当前位置: 首页>>代码示例>>PHP>>正文


PHP StringUtil::authCode方法代码示例

本文整理汇总了PHP中StringUtil::authCode方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::authCode方法的具体用法?PHP StringUtil::authCode怎么用?PHP StringUtil::authCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringUtil的用法示例。


在下文中一共展示了StringUtil::authCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getData

 private function getData()
 {
     $id = EnvUtil::getRequest("id");
     $aidString = base64_decode(rawurldecode($id));
     if (empty($aidString)) {
         $this->error(Ibos::lang("Parameters error", "error"), "", array("autoJump" => 0));
     }
     $salt = Ibos::app()->user->salt;
     $decodeString = StringUtil::authCode($aidString, "DECODE", $salt);
     $decodeArr = explode("|", $decodeString);
     $count = count($decodeArr);
     if ($count < 3) {
         $this->error(Ibos::lang("Data type invalid", "error"), "", array("autoJump" => 0));
     } else {
         $aid = $decodeArr[0];
         $tableId = $decodeArr[1];
         if (0 <= $tableId && $tableId < 10) {
             $attach = AttachmentN::model()->fetch($tableId, $aid);
         }
         $return = array("decodeArr" => $decodeArr, "attach" => array());
         if (!empty($attach)) {
             $return["attach"] = $attach;
         }
         return $return;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:26,代码来源:AttachController.php

示例2: __construct

 public function __construct($config = array())
 {
     $ftp = Yii::app()->setting->get("setting/ftp");
     $this->setError(0);
     $this->_config = !$config ? $ftp : $config;
     $this->_enabled = false;
     if (empty($this->_config["on"]) || empty($this->_config["host"])) {
         $this->setError(self::FTP_ERR_CONFIG_OFF);
     } else {
         $this->_func = isset($this->_config["ftpssl"]) && function_exists("ftp_ssl_connect") ? "ftp_ssl_connect" : "ftpConnect";
         if ($this->_func == "ftpConnect" && !function_exists("ftpConnect")) {
             $this->setError(self::FTP_ERR_SERVER_DISABLED);
         } else {
             $this->_config["host"] = $this->clear($this->_config["host"]);
             $this->_config["port"] = intval($this->_config["port"]);
             $this->_config["ssl"] = intval($this->_config["ssl"]);
             $this->_config["host"] = $this->clear($this->_config["host"]);
             $autoKey = md5(Yii::app()->setting->get("config/security/authkey"));
             $this->_config["password"] = StringUtil::authCode($this->_config["password"], "DECODE", $autoKey);
             $this->_config["timeout"] = intval($this->_config["timeout"]);
             $this->_enabled = true;
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:24,代码来源:FtpUtil.php

示例3: updateSession

 public function updateSession()
 {
     static $updated = false;
     if (!$updated) {
         $global = Ibos::app()->setting->toArray();
         if (!Ibos::app()->user->isGuest) {
             if (isset($global["cookie"]["ulastactivity"])) {
                 $userLastActivity = StringUtil::authCode($global["cookie"]["ulastactivity"], "DECODE");
             } else {
                 $userLastActivity = UserUtil::getUserProfile("lastactivity");
                 MainUtil::setCookie("ulastactivity", StringUtil::authCode($userLastActivity, "ENCODE"), 31536000);
             }
         }
         $onlineTimeSpan = 10;
         $lastOnlineUpdate = $this->var["lastolupdate"];
         $onlineTimeOffset = $lastOnlineUpdate ? $lastOnlineUpdate : $userLastActivity;
         $allowUpdateOnlineTime = $onlineTimeSpan * 60 < TIMESTAMP - $onlineTimeOffset;
         if (!Ibos::app()->user->isGuest && $allowUpdateOnlineTime) {
             $updateStatus = OnlineTime::model()->updateOnlineTime(Ibos::app()->user->uid, $onlineTimeSpan, $onlineTimeSpan, TIMESTAMP);
             if ($updateStatus === false) {
                 $onlineTime = new OnlineTime();
                 $onlineTime->uid = Ibos::app()->user->uid;
                 $onlineTime->thismonth = $onlineTimeSpan;
                 $onlineTime->total = $onlineTimeSpan;
                 $onlineTime->lastupdate = $global["timestamp"];
                 $onlineTime->save();
             }
             $this->setKey("lastolupdate", TIMESTAMP);
         }
         $this->var["invisible"] = UserUtil::getUserProfile("invisible");
         foreach ($this->var as $key => $value) {
             if (Ibos::app()->user->hasState($key) && $key != "lastactivity") {
                 $this->setKey($key, Ibos::app()->user->{$key});
             }
         }
         Ibos::app()->session->update();
         if (!Ibos::app()->user->isGuest) {
             $updateStatusField = array("lastip" => $global["clientip"], "lastactivity" => TIMESTAMP, "lastvisit" => TIMESTAMP, "invisible" => 1);
             if (21600 < TIMESTAMP - $userLastActivity) {
                 if ($onlineTimeSpan && 43200 < TIMESTAMP - $userLastActivity) {
                     $onlineTime = OnlineTime::model()->fetchByPk(Ibos::app()->user->uid);
                     UserCount::model()->updateByPk(Ibos::app()->user->uid, array("oltime" => round(intval($onlineTime["total"]) / 60)));
                 }
                 MainUtil::setCookie("ulastactivity", StringUtil::authCode(TIMESTAMP, "ENCODE"), 31536000);
                 UserStatus::model()->updateByPk(Ibos::app()->user->uid, $updateStatusField);
             }
         }
         $updated = true;
     }
     return $updated;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:51,代码来源:ICSession.php

示例4: sendWebMail

 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;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:43,代码来源:WebMailUtil.php

示例5: copyFile

 public function copyFile($srcFile, $desFile, $type)
 {
     $_G = Yii::app()->setting->toArray();
     if (!is_file($srcFile)) {
         return false;
     }
     if ($type == "file") {
         $this->mkdirs(dirname($desFile));
         copy($srcFile, $desFile);
     } else {
         if ($type == "ftp") {
             $siteFtp = $_GET["siteftp"];
             $siteFtp["on"] = 1;
             $autoKey = md5($_G["config"]["security"]["authkey"]);
             $siteFtp["password"] = StringUtil::authCode($siteFtp["password"], "ENCODE", $autoKey);
             $ftp =& FtpUtil::instance($siteFtp);
             $ftp->connect();
             $ftp->upload($srcFile, $desFile);
             if ($ftp->error()) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:25,代码来源:ICUpgrade.php

示例6: beforeSave

 private function beforeSave($web)
 {
     $web["nickname"] = isset($_POST["web"]["nickname"]) ? trim(htmlspecialchars($_POST["web"]["nickname"])) : "";
     if (empty($web["nickname"])) {
         $web["nickname"] = Yii::app()->user->realname;
     }
     $web["uid"] = $this->uid;
     $web["password"] = StringUtil::authCode($web["password"], "ENCODE", Yii::app()->user->salt);
     return $web;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:10,代码来源:WebController.php

示例7: getAttachStr

 public static function getAttachStr($aid, $tableID = "", $param = array())
 {
     if (!is_numeric($tableID)) {
         $tableID = Ibos::app()->db->createCommand()->select("tableid")->from("{{attachment}}")->where("aid = {$aid}")->queryScalar();
     }
     $str = $aid . "|" . $tableID . "|" . TIMESTAMP;
     if (!empty($param)) {
         $str .= "|" . serialize($param);
     }
     $encode = rawurlencode(base64_encode(StringUtil::authCode($str, "ENCODE", Ibos::app()->user->salt)));
     return $encode;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:12,代码来源:AttachUtil.php


注:本文中的StringUtil::authCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。