/** * 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; }
<?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();
} } // 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);
$msg = "ajax/modulesettings.php: No IDs for uid({$uid}) or page_id({$page_id}) passed"; Logger::log($msg); print "ERROR: " . $msg; exit; } $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); $data = stripslashes($_GET['data']); $new_settings_data = $json->decode($data); // remove the possibly auto added ActionsModule $new_settings_data['left'] = delete_module_from_array('ActionsModule', $new_settings_data['left']); $new_settings_data['right'] = delete_module_from_array('ActionsModule', $new_settings_data['right']); Logger::log("ajax/modulesettings.php: writing settings for uid({$uid}) or page_id({$page_id}) "); Logger::log("settings DATA IS:: " . print_r($new_settings_data, true)); // Logger::log("RAW JSON DATA IS:: ".$data ); // save settings for THIS page ModuleSetting::save_setting($uid, $page_id, $new_settings_data); /* if ($page_id == 1) { // if this is the USER page // we also want to save thiose settings // for her PUBLIC page //Code to remove modules from user public page $new_settings_data_public = $new_settings_data; $public_page_blacklist_modules = array('EnableModule', 'UserMessagesModule'); $new_settings_data_public['left'] = delete_module_from_array( $public_page_blacklist_modules, $new_settings_data_public['left'] );
/** !! * Sets up the html for the entire page. It starts by creating an array of all * modules that are present on the page and updates the array with the data for * the modules including name, type and placement. It then reviews settings for * the page based on page name and id. It then checks for administrator * permission. Finally it gets server data and calls { @link set_inner_template() } * and { @link generate_inner_html() } to create the page. * @param string $request_method if this is GET, get server information and * initialize the page * @param array $request_data contains information on what to display on the page */ function initializeModule($request_method, $request_data) { global $error_msg, $settings_new; $this->id = !empty($request_data['id']) ? $request_data['id'] : 0; $this->module = !empty($request_data['module']) ? $request_data['module'] : null; $mod_info = new ModulesInfo(array(PA::$core_dir . DIRECTORY_SEPARATOR . PA::$blockmodule_path, PA::$project_dir . DIRECTORY_SEPARATOR . PA::$blockmodule_path)); $condition = ModulesInfo::USER_MODULES_FILTER . " || " . ModulesInfo::GROUP_MODULES_FILTER . " || " . ModulesInfo::NETWORK_MODULES_FILTER; $modules = $mod_info->getModulesByCondition($condition); $module_info = null; $mod_selected = null; $mod_select_options = array(); $mod_select_options[" "] = " "; foreach ($modules as $module) { $mod_select_options[$module['name']] = $module['name']; if (@$request_data['module'] == $module['name']) { $mod_selected = $module['name']; $module_info['name'] = $module['name']; $module_info['module_type'] = $module['module_type']; $module_info['module_placement'] = $module['module_placement']; $module_info['status_points'] = 0; if (!empty($module['architecture_info']['has_init_module'])) { $module_info['status_points'] += 33; } if (!empty($module['architecture_info']['has_action_handler'])) { $module_info['status_points'] += 33; } if (!empty($module['architecture_info']['has_set_inner_tpl'])) { $module_info['status_points'] += 33; } } } asort($mod_select_options); $mod_tag_attrs = array('name' => "form_data[module]", 'onchange' => "javascript: document.location='" . PA_ROUTE_CREATE_DYN_PAGE . "?action=edit&id={$this->id}&module='+this.value"); $mod_select_tag = xHtml::selectTag($mod_select_options, $mod_tag_attrs, $mod_selected); $pages_default_setting = ModuleSetting::get_pages_default_setting('network'); $selected = null; $current_selecion = null; $select_options = array(); $select_options[" "] = "0"; foreach ($pages_default_setting as $page_details) { $select_options[$page_details->page_name] = $page_details->page_id; if (@$request_data['id'] == $page_details->page_id) { $selected = $page_details->page_id; $current_selection = $page_details; $restore_settings = $page_details->getPageSettings(); } } $tag_attrs = array('name' => "form_data[page_id]", 'onchange' => "javascript: document.location='" . PA_ROUTE_CREATE_DYN_PAGE . "?action=edit&module={$this->module}&id='+this.value"); $select_tag = xHtml::selectTag($select_options, $tag_attrs, $selected); $this->outer_template = 'outer_public_center_module.tpl'; // $this->shared_data['OVO_JE_DODANO'] = "Ovo je dodano unutar modula!"; $task_obj = Tasks::get_instance(); $tasks = $task_obj->get_tasks(); $permiss = array(); $permiss[] = 'configure_system'; // NOTE: system administrator permissions!! foreach ($tasks as $task) { $permiss[] = $task->task_value; } $this->adm_permissions = implode(', ', $permiss); if ($request_method == 'GET') { if (!empty($request_data['action']) && !empty($request_data['id']) && $request_data['action'] == 'edit') { $this->page = new DynamicPage((int) $request_data['id'], $settings_new); if (!empty($request_data['add'])) { $this->page->addModule($request_data['add'], $this->module); } $this->page->initialize(); } } $this->set_inner_template('center_inner_public.tpl'); // initial template $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'page' => $this->page, 'select_tag' => $select_tag, 'type' => 'theme', 'base_url' => PA_ROUTE_CREATE_DYN_PAGE, 'mod_select_tag' => $mod_select_tag, 'module_info' => $module_info, 'adm_permissions' => $this->adm_permissions)); }
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'); } }
$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 ($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':
$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();
* @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';
/** !! * Save the selected modules as the future defaults * @param array $request_data form containing the modules settings */ private function handlePOST_saveModuleSettings($request_data) { $page_templates = $this->page_templates; $form_data = $request_data['form_data']; $page_template = $page_templates[$form_data['page_template']]; $left = null; $middle = null; $right = null; $new_settings = array(); foreach (array('left', 'middle', 'right') as $column) { if (isset($form_data[$column])) { foreach ($form_data[$column] as $module_data) { if (!empty($module_data['name'])) { if ($module_data['column'] == 'left') { $left[] = $module_data; } elseif ($module_data['column'] == 'middle') { $middle[] = $module_data; } elseif ($module_data['column'] == 'right') { $right[] = $module_data; } else { } } } } } if ($left) { usort($left, "sortByPosition"); foreach ($left as $key => $lmodule) { if (isset($lmodule['name'])) { $left[$key] = $lmodule['name']; } } } if ($middle) { usort($middle, "sortByPosition"); foreach ($middle as $key => $mmodule) { if (isset($mmodule['name'])) { $middle[$key] = $mmodule['name']; } } } if ($right) { usort($right, "sortByPosition"); foreach ($right as $key => $rmodule) { if (isset($rmodule['name'])) { $right[$key] = $rmodule['name']; } } } $new_settings['left'] = $left; $new_settings['middle'] = $middle; $new_settings['right'] = $right; $new_settings['page_template'] = $page_template; try { ModuleSetting::save_setting($this->assoc_id, $this->pid, $new_settings, $this->settings_type); } catch (Exception $e) { throw $e; } unset($request_data['form_data']); unset($request_data['page_template']); $this->setupCustomizeModuleSettings($request_data); }
} // 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;
global $query_count_on_page, $config_site_name, $login_uid; $query_count_on_page = 0; $group_var = new Group(); $group_var->collection_id = $_GET['gid']; $group_info = $group_var->get_group_theme_detail(); $extra = NULL; if (@$group_info['extra']) { $extra = unserialize($group_info['extra']); } if (empty($extra['module_setting'])) { // global $settings_new; // $setting_data = $settings_new[PAGE_GROUP]['data']; // above code commmened out my Martin: // the above code does not respect changes the network admin might have made in the // ModuleSelector $setting_data = ModuleSetting::load_default_setting(PAGE_GROUP); } else { $setting_data = $extra['module_setting']; } $request_info = load_info(); $parent_id = $request_info['parent_id']; $parent_name_hidden = $request_info['parent_name_hidden']; $parent_type = $request_info['parent_type']; $header_title = $request_info['header_title']; $group_invitation_id = !empty($_REQUEST['GInvID']) ? $_REQUEST['GInvID'] : null; ////////////////////////////////// ///get details of group $is_member = FALSE; $is_admin = FALSE; $content_access = TRUE; $is_invite = FALSE;
function get_links() { $links = array(); $setting_data = ModuleSetting::load_default_setting(PAGE_USER_PRIVATE); return $setting_data; }
$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']; }
} 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"];
} } $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; }
$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 {
} if (!$uid || !$page_id) { $msg = "ajax/modulesettings.php: No IDs for uid({$uid}) or page_id({$page_id}) passed"; Logger::log($msg); print "ERROR: " . $msg; exit; } $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); $data = stripslashes($_GET['data']); $new_settings_data = $json->decode($data); Logger::log("ajax/modulesettings.php: writing settings for uid({$uid}) or page_id({$page_id}) "); Logger::log("settings DATA IS:: " . print_r($new_settings_data, true)); // Logger::log("RAW JSON DATA IS:: ".$data ); // save settings for THIS page ModuleSetting::save_setting($uid, $page_id, $new_settings_data); if ($page_id == 1) { // if this is the USER page // we also want to save thiose settings // for her PUBLIC page /*Code to remove modules from user public page */ $new_settings_data_public = $new_settings_data; $public_page_blacklist_modules = array('EnableModule', 'UserMessagesModule'); $new_settings_data_public['left'] = delete_module_from_array($public_page_blacklist_modules, $new_settings_data_public['left']); $new_settings_data_public['right'] = delete_module_from_array($public_page_blacklist_modules, $new_settings_data_public['right']); // save setting for the PUBLIC page also Logger::log("public settings DATA IS:: " . print_r($new_settings_data_public, true)); ModuleSetting::save_setting($uid, PAGE_USER_PUBLIC, $new_settings_data_public); } // output something to the browser print_r($new_settings_data); exit;