public function init() { $this->uid = $uid = intval(Yii::app()->user->uid); $this->folders = EmailFolder::model()->fetchAllUserFolderByUid($uid); $this->allowWebMail = (bool) Yii::app()->setting->get("setting/emailexternalmail"); $this->webMails = $this->allowWebMail ? EmailWeb::model()->fetchAllByUid($uid) : array(); parent::init(); }
public function actionDel() { $fid = $this->fid; $cleanAll = EnvUtil::getRequest("delemail"); $emailIds = Email::model()->fetchAllEmailIdsByFolderId($fid, $this->uid); if ($cleanAll) { $emailIds && Email::model()->completelyDelete($emailIds, $this->uid); } else { $emailIds && Email::model()->updateByPk($emailIds, array("fid" => parent::INBOX_ID)); } $deleted = EmailFolder::model()->deleteByPk($fid); if ($deleted) { $this->ajaxReturn(array("isSuccess" => true)); } else { $this->ajaxReturn(array("isSuccess" => false, "errorMsg" => Ibos::lang("Del failed", "message"))); } }
protected function processAddWebMail($inAjax = false) { $web = $_POST["web"]; $errMsg = ""; $this->submitCheck($web, $inAjax); if (isset($_POST["moreinfo"])) { if (empty($web["server"])) { $this->error(Ibos::lang("Empty server address"), "", array(), $inAjax); } $passCheck = WebMailUtil::checkAccount($web["address"], $web["password"], $web); if ($passCheck) { $web = WebMailUtil::mergePostConfig($web["address"], $web["password"], $web); } else { $errMsg = Ibos::lang("Error server info"); } } else { $passCheck = WebMailUtil::checkAccount($web["address"], $web["password"]); if ($passCheck) { $web = WebMailUtil::getEmailConfig($web["address"], $web["password"]); } else { $errMsg = Ibos::lang("More server info"); } } if (!$passCheck) { if (!$inAjax) { $this->setPageTitle(Ibos::lang("Add web email")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Email center"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Add web email")))); $this->render("add", array("more" => true, "errMsg" => $errMsg, "web" => $web)); } else { $data = array("lang" => Ibos::getLangSources(), "more" => true, "errMsg" => $errMsg, "web" => $web); $content = $this->renderPartial("ajaxAdd", $data, true); $this->ajaxReturn(array("moreinfo" => true, "content" => $content)); } exit; } $web = $this->beforeSave($web); $newId = EmailWeb::model()->add($web, true); $folder = array("sort" => 0, "name" => isset($_POST["web"]["name"]) ? StringUtil::filterCleanHtml($_POST["web"]["name"]) : $web["address"], "uid" => $this->uid, "webid" => $newId); $fid = EmailFolder::model()->add($folder, true); EmailWeb::model()->modify($newId, array("fid" => $fid)); return $newId; }
protected function checkUserSize() { $userSize = EmailUtil::getUserSize($this->uid); $usedSize = EmailFolder::model()->getUsedSize($this->uid); if (ConvertUtil::ConvertBytes($userSize . "m") < $usedSize) { $this->error(Ibos::lang("Capacity overflow", "", array("{size}" => $usedSize)), $this->createUrl("email/list")); } }