コード例 #1
0
ファイル: EnvUtil.php プロジェクト: AxelPanda/ibos
 public static function ipBanned($onlineip)
 {
     CacheUtil::load("ipbanned");
     $ipBanned = Ibos::app()->setting->get("cache/ipbanned");
     if (empty($ipBanned)) {
         return false;
     } else {
         if ($ipBanned["expiration"] < TIMESTAMP) {
             CacheUtil::update("ipbanned");
             CacheUtil::load("ipbanned", true);
             $ipBanned = Ibos::app()->setting->get("cache/ipbanned");
         }
         return preg_match("/^(" . $ipBanned["regexp"] . ")\$/", $onlineip);
     }
     return preg_match("/^(" . $ipBanned["regexp"] . ")\$/", $onlineip);
 }
コード例 #2
0
ファイル: OrgUtil.php プロジェクト: AxelPanda/ibos
 private static function createStaticJs()
 {
     CacheUtil::load(array("department", "position"), true);
     $unit = Ibos::app()->setting->get("setting/unit");
     $department = DepartmentUtil::loadDepartment();
     $users = UserUtil::loadUser();
     $position = PositionUtil::loadPosition();
     $positionCategory = PositionUtil::loadPositionCategory();
     $companyData = self::initCompany($unit);
     $deptData = self::initDept($department);
     $userData = self::initUser($users);
     $posData = self::initPosition($position);
     $posCatData = self::initPositionCategory($positionCategory);
     $default = file_get_contents(PATH_ROOT . "/static/js/src/org.default.js");
     if ($default) {
         $patterns = array("/\\{\\{(company)\\}\\}/", "/\\{\\{(department)\\}\\}/", "/\\{\\{(position)\\}\\}/", "/\\{\\{(users)\\}\\}/", "/\\{\\{(positioncategory)\\}\\}/");
         $replacements = array($companyData, $deptData, $posData, $userData, $posCatData);
         $new = preg_replace($patterns, $replacements, $default);
         FileUtil::createFile("data/org.js", $new);
         CacheUtil::update("setting");
     }
 }
コード例 #3
0
ファイル: index.php プロジェクト: AxelPanda/ibos
        $replace = array(time(), strtotime('-1 hour'), strtotime('+1 hour'), strtotime(date('Y-m-d')), strtotime('-1 day', strtotime(date('Y-m-d'))));
        $sql = str_replace($search, $replace, $sqlData);
        executeSql($sql);
        unset($_SESSION['extData']);
    }
    // 安装工作流数据
    if (getIsInstall('workflow')) {
        $sqlFlowData = file_get_contents(PATH_ROOT . './install/data/installFlow.sql');
        executeSql($sqlFlowData);
    }
    session_destroy();
    $cacheArr = array('AuthItem', 'CreditRule', 'Department', 'Ipbanned', 'Nav', 'NotifyNode', 'Position', 'PositionCategory', 'Setting', 'UserGroup');
    foreach ($cacheArr as $cache) {
        CacheUtil::update($cache);
    }
    CacheUtil::load('usergroup');
    // 要注意小写
    CacheUtil::update('Users');
    // 因为用户缓存要依赖usergroup缓存,所以放在最后单独更新
    file_put_contents(PATH_ROOT . 'data/install.lock', '');
    $configfile = CONFIG_PATH . 'config.php';
    $config = (require $configfile);
    include 'extInfo.php';
    exit;
} elseif ($option == 'tablepreCheck') {
    $dbHost = $_POST['dbHost'];
    $dbAccount = $_POST['dbAccount'];
    $dbPassword = $_POST['dbPassword'];
    $dbName = $_POST['dbName'];
    $tablePre = $_POST['tablePre'];
    if (!function_exists('mysql_connect')) {
コード例 #4
0
ファイル: Department.php プロジェクト: AxelPanda/ibos
 public function afterDelete()
 {
     CacheUtil::update("department");
     CacheUtil::load("department");
     parent::afterDelete();
 }
コード例 #5
0
ファイル: Position.php プロジェクト: AxelPanda/ibos
 public function afterDelete()
 {
     CacheUtil::update("position");
     CacheUtil::load("position");
     parent::afterDelete();
 }
コード例 #6
0
 public function afterSave()
 {
     $pk = $this->getPrimaryKey();
     if ($pk) {
         $category = Yii::app()->setting->get("officialdoccategory");
         $attr = $this->getAttributes();
         $category[$pk] = $attr;
         Syscache::model()->modify("officialdoccategory", $category);
         CacheUtil::load("officialdoccategory", true);
     }
     parent::afterSave();
 }
コード例 #7
0
ファイル: User.php プロジェクト: AxelPanda/ibos
 public function makeCache($users)
 {
     Syscache::model()->modify("users", $users);
     CacheUtil::load("users");
 }
コード例 #8
0
ファイル: UserUtil.php プロジェクト: AxelPanda/ibos
 public static function wrapUserInfo($user)
 {
     $user["group_title"] = "";
     $user["next_group_credit"] = $user["upgrade_percent"] = 0;
     $currentGroup = !empty($user["groupid"]) ? UserGroup::model()->fetchByPk($user["groupid"]) : array();
     if (!empty($currentGroup)) {
         $user["group_title"] = $currentGroup["title"];
         if ($currentGroup["creditslower"] !== "0") {
             $user["upgrade_percent"] = round((double) $user["credits"] / $currentGroup["creditslower"] * 100, 2);
         }
         $user["next_group_credit"] = (int) $currentGroup["creditslower"];
     }
     $user["level"] = self::getUserLevel($user["groupid"]);
     CacheUtil::load(array("department", "position"));
     $position = PositionUtil::loadPosition();
     $department = DepartmentUtil::loadDepartment();
     if (0 < $user["deptid"]) {
         $relatedDeptId = DepartmentRelated::model()->fetchAllDeptIdByUid($user["uid"]);
         $deptIds = array_merge((array) $relatedDeptId, array($user["deptid"]));
         $user["alldeptid"] = implode(",", array_unique($deptIds));
         $user["allupdeptid"] = Department::model()->queryDept($user["alldeptid"]);
         $user["alldowndeptid"] = Department::model()->fetchChildIdByDeptids($user["alldeptid"]);
         $user["relatedDeptId"] = implode(",", $relatedDeptId);
         $user["deptname"] = isset($department[$user["deptid"]]) ? $department[$user["deptid"]]["deptname"] : "";
     } else {
         $user["alldeptid"] = $user["allupdeptid"] = $user["alldowndeptid"] = $user["relatedDeptId"] = $user["deptname"] = "";
     }
     if (0 < $user["positionid"]) {
         $relatedPosId = PositionRelated::model()->fetchAllPositionIdByUid($user["uid"]);
         $posIds = array_merge(array($user["positionid"]), (array) $relatedPosId);
         $user["allposid"] = implode(",", array_unique($posIds));
         $user["relatedPosId"] = implode(",", $relatedPosId);
         $user["posname"] = isset($position[$user["positionid"]]) ? $position[$user["positionid"]]["posname"] : "";
     } else {
         $user["allposid"] = $user["relatedPosId"] = $user["posname"] = "";
     }
     $user["space_url"] = "?r=user/home/index&uid=" . $user["uid"];
     $user["avatar_middle"] = "avatar.php?uid={$user["uid"]}&size=middle&engine=" . ENGINE;
     $user["avatar_small"] = "avatar.php?uid={$user["uid"]}&size=small&engine=" . ENGINE;
     $user["avatar_big"] = "avatar.php?uid={$user["uid"]}&size=big&engine=" . ENGINE;
     $user["bg_big"] = "bg.php?uid={$user["uid"]}&size=big&engine=" . ENGINE;
     $user["bg_small"] = "bg.php?uid={$user["uid"]}&size=small&engine=" . ENGINE;
     $profile = UserProfile::model()->fetchByUid($user["uid"]);
     $user = array_merge($user, (array) $profile);
     return $user;
 }
コード例 #9
0
ファイル: CreditUtil.php プロジェクト: AxelPanda/ibos
 public function getRule($action)
 {
     if (empty($action)) {
         return false;
     }
     CacheUtil::load("creditrule");
     $caches = Ibos::app()->setting->get("cache/creditrule");
     $extcredits = $this->getExtCredits();
     $rule = false;
     if (is_array($caches[$action])) {
         $rule = $caches[$action];
         for ($i = 1; $i <= 5; $i++) {
             if (empty($extcredits[$i])) {
                 unset($rule["extcredits" . $i]);
                 continue;
             }
             $rule["extcredits" . $i] = intval($rule["extcredits" . $i]);
         }
     }
     return $rule;
 }
コード例 #10
0
ファイル: HomeController.php プロジェクト: AxelPanda/ibos
 protected function getCreditLog()
 {
     CacheUtil::load(array("creditrule"));
     $creditRule = CreditRule::model()->fetchAllSortByPk("rid");
     $credits = Ibos::app()->setting->get("setting/extcredits");
     $relateRules = CreditRuleLog::model()->fetchAllByAttributes(array("uid" => $this->getUid()));
     $criteria = array("condition" => "`uid` = :uid", "params" => array(":uid" => $this->getUid()), "order" => "dateline DESC");
     $count = CreditLog::model()->count($criteria);
     $pages = PageUtil::create($count, 20);
     $criteria["limit"] = 20;
     $criteria["offset"] = $pages->getOffset();
     $creditLog = CreditLog::model()->fetchAll($criteria);
     return array("creditLog" => $creditLog, "relateRules" => $relateRules, "credits" => $credits, "creditRule" => $creditRule, "pages" => $pages);
 }