/** * Figures out what is being accessed and calls the appropriate load function * * @return bool */ function zp_load_request() { if ($success = zp_apply_filter('load_request', true)) { // filter allowed the load zp_load_page(); if (isset($_GET['p'])) { $page = str_replace(array('/', '\\', '.'), '', sanitize($_GET['p'])); if (isset($_GET['t'])) { // Zenphoto tiny url unset($_GET['t']); $tiny = sanitize_numeric($page); $asoc = getTableAsoc(); $tbl = $tiny & 7; if (array_key_exists($tbl, $asoc)) { $tbl = $asoc[$tbl]; $id = $tiny >> 3; $result = query_single_row('SELECT * FROM ' . prefix($tbl) . ' WHERE `id`=' . $id); if ($result) { switch ($tbl) { case 'news': case 'pages': $page = $_GET['p'] = $tbl; $_GET['title'] = $result['titlelink']; break; case 'images': $image = $_GET['image'] = $result['filename']; $result = query_single_row('SELECT * FROM ' . prefix('albums') . ' WHERE `id`=' . $result['albumid']); case 'albums': $album = $_GET['album'] = $result['folder']; unset($_GET['p']); if (!empty($image)) { return zp_load_image($album, $image); } else { if (!empty($album)) { return zp_load_album($album); } } break; case 'comments': unset($_GET['p']); $commentid = $id; $type = $result['type']; $result = query_single_row('SELECT * FROM ' . prefix($result['type']) . ' WHERE `id`=' . $result['ownerid']); switch ($type) { case 'images': $image = $result['filename']; $result = query_single_row('SELECT * FROM ' . prefix('albums') . ' WHERE `id`=' . $result['albumid']); $redirect = 'index.php?album=' . $result['folder'] . '&image=' . $image; break; case 'albums': $album = $result['folder']; $redirect = 'index.php?album=' . $result['folder']; break; case 'pages': $redirect = 'index.php?p=pages&title=' . $result['titlelink']; break; } $redirect .= '#c_' . $commentid; header("HTTP/1.0 301 Moved Permanently"); header("Status: 301 Moved Permanently"); header('Location: ' . FULLWEBPATH . '/' . $redirect); exit; break; } } } } switch ($page) { case 'search': return zp_load_search(); break; case 'pages': if (getOption('zp_plugin_zenpage')) { return zenpage_load_page(); } break; case 'news': if (getOption('zp_plugin_zenpage')) { return zenpage_load_news(); } break; } } // may need image and album parameters processed list($album, $image) = rewrite_get_album_image('album', 'image'); if (!empty($image)) { return zp_load_image($album, $image); } else { if (!empty($album)) { return zp_load_album($album); } } } return $success; }
/** * Figures out what is being accessed and calls the appropriate load function * * @return bool */ function zp_load_request() { if ($success = zp_apply_filter('load_request', true)) { // filter allowed the load zp_load_page(); if (isset($_GET['p'])) { $page = str_replace(array('/', '\\', '.'), '', sanitize($_GET['p'])); switch ($page) { case 'search': return zp_load_search(); break; case 'pages': if (extensionEnabled('zenpage')) { return load_zenpage_pages(sanitize(rtrim(@$_GET['title'], '/'))); } break; case 'news': if (extensionEnabled('zenpage')) { return load_zenpage_news(sanitize($_GET)); } break; } } // may need image and album parameters processed list($album, $image) = rewrite_get_album_image('album', 'image'); if (!empty($image)) { return zp_load_image($album, $image); } else { if (!empty($album)) { return zp_load_album($album); } } } return $success; }
function zp_load_request() { list($album, $image) = rewrite_get_album_image('album', 'image'); zp_load_page(); $success = true; if (!empty($image)) { $success = zp_load_image($album, $image); } else { if (!empty($album)) { $success = zp_load_album($album); } } if (isset($_GET['p'])) { $page = str_replace(array('/', '\\', '.'), '', $_GET['p']); if ($page == "search") { $success = zp_load_search(); } } return $success; }