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";
     }
 }
 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";
         }
     }
 }
 /**
  * Run the module
  */
 function run()
 {
     $sites = $this->_get_sites();
     if (empty($sites)) {
         echo '<p>You must have editing access to at least one live Reason site for this module to work</p>' . "\n";
         return;
     }
     $users = $this->_get_users();
     if (empty($users)) {
         echo '<p>No users available.</p>' . "\n";
         return;
     }
     echo '<div id="reviewChangesModule">' . "\n";
     $d = new disco();
     $d->add_element('start_date', 'textdate', array('prepopulate' => true, 'year_max' => carl_date('Y'), 'year_min' => '1000'));
     $d->add_required('start_date');
     $d->add_element('end_date', 'textdate', array('year_max' => carl_date('Y'), 'year_min' => '1000'));
     $d->add_comments('end_date', form_comment('If no end date given, changes will be shown for just the start date'));
     $d->add_element('type', 'select', array('options' => $this->_prep_for_disco($this->_get_types())));
     if (!empty($this->admin_page->request['type_id'])) {
         $d->set_value('type', $this->admin_page->request['type_id']);
     }
     $d->add_element('site', 'select', array('options' => $this->_prep_for_disco($sites)));
     if (!empty($this->admin_page->request['site_id'])) {
         $d->set_value('site', $this->admin_page->request['site_id']);
     }
     $d->add_element('user', 'select', array('options' => $this->_prep_for_disco($users)));
     if (!empty($this->admin_page->request['user'])) {
         $d->set_value('user', $this->admin_page->request['user']);
     }
     $d->add_element('sort', 'select', array('options' => array('DESC' => 'Descending', 'ASC' => 'Ascending')));
     $d->set_actions(array('review' => 'Review'));
     $d->run();
     if ($d->successfully_submitted()) {
         $end_date = $d->get_value('end_date') ? $d->get_value('end_date') : $d->get_value('start_date');
         if ($end_date < $d->get_value('start_date')) {
             echo 'Please pick a end date on or after the start date.';
         } else {
             echo $this->_get_changes_markup($d->get_value('start_date'), $end_date, $d->get_value('type'), $d->get_value('site'), $d->get_value('user'), $d->get_value('sort'));
         }
     }
     echo '</div>' . "\n";
 }