* This script is loaded by sections/view.php. * * If this section, or one of its anchor, specifies a specific skin (option keyword '[code]skin_xyz[/code]'), * or a specific variant (option keyword '[code]variant_xyz[/code]'), they are used instead default values. * * @author Bernard Paques * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // loaded from sections/view.php defined('YACS') or exit('Script must be included'); // // rewrite $context['page_details'] because some details have moved to tabs // // do not mention details at follow-up pages, nor to crawlers if (!$zoom_type && !Surfer::is_crawler()) { // one detail per line $text = '<p class="details">'; $details = array(); // add details from the overlay, if any if (is_object($overlay) && ($more = $overlay->get_text('details', $item))) { $details[] = $more; } // restricted to logged members if ($item['active'] == 'R') { $details[] = RESTRICTED_FLAG . i18n::s('Community - Access is granted to any identified surfer'); } // restricted to associates if ($item['active'] == 'N') { $details[] = PRIVATE_FLAG . i18n::s('Private - Access is restricted to selected persons'); }
// load the skin load_skin('categories'); // the path to this page if (is_object($anchor) && $anchor->is_viewable()) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('categories/' => i18n::s('Categories')); } // the title of the page if (is_object($anchor)) { $context['page_title'] = sprintf(i18n::s('Categories for: %s'), $anchor->get_title()); } else { $context['page_title'] = i18n::s('Select categories for this page'); } // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // not found } elseif (!is_object($anchor)) { Safe::header('Status: 404 Not Found', TRUE, 404); Logger::error(i18n::s('No item has been found.')); // permission denied } elseif (!$permitted) { // anonymous users are invited to log in or to register if (!Surfer::is_logged()) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Categories::get_url($member, 'select'))); } // permission denied to authenticated user Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.'));
/** * remember that surfer is joining a meeting * */ function join_meeting() { global $context; // sanity check if (!is_callable(array($this->anchor, 'get_reference'))) { return; } // create a comment only on first join, and if not a robot, and if comments are allowed if (!isset($_SESSION['event_' . $this->anchor->get_reference()]) && !Surfer::is_crawler() && !$this->anchor->has_option('no_comments')) { // track the new participant include_once $context['path_to_root'] . 'comments/comments.php'; $fields = array(); $fields['anchor'] = $this->anchor->get_reference(); $fields['description'] = sprintf(i18n::s('%s has joined the meeting'), Surfer::get_name()); $fields['type'] = 'notification'; Comments::post($fields); } // remember that you joined the event $_SESSION['event_' . $this->anchor->get_reference()] = TRUE; // additional steps only for authenticated users if (!Surfer::get_id()) { return; } // add this page to the watching list of this surfer Members::assign($this->anchor->get_reference(), 'user:'******'path_to_root'] . 'shared/enrolments.php'; enrolments::confirm($this->anchor->get_reference()); }
/** * update surfer presence * * This function is used to track presence information. * Errors are not reported, if any * * @param string web address of visited page * @param string related title * @param string the target anchor, if any * @param string level of visibility for this anchor (e.g., 'Y', 'R' or 'N') */ public static function is_visiting($link, $label, $anchor = NULL, $active = 'Y') { global $context; // don't track crawlers if (Surfer::is_crawler()) { return; } // update the history stack if (!isset($context['pages_without_history']) || $context['pages_without_history'] != 'Y') { // put at top of stack if (!isset($_SESSION['visited'])) { $_SESSION['visited'] = array(); } $_SESSION['visited'] = array_merge(array($link => $label), $_SESSION['visited']); // limit to 20 most recent pages if (count($_SESSION['visited']) > 20) { array_pop($_SESSION['visited']); } } // no anchor to remember if (!$anchor) { return; } // ensure regular operation of the server if (!file_exists($context['path_to_root'] . 'parameters/switch.on')) { return; } // nothing remembered for anonymous surfers if (!Surfer::get_id()) { return; } // we need a GET if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] != 'GET') { return; } // Firefox pre-fetch is not a real visit if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') { return; } // ensure the back-end is there if (!is_callable(array('SQL', 'query'))) { return; } // update the record of the surfer $query = "UPDATE " . SQL::table_name('users') . " SET click_anchor='" . SQL::escape($anchor) . "', click_date='" . gmstrftime('%Y-%m-%d %H:%M:%S') . "'" . " WHERE id = " . SQL::escape(Surfer::get_id()); SQL::query($query, FALSE, $context['users_connection']); // also update recent visits include_once $context['path_to_root'] . 'users/visits.php'; Visits::track($anchor, $active); // job done return; }
/** * build a link * * Accept following variants: * - 'article' - jump to an article page * - 'basic' - a very basic link - also the default * - 'button' - a link that looks like a button * - 'category' - jump to a category page * - 'click' - a button that records clicks * - 'comment' - jump to a comment page * - 'day' - a one day calendar * - 'email' - a mailto: link * - 'edit' - say this link edit a page, for eg. to call overlaid edition * - 'external' - jump to the outside world * - 'file' - see file details * - 'internal' - jump to the outside world, but stay in this window * - 'menu_1' - one top level link ([menu]...[/menu]) * - 'menu_2' - one secondary level link ([submenu]...[/submenu]) * - 'month' - a one month calendar * - 'more' - a follow-up link * - 'open' - open a separate window to display some help * - 'raw' - return only the url * - 'xml' - this has to be processed by a specialized software * - 'script' - see some phpDoc page * - 'section' - jump to a section page * - 'server' - jump to a server profile (news, ftp, etc.) * - 'shortcut' - stay within the site * - 'span' - like 'basic', but insert a <span> around the label * - 'tag' - a folksonomy * - 'tee' - like button, but also reload the current page * - 'user' - a person profile * - 'year' - a full year calendar * * You may define a id attributes to the link by adding #<yourID> to the variant * example : button#foobar * * @link http://www.texastar.com/tips/2004/target_blank.shtml XHTML 1.1 Modularization Anchor Element Target Attribute * * @param string the url, if any * @param string a label, if any * @param string an optional variant, as described above * @param string an optional title to add to the link * @param boolean open the link in a separate page if TRUE * @param string to access this link with keyboard only * @return string the rendered text, or the bare url if $variant = 'raw' **/ public static function &build_link($url, $label = NULL, $variant = NULL, $href_title = NULL, $new_window = FALSE, $access_key = NULL) { global $context; // don't create a link if there is no url - strip everything that begins with '_' if (!$url || !is_string($url) || strpos($url, '_') === 0) { return $label; } // be sure to have a label if (!$label) { $label = $url; } // limit the size of labels when they are links if (!strncmp($label, 'http:', 5) || !strncmp($label, 'https:', 6) || !strncmp($label, 'ftp:', 4)) { if (strlen($label) > 50) { $label = substr_replace($label, '...', 30, -15); } } // more attributes to give to the link $attributes = ''; // check no_follow if (strpos($variant, 'nofollow') !== false) { $variant = trim(str_replace('nofollow', '', $variant)); $attributes .= ' rel="nofollow"'; } // guess the type of this link if (!$variant) { if (!strncmp($url, '/', 1)) { $variant = 'basic'; } elseif (!strncmp($url, 'articles/view.php', 17)) { $variant = 'article'; } elseif (!strncmp($url, 'article-', 8)) { $variant = 'article'; } elseif (!strncmp($url, 'categories/view.php', 19)) { $variant = 'category'; } elseif (!strncmp($url, 'category-', 9)) { $variant = 'category'; } elseif (!strncmp($url, 'comments/view.php', 17)) { $variant = 'comment'; } elseif (!strncmp($url, 'comment-', 8)) { $variant = 'comment'; } elseif (!strncmp($url, 'files/view.php', 14)) { $variant = 'file'; } elseif (!strncmp($url, 'file-', 5)) { $variant = 'file'; } elseif (!strncmp($url, 'images/view.php', 15)) { $variant = 'basic'; } elseif (!strncmp($url, 'image-', 6)) { $variant = 'basic'; } elseif (!strncmp($url, 'locations/view.php', 18)) { $variant = 'location'; } elseif (!strncmp($url, 'location-', 9)) { $variant = 'location'; } elseif (!strncmp($url, 'sections/view.php', 17)) { $variant = 'section'; } elseif (!strncmp($url, 'section-', 8)) { $variant = 'section'; } elseif (!strncmp($url, 'servers/view.php', 16)) { $variant = 'server'; } elseif (!strncmp($url, 'server-', 7)) { $variant = 'server'; } elseif (!strncmp($url, 'tables/view.php', 15)) { $variant = 'table'; } elseif (!strncmp($url, 'table-', 6)) { $variant = 'table'; } elseif (!strncmp($url, 'users/view.php', 14)) { $variant = 'user'; } elseif (!strncmp($url, 'user-', 5)) { $variant = 'user'; } elseif (!strncmp($url, 'mailto:', 7)) { $variant = 'email'; } } elseif ($pos = strpos($variant, '#')) { // separate id from variant if any $attributes .= ' id="' . substr($variant, $pos + 1) . '"'; $variant = substr($variant, 0, $pos); } // open in a separate window if asked explicitly or on file streaming if ($new_window || strpos($url, 'files/stream.php') !== FALSE || strpos($url, 'file-stream/') !== FALSE) { $attributes .= ' onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;"'; } // access key if ($access_key) { $attributes .= ' accesskey="' . $access_key . '"'; } // use the link as-is if ($variant == 'click') { } // force tip display for this link if ($variant == 'tip') { $attributes .= ' class="tip"'; $variant = 'basic'; } // malformed url '//server/path' --> 'http://server/path' if (!strncmp($url, '//', 2)) { $url = 'http:' . $url; } elseif (!preg_match('/^(\\/|[a-zA-Z]+:)/', $url)) { // email address if ($variant == 'email') { $url = 'mailto:' . $url; } elseif ($variant == 'script') { } elseif (!strncmp($url, 'ftp.', 4)) { $url = 'ftp://' . $url; } elseif (!strncmp($url, 'irc.', 4)) { $url = 'irc://' . $url; } elseif (!strncmp($url, 'nntp.', 5) || !strncmp($url, 'news.', 5)) { $url = 'news://' . $url; } elseif (!strncmp($url, 'www.', 4)) { $url = 'http://' . $url; } elseif (!strncmp($url, '#', 1)) { $url = $context['self_url'] . $url; } elseif ($variant != 'external') { $url = $context['url_to_root'] . $url; } } // help crawlers and do not count clicks if (is_callable(array('Surfer', 'is_crawler')) && Surfer::is_crawler()) { $variant = 'basic'; $href_title = ''; // format for a human being } else { // flag external links $external = $variant == 'external'; // if no explict "external" variant but url is absolute, compare // it with all hosted domains to establish if its external or not $matches_ext = array(); if (!$external && preg_match('/.+:\\/\\/(.+)$/', $url, $matches_ext)) { // the url without the protocol, begins after "://" $url_path = $matches_ext[1]; // our host name, at least ! $domains[] = $context['host_name']; // the master host, could be different $domains[] = $context['master_host']; // do we have hosted virtual domains ? consider them also if (isset($context['virtual_domains'])) { $domains = array_merge($domains, $context['virtual_domains']); } // consider the url will not match ... $internal = FALSE; // compare url with each domains foreach ($domains as $domain) { // strncomp = 0 means strings are matching if (!strncmp($url_path, $domain, strlen($domain))) { $internal = TRUE; break; // one matching is enought } } $external = !$internal; } // default tagging for external links if (!$variant && $external) { $variant = 'external'; } // default processing for external links if ($external) { //check we have full link if (!preg_match("/^(?:[a-z]+:)?\\/\\//i", $url)) { $url = "http://" . $url; } // finalize the hovering title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Browse in a separate window')) . '"'; } else { $href_title = ' title="' . encode_field(strip_tags($href_title)) . '"'; } // internal link } else { // finalize the hovering title if ($href_title) { $href_title = ' title="' . encode_field(strip_tags($href_title)) . '"'; } } } // depending on variant switch ($variant) { case 'article': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('View the page')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="article"' . $attributes . '>' . $label . '</a>'; break; case 'basic': $text = '<a href="' . $url . '"' . $href_title . $attributes . '>' . $label . '</a>'; break; case 'button': // always stay in the same window $text = '<a href="' . $url . '"' . $href_title . ' class="button tip" ' . $attributes . '><span>' . $label . '</span></a>'; break; case 'category': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('View the category')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="category"' . $attributes . '>' . $label . '</a>'; break; case 'click': // always count clicks $url = $context['url_to_root'] . 'links/click.php?url=' . urlencode($url); // always open in a separate window $text = '<a href="' . $url . '"' . $href_title . ' class="button tip" onclick="window.open(this.href); return false;"><span>' . $label . '</span></a>'; break; case 'comment': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('View this comment')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="comment"' . $attributes . '>' . $label . '</a>'; break; case 'day': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Daily calendar')) . '"'; } $text = ' <a href="' . $url . '"' . $href_title . ' class="day"' . $attributes . '>' . $label . '</a> '; break; case 'email': // note that mailto: prefix and obscufacation have to be done beforehand // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Send a message')) . '"'; } // use obfuscated reference $text = '<a href="' . $url . '"' . $href_title . ' class="email"' . $attributes . ' rel="nofollow">' . $label . '</a>'; break; case 'external': $text = '<a href="' . $url . '"' . $href_title . ' class="external" ' . $attributes . ' onclick="window.open(this.href); return false;">' . $label . '</a>'; break; case 'file': $text = '<a href="' . $url . '"' . $href_title . ' class="file"' . $attributes . '>' . $label . '</a>'; break; case 'open': // open the link in a side window // open the link in a side window case 'help': // -- obsolete $text = '<a href="' . $url . '"' . $href_title . ' class="help"' . ' onclick="window.open(this.href); return false;"' . ' onkeypress="window.open(this.href); return false;" rel="nofollow"><span>' . $label . '</span></a>'; break; case 'overlaid': // openned by ajax on popup $text = '<a href="' . $url . '"' . $href_title . ' class="open-overlaid"' . $attributes . '>' . $label . '</a>'; break; case 'overlaid-edit': // openned by ajax on popup $text = '<a href="' . $url . '"' . $href_title . ' class="edit-overlaid"' . $attributes . '>' . $label . '</a>'; break; case 'internal': // like external, but stay in the same window // count external clicks // $url = $context['url_to_root'].'links/click.php?url='.urlencode($url); // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('View the page')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="external">' . $label . '</a>'; break; case 'menu_1': $text = MENU_1_PREFIX . '<a href="' . $url . '"' . $href_title . ' class="menu_1"' . $attributes . '><span>' . $label . '</span></a>' . MENU_1_SUFFIX; break; case 'menu_2': $text = MENU_2_PREFIX . '<a href="' . $url . '"' . $href_title . ' class="menu_2"' . $attributes . '><span>' . $label . '</span></a>' . MENU_2_SUFFIX; break; case 'month': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Monthly calendar')) . '"'; } $text = ' <a href="' . $url . '"' . $href_title . ' class="month"' . $attributes . '>' . $label . '</a> '; break; case 'more': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('More')) . '"'; } $text = '<a class="more" href="' . $url . '"' . $href_title . $attributes . '>' . $label . '</a>'; break; case 'next': // add an icon, except if there is already an image if (!preg_match('/<img/i', $label) && defined('NEXT_IMG')) { $label .= NEXT_IMG; } // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Next')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="next"' . $attributes . '>' . $label . '</a>'; break; case 'previous': // add an icon, except if there is already an image if (!preg_match('/<img/i', $label) && defined('PREVIOUS_IMG')) { $label = PREVIOUS_IMG . $label; } // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Previous')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="previous"' . $attributes . '>' . $label . '</a>'; break; case 'raw': $text = $url; break; case 'script': // if we have built the documentation, use it if (file_exists($context['path_to_root'] . 'scripts/reference/footprints.php')) { if ($context['with_friendly_urls'] == 'Y') { $prefix = 'scripts/view.php/'; } else { $prefix = 'scripts/view.php?script='; } $url = $context['url_to_root'] . $prefix . $url; // else look at the reference server } elseif (is_readable($context['path_to_root'] . 'parameters/scripts.include.php')) { include_once $context['path_to_root'] . 'parameters/scripts.include.php'; if (!$context['reference_server']) { $context['reference_server'] = i18n::s('www.yacs.fr'); } // reference server have to be installed at the root $url = 'http://' . $context['reference_server'] . '/scripts/view.php?script=' . $url; // or, ultimately, check our origin server -- reference server have to be installed at the root } else { $url = 'http://www.yacs.fr/scripts/view.php/' . $url; } // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Go to the documentation page')) . '"'; } // a link to the phpdoc page $text = '<a href="' . $url . '"' . $href_title . ' class="script"' . $attributes . ' rel="nofollow">' . $label . '</a>'; break; case 'section': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('View the page')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="section"' . $attributes . '>' . $label . '</a>'; break; case 'server': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('See server profile')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="server"' . $attributes . '>' . $label . '</a>'; break; case 'shortcut': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Shortcut')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="shortcut"' . $attributes . '>' . $label . '</a>'; break; case 'span': $text = '<a href="' . $url . '"' . $href_title . $attributes . '><span>' . $label . '</span></a>'; break; case 'tee': // like button, but also reload the current page and go to another window $text = '<a href="' . $url . '"' . $href_title . ' class="button tip" onclick="window.open(this.href); window.location.reload(); return false;"' . $attributes . '>' . $label . '</a>'; break; case 'idle user': case 'user': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('View person profile')) . '"'; } $text = '<a href="' . $url . '"' . $href_title . ' class="' . $variant . '"' . $attributes . '>' . $label . '</a>'; break; case 'xml': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Provide this link to specialized software, such as a RSS news reader')) . '"'; } Skin::define_img('XML_IMG', 'tools/xml.gif'); $text = '<a href="' . $url . '"' . $href_title . ' class="xml"' . ' onclick="window.open(this.href); return false;"' . ' onkeypress="window.open(this.href); return false;" rel="nofollow">' . XML_IMG . $label . '</a>'; break; case 'year': // a default title if (!$href_title) { $href_title = ' title="' . encode_field(i18n::s('Yearly calendar')) . '"'; } $text = ' <a href="' . $url . '"' . $href_title . ' class="year"' . $attributes . '>' . $label . '</a> '; break; default: if ($variant) { $text = '<a href="' . $url . '"' . $href_title . ' class="' . $variant . '"' . $attributes . '>' . $label . '</a>'; } else { $text = '<a href="' . $url . '"' . $href_title . $attributes . '>' . $label . '</a>'; } break; } // job done return $text; }
/** * check if a anchor with same nickname exist but with a language * better for the current surfer * if yes, redirect surfer to it * * @see articles/view.php, sections/view.php * * @param type $reference of the current item * @param type $nickname of the current item */ public static function check_better_lang($reference, $nickname) { // separate class and id list($class, $id) = explode(":", $reference); // sanity check if (!$id || !$nickname) { return; } // get anchor familly $class = new $class(); $familly = $class->get_static_group_class(); // get item from nickname, will chose best language $anchor = $familly::get($nickname); // compare id, if != the redirect surfer but not crawlers if ($anchor['id'] !== $id && !Surfer::is_crawler()) { $url = $familly::get_permalink($anchor); Safe::redirect($url); } }
/** * process one single HTTP request * * This function removes any PHPSESSID data in the query string, if any * * @return void * * @see agents/referrals_hook.php */ public static function check_request() { global $context; // don't bother with HEAD requests if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'HEAD') { return; } // the target url if (!isset($_SERVER['REQUEST_URI']) || !($url = $_SERVER['REQUEST_URI'])) { return; } // only remember viewed pages and index pages if (!preg_match('/\\/(index|view).php/', $url)) { return; } // continue only if we have a referer if (!isset($_SERVER['HTTP_REFERER']) || !($referer = $_SERVER['HTTP_REFERER'])) { return; } // do not memorize cache referrals if (preg_match('/cache:/i', $referer)) { return; } // block pernicious attacks $referer = strip_tags($referer); // only remember external referrals if (preg_match('/\\b' . preg_quote(str_replace('www.', '', $context['host_name']), '/') . '\\b/i', $referer)) { return; } // stop crawlers if (Surfer::is_crawler()) { return; } // avoid banned sources include_once $context['path_to_root'] . 'servers/servers.php'; if (preg_match(Servers::get_banned_pattern(), $referer)) { return; } // normalize the referral, extract keywords, and domain list($referer, $domain, $keywords) = Referrals::normalize($referer); // if a record exists for this url $query = "SELECT id FROM " . SQL::table_name('referrals') . " AS referrals" . " WHERE referrals.url LIKE '" . SQL::escape($url) . "' AND referrals.referer LIKE '" . SQL::escape($referer) . "'"; if (!($item = SQL::query_first($query))) { return; } // update figures if (isset($item['id'])) { $query = "UPDATE " . SQL::table_name('referrals') . " SET" . " hits=hits+1," . " stamp='" . gmstrftime('%Y-%m-%d %H:%M:%S') . "'" . " WHERE id = " . $item['id']; // create a new record } else { // ensure the referer is accessible if (($content = http::proceed($referer)) === FALSE) { return; } // we have to find a reference to ourself in this page if (strpos($content, $context['url_to_home']) === FALSE) { return; } $query = "INSERT INTO " . SQL::table_name('referrals') . " SET" . " url='" . SQL::escape($url) . "'," . " referer='" . SQL::escape($referer) . "'," . " domain='" . SQL::escape($domain) . "'," . " keywords='" . SQL::escape($keywords) . "'," . " hits=1," . " stamp='" . gmstrftime('%Y-%m-%d %H:%M:%S') . "'"; } // actual database update if (SQL::query($query) === FALSE) { return; } // prune with a probability of 1/100 if (rand(1, 100) != 50) { return; } // purge oldest records -- 100 days = 8640000 seconds $query = "DELETE FROM " . SQL::table_name('referrals') . " WHERE stamp < '" . gmstrftime('%Y-%m-%d %H:%M:%S', time() - 8640000) . "'"; SQL::query($query); }
// set specific headers if (isset($item['introduction']) && $item['introduction']) { $context['page_meta'] = strip_tags(Codes::beautify_introduction($item['introduction'])); } if (isset($item['create_name']) && $item['create_name']) { $context['page_author'] = $item['create_name']; } if (isset($item['edit_date']) && $item['edit_date']) { $context['page_date'] = $item['edit_date']; } } // // page details -- $context['page_details'] // // do not mention details to crawlers if (!Surfer::is_crawler() && $whole_rendering) { // tags, if any if (isset($item['tags'])) { $context['page_tags'] =& Skin::build_tags($item['tags']); } // one detail per line $context['page_details'] .= '<p class="details">'; $details = array(); // add details from the overlay, if any if (is_object($overlay) && ($more = $overlay->get_text('details', $item))) { $details[] = $more; } // the capability field is displayed only to logged users if (!Surfer::is_logged()) { } elseif ($item['capability'] == 'A') { $details[] = i18n::s('Associate');
* @author Alexis Raimbault * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once '../shared/global.php'; // ensure browser always look for fresh data http::expire(0); // lang i18n::bind('files'); // stop here on scripts/validate.php if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'HEAD') { return; } // stop if forbidden if (Surfer::is_crawler() || !Surfer::may_upload()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); die(i18n::s('You are not allowed to perform this operation.')); } // some input is mandatory if (!isset($_REQUEST['name'])) { Safe::header('Status: 400 Bad Request', TRUE, 400); outputJSON(i18n::s('Request is invalid.')); } else { $name = $_REQUEST['name']; } $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; // Output JSON function outputJSON($msg, $status = 'error', $preview = '') { global $context;