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


PHP Sections::is_assigned方法代码示例

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


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

示例1: elseif

$id = NULL;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
    $id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Sections::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
    $anchor = Anchors::get($item['anchor']);
}
// editors have associate-like capabilities
if (isset($item['id']) && Sections::is_assigned($item['id']) || is_object($anchor) && $anchor->is_assigned()) {
    Surfer::empower();
}
// load the skin, maybe with a variant
load_skin('sections', $anchor, isset($item['options']) ? $item['options'] : '');
// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    die(i18n::s('You are not allowed to perform this operation.'));
}
// page title
if (isset($item['title'])) {
    $context['page_title'] = $item['title'];
}
// not found
if (!$item['id']) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:describe.php

示例2: allow_creation

 /**
  * check if new links can be added
  *
  * This function returns TRUE if links can be added to some place,
  * and FALSE otherwise.
  *
  * @param object an instance of the Anchor interface, if any
  * @param array a set of item attributes, if any
  * @param string the type of item, e.g., 'section'
  * @return boolean TRUE or FALSE
  */
 public static function allow_creation($item = NULL, $anchor = NULL, $variant = NULL)
 {
     global $context;
     // backward compatibility, reverse parameters :
     // $anchor is always a object and $item a array
     if (is_object($item) || is_array($anchor)) {
         $permute = $anchor;
         $anchor = $item;
         $item = $permute;
     }
     // guess the variant
     if (!$variant) {
         // most frequent case
         if (isset($item['id'])) {
             $variant = 'article';
         } elseif (is_object($anchor)) {
             $variant = $anchor->get_type();
         } else {
             return FALSE;
         }
     }
     // only in articles
     if ($variant == 'article') {
         // 'no_links' option
         if (Articles::has_option('no_links', $anchor, $item)) {
             return FALSE;
         }
         // other containers
     } else {
         // links have to be activated
         if (isset($item['options']) && is_string($item['options']) && preg_match('/\\bwith_links\\b/i', $item['options'])) {
         } elseif (!isset($item['id']) && is_object($anchor) && $anchor->has_option('with_links', FALSE)) {
         } else {
             return FALSE;
         }
     }
     // surfer is an associate
     if (Surfer::is_associate()) {
         return TRUE;
     }
     // submissions have been disallowed
     if (isset($context['users_without_submission']) && $context['users_without_submission'] == 'Y') {
         return FALSE;
     }
     // only in articles
     if ($variant == 'article') {
         // surfer owns this item, or the anchor
         if (Articles::is_owned($item, $anchor)) {
             return TRUE;
         }
         // surfer is an editor, and the page is not private
         if (isset($item['active']) && $item['active'] != 'N' && Articles::is_assigned($item['id'])) {
             return TRUE;
         }
         // only in sections
     } elseif ($variant == 'section') {
         // surfer owns this item, or the anchor
         if (Sections::is_owned($item, $anchor, TRUE)) {
             return TRUE;
         }
         // surfer is an editor, and the section is not private
         if (isset($item['active']) && $item['active'] != 'N' && Sections::is_assigned($item['id'])) {
             return TRUE;
         }
     }
     // surfer is an editor, and container is not private
     if (isset($item['active']) && $item['active'] != 'N' && is_object($anchor) && $anchor->is_assigned()) {
         return TRUE;
     }
     if (!isset($item['id']) && is_object($anchor) && !$anchor->is_hidden() && $anchor->is_assigned()) {
         return TRUE;
     }
     // item has been locked
     if (isset($item['locked']) && $item['locked'] == 'Y') {
         return FALSE;
     }
     // anchor has been locked --only used when there is no item provided
     if (!isset($item['id']) && is_object($anchor) && $anchor->has_option('locked')) {
         return FALSE;
     }
     // surfer is an editor (and item has not been locked)
     if ($variant == 'article' && isset($item['id']) && Articles::is_assigned($item['id'])) {
         return TRUE;
     }
     if ($variant == 'section' && isset($item['id']) && Sections::is_assigned($item['id'])) {
         return TRUE;
     }
     if (is_object($anchor) && $anchor->is_assigned()) {
         return TRUE;
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:links.php

示例3: array

    // invite participants, for owners
    if (Sections::is_owned($item, $anchor, TRUE) && isset($context['with_email']) && $context['with_email'] == 'Y') {
        Skin::define_img('SECTIONS_INVITE_IMG', 'sections/invite.gif');
        $box['bar'] += array(Sections::get_url($item['id'], 'invite') => SECTIONS_INVITE_IMG . i18n::s('Invite participants'));
    }
    // notify participants
    if ($count > 1 && Sections::allow_message($item, $anchor) && isset($context['with_email']) && $context['with_email'] == 'Y') {
        Skin::define_img('SECTIONS_EMAIL_IMG', 'sections/email.gif');
        $box['bar'] += array(Sections::get_url($item['id'], 'mail') => SECTIONS_EMAIL_IMG . i18n::s('Notify participants'));
    }
    // manage editors, for owners
    if (Sections::is_owned($item, $anchor, TRUE) || Surfer::is_associate()) {
        Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif');
        $box['bar'] += array(Users::get_url('section:' . $item['id'], 'select') => SECTIONS_ASSIGN_IMG . i18n::s('Manage participants'));
        // leave this section, for editors
    } elseif (Sections::is_assigned($item['id'])) {
        Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif');
        $box['bar'] += array(Users::get_url('section:' . $item['id'], 'leave') => SECTIONS_ASSIGN_IMG . i18n::s('Leave this section'));
    }
    // headers
    $headers = array(i18n::s('Person'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner'));
    // layout columns
    if ($rows) {
        $box['text'] .= Skin::table($headers, $rows, 'grid');
    }
    // actually render the html
    $users .= Skin::build_content(NULL, NULL, $box['text'], $box['bar']);
}
// display in a separate panel
if ($users) {
    $label = i18n::s('Persons');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view_as_tabs.php

示例4: allow_message

 /**
  * check if a surfer can send a message to group participants
  *
  * @param array a set of item attributes, aka, the target section
  * @param object an instance of the Anchor interface
  * @return TRUE or FALSE
  */
 public static function allow_message($item, $anchor = NULL)
 {
     global $context;
     // subscribers can never sned a message
     if (!Surfer::is_member()) {
         return FALSE;
     }
     // sanity check
     if (!isset($item['id'])) {
         return FALSE;
     }
     // surfer is an associate
     if (Surfer::is_associate()) {
         return TRUE;
     }
     // surfer owns the container or the section
     if (Sections::is_owned($item, $anchor, TRUE)) {
         return TRUE;
     }
     // section editors can proceed
     if (isset($item['id']) && Sections::is_assigned($item['id'])) {
         return TRUE;
     }
     // container editors can proceed
     if (is_object($anchor) && $anchor->is_assigned()) {
         return TRUE;
     }
     // default case
     return FALSE;
 }
开发者ID:rair,项目名称:yacs,代码行数:37,代码来源:sections.php

示例5: allow_creation

 /**
  * check if new files can be added
  *
  * This function returns TRUE if files can be added to some place,
  * and FALSE otherwise.
  *
  * @param array a set of item attributes, if any
  * @param object an instance of the Anchor interface, if any
  * @param string the type of item, e.g., 'article' or 'section'
  * @return boolean TRUE or FALSE
  */
 public static function allow_creation($item = NULL, $anchor = NULL, $variant = NULL)
 {
     global $context;
     // guess the variant
     if (!$variant) {
         // most frequent case
         if (isset($item['id'])) {
             $variant = 'article';
         } elseif (is_object($anchor)) {
             $variant = $anchor->get_type();
         } else {
             return FALSE;
         }
     }
     // attach a file to an article
     if ($variant == 'article') {
         // 'no initial upload' option
         if (!isset($item['id']) && Articles::has_option('no_initial_upload', $anchor, $item)) {
             return FALSE;
         }
         // 'no files' option
         if (Articles::has_option('no_files', $anchor, $item)) {
             return FALSE;
         }
         // attach a file to a user profile
     } elseif ($variant == 'user') {
         // associates can always proceed
         if (Surfer::is_associate()) {
         } elseif (!is_object($anchor) || !Surfer::get_id()) {
             return FALSE;
         } elseif ($anchor->get_reference() != 'user:' . Surfer::get_id()) {
             return FALSE;
         }
         // other containers
     } else {
         // files have to be activated explicitly
         if (isset($item['options']) && is_string($item['options']) && preg_match('/\\bwith_files\\b/i', $item['options'])) {
         } elseif (!isset($item['id']) && is_object($anchor) && $anchor->has_option('with_files', FALSE)) {
         } else {
             return FALSE;
         }
     }
     // surfer is not allowed to upload a file
     if (!Surfer::may_upload()) {
         return FALSE;
     }
     // surfer is an associate
     if (Surfer::is_associate()) {
         return TRUE;
     }
     // submissions have been disallowed
     if (isset($context['users_without_submission']) && $context['users_without_submission'] == 'Y') {
         return FALSE;
     }
     // only in articles
     if ($variant == 'article') {
         // surfer owns this item, or the anchor
         if (Articles::is_owned($item, $anchor)) {
             return TRUE;
         }
         // surfer is an editor, and the page is not private
         if (isset($item['active']) && $item['active'] != 'N' && Articles::is_assigned($item['id'])) {
             return TRUE;
         }
         // only in sections
     } elseif ($variant == 'section') {
         // surfer owns this item, or the anchor
         if (Sections::is_owned($item, $anchor, TRUE)) {
             return TRUE;
         }
         // surfer is an editor, and the section is not private
         if (isset($item['active']) && $item['active'] != 'N' && Sections::is_assigned($item['id'])) {
             return TRUE;
         }
     }
     // surfer is an editor, and container is not private
     if (isset($item['active']) && $item['active'] != 'N' && is_object($anchor) && $anchor->is_assigned()) {
         return TRUE;
     }
     if (!isset($item['id']) && is_object($anchor) && !$anchor->is_hidden() && $anchor->is_assigned()) {
         return TRUE;
     }
     // item has been locked
     if (isset($item['locked']) && $item['locked'] == 'Y') {
         return FALSE;
     }
     // anchor has been locked --only used when there is no item provided
     if (!isset($item['id']) && is_object($anchor) && $anchor->has_option('locked')) {
         return FALSE;
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:files.php

示例6: allow_creation

 /**
  * check if new articles can be added
  *
  * This function returns TRUE if articles can be added to some place,
  * and FALSE otherwise.
  *
  * @param array a set of item attributes, if any --always a section
  * @param object an instance of the Anchor interface, if any
  * @return boolean TRUE or FALSE
  */
 public static function allow_creation($item, $anchor = NULL)
 {
     global $context;
     // articles are prevented in item, through layout
     if (isset($item['articles_layout']) && $item['articles_layout'] == 'none') {
         return FALSE;
     }
     // surfer is an associate
     if (Surfer::is_associate()) {
         return TRUE;
     }
     // submissions have been disallowed
     if (isset($context['users_without_submission']) && $context['users_without_submission'] == 'Y') {
         return FALSE;
     }
     // surfer owns this item, or the anchor
     if (Sections::is_owned($item, $anchor, TRUE)) {
         return TRUE;
     }
     // not for subscribers
     if (Surfer::is_member()) {
         // surfer is an editor, and the section is not private
         if (isset($item['active']) && $item['active'] != 'N' && Sections::is_assigned($item['id'])) {
             return TRUE;
         }
         if (isset($item['active']) && $item['active'] != 'N' && is_object($anchor) && $anchor->is_assigned()) {
             return TRUE;
         }
         if (!isset($item['id']) && is_object($anchor) && !$anchor->is_hidden() && $anchor->is_assigned()) {
             return TRUE;
         }
     }
     // container has been locked
     if (isset($item['locked']) && $item['locked'] == 'Y') {
         return FALSE;
     }
     // anchor has been locked
     if (!isset($item['id']) && is_object($anchor) && $anchor->has_option('locked')) {
         return FALSE;
     }
     // anonymous contributions are allowed for articles
     if (isset($item['options']) && preg_match('/\\banonymous_edit\\b/i', $item['options'])) {
         return TRUE;
     }
     if (is_object($anchor) && $anchor->has_option('anonymous_edit')) {
         return TRUE;
     }
     // subscribers can contribute too
     if (Surfer::is_logged() && isset($item['options']) && preg_match('/\\bmembers_edit\\b/i', $item['options'])) {
         return TRUE;
     }
     if (Surfer::is_logged() && is_object($anchor) && $anchor->has_option('members_edit')) {
         return TRUE;
     }
     // not for subscribers
     if (Surfer::is_member()) {
         // surfer is an editor (and item has not been locked)
         if (isset($item['id']) && Sections::is_assigned($item['id'])) {
             return TRUE;
         }
         if (is_object($anchor) && $anchor->is_assigned()) {
             return TRUE;
         }
     }
     // container is hidden
     if (isset($item['active']) && $item['active'] == 'N') {
         return FALSE;
     }
     if (is_object($anchor) && $anchor->is_hidden()) {
         return FALSE;
     }
     // surfer is a member
     if (Surfer::is_member()) {
         return TRUE;
     }
     // the default is to not allow for new articles
     return FALSE;
 }
开发者ID:rair,项目名称:yacs,代码行数:88,代码来源:articles.php

示例7: elseif

$id = NULL;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
    $id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Sections::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
    $anchor = Anchors::get($item['anchor']);
}
// editors have associate-like capabilities
if (Surfer::is_empowered('M') && (isset($item['id']) && isset($user['id']) && Sections::is_assigned($item['id'], $user['id'])) || is_object($anchor) && $anchor->is_assigned()) {
    Surfer::empower('A');
}
// load a skin, maybe with a variant
load_skin('sections', $anchor, isset($item['options']) ? $item['options'] : '');
// path to this page
$context['path_bar'] = array('sections/' => i18n::s('Site map'));
// page title
$context['page_title'] = i18n::s('RSS feed');
// not found
if (!isset($item['id']) || !$item['id']) {
    include '../error.php';
    // access denied
} elseif (!Sections::allow_access($item, $anchor)) {
    // give anonymous surfers a chance for HTTP authentication
    if (!Surfer::is_logged()) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:feed.php


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