function print_table($name, $campaign_list) { echo ' <div class="BlueBox">' . "\n"; echo ' <h2>' . xml_escape($name) . '</h2>' . "\n"; echo ' <table width="90%" cellpadding="3" align="center">' . "\n"; echo ' <thead>' . "\n"; echo ' <tr>' . "\n"; echo ' <th width="80%">Name</th>' . "\n"; echo ' <th width="20%">Petitioned</th>' . "\n"; echo ' </tr>' . "\n"; echo ' </thead>' . "\n"; echo ' <tbody>' . "\n"; foreach ($campaign_list as $key => $campaign) { echo ' <tr>' . "\n"; echo ' <td><a href="/office/campaign/editarticle/' . $key . '">' . xml_escape($campaign['name']) . '</a></td>' . "\n"; if ($campaign['has_been_petitioned'] == 1) { echo ' <td>yes</td>' . "\n"; } else { echo ' <td>no</td>' . "\n"; } echo ' </tr>' . "\n"; } echo ' </tbody>' . "\n"; echo ' </table>' . "\n"; echo ' </div>' . "\n"; }
function SetWikiparser($wiki = null, $preview = true) { $this->wikiparser = $wiki; $this->preview = $preview; // Generate preview for ajax? if ($preview && isset($_GET['input_wikitext_preview_field']) && $_GET['input_wikitext_preview_field'] == $this->name) { if (null === $this->wikiparser) { get_instance()->load->library('Wikiparser'); $parser = new Wikiparser(); } else { $parser =& $this->wikiparser; } if (isset($_POST['input_wikitext_preview'])) { $xml = $parser->parse($_POST['input_wikitext_preview']); } else { $xml = "POST input_wikitext_preview missing"; } header('content-type: text/xml'); ?> <<?php ?> ?xml version="1.0" encoding="UTF-8"?><?php ?> <wikitext><?php echo xml_escape($xml); ?> </wikitext><?php exit(0); } }
function printInput($title, $name, $type, $value, $section, $access, $user_level) { $name = xml_escape($name); $title = xml_escape($title); $value = xml_escape($value); if ($type != 'submit') { echo '<label for="' . $name . '">' . $title . ':</label>'; } if ($access[$section][$user_level]) { switch ($type) { case 'textarea': echo '<textarea name="' . $name . '" id="' . $name . '" cols="25" rows="5">' . $value . '</textarea>'; break; case 'submit': echo '<input type="' . $type . '" name="' . $name . '" id="' . $name . '" value="' . $value . '" class="button" />'; break; default: echo '<input type="' . $type . '" name="' . $name . '" id="' . $name . '" value="' . $value . '" size="30" />'; break; } } else { if ($type != 'submit') { echo '<div id="' . $name . '" style="float:left;margin:5px 10px;">' . $value . '</div>'; } } echo '<br />'; }
function printarticlelink($article) { echo ' <div style="border-bottom:1px #999 solid;">' . "\n"; echo ' <a href="/news/' . $article['type_codename'] . '/'; if (!empty($article['organisation_codename'])) { echo $article['organisation_codename'] . '/'; } //for reviews echo $article['id'] . '">' . "\n"; echo ' ' . $article['photo_xhtml'] . "\n"; echo ' </a>' . "\n"; echo ' <div class="ArticleEntry">' . "\n"; echo ' <h3 class="Headline">' . "\n"; if (!empty($article['organisation_codename'])) { //If the article has an org name, it is a review. echo ' <a href="/reviews/' . $article['type_codename'] . '/' . $article['organisation_codename'] . '/'; } else { echo ' <a href="/news/' . $article['type_codename'] . '/'; } echo $article['id'] . '">' . "\n"; echo ' ' . xml_escape($article['heading']) . "\n"; echo ' </a>' . "\n"; echo ' </h3>' . "\n"; echo ' <div class="Section" style="float:right;">' . xml_escape($article['type_name']) . '</div>' . "\n"; echo ' <div class="Date">' . date('D, jS F Y', $article['date']) . '</div>' . "\n"; echo ' <div class="Author">' . "\n"; foreach ($article['reporters'] as $reporter) { echo ' <a href="/news/archive/reporter/' . $reporter['id'] . '/">' . xml_escape($reporter['name']) . '</a>' . "\n"; } echo ' </div>' . "\n"; echo ' </div>' . "\n"; echo ' <p>' . xml_escape($article['blurb']) . '</p>' . "\n"; echo ' </div>' . "\n"; }
function log() { if (!CheckPermissions('admin')) { return; } $this->load->helper('url'); $bulk = 'Valid logs are ' . anchor('admin/dev/log/web/', 'log/web') . ' and ' . anchor('admin/dev/log/irc/', 'log/irc') . '.'; $segments = $this->uri->segment_array(); switch ($this->uri->segment(4)) { case "web": $web = dir('../log'); while (false !== ($entry = $web->read())) { if ($entry != '.' or $entry != '..') { $bulk .= '<p>' . anchor('admin/dev/log/web/' . $entry, $entry) . '</p>'; } } if ($this->uri->segment(5)) { $bulk .= nl2br(file_get_contents('../log/' . $this->uri->segment(5))); } break; case "irc": $irc = dir('../supybot/logs/ChannelLogger/afsmg/#theyorker'); while (false !== ($entry = $irc->read())) { $entry = trim($entry, '#'); $bulk .= '<p>' . anchor('admin/dev/log/irc/' . $entry, $entry) . '</p>'; } if ($this->uri->segment(5)) { $bulk .= nl2br(xml_escape(file_get_contents('../supybot/logs/ChannelLogger/afsmg/#theyorker/#' . $this->uri->segment(5)))); } break; } $this->main_frame->SetContent(new SimpleView($bulk)); $this->main_frame->SetTitle('Log Viewer'); $this->main_frame->Load(); }
function printarticlelink($article) { echo ' <div class="Entry">' . "\n"; echo ' <a href="/news/' . $article['article_type'] . '/' . $article['id'] . '">' . "\n"; echo ' ' . $article['photo_xhtml'] . "\n"; echo ' </a>' . "\n"; if (!array_key_exists('blurb', $article)) { echo ' <div class="ArticleEntry">' . "\n"; } echo ' <h3 class="Headline">' . "\n"; echo ' <a href="/news/' . $article['article_type'] . '/' . $article['id'] . '">' . "\n"; echo ' ' . xml_escape($article['heading']) . "\n"; echo ' </a>' . "\n"; echo ' </h3>' . "\n"; echo ' <div class="Date">' . $article['date'] . '</div>' . "\n"; echo ' <div class="Author">' . "\n"; foreach ($article['authors'] as $reporter) { echo ' <a href="/news/archive/reporter/' . $reporter['id'] . '/">' . xml_escape($reporter['name']) . '</a>' . "\n"; } echo ' </div>' . "\n"; if (!array_key_exists('blurb', $article)) { echo ' </div>' . "\n"; } if (array_key_exists('blurb', $article) && $article['blurb'] != '') { echo ' <p>' . xml_escape($article['blurb']) . '</p>' . "\n"; } echo ' </div>' . "\n"; }
function write_xml($subtags, $label = NULL) { if (NULL !== $subtags) { if (NULL !== $label) { $attributes = ''; if (is_array($subtags) && isset($subtags['_attr']) && is_array($subtags['_attr'])) { foreach ($subtags['_attr'] as $attribute => $value) { $attributes .= " {$attribute}=\"" . xml_escape($value) . '"'; } } echo '<' . $label . $attributes . '>'; } if (is_array($subtags)) { foreach ($subtags as $tag => $content) { if (substr($tag, 0, 1) == '_') { continue; } if (is_numeric($tag)) { if (is_array($content) && isset($content['_tag'])) { $tag = $content['_tag']; } else { $tag = NULL; } } write_xml($content, $tag); } } else { echo xml_escape($subtags); } if (NULL !== $label) { echo '</' . $label . '>'; } } }
function DoTeam($team, $in_list = TRUE) { if ($in_list) { echo '<li>'; } if (isset($team['notices'])) { echo '<a href="">'; } echo xml_escape($team['name']); if (isset($team['notices'])) { echo ' (' . count($team['notices']) . ' notices)'; echo '</a>'; } if (!empty($team['subteams'])) { echo '<ul>'; foreach ($team['subteams'] as $subteam) { DoTeam($subteam); } echo '</ul>'; } if ($in_list) { echo '</li>'; } return count($team['subteams']); }
function dir_walk($path = '', $depth = 0) { if ($path == '') { $apath = './'; } else { if (substr($path, -1, 1) != '/') { $path .= '/'; } $apath = $path; } $out = array(); $ds = utf8_encode(str_repeat("� � ", $depth)); foreach (scandir($apath) as $v) { if (substr($v, 0, 1) == '.') { continue; } if (is_dir($apath . $v)) { printf("%s+ <b>%s</b><br/>\n", $ds, xml_escape($path . $v)); dir_walk($path . $v, $depth + 1); print "<br/>\n"; } else { if (ext($v) == 'pyc' || $path == '' && $v == 'index.php') { continue; } $out[] = $v; } } foreach ($out as $file) { printf("%s<a href=\"?sauce=%s\">%s</a><br/>\n", $ds, urlencode($path . $file), xml_escape($file)); } }
function ArticleList($section, $articles, $last = false) { if (count($articles) == 0) { return; } ?> <div class="ArticleListBox FlexiBox Box13<?php if ($last) { echo ' FlexiBoxLast'; } ?> "> <div class="ArticleListTitle"> <a href="/news/<?php echo $articles[0]['article_type'] . '/' . $articles[0]['id']; ?> ">latest <?php echo $section; ?> </a> </div> <?php foreach ($articles as $article) { ?> <div> <a href="/news/<?php echo xml_escape($article['article_type'] . '/' . $article['id']); ?> "> <img src="/photos/small/<?php echo xml_escape($article['photo_id']); ?> " alt="<?php echo xml_escape($article['photo_title']); ?> " title="<?php echo xml_escape($article['photo_title']); ?> " /> <?php echo xml_escape($article['heading']); ?> </a> <div class="Date"><?php echo xml_escape($article['date']); ?> </div> <div class="clear"></div> </div> <?php } ?> </div> <?php if ($last) { ?> <div class="clear"></div><?php } }
/** * @param $Keys array with keys 'userid', 'occid'. */ function __construct($Keys, $Extra = NULL) { parent::__construct(self::$notTypeInfo, $Keys); if (NULL !== $Extra) { $CI =& get_instance(); $this->SetData('Custom', '<p>Summary: <strong><a href="' . site_url($Extra['link']) . $CI->uri->uri_string() . '">' . xml_escape($Extra['name']) . '</a></strong>'); } }
function PrintTextArea($input_name, $item, $sessionvar) { echo '<label for="' . $input_name . '">' . $item . '</label>'; echo '<textarea name="' . $input_name . '" id="' . $input_name . '" cols="25" rows="5">'; if (isset($_SESSION[$sessionvar][$input_name])) { echo xml_escape($_SESSION[$sessionvar][$input_name]); } echo '</textarea>'; }
function ListExperiments(&$list, &$query) { global $item_tag; global $item_title; foreach ($list as $eid => $exp) { $exp_name = xml_escape($exp["name"]); $equery = $query . "__" . $exp['start'] . "-" . $exp['stop']; $res .= "<{$item_tag} {$item_title}=\"{$exp_name}\" id=\"SetQuery__{$equery}\"/>"; } return $res; }
function PrintRequestList($data, $AssignedColumn = FALSE) { $colCount = 5; $colCount = floor(100 / $colCount); echo ' <div class="ArticleBox">' . "\n"; echo ' <table>' . "\n"; echo ' <thead>' . "\n"; echo ' <tr>' . "\n"; echo ' <th style="width:' . $colCount . '%;">Request Title</th>' . "\n"; echo ' <th style="width:' . $colCount . '%;">Photographer</th>' . "\n"; echo ' <th style="width:' . $colCount . '%;">Status</th>' . "\n"; echo ' <th style="width:' . $colCount . '%;">Submission Date</th>' . "\n"; echo ' <th style="width:' . $colCount . '%;text-align:right;">Article Deadline</th>' . "\n"; echo ' </tr>' . "\n"; echo ' </thead>' . "\n"; echo ' <tbody>' . "\n"; $RowStyle = FALSE; if (count($data) == 0) { echo ' <tr>'; echo ' <td colspan="0" style="text-align:center; font-style:italic;">No requests in this section...</td>'; echo ' </tr>'; } else { foreach ($data as $row) { echo ' <tr '; if ($RowStyle) { echo 'class="tr2"'; } echo '>' . "\n"; echo ' <td><a href="/office/photos/view/' . $row['id'] . '/"><img src="/images/prototype/news/photo-small.gif" alt="Photo Request" title="Photo Request" /> ' . xml_escape($row['title']) . '</a></td>' . "\n"; echo ' <td>'; if ($row['user_name'] != '') { echo '<img src="/images/prototype/news/person.gif" alt="Photographer" title="Photographer" /> ' . xml_escape($row['user_name']); } echo '</td>' . "\n"; echo ' <td>'; if ($row['user_status'] != '') { echo '<img src="/images/prototype/news/' . xml_escape($row['user_status']) . '.gif" alt="' . xml_escape($row['user_status']) . '" title="' . xml_escape($row['user_status']) . '" /> ' . xml_escape($row['user_status']); } echo '</td>'; echo ' <td>' . date('d/m/y @ H:i', $row['time']) . '</td>' . "\n"; echo ' <td style="text-align:right;'; if (mktime() > $row['deadline']) { echo 'color:red;'; } echo '">' . date('d/m/y @ H:i', $row['deadline']) . '</td>' . "\n"; echo ' </tr>' . "\n"; $RowStyle = !$RowStyle; } } echo ' </tbody>' . "\n"; echo ' </table>' . "\n"; echo ' </div>' . "\n"; }
function EchoTeamFilterOptions($team, $prefix = '', $path = '', $indentation = 0) { foreach ($team['subteams'] as $subteam) { echo '<option name="team_' . $subteam['id'] . '">' . "\n"; //echo str_repeat(' ',$indentation); echo xml_escape($prefix . $path . $subteam['name']) . "\n"; echo '</option>' . "\n"; if (!empty($subteam['subteams'])) { EchoTeamFilterOptions($subteam, $prefix, $path . $subteam['name'] . '/', $indentation + 1); } } }
/** * Echos the html for the specified menu array. * @param $DrawMenu array[menu_item] In the format of @a $Menu. */ function RenderMenu($DrawMenu) { echo '<ul>'; foreach ($DrawMenu as $child) { echo '<li>'; echo '<a href="' . xml_escape($child['link']) . '">' . xml_escape($child['name']) . ' (' . $child['quantity'] . ')</a>'; if (isset($child['children']) && !empty($child['children'])) { echo RenderMenu($child['children']); } echo '</li>'; } echo '</ul>'; }
function print_comment($comment, $comments_per_page) { $page = floor(($comment['article_comment_count'] - 1) / $comments_per_page) * $comments_per_page + 1; if ($comment['comment_anonymous']) { echo ' <li class="anonymous">' . "\n"; echo ' <i>Anonymous</i>' . "\n"; } else { echo ' <li>' . "\n"; echo ' <i>' . xml_escape($comment['user_firstname'] . ' ' . $comment['user_surname']) . '</i>' . "\n"; } echo ' on <a href="/comments/thread/' . $comment['comment_id'] . '">' . xml_escape($comment['heading']) . '</a>' . "\n"; echo ' </li>' . "\n"; }
public function recordToDcmesXml($item) { $xml = "\n" . '<rdf:Description rdf:about="' . xml_escape(record_url($item, null, true)) . '">'; // Iterate throught the DCMES. foreach ($this->_dcElements as $elementName) { if ($text = metadata($item, array('Dublin Core', $elementName), array('all' => true, 'no_escape' => true))) { foreach ($text as $k => $v) { if (!empty($v)) { $xml .= "\n" . '<dc:' . strtolower($elementName) . '>' . xml_escape($v) . '</dc:' . strtolower($elementName) . '>'; } } } } $xml .= "\n" . '</rdf:Description>'; return $xml; }
public function getImage($imageID, $type, $extraTags = array(), $extraArguments = array()) { if (is_int($type)) { $sql = 'SELECT image_type_codename FROM image_types WHERE image_type_id = ?'; $codename = $this->db->query($sql, array($type))->first_row()->image_type_codename; $data = $this->get($imageID, 'images', $codename); } else { $data = $this->get($imageID, 'images', $type); } $tagInner = ''; $data['alt'] = $data['title']; foreach (array_merge($data, $extraTags) as $name => $value) { $tagInner .= $name . '="' . xml_escape($value) . '" '; } return '<img src="/image/' . $type . '/' . $imageID . '" ' . $tagInner . ' />'; }
protected function itemToRSS($item) { $entry = array(); set_current_record('item', $item, true); // Title is a CDATA section, so no need for extra escaping. $entry['title'] = strip_formatting(metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true))); $entry['description'] = $this->buildDescription($item); $entry['link'] = xml_escape(record_url($item, null, true)); $entry['lastUpdate'] = strtotime($item->added); //List the first file as an enclosure (only one per RSS feed) if (($files = $item->Files) && ($file = current($files))) { $entry['enclosure'] = array(); $fileDownloadUrl = file_display_url($file); $enc['url'] = $fileDownloadUrl; $enc['type'] = $file->mime_type; $enc['length'] = (int) $file->size; $entry['enclosure'][] = $enc; } return $entry; }
function DoTeam($team, $in_list = TRUE) { if ($in_list) { echo '<li>' . "\n"; } echo '<input type="checkbox" name="filter_team_' . $team['id'] . '" value="' . $team['id'] . '" />' . "\n"; echo '<a href="' . vip_url('members/teams/' . $team['id']) . '">' . xml_escape($team['name']) . '</a>' . "\n"; if (!empty($team['subteams'])) { echo '<ul>' . "\n"; foreach ($team['subteams'] as $subteam) { DoTeam($subteam); } echo '</ul>' . "\n"; } if ($in_list) { echo '</li>' . "\n"; } echo '<br /><br />' . "\n"; return count($team['subteams']); }
function star_rating_large($rating, $text) { $xhtml = ''; $star_count = 0; $rating_left = $rating; $text = xml_escape($text); while ($rating_left >= 2) { $xhtml .= '<img src="/images/prototype/reviews/star.png" alt="' . $text . ' Rating: ' . $rating . '" title="' . $text . ' Rating: ' . $rating . '" />'; $star_count++; $rating_left -= 2; } if ($rating_left == 1) { $xhtml .= '<img src="/images/prototype/reviews/halfstar.png" alt="' . $text . ' Rating: ' . $rating . '" title="' . $text . ' Rating: ' . $rating . '" />'; $star_count++; $rating_left--; } while ($star_count < 5) { $xhtml .= '<img src="/images/prototype/reviews/emptystar.png" alt="' . $text . ' Rating: ' . $rating . '" title="' . $text . ' Rating: ' . $rating . '" />'; $star_count++; } return $xhtml; }
function Make_Game_Table($game_array, $is_editor) { echo '<table><thead><tr> <th></th> <th width="100%">Title</th> <th>Added</th> <th style="padding-right:5px;">Count</th> <th>Del</th> </tr></thead><tbody>'; $alternate = 1; foreach ($game_array as $game_id => $game) { echo ' <tr id="row_' . $game_id . '" class="tr' . $alternate . '"> <td style="width:14px">'; if ($is_editor) { echo ' <a href="#" onclick="xajax_toggle_activation(' . $game_id . ')">'; } echo ' <img id="activation_' . $game_id . '" src="'; if ($game['activated']) { echo '/images/prototype/prefs/success.gif'; } else { echo '/images/prototype/news/delete.gif'; } echo '" />' . ($is_editor ? '</a>' : "") . '</td>'; echo '<td style="padding-right:5px"><a href="/office/games/edit/' . $game_id . '">' . (strlen($game['title']) > 0 ? xml_escape($game['title']) : '<em><No Name></em>') . '</a></td>'; echo '<td style="padding-right:5px;"> ' . $game['date_added'] . '</td>'; echo '<td style="padding-right:5px;text-align:right;">' . $game['play_count'] . '</td>'; echo '<td>'; echo '<a href="/office/games/del_game/' . $game_id . '" onclick="return check_delete(\'' . xml_escape($game['title']) . '\');">Del</a>'; echo '</td>'; echo '</tr>'; $alternate == 1 ? $alternate = 2 : ($alternate = 1); } echo '</tbody></table>'; }
function PrintSectionTableContents($header_name, $data) { echo ' <b>' . xml_escape($header_name) . '</b>'; echo ' <div class="ArticleBox">' . "\n"; echo ' <table>' . "\n"; echo ' <thead>' . "\n"; echo ' <tr>' . "\n"; echo ' <th style="width:50%;">' . "\n"; echo ' Name' . "\n"; echo ' </th>' . "\n"; echo ' <th style="width:20%;">' . "\n"; echo ' By' . "\n"; echo ' </th>' . "\n"; echo ' <th style="width:30%;text-align:right;">' . "\n"; echo ' Date' . "\n"; echo ' </th>' . "\n"; echo ' </tr>' . "\n"; echo ' </thead>' . "\n"; echo ' <tbody>' . "\n"; $alternate = 1; foreach ($data as $section) { $dateformatted = date('d/m/y @ H:i', $section['publish']); echo ' <tr class="tr' . $alternate . '">' . "\n"; echo ' <td>' . "\n"; echo ' <a href="/office/howdoi/editquestion/' . $section['id'] . '">' . xml_escape($section['heading']) . '</a>' . "\n"; echo ' </td>' . "\n"; echo ' <td>' . "\n"; echo ' ' . xml_escape($section['user_firstname'] . ' ' . $section['user_surname']) . "\n"; echo ' </td>' . "\n"; echo ' <td style="text-align:right;">' . "\n"; echo ' ' . $dateformatted . "\n"; echo ' </td>' . "\n"; echo ' </tr>' . "\n"; $alternate == 1 ? $alternate = 2 : ($alternate = 1); } echo ' </tbody>' . "\n"; echo ' </table>' . "\n"; echo ' </div>' . "\n"; }
/** * @brief Allows a user to become a VIP for an organisation */ function vip($org_id = NULL) { if (!CheckPermissions('student')) { return; } $this->_SetupTabs('subscriptions'); /// Get custom page content $this->pages_model->SetPageCode('account_home'); $data['org_id'] = $org_id; $data['org_name'] = $this->prefs_model->getOrganisationDescription($org_id); $data['vip_help_heading'] = $this->pages_model->GetPropertyText('vip_help_heading'); $data['vip_help_text'] = $this->pages_model->GetPropertyWikitext('vip_help_text'); if ($org_id == NULL || !is_numeric($org_id)) { $this->messages->AddMessage('error', 'The organisation you tried to apply to be VIP for does not exist.'); redirect('account/'); } elseif (!$this->prefs_model->isSubscribed($this->user_auth->entityId, $org_id)) { $this->messages->AddMessage('error', 'You must be subscribed to the organisation before you can apply to become a VIP for it.'); redirect('account/'); } elseif ($this->input->post('v_apply') == 'Apply') { /// Process form submission $this->load->model('members_model'); $position = $this->input->post('v_position'); $phone = $this->input->post('v_phone'); if ($position == '') { $this->messages->AddMessage('error', 'Please make sure you specify your position in the organisation before submitting the application.'); } else { $this->members_model->UpdateVipStatus('requested', $this->user_auth->entityId, $org_id); $this->prefs_model->vipApplication($this->user_auth->entityId, $org_id, $position, $phone); $this->messages->AddMessage('success', 'Your application to become VIP for ' . xml_escape($data['org_name']['name']) . ' has been successfully recieved.'); redirect('/account'); } } /// Set up the main frame $this->main_frame->SetContentSimple('account/vip_application', $data); /// Set page title & load main frame with view $this->main_frame->Load(); }
/** * @return array[id => array]. * - NULL if not supported. */ function GetAllOpenCalendars() { $sql = 'SELECT `organisation_entity_id` AS entity_id,' . ' `organisation_name` AS name,' . ' `organisation_event_submission_text` AS text' . ' FROM `organisations`' . ' WHERE `organisation_events` = True' . ' AND `organisation_event_submission_text` IS NOT NULL' . ' ORDER BY `organisation_name` ASC'; $CI =& get_instance(); $open_calendars = $CI->db->query($sql)->result_array(); $result = array(); foreach ($open_calendars as $row) { $result[(int) $row['entity_id']] = array('id' => $row['entity_id'], 'name' => $row['name'], 'description_xml' => '<p>' . xml_escape($row['text']) . '</p>'); } return $result; }
's special article</h2> <form method="post" action="/office/specials"> <fieldset> <label for="special_article"></label> <select name="special_article"> <option value="">#No Special#</option> <?php foreach ($articles as $article) { echo ' <option value="' . $article['id'] . '"'; if (!empty($current_special_id)) { if ($article['id'] == $current_special_id) { echo 'selected="selected"'; } } echo '>'; echo ' ' . xml_escape($article['heading']); echo ' </option>' . "\n"; } ?> </select> <input type="hidden" name="article_type" value="<?php echo $article_type['codename']; ?> "> </fieldset> <fieldset> <input name="specials_edit" type="submit" value="Edit" class="button" /> </fieldset> </form> </div> <a href='/office/specials/'>Go Back</a>
$idPostfix = 0; foreach ($organisation_types as $org_type) { ?> <label for="filterCheck<?php echo $idPostfix; ?> "> <input id="filterCheck<?php echo $idPostfix; ?> " onclick="searchDirectory();" type="checkbox" name="<?php echo xml_escape($org_type['id']); ?> " checked="checked" class="checkbox"/> <?php echo xml_escape($org_type['name']) . ' (' . $org_type['quantity'] . ')'; ?> </label> <?php $idPostfix++; } ?> </div> <h2>Suggestions</h2> <div class="Entry"> <ul> <li><a href="/wizard/organisation">Suggest an entry</a></li> </ul> </div> </div>
/** Category management. */ function cats($category = null, $op = null) { if (!CheckPermissions('office')) { return; } $this->load->model('permissions_model'); $permissions = array('index' => $this->permissions_model->hasUserPermission('CROSSWORD_INDEX'), 'categories_index' => $this->permissions_model->hasUserPermission('CROSSWORD_CATEGORIES_INDEX'), 'category_add' => $this->permissions_model->hasUserPermission('CROSSWORD_CATEGORY_ADD'), 'category_view' => $this->permissions_model->hasUserPermission('CROSSWORD_CATEGORY_VIEW'), 'category_edit' => $this->permissions_model->hasUserPermission('CROSSWORD_CATEGORY_MODIFY'), 'crossword_add' => $this->permissions_model->hasUserPermission('CROSSWORD_ADD'), 'crossword_view' => $this->permissions_model->hasUserPermission('CROSSWORD_VIEW'), 'crossword_edit' => $this->permissions_model->hasUserPermission('CROSSWORD_MODIFY')); if (null === $category) { if (!CheckRolePermissions('CROSSWORD_CATEGORIES_INDEX')) { return; } $this->pages_model->SetPageCode('crosswords_office_cats'); $data = array('Permissions' => &$permissions, 'Categories' => $this->crosswords_model->GetAllCategories()); $this->main_frame->SetContentSimple('crosswords/office/categories', $data); } else { // URL return path $ret = isset($_GET['ret']) ? $_GET['ret'] : null; $effective_ret = null === $ret ? 'office/crosswords/cats' : $ret; $action = site_url($this->uri->uri_string()); if ($ret !== null) { $action .= '?ret=' . urlencode($ret); } $layouts = $this->crosswords_model->GetAllLayouts(); $data = array('Permissions' => &$permissions, 'MaxLengths' => array('name' => 255, 'short_name' => 32), 'Layouts' => $layouts, 'Category' => array('name' => '', 'short_name' => '', 'default_width' => 13, 'default_height' => 13, 'default_layout_id' => -1, 'default_has_normal_clues' => true, 'default_has_cryptic_clues' => false, 'default_winners' => 3), 'Actions' => array(), 'PostAction' => $action); if ('add' === $category) { if (!CheckRolePermissions('CROSSWORD_CATEGORY_ADD')) { return; } $this->pages_model->SetPageCode('crosswords_office_cat_add'); // Check post input $cancelled = false !== $this->input->post('xword_cat_cancel'); if ($cancelled) { redirect($effective_ret); } if (empty($layouts)) { $this->messages->AddMessage('error', 'No crossword layouts have been set up. ' . 'Please <a href="' . site_url('office/crosswords/layouts/add') . '?ret=' . xml_escape(urlencode($action)) . '">add a layout</a> before adding categories.'); } else { // Do the adding if possible $valid_input = $this->_validateCategoryPost($data['Category'], $data['MaxLengths'], $layouts); if ($valid_input) { $messages = $this->crosswords_model->AddCategory($data['Category']); $this->messages->AddMessages($messages); if (!isset($messages['error']) || empty($messages['error'])) { redirect($effective_ret); } } $data['Actions']['add'] = 'Add Category'; $data['Actions']['cancel'] = 'Cancel'; $this->main_frame->SetContentSimple('crosswords/office/category_edit', $data); } } elseif (is_numeric($category)) { $category = (int) $category; if ($op == 'edit') { if (!CheckRolePermissions('CROSSWORD_CATEGORY_MODIFY')) { return; } $this->pages_model->SetPageCode('crosswords_office_cat_edit'); } elseif ($op === null) { if (!CheckRolePermissions('CROSSWORD_CATEGORY_VIEW')) { return; } $this->pages_model->SetPageCode('crosswords_office_cat_view'); } else { show_404(); } // Retreive current data about the category. $categoryData = $this->crosswords_model->GetCategoryById($category); if (null === $categoryData) { $this->messages->AddMessage('error', "No crossword category with the id {$category} exists."); redirect($effective_ret); } $data['Category'] = $categoryData; // Provide some info for the title $this->main_frame->SetTitleParameters(array('CATEGORY' => $categoryData['name'])); if ($op == 'edit') { // Check post input $cancelled = false !== $this->input->post('xword_cat_cancel'); if ($cancelled) { redirect($effective_ret); } $valid_input = $this->_validateCategoryPost($data['Category'], $data['MaxLengths'], $layouts); // Do the saving if possible if ($valid_input) { // Don't bother if nothing has changed if ($data['Category']['name'] != $categoryData['name'] || $data['Category']['short_name'] != $categoryData['short_name'] || $data['Category']['default_width'] != $categoryData['default_width'] || $data['Category']['default_height'] != $categoryData['default_height'] || $data['Category']['default_layout_id'] != $categoryData['default_layout_id'] || $data['Category']['default_has_normal_clues'] != $categoryData['default_has_normal_clues'] || $data['Category']['default_has_cryptic_clues'] != $categoryData['default_has_cryptic_clues'] || $data['Category']['default_winners'] != $categoryData['default_winners']) { $messages = $this->crosswords_model->ModifyCategory($category, $data['Category']); } else { $messages = array('information' => array(xml_escape('You didn\'t make any changes.'))); } $this->messages->AddMessages($messages); if (!isset($messages['error']) || empty($messages['error'])) { redirect($effective_ret); } } $data['Actions']['save'] = 'Save Category'; $data['Actions']['cancel'] = 'Cancel'; $this->main_frame->SetContentSimple('crosswords/office/category_edit', $data); } else { if (false !== $this->input->post('xword_cat_view_add_crossword')) { if (!CheckRolePermissions('CROSSWORD_ADD')) { return; } $new_category_id = $this->crosswords_model->AddCrossword($category); if (null !== $new_category_id) { redirect("office/crosswords/crossword/{$new_category_id}"); } else { $this->messages->AddMessage('error', 'Could not add a new crossword to this category.'); } } // Get the crosswords in this category $crosswords = $this->crosswords_model->GetCrosswords(null, $category); $data['Crosswords'] = $crosswords; $this->main_frame->SetContentSimple('crosswords/office/category_view', $data); } } else { show_404(); } } $this->main_frame->IncludeCss('stylesheets/crosswords_office.css'); $this->main_frame->Load(); }
<?php header('Access-Control-Allow-Origin: *'); require "../adei.php"; try { ADEI::RequireService($_GET['service']); } catch (ADEIException $ex) { $ex->logInfo(); $service_error = xml_escape($ex->getInfo()); } if ($service_error) { echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<result><Error>{$service_error}</Error></result>"; }