當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Surfer::is_trusted方法代碼示例

本文整理匯總了PHP中Surfer::is_trusted方法的典型用法代碼示例。如果您正苦於以下問題:PHP Surfer::is_trusted方法的具體用法?PHP Surfer::is_trusted怎麽用?PHP Surfer::is_trusted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Surfer的用法示例。


在下文中一共展示了Surfer::is_trusted方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_sql_where

 /**
  * restrict the scope of SQL query
  *
  * @return string to be inserted into a SQL statement
  */
 private static function get_sql_where()
 {
     // display active items
     $where = "sections.active='Y'";
     // add restricted items to members and for trusted hosts, or if teasers are allowed
     if (Surfer::is_logged() || Surfer::is_trusted() || Surfer::is_teased()) {
         $where .= " OR sections.active='R'";
     }
     // include hidden items for associates and for trusted hosts, or if teasers are allowed
     if (Surfer::is_associate() || Surfer::is_trusted() || Surfer::is_teased()) {
         $where .= " OR sections.active='N'";
     } else {
         // include content from managed sections
         if ($my_sections = Surfer::assigned_sections()) {
             $where .= " OR sections.anchor IN ('section:" . join("', 'section:", $my_sections) . "')" . " OR sections.id IN (" . join(", ", $my_sections) . ")";
         }
     }
     // end of active filter
     $where = '(' . $where . ')';
     // job done
     return $where;
 }
開發者ID:rair,項目名稱:yacs,代碼行數:27,代碼來源:sections.php

示例2: is_viewable

 /**
  * check that the surfer is allowed to display the anchor
  *
  * This function is used to control the authority delegation from the anchor.
  *
  * To be overloaded into derived class if field has a different name
  *
  * @param int optional reference to some user profile
  * @return TRUE or FALSE
  */
 function is_viewable($user_id = NULL)
 {
     global $context;
     // we need some data to proceed
     if (!isset($this->item['id'])) {
         return FALSE;
     }
     // surfer is a trusted host
     if (Surfer::is_trusted()) {
         return TRUE;
     }
     // section is public
     if (isset($this->item['active']) && $this->item['active'] == 'Y') {
         return TRUE;
     }
     // id of requesting user
     if (!$user_id) {
         $user_id = Surfer::get_id();
     }
     // anonymous is allowed
     if (!$user_id) {
         $user_id = 0;
     }
     // section is opened to members
     if ($user_id && isset($this->item['active']) && $this->item['active'] == 'R') {
         return TRUE;
     }
     // anchor has to be assigned
     return $this->is_assigned($user_id) || Surfer::is_associate();
 }
開發者ID:rair,項目名稱:yacs,代碼行數:40,代碼來源:anchor.php

示例3: get_sql_where

 /**
  * restrict the scope of SQL query
  *
  * @return string to be inserted into a SQL statement
  */
 private static function get_sql_where()
 {
     // display active items
     $where = "files.active='Y'";
     // add restricted items to members and for trusted hosts, or if teasers are allowed
     if (Surfer::is_logged() || Surfer::is_trusted() || Surfer::is_teased()) {
         $where .= " OR files.active='R'";
     }
     // include hidden items for associates and for trusted hosts, or if teasers are allowed
     if (Surfer::is_empowered('S') || Surfer::is_trusted() || Surfer::is_teased()) {
         $where .= " OR files.active='N'";
     }
     // end of active filter
     $where = '(' . $where . ')';
     // job done
     return $where;
 }
開發者ID:rair,項目名稱:yacs,代碼行數:22,代碼來源:files.php


注:本文中的Surfer::is_trusted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。