/**
  * Grab request variables - merge custom page types and modules into the instance arrays.
  */
 function init()
 {
     $this->request = carl_clean_vars(carl_get_request(), $this->cleanup_rules);
     if (!empty($this->custom_recommended_page_type_mapping)) {
         $this->recommended_page_type_mapping = array_merge($this->recommended_page_type_mapping, $this->custom_recommended_page_type_mapping);
     }
     if (!empty($this->custom_news_modules)) {
         $this->news_modules = array_merge($this->news_modules, $this->custom_news_modules);
     }
     if (!empty($this->custom_publication_modules)) {
         $this->publication_modules = array_merge($this->publication_modules, $this->custom_publication_modules);
     }
     if (!empty($this->custom_page_type_comments)) {
         $this->page_type_comments = array_merge($this->page_type_comments, $this->custom_page_type_comments);
     }
 }
 function init()
 {
     $this->request = carl_get_request();
     // If obtained via post we need to manually decode the URL - all current uses of this pass it via get.
     if (isset($_POST['requested_url'])) {
         $this->request['requested_url'] = urldecode($this->request['requested_url']);
     }
     $this->admin_page->title = 'Access Denied';
     if ($requested_site_id = $this->get_requested_site_id()) {
         // lets double check whether the user has access
         if (user_can_edit_site($this->admin_page->user_id, $requested_site_id)) {
             header('Location: ' . $this->get_destination_url_with_user_id($this->admin_page->user_id));
             exit;
         } else {
             $this->can_pose_as_other_user = reason_user_has_privs($this->admin_page->user_id, 'pose_as_other_user');
             $this->has_master_admin_edit_access = user_can_edit_site($this->admin_page->user_id, id_of('master_admin'));
         }
     } else {
         $redirect = carl_make_redirect(array('cur_module' => '', 'requested_url' => '', 'site_id' => ''));
         header('Location: ' . $redirect);
         exit;
     }
 }
Example #3
0
 function load_params()
 {
     $param_cleanup_rules = array('site_id' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'type_id' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'user_id' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'id' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'rel_id' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'cur_module' => array('function' => 'check_against_regexp', 'extra_args' => array('safechars')), 'viewer_id' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'entity_a' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'entity_b' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')), 'new_entity' => array('function' => 'check_against_array', 'extra_args' => array(0, 1)), 'debugging' => array('function' => 'check_against_array', 'extra_args' => array('true', 'false')), 'state' => array('function' => 'check_against_array', 'extra_args' => array('deleted', 'pending', 'live')));
     $params_to_localize = array('site_id', 'user_id', 'type_id', 'id', 'rel_id', 'cur_module', 'viewer_id', 'entity_a', 'entity_b', 'debugging');
     $request = carl_get_request();
     $this->request = array_merge($request, carl_clean_vars($request, $param_cleanup_rules));
     foreach ($params_to_localize as $v) {
         if (isset($this->request[$v])) {
             $this->{$v} = $this->request[$v];
         }
     }
     // verify that id corresponds to an entity
     if ($this->id > 0) {
         $e = new entity($this->id);
         $values = $e->get_values();
         if (empty($values)) {
             trigger_error('Malformed request from ' . $_SERVER['HTTP_REFERER'] . ' (ID given does not correspond to an entity)');
             $this->id = '';
         }
     }
     if (isset($this->request['PHPSESSID'])) {
         unset($this->request['PHPSESSID']);
     }
     $old_id = !empty($this->request[CM_VAR_PREFIX . 'id']) ? $this->request[CM_VAR_PREFIX . 'id'] : false;
     $id = !empty($this->request['id']) ? $this->request['id'] : false;
     if ($old_id && $id && $id == $old_id) {
         $new_link = carl_construct_redirect($this->get_default_args());
         header('Location: ' . $new_link);
         echo '<p>Attempted to redirect to <a href=' . htmlspecialchars($new_link, ENT_QUOTES) . '>here</a>, but seem to have failed.</p>';
         die;
     }
     $this->select_user();
 }
Example #4
0
}
$pages = array();
$modules_by_page_type = array();
$es = new entity_selector();
$es->add_type(id_of('minisite_page'));
$es->limit_tables(array('page_node', 'url'));
$es->limit_fields('entity.name, page_node.custom_page, page_node.url_fragment, url.url');
$es->add_right_relationship_field('owns', 'entity', 'id', 'owner_id');
$es->add_right_relationship_field('owns', 'entity', 'name', 'site_name');
$es->add_left_relationship_field('minisite_page_parent', 'entity', 'id', 'parent_id');
// we add some relations so that we grab only valid pages with names that are not custom url pages
$es->add_relation('(entity.name != "") AND ((url.url = "") OR (url.url IS NULL))');
$result = $es->run_one();
$builder = new reasonPageURL();
$builder->provide_page_entities($result);
$request = carl_get_request();
$detail_mode = isset($request['detail']) ? $request['detail'] == 'true' : false;
$module_limiter = isset($request['limit']) ? conditional_stripslashes(turn_into_string($request['limit'])) : '';
$detail_limiter = isset($request['detail_limit']) ? conditional_stripslashes(turn_into_string($request['detail_limit'])) : '';
$core_local_limiter = isset($request['core_local_limit']) ? check_against_array($request['core_local_limit'], array('core', 'local')) : '';
$num = isset($request['num']) ? turn_into_int($request['num']) : 'All';
if (isset($request['reset'])) {
    header("Location: " . carl_make_redirect(array('limit' => '', 'core_local_limit' => '')));
    exit;
}
// Make an array with first dimension of page type name, second dimension of every page
// ID using the pt, third dimension 'true' for every page type returned by the query.
foreach ($result as $k => $mypage) {
    $page_type_value = $mypage->get_value('custom_page');
    if (empty($page_type_value)) {
        $page_type_value = 'default';