Beispiel #1
0
 public static function run($args = NULL, $prefix = "do_")
 {
     self::init();
     $app = $_GET['app'];
     $app or $app = 'home';
     //in_array($app, self::$apps) OR iPHP::throwException('运行出错!找不到应用程序:' . $app, 1001);
     $do or $do = $_GET['do'] ? (string) $_GET['do'] : 'iCMS';
     if ($_POST['action']) {
         $do = $_POST['action'];
         $prefix = 'ACTION_';
     }
     self::$app_name = $app;
     self::$app_do = $do;
     self::$app_method = $prefix . $do;
     self::$app_path = ACP_PATH;
     self::$app_tpl = ACP_PATH . '/template';
     self::$app_file = ACP_PATH . '/' . $app . '.app.php';
     define('APP_URI', __ADMINCP__ . '=' . $app);
     define('APP_FURI', APP_URI . '&frame=iPHP');
     define('APP_DOURI', APP_URI . ($do != 'iCMS' ? '&do=' . $do : ''));
     define('APP_BOXID', self::$app_name . '-box');
     define('APP_FORMID', 'iCMS-' . APP_BOXID);
     is_file(self::$app_file) or iPHP::throwException('运行出错!找不到文件: <b>' . self::$app_name . '.app.php</b>', 1002);
     iPHP::import(self::$app_file);
     $appName = self::$app_name . 'App';
     self::$app = new $appName();
     $app_methods = get_class_methods($appName);
     in_array(self::$app_method, $app_methods) or iPHP::throwException('运行出错! <b>' . self::$app_name . '</b> 类中找不到方法定义: <b>' . self::$app_method . '</b>', 1003);
     $method = self::$app_method;
     $args === null && ($args = self::$app_args);
     if ($args) {
         if ($args === 'object') {
             return self::$app;
         }
         return self::$app->{$method}($args);
     } else {
         return self::$app->{$method}();
     }
 }
Beispiel #2
0
 function do_list()
 {
     iACP::$app_do = 'list';
     $sql = " where `appid`='{$this->appid}'";
     $cids = iACP::CP('__CID__');
     $sql .= iPHP::where($cids, 'cid');
     if ($_GET['keywords']) {
         if ($_GET['st'] == "name") {
             $sql .= " AND `name` REGEXP '{$_GET['keywords']}'";
         } else {
             if ($_GET['st'] == "cid") {
                 $sql .= " AND `cid` REGEXP '{$_GET['keywords']}'";
             } else {
                 if ($_GET['st'] == "tkd") {
                     $sql .= " AND CONCAT(name,title,keywords,description) REGEXP '{$_GET['keywords']}'";
                 }
             }
         }
     }
     if (isset($_GET['rootid']) && $_GET['rootid'] != '-1') {
         $sql .= " AND `rootid`='{$_GET['rootid']}'";
     }
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "cid DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__category` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage);
     $rs = iDB::all("SELECT * FROM `#iCMS@__category` {$sql} order by {$orderby} LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("category.manage");
 }
Beispiel #3
0
 function do_iCMS()
 {
     iACP::$app_do = "manage";
     $this->do_manage();
 }