Example #1
0
 public function handleSetting($event)
 {
     $settings = Setting::model()->fetchAllSetting();
     $this->_setting =& $settings;
     $this->handleCredits();
     $this->handleCreditsFormula();
     $this->_setting["verhash"] = StringUtil::random(3);
     Syscache::model()->modify("setting", $settings);
 }
Example #2
0
 public function handleUsers($event)
 {
     $users = array();
     $records = User::model()->fetchAll(array("condition" => "status IN (0,1)"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $users[$record["uid"]] = UserUtil::wrapUserInfo($record);
         }
     }
     Syscache::model()->modify("users", $users);
 }
Example #3
0
 private function nextCron()
 {
     $cron = Cron::model()->fetchByNextCron();
     if ($cron && isset($cron["nextrun"])) {
         $data = $cron["nextrun"];
     } else {
         $data = TIMESTAMP + 86400 * 365;
     }
     Syscache::model()->modify("cronnextrun", $data);
     return true;
 }
 public function handleDepartment($event)
 {
     $departments = array();
     $records = Department::model()->findAll(array("order" => "sort ASC"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $dept = $record->attributes;
             $departments[$dept["deptid"]] = $dept;
         }
     }
     Syscache::model()->modify("department", $departments);
 }
 public function handleCreditRule($event)
 {
     $rules = array();
     $records = CreditRule::model()->fetchAll();
     if (!empty($records)) {
         foreach ($records as $rule) {
             $rule["rulenameuni"] = urlencode(ConvertUtil::iIconv($rule["rulename"], CHARSET, "UTF-8", true));
             $rules[$rule["action"]] = $rule;
         }
     }
     Syscache::model()->modify("creditrule", $rules);
 }
 public function handleUserGroup($event)
 {
     $usergroup = array();
     $records = UserGroup::model()->findAll(array("order" => "creditslower ASC"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $group = $record->attributes;
             $usergroup[$group["gid"]] = $group;
         }
     }
     Syscache::model()->modify("usergroup", $usergroup);
 }
 public function handlePositionCategory($event)
 {
     $categorys = array();
     $records = PositionCategory::model()->findAll(array("order" => "sort ASC"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $cat = $record->attributes;
             $categorys[$cat["catid"]] = $cat;
         }
     }
     Syscache::model()->modify("positioncategory", $categorys);
 }
Example #8
0
function handleLoadSysCache()
{
    $caches = Syscache::model()->fetchAll();
    foreach ($caches as $cache) {
        $value = $cache["type"] == "1" ? unserialize($cache["value"]) : $cache["value"];
        if ($cache["name"] == "setting") {
            Ibos::app()->setting->set("setting", $value);
        } else {
            Ibos::app()->setting->set("cache/" . $cache["name"], $value);
        }
    }
}
 public function handleArticleCategory($event)
 {
     $categorys = array();
     Yii::import("application.modules.article.model.ArticleCategory", true);
     $records = ArticleCategory::model()->findAll(array("order" => "sort ASC"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $cat = $record->attributes;
             $categorys[$cat["catid"]] = $cat;
         }
     }
     Syscache::model()->modify("articlecategory", $categorys);
 }
 public function handleOfficialdocCategory($event)
 {
     $categorys = array();
     Yii::import("application.modules.officialdoc.model.OfficialdocCategory");
     $records = OfficialdocCategory::model()->findAll(array("order" => "sort ASC"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $cat = $record->attributes;
             $categorys[$cat["catid"]] = $cat;
         }
     }
     Syscache::model()->modify("officialdoccategory", $categorys);
 }
Example #11
0
 public function handleIpbanned($event)
 {
     IpBanned::model()->DeleteByExpiration(TIMESTAMP);
     $data = array();
     $bannedArr = IpBanned::model()->fetchAll();
     if (!empty($bannedArr)) {
         $data["expiration"] = 0;
         $data["regexp"] = $separator = "";
     }
     foreach ($bannedArr as $banned) {
         $data["expiration"] = !$data["expiration"] || $banned["expiration"] < $data["expiration"] ? $banned["expiration"] : $data["expiration"];
         $data["regexp"] .= $separator . ($banned["ip1"] == "-1" ? "\\d+\\." : $banned["ip1"] . "\\.") . ($banned["ip2"] == "-1" ? "\\d+\\." : $banned["ip2"] . "\\.") . ($banned["ip3"] == "-1" ? "\\d+\\." : $banned["ip3"] . "\\.") . ($banned["ip4"] == "-1" ? "\\d+" : $banned["ip4"]);
         $separator = "|";
     }
     Syscache::model()->modify("ipbanned", $data);
 }
Example #12
0
 public function handleAuthItem($event)
 {
     $categorys = array();
     $nodes = Node::model()->fetchAllEmptyNode();
     foreach ($nodes as $node) {
         if (empty($node["category"])) {
             continue;
         }
         $category = base64_encode($node["category"]);
         $categorys[$category]["category"] = $node["category"];
         if ($node["type"] == "data" && empty($node["node"])) {
             $node["node"] = Node::model()->fetchAllNotEmptyNodeByModuleKey($node["module"], $node["key"]);
         }
         if (!empty($node["group"])) {
             $group = base64_encode($node["group"]);
             $categorys[$category]["group"][$group]["groupName"] = $node["group"];
             $categorys[$category]["group"][$group]["node"][] = $node;
         } else {
             $categorys[$category]["node"][] = $node;
         }
     }
     Syscache::model()->modify("authitem", $categorys);
 }
Example #13
0
 public function handleNav($event)
 {
     $navs = Nav::model()->fetchAllByAllPid();
     Syscache::model()->modify("nav", $navs);
 }
Example #14
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();
 }
Example #15
0
 public function handlePosition($event)
 {
     $records = Position::model()->fetchAllSortByPk("positionid");
     Syscache::model()->modify("position", $records);
 }
Example #16
0
 public function makeCache($users)
 {
     Syscache::model()->modify("users", $users);
     CacheUtil::load("users");
 }
Example #17
0
 public static function save($cacheName, $value)
 {
     Syscache::model()->addCache($cacheName, $value);
 }