";
clearoldadmins();
// admin stuff
if ($do=="admin") {
if ($action=="login"){
if ($name==$adminname && $pwd==$adminpwd){
include($log);
$fp=fopen($log, "w");
fputs($fp, "\n");
$i=0;
if (count($admins)>0){
foreach ($admins as $line){
fputs($fp, "\$admins[$i]['time']=".$line[time]."; \$admins[$i]['hash']='".$line['hash']."';\n");
$i++;
}
}
fputs($fp, "\$admins[$i]['time']=".$now."; \$admins[$i]['hash']='".md5($hash)."';\n?>");
fclose($fp);
jsRedirect($me.$getvars);
}
}
if ($action=="delete" && isloggedin()){
$todel=getkey($id, $stuff);
unset($stuff->data[$todel]);
$stuff->msort();
saveposts($stuff->data);
$do="view";
}else{
?>
}
}
if (isloggedin()){
showmenu();
if ($do=="add"){
if ($action=="save"){
$error=false;
$saveit=false;
if ($title=="") $error.=" » $txtbadtitle"; //if ($story=="") $error.=" » $txtbadstory"; if ($teaser=="") $error.=" » $txtbadteaser"; if ($date=="") $error.=" » $txtbaddate"; if ($error===false){ $date = explode(".", $date); $daytime = explode(".", $_REQUEST['daytime']); $daytime[0] = (is_numeric($daytime[0]) && $daytime[0] >= 0 && $daytime[0] < 24) ? $daytime[0] : 23; $daytime[1] = (is_numeric($daytime[1]) && $daytime[1] >= 0 && $daytime[1] < 60) ? $daytime[1] : 59; $time = mktime($daytime[0], $daytime[1], 0, $date[1], $date[0], $date[2]); $story = ($_REQUEST['hasstory'] == 1) ? $_REQUEST['story'] : ""; if ($id=="new"){ $index=$numposts; $id=$nextindex; $saveit=true; }else if (is_numeric($id)){ $index=getkey($id, $stuff); $saveit=true; } if ($saveit){ $stuff->data[$index]['id']=$id; $stuff->data[$index]['time']=$time; $stuff->data[$index]['mode']=$_REQUEST['mode']; $stuff->data[$index]['title']=str_replace(array("|"), array(" "), $title); if ($wysiwyg===true){ $stuff->data[$index]['teaser']=stripslashes(str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $teaser)); $stuff->data[$index]['story']=stripslashes(str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $story)); }else{ $stuff->data[$index]['teaser']=str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $teaser); $stuff->data[$index]['story']=str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $story); } saveposts($stuff->data); $stuff->msort(); $empty=false; } $do="view"; }else echo " $txterrors$error ";
}else{
if ($action=="edit"){
$post=$stuff->data[getkey($id, $stuff)];
$title= htmlentities(stripslashes($post['title']), ENT_QUOTES);
if ($wysiwyg===true){
$teaser = ($post['teaser']);
$story = ($post['story']);
}else{
$teaser=stripslashes(str_replace("$txtclickback ", "\n", htmlentities($post['teaser'], ENT_QUOTES))); $story=stripslashes(str_replace(" ", "\n", htmlentities($post['story'], ENT_QUOTES))); } $time=$post['time']; $mode = $post['mode']; $hasstory = (trim($story) != "") ? true : false; }else{ $title=""; $story=""; $time="notset"; $id="new"; $mode = "dynamic"; $hasstory = true; } ?> } } } // display posts if ($do=="view" || !isset($do)){ if (!$empty){ $templates = implode("", file($templatefile)); $tpl_teaser = getTemplate("TEASER", $templates); $tpl_story = getTemplate("STORY", $templates); // show full story of specific news if (is_numeric($_GET['mnid'])){ $item = $stuff->data[getkey($_GET['mnid'], $stuff)]; $item['title'] = stripslashes($item['title']); $item['teaser'] = stripslashes($item['teaser']); $item['story'] = stripslashes($item['story']); if ($wrap!==false) $item['story']=wordwrap($item['story'], $wrap, " ", 1); $match=array("{title}", "{time}", "{teaser}", "{story}", "{edit}", "{delete}", "{urltoallnews}"); if (isloggedin()){ $replace=array( $item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "$txtedit", "$txtdelete", "$me$getvars&page=".$_GET['page']); }else $replace=array($item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "", "", "$me$getvars&page=".$_GET['page']); $tmp = str_replace($match, $replace, $tpl_story); ob_start(); eval("?>".$tmp.""); $tmpparsed = ob_get_contents(); ob_end_clean(); $html .= $tmpparsed; echo stripslashes($html); // show all news }else{ $i=1; $from=(is_numeric($_GET['page'])) ? (($_GET['page']-1)*$ppp)+1 : 1; foreach($stuff->data as $item){ if ($item['id']!=0 && $i>=$from && $i< ($from+$ppp) ){ $item['title'] = stripslashes($item['title']); $item['teaser'] = stripslashes($item['teaser']); $item['story'] = stripslashes($item['story']); $hasstory = (trim($item['story']) != "") ? true : false; if ($wrap!==false) $item['story']=wordwrap($item['story'], $wrap, " ", 1); $match=array("{title}", "{time}", "{teaser}", "{story}", "{edit}", "{delete}", "{urltofullstory}"); if (isloggedin()){ $replace=array( $item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "$txtedit", "$txtdelete", ($hasstory === true) ? "$me$getvars&mnid=".$item['id']."&page=".$_GET['page'] : "" ); }else{ $replace = array($item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "", "", ($hasstory === true) ? "$me$getvars&mnid=".$item['id']."&page=".$_GET['page'] : "" ); } $tmp = str_replace($match, $replace, $tpl_teaser); ob_start(); eval("?>".$tmp.""); $tmpparsed = ob_get_contents(); ob_end_clean(); $html .= $tmpparsed; } $i++; } echo stripslashes($html); $numpages=(fmod($numposts,$ppp)>0) ? floor($numposts/$ppp)+1 : ($numposts/$ppp); echo " "; echo paging($numpages); echo " "; } } } // closing table tags // Please don't remove the 'powered by...' link echo " |
"; if (!isloggedin()) echo "$txtadmin"; else echo "$txtlogout "; echo " |