本文整理汇总了PHP中url_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP url_escape函数的具体用法?PHP url_escape怎么用?PHP url_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了url_escape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_aliases
/**
* Show a page of aliases.
*
* Note: $can_manage = whether things like "add new alias" should be shown
*
* @param array $aliases An array of ($old_tag => $new_tag)
* @param int $pageNumber
* @param int $totalPages
*/
public function display_aliases($aliases, $pageNumber, $totalPages)
{
global $page, $user;
$can_manage = $user->can("manage_alias_list");
if ($can_manage) {
$h_action = "<th width='10%'>Action</th>";
$h_add = "\n\t\t\t\t<tr>\n\t\t\t\t\t" . make_form(make_link("alias/add")) . "\n\t\t\t\t\t\t<td><input type='text' name='oldtag'></td>\n\t\t\t\t\t\t<td><input type='text' name='newtag'></td>\n\t\t\t\t\t\t<td><input type='submit' value='Add'></td>\n\t\t\t\t\t</form>\n\t\t\t\t</tr>\n\t\t\t";
} else {
$h_action = "";
$h_add = "";
}
$h_aliases = "";
foreach ($aliases as $old => $new) {
$h_old = html_escape($old);
$h_new = "<a href='" . make_link("post/list/" . url_escape($new) . "/1") . "'>" . html_escape($new) . "</a>";
$h_aliases .= "<tr><td>{$h_old}</td><td>{$h_new}</td>";
if ($can_manage) {
$h_aliases .= "\n\t\t\t\t\t<td>\n\t\t\t\t\t\t" . make_form(make_link("alias/remove")) . "\n\t\t\t\t\t\t\t<input type='hidden' name='oldtag' value='{$h_old}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t";
}
$h_aliases .= "</tr>";
}
$html = "\n\t\t\t<table id='aliases' class='sortable zebra'>\n\t\t\t\t<thead><tr><th>From</th><th>To</th>{$h_action}</tr></thead>\n\t\t\t\t<tbody>{$h_aliases}</tbody>\n\t\t\t\t<tfoot>{$h_add}</tfoot>\n\t\t\t</table>\n\t\t\t<p><a href='" . make_link("alias/export/aliases.csv") . "'>Download as CSV</a></p>\n\t\t";
$bulk_html = "\n\t\t\t" . make_form(make_link("alias/import"), 'post', true) . "\n\t\t\t\t<input type='file' name='alias_file'>\n\t\t\t\t<input type='submit' value='Upload List'>\n\t\t\t</form>\n\t\t";
$page->set_title("Alias List");
$page->set_heading("Alias List");
$page->add_block(new NavBlock());
$page->add_block(new Block("Aliases", $html));
if ($can_manage) {
$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
}
$this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
}
示例2: display_table
public function display_table(Page $page, $extensions, $editable)
{
$h_en = $editable ? "<th>Enabled</th>" : "";
$html = "\n\t\t\t" . make_form(make_link("ext_manager/set")) . "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\$(\"#extensions\").tablesorter();\n\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t\t<table id='extensions' class='zebra'>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>{$h_en}<th>Name</th><th>Description</th></tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t";
foreach ($extensions as $extension) {
if (!$editable && $extension->visibility == "admin") {
continue;
}
$h_name = html_escape(empty($extension->name) ? $extension->ext_name : $extension->name);
$h_description = html_escape($extension->description);
if ($extension->enabled === TRUE) {
$h_enabled = " checked='checked'";
} else {
if ($extension->enabled === FALSE) {
$h_enabled = "";
} else {
$h_enabled = " disabled checked='checked'";
}
}
$h_link = make_link("ext_doc/" . url_escape($extension->ext_name));
$h_en = $editable ? "<td><input type='checkbox' name='ext_" . html_escape($extension->ext_name) . "'{$h_enabled}></td>" : "";
$html .= "\n\t\t\t\t<tr>\n\t\t\t\t\t{$h_en}\n\t\t\t\t\t<td><a href='{$h_link}'>{$h_name}</a></td>\n\t\t\t\t\t<td style='text-align: left;'>{$h_description}</td>\n\t\t\t\t</tr>";
}
$h_set = $editable ? "<tfoot><tr><td colspan='5'><input type='submit' value='Set Extensions'></td></tr></tfoot>" : "";
$html .= "\n\t\t\t\t\t</tbody>\n\t\t\t\t\t{$h_set}\n\t\t\t\t</table>\n\t\t\t</form>\n\t\t";
$page->set_title("Extensions");
$page->set_heading("Extensions");
$page->add_block(new NavBlock());
$page->add_block(new Block("Extension Manager", $html));
}
示例3: do_rss
/**
* @param array $images
* @param array $search_terms
* @param int $page_number
*/
private function do_rss($images, $search_terms, $page_number)
{
global $page;
global $config;
$page->set_mode("data");
$page->set_type("application/rss+xml");
$data = "";
foreach ($images as $image) {
$data .= $this->thumb($image);
}
$title = $config->get_string('title');
$base_href = make_http(get_base_href());
$search = "";
if (count($search_terms) > 0) {
$search = url_escape(implode(" ", $search_terms)) . "/";
}
if ($page_number > 1) {
$prev_url = make_link("rss/images/{$search}" . ($page_number - 1));
$prev_link = "<atom:link rel=\"previous\" href=\"{$prev_url}\" />";
} else {
$prev_link = "";
}
$next_url = make_link("rss/images/{$search}" . ($page_number + 1));
$next_link = "<atom:link rel=\"next\" href=\"{$next_url}\" />";
// no end...
$version = VERSION;
$xml = "<" . "?xml version=\"1.0\" encoding=\"utf-8\" ?" . ">\n<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <channel>\n <title>{$title}</title>\n <description>The latest uploads to the image board</description>\n\t\t<link>{$base_href}</link>\n\t\t<generator>Shimmie-{$version}</generator>\n\t\t<copyright>(c) 2007 Shish</copyright>\n\t\t{$prev_link}\n\t\t{$next_link}\n\t\t{$data}\n\t</channel>\n</rss>";
$page->set_data($xml);
}
示例4: display_aliases
public function display_aliases(Page $page, $aliases, $is_admin, $pageNumber, $totalPages)
{
if ($is_admin) {
$action = "<th width='10%'>Action</th>";
$add = "\n\t\t\t\t<tr>\n\t\t\t\t\t<form action='" . make_link("alias/add") . "' method='POST'>\n\t\t\t\t\t\t<td><input type='text' name='oldtag'></td>\n\t\t\t\t\t\t<td><input type='text' name='newtag'></td>\n\t\t\t\t\t\t<td><input type='submit' value='Add'></td>\n\t\t\t\t\t</form>\n\t\t\t\t</tr>\n\t\t\t";
} else {
$action = "";
$add = "";
}
$h_aliases = "";
$n = 0;
foreach ($aliases as $old => $new) {
$h_old = html_escape($old);
$h_new = "<a href='" . make_link("post/list/" . url_escape($new) . "/1") . "'>" . html_escape($new) . "</a>";
$oe = $n++ % 2 == 0 ? "even" : "odd";
$h_aliases .= "<tr class='{$oe}'><td>{$h_old}</td><td>{$h_new}</td>";
if ($is_admin) {
$h_aliases .= "\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<form action='" . make_link("alias/remove") . "' method='POST'>\n\t\t\t\t\t\t\t<input type='hidden' name='oldtag' value='{$h_old}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t";
}
$h_aliases .= "</tr>";
}
$html = "\n\t\t\t<script>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#aliases\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t<table id='aliases' class='zebra'>\n\t\t\t\t<thead><tr><th>From</th><th>To</th>{$action}</tr></thead>\n\t\t\t\t<tbody>{$h_aliases}</tbody>\n\t\t\t\t<tfoot>{$add}</tfoot>\n\t\t\t</table>\n\t\t\t<p><a href='" . make_link("alias/export/aliases.csv") . "'>Download as CSV</a></p>\n\t\t";
$bulk_html = "\n\t\t\t<form enctype='multipart/form-data' action='" . make_link("alias/import") . "' method='POST'>\n\t\t\t\t<input type='file' name='alias_file'>\n\t\t\t\t<input type='submit' value='Upload List'>\n\t\t\t</form>\n\t\t";
$page->set_title("Alias List");
$page->set_heading("Alias List");
$page->add_block(new NavBlock());
$page->add_block(new Block("Aliases", $html));
if ($is_admin) {
$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
}
$this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
}
示例5: get_list_pageinfo
/**
* Returns info about the current page number.
*
* @param PageRequestEvent $event
* @return array
*/
private function get_list_pageinfo(PageRequestEvent $event)
{
global $config, $database;
// get the amount of images per page
$images_per_page = $config->get_int('index_images');
// if there are no tags, use default
if (is_null($event->get_arg(1))) {
$prefix = "";
$page_number = int_escape($event->get_arg(0));
$total_pages = ceil($database->get_one("SELECT COUNT(*) FROM images") / $images_per_page);
} else {
// if there are tags, use pages with tags
$prefix = url_escape($event->get_arg(0)) . "/";
$page_number = int_escape($event->get_arg(1));
$total_pages = ceil($database->get_one("SELECT count FROM tags WHERE tag=:tag", array("tag" => $event->get_arg(0))) / $images_per_page);
}
// creates previous & next values
// When previous first page, go to last page
if ($page_number <= 1) {
$prev = $total_pages;
} else {
$prev = $page_number - 1;
}
if ($page_number >= $total_pages) {
$next = 1;
} else {
$next = $page_number + 1;
}
// Create return array
$pageinfo = array("prev" => $prefix . $prev, "next" => $prefix . $next);
return $pageinfo;
}
示例6: display_page
/**
* @param Page $page
* @param Image[] $images
*/
public function display_page(Page $page, $images)
{
global $config;
if (count($this->search_terms) == 0) {
$query = null;
$page_title = $config->get_string('title');
} else {
$search_string = implode(' ', $this->search_terms);
$query = url_escape($search_string);
$page_title = html_escape($search_string);
}
$nav = $this->build_navigation($this->page_number, $this->total_pages, $this->search_terms);
$page->set_title($page_title);
$page->set_heading($page_title);
$page->add_block(new Block("Search", $nav, "left", 0));
if (count($images) > 0) {
if ($query) {
$page->add_block(new Block("Images", $this->build_table($images, "search={$query}"), "main", 10));
$this->display_paginator($page, "post/list/{$query}", null, $this->page_number, $this->total_pages);
} else {
$page->add_block(new Block("Images", $this->build_table($images, null), "main", 10));
$this->display_paginator($page, "post/list", null, $this->page_number, $this->total_pages);
}
} else {
$page->add_block(new Block("No Images Found", "No images were found to match the search criteria"));
}
}
示例7: display_global_page
/**
* @param Page $page
* @param array $history
* @param int $page_number
*/
public function display_global_page(Page $page, $history, $page_number)
{
$start_string = "\n\t\t\t<div style='text-align: left'>\n\t\t\t\t" . make_form(make_link("tag_history/revert")) . "\n\t\t\t\t\t<ul style='list-style-type:none;'>\n\t\t";
$end_string = "\n\t\t\t\t\t</ul>\n\t\t\t\t\t<input type='submit' value='Revert To'>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t";
global $user;
$history_list = "";
foreach ($history as $fields) {
$current_id = $fields['id'];
$image_id = $fields['image_id'];
$current_tags = html_escape($fields['tags']);
$name = $fields['name'];
$h_ip = $user->can("view_ip") ? " " . show_ip($fields['user_ip'], "Tagging Image #{$image_id} as '{$current_tags}'") : "";
$setter = "<a href='" . make_link("user/" . url_escape($name)) . "'>" . html_escape($name) . "</a>{$h_ip}";
$history_list .= '
<li>
<input type="radio" name="revert" value="' . $current_id . '">
<a href="' . make_link('post/view/' . $image_id) . '">' . $image_id . '</a>:
' . $current_tags . ' (Set by ' . $setter . ')
</li>
';
}
$history_html = $start_string . $history_list . $end_string;
$page->set_title("Global Tag History");
$page->set_heading("Global Tag History");
$page->add_block(new Block("Tag History", $history_html, "main", 10));
$h_prev = $page_number <= 1 ? "Prev" : '<a href="' . make_link('tag_history/all/' . ($page_number - 1)) . '">Prev</a>';
$h_index = "<a href='" . make_link() . "'>Index</a>";
$h_next = '<a href="' . make_link('tag_history/all/' . ($page_number + 1)) . '">Next</a>';
$nav = $h_prev . ' | ' . $h_index . ' | ' . $h_next;
$page->add_block(new Block("Navigation", $nav, "left"));
}
示例8: display_pms
public function display_pms(Page $page, $pms)
{
global $user;
$html = "\n\t\t\t<script type='text/javascript'>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#pms\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t<table id='pms' class='zebra'>\n\t\t\t\t<thead><tr><th>Subject</th><th>From</th><th>Date</th><th>Action</th></tr></thead>\n\t\t\t\t<tbody>";
$n = 0;
foreach ($pms as $pm) {
$oe = $n++ % 2 == 0 ? "even" : "odd";
$h_subject = html_escape($pm->subject);
if (strlen(trim($h_subject)) == 0) {
$h_subject = "(No subject)";
}
$from_name = User::by_id($pm->from_id)->name;
$h_from = html_escape($from_name);
$from_url = make_link("user/" . url_escape($from_name));
$pm_url = make_link("pm/read/" . $pm->id);
$del_url = make_link("pm/delete");
$h_date = html_escape($pm->sent_date);
if ($pm->is_read) {
$h_subject = "<b>{$h_subject}</b>";
}
$html .= "<tr class='{$oe}'><td><a href='{$pm_url}'>{$h_subject}</a></td>\n\t\t\t<td><a href='{$from_url}'>{$h_from}</a></td><td>{$h_date}</td>\n\t\t\t<td><form action='{$del_url}' method='POST'>\n\t\t\t\t<input type='hidden' name='pm_id' value='{$pm->id}'>\n\t\t\t\t" . $user->get_auth_html() . "\n\t\t\t\t<input type='submit' value='Delete'>\n\t\t\t</form></td></tr>";
}
$html .= "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t";
$page->add_block(new Block("Private Messages", $html, "main", 10));
}
示例9: display_events
public function display_events($events)
{
$table = "\n<style>\n.sizedinputs TD INPUT {\n\twidth: 100%;\n}\n</style>\n<table class='zebra'>\n\t<thead>\n\t\t<tr><th>Time</th><th>Module</th><th>User</th><th>Message</th></tr>\n\t\t<form action='" . make_link("log/view") . "' method='GET'>\n\t\t\t<tr class='sizedinputs'>\n\t\t\t\t<td><input type='text' name='time' value='" . $this->heie("time") . "'></td>\n\t\t\t\t<td><input type='text' name='module' value='" . $this->heie("module") . "'></td>\n\t\t\t\t<td><input type='text' name='user' value='" . $this->heie("user") . "'></td>\n\t\t\t\t<td>\n\t\t\t\t\t<select name='priority'>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_DEBUG . "'>Debug</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_INFO . "' selected>Info</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_WARNING . "'>Warning</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_ERROR . "'>Error</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_CRITICAL . "'>Critical</option>\n\t\t\t\t\t</select>\n\t\t\t\t\t<input type='submit' value='Search' style='width: 20%'>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</form>\n\t</thead>\n\t<tbody>\n";
$n = 0;
foreach ($events as $event) {
$oe = $n++ % 2 == 0 ? "even" : "odd";
$c = $this->pri_to_col($event['priority']);
$table .= "<tr style='color: {$c}' class='{$oe}'>";
$table .= "<td>" . str_replace(" ", " ", $event['date_sent']) . "</td>";
$table .= "<td>" . $event['section'] . "</td>";
if ($event['username'] == "Anonymous") {
$table .= "<td>" . $event['address'] . "</td>";
} else {
$table .= "<td><span title='" . $event['address'] . "'>" . "<a href='" . make_link("user/" . url_escape($event['username'])) . "'>" . html_escape($event['username']) . "</a>" . "</span></td>";
}
$table .= "<td>" . $this->scan_entities(html_escape($event['message'])) . "</td>";
$table .= "</tr>\n";
}
$table .= "</tbody></table>";
global $page;
$page->set_title("Event Log");
$page->set_heading("Event Log");
$page->add_block(new NavBlock());
$page->add_block(new Block("Events", $table));
}
示例10: display_pms
public function display_pms(Page $page, $pms)
{
global $user;
$html = "\n\t\t\t<table id='pms' class='zebra sortable'>\n\t\t\t\t<thead><tr><th>R?</th><th>Subject</th><th>From</th><th>Date</th><th>Action</th></tr></thead>\n\t\t\t\t<tbody>";
foreach ($pms as $pm) {
$h_subject = html_escape($pm->subject);
if (strlen(trim($h_subject)) == 0) {
$h_subject = "(No subject)";
}
$from = User::by_id($pm->from_id);
$from_name = $from->name;
$h_from = html_escape($from_name);
$from_url = make_link("user/" . url_escape($from_name));
$pm_url = make_link("pm/read/" . $pm->id);
$del_url = make_link("pm/delete");
$h_date = html_escape($pm->sent_date);
$readYN = "Y";
if (!$pm->is_read) {
$h_subject = "<b>{$h_subject}</b>";
$readYN = "N";
}
$hb = $from->can("hellbanned") ? "hb" : "";
$html .= "<tr class='{$hb}'>\n\t\t\t<td>{$readYN}</td>\n\t\t\t<td><a href='{$pm_url}'>{$h_subject}</a></td>\n\t\t\t<td><a href='{$from_url}'>{$h_from}</a></td><td>{$h_date}</td>\n\t\t\t<td><form action='{$del_url}' method='POST'>\n\t\t\t\t<input type='hidden' name='pm_id' value='{$pm->id}'>\n\t\t\t\t" . $user->get_auth_html() . "\n\t\t\t\t<input type='submit' value='Delete'>\n\t\t\t</form></td>\n\t\t\t</tr>";
}
$html .= "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t";
$page->add_block(new Block("Private Messages", $html, "main", 40, "private-messages"));
}
示例11: display_image
public function display_image(Page $page, Image $image)
{
$data_href = get_base_href();
$ilink = $image->get_image_link();
$fname = url_escape($image->filename);
//Most of the time this will be the title/artist of the song.
$html = "\n\t\t\t<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'\n\t\t\t codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'\n\t\t\t\t\twidth='400' height='15'>\n\t\t\t\t<param name='movie' value='{$data_href}/ext/handle_mp3/xspf_player_slim.swf?song_url={$ilink}'/>\n\t\t\t\t<param name='quality' value='high' />\n\t\t\t\t<embed src='{$data_href}/ext/handle_mp3/xspf_player_slim.swf?song_url={$ilink}&song_title={$fname}' quality='high'\n\t\t\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer'\n\t\t\t\t\twidth='400' height='15'\n\t\t\t\t\ttype='application/x-shockwave-flash'></embed>\n\t\t\t</object>\n\t\t\t<p><a href='{$ilink}'>Download</a>";
$page->add_block(new Block("Music", $html, "main", 10));
}
示例12: display_comment_list
/**
* @param array $images
* @param int $page_number
* @param int $total_pages
* @param bool $can_post
*/
public function display_comment_list($images, $page_number, $total_pages, $can_post)
{
global $config, $page, $user;
$page->disable_left();
// parts for the whole page
$prev = $page_number - 1;
$next = $page_number + 1;
$h_prev = $page_number <= 1 ? "Prev" : "<a href='" . make_link("comment/list/{$prev}") . "'>Prev</a>";
$h_index = "<a href='" . make_link() . "'>Index</a>";
$h_next = $page_number >= $total_pages ? "Next" : "<a href='" . make_link("comment/list/{$next}") . "'>Next</a>";
$nav = "{$h_prev} | {$h_index} | {$h_next}";
$page->set_title("Comments");
$page->set_heading("Comments");
$page->add_block(new Block("Navigation", $nav, "left"));
$this->display_paginator($page, "comment/list", null, $page_number, $total_pages);
// parts for each image
$position = 10;
$comment_captcha = $config->get_bool('comment_captcha');
$comment_limit = $config->get_int("comment_list_count", 10);
foreach ($images as $pair) {
$image = $pair[0];
$comments = $pair[1];
$thumb_html = $this->build_thumb_html($image);
$s = " ";
$un = $image->get_owner()->name;
$t = "";
foreach ($image->get_tag_array() as $tag) {
$u_tag = url_escape($tag);
$t .= "<a href='" . make_link("post/list/{$u_tag}/1") . "'>" . html_escape($tag) . "</a> ";
}
$p = autodate($image->posted);
$r = class_exists("Ratings") ? "<b>Rating</b> " . Ratings::rating_to_human($image->rating) : "";
$comment_html = "<b>Date</b> {$p} {$s} <b>User</b> {$un} {$s} {$r}<br><b>Tags</b> {$t}<p> ";
$comment_count = count($comments);
if ($comment_limit > 0 && $comment_count > $comment_limit) {
//$hidden = $comment_count - $comment_limit;
$comment_html .= "<p>showing {$comment_limit} of {$comment_count} comments</p>";
$comments = array_slice($comments, -$comment_limit);
}
foreach ($comments as $comment) {
$comment_html .= $this->comment_to_html($comment);
}
if ($can_post) {
if (!$user->is_anonymous()) {
$comment_html .= $this->build_postbox($image->id);
} else {
if (!$comment_captcha) {
$comment_html .= $this->build_postbox($image->id);
} else {
$comment_html .= "<a href='" . make_link("post/view/" . $image->id) . "'>Add Comment</a>";
}
}
}
$html = "\n\t\t\t\t<table><tr>\n\t\t\t\t\t<td style='width: 220px;'>{$thumb_html}</td>\n\t\t\t\t\t<td style='text-align: left;'>{$comment_html}</td>\n\t\t\t\t</tr></table>\n\t\t\t";
$page->add_block(new Block(" ", $html, "main", $position++));
}
}
示例13: receive_event
public function receive_event(Event $event)
{
global $config, $database, $page, $user;
if (is_null($this->theme)) {
$this->theme = get_theme_object($this);
}
if (is_a($event, 'PageRequestEvent') && ($event->page_matches("post/prev") || $event->page_matches("post/next"))) {
$image_id = int_escape($event->get_arg(0));
if (isset($_GET['search'])) {
$search_terms = explode(' ', $_GET['search']);
$query = "search=" . url_escape($_GET['search']);
} else {
$search_terms = array();
$query = null;
}
$image = Image::by_id($image_id);
if ($event->page_matches("post/next")) {
$image = $image->get_next($search_terms);
} else {
$image = $image->get_prev($search_terms);
}
if (!is_null($image)) {
$page->set_mode("redirect");
$page->set_redirect(make_link("post/view/{$image->id}", $query));
} else {
$this->theme->display_error($page, "Image not found", "No more images");
}
}
if ($event instanceof PageRequestEvent && $event->page_matches("post/view")) {
$image_id = int_escape($event->get_arg(0));
$image = Image::by_id($image_id);
if (!is_null($image)) {
send_event(new DisplayingImageEvent($image));
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
send_event($iabbe);
ksort($iabbe->parts);
$this->theme->display_admin_block($page, $iabbe->parts);
} else {
$this->theme->display_error($page, "Image not found", "No image in the database has the ID #{$image_id}");
}
}
if ($event instanceof PageRequestEvent && $event->page_matches("post/set")) {
$image_id = int_escape($_POST['image_id']);
send_event(new ImageInfoSetEvent(Image::by_id($image_id)));
$query = $_POST['query'];
$page->set_mode("redirect");
$page->set_redirect(make_link("post/view/{$image_id}", $query));
}
if ($event instanceof DisplayingImageEvent) {
$iibbe = new ImageInfoBoxBuildingEvent($event->get_image(), $user);
send_event($iibbe);
ksort($iibbe->parts);
$this->theme->display_page($page, $event->get_image(), $iibbe->parts);
}
}
示例14: display_page_images
protected function display_page_images(Page $page, $images)
{
if (count($this->search_terms) > 0) {
$query = url_escape(implode(' ', $this->search_terms));
$page->add_block(new Block("Images", $this->build_table($images, "#search={$query}"), "main", 10, "image-list"));
$this->display_paginator($page, "post/list/{$query}", null, $this->page_number, $this->total_pages);
} else {
$page->add_block(new Block("Images", $this->build_table($images, null), "main", 10, "image-list"));
$this->display_paginator($page, "post/list", null, $this->page_number, $this->total_pages);
}
}
示例15: create_edit_html
protected function create_edit_html(WikiPage $page)
{
$h_title = html_escape($page->title);
$u_title = url_escape($page->title);
$i_revision = int_escape($page->revision) + 1;
global $user;
if ($user->is_admin()) {
$val = $page->is_locked() ? " checked" : "";
$lock = "<br>Lock page: <input type='checkbox' name='lock'{$val}>";
} else {
$lock = "";
}
return "\n\t\t\t" . make_form(make_link("wiki_admin/save")) . "\n\t\t\t\t<input type='hidden' name='title' value='{$h_title}'>\n\t\t\t\t<input type='hidden' name='revision' value='{$i_revision}'>\n\t\t\t\t<textarea name='body' style='width: 100%' rows='20'>" . html_escape($page->body) . "</textarea>\n\t\t\t\t{$lock}\n\t\t\t\t<br><input type='submit' value='Save'>\n\t\t\t</form>\n\t\t";
}