Location: PHPKode > projects > ZAPms > zap/index.php
<?php
/* ==================================================== ##
##             COPYRIGHTS © ZAPms PHP TEAM              ##
## ==================================================== ##
## PRODUCT : CMS(CONTENT MANAGEMENT SYSTEM)             ##
## LICENSE : GNU 2(General Public License v.2)          ##
## TECHNOLOGIES : PHP & MySQL                           ##
## WWW : www.zapms.de | www.marchenko.de                ##
## E-MAIL : hide@address.com, hide@address.com          ##
## ==================================================== */

ini_set('default_charset','utf-8');

include_once 'include/libs.php';
include_once 'include/constants.php';
include_once 'include/sess.php';
include_once 'include/in.php';

if (!empty($_POST['entry_id']) || !empty($_GET['entry_id']))
$entry_id = (!empty($_POST['entry_id'])) ? $_POST['entry_id'] : $_GET['entry_id'];
if (!is_numeric($entry_id) || !$entry_id) $entry_id = 1;

if (!empty($_POST['action']) || !empty($_GET['action']))
$action = (!empty($_POST['action'])) ? $_POST['action'] : $_GET['action'];
if (!$action) $action = 'list';

$left_frame = 'core_dtree.tpl';
$right_frame = 'core_help.tpl';
$display_frame = 'core_default.tpl';

//------------------------------------------------------------
// Session Checking
	$sid = '';
	$auth_id = 0;
	$auth_time = 0;
	$auth_var1 = '';
	$auth_var2 = '';
	$auth_var3 = '';
	$auth_var4 = '';
	$auth_var5 = '';
	if (!empty($_POST['sid']) || !empty($_GET['sid'])) {
		$sid = (!empty($_POST['sid'])) ? $_POST['sid'] : $_GET['sid'];
		if(sess_is_registered($sid)) {
			$auth_info = sess_read($sid);
			list($auth_id, $auth_time, $auth_var1, $auth_var2, $auth_var3, $auth_var4, $auth_var5) = preg_split('/#/', $auth_info);
			//print $auth_info.' ';
			//print $auth_id.' '.$auth_time;
			sess_update();
		} else
			$sid = '';
	}
	if ($sid) $SID = 'sid='.$sid;
//------------------------------------------------------------
// CONFIG modul
		include_once MODUL_DIR.'config/Config.php';
		$cfg_obj = new Config(DB_PREFIX);
		$cfg_global = $cfg_obj->getConfigInfo();
		// global variables
		while(list($tmp_var, $tmp_param) = @each($cfg_global))
			$$tmp_var = $tmp_param;

		if ($entry_id > 1) {
			$cfg_local = $cfg_obj->getConfigInfo($entry_id);
			// local variables
			while(list($tmp_var, $tmp_param) = @each($cfg_local))
				$$tmp_var = $tmp_param;
		}
//------------------------------------------------------------
// SYSTEM WARNINGS library
		$ui_lang = $cfg_global['msg_lang'];
		include_once 'include/warnings.php';
		$smarty->assign('ui_lang', $ui_lang);
//------------------------------------------------------------
// USERS modul
	if ($auth_id) {
		include_once MODUL_DIR.'users/Users.php';
		$users_obj = new Users(DB_PREFIX);
		$user_info = $users_obj->getUserInfo($auth_id);
		//print_r($user_info);
// assign variables
		assignArray($user_info, 'user_info');
	} else {
		include_once MODUL_DIR.'users/login.php';
// open help by DEFAULT
		$entry_id = ($entry_id_default) ? ($entry_id_default) : (4);
		$action = 'list';
	}
//------------------------------------------------------------
// PROFILS modul
// include user's profil
	if ($auth_id) {
		include_once MODUL_DIR.'users/Profils.php';
		$profils_obj = new Profils(DB_PREFIX);
		$cfg_profil = $profils_obj->getProfilsInfo($auth_id);
		// get favorites
		assignArray(explodeRequestValues($cfg_profil['srh_sort']), 'modules_fav');
	}
//------------------------------------------------------------
// DTREE modul
	if ($auth_id) {
		include_once MODUL_DIR.'dtree/Dtree.php';
		$dtree_obj = new Dtree(DB_PREFIX);
		// get entry details
		$dtree_obj->setFilterByUserId($auth_id);
		$dtree_obj->setFilterByAttr(0, -1, 1);
		$entry_info = $dtree_obj->getEntryInfo($entry_id);
		if ($entry_info) {
			$modul_path = MODUL_DIR.$entry_info['entry_path'];
			// assign variables
			assignArray($entry_info, 'entry_info');
			//print $entry_path;
			// view_mode: 0 - module file is not found, 1 - core, 2 - modul
			$view_mode = (file_exists($modul_path)) ? (1) : (0);
		} else
			$view_mode = 0;
		// get modules prefixes
		$MODULES_PREFIX_ARRAY = $dtree_obj->getPrefixes();
		//print_r($entry_info);
//------------------------------------------------------------
// SECURITY verification
		$action_attr_array = array(
			'list' => 1,
			'details' => 1,
			'edit' => 2,
			'create' => 3,
			'delete' => 4);
		if ($action_attr_array[$action] > $entry_info['entry_attr'])
			$action = 'error';
//------------------------------------------------------------
// Include custom modul
		if ($view_mode)
			include_once $modul_path;
//------------------------------------------------------------
// Display Dtree
		// get dtree array
		if ($action == 'list') {
			$dtree_obj->resetFilter();
			$dtree_obj->setFilterByUserId($auth_id);
			$dtree_obj->setFilterByAttr(0, -1, 1);
			$dtree_data = $dtree_obj->getDtreeJS($SID, $entry_id);
			//print_r($dtree_obj->array_dtree);
		}
	}
//------------------------------------------------------------
// SMARTY modul
	if ($view_mode < 2) {
		if (!$view_mode) {
			$right_frame = 'core_error.tpl';
			$error_msg .= $SYS_WARN_MSG[$ui_lang]['modul_notfound'];
		}
		//$error_msg = 'Modul can not be found.';
		//$warning_msg = 'Modul can not be found.';
		$smarty->assign('error_msg', $error_msg);
		$smarty->assign('warning_msg', $warning_msg);
		
		$smarty->assign('site_url', $site_url);
		$smarty->assign('site_title', $site_title);
		$smarty->assign('zap_ver', $zap_ver);
		$smarty->assign('zap_theme', $zap_theme);
		$smarty->assign('left_frame', $left_frame);
		$smarty->assign('right_frame', $right_frame);
		
		$smarty->assign('entry_id', $entry_id);
		$smarty->assign('entry_id_default', $entry_id_default);
		$smarty->assign('SID', $SID);
		$smarty->assign('DTREE_DATA', $dtree_data);
		
		$smarty->display($display_frame); 
	}

include_once 'include/out.php';

?>
Return current item: ZAPms