/** how to use this file * * include this file where you want to call auto_email_notification * then create a function in this file as it is depicted in * extra['notify_owner']['<-case->']['caption'] field of network info * for examaple 'some_joins_a_network' * within that function return if extra['notify_owner']['<-case->']['value'] != * NET_NONE means no notification * other wise set variables that is to be used in mail/message subject body * then call function $this->switch_destination($destination) * */ function auto_email_notification($activity_type, $params) { if (!PA::$network_info) { return; } //setting common variables $notification = new EmailNotification(); //mail to if (PA::$network_info->type == MOTHER_NETWORK_TYPE) { $network_owner_id = SUPER_USER_ID; } else { $network_owner_id = Network::get_network_owner(PA::$network_info->network_id); } $notification->network_owner = User::map_ids_to_logins($network_owner_id); $notification->owner = new User(); foreach ($notification->network_owner as $key => $value) { $notification->owner->load((int) $key); } $notification->to = $notification->owner->email; $owner_name = $notification->owner->login_name; //mail from $notification->from = (int) PA::$login_uid; $array_of_data = array('to' => $notification->to, 'from' => $notification->from, 'owner_name' => $owner_name, 'params' => $params); $notification->send($activity_type, $array_of_data); }
function auto_email_notification($activity_type, $params) { global $network_info; global $to, $mail_type, $mail_sub_msg_array, $from, $no_id, $network_owner, $subject, $message, $owner; if (!$network_info) { return; } //setting common variables //mail to if ($network_info->type == MOTHER_NETWORK_TYPE) { $network_owner_id = SUPER_USER_ID; } else { $network_owner_id = Network::get_network_owner($network_info->network_id); } $network_owner = User::map_ids_to_logins($network_owner_id); $owner = new User(); foreach ($network_owner as $key => $value) { $owner->load((int) $key); } $to = $owner->email; $owner_name = $owner->login_name; //mail from $from = (int) $_SESSION['user']['id']; $array_of_data = array('to' => $to, 'from' => $from, 'owner_name' => $owner_name, 'params' => $params); call_user_func_array($activity_type, array($array_of_data)); }
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; } }
public static function add_default_links($user_id) { require_once "api/CNNetworkLinks/CNNetworkLinks.php"; require_once "api/CNLinks/CNLinks.php"; $network_links = new NetworkLinks(); $network_owner_id = PA::$network_info->type == MOTHER_NETWORK_TYPE ? SUPER_USER_ID : Network::get_network_owner(PA::$network_info->network_id); $condition = array('user_id' => $network_owner_id, 'is_active' => 1); $link_categories = $network_links->load_category($condition); // load category as set by network operator $Links = new Links(); $error_array = array(); //providing default links to the user, as set by network operator for ($counter = 0; $counter < count($link_categories); $counter++) { $param_array = array('category_name' => $link_categories[$counter]->category_name, 'user_id' => $user_id, 'created' => time(), 'changed' => time(), 'is_active' => ACTIVE); $Links->set_params($param_array); $category_id = $Links->save_category(); // save network operator category as user's link category $network_lists = new NetworkLinks(); $network_lists->user_id = $network_info->owner_id; $condition = array('category_id' => $link_categories[$counter]->category_id, 'is_active' => ACTIVE); $list_array = $network_lists->load_link($condition); // load list for network operator's category for ($i = 0; $i < count($list_array); $i++) { $param_array = array('title' => $list_array[$i]->title, 'url' => $list_array[$i]->url, 'category_id' => $category_id, 'created' => time(), 'changed' => time(), 'is_active' => ACTIVE); $Links->set_params($param_array); $Links->save_link(); // save network operator list as user's list } } }
private function buildStatistics($board) { $board_statistics = $board->getBoardStatistics(); $statistics = array(); $statistics['title'] = $board->get_title(); $statistics['description'] = $board->get_description(); $statistics['type'] = $board->get_type() . " board"; $statistics['created_at'] = $board->get_created_at(); switch ($board->get_type()) { case PaForumBoard::network_board: $net_id = $board->get_owner_id(); if ($net_id == 1) { // mother network - owner_id always is '1' ! $owner_id = 1; } else { $owner_id = Network::get_network_owner((int) $board->get_owner_id()); } break; case PaForumBoard::group_board: $owner_id = Group::get_owner_id((int) $board->get_owner_id()); break; case PaForumBoard::personal_board: $owner_id = $board->get_owner_id(); break; } $user = new User(); $user->load((int) $owner_id); $statistics['owner'] = $user; $statistics['nb_categories'] = $board_statistics['nb_categories']; $nb_forums = 0; $nb_threads = 0; $nb_posts = 0; $threads = array(); $last_posts = array(); foreach ($board_statistics['categories'] as $category) { if ($category->statistics['nb_forums'] > 0) { $nb_forums += $category->statistics['nb_forums']; foreach ($category->statistics['forums'] as $forum) { if (!empty($forum->statistics['threads']) and count($forum->statistics['threads']) > 0) { foreach ($forum->statistics['threads'] as &$thr) { $thr->forum = $forum; } $threads = array_merge($threads, $forum->statistics['threads']); $nb_threads += $forum->statistics['nb_threads']; $nb_posts += $forum->statistics['nb_posts']; if (!empty($forum->statistics['last_post'])) { $last_posts[] = $forum->statistics['last_post']; } } } } } if (count($threads) > 1) { usort($threads, "cmpThreadCreated"); } $statistics['threads'] = $threads; $statistics['nb_forums'] = $nb_forums; $statistics['nb_threads'] = $nb_threads; $statistics['nb_posts'] = $nb_posts; $statistics['last_posts'] = $last_posts; $statistics['nb_users'] = PaForumsUsers::countPaForumsUsers("board_id = " . $board->get_id()); return $statistics; }
* 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>"; } else { $return_string = "<center>There are no links under this category</center> "; }
private function getBoardOwner($request_data) { switch ($this->board_type) { case PaForumBoard::network_board: $owner_id = Network::get_network_owner((int) $this->parent_id); break; case PaForumBoard::group_board: $group_owner = Group::get_owner_id((int) $this->parent_id); $owner_id = $group_owner['user_id']; break; case PaForumBoard::personal_board: $owner_id = (int) $this->parent_id; break; } $this->owner_id = $owner_id; $user = new User(); $user->load((int) $owner_id); return $user; }
} $abuse = trim($_POST['abuse']); if (!empty($abuse)) { if ($_SESSION['user']['id']) { $visitor_name = $_SESSION['user']['name']; } else { if (!empty($_POST['visitor_name'])) { $visitor_name = trim($_POST['visitor_name']); } else { $visitor_name = 'some one'; } } if ($network_info->type == MOTHER_NETWORK_TYPE) { $user_id = SUPER_USER_ID; } else { $user_id = Network::get_network_owner($network_info->network_id); } $user = new User(); $user->load((int) $user_id); $to_network_owner = $user->email; $cid = $_GET['cid']; $mail_type = 'report_abuse'; $content_url = $base_url . '/content.php?cid=' . $cid; $delete_url = $base_url . '/deletecontentbynetadmin.php?cid=' . $cid; $mail_sub_msg_array = array('login_name' => $user->login_name, 'visitor_name' => $visitor_name, 'network_url' => $base_url, 'message' => $_POST['abuse'], 'content_url' => $content_url, 'delete_url' => $delete_url, 'config_site_name' => $config_site_name); $error_message = 9003; switch (@$extra['notify_owner']['report_abuse_on_content']['value']) { case 1: $check = pa_mail($to_network_owner, $mail_type, $mail_sub_msg_array); break; case 2: