Exemplo n.º 1
0
<?php

import("ORG.Text.Validation");
import("ORG.Util.HashMap");
include_cache("./Include/Page.class.php");
class BaseAction extends Action
{
    var $mid;
    //当前登陆的用户ID = mid
    var $uid;
    //当前浏览的用户ID = uid
    protected function _initialize()
    {
        //判断用户登录
        $this->mid = Session::get("mid");
        $this->uid = $_REQUEST['uid'];
        if (empty($this->mid)) {
            //登陆验证
            $this->redirect("checklogin", "Public");
            exit;
        }
        if (empty($this->uid)) {
            $this->uid = $this->mid;
        }
        //未读短信条数
        $msgCount = D("Message")->count("toUserId=" . $this->mid . " and status=0");
        //在线状态
        //$online	=	$this->checkOnline();
        $networkId = D('User')->find($this->mid, 'networkId')->networkId;
        if (empty($networkId)) {
            $networkId = 1;
Exemplo n.º 2
0
 /**
 +----------------------------------------------------------
 * 加载插件
 +----------------------------------------------------------
 * @access private 
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 private function loadPlugIn()
 {
     // 如果存在缓存插件数据,直接包含
     if (file_exists(CONFIG_PATH . '_plugins.php')) {
         $plugins = (include CONFIG_PATH . '_plugins.php');
     } else {
         // 检查插件数据
         $common_plugins = get_plugins(THINK_PATH . '/PlugIns', 'Think');
         // 公共插件
         $app_plugins = get_plugins();
         // 项目插件
         // 合并插件数据
         $plugins = array_merge($common_plugins, $app_plugins);
         // 缓存插件数据
         $content = "<?php\nreturn " . var_export($plugins, true) . ";\n?>";
         file_put_contents(CONFIG_PATH . '_plugins.php', $content);
     }
     //加载有效插件文件
     foreach ($plugins as $key => $val) {
         include_cache($val['file']);
     }
     return;
 }