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


PHP Network::is_mother_network方法代码示例

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


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

示例1: getBoardsInfo

 private function getBoardsInfo()
 {
     $boards_info = array();
     $this->nid = isset($this->shared_data['network_id']) ? $this->shared_data['network_id'] : PA::$network_info->network_id;
     $boards = PaForumBoard::listPaForumBoard("network_id = {$this->nid} AND is_active = 1", 'type', 'ASC', 10);
     if (count($boards) > 0) {
         for ($i = 0; $i < count($boards); $i++) {
             $title = $boards[$i]->get_title();
             $type = $boards[$i]->get_type();
             $boards_info[$i]['title'] = strlen($title) <= self::max_title_length ? $title : substr($title, 0, self::max_title_length + 3) . '...';
             $boards_info[$i]['type'] = $type;
             $net_id = $boards[$i]->get_network_id();
             if (Network::is_mother_network($net_id)) {
                 $address = 'www';
             } else {
                 $network = Network::get_by_id((int) $net_id);
                 $address = $network->address;
             }
             $url = "http://{$address}." . PA::$domain_suffix . PA_ROUTE_FORUMS . "/network_id=" . $net_id;
             switch ($type) {
                 case PaForumBoard::network_board:
                     break;
                 case PaForumBoard::group_board:
                     $url .= "&gid=" . $boards[$i]->get_owner_id();
                     break;
                 case PaForumBoard::personal_board:
                     $url .= "&user_id=" . $boards[$i]->get_owner_id();
                     break;
             }
             $boards_info[$i]['url'] = $url;
         }
     }
     return $boards_info;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:34,代码来源:ForumsListModule.php

示例2: get_user_links

 function get_user_links()
 {
     $extra = unserialize(PA::$network_info->extra);
     if (Network::is_mother_network(PA::$network_info->network_id)) {
         $uid = SUPER_USER_ID;
     } else {
         $uid = Network::get_network_owner(PA::$network_info->network_id);
     }
     $condition = array('user_id' => $uid, 'is_active' => 1);
     $limit = 5;
     // 5 lists to be display on home page
     $Links = new NetworkLinks();
     $category_list = $Links->load_category($condition, $limit);
     if (!empty($category_list)) {
         for ($counter = 0; $counter < count($category_list); $counter++) {
             $links_data_array[$counter]['category_id'] = $category_list[$counter]->category_id;
             $links_data_array[$counter]['category_name'] = $category_list[$counter]->category_name;
             $Links->user_id = $uid;
             $condition = array('category_id' => $category_list[$counter]->category_id, 'is_active' => 1);
             $limit = 5;
             // 5 links to be display on home page
             $links_array = $Links->load_link($condition, $limit);
             $links_data_array[$counter]['links'] = $links_array;
         }
         return $links_data_array;
     }
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:27,代码来源:NetworkDefaultLinksModule.php

示例3: delete

 /**
  * deletes network
  * @access public static
  * @param id of the network
  * @return success or raise exception if user has not the permissions to delete the network
  */
 public static function delete($network_id, $uid = NULL)
 {
     //$uid NULL for the time being unless we add check permissions
     // global var $path_prefix has been removed - please, use PA::$path static variable
     Logger::log("[ Enter: function Network::delete | Args: \$comment_id = {$comment_id} ]\n");
     if (Network::is_mother_network($network_id)) {
         throw new PAException(OPERATION_NOT_PERMITTED, "You cant delete mother network.");
     }
     Network::delete_all($network_id);
     Logger::log("Exit: function Network::delete\n");
     return;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:18,代码来源:Network.php

示例4: is_admin

 /**
  * let the user member_exists
  * @access public
  * @param id of the network,uid of user
  * @return flag for joining request moderated or success message
  */
 static function is_admin($network_id, $uid)
 {
     // this function will be used for every action
     // need to be in role based access control
     // role needs to be figured out
     Logger::log("Enter: static function Network::is_admin");
     if (Network::is_mother_network($network_id)) {
         //check if we asking about mother network
         if (defined('SUPER_USER_ID')) {
             // check if super user exists else raise exception
             if (SUPER_USER_ID == $uid) {
                 return TRUE;
             } else {
                 return FALSE;
             }
         } else {
             throw new PAException(ROLE_ID_NOT_EXIST, "Configuration error: Super user is not defined for mother network.");
         }
     }
     //.. mother network
     $res = Dal::query("SELECT  user_type FROM {networks_users} WHERE network_id = ? AND user_id=?", array($network_id, $uid));
     $ret = $res->numRows();
     if (!$ret) {
         return FALSE;
     }
     $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
     if ($row->user_type != NETWORK_OWNER) {
         return FALSE;
     } else {
         return TRUE;
     }
     Logger::log("Exit: static function Network::is_admin");
     return $ret;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:40,代码来源:Network.php

示例5: dirname

 * Author:      tekritisoftware
 * Version:     1.1
 * Description: This file gets called from links module. It renders html
 *              for the links(inner html)
 * The lastest version of PeopleAggregator can be obtained from:
 * http://peopleaggregator.org
 * For questions, help, comments, discussion, etc. please visit 
 * http://wiki.peopleaggregator.org/index.php
 * TODO:      Need to call here link module to generate inner html
 */
$login_required = TRUE;
require_once dirname(__FILE__) . "/includes/page.php";
require_once "api/NetworkLinks/NetworkLinks.php";
if (!empty($_GET['category_id'])) {
    $condition = array('category_id' => $_GET['category_id'], 'is_active' => 1);
    if (Network::is_mother_network(PA::$network_info->network_id)) {
        $uid = SUPER_USER_ID;
    } else {
        $uid = Network::get_network_owner(PA::$network_info->network_id);
    }
    $params_array = array('user_id' => $uid);
    $Links = new NetworkLinks();
    $Links->set_params($params_array);
    $result_array = $Links->network_owner_link($condition);
    $return_string = "";
    if (count($result_array) > 0) {
        $return_string .= "<table width='100%' cellspacing='0' cellpadding='0'>";
        for ($counter = 0; $counter < count($result_array); $counter++) {
            $return_string .= "\n              <tr>\n                <td width='6%' rowspan='2'>\n                  <input type='checkbox' name='link_id[]' id='link_id_" . $result_array[$counter]->link_id . "' value='link_id:" . $result_array[$counter]->link_id . "' />\n                </td>\n                <td width='94%'>  \n                  <input type='text' size=65 value=\"" . $result_array[$counter]->title . "\"  id='link_id_" . $result_array[$counter]->link_id . "_title' style='border:0px;'/>\n                </td>\n               </tr>\n               <tr>\n                 <td>\n                   <input type='text' size=65 value='" . $result_array[$counter]->url . "' id='link_id_" . $result_array[$counter]->link_id . "_url' style='border:0px;'/>\n                 </td>  \n               </tr><br /> ";
        }
        $return_string .= "</table>";
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:ajax_default_links.php


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