Пример #1
0
 function register_sub()
 {
     unset($_POST['pwd_confirm']);
     unset($_POST['favorite']);
     $email = trim($_POST['email']);
     if (!preg_match('/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/', $email)) {
         $this->error('Email error');
     }
     if (md5($_POST['code']) != $_SESSION['verify']) {
         $this->error(C('ERROR_VERIFY_ERROR'));
     } else {
         $_POST['add_time'] = time();
         $checkUsernameCondition['username'] = array('eq', $this->zaddslashes($_POST['username']));
         $status = $this->registerModel->getUserCheckStatus($checkUsernameCondition);
         if (empty($status)) {
             $saveData['username'] = trim($this->zaddslashes($_POST['username']));
             $saveData['password'] = md5($_POST['password']);
             $saveData['email'] = trim($this->zaddslashes($_POST['email']));
             $saveData['add_time'] = time();
             $userResult = $this->registerModel->getRigisterUser($saveData);
             if ($userResult['status']) {
                 Cookie::set('user_name', $saveData['username']);
                 Cookie::set('user_id', $userResult['user_id'], 60 * 60 * 24);
                 //user id
                 Cookie::set('feifa_home', 'passageway_home', 60 * 60 * 24);
                 //cookie 验证是否登录
                 Cookie::set('cart_num', $userResult['cart_num'], 60 * 60 * 24);
                 // 设置cookie购物车商品数
                 $email = $saveData['username'];
                 $title = '感谢注册您的 Kshop数码 !';
                 $content = '<div>';
                 $content .= sprintf('尊敬的&nbsp;%s<br>', COOKIE::get('user_name'));
                 $content .= '感谢您注册 Kshop数码,您的个人信息请妥善保管个人注册信息<br>';
                 $content .= sprintf('用户名:%s<br>发送时间:%s<br>', $saveData['username'], date('Y-m-d H:i:s', $_POST['add_time']));
                 $content .= '■重要信息:由于此邮件包含个人注册资料,请妥善保存!</div>';
                 //注册成功
                 $this->SendMail($email, $title, $content);
                 $this->redirect('passport_create');
             } else {
                 $this->error(C('ERROR_REGISTER_FAILURE'));
             }
         } else {
             $this->error(C('ERROR_ACCOUNT_HAVE_USE'));
         }
     }
 }
Пример #2
0
    public function show()
    {
        \CORE::msg('debug', 'umenu');
        $UI = \CORE\UI::init();
        $USER = \USER::init();
        $UI->pos['js'] .= '
<script>
$(document).ready(function() {

	function change_language(xlang){
		$.post("./?lang="+xlang, function(){
			location.reload();
		});
	}  

	$("a.change_language").click(function(e){
		e.preventDefault();
		var xlang = $(this).attr("rel");
		change_language(xlang);
	});

});
</script>
';
        if ($USER->auth()) {
            // authorized users
            $UI->pos['mainmenu'] .= '
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('reports', 'Отчеты') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
              	<li class="dropdown-header">' . \CORE::t('input_forms', 'Формы ввода данных:') . '</li>
              	<li class="divider"></li>
                <li><a href="./?c=frm&act=ps">' . \CORE::t('mt_frm_passport', 'Паспорт образовательного учреждения') . '</a></li>
                <li><a href="./?c=frm&act=bmt1">' . \CORE::t('mt_frm_bmt1', 'Форма БМТ-1') . '</a></li>
                <li><a href="./?c=frm&act=kom1">' . \CORE::t('mt_frm_kom1', 'Форма КОМ-1') . '</a></li>
                <li><a href="./?c=frm&act=tm1">' . \CORE::t('mt_frm_tm1', 'Форма ОШ-1') . '</a></li>
                <li><a href="./?c=frm&act=fb">' . \CORE::t('mt_frm_fb', 'Форма ФБ') . '</a></li>
                <li><a href="./?c=frm&act=km1">' . \CORE::t('mt_frm_km1', 'Форма КМ-1') . '</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('statistic', 'Статистика') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=stat">----</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('visualization', 'Визуализация') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=map">' . \CORE::t('map', 'Карта') . '</a></li>
                <li><a href="./?c=vs">' . \CORE::t('datavisual', 'Визуализация данных') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('opendata', 'Открытые данные') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about_opendata">' . \CORE::t('about_opendata', 'Об открытых данных') . '</a></li>
                <li><a href="./?c=od">' . \CORE::t('opendata', 'Открытые данные') . '</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('zayavki', 'Заявки') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=apps&act=create">' . \CORE::t('reg_form', 'Форма регистрации') . '</a></li>
                <li><a href="./?c=apps&act=status_check">' . \CORE::t('check_app', 'Проверить статус заявки') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('project', 'Проект') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about">' . \CORE::t('about_project', 'Описание проекта') . '</a></li>
                <li><a href="./?c=page&act=team">' . \CORE::t('project_team', 'Команда проекта') . '</a></li>
              </ul>
            </li>
			';
            $UI->pos['user1'] .= '
			<ul class="nav navbar-nav">
				' . LANGUAGE::SWITCHER(true) . '
				<li class="dropdown">
	              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
				  <small><i class="glyphicon glyphicon-cog"></i>&nbsp;</small>
				  ' . $USER->get('username') . '
	              <span class="caret"></span></a>
	              <ul class="dropdown-menu">
	                <!--<li>
	                	<a href="./?c=user&act=profile">
	                		<small><i class="glyphicon glyphicon-user"></i>&nbsp;</small> 
				    		<span class="text">' . \CORE::t('profile', 'Профиль') . '</span>
	                	</a>
	                </li>-->
	                <!--<li>
	                	<a href="./?c=user&act=change_password">
	                		<small><i class="glyphicon glyphicon-pencil"></i>&nbsp;</small> 
				    		<span class="text">' . \CORE::t('cpasswd', 'Сменить пароль') . '</span>
	                	</a>
	                </li>
	                -->
	                <li class="divider"></li>
	                <li>
	                	<a href="./?c=user&act=logout">
	                		<small><i class="glyphicon glyphicon-off"></i>&nbsp;</small> 
				    		<span class="text">' . \CORE::t('logout', 'Logout') . '</span>
	                	</a>
	                </li>
	              </ul>
	            </li>
		    </ul>
			';
        } else {
            // guests
            $UI->pos['mainmenu'] .= '
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('visualization', 'Визуализация') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=map">' . \CORE::t('map', 'Карта') . '</a></li>
                <li><a href="./?c=vs">' . \CORE::t('datavisual', 'Визуализация данных') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('opendata', 'Открытые данные') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about_opendata">' . \CORE::t('about_opendata', 'Об открытых данных') . '</a></li>
                <li><a href="./?c=od">' . \CORE::t('opendata', 'Открытые данные') . '</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('zayavleniya', 'Заявления') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=apps&act=create">' . \CORE::t('reg_form', 'Форма регистрации') . '</a></li>
                <li><a href="./?c=apps&act=status_check">' . \CORE::t('check_app', 'Проверить статус заявки') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('about', 'О проекте') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about">' . \CORE::t('about_project', 'Описание проекта') . '</a></li>
                <li><a href="./?c=page&act=team">' . \CORE::t('team', 'Команда проекта') . '</a></li>
              </ul>
            </li>
			';
            $UI->pos['user1'] .= '<form action="./?c=user&act=login" method="post" class="navbar-form">
			' . LANGUAGE::SWITCHER();
            $UI->pos['user1'] .= '<div class="form-group">
					<input type="text" name="login" placeholder="' . \CORE::t('login', 'Login') . '" value="' . \COOKIE::get('lastuser') . '" class="form-control" style="width:150px;">
				</div>
				<div class="form-group">
					<input type="password" name="password" placeholder="' . \CORE::t('password', 'Password') . '" class="form-control" style="width:150px;">
				</div>
				<button type="submit" class="btn btn-warning">' . \CORE::t('login', 'Login') . '</button>
			';
            $UI->pos['user1'] .= '</form>
			';
        }
    }
Пример #3
0
 public function display($view = '', $return = false)
 {
     global $lable, $list, $datalist, $volist, $data;
     $file = $this->class_info['method'];
     $clas = $this->class_info['file'];
     $tpl = $this->config->get('DEFAULT_TPL');
     if (!$tpl) {
         $tpl = 'default';
     }
     if (COOKIE::get('default_tpl')) {
         $tpl = COOKIE::get('default_tpl');
     }
     if (!defined('DEFAULT_TPL')) {
         define('DEFAULT_TPL', $tpl);
     }
     $data = $this->data;
     ob_start();
     $templete_ext = $this->config->get('templete_ext');
     if (!$templete_ext) {
         $templete_ext = '.htm';
     }
     $v = $clas . "/" . $file . $templete_ext;
     if ($view) {
         $v = $view;
     }
     $file = DEFAULT_TPL_PATH . "/{$tpl}/" . $v;
     foreach ($this->data as $kyphp_key => $kyphp_value) {
         if (is_string($kyphp_value)) {
             $lable[$kyphp_key] = $kyphp_value;
         }
         ${$kyphp_key} = $kyphp_value;
     }
     if (is_file($file)) {
         require $file;
     } else {
         error(0, $file);
     }
     $content = ob_get_contents();
     ob_end_clean();
     $content = make_html($content, $this->config->get('PATH_KEY'));
     if ($this->config->get('PATH_KEY') == 4) {
         $htmlpath = $this->config->get('DEFAULT_HTML_PATH');
         if (!$htmlpath) {
             $htmlpath = 'html';
         }
         $fstr = APP_PATH . '/' . $htmlpath;
         $fstr .= '/' . $this->kyphp_route;
         if (!is_dir($fstr)) {
             mkdir($fstr, 0755, true);
         }
         $f = fopen($fstr . '/index.html', 'w');
         fwrite($f, $content);
         fclose($f);
     }
     if ($this->config->get('CACHE_ON') == 'on') {
         $urlcachekey = 'KYPHP_URL' . $_SERVER['REQUEST_URI'];
         $urlcache = array('dirver' => 'file');
         $kyphpcache = new Cache($urlcache);
         $timeout = 3600;
         if ($this->config->get('CACHE_TIME_EXPIRE')) {
             $timeout = $this->config->get('CACHE_TIME_EXPIRE');
         }
         if ($this->config->get('CACHE_CONTENT_WITHTIME') != 'off') {
             if (!$this->config->get('CACHE_CONTENT_WITHTIME')) {
                 $content = $content . '<!--cached ' . date('Y-m-d H:i:s') . ' by KYPHP-->';
             } else {
                 $content = $content . $this->config->get('CACHE_CONTENT_WITHTIME');
             }
         }
         $kyphpcache->set($urlcachekey, $content, $timeout);
     }
     if ($return) {
         return $content;
     } else {
         echo $content;
     }
     if ($this->config->get('debug') == 'on') {
         $debug = debug_backtrace();
         echo '<div>Debug Trace:<br><ul>';
         global $_charset;
         $this->runtime->stop();
         foreach ($debug as $key => $value) {
             echo "<li>file:{$value['file']} " . sprintf($_charset['lineno'], $value['line']) . " {$value['function']}</li>";
         }
         echo '</ul></div>';
         echo "<div>Time:spent is " . $this->runtime->spent() . " (ms)</div>";
     }
 }
Пример #4
0
 public static function check_lang()
 {
     global $conf;
     if (isset($conf['lang'])) {
         $lang = $conf['lang'];
         $langs = CORE::init()->langs;
         $ln = COOKIE::get('lang');
         if ($ln != '') {
             $lang = $ln;
         }
         if (isset($_GET['lang'])) {
             $ln = trim($_GET['lang']);
             if (isset($langs[$ln])) {
                 COOKIE::set('lang', $ln);
                 $lang = $ln;
             }
         }
         if (isset($langs[$lang])) {
             CORE::init()->lang = $lang;
         }
         CORE::msg('debug', 'language: ' . CORE::init()->lang);
     }
 }