/** * Adds the given setting for the given user id. * * @param integer $assoc_id The id of the association entity for whom settings are to be added. * @param integer $array_of_data The array of settings data to be added like array([0]=>array([module_id]=>, [orientation]=>, [priority]=> ) [1]=>array([module_id]=>, [orientation]=>, [priority]=> )) */ static function save_setting($assoc_id, $page_id, $array_of_data, $assoc_type = "user") { Logger::log("Enter: function ModuleSetting::save_setting"); // get the prior settings // (passed settings might be only left or right or middle) $settings = ModuleSetting::load_setting($page_id, $assoc_id, $assoc_type); // now merge the two foreach ($array_of_data as $sec => $mods) { $settings[$sec] = $mods; } $settings_data = serialize($settings); $sql = "SELECT * FROM {page_settings} WHERE assoc_id=? AND page_id=? AND assoc_type =?"; $data = array($assoc_id, $page_id, $assoc_type); $res = Dal::query($sql, $data); if ($res->numRows() > 0) { $sql = "DELETE FROM {page_settings} WHERE assoc_id=? AND page_id=? AND assoc_type =?"; $data = array($assoc_id, $page_id, $assoc_type); $res = Dal::query($sql, $data); $sql = "INSERT INTO {page_settings} (assoc_id, page_id, settings, assoc_type) VALUES (?, ?, ?, ?)"; $data = array($assoc_id, $page_id, $settings_data, $assoc_type); Dal::query($sql, $data); } else { $sql = "INSERT INTO {page_settings} (assoc_id, page_id, settings, assoc_type) VALUES (?, ?, ?, ?)"; $data = array($assoc_id, $page_id, $settings_data, $assoc_type); Dal::query($sql, $data); } Logger::log("Exit: function ModuleSetting::save_setting"); return; }
require_once '../api/User/User.php'; require_once '../api/Relation/Relation.php'; include_once "../api/Theme/Template.php"; require_once './includes/functions/html_generate.php'; require_once '../ext/Image/Image.php'; require_once '../ext/Audio/Audio.php'; require_once '../ext/Video/Video.php'; require_once './includes/functions/date_methods.php'; require_once "{$path_prefix}/api/Message/Message.php"; $parameter = '<script type="text/javascript" language="javascript" src="' . $current_theme_path . '/base_javascript.js"></script></script> <script type="text/javascript" language="javascript" src="' . $current_theme_path . '/javascript/prototype.js"></script> <script type="text/javascript" language="javascript" src="' . $current_theme_path . '/javascript/scriptaculous.js"></script>'; html_header("people Aggregator User page", $parameter); default_exception(); $uid = $_SESSION['user']['id']; $setting_data = ModuleSetting::load_setting(PAGE_USER_PUBLIC, $uid); //left of user page foreach ($setting_data['left'] as $leftModule) { $file = "BlockModules/{$leftModule}/{$leftModule}.php"; require_once $file; $obj = new $leftModule(); if ($page_type == 'public') { $obj->mode = PUB; } else { $obj->mode = PRI; } $obj->uid = $uid; if ($leftModule == 'UserTasksModule') { $obj->block_type = 'UserPhotoBlock'; } $array_left_modules[] = $obj->render();
function __construct($cb, $page_id, $title, $page_template = "homepage_pa.tpl", $header_template = "header.tpl", $default_mode = PRI, $default_block_type = HOMEPAGE, $network_info_ = NULL, $onload = NULL, $setting_data = NULL) { global $app, $page; if (PA::$profiler) { PA::$profiler->startTimer('PageRenderer_init'); } // we may want to know the page_tpe elsewhere too PA::$config->page_type = $page_id; // NOTE: PA::$config->page_type var = $page_id and should be removed! $this->page_id = $page_id; $this->debugging = isset($_GET['debug']); $this->page_template = $page_template; $this->top_navigation_template = 'top_navigation_bar.tpl'; //TO DO: Remove this hardcoded text afterwards $this->header_template = $header_template; //settings for current network $this->network_info = $network_info_ ? $network_info_ : PA::$network_info; //FIXME: does this have to be a parameter? can't we just always use the global PA::$network_info? $this->module_arrays = array(); // the function hide_message_window is added here // so whenever html page is loaded the message window's ok button gets focus // here if previouly some function is defined as // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls);" // now it will look like // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls); hide_message_window();" $this->onload = "{$onload} hide_message_window('confirm_btn');"; $this->page_title = $title; $this->html_body_attributes = ""; // default settings for the tiers $this->main_tier = @$_GET['tier_one']; $this->second_tier = @$_GET['tier_two']; $this->third_tier = @$_GET['tier_three']; $navigation = new Navigation(); $this->navigation_links = $navigation->get_links(); $this->message_count = null; if (!isset(PA::$login_uid)) { PA::$login_uid = @$_SESSION['user']['id']; } if (PA::$login_uid) { $this->message_count = Message::get_new_msg_count(PA::$login_uid); } if (!isset($dynamic_page)) { $dynamic_page = new DynamicPage($this->page_id); if (!is_object($dynamic_page) or !$dynamic_page->docLoaded) { throw new Exception("Page XML config file for page ID: {$page_id} - not found!"); } $dynamic_page->initialize(); } if (false !== strpos($dynamic_page->page_type, 'group') && (!empty($_REQUEST['gid']) || !empty($_REQUEST['ccid']))) { // page is a group page - get group module settings $_gr_id = !empty($_REQUEST['gid']) ? $_REQUEST['gid'] : $_REQUEST['ccid']; $this->setting_data = ModuleSetting::load_setting($this->page_id, $_gr_id, 'group'); $this->page_template = $this->setting_data['page_template']; if (empty($this->setting_data['access_permission'])) { // no permissions required to access page $access_permission = true; } else { $access_permission = PermissionsHandler::can_group_user(PA::$login_uid, $_gr_id, array('permissions' => $this->setting_data['access_permission'])); } } else { if (false !== strpos($dynamic_page->page_type, 'user') && !empty(PA::$login_uid)) { // page is an user page - get user module settings // echo "POSTING TO USER PAGE"; die(); $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$login_uid, 'user'); $this->page_template = $this->setting_data['page_template']; if (empty($this->setting_data['access_permission'])) { // no permissions required to access page $access_permission = true; } else { $access_permission = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => $this->setting_data['access_permission'])); } } else { // page is a network page - get network module settings $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$network_info->network_id, 'network'); $this->page_template = $this->setting_data['page_template']; if (empty($this->setting_data['access_permission'])) { // no permissions required to access page $access_permission = true; } else { $access_permission = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => $this->setting_data['access_permission'])); } } } $this->page = new Template(CURRENT_THEME_FSPATH . "/" . $this->page_template); $this->page->set('current_theme_path', PA::$theme_url); $this->page->set('current_theme_rel_path', PA::$theme_rel); // Loading the templates variables for the Outer templates files $this->page->set('outer_class', get_class_name(PA::$config->page_type)); $this->top_navigation_bar = new Template(CURRENT_THEME_FSPATH . "/" . $this->top_navigation_template); $this->top_navigation_bar->set('current_theme_path', PA::$theme_url); $this->top_navigation_bar->set('current_theme_rel_path', PA::$theme_rel); $this->top_navigation_bar->set('navigation_links', $this->navigation_links); $this->setHeader($this->header_template); $this->footer = new Template(CURRENT_THEME_FSPATH . "/footer.tpl"); $this->footer->set('current_theme_path', PA::$theme_url); $this->footer->set('page_name', $title); $page = $this; $this->preInitialize($this->setting_data); $this->initNew($cb, $default_mode, $default_block_type, $this->setting_data); if (!$access_permission) { $configure = unserialize(ModuleData::get('configure')); if (PA::logged_in()) { $redir_url = PA::$url . PA_ROUTE_USER_PRIVATE; } else { if (!isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) { $redir_url = PA::$url . '/' . FILE_LOGIN; } else { $redir_url = PA::$url; } } $er_msg = urlencode("Sorry! you are not authorized to to access this page."); $this->showDialog($er_msg, $type = 'error', $redir_url, 10); } if (PA::$profiler) { PA::$profiler->stopTimer('PageRenderer_init'); } }
} // For None of the words if (!empty($_GET["notwords"])) { $notwords_array = explode(" ", trim($_GET["notwords"])); if (count($notwords_array) > 0) { for ($counter = 0; $counter < count($notwords_array); $counter++) { $search_string_array["notwords"][$counter] = trim($notwords_array[$counter]); } } } //$content_array = Content::content_search($search_string_array); //die; if (!isset($search_string_array) && isset($_GET["mFrom"])) { $error_message = __("Please enter either data or date to search"); } $setting_data = ModuleSetting::load_setting(PAGE_SHOWCONTENT, $uid); $user = new User(); if ($login_uid) { $user_details = $user->load((int) $uid); } $_REQUEST['ccid'] = @$_REQUEST['gid']; //get details of group if ($_REQUEST['ccid']) { $is_member = FALSE; $is_admin = FALSE; $content_access = TRUE; $is_invite = FALSE; //$gid = (int)$_REQUEST['gid']; gid changed to ccid $gid = (int) $_REQUEST['gid']; $group = ContentCollection::load_collection((int) $gid, $login_uid); $access = $group->access_type;
* @copyright Copyright (c) 2010 Broadband Mechanics * @package PeopleAggregator */ $login_required = FALSE; $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. include_once "web/includes/page.php"; include_once "api/Theme/Template.php"; /*including Js files */ $parameter = js_includes('common.js'); $page_id = PAGE_NETWORKS_HOME; if (!PA::$network_capable) { die(__("Networks are disabled.")); } // which blocks are coming on this page $setting_data = ModuleSetting::load_setting(PAGE_NETWORKS_HOME, @PA::$login_user->user_id); $setting_data['left'] = is_array(@$setting_data['left']) ? $setting_data['left'] : array(); if (@$_SESSION['user']['id']) { array_unshift($setting_data['left'], 'MyNetworksModule'); } array_unshift($setting_data['left'], 'FeaturedNetworkModule', 'VideoTourModule'); $params = array(); $params['cnt'] = TRUE; $network_obj = new Network(); $total_network = $network_obj->get($params); function setup_module($column, $moduleName, $obj) { global $user_edit, $error, $uid, $rel_type, $uid, $user, $paging, $page_uid, $login_uid, $total_network; switch ($moduleName) { case 'FeaturedNetworkModule': $obj->block_type = 'FeaturedNetwork';
<?php $login_required = FALSE; $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. include "includes/page.php"; global $path_prefix; require_once "{$path_prefix}/api/User/User.php"; require_once "{$path_prefix}/api/Tag/Tag.php"; include_once "{$path_prefix}/api/ModuleSetting/ModuleSetting.php"; include_once "{$path_prefix}/api/Theme/Template.php"; require_once "{$path_prefix}/ext/SBMicroContent/SBMicroContent.php"; require_once "{$path_prefix}/ext/Group/Group.php"; require_once "{$path_prefix}/api/Invitation/Invitation.php"; $setting_data = ModuleSetting::load_setting(PAGE_GROUP_MEMBERS, $uid); $gid = (int) $_REQUEST['gid']; $group = ContentCollection::load_collection((int) $gid, $_SESSION['user']['id']); $group_details = array(); $group_details['collection_id'] = $group->collection_id; $group_details['type'] = $group->type; $group_details['author_id'] = $group->author_id; $user = new User(); $user->load((int) $group->author_id); $first_name = $user->first_name; $last_name = $user->last_name; $login_name = $user->login_name; $group_details['author_name'] = chop_string($login_name, 15); $group_details['author_picture'] = $user->picture; $group_details['title'] = $group->title; $group_details['description'] = $group->description; $group_details['is_active'] = $group->is_active;
include_once "web/includes/page.php"; // global var $path_prefix has been removed - please, use PA::$path static variable require_once "api/Content/Content.php"; require_once "api/Tag/Tag.php"; require_once "api/ContentCollection/ContentCollection.php"; require_once "api/Comment/Comment.php"; include_once "api/ModuleSetting/ModuleSetting.php"; require_once "api/Group/Group.php"; include_once "api/Theme/Template.php"; require_once "api/Category/Category.php"; $parameter = '<script type="text/javascript" language="javascript" src="' . PA::$theme_url . '/base_javascript.js"></script></script> <script type="text/javascript" language="javascript" src="' . PA::$theme_url . '/javascript/prototype.js"></script> <script type="text/javascript" language="javascript" src="' . PA::$theme_url . '/javascript/scriptaculous.js"></script>'; html_header("Group Home", $parameter); //print '<body style="background-color: #363636;">'; $setting_data = ModuleSetting::load_setting(PAGE_GROUPS_CATEGORY, $uid); $leftModulesFromDB = $setting_data['left']; $middleModulesFromDB = $setting_data['middle']; $rightModulesFromDB = $setting_data['right']; $page = new Template(CURRENT_THEME_FSPATH . "/groups.tpl"); $page->set('current_theme_path', PA::$theme_url); //header of group page $optional_parameters = "onload=\"{$onload}\""; html_body($optional_parameters); //header of group page $header = new Template(CURRENT_THEME_FSPATH . "/header.tpl"); $header->set('current_theme_path', PA::$theme_url); $header->set('current_theme_rel_path', PA::$theme_rel); // find navigation link for header $navigation = new Navigation(); $navigation_links = $navigation->get_links();
if ($mid) { //echo 'data has been saved'; if ($_GET['ccid']) { header("Location: {$base_url}/forum_messages.php?mid={$parent_id}&ccid=" . $_GET['ccid']); } else { header("Location: {$base_url}/forum_messages.php?mid={$parent_id}"); } exit; } } else { if (isset($_POST['submit']) && !Group::member_exists((int) $_GET['ccid'], (int) $_SESSION['user']['id'])) { $msg = "You are not a member of this group."; $error = TRUE; } } $setting_data = ModuleSetting::load_setting(PAGE_FORUM_MESSAGES, $uid); if ($_REQUEST['ccid']) { array_unshift($setting_data['left'], 'GroupAccessModule', 'MembersFacewallModule'); array_unshift($setting_data['right'], 'GroupStatsModule', 'RecentPostModule'); } $param['action'] = 'edit_forum'; function setup_module($column, $moduleName, $obj) { global $request_info, $title, $body, $name, $email, $paging, $msg; global $group_details, $users, $param; switch ($moduleName) { case 'GroupAccessModule': case 'GroupStatsModule': $obj->group_details = $group_details; break; case 'MembersFacewallModule':
} } $module_array = serialize($set_module); try { // Saving the data into database $success = ModuleSetting::save_page_setting($page_id, $module_array); $module_settings = ModuleSetting::load_setting($page_id, NULL); $msg = 7010; } catch (PAException $e) { // handling exception while saving data throw $e; } } // Adding the Default option on the network module settings if (isset($_POST['default_setting']) && $_GET['type'] == 'module') { global $settings_new; $setting_default_data = $settings_new[$page_id]['data']; $module_array = serialize($setting_default_data); try { // Saving the data into database $success = ModuleSetting::save_page_setting($page_id, $module_array); $module_settings = ModuleSetting::load_setting($page_id, NULL); $msg = 7010; } catch (PAException $e) { // handling exception while saving data throw $e; } } if (!empty($error_msg)) { $msg = $error_msg; }
$login_required = TRUE; include_once "web/includes/page.php"; // global var $path_prefix has been removed - please, use PA::$path static variable require_once "api/Content/Content.php"; require_once "api/Tag/Tag.php"; require_once "api/ContentCollection/ContentCollection.php"; require_once "api/Comment/Comment.php"; include_once "api/ModuleSetting/ModuleSetting.php"; require_once "api/Group/Group.php"; include_once "api/Theme/Template.php"; require_once "api/Category/Category.php"; $parameter = '<script type="text/javascript" language="javascript" src="' . PA::$theme_url . '/base_javascript.js"></script></script> <script type="text/javascript" language="javascript" src="' . PA::$theme_url . '/javascript/prototype.js"></script> <script type="text/javascript" language="javascript" src="' . PA::$theme_url . '/javascript/scriptaculous.js"></script>'; html_header("Group Home", $parameter); $setting_data = ModuleSetting::load_setting(PAGE_MANAGECONTENT, $uid); $leftModulesFromDB = $setting_data['left']; $middleModulesFromDB = $setting_data['middle']; $rightModulesFromDB = $setting_data['right']; $page = new Template(CURRENT_THEME_FSPATH . "/groups.tpl"); $page->set('current_theme_path', PA::$theme_url); //header of group page if ($_GET['tier_one']) { $main_tier = $_GET['tier_one']; //$tmp = $_GET['tier_one'].'pagedemo.php'; } else { $main_tier = 'group'; } if ($_GET['tier_two']) { $second_tier = $_GET['tier_two']; }
/** !! * Gather all modules and their current status (active/inactive and where). * Also check to see if { @link restore_module_settings } is true in which * case return to the past settings by setting values to null. Once all the * data for the different objects to be displayed on the page has been * gathered pass the information into { @link generate_inner_html() }. * @param array $request_data contains the different selected Modules */ private function setupCustomizeModuleSettings($request_data) { $page_templates = $this->page_templates; $this->template_selected = !empty($request_data['page_template']) ? $request_data['page_template'] : null; $this->side_selected = !empty($request_data['side_module']) ? $request_data['side_module'] : null; $this->middle_selected = !empty($request_data['middle_module']) ? $request_data['middle_module'] : null; $module_settings = ModuleSetting::load_setting($this->pid, $this->assoc_id, $this->settings_type); // @todo: Should we enable restore defaults from XML for user and group pages ? $from_XML = $this->settings_type == 'network' ? true : false; $pages_default_setting = ModuleSetting::get_pages_default_setting($this->settings_type, true, $from_XML); $selected = null; $current_selecion = null; $select_options = array(); if ($this->settings_type == 'user') { $user_configurable_pages = array(PAGE_USER_PRIVATE, PAGE_USER_PUBLIC); foreach ($pages_default_setting as $page_details) { if (in_array($page_details->page_id, $user_configurable_pages)) { $select_options[$page_details->page_name] = $page_details->page_id; if ($this->pid == $page_details->page_id) { $selected = $page_details->page_id; $current_selection = $page_details; $restore_settings = $page_details->getPageSettings(); } } } } else { foreach ($pages_default_setting as $page_details) { $select_options[$page_details->page_name] = $page_details->page_id; if ($this->pid == $page_details->page_id) { $selected = $page_details->page_id; $current_selection = $page_details; $restore_settings = $page_details->getPageSettings(); } } } if ($this->restore_module_settings) { $module_settings = $restore_settings; $this->template_selected = null; $this->side_selected = null; $this->middle_selected = null; } $tag_attrs = array('name' => "form_data[page_id]", 'onchange' => "javascript: document.location='" . $this->url . "&pid='+this.value"); $select_tag = xHtml::selectTag($select_options, $tag_attrs, $selected); if (empty($module_settings['left'])) { $module_settings['left'] = array(); } if (empty($module_settings['middle'])) { $module_settings['middle'] = array(); } if (empty($module_settings['right'])) { $module_settings['right'] = array(); } if ($this->template_selected) { $selected_template = $this->template_selected; } else { $page_tmpl = trim($module_settings['page_template']); $available_templates = array_flip($this->page_templates); if (array_key_exists($page_tmpl, $available_templates)) { $selected_template = $available_templates[$page_tmpl]; } } $template_tag_attrs = array('name' => "form_data[page_template]", 'onchange' => "javascript: document.location='" . $this->url . "&pid={$this->pid}&page_template='+this.value"); $template_select_tag = xHtml::selectTag(array_flip($page_templates), $template_tag_attrs, $selected_template); $mod_info = new CNModulesInfo(array(PA::$project_dir . DIRECTORY_SEPARATOR . PA::$blockmodule_path, PA::$core_dir . DIRECTORY_SEPARATOR . PA::$blockmodule_path)); $side_modules = $mod_info->getModulesByCondition($this->side_modules_condition); $middle_modules = $mod_info->getModulesByCondition($this->middle_modules_condition); $side_selected = null; $side_current_selecion = null; $side_select_options = array(); foreach ($side_modules as $s_module) { $side_select_options[$s_module['name']] = $s_module['name']; if ($this->side_selected == $s_module['name']) { $side_selected = $s_module['name']; } } $side_select_options[" "] = " "; ksort($side_select_options); $side_tag_attrs = array('name' => "add_side_module", 'onchange' => "javascript: document.location='" . $this->url . "&pid={$this->pid}&page_template={$this->template_selected}&side_module='+this.value"); $side_select_tag = xHtml::selectTag($side_select_options, $side_tag_attrs, $side_selected); $middle_selected = null; $middle_current_selecion = null; $middle_select_options = array(); foreach ($middle_modules as $s_module) { $middle_select_options[$s_module['name']] = $s_module['name']; if ($this->middle_selected == $s_module['name']) { $middle_selected = $s_module['name']; } } $middle_select_options[" "] = " "; ksort($middle_select_options); $middle_tag_attrs = array('name' => "add_middle_module", 'onchange' => "javascript: document.location='" . $this->url . "&pid={$this->pid}&page_template={$this->template_selected}&middle_module='+this.value"); $middle_select_tag = xHtml::selectTag($middle_select_options, $middle_tag_attrs, $middle_selected); if (!is_null($this->middle_selected)) { array_push($module_settings['middle'], $this->middle_selected); } if (!is_null($this->side_selected)) { array_push($module_settings['left'], $this->side_selected); } $side_dissabled = 'none'; switch ($selected_template) { case 'one': unset($module_settings['left']); unset($module_settings['right']); $side_dissabled = 'both'; $show_columns = array('middle'); break; case 'two': case 'two_l': case 'two_r': /* $all_modules = array_merge($module_settings['left'], $module_settings['right']); unset($module_settings['right']); $module_settings['left'] = $all_modules; $side_dissabled = 'right'; $show_columns = array('left', 'middle'); */ $show_columns = array('left', 'middle', 'right'); break; case 'three': $show_columns = array('left', 'middle', 'right'); break; } $this->set_inner_template('cnmodule_selector.php'); $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->pid, 'page_url' => $this->url, 'base_url' => $this->base_url, 'uid' => $this->uid, 'gid' => $this->gid, 'module_settings' => $module_settings, 'pages_default_setting' => $pages_default_setting, 'type' => 'module', 'settings_type' => $this->settings_type, 'select_tag' => $select_tag, 'template_select_tag' => $template_select_tag, 'side_select_tag' => $side_select_tag, 'middle_select_tag' => $middle_select_tag, 'current_selection' => $current_selection, 'side_dissabled' => $side_dissabled, 'show_columns' => $show_columns)); }
$user_data_professional = sanitize_user_data($user_professionaldata); $data = array('user_data_general' => $user_data_general, 'user_data_personal' => $user_data_personal, 'user_data_professional' => $user_data_professional); $user_data_external = sanitize_user_data(User::load_user_profile($uid, $uid, 'external')); $delicious_id = @$user_data_external['delicious']; $flickr_id = @$user_data_external['flickr_email']; // try and get the Flickr nsid if user has imported profile $user_data_flickr = sanitize_user_data(User::load_user_profile($uid, $uid, 'flickr')); $flickr_nsid = @$user_data_flickr['nsid']; // Loading user relations (relation ids) $relations_ids = Relation::get_all_user_ids((int) $_SESSION['user']['id'], 5); // $onload="ajax_call_method(ajax_titles, $uid, ajax_urls);"; // see if we have a user defined CSS $user_data_ui = sanitize_user_data(User::load_user_profile($uid, $uid, 'ui')); $skin_var = sanitize_user_data(User::load_user_profile($uid, $uid, 'skin')); // accessing page settings data $setting_data = ModuleSetting::load_setting(PAGE_USER_PRIVATE, $uid); function setup_module($column, $moduleName, $obj) { global $logged_user, $setting_data, $flickr_id, $flickr_nsid, $delicious_id, $uid, $data; global $content_type, $post_type_message, $paging, $relations_ids, $post_type_message, $post_type; global $type, $user_data_ui, $skin_var, $setting_data, $user_info; switch ($moduleName) { case 'CustomizeUIModule': $obj->uid = $uid; $obj->type = $type; $obj->data = $data; $obj->user_data_ui = $user_data_ui; $obj->skin_var = $skin_var; $obj->setting_data = $setting_data; break; case 'InRelationModule':
$contents[$i]['trackback_url'] = "{$base_url}/pa_trackback.php?cid=" . $contents[$i]['content_id']; $tags = Tag::load_tags_for_content($contents[$i]['content_id']); if ($tags) { $t = array(); for ($j = 0; $j < count($tags); $j++) { $t_name = $tags[$j]['name']; $uid = $_SESSION['user']['id']; $t[] = "<a href=\"content_all.php?uid={$uid}&tag={$t_name}\">" . $tags[$j]['name'] . "</a>"; } $contents[$i]['tag_entry'] = "<b>Tags : </b>" . implode(", ", $t); } else { $contents[$i]['tag_entry'] = ""; } } // accessing page settings data $setting_data = ModuleSetting::load_setting(2, 1); // members $users = User::allUsers_with_paging(1, 10); // header $header =& new Template(CURRENT_THEME_FSPATH . "/header_all.tpl"); $header->set('current_theme_path', $current_theme_path); $module2 = new LinkModule($links['myself']); $module2->mode = PRI; $module2->title = "Published Links"; $module2->orientation = LEFT; $module1 = new ShowContentModule($contents); $module1->title = "Community Content"; $module3 = new LinkModule($links['myself']); $module3->mode = PRI; $module3->block_type = 'Homepage'; $module3->title = "My Links";
function __construct($cb, $page_type, $title, $page_template = "homepage_pa.tpl", $header_template = "header.tpl", $default_mode = PRI, $default_block_type = HOMEPAGE, $network_info_ = NULL, $onload = NULL, $setting_data = NULL) { global $login_uid, $page_uid, $uid, $path_prefix, $current_theme_path, $current_theme_rel_path, $base_url, $network_info, $current_blockmodule_path; $this->debugging = isset($_GET['debug']); $this->page_template = $page_template; $this->top_navigation_template = 'top_navigation_bar.tpl'; //TO DO: Remove this hardcoded text afterwards $this->header_template = $header_template; //settings for current network $this->network_info = $network_info_ ? $network_info_ : $network_info; //FIXME: does this have to be a parameter? can't we just always use the global $network_info? // the function hide_message_window is added here // so whenever html page is loaded the message window's ok button gets focus // here if previouly some function is defined as // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls);" // now it will look like // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls); hide_message_window();" $this->onload = "{$onload} hide_message_window('confirm_btn');"; $this->page_title = $title; $this->html_body_attributes = ""; // default settings for the tiers $this->main_tier = @$_GET['tier_one']; $this->second_tier = @$_GET['tier_two']; $this->third_tier = @$_GET['tier_three']; $navigation = new Navigation(); $navigation_links = $navigation->get_links(); $message_count = null; if ($login_uid) { $message_count = Message::get_new_msg_count($login_uid); } // load all templates $this->page =& new Template(CURRENT_THEME_FSPATH . "/" . $this->page_template); $this->page->set('current_theme_path', $current_theme_path); $this->page->set('current_theme_rel_path', $current_theme_rel_path); $this->page->set('base_url', $base_url); // Loading the templates variables for the Outer templates files $this->page->set('outer_class', get_class_name($page_type)); $this->top_navigation_bar =& new Template(CURRENT_THEME_FSPATH . "/" . $this->top_navigation_template); $this->top_navigation_bar->set('current_theme_path', $current_theme_path); $this->top_navigation_bar->set('current_theme_rel_path', $current_theme_rel_path); $this->top_navigation_bar->set('navigation_links', $navigation_links); $this->header =& new Template(CURRENT_THEME_FSPATH . "/" . $this->header_template); $this->header->set('current_theme_path', $current_theme_path); $this->header->set('current_theme_rel_path', $current_theme_rel_path); $this->header->set('base_url', $base_url); $this->header->set_object('network_info', $this->network_info); $this->header->set('message_count', $message_count['unread_msg']); $this->header->set('navigation_links', $navigation_links); $this->footer =& new Template(CURRENT_THEME_FSPATH . "/footer.tpl"); $this->footer->set('current_theme_path', $current_theme_path); $this->footer->set('page_name', $title); // load module settings // if we want to change the Module's arrangement then we give the setting_data to this function or we want to change the Ordering of the Modules ... if ($setting_data) { $this->setting_data = $setting_data; } else { $this->setting_data = !$page_type ? NULL : ModuleSetting::load_setting($page_type, $uid); } // render all modules $this->module_arrays = array(); foreach (array("left", "middle", "right") as $module_column) { $modulesFromDB = !$page_type ? NULL : @$this->setting_data[$module_column]; $array_modules = array(); // render all modules if ($modulesFromDB) { foreach ($modulesFromDB as $moduleName) { if (!$moduleName) { continue; } $file = "{$current_blockmodule_path}/{$moduleName}/{$moduleName}.php"; try { require_once $file; } catch (Exception $e) { echo "<p>Failed to require_once {$file}.</p>"; throw $e; } $obj = new $moduleName(); $obj->login_uid = (int) $login_uid; // uid of logged in user $obj->page_uid = (int) $page_uid; // uid specified in URL // standard column-specific initialization switch ($module_column) { case 'left': case 'right': if ($default_mode) { $obj->mode = $default_mode; } // some modules don't like to be set as PRI/HOMEPAGE switch ($moduleName) { case 'LogoModule': case 'AdsByGoogleModule': case 'GroupAccessModule': case 'GroupStatsModule': break; default: if ($default_block_type) { $obj->block_type = $default_block_type; } } break; case 'middle': break; } // now call the page callback and see if we need to skip // displaying this module $skipped = FALSE; if ($cb) { switch ($cb($module_column, $moduleName, $obj)) { case 'skip': $skipped = TRUE; break; } } // now render for display if (!$skipped) { $start_time = microtime(TRUE); $html = $obj->render(); $render_time = microtime(TRUE) - $start_time; $array_modules[] = $html; } if ($this->debugging) { $dhtml = "← {$moduleName} ({$obj->block_type}; {$obj->mode}; " . sprintf("%.3f s", $render_time) . ")"; if ($skipped) { $dhtml .= " SKIPPED"; } $dhtml .= "<br>"; $array_modules[] = $dhtml; } } } $this->module_arrays[$module_column] = $array_modules; } $pages = Advertisement::get_pages(); // get pages where ads is to be displayed $display_ad = FALSE; foreach ($pages as $page) { if ($page_type == $page['value']) { $display_ad = TRUE; break; } } if ($display_ad) { // get all ads $all_ads = Advertisement::get(array('direction' => 'ASC', 'sort_by' => 'orientation'), array('page_id' => $page_type, 'is_active' => ACTIVE)); if (!empty($all_ads)) { foreach ($all_ads as $ad) { $pos = $ad->orientation; $pos = explode(',', $ad->orientation); $x_loc = $pos[0]; //y_loc was not originally designed so for already created ads //FIX for already created ads if (array_key_exists(1, $pos)) { $y_loc = $pos[1]; } else { $y_loc = 1; //Ads created before this logic implementation should come on top } //horizontal and vertical position should not be empty if (!empty($x_loc) && !empty($y_loc)) { $array_of_data = array('links' => $ad); $inner_html = $this->add_block_module('AdvertisementModule', $array_of_data); $this->add_module_xy($x_loc, $y_loc, $inner_html); } } } //end of if all_ads } //end of display_ad }
} if ($content->parent_collection_id != -1) { //load here content collection $cid = $content->parent_collection_id; $collection = ContentCollection::load_collection((int) $cid, PA::$login_uid); if ($collection->type == GROUP_COLLECTION_TYPE) { $is_member = Group::member_exists((int) $cid, PA::$login_uid); $is_admin = Group::is_admin((int) $cid, PA::$login_uid); $is_group_content = TRUE; $header = 'header_group.tpl'; // group header will be user in this case. //its group so lets load group details and group modules $media_gallery = 'grouppage'; $group_details = pageLoadGroup($collection); $gid = $content->parent_collection_id; $setting_group_data = ModuleSetting::load_setting(PAGE_GROUP, $uid); $setting_data['left'] = $setting_group_data['left']; $setting_data['right'] = $setting_group_data['right']; if ($collection->reg_type == REG_INVITE && !$is_member && !$is_admin) { $error_message = 9005; } } } else { $group_details = $collection = NULL; } // Code for Approving and Denying the Pending Content Moderations: Starts if (!empty($_GET["cid"]) && !empty($_GET["ccid"])) { $type = 'content'; if (Group::is_admin((int) $_GET["ccid"], (int) PA::$login_uid)) { $Group = new Group(); $Group->collection_id = $_GET["ccid"];
} } // loading images $pictures = Image::load_images($uid, 10); // loading audio $audios = Audio::load_audio($uid, 10); // loading video $videos = Video::load_video($uid, 10); if ($_SESSION['user']['id']) { $user = new User(); $user->load((int) $uid); } else { header("Location: homepage.php?error=1"); } // accessing page settings data $setting_data = ModuleSetting::load_setting(4, $uid); // user general info $user_data_general = array(); $user_generaldata = User::load_user_profile($uid, (int) $_SESSION['user']['id'], GENERAL); for ($i = 0; $i < count($user_generaldata); $i++) { $name = $user_generaldata[$i]['name']; $value = $user_generaldata[$i]['value']; $perm_name = $name . "_perm"; $perm_value = $user_generaldata[$i]['perm']; $user_data_general["{$name}"] = $value; $user_data_general["{$perm_name}"] = $perm_value; } // relations if ($_SESSION['user']['id']) { // user Relations (user relations with all informations) $relations = Relation::get_all_relations((int) $uid);
$groups = new Group(); $groups->load($_REQUEST['gid']); $group_type = $groups->group_type; } function setup_module($column, $module, $obj) { global $login_uid, $paging, $page_uid, $super_groups_available, $user_type, $group_type; switch ($module) { case 'AddGroupModule': if (!empty($_REQUEST['gid'])) { $obj->id = $_REQUEST['gid']; } break; } } $setting_data = ModuleSetting::load_setting(PAGE_ADDGROUP, PA::$login_uid); $page = new PageRenderer("setup_module", PAGE_ADDGROUP, "{$title} - " . PA::$network_info->name, 'container_three_column.tpl', $header, PRI, HOMEPAGE, PA::$network_info, NULL, $setting_data); $page->add_header_js('addgroup.js'); if (!empty($_REQUEST['msg'])) { $message = null; } else { if (!empty($_REQUEST['error_msg'])) { $message = null; } else { $message = null; } } uihelper_error_msg($message); if ($edit) { uihelper_get_group_style($_REQUEST['gid']); } else {
$params['uid'] = $_SESSION['user']['id']; auto_email_notification('some_joins_a_network', $params); } else { //$msg = "Please login first to join the network."; header("Location: {$base_url}/login.php?error=1&return=" . urlencode($_SERVER['REQUEST_URI'])); } } catch (PAException $e) { $msg .= $e->message; } } default_exception(); $parameter = '<script type="text/javascript" language="javascript" src="' . $current_theme_path . '/base_javascript.js"></script></script> <script type="text/javascript" language="javascript" src="' . $current_theme_path . '/javascript/prototype.js"></script> <script type="text/javascript" language="javascript" src="' . $current_theme_path . '/javascript/scriptaculous.js"></script>'; html_header("Networks in category", $parameter); $setting_data = ModuleSetting::load_setting(PAGE_NETWORKS_CATEGORY, $uid); $leftModulesFromDB = $setting_data['left']; $middleModulesFromDB = $setting_data['middle']; $rightModulesFromDB = $setting_data['right']; $page =& new Template(CURRENT_THEME_FSPATH . "/groups.tpl"); $page->set('current_theme_path', $current_theme_path); $page->set('base_url', $base_url); //header of group page $optional_parameters = "onload=\"{$onload}\""; html_body($optional_parameters); //header of group page $header =& new Template(CURRENT_THEME_FSPATH . "/header.tpl"); $header->set('current_theme_path', $current_theme_path); $header->set('current_theme_rel_path', $current_theme_rel_path); // find navigation link for header $navigation = new Navigation();