Delete PAGILauncher.php file for security testing
Showing
1 changed file
with
0 additions
and
56 deletions
| 1 | <?php | ||
| 2 | /** | ||
| 3 | * This is our "dispatcher", you should invoke this one from your dialplan. | ||
| 4 | * This script will assume the existance of the following environment variables: | ||
| 5 | * -- PAGIApplication: Name of the class that extends PAGIApplication that you | ||
| 6 | * want to run. | ||
| 7 | * -- PAGIBootstrap: Name of the file (like a.php) that you want to include_once | ||
| 8 | * before running the application. | ||
| 9 | * | ||
| 10 | * PHP Version 5 | ||
| 11 | * | ||
| 12 | * @category Pagi | ||
| 13 | * @package Application | ||
| 14 | * @author Marcelo Gornstein <[email protected]> | ||
| 15 | * @license http://marcelog.github.com/PAGI/ Apache License 2.0 | ||
| 16 | * @version SVN: $Id$ | ||
| 17 | * @link http://marcelog.github.com/PAGI/ | ||
| 18 | * | ||
| 19 | * Copyright 2011 Marcelo Gornstein <[email protected]> | ||
| 20 | * | ||
| 21 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 22 | * you may not use this file except in compliance with the License. | ||
| 23 | * You may obtain a copy of the License at | ||
| 24 | * | ||
| 25 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 26 | * | ||
| 27 | * Unless required by applicable law or agreed to in writing, software | ||
| 28 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 30 | * See the License for the specific language governing permissions and | ||
| 31 | * limitations under the License. | ||
| 32 | * | ||
| 33 | */ | ||
| 34 | use PAGI\Application\Exception\InvalidApplicationException; | ||
| 35 | use PAGI\Application\PAGIApplication; | ||
| 36 | |||
| 37 | $appName = getenv('PAGIApplication'); | ||
| 38 | $bootstrap = getenv('PAGIBootstrap'); | ||
| 39 | $myApp = ''; | ||
| 40 | try { | ||
| 41 | |||
| 42 | // include_once $bootstrap; | ||
| 43 | if (!class_exists($appName, true)) { | ||
| 44 | throw new \Exception($appName . ' is not loaded'); | ||
| 45 | } | ||
| 46 | $rClass = new ReflectionClass($appName); | ||
| 47 | if (!$rClass->isSubclassOf('PAGI\\Application\\PAGIApplication')) { | ||
| 48 | throw new \Exception($appName . ': Invalid application'); | ||
| 49 | } | ||
| 50 | $agi = PAGI\Client\Impl\ClientImpl::getInstance(); | ||
| 51 | $myApp = new $appName(array('pagiClient' => $agi)); | ||
| 52 | $myApp->init(); | ||
| 53 | $myApp->run(); | ||
| 54 | } catch (\Exception $e) { | ||
| 55 | $myApp->log($e); | ||
| 56 | } |
-
Please register or sign in to post a comment