00001 <?php 00028 00029 define('__PRAGYAN_CMS',')$!%^!%#^@'); 00030 00032 $cmsFolder="cms"; 00033 00035 $moduleFolder = "modules"; 00036 00038 $templateFolder = "templates"; 00039 00041 $uploadFolder = "uploads"; 00042 00044 $widgetFolder = "widgets"; 00045 00047 $debugSet = "off"; 00048 00050 $sourceFolder = substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/'))."/".$cmsFolder; 00051 00053 $PAGELASTUPDATED=""; 00054 00056 $ERRORSTRING = ""; 00057 00059 $INFOSTRING = ""; 00060 00062 $WARNINGSTRING = ""; 00063 00065 $STARTSCRIPTS = ""; 00066 00068 $urlRequestRoot = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')); 00069 00071 $TEMPLATEBROWSERPATH = ""; 00072 00074 $TEMPLATECODEPATH = ""; 00075 00077 $SITEDESCRIPTION = ""; 00078 00080 $SITEKEYWORDS = ""; 00081 00083 $LOGINFORM = ""; 00084 00086 $DEBUGINFO = ""; 00087 00089 $cookieSupported = false; 00090 00092 $ICONS = ""; 00093 00095 $ICONS_SRC = ""; 00096 00098 $WIDGETS = array(); 00099 00101 $onlineSiteUrl = "http://" . $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'],0,stripos($_SERVER['SCRIPT_NAME'],"index.php")) . "home"; 00102 00104 @include_once($sourceFolder."/config.inc.php"); 00105 00107 if(!defined("ADMIN_USERID") ) 00108 { 00109 echo "Welcome to Pragyan CMS v3.0. <a href='./INSTALL/'>Click Here</a> to goto installation page.<br/><br/> 00110 <b>NOTE:</b>If you're not using the <a href='http://sourceforge.net/projects/pragyan'>official package</a> of the Pragyan CMS or you're installing for the second time, then please make sure that the 'RewriteEngine' property is set to 'Off' in the .htaccess file present in the root folder of Pragyan for the above link to work correctly."; 00111 exit(); 00112 } 00113 00115 require_once($sourceFolder."/common.lib.php"); 00116 00117 require_once($sourceFolder."/icons.lib.php"); 00118 00120 $dbase; 00121 00123 connect(); 00124 00126 require_once($sourceFolder."/authenticate.lib.php"); 00127 $cookieSupported = checkCookieSupport(); 00128 if($cookieSupported==true) session_start(); 00129 $userId=firstTimeGetUserId(); 00130 if(isset($_GET['page'])) 00131 $pageFullPath = strtolower($_GET['page']); 00132 else $pageFullPath = "home"; 00133 00135 if(isset($_GET['action'])) 00136 $action = strtolower(escape($_GET['action'])); 00137 else $action = "view"; 00138 00140 if ($action == 'keepalive') 00141 die("OK: " . rand()); 00142 00144 $globals=getGlobalSettings(); 00145 foreach($globals as $var=>$val) 00146 $$var=$val; 00147 00148 00149 if($openid_enabled=='true'){ 00150 set_include_path('cms/openid/'); 00151 require_once 'cms/openid/class.dopeopenid.php'; 00152 } 00154 $rewriteEngineEnabled=$url_rewrite; 00155 00157 00159 define("CMS_TITLE", $cms_title); 00160 00162 define("DEF_TEMPLATE",$default_template); 00163 00165 define("UPLOAD_SIZE_LIMIT", $upload_limit); 00166 00168 define("SEND_MAIL_ON_REGISTRATION",($default_mail_verify==0)?false:true); 00169 00171 define("CMS_EMAIL",$cms_email); 00172 00174 define("ACTIVATE_USER_ON_REG",$default_user_activate); 00175 00176 $SITEDESCRIPTION=$cms_desc; 00177 $SITEKEYWORDS=$cms_keywords; 00178 $FOOTER=$cms_footer; 00179 00181 00182 require_once($sourceFolder."/parseurl.lib.php"); 00183 require_once($sourceFolder."/template.lib.php"); 00184 require_once($sourceFolder."/menu.lib.php"); 00185 require_once($sourceFolder."/breadcrumbs.lib.php"); 00186 require_once($sourceFolder."/permission.lib.php"); 00187 require_once($sourceFolder."/content.lib.php"); 00188 require_once($sourceFolder."/inheritedinfo.lib.php"); 00189 require_once($sourceFolder."/actionbar.lib.php"); 00190 require_once($sourceFolder."/registration.lib.php"); 00191 require_once($sourceFolder."/widget.lib.php"); 00192 require_once($sourceFolder."/login.lib.php"); 00193 00194 00195 00196 00198 $pageId = parseUrlReal($pageFullPath, $pageIdArray); 00199 00201 if ($pageId === false) { 00202 define("TEMPLATE", getPageTemplate(0)); 00203 $pageId = parseUrlReal("home", $pageIdArray); 00204 $TITLE = CMS_TITLE; 00205 $MENUBAR = ''; 00206 $CONTENT = "The requested URL was not found on this server.<br />$_SERVER[SERVER_SIGNATURE]". 00207 "<br /><br />Click <a href='".$urlRequestRoot."'>here </a> to return to the home page"; 00208 templateReplace($TITLE,$MENUBAR,$ACTIONBARMODULE,$ACTIONBARPAGE,$BREADCRUMB,$INHERITEDINFO,$CONTENT,$FOOTER,$DEBUGINFO,$ERRORSTRING,$WARNINGSTRING,$INFOSTRING,$STARTSCRIPTS,$LOGINFORM); 00209 exit(); 00210 } 00211 00213 logInfo (getUserEmail($userId),$userId, $pageId, $pageFullPath, getPageModule($pageId), $action, $_SERVER['REMOTE_ADDR']); 00214 00216 if(URLSecurityCheck($_GET)) 00217 { 00218 define("TEMPLATE", getPageTemplate(0)); 00219 $pageId = parseUrlReal("home", $pageIdArray); 00220 $TITLE = CMS_TITLE; 00221 $MENUBAR = ''; 00222 $CONTENT = "The requested URL was found to have invalid syntax and cannot be processed for security reasons.<br/> If you believe its a". "correct URL, please contact the administrator immediately..<br />$_SERVER[SERVER_SIGNATURE]". 00223 "<br /><br />Click <a href='".$urlRequestRoot."'>here </a> to return to the home page"; 00224 templateReplace($TITLE,$MENUBAR,$ACTIONBARMODULE,$ACTIONBARPAGE,$BREADCRUMB,$INHERITEDINFO,$CONTENT,$FOOTER,$DEBUGINFO,$ERRORSTRING,$WARNINGSTRING,$INFOSTRING,$STARTSCRIPTS,$LOGINFORM); 00225 exit(); 00226 } 00227 00229 if(isset($_GET['fileget'])) { 00230 require_once($sourceFolder."/download.lib.php"); 00231 $action=""; 00232 if(isset($_GET['action'])) 00233 $action=$_GET['action']; 00234 download($pageId,$userId,$_GET['fileget'],$action); 00235 exit(); 00236 } 00237 00239 $permission = getPermissions($userId, $pageId, $action); 00240 00242 define("TEMPLATE", getPageTemplate($pageId)); 00243 00245 if (getTitle($pageId, $action, $TITLE)) 00246 $TITLE = CMS_TITLE . " - $TITLE"; 00247 else 00248 $TITLE = CMS_TITLE; 00249 00251 $CONTENT = getContent($pageId, $action, $userId, $permission); 00252 00254 $INHERITEDINFO = inheritedinfo($pageIdArray); 00255 00257 $BREADCRUMB = breadcrumbs($pageIdArray," ยป "); 00258 00260 $MENUBAR = getMenu($userId, $pageIdArray); 00261 00263 if($userId == 0) 00264 $LOGINFORM = loginForm(); 00265 else 00266 { 00267 $userNameFromId = getUserName($userId); 00268 $LOGINFORM = "Welcome {$userNameFromId}."; 00269 } 00270 00272 $ACTIONBARPAGE = getActionbarPage($userId, $pageId); 00273 00275 $ACTIONBARMODULE = getActionbarModule($userId, $pageId); 00276 00278 populateWidgetVariables($pageId); 00279 00281 if($rewriteEngineEnabled=='false') { 00282 $TITLE = convertUri($TITLE); 00283 $MENUBAR = convertUri($MENUBAR); 00284 $CONTENT = convertUri($CONTENT); 00285 $INHERITEDINFO = convertUri($INHERITEDINFO); 00286 $BREADCRUMB = convertUri($BREADCRUMB); 00287 $ACTIONBARPAGE = convertUri($ACTIONBARPAGE); 00288 $ACTIONBARMODULE = convertUri($ACTIONBARMODULE); 00289 $INFOSTRING = convertUri($INFOSTRING); 00290 $ERRORSTRING = convertUri($ERRORSTRING); 00291 $WARNINGSTRING = convertUri($WARNINGSTRING); 00292 $LOGINFORM = convertUri($LOGINFORM); 00293 } 00294 00296 if($debugSet == "on") { 00297 $DEBUGINFO .= "Page Full text path : ".$pageFullPath."<br /><br />\n"; 00298 $DEBUGINFO .= "UID : ".getUserId()."<br /><br />\n"; 00299 $DEBUGINFO .= "GIDS : ".arraytostring(getGroupIds($userId))."<br /><br />\n"; 00300 $DEBUGINFO .= "Action : ".$action."<br /><br />\n"; 00301 $DEBUGINFO .= "Get Vars : ".arraytostring($_GET)."<br /><br />\n"; 00302 $DEBUGINFO .= "Page Id : ".$pageId."<br /><br />\n"; 00303 $DEBUGINFO .= "Page id path : ".arraytostring($pageIdArray)."\n<br /><br />"; 00304 $DEBUGINFO .= "Title : ".$TITLE."\n<br /><br />"; 00305 $DEBUGINFO .= "SERVER info : ".arraytostring($_SERVER)."\n<br /><br />"; 00306 $DEBUGINFO .= "POST info : ".arraytostring($_POST)."\n<br /><br />"; 00307 $DEBUGINFO .= "FILES info : ".arraytostring($_FILES)."\n<br /><br />"; 00308 $DEBUGINFO .= "SESSION info : ".arraytostring($_SESSION)."\n<br /><br />"; 00309 $DEBUGINFO .= "STARTSCRIPTS : ".$STARTSCRIPTS."\n<br/><br/>"; 00310 if($DEBUGINFO!="") displayinfo($DEBUGINFO); 00311 } 00312 00314 setcookie("cookie_support", "enabled", 0, "/"); 00315 00317 templateReplace($TITLE,$MENUBAR,$ACTIONBARMODULE,$ACTIONBARPAGE,$BREADCRUMB,$INHERITEDINFO,$CONTENT,$FOOTER,$DEBUGINFO,$ERRORSTRING,$WARNINGSTRING,$INFOSTRING,$STARTSCRIPTS,$LOGINFORM); 00318 00319 disconnect(); 00320 exit(); 00321