public function actionSetup() { if (EnvUtil::submitCheck("formhash")) { $_POST["wbpostfrequency"] = 5 < intval($_POST["wbpostfrequency"]) ? $_POST["wbpostfrequency"] : 5; $_POST["wbnums"] = 140 <= intval($_POST["wbnums"]) ? $_POST["wbnums"] : 140; $wbwatermark = isset($_POST["wbwatermark"]) ? 1 : 0; $wbwcenabled = isset($_POST["wbwcenabled"]) ? 1 : 0; $postType = array("image" => 0, "topic" => 0, "praise" => 0); if (isset($_POST["wbposttype"])) { foreach ($postType as $key => &$val) { if (isset($_POST["wbposttype"][$key])) { $val = 1; } } } if (isset($_POST["wbmovements"])) { } else { $_POST["wbmovements"] = array(); } $data = array("wbnums" => $_POST["wbnums"], "wbpostfrequency" => $_POST["wbpostfrequency"], "wbposttype" => $postType, "wbwatermark" => $wbwatermark, "wbwcenabled" => $wbwcenabled, "wbmovement" => $_POST["wbmovements"]); foreach ($data as $key => $value) { Setting::model()->updateSettingValueByKey($key, $value); } CacheUtil::update("setting"); $this->success(Ibos::lang("Operation succeed", "message")); } else { $data = array("config" => WbCommonUtil::getSetting(), "movementModule" => WbCommonUtil::getMovementModules()); $this->render("setup", $data); } }
public function actionAdd() { if (EnvUtil::submitCheck("addsubmit")) { $this->beforeSave($_POST); $uid = Ibos::app()->user->uid; $assignment = $this->handlePostData(); $assignment["designeeuid"] = $uid; $assignment["addtime"] = TIMESTAMP; $assignmentId = Assignment::model()->add($assignment, true); if (!empty($assignment["attachmentid"])) { AttachUtil::updateAttach($assignment["attachmentid"]); } $chargeuid = StringUtil::getId($_POST["chargeuid"]); $participantuid = StringUtil::getId($_POST["participantuid"]); $uidArr = array_merge($participantuid, $chargeuid); $this->sendNotify($assignmentId, $assignment["subject"], $uidArr, "assignment_new_message"); $wbconf = WbCommonUtil::getSetting(true); if (isset($wbconf["wbmovement"]["assignment"]) && $wbconf["wbmovement"]["assignment"] == 1) { $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $assignment["subject"], "{url}" => Ibos::app()->urlManager->createUrl("assignment/default/show", array("assignmentId" => $assignmentId)))), "body" => $assignment["subject"], "actdesc" => Ibos::lang("Post assignment"), "userid" => implode(",", $uidArr), "deptid" => "", "positionid" => ""); WbfeedUtil::pushFeed($uid, "assignment", "assignment", $assignmentId, $data, "post"); } $this->addStepComment($assignmentId, Ibos::lang("Add the assignment")); AssignmentLog::model()->addLog($assignmentId, "add", Ibos::lang("Add the assignment")); $returnData = array("charge" => User::model()->fetchByUid($assignment["chargeuid"]), "id" => $assignmentId, "subject" => $assignment["subject"], "time" => date("m月d日 H:i", $assignment["starttime"]) . "--" . date("m月d日 H:i", $assignment["endtime"])); $this->ajaxReturn(array("isSuccess" => true, "data" => $returnData)); } }
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))); }
private function save() { if (EnvUtil::submitCheck("formhash")) { $postData = $_POST; $uid = Ibos::app()->user->uid; $postData["uid"] = $uid; $postData["subject"] = StringUtil::filterCleanHtml($_POST["subject"]); $toidArr = StringUtil::getId($postData["toid"]); $postData["toid"] = implode(",", $toidArr); $postData["begindate"] = strtotime($postData["begindate"]); $postData["enddate"] = strtotime($postData["enddate"]); $reportData = ICReport::handleSaveData($postData); $repid = Report::model()->add($reportData, true); if ($repid) { if (!empty($postData["attachmentid"])) { AttachUtil::updateAttach($postData["attachmentid"]); } $orgPlan = $outSidePlan = array(); if (array_key_exists("orgPlan", $_POST)) { $orgPlan = $_POST["orgPlan"]; } if (!empty($orgPlan)) { foreach ($orgPlan as $recordid => $val) { $updateData = array("process" => intval($val["process"]), "exedetail" => StringUtil::filterCleanHtml($val["exedetail"])); if ($updateData["process"] == self::COMPLETE_FALG) { $updateData["flag"] = 1; } ReportRecord::model()->modify($recordid, $updateData); } } if (array_key_exists("outSidePlan", $_POST)) { $outSidePlan = array_filter($_POST["outSidePlan"], create_function("\$v", "return !empty(\$v[\"content\"]);")); } if (!empty($outSidePlan)) { ReportRecord::model()->addPlans($outSidePlan, $repid, $postData["begindate"], $postData["enddate"], $uid, 1); } $nextPlan = array_filter($_POST["nextPlan"], create_function("\$v", "return !empty(\$v[\"content\"]);")); ReportRecord::model()->addPlans($nextPlan, $repid, strtotime($_POST["planBegindate"]), strtotime($_POST["planEnddate"]), $uid, 2); $wbconf = WbCommonUtil::getSetting(true); if (isset($wbconf["wbmovement"]["report"]) && $wbconf["wbmovement"]["report"] == 1) { $userid = $postData["toid"]; $supUid = UserUtil::getSupUid($uid); if (0 < intval($supUid) && !in_array($supUid, explode(",", $userid))) { $userid = $userid . "," . $supUid; } $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $postData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("report/review/show", array("repid" => $repid)))), "body" => StringUtil::cutStr($_POST["content"], 140), "actdesc" => Ibos::lang("Post report"), "userid" => trim($userid, ","), "deptid" => "", "positionid" => ""); WbfeedUtil::pushFeed($uid, "report", "report", $repid, $data); } UserUtil::updateCreditByAction("addreport", $uid); if (!empty($toidArr)) { $config = array("{sender}" => User::model()->fetchRealnameByUid($uid), "{subject}" => $reportData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("report/review/show", array("repid" => $repid))); Notify::model()->sendNotify($toidArr, "report_message", $config, $uid); } $this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("default/index")); } else { $this->error(Ibos::lang("Save faild", "message"), $this->createUrl("default/index")); } } }
echo $att["attach_url"]; ?> " data-lightbox="preview" title="<?php echo $att["attach_name"]; ?> "> <img src="<?php echo $att["attach_middle"]; ?> " alt="<?php echo $att["attach_name"]; ?> "> </a> <?php if (WbCommonUtil::isResize($att["attach_middle"])) { ?> <div class="wb-info-pic-tip"> <div class="wb-info-pic-tipbg"></div> <a href="<?php echo $att["attach_url"]; ?> " data-lightbox="previewDesc" title="<?php echo $att["attach_name"]; ?> ">点击查看完整图片</a> </div> <?php } ?> </div>
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")); }
private function verifyComplete($artId, $uid) { Article::model()->updateAllStatusAndApproverByPks($artId, $uid, 1); ArticleApproval::model()->deleteAll("articleid={$artId}"); $article = Article::model()->fetchByPk($artId); if (!empty($article)) { $wbconf = WbCommonUtil::getSetting(true); if (isset($wbconf["wbmovement"]["article"]) && $wbconf["wbmovement"]["article"] == 1) { $publishScope = array("deptid" => $article["deptid"], "positionid" => $article["positionid"], "uid" => $article["uid"]); $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $article["subject"], "{url}" => Ibos::app()->urlManager->createUrl("article/default/index", array("op" => "show", "articleid" => $article["articleid"])))), "body" => $article["content"], "actdesc" => Ibos::lang("Post news"), "userid" => $publishScope["uid"], "deptid" => $publishScope["deptid"], "positionid" => $publishScope["positionid"]); if ($article["type"] == self::ARTICLE_TYPE_PICTURE) { $type = "postimage"; $picture = ArticlePicture::model()->fetchByAttributes(array("articleid" => $article["articleid"])); $data["attach_id"] = $picture["aid"]; } else { $type = "post"; } WbfeedUtil::pushFeed($article["author"], "article", "article", $article["articleid"], $data, $type); } UserUtil::updateCreditByAction("addarticle", $article["author"]); } }
private function save() { $uid = Ibos::app()->user->uid; $realname = User::model()->fetchRealnameByUid($uid); $originalPlan = $planOutside = array(); if (array_key_exists("originalPlan", $_POST)) { $originalPlan = $_POST["originalPlan"]; } if (array_key_exists("planOutside", $_POST)) { $planOutside = array_filter($_POST["planOutside"], create_function("\$v", "return !empty(\$v[\"content\"]);")); } if (!empty($originalPlan)) { foreach ($originalPlan as $key => $value) { DiaryRecord::model()->modify($key, array("schedule" => $value)); } } $date = $_POST["todayDate"] . " " . Ibos::lang("Weekday", "date") . DateTimeUtil::getWeekDay(strtotime($_POST["todayDate"])); $shareUidArr = isset($_POST["shareuid"]) ? StringUtil::getId($_POST["shareuid"]) : array(); $diary = array("uid" => $uid, "diarytime" => strtotime($_POST["todayDate"]), "nextdiarytime" => strtotime($_POST["plantime"]), "addtime" => TIMESTAMP, "content" => $_POST["diaryContent"], "shareuid" => implode(",", $shareUidArr), "readeruid" => "", "remark" => "", "attention" => ""); if (!empty($_POST["attachmentid"])) { AttachUtil::updateAttach($_POST["attachmentid"]); } $diary["attachmentid"] = $_POST["attachmentid"]; $diaryId = Diary::model()->add($diary, true); if (!empty($planOutside)) { DiaryRecord::model()->addRecord($planOutside, $diaryId, strtotime($_POST["todayDate"]), $uid, "outside"); } $plan = array_filter($_POST["plan"], create_function("\$v", "return !empty(\$v[\"content\"]);")); DiaryRecord::model()->addRecord($plan, $diaryId, strtotime($_POST["plantime"]), $uid, "new"); $wbconf = WbCommonUtil::getSetting(true); if (isset($wbconf["wbmovement"]["diary"]) && $wbconf["wbmovement"]["diary"] == 1) { $supUid = UserUtil::getSupUid($uid); if (0 < intval($supUid)) { $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $realname . " " . $date . " " . Ibos::lang("Work diary"), "{url}" => Ibos::app()->urlManager->createUrl("diary/review/show", array("diaryid" => $diaryId)))), "body" => StringUtil::cutStr($diary["content"], 140), "actdesc" => Ibos::lang("Post diary"), "userid" => $supUid, "deptid" => "", "positionid" => ""); WbfeedUtil::pushFeed($uid, "diary", "diary", $diaryId, $data); } } UserUtil::updateCreditByAction("adddiary", $uid); $upUid = UserUtil::getSupUid($uid); if (!empty($upUid)) { $config = array("{sender}" => User::model()->fetchRealnameByUid($uid), "{title}" => Ibos::lang("New diary title", "", array("{sub}" => $realname, "{date}" => $date)), "{content}" => $this->renderPartial("remindcontent", array("realname" => $realname, "date" => $date, "lang" => Ibos::getLangSources(), "originalPlan" => array_values($originalPlan), "planOutside" => array_values($planOutside), "content" => StringUtil::cutStr(strip_tags($_POST["diaryContent"]), 200), "plantime" => $_POST["plantime"] . " " . Ibos::lang("Weekday", "date") . DateTimeUtil::getWeekDay(strtotime($_POST["plantime"])), "plan" => array_values($plan)), true), "{url}" => Ibos::app()->urlManager->createUrl("diary/review/show", array("diaryid" => $diaryId))); Notify::model()->sendNotify($upUid, "diary_message", $config, $uid); } $this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("default/index")); }
private function verifyComplete($docid, $uid) { Officialdoc::model()->updateAllStatusByDocids($docid, 1, $uid); OfficialdocApproval::model()->deleteAll("docid={$docid}"); $doc = Officialdoc::model()->fetchByPk($docid); if (!empty($doc)) { $wbconf = WbCommonUtil::getSetting(true); if (isset($wbconf["wbmovement"]["article"]) && $wbconf["wbmovement"]["article"] == 1) { $publishScope = array("deptid" => $doc["deptid"], "positionid" => $doc["positionid"], "uid" => $doc["uid"]); $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $doc["subject"], "{url}" => Ibos::app()->urlManager->createUrl("officialdoc/officialdoc/show", array("docid" => $doc["docid"])))), "body" => $doc["content"], "actdesc" => Ibos::lang("Post officialdoc"), "userid" => $publishScope["uid"], "deptid" => $publishScope["deptid"], "positionid" => $publishScope["positionid"]); WbfeedUtil::pushFeed($doc["author"], "officialdoc", "officialdoc", $doc["docid"], $data); } UserUtil::updateCreditByAction("addofficialdoc", $doc["author"]); } }
private function parseTemplate($_data) { $user = User::model()->fetchByUid($_data["uid"]); $_data["data"] = unserialize($_data["feeddata"]); $var = $_data["data"]; if (!empty($var["attach_id"])) { $var["attachInfo"] = AttachUtil::getAttach($var["attach_id"]); $attachUrl = FileUtil::getAttachUrl(); foreach ($var["attachInfo"] 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"]); if ($_data["type"] == "postimage") { $_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); } $var["attachInfo"][$ak] = $_attach; } } $var["uid"] = $_data["uid"]; $var["actor"] = "<a href='{$user["space_url"]}' data-toggle='usercard' data-param=\"uid={$user["uid"]}\">{$user["realname"]}</a>"; $var["actor_uid"] = $user["uid"]; $var["actor_uname"] = $user["realname"]; $var["feedid"] = $_data["feedid"]; if (!empty($_data["rowid"])) { empty($_data["table"]) && ($_data["table"] = "feed"); $var["sourceInfo"] = Source::getSourceInfo($_data["table"], $_data["rowid"], false, $_data["module"]); } else { $var["sourceInfo"] = null; } $feedTemplateAlias = "application.modules.message.config.feed.{$_data["type"]}Feed"; $file = Ibos::getPathOfAlias($feedTemplateAlias); if (!file_exists($file . ".php")) { $feedTemplateAlias = "application.modules.message.config.feed.postFeed"; } $feedXmlContent = Ibos::app()->getController()->renderPartial($feedTemplateAlias, $var, true); $s = simplexml_load_string($feedXmlContent); if (!$s) { return false; } $result = $s->xpath("//feed[@type='" . StringUtil::filterCleanHtml($_data["type"]) . "']"); $actions = (array) $result[0]->feedAttr; $return["content"] = $var["content"]; if (isset($var["attach_id"])) { $return["attach_id"] = $var["attach_id"]; } $return["userInfo"] = $user; $return["title"] = trim((string) $result[0]->title); $return["body"] = trim((string) $result[0]->body); $return["info"] = trim((string) $result[0]["info"]); $return["body"] = StringUtil::parseHtml($return["body"]); $return["api_source"] = $var["sourceInfo"]; $return["actions"] = $actions["@attributes"]; if (!$this->notDel($_data["module"], $_data["type"], $_data["rowid"])) { $return["body"] = Ibos::lang("Info already delete", "message.default"); } return $return; }