예제 #1
0
파일: base.php 프로젝트: noikiy/cunkou
 /**
  * 控制器调度
  *
  */
 private static function control()
 {
     //二级域名
     if ($GLOBALS['setting_config']['enabled_subdomain'] == '1' && $_GET['act'] == 'index' && $_GET['op'] == 'index') {
         $store_id = subdomain();
         if ($store_id > 0) {
             $_GET['act'] = 'show_store';
         }
     }
     $act_file = realpath(BASE_PATH . '/control/' . $_GET['act'] . '.php');
     $class_name = $_GET['act'] . 'Control';
     if (!@(include $act_file)) {
         if (C('debug')) {
             throw_exception("Base Error: access file isn't exists!");
         } else {
             showMessage('抱歉!您访问的页面不存在', '', 'html', 'error');
         }
     }
     if (class_exists($class_name)) {
         $main = new $class_name();
         $function = $_GET['op'] . 'Op';
         if (method_exists($main, $function)) {
             $main->{$function}();
         } elseif (method_exists($main, 'indexOp')) {
             $main->indexOp();
         } else {
             $error = "Base Error: function {$function} not in {$class_name}!";
             throw_exception($error);
         }
     } else {
         $error = "Base Error: class {$class_name} isn't exists!";
         throw_exception($error);
     }
 }
예제 #2
0
function img_resoure($dir, $width = 0, $height = 0, $domain = 'resource_url', $returnDirOnly = true, $alt = '')
{
    $CI_ =& get_instance();
    if (!$dir) {
        $dir = 'no-image.jpg';
    }
    if (!preg_match('!^\\w+://! i', $dir)) {
        $path = pathinfo($dir);
        if (!$domain) {
            $domain = 'resource_url';
        }
        $resourcePath = subdomain($domain) . '/';
        if ($path['dirname'] && $path['dirname'] != '.') {
            $resourcePath .= base64_encode($path['dirname']) . '/';
        }
        if ($width && $width > 0) {
            $resourcePath .= "w{$width}/";
        }
        $resourcePath .= $path['basename'];
    } else {
        $resourcePath = $dir;
    }
    //$img = ( ! preg_match('!^\w+://! i', $dir)) ? 'deal/'.$deal->image : $deal->image;
    if ($returnDirOnly == true) {
        return $resourcePath;
    } else {
        return '<img alt="' . $alt . '" src="' . $resourcePath . '"  />';
    }
}
예제 #3
0
 function input($key, $data, $view = 'default')
 {
     // 		bug($data);exit;
     $directory = isset($data->dir) && $data->dir ? $data->dir : '';
     $resourceURL = subdomain('resource_url');
     $input = '<div class="' . self::protection($key) . '" ><input type="text" name="' . self::protection($key) . '" value="' . $data->value . '" class="field" readonly  />' . self::ui('button', lang('Select Image'), array('class' => "select-image")) . self::ui('button', lang('Upload'), array('class' => "upload-image")) . '</div>';
     $script = ' img.action("' . self::protection($key) . '","' . subdomain('resource_url') . '","' . (isset($data->dir) && $data->dir != '' ? $data->dir : '') . '"); ';
     $this->CI->template->add_js_ready($script);
     // 		}
     //$input = parent::inputSelect($key,null,self::$val,false,'class="gender"');
     if ($view == 'val') {
         return self::$val[$data->value];
     } else {
         return self::rowForm($data->title, $input);
     }
 }
예제 #4
0
파일: base.php 프로젝트: my1977/shopnc
 private static function control()
 {
     if (defined("ProjectName") && ProjectName != "") {
         $act_file = BasePath . DS . ProjectName . DS . "control" . DS . $_GET['act'] . ".php";
     } else {
         if ($GLOBALS['setting_config']['enabled_subdomain'] == "1" && $_GET['act'] == "index" && $_GET['op'] == "index") {
             $store_id = subdomain();
             if (0 < $store_id) {
                 $GLOBALS['_GET']['act'] = "show_store";
             }
         }
         //$_GET['act'] = isset($_GET['act']) ? strtolower( $_GET['act'] ) : isset($_POST['act']) ? strtolower( $_POST['act'] ) : "index";
         //$_GET['op'] = isset($_GET['op']) ? strtolower( $_GET['op'] ) : isset($_POST['op']) ? strtolower( $_POST['op'] ) : "index";
         $act_file = BasePath . DS . "control" . DS . $_GET['act'] . ".php";
         //echo '2';
     }
     //    var_dump($act_file);echo '<br />';
     //        var_dump($_GET);echo '<br />';
     //        var_dump($GLOBALS['_GET']);echo '<br />';
     //var_dump(ProjectName);
     if (is_file($act_file)) {
         require $act_file;
         $class_name = $_GET['act'] . "Control";
         if (class_exists($class_name)) {
             $main = new $class_name();
             $function = $_GET['op'] . "Op";
             if (method_exists($main, $function)) {
                 $main->{$function}();
             } else {
                 if (method_exists($main, "indexOp")) {
                     $main->indexOp();
                 } else {
                     $error = "Base Error: function " . $function . " not in {$class_name}!";
                     throw_exception($error);
                 }
             }
         } else {
             $error = "Base Error: class " . $class_name . " isn't exists!";
             throw_exception($error);
         }
     } else {
         $error = "Base Error: access file isn't exists!";
         throw_exception($error);
     }
 }
예제 #5
0
파일: base.php 프로젝트: noikiy/shopnc-2
 /**
  * 控制器调度
  *
  */
 private static function control()
 {
     //二级域名
     if ($GLOBALS['setting_config']['enabled_subdomain'] == '1' && $_GET['act'] == 'index' && $_GET['op'] == 'index') {
         $store_id = subdomain();
         if ($store_id > 0) {
             $_GET['act'] = 'store';
         }
     }
     $act_file = realpath(BASE_PATH . '/control/' . $_GET['act'] . '.php');
     if (is_file($act_file)) {
         require $act_file;
         $class_name = $_GET['act'] . 'Control';
         if (class_exists($class_name)) {
             $main = new $class_name();
             $function = $_GET['op'] . 'Op';
             if (method_exists($main, $function)) {
                 $main->{$function}();
             } elseif (method_exists($main, 'indexOp')) {
                 $main->indexOp();
             } else {
                 $error = "Base Error: function {$function} not in {$class_name}!";
                 throw_exception($error);
             }
         } else {
             $error = "Base Error: class {$class_name} isn't exists!";
             throw_exception($error);
         }
     } else {
         $error = "Base Error: access file isn't exists!";
         throw_exception($error);
     }
 }