"; print_r($_SERVER); echo ""; $redirect = false; if(isset($_SERVER['REQUEST_URI'])){ $rqs = trim($_SERVER['REQUEST_URI'], ""); #$rqs = trim($_SERVER['REQUEST_URI'], "/"); #$_e = explode("/", $_rqs); $file = fopen("../starilinkovi.txt", "r"); $_e = array(); while(! feof($file)){ $l = fgets($file); $_l = explode("->", $l); $_e = array_merge($_e, $_l); } fclose($file); #$_e = explode(" -> ", $linkovi); foreach($_e as $ek => $e){ $e = preg_replace("/\r/is", " ", $e); $e = preg_replace("/\n/is", " ", $e); $e = preg_replace("/\s\s+/is", " ", $e); $e = str_replace(ROOTURL, "", $e); $e = trim($e); $_e[$ek] = $e; } #echo "
"; print_r($_e); echo "
"; $old = array_search($rqs, $_e); #var_dump($old); #var_dump($rqs); #exit(); if($old!==false){ if(isset($_e[$old+1])){ $redirect = true; #var_dump($rqs); #var_dump($_e[$old+1]); #exit(); header("Location: ".ROOTURL.$_e[$old+1]); } } } #exit(); if(!$redirect){ header("Location: $_SERVER[HTTP_HOST]"); } */ require_once('include/conf.php'); // check to see whether we have if (isset($GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'])) { if (ereg('(/)([0-9]*)\.(.*)', $GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'], $regs)) { $id = $regs[2]; $type = $regs[3]; if (Template::setTemporaryType($type) == false) trigger_error("Template type [$type] not supported.", E_USER_WARNING); } } // to force check_parameter in order to report an error if id is not int. if (isset($id) == false) check_parameter('id', 'integer', 200); //if (!is_int($id)) if ( (string)(int)$id != (string)$id ) trigger_error("Not a valid id supplied [id=$id]", E_USER_ERROR); $id = (int)$id; $articleid = $id; $article = new Article(); if ($article->load($id) == false) { include(Template::getPath('cms/view-articlenotfound')); exit(); } // check privileges if the user is registered $show_edit_links = false; if (Auth::isGroupMember('CMS/Editors')) { // does he has READ priviledges? $articleid=(int)$articleid; $acl = new acl($articleid); $b = $acl->checkPrivileges(PREAD); $modules->cms->show_create_links = $acl->checkPrivileges(PCREATE); $modules->cms->show_edit_links = $acl->checkPrivileges(PCHANGE+PDELETE+PCREATE); if (!$b) { include(template::getPath('cms/no_edit_priviledges')); exit(); } } // disable natural links if the page is accessed // directly through the PHP script (they will not // work because of the current implementation if (ereg("view\.php", getenv('REQUEST_URI'))) { $modules->cms->natural_urls_enabled = false; } // do not cache for Editors if ((Auth::isGroupMember('CMS/Editors') == false )&&(isset($no_cms_cache) == false)) { // this call will try to serve a static version of // this page; if successful, it will serve the page // and then stop processing cache::serve($waf->user->status); } // status check if (Auth::isGroupMember('CMS/Editors') == false) { if (($article->status != 'LIVE') && ($article->status != 'ARCHIVED')) { trigger_error('[waf:error] Privilege error.', E_USER_ERROR); exit(); } } if ($article->sectorid != CMS_GROUP_PUBLIC) if ((Auth::isGroupMember((int)$article->sectorid) == false)&&(Auth::isGroupMember('CMS/Editors') == false)) { trigger_error('[waf:error] Privilege error.', E_USER_ERROR); exit(); } check_parameter('from', 'int', 0); // -- display the page now --------------------------------------------- if (isset($print)) Template::setTemporaryType('print.html'); trigger_error("will load template: $article->template_filename"); // do not cache for Editors if ((Auth::isGroupMember('CMS/Editors') == false )&&(isset($no_cms_cache) == false)) { cache::begin(); include(Template::getPath('cms/common/' . $article->template_filename)); cache::end($waf->user->status); } else { include(Template::getPath('cms/common/' . $article->template_filename)); } ?>