Ejemplo n.º 1
0
 function make_editor_form()
 {
     $form = new disco();
     $editor_name = html_editor_name($this->site_id);
     $params = html_editor_params($this->site_id);
     if (strpos($editor_name, 'loki') === 0) {
         unset($params['paths']['site_feed']);
         unset($params['paths']['finder_feed']);
         unset($params['paths']['default_site_regexp']);
         unset($params['paths']['default_type_regexp']);
         $params['widgets'] .= ' +source +debug';
     }
     $form->add_element('demo', $editor_name, $params);
     $form->set_display_name('demo', ' ');
     $form->set_actions(array('Submit'));
     $form->run();
     if ($form->get_value('demo')) {
         echo '<h3>Output</h3>' . "\n";
         echo '<p>(For security reasons, this may differ from the Raw and Tidied markup -- it has been run through <a href="http://htmlpurifier.org/">HTML Purifier</a>)</p>';
         echo '<div class="echoBack">' . "\n";
         echo carl_get_safer_html($form->get_value('demo'));
         echo '</div>' . "\n";
         echo '<h3>Tidied Markup</h3>' . "\n";
         echo '<p>This is what you submitted after being run through <a href="http://tidy.sourceforge.net/">Tidy</a></p>';
         echo '<div class="echoBack">' . "\n";
         echo nl2br(htmlspecialchars($form->get_value('demo')));
         echo '</div>' . "\n";
         echo '<h3>Raw Markup</h3>' . "\n";
         echo '<p>This is exactly what you submitted</p>';
         echo '<div class="echoBack">' . "\n";
         echo nl2br(htmlspecialchars(conditional_stripslashes($_POST['demo'])));
         echo '</div>' . "\n";
     }
 }
Ejemplo n.º 2
0
 function run()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo 'Sorry; you do not have the rights to view this information.';
         return;
     }
     // get audiences in REason
     $es = new entity_selector();
     $es->add_type(id_of('audience_type'));
     $audiences = $es->run_one();
     $options = array();
     foreach ($audiences as $aud) {
         $options[$aud->get_value('directory_service_value')] = $aud->get_value('name');
     }
     $d = new disco();
     $d->add_element('active_since', 'textdatetime');
     $d->add_element('affiliations', 'checkboxgroup', array('options' => $options));
     $d->set_display_name('affiliations', 'Audiences');
     $d->add_comments('affiliations', form_comment('Leaving these checkboxes blank won\'t filter the results.'));
     $d->set_actions(array('run' => 'Run'));
     $d->run();
     if ($d->get_value('active_since')) {
         $user_ids = $this->_get_active_user_ids($d->get_value('active_since'));
         echo count($user_ids) . ' Reason users modified at least one item since ' . prettify_mysql_datetime($d->get_value('active_since')) . '<br />';
         if ($d->get_value('affiliations')) {
             $affiliations = array_values($d->get_value('affiliations'));
         } else {
             $affiliations = array();
         }
         $users = $this->_get_active_users_from_ids($user_ids, $affiliations);
         echo '<br />' . count($users) . ' of the above users currently have access to at least one site<br />';
         if (!empty($users)) {
             echo '<textarea rows="12">' . "\n";
             $usernames = array();
             foreach ($users as $user) {
                 $usernames[$user->id()] = $user->get_value('name');
             }
             echo implode(', ', $usernames);
             echo '</textarea>' . "\n";
         }
         $emails = $this->_get_email_addresses_from_users($users);
         echo '<br />' . count($emails) . ' of the users with site access have an email addresses in the directory<br />';
         if (!empty($emails)) {
             echo '<textarea rows="12">' . "\n";
             echo implode(', ', $emails);
             echo '</textarea>' . "\n";
         }
     }
 }
Ejemplo n.º 3
0
 function set_disco_obj($types)
 {
     $d = new disco();
     $types = array();
     foreach ($this->types as $type) {
         $types = $types + array($type->get_value('id') => $type->get_value('name'));
     }
     $d->add_element('types', 'select_multiple', array('options' => $types));
     $d->set_display_name('types', 'Types to search:');
     $d->set_comments('types', form_comment('<a id="select_all" href="#all">Select all</a>'));
     $d->add_element('max', 'radio_inline_no_sort', array('options' => array('yes' => 'Yes', 'no' => 'No')));
     $d->set_display_name('max', 'Limit number of orphans to find:');
     $d->set_comments('max', form_comment('Searching for all orphaned entities can take a while. Limiting the number to find speeds the search.'));
     $d->set_value('max', 'yes');
     $d->add_element('max_num', 'text', array('size' => '5'));
     $d->set_display_name('max_num', 'Maximum number:');
     $d->set_value('max_num', '50');
     $d->add_element('cur_module', 'hidden');
     $d->set_value('cur_module', 'OrphanManager');
     $d->add_required('types', 'max');
     $d->add_element('mode', 'hidden');
     $d->set_value('mode', 'manager');
     $d->set_actions(array('run' => 'Find Orphaned Entities'));
     function check_phase_callback(&$disco)
     {
         if ($disco->successfully_submitted()) {
             $disco->show_form = false;
         }
     }
     $d->add_callback('check_phase_callback', 'where_to');
     $this->d = $d;
 }
Ejemplo n.º 4
0
 function _get_editing_form($blurb)
 {
     $form = new disco();
     $form->strip_tags_from_user_input = true;
     $form->allowable_HTML_tags = REASON_DEFAULT_ALLOWED_TAGS;
     $form->add_element('blurb_edit_text', html_editor_name($this->site_id), html_editor_params($this->site_id, $this->get_html_editor_user_id()));
     $form->set_display_name('blurb_edit_text', ' ');
     $form->set_value('blurb_edit_text', $blurb->get_value('content'));
     $form->set_actions(array('save' => 'Save', 'save_and_finish' => 'Save and Finish Editing'));
     $form->add_callback(array(&$this, 'save_blurb_callback'), 'process');
     $form->add_callback(array(&$this, 'where_to_callback'), 'where_to');
     ob_start();
     $form->run();
     $form_output = ob_get_clean();
     return $form_output;
 }