Ejemplo n.º 1
0
 /**
  * 注册已挂靠的视图函数
  */
 public function addfuncs()
 {
     if (is_array($GLOBALS['G']["view_registered_functions"])) {
         foreach ($GLOBALS['G']["view_registered_functions"] as $alias => $func) {
             if (is_array($func) && !is_object($func[0])) {
                 $func = array(gClass($func[0]), $func[1]);
             }
             $this->engine->registerPlugin("function", $alias, $func);
             unset($GLOBALS['G']["view_registered_functions"][$alias]);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * 魔术函数,实现对控制器扩展类的自动加载
  */
 public function __call($name, $args)
 {
     if (in_array($name, $GLOBALS['G']["auto_load_controller"])) {
         return gClass($name)->__input($args);
     } elseif (!method_exists($this, $name)) {
         gError("方法 {$name}未定义!<br />请检查是否控制器类(" . get_class($this) . ")与数据模型类重名?");
     }
 }
Ejemplo n.º 3
0
 /**
  * 魔术函数,执行模型扩展类的自动加载及使用
  */
 public function __call($name, $args)
 {
     if (in_array($name, $GLOBALS['G']["auto_load_model"])) {
         return gClass($name)->__input($this, $args);
     } elseif (!method_exists($this, $name)) {
         gError("方法 {$name} 未定义");
     }
 }
Ejemplo n.º 4
0
/** gLaunch  执行挂靠程序
 *
 * @param configname    挂靠程序设置点名称
 * @param launchargs    挂靠参数
 * @param return    是否存在返回数据,如需要返回,则该挂靠点仅能有一个挂靠操作
 */
function gLaunch($configname, $launchargs = null, $returns = FALSE)
{
    if (isset($GLOBALS['G']['launch'][$configname]) && is_array($GLOBALS['G']['launch'][$configname])) {
        foreach ($GLOBALS['G']['launch'][$configname] as $launch) {
            if (is_array($launch)) {
                $reval = gClass($launch[0])->{$launch[1]}($launchargs);
            } else {
                $reval = call_user_func_array($launch, $launchargs);
            }
            if (TRUE == $returns) {
                return $reval;
            }
        }
    }
    return false;
}
Ejemplo n.º 5
0
 function clk()
 {
     $extid = isset($GLOBALS['G']['url_args'][0]) ? trim($GLOBALS['G']['url_args'][0]) : '';
     if (empty($extid)) {
         exit;
     }
     if (gClass('ExtStorage')->incrField(array('crx_id' => $extid), 'download', 1)) {
         echo 'ok';
     }
 }
Ejemplo n.º 6
0
 /**
  * 获取分享弹出框html,同时需要读取用户相互关注粉丝
  */
 function ajax_share_content()
 {
     $id = @$GLOBALS['G']['url_args'][0];
     if (empty($id)) {
         exit;
     }
     $_SESSION['share_id'] = $id;
     if (@$_SESSION['islogined']) {
         $token = ck::get('token');
         $c = new SaeTClientV2(Sconfig::$weibo['APPKEY'], Sconfig::$weibo['APPSECRET'], $token['access_token']);
         //TODO: 获取用户互相关注用户列表
         $friends = $c->bilateral($token['uid'], 1, 100);
         $this->friends = $friends['users'];
         $ext_info = gClass('ExtStorage')->find_one($id);
         $detailpicArr = json_decode($ext_info['descpic'], true);
         $ext_info['detailpic'] = $detailpicArr[0];
         $this->ext_info = $ext_info;
         //授权用户详细信息
         $userinfo = $c->show_user_by_id($token['uid']);
         //取得微博发布内容
         require SITE_PATH . 'include/weibo_content.php';
         $this->weibo_content = rand_content($cfg_content, $this->ext_info);
         $nick = !empty($userinfo['screen_name']) ? $userinfo['screen_name'] : $userinfo['name'];
         exit(json_encode(array('status' => 'success', 'html' => $this->display('extensions/share.html', false), 'nick' => $nick)));
     }
     exit(json_encode(array('status' => 'error', 'msg' => '未登录')));
 }