/test/subjects/benchmarks/webapps/tigerPhpNewsSystem_1.0_beta_build39/index.php
PHP | 2777 lines | 2491 code | 105 blank | 181 comment | 861 complexity | f061bf620ef88c20976540361c106b8d MD5 | raw file
Possible License(s): GPL-2.0, 0BSD, BSD-3-Clause, Unlicense, MPL-2.0-no-copyleft-exception, LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?
- /*
- * This software is part of the Tiger php news system
- * http://tpns.sourceforge.net
- *
- * This software comes with ABSOLUTELY NO WARRANTY. For details, see
- * the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
- *
- */
- //{{{ PHP start
- #start timer:
- $stimer = explode( ' ', microtime() );
- $stimer = $stimer[1] + $stimer[0];
- $isbot=false;
- if ( preg_match("/bot|spider|crawl|seek|search|slurp|checker|meta|validator/is",$_SERVER['HTTP_USER_AGENT'] ) )
- {
- $isbot=true;
- }
- header("Content-Type: text/html; charset=ISO-8859-15");
- require_once( 'Main.php' );
- include( 'config.php' );
- require_once( 'sessions.php' );
- $confnr=$nr;
- $main = new Main();
- #if ($usedbsessions)
- #{
- # $session = new session();
- # $session->setMain($main);
- # session_set_save_handler(array(&$session,"open"), array(&$session,"close"), array(&$session,"read"), array(&$session,"write"), array(&$session,"destroy"), array(&$session,"gc"));
- #}
- session_start();
- //{{{ LOG ANON COMMENTS
- if (isset($_REQUEST['page']) and $logannoncomment)
- {
- if ( !isset($_SESSION['role'])){$_SESSION['role']="0";}
- if ($_SESSION['role'] == "0" and $_REQUEST['page'] == "addnewscomment")
- {
- //open the file and append the contents
- $fp = fopen($annoncommentlogfile, "a+");
- // Write the request to the file
- fwrite($fp, "\n\nREMOTE_ADDR=".$_SERVER['REMOTE_ADDR']);
- fwrite($fp, "\nHTTP_HOST=".$_SERVER['HTTP_HOST']);
- fwrite($fp, "\nHTTP_USER_AGENT=".$_SERVER['HTTP_USER_AGENT']);
- fwrite($fp, "\nHTTP_ACCEPT=".$_SERVER['HTTP_ACCEPT']);
- fwrite($fp, "\nHTTP_ACCEPT_LANGUAGE=".$_SERVER['HTTP_ACCEPT_LANGUAGE']);
- fwrite($fp, "\nHTTP_ACCEPT_ENCODING=".$_SERVER['HTTP_ACCEPT_ENCODING']);
- fwrite($fp, "\nHTTP_ACCEPT_CHARSET=".$_SERVER['HTTP_ACCEPT_CHARSET']);
- foreach ($_GET as $key => $val) {fwrite($fp, "\n_GET: ".$key."=".$val);}
- foreach ($_POST as $key => $val) {fwrite($fp, "\n_POST: ".$key."=".$val);}
- foreach ($_SESSION as $key => $val) {fwrite($fp, "\n_SESSION: ".$key."=".$val);}
- foreach ($_COOKIE as $key => $val) { fwrite($fp, "\n_COOKIE: ".$key."=".$val);
- }
- fwrite($fp, "\n");
- // Close the file
- fclose($fp);
- }
- }
- //}}}
- $havecookie=false;
- if ( isset($_COOKIE['PHPSESSID']) and isset($_SESSION['reqid']) )
- {
- $havecookie=true;
- }
- $main->isbot=$isbot;
- $main->havecookie=$havecookie;
- $upload_max_filesize = ini_get('upload_max_filesize');
- $form_upload_max_filesize = preg_replace('/M/', '000000', $upload_max_filesize);
- $text_upload_max_filesize = preg_replace('/M/', ' Megabyte(s)', $upload_max_filesize);
- //$main->Main();
- $_REQUEST = $main->clean_array( $_REQUEST, true );
- $_SERVER = $main->clean_array( $_SERVER, false, false );
- if ( isset($_SESSION['nr']) ){$nr=$_SESSION['nr'];}
- if ( isset($_REQUEST['nr']) ){$nr=$_REQUEST['nr'];}
- $count=0;
- $plugins=array();
- //Variables
- $page="start";if ( $initpage == "true"){ $page="init";}if ($enablesplash){ $page="splash";}if ( isset($_REQUEST['page']) ){$page=$_REQUEST['page'];}
- $bbcode="
- <script type=\"text/javascript\">
- //<!--
- function showBBcodehelp()
- {
- var bbcodetext = document.getElementById('bbcodehelp');
- var bbon = document.getElementById('bbon');
- bbcodetext.style.display = \"block\";
- bbon.style.display = \"none\";
- }
- function hideBBcodehelp()
- {
- var bbcodetext = document.getElementById('bbcodehelp');
- var bbon = document.getElementById('bbon');
- bbcodetext.style.display = \"none\";
- bbon.style.display = \"block\";
- }
- //-->
- </script>
- <input type='button' value='bbcode' id='bbon' onclick=\"showBBcodehelp()\" class='button'/>
- <div id='bbcodehelp' style='display:none'>
- <input type='button' value='bbcode' id='bboff' onclick=\"hideBBcodehelp()\" class='button'/>
- <p><small>[b]<b>B</b>[/b] [i]<i>i</i>[/i] [u]<span class='uline'>u</span>[/u] [s]<span class=\"small\">s</span>[/s] [sm]<small>small</small>[/sm] [big]<big>big</big>[/big] [strike]<span class='strike'>strike</span>[/strike]<br />
- [color=#f00]<span style=\"color: #f00;\">#f00</span>[/color] [color=#f00000]<span style=\"color: #f00000;\">#f00000</span>[/color] [color=red]<span style=\"color: red;\">red</span>[/color]<br />
- [table]<br />[tr][th][/th][/tr]<br />[tr][td][/td][/tr]<br />[/table]<br />
- [list][list=1][list=a]<br />
- [*] <br />
- [/list]<br />
- [bq]<br />
- blockquote<br />
- [/bq]<br />
- [url=http://url]name[/url]<br />
- [url=mailto:address]name[/url]<br />
- [news=#]name[/news]<br />
- [page=page]name[/page]<br />
- [cat=#]name[/cat]<br />
- </small></p></div>";
- if ( $enablebbcode != "true" )
- {
- $bbcode="";
- }
- $main->setBBcode($bbcode);
- if (!isset($_SESSION['imgkey'])){$_SESSION['imgkey']=rand(1000, 9999);}
- if (!isset($_REQUEST['imgkey'])){$_REQUEST['imgkey']=0;}
- if (!isset($_SESSION['anonemail'])){$_SESSION['anonemail']="";}
- if (!isset($_SESSION['anonname'])){$_SESSION['anonname']="";}
- if (!isset($_SESSION['anonhomepage'])){$_SESSION['anonhomepage']="";}
- $oldrequestid=rand(1000, 9999);if ( isset($_REQUEST['rid'])){$oldrequestid=$_REQUEST['rid'];}else{$_REQUEST['rid']=$oldrequestid;}
- $requestid=rand(1000, 9999);;if ( isset($_SESSION['reqid']) ){$requestid=$_SESSION['reqid'];}
- //}}}
- // {{{ Counter
- if ( $enablecounter == "true" )
- {
- // Open the file for reading
- $fp = fopen("counterlog.txt", "r");
- // Get the existing count
- $count = fread($fp, 1024);
- // Close the file
- fclose($fp);
- if ($main->isPublicIp($_SERVER['REMOTE_ADDR']))
- {
- if ( !isset($_SESSION['counted']) and !$isbot and $havecookie )
- {
- $count=$count + 1;
- // Reopen the file and erase the contents
- $fp = fopen("counterlog.txt", "w");
- // Write the new count to the file
- fwrite($fp, $count);
- // Close the file
- fclose($fp);
- $_SESSION['counted'] = "1";
- }
- }
- }
- //}}} Counter
- //{{{ Check referer
- if ( isset($_SERVER['HTTP_REFERER']) )
- {
- if (! preg_match ("/http:\/\/".$_SERVER['HTTP_HOST']."/i", $_SERVER['HTTP_REFERER']))
- {
- $main->addreferer( $_SERVER['HTTP_REFERER'] );
- }
- }
- ///}}}
- //{{{ browser statistics
- if ( !isset($_SESSION['bstat']))
- {
- $testbrowsercap=ini_get("browscap");
- if ( $testbrowsercap != "")
- {
- if ($main->isPublicIp($_SERVER['REMOTE_ADDR']))
- {
- $browserinfo = get_browser();
- $bstatplatform="";if (isset($browserinfo->platform)){$bstatplatform=$browserinfo->platform;}
- $bstatbrowser="";if (isset($browserinfo->browser)){$bstatbrowser=$browserinfo->browser;}
- $bstatversion="";if (isset($browserinfo->version)){$bstatversion=$browserinfo->version;}
- $bstatcrawler=0;if ("$browserinfo->crawler" == "1" ){$bstatcrawler=$browserinfo->crawler;}
- if ("$bstatplatform$bstatbrowser$bstatversion" != "" )
- {
- $main->updatebrowserstat($bstatplatform,$bstatbrowser,$bstatversion,$bstatcrawler);
- }
- }
- }
- $_SESSION['bstat']="loged";
- }
- //}}}
- //{{{Login
- if ( $page == "login")
- {
- if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])){$_SERVER['HTTP_X_FORWARDED_FOR']="";}
- if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])){$_SERVER['HTTP_ACCEPT_CHARSET']="";}
- $user="";if ( $_REQUEST['user'] != "" ){$user=$_REQUEST['user'];}
- $passwd="";if ( $_REQUEST['passwd'] != "" ){$passwd=$_REQUEST['passwd'];}
- $passwd=md5($passwd);
- $userdata=$main->login($user, $passwd , true );
- if ( isset($userdata->rows) and $userdata->rows == 1 )
- {
- $userid=$userdata->records[0]['id'];
- $role=$userdata->records[0]['role'];
- $_SESSION['name']=$userdata->records[0]['name'];
- $_SESSION['nr']=$userdata->records[0]['nr'];
- $_SESSION['userid']=$userid;
- $_SESSION['role']=$role;
- $_SESSION['user']=$userdata->records[0]['user'];
- $_SESSION['passwd']=$passwd;
- $_SESSION['email']=$userdata->records[0]['email'];
- $_SESSION['theme']=$userdata->records[0]['theme'];
- //$_SESSION['img']=$userdata->records[0]['img'];
- //$_SESSION['data']=$userdata->records[0]['data'];
- $_SESSION['ip']=$_SERVER['REMOTE_ADDR'];
- $_SESSION['agent']="$_SERVER[HTTP_USER_AGENT]$_SERVER[HTTP_X_FORWARDED_FOR]$_SERVER[HTTP_ACCEPT_LANGUAGE]$_SERVER[HTTP_ACCEPT_CHARSET]";
- $_SESSION['lang']=$userdata->records[0]['lang'];
- }
- else
- {
- print "login failed";
- }
- $page="start";if ( $initpage == "true"){ $page="init";}if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
- }
- if ( isset($_SESSION['userid']) and $_SESSION['userid'] != 0 )
- {
- if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])){$_SERVER['HTTP_X_FORWARDED_FOR']="";}
- if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])){$_SERVER['HTTP_ACCEPT_CHARSET']="";}
- if ($_SESSION['ip'] == $_SERVER['REMOTE_ADDR'] and $_SESSION['agent'] == "$_SERVER[HTTP_USER_AGENT]$_SERVER[HTTP_X_FORWARDED_FOR]$_SERVER[HTTP_ACCEPT_LANGUAGE]$_SERVER[HTTP_ACCEPT_CHARSET]" )
- {
- $userid=$_SESSION['userid'];
- $role=$_SESSION['role'];
- }
- else
- {
- $page="logout";
- }
- }
- //}}}
- //{{{ Logout
- if ( $page == "logout" )
- {
- $_SESSION['name']="";
- $_SESSION['userid']="0";
- $_SESSION['role']="0";
- $_SESSION['user']="";
- $_SESSION['nr']="$confnr";
- $_SESSION['passwd']="";
- $_SESSION['email']="";
- $_SESSION['img']="";
- $_SESSION['data']="";
- $userid=0;
- $role=0;
- $page="start";if ( $initpage == "true"){ $page="init";}if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}
- }
- //}}}
- //{{{ Set Lang
- include_once( "lang/en.php" );
- $text=$main->clean_array( $text, false, true );
- $main->settext($text);
- //}}}
- if ($usedbsessions){if (!isset($userid)){$userid=0;}$main->run_query("update sessions set user ='$userid', page = '$page', hits = hits + 1 where session_id = '".session_id()."'");}
- //{{{ Download
- if ( $page == "dload" )
- {
- $id = $_REQUEST['id'];
- $fileinfo=$main->getfileinfo($id);
- if ($fileinfo->rows == "1")
- {
- if ( $fileinfo->records['0']['access'] > $role ){ header("HTTP/1.0 401 Unauthorized",true,401); die("401 Unauthorized");}
- $filename = $fileinfo->records['0']['filename'];
- $file = "$filepath/$id/$filename";
- //First, see if the file exists
- if (!is_file($file)) { header("HTTP/1.0 404 Not Found",true,404); die("404 File not found!"); }
- //Gather relevent info about file
- $len = $fileinfo->records['0']['size'];
- $ctype = $fileinfo->records['0']['type'];
- //Begin writing headers
- header("Pragma: public");
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: public");
- if ( !isset($_REQUEST['view']))
- {
- header("Content-Description: File Transfer");
- header("Content-Disposition: attachment; filename=$filename;");
- }
- if ( isset($_REQUEST['view']))
- {
- if ( $_REQUEST['view'] != "true" )
- {
- header("Content-Description: File Transfer");
- header("Content-Disposition: attachment; filename=$filename;");
- }
- }
- //Use the switch-generated Content-Type
- header("Content-Type: $ctype");
- header("Content-Transfer-Encoding: binary");
- header("Content-Length: ".$len);
- @readfile($file) or die("File not found.");
- exit;
- }
- header("HTTP/1.0 404 Not Found",true,404);
- die("404 File not found.");
- }
- //}}}
- //{{{start of request id limit
- if ( "$oldrequestid" == "$requestid" and $havecookie and !$isbot )
- {
- //}}}
- //{{{Password recovery
- if ( $page == "pwdrec3" )
- {
- if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])){$_SERVER['HTTP_X_FORWARDED_FOR']="";}
- if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])){$_SERVER['HTTP_ACCEPT_CHARSET']="";}
- if ( $_SESSION['pwdid'] == $_REQUEST['pwdinid'])
- {
- $userdata=$_SESSION['tempuserlogin'];
- $userid=$userdata['id'];
- $role=$userdata['role'];
- $_SESSION['name']=$userdata['name'];
- $_SESSION['nr']=$userdata['nr'];
- $_SESSION['userid']=$userid;
- $_SESSION['role']=$role;
- $_SESSION['user']=$userdata['user'];
- $_SESSION['passwd']=$userdata['passwd'];
- $_SESSION['email']=$userdata['email'];
- $_SESSION['theme']=$userdata['theme'];
- //$_SESSION['img']=$userdata->records[0]['img'];
- //$_SESSION['data']=$userdata->records[0]['data'];
- $_SESSION['ip']=$_SERVER['REMOTE_ADDR'];
- $_SESSION['agent']="$_SERVER[HTTP_USER_AGENT]$_SERVER[HTTP_X_FORWARDED_FOR]$_SERVER[HTTP_ACCEPT_LANGUAGE]$_SERVER[HTTP_ACCEPT_CHARSET]";
- $_SESSION['lang']=$userdata['lang'];
- $page="edituser";
- $_REQUEST['id']=$userid;
- }
- else
- {
- print "login failed";
- $page="pwdrec";
- }
- }
- //}}}
- //{{{ Vote
- if ( "$page" == "vote" )
- {
- if ( ! isset($_SESSION['vote'][$_REQUEST['id']]) )
- {
- $_SESSION['vote'][$_REQUEST['id']]='v';
- if ( $_REQUEST['value'] < "6" and $_REQUEST['value'] > "0")
- {
- $main->vote($_REQUEST['id'],$_REQUEST['value']);
- }
- }
- $page="start";if ( $initpage == "true"){ $page="init";}if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage'])){$page=$_SESSION['lastpage'];}
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- //{{{ Start of imgkey sheck
- if ( $role > 0 or $_SESSION['imgkey'] == $_REQUEST['imgkey'])
- {
- //}}}
- //{{{ Save news
- if ( "$page" == "savenews" and "$role" > "0" )
- {
- $addnews="true";
- $id="";if ( $_REQUEST['id'] != "" ){$id=$_REQUEST['id'];}
- $access="";if ( $_REQUEST['access'] != "" ){$access=$_REQUEST['access'];}else{$addnews="false";}
- $headline="";if ( $_REQUEST['header'] != "" ){$headline=$_REQUEST['header'];}else{$addnews="false";}
- $order="";if ( $_REQUEST['order'] != "" ){$order=$_REQUEST['order'];}else{$order="1";}
- $type="";if ( $_REQUEST['type'] != "" ){$type=$_REQUEST['type'];}else{$type="1";}
- $data="";if ( $_REQUEST['news'] != "" ){$data=$_REQUEST['news'];}else{$addnews="false";}
- $data2="";if ( $_REQUEST['extnews'] != "" ){$data2=$_REQUEST['extnews'];}
- $filename="";if ( isset($_REQUEST['delimg'])){$filename="del";}
- $category="1";
- if ( $_REQUEST['newcategory'] != "" )
- {
- $newcat=$main->addCategory($_REQUEST['newcategory']);
- if ( isset($newcat->lastid) and $newcat->lastid != 0)
- {
- $category=$newcat->lastid;
- }
- }
- elseif($_REQUEST['category'] != "" ){$category=$_REQUEST['category'];}
- else{$addnews="false";}
- if ( "$addnews" == "true" )
- {
- if ( $type == "1" ){$page="start";}
- elseif( $type == "2" ){$page="newscat";$_REQUEST['catid']=$category;}
- elseif( $type == "3" ){$page="viewnews";}
- elseif( $type == "4" ){$page="init";$main->removeoldinit($access);}
- elseif( $type == "5" ){$page="myhome";$subpage="news";$_REQUEST['id']=$_SESSION['lastuid'];}
- elseif( $type == "6" ){$page="myhome";$subpage="private";}
- elseif( $type == "7" ){$page="admnews";}
- elseif( $type == "8" ){$page="remnews";}
- elseif( $type == "9" ){$page="myhome";$_REQUEST['subpage']="hidden";$_REQUEST['id']=$userid;}
- else {$page="start";}
- $_SESSION['lastpage']=$page;
- if ( $role >= "2" )
- {
- if ($filename == "del" or $_FILES['img']['size'] != "0" )
- {
- $thumbdir="./thumb/news/$id/";
- $smalldir="./small/news/$id/";
- $uploaddir="./img/news/$id/";
- if(is_dir($thumbdir))
- {
- $main->rmdirr($thumbdir);
- }
- if(is_dir($smalldir))
- {
- $main->rmdirr($smalldir);
- }
- if(is_dir($uploaddir))
- {
- $main->rmdirr($uploaddir);
- }
- }
- if ($_FILES['img']['size'] != "0")
- {
- $filename=$main->uploadfile( $_FILES['img'] , "news", $id );
- }
- }
- $result = $main->savenews( $id, $access, $headline, $filename, $data, $data2, $order, $category, $type );
- }
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- //{{{ Add news
- if ( "$page" == "addnews" and "$role" != "0" )
- {
- $addnews="true";
- $img="";
- $access="";if ( $_REQUEST['access'] != "" ){$access=$_REQUEST['access'];}else{$addnews="false";}
- $owner=$userid;
- $headline="";if ( $_REQUEST['header'] != "" ){$headline=$_REQUEST['header'];}else{$addnews="false";}
- $order="";if ( $_REQUEST['order'] != "" ){$order=$_REQUEST['order'];}else{$order="1";}
- $type="";if ( $_REQUEST['type'] != "" ){$type=$_REQUEST['type'];}else{$type="1";}
- $data="";if ( $_REQUEST['news'] != "" ){$data=$_REQUEST['news'];}else{$addnews="false";}
- $data2="";if ( $_REQUEST['extnews'] != "" ){$data2=$_REQUEST['extnews'];}
- $category="1";
- if ( $_REQUEST['newcategory'] != "" ){
- $newcat=$main->addCategory($_REQUEST['newcategory']);
- if ( isset($newcat->lastid) and $newcat->lastid != 0)
- {
- $category=$newcat->lastid;
- }
- }
- elseif($_REQUEST['category'] != "" ){$category=$_REQUEST['category'];}
- else{$addnews="false";}
- if ( "$addnews" == "true" )
- {
- if ( $type == "1" ){$page="start";}
- elseif( $type == "2" ){$page="newscat";$_REQUEST['catid']=$category;}
- elseif( $type == "3" ){$page="viewnews";}
- elseif( $type == "4" ){$page="init";$main->removeoldinit($access);}
- elseif( $type == "5" ){$page="myhome";$subpage="news";$_REQUEST['id']=$_SESSION['lastuid'];}
- elseif( $type == "6" ){$page="myhome";$subpage="private";}
- elseif( $type == "7" ){$page="admnews";}
- elseif( $type == "8" ){$page="remnews";}
- elseif( $type == "9" ){$page="myhome";$_REQUEST['subpage']="hidden";$_REQUEST['id']=$userid;}
- else {$page="start";}
- $_SESSION['lastpage']=$page;
-
- $filename=str_replace(" ","_",basename($_FILES['img']['name']));
- $filename=str_replace("?","a",$filename);
- $filename=str_replace("ä","a",$filename);
- $filename=str_replace("ö","o",$filename);
- $filename=str_replace("?","A",$filename);
- $filename=str_replace("Ä","A",$filename);
- $filename=str_replace("Ö","O",$filename);
- $filename=str_replace("(","_",$filename);
- $filename=str_replace(")","_",$filename);
- $filename=ereg_replace("[^a-z,A-Z,0-9,_,.]","_",$filename);
- $result = $main->addnews( $access, $owner, $headline, $filename, $data, $data2, $order, $category, $type );
- if ( $role >= "2" )
- {
- $filenam=$main->uploadfile( $_FILES['img'], "news", $result->lastid );
- }
- }
- }
- //}}}
- //{{{ Remove news
- if ( "$page" == "rmnews" and "$role" > "0" )
- {
- $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
- $main->rmnews( $id, $role );
- if ($_SESSION['lastpage'] == "myhome" ){$_REQUEST['id']=$_SESSION['lastuid'];}
- $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
- if ( "$page" == "myhome")
- {
- $_REQUEST['id']=$_SESSION['lastuid'];
- $_REQUEST['subpage']=$_SESSION['lastsubpage'];
- }
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- //{{{ Delete news
- if ( "$page" == "deletenews" and "$role" >= "3")
- {
- $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
- $main->delnews( $id, $role );
- $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
- if ($page=="viewnews"){$page="start";}
- if ( "$page" == "myhome")
- {
- $_REQUEST['id']=$_SESSION['lastuid'];
- $_REQUEST['subpage']=$_SESSION['lastsubpage'];
- }
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- //{{{ Add comment to news
- if ( "$page" == "addnewscomment" and ( $role >= 1 or $allowanonaddcomment == 'true' or ( $_SESSION['lastid'] == "-1" and $allowanonaddguestbook == "true" ) ) )
- {
- $id="";if ( isset($_SESSION['lastid']) ){$id=$_SESSION['lastid'];}
- $headline="";if ( isset($_REQUEST['header']) ){$headline=$_REQUEST['header'];}
- $data="";if ( isset($_REQUEST['data']) ){$data=$_REQUEST['data'];}
- $anonname="";if ( isset($_REQUEST['name']) ){$anonname=$_REQUEST['name'];}
- $_SESSION['anonname']=$anonname;
- $anonemail="";if ( isset($_REQUEST['email']) ){$anonemail=$_REQUEST['email'];}
- $_SESSION['anonemail']=$anonemail;
- $homepage="";if ( isset($_REQUEST['homepage'])){$homepage=$_REQUEST['homepage'];}
- $_SESSION['anonhomepage']=preg_replace("#(\<a)(.*?)(\>)(.*?)(\</a\>)#is","$4",$homepage);
- if ( $data != "" ){$main->addcomment( $userid, 1, $id, $headline, $data, $anonname, $anonemail,$homepage );}
- $page=$_SESSION['lastpage'];
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- //{{{Save comment
- if ( "$page" == "savecomment" and $role >= 1 )
- {
- $page=$_SESSION['lastpage'];
- $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
- $headline="";if ( isset($_REQUEST['header']) ){$headline=$_REQUEST['header'];}
- $data="";if ( isset($_REQUEST['data']) ){$data=$_REQUEST['data'];}
- $anonname="";if ( isset($_REQUEST['name']) ){$anonname=$_REQUEST['name'];}
- $anonemail="";if ( isset($_REQUEST['email']) ){$anonemail=$_REQUEST['email'];}
- $homepage="";if ( isset($_REQUEST['homepage']) ){$homepage=$_REQUEST['homepage'];}
- if ( $headline != "" and $data != "" ){$main->savecomment( $userid, $role, $id, $headline, $data, $anonname, $anonemail, $homepage);}
- $_REQUEST['id']=$_SESSION['lastid'];
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- // {{{ Remove comments
- if ( "$page" == "rmcomment" and $role >= 1 )
- {
- $page=$_SESSION['lastpage'];
- $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
- if ( $id != "" )
- {
- $main->rmcomment( $userid, $role, $id);
- }
- $_REQUEST['id']=$_SESSION['lastid'];
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- // {{{ Delete comment
- if ( "$page" == "deletecomment" and $role == 4 )
- {
- $page=$_SESSION['lastpage'];
- $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
- if ( $id != "" )
- {
- $main->deletecomment( $id);
- }
- $_REQUEST['id']=$_SESSION['lastid'];
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- //}}}
- //{{{ Add user
- if ( "$page" == "adduser" and (("$role" == "0" and $allowregister == "true" ) or "$role" >= "3" ))
- {
- $adduser="true";
- $img="";
- $newrole="";if ( $_REQUEST['role'] != "" ){$newrole=$_REQUEST['role'];}else{$adduser="false";}
- $newname="";if ( $_REQUEST['name'] != "" ){$newname=$_REQUEST['name'];}else{$adduser="false";}
- $newuser="";if ( $_REQUEST['nuser'] != "" ){$newuser=$_REQUEST['nuser'];}else{$adduser="false";}
- $newemail="";if ( $_REQUEST['email'] != "" ){$newemail=$_REQUEST['email'];}
- $newdata="";if ( $_REQUEST['data'] != "" ){$newdata=$_REQUEST['data'];}
- $newlang="";if ( $_REQUEST['lang'] != "" ){$newlang=$_REQUEST['lang'];}else{$adduser="false";}
- $newpwd1="";if ( $_REQUEST['pwd1'] != "" ){$newpwd1=$_REQUEST['pwd1'];}else{$adduser="false";}
- $newpwd2="";if ( $_REQUEST['pwd2'] != "" ){$newpwd2=$_REQUEST['pwd2'];}else{$adduser="false";}
- $homepage="";if ( $_REQUEST['homepage'] != "" ){$homepage=$_REQUEST['homepage'];}
- $usetheme="default";
- if ( $allowusertheme == "true" and $_REQUEST['usetheme'] != "" )
- {
- $usetheme=$_REQUEST['usetheme'];
- if ( !is_file("themes/$usetheme/site.css"))
- {
- $usetheme="default";
- }
- }
- if( $allowusertheme != "true"){$usetheme="default";}
- $nr=$confnr;if ( isset($_REQUEST['nr'])){$nr=$_REQUEST['nr'];}
- if ( "$adduser" == "true" and ( "$role" >= "$newrole" or "$newrole" == "1" )and "$newpwd1" == "$newpwd2" )
- {
- $filename="";
- if ( isset($_FILES['img']))
- {
- $filename=str_replace(" ","_",basename($_FILES['img']['name']));
- $filename=str_replace("?","a",$filename);
- $filename=str_replace("ä","a",$filename);
- $filename=str_replace("ö","o",$filename);
- $filename=str_replace("?","A",$filename);
- $filename=str_replace("Ä","A",$filename);
- $filename=str_replace("Ö","O",$filename);
- $filename=str_replace("(","_",$filename);
- $filename=str_replace(")","_",$filename);
- $filename=ereg_replace("[^a-z,A-Z,0-9,_,.]","_",$filename);
- }
- $result = $main->adduser( $newrole,$nr,$usetheme,$newname,$newuser,$newemail,$newdata, md5($newpwd1), $filename, $newlang, $homepage );
- $_REQUEST['id']=$result->lastid;
- $_REQUEST['nextpage']="myhome";
- if ($newusermailtoadmin)
- {
- $admins=$main->run_query("SELECT email FROM `user` where role=4;");
- foreach($admins->records as $adminemails )
- {
- $main->sendMail( "$adminemails[email]" , $main->decode("$sitetitle: $text[useradded]"), $main->decode("$text[name] $newname\n$text[email] $newemail\n$text[description]\n$newdata") , "$adminemail");
- }
- }
- if ( $role >= "2" and isset($_FILES['img']) )
- {
- $filename=$main->uploadfile( $_FILES['img'] , "user", $result->lastid );
- }
- }
- $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
-
- }
- //}}}
- //{{{ Save user
- if ( "$page" == "saveuser" )
- {
- $adduser="true";
- $newid="";if ( $_REQUEST['id'] != "" ){$newid=$_REQUEST['id'];}else{$adduser="false";}
- $newrole="";if ( $_REQUEST['role'] != "" ){$newrole=$_REQUEST['role'];}else{$adduser="false";}
- $newname="";if ( $_REQUEST['name'] != "" ){$newname=$_REQUEST['name'];}else{$adduser="false";}
- $newemail="";if ( $_REQUEST['email'] != "" ){$newemail=$_REQUEST['email'];}
- $newdata="";if ( $_REQUEST['data'] != "" ){$newdata=$_REQUEST['data'];}
- $newlang="";if ( $_REQUEST['lang'] != "" ){$newlang=$_REQUEST['lang'];}else{$adduser="false";}
- $newpwd1="";if ( $_REQUEST['pwd1'] != "" ){$newpwd1=$_REQUEST['pwd1'];}
- $newpwd2="";if ( $_REQUEST['pwd2'] != "" ){$newpwd2=$_REQUEST['pwd2'];}
- $homepage="";if ( $_REQUEST['homepage'] != "" ){$homepage=$_REQUEST['homepage'];}
- $filename="";if ( isset($_REQUEST['delimg'])){$filename="del";}
- $usetheme="default";
- if ( $allowusertheme == "true" and $_REQUEST['usetheme'] != "" )
- {
- $usetheme=$_REQUEST['usetheme'];
- if ( !is_file("themes/$usetheme/site.css"))
- {
- $usetheme="default";
- }
- elseif( $newid == $userid )
- {
- $_SESSION['theme']="$usetheme";
- }
- }
- $nr=$confnr;if ( isset($_REQUEST['nr'])){$nr=$_REQUEST['nr'];}
- if ( "$role" <= "2" )
- {
- $newrole=$role;
- $newid=$userid;
- }
- if ( "$adduser" == "true" and ( "$role" >= "$newrole" or "$newrole" == "1" ) and "$newpwd1" == "$newpwd2" )
- {
- if ( $role >= "2" )
- {
- if ($filename == "del" or $_FILES['img']['size'] != "0" )
- {
- $thumbdir="./thumb/user/$newid/";
- $smalldir="./small/user/$newid/";
- $uploaddir="./img/user/$newid/";
- if(is_dir($thumbdir))
- {
- $main->rmdirr($thumbdir);
- }
- if(is_dir($smalldir))
- {
- $main->rmdirr($smalldir);
- }
- if(is_dir($uploaddir))
- {
- $main->rmdirr($uploaddir);
- }
- }
- if ( $_FILES['img']['size'] != "0")
- {
- $filename=$main->uploadfile( $_FILES['img'] , "user", $newid );
- }
- }
- if ( "$newpwd1" != "" )
- {
- $main->saveuser( $newid, $newrole, $nr,$usetheme, $newname, $newemail,$newdata, md5($newpwd1), $filename, $newlang, $homepage );
- }
- else
- {
- $main->saveuser( $newid, $newrole, $nr,$usetheme, $newname, $newemail,$newdata, "", $filename, $newlang, $homepage );
- }
- if ( $userid == $newid )
- {
- $_SESSION['lang']=$newlang;
- $_SESSION['nr']=$nr;
- $_SESSION['name']=$newname;
- $_SESSION['email']=$newemail;
- include_once( "lang/en.php" );
- $text=$main->clean_array( $text, false, true );
- $main->settext($text);
- }
- }
- $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
- }
- //}}}
- //{{{ Remove user
- if ( "$page" == "rmuser" and "$role" >= "3" )
- {
- $id="";if ( $_REQUEST['id'] != "" ){$id=$_REQUEST['id'];}
- $main->rmuser( $id );
- $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
- if ( $page == "userhome"){$page="start";if ( $initpage == "true"){ $page="init";}}
- }
- //}}}
- //{{{Edit abbr
- if ( $page == "editabbr" and $role >= "3" )
- {
- if (isset($_REQUEST['deleteid']))
- {
- $main->delabbr($_REQUEST['deleteid']);
- }
- if (isset($_REQUEST['do']))
- {
- if ($_REQUEST['do'] == "save")
- {
- $main->saveabbr($_REQUEST['id'], $_REQUEST['type'], $_REQUEST['word'] , $_REQUEST['title'], $_REQUEST['abbrdata']);
- }
- elseif ($_REQUEST['do'] == "add")
- {
- $main->addabbr( $_REQUEST['type'], $_REQUEST['word'] , $_REQUEST['title'], $_REQUEST['abbrdata'] );
- }
- }
- }
- //}}}
- //{{{ Delete user
- if ( "$page" == "deluser" and "$role" >= "4" )
- {
- $id="";if ( $_REQUEST['id'] != "" ){$id=$_REQUEST['id'];}
- $main->deluser( $id );
- $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- if ( $page == "userhome" or $page == "myhome" ){$page="start";if ( $initpage == "true"){ $page="init";}}
- }
- //}}}
- //{{{end of request id limit
- }
- }
- //}}}
- //{{{ Update request id
- $requestid=rand(1000, 9999);
- $_SESSION['reqid']=$requestid;
- //}}}
- //{{{ HTML header
- /*print "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n";*/
- print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n\n";
- //print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
- print "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title>$sitetitle</title>\n<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-15' />\n";
- if ( $page == "changetheme" and $allowusertheme == "true")
- {
- $_SESSION['theme']=$_REQUEST['theme'];
- $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage'])){$page=$_SESSION['lastpage'];}
- if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
- if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
- }
- if ( isset($_SESSION['theme']))
- {
- if ($_SESSION['theme'] != "default")
- {
- $stylesheet="themes/$_SESSION[theme]/site.css";
- }
- }
- print "<link rel='stylesheet' href='$stylesheet' type='text/css'></link>\n";
- print "<meta content='$keywords' name='keywords'></meta>\n";
- print "<meta content='$description' name='description'></meta>\n";
- if ( "$enablerss" == "true" )
- {
- if ( "$role" != "0" ){print "<link rel='alternate' type='text/xml' title='RSS' href='rss.php?user=$_SESSION[user]&passwd=$_SESSION[passwd]'></link>\n";}
- else {print "<link rel='alternate' type='text/xml' title='RSS' href='rss.php'></link>\n";}
- }
- if ( $enablesplash and ($page=="" or $page=="splash" ))
- {
- $page2="start";if ( $initpage == "true"){ $page2="init";}
- if ($splashtimer!=0)
- {
- print "<meta http-equiv='refresh' content='$splashtimer;url=?page=$page2' />";
- }
- }
-
- print "</head>\n";
- $bodyclass="gray";
- if ( !isset($_REQUEST['textsize']) and isset($_SESSION['textsize']) )
- {
- $_REQUEST['textsize']=$_SESSION['textsize'];
- }
- if (isset($_REQUEST['textsize']))
- {
- if( $_REQUEST['textsize'] == "s" )
- {
- $bodyclass="graysmall";
- }
- if( $_REQUEST['textsize'] == "n" )
- {
- $bodyclass="gray";
- }
- if( $_REQUEST['textsize'] == "l" )
- {
- $bodyclass="graylarge";
- }
- $_SESSION['textsize']=$_REQUEST['textsize'];
-
- }
- print "<body class='$bodyclass'>\n";
- print "<table class='main' summary='main table'><tr><td class='tls'></td><td class='ts'></td><td class='trs'></td></tr><tr><td class='ls'></td>";
- if ($page=="splash"){print "<td valign='middle' align='center'>\n";}else{print "<td valign='top'>\n";}
- //}}}
- //{{{ splach
- if ( $enablesplash and ($page=="" or $page=="splash" ))
- {
- $page2="start";if ( $initpage == "true"){ $page2="init";}
- print "<a href='?page=$page2'><img src='$splashimage' alt='$sitetitle' /></a>";
- }
- //}}}
- //{{{ Top part
- //start splash check
- if ($page!="splash")
- {
- print "<table summary='Main table'>\n";
- print "<tr><td><img src='$logo' alt='LOGO' width='$logowidth' /></td><td align='right' class='headerbottom'><p> </p>\n";
- if ( $enablesearch == 'true' )
- {
- $searchvalue="";
- $search="";if ( isset($_REQUEST['search']) ){$search=$_REQUEST['search'];}
- if ( $search == "" and $page == "search" and $_SESSION['lastpage']=="search" and isset($_SESSION['searchstr']) ){$search=$_SESSION['searchstr'];}
- if ( $search != "" ){$searchvalue="value='$search'";}
- print "<form enctype='multipart/form-data' action='?page=search' method='post'><p><input type='hidden' name='rid' value='$requestid' />";
- print "<label for='search'>$text[search]: </label><input name='search' type='text' id='search' alt='search' $searchvalue /> ";
- print "<input type='submit' value='$text[search]' id='searchbuttom' class='button'/> <input type='reset' value='$text[reset]' class='button'/></p></form>";
- }
- print "</td><td align='right' class='headermiddle'>\n";
- print "<table summary='information table'>";
- foreach ($siteheader as $headerline)
- {
- print "<tr><td align='right' class='menusmall'><b>$headerline[1]</b></td>";
- print "<td align='left' class='menusmall'>$headerline[2]</td></tr>";
- }
- print "</table>";
- print "</td></tr></table><table summary='Main table'>\n";
- //}}}
- //{{{ Menu
- print "<tr><td valign='top' class='menu'>\n";
- if ( $initpage == "true" )
- {
- print "<a href='?page=init'>$text[home]</a> <br />\n";
- }
- $menu = $main->getmenu( $role, $userid );
- $lastaccess=0;
- foreach( $menu->records as $item )
- {
- $curaccess=$item['access'];
- if ( "$lastaccess" != "$curaccess" )
- {
- print "<br />\n";
- }
- $lastaccess=$curaccess;
- $menuitem="";
- if (isset($text[ $item['data'] ])){$menuitem=str_replace(" "," ",$text[ $item['data'] ]);}
- if ($menuitem == ""){$menuitem=$item['data'];}
- print "<a href='?page=$item[data]'>$menuitem</a> <br />\n";
- }
- $newslinks=$main->getmenunewslist($role);
- if ($newslinks->rows != "0" )
- {
- print "<br />\n";
- foreach( $newslinks->records as $item )
- {
- $menuitem=str_replace(" "," ",$item['headline']);
- print "<a href='?page=viewnews&id=$item[id]'>$menuitem</a> <br />\n";
- }
- }
- $category = $main->getCategories($role);
- if ($category->rows != "0" )
- {
- print "<br />$text[category]<br />\n";
- foreach( $category->records as $item )
- {
- $menuitem=str_replace(" "," ",$item['name']);
- //if ( isset($text[$item['name']])){$menuitem=str_replace(" "," ",$text[$item['name']]);}
- print "<a href='?page=newscat&catid=$item[id]'>$menuitem</a> <br />\n";
- }
- }
- if ( $enablerss == "true" and "$userid" != "0" )
- {
- print "<br /><a href='rss.php?user=$_SESSION[user]&passwd=$_SESSION[passwd]'><img src='images/rss.gif' alt='$text[rss]'/></a> <br />\n";
- print "<a href='atom.php?user=$_SESSION[user]&passwd=$_SESSION[passwd]'><img src='images/atom.gif' alt='$text[atom]'/></a> <br />\n";
- }
- elseif ( $enablerss == "true" )
- {
- print "<br /><a href='rss.php'><img src='images/rss.gif' alt='$text[rss]'/></a> <br />\n";
- print "<a href='atom.php'><img src='images/atom.gif' alt='$text[atom]'/></a> <br />\n";
- }
- if ( $allowusertheme == "true" and "$userid" == "0")
- {
- print "<br /><form action='?'><p><select onchange=\"location=this.options[this.selectedIndex].value;\">\n";
- $d=dir("themes");
- $curtheme="";
- if ( isset($_SESSION['theme']))
- {
- $curtheme=$_SESSION['theme'];
- }
- print "<option value='?page=changetheme&theme=default'>$text[default]</option>\n";
- while($entry = $d->read())
- {
- $entry=str_replace(".php","" ,$entry);
- if( is_dir("themes/$entry") and $entry != "." and $entry != ".." and is_file("themes/$entry/site.css"))
- {
- $selected="";
- if ($entry == $curtheme ){$selected="selected=selected";}
- print "<option value='?page=changetheme&theme=$entry' $selected>$entry</option>\n";
- }
- }
- print "</select></p></form>\n";
- }
- else
- {
- print "<br />\n";
- }
- $textsizeurl="";
- if(isset($_REQUEST['nr'])){$textsizeurl.="&nr=$_REQUEST[nr]";}
- if(isset($_REQUEST['start'])){$textsizeurl.="&start=$_REQUEST[start]";}
- if(isset($_REQUEST['id'])){$textsizeurl.="&id=$_REQUEST[id]";}
- print "<a href='?page=$page&textsize=s&rid=$requestid$textsizeurl' class='small' rel='nofollow'>A</a>";
- print "<a href='?page=$page&textsize=n&rid=$requestid$textsizeurl' class='normal' rel='nofollow'>A</a>";
- print "<a href='?page=$page&textsize=l&rid=$requestid$textsizeurl' class='large' rel='nofollow'>A</a>";
- print "<br />\n";
- if ( "$userid" == "0" and $showlogin == "true")
- {
- print "<br /><hr /><form action='?page=login' method='post'><p><input type='hidden' name='rid' value='$requestid' />\n";
- print "<label for='user'>$text[user]</label><br /><input type='text' alt='user' id='user' name='user' size='10'/><br />\n";
- print "<label for='passwd'>$text[passwd]</label><br /><input type='password' alt='password' id='passwd' name='passwd' size='10'/><br />\n";
- print "<input type='submit' value='$text[login]' id='login' class='button' /><br />\n";
- if ( $allowregister == "true" )
- {
- print "<a href='?page=newuser' rel='nofollow'>$text[register]</a> \n";
- }
- print "</p></form><a href='?page=pwdrec&rid=$requestid' rel='nofollow'>".str_replace(" "," ",$text['pwdrecovery'])."</a><hr />\n";
-
- }
- elseif ( "$userid" != "0")
- {
- print "<br /><hr />$text[logedinas]<br /><a href='?page=myhome&rid=$requestid'>$_SESSION[name]</a> \n";
- print "<br />".$text["access$role"]."\n";
- print "<br /><a href='?page=logout&rid=$requestid'>$text[logout]</a> <hr />\n";
- }
- if ( $cookieinfo == "true" )
- {
- print "<br /><a href='?page=cookie'>".str_replace(" "," ",$text['cookieheader'])."</a><br /><br />";
- }
- print "</td><td valign='top' colspan='2' rowspan='2'>\n";
- //if ( isset($_SESSION['nr'])){$_SESSION['lastnr']=$_SESSION['nr'];}
- //elseif( $page != "editnews" and $page != "savenews" ){$_SESSION['lastnr']="";}
- if ( isset($_REQUEST['start'])){$_SESSION['laststart']=$_REQUEST['start'];}
- elseif( $page != "editnews" and $page != "savenews" ){$_SESSION['laststart']="";}
- //End splash shech
- }
- //}}}
- //{{{ Init page
- if ("$page" == "init" or ("$page" == "" and $initpage == "true" ) )
- {
- $_SESSION['lastpage']=$page;
- $news = $main->getinitnews($role);
- $main->incresenewsviews($news->records['0']['id']);
- $main->printnews( $news,1,$role,$userid,"-1","-1",$page,"" );
- }
- //}}}
- //{{{Start page
- if ( "$page" == "start" or ("$page" == "" and $initpage != "true" ) )
- {
- $_SESSION['lastpage']=$page;
- $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
- $news = $main->getnews( $role , 1 , $start , $nr);
- $nrofnews = $main->getnrnews( $role, 1);
- $nrofnews = $nrofnews->records[0]['nr'];
- $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
- }
- //}}}
- //{{{Search page
- if ( "$page" == "search" )
- {
- $_SESSION['lastpage']=$page;
- $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
- $search="";if ( isset($_REQUEST['search']) ){$search=$_REQUEST['search'];$_SESSION['searchstr']=$search;}elseif ( isset($_SESSION['searchstr']) ){$search=$_SESSION['searchstr'];}
- $news = $main->search( $search, $role , $start , $nr);
- $nrofnews = $main->searchnr( $search, $role );
- $nrofnews = $nrofnews->records[0]['nr'];
- $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
- }
- //}}}
- //{{{ Toplist page
- if ( "$page" == "top" )
- {
- $_SESSION['lastpage']=$page;
- $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
- $news = $main->gettopnews( $role , $start , $nr);
- $nrofnews = $main->getnrtopnews( $role);
- $nrofnews = $nrofnews->records[0]['nr'];
- $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
- }
- //}}}
- //{{{ Toplist view page
- if ( "$page" == "topview" )
- {
- $_SESSION['lastpage']=$page;
- $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
- $news = $main->gettopviewnews( $role , $start , $nr);
- $nrofnews = $main->getnrtopnews( $role);
- $nrofnews = $nrofnews->records[0]['nr'];
- $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
- }
- //}}}
- //{{{Top comments page
- if ( "$page" == "topcomment" )
- {
- $_SESSION['lastpage']=$page;
- $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
- $news = $main->gettopcommentnews( $role, $start, $nr);
- $nrofnews = $main->getnrtopnews( $role);
- $nrofnews = $nrofnews->records[0]['nr'];
- $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
- }
- //}}}
- //{{{ Category page
- if ( "$page" == "newscat" )
- {
- $_SESSION['lastpage']=$page;
- $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
- $cat="1";if ( isset($_REQUEST['catid']) ){$cat=$_REQUEST['catid'];}elseif ( isset($_SESSION['catid']) ){$cat=$_SESSION['catid'];}
- $_SESSION['catid']=$cat;
- $news = $main->getcatnews( $role, $start , $nr, $cat);
- $nrofnews = $main->getcatnrnews( $role, $cat);
- $nrofnews = $nrofnews->records[0]['nr'];
- $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
- }
- //}}}
- //{{{ Guestbook
- if ( "$page" == "guestbook" )
- {
- $_SESSION['lastpage']=$page;
- $cstart=0;if ( isset($_REQUEST['cstart']) ){$cstart=$_REQUEST['cstart'];}
- $cnr=$nr;if ( isset($_REQUEST['cnr']) ){$cnr=$_REQUEST['cnr'];}
- $main->printcomments( "0", $role,$userid,$cstart,$cnr,$page,-1);
- $_SESSION['lastid']="0";
- }
- //}}}
- //{{{ Removed comments
- if ( "$page" == "removedcomments" and $role >= 3)
- {
- $_SESSION['lastpage']=$page;
- $cstart=0;if ( isset($_REQUEST['cstart']) ){$cstart=$_REQUEST['cstart'];}
- $cnr=$nr;if ( isset($_REQUEST['cnr']) ){$cnr=$_REQUEST['cnr'];}
- $main->printcomments( "-1", $role,$userid,$cstart,$cnr,$page,-1);
- $_SESSION['lastid']="-1";
- }
- //}}}
- //{{{ Edit comment
- if ( $page == "editcomment" and $role >= 1)
- {
- print "<script type='text/javascript'>
- function validate(form)
- {
- error=\"\";
- if ( form.header.value == \"\" )
- {
- error=\"".str_replace(":",","," ".$main->edit_array( $text['header'])." ")."\";
- }
- if ( form.data.value == \"\" )
- {
- error=error+\"".str_replace(":",""," ".$main->edit_array( $text['comment'])." ")."\";
- }
- if (error != '' )
- {
- error=error.replace(\":\", \",\");
- alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
- return;
- }
- else
- {
- form.submit();
- }
- }
- </script>";
- $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
- $comment=$main->edit_array($main->getcomment( $userid, $role, $id ));
- print "<form enctype='multipart/form-data' action='?page=savecomment' method='post'><p><input type='hidden' name='rid' value='$requestid' /></p>\n";
- print "<table summary='$text[editcomment]'><tr><td colspan='2'><hr></td></tr>\n";
- if ( $comment['records']['0']['role'] == 0 )
- {
- print "<tr><td>$text[name]</td><td><input name='name' type='text' id='name' value='" . $comment['records']['0']['anonname'] . "'/></td></tr>\n";
- print "<tr><td>$text[email]</td><td><input name='email' type='text' id='email' value='" . $comment['records']['0']['anonemail'] . "'/></td></tr>\n";
- print "<tr><td>$text[homepageheader]</td><td><input name='homepage' type='text' id='email' value='" . $comment['records']['0']['anonhomepage'] . "'/></td></tr>\n";
- }
- print "<tr><td>$text[header]</td><td><input name='header' type='text' id='header' value='" . $comment['records']['0']['headline'] . "'/></td></tr>\n";
- print "<tr><td colspan='2'>$text[comment]</td></tr>\n";
- print "<tr><td colspan='2'><input type='hidden' name='id' value='" . $comment['records']['0']['id'] . "'><textarea name='data' rows='5' cols='60'>" . $comment['records']['0']['data'] . "</textarea></td></tr>\n";
- print "<tr><td colspan='2'><input type='button' value='$text[savecomment]' id='savecomment' onclick=\"validate(this.form)\" class='button'/> <input type='reset' value='$text[reset]' class='button' /></td></tr>\n";
- print "</table></form>\n";
- print "$bbcode";
- }
- //}}}
- //{{{ Remnews
- if ( "$page" == "remnews" and "$role" >= "3" )
- {
- $_SESSION['lastpage']=$page;
- $start="0";if ( isset($_REQUEST['start'])){$start=$_REQUEST['start'];}
- $news = $main->getnews( 4 , 8 , $start , $nr);
- $nrofnews = $main->getnrnews( 4, 8);
- $nrofnews = $nrofnews->records[0]['nr'];
- $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
- }
- //}}}
- //{{{ Downloads
- if ( $page == "downloads")
- {
- print "<span class=\"headline\"><b>$text[downloads]</b></span><br />";
- $dir="/";if( isset($_REQUEST['dir'])){$dir=$_REQUEST['dir'];}
- if ( !isset($_REQUEST['do']) )
- {
- $_REQUEST['do']="";
- }
- if ( $role >= 3 or $role >= $uploadfileaccess )
- {
- if($_REQUEST['do'] == "upload" and isset($_FILES['file']['name']))
- {
- $filename=str_replace(" ","_",basename($_FILES['file']['name']));
- $filename=str_replace("?","a",$filename);
- $filename=str_replace("ä","a",$filename);
- $filename=str_replace("ö","o",$filename);
- $filename=str_replace("?","A",$filename);
- $filename=str_replace("Ä","A",$filename);
- $filename=str_replace("Ö","O",$filename);
- $filename=str_replace("(","_",$filename);
- $filename=str_replace(")","_",$filename);
- $filename=ereg_replace("[^a-z,A-Z,0-9,_,.]","_",$filename);
- $fname=$_REQUEST['fname'];
- $access=$_REQUEST['access'];
- $dir=$_REQUEST['dir'];
- $subdir=$_REQUEST['subdir'];
- $parrentdir=$_REQUEST['parentdir'];
- if ( $subdir != "" )
- {
- $parrentdir=$dir;
- $dir=$subdir;
- }
- $type=$_FILES['file']['type'];
- $owner=$userid;
- $size=$_FILES['file']['size'];
- $newid=$main->addfile($filename,$fname,$access,$dir,$parrentdir,$type,$owner,$size);
- if ( ! $main->uploadanyfile($_FILES['file'],"$filepath/$newid/"))
- {
- $main->deletefile($newid);
- }
- }
-
- …
Large files files are truncated, but you can click here to view the full file