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


PHP Str::validateXHTML方法代码示例

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


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

示例1: send

 /**
  * @return Bengine_Admin_Controller_Globalmail
  */
 protected function send()
 {
     $subject = Str::validateXHTML($this->getParam("subject"));
     $message = richtext(nl2br($this->getParam("message")));
     if (Str::length($message) < 10) {
         Core::getTPL()->assign("messageError", Logger::getMessageField("MESSAGE_TOO_SHORT"));
         $error = true;
     }
     if (Str::length($subject) == 0) {
         Core::getTPL()->assign("subjectError", Logger::getMessageField("SUBJECT_TOO_SHORT"));
         $error = true;
     }
     if (!empty($error)) {
         return $this;
     }
     $sql = "INSERT INTO `" . PREFIX . "message` (`mode`, `time`, `sender`, `receiver`, `subject`, `message`, `read`) SELECT ?, ?, NULL, " . PREFIX . "user.userid, ?, ?, ? FROM " . PREFIX . "user";
     Core::getDB()->query($sql, array(1, TIME, $subject, $message, 0));
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:22,代码来源:Globalmail.php

示例2: globalMailAction

 /**
  * Allows the user to write a global mail to all alliance member.
  *
  * @param string $reply
  * @return Bengine_Game_Controller_Alliance
  */
 protected function globalMailAction($reply)
 {
     $result = Core::getQuery()->select("user2ally u2a", array("a.founder", "ar.CAN_WRITE_GLOBAL_MAILS"), "LEFT JOIN " . PREFIX . "alliance a ON (a.aid = u2a.aid) LEFT JOIN " . PREFIX . "allyrank ar ON (ar.rankid = u2a.rank)", Core::getDB()->quoteInto("u2a.userid = ?", Core::getUser()->get("userid")));
     if ($row = $result->fetchRow()) {
         $result->closeCursor();
         if ($row["CAN_WRITE_GLOBAL_MAILS"] || $row["founder"] == Core::getUser()->get("userid")) {
             Core::getLanguage()->load("Message");
             if ($this->isPost()) {
                 $message = richtext($this->getParam("message"));
                 $length = Str::length(strip_tags($message));
                 $subject = Str::validateXHTML(trim($this->getParam("subject")));
                 $receiver = $this->getParam("receiver");
                 if ($length > 2 && $length <= Core::getOptions()->get("MAX_PM_LENGTH") && Str::length($subject) > 0 && Str::length($subject) < 101) {
                     Hook::event("SendGlobalMail", array($subject, &$message));
                     if ($receiver == "foo") {
                         $where = Core::getDB()->quoteInto("aid = ?", $this->aid);
                     } else {
                         $where = Core::getDB()->quoteInto("rank = ? AND aid = ?", array($receiver, $this->aid));
                     }
                     $_result = Core::getQuery()->select("user2ally", "userid", "", $where);
                     foreach ($_result->fetchAll() as $_row) {
                         Core::getQuery()->insert("message", array("mode" => 6, "time" => TIME, "sender" => Core::getUser()->get("userid"), "receiver" => $_row["userid"], "message" => $message, "subject" => $subject, "read" => $_row["userid"] == Core::getUser()->get("userid") ? 1 : 0));
                     }
                     $_result->closeCursor();
                     Logger::addMessage("SENT_SUCCESSFUL", "success");
                 } else {
                     if ($length < 3) {
                         Core::getTPL()->assign("messageError", Logger::getMessageField("MESSAGE_TOO_SHORT"));
                     }
                     if ($length > Core::getOptions()->get("MAX_PM_LENGTH")) {
                         Core::getTPL()->assign("messageError", Logger::getMessageField("MESSAGE_TOO_LONG"));
                     }
                     if (Str::length($subject) == 0) {
                         Core::getTPL()->assign("subjectError", Logger::getMessageField("SUBJECT_TOO_SHORT"));
                     }
                     if (Str::length($subject) > 100) {
                         Core::getTPL()->assign("subjectError", Logger::getMessageField("SUBJECT_TOO_LONG"));
                     }
                     Core::getTPL()->assign("subject", $this->getParam("subject"))->assign("message", $this->getParam("message"));
                 }
             } else {
                 if ($reply) {
                     $reply = preg_replace("#((RE|FW):\\s)+#is", "\\1", $reply);
                     Core::getTPL()->assign("subject", $reply);
                 }
             }
             $ranks = Core::getQuery()->select("allyrank", array("rankid", "name"), "", Core::getDB()->quoteInto("aid = ?", $this->aid));
             Core::getTPL()->assign("maxpmlength", fNumber(Core::getOptions()->get("MAX_PM_LENGTH")));
             Core::getTPL()->addLoop("ranks", $ranks);
         } else {
             Logger::dieMessage("MISSING_RIGHTS_FOR_GLOBAL_MAIL", "warning");
         }
     } else {
         Logger::dieMessage("MISSING_RIGHTS_FOR_GLOBAL_MAIL", "warning");
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:63,代码来源:Alliance.php

示例3: invite

 /**
  * Executes an invitation.
  *
  * @param integer $eventid
  * @param string $name
  * @param string $username
  *
  * @return Bengine_Game_Controller_Mission
  */
 protected function invite($eventid, $name, $username)
 {
     $this->noAction = true;
     $where = Core::getDB()->quoteInto("(mode = ? OR mode = ?) AND user = ? AND eventid = ?", array(10, 12, Core::getUser()->get("userid"), $eventid));
     $result = Core::getQuery()->select("events", "time", "", $where);
     if ($row = $result->fetchRow()) {
         $result->closeCursor();
         $error = "";
         $time = $row["time"];
         $result = Core::getQuery()->select("user u", array("u.userid", "u2a.aid"), "LEFT JOIN " . PREFIX . "user2ally u2a ON (u2a.userid = u.userid)", Core::getDB()->quoteInto("u.username = ?", $username));
         $row = $result->fetchRow();
         $userid = $row["userid"];
         $aid = $row["aid"];
         $Relation = new Bengine_Game_User_Relation(Core::getUser()->get("userid"), Core::getUser()->get("aid"));
         if (!$Relation->hasRelation($userid, $aid)) {
             $error[] = "UNABLE_TO_INVITE_USER";
         }
         unset($Relation);
         if (Str::length($name) > 0 && Str::length($name) <= 128) {
             $name = Str::validateXHTML($name);
             Core::getQuery()->update("attack_formation", array("name" => $name), "eventid = ?", array($eventid));
         } else {
             $error[] = "ENTER_FORMATION_NAME";
         }
         if (empty($error)) {
             Core::getQuery()->insert("formation_invitation", array("eventid" => $eventid, "userid" => $userid));
         } else {
             foreach ($error as $_error) {
                 Logger::addMessage($_error);
             }
         }
     }
     $this->formation($eventid);
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:44,代码来源:Mission.php

示例4: sendMessage

 /**
  * Sends a message.
  *
  * @param string $receiver	Receiver name
  * @param string $subject	Subject
  * @param string $message	Message
  *
  * @return Bengine_Game_Controller_MSG
  */
 protected function sendMessage($receiver, $subject, $message)
 {
     $this->checkForSpam();
     $receiver = trim($receiver);
     $subject = trim($subject);
     $message = richText($message);
     $messageLength = Str::length(strip_tags($message));
     if ($messageLength >= 3 && $messageLength <= Core::getOptions()->get("MAX_PM_LENGTH") && Str::length($subject) > 0 && Str::length($subject) < 101) {
         $result = Core::getQuery()->select("user", "userid", "", Core::getDB()->quoteInto("username = ?", $receiver));
         if ($row = $result->fetchRow()) {
             $result->closeCursor();
             if ($row["userid"] != Core::getUser()->get("userid")) {
                 $subject = preg_replace("#((RE|FW):\\s)+#is", "\\1", $subject);
                 // Remove excessive reply or forward notes
                 Hook::event("SendPrivateMessage", array(&$row, $receiver, &$subject, &$message));
                 Core::getQuery()->insert("message", array("mode" => 1, "time" => TIME, "sender" => Core::getUser()->get("userid"), "receiver" => $row["userid"], "subject" => Str::validateXHTML($subject), "message" => $message, "read" => 0));
                 Core::getQuery()->insert("message", array("mode" => 2, "time" => TIME, "sender" => $row["userid"], "receiver" => Core::getUser()->get("userid"), "subject" => Str::validateXHTML($subject), "message" => $message, "read" => 1));
                 $msgid = Core::getDB()->lastInsertId();
                 if ($msgid > 10000000) {
                     $TableCleaner = new Recipe_Maintenance_TableCleaner("message", "msgid");
                     $TableCleaner->clean();
                 }
                 Logger::addMessage("SENT_SUCCESSFUL", "success");
             } else {
                 Core::getTPL()->assign("userError", Logger::getMessageField("SELF_MESSAGE"));
             }
         } else {
             $result->closeCursor();
             Core::getTPL()->assign("userError", Logger::getMessageField("USER_NOT_FOUND"));
         }
     } else {
         if ($messageLength < 3) {
             Core::getTPL()->assign("messageError", Logger::getMessageField("MESSAGE_TOO_SHORT"));
         }
         if ($messageLength > Core::getOptions()->get("MAX_PM_LENGTH")) {
             Core::getTPL()->assign("messageError", Logger::getMessageField("MESSAGE_TOO_LONG"));
         }
         if (Str::length($subject) == 0 || Str::length($subject) > 50) {
             Core::getTPL()->assign("subjectError", Logger::getMessageField("SUBJECT_TOO_SHORT"));
         }
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:52,代码来源:MSG.php

示例5: saveVariable

 /**
  * @param string $var
  * @param string $type
  * @param string $options
  * @param string $description
  * @param integer $groupid
  * @return Bengine_Admin_Controller_Config
  */
 protected function saveVariable($var, $type, $options, $description, $groupid)
 {
     $options = $this->serialize($options);
     $spec = array("type" => $type, "options" => $options, "description" => Str::validateXHTML($description), "groupid" => $groupid);
     Core::getQuery()->update("config", $spec, "var = ?", array($var));
     Logger::addMessage("Saving_Successful", "success");
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:16,代码来源:Config.php


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