/** * 模板显示 调用内置的模板引擎显示方法, * @access protected * @param string $templateFile 指定要调用的模板文件 * @return void */ protected function display($template) { $file = T('Addons://' . parse_name($_GET['_addons'], 1) . '@./' . ucfirst($_GET['_controller']) . '/' . $_GET['_action']); define('IS_ADDON', true); parent::display($file); // 重要:要避免陷入$this->display()循环 }
public function getRoute() { // Retrieve the URI if (strlen($this->_basepath) > 1) { // Local Server $uri = str_replace($this->_basepath, "", $_SERVER['REQUEST_URI']); } else { // AWS Server $uri = substr($_SERVER['REQUEST_URI'], 1); } // If the user is not logged in, go back to Home. if ($uri != 'Login') { if (!isset($_SESSION['loggedin'])) { $uri = 'Home'; } } if (strrpos($uri, '/') !== false) { $uri = explode('/', $uri); $id = $uri[1]; $uri = $uri[0] . '-'; } // Calls the appropriate controller based on the URI. switch ($uri) { case 'Home': $home = new HomeController(); $home->display(); break; case 'Account-Summary': $summary = new SummaryController(); $summary->display(); break; case 'Transaction-History-': $_SESSION['accountID'] = $id; $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Transaction-History"); break; case 'Transaction-History': $history = new HistoryController(); $history->display(); break; case 'Account-Details-': $_SESSION['detAccountID'] = $id; $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Account-Details"); break; case 'Account-Details': $details = new DetailsController(); $details->display(); break; case 'New-Bill-Payment-': $payment = new Paymentamt(); $payment->setAccountSelected($id); $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "New-Bill-Payment"); break; case 'New-Bill-Payment': $payment = new PaymentController(); $payment->display(); break; case 'Bill-Payment-Amount': $paymentamt = new PaymentamtController(); $paymentamt->display(); break; case 'Bill-Payment-Confirmation': $paymentconf = new PaymentconfController(); $paymentconf->display(); break; case 'Bill-Payment-Acknowledgement': $paymentack = new PaymentackController(); $paymentack->display(); break; case 'Payment-List': $paymentlist = new PaymentlistController(); $paymentlist->display(); break; case 'Bill-Payment-List': $_SESSION['billPayment'] = true; unset($_SESSION['fundsTransferPayment']); $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Payment-List"); break; case 'Funds-Transfer-Payment-List': $_SESSION['fundsTransferPayment'] = true; unset($_SESSION['billPayment']); $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Payment-List"); break; case 'Payee-List': $payeelist = new PayeelistController(); $payeelist->display(); break; case 'Bill-Payee-List': $_SESSION['billPayee'] = true; unset($_SESSION['fundsTransferPayee']); $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Payee-List"); break; case 'Funds-Transfer-Payee-List': $_SESSION['fundsTransferPayee'] = true; unset($_SESSION['billPayee']); $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Payee-List"); break; case 'Biller-Add': $billeradd = new BilleraddController(); $billeradd->display(); break; case 'Biller-Modify-': $_SESSION['billerModifyID'] = $id; $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Biller-Modify"); break; case 'Biller-Modify': $billermodify = new BillermodifyController(); $billermodify->display(); break; case 'Biller-Delete-': $_SESSION['billerDeleteID'] = $id; $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Biller-Delete"); break; case 'Biller-Delete': $billerdelete = new BillerdeleteController(); $billerdelete->display(); break; case 'New-Funds-Transfer-': $transfer = new CheckTransfer(); $transfer->setAccountSelected($id); $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "New-Funds-Transfer"); break; case 'New-Funds-Transfer': $transfer = new TransferController(); $transfer->display(); break; case 'Check-Transfer': $checktransfer = new ChecktransferController(); $checktransfer->display(); break; case 'Funds-Transfer-Acknowledgement': $transferack = new TransferackController(); $transferack->display(); break; case 'Payee-Add': $payeeadd = new PayeeaddController(); $payeeadd->display(); break; case 'Payee-Modify-': $_SESSION['payeeModifyID'] = $id; $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Payee-Modify"); break; case 'Payee-Modify': $payeemodify = new PayeemodifyController(); $payeemodify->display(); break; case 'Payee-Delete-': $_SESSION['payeeDeleteID'] = $id; $pos = strrpos($_SERVER['HTTP_REFERER'], '/'); $pos = strlen($_SERVER['HTTP_REFERER']) - $pos; header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "Payee-Delete"); break; case 'Payee-Delete': $payeedelete = new PayeedeleteController(); $payeedelete->display(); break; case 'Login': $login = new LoginController(); $login->login(); break; case 'Logout': $logout = new LoginController(); $logout->logout(); break; default: $home = new HomeController(); $home->display(); break; } }
<?php //-+---------------------------------------------------------------------------------------------+ // A Simple and Innovative PHP Framework about Foreign Trade E-commerce @2015-07-01 Version 1.0 // 一个简单和创新的PHP框架,为外贸电子商务开发, 始于中国共产党建党日,7月1日,版本1.0 //-+---------------------------------------------------------------------------------------------+ // Update from/更新地址@https://github.com/HollenMok/pandoraf_v1.0 //-+---------------------------------------------------------------------------------------------+ // Display on/项目效果展示地址 @http://www.pandoraf.com //-+---------------------------------------------------------------------------------------------+ // Apache License/开源许可协议 @http://www.apache.org/licenses/LICENSE-2.0 //-+---------------------------------------------------------------------------------------------+ // Document support multi-language, aim to invite people worldwide join this project // 文档目标是支持多语言,让全世界的人有机会了解并参加设计这个项目,目前只支持中文与英语。 //-+---------------------------------------------------------------------------------------------+ require 'controller.php'; $controller = new HomeController(); if ($task) { $controller->{$task}(); } else { $controller->display(); }