public function actionUpdate() { if (EnvUtil::submitCheck("formhash")) { $fieldArr = array("reporttypemanage" => "", "stampenable" => 0, "stampdetails" => "", "pointsystem" => 5, "autoreview" => 0, "autoreviewstamp" => 1); foreach ($_POST as $key => $value) { if (in_array($key, array_keys($fieldArr))) { $fieldArr[$key] = $value; } } $stampStr = ""; if (!empty($fieldArr["stampdetails"])) { foreach ($fieldArr["stampdetails"] as $score => $stampId) { $stampId = empty($stampId) ? 0 : $stampId; $stampStr .= $stampId . ":" . $score . ","; } } $fieldArr["stampdetails"] = rtrim($stampStr, ","); $apprise = EnvUtil::getRequest("apprise"); if (empty($_POST["stampdetails"][$apprise])) { $fieldArr["autoreview"] = 0; } else { $fieldArr["autoreviewstamp"] = $_POST["stampdetails"][$apprise]; } Setting::model()->modify("reportconfig", array("svalue" => serialize($fieldArr))); CacheUtil::update("setting"); $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index")); } }
public function actionSetup() { if (EnvUtil::submitCheck("formhash")) { $_POST["wbpostfrequency"] = 5 < intval($_POST["wbpostfrequency"]) ? $_POST["wbpostfrequency"] : 5; $_POST["wbnums"] = 140 <= intval($_POST["wbnums"]) ? $_POST["wbnums"] : 140; $wbwatermark = isset($_POST["wbwatermark"]) ? 1 : 0; $wbwcenabled = isset($_POST["wbwcenabled"]) ? 1 : 0; $postType = array("image" => 0, "topic" => 0, "praise" => 0); if (isset($_POST["wbposttype"])) { foreach ($postType as $key => &$val) { if (isset($_POST["wbposttype"][$key])) { $val = 1; } } } if (isset($_POST["wbmovements"])) { } else { $_POST["wbmovements"] = array(); } $data = array("wbnums" => $_POST["wbnums"], "wbpostfrequency" => $_POST["wbpostfrequency"], "wbposttype" => $postType, "wbwatermark" => $wbwatermark, "wbwcenabled" => $wbwcenabled, "wbmovement" => $_POST["wbmovements"]); foreach ($data as $key => $value) { Setting::model()->updateSettingValueByKey($key, $value); } CacheUtil::update("setting"); $this->success(Ibos::lang("Operation succeed", "message")); } else { $data = array("config" => WbCommonUtil::getSetting(), "movementModule" => WbCommonUtil::getMovementModules()); $this->render("setup", $data); } }
public function actionParam() { if (EnvUtil::submitCheck("formhash")) { $data = array("sealfrom" => $_POST["seal_from"]); $workRemindBefore = intval($_POST["work_remind_before"]); $unitBefore = $_POST["unit_before"]; if (!empty($workRemindBefore)) { $workRemindBefore .= $unitBefore; $data["wfremindbefore"] = $workRemindBefore; } $workRemindAfter = $_POST["work_remind_after"]; $unitAfter = $_POST["unit_after"]; if (!empty($workRemindAfter)) { $workRemindAfter .= $unitAfter; $data["wfremindafter"] = $workRemindAfter; } foreach ($data as $key => $value) { Setting::model()->updateSettingValueByKey($key, $value); } CacheUtil::update("setting"); $this->success(Ibos::lang("Operation succeed", "message")); } else { $keys = "wfremindbefore,wfremindafter,sealfrom"; $values = Setting::model()->fetchSettingValueByKeys($keys); $param = array(); foreach ($values as $key => $value) { if ($key == "wfremindbefore" || $key == "wfremindafter") { $param[$key . "desc"] = substr($value, 0, -1); $param[$key . "unit"] = substr($value, -1, 1); } $param[$key] = $value; } $this->render("param", array("param" => $param)); } }
public function actionIndex() { $unit = Setting::model()->fetchSettingValueByKey("unit"); $formSubmit = EnvUtil::submitCheck("unitSubmit"); if ($formSubmit) { $postData = array(); if (!empty($_FILES["logo"]["name"])) { !empty($unit["logourl"]) && FileUtil::deleteFile($unit["logourl"]); $postData["logourl"] = $this->imgUpload("logo"); } elseif (!empty($_POST["logourl"])) { $postData["logourl"] = $_POST["logourl"]; } else { $postData["logourl"] = ""; } $keys = array("phone", "fullname", "shortname", "fax", "zipcode", "address", "adminemail", "systemurl"); foreach ($keys as $key) { if (isset($_POST[$key])) { $postData[$key] = StringUtil::filterCleanHtml($_POST[$key]); } else { $postData[$key] = ""; } } Setting::model()->updateSettingValueByKey("unit", $postData); CacheUtil::update(array("setting")); $this->success(Ibos::lang("Save succeed", "message")); } else { $license = Setting::model()->fetchSettingValueByKey("license"); $data = array("unit" => unserialize($unit), "license" => $license); $this->render("index", $data); } }
public function actionRule() { $formSubmit = EnvUtil::submitCheck("creditRuleSubmit"); if ($formSubmit) { $cycles = $_POST["cycles"]; $credits = $_POST["credits"]; $rewardNums = $_POST["rewardnums"]; $rulesParam = array(); foreach ($cycles as $ruleId => $cycle) { $rulesParam[$ruleId]["cycletype"] = $cycle; } foreach ($credits as $ruleId => $credit) { foreach ($credit as $extcreditOffset => $creditValue) { $rulesParam[$ruleId]["extcredits" . $extcreditOffset] = $creditValue; } } foreach ($rewardNums as $ruleId => $rewardNum) { $rulesParam[$ruleId]["rewardnum"] = $rewardNum; } foreach ($rulesParam as $ruleId => $updateValue) { CreditRule::model()->modify($ruleId, $updateValue); } CacheUtil::update(array("creditRule")); $this->success(Ibos::lang("Save succeed", "message")); } else { $rules = CreditRule::model()->fetchAll(); $credits = Credit::model()->fetchAll(); $data = array("rules" => $rules, "credits" => $credits); $this->render("rule", $data); } }
public function actionSetup() { $formSubmit = EnvUtil::submitCheck("formhash"); if ($formSubmit) { $data =& $_POST; foreach (array("sendemail", "sendsms", "sendmessage") as $field) { if (!empty($data[$field])) { $ids = array_keys($data[$field]); $idstr = implode(",", $ids); Notify::model()->updateAll(array($field => 1), sprintf("FIND_IN_SET(id,'%s')", $idstr)); Notify::model()->updateAll(array($field => 0), sprintf("NOT FIND_IN_SET(id,'%s')", $idstr)); } else { Notify::model()->updateAll(array($field => 0)); } } CacheUtil::update("NotifyNode"); $this->success(Ibos::lang("Save succeed", "message")); } else { $nodeList = Notify::model()->getNodeList(); foreach ($nodeList as &$node) { $node["moduleName"] = Module::model()->fetchNameByModule($node["module"]); } $this->render("setup", array("nodeList" => $nodeList)); } }
public function actionEdit() { if (EnvUtil::submitCheck("emailSubmit")) { $setting = array(); foreach ($this->_fields as $field) { if (array_key_exists($field, $_POST)) { $setting[$field] = intval($_POST[$field]); } else { $setting[$field] = 0; } } $roles = array(); if (isset($_POST["role"])) { foreach ($_POST["role"] as $role) { if (!empty($role["positionid"]) && !empty($role["size"])) { $positionId = StringUtil::getId($role["positionid"]); $roles[implode(",", $positionId)] = intval($role["size"]); } } } $setting["emailroleallocation"] = serialize($roles); foreach ($setting as $key => $value) { Setting::model()->updateSettingValueByKey($key, $value); } CacheUtil::update("setting"); $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index")); } }
public function actionEdit() { if (Ibos::app()->request->getIsAjaxRequest()) { if (EnvUtil::getRequest("op") === "structure") { $curId = EnvUtil::getRequest("curid"); $objId = EnvUtil::getRequest("objid"); $status = $this->setStructure($curId, $objId); $this->ajaxReturn(array("IsSuccess" => $status), "json"); } $deptId = EnvUtil::getRequest("deptid"); if ($deptId == 0) { $keys = array("phone", "fullname", "shortname", "fax", "zipcode", "address", "adminemail"); $postData = array(); foreach ($_POST as $key => $value) { if (in_array($key, $keys)) { $postData[$key] = $value; } } Setting::model()->updateSettingValueByKey("unit", $postData); $editStatus = true; CacheUtil::update(array("setting")); } else { $this->dealWithBranch(); $this->dealWithSpecialParams(); $data = Department::model()->create(); $editStatus = Department::model()->modify($data["deptid"], $data); $editStatus && OrgUtil::update(); } $this->ajaxReturn(array("IsSuccess" => !!$editStatus), "json"); } }
public function actionIndex() { $type = EnvUtil::getRequest("type"); $allowType = array("rtx", "qq"); if (!in_array($type, $allowType)) { $type = "rtx"; } $diff = array_diff($allowType, array($type)); $value = Setting::model()->fetchSettingValueByKey("im"); $im = unserialize($value); $formSubmit = EnvUtil::submitCheck("imSubmit"); if ($formSubmit) { $type = $_POST["type"]; if ($type == "rtx") { $keys = array("open", "server", "appport", "sdkport", "push", "sso", "reverselanding", "syncuser"); } elseif ($type == "qq") { $keys = array("open", "id", "token", "appid", "appsecret", "push", "sso", "syncuser", "syncorg", "showunread", "refresh_token", "time", "expires_in"); } $updateList = array(); foreach ($keys as $key) { if (isset($_POST[$key])) { $updateList[$key] = $_POST[$key]; } else { $updateList[$key] = 0; } } if ($updateList["open"] == "1") { $this->checkImUnique($diff); $correct = MessageUtil::getIsImBinding($type, $updateList); if ($correct !== true) { $updateList["open"] = 0; } elseif ($type == "qq") { $updateList["checkpass"] = 1; } } else { if ($type == "qq") { $updateList["checkpass"] = 0; } $correct = true; } $im[$type] = $updateList; Setting::model()->updateSettingValueByKey("im", $im); CacheUtil::update(array("setting")); if ($correct === true) { $this->success(Ibos::lang("Save succeed", "message")); } else { $updateList["open"] = 0; if (is_array($correct)) { $msg = isset($correct[ICIM::ERROR_INIT]) ? implode(",", $correct[ICIM::ERROR_INIT]) : Ibos::lang("Unknown error", "error"); } else { $msg = Ibos::lang("Unknown error", "error"); } $this->error(Ibos::lang("Binding error", "", array("{err}" => $msg))); } } else { $data = array("type" => $type, "im" => $im[$type]); $this->render($type, $data); } }
public function actionIndex() { $types = EnvUtil::getRequest("updatetype"); $data = array(); if (EnvUtil::submitCheck("formhash")) { $type = implode(",", $types); if (!empty($type)) { $this->redirect($this->createUrl("update/index", array("doupdate" => 1, "updatetype" => $type))); } } if (Ibos::app()->request->getIsAjaxRequest()) { $op = EnvUtil::getRequest("op"); if (LOCAL) { @set_time_limit(0); } if ($op == "data") { CacheUtil::update(); } if ($op == "static") { LOCAL && Ibos::app()->assetManager->republicAll(); OrgUtil::update(); } if ($op == "module") { ModuleUtil::updateConfig(); } Ibos::app()->cache->clear(); $this->ajaxReturn(array("isSuccess" => true)); } if (EnvUtil::getRequest("doupdate") == 1) { $type = explode(",", trim($types, ",")); $data["doUpdate"] = true; foreach ($type as $index => $act) { if (!empty($act)) { if (in_array("data", $type)) { unset($type[$index]); $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Data cache"); $data["op"] = "data"; break; } if (in_array("static", $type)) { unset($type[$index]); $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Static cache"); $data["op"] = "static"; break; } if (in_array("module", $type)) { $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Module setting"); $data["op"] = "module"; unset($type[$index]); break; } } } $data["next"] = $this->createUrl("update/index", array("doupdate" => intval(!empty($type)), "updatetype" => implode(",", $type))); } else { $data["doUpdate"] = false; } $this->render("index", $data); }
public function actionSwitchstatus() { if (Ibos::app()->getRequest()->getIsAjaxRequest()) { $val = EnvUtil::getRequest("val"); $result = Setting::model()->updateSettingValueByKey("appclosed", (int) $val); CacheUtil::update(array("setting")); return $this->ajaxReturn(array("IsSuccess" => $result), "json"); } }
public function actionEdit() { $votethumbenable = 0; if (isset($_POST["votethumbenable"])) { $votethumbenable = $_POST["votethumbenable"]; } $width = empty($_POST["votethumbwidth"]) ? 0 : $_POST["votethumbwidth"]; $height = empty($_POST["votethumbheight"]) ? 0 : $_POST["votethumbheight"]; $votethumbewh = $width . "," . $height; Setting::model()->modify("votethumbenable", array("svalue" => $votethumbenable)); Setting::model()->modify("votethumbwh", array("svalue" => $votethumbewh)); CacheUtil::update("setting"); $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index")); }
public function actionStatus() { $moduleStatus = EnvUtil::getRequest("type"); $module = EnvUtil::getRequest("module"); if (Ibos::app()->getRequest()->getIsAjaxRequest()) { $status = 0; if ($moduleStatus == "disabled") { $status = 1; } $changeStatus = Module::model()->modify($module, array("disabled" => $status)); Nav::model()->updateAll(array("disabled" => $status), "module = :module", array(":module" => $module)); CacheUtil::update(array("setting", "nav")); ModuleUtil::updateConfig($module); $this->ajaxReturn(array("IsSuccess" => $changeStatus), "json"); } }
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); }
public function actionIndex() { $formSubmit = EnvUtil::submitCheck("dateSetupSubmit"); if ($formSubmit) { $data = array("dateformat" => $_POST["dateFormat"], "timeformat" => $_POST["timeFormat"], "dateconvert" => $_POST["dateConvert"], "timeoffset" => $_POST["timeOffset"]); foreach ($data as $sKey => $sValue) { Setting::model()->updateSettingValueByKey($sKey, $sValue); } CacheUtil::update(array("setting")); $this->success(Ibos::lang("Save succeed", "message")); } else { $date = Setting::model()->fetchSettingValueByKeys("dateformat,dateconvert,timeformat,timeoffset"); $data = array("timeZone" => Ibos::getLangSource("dashboard.timeZone"), "date" => $date); $this->render("index", $data); } }
public function actionIndex() { if (EnvUtil::submitCheck("formhash")) { if (isset($_POST["statmodules"])) { } else { $_POST["statmodules"] = array(); } Setting::model()->updateSettingValueByKey("statmodules", $_POST["statmodules"]); CacheUtil::update("setting"); $this->success(Ibos::lang("Operation succeed", "message")); } else { $res = Setting::model()->fetchSettingValueByKey("statmodules"); $statModules = $res ? unserialize($res) : array(); $data = array("statModules" => $statModules, "enabledModules" => StatCommonUtil::getStatisticsModules()); $this->render("index", $data); } }
public static function checkUpgrade() { $return = false; $ibosRelease = VERSION_DATE; $upgradeFile = self::UPGRADE_URL . self::getVersionPath() . "/" . $ibosRelease . "/upgrade.xml"; $remoteResponse = FileUtil::fileSockOpen($upgradeFile); $response = XmlUtil::xmlToArray($remoteResponse); if (isset($response["cross"]) || isset($response["patch"])) { Setting::model()->updateSettingValueByKey("upgrade", $response); CacheUtil::update("setting"); $return = true; } else { Setting::model()->updateSettingValueByKey("upgrade", ""); $return = false; } return $return; }
public function actionUpdate() { if (EnvUtil::submitCheck("calendarSubmit")) { $setting = array(); foreach ($this->_fields as $field) { if (array_key_exists($field, $_POST)) { $setting[$field] = $_POST[$field]; } else { $setting[$field] = 0; } } foreach ($setting as $key => $value) { Setting::model()->updateSettingValueByKey($key, $value); } CacheUtil::update("setting"); $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index")); } }
public function actionSphinx() { if (LOCAL) { $formSubmit = EnvUtil::submitCheck("sphinxSubmit"); if ($formSubmit) { $sphinxHost = $_POST["sphinxhost"]; $sphinxPort = $_POST["sphinxport"]; Setting::model()->updateSettingValueByKey("sphinxhost", $sphinxHost); Setting::model()->updateSettingValueByKey("sphinxport", $sphinxPort); CacheUtil::update(array("setting")); $this->success(Ibos::lang("Save succeed", "message")); } else { $record = Setting::model()->fetchSettingValueByKeys("sphinxhost,sphinxport"); $sphinxPort = Setting::model()->fetchSettingValueByKey("sphinxport"); $data = array("sphinxHost" => $record["sphinxhost"], "sphinxPort" => $record["sphinxport"]); $this->render("sphinx", $data); } } else { echo Ibos::lang("Not compatible service", "message"); } }
public function actionSetup() { $mailSetting = Setting::model()->fetchSettingValueByKey("mail"); $mail = unserialize($mailSetting); $formSubmit = EnvUtil::submitCheck("emailSubmit"); if ($formSubmit) { $serverList = array(); $filterCheck = false; if ($_POST["mailsend"] == 1) { $filterCheck = true; $postArea = "socket"; } else { $postArea = "smtp"; } if (isset($_POST[$postArea])) { $serverList = array_merge($serverList, $_POST[$postArea]); } if (isset($_POST["new" . $postArea])) { $serverList = array_merge($serverList, $_POST["new" . $postArea]); } if ($filterCheck) { foreach ($serverList as $index => $server) { if (isset($mail["server"][$index])) { $passwordmask = StringUtil::passwordMask($mail["server"][$index]["password"]); $serverList[$index]["password"] = $server["password"] == $passwordmask ? $mail["server"][$index]["password"] : $server["password"]; } if (!isset($server["auth"])) { $serverList[$index]["auth"] = 0; } } } $data = array("mailsend" => $_POST["mailsend"], "maildelimiter" => $_POST["maildelimiter"], "mailusername" => isset($_POST["mailusername"]) ? 1 : 0, "sendmailsilent" => isset($_POST["sendmailsilent"]) ? 1 : 0, "server" => $serverList); Setting::model()->updateSettingValueByKey("mail", $data); CacheUtil::update(array("setting")); $this->success(Ibos::lang("Save succeed", "message")); } else { $this->render("setup", array("mail" => $mail)); } }
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"); } }
public function actionIndex() { $formSubmit = EnvUtil::submitCheck("navSubmit"); if ($formSubmit) { Nav::model()->deleteAll(); $navs = $_POST["data"]; foreach ($navs as $pnav) { $pnav["pid"] = 0; $id = $this->runAdd($pnav); if ($id && isset($pnav["child"]) && !empty($pnav["child"])) { foreach ($pnav["child"] as $cnav) { $cnav["pid"] = $id; $this->runAdd($cnav); } } } CacheUtil::update("nav"); $this->success(Ibos::lang("Save succeed", "message")); } else { $navs = Nav::model()->fetchAllByAllPid(); $this->render("index", array("navs" => $navs)); } }
public function actionUpdate() { $fieldArr = array("recruitrealname" => "recruitrealname", "recruitsex" => "recruitsex", "recruitbirthday" => "recruitbirthday", "recruitbirthplace" => "recruitbirthplace", "recruitworkyears" => "recruitworkyears", "recruiteducation" => "recruiteducation", "recruitstatus" => "recruitstatus", "recruitidcard" => "recruitidcard", "recruitheight" => "recruitheight", "recruitweight" => "recruitweight", "recruitmaritalstatus" => "recruitmaritalstatus", "recruitresidecity" => "recruitresidecity", "recruitzipcode" => "recruitzipcode", "recruitmobile" => "recruitmobile", "rucruitemail" => "rucruitemail", "recruittelephone" => "recruittelephone", "recruitqq" => "recruitqq", "recruitmsn" => "recruitmsn", "recruitbeginworkday" => "recruitbeginworkday", "recruittargetposition" => "recruittargetposition", "recruitexpectsalary" => "recruitexpectsalary", "recruitworkplace" => "recruitworkplace", "recruitrecchannel" => "recruitrecchannel", "recruitworkexperience" => "recruitworkexperience", "recruitprojectexperience" => "recruitprojectexperience", "recruiteduexperience" => "recruiteduexperience", "recruitlangskill" => "recruitlangskill", "recruitcomputerskill" => "recruitcomputerskill", "recruitprofessionskill" => "recruitprofessionskill", "recruittrainexperience" => "recruittrainexperience", "recruitselfevaluation" => "recruitselfevaluation", "recruitrelevantcertificates" => "recruitrelevantcertificates", "recruitsocialpractice" => "recruitsocialpractice"); $data = array(); foreach ($_POST as $key => $value) { if (in_array($key, $fieldArr)) { $data[$key] = $value; unset($fieldArr[$key]); } $data[$key]["visi"] = isset($data[$key]["visi"]) ? $data[$key]["visi"] : 0; $data[$key]["fieldrule"] = isset($data[$key]["fieldrule"]) ? $data[$key]["fieldrule"] : "notrequirement"; if ($data[$key]["fieldrule"] == "") { $data[$key]["fieldrule"] = "notrequirement"; } $data[$key] = $data[$key]["visi"] . "," . $data[$key]["fieldrule"]; } foreach ($fieldArr as $field) { $data[$field] = "0,notrequirement"; } Setting::model()->updateSettingValueByKey("recruitconfig", $data); CacheUtil::update("setting"); $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index")); }
public function actionAdd() { $oldRcType = $newRcType = $delRcids = $oldRcids = array(); foreach ($_POST as $key => $value) { $value = trim($value); if (!empty($value)) { if (strpos($key, "old_") === 0 || strpos($key, "old_") !== false) { list(, $rcid) = explode("_", $key); $oldRcType[$rcid] = $value; $oldRcids[] = $rcid; } if (strpos($key, "new_") === 0 || strpos($key, "new_") !== false) { $newRcType[] = $value; } } } $rcTypes = RcType::model()->fetchAll(array("select" => array("rcid"), "condition" => "", "params" => array())); foreach ($rcTypes as $rcType) { if (!in_array($rcType["rcid"], $oldRcids)) { $delRcids[] = $rcType["rcid"]; } } $docConfig = array("doccommentenable" => isset($_POST["commentSwitch"]) ? 1 : 0); Setting::model()->modify("docconfig", array("svalue" => serialize($docConfig))); foreach ($oldRcType as $key => $value) { RcType::model()->modify($key, array("name" => $value)); } foreach ($newRcType as $key => $value) { $rcType = array("name" => $value); RcType::model()->add($rcType); } if (0 < count($delRcids)) { RcType::model()->deleteByPk($delRcids); } CacheUtil::update("setting"); $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index")); }
public static function updateAuthorization($authItem, $moduleName, $category) { foreach ($authItem as $key => $node) { $data["type"] = $node["type"]; $data["category"] = $category; $data["module"] = $moduleName; $data["key"] = $key; $data["name"] = $node["name"]; $data["node"] = ""; if (isset($node["group"])) { $data["group"] = $node["group"]; } else { $data["group"] = ""; } $condition = "`module` = '{$moduleName}' AND `key` = '{$key}'"; Node::model()->deleteAll($condition); if ($node["type"] === "data") { Node::model()->add($data); foreach ($node["node"] as $nKey => $subNode) { $dataCondition = $condition . " AND `node` = '{$nKey}'"; Node::model()->deleteAll($dataCondition); $data["name"] = $subNode["name"]; $routes = self::wrapControllerMap($moduleName, $subNode["controllerMap"]); $data["routes"] = $routes; $data["node"] = $nKey; self::updateAuthItem(explode(",", $routes), true); Node::model()->add($data); } } else { $data["routes"] = self::wrapControllerMap($moduleName, $node["controllerMap"]); self::updateAuthItem(explode(",", $data["routes"]), false); Node::model()->add($data); } } CacheUtil::update("authItem"); }
public function actionEdit() { $data = array(); $fields = array("articlecommentenable", "articlevoteenable", "articlemessageenable", "articlethumbenable", "articlethumbwidth", "articlethumbheight"); foreach ($fields as $field) { if (isset($_POST[$field])) { if (empty($_POST[$field])) { $data[$field] = 0; } else { $data[$field] = $_POST[$field]; } } else { $data[$field] = 0; } } $data["articlethumbwh"] = $data["articlethumbwidth"] . "," . $data["articlethumbheight"]; unset($data["articlethumbwidth"]); unset($data["articlethumbhieght"]); foreach ($data as $key => $value) { Setting::model()->updateAll(array("svalue" => $value), "skey=:skey", array(":skey" => $key)); } CacheUtil::update("setting"); $this->success(Ibos::lang("Update succeed"), $this->createUrl("dashboard/index")); }
public function actionIndex() { $op = EnvUtil::getRequest("op"); $id = intval(EnvUtil::getRequest("id")); if (EnvUtil::submitCheck("formhash")) { if ($op == "edit") { $dayNew = $_POST["weekdaynew"] != -1 ? -1 : $_POST["daynew"]; if (strpos($_POST["minutenew"], ",") !== false) { $minuteNew = explode(",", $_POST["minutenew"]); foreach ($minuteNew as $key => $val) { $minuteNew[$key] = $val = intval($val); if ($val < 0 || 59 < $val) { unset($minuteNew[$key]); } } $minuteNew = array_slice(array_unique($minuteNew), 0, 12); $minuteNew = implode("\t", $minuteNew); } else { $minuteNew = intval($_POST["minutenew"]); $minuteNew = 0 <= $minuteNew && $minuteNew < 60 ? $minuteNew : ""; } $cronfile = $this->getRealCronFile($_POST["type"], $_POST["filenamenew"], $_POST["module"]); if (preg_match("/[\\\\\\/\\:\\*\\?\"\\<\\>\\|]+/", $_POST["filenamenew"])) { $this->error(Ibos::lang("Crons filename illegal")); } elseif (!is_readable($cronfile)) { $this->error(Ibos::lang("Crons filename invalid", "", array("{cronfile}" => $cronfile))); } else { if ($_POST["weekdaynew"] == -1 && $dayNew == -1 && $_POST["hournew"] == -1 && $minuteNew === "") { $this->error(Ibos::lang("Crons time invalid")); } } $data = array("weekday" => $_POST["weekdaynew"], "day" => $dayNew, "hour" => $_POST["hournew"], "minute" => $minuteNew, "filename" => trim($_POST["filenamenew"])); $id && Cron::model()->modify($id, $data); Ibos::app()->cron->run($id); } elseif ($op == "delete") { if (!empty($_POST["delete"])) { $ids = StringUtil::iImplode($_POST["delete"]); Cron::model()->deleteAll(sprintf("cronid IN (%s) AND type='user'", $ids)); } } else { if (isset($_POST["namenew"]) && !empty($_POST["namenew"])) { foreach ($_POST["namenew"] as $id => $name) { $newCron = array("name" => StringUtil::filterCleanHtml($_POST["namenew"][$id]), "available" => isset($_POST["availablenew"][$id]) ? 1 : 0); if (isset($_POST["availablenew"][$id]) && empty($_POST["availablenew"][$id])) { $newCron["nextrun"] = "0"; } Cron::model()->modify($id, $newCron); } } if (!empty($_POST["newname"])) { $data = array("name" => StringUtil::ihtmlSpecialChars($_POST["newname"]), "type" => "user", "available" => "0", "weekday" => "-1", "day" => "-1", "hour" => "-1", "minute" => "", "nextrun" => TIMESTAMP); Cron::model()->add($data); } $list = Cron::model()->fetchAll(array("select" => "cronid,filename,type,module")); foreach ($list as $cron) { $cronFile = $this->getRealCronFile($cron["type"], $cron["filename"], $cron["module"]); if (!file_exists($cronFile)) { Cron::model()->modify($cron["cronid"], array("available" => 0, "nextrun" => 0)); } } CacheUtil::update("setting"); } $this->success(Ibos::lang("Crons succeed"), $this->createUrl("cron/index")); } else { if ($op && in_array($op, array("edit", "run"))) { $cron = Cron::model()->fetchByPk($id); if (!$cron) { $this->error("Cron not found"); } $cron["filename"] = str_replace(array("..", "/", "\\"), array("", "", ""), $cron["filename"]); if ($op == "edit") { $this->render("edit", array("cron" => $cron)); } elseif ($op == "run") { $file = $this->getRealCronFile($cron["type"], $cron["filename"], $cron["module"]); if (!file_exists($file)) { $this->error(Ibos::lang("Crons run invalid", "", array("{cronfile}" => $file))); } else { Ibos::app()->cron->run($cron["cronid"]); $this->success(Ibos::lang("Crons run succeed"), $this->createUrl("cron/index")); } } } else { $list = Cron::model()->fetchAll(array("order" => "type desc")); $this->handleCronList($list); $this->render("index", array("list" => $list)); } } }
public function afterDelete() { CacheUtil::update("department"); CacheUtil::load("department"); parent::afterDelete(); }
public function actionIndex() { $formSubmit = EnvUtil::submitCheck("userGroupSubmit"); if ($formSubmit) { $groups = $_POST["groups"]; $newGroups = isset($_POST["newgroups"]) ? $_POST["newgroups"] : array(); $groupNewAdd = DashboardUtil::arrayFlipKeys($newGroups); foreach ($groupNewAdd as $k => $v) { if (!$v["title"]) { unset($groupNewAdd[$k]); } elseif (!$v["creditshigher"]) { $this->error(Ibos::lang("Usergroups update creditshigher invalid")); } } $groupNewKeys = array_keys($groups); $maxGroupId = max($groupNewKeys); foreach ($groupNewAdd as $k => $v) { $groups[$k + $maxGroupId + 1] = $v; } $orderArray = array(); if (is_array($groups)) { foreach ($groups as $id => $group) { if ($id == 0 && (!$group["title"] || $group["creditshigher"] == "")) { unset($groups[$id]); } else { $orderArray[$group["creditshigher"]] = $id; } } } if (empty($orderArray) || 0 <= min(array_flip($orderArray))) { $this->error(Ibos::lang("Usergroups update credits invalid")); } ksort($orderArray); $rangeArray = array(); $lowerLimit = array_keys($orderArray); for ($i = 0; $i < count($lowerLimit); $i++) { $rangeArray[$orderArray[$lowerLimit[$i]]] = array("creditshigher" => isset($lowerLimit[$i - 1]) ? $lowerLimit[$i] : -999999999, "creditslower" => isset($lowerLimit[$i + 1]) ? $lowerLimit[$i + 1] : 999999999); } foreach ($groups as $id => $group) { $creditshigherNew = $rangeArray[$id]["creditshigher"]; $creditslowerNew = $rangeArray[$id]["creditslower"]; if ($creditshigherNew == $creditslowerNew) { $this->error(Ibos::lang("Usergroups update credits duplicate")); } if (in_array($id, $groupNewKeys)) { UserGroup::model()->modify($id, array("title" => $group["title"], "creditshigher" => $creditshigherNew, "creditslower" => $creditslowerNew)); } else { if ($group["title"] && $group["creditshigher"] != "") { $data = array("title" => $group["title"], "creditshigher" => $creditshigherNew, "creditslower" => $creditslowerNew); UserGroup::model()->add($data); } } } $removeId = $_POST["removeId"]; if (!empty($removeId)) { UserGroup::model()->deleteById($removeId); } CacheUtil::update(array("UserGroup")); $this->success(Ibos::lang("Save succeed", "message")); } else { $groups = UserGroup::model()->fetchAll(array("order" => "creditshigher")); $data = array("data" => $groups); $this->render("index", $data); } }
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')) { $ret['isSuccess'] = false; $ret['msg'] = 'mysql_connect' . $lang['func not exist'];