PageRenderTime 70ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/www/index.php

http://kandidat-cms.googlecode.com/
PHP | 83 lines | 75 code | 3 blank | 5 comment | 35 complexity | eedbbee79e46a0744ba780761e0e4c65 MD5 | raw file
Possible License(s): CC0-1.0
  1. <?php
  2. session_start();
  3. $begintime=microtime(true);
  4. define( '_JEXEC', 1 );
  5. if(file_exists('admin/install/index.php')){Header('Location: ../admin/install/index.php');exit();}
  6. include 'conf/config.php';
  7. if($gzip_enable=='1') include 'code/gzip.php';
  8. if($siteoff) {
  9. include('code/siteoff.php');exit;
  10. }
  11. $captcha = false;
  12. if(isset($_SESSION['vcaptcha'])){
  13. if($_SESSION['vcaptcha']===$_POST['vcaptcha'])$captcha = true;
  14. $_SESSION['vcaptcha']='';
  15. }
  16. if($_SESSION['id']!=session_id())$_SESSION['name'] = '?????';
  17. @$whatpage = preg_replace('/[^a-z0-9-_]/iu','',$_REQUEST['whatpage']);
  18. @$catpage = preg_replace('/[^a-z0-9-_]/iu','',$_REQUEST['catpage']);
  19. @$subcatpage = preg_replace('/[^a-z0-9-_]/iu','',$_REQUEST['subcatpage']);
  20. foreach ($_GET as $var => $secvalue) { if((preg_match ('/<[^>]*script*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*object*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*iframe*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*applet*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*meta*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*style*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*form*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*img*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*onmouseover*\"?[^>]*>/iu', $secvalue)) || (preg_match ('/\([^>]*\"?[^)]*\)/iu', $secvalue)) || (preg_match ('/\"/iu', $secvalue))) { die('BAD YOUR CODE'); exit; }}
  21. foreach ($_POST as $secvalue) { if((preg_match ('/<[^>]*script *\"?[^>]*>/iu', $secvalue)) || (preg_match ('/<[^>]*style*\"?[^>]*>/iu', $secvalue))) { die('BAD YOUR CODE'); exit; }}
  22. include 'code/functions.php';
  23. //SAPE
  24. if(($sape_user!='')&&file_exists($localpath.$sape_user.'/sape.php')){
  25. require_once($localpath.$sape_user.'/sape.php');
  26. $sape=new SAPE_client();
  27. }
  28. //LINKFEED
  29. if(($linkfeed_user!='')&&file_exists($localpath.$linkfeed_user.'/linkfeed.php')){
  30. require_once($localpath.$linkfeed_user.'/linkfeed.php');
  31. $linkfeed=new LinkFeedClient();
  32. }
  33. if(file_exists(CONF.'photoconf.php'))include_once(CONF.'photoconf.php');
  34. $templatepp=empty($templatepp)?'dark_rounded':$templatepp;
  35. $myFile=ARTICLES;
  36. if(!empty($catpage))$myFile.=$catpage.'/';
  37. if(!empty($subcatpage))$myFile.=$subcatpage.'/';
  38. $myFile.=empty($whatpage)?'main.dat':$whatpage.'.dat';
  39. if(!file_exists($myFile)){$myFile=ARTICLES.'404.dat'; header('Status: 404'); header('HTTP/1.1 404 Not Found');}
  40. $data=file_get_contents($myFile);
  41. $sitetitle=articlesparam('title',$data);
  42. $contentcenter=articlesparam('content',$data);
  43. $myinclude = articlesparam('myinclude',$data);
  44. if(empty($myinclude))$myinclude='main';
  45. $metadescription=articlesparam('description',$data);
  46. $metakeywords=articlesparam('keywords',$data);
  47. $pubdateofpage=articlesparam('pubdate',$data);
  48. $enablecomment=(int)articlesparam('comment',$data);
  49. //?????? ? ????????
  50. $contentcenter.='<div class="myinclude">';
  51. ob_start();
  52. require(MYCODE.$myinclude.'.php');
  53. if($enablecomment>0)require(MYCODE.'comments.php');
  54. $contentcenter.=ob_get_contents();
  55. ob_end_clean();
  56. $contentcenter.='</div>';
  57. //????????? ??????
  58. $what_templatepage=articlesparam('templatepage',$data);
  59. if(!empty($catpage)){
  60. $myFile=ARTICLES.$catpage.'/main.dat';
  61. if(file_exists($myFile))$cat_templatepage = articlesparam('templatepage',file_get_contents($myFile));
  62. }
  63. if(!empty($subcatpage)){
  64. $myFile=ARTICLES.$catpage.'/'.$subcatpage.'/main.dat';
  65. if(file_exists($myFile))$subcat_templatepage = articlesparam('templatepage',file_get_contents($myFile));
  66. }
  67. $templatepage='template';
  68. if($what_templatepage==''){
  69. if($subcat_templatepage==''){
  70. if($cat_templatepage==''){
  71. $templatepage .= $what_templatepage;
  72. }else $templatepage .= $cat_templatepage;
  73. }else $templatepage .= $subcat_templatepage;
  74. }else $templatepage .= $what_templatepage;
  75. //????????? ?????? ??????????? ????? ?????????? ????????
  76. if(!file_exists(LOCALPATH.'templates/'.$template.'/'.$templatepage.'.php'))$templatepage='template';
  77. $incl=file_get_contents(LOCALPATH.'templates/'.$template.'/'.$templatepage.'.php');
  78. $incl=parse_incl($incl);
  79. $lnav=linkator($whatpage, $catpage, $subcatpage, $sitetitle);
  80. eval('?>'.$incl);