Exemple #1
0
 private function checkIsGuided()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $uid = Ibos::app()->user->uid;
         $isadministrator = $uid == 1 ? true : false;
         $user = User::model()->fetchByAttributes(array("uid" => $uid));
         $newcomer = $user["newcomer"];
         if (!$newcomer) {
             $this->ajaxReturn(array("isNewcommer" => false));
         } else {
             if ($uid == 1) {
                 $guideAlias = "application.modules.main.views.default.adminGuide";
                 $unit = unserialize(Setting::model()->fetchSettingValueByKey("unit"));
                 $data["fullname"] = $unit["fullname"];
                 $data["shortname"] = $unit["shortname"];
                 $data["pageUrl"] = $this->getPageUrl();
             } else {
                 $data["swfConfig"] = AttachUtil::getUploadConfig($uid);
                 $data["uid"] = $uid;
                 $guideAlias = "application.modules.main.views.default.initGuide";
             }
             $account = unserialize(Setting::model()->fetchSettingValueByKey("account"));
             $data["account"] = $account;
             if ($account["mixed"]) {
                 $data["preg"] = "[0-9]+[A-Za-z]+|[A-Za-z]+[0-9]+";
             } else {
                 $data["preg"] = "^[A-Za-z0-9\\!\\@\\#\$\\%\\^\\&\\*\\.\\~]{" . $account["minlength"] . ",32}\$";
             }
             $data["lang"] = Ibos::getLangSource("main.default");
             $data["assetUrl"] = $this->getAssetUrl();
             $guideView = $this->renderPartial($guideAlias, $data, true);
             $this->ajaxReturn(array("isNewcommer" => true, "guideView" => $guideView, "isadministrator" => $isadministrator));
         }
     }
 }
 protected function showDetail()
 {
     $repid = intval(EnvUtil::getRequest("repid"));
     $isShowTitle = EnvUtil::getRequest("isShowTitle");
     $fromController = EnvUtil::getRequest("fromController");
     $report = Report::model()->fetchByPk($repid);
     $uid = Ibos::app()->user->uid;
     Report::model()->addReaderuid($report, $uid);
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = array();
     if (!empty($report["attachmentid"])) {
         $attachs = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
     }
     $readers = array();
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if ($report["stamp"] != 0) {
         $stamp = Stamp::model()->fetchStampById($report["stamp"]);
         $stampUrl = FileUtil::fileName(Stamp::STAMP_PATH) . $stamp;
     }
     $report["addtime"] = ConvertUtil::formatDate($report["addtime"], "u");
     $params = array("lang" => Ibos::getLangSource("report.default"), "repid" => $repid, "report" => $report, "uid" => $uid, "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "fromController" => $fromController, "isShowTitle" => $isShowTitle, "allowComment" => $this->getIsAllowComment($fromController));
     $detailAlias = "application.modules.report.views.detail";
     $detailView = $this->renderPartial($detailAlias, $params, true);
     $this->ajaxReturn(array("data" => $detailView, "isSuccess" => true));
 }
Exemple #3
0
 public static function getThumbImageUrl($attach, $width, $height)
 {
     $attachUrl = FileUtil::getAttachUrl();
     $thumbName = self::getThumbName($attach, $width, $height);
     $thumbUrl = FileUtil::fileName($thumbName);
     if (FileUtil::fileExists($thumbUrl)) {
         return $thumbName;
     } else {
         $attachment = $attach["attachment"];
         $file = $attachUrl . "/" . $attachment;
         $imgext = AttachUtil::getCommonImgExt();
         if (FileUtil::fileExists($file)) {
             $info = ImageUtil::getImageInfo(FileUtil::fileName($file));
             $infoCorrect = is_array($info) && in_array($info["type"], $imgext);
             $sizeCorrect = $infoCorrect && ($width < $info["width"] || $height < $info["height"]);
             if ($infoCorrect && $sizeCorrect) {
                 $returnUrl = self::makeThumb($attach, $width, $height);
             } else {
                 $returnUrl = $attachUrl . "/" . $attachment;
             }
         } else {
             $returnUrl = FileUtil::fileName($file);
         }
         return $returnUrl;
     }
 }
Exemple #4
0
 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 actionIndex()
 {
     $uid = Ibos::app()->user->uid;
     $params = $this->getUnfinishedDataByUid($uid);
     $params["uploadConfig"] = AttachUtil::getUploadConfig();
     $this->setPageTitle(Ibos::lang("Assignment"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Assignment"), "url" => $this->createUrl("unfinished/index")), array("name" => Ibos::lang("Unfinished list"))));
     $this->render("list", $params);
 }
Exemple #6
0
 private function getDocFile($var)
 {
     if ($var["isNew"]) {
         $typeId = AttachUtil::attachType($var["param"]["filetype"], "id");
         $map = array(self::DOC_WORD => array("fileName" => $var["lang"]["New doc"] . ".doc", "fileUrl" => self::OFFICE_PATH . "new.doc", "typeId" => self::DOC_WORD), self::DOC_EXCEL => array("fileName" => $var["lang"]["New excel"] . ".xls", "fileUrl" => self::OFFICE_PATH . "new.doc", "typeId" => self::DOC_WORD), self::DOC_PPT => array("fileName" => $var["lang"]["New ppt"] . ".ppt", "fileUrl" => self::OFFICE_PATH . "new.ppt", "typeId" => self::DOC_WORD));
         return $map[$typeId];
     } else {
         return array("typeId" => AttachUtil::attachType(StringUtil::getFileExt($var["attach"]["attachment"]), "id"), "fileName" => $var["attach"]["filename"], "fileUrl" => FileUtil::fileName(FileUtil::getAttachUrl() . "/" . $var["attach"]["attachment"]));
     }
 }
Exemple #7
0
 public function delBody($bodyIds, $archiveId = 0)
 {
     $table = sprintf("{{%s}}", $this->getTableName($archiveId));
     $bodys = Yii::app()->db->createCommand()->select("attachmentid")->from($table)->where("FIND_IN_SET(bodyid,'{$bodyIds}')")->queryAll();
     $attachIds = ConvertUtil::getSubByKey($bodys, "attachmentid");
     $attachId = StringUtil::filterStr(implode(",", $attachIds));
     if (!empty($attachId)) {
         AttachUtil::delAttach($attachId);
     }
     return Yii::app()->db->createCommand()->delete($table, "FIND_IN_SET(bodyid,'{$bodyIds}')");
 }
 public function getHeader($lang = array())
 {
     $onlineStatus = UserUtil::getOnlineStatus($this->getUid());
     $styleMap = array(-1 => "o-pm-offline", 1 => "o-pm-online");
     $data = array("user" => $this->getUser(), "assetUrl" => $this->getAssetUrl("user"), "swfConfig" => AttachUtil::getUploadConfig(), "onlineIcon" => $styleMap[$onlineStatus], "lang" => $lang);
     if ($this->getIsWeiboEnabled()) {
         $data["userData"] = UserData::model()->getUserData($this->getUid());
         !$this->getIsMe() && ($data["states"] = Follow::model()->getFollowState(Ibos::app()->user->uid, $this->getUid()));
     }
     return $this->renderPartial("application.modules.user.views.header", $data, true);
 }
Exemple #9
0
 public function actionShow()
 {
     $id = isset($_GET["id"]) ? $_GET["id"] : 0;
     $email = Email::model()->fetchById($id, 0);
     if (!empty($email)) {
         if (!empty($email["attachmentid"])) {
             $email["attach"] = AttachUtil::getAttach($email["attachmentid"], true, false, false, false, true);
             $attachmentArr = explode(",", $email["attachmentid"]);
         }
     }
     Email::model()->setRead($id, Yii::app()->user->uid);
     $this->ajaxReturn($email, "JSONP");
 }
Exemple #10
0
 public function actionShow()
 {
     $newsid = EnvUtil::getRequest("id");
     $article = new MICArticle();
     $data = $article->getNews($newsid);
     if (!empty($data)) {
         if (!empty($data["attachmentid"])) {
             $data["attach"] = AttachUtil::getAttach($data["attachmentid"]);
             $attachmentArr = explode(",", $data["attachmentid"]);
         }
     }
     $this->ajaxReturn($data, "JSONP");
 }
Exemple #11
0
 public function actionIndex()
 {
     $data = array();
     $data["userData"] = UserData::model()->getUserData($this->uid);
     $data["activeUser"] = UserData::model()->fetchActiveUsers();
     $data["movements"] = Ibos::app()->setting->get("setting/wbmovement");
     $data["enableMovementModule"] = WbCommonUtil::getMovementModules();
     $data["uploadConfig"] = AttachUtil::getUploadConfig();
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Enterprise weibo")), array("name" => Ibos::lang("Index"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("List"))));
     $var["type"] = isset($_GET["type"]) ? StringUtil::filterCleanHtml($_GET["type"]) : "all";
     $var["feedtype"] = isset($_GET["feedtype"]) ? StringUtil::filterCleanHtml($_GET["feedtype"]) : "all";
     $var["feedkey"] = isset($_GET["feedkey"]) ? StringUtil::filterCleanHtml(urldecode($_GET["feedkey"])) : "";
     $var["loadNew"] = isset($_GET["page"]) ? 0 : 1;
     $var["loadMore"] = isset($_GET["page"]) ? 0 : 1;
     $var["loadId"] = 0;
     $var["nums"] = isset($_GET["page"]) ? WbConst::DEF_LIST_FEED_NUMS : 10;
     $this->render("index", array_merge($data, $var, $this->getData($var)));
 }
Exemple #12
0
 public function actionDelAttach()
 {
     $runId = intval(EnvUtil::getRequest("runid"));
     $attachId = intval(EnvUtil::getRequest("aid"));
     $run = FlowRun::model()->fetchByPk($runId);
     if ($run) {
         $aids = explode(",", $run["attachmentid"]);
         foreach ($aids as $i => $aid) {
             if ($aid == $attachId) {
                 unset($aids[$i]);
                 break;
             }
         }
         FlowRun::model()->modify($runId, array("attachmentid" => implode(",", $aids)));
         AttachUtil::delAttach($attachId);
         $this->ajaxReturn(array("isSuccess" => true));
     }
     $this->ajaxReturn(array("isSuccess" => false));
 }
Exemple #13
0
 public function download($attach, $downloadInfo = array())
 {
     $file = FileUtil::getAttachUrl() . "/" . $attach["attachment"];
     if (file_exists($file)) {
         if (Ibos::app()->browser->name == "msie" || Ibos::app()->browser->getVersion() == "10.0" || Ibos::app()->browser->getVersion() == "11.0") {
             $usingIe = true;
         } else {
             $usingIe = false;
         }
         $typeArr = array("1" => "application/octet-stream", "3" => "application/msword", "4" => "application/msexcel", "5" => "application/mspowerpoint", "7" => "application/octet-stream", "8" => "application/x-shockwave-flash", "10" => "application/pdf");
         $attachType = AttachUtil::Attachtype(StringUtil::getFileExt($attach["filename"]), "id");
         $content = false;
         if (isset($downloadInfo["directView"])) {
             if (!in_array($attachType, array("1", "7", "8", "10"))) {
                 $content = true;
             }
             $contentType = $typeArr[$attachType];
         } else {
             if (in_array($attachType, array("3", "4", "5")) && $usingIe) {
                 $contentType = $typeArr[$attachType];
             } else {
                 $content = 1;
                 $contentType = "application/octet-stream";
             }
         }
         ob_end_clean();
         header("Cache-control: private");
         header("Content-type: {$contentType}");
         header("Accept-Ranges: bytes");
         header("Content-Length: " . sprintf("%u", $this->fileSize($file)));
         if ($usingIe) {
             $attach["filename"] = urlencode($attach["filename"]);
         }
         if ($content) {
             header("Content-Disposition: attachment; filename=\"" . $attach["filename"] . "\"");
         } else {
             header("Content-Disposition: filename=\"" . $attach["filename"] . "\"");
         }
         Attachment::model()->updateDownload($attach["aid"]);
         readfile($file);
         exit;
     }
 }
Exemple #14
0
 public function upload()
 {
     $uid = intval(EnvUtil::getRequest("uid"));
     $this->upload->save();
     $attach = $this->upload->getAttach();
     $attachment = $attach["type"] . "/" . $attach["attachment"];
     $data = array("dateline" => TIMESTAMP, "filename" => $attach["name"], "filesize" => $attach["size"], "attachment" => $attachment, "isimage" => $attach["isimage"], "uid" => $uid);
     $aid = Attachment::model()->add(array("uid" => $uid, "tableid" => 127), true);
     $data["aid"] = $aid;
     AttachmentUnused::model()->add($data);
     $file["icon"] = AttachUtil::attachType(StringUtil::getFileExt($attach["name"]));
     $file["aid"] = $aid;
     $file["name"] = $attach["name"];
     $file["url"] = FileUtil::fileName(FileUtil::getAttachUrl() . "/" . $attachment);
     if (!empty($file) && is_array($file)) {
         return CJSON::encode($file);
     } else {
         return CJSON::encode(array("aid" => 0, "url" => 0, "name" => 0));
     }
 }
Exemple #15
0
 public function actionShow()
 {
     $diaryid = intval(EnvUtil::getRequest("diaryid"));
     $uid = Ibos::app()->user->uid;
     if (empty($diaryid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("share/index"));
     }
     $diary = Diary::model()->fetchByPk($diaryid);
     if (empty($diary)) {
         $this->error(Ibos::lang("No data found"), $this->createUrl("share/index"));
     }
     if (!ICDiary::checkScope($uid, $diary)) {
         $this->error(Ibos::lang("You do not have permission to view the log"), $this->createUrl("share/index"));
     }
     Diary::model()->addReaderuidByPK($diary, $uid);
     $data = Diary::model()->fetchDiaryRecord($diary);
     $params = array("diary" => ICDiary::processDefaultShowData($diary), "prevAndNextPK" => Diary::model()->fetchPrevAndNextPKByPK($diary["diaryid"]), "data" => $data);
     if (!empty($diary["attachmentid"])) {
         $params["attach"] = AttachUtil::getAttach($diary["attachmentid"], true, true, false, false, true);
         $params["count"] = 0;
     }
     $params["allowComment"] = $this->issetSharecomment() || UserUtil::checkIsSub($uid, $diary["uid"]) ? 1 : 0;
     if (!empty($diary["readeruid"])) {
         $readerArr = explode(",", $diary["readeruid"]);
         $params["readers"] = User::model()->fetchAllByPk($readerArr);
     } else {
         $params["readers"] = "";
     }
     if (!empty($diary["stamp"])) {
         $params["stampUrl"] = Stamp::model()->fetchStampById($diary["stamp"]);
     }
     $params["sharecomment"] = $this->issetSharecomment();
     $this->setPageTitle(Ibos::lang("Show share diary"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work diary"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show share diary"))));
     $this->render("show", $params);
 }
Exemple #16
0
 public function actionShow()
 {
     $diaryid = EnvUtil::getRequest("id");
     $diaryDate = EnvUtil::getRequest("diarydate");
     if (empty($diaryid) && empty($diaryDate)) {
         $this->ajaxReturn(array(), "JSONP");
     }
     $diary = array();
     $uid = Ibos::app()->user->uid;
     if (!empty($diaryid)) {
         $diary = Diary::model()->fetchByPk($diaryid);
     } else {
         $diary = Diary::model()->fetch("diarytime=:diarytime AND uid=:uid", array(":diarytime" => strtotime($diaryDate), ":uid" => $uid));
     }
     if (empty($diary)) {
         $this->ajaxReturn(array(), "JSONP");
     }
     Diary::model()->addReaderuidByPK($diary, $uid);
     $data = Diary::model()->fetchDiaryRecord($diary);
     $params = array("diary" => ICDiary::processDefaultShowData($diary), "prevAndNextPK" => Diary::model()->fetchPrevAndNextPKByPK($diary["diaryid"]), "data" => $data);
     if (!empty($diary["attachmentid"])) {
         $params["attach"] = AttachUtil::getAttach($diary["attachmentid"], true, true, false, false, true);
         $params["count"] = 0;
     }
     if (!empty($diary["readeruid"])) {
         $readerArr = explode(",", $diary["readeruid"]);
         $params["readers"] = User::model()->fetchAllByPk($readerArr);
     } else {
         $params["readers"] = "";
     }
     if (!empty($diary["stamp"])) {
         $params["stampUrl"] = Stamp::model()->fetchStampById($diary["stamp"]);
     }
     $this->ajaxReturn($params, "JSONP");
 }
Exemple #17
0
 protected function parseComment($data)
 {
     $uid = Ibos::app()->user->uid;
     $isAdministrator = Ibos::app()->user->isadministrator;
     $data["userInfo"] = User::model()->fetchByUid($uid);
     $data["content"] = StringUtil::pregHtml($data["content"]);
     $data["content"] = StringUtil::parseHtml($data["content"]);
     $data["lang"] = Ibos::getLangSources(array("message.default"));
     $data["isCommentDel"] = $isAdministrator || $uid === $data["uid"];
     if (!empty($data["attachmentid"])) {
         $data["attach"] = AttachUtil::getAttach($data["attachmentid"]);
     }
     return $this->render($this->getParseView("comment", "parse"), $data, true);
 }
Exemple #18
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $articleids = trim(EnvUtil::getRequest("articleids"), ",");
         $attachmentids = "";
         $attachmentIdArr = Article::model()->fetchAllFieldValueByArticleids("attachmentid", $articleids);
         foreach ($attachmentIdArr as $attachmentid) {
             if (!empty($attachmentid)) {
                 $attachmentids .= $attachmentid . ",";
             }
         }
         $count = 0;
         if (!empty($attachmentids)) {
             $splitArray = explode(",", trim($attachmentids, ","));
             $attachmentidArray = array_unique($splitArray);
             $attachmentids = implode(",", $attachmentidArray);
             $count = AttachUtil::delAttach($attachmentids);
         }
         if ($this->getVoteInstalled()) {
             Vote::model()->deleteAllByRelationIdsAndModule($articleids, "article");
         }
         ArticlePicture::model()->deleteAllByArticleIds($articleids);
         Article::model()->deleteAllByArticleIds($articleids);
         ArticleApproval::model()->deleteByArtIds($articleids);
         $this->ajaxReturn(array("isSuccess" => true, "count" => $count, "msg" => Ibos::lang("Del succeed", "message")));
     }
 }
Exemple #19
0
 public function completelyDelete($emailIds, $uid, $archiveId = 0)
 {
     $isSuccess = 0;
     $emailIds = is_array($emailIds) ? $emailIds : array($emailIds);
     $mainTable = sprintf("{{%s}}", $this->getTableName($archiveId));
     $bodyTable = sprintf("{{%s}}", EmailBody::model()->getTableName($archiveId));
     $bodyIds = Ibos::app()->db->createCommand()->select("bodyid")->from($mainTable)->where("FIND_IN_SET(emailid,'" . implode(",", $emailIds) . "')")->queryAll();
     if ($bodyIds) {
         $bodyIds = ConvertUtil::getSubByKey($bodyIds, "bodyid");
     }
     foreach ($bodyIds as $i => $bodyId) {
         $body = Ibos::app()->db->createCommand()->select("fromid,attachmentid")->from($bodyTable)->where("bodyid = {$bodyId} AND fromid = {$uid}")->queryRow();
         if ($body || !isset($emailIds[$i])) {
             if (isset($emailIds[$i])) {
                 $readerRows = Ibos::app()->db->createCommand()->select("bodyid")->from($mainTable)->where("emailid = {$emailIds[$i]} AND isread != 0 AND toid != {$uid}")->queryRow();
             } else {
                 $readerRows = false;
             }
             if ($readerRows) {
                 if (Ibos::app()->db->createCommand()->update($bodyTable, array("issenderdel" => 1), "bodyid = " . $bodyId)) {
                     $isSuccess = 1;
                 }
             } else {
                 if (isset($emailIds[$i])) {
                     $nextStep = Ibos::app()->db->createCommand()->delete($mainTable, "emailid = " . $emailIds[$i]);
                 } else {
                     Ibos::app()->db->createCommand()->delete($bodyTable, "bodyid = " . $bodyId);
                     $nextStep = true;
                 }
                 if ($nextStep) {
                     if ($body["attachmentid"] !== "") {
                         AttachUtil::delAttach($body["attachmentid"]);
                     }
                     $isSuccess = 1;
                 }
             }
         } else {
             $lastRows = Ibos::app()->db->createCommand()->select("toid")->from($mainTable)->where("bodyid = {$bodyId} AND toid != {$uid}")->queryRow();
             if (!$lastRows) {
                 Ibos::app()->db->createCommand()->delete($mainTable, "emailid = " . $emailIds[$i]);
                 $attachmentId = Ibos::app()->db->createCommand()->select("attachmentid")->from($bodyTable)->where("bodyid = " . $bodyId)->queryScalar();
                 if ($attachmentId && $attachmentId !== "") {
                     AttachUtil::delAttach($attachmentId);
                 }
                 $isSuccess++;
             } else {
                 Ibos::app()->db->createCommand()->delete($mainTable, "emailid = {$emailIds[$i]} AND toid = {$uid}");
                 $isSuccess++;
             }
         }
     }
     return $isSuccess;
 }
Exemple #20
0
 public function actionFeed()
 {
     $feedid = intval(EnvUtil::getRequest("feedid"));
     $feedInfo = Feed::model()->get($feedid);
     if (!$feedInfo) {
         $this->error(Ibos::lang("Weibo not exists"));
     }
     if ($feedInfo["isdel"] == "1") {
         $this->error(Ibos::lang("No relate weibo"));
         exit;
     }
     if ($feedInfo["from"] == "1") {
         $feedInfo["from"] = EnvUtil::getFromClient(6, $feedInfo["module"], "3G版");
     } else {
         switch ($feedInfo["module"]) {
             case "mobile":
                 break;
             default:
                 $feedInfo["from"] = EnvUtil::getFromClient($feedInfo["from"], $feedInfo["module"]);
                 break;
         }
     }
     if ($feedInfo["type"] === "postimage") {
         $var = unserialize($feedInfo["feeddata"]);
         $feedInfo["image_body"] = $var["body"];
         if (!empty($var["attach_id"])) {
             $attach = AttachUtil::getAttachData($var["attach_id"]);
             $attachUrl = FileUtil::getAttachUrl();
             foreach ($attach as $ak => $av) {
                 $_attach = array("attach_id" => $av["aid"], "attach_name" => $av["filename"], "attach_url" => FileUtil::fileName($attachUrl . "/" . $av["attachment"]), "extension" => StringUtil::getFileExt($av["filename"]), "size" => $av["filesize"]);
                 $_attach["attach_small"] = WbCommonUtil::getThumbImageUrl($av, WbConst::ALBUM_DISPLAY_WIDTH, WbConst::ALBUM_DISPLAY_HEIGHT);
                 $_attach["attach_middle"] = WbCommonUtil::getThumbImageUrl($av, WbConst::WEIBO_DISPLAY_WIDTH, WbConst::WEIBO_DISPLAY_HEIGHT);
                 $feedInfo["attachInfo"][$ak] = $_attach;
             }
         }
     }
     $diggArr = FeedDigg::model()->checkIsDigg($feedid, Ibos::app()->user->uid);
     $data = array("diggArr" => $diggArr, "fd" => $feedInfo, "assetUrl" => Ibos::app()->assetManager->getAssetsUrl("user"), "moduleAssetUrl" => Ibos::app()->assetManager->getAssetsUrl("weibo"), "colleagues" => $this->getRelation("colleague"));
     if (!$this->getIsMe()) {
         $data["bothfollow"] = $this->getRelation("bothfollow");
         $data["secondfollow"] = $this->getRelation("secondfollow");
     }
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Enterprise weibo"), "url" => $this->createUrl("home/index")), array("name" => $feedInfo["user_info"]["realname"] . Ibos::lang("sbs feed"), "url" => $this->createUrl("personal/index", array("uid" => $this->getUid()))), array("name" => Ibos::lang("Detail"))));
     $this->render("detail", $data, false, array("user.default"));
 }
Exemple #21
0
 public function getCommentList($map = null, $order = "cid ASC", $limit = 10, $offset = 0, $isReply = false)
 {
     $list = $this->getDbConnection()->createCommand()->select("*")->from($this->tableName())->where($map)->order($order)->limit($limit)->offset($offset)->queryAll();
     $uid = Ibos::app()->user->uid;
     $isAdministrator = Ibos::app()->user->isadministrator;
     foreach ($list as $k => &$v) {
         if (!empty($v["tocid"]) && $isReply) {
             $replyInfo = $this->getCommentInfo($v["tocid"], false);
             $v["replyInfo"] = "//@<a class='anchor' data-toggle='usercard' data-param='uid={$replyInfo["user_info"]["uid"]}' href='{$replyInfo["user_info"]["space_url"]}' target='_blank'>" . $replyInfo["user_info"]["realname"] . "</a>:" . $replyInfo["content"];
         } else {
             $v["replyInfo"] = "";
         }
         $v["isCommentDel"] = $isAdministrator || $uid === $v["uid"];
         $v["user_info"] = User::model()->fetchByUid($v["uid"]);
         $v["content"] = StringUtil::parseHtml($v["content"] . $v["replyInfo"]);
         $v["sourceInfo"] = Source::getCommentSource($v);
         if (!empty($v["attachmentid"])) {
             $v["attach"] = AttachUtil::getAttach($v["attachmentid"]);
         }
     }
     return $list;
 }
Exemple #22
0
 private function analysis()
 {
     $importType = intval(EnvUtil::getRequest("importType"));
     if ($importType == 1) {
         $file = $_FILES["importFile"];
         if (0 < $file["error"]) {
             $this->error("上传失败,失败类型:" . $file["error"], $this->createUrl("resume/index"));
         }
         if (!preg_match("/.(txt)\$/i", $file["name"], $match)) {
             $this->error("不支持的文件类型", $this->createUrl("resume/index"));
         }
         if ($match[1] == "txt") {
             header("Content-Type:text/html;charset=utf-8");
             $importContent = file_get_contents($file["tmp_name"]);
         }
     } elseif ($importType == 2) {
         $importContent = EnvUtil::getRequest("importContent");
     }
     $code = strtolower(mb_detect_encoding($importContent, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5")));
     if (($code == "gb2312" || $code == "GBK" || $code == "euc-cn") && $code != CHARSET) {
         $importContent = iconv($code, CHARSET, $importContent);
     }
     $config = AnalysisConfig::getAnalconf();
     $analysis = new ResumeAnalysis($importContent, $config);
     $result = $analysis->parse_content();
     $result["gender"] = preg_match("/女/", $result["gender"]) ? 2 : 1;
     $result["maritalstatus"] = preg_match("/是|已/", $result["maritalstatus"]) ? 1 : 0;
     $result["workyears"] = $result["workyears"] ? intval($result["workyears"]) + 0 : "";
     $result["mobile"] = $result["mobile"] ? $result["mobile"] + 0 : "";
     $result["height"] = $result["height"] ? $result["height"] + 0 : "";
     $result["weight"] = $result["weight"] ? $result["weight"] + 0 : "";
     $result["zipcode"] = $result["zipcode"] ? $result["zipcode"] + 0 : "";
     $result["qq"] = $result["qq"] ? intval($result["qq"]) + 0 : "";
     if ($result["birthday"]) {
         $result["birthday"] = date("Y-m-d", strtotime($result["birthday"]));
     } elseif (!empty($result["age"])) {
         $result["birthday"] = date("Y") - ($result["age"] + 0) . "-00-00";
     }
     $regulars = Regular::model()->fetchAll();
     $params = array("importInfo" => CJSON::encode($result), "sidebar" => $this->getSidebar(), "dashboardConfig" => $this->getDashboardConfig(), "uploadConfig" => AttachUtil::getUploadConfig(), "regulars" => CJSON::encode($regulars));
     $params["dashboardConfigToJson"] = CJSON::encode($params["dashboardConfig"]);
     $this->setPageTitle(Ibos::lang("Add resume"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Recruitment management"), "url" => $this->createUrl("resume/index")), array("name" => Ibos::lang("Talent management"), "url" => $this->createUrl("resume/index")), array("name" => Ibos::lang("Add resume"))));
     $this->render("add", $params);
 }
Exemple #23
0
 public static function getEmailSize($content, $attachmentId = "")
 {
     $tmpfile = "data/emailsize.temp";
     FileUtil::createFile($tmpfile, $content);
     $emailContentSize = FileUtil::fileSize($tmpfile);
     FileUtil::deleteFile($tmpfile);
     $attFileSize = 0;
     if (!empty($attachmentId)) {
         $attach = AttachUtil::getAttachData($attachmentId, false);
         foreach ($attach as $value) {
             $attFileSize += intval($value["filesize"]);
         }
     }
     return intval($emailContentSize + $attFileSize);
 }
Exemple #24
0
 public static function sendWebMail($toUser, $body, $web)
 {
     $user = User::model()->fetchByUid($web["uid"]);
     $password = StringUtil::authCode($web["password"], "DECODE", $user["salt"]);
     $mailer = Yii::createComponent("application.modules.email.extensions.mailer.EMailer");
     $mailer->IsSMTP();
     $mailer->SMTPDebug = 0;
     $mailer->Host = $web["smtpserver"];
     $mailer->Port = $web["smtpport"];
     $mailer->CharSet = "UTF-8";
     if ($web["smtpssl"]) {
         $mailer->SMTPSecure = "ssl";
     }
     $mailer->SMTPAuth = true;
     $mailer->Username = $web["username"];
     $mailer->Password = $password;
     $mailer->setFrom($web["address"], $web["nickname"]);
     foreach (explode(";", $toUser) as $address) {
         $mailer->addAddress($address);
     }
     $mailer->Subject = $body["subject"];
     $mailer->msgHTML($body["content"]);
     $mailer->AltBody = "This is a plain-text message body";
     if (!empty($body["attachmentid"])) {
         $attachs = AttachUtil::getAttachData($body["attachmentid"]);
         $attachUrl = FileUtil::getAttachUrl();
         foreach ($attachs as $attachment) {
             $url = $attachUrl . "/" . $attachment["attachment"];
             if (LOCAL) {
                 $mailer->addAttachment($url, $attachment["filename"]);
             } else {
                 $temp = Ibos::engine()->IO()->file()->fetchTemp($url);
                 $mailer->addAttachment($temp, $attachment["filename"]);
             }
         }
     }
     $status = $mailer->send();
     if ($status) {
         return true;
     } else {
         return $mailer->ErrorInfo;
     }
 }
Exemple #25
0
		<!--[if lt IE 9]>
			<link rel="stylesheet" href="<?php 
echo STATICURL;
?>
/css/iefix.css?<?php 
echo VERHASH;
?>
" />
		<![endif]-->
		<!-- load css end -->
		

		<!-- JS全局变量-->
		<script>
			<?php 
$gUploadConfig = AttachUtil::getUploadConfig();
$gAccount = UserUtil::getAccountSetting();
?>
			var G = {
				VERHASH: '<?php 
echo VERHASH;
?>
',
				SITE_URL: '<?php 
echo Ibos::app()->setting->get("siteurl");
?>
',
				STATIC_URL: '<?php 
echo STATICURL;
?>
',
Exemple #26
0
 protected function handleImgComponent(&$formData)
 {
     foreach ($GLOBALS["_FILES"] as $key => $value) {
         if (strtolower(substr($key, 0, 5)) == "data_") {
             $formData["{$key}"] = "";
             $old = $_POST["imgid_" . substr($key, 5)];
             if ($value["name"] != "") {
                 if (!empty($old)) {
                     AttachUtil::delAttach($old);
                 }
                 $upload = FileUtil::getUpload($_FILES[$key], "workflow");
                 $upload->save();
                 $attach = $upload->getAttach();
                 $attachment = "workflow/" . $attach["attachment"];
                 $imgData = array("dateline" => TIMESTAMP, "filename" => $attach["name"], "filesize" => $attach["size"], "isimage" => $attach["isimage"], "attachment" => $attachment, "uid" => $this->uid);
                 $aid = Attachment::model()->add(array("uid" => $this->uid, "rid" => $this->runid, "tableid" => AttachUtil::getTableId($this->runid)), true);
                 $imgData["aid"] = $aid;
                 $newAttach = AttachmentN::model()->add(sprintf("rid:%d", $this->runid), $imgData, true);
                 $formData["{$key}"] = $newAttach;
             } else {
                 $formData["{$key}"] = $old;
             }
         }
     }
 }
Exemple #27
0
 public function actionShow()
 {
     $repid = EnvUtil::getRequest("repid");
     $uid = Ibos::app()->user->uid;
     if (empty($repid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index"));
     }
     $report = Report::model()->fetchByPk($repid);
     if (empty($report)) {
         $this->error(Ibos::lang("File does not exists", "error"), $this->createUrl("default/index"));
     }
     if ($report["uid"] != $uid) {
         $this->error(Ibos::lang("Request tainting", "error"), $this->createUrl("default/index"));
     }
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = $readers = array();
     if (!empty($report["attachmentid"])) {
         $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
         $attachs = array_values($attachments);
     }
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if (!empty($report["stamp"])) {
         $stampUrl = Stamp::model()->fetchStampById($report["stamp"]);
     }
     $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"]), "isInstallCalendar" => ModuleUtil::getIsEnabled("calendar"));
     if (!empty($params["nextPlanList"])) {
         $reportType = ReportType::model()->fetchByPk($report["typeid"]);
         $firstPlan = $params["nextPlanList"][0];
         $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1);
     }
     $this->setPageTitle(Ibos::lang("Show report"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show report"))));
     $this->render("show", $params);
 }
Exemple #28
0
 public static function getAttachNameSearch($attachName = "")
 {
     $condition = array();
     if (!empty($attachName)) {
         $runIds = array();
         foreach (FlowRun::model()->fetchAllAttachID() as $run) {
             $table = "attachment_" . AttachUtil::getTableId($run["runid"]);
             $sql = "SELECT 1 FROM {{$table}} WHERE FIND_IN_SET(aid,'{$run["attachmentid"]}') AND filename LIKE '%{$attachName}%'";
             $flag = Ibos::app()->db->createCommand()->setText($sql)->queryScalar();
             if ($flag) {
                 $runIds[] = $run["runid"];
             }
         }
         if (!empty($runIds)) {
             $condition[] = sprintf("FIND_IN_SET(fr.runid,'%s')", implode(",", $runIds));
         } else {
             $condition[] = "1=2";
         }
     }
     return $condition;
 }
Exemple #29
0
 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     switch ($type) {
         case "following":
             $pages = PageUtil::create(1000, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "following", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND a.feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND a.type = '" . $var["feedtype"] . "'";
                 }
                 $list = Feed::model()->getFollowingFeed($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         case "newfollowing":
             $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
             if (0 < $var["maxId"]) {
                 $where .= " AND a.feedid > '" . intval($var["maxId"]) . "'";
                 $list = Feed::model()->getFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid <> %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     if (!isset($var["new"])) {
         $pages->route = "home/index";
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->uid);
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
             if (isset($v["attach_id"][0])) {
                 $_tmp = AttachUtil::getAttachData($v["attach_id"][0]);
                 $v["attach_url"] = FileUtil::getAttachUrl() . "/" . $_tmp[$v["attach_id"][0]]["attachment"];
             }
             if (isset($v["api_source"]["attach"][0]["attach_url"])) {
                 $v["api_source"]["attach_url"] = $v["api_source"]["attach"][0]["attach_url"];
                 unset($v["api_source"]["attach"]);
                 unset($v["api_source"]["source_body"]);
             }
             unset($v["user_info"]);
             unset($v["body"]);
             unset($v["sourceInfo"]);
             unset($v["api_source"]["source_user_info"]);
             unset($v["api_source"]["avatar_big"]);
             unset($v["api_source"]["avatar_middle"]);
             unset($v["api_source"]["avatar_small"]);
             unset($v["api_source"]["source_url"]);
             unset($v["feeddata"]);
         }
         $data["list"] = $list;
         $data["diggArr"] = $diggArr;
     } else {
         $data["list"] = array();
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }
Exemple #30
0
 public function actionShow()
 {
     $repid = intval(EnvUtil::getRequest("repid"));
     $uid = Ibos::app()->user->uid;
     if (empty($repid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("review/index"));
     }
     $report = Report::model()->fetchByPk($repid);
     if (empty($report)) {
         $this->error(Ibos::lang("No data found", "error"), $this->createUrl("review/index"));
     }
     if ($report["uid"] == $uid) {
         $this->redirect($this->createUrl("default/show", array("repid" => $repid)));
     }
     $permission = ICReport::checkPermission($report, $uid);
     if (!$permission) {
         $this->error(Ibos::lang("You do not have permission to view the report"), $this->createUrl("review/index"));
     }
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = $readers = array();
     if (!empty($report["attachmentid"])) {
         $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
         $attachs = array_values($attachments);
     }
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if (!empty($report["stamp"])) {
         $stampUrl = Stamp::model()->fetchStampById($report["stamp"]);
     }
     $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"]));
     if (!empty($params["nextPlanList"])) {
         $reportType = ReportType::model()->fetchByPk($report["typeid"]);
         $firstPlan = $params["nextPlanList"][0];
         $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1);
     }
     $dashboardConfig = $this->getReportConfig();
     if ($dashboardConfig["stampenable"] && $dashboardConfig["autoreview"]) {
         $this->changeIsreview($repid);
     }
     $this->setPageTitle(Ibos::lang("Show subordinate report"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show subordinate report"))));
     $this->render("show", $params);
 }