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
00100 $publicPageRequest = false;
00101
00103 $onlineSiteUrl = "http://" . $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'],0,stripos($_SERVER['SCRIPT_NAME'],"index.php")) . "home";
00104
00106 @include_once($sourceFolder."/config.inc.php");
00107
00109 if(!defined("ADMIN_USERID") )
00110 {
00111 echo "Welcome to Pragyan CMS v3.0. <a href='./INSTALL/'>Click Here</a> to goto installation page.<br/><br/>
00112 <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.";
00113 exit();
00114 }
00115
00117 require_once($sourceFolder."/common.lib.php");
00118
00119 require_once($sourceFolder."/icons.lib.php");
00120
00122 $dbase;
00123
00125 connect();
00126
00128 require_once($sourceFolder."/authenticate.lib.php");
00129 $cookieSupported = checkCookieSupport();
00130 if($cookieSupported==true) session_start();
00131 $userId=firstTimeGetUserId();
00133 if(isset($_GET['page']))
00134 $pageFullPath = strtolower($_GET['page']);
00136 else if(isset($_GET['user'])) {
00137 $publicPageRequest = true;
00138 $userProfileName = $_GET['user'];
00139
00140 $pageFullPath = "home";
00141 }
00142 else $pageFullPath = "home";
00143
00145 if(isset($_GET['action']))
00146 $action = strtolower(escape($_GET['action']));
00147 else $action = "view";
00148
00150 if ($action == 'keepalive')
00151 die("OK: " . rand());
00152
00154 $globals=getGlobalSettings();
00155 foreach($globals as $var=>$val)
00156 $$var=$val;
00157
00158
00159 if($openid_enabled=='true'){
00160 set_include_path('cms/openid/');
00161 require_once 'cms/openid/class.dopeopenid.php';
00162 }
00164 $rewriteEngineEnabled=$url_rewrite;
00165
00167
00169 define("CMS_TITLE", $cms_title);
00170
00172 define("DEF_TEMPLATE",$default_template);
00173
00175 define("UPLOAD_SIZE_LIMIT", $upload_limit);
00176
00178 define("SEND_MAIL_ON_REGISTRATION",($default_mail_verify==0)?false:true);
00179
00181 define("CMS_EMAIL",$cms_email);
00182
00184 define("ACTIVATE_USER_ON_REG",$default_user_activate);
00185
00186 $SITEDESCRIPTION=$cms_desc;
00187 $SITEKEYWORDS=$cms_keywords;
00188 $FOOTER=$cms_footer;
00189
00191
00192 require_once($sourceFolder."/parseurl.lib.php");
00193 require_once($sourceFolder."/template.lib.php");
00194 require_once($sourceFolder."/menu.lib.php");
00195 require_once($sourceFolder."/breadcrumbs.lib.php");
00196 require_once($sourceFolder."/permission.lib.php");
00197 require_once($sourceFolder."/content.lib.php");
00198 require_once($sourceFolder."/inheritedinfo.lib.php");
00199 require_once($sourceFolder."/actionbar.lib.php");
00200 require_once($sourceFolder."/registration.lib.php");
00201 require_once($sourceFolder."/widget.lib.php");
00202 require_once($sourceFolder."/login.lib.php");
00203
00204
00206
00208 if($publicPageRequest) {
00209
00210 define("TEMPLATE", getPageTemplate(0));
00211 $TITLE = $userProfileName;
00212
00213 $CONTENT = "You are currently viewing a Public Profile of ". htmlentities($userProfileName);
00214 $MENUBAR = '';
00215 templateReplace($TITLE,$MENUBAR,$ACTIONBARMODULE,$ACTIONBARPAGE,$BREADCRUMB,$INHERITEDINFO,$CONTENT,$FOOTER,$DEBUGINFO,$ERRORSTRING,$WARNINGSTRING,$INFOSTRING,$STARTSCRIPTS,$LOGINFORM);
00216 exit();
00217 }
00218
00220 $pageId = parseUrlReal($pageFullPath, $pageIdArray);
00221
00223 if ($pageId === false) {
00224 define("TEMPLATE", getPageTemplate(0));
00225 $pageId = parseUrlReal("home", $pageIdArray);
00226 $TITLE = CMS_TITLE;
00227 $MENUBAR = '';
00228 $CONTENT = "The requested URL was not found on this server.<br />$_SERVER[SERVER_SIGNATURE]".
00229 "<br /><br />Click <a href='".$urlRequestRoot."'>here </a> to return to the home page";
00230 templateReplace($TITLE,$MENUBAR,$ACTIONBARMODULE,$ACTIONBARPAGE,$BREADCRUMB,$INHERITEDINFO,$CONTENT,$FOOTER,$DEBUGINFO,$ERRORSTRING,$WARNINGSTRING,$INFOSTRING,$STARTSCRIPTS,$LOGINFORM);
00231 exit();
00232 }
00233
00235 logInfo (getUserEmail($userId),$userId, $pageId, $pageFullPath, getPageModule($pageId), $action, $_SERVER['REMOTE_ADDR']);
00236
00238 if(URLSecurityCheck($_GET))
00239 {
00240 define("TEMPLATE", getPageTemplate(0));
00241 $pageId = parseUrlReal("home", $pageIdArray);
00242 $TITLE = CMS_TITLE;
00243 $MENUBAR = '';
00244 $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]".
00245 "<br /><br />Click <a href='".$urlRequestRoot."'>here </a> to return to the home page";
00246 templateReplace($TITLE,$MENUBAR,$ACTIONBARMODULE,$ACTIONBARPAGE,$BREADCRUMB,$INHERITEDINFO,$CONTENT,$FOOTER,$DEBUGINFO,$ERRORSTRING,$WARNINGSTRING,$INFOSTRING,$STARTSCRIPTS,$LOGINFORM);
00247 exit();
00248 }
00249
00251 if(isset($_GET['fileget'])) {
00252 require_once($sourceFolder."/download.lib.php");
00253 $action="";
00254 if(isset($_GET['action']))
00255 $action=$_GET['action'];
00256 download($pageId,$userId,$_GET['fileget'],$action);
00257 exit();
00258 }
00259
00261 $permission = getPermissions($userId, $pageId, $action);
00262
00264 define("TEMPLATE", getPageTemplate($pageId));
00265
00267 if (getTitle($pageId, $action, $TITLE))
00268 $TITLE = CMS_TITLE . " - $TITLE";
00269 else
00270 $TITLE = CMS_TITLE;
00271
00273 $CONTENT = getContent($pageId, $action, $userId, $permission);
00274
00276 $INHERITEDINFO = inheritedinfo($pageIdArray);
00277
00279 $BREADCRUMB = breadcrumbs($pageIdArray," ยป ");
00280
00282 $MENUBAR = getMenu($userId, $pageIdArray);
00283
00285 if($userId == 0)
00286 $LOGINFORM = loginForm();
00287 else
00288 {
00289 $userNameFromId = getUserName($userId);
00290 $LOGINFORM = "Welcome {$userNameFromId}.";
00291 }
00292
00294 $ACTIONBARPAGE = getActionbarPage($userId, $pageId);
00295
00297 $ACTIONBARMODULE = getActionbarModule($userId, $pageId);
00298
00300 populateWidgetVariables($pageId);
00301
00303 if($rewriteEngineEnabled=='false') {
00304 $TITLE = convertUri($TITLE);
00305 $MENUBAR = convertUri($MENUBAR);
00306 $CONTENT = convertUri($CONTENT);
00307 $INHERITEDINFO = convertUri($INHERITEDINFO);
00308 $BREADCRUMB = convertUri($BREADCRUMB);
00309 $ACTIONBARPAGE = convertUri($ACTIONBARPAGE);
00310 $ACTIONBARMODULE = convertUri($ACTIONBARMODULE);
00311 $INFOSTRING = convertUri($INFOSTRING);
00312 $ERRORSTRING = convertUri($ERRORSTRING);
00313 $WARNINGSTRING = convertUri($WARNINGSTRING);
00314 $LOGINFORM = convertUri($LOGINFORM);
00315 }
00316
00318 if($debugSet == "on") {
00319 $DEBUGINFO .= "Page Full text path : ".$pageFullPath."<br /><br />\n";
00320 $DEBUGINFO .= "UID : ".getUserId()."<br /><br />\n";
00321 $DEBUGINFO .= "GIDS : ".arraytostring(getGroupIds($userId))."<br /><br />\n";
00322 $DEBUGINFO .= "Action : ".$action."<br /><br />\n";
00323 $DEBUGINFO .= "Get Vars : ".arraytostring($_GET)."<br /><br />\n";
00324 $DEBUGINFO .= "Page Id : ".$pageId."<br /><br />\n";
00325 $DEBUGINFO .= "Page id path : ".arraytostring($pageIdArray)."\n<br /><br />";
00326 $DEBUGINFO .= "Title : ".$TITLE."\n<br /><br />";
00327 $DEBUGINFO .= "SERVER info : ".arraytostring($_SERVER)."\n<br /><br />";
00328 $DEBUGINFO .= "POST info : ".arraytostring($_POST)."\n<br /><br />";
00329 $DEBUGINFO .= "FILES info : ".arraytostring($_FILES)."\n<br /><br />";
00330 $DEBUGINFO .= "SESSION info : ".arraytostring($_SESSION)."\n<br /><br />";
00331 $DEBUGINFO .= "STARTSCRIPTS : ".$STARTSCRIPTS."\n<br/><br/>";
00332 if($DEBUGINFO!="") displayinfo($DEBUGINFO);
00333 }
00334
00336 setcookie("cookie_support", "enabled", 0, "/");
00337
00339 templateReplace($TITLE,$MENUBAR,$ACTIONBARMODULE,$ACTIONBARPAGE,$BREADCRUMB,$INHERITEDINFO,$CONTENT,$FOOTER,$DEBUGINFO,$ERRORSTRING,$WARNINGSTRING,$INFOSTRING,$STARTSCRIPTS,$LOGINFORM);
00340
00341 disconnect();
00342 exit();
00343