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


PHP functions::latin2utf方法代码示例

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


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

示例1: getArticle

 public function getArticle($publishstatus = NEWS_ANYUNPUBLISHED, $article_id = 0, $section_id = 0, $issue_id = 0, $orderby = "", $cover = false)
 {
     $dbData = array();
     if ($section_id == NEWS_ALLSECTIONS) {
         $section_id = 0;
     }
     // NEWS_ALLSECTIONS used in feed generation
     // ----------------------
     if ($publishstatus == NEWS_ANYUNPUBLISHED) {
         $wheres[] = "(A.issue_id='') || (A.issue_id='0') || (I.date_published='" . DATETIME_NULL . "') || (NOW()<I.date_published)";
     }
     if ($publishstatus == NEWS_TOBEPUBLISHED) {
         $wheres[] = "(A.articlestatus_id='1') && ((A.issue_id='') || (A.issue_id='0') || (I.date_published='" . DATETIME_NULL . "') || (NOW()<I.date_published))";
     }
     if ($publishstatus == NEWS_PUBLISHED) {
         $wheres[] = "(A.issue_id!='') && (A.issue_id!='0') && (I.date_published!='" . DATETIME_NULL . "') && (I.date_published<=NOW())";
     }
     if (!empty($article_id)) {
         $wheres[] = "A.article_id='" . addslashes(strip_tags($article_id)) . "'";
     }
     if (!empty($section_id)) {
         $wheres[] = "A.section_id='" . addslashes(strip_tags($section_id)) . "'";
     }
     if ($cover) {
         $wheres[] = "(A.cover_order!='0') && (A.section_id!='" . NEWS_FEATURE . "')";
     }
     if ($issue_id == NEWS_CURRENTISSUE) {
         $wheres[] = "A.issue_id='" . $this->getCurrentIssueId() . "'";
     } elseif (!empty($issue_id)) {
         $wheres[] = "A.issue_id='" . addslashes(strip_tags($issue_id)) . "'";
     }
     $where = isset($wheres) ? "WHERE (" . implode(") AND (", $wheres) . ")" : "";
     $order = !empty($orderby) ? " " . $orderby . "," : "";
     // ----------------------
     $sql = "SELECT " . "  A.article_id, " . "  A.title, " . "  A.text, " . "  A.date_lastchange, " . "  A.date_created, " . "  DATE_FORMAT(A.date,'%Y-%m-%d') AS 'date_written', " . "  DATE_FORMAT(A.date,'%e %M %Y') AS 'date', " . "  A.cover_image, " . "  A.issue_id, " . "  A.author_id, " . "  A.section_id, " . "  A.article_order, " . "  A.cover_order, " . "  A.cover_image, " . "  A.articlestatus_id, " . "  A.locked, " . "  F.user AS 'author_user', " . "  CONCAT(F.fname,' ',F.lname) AS 'author_name', " . "  F.email AS 'author_email', " . "  F.image AS 'author_image', " . "  F.authorstatus_id, " . "  F.adminstatus_id, " . "  I.year AS 'issue_year', " . "  I.number AS 'issue_number', " . "  I.date_published AS 'issue_date_published', " . "  I.last_preprint_year, " . "  I.last_preprint_number, " . "  CONCAT(I.last_preprint_year,'-',LPAD(I.last_preprint_number,3,'0')) AS 'issue_preprint_to', " . "  I.sent_no_subscribers AS 'issue_sent_no_subscribers', " . "  I.issuestatus_id " . "FROM " . "  " . $this->dbprefix . "article AS A " . "  LEFT JOIN " . $this->dbprefix . "author AS F " . "  ON A.author_id=F.author_id " . "  LEFT JOIN " . $this->dbprefix . "issue AS I " . "  ON A.issue_id=I.issue_id " . " " . $where . " " . "ORDER BY " . $order . "  A.section_id," . "  A.article_id" . "";
     $res = $this->query($sql, IS_TESTSERVER);
     // includes a call to connect
     if (!$res || $this->num_rows($res) == 0) {
         return array();
     }
     while ($data = $this->next_record_assoc($res)) {
         if (is_array($data) && !empty($data)) {
             // Assumes SQL selects unique articles:
             $dbData[$data["article_id"]] = functions::latin2utf($data);
         }
     }
     // ----------------------
     $dbSection = $dbCategory = $dbCountry = array();
     foreach ($dbData as $idx => $data) {
         // -------------
         $sql = "SELECT " . "  A.article_id, " . "  S.section_id, " . "  S.section " . "FROM " . "  " . $this->dbprefix . "article AS A " . "  LEFT JOIN " . $this->dbprefix . "section AS S " . "  ON A.section_id=S.section_id " . "WHERE " . "  A.article_id='" . $idx . "' " . "ORDER BY " . "  A.article_id" . "";
         $res = $this->query($sql, IS_TESTSERVER);
         // includes a call to connect
         if ($res !== false && $this->num_rows($res) > 0) {
             while ($data = $this->next_record_assoc($res)) {
                 if (is_array($data) && !empty($data) && !empty($data["section"])) {
                     $data = functions::latin2utf($data);
                     $dbData[$data["article_id"]]["section_id"] = $data["section_id"];
                     $dbData[$data["article_id"]]["section"] = $data["section"];
                 }
             }
         }
         // -------------
         $sql = "SELECT " . "  A.article_id, " . "  C.category_id, " . "  C.category " . "FROM " . "  " . $this->dbprefix . "article AS A " . "  LEFT JOIN " . $this->dbprefix . "article_category AS Y " . "  ON A.article_id=Y.article_id " . "  LEFT JOIN " . $this->dbprefix . "category AS C " . "  ON Y.category_id=C.category_id " . "WHERE " . "  A.article_id='" . $idx . "' " . "ORDER BY " . "  A.article_id" . "";
         $res = $this->query($sql, IS_TESTSERVER);
         // includes a call to connect
         if ($res !== false && $this->num_rows($res) > 0) {
             while ($data = $this->next_record_assoc($res)) {
                 if (is_array($data) && !empty($data) && !empty($data["category"])) {
                     $data = functions::latin2utf($data);
                     $dbCategory[$idx][] = $data;
                     $dbData[$idx]["category"][$data["category_id"]] = $data["category"];
                 }
             }
         }
         // -------------
         $sql = "SELECT " . "  A.article_id, " . "  L.country_id, " . "  L.country " . "FROM " . "  " . $this->dbprefix . "article AS A " . "  LEFT JOIN " . $this->dbprefix . "article_country AS Z " . "  ON A.article_id=Z.article_id " . "  LEFT JOIN " . $this->dbprefix . "country AS L " . "  ON Z.country_id=L.country_id " . "WHERE " . "  A.article_id='" . $idx . "' " . "ORDER BY " . "  A.article_id" . "";
         $res = $this->query($sql, IS_TESTSERVER);
         // includes a call to connect
         if ($res !== false && $this->num_rows($res) > 0) {
             while ($data = $this->next_record_assoc($res)) {
                 if (is_array($data) && !empty($data) && !empty($data["country"])) {
                     $data = functions::latin2utf($data);
                     $dbCountry[$idx][] = $data;
                     $dbData[$idx]["country"][$data["country_id"]] = $data["country"];
                 }
             }
         }
         // -------------
         $cmt = $this->getComment($idx);
         if (is_array($cmt) && !empty($cmt)) {
             $dbData[$idx]["comment"] = $cmt;
         }
     }
     // ----------------------
     // If specific db record requested, return only that single array
     if (!empty($article_id) && count($dbData)) {
         return array_shift($dbData);
     }
     return $dbData;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: next_record_assoc

 function next_record_assoc($resultset = FALSE)
 {
     if (!$resultset) {
         $resultset = $this->qresult;
     }
     if (!$resultset) {
         return false;
     }
     if (USE_MYSQLI) {
         // ---------------------------
         // MYSQLI version
         // ---------------------------
         if ($record = mysqli_fetch_assoc($resultset)) {
             //TODO: check if latin2utf8 conversion still needed
             //      $record = functions::latin2utf($record);
             //echo mysql_client_encoding($this->dblink);
             //debug::rr($record);
         } else {
             mysqli_free_result($resultset);
             unset($resultset);
         }
     } else {
         // ---------------------------
         // MYSQL version
         // ---------------------------
         if ($record = mysql_fetch_assoc($resultset)) {
             $record = functions::latin2utf($record);
         } else {
             mysql_free_result($resultset);
             unset($resultset);
         }
         // ---------------------------
     }
     return $record;
 }
开发者ID:,项目名称:,代码行数:35,代码来源:


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