| [ PHPXref.com ] | [ Generated: Sun Jul 20 20:11:31 2008 ] | [ SAPID CMS 1.2.3 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?PHP 2 // vim: set expandtab tabstop=4 shiftwidth=4: 3 // +----------------------------------------------------------------------+ 4 // | SAPID: XML Sapiens Engine Demonstrator | 5 // +----------------------------------------------------------------------+ 6 // | Author: Max Baryshnikov aka Mephius <mb@rg.by> | 7 // | Copyright (c) 2004 Max Baryshnikov | 8 // | http://sapid.sourceforge.net | 9 // +----------------------------------------------------------------------+ 10 // | This source file is free software; you can redistribute it and/or | 11 // | modify it under the terms of the GNU Lesser General Public | 12 // | License as published by the Free Software Foundation; either | 13 // | version 2.1 of the License, or (at your option) any later version. | 14 // | | 15 // | This source file is distributed in the hope that it will be useful, | 16 // | but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 // | Lesser General Public License for more details. | 19 // +----------------------------------------------------------------------+ 20 // Release: 06.12.04 (dd/mm/yy) 21 // $Id: index.php,v 1.10 2005/08/15 15:18:05 mephius Exp $ 22 23 //Cut off lost picture requests 24 if (preg_match("/\.[gjpi][ipnc][fgo]/i", $_SERVER['REQUEST_URI'])) exit; 25 26 27 include (dirname(__FILE__) . "/etc/rc.conf.php"); 28 if(!@include (ROOT_PATH."etc/rc.d/debug.inc.php")) header("Location: install.php"); 29 if(!$http_path or !is_file(ROOT_PATH . "index.php")) message_die("SAPID not yet been configured or configuration is broken.<br /><br />Please, enter the <a href=\"install.php\">configuration utility</a> and create a new configuration."); 30 include (ROOT_PATH . "etc/startup.inc.php"); 31 32 if (!isset($_SESSION["user"]["login"])) { 33 include (ROOT_PATH . "usr/system/counter.inc.php"); 34 }else{ 35 $env["user"]=$_SESSION["user"]; 36 } 37 include (ROOT_PATH."mvc/controller/user_requests_analysis.inc.php"); 38 39 40 $env["area51"]=0; 41 if (isset($_SESSION["user"]["LOGIN"]) and $_SESSION["user"]["NOLOGIN"]=="") { 42 $env["user.aStatus"]=1; 43 $env["area51"]=1; 44 if(isset($_GET["mode"])){ 45 switch ($_GET["mode"]) { 46 case "edit": 47 if($env["page"]["pWrite"]) { 48 $env["mode"]=1; 49 $env["area51"]=2; 50 }else{ 51 $env["mode"]=0; 52 } 53 break; 54 default: 55 $env["mode"]=0; 56 break; 57 } 58 } 59 } 60 61 62 if($panel=="") $sapi_obj = new sapi_parser(ROOT_PATH . "usr/templates/" . $env["page"]["TEMPLATE"], $env); 63 64 65 66 // Looking for an information about current page children 67 if($tree->map) { 68 foreach($tree->map as $k=>$v) { 69 if($v["ID"]==$env["page.ID"]) { $curPointer = $v["POINTER"]; break; } 70 } 71 eval("\$val = \$tree->structure".$curPointer."['CHILDREN'];"); 72 $env["document.children"] = count($val); 73 } 74 75 76 $parse=($panel==""?$sapi_obj->build_page():$panel); 77 78 $stream=""; 79 if (isset($_SESSION["user"]["LOGIN"]) and $_SESSION["user"]["NOLOGIN"]=="") { 80 81 if($env["mode"]==1){ 82 // Delete QC in <title> 83 $parse = preg_replace("/<title>(.*?)<\/title>/is", "", $parse); 84 $parse = preg_replace("/<meta .*?content=\"(.*?)\".*?>/is", "", $parse); 85 include ("usr/system/metapanel.inc.php"); 86 $parse = $metapanel.$parse; 87 } 88 89 if (isset($_POST["quick_save"])) { 90 if ($error_message) $message="<span style='color: #D31412'>".$error_message."</span>"; 91 else $message="<span style='color: #333399'>Data saved</span>"; 92 echo ' 93 <html> 94 <body style="background-color: white; padding: 5px 10px"> 95 <table width="100%" height="100%" border="0"> 96 <tr><td style="font-weight: bold; text-align: center">'.$message.'</td></tr> 97 </table> 98 <script language="javascript1.2"> 99 function Hide_Message(){ 100 top.document.getElementById("message_div").style.left=-300; 101 top.document.getElementById("message_div").style.top=-300; 102 } 103 104 top.document.getElementById("message_div").style.left=top.document.body.clientWidth/2-100; 105 top.document.getElementById("message_div").style.top=top.document.body.clientHeight/2-25+top.document.body.scrollTop; 106 setTimeout(Hide_Message,1500); 107 </script> 108 </body> 109 </html> 110 '; 111 exit; 112 } 113 114 //$action=$env["http_path"] . ($MODREWRITE=="disabled"?"?vpath=":"").preg_replace("/^\/(.*)\/*$/iU", "\\1/", str_replace("?".$_SERVER["QUERY_STRING"], "", $_SERVER["REQUEST_URI"])); 115 $action=$env["http_path"] . ($MODREWRITE=="disabled"?"?vpath=":"") . $env["noslash_argv_string"] . ($env["noslash_argv_string"]==""?"":"/"); 116 if ($env["mode"]==1) { 117 include (ROOT_PATH ."usr/system/js/startup.js.php"); 118 119 $form_header=' 120 <form action="'.$action.'" method="post" enctype="multipart/form-data" name="bcwb_form" id="bcwb_form" style="padding: 0px; display: none;"> 121 <input type="hidden" name="update" value="1"> 122 123 <input type="hidden" name="arg_ImgUrl" value=""> 124 <input type="hidden" name="arg_AltText" value=""> 125 <input type="hidden" name="arg_ImgBorder" value=""> 126 <input type="hidden" name="arg_HorSpace" value=""> 127 <input type="hidden" name="arg_VerSpace" value=""> 128 <input type="hidden" name="arg_ImgAlign" value=""> 129 <input type="hidden" name="arg_ImgHeight" value=""> 130 <input type="hidden" name="arg_ImgWidth" value=""> 131 <input type="hidden" name="arg_FileUrl" value=""> 132 133 '.$GLOBALS["form_fields"]."</form>"; 134 } 135 136 if(!$panel){ 137 preg_match("/<title>(.*)<\/title>/isU", $parse, $matches); 138 $title=$matches[1]; 139 } 140 141 142 // Skin of administrative panel 143 include (ROOT_PATH."usr/themes/default/templates/admin_panel.inc.php"); 144 145 //mod toxin, browser 146 // $stream=<<<PROLOG 147 //<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 148 //"http://www.w3.org/TR/html4/loose.dtd"> 149 //PROLOG; 150 151 $stream.=" 152 <head> 153 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$default_charset."\" /> 154 <link rel=\"stylesheet\" type=\"text/css\" href=\"".$http_path . "usr/".($_SESSION["user"]["LOGIN"]?"system":"content")."/".($panel==""?"light.css":"default.css")."\"> 155 <title>".$metatitle."</title> 156 ".($env["mode"]==1?" 157 <script src=\"".$http_path."usr/system/js/mozile/mozileLoader.js\" type=\"text/javascript\"></script> 158 <SCRIPT LANGUAGE=\"JavaScript\"> 159 function ".substr(0, 5, time())."_go(){ 160 ".$GLOBALS["action_script"]." 161 document.getElementById('bcwb_form').submit(); 162 } 163 </SCRIPT> 164 ":"")." 165 <script language=\"javascript\"> 166 var id_form_focus=false; 167 168 169 function Hide_Message(){ 170 document.getElementById(\"message_div\").style.left=-300; 171 document.getElementById(\"message_div\").style.top=-300; 172 } 173 174 175 function do_quick_save(id_form_focus){ 176 177 if(document.implementation && document.implementation.createDocument){ 178 var data=''; 179 form=document.getElementById(id_form_focus); 180 if(form){ 181 for(i=0; i<form.elements.length; i++){ 182 if(form.elements.item(i).nodeName=='INPUT' || form.elements.item(i).nodeName=='TEXTAREA') { 183 if(form.elements.item(i).name!='' && form.elements.item(i).value!='') data+=(data==''?'':'&')+form.elements.item(i).name+'='+escape(form.elements.item(i).value); 184 } 185 } 186 } 187 request=new XMLHttpRequest(); 188 var method=(form.attributes.getNamedItem('method') && form.attributes.getNamedItem('method').value?form.attributes.getNamedItem('method').value:'GET'); 189 var action=(form.attributes.getNamedItem('action') && form.attributes.getNamedItem('action').value?form.attributes.getNamedItem('action').value:document.baseURI); 190 request.open(method, action, false); 191 request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 192 request.send(data+'&quick_save=1'); 193 document.getElementById('message_div').innerHTML='<table width=\"100%\" height=\"100%\" border=\"0\" style=\"background-color: white\"><tr><td style=\"font-weight: bold; text-align: center; vertical-align: middle; color: #333399; font-size: 12px;\">'+(request.status==200?'Data Saved':'<span style=\"color: red;\">Error</span>')+'</td></tr></table>'; 194 195 document.getElementById(\"message_div\").style.left=top.document.body.clientWidth/2-100; 196 document.getElementById(\"message_div\").style.top=top.document.body.clientHeight/2-25+top.document.body.scrollTop; 197 setTimeout(Hide_Message,1500); 198 199 200 }else{ 201 if (id_form_focus){ 202 203 quick_save.document.write('<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=".$default_charset."\"></HEAD<BODY><DIV style=\"visibility: hidden\">'); 204 quick_save.document.write(document.getElementById(id_form_focus).outerHTML.replace(\"</FORM>\",\"<input type='hidden' name='quick_save' value='true' /></FORM>\")); 205 quick_save.document.write('</DIV></BODY></HTML>'); 206 quick_save.document.close(); 207 quick_save.document.charset=\"".$default_charset."\"; 208 209 quick_save.document.getElementById(id_form_focus).submit(); 210 } 211 } 212 } 213 214 215 function getKeyDown(ev) { 216 if(document.implementation && document.implementation.createDocument){ 217 var data=''; 218 form=document.getElementById(id_form_focus); 219 if(form && ev.charCode==115 && ev.ctrlKey) { 220 ev.preventDefault(); 221 do_quick_save(id_form_focus); 222 return false; 223 } 224 }else{ 225 if (window.event.keyCode==83 && window.event.ctrlKey && id_form_focus) { 226 do_quick_save(id_form_focus); 227 return false; 228 } 229 } 230 } 231 232 if(window.addEventListener) { 233 window.addEventListener('keypress', getKeyDown, true); 234 } else document.onkeydown = getKeyDown; 235 ".($env["mode"]==1?$add_js:"")." 236 </script> 237 ".($_GET["mode"]=="edit" ? "<script type=\"text/javascript\" src=\"".$http_path."usr/system/html2xhtml.js\"></script>" : "")." 238 </head> 239 <body "./*($panel==""?"onscroll=\"move_panel();\"":"").*/"> 240 <div id=\"message_div\" style=\"position:absolute; top:-300px; left:-300px; width:300px; border: solid 1px #9EB9CC; height:75px; vertical-align: middle;\"><iframe name=\"quick_save\" scrolling=\"no\" id=\"quick_save\" style=\"width:300; height:75;\" frameborder=0></iframe></div> 241 <table width=\"100%\" height=\"100%\" cellpadding=0 cellspacing=0 border=0><tr><td height=\"100%\" colspan=2 style=\"vertical-align: top;\"> 242 ".$tools.($env["mode"]==1?$form_header:"").$parse." 243 </td></tr> 244 <tr><td style=\"vertical-align : middle; width: 75%; height: 15px; background-color: #003263; color: white; \"><a class=\"sapidcms_white\" href=\"http://sapid.sourceforge.net\">Sapid v".$VERSION."</a> <span style=\"color: white; font-size: 10px; vertical-align : middle;\">Configured: ".$CONFIGURED."</span></td><td nowrap=\"nowrap\" style=\"height: 15px; background-color: #003263; vertical-align : middle;\"><a class=\"sapidcms_white\" href=\"http://www.redgraphic.com\">Red Graphic Systems Sponsored</a></td></tr></table> 245 </body> 246 </html> 247 "; 248 249 250 251 }else $stream=$parse; 252 253 254 if (preg_match("/DOCTYPE\swml/isU", trim(substr($stream,0,250)))) { 255 header("Content-Type: text/vnd.wap.wml"); 256 } elseif (preg_match("/^<\?xml/isU", trim(substr($stream,0,50)))) { 257 header("Content-type: text/xml"); 258 } 259 260 261 if ($MODREWRITE=="disabled") { 262 $stream=preg_replace("/(<a[\sa-zA-Z\"\._\-=\;\:]+)href=(\"|')?(?:".addcslashes($http_path, "/")."|\/)([^\?]){1}([^\s\"\'\?]{0,})(\"|')?([\sa-zA-Z\"\._\-=]*)>/isU", "\\1href=\\2?vpath=/\\3\\4\\5\\6>", $stream); 263 $stream=preg_replace("/location=(\"|')?(?:".addcslashes($http_path, "/")."|\/)([^\?]{1})([^\s\"\'\?]{0,})(\"|')?/is", "location=\\1".$http_path."?vpath=/\\2\\3\\4", $stream); 264 $stream=preg_replace("/(<form[\sa-zA-Z\"\._\-=\;\:]+)action=(\"|')(?:".addcslashes($http_path, "/")."|\/)([^\?]){1}([^\s\"\'\?]{0,})(\"|')([\sa-zA-Z\"\._\-=]*)>/isU", "\\1action=\\2?vpath=/\\3\\4\\5\\6>", $stream); 265 } 266 267 $env["time_finish"]=getmicrotime(); 268 $env["exec_time"]=$env["time_finish"]-$env["time_start"] . " sec"; 269 270 $stream=str_replace("##gentime##", $env["exec_time"], $stream); 271 echo $stream; 272 273 if ($sapi_obj->error and $_SESSION["user"]["LOGIN"]) echo "<div style=\"position: absolute; top: 40%; left: 40%; background-color: #D9D9D9; border: 1px solid red; padding: 10px; width: 280px; position: absolute; height: 40px; display: block; \"/><b style=\"color: red;\">Error!</b><br /><span style=\"font-size: 10px;\">".$sapi_obj->error."</span></div>"; 274 if($_GET["d"]=="perf" and DEBUG) echo "<div style=\"background-color: Silver; border: 1px solid maroon; padding: 10px; width: 310px; position: absolute; top: 45%; left:36%; height: 40px; display: block; \"/>Execution time: " . $env["exec_time"] . "</div>"; 275 unset($sapi_obj); 276 277 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |