function init($args = array()) { $this->get_head_items()->add_javascript(REASON_HTTP_BASE_PATH . 'modules/kaltura_import/kaltura_import.js'); $this->get_head_items()->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/kaltura_import/kaltura_import.css'); force_secure_if_available(); parent::init($args); }
function init($args = array()) { parent::init($args); // force secure form due to a bug that causes images not to work in unsecure environment if (!on_secure_page()) { reason_include_once('function_libraries/user_functions.php'); force_secure_if_available(); } }
function init($args = array()) { force_secure_if_available(); $this->init_head_items(); $this->init_custom_form(); $this->init_admin_form(); $method = $this->is_admin_view() ? 'init_admin_view' : 'init_form_view'; $this->{$method}(); }
function init($args = array()) { if ($this->params['integration_library'] && in_array($this->params['integration_library'], $GLOBALS['UPLOADABLE_MEDIA_WORK_INTEGRATION_LIBRARIES'])) { $this->_integration_library = $this->params['integration_library']; $this->get_head_items()->add_javascript(REASON_HTTP_BASE_PATH . 'modules/media_import/media_import.js'); $this->get_head_items()->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/media_import/media_import.css'); $this->shim = MediaWorkFactory::shim($this->_integration_library); } force_secure_if_available(); parent::init($args); }
} if ($this->mode == 'run') { $r_id = create_allowable_relationship(id_of('asset'), id_of('category_type'), 'asset_to_category', $this->asset_to_category_details); if ($r_id) { echo '<p>asset_to_category allowable relationship successfully created</p>' . "\n"; } else { echo '<p>Unable to create asset_to_category allowable relationship</p>'; echo '<p>You might try creating the relationship asset_to_category yourself in the reason administrative interface - it should include the following characteristics:</p>'; pray($this->asset_to_category_details); } } else { echo '<p>Would have created asset_to_category allowable relationship.</p>' . "\n"; } } } force_secure_if_available(); $user_netID = reason_require_authentication(); $reason_user_id = get_user_id($user_netID); if (empty($reason_user_id)) { die('valid Reason user required'); } if (!reason_user_has_privs($reason_user_id, 'upgrade')) { die('You must have Reason upgrade privileges to run this script'); } ?> <h2>Reason: update assets for 4.0b6</h2> <p>What will this update do?</p> <ul> <li>Change the page to asset relationship to bi-directional if it is not already.</li> <li>Create an asset to category relationship if it does not exist.</li> </ul>
/** * Require authentication via http basic auth * * Note 1: If the user already has a session-based login, or the script is otherwise behind an * apache-rule-based http auth, this function will return the username without forcing a second * login. * * Note 2: This function currently only works properly when php is running as an Apache module. If * Apache is running under CGI/Fast CGI, it currently simply denies access. * * @todo Add CGI/FastCGI support * * @param string $realm * @param string $cancel_message * @return string username * */ function reason_require_http_authentication($realm = FULL_ORGANIZATION_NAME, $cancel_message = '') { if($username = reason_check_authentication()) return $username; force_secure_if_available(); if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) { require_once(CARL_UTIL_INC.'dir_service/directory.php'); $dir = new directory_service(); if($dir->authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) return $_SERVER['PHP_AUTH_USER']; } $cgi_mode = (substr(php_sapi_name(), 0, 3) == 'cgi'); if(!$cgi_mode) { header('WWW-Authenticate: Basic realm="'.str_replace('"',"'",$realm).'"'); } http_response_code(401); if(empty($cancel_message)) { $msg_str = 'This resource requires login.'; $cancel_message = '<!doctype HTML><html><title>'.$msg_str.'</title></head><body><h3>'.$msg_str.'</h3>'; if($cgi_mode && function_exists('is_developer') && is_developer()) $cancel_message .= '<p>HTTP authentication is not currently supported when PHP is running under CGI/Fast CGI.</p>'; $cancel_message .= '</body></html>'; } echo $cancel_message; exit; }
/** * Set up the template * * @var integer $site_id * @var integer $page_id * @todo page_id should not have a default value -- this makes it seem like you could initialize * the template without providing a page_id, but that would result in a 404. */ function initialize( $site_id, $page_id = '' ) // {{{ { $this->sess =& get_reason_session(); if( $this->sess->exists() ) { // if a session exists and the server supports https, pop over to the secure // site so we have access to the secure session information force_secure_if_available(); if(!$this->sess->has_started()) $this->sess->start(); } $this->site_id = $site_id; $this->page_id = $page_id; $this->site_info = new entity( $site_id ); $this->page_info = new entity( $page_id ); $this->head_items = new HeadItems(); // make sure that the page exists or that the page's state is Live // if not, redirect to the 404 if( !$this->page_info->get_values() OR $this->page_info->get_value( 'state' ) != 'Live' ) { //trigger_error( 'page does not exist', WARNING ); $this->display_404_page(); die(); } if ($this->use_navigation_cache) { $cache = new ReasonObjectCache($this->site_id . '_navigation_cache', 3600); // lifetime of 1 hour $page_object_cache =& $cache->fetch(); if ($page_object_cache && is_array($page_object_cache) && isset($page_object_cache[$this->nav_class])) { $this->pages = $page_object_cache[$this->nav_class]; } elseif ($page_object_cache && is_object($page_object_cache)) // old format { // lets use our cache and also update it $this->pages = $page_object_cache; $new_page_object_cache[$this->nav_class] = $this->pages; $cache->set($new_page_object_cache); // replace with our array keyed cache } } // lets check the persistent cache if (empty($this->pages) || !isset($this->pages->values[$this->page_info->id()])) { // lets setup $this->pages and place in the persistent cache $this->pages = new $this->nav_class; // small kludge - just give the tree view access to the site info. used in the show_item function to show the root node of the navigation $this->pages->site_info =& $this->site_info; $this->pages->order_by = 'sortable.sort_order'; $this->pages->init( $this->site_id, id_of('minisite_page') ); if ($this->use_navigation_cache) { $page_object_cache[$this->nav_class] = $this->pages; $cache->set($page_object_cache); } } else // if pages came from cache refresh the request variables and set site_info and order_by { $this->pages->grab_request(); $this->pages->site_info =& $this->site_info; $this->pages->order_by = 'sortable.sort_order'; // in case it was changed in the request } $this->_handle_access_auth_check(); $this->textonly = ''; if( $this->pages->values ) { if( !$this->page_id ) $this->page_id = $this->pages->root_node(); $this->pages->cur_page_id = $this->page_id; $this->pages->force_open( $this->page_id ); $this->cur_page = new entity($this->page_id); $this->title = $this->cur_page->get_value('name'); $this->get_css_files(); $this->get_meta_information(); if( $this->sess->exists() ) { if (USE_JS_LOGOUT_TIMER) { $this->head_items->add_stylesheet(REASON_HTTP_BASE_PATH.'css/timer.css'); $this->head_items->add_javascript(JQUERY_URL, true); $this->head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'timer/timer.js'); } // we know that someone is logged in if the session exists $this->logged_in = true; } // hook for any actions to take prior to loading modules $this->pre_load_modules(); // load the modules $this->load_modules(); } else { trigger_error('Page requested not able to be displayed... no pages on site'); $this->_display_403_page(); die(); } } // }}}
/** * The old form module always would force a secure connection if available. We will maintain this as the default, * but allow the force_secure parameters to also be set to false, thus disabling force_secure. * * @access private */ function _check_force_secure_parameter() { if ($this->params['force_secure']) { force_secure_if_available(); } }
/** * Returns the current user's netID from the session, or false if the user is not logged in. * @return string user_netID * @access private */ function get_authentication_from_session() { $this->session =& get_reason_session(); if ($this->session->exists()) { force_secure_if_available(); if (!$this->session->has_started()) { $this->session->start(); } $this->user_netID = $this->session->get('username'); return $this->user_netID; } else { return false; } }