public static function export($idstr) { $idArr = is_array($idstr) ? $idstr : explode(",", $idstr); if (1 < count($idArr)) { $zip = new Zip(); $exportFileName = Ibos::lang("Form export file pack", "workflow.default", array("{date}" => date("Y-m-d"))); $zipFileName = FileUtil::getTempPath() . "/" . TIMESTAMP . ".zip"; foreach ($idArr as $id) { $form = self::handleExportSingleForm($id); $zip->addFile($form["content"], sprintf("%s.html", ConvertUtil::iIconv($form["title"], CHARSET, "gbk"))); } $fp = fopen($zipFileName, "w"); if (@fwrite($fp, $zip->file()) !== false) { header("Cache-control: private"); header("Content-type: application/octet-stream"); header("Accept-Ranges: bytes"); header("Content-Length: " . sprintf("%u", FileUtil::fileSize($zipFileName))); header("Content-Disposition: attachment; filename=" . $exportFileName . ".zip"); readfile($zipFileName); exit; } } else { $id = implode(",", $idArr); $form = self::handleExportSingleForm($id); ob_end_clean(); header("Cache-control: private"); header("Content-type: text/plain"); header("Accept-Ranges: bytes"); header("Accept-Length: " . strlen($form["content"])); header("Content-Disposition: attachment; filename=" . $form["title"] . ".html"); echo $form["content"]; } }
public function actionEdit() { $id = intval(EnvUtil::getRequest("id")); if ($id) { if (EnvUtil::submitCheck("formhash")) { $this->beforeSave(); unset($_POST["id"]); $data = FlowPermission::model()->create(); $status = FlowPermission::model()->modify($id, $data); $this->ajaxReturn(array("isSuccess" => !!$status)); } else { $per = FlowPermission::model()->fetchByPk($id); if (!empty($per)) { if ($per["deptid"] == "alldept") { $users = "c_0"; } else { $users = StringUtil::wrapId($per["uid"], "u") . "," . StringUtil::wrapId($per["deptid"], "d") . "," . StringUtil::wrapId($per["positionid"], "p"); } $isCustom = !in_array($per["scope"], array("selforg", "alldept", "selfdeptall", "selfdept")); $data = array("per" => $per, "lang" => Ibos::getLangSources(), "custom" => $isCustom, "users" => StringUtil::filterStr($users)); $this->renderPartial("edit", $data); } else { $this->ajaxReturn(Ibos::lang("Parameters error", "error"), "eval"); } } } }
public function actionPost() { if (EnvUtil::submitCheck("formhash")) { $return = array("data" => Ibos::lang("Operation succeed", "message"), "IsSuccess" => true); if (empty($_POST["touid"])) { $return["data"] = Ibos::lang("Message receiver cannot be empty"); $return["IsSuccess"] = false; $this->ajaxReturn($return); } if (trim(StringUtil::filterCleanHtml($_POST["content"])) == "") { $return["data"] = Ibos::lang("Message content cannot be empty"); $return["IsSuccess"] = false; $this->ajaxReturn($return); } $_POST["touid"] = implode(",", StringUtil::getUid($_POST["touid"])); if (isset($_POST["type"])) { !in_array($_POST["type"], array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT)) && ($_POST["type"] = null); } else { $_POST["type"] = null; } $_POST["content"] = StringUtil::filterDangerTag($_POST["content"]); $res = MessageContent::model()->postMessage($_POST, Yii::app()->user->uid); if ($res) { $this->ajaxReturn($return); } else { $return["IsSuccess"] = false; $return["data"] = MessageContent::model()->getError("message"); $this->ajaxReturn($return); } } }
public function actionDel() { if (Ibos::app()->request->isAjaxRequest) { $typeid = intval(EnvUtil::getRequest("typeid")); if (empty($typeid)) { $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Parameters error", "error"))); } $removeSuccess = ReportType::model()->remove($typeid); if ($removeSuccess) { $reports = Report::model()->fetchRepidAndAidByTypeids($typeid); if (!empty($reports)) { if ($reports["aids"]) { AttachUtil::delAttach($reports["aids"]); } ReportRecord::model()->deleteAll("repid IN('{$reports["repids"]}')"); Report::model()->deleteAll("repid IN('{$reports["repids"]}')"); } $return["isSuccess"] = true; $return["msg"] = Ibos::lang("Del succeed", "message"); } else { $return["isSuccess"] = false; $return["msg"] = Ibos::lang("Del failed", "message"); } $this->ajaxReturn($return); } }
public function updateKey($key, $nums, $add = true, $uid = "") { if ($nums == 0) { $this->addError("updateKey", Ibos::lang("Dont need to modify", "message.default")); return false; } $nums < 0 && ($add = false); $key = StringUtil::filterCleanHtml($key); $data = $this->getUserData($uid); if (empty($data) || !$data) { $data = array(); $data[$key] = $nums; } else { $data[$key] = $add ? (int) @$data[$key] + abs($nums) : (int) @$data[$key] - abs($nums); } $data[$key] < 0 && ($data[$key] = 0); $map["uid"] = empty($uid) ? Ibos::app()->user->uid : $uid; $map["key"] = $key; $this->deleteAll("`key` = :key AND uid = :uid", array(":key" => $key, ":uid" => $map["uid"])); $map["value"] = $data[$key]; $map["mtime"] = date("Y-m-d H:i:s"); $this->add($map); CacheUtil::rm("userData_" . $map["uid"]); return $data; }
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); } }
private function getData() { $id = EnvUtil::getRequest("id"); $aidString = base64_decode(rawurldecode($id)); if (empty($aidString)) { $this->error(Ibos::lang("Parameters error", "error"), "", array("autoJump" => 0)); } $salt = Ibos::app()->user->salt; $decodeString = StringUtil::authCode($aidString, "DECODE", $salt); $decodeArr = explode("|", $decodeString); $count = count($decodeArr); if ($count < 3) { $this->error(Ibos::lang("Data type invalid", "error"), "", array("autoJump" => 0)); } else { $aid = $decodeArr[0]; $tableId = $decodeArr[1]; if (0 <= $tableId && $tableId < 10) { $attach = AttachmentN::model()->fetch($tableId, $aid); } $return = array("decodeArr" => $decodeArr, "attach" => array()); if (!empty($attach)) { $return["attach"] = $attach; } return $return; } }
public static function getIncentiveWord() { $words = Ibos::getLangSource("incentiveword"); $luckyOne = array_rand($words); $source = $words[$luckyOne]; return Ibos::lang("Custom title", "main.default") . $source[array_rand($source)]; }
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); } }
protected function handleListData(&$list) { foreach ($list as &$ver) { $ver["value"] = $ver["id"]; $ver["text"] = Ibos::lang("Form version text", "", array("{num}" => $ver["mark"], "{date}" => date("Y-m-d H:i:s", $ver["time"]))); } }
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 static function getShowData($data) { $data["subject"] = stripslashes($data["subject"]); if (!empty($data["author"])) { $data["authorDeptName"] = Department::model()->fetchDeptNameByUid($data["author"]); } if ($data["approver"] != 0) { $data["approver"] = User::model()->fetchRealNameByUid($data["approver"]); } else { $data["approver"] = Ibos::lang("None"); } $data["addtime"] = ConvertUtil::formatDate($data["addtime"], "u"); $data["uptime"] = empty($data["uptime"]) ? "" : ConvertUtil::formatDate($data["uptime"], "u"); $data["categoryName"] = ArticleCategory::model()->fetchCateNameByCatid($data["catid"]); if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) { $data["departmentNames"] = Ibos::lang("All"); $data["positionNames"] = $data["uidNames"] = ""; } elseif ($data["deptid"] == "alldept") { $data["departmentNames"] = Ibos::lang("All"); $data["positionNames"] = $data["uidNames"] = ""; } else { $department = DepartmentUtil::loadDepartment(); $data["departmentNames"] = ArticleUtil::joinStringByArray($data["deptid"], $department, "deptname", "、"); $position = PositionUtil::loadPosition(); $data["positionNames"] = ArticleUtil::joinStringByArray($data["positionid"], $position, "posname", "、"); if (!empty($data["uid"])) { $users = User::model()->fetchAllByUids(explode(",", $data["uid"])); $data["uidNames"] = ArticleUtil::joinStringByArray($data["uid"], $users, "realname", "、"); } else { $data["uidNames"] = ""; } } return $data; }
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 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 init() { $mainConfig = Ibos::engine()->getMainConfig(); $config = $mainConfig["cache"]; $this->_config = $config; $this->setExtension(); $this->_prefix = empty($config["prefix"]) ? substr(md5($_SERVER["HTTP_HOST"]), 0, 6) . "_" : $config["prefix"]; foreach (array("eaccelerator", "apc", "xcache", "wincache", "filecache") as $cache) { if (!is_object($this->_instance) && $this->_extension[$cache] && $this->config[strtolower($cache)]) { $className = ucfirst($cache); $this->_instance = new $className(); $this->_instance->init(null); break; } } if (is_object($this->_instance)) { $this->enable = true; $this->type = get_class($this->_instance); if (strtolower($this->type) == "filecache") { $this->_prefix = ""; } } else { throw new EnvException(Ibos::lang("Cache init error", "error")); } }
public static function exportSms($id) { $ids = is_array($id) ? $id : explode(",", $id); header("Content-Type:application/vnd.ms-excel"); $fileName = ConvertUtil::iIconv(Ibos::lang("SMS export name", "dashboard.default", array("{date}" => date("Ymd"))), CHARSET, "gbk"); header("Content-Disposition: attachment;filename={$fileName}.csv"); header("Cache-Control: max-age = 0"); $head = array("ID", Ibos::lang("Sender", "dashboard.default"), Ibos::lang("Recipient", "dashboard.default"), Ibos::lang("Membership module", "dashboard.default"), Ibos::lang("Recipient phone number", "dashboard.default"), Ibos::lang("Content", "dashboard.default"), Ibos::lang("Result", "dashboard.default"), Ibos::lang("Send time", "dashboard.default")); foreach ($head as &$header) { $header = ConvertUtil::iIconv($header, CHARSET, "gbk"); } $fp = fopen("php://output", "a"); fputcsv($fp, $head); $cnt = 0; $limit = 100; $system = Ibos::lang("System", "dashboard.default"); foreach (NotifySms::model()->fetchAll(sprintf("FIND_IN_SET(id,'%s')", implode(",", $ids))) as $row) { if ($limit == $cnt) { ob_flush(); flush(); $cnt = 0; } $data = array($row["id"], ConvertUtil::iIconv($row["uid"] == 0 ? $system : User::model()->fetchRealnameByUid($row["uid"]), CHARSET, "gbk"), ConvertUtil::iIconv(User::model()->fetchRealnameByUid($row["touid"]), CHARSET, "gbk"), $row["module"], $row["mobile"], ConvertUtil::iIconv($row["content"], CHARSET, "gbk"), ConvertUtil::iIconv($row["return"], CHARSET, "gbk"), date("Y-m-d H:i:s", $row["ctime"])); fputcsv($fp, $data); } exit; }
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)); } }
private function loadTodo($num = 4) { $uid = Ibos::app()->user->uid; $fields = array("frp.runid", "frp.processid", "frp.flowprocess", "ft.type", "frp.flag", "ft.flowid", "fr.name as runName", "fr.beginuser", "fr.focususer"); $condition = array("and", "fr.delflag = 0", "frp.childrun = 0", sprintf("frp.uid = %d", $uid)); $condition[] = array("in", "frp.flag", array(1, 2)); $sort = "frp.createtime DESC"; $group = "frp.id"; $runProcess = Ibos::app()->db->createCommand()->select($fields)->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->order($sort)->group($group)->offset(0)->limit($num)->queryAll(); $allProcess = FlowProcess::model()->fetchAllProcessSortByFlowId(); foreach ($runProcess as &$run) { $run["user"] = User::model()->fetchByUid($run["beginuser"]); if ($run["type"] == 1) { if (isset($allProcess[$run["flowid"]][$run["flowprocess"]]["name"])) { $run["stepname"] = $allProcess[$run["flowid"]][$run["flowprocess"]]["name"]; } else { $run["stepname"] = Ibos::lang("Process steps already deleted", "workflow.default"); } } else { $run["stepname"] = Ibos::lang("Step", "", array("{step}" => $run["processid"])); } $run["focus"] = StringUtil::findIn($uid, $run["focususer"]); $param = array("runid" => $run["runid"], "flowid" => $run["flowid"], "processid" => $run["processid"], "flowprocess" => $run["flowprocess"]); $run["key"] = WfCommonUtil::param($param); } return $runProcess; }
public function postMessage($data, $fromUid) { $fromUid = intval($fromUid); $data["touid"] = is_array($data["touid"]) ? $data["touid"] : explode(",", $data["touid"]); $data["users"] = array_filter(array_merge(array($fromUid), $data["touid"])); $data["mtime"] = time(); if (false == ($data["listid"] = $this->addMessageList($data, $fromUid))) { $this->addError("message", Ibos::lang("private message send fail", "message.default")); return false; } if (false === $this->addMessageUser($data, $fromUid)) { $this->addError("message", Ibos::lang("private message send fail", "message.default")); return false; } if (false == $this->addMessage($data, $fromUid)) { $this->addError("message", Ibos::lang("private message send fail", "message.default")); return false; } $author = User::model()->fetchByUid($fromUid); $config["name"] = $author["realname"]; $config["content"] = $data["content"]; $config["ctime"] = date("Y-m-d H:i:s", $data["mtime"]); $config["source_url"] = Ibos::app()->urlManager->createUrl("message/pm/index"); MessageUtil::push("pm", $data["touid"], $data["content"]); MessageUtil::appPush($data["touid"], $data["content"]); return $data["listid"]; }
public function actionSearch() { $condition = array(); if (Yii::app()->request->getIsPostRequest()) { $search = $_POST["search"]; $condition = EmailUtil::mergeSearchCondition($search, $this->uid); $conditionStr = base64_encode(serialize($condition)); } else { $conditionStr = EnvUtil::getRequest("condition"); $condition = unserialize(base64_decode($conditionStr)); } if (empty($condition)) { $this->error(Ibos::lang("Request tainting", "error"), $this->createUrl("list/index")); } $emailData = Email::model()->fetchAllByArchiveIds("*", $condition["condition"], $condition["archiveId"], array("e", "eb"), null, null, SORT_DESC, "emailid"); $count = count($emailData); $pages = PageUtil::create($count, $this->getListPageSize(), false); $pages->params = array("condition" => $conditionStr); $list = array_slice($emailData, $pages->getOffset(), $pages->getLimit(), false); foreach ($list as $index => &$mail) { $mail["fromuser"] = $mail["fromid"] ? User::model()->fetchRealnameByUid($mail["fromid"]) : ""; } $data = array("list" => $list, "pages" => $pages, "condition" => $conditionStr, "folders" => $this->folders); $this->setPageTitle(Ibos::lang("Search result")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Email center"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Search result")))); $this->render("search", $data); }
public function actionIndex() { $op = EnvUtil::getRequest("op"); $op = in_array($op, array("dept", "letter")) ? $op : "dept"; $params = array(); if ($op == "letter") { $params["datas"] = $this->getDataByLetter(); } else { $params["datas"] = $this->getDataByDept(); } $userDatas = array(); if (!empty($params["datas"])) { foreach ($params["datas"] as $datas) { $userDatas = $op == "dept" ? array_merge($userDatas, $datas["users"]) : array_merge($userDatas, $datas); } } $params["uids"] = implode(",", ConvertUtil::getSubByKey($userDatas, "uid")); $uid = Ibos::app()->user->uid; $params["cuids"] = Contact::model()->fetchAllConstantByUid($uid); $this->setPageTitle(Ibos::lang("Contact")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Contact"), "url" => $this->createUrl("defalut/index")), array("name" => Ibos::lang("Company contact")))); $view = $op == "letter" ? "letter" : "dept"; $params["allLetters"] = $this->allLetters; $this->render($view, $params); }
public static function getDateAndWeekDay($dateStr) { list($year, $month, $day) = explode("-", $dateStr); $weekArray = array(Ibos::lang("Day", "date"), Ibos::lang("One", "date"), Ibos::lang("Two", "date"), Ibos::lang("Three", "date"), Ibos::lang("Four", "date"), Ibos::lang("Five", "date"), Ibos::lang("Six", "date")); $weekday = $weekArray[date("w", strtotime($dateStr))]; return array("year" => $year, "month" => $month, "day" => $day, "weekday" => Ibos::lang("Weekday", "date") . $weekday); }
protected function handleList($runProcess) { $allProcess = FlowProcess::model()->fetchAllProcessSortByFlowId(); foreach ($runProcess as &$run) { $run["user"] = User::model()->fetchByUid($run["beginuser"]); $rp = FlowRunProcess::model()->fetchCurrentNextRun($run["runid"], $this->uid); if (!empty($rp)) { $run["processid"] = $rp["processid"]; $run["flowprocess"] = $rp["flowprocess"]; $run["opflag"] = $rp["opflag"]; $run["flag"] = $rp["flag"]; } if ($run["type"] == 1) { if (isset($allProcess[$run["flowid"]][$run["flowprocess"]]["name"])) { $run["stepname"] = $allProcess[$run["flowid"]][$run["flowprocess"]]["name"]; } else { $run["stepname"] = Ibos::lang("Process steps already deleted"); } } else { $run["stepname"] = Ibos::lang("Step", "", array("{step}" => $run["processid"])); } $param = array("runid" => $run["runid"], "flowid" => $run["flowid"], "processid" => $run["processid"], "flowprocess" => $run["flowprocess"]); $run["key"] = WfCommonUtil::param($param); } return array("list" => $runProcess); }
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); }
protected function beforeSave() { $_POST["starttime"] = strtotime($_POST["starttime"]); $_POST["endtime"] = strtotime($_POST["endtime"]); if ($_POST["endtime"] < $_POST["starttime"]) { $this->error(Ibos::lang("Sorry, you did not enter the start time or the end time you input is not correct", "error")); } }
public function actionLicense() { if (EnvUtil::submitCheck("formhash")) { $licensekey = StringUtil::filterCleanHtml(EnvUtil::getRequest("licensekey")); $filename = PATH_ROOT . "/data/licence.key"; @file_put_contents($filename, $licensekey); $this->success(Ibos::lang("Save succeed", "message")); } }
public function setCategory($category) { $this->_category = null; if (class_exists($category)) { $this->_category = new $category(); } else { throw new NotFoundException(Ibos::lang("Cannot find class", "error", array("{class}" => $category))); } }
private function update() { $rcid = $_POST["rcid"]; $name = $_POST["name"]; $content = $_POST["content_text"]; $escapeContent = $_POST["content"]; RcType::model()->modify($rcid, array("name" => $name, "content" => $content, "escape_content" => $escapeContent)); $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index")); }
public static function digitalToDay($digitalStr) { $digitalArr = explode(",", $digitalStr); $dayArr = array(1 => Ibos::lang("One", "date"), 2 => Ibos::lang("Two", "date"), 3 => Ibos::lang("Three", "date"), 4 => Ibos::lang("Four", "date"), 5 => Ibos::lang("Five", "date"), 6 => Ibos::lang("Six", "date"), 7 => Ibos::lang("day")); $recurringtime = ""; foreach ($digitalArr as $digital) { $recurringtime .= $dayArr[$digital] . ","; } return rtrim($recurringtime, ","); }
public static function moveTempFile($file, $path) { if (FileUtil::fileExists($file)) { $copySucceed = FileUtil::copyToDir($file, $path); if (!$copySucceed) { throw new EnvException(Ibos::lang("Move file failed", "error", array("file" => $file, "path" => $path))); } return basename($file); } }