Beispiel #1
0
 function profile()
 {
     events::observe('save', 'system', 'users', 'saveProfile');
     events::observer();
     admin::components('validator');
     admin::addHeader(' ' . adminUser::get('user_login'));
     f::set(adminUser::gets());
 }
Beispiel #2
0
 function load($user_id)
 {
     if (self::$user) {
         return true;
     }
     db::table('admin_users');
     db::where('user_id', $user_id);
     db::where('user_pub', 1);
     db::limit(1);
     self::$user = db::assoc();
     if (db::rows() == 0) {
         admin::logout();
     }
     define("ADMIN_USER_ID", $user_id);
     define("ADMIN_USER_SITE_ID", self::get('site_id'));
     define("ADMIN_USER_GROUP_ID", self::get('group_id'));
     s::set('ADMIN_USER_LOGIN', self::get('user_login'));
     s::set('ADMIN_USER_ID', $user_id);
     return true;
 }
Beispiel #3
0
 function login()
 {
     $err = true;
     $pass = md5(params::get('user_password'));
     if (adminUser::auth(params::get('user_login'), $pass)) {
         $err = false;
         if (params::get('user_login') != adminUser::get('user_login') && $pass != adminUser::get('user_password')) {
             $err = true;
         } else {
             $word = 'legenda';
             $mem = md5(adminUser::get('user_login') . $word);
             setcookie('legenda', adminUser::get('user_login') . ',' . adminUser::get('user_id') . ',' . $mem, time() + 86400 * 14, "/");
             $_SESSION['ADMIN_AUTH'] = 1;
             $_SESSION['ADMIN_USER_ID'] = adminUser::get('user_id');
         }
     }
     if ($err) {
         buffer::add('Неверный логин или пароль');
     }
 }
Beispiel #4
0
 function observer()
 {
     if (isset($_SESSION['ADMIN_AUTH'])) {
         adminUser::load($_SESSION['ADMIN_USER_ID']);
         return true;
     } else {
         self::observerMemory();
         return false;
     }
 }
Beispiel #5
0
echo $return;
echo "\n";
echo "给用户开发者权限结束\n";
//给用户api提供者权限
echo "给用户api提供者权限开始\n";
$adminUserApiProviderParams = array('email' => $configUserName);
$adminUser = new adminUser($configPrismUrl, $configAdminKey, $configAdminSecret);
$return = $adminUser->apiprovider($adminUserApiProviderParams);
unset($adminUser);
echo $return;
echo "\n";
echo "给用户api提供者权限结束\n";
//获取用户的管理key和secret
echo "获取用户的管理key和secret开始\n";
$adminUserInfoParams = array('email' => $configUserName);
$adminUser = new adminUser($configPrismUrl, $configAdminKey, $configAdminSecret);
$return = $adminUser->info($adminUserInfoParams);
unset($adminUser);
echo $return;
echo "\n";
$return = json_decode($return, 1);
$configUserKey = $return['result']['Key'];
$configUserSecret = $return['result']['Secret'];
echo "获取用户的管理key和secret结束\n";
//导入api数据
//$configApiId = "olgq7x4i";
echo "导入api数据开始\n";
$userApiImportParams = array('url' => $configJSONFileUrl);
$userApi = new userApi($configPrismUrl, $configUserKey, $configUserSecret);
$return = $userApi->import($userApiImportParams);
unset($userApi);
Beispiel #6
0
    function start()
    {
        /*
        	Test cache
        */
        if (GLOBAL_CACHE == true) {
            cache::get();
        }
        /*
        	Auth observer
        */
        self::observerLogout('weblogoff');
        db::connect();
        /*
        	Get site info
        */
        self::getSite();
        /*
        	Get lang
        */
        $lang = lang::gets(LANG_INDEX, SITE_ID);
        define('GUI_STYLE', 'http://' . SERVER . SYS_DIR . 'gui/' . SYS_STYLE);
        s::set('FACE_PATH', GUI_STYLE);
        s::set('SYS_DIR', SYS_DIR);
        s::set('SITE', SITE);
        s::set('NOW_YEAR', date('Y'));
        /*
        	        Links with links for this page and parents pages
        */
        self::$page_tree = self::getThisPageTree();
        /*
        	Pages with pages parents
        */
        self::loadPageData();
        /*
        	Page handler events
        */
        if (self::get('page_handler') == '1') {
            self::getHandlerEvents(self::$page['page_folder'], URI_SELF);
            define('PAGE_HANDLER', true);
        } else {
            define('PAGE_HANDLER', false);
            self::$page['this'] = arrays::lastValue(explode('/', urldecode(string::clearBoth(URI_SELF))));
        }
        /*
        	Page cache
        */
        define('PAGE_CACHE_ALL', false);
        define('PAGE_CACHE', false);
        define('PAGE_CACHE_TIME', 2);
        if (PAGE_CACHE == true && GLOBAL_CACHE == false) {
            if (PAGE_CACHE_ALL == true) {
                self::set('page_cache', '1');
            }
            if (self::get('page_cache') == '1') {
                cache::get();
            }
        }
        /*
        	Main page analyse
        */
        if (empty(router::$sections[0])) {
            define('MAIN_PAGE', true);
        } else {
            define('MAIN_PAGE', false);
        }
        /*
        	Error 404
        */
        if (self::getError404() || isset($_SESSION['E404'])) {
            unset($_SESSION['E404']);
            load::handler('pages', 'main', 'view404');
        }
        /*
        	Set page variables
        */
        self::$page = self::pageSettings(self::$page);
        s::set(self::$page);
        define('PAGE_ID', self::get('page_id'));
        s::set('PAGE_ID', PAGE_ID);
        /*
        	Set tmpl
        */
        self::$site_tmpl = self::get('tmpl_file');
        /*
        	Authentification adminUser
        */
        self::$jip = false;
        if (isset($_SESSION['ADMIN_AUTH'])) {
            //adminUser::update('site_id', SITE_ID, $_SESSION['ADMIN_USER_ID']);
            adminUser::load($_SESSION['ADMIN_USER_ID']);
            if (settings::get('pages', 'jip') == '1') {
                self::$jip = true;
            }
        }
        /*
        	Authentification webUser
        */
        self::observer();
        /*
        	Site Handlers
        */
        conf::parse('sites', SITE_ID);
        if (conf::get('sites', 'methods')) {
            foreach (conf::get('sites', 'methods') as $v) {
                $arr = explode('::', trim($v));
                if (count($arr) == 3) {
                    load::handler($arr[0], $arr[1], $arr[2]);
                }
            }
        }
        /*
        	Load pages setup
        */
        load::handlerSetup('pages');
        /*
        	Load blocks
        */
        load::handler('blocks');
        /*
        	Load page conf
        */
        conf::parse('pages', PAGE_ID);
        /*
        	Events observe
        */
        if (conf::get('pages', 'events')) {
            foreach (conf::get('pages', 'events') as $v) {
                $arr = explode('::', trim($v));
                $event_detect = events::targetDetect($arr[0], $arr[1], $arr[2]);
                if ($arr[3] == 'hide') {
                    if ($event_detect) {
                        load::handler('pages', 'main', 'view404');
                    }
                } else {
                    if ($arr[3] == 'handler') {
                        if ($event_detect) {
                            load::handler($arr[4], $arr[5], $arr[6]);
                        }
                    } else {
                        if ($arr[3] == 'replace') {
                            if ($event_detect) {
                                params::set('page_id', $arr[4]);
                                load::handler('pages', 'main', 'replace');
                            }
                        }
                    }
                }
            }
        }
        /*
        	Handlers class' methods
        */
        if (conf::get('pages', 'methods')) {
            foreach (conf::get('pages', 'methods') as $v) {
                $arr = explode('::', trim($v));
                if (count($arr) == 3) {
                    load::handler($arr[0], $arr[1], $arr[2]);
                }
            }
        }
        /*
        	Load tmpl conf
        */
        $tmpl_id = self::get('tmpl_id');
        conf::parse('tmpls', $tmpl_id);
        /*
        	Tmpl events
        */
        if (conf::get('tmpls', 'events')) {
            foreach (conf::get('tmpls', 'events') as $v) {
                $arr = explode('::', trim($v));
                if ($arr[0]) {
                    if (events::targetDetect($arr[0], $arr[1], $arr[2])) {
                        /*
                        	:TODO: добавить передачу в params события, его названия и его значения
                        */
                        if ($arr[3] == 'replace') {
                            $tmpl_replace_id = $arr[4];
                            db::table('templates');
                            db::where('tmpl_id', $tmpl_replace_id);
                            self::$site_tmpl = db::get('tmpl_file');
                        } else {
                            if ($arr[3] == 'handler') {
                                load::handler($arr[4], $arr[5], $arr[6]);
                            }
                        }
                    }
                }
            }
        }
        /*
        	Tmpl handlers
        */
        if (conf::get('tmpls', 'methods')) {
            foreach (conf::get('tmpls', 'methods') as $v) {
                $arr = explode('::', trim($v));
                if (count($arr) == 3) {
                    load::handler($arr[0], $arr[1], $arr[2]);
                }
            }
        }
        /*
        	Set site template
        */
        s::setTmpl(SYS_ROOT . 'tmpls/' . SITE . '/' . self::$site_tmpl, $lang);
        /*
        	Get handlers
        */
        s::resolver();
        /*
          JIP
        */
        if (self::$jip) {
            s::set('legenda_jip_page_path', 'http://' . SITE . SYS_DIR . 'pages/main/edit/' . PAGE_ID . '/');
            self::$jip_html = '
	<script src="http://' . SERVER . SYS_DIR . 'gui/js/lib/prototype.js" type="text/javascript"></script>
	<script src="http://' . SERVER . SYS_DIR . 'gui/original/js/jip.js" type="text/javascript"></script>
	<link rel="stylesheet" href="http://' . SERVER . SYS_DIR . 'gui/original/css/jip.css" type="text/css" />
	<div id="legenda_jip_show" style="display: none;">
	<a href="javascript:void(null);" onclick="legendaJIPShow();" id="legenda_jip_show_link">Показать</a>
	</div>
	<div id="legenda_jip" style="display: none;">
		<div id="legenda_jip_inner">
			<a href="javascript:void(null);" onclick="legendaJIPHide();" id="legenda_jip_hide_link">Скрыть</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="{legenda_jip_page_path}">Редактировать страницу</a>&nbsp;&nbsp;
			<select onchange="legendaJIPGoToEdit(this.value);">
				<option value="0">Редактировать блок</option>
				<option value="0">-----------------------------</option>
				{start legenda_jip_blocks}
				<option value="{path}">{name}</option>
				{end legenda_jip_blocks}
			</select>

			<a href="http://' . SERVER . SYS_DIR . '?adminlogoff" id="legenda_jip_logout">Выход</a>
		</div>
	</div>
			</body>';
        }
        /*
        	Site display
        */
        $code = s::get();
        if (isset($_SESSION['E404'])) {
            headers::self();
        }
        echo $code;
        if (PAGE_CACHE == true && GLOBAL_CACHE == false) {
            if (self::$page['page_cache'] == '1') {
                cache::save();
            }
        }
        if (GLOBAL_CACHE == true) {
            cache::save();
        }
    }
<?php

$sessionAdmin = $common->checkSession($adminSession, true, $adminURL);
require_once "framework/table/admin.php";
require_once "framework/table/group.php";
require_once "framework/module/adminUser.php";
$adminTable = new adminTable($connection);
$groupTable = new groupTable($connection);
$groupList = $groupTable->selectGroup();
$module = new adminUser($connection);
$adminUserDetails = $module->selectAdminDetails($sessionAdmin);
if (is_bool($adminUserDetails)) {
    echo "Error: " . $module->message;
    exit;
} else {
    if ($adminUserDetails['image'] == null || $adminUserDetails['image'] == "") {
        $adminUserDetails['image'] = "blank.gif";
    }
    switch ($adminUserDetails['gender']) {
        case '1':
            $adminUserDetails['gender'] = "M";
            break;
        case '2':
            $adminUserDetails['gender'] = "F";
            break;
        case '3':
            $adminUserDetails['gender'] = "U";
            break;
    }
}
?>