/** * Append notice that the site is currently in maintenance mode offering a link * to switch to live mode if no other alert is set. * * @param array $context * delegate context */ public function __appendAlert($context) { // Site in maintenance mode if (Symphony::Configuration()->get('enabled', 'maintenance_mode') == 'yes') { Administration::instance()->Page->pageAlert(__('This site is currently in maintenance mode.') . ' <a href="' . SYMPHONY_URL . '/system/preferences/?action=toggle-maintenance-mode&redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>', Alert::NOTICE); } }
function printPageListWithNavAlt($prevtext, $nexttext, $nextprev = true, $class = NULL, $id = "pagelist") { echo "<div" . ($id ? " id=\"{$id}\"" : "") . " class=\"{$class}\">"; $total = getTotalPages(); $current = getCurrentPage(); echo "\n<ul class=\"{$class}\"><li>[</li>"; for ($i = 1; $i <= $total; $i++) { echo "\n <li" . ($i == $current ? " class=\"current\"" : "") . ">"; printLinkHTML(getPageURL($i), $i, "Page {$i}" . ($i == $current ? " (Current Page)" : "")); echo "</li>"; } echo "\n<li>]</li>"; if ($nextprev) { echo "\n <li class=\"prev\">"; printPrevPageURL($prevtext, "Previous Page"); echo "</li>"; } echo "\n<li></li>"; if ($nextprev) { echo "\n <li class=\"next\">"; printNextPageURL($nexttext, "Next Page"); echo "</li>"; } echo "\n</ul>"; echo "\n</div>\n"; }
function showPagination($params) { if ($params['totalRows'] >= 1) { $currentPage = getCurrentPage(); $recordsPerPage = isset($params['recordsPerPage']) ? trim($params['recordsPerPage']) : 10; $range = isset($params['range']) ? $params['range'] : 5; // count all lines in the database to calculate total pages $totalPges = ceil($params['totalRows'] / $recordsPerPage); // display links to 'range of pages' around 'current page' $initialNum = $currentPage - $range; $conditionLimitNum = $currentPage + $range + 1; echo "<nav><ul class=\"pagination pagination-sm\">"; // button for first page if ($currentPage > 1) { echo "<li><a href=\"{$params['url']}\" title=\"Ir para primeira página.\"> << </a></li>"; } for ($x = $initialNum; $x < $conditionLimitNum; $x++) { // be sure '$x is greater than 0' AND 'less than or equal to the $totalPges' if ($x > 0 && $x <= $totalPges) { // current page if ($x == $currentPage) { echo "<li class=\"active\"><a href=\"#\">{$x} <span class=\"sr-only\">(current)</span></a></li>"; } else { // not current page echo "<li><a href=\"{$params['url']}?page={$x}\">{$x}</a></li>"; } } } // button for last page if ($currentPage < $totalPges) { echo "<li><a href=\"" . $params['url'] . "?page={$totalPges}\" title=\"Last page is {$totalPges}.\"> >> </a></li>"; } echo "</ul></nav>"; } }
function action() { ##Do not proceed if the config file is read only if (!is_writable(CONFIG)) { redirect($this->_Parent->getCurrentPageURL()); } ### # Delegate: CustomActions # Description: This is where Extensions can hook on to custom actions they may need to provide. $this->_Parent->ExtensionManager->notifyMembers('CustomActions', getCurrentPage()); if (isset($_POST['action']['save'])) { $settings = $_POST['settings']; ### # Delegate: Save # Description: Saving of system preferences. $this->_Parent->ExtensionManager->notifyMembers('Save', getCurrentPage(), array('settings' => &$settings, 'errors' => &$this->_errors)); if (!is_array($this->_errors) || empty($this->_errors)) { foreach ($settings as $set => $values) { foreach ($values as $key => $val) { $this->_Parent->Configuration->set($key, $val, $set); } } $this->_Parent->saveConfig(); redirect($this->_Parent->getCurrentPageURL()); } } }
function renderer_json($mode) { if (strtolower($mode) == 'administration') { throw new Lib\Exceptions\InvalidModeException('JSON Renderer launcher is only available on the frontend'); } $renderer = Frontend::instance(); // Check if we should enable exception debug information $exceptionDebugEnabled = Symphony::isLoggedIn(); // Use the JSON exception and error handlers instead of the Symphony one. Lib\ExceptionHandler::initialise($exceptionDebugEnabled); Lib\ErrorHandler::initialise($exceptionDebugEnabled); // #1808 if (isset($_SERVER['HTTP_MOD_REWRITE'])) { throw new Exception("mod_rewrite is required, however is not enabled."); } $output = $renderer->display(getCurrentPage()); cleanup_session_cookies(); if (in_array('JSON', Frontend::Page()->pageData()['type'])) { // Load the output into a SimpleXML Container and convert to JSON try { $xml = new SimpleXMLElement($output, LIBXML_NOCDATA); // Convert the XML to a plain array. This step is necessary as we cannot // use JSON_PRETTY_PRINT directly on a SimpleXMLElement object $outputArray = json_decode(json_encode($xml), true); // Get the transforer object ready. Other extensions will // add their transormations to this. $transformer = new Lib\Transformer(); /** * Allow other extensions to add their own transformers */ Symphony::ExtensionManager()->notifyMembers('APIFrameworkJSONRendererAppendTransformations', '/frontend/', ['transformer' => &$transformer]); // Apply transformations $outputArray = $transformer->run($outputArray); // Now put the array through a json_encode $output = json_encode($outputArray, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); } catch (\Exception $e) { // This happened because the input was not valid XML. This could // occur for a few reasons, but there are two scenarios // we are interested in. // 1) This is a devkit page (profile, debug etc). We want the data // to be passed through and displayed rather than converted into // JSON. There is no easy way in Symphony to tell if a devkit has // control over the page, so instead lets inspect the output for // any signs a devkit is rendering the page. // 2) It is actually bad XML. In that case we need to let the error // bubble through. // Currently the easiest method is to check for the devkit.min.css // in the output. This may fail in the furture if this file is // renamed or moved. if (!preg_match("@\\/symphony\\/assets\\/css\\/devkit.min.css@", $output)) { throw $e; } } } echo $output; return $renderer; }
public function __appendAlert($context) { if (!is_null($context['alert'])) { return; } if ($this->_Parent->Configuration->get('enabled', 'maintenance_mode') == 'yes') { Administration::instance()->Page->pageAlert(__('This site is currently in maintenance mode.') . ' <a href="' . URL . '/symphony/system/preferences/?action=toggle-maintenance-mode&redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>', Alert::NOTICE); } }
function getNextLink() { $paged = getCurrentPage(); if ($paged === getMaxPage()) { echo '#'; } else { echo getPageLink($paged + 1); } }
public function __appendAlert($context){ if(Symphony::Configuration()->get('enabled', 'readonly_mode') == 'yes'){ $text = __('This site is currently in readonly mode.'); if($this->isDeveloper()) $text .= ' <a href="' . SYMPHONY_URL . '/system/preferences/?action=toggle-readonly-mode&redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>'; Administration::instance()->Page->pageAlert($text, Alert::NOTICE); } }
/** * Fonction permettant la récupération du fichier de configuration * @return array associatif dont les clés, sont les sections */ function getConfigFile() { $page = getCurrentPage(); $isIndex = ($page == '' or $page == "index"); if ($isIndex) { return parse_ini_file("config.ini.php", true); } else { return parse_ini_file("../config.ini.php", true); } }
static function printNavigation($prevtext, $nexttext, $oneImagePage = false, $navlen = 7, $firstlast = true) { $total = getTotalPages($oneImagePage); $current = getCurrentPage(); if ($total < 2) { $class .= ' disabled_nav'; } if ($navlen == 0) { $navlen = $total; } $extralinks = 2; if ($firstlast) { $extralinks += 2; } $len = floor(($navlen - $extralinks) / 2); $j = max(round($extralinks / 2), min($current - $len - (2 - round($extralinks / 2)), $total - $navlen + $extralinks - 1)); $ilim = min($total, max($navlen - round($extralinks / 2), $current + floor($len))); $k1 = round(($j - 2) / 2) + 1; $k2 = $total - round(($total - $ilim) / 2); if ($firstlast) { echo '<div class="nav-cell ' . ($current == 1 ? 'current' : 'first') . '">'; echo "<span class='valign'>"; printLink(getPageURL(1, $total), 1, "Page 1"); echo "</span></div>\n"; if ($j > 2) { echo '<div class="nav-cell">'; echo "<span class='valign'>"; printLink(getPageURL($k1, $total), $j - 1 > 2 ? '...' : $k1, "Page {$k1}"); echo "</span></div>\n"; } } for ($i = $j; $i <= $ilim; $i++) { echo '<div class="nav-cell' . ($i == $current ? " current" : "") . '">'; echo "<span class='valign'>"; printLink(getPageURL($i, $total), $i, "Page {$i}" . ($i == $current ? ' ' . gettext("(Current Page)") : "")); echo "</span></div>\n"; } if ($i < $total) { echo '<div class="nav-cell">'; echo "<span class='valign'>"; printLink(getPageURL($k2, $total), $total - $i > 1 ? '...' : $k2, "Page {$k2}"); echo "</span></div>\n"; } if ($firstlast && $i <= $total) { echo '<div class="nav-cell last">'; echo "<span class='valign'>"; printLink(getPageURL($total, $total), $total, "Page {$total}"); echo "</span></div>\n"; } $prevNextLinks = array(); $prevNextLinks['prev'] = ThemeUtil::getLink(getPrevPageURL(), $prevtext) . "\n"; $prevNextLinks['next'] = ThemeUtil::getLink(getNextPageURL(), $nexttext) . "\n"; return $prevNextLinks; }
public function __construct(View $view) { parent::__construct(); $this->document = new HTMLDocument(); $this->view = $view; $this->data = (object) array(); $this->url = new URLWriter(URL . getCurrentPage(), $_GET); // Remove symphony parameters: unset($this->url->parameters()->{'symphony-page'}); unset($this->url->parameters()->{'symphony-renderer'}); }
function GalleryController() { global $_zp_gallery; zp_load_page(); $this->requestedPage = getCurrentPage() >= 1 ? getCurrentPage() : 1; if (!isset($_zp_gallery)) { load_gallery(); } list($album, $image) = rewrite_get_album_image('album', 'image'); $this->setAlbum($album); $this->setImage($image); }
/** * Fields requests, routes them to appropriate View, returns output */ public function renderView() { // Set URL $this->url = getCurrentPage(); // Create view $this->View = $this->createView(); // Initialize View $this->View->load($this->url); // Initialize context $this->initializeContext(); // Tell the view to build its output $output = $this->View->buildOutput(); return $output; }
function smarty_function_reportPages($params, &$smarty) { /* parameter total_results(integer,requrired): total number of results parameter file_path(string,optional): set the file path that will be used in page urls parameter pages_to_show(integer,optional): set number of pages we want to show the user on page select, default 12 */ $url_params = convertRequestToUrl(array("page")); $file_path = isset($params["file_path"]) ? $params["file_path"] : $_SERVER["PHP_SELF"]; $pages_to_show = isset($params["pages_to_show"]) ? (int) $params["pages_to_show"] : 12; $total_pages = calcTotalPages($params["total_results"], getRPP()); $cur_page = min(getCurrentPage(), $total_pages); $link = "{$file_path}?{$url_params}"; $pages = createReportPagesArray($link, $cur_page, $total_pages, $pages_to_show); return createReportPagesTable($pages, $cur_page, $link, $total_pages); }
/** * Redirects user to login and if he logged he will be returned to where this was calles * @param String $paramTo To what should he be redirected? (OPTIONAL) */ public static function promptAuth($paramTo = null) { if (getUser() != null) { return; } if ($paramTo != null) { header("Location: " . orongoURL('orongo-login.php?redirect=' . $paramTo)); exit; } if (!function_exists('getCurrentPage')) { header("Location: " . orongoURL('orongo-login.php')); exit; } $currentPage = str_replace("admin_", "orongo-admin/", getCurrentPage()) . '.php'; header("Location: " . orongoURL('orongo-login.php?redirect=' . $currentPage)); exit; }
public function __construct($args) { $authKey = $args['auth_key']; $this->settings = Plugin::getSettings($authKey); //Hook terminal plugin if (!isset($this->settings["use_terminal"])) { $this->settings["use_terminal"] = true; } if ($this->settings["use_terminal"]) { if (!file_exists("OrongoAuthTerminal.php")) { throw new Exception("Terminal plugin missing!"); } Plugin::hookTerminalPlugin(new OrongoAuthTerminal($this->settings)); } if (getCurrentPage() == "orongo-login" && isset($_SERVER['orongo-auth-app-name']) && isset($_SERVER['orongo-auth-app-desc']) && isset($_SERVER['orongo-auth-app-website']) && isset($_SERVER['orongo-auth-time'])) { } }
public function getArticlesHTML($paramArticles) { $generatedHTML = ""; $curPage = getCurrentPage(); if (is_array($paramArticles) == false) { return null; } //Sup, Orongo? U nooo pass me an array :( $count = count($paramArticles); if ($count < 1) { return "<p>No articles we're found</p>"; } $generatedCount = 0; foreach ($paramArticles as $article) { $last = false; if ($article instanceof Article == false) { continue; } $generatedCount++; if ($generatedCount == 4 && $curPage == 'index') { $last = true; } if (is_int($generatedCount / 4) && $curPage == 'archive') { $last = true; } if ($curPage == 'archive' && $last == false && $generatedCount == count($paramArticles)) { $last = true; } $generatedHTML .= '<div class="one_fourth '; if ($last) { $generatedHTML .= 'column-last'; } $generatedHTML .= ' ">'; $generatedHTML .= '<a href="' . Settings::getWebsiteURL() . 'article.php?id=' . $article->getID() . '"><h3>' . $article->getTitle() . '</h3></a>'; $generatedHTML .= '<p>' . substr(strip_tags($article->getContent()), 0, 500) . '</p>'; $generatedHTML .= '</div>'; if ($last && $curPage == 'index') { break; } } return $generatedHTML; }
/** * Helper function to build Cache information block * * @param XMLElement $wrapper * @param Cacheable $cache * @param string $cache_id */ public static function buildCacheInformation(XMLElement $wrapper, Cacheable $cache, $cache_id) { $cachedData = $cache->check($cache_id); if (is_array($cachedData) && !empty($cachedData) && time() < $cachedData['expiry']) { $a = Widget::Anchor(__('Clear now'), SYMPHONY_URL . getCurrentPage() . 'clear_cache/'); $wrapper->appendChild(new XMLElement('p', __('Cache expires in %d minutes. %s', array(($cachedData['expiry'] - time()) / 60, $a->generate(false))), array('class' => 'help'))); } else { $wrapper->appendChild(new XMLElement('p', __('Cache has expired or does not exist.'), array('class' => 'help'))); } }
/** * Receive all the posts from the articles manager, check it, then save it. * Finally the articles are prepared and the template loaded. */ function PortaMx_AdminArticles() { global $smcFunc, $pmxCacheFunc, $context, $sourcedir, $scripturl, $modSettings, $user_info, $txt; $admMode = isset($_GET['action']) ? $_GET['action'] : ''; // fix the linktree if ($admMode == 'admin') { foreach ($context['linktree'] as $key => $data) { if (strpos($data['url'], 'pmx_articles') !== false) { $context['linktree'] = array_merge(array_slice($context['linktree'], 0, $key), array(array('url' => $scripturl . '?action=admin;area=pmx_center;' . $context['session_var'] . '=' . $context['session_id'], 'name' => $txt['pmx_extension'])), array_slice($context['linktree'], $key, count($context['linktree']) - $key)); break; } } } if (($admMode == 'admin' || $admMode == 'portamx') && isset($_GET['area']) && $_GET['area'] == 'pmx_articles') { if (allowPmx('pmx_admin, pmx_articles, pmx_create')) { require_once $context['pmx_sourcedir'] . 'AdminSubs.php'; $context['pmx']['subaction'] = !empty($_POST['sa']) ? $_POST['sa'] : 'overview'; // From template ? if (PortaMx_checkPOST()) { // Make sure we have a valid session... checkSession('post'); // get current pageindex if (isset($_POST['articlestart'])) { $context['pmx']['articlestart'] = $_POST['articlestart']; } // actions from overview? if ($context['pmx']['subaction'] == 'overview' && empty($_POST['cancel_overview'])) { // from xml on overview? if (isset($_POST['xml'])) { $xmlResult = ''; } // filter set ? if (isset($_POST['filter'])) { $_SESSION['PortaMx']['filter'] = $_POST['filter']; } // Row pos updates from overview? if (!empty($_POST['upd_rowpos'])) { list($fromID, $place, $idto) = Pmx_StrToArray($_POST['upd_rowpos']); $request = $smcFunc['db_query']('', ' SELECT id FROM {db_prefix}portamx_articles WHERE id ' . ($place == 'before' ? '<' : '>') . ' {int:id} LIMIT 1', array('id' => $idto)); list($toID) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); $toID = is_null($toID) ? $place == 'before' ? -1 : 0 : $toID; $request = $smcFunc['db_query']('', ' SELECT MAX(id) +1 FROM {db_prefix}portamx_articles', array()); list($maxID) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); // create the query... if ($toID == -1) { // move from to first $query = array('SET id = 0 WHERE id = ' . $fromID, 'SET id = id + 1 WHERE id >= 1 AND id <= ' . $fromID, 'SET id = 1 WHERE id = 0'); } elseif ($toID == 0) { // move from to end $query = array('SET id = ' . $maxID . ' WHERE id = ' . $fromID, 'SET id = id - 1 WHERE id >= ' . $fromID); } elseif ($toID > $fromID) { // to > from - move to after from $query = array('SET id = id + 1 WHERE id >= ' . $toID, 'SET id = ' . $toID . ' WHERE id = ' . $fromID, 'SET id = id - 1 WHERE id >= ' . $fromID); } else { // to < from - move to before from $query = array('SET id = 0 WHERE id = ' . $fromID, 'SET id = id + 1 WHERE id >= ' . $toID . ' AND id <= ' . $fromID, 'SET id = ' . $toID . ' WHERE id = 0'); } // execute foreach ($query as $qdata) { $smcFunc['db_query']('', 'UPDATE {db_prefix}portamx_articles ' . $qdata, array()); } } // updates from overview popups ? if (!empty($_POST['upd_overview'])) { $updates = array(); foreach ($_POST['upd_overview'] as $updkey => $updvalues) { foreach ($updvalues as $id => $values) { if ($updkey == 'title') { foreach ($values as $key => $val) { if ($key == 'lang') { foreach ($val as $langname => $langvalue) { $updates[$id]['config'][$updkey][$langname] = $langvalue; } } else { $updates[$id]['config'][$updkey . '_' . $key] = $val; } } } else { $updates[$id][$updkey] = $values; } } } // save all updates $idList = array(); $catList = array(); foreach ($updates as $id => $values) { $idList[] = $id; foreach ($values as $rowname => $data) { $request = $smcFunc['db_query']('', ' SELECT config, catid, acsgrp FROM {db_prefix}portamx_articles WHERE id = {int:id}', array('id' => $id)); $row = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); $catList[] = $row['catid']; // update config if ($rowname == 'config') { $cfg = unserialize($row['config']); foreach ($data as $ckey => $cval) { if ($ckey == 'title') { foreach ($cval as $lang => $val) { $cfg[$ckey][$lang] = $val; } } else { $cfg[$ckey] = $cval; } } $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_articles SET config = {string:config} WHERE id = {int:id}', array('id' => $id, 'config' => serialize($cfg))); } elseif ($rowname == 'category') { $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_articles SET catid = {int:val} WHERE id = {int:id}', array('id' => $id, 'val' => $data)); } else { $mode = substr($rowname, 0, 3); // update (replace) if ($mode == 'upd') { $newacs = explode(',', $data); } elseif ($mode == 'add') { $newacs = array_unique(array_merge(explode(',', $row['acsgrp']), explode(',', $data))); } else { $newacs = array_unique(array_diff(explode(',', $row['acsgrp']), explode(',', $data))); } $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_articles SET acsgrp = {string:val} WHERE id = {int:id}', array('id' => $id, 'val' => implode(',', $newacs))); // send by xml? if (isset($_POST['xml'])) { $request = $smcFunc['db_query']('', ' SELECT active FROM {db_prefix}portamx_articles WHERE id = {int:id}', array('id' => $id)); list($active) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); $acsnew = implode(',', $newacs); $xmlResult .= (!empty($xmlResult) ? '&' : '') . $id . '|' . $acsnew . '|' . count($newacs) . '|' . intval(allowPmxGroup($newacs)) . '|' . (!empty($active) ? '1' : '0'); } } } } // clear cached blocks && Cat/Art Session Keys $pmxCacheFunc['clean'](); if (isset($_SESSION['PortaMx'])) { foreach ($_SESSION['PortaMx'] as $key => $val) { if (strpos($key, 'pmxpost_') !== false) { unset($_SESSION['PortaMx'][$key]); } } } if (isset($_POST['xml'])) { // return update result ob_start(); if (!empty($_POST['result'])) { echo $_POST['result']; } else { echo $xmlResult; } ob_end_flush(); exit; } } // add a new article if (!empty($_POST['add_new_article'])) { $article = PortaMx_getDefaultArticle($_POST['add_new_article']); $context['pmx']['subaction'] = 'editnew'; } elseif (!empty($_POST['edit_article']) || !empty($_POST['clone_article'])) { $id = !empty($_POST['clone_article']) ? $_POST['clone_article'] : $_POST['edit_article']; // load the article for edit/clone $request = $smcFunc['db_query']('', ' SELECT * FROM {db_prefix}portamx_articles WHERE id = {int:id}', array('id' => $id)); $row = $smcFunc['db_fetch_assoc']($request); $article = array('id' => $row['id'], 'name' => $row['name'], 'catid' => $row['catid'], 'acsgrp' => $row['acsgrp'], 'ctype' => $row['ctype'], 'config' => $row['config'], 'content' => $row['content'], 'active' => $row['active'], 'owner' => $row['owner'], 'created' => $row['created'], 'approved' => $row['approved'], 'approvedby' => $row['approvedby'], 'updated' => $row['updated'], 'updatedby' => $row['updatedby']); $smcFunc['db_free_result']($request); if (!empty($_POST['clone_article'])) { $article['id'] = 0; $article['active'] = 0; $article['approved'] = 0; $article['owner'] = $user_info['id']; $article['created'] = 0; $article['updated'] = 0; $article['updatedby'] = 0; $context['pmx']['subaction'] = 'editnew'; } else { $context['pmx']['subaction'] = 'edit'; } } elseif (!empty($_POST['delete_article'])) { $delid = $_POST['delete_article']; // get the current page $context['pmx']['articlestart'] = getCurrentPage($delid, $context['pmx']['settings']['manager']['artpage'], true); $smcFunc['db_query']('', ' DELETE FROM {db_prefix}portamx_articles WHERE id = {int:id}', array('id' => $delid)); // clear cached blocks $pmxCacheFunc['clean'](); } elseif (!empty($_POST['chg_approved'])) { $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_articles SET approved = CASE WHEN approved = 0 THEN {int:apptime} ELSE 0 END, approvedby = {int:appmember} WHERE id = {int:id}', array('id' => $_POST['chg_approved'], 'apptime' => forum_time(), 'appmember' => $user_info['id'])); // clear cached blocks $pmxCacheFunc['clean'](); } elseif (!empty($_POST['chg_active'])) { $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_articles SET active = CASE WHEN active = 0 THEN {int:apptime} ELSE 0 END WHERE id = {int:id}', array('id' => $_POST['chg_active'], 'apptime' => forum_time())); // clear cached blocks $pmxCacheFunc['clean'](); } if (isset($_POST['xml']) && (!empty($_POST['chg_active']) || !empty($_POST['chg_approved']))) { $id = !empty($_POST['chg_active']) ? $_POST['chg_active'] : $_POST['chg_approved']; $request = $smcFunc['db_query']('', ' SELECT active, approved FROM {db_prefix}portamx_articles WHERE id = {int:id}', array('id' => $id)); list($active, $approved) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); // return update result ob_start(); echo $id . ',' . (!empty($_POST['chg_active']) ? intval(!empty($active)) : intval(!empty($approved))); ob_end_flush(); exit; } } elseif (!empty($_POST['cancel_edit']) || !empty($_POST['cancel_overview'])) { // called fron blocks move/clone ? if (!empty($_POST['fromblock'])) { // on cancel after saved remove the article if ($_POST['sa'] == 'edit' && !empty($_POST['id'])) { $smcFunc['db_query']('', ' DELETE FROM {db_prefix}portamx_articles WHERE id = {int:id}', array('id' => $_POST['id'])); $pmxCacheFunc['clean'](); } // redirect back to the blocks manager @(list($mode, $side, $bid) = explode('.', $_POST['fromblock'])); redirectexit('action=' . $admMode . ';area=pmx_blocks;sa=' . $side . ';' . $context['session_var'] . '=' . $context['session_id']); } // Otherwise let's load the overview $context['pmx']['subaction'] = 'overview'; } elseif ($context['pmx']['subaction'] == 'editnew' || $context['pmx']['subaction'] == 'edit') { $context['pmx']['fromblock'] = $_POST['fromblock']; // check defined numeric vars (check_num_vars holds the posted array to check like [varname][varname] ...) if (isset($_POST['check_num_vars'])) { foreach ($_POST['check_num_vars'] as $val) { $data = explode(',', $val); $post = '$_POST' . str_replace(array('[', ']'), array('[\'', '\']'), $data[0]); if (eval("return isset({$post});") && eval("return !is_numeric({$post});")) { eval("{$post} = {$data['1']};"); } } } if (isset($_POST['content']) && PortaMx_makeSafeContent($_POST['content']) != '') { // convert html/script to bbc if ($_POST['ctype'] == 'bbc_script' && in_array($_POST['contenttype'], array('html', 'script'))) { $_POST['content'] = PortaMx_SmileyToBBC($_POST['content']); if (preg_match_all('/<img.*(style[^\\"]*\\"([^\\"]*\\"))[^>]*>/U', $_POST['content'], $match) > 0) { foreach ($match[0] as $key => $val) { $repl = ' ' . str_replace(array('"', ': ', ':', 'px;'), array('', '="', '="', '" '), $match[2][$key]); $_POST['content'] = str_replace($val, str_replace($match[1][$key], $repl, $val), $_POST['content']); } } require_once $sourcedir . '/Subs-Editor.php'; $modSettings['smiley_enable'] = true; $user_info['smiley_set'] = 'PortaMx'; $_POST['content'] = html_to_bbc($_POST['content']); } elseif ($_POST['contenttype'] == 'bbc_script' && in_array($_POST['ctype'], array('html', 'script'))) { $_POST['content'] = PortaMx_BBCsmileys(parse_bbc(PortaMx_makeSafeContent($_POST['content'], $_POST['contenttype']), false)); $_POST['content'] = str_replace(array('<hr>', '<br>'), array('<hr />', '<br />'), $_POST['content']); $_POST['content'] = preg_replace_callback('/<\\/[^>]*>|<[^\\/]*\\/>|<ul[^>]*>|<ol[^>]*>/', create_function('$matches', 'return $matches[0] ."\\n";'), $_POST['content']); if (preg_match_all('/<img[^w]*(width=\\"([0-9]+)\\")(\\sheight=\\"([\\s0-9]+)\\")[^>]*>/', $_POST['content'], $match) > 0) { foreach ($match[0] as $key => $val) { $_POST['content'] = str_replace($match[1][$key], '', $_POST['content']); $_POST['content'] = str_replace($match[3][$key], 'style="width: ' . $match[2][$key] . 'px;height: ' . $match[4][$key] . 'px;"', $_POST['content']); } $_POST['content'] = preg_replace('/px;"[^c]*class=/', 'px;" class=', $_POST['content']); } } elseif ($_POST['ctype'] == 'php' && $_POST['contenttype'] == 'php') { pmxPHP_convert(); } elseif ($_POST['ctype'] == 'html' && $_POST['contenttype'] == 'html') { $_POST['content'] = str_replace('/ckeditor/../Smileys/', '/Smileys/', $_POST['content']); if (preg_match_all('~<img.*(class[^r]*resized[^\\"]*\\")[^>]*>~', $_POST['content'], $match) > 0) { foreach ($match[0] as $key => $val) { $endChr = substr($val, -2) !== '/>' ? array('>', '/>') : array(' />', '/>'); $repl = str_replace($match[1][$key], '', $val); $_POST['content'] = str_replace($val, str_replace($endChr[0], ' class="bbc_img resized"' . $endChr[1], $repl), $_POST['content']); } } elseif (preg_match_all('~<img[^>]*>~', $_POST['content'], $match) > 0) { foreach ($match[0] as $key => $val) { $endChr = substr($val, -2) !== ' />' ? array('>', '/>') : array(' />', '/>'); if (strpos($val, '/Smileys/') === false) { $_POST['content'] = str_replace($val, str_replace($endChr[0], ' class="bbc_img resized"' . $endChr[1], $val), $_POST['content']); } } } } } // get all data $article = array('id' => $_POST['id'], 'name' => $_POST['name'], 'catid' => $_POST['catid'], 'acsgrp' => !empty($_POST['acsgrp']) ? implode(',', $_POST['acsgrp']) : '', 'ctype' => $_POST['ctype'], 'config' => serialize($_POST['config']), 'content' => $_POST['content'], 'active' => $_POST['active'], 'owner' => $_POST['owner'], 'created' => $_POST['created'], 'approved' => $_POST['approved'], 'approvedby' => $_POST['approvedby'], 'updated' => $_POST['updated'], 'updatedby' => $_POST['updatedby']); // save article if have content.. if (!empty($article['content']) && empty($_POST['edit_change']) && (!empty($_POST['save_edit']) || !empty($article['content']) && !empty($_POST['save_edit_continue']))) { // if new article get the last id if ($context['pmx']['subaction'] == 'editnew') { $request = $smcFunc['db_query']('', ' SELECT MAX(id) FROM {db_prefix}portamx_articles', array()); list($dbid) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); $article['id'] = strval(1 + ($dbid === null ? $article['id'] : $dbid)); $article['created'] = forum_time(); // auto approve for admins if (allowPmx('pmx_admin')) { $article['approved'] = forum_time(); $article['approvedby'] = $user_info['id']; } // insert new article $smcFunc['db_insert']('ignore', ' {db_prefix}portamx_articles', array('id' => 'int', 'name' => 'string', 'catid' => 'int', 'acsgrp' => 'string', 'ctype' => 'string', 'config' => 'string', 'content' => 'string', 'active' => 'int', 'owner' => 'int', 'created' => 'int', 'approved' => 'int', 'approvedby' => 'int', 'updated' => 'int', 'updatedby' => 'int'), $article, array()); // clear cache $pmxCacheFunc['clean'](); } else { $article['updated'] = forum_time(); $article['updatedby'] = $user_info['id']; // update the article $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_articles SET name = {string:name}, catid = {int:catid}, acsgrp = {string:acsgrp}, ctype = {string:ctype}, config = {string:config}, content = {string:content}, active = {int:active}, owner = {int:owner}, created = {int:created}, approved = {int:approved}, approvedby = {int:approvedby}, updated = {int:updated}, updatedby = {int:updatedby} WHERE id = {int:id}', array('id' => $article['id'], 'name' => $article['name'], 'catid' => $article['catid'], 'acsgrp' => $article['acsgrp'], 'ctype' => $article['ctype'], 'config' => $article['config'], 'content' => $article['content'], 'active' => $article['active'], 'owner' => $article['owner'], 'created' => $article['created'], 'approved' => $article['approved'], 'approvedby' => $article['approvedby'], 'updated' => $article['updated'], 'updatedby' => $article['updatedby'])); } // clear cache $pmxCacheFunc['clean'](); $context['pmx']['subaction'] = 'edit'; } // continue edit ? if (!empty($_POST['save_edit']) || !empty($_POST['save_edit_continue'])) { if (empty($_POST['save_edit_continue'])) { // edit done, is it a move/clone from blocks? if (!empty($context['pmx']['fromblock'])) { @(list($mode, $side, $bid) = explode('.', $context['pmx']['fromblock'])); // was block moved? if ($mode == 'move') { $request = $smcFunc['db_query']('', ' SELECT pos, blocktype FROM {db_prefix}portamx_blocks WHERE id = {int:bid}', array('bid' => $bid)); $block = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); // update all pos >= moved id $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_blocks SET pos = pos - 1 WHERE side = {string:side} AND pos >= {int:pos}', array('side' => $side, 'pos' => $block['pos'])); // delete the block $smcFunc['db_query']('', ' DELETE FROM {db_prefix}portamx_blocks WHERE id = {int:id}', array('id' => $bid)); // clear cache and SEF pages list $pmxCacheFunc['clean'](); } } // go to article overview $context['pmx']['subaction'] = 'overview'; $context['pmx']['articlestart'] = getCurrentPage($article['id'], $context['pmx']['settings']['manager']['artpage']); } } // clear cached blocks $pmxCacheFunc['clean'](); } if ($context['pmx']['subaction'] == 'overview') { if (!isset($context['pmx']['articlestart'])) { $context['pmx']['articlestart'] = 0; } redirectexit('action=' . $admMode . ';area=pmx_articles;' . $context['session_var'] . '=' . $context['session_id'] . ';pg=' . $context['pmx']['articlestart']); } } // load the template, initialize the page title loadTemplate($context['pmx_templatedir'] . 'AdminArticles'); $context['page_title'] = $txt['pmx_articles']; $context['pmx']['AdminMode'] = $admMode; $context['pmx']['RegBlocks'] = eval($context['pmx']['registerblocks']); // direct edit request? if (isset($_GET['sa']) && PortaMx_makeSafe($_GET['sa']) == 'edit' && !empty($_GET['id'])) { // move or clone from blocks? if (isset($_GET['from'])) { $context['pmx']['fromblock'] = PortaMx_makeSafe($_GET['from']) . '.' . PortaMx_makeSafe($_GET['id']); // load the block $request = $smcFunc['db_query']('', ' SELECT * FROM {db_prefix}portamx_blocks WHERE id = {int:id}', array('id' => PortaMx_makeSafe($_GET['id']))); $row = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); // modify the config array $cfg = unserialize($row['config']); if (isset($cfg['pagename'])) { $pgname = $cfg['pagename']; unset($cfg['pagename']); } else { $pgname = ''; } unset($cfg['ext_opts']); if (isset($cfg['frontmode'])) { unset($cfg['frontmode']); } $cfg['can_moderate'] = allowedTo('admin_forum') ? 0 : 1; $article = array('id' => 0, 'name' => $pgname, 'catid' => 0, 'acsgrp' => $row['acsgrp'], 'ctype' => $row['blocktype'], 'config' => serialize($cfg), 'content' => $row['content'], 'active' => 0, 'owner' => $user_info['id'], 'created' => 0, 'approved' => 0, 'approvedby' => 0, 'updated' => 0, 'updatedby' => 0); $context['pmx']['subaction'] = 'editnew'; $context['pmx']['articlestart'] = 0; } else { $context['pmx']['fromblock'] = ''; $request = $smcFunc['db_query']('', ' SELECT * FROM {db_prefix}portamx_articles WHERE id = {int:id}', array('id' => PortaMx_makeSafe($_GET['id']))); if ($smcFunc['db_num_rows']($request) > 0) { $row = $smcFunc['db_fetch_assoc']($request); $article = array('id' => $row['id'], 'name' => $row['name'], 'catid' => $row['catid'], 'acsgrp' => $row['acsgrp'], 'ctype' => $row['ctype'], 'config' => $row['config'], 'content' => $row['content'], 'active' => $row['active'], 'owner' => $row['owner'], 'created' => $row['created'], 'approved' => $row['approved'], 'approvedby' => $row['approvedby'], 'updated' => $row['updated'], 'updatedby' => $row['updatedby']); $smcFunc['db_free_result']($request); $context['pmx']['subaction'] = 'edit'; $context['pmx']['articlestart'] = 0; } } } // continue edit or overview? if ($context['pmx']['subaction'] == 'overview') { // load article data for overview if (!allowPmx('pmx_articles') && allowPmx('pmx_create', true)) { $where = 'WHERE a.owner = {int:owner}'; } else { $where = ''; } if (!isset($_SESSION['PortaMx']['filter'])) { $_SESSION['PortaMx']['filter'] = array('category' => '', 'approved' => 0, 'active' => 0, 'myown' => 0, 'member' => ''); } if ($_SESSION['PortaMx']['filter']['category'] != '') { $where .= (empty($where) ? 'WHERE ' : ' AND ') . 'a.catid IN ({array_int:catfilter})'; } if ($_SESSION['PortaMx']['filter']['approved'] != 0) { $where .= empty($where) ? 'WHERE ' : ' AND '; if ($_SESSION['PortaMx']['filter']['active'] != 0) { $where .= '(a.approved = 0 OR a.active = 0)'; } else { $where .= 'a.approved = 0'; } } if ($_SESSION['PortaMx']['filter']['active'] != 0) { $where .= empty($where) ? 'WHERE ' : ' AND '; if ($_SESSION['PortaMx']['filter']['approved'] != 0) { $where .= '(a.active = 0 OR a.approved = 0)'; } else { $where .= 'a.active = 0'; } } if ($_SESSION['PortaMx']['filter']['myown'] != 0) { $where .= (empty($where) ? 'WHERE ' : ' AND ') . 'a.owner = {int:owner}'; } if ($_SESSION['PortaMx']['filter']['member'] != '') { $where .= (empty($where) ? 'WHERE ' : ' AND ') . 'm.member_name LIKE {string:memname}'; } if (isset($_GET['pg']) && !is_array($_GET['pg'])) { $context['pmx']['articlestart'] = PortaMx_makeSafe($_GET['pg']); unset($_GET['pg']); } elseif (!isset($context['pmx']['articlestart'])) { $context['pmx']['articlestart'] = 0; } $cansee = allowPmx('pmx_articles, pmx_create', true); $isadmin = allowPmx('pmx_admin'); $memerIDs = array(); $context['pmx']['articles'] = array(); $context['pmx']['article_rows'] = array(); $context['pmx']['totalarticles'] = 0; $result = null; $request = $smcFunc['db_query']('', ' SELECT a.id, a.name, a.catid, a.acsgrp, a.ctype, a.config, a.active, a.owner, a.created, a.approved, a.approvedby, a.updated, a.updatedby, a.content, c.artsort, c.level, c.name AS catname FROM {db_prefix}portamx_articles AS a' . ($_SESSION['PortaMx']['filter']['member'] != '' ? ' LEFT JOIN {db_prefix}members AS m ON (a.owner = m.id_member)' : '') . ' LEFT JOIN {db_prefix}portamx_categories AS c ON (a.catid = c.id) ' . $where . ' ORDER BY a.id', array('catfilter' => Pmx_StrToArray($_SESSION['PortaMx']['filter']['category']), 'memname' => str_replace('*', '%', $_SESSION['PortaMx']['filter']['member']), 'owner' => $user_info['id'])); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $cfg = unserialize($row['config']); if (!empty($isadmin) || $cansee && !empty($cfg['can_moderate'])) { $memerIDs[] = $row['owner']; $memerIDs[] = $row['approvedby']; $memerIDs[] = $row['updatedby']; $context['pmx']['article_rows'][$row['id']] = array('name' => $row['name'], 'cat' => str_repeat('•', $row['level']) . $row['catname']); $result[] = array('id' => $row['id'], 'name' => $row['name'], 'catid' => $row['catid'], 'cat' => str_repeat('•', $row['level']) . $row['catname'], 'acsgrp' => $row['acsgrp'], 'ctype' => $row['ctype'], 'config' => $cfg, 'active' => $row['active'], 'owner' => $row['owner'], 'created' => $row['created'], 'approved' => $row['approved'], 'approvedby' => $row['approvedby'], 'updated' => $row['updated'], 'updatedby' => $row['updatedby'], 'content' => $row['content']); } } $smcFunc['db_free_result']($request); if (!empty($result)) { foreach ($result as $st => $data) { $context['pmx']['articles'][$st] = $data; } $context['pmx']['totalarticles'] = count($result); if ($context['pmx']['totalarticles'] <= $context['pmx']['articlestart']) { $context['pmx']['articlestart'] = 0; } // get all members names $request = $smcFunc['db_query']('', ' SELECT id_member, member_name FROM {db_prefix}members WHERE id_member IN ({array_int:members})', array('members' => array_unique($memerIDs))); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $context['pmx']['articles_member'][$row['id_member']] = $row['member_name']; } $smcFunc['db_free_result']($request); } } } // load popup js for overview loadJavascriptFile(PortaMx_loadCompressed('PortaMxPopup.js'), array('external' => true)); } elseif (empty($_POST['save_edit'])) { // prepare the editor PortaMx_EditArticle($article['ctype'], 'content', $article['content']); // load the class file and create the object require_once $context['pmx_sysclassdir'] . 'PortaMx_AdminArticlesClass.php'; $context['pmx']['editarticle'] = new PortaMxC_SystemAdminArticle($article); $context['pmx']['editarticle']->pmxc_AdmArticle_loadinit(); } } else { fatal_error($txt['pmx_acces_error']); } } }
/** * Checks the current Symphony Author can access the current page. * This includes the check to ensure that an Author cannot access a * hidden section. * * @return boolean * True if the Author can access the current page, false otherwise */ public function canAccessPage() { $nav = $this->getNavigationArray(); $page = '/' . trim(getCurrentPage(), '/') . '/'; $page_limit = 'author'; foreach ($nav as $item) { if (General::in_array_multi($page, $item['children'])) { if (is_array($item['children'])) { foreach ($item['children'] as $c) { if ($c['type'] == 'section' && $c['visible'] == 'no' && preg_match('#^' . $c['link'] . '#', $page)) { $page_limit = 'developer'; } if ($c['link'] == $page && isset($c['limit'])) { $page_limit = $c['limit']; } } } if (isset($item['limit']) && $page_limit != 'primary') { if ($page_limit == 'author' && $item['limit'] == 'developer') { $page_limit = 'developer'; } } } elseif (isset($item['link']) && $page == $item['link'] && isset($item['limit'])) { $page_limit = $item['limit']; } } if ($page_limit == 'author') { return true; } elseif ($page_limit == 'developer' && Administration::instance()->Author->isDeveloper()) { return true; } elseif ($page_limit == 'primary' && Administration::instance()->Author->isPrimaryAccount()) { return true; } return false; }
?> <meta name="keywords" content="<?php echo html_encode(getMainSiteName() . ', ' . getGalleryTitle()); ?> " /> <meta name="description" content="<?php echo html_encode(getMainSiteName() . ' / ' . getGalleryTitle() . ' / ' . getGalleryDesc()); ?> " /> <title><?php echo strip_tags(getMainSiteName() . ' / ' . getGalleryTitle()); ?> </title> </head> <body id="gallery-index" class="<?php echo 'page-' . getCurrentPage(); ?> "> <?php zp_apply_filter('theme_body_open'); ?> <div id="wrapper"> <div id="header"> <?php if (getOption('Allow_search')) { printSearchForm(''); } ?> <ul class="path c"> <?php if (getMainSiteURL()) {
$search = $_zp_current_album->getSearchEngine(); $cookiepath = WEBPATH; if (WEBPATH == '') { $cookiepath = '/'; } zp_setcookie("zenphoto_image_search_params", $search->getSearchParams(), 0, $cookiepath); set_context(ZP_INDEX | ZP_ALBUM); $theme = setupTheme(); $_zp_gallery_page = basename($obj = THEMEFOLDER . "/{$theme}/album.php"); } else { handleSearchParms('album', $_zp_current_album); $theme = setupTheme(); $_zp_gallery_page = basename($obj = THEMEFOLDER . "/{$theme}/album.php"); } // update hit counter if (!isMyALbum($_zp_current_album->name, ALL_RIGHTS) && getCurrentPage() == 1) { $hc = $_zp_current_album->get('hitcounter') + 1; $_zp_current_album->set('hitcounter', $hc); $_zp_current_album->save(); } // Display the Index page. } else { if (in_context(ZP_INDEX)) { handleSearchParms('index'); $theme = setupTheme(); $_zp_gallery_page = basename($obj = THEMEFOLDER . "/{$theme}/index.php"); } } } } // Load plugins, then load the requested $obj (page, image, album, or index; defined above).
<?php define('DOCROOT', rtrim(dirname(__FILE__), '\\/')); define('PATH_INFO', isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : NULL); define('DOMAIN_PATH', dirname(rtrim($_SERVER['PHP_SELF'], PATH_INFO))); define('DOMAIN', rtrim(rtrim($_SERVER['HTTP_HOST'], '\\/') . DOMAIN_PATH, '\\/')); require DOCROOT . '/symphony/lib/boot/bundle.php'; function renderer($mode = 'frontend') { if (!in_array($mode, array('frontend', 'administration'))) { throw new Exception('Invalid Symphony Renderer mode specified. Must be either "frontend" or "administration".'); } require_once CORE . "/class.{$mode}.php"; return $mode == 'administration' ? Administration::instance() : Frontend::instance(); } $renderer = isset($_GET['mode']) && strtolower($_GET['mode']) == 'administration' ? 'administration' : 'frontend'; $output = renderer($renderer)->display(getCurrentPage()); echo $output; exit;
/** * Prints a full page navigation including previous and next page links with a list of all pages in between. * * @param string $prevtext Insert here the linktext like 'previous page' * @param string $nexttext Insert here the linktext like 'next page' * @param bool $_oneImagePage set to true if there is only one image page as, for instance, in flash themes * @param string $nextprev set to true to get the 'next' and 'prev' links printed * @param string $class Insert here the CSS-class name you want to style the link with (default is "pagelist") * @param string $id Insert here the CSS-ID name if you want to style the link with this * @param bool $firstlast Add links to the first and last pages of you gallery * @param int $navlen Number of navigation links to show (0 for all pages). Works best if the number is odd. */ function printPageListWithNav($prevtext, $nexttext, $_oneImagePage = false, $nextprev = true, $class = 'pagelist', $id = NULL, $firstlast = true, $navlen = 9) { $current = getCurrentPage(); $total = max(1, getTotalPages($_oneImagePage)); $nav = getPageNavList($_oneImagePage, $navlen, $firstlast, $current, $total); if ($total > 1) { ?> <div <?php if ($id) { echo ' id="' . $id . '"'; } ?> class="<?php echo $class; ?> "> <ul class="<?php echo $class; ?> "> <?php $prev = $nav['prev']; unset($nav['prev']); $next = $nav['next']; unset($nav['next']); if ($nextprev) { ?> <li class="prev"> <?php if ($prev) { printLinkHTML($prev, html_encode($prevtext), gettext('Previous Page')); } else { ?> <span class="disabledlink"><?php echo html_encode($prevtext); ?> </span> <?php } ?> </li> <?php } $last = NULL; if ($firstlast) { ?> <li class="<?php if ($current == 1) { echo 'current'; } else { echo 'first'; } ?> "> <?php if ($current == 1) { echo '1'; } else { printLinkHTML($nav[1], 1, gettext("Page 1")); } ?> </li> <?php $last = 1; unset($nav[1]); } foreach ($nav as $i => $link) { $d = $i - $last; if ($d > 2) { ?> <li> <?php $k1 = $i - (int) (($i - $last) / 2); printLinkHTML(getPageNumURL($k1, $total), '...', sprintf(ngettext('Page %u', 'Page %u', $k1), $k1)); ?> </li> <?php } else { if ($d == 2) { ?> <li> <?php $k1 = $last + 1; printLinkHTML(getPageNumURL($k1, $total), $k1, sprintf(ngettext('Page %u', 'Page %u', $k1), $k1)); ?> </li> <?php } } ?> <li<?php if ($current == $i) { echo ' class="current"'; } ?> > <?php if ($i == $current) { echo $i; } else { $title = sprintf(ngettext('Page %1$u', 'Page %1$u', $i), $i); printLinkHTML($link, $i, $title); } ?> </li> <?php $last = $i; unset($nav[$i]); if ($firstlast && count($nav) == 1) { break; } } if ($firstlast) { foreach ($nav as $i => $link) { $d = $i - $last; if ($d > 2) { $k1 = $i - (int) (($i - $last) / 2); ?> <li> <?php printLinkHTML(getPageNumURL($k1, $total), '...', sprintf(ngettext('Page %u', 'Page %u', $k1), $k1)); ?> </li> <?php } else { if ($d == 2) { $k1 = $last + 1; ?> <li> <?php printLinkHTML(getPageNumURL($k1, $total), $k1, sprintf(ngettext('Page %u', 'Page %u', $k1), $k1)); ?> </li> <?php } } ?> <li class="last<?php if ($current == $i) { echo ' current'; } ?> "> <?php if ($current == $i) { echo $i; } else { printLinkHTML($link, $i, sprintf(ngettext('Page %u', 'Page %u', $i), $i)); } ?> </li> <?php } } if ($nextprev) { ?> <li class="next"> <?php if ($next) { printLinkHTML($next, html_encode($nexttext), gettext('Next Page')); } else { ?> <span class="disabledlink"><?php echo html_encode($nexttext); ?> </span> <?php } ?> </li> <?php } ?> </ul> </div> <?php } }
/** * Returns the page namespace based on the current URL. * A few examples: * * /login * /publish * /blueprints/datasources * [...] * /extension/$extension_name/$page_name * * This method is especially useful in couple with the translation function. * * @see toolkit#__() * @return string * The page namespace, without any action string (e.g. "new", "saved") or * any value that depends upon the single setup (e.g. the section handle in * /publish/$handle) */ public static function getPageNamespace() { if (self::$namespace !== false) { return self::$namespace; } $page = getCurrentPage(); if (!is_null($page)) { $page = trim($page, '/'); } if (substr($page, 0, 7) == 'publish') { self::$namespace = '/publish'; } else { if (empty($page) && isset($_REQUEST['mode'])) { self::$namespace = '/login'; } else { if (empty($page)) { self::$namespace = null; } else { $bits = explode('/', $page); if ($bits[0] == 'extension') { self::$namespace = sprintf('/%s/%s/%s', $bits[0], $bits[1], $bits[2]); } else { self::$namespace = sprintf('/%s/%s', $bits[0], $bits[1]); } } } } return self::$namespace; }
<?php define('DOCROOT', rtrim(dirname(__FILE__), '/')); define('DOMAIN', rtrim(rtrim($_SERVER['HTTP_HOST'], '/') . dirname($_SERVER['PHP_SELF']), '/')); require DOCROOT . '/symphony/lib/boot/bundle.php'; require_once CORE . '/class.frontend.php'; $Frontend = Frontend::instance(); $output = $Frontend->display(getCurrentPage()); header(sprintf('Content-Length: %d', strlen($output))); echo $output; exit;
<div id="header"> <div id="gallerytitle"><h2><?php echo getGalleryTitle(); ?> </h2></div> <div id="img_header_bg"> <div id="img_header"> </div> </div> </div> <div id="navigation"> <ul> <?php $totalPages = getTotalPages(); $currentPage = getCurrentPage(); if (hasPrevPage()) { $link = getPrevPageURL(); } else { $link = "#"; } echo "<li><a href=\"{$link}\" title=\"Previous Page\">«</a></li>\n"; for ($i = 1; $i <= $totalPages; $i++) { echo $i == $currentPage ? '<li class="current">' : '<li>'; if ($i < 10) { $page = '0' . $i; } else { $page = $i; } printLinkHTML(getPageNumURL($i), $page, "Page {$page}"); echo "</li>\n";
<?php define('DOCROOT', rtrim(dirname(dirname(__FILE__)), '/')); define('DOMAIN', rtrim(rtrim($_SERVER['HTTP_HOST'], '/') . dirname(dirname($_SERVER['PHP_SELF'])), '/')); require DOCROOT . '/symphony/lib/boot/bundle.php'; require_once CORE . '/class.administration.php'; $Admin = Administration::instance(); $output = $Admin->display(getCurrentPage()); ## Temporary: Display debuging information if ($Admin->displayProfilerReport == true) { ob_start(); printf("\n<!-- \n Total Render Time: %s \n\n", $Admin->Profiler->retrieveTotalRunningTime()); print_r($Admin->Database->getStatistics()); print_r($Admin->Profiler); print "\n -->"; $output .= ob_get_contents(); ob_end_clean(); } header(sprintf('Content-Length: %d', strlen($output))); echo $output; exit;
/** * Generates the JavaScript for an IBM Connections endpoint. * * @return string The JavaScript representing an IBM Connections endpoint. * @author Benjamin Jakobus */ function generateEndpoint($endpoint, $agnostic_deploy_url) { // $endpoint['auth_type'], $endpoint['server_url'], $agnostic_deploy_url, $endpoint['name'], $endpoint['api_version'] // $type, $authentication_method, $url, $deploy_url, $name, $api_version $endpoint_js = '"' . $endpoint['name'] . '": new Endpoint({'; if ($endpoint['authentication_method'] == 'oauth1' || $endpoint['authentication_method'] == 'oauth2') { $endpoint_js .= '"authType": "oauth",'; } else { $endpoint_js .= '"authType": "basic",'; } if ($endpoint['api_version'] != "") { $endpoint_js .= '"apiVersion": "' . $endpoint['api_version'] . '",' . "\n"; } // $endpoint_js .= '"platform": "' . $endpoint['server_type'] . '",'; $endpoint_js .= '"platform": "connections",' . "\n"; if ($endpoint['authentication_method'] == 'oauth1') { $endpoint_js .= '"authenticator": new OAuth({"loginUi": null, "url": "' . $agnostic_deploy_url . '"}),'; } else { if ($endpoint['authentication_method'] == 'basic') { $endpoint_js .= '"authenticator": new Basic({'; $endpoint_js .= '"url": "' . $agnostic_deploy_url . '", "actionUrl": "' . plugins_url(PLUGIN_NAME) . '/core/index.php?classpath=services&class=Proxy&method=route&endpointName=' . $endpoint['name'] . '&basicAuthRequest=true&_redirectUrl=' . getCurrentPage() . '"}),'; } } // $endpoint_js .= '"proxyPath": "connections",'; $endpoint_js .= '"proxyPath": "",' . "\n"; // $endpoint_js .= '"proxyPath": "' . $type . '",'; // if ($endpoint['server_type'] == 'smartcloud') { // $endpoint_js .= '"isSmartCloud": true,'; // } $endpoint_js .= '"isAuthenticated": "false",' . "\n"; $endpoint_js .= '"transport": new Transport({}),' . "\n"; $endpoint_js .= '"serviceMappings": {},' . "\n"; $endpoint_js .= '"name": "' . $endpoint['name'] . '",' . "\n"; if ($type == 'smartcloud') { $endpoint_js .= '"authenticationErrorCode": "403",' . "\n"; } else { $endpoint_js .= '"authenticationErrorCode": "401",' . "\n"; } $endpoint_js .= '"baseUrl": "' . $endpoint['url'] . '",' . "\n"; $endpoint_js .= '"proxy": new Proxy({' . "\n"; $endpoint_js .= '"proxyUrl": "' . plugins_url(PLUGIN_NAME) . '/core/index.php?classpath=services&endpointName=' . $endpoint['name'] . '&class=Proxy&method=route&_redirectUrl="})}),'; return $endpoint_js; }
/** * Responsible for launching a standard symphony instance and * sending output to the browser. * * @param string $mode (optional) * @return integer */ function symphony_launcher($mode) { if (strtolower($mode) == 'administration') { $renderer = Administration::instance(); } else { $renderer = Frontend::instance(); } $output = $renderer->display(getCurrentPage()); // #1808 if (isset($_SERVER['HTTP_MOD_REWRITE'])) { $output = file_get_contents(GenericExceptionHandler::getTemplate('fatalerror.rewrite')); $output = str_replace('{ASSETS_URL}', ASSETS_URL, $output); $output = str_replace('{SYMPHONY_URL}', SYMPHONY_URL, $output); $output = str_replace('{URL}', URL, $output); echo $output; exit; } cleanup_session_cookies(); echo $output; return $renderer; }