* For questions, help, comments, discussion, etc. please visit
 * https://github.com/CyberspaceNetworks/CoreSystem
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */
require_once "api/CNPermissions/CNPermissionsHandler.php";
require_once "web/includes/classes/CNTinyMCE.php";
$tiny = new CNTinyMCE('blog');
echo $tiny->installTinyMCE();
/*
 require_once "web/includes/tinymce.php";
 install_tinymce('full');
*/
if (!empty($_REQUEST['ccid'])) {
    $permission_to_upload = PermissionsHandler::can_group_user(PA::$login_uid, $_REQUEST['ccid'], array('permissions' => 'upload_images, upload_videos'));
} else {
    $permission_to_upload = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => 'upload_images, upload_videos'));
}
?>
<fieldset>
    <input id="blog_type" name="blog_type" type="hidden" value="<?php 
echo $blog_type == 'Suggestion' ? 'Suggestion' : 'CNBlogPost';
?>
" />
    <input id="redirect" name="redirect" type="hidden" value="<?php 
echo urldecode(stripslashes($redirect));
?>
" />
    <div class="field" >
        <label for="title"><span class="required"> * </span><b> <?php 
echo __("Title");
?>
 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');
     }
 }
 * Author:      tekritisoftware
 * 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
 *
*/
$login_required = TRUE;
//including necessary files
$use_theme = 'Beta';
//TODO : Remove this when new UI is completely implemented.
include_once "web/includes/page.php";
require_once "web/includes/network.inc.php";
require_once "api/Roles/Roles.php";
require_once "api/Permissions/PermissionsHandler.class.php";
$res = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => 'post_to_community, edit_content'), true);
echo "Manage settings: {$res}";
$msg = '';
if (@$_GET['msg']) {
    $msg = $_GET['msg'];
}
//echo '<pre>';print_r($_POST);exit;
if (@$_POST['save']) {
    $count_role = (int) $_POST['totalcount'];
    for ($i = 1; $i <= $count_role; $i++) {
        $role_id = $_POST['link_id' . $i];
        $role = new Roles();
        $task_count = (int) $_POST['taskcount'];
        for ($j = 1; $j <= $task_count; $j++) {
            $task_id = $_POST['taskid' . $j];
            $chk = $role_id . '~' . $task_id;