public function addLog($assignmentId, $type, $content) { $uid = Ibos::app()->user->uid; $realname = User::model()->fetchRealnameByUid($uid); $data = array("assignmentid" => $assignmentId, "uid" => $uid, "time" => TIMESTAMP, "ip" => EnvUtil::getClientIp(), "type" => $type, "content" => $realname . $content); return $this->add($data); }
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 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 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 parse($isUpdate = false) { Ibos::import("application.extensions.simple_html_dom", true); if ($isUpdate) { $model = preg_replace("/\\s+data-id\\s?=\\s?\"?\\d+\"?/i", "", $this->printmodel); $max = 0; } else { $model = $this->printmodel; $max = intval($this->itemmax); } $elements = array(); $doc = new simple_html_dom(); $doc->load($model, true, true, CHARSET); $items = $doc->find("ic"); $config = $this->getItemConfig(); if (!empty($items) && !empty($config)) { $this->refactor($items, $config, $max, $elements); } $html = $doc->save(); $this->_cache = $elements; CacheUtil::set("form_" . $this->ID, $elements); $form["printmodelshort"] = $html; if ($max != $this->itemmax) { $form["itemmax"] = $max; } $doc->clear(); FlowFormType::model()->modify($this->ID, $form); }
public static function checkVote($relatedModule, $relatedId, $uid = 0) { $result = false; $uid = empty($uid) ? Ibos::app()->user->uid : $uid; $condition = "relatedmodule=:relatedmodule AND relatedid=:relatedid"; $params = array(":relatedmodule" => $relatedModule, ":relatedid" => $relatedId); $vote = Vote::model()->fetch($condition, $params); if (!empty($vote)) { $voteid = $vote["voteid"]; $voteItemList = VoteItem::model()->fetchAll("voteid=:voteid", array(":voteid" => $voteid)); foreach ($voteItemList as $voteItem) { $itemid = $voteItem["itemid"]; $itemCountList = VoteItemCount::model()->fetchAll("itemid=:itemid", array(":itemid" => $itemid)); if (!empty($itemCountList) && 0 < count($itemCountList)) { foreach ($itemCountList as $itemCount) { if ($itemCount["uid"] == $uid) { $result = true; break; } } } } } return $result; }
public function getNews($id) { $gUid = Ibos::app()->user->uid; $article = Article::model()->fetchByPk($id); $attribute = ICArticle::getShowData($article); return $attribute; }
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); } }
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 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); }
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 static function update($cacheName = "") { $updateList = empty($cacheName) ? array() : (is_array($cacheName) ? $cacheName : array($cacheName)); if (!$updateList) { $cacheDir = Ibos::getPathOfAlias(self::CACHE_ALIAS); $cacheDirHandle = dir($cacheDir); while ($entry = $cacheDirHandle->read()) { $isProviderFile = preg_match("/^([\\_\\w]+)CacheProvider\\.php\$/", $entry, $matches) && substr($entry, -4) == ".php" && is_file($cacheDir . "/" . $entry); if (!in_array($entry, array(".", "..")) && $isProviderFile) { $class = basename($matches[0], ".php"); if (class_exists($class)) { Ibos::app()->attachBehavior("onUpdateCache", array("class" => self::CACHE_ALIAS . "." . $class)); } } } } else { foreach ($updateList as $entry) { $owner = ucfirst($entry) . "CacheProvider"; if (class_exists($owner)) { Ibos::app()->attachBehavior("onUpdateCache", array("class" => self::CACHE_ALIAS . "." . $owner)); } } } if (Ibos::app()->hasEventHandler("onUpdateCache")) { Ibos::app()->raiseEvent("onUpdateCache", new CEvent(Ibos::app())); } }
public function renderIndex() { $return = array(); $viewAlias = "application.modules.report.views.indexapi.report"; $uid = Ibos::app()->user->uid; $reports = Report::model()->fetchAllRepByUids($uid); if (!empty($reports)) { $reports = $this->handleIconUrl($reports); } $subUidArr = User::model()->fetchSubUidByUid($uid); $subUidStr = implode(",", $subUidArr); $subReports = Report::model()->fetchAll("FIND_IN_SET(`uid`, '{$subUidStr}') OR FIND_IN_SET({$uid}, `toid`)"); if (!empty($subReports)) { $subReports = $this->handleIconUrl($subReports, true); } $data = array("reports" => $reports, "subReports" => $subReports, "lang" => Ibos::getLangSource("report.default"), "assetUrl" => Yii::app()->assetManager->getAssetsUrl("report")); foreach ($this->_indexTab as $tab) { $data["tab"] = $tab; if ($tab == "reportPersonal") { $return[$tab] = Yii::app()->getController()->renderPartial($viewAlias, $data, true); } else { if ($tab == "reportAppraise" && (0 < count($subUidArr) || !empty($subReports))) { $return[$tab] = Yii::app()->getController()->renderPartial($viewAlias, $data, true); } } } return $return; }
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 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 run() { $module = $this->getController()->getModule()->getId(); $timeRoute = $this->getTimeRoute($module); $data = array("module" => $module, "timeRoute" => $timeRoute, "lang" => Ibos::getLangSources(array("diary.default")), "time" => StatCommonUtil::getCommonTimeScope()); $this->render(self::VIEW, $data); }
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 save($imgname, $type = NULL, $interlace = true) { if (empty($this->img)) { throw new Exception("没有可以被保存的图像资源"); } if (is_null($type)) { $type = $this->info["type"]; } else { $type = strtolower($type); } if ("jpeg" == $type || "jpg" == $type) { $type = "jpeg"; imageinterlace($this->img, $interlace); } if ("gif" == $type && !empty($this->gif)) { $this->gif->save($imgname); } else { $fun = "image{$type}"; if (!LOCAL) { $temp = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($imgname), $this->info["type"]); $fun($this->img, $temp); $content = file_get_contents($temp); Ibos::engine()->IO()->file()->writeFile($imgname, $content); } else { $fun($this->img, $imgname); } } }
protected function getIsNeedReset() { $neededReset = false; if ($this->account["expiration"] != 0) { if (Ibos::app()->user->lastchangepass == 0) { $neededReset = true; } else { $time = TIMESTAMP - Ibos::app()->user->lastchangepass; switch ($this->account["expiration"]) { case "1": if (30 < $time / 86400) { $neededReset = true; } break; case "2": if (60 < $time / 86400) { $neededReset = true; } break; case "3": if (180 < $time / 86400) { $neededReset = true; } break; default: break; } } } return $neededReset; }
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 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 republicAll() { if (LOCAL) { $except = array("image", "css", "font", "js", ".", ".."); $basePath = $this->getBasePath(); $dir = @opendir($basePath); while ($entry = @readdir($dir)) { $file = $basePath . DIRECTORY_SEPARATOR . $entry; if (!in_array($entry, array_merge($this->excludeFiles, $except))) { if (is_dir($file)) { FileUtil::clearDirs($file . "/"); } } } closedir($dir); $modules = Ibos::app()->getEnabledModule(); foreach ($modules as $module) { $path = Yii::getPathOfAlias("application.modules.{$module["module"]}.static"); if (is_dir($path)) { $this->publish($path, false, -1, true); } } } return true; }
private function loadNewArticle($num = 3) { $uid = Ibos::app()->user->uid; $allDeptId = Ibos::app()->user->alldeptid . ""; $allPosId = Ibos::app()->user->allposid . ""; $deptCondition = ""; $deptIdArr = explode(",", $allDeptId); if (0 < count($deptIdArr)) { foreach ($deptIdArr as $deptId) { $deptCondition .= "FIND_IN_SET('{$deptId}',deptid) OR "; } $deptCondition = substr($deptCondition, 0, -4); } else { $deptCondition = "FIND_IN_SET('',deptid)"; } $condition = " ( ((deptid='alldept' OR {$deptCondition} OR FIND_IN_SET('{$allPosId}',positionid) OR FIND_IN_SET('{$uid}',uid)) OR (deptid='' AND positionid='' AND uid='') OR (author='{$uid}') OR (approver='{$uid}')) ) AND `status`='1'"; $criteria = array("select" => "articleid,subject,content,addtime,type", "condition" => $condition, "order" => "`istop` DESC, `addtime` DESC", "offset" => 0, "limit" => $num); $articles = Article::model()->fetchAll($criteria); if (!empty($articles)) { foreach ($articles as &$article) { $read = ArticleReader::model()->fetchByAttributes(array("articleid" => $article["articleid"], "uid" => $uid)); $readStatus = $read ? 1 : 0; if ($readStatus) { $article["iconStyle"] = $this->iconReadStyle[$article["type"]]; } else { $article["iconStyle"] = $this->iconNormalStyle[$article["type"]]; } } } return $articles; }
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"]; } }
protected function handleTplData($flowId) { $data = array(); $lang = Ibos::getLangSources(); $flow = new ICFlowType($flowId); $flowArr = $flow->toArray(); if (!empty($flowArr)) { $data["flow"] = $flowArr; $data["form"] = $flow->form->toArray(); $formStructure = $flow->form->parser->getStructure(); $defTitleArr = array(array("key" => "runid", "title" => $lang["Flow no"]), array("key" => "runname", "title" => $lang["Flow subject/num"]), array("key" => "runstatus", "title" => $lang["Flow status"]), array("key" => "rundate", "title" => $lang["Flow begin date"]), array("key" => "runtime", "title" => $lang["Flow begin time"])); $titleArr = array(); $table = "flow_data_" . $flowId; foreach ($formStructure as $structure) { if ($structure["data-type"] == "sign" || $structure["data-type"] == "label") { continue; } $titleIdentifier = sprintf("%s.%s", $table, "data_" . $structure["itemid"]); $structure["data-title"] = stripslashes(str_replace(array("<", ">"), array("<", ">"), $structure["data-title"])); $titleArr[] = array("key" => $titleIdentifier, "title" => $structure["data-title"]); } $data["deftitle"] = $defTitleArr; $data["title"] = $titleArr; } $data["lang"] = $lang; return $data; }
public function run() { $attr = $this->getAttributes(); $map = array("module" => $this->getModule(), "table" => $this->getTable(), "rowid" => $attr["rowid"], "isdel" => 0); $attr["count"] = Comment::model()->countByAttributes($map); $list = $this->getCommentList(); $isAdministrator = Ibos::app()->user->isadministrator; $uid = Ibos::app()->user->uid; foreach ($list as &$cm) { $cm["isCommentDel"] = $isAdministrator || $uid === $cm["uid"]; $cm["replys"] = intval(Comment::model()->countByAttributes(array("module" => "message", "table" => "comment", "rowid" => $cm["cid"], "isdel" => 0))); } $attr["comments"] = $list; $attr["lang"] = Ibos::getLangSources(array("message.default")); $content = $this->render($this->getParseView("comment"), $attr, true); $ajax = $attr["inAjax"]; $count = $attr["count"]; unset($attr); $return = array("isSuccess" => true, "data" => $content, "count" => $count); if ($ajax == 1) { $this->getOwner()->ajaxReturn($return); } else { echo $return["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 run() { $id = $this->getController()->getId(); $action = $this->getController()->getAction()->getId(); $data = array("inPersonal" => $id == "stats" && $action == "personal", "inReview" => $id == "stats" && $action == "review", "hasSub" => $this->getHasSub(), "lang" => Ibos::getLangSource("report.default")); $this->render(self::VIEW, $data); }
public function actionFileUp() { $config = array("savePath" => "data/editor/file/" . Ibos::app()->user->uid . "/", "allowFiles" => array(".rar", ".doc", ".docx", ".zip", ".pdf", ".txt", ".swf", ".wmv"), "maxSize" => 5000); $up = new EditorUploader("upfile", $config); $info = $up->getFileInfo(); echo "{\"url\":\"" . $info["url"] . "\",\"fileType\":\"" . $info["type"] . "\",\"original\":\"" . $info["originalName"] . "\",\"state\":\"" . $info["state"] . "\"}"; }
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); } }