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;
 }
 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;
     }
 }
 /**
  * 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;
 }
示例#4
0
 /**
  * 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;
 }
 * 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>";