Esempio n. 1
0
 /**
  * Standard Module init function
  *
  * @return void
  */
 function init()
 {
     parent::init();
     if (!reason_user_has_privs($this->admin_page->user_id, 'delete')) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you don\'t have the privileges to delete items on this site.';
     } elseif (empty($this->admin_page->site_id)) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you need to specify a site before batch deleting items.';
     } elseif (empty($this->admin_page->type_id)) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you need to specify a type before batch deleting items.';
     }
     if ($this->_ok_to_run) {
         $this->_type = new entity($this->admin_page->type_id);
         $this->admin_page->title = 'Batch Delete ' . $this->_type->get_value('plural_name');
         $es = new entity_selector($this->admin_page->site_id);
         $es->add_type($this->admin_page->type_id);
         $es->set_sharing('owns');
         $es->set_order('entity.last_modified DESC');
         // pray($this->admin_page->request);
         if (isset($this->admin_page->request['state']) && $this->admin_page->request['state'] == 'pending') {
             $status = 'Pending';
         } else {
             $status = 'Live';
         }
         $this->_items = $es->run_one('', $status);
         foreach (array_keys($this->_items) as $id) {
             if (!$this->admin_page->is_deletable($id)) {
                 unset($this->_items[$id]);
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * Standard Module init function
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $this->head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/forms/form_data.css');
     $form =& $this->get_form();
     if ($form) {
         $this->admin_page->title = 'Data Manager for Form "' . $form->get_value('name') . '"';
     }
     $ta =& $this->get_thor_admin();
     // biobooks use a non-standard thor db structure ... until this is fixed we want to disable
     // row creation and editing for bio book thor forms. After this is fixed this check should
     // be zapped for a little performance boost.
     if ($ta) {
         $tc = $ta->get_thor_core();
         $allow_edit_and_new = $tc->column_exists('formkey') ? false : true;
         $ta->set_allow_delete(true);
         if ($allow_edit_and_new) {
             $ta->set_allow_edit(true);
             $ta->set_allow_new(true);
             // can we make sure its valid first?
         }
         $ta->set_allow_row_delete(true);
         $ta->set_allow_download_files(true);
         $ta->init_thor_admin();
     }
 }
Esempio n. 3
0
 public function __construct(Pakiti &$pakiti)
 {
     parent::__construct($pakiti);
     $this->_host = new Host();
     $this->_report = new Report();
     # Get the version of the client
     if (($this->_version = Utils::getHttpVar(Constants::$REPORT_VERSION)) == null) {
         //TODO Change version
         //Throw exception if null
         $this->_version = "cern_1";
     }
     # Map variables in the report to the internal variables
     $this->doReportMapping($this->_version);
     # Get the hostname and ip
     $this->_host->setHostname($this->_report_hostname);
     $this->_host->setIp($this->_report_ip);
     # Get the hostname and ip of the reporting machine (could be a NAT machine)
     $this->_host->setReporterIp(isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "0.0.0.0");
     $this->_host->setReporterHostname(gethostbyaddr($this->_host->getReporterIp()));
     Utils::log(LOG_DEBUG, "Report from [reporterHost=" . $this->_host->getReporterHostname() . ",reporterIp=" . $this->_host->getReporterIp() . "]", __FILE__, __LINE__);
     # Is the host proxy?
     if ($this->_report_proxy == Constants::$HOST_IS_PROXY) {
         $this->_report->setTroughtProxy(Constants::$HOST_IS_PROXY);
         # Check if the proxy is authorized to send the reports
         if (!$this->checkProxyAuthz($this->_host->getReporterHostname(), $this->_host->getReporterIp())) {
             throw new Exception("Proxy " . $this->_host->getReporterHostname() . " is not authorized to send the reports");
         }
         Utils::log(LOG_INFO, "Proxy logging [proxy=" . $this->_host->getReporterHostname() . "] for [host=" . $this->_host->getHostname() . "]");
         # If we are in proxy mode, the reporterHostname and reporterIp will be replaced with the real hostname and ip of the client machine.
         $this->_host->setReporterHostname($this->_host->getHostname());
         $this->_host->setReporterIp($this->_host->getIp());
     } else {
         $this->_report->setTroughtProxy(Constants::$HOST_IS_NOT_PROXY);
     }
 }
Esempio n. 4
0
 public function __construct(Pakiti &$pakiti)
 {
     parent::__construct($pakiti);
     $this->_pakiti = $pakiti;
     $this->_sources = array();
     # Load all VDS sources
     $this->loadSources();
 }
Esempio n. 5
0
 /**
  * Standard Module init function
  *
  * Sets up page variables and runs the entity selctor that grabs the users
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     $this->site = new entity($this->admin_page->site_id);
     $this->admin_page->title = 'Users with administrative access to ' . $this->site->get_value('name');
     $es = new entity_selector();
     $es->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_to_user'));
     $this->users = $es->run_one(id_of('user'));
 }
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Re-Download File from Zencoder';
     $this->media_work = new entity($this->admin_page->id);
     if ($this->media_work->get_value('integration_library') == 'zencoder') {
         $this->user = new entity($this->admin_page->user_id);
     }
 }
Esempio n. 7
0
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Site Pages';
     $this->admin_page->set_breadcrumbs(array('' => 'Site Pages'));
     $this->head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/forms/form_data.css');
     $this->_get_site_page_data();
     // lets do the work in admin
 }
Esempio n. 8
0
 public function __construct(&$pakiti)
 {
     parent::__construct($pakiti);
     $this->_time = microtime(true);
     $this->_htmlAttributes = array();
     $this->_httpGetVars = array();
     $this->_acl = new Acl();
     $this->_errors = array();
     $this->_messages = array();
 }
Esempio n. 9
0
 /**
  * Initialize the module
  *
  * Set up the page title, add appropriate css, and set up the form
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Custom Image Size';
     $this->head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/reason_admin/image_sizer.css');
     if ($this->_ok_to_run_module() && ($image = $this->_get_image())) {
         $this->admin_page->title .= ': ' . $image->get_value('name');
         $this->_set_up_form($image);
     }
 }
Esempio n. 10
0
 /**
  * Standard Module init function
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     if (!empty($this->admin_page->id)) {
         $this->group = new entity($this->admin_page->id);
     }
     if (empty($this->group) || $this->group->get_value('type') != id_of('group_type')) {
         trigger_error('Group Tester Module run on a non-group entity', EMERGENCY);
         die;
     }
     $this->admin_page->title = 'Group tester for ' . $this->group->get_value('name');
 }
Esempio n. 11
0
 /**
  * Standard Module init function
  *
  * Sets up page variables
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     $this->site = new entity($this->admin_page->site_id);
     if (ALLOW_REASON_SITES_TO_SWITCH_THEMES && $this->site->get_value('allow_site_to_change_theme') == 'true' && reason_user_has_privs($this->admin_page->user_id, 'switch_theme')) {
         $this->self_change = true;
         $this->admin_page->title = 'Select a Site Theme';
     } else {
         $this->self_change = false;
         $this->admin_page->title = 'Site Theme';
     }
 }
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Download Links for Media Work';
     $this->media_work = new entity($this->admin_page->id);
     if ($this->media_work->get_value('integration_library') == 'kaltura') {
         $this->kaltura_shim = new KalturaShim();
         $this->user = new entity($this->admin_page->user_id);
         // Grab the associated media files
         $es = new entity_selector();
         $es->add_type(id_of('av_file'));
         $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_to_av_file'));
         $this->media_files = $es->run_one();
     }
 }
 function init()
 {
     parent::init();
     $this->head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/forms/form_data.css');
     $this->admin_page->title = 'Allowable Relationship Manager';
     if ($this->authenticate()) {
         $disco_admin = new DiscoAllowableRelationshipManager();
         $this->table_admin = new TableAdmin();
         $this->table_admin->set_allow_row_delete(true);
         $this->table_admin->set_allow_edit(true);
         $this->table_admin->set_allow_view(false);
         $this->table_admin->set_allow_new(true);
         $this->table_admin->set_admin_form($disco_admin);
         $this->table_admin->init(REASON_DB, 'allowable_relationship');
     }
 }
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Select Thumbnail for Media Work';
     $this->media_work = new entity($this->admin_page->id);
     $this->user = new entity($this->admin_page->user_id);
     // Grab the initial associated image, if it exists
     $es = new entity_selector();
     $es->add_type(id_of('image'));
     $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_to_primary_image'));
     $this->cur_image = current($es->run_one());
     $this->admin_page->head_items->add_javascript(JQUERY_URL, true);
     $this->admin_page->head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'media_image_picker_zencoder.js');
     // fd-slider is a polyfill for the range plasmature type
     $this->admin_page->head_items->add_javascript(REASON_PACKAGE_HTTP_BASE_PATH . 'fd-slider/js/fd-slider.js');
     $this->admin_page->head_items->add_stylesheet(REASON_PACKAGE_HTTP_BASE_PATH . 'fd-slider/css/fd-slider.css');
     $this->shim = MediaWorkFactory::shim($this->media_work);
 }
Esempio n. 15
0
 /**
  * Standard Module init function
  *
  * Sets up the entity selectors and grabs the site lists
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     $this->site = new entity($this->admin_page->site_id);
     $this->admin_page->title = 'Site Listing';
     $lm = new entity_selector();
     $lm->add_type(id_of('site'));
     $lm->set_order('entity.name');
     $lm->add_relation('site.site_state = "Live"');
     $this->ls_count = $lm->get_one_count();
     $this->live_sites_list = $lm->run_one();
     if (reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         $nm = new entity_selector();
         $nm->add_type(id_of('site'));
         $nm->set_order('entity.name');
         $nm->add_relation('site.site_state != "Live"');
         $this->nls_count = $nm->get_one_count();
         $this->not_live_site_list = $nm->run_one();
     }
 }
Esempio n. 16
0
 /**
  * Standard Module init function
  *
  * @return void
  */
 function init()
 {
     parent::init();
     if (!empty($this->admin_page->id)) {
         $this->issue = new entity($this->admin_page->id);
     }
     if (empty($this->issue) || $this->issue->get_value('type') != id_of('issue_type')) {
         trigger_error('Sort Posts module run on a non-issue entity', EMERGENCY);
         die;
     }
     $this->admin_page->title = 'Sort Posts on issue "' . $this->issue->get_value('name') . '"';
     $es = new entity_selector($this->admin_page->site_id);
     $es->add_type(id_of('news'));
     $es->set_sharing('owns');
     $es->add_left_relationship($this->issue->id(), relationship_id_of('news_to_issue'));
     $es->set_order('dated.datetime DESC');
     $this->posts = $es->run_one();
     $user = new entity($this->admin_page->user_id);
     foreach ($this->posts as $id => $post) {
         if (!$post->user_can_edit_field('datetime', $user)) {
             $this->locked_posts[$id] = $post;
         }
     }
 }
 /**
  * Verify that we are running on a site.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Delete Registration Slot Data';
 }
Esempio n. 18
0
 function run()
 {
     echo '<div id="siteIntro">' . "\n";
     $e = new entity($this->admin_page->site_id);
     echo '<div id="siteNotices">' . "\n";
     if ($e->get_value('site_state') == "Not Live" && $e->get_value('unique_name') != 'master_admin') {
         echo '<div class="notLiveNotice"><h4>This site is not live.</h4><p>Among other things, that means that it\'s excluded from search engines (so people won\'t stumble upon a site that isn\'t ready for public consumption).</p>' . "\n";
         if (user_can_edit_site($this->admin_page->user_id, id_of('master_admin'))) {
             echo '<p><a href="' . $this->admin_page->make_link(array('site_id' => id_of('master_admin'), 'type_id' => id_of('site'), 'id' => $e->id(), 'cur_module' => 'Editor')) . '">Edit this site</a></p>' . "\n";
         } else {
             echo '<p>Please contact ' . REASON_CONTACT_INFO_FOR_CHANGING_USER_PERMISSIONS . ' when you are ready to make this site live.</p>' . "\n";
         }
         echo '</div>' . "\n";
     }
     if ($e->get_value('description')) {
         echo '<div id="siteDesc">' . "\n";
         if (strip_tags($e->get_value('description')) == $e->get_value('description')) {
             echo nl2br($e->get_value('description'));
         } else {
             echo $e->get_value('description');
         }
         echo '</div>' . "\n";
     }
     $sites = $this->admin_page->get_sites();
     if (count($sites) == 1) {
         parent::run();
     }
     echo '</div>' . "\n";
     echo '<div id="guide">' . "\n";
     $es = new entity_selector();
     $es->add_type(id_of('type'));
     $es->add_right_relationship($e->id(), relationship_id_of('site_to_type'));
     $es->limit_tables();
     $es->limit_fields();
     $non_editable_es = carl_clone($es);
     $non_editable_es->add_right_relationship($e->id(), relationship_id_of('site_cannot_edit_type'));
     $noneditable_types = $non_editable_es->run_one();
     if (!empty($noneditable_types)) {
         $es->add_relation('entity.id NOT IN (' . implode(',', array_keys($noneditable_types)) . ')');
     }
     $es->set_order('entity.name ASC');
     $types = $es->run_one();
     if (array_key_exists(id_of('minisite_page'), $types)) {
         $page_type_array[id_of('minisite_page')] = $types[id_of('minisite_page')];
         unset($types[id_of('minisite_page')]);
         $types = array_merge($page_type_array, $types);
     }
     echo '<ul>' . "\n";
     foreach ($types as $type) {
         $es = new entity_selector($e->id());
         $es->set_sharing('owns');
         $es->add_type($type->id());
         $es->limit_tables();
         $es->limit_fields();
         $es->set_order('entity.last_modified DESC');
         if (reason_user_has_privs($this->admin_page->user_id, 'edit')) {
             $state = 'Live';
             $state_link_val = 'live';
         } else {
             $state = 'Pending';
             $state_link_val = 'pending';
         }
         $ents = $es->run_one($type->id(), $state);
         $ents_count = count($ents);
         $name = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
         echo '<li class="' . $type->get_value('unique_name') . '" style="list-style-image:url(' . reason_get_type_icon_url($type) . ')">';
         echo '<h4><a href="' . $this->admin_page->make_link(array('type_id' => $type->id(), 'cur_module' => 'Lister', 'state' => $state_link_val)) . '">' . $name . '</a> <span class="count">(' . $ents_count . ')</span></h4>' . "\n";
         if (!empty($ents)) {
             echo '<div class="recent">' . "\n";
             echo 'Recently edited:' . "\n";
             echo '<ul>' . "\n";
             $i = 1;
             foreach ($ents as $ent_id => $ent) {
                 if ($i > 3) {
                     break;
                 }
                 $name = strip_tags($ent->get_display_name());
                 if (empty($name)) {
                     $name = '[unnamed]';
                 }
                 echo '<li class="item' . $i . '"><a href="' . $this->admin_page->make_link(array('type_id' => $type->id(), 'id' => $ent_id, 'cur_module' => 'Editor')) . '">' . $name . '</a></li>' . "\n";
                 $i++;
             }
             echo '</ul>' . "\n";
             echo '</div>' . "\n";
         }
         echo '</li>' . "\n";
     }
     echo '</ul>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
 }
Esempio n. 19
0
 /**
  * Standard Module init function
  *
  * Sets up page variables and runs the entity selctor that grabs the site's page url_fragments
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     $this->site = new entity($this->admin_page->site_id);
     $this->admin_page->title = 'About Analytics';
     $this->head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/google_api/analytics/analytics.css');
 }
 /**
  * Standard Module init function
  *
  * Sets up the entity selectors and grabs the site lists
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     $this->site = new entity($this->admin_page->site_id);
     $this->admin_page->title = 'Unused Theme Listing';
 }