Example #1
0
 public function actionLogin()
 {
     $access = $this->getAccess();
     $defaultUrl = $this->createUrl("default/index");
     if (0 < $access) {
         $this->success(Ibos::lang("Login succeed"), $defaultUrl);
     }
     if (!EnvUtil::submitCheck("formhash")) {
         $data = array("userName" => !empty($this->user) ? $this->user["username"] : "");
         $this->render("login", $data);
     } else {
         $userName = EnvUtil::getRequest("username");
         $passWord = EnvUtil::getRequest("password");
         if (!$passWord || $passWord != addslashes($passWord)) {
             $this->error(Ibos::lang("Passwd illegal"));
         }
         $identity = new ICUserIdentity($userName, $passWord);
         $result = $identity->authenticate(true);
         if (0 < $result) {
             Ibos::app()->user->login($identity);
             if (Ibos::app()->user->uid != 1) {
                 MainUtil::checkLicenseLimit(true);
             }
             $this->success(Ibos::lang("Login succeed"), $defaultUrl);
         } else {
             $passWord = preg_replace("/^(.{" . round(strlen($passWord) / 4) . "})(.+?)(.{" . round(strlen($passWord) / 6) . "})\$/s", "***", $passWord);
             $log = array("user" => $userName, "password" => $passWord, "ip" => Ibos::app()->setting->get("clientip"));
             Log::write($log, "illegal", "module.dashboard.login");
             $this->error(Ibos::lang("Login failed"));
         }
     }
 }
 protected function getListPageSize()
 {
     $pageSize = MainUtil::getCookie("workflow_pagesize_" . $this->getUid());
     if (is_null($pageSize)) {
         $pageSize = FlowConst::DEF_PAGE_SIZE;
     }
     return $pageSize;
 }
Example #3
0
 protected function getListPageSize()
 {
     $pageSize = MainUtil::getCookie("workflow_pagesize_" . $this->uid);
     if (is_null($pageSize)) {
         $pageSize = self::DEFAULT_PAGE_SIZE;
     }
     return $pageSize;
 }
Example #4
0
 public function actionLoadNew()
 {
     $moduleStr = EnvUtil::getRequest("module");
     $moduleStr = urldecode($moduleStr);
     $moduleArr = explode(",", $moduleStr);
     $data = MainUtil::execApiMethod("loadNew", $moduleArr);
     $data["timestamp"] = TIMESTAMP;
     $this->ajaxReturn($data);
 }
Example #5
0
 public function afterLogin($fromCookie)
 {
     $uid = $this->getId();
     MainUtil::setCookie("lastactivity", TIMESTAMP);
     UserStatus::model()->updateByPk($uid, array("lastip" => EnvUtil::getClientIp(), "lastvisit" => TIMESTAMP, "lastactivity" => TIMESTAMP, "invisible" => 1));
     if (!$fromCookie) {
         Ibos::app()->session->isNew = true;
         Ibos::app()->session->updateSession();
     }
 }
Example #6
0
 protected function doLogin($userName, $passWord, $loginType, $account, $autoLogin = 1, $cookieTime = 0, $inajax = 0)
 {
     if (!$passWord || $passWord != addslashes($passWord)) {
         $this->error(Ibos::lang("Passwd illegal"));
     }
     $errornum = $this->loginCheck($account);
     $ip = Ibos::app()->setting->get("clientip");
     $identity = new ICUserIdentity($userName, $passWord, $loginType);
     $result = $identity->authenticate();
     if (0 < $result) {
         $user = Ibos::app()->user;
         if (empty($autoLogin)) {
             $user->setState($user::AUTH_TIMEOUT_VAR, TIMESTAMP + $account["timeout"]);
         } else {
             MainUtil::setCookie("autologin", 1, $cookieTime);
         }
         $user->login($identity, $cookieTime);
         if ($user->uid != 1) {
             MainUtil::checkLicenseLimit(true);
         }
         if (!$inajax) {
             $urlForward = EnvUtil::referer();
             $log = array("terminal" => "web", "password" => StringUtil::passwordMask($passWord), "ip" => $ip, "user" => $userName, "loginType" => $loginType, "address" => "", "gps" => "");
             Log::write($log, "login", sprintf("module.user.%d", $user->uid));
             $rule = UserUtil::updateCreditByAction("daylogin", $user->uid);
             if (!$rule["updateCredit"]) {
                 UserUtil::checkUserGroup($user->uid);
             }
             $this->success(Ibos::lang("Login succeed", "", array("{username}" => $user->realname)), $urlForward);
         } else {
             $this->ajaxReturn(array("isSuccess" => true));
         }
     } elseif ($result === 0) {
         $this->error(Ibos::lang("User not fount", "", array("{username}" => $userName)), "", array(), array("error" => $result));
     } elseif ($result === -1) {
         $this->error(Ibos::lang("User lock", "", array("{username}" => $userName)), "", array(), array("error" => $result));
     } elseif ($result === -2) {
         $this->error(Ibos::lang("User disabled", "", array("{username}" => $userName)), "", array(), array("error" => $result));
     } elseif ($result === -3) {
         FailedLogin::model()->updateFailed($ip);
         list($ip1, $ip2) = explode(".", $ip);
         $newIp = $ip1 . "." . $ip2;
         FailedIp::model()->insertIp($newIp);
         $log = array("user" => $userName, "password" => StringUtil::passwordMask($passWord), "ip" => $ip);
         Log::write($log, "illegal", "module.user.login");
         if ($errornum) {
             $this->error("登录失败,您还可以尝试" . ($errornum - 1) . "次");
         } else {
             $this->error(Ibos::lang("User name or password is not correct"), "", array(), array("error" => $result));
         }
     }
 }
Example #7
0
 public static function hookSyncUser($uid, $pwd = "", $syncFlag = 1)
 {
     $type = "";
     $imCfg = array();
     foreach (Ibos::app()->setting->get("setting/im") as $imType => $config) {
         if ($config["open"] == "1") {
             $type = $imType;
             $imCfg = $config;
             break;
         }
     }
     if (!empty($type) && !empty($imCfg) && $imCfg["syncuser"] == "1") {
         MainUtil::setCookie("hooksyncuser", 1, 30);
         MainUtil::setCookie("syncurl", Ibos::app()->createUrl("organization/api/syncUser", array("type" => $type, "uid" => $uid, "pwd" => $pwd, "flag" => $syncFlag)), 30);
     }
 }
Example #8
0
 private function search()
 {
     $type = EnvUtil::getRequest("type");
     $conditionCookie = MainUtil::getCookie("condition");
     if (empty($conditionCookie)) {
         MainUtil::setCookie("condition", $this->condition, 10 * 60);
     }
     if ($type == "advanced_search") {
         $this->condition = ArticleUtil::joinSearchCondition($_POST["search"], $this->condition);
     } elseif ($type == "normal_search") {
         $keyword = $_POST["keyword"];
         $this->condition = " subject LIKE '%{$keyword}%' ";
         MainUtil::setCookie("keyword", $keyword, 10 * 60);
     } else {
         $this->condition = $conditionCookie;
     }
     if ($this->condition != MainUtil::getCookie("condition")) {
         MainUtil::setCookie("condition", $this->condition, 10 * 60);
     }
 }
Example #9
0
 protected function search()
 {
     $type = EnvUtil::getRequest("type");
     $conditionCookie = MainUtil::getCookie("condition");
     if (empty($conditionCookie)) {
         MainUtil::setCookie("condition", $this->_condition, 10 * 60);
     }
     if ($type == "advanced_search") {
         $search = $_POST["search"];
         $this->_condition = ReportUtil::joinSearchCondition($search);
     } elseif ($type == "normal_search") {
         $keyword = $_POST["keyword"];
         MainUtil::setCookie("keyword", $keyword, 10 * 60);
         $this->_condition = " ( content LIKE '%{$keyword}%' OR subject LIKE '%{$keyword}%' ) ";
     } else {
         $this->_condition = $conditionCookie;
     }
     if ($this->_condition != MainUtil::getCookie("condition")) {
         MainUtil::setCookie("condition", $this->_condition, 10 * 60);
     }
 }
Example #10
0
 private function search()
 {
     $conditionCookie = MainUtil::getCookie("condition");
     if (empty($conditionCookie)) {
         MainUtil::setCookie("condition", $this->_condition, 10 * 60);
     }
     if (EnvUtil::getRequest("search")) {
         $keyword = EnvUtil::getRequest("keyword");
         if (!empty($keyword)) {
             $this->_condition = " (`subject` LIKE '%{$keyword}%' ";
             $users = User::model()->fetchAll("`realname` LIKE '%{$keyword}%'");
             if (!empty($users)) {
                 $uids = ConvertUtil::getSubByKey($users, "uid");
                 $uidStr = implode(",", $uids);
                 $this->_condition .= " OR FIND_IN_SET(`designeeuid`, '{$uidStr}') OR FIND_IN_SET( `chargeuid`, '{$uidStr}' ) ";
                 foreach ($uids as $uid) {
                     $this->_condition .= " OR FIND_IN_SET({$uid}, `participantuid`)";
                 }
             }
             $this->_condition .= ")";
         }
         $daterange = EnvUtil::getRequest("daterange");
         if (!empty($daterange)) {
             $time = explode(" - ", $daterange);
             $starttime = $time[0];
             $endtime = $time[1];
             $st = strtotime($starttime);
             $et = strtotime($endtime);
             $this->_condition = AssignmentUtil::joinCondition($this->_condition, "`starttime` >= {$st} AND `endtime` <= {$et}");
         }
         MainUtil::setCookie("keyword", $keyword, 10 * 60);
         MainUtil::setCookie("daterange", $daterange, 10 * 60);
     } else {
         $this->_condition = $conditionCookie;
     }
     if ($this->_condition != MainUtil::getCookie("condition")) {
         MainUtil::setCookie("condition", $this->_condition, 10 * 60);
     }
 }
Example #11
0
 public function actionSearch()
 {
     $type = EnvUtil::getRequest("type");
     $conditionCookie = MainUtil::getCookie("condition");
     if (empty($conditionCookie)) {
         MainUtil::setCookie("condition", $this->condition, 10 * 60);
     }
     if ($type == "advanced_search") {
         $search = $_POST["search"];
         $methodName = "join" . ucfirst($this->id) . "SearchCondition";
         $this->condition = RecruitUtil::$methodName($search, $this->condition);
     } elseif ($type == "normal_search") {
         $keyword = $_POST["keyword"];
         $this->condition = " rd.realname LIKE '%{$keyword}%' ";
     } else {
         $this->condition = $conditionCookie;
     }
     if ($this->condition != MainUtil::getCookie("condition")) {
         MainUtil::setCookie("condition", $this->condition, 10 * 60);
     }
     $this->actionIndex();
 }
Example #12
0
 public function actionEdit()
 {
     $op = EnvUtil::getRequest("op");
     if ($op && in_array($op, array("enabled", "disabled", "lock")) && Ibos::app()->request->getIsAjaxRequest()) {
         $ids = EnvUtil::getRequest("uid");
         if ($op !== "disabled") {
             MainUtil::checkLicenseLimit();
         }
         return $this->setStatus($op, $ids);
     } else {
         MainUtil::checkLicenseLimit();
     }
     $uid = EnvUtil::getRequest("uid");
     $user = User::model()->fetchByUid($uid);
     if (EnvUtil::submitCheck("userSubmit")) {
         $this->dealWithSpecialParams();
         if (empty($_POST["password"])) {
             unset($_POST["password"]);
         } else {
             $_POST["password"] = md5(md5($_POST["password"]) . $user["salt"]);
             $_POST["lastchangepass"] = TIMESTAMP;
         }
         if (isset($_POST["auxiliarydept"])) {
             $deptIds = StringUtil::getId($_POST["auxiliarydept"]);
             $this->handleAuxiliaryDept($uid, $deptIds, $_POST["deptid"]);
         }
         if (isset($_POST["auxiliarypos"])) {
             $posIds = StringUtil::getId($_POST["auxiliarypos"]);
             $this->handleAuxiliaryPosition($uid, $posIds, $_POST["positionid"]);
         }
         $data = User::model()->create();
         User::model()->updateByUid($uid, $data);
         OrgUtil::update();
         $this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("user/index"));
     } else {
         if (empty($user)) {
             $this->error(Ibos::lang("Request param"), $this->createUrl("user/index"));
         }
         $user["auxiliarydept"] = DepartmentRelated::model()->fetchAllDeptIdByUid($user["uid"]);
         $user["auxiliarypos"] = PositionRelated::model()->fetchAllPositionIdByUid($user["uid"]);
         $account = Ibos::app()->setting->get("setting/account");
         if ($account["mixed"]) {
             $preg = "[0-9]+[A-Za-z]+|[A-Za-z]+[0-9]+";
         } else {
             $preg = "^[A-Za-z0-9\\!\\@\\#\$\\%\\^\\&\\*\\.\\~]{" . $account["minlength"] . ",32}\$";
         }
         $this->setPageTitle(Ibos::lang("Edit user"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("User manager"), "url" => $this->createUrl("user/index")), array("name" => Ibos::lang("Edit user"))));
         $this->render("edit", array("user" => $user, "passwordLength" => $account["minlength"], "preg" => $preg));
     }
 }
Example #13
0
echo $lang["Write report"];
?>
</a>
						<button class="btn" data-action="removeReportsFromList"><?php 
echo $lang["Delete"];
?>
</button>
					</div>
					<form action="<?php 
echo $this->createUrl("default/index", array("param" => "search"));
?>
" method="post">
						<div class="search search-config pull-right span3">
							<input type="text" name="keyword" placeholder="Search" id="mn_search" nofocus value="<?php 
if (EnvUtil::getRequest("param") == "search") {
    echo MainUtil::getCookie("keyword");
}
?>
">
							<a href="javascript:;">search</a>
							<input type="hidden" name="type" value="normal_search">
						</div>
					</form>
				</div>
				<?php 
if (0 < count($reportList)) {
    ?>
					<div class="page-list-mainer">
						<ul class="rp-list" id="rp_list">
							<?php 
    foreach ($reportList as $k => $report) {
Example #14
0
 public function handleCheckUpgrade($event)
 {
     if (!Ibos::app()->user->isGuest && Ibos::app()->user->isadministrator) {
         $upgrade = Ibos::app()->setting->get("setting/upgrade");
         if (!empty($upgrade)) {
             Ibos::app()->setting->set("newversion", 1);
         }
         $cookie = Ibos::app()->setting->get("cookie");
         $needUpgrade = isset($cookie["checkupgrade"]);
         if ($needUpgrade) {
             $checkReturn = upgradeUtil::checkUpgrade();
             Ibos::app()->setting->set("newversion", $checkReturn ? 1 : 0);
             MainUtil::setCookie("checkupgrade", 1, 7200);
         }
     }
 }
Example #15
0
 public function actionDesign()
 {
     if (filter_input(INPUT_GET, "op") == "showcomponet") {
         $type = filter_input(INPUT_GET, "type");
         return $this->renderPartial("ic" . $type, null, false);
     }
     $formId = intval(EnvUtil::getRequest("formid"));
     $mode = EnvUtil::getRequest("mode");
     if (!in_array($mode, array("advanced", "simple"))) {
         $mode = "advanced";
     }
     if (EnvUtil::submitCheck("formhash")) {
         $content = preg_replace("/<form.*?>(.*?)<\\/form>/is", "", $_POST["content"]);
         if ($_POST["op"] == "version") {
             $verMax = FlowFormVersion::model()->getMaxMark($formId);
             $mark = $verMax ? $verMax + 1 : 1;
             $oldForm = FlowFormType::model()->fetchByPk($formId);
             $data = array("formid" => $formId, "printmodel" => $oldForm["printmodel"], "printmodel_short" => $oldForm["printmodelshort"], "script" => $oldForm["script"], "css" => $oldForm["css"], "time" => TIMESTAMP, "mark" => $mark);
             FlowFormVersion::model()->add($data);
             MainUtil::setCookie("form_op_version", 1, 30, 0);
         } else {
             $this->setAllGuideInfo($formId);
             MainUtil::setCookie("form_op_save", 1, 30, 0);
         }
         FlowFormType::model()->modify($formId, array("printmodel" => $content));
         CacheUtil::rm("form_" . $formId);
         $form = new ICFlowForm($formId);
         $form->parser->parse();
         $url = $this->createUrl("formtype/design", array("mode" => $mode, "formid" => $formId));
         $this->redirect($url);
         exit;
     }
     $form = new ICFlowForm($formId);
     $arr = $form->toArray();
     $data = array("form" => $arr, "mode" => $mode, "formid" => $formId);
     $this->layout = false;
     $this->render("designer" . ucfirst($mode), $data, false, array("workflow.item"));
 }
Example #16
0
 public function showMessage($message, $jumpUrl = "", $params = array(), $status = 1, $ajax = false)
 {
     if ($ajax === true || Ibos::app()->request->getIsAjaxRequest()) {
         $data = is_array($ajax) ? $ajax : array();
         $data["msg"] = $message;
         $data["isSuccess"] = $status;
         $data["url"] = $jumpUrl;
         $this->ajaxReturn($data);
     }
     $params["message"] = $message;
     $params["autoJump"] = isset($params["autoJump"]) ? $params["autoJump"] : true;
     if (!$params["autoJump"]) {
         $params["jumpLinksOptions"] = isset($params["jumpLinksOptions"]) && is_array($params["jumpLinksOptions"]) ? $params["jumpLinksOptions"] : array();
     } else {
         $params["jumpLinksOptions"] = array();
     }
     if (!empty($jumpUrl)) {
         $params["jumpUrl"] = $jumpUrl;
     } else {
         $params["jumpUrl"] = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "";
     }
     if (!isset($params["timeout"])) {
         if ($status) {
             $params["timeout"] = 1;
         } else {
             $params["timeout"] = 5;
         }
     }
     $params["msgTitle"] = $status ? Ibos::lang("Operation successful", "message") : Ibos::lang("Operation failure", "message");
     if (isset($params["closeWin"])) {
         $params["jumpUrl"] = "javascript:window.close();";
     }
     $params["script"] = isset($params["script"]) ? trim($params["script"]) : null;
     if (!isset($params["messageType"])) {
         $params["messageType"] = $status ? "success" : "error";
     }
     if ($status) {
         MainUtil::setCookie("globalRemind", urlencode($params["message"]), 30);
         MainUtil::setCookie("globalRemindType", $params["messageType"], 30);
         $this->redirect($params["jumpUrl"]);
     } else {
         $viewPath = $basePath = Ibos::app()->getViewPath();
         $viewFile = $this->resolveViewFile("showMessage", $viewPath, $basePath);
         $output = $this->renderFile($viewFile, $params, true);
         echo $output;
     }
     exit;
 }
Example #17
0
 public function update()
 {
     if ($this->sid !== null) {
         if ($this->isNew) {
             $this->delete();
             Session::model()->add($this->var);
         } else {
             if (IN_DASHBOARD) {
                 MainUtil::setCookie("lastactivity", TIMESTAMP);
             }
             Session::model()->updateByPk($this->var["sid"], $this->var);
         }
         Ibos::app()->setting->set("session", $this->var);
         MainUtil::setCookie("sid", $this->sid, 86400);
     }
 }
Example #18
0
 protected function complete($runId, $processId, $opflag = 1, $topflag = 0, $inajax = 0, $flowProcess = "", $op = "")
 {
     $flowType = FlowRun::model()->fetchFlowTypeByRunId($runId);
     if ($opflag || $op == "manage") {
         $pidNext = $processId + 1;
         if (FlowRunProcess::model()->getHasDefaultStep($runId, $pidNext)) {
             if ($op != "manage") {
                 if ($inajax) {
                     $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Subsequent default steps in the process")));
                 } else {
                     $this->error(Ibos::lang("Subsequent default steps in the process"), $this->createUrl("list/index"));
                 }
             } else {
                 FlowRunProcess::model()->deleteByIDScope($runId, $pidNext);
             }
         }
         if ($op != "manage") {
             FlowRunProcess::model()->updateAll(array("delivertime" => TIMESTAMP), sprintf("runid = %d AND processid = %d AND uid = %d", $runId, $processId, $this->uid));
         } else {
             FlowRunProcess::model()->updateAll(array("delivertime" => TIMESTAMP), sprintf("runid = %d AND delivertime = 0", $runId));
             FlowRunProcess::model()->updateAll(array("processtime" => TIMESTAMP), sprintf("runid = %d AND processtime = 0", $runId));
         }
         FlowRunProcess::model()->updateAll(array("flag" => FlowConst::PRCS_DONE), "runid = {$runId}");
         FlowRun::model()->modify($runId, array("endtime" => TIMESTAMP));
         $content = $op != "manage" ? Ibos::lang("Form endflow") : Ibos::app()->user->realname . Ibos::lang("Forced end process");
         WfCommonUtil::runlog($runId, $processId, $flowProcess, $this->uid, 1, $content);
         $parentRun = FlowRun::model()->fetchParentByRunID($runId);
         if ($parentRun != 0) {
             $parentFlowId = FlowRun::model()->fetchFlowIdByRunId($parentRun);
             $temp = FlowRunProcess::model()->fetchIDByChild($parentRun, $runId);
             if ($temp) {
                 $parentProcessId = $temp["processid"];
                 $parentFlowprocess = $temp["flowprocess"];
             }
             $parentProcess = FlowProcess::model()->fetchProcess($parentFlowId, $parentFlowprocess);
             if ($parentProcess) {
                 $prcsBack = $parentProcess["processto"];
                 $backUserOp = $parentProcess["autouserop"];
                 $backUser = $parentProcess["autouser"];
             }
             FlowRunProcess::model()->updateToOver($parentRun, $parentProcessId, $parentFlowprocess);
             if ($prcsBack != "") {
                 $parentProcessIdNew = $parentProcessId + 1;
                 $data = array("runid" => $parentRun, "processid" => $parentProcessIdNew, "uid" => $backUserOp, "flag" => 1, "flowprocess" => $prcsBack, "opflag" => 1, "topflag" => 0, "parent" => $parentFlowprocess);
                 FlowRunProcess::model()->add($data);
                 $backUserArr = explode(",", $backUser);
                 for ($k = 0; $k < count($backUserArr); $k++) {
                     if ($backUserArr[$k] != "" && $backUserArr[$k] != $backUserOp) {
                         $data = array("runid" => $parentRun, "processid" => $parentProcessIdNew, "uid" => $backUserArr[$k], "flag" => 1, "flowprocess" => $prcsBack, "opflag" => 0, "topflag" => 0, "parent" => $parentFlowprocess);
                         FlowRunProcess::model()->add($data);
                     }
                 }
             } elseif (!FlowRunProcess::model()->getIsNotOver($parentRun)) {
                 FlowRun::model()->modify($parentRun, array("endtime" => TIMESTAMP));
             }
         }
         $flag = EnvUtil::getRequest("flag");
         if ($flowType == 2 && $flag != 1) {
             $inajax && $this->ajaxReturn(array("isSuccess" => true));
             $this->redirect($this->createUrl("list/index"));
         }
         $inajax && $this->ajaxReturn(array("isSuccess" => true));
     } else {
         $flowId = FlowRun::model()->fetchFlowIDByRunID($runId);
         if ($topflag == 2) {
             if (!FlowRunProcess::model()->getHasOtherOPUser($runId, $processId, $flowProcess, $this->uid)) {
                 if (is_null($flowProcess) || $flowProcess == "0") {
                     $turnpage = "showNextFree";
                 } else {
                     $turnpage = "showNext";
                 }
                 $param = array("flowid" => $flowId, "processid" => $processId, "flowprocess" => $flowProcess, "runid" => $runId);
                 $url = $this->createUrl("handle/" . $turnpage, array("key" => WfCommonUtil::param($param), "topflag" => $topflag));
                 $this->ajaxReturn(array("status" => 2, "url" => $url));
             }
         }
         $con = sprintf("runid = %d AND processid = %d AND uid = %d", $runId, $processId, $this->uid);
         if ($flowProcess !== "" && $flowProcess !== "0") {
             $con .= " AND flowprocess = " . $flowProcess;
         }
         FlowRunProcess::model()->updateAll(array("flag" => "4", "delivertime" => TIMESTAMP), $con);
         if (!FlowRunProcess::model()->getHasOtherAgentNotDone($runId, $processId)) {
             $run = FlowRun::model()->fetchByPk($runId);
             $uid = FlowRunProcess::model()->fetchNotDoneOpuser($runId, $processId);
             if ($uid) {
                 $param = array("runid" => $runId, "flowid" => $flowId, "processid" => $processId, "flowprocess" => $flowProcess);
                 $config = array("{runname}" => $run["name"], "{url}" => Ibos::app()->urlManager->createUrl("workflow/form/index", array("key" => WfCommonUtil::param($param))));
                 Notify::model()->sendNotify($uid, "workflow_sign_notice", $config);
             }
         }
         MainUtil::setCookie("flow_complete_flag", 1, 30);
         $url = Ibos::app()->urlManager->createUrl("workflow/list/index", array("op" => "list", "type" => "trans", "sort" => "all"));
         $this->redirect($url);
     }
 }
 private function checkAccess()
 {
     if (isset($this->user["uid"]) && $this->user["uid"] == 0) {
         $this->_access = 0;
     } elseif ($this->_isAdministrator) {
         $lastactivity = MainUtil::getCookie("lastactivity");
         $frozenTime = intval(TIMESTAMP - $lastactivity);
         if ($frozenTime < $this->_cookieLife) {
             $this->_access = 1;
             MainUtil::setCookie("lastactivity", TIMESTAMP);
         } else {
             $this->_access = -1;
         }
     } else {
         $this->_access = -1;
     }
     if ($this->_access == 1) {
         Ibos::app()->session->update();
     } else {
         $requestUrl = Ibos::app()->getRequest()->getUrl();
         $loginUrl = Ibos::app()->getUrlManager()->createUrl($this->loginUrl);
         if (strpos($requestUrl, $loginUrl) !== 0) {
             $this->userLogin();
         }
     }
 }
Example #20
0
 private function search()
 {
     $uid = $this->uid;
     $complete = $this->complete;
     $type = EnvUtil::getRequest("type");
     $conditionCookie = MainUtil::getCookie("condition");
     if (empty($conditionCookie)) {
         MainUtil::setCookie("condition", $this->_condition, 10 * 60);
     }
     if ($type == "normal_search") {
         $keyword = EnvUtil::getRequest("keyword");
         MainUtil::setCookie("keyword", $keyword, 10 * 60);
         $pTasks = Tasks::model()->fetchPTasks($uid, $complete, $keyword);
         $cTasks = Tasks::model()->fetchCTasks($uid, $complete, $keyword);
         $array = array();
         foreach ($pTasks as $task) {
             $array[] = $task["id"];
         }
         foreach ($cTasks as $task) {
             $array[] = $task["pid"];
         }
         $pids = array_unique($array);
         $pidTemp = "";
         foreach ($pids as $v) {
             $pidTemp .= "\"" . $v . "\",";
         }
         $pidStr = rtrim($pidTemp, ",");
         if (!empty($pidStr)) {
             $this->_condition = " uid='{$uid}' AND id IN({$pidStr}) AND allcomplete='{$complete}'";
         } else {
             $this->_condition = " uid='{$uid}' AND id IN('') AND allcomplete='{$complete}'";
         }
     } else {
         $this->_condition = $conditionCookie;
     }
     if ($this->_condition != MainUtil::getCookie("condition")) {
         MainUtil::setCookie("condition", $this->_condition, 10 * 60);
     }
 }
Example #21
0
 public function actionForm()
 {
     $key = EnvUtil::getRequest("key");
     if ($key) {
         $this->key = $key;
         $param = WfCommonUtil::param($key, "DECODE");
         $this->_extraAttributes = $param;
         $this->runid = $param["runid"];
         $this->flowid = $param["flowid"];
         $this->processid = $param["processid"];
         $this->flowprocess = $param["flowprocess"];
     } else {
         $this->ajaxReturn("<script>alert('工作流数据错误,可能已转交或被回退')</script>", "EVAL");
     }
     $flow = new ICFlowType(intval($this->flowid));
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $data = array();
         $readOnly = $_POST["readonly"];
         $hidden = $_POST["hidden"];
         $saveflag = $_POST["saveflag"];
         $fbAttachmentID = $_POST["fbattachmentid"];
         $attachmentID = $_POST["attachmentid"];
         $content = isset($_POST["content"]) ? StringUtil::filterCleanHtml($_POST["content"]) : "";
         $topflag = $_POST["topflag"];
         $this->checkRunAccess($this->runid, $this->processid, $this->createUrl("list/index"));
         if (FlowRunProcess::model()->getIsOp($this->uid, $this->runid, $this->processid)) {
             $enablefiledArr = explode(",", $_POST["enablefiled"]);
             $formData = array();
             $structure = $flow->form->parser->structure;
             foreach ($structure as $index => $item) {
                 if (!in_array("data_" . $item["itemid"], $enablefiledArr)) {
                     continue;
                 }
                 $value = isset($_POST[$index]) ? $_POST[$index] : "";
                 $formData[$index] = $value;
             }
             $formData && $this->handleImgComponent($formData);
             $formData && FlowDataN::model()->update($this->flowid, $this->runid, $formData);
         }
         if (!empty($content) || !empty($fbAttachmentID)) {
             $fbData = array("runid" => $this->runid, "processid" => $this->processid, "flowprocess" => $this->flowprocess, "uid" => $this->uid, "content" => $content, "attachmentid" => $fbAttachmentID, "edittime" => TIMESTAMP);
             FlowRunfeedback::model()->add($fbData);
             AttachUtil::updateAttach($fbAttachmentID, $this->runid);
         }
         FlowRun::model()->modify($this->runid, array("attachmentid" => $attachmentID));
         AttachUtil::updateAttach($attachmentID, $this->runid);
         $plugin = FlowProcess::model()->fetchSavePlugin($this->flowid, $this->flowprocess);
         if (!empty($plugin)) {
             $pluginFile = "./system/modules/workflow/plugins/save/" . $plugin;
             if (file_exists($pluginFile)) {
                 include_once $pluginFile;
             }
         }
         switch ($saveflag) {
             case "save":
                 MainUtil::setCookie("save_flag", 1, 300);
                 $this->ajaxReturn("<script>alert('保存成功')</script>", "EVAL");
                 break;
             case "turn":
                 MainUtil::setCookie("turn_flag", 1, 300);
                 break;
             case "end":
             case "finish":
                 if ($saveflag == "end") {
                     $param = array("opflag" => 1);
                 } else {
                     $param = array("topflag" => $topflag);
                 }
                 $this->redirect($this->createUrl("handle/complete", array_merge($param, array("key" => $this->key))));
                 break;
             default:
                 break;
         }
     } else {
         $this->checkRunDel();
         $this->checkIllegal();
         $len = strlen($flow->autonum);
         for ($i = 0; $i < $flow->autolen - $len; $i++) {
             $flow->autonum = "0" . $flow->autonum;
         }
         $runProcess = new ICFlowRunProcess($this->runid, $this->processid, $this->flowprocess, $this->uid);
         $checkitem = "";
         if ($flow->isFixed()) {
             $process = new ICFlowProcess($this->flowid, $this->flowprocess);
             if ($runProcess->opflag != 0) {
                 $checkitem = $process->checkitem;
             }
             if (0 < $process->allowback) {
                 $isAllowBack = true;
             }
         } else {
             $process = array();
         }
         $run = new ICFlowRun($this->runid);
         $hasOtherOPUser = FlowRunProcess::model()->getHasOtherOPUser($this->runid, $this->processid, $this->flowprocess, $this->uid);
         if ($runProcess->flag == self::UN_RECEIVE) {
             $this->setSelfToHandle($runProcess->id);
         }
         if ($runProcess->topflag == 1 && $runProcess->opflag == 1) {
             FlowRunProcess::model()->updateTop($this->uid, $this->runid, $this->processid, $this->flowprocess);
         }
         if ($runProcess->topflag == 2) {
             if (!$hasOtherOPUser) {
                 $runProcess->opflag = 1;
             }
         }
         if ($this->processid == 1) {
             FlowRun::model()->modify($this->runid, array("beginuser" => $this->uid, "begintime" => TIMESTAMP));
             if (!empty($run->parentrun)) {
                 $this->setParentToHandle($run->parentrun, $this->runid);
             }
         }
         $preProcess = $this->processid - 1;
         if ($preProcess) {
             if ($flow->isFree() || $flow->isFixed() && $process->gathernode != self::FORCE) {
                 $this->setProcessDone($preProcess);
             }
         }
         if ($flow->isFixed() && $process->timeout != 0) {
             if ($runProcess->flag == self::UN_RECEIVE && $this->processid !== 1) {
                 $processBegin = FlowRunProcess::model()->fetchDeliverTime($this->runid, $preProcess);
             } else {
                 $processBegin = $runProcess->processtime ? $runProcess->processtime : TIMESTAMP;
             }
             $timeUsed = TIMESTAMP - $processBegin;
         }
         $viewer = new ICFlowFormViewer(array("flow" => $flow, "form" => $flow->getForm(), "run" => $run, "process" => $process, "rp" => $runProcess));
         $data = array_merge(array("flow" => $flow->toArray(), "run" => $run->toArray(), "process" => !empty($process) ? $process->toArray() : $process, "checkItem" => $checkitem, "prcscache" => WfCommonUtil::loadProcessCache($this->flowid), "rp" => $runProcess->toArray(), "rpcache" => WfPreviewUtil::getViewFlowData($this->runid, $this->flowid, $this->uid, $remindUid), "fbSigned" => $this->isFeedBackSigned(), "allowBack" => isset($isAllowBack) ? $isAllowBack : false, "timeUsed" => isset($timeUsed) ? $timeUsed : 0, "uploadConfig" => AttachUtil::getUploadConfig()), $viewer->render(true, false, true));
         $formdata = array("run" => $data["run"], "flow" => $data["flow"], "enableArr" => "", "valueArr" => "", "emptyArr" => "");
         $data["enablefiled"] = array();
         if (is_array($data["model"]["itemData"])) {
             if (isset($data["prcscache"][$data["rp"]["flowprocess"]]["processitem"])) {
                 $enableFiled = explode(",", $data["prcscache"][$data["rp"]["flowprocess"]]["processitem"]);
             } else {
                 $enableFiled = array();
             }
             foreach ($data["model"]["itemData"] as $k => $v) {
                 if (substr($k, 0, 5) != "data_") {
                     continue;
                 }
                 $data["model"]["structure"][$k]["value"] = $v;
                 if (in_array($data["model"]["structure"][$k]["data-title"], $enableFiled)) {
                     $data["enablefiled"][] = $k;
                     $data["model"]["structure"][$k]["value"] = $data["model"]["eleout"][$k];
                     $formdata["enableArr"][] = $data["model"]["structure"][$k];
                     continue;
                 }
                 if ($v != "") {
                     $formdata["valueArr"][] = $data["model"]["structure"][$k];
                     continue;
                 }
                 $formdata["emptyArr"][] = $data["model"]["structure"][$k];
             }
         }
         $data["model"] = $this->renderPartial("application.modules.mobile.views.work.form", $formdata, true);
         $data["model"] .= "<input type=\"hidden\" name=\"key\" value=\"" . $this->key . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"hidden\" value=\"" . $data["hidden"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"readonly\" value=\"" . $data["readonly"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"attachmentid\" id=\"attachmentid\" value=\"" . $data["run"]["attachmentid"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"fbattachmentid\" id=\"fbattachmentid\" value=\"\">";
         $data["model"] .= "<input type=\"hidden\" name=\"topflag\" value=\"" . $data["rp"]["opflag"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"saveflag\">";
         $data["model"] .= "<input type=\"hidden\" name=\"formhash\" value=\"" . FORMHASH . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"enablefiled\" value=\"" . implode(",", $data["enablefiled"]) . "\">";
         if ($this->isEnabledAttachment($flow, $run, $process, $runProcess)) {
             $data["allowAttach"] = true;
             if (!empty($run->attachmentid)) {
                 $attachPurv = $this->getAttachPriv($flow, $process, $runProcess);
                 $down = $attachPurv["down"];
                 $edit = $attachPurv["edit"];
                 $del = $attachPurv["del"];
                 $data["attachData"] = AttachUtil::getAttach($run->attachmentid, $down, $down, $edit, $del);
             }
         } else {
             $data["allowAttach"] = false;
         }
         if ($flow->isFixed() && $process->feedback != 1) {
             $data["allowFeedback"] = true;
             $data["feedback"] = WfHandleUtil::loadFeedback($flow->getID(), $run->getID(), $flow->type, $this->uid);
         } else {
             $data["allowFeedback"] = false;
         }
         if ($flow->isFree() && $runProcess->opflag == "1") {
             $hasDefault = FlowRunProcess::model()->getHasDefaultStep($this->runid, $this->processid);
             if (!$hasDefault) {
                 $data["defaultEnd"] = true;
             }
         }
         if ($flow->isFree() && $runProcess->topflag == "2") {
             if (!$hasOtherOPUser) {
                 $data["otherEnd"] = true;
             }
         }
         $this->ajaxReturn($data, "JSONP");
     }
 }
Example #22
0
 public function actionSendRemind()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $toId = $_POST["toid"];
         $runId = intval($_POST["runid"]);
         $message = StringUtil::filterCleanHtml($_POST["message"]);
         Notify::model()->sendNotify($toId, "workflow_todo_remind", array("{message}" => $message));
         MainUtil::setCookie("workflow_todo_remind_" . $runId, 1, 60);
         $this->ajaxReturn(array("isSuccess" => true));
     }
 }
Example #23
0
 $properties = array("company_id" => $cid, "company_token" => $imCfg["token"], "app_id" => $imCfg["appid"], "client_ip" => EnvUtil::getClientIp());
 $api = new BQQApi($properties);
 $status = $api->getVerifyStatus(array("open_id" => $openId, "hashskey" => $hashskey));
 if ($status["ret"] == 0) {
     $config = @(include PATH_ROOT . "/system/config/config.php");
     if (empty($config)) {
         throw new Exception(Ibos::Lang("Config not found", "error"));
     } else {
         define("IN_MOBILE", EnvUtil::checkInMobile());
         $global = array("clientip" => EnvUtil::getClientIp(), "config" => $config, "timestamp" => time());
         Ibos::app()->setting->copyFrom($global);
         handleloadsyscache();
         $saltkey = MainUtil::getCookie("saltkey");
         if (empty($saltkey)) {
             $saltkey = StringUtil::random(8);
             MainUtil::setCookie("saltkey", $saltkey, 86400 * 30, 1, 1);
         }
         $curUser = User::model()->fetchByUid($uid);
         $identity = new ICUserIdentity($curUser["username"], $curUser["password"]);
         $identity->setId($uid);
         $identity->setPersistentStates($curUser);
         $ip = Ibos::app()->setting->get("clientip");
         foreach ($_COOKIE as $k => $v) {
             $cookiePath = $config["cookie"]["cookiepath"];
             $cookieDomain = $config["cookie"]["cookiedomain"];
             $secure = $_SERVER["SERVER_PORT"] == 443 ? 1 : 0;
             @setcookie($k, "", time() - 86400, $cookiePath, $cookieDomain, $secure, false);
         }
         $account = Ibos::app()->setting->get("setting/account");
         $user = Ibos::app()->user;
         if ($account["allowshare"] != 1) {
Example #24
0
 public function updateUserCount($creditArr, $uids = 0, $checkGroup = true, $ruletxt = "")
 {
     if (Ibos::app()->user->isGuest) {
         return null;
     }
     $setting = Ibos::app()->setting->toArray();
     if (!$uids) {
         $uids = intval(Ibos::app()->user->uid);
     }
     $uids = is_array($uids) ? $uids : array($uids);
     if ($uids && ($creditArr || $this->_extraSql)) {
         if ($this->_extraSql) {
             $creditArr = array_merge($creditArr, $this->_extraSql);
         }
         $sql = array();
         $allowkey = array("extcredits1", "extcredits2", "extcredits3", "extcredits4", "extcredits5", "oltime", "attachsize");
         $creditRemind = $setting["setting"]["creditremind"] && Ibos::app()->user->uid && $uids == array(Ibos::app()->user->uid);
         if ($creditRemind) {
             if (!isset($setting["cookiecredits"])) {
                 $setting["cookiecredits"] = !empty($_COOKIE["creditnotice"]) ? explode("D", $_COOKIE["creditremind"]) : array_fill(0, 6, 0);
                 for ($i = 1; $i <= 5; $i++) {
                     $setting["cookiecreditsbase"][$i] = UserUtil::getUserProfile("extcredits" . $i);
                 }
             }
             if ($ruletxt) {
                 $setting["cookiecreditsrule"][$ruletxt] = $ruletxt;
             }
         }
         foreach ($creditArr as $key => $value) {
             if (!empty($key) && $value && in_array($key, $allowkey)) {
                 $sql[$key] = $value;
                 if ($creditRemind && substr($key, 0, 10) == "extcredits") {
                     $i = substr($key, 10);
                     $setting["cookiecredits"][$i] += $value;
                 }
             }
         }
         if ($creditRemind) {
             MainUtil::setCookie("creditremind", implode("D", $setting["cookiecredits"]) . "D" . Ibos::app()->user->uid);
             MainUtil::setCookie("creditbase", "0D" . implode("D", $setting["cookiecreditsbase"]));
             if (!empty($setting["cookiecreditsrule"])) {
                 MainUtil::setCookie("creditrule", strip_tags(implode("\t", $setting["cookiecreditsrule"])));
             }
         }
         Ibos::app()->setting->copyFrom($setting);
         if ($sql) {
             UserCount::model()->increase($uids, $sql);
         }
         if ($checkGroup && count($uids) == 1) {
             $this->checkUserGroup($uids[0]);
         }
         $this->setExtraSql(array());
     }
 }
Example #25
0
        echo ENGINE;
        ?>
" alt="">
									</span>
									<span class="avatar-desc"><strong><?php 
        echo $user['realname'];
        ?>
</strong></span>
								</a>
							</li>
							<?php 
    }
    ?>
							<li class="da-bell">
								<?php 
    if (MainUtil::getCookie('reminded_' . strtotime($date))) {
        ?>
									<a href="javascript:" class="">
										<i class="o-da-reminded"></i>
										<span class="avatar-desc"><strong><?php 
        echo $lang['Reminded'];
        ?>
</strong></span>
									</a>
								<?php 
    } else {
        ?>
									<a href="javascript:" class="avatar-box" data-action="remindUnderling">
										<i class="o-da-bell"></i>
										<span class="avatar-desc"><strong><?php 
        echo $lang['Remind to write log'];
Example #26
0
 private function remind()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $date = EnvUtil::getRequest("date");
         $dateTime = strtotime($date);
         $getUids = trim(EnvUtil::getRequest("uids"), ",");
         $uidArr = explode(",", $getUids);
         $uid = Ibos::app()->user->uid;
         if (empty($uidArr)) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("No user to remind")));
         }
         foreach ($uidArr as $subUid) {
             if (!UserUtil::checkIsSub($uid, $subUid)) {
                 $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("No permission to remind")));
             }
         }
         $dashboardConfig = $this->getDiaryConfig();
         $config = array("{name}" => User::model()->fetchRealnameByUid($uid), "{title}" => Ibos::lang("Remind title", "", array("y" => date("Y", $dateTime), "m" => date("m", $dateTime), "d" => date("d", $dateTime))), "{content}" => $dashboardConfig["remindcontent"]);
         if (0 < count($uidArr)) {
             Notify::model()->sendNotify($uidArr, "diary_message", $config, $uid);
         }
         $todayTime = strtotime(date("Y-m-d"));
         MainUtil::setCookie("reminded_" . $dateTime, md5($dateTime), $todayTime + 24 * 60 * 60 - TIMESTAMP);
         $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Remind succeed")));
     }
 }
Example #27
0
?>
</span>
					
				</div>
			</div>
		</div>
		<div class="page-list">
			<div class="page-list-header">
                <form action="<?php 
echo $this->createUrl('share/index', array('op' => 'personal', 'param' => 'search', 'uid' => $user['uid']));
?>
" method="post">
                    <div class="search search-config pull-right span3">
                        <input type="text" name="keyword" placeholder="Search" id="mn_search" nofocus value="<?php 
if (EnvUtil::getRequest('param') == 'search') {
    echo MainUtil::getCookie('keyword');
}
?>
">
                        <a href="javascript:;">search</a>
                        <input type="hidden" name="type" value="normal_search">
                    </div>
                </form>
            </div>
			<div class="page-list-mainer">
				<?php 
if (count($data) > 0) {
    ?>
					<ul class="da-list" id="da_list">
						<?php 
    foreach ($data as $diary) {
Example #28
0
 public function actionLogout()
 {
     Ibos::app()->user->logout();
     MainUtil::setCookie("autologin", 0, 0);
     $this->ajaxReturn(array("login" => false), "JSONP");
 }
Example #29
0
<!-- Template:常用菜单项模板 -->
<script type="text/ibos-template" id="mu_item_tpl">
    <li data-module="<%=mod%>">
    <a href="<%=href%>" title="<%=desc%>">
    <div class="posr">
    <img width="64" height="64" class="mbs" src="<%=src%>">
    <span class="bubble" data-bubble="<%=mod%>"></span>
    </div>
    <div class="cm-menu-title"><%=title%></div>
    </a>
    </li>
</script>
<script>
    Ibos.app.s({
        "guideNextTime": <?php 
if (MainUtil::getCookie('guideNextTime') == md5(Ibos::app()->user->uid)) {
    echo 1;
} else {
    echo 0;
}
?>
,
        "assetUrl": "<?php 
echo $assetUrl;
?>
",
        "refreshInterval": 10000 // @debug: 原本为 10000
    })
</script>
<script src='<?php 
echo STATICURL;
Example #30
0
 public function actionIndex()
 {
     $flow = new ICFlowType(intval($this->flowid));
     if (EnvUtil::submitCheck("formhash")) {
         $data = array();
         $readOnly = $_POST["readonly"];
         $hidden = $_POST["hidden"];
         $saveflag = $_POST["saveflag"];
         $fbAttachmentId = $_POST["fbattachmentid"];
         $attachmentId = $_POST["attachmentid"];
         $content = isset($_POST["content"]) ? StringUtil::filterCleanHtml($_POST["content"]) : "";
         $topflag = $_POST["topflag"];
         $this->checkRunAccess($this->runid, $this->processid, $this->createUrl("list/index"));
         if (FlowRunProcess::model()->getIsOp($this->uid, $this->runid, $this->processid)) {
             $formData = array();
             $structure = $flow->form->parser->structure;
             foreach ($structure as $index => $item) {
                 if (StringUtil::findIn($hidden, $item["itemid"]) || StringUtil::findIn($readOnly, $item["itemid"])) {
                     continue;
                 }
                 $value = isset($_POST[$index]) ? $_POST[$index] : "";
                 $formData[$index] = $value;
             }
             $formData && $this->handleImgComponent($formData);
             $formData && FlowDataN::model()->update($this->flowid, $this->runid, $formData);
         }
         if (!empty($content) || !empty($fbAttachmentId)) {
             $fbData = array("runid" => $this->runid, "processid" => $this->processid, "flowprocess" => $this->flowprocess, "uid" => $this->uid, "content" => $content, "attachmentid" => $fbAttachmentId, "edittime" => TIMESTAMP);
             FlowRunfeedback::model()->add($fbData);
             AttachUtil::updateAttach($fbAttachmentId, $this->runid);
         }
         FlowRun::model()->modify($this->runid, array("attachmentid" => $attachmentId));
         AttachUtil::updateAttach($attachmentId, $this->runid);
         $plugin = FlowProcess::model()->fetchSavePlugin($this->flowid, $this->flowprocess);
         if (!empty($plugin)) {
             $pluginFile = "./system/modules/workflow/plugins/save/" . $plugin;
             if (file_exists($pluginFile)) {
                 include_once $pluginFile;
             }
         }
         switch ($saveflag) {
             case "save":
                 MainUtil::setCookie("save_flag", 1);
                 $this->redirect($this->createUrl("form/index", array("key" => $this->key)));
                 break;
             case "turn":
                 MainUtil::setCookie("turn_flag", 1);
                 $this->redirect($this->createUrl("form/index", array("key" => $this->key)));
                 break;
             case "end":
             case "finish":
                 if ($saveflag == "end") {
                     $param = array("opflag" => 1);
                 } else {
                     $param = array("topflag" => $topflag);
                 }
                 $this->redirect($this->createUrl("handle/complete", array_merge($param, array("key" => $this->key))));
                 break;
             default:
                 break;
         }
     } else {
         $this->checkRunDel();
         $this->checkIllegal();
         $len = strlen($flow->autonum);
         for ($i = 0; $i < $flow->autolen - $len; $i++) {
             $flow->autonum = "0" . $flow->autonum;
         }
         $runProcess = new ICFlowRunProcess($this->runid, $this->processid, $this->flowprocess, $this->uid);
         $checkitem = "";
         if ($flow->isFixed()) {
             $process = new ICFlowProcess($this->flowid, $this->flowprocess);
             if ($runProcess->opflag != 0) {
                 $checkitem = $process->checkitem;
             }
             if (0 < $process->allowback) {
                 $isAllowBack = $this->isAllowBack($runProcess->parent);
             }
         } else {
             $process = array();
         }
         $run = new ICFlowRun($this->runid);
         $hasOtherOPUser = FlowRunProcess::model()->getHasOtherOPUser($this->runid, $this->processid, $this->flowprocess, $this->uid);
         if ($runProcess->flag == FlowConst::PRCS_UN_RECEIVE) {
             $this->setSelfToHandle($runProcess->id);
         }
         if ($runProcess->topflag == 1 && $runProcess->opflag == 1) {
             FlowRunProcess::model()->updateTop($this->uid, $this->runid, $this->processid, $this->flowprocess);
         }
         if ($runProcess->topflag == 2) {
             if (!$hasOtherOPUser) {
                 $runProcess->opflag = 1;
             }
         }
         if ($this->processid == 1) {
             FlowRun::model()->modify($this->runid, array("beginuser" => $this->uid, "begintime" => TIMESTAMP));
             if (!empty($run->parentrun)) {
                 $this->setParentToHandle($run->parentrun, $this->runid);
             }
         }
         $preProcess = $this->processid - 1;
         if ($preProcess) {
             if ($flow->isFree() || $flow->isFixed() && $process->gathernode != 1) {
                 $this->setProcessDone($preProcess);
             }
         }
         if ($flow->isFixed() && $process->timeout != 0) {
             if ($runProcess->flag == FlowConst::PRCS_UN_RECEIVE && $this->processid != 1) {
                 $processBegin = FlowRunProcess::model()->fetchDeliverTime($this->runid, $preProcess);
             } else {
                 $processBegin = $runProcess->processtime ? $runProcess->processtime : TIMESTAMP;
             }
             $timeUsed = TIMESTAMP - $processBegin;
         }
         $viewer = new ICFlowFormViewer(array("flow" => $flow, "form" => $flow->getForm(), "run" => $run, "process" => $process, "rp" => $runProcess));
         $data = array_merge(array("flow" => $flow->toArray(), "run" => $run->toArray(), "processid" => $this->processid, "process" => !empty($process) ? $process->toArray() : $process, "checkItem" => $checkitem, "prcscache" => WfCommonUtil::loadProcessCache($this->flowid), "rp" => $runProcess->toArray(), "fbSigned" => $this->isFeedBackSigned(), "allowBack" => isset($isAllowBack) ? $isAllowBack : false, "timeUsed" => isset($timeUsed) ? $timeUsed : 0, "uploadConfig" => AttachUtil::getUploadConfig()), $viewer->render());
         if ($this->isEnabledAttachment($flow, $run, $process, $runProcess)) {
             $data["allowAttach"] = true;
             if (!empty($run->attachmentid)) {
                 $attachPurv = $this->getAttachPriv($flow, $process, $runProcess);
                 $down = $attachPurv["down"];
                 $edit = $attachPurv["edit"];
                 $del = $attachPurv["del"];
                 $data["attachData"] = AttachUtil::getAttach($run->attachmentid, $down, $down, $edit, $del);
             }
         } else {
             $data["allowAttach"] = false;
         }
         if ($flow->isFixed() && $process->feedback != 1 || $flow->isFree()) {
             $data["allowFeedback"] = true;
         } else {
             $data["allowFeedback"] = false;
         }
         if ($data["allowBack"]) {
             $data["backlist"] = $this->getBackList($runProcess->flowprocess);
         }
         $data["feedback"] = WfHandleUtil::loadFeedback($flow->getID(), $run->getID(), $flow->type, $this->uid);
         if ($flow->isFree() && $runProcess->opflag == "1") {
             $hasDefault = FlowRunProcess::model()->getHasDefaultStep($this->runid, $this->processid);
             if (!$hasDefault) {
                 $data["defaultEnd"] = true;
             }
         }
         if ($flow->isFree() && $runProcess->topflag == "2") {
             if (!$hasOtherOPUser) {
                 $data["otherEnd"] = true;
             }
         }
         $this->setPageTitle(Ibos::lang("Handle work"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang("My work"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Handle work"))));
         $this->render("index", $data);
     }
 }