Example #1
0
function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = $a->cmd;
    if (!local_user()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login($a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin()) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if ($a->argc != 3) {
        killme();
    }
    $cmd = $a->argv[1];
    $hash = $a->argv[2];
    if ($cmd === 'deny') {
        if (!user_deny($hash)) {
            killme();
        }
    }
    if ($cmd === 'allow') {
        if (!user_allow($hash)) {
            killme();
        }
    }
}
Example #2
0
 function get()
 {
     if (local_channel()) {
         goaway(z_root());
     }
     return login(\App::$config['system']['register_policy'] == REGISTER_CLOSED ? false : true);
 }
Example #3
0
 /**
  * 自动登录的方法 , 就是根据cookie中值进行登录
  * 1. 登录失败: 返回false
  * 2. 登录成功: 返回true
  */
 public function autoLogin()
 {
     //>>1.得到cookie中信息
     $admin_id = cookie('admin_id');
     $auto_key = cookie('auto_key');
     //如果没有cookie的值就需要自动登录
     if (empty($admin_id) || empty($auto_key)) {
         return false;
     }
     //>>2.根据cookie中的admin_id,查找是否有该用户
     $adminModel = M('Admin');
     $row = $adminModel->getById($admin_id);
     if ($row) {
         //>>3.如果有用户再比 加密后的auto_key
         if ($auto_key == md5($row['auto_key'] . $row['salt'])) {
             //登录成功
             login($row);
             //将当前登陆信息保存到 session中
             //根据用户的id 查询出当前用户的权限的url和id,保存到session中
             $permissions = $this->getPermissions($row['id']);
             savePermissionURL($permissions['urls']);
             //将权限的url地址保存
             savePermissionID($permissions['ids']);
             //将权限的id保存
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Example #4
0
/**
 * @param App &$a
 * @return string
 */
function admin_content(&$a)
{
    logger('admin_content', LOGGER_DEBUG);
    if (!is_site_admin()) {
        return login(false);
    }
    /*
     * Page content
     */
    $o = '';
    // urls
    if (argc() > 1) {
        switch (argv(1)) {
            case 'site':
                $o = admin_page_site($a);
                break;
            case 'users':
                $o = admin_page_users($a);
                break;
            case 'channels':
                $o = admin_page_channels($a);
                break;
            case 'plugins':
                $o = admin_page_plugins($a);
                break;
            case 'themes':
                $o = admin_page_themes($a);
                break;
                //			case 'hubloc':
                //				$o = admin_page_hubloc($a);
                //				break;
            //			case 'hubloc':
            //				$o = admin_page_hubloc($a);
            //				break;
            case 'logs':
                $o = admin_page_logs($a);
                break;
            case 'dbsync':
                $o = admin_page_dbsync($a);
                break;
            case 'profs':
                $o = admin_page_profs($a);
                break;
            case 'queue':
                $o = admin_page_queue($a);
                break;
            default:
                notice(t('Item not found.'));
        }
    } else {
        $o = admin_page_summary($a);
    }
    if (is_ajax()) {
        echo $o;
        killme();
        return '';
    } else {
        return $o;
    }
}
Example #5
0
function oexchange_content(&$a)
{
    if (!local_user()) {
        $o = login(false);
        return $o;
    }
    if ($a->argc > 1 && $a->argv[1] === 'done') {
        info(t('Post successful.') . EOL);
        return;
    }
    $url = x($_GET, 'url') && strlen($_GET['url']) ? urlencode(notags(trim($_GET['url']))) : '';
    $title = x($_GET, 'title') && strlen($_GET['title']) ? '&title=' . urlencode(notags(trim($_GET['title']))) : '';
    $description = x($_GET, 'description') && strlen($_GET['description']) ? '&description=' . urlencode(notags(trim($_GET['description']))) : '';
    $tags = x($_GET, 'tags') && strlen($_GET['tags']) ? '&tags=' . urlencode(notags(trim($_GET['tags']))) : '';
    $s = fetch_url($a->get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
    if (!strlen($s)) {
        return;
    }
    require_once 'include/html2bbcode.php';
    $post = array();
    $post['profile_uid'] = local_user();
    $post['return'] = '/oexchange/done';
    $post['body'] = html2bbcode($s);
    $post['type'] = 'wall';
    $_POST = $post;
    require_once 'mod/item.php';
    item_post($a);
}
Example #6
0
function onPost()
{
    if (!isset($_POST['method'])) {
        http_response_code(HTTP_BAD_REQUEST);
        echo 'method field reuired';
        return;
    }
    switch ($_POST['method']) {
        case METHOD_LOGIN:
            login();
            break;
        case METHOD_LOGOUT:
            logout();
            break;
        case METHOD_CREATE_ACCOUNT:
            createAccount();
            break;
        case METHOD_USER_INFO:
            userInfo();
            break;
        default:
            http_response_code(HTTP_BAD_REQUEST);
            echo 'invalid method name: ' . $_POST['method'];
            return;
    }
}
Example #7
0
function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = App::$cmd;
    if (!local_channel()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login(App::$config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin()) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if (argc() != 3) {
        killme();
    }
    $cmd = argv(1);
    $hash = argv(2);
    if ($cmd === 'deny') {
        if (!account_deny($hash)) {
            killme();
        }
    }
    if ($cmd === 'allow') {
        if (!account_allow($hash)) {
            killme();
        }
    }
}
Example #8
0
function authorize($data = null)
{
    global $authorized;
    before();
    ?>
    <div id="xicl-error" style="">
        <table id="xicl-error-content"><tr><td>
            <?php 
    login();
    // показываем форму входа/выхода
    ?>
            <?php 
    if (_has('message')) {
        ?>
            <p class="message"><?php 
        echo _data('message');
        ?>
</p>
            <?php 
    }
    ?>
        </td></tr></table>
        <a href="./" id="xicl-error-home" title="на главную">&nbsp;</a>
    </div>
<?php 
    after();
    die;
    // прекратить дальнейшую работу
}
Example #9
0
function Main()
{
    global $TPLV, $urls, $usuario, $imovel;
    $TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
    $TPLV->assignGlobal("imagePath", IMAGE_PATH);
    $TPLV->assignGlobal("swfPath", SWF_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH);
    $TPLV->assignGlobal('navBottom', $bottom);
    $TPLV->assignGlobal($urls->var);
    $TPLV->prepare();
    $in = $_GET['in'];
    switch ($in) {
        //FILTROS DE BUSCAS
        default:
        case 'deletaUsuario':
            deletaUsuario();
            break;
        case 'deletaMidia':
            deletaMidia();
            break;
            //LOGIN E RECUPERA SENHA
        //LOGIN E RECUPERA SENHA
        case 'getLogin':
            getLogin();
            break;
        case 'login':
            login();
            break;
        case 'getSenha':
            getSenha();
            break;
        case 'recuperaSenha':
            recuperaSenha();
            break;
        case 'isLogado':
            if ($usuario->isLogado()) {
                echo 'logado';
            } else {
                echo 'erro';
            }
            break;
            //CADASTRO
        //CADASTRO
        case 'validaEmailCadastro':
            validaEmailCadastro();
            break;
            //LEADS DETALHES
        //LEADS DETALHES
        case 'getCadastro':
            getCadastro();
            break;
        case 'salvarCadastro':
            salvarCadastro();
            break;
        case 'verificaCPF':
            verificaCPF();
            break;
    }
}
Example #10
0
 /**
  * @return string
  */
 function get()
 {
     logger('admin_content', LOGGER_DEBUG);
     if (!is_site_admin()) {
         return login(false);
     }
     /*
      * Page content
      */
     $o = '';
     if (argc() > 1) {
         $o = $this->sm->call('get');
         if ($o === false) {
             notice(t('Item not found.'));
         }
     } else {
         $o = $this->admin_page_summary();
     }
     if (is_ajax()) {
         echo $o;
         killme();
         return '';
     } else {
         return $o;
     }
 }
Example #11
0
File: api.php Project: nikilster/I
function processTheRequest($userId)
{
    $function = getIntendedFunction();
    $timezone = getParameter(APIKeys::$TIMEZONE);
    //Login
    if ($function == APIKeys::$FUNCTION_LOGIN) {
        login($timezone);
    } else {
        if ($function == APIKeys::$FUNCTION_CREATE_ACCOUNT) {
            createAccount($timezone);
        } else {
            if ($function == APIKeys::$FUNCTION_GET_INFORMATION) {
                getInformation($userId, $timezone);
            } else {
                if ($function == APIKeys::$FUNCTION_START_ACTIVITY) {
                    startActivity($userId, $timezone);
                } else {
                    if ($function == APIKeys::$FUNCTION_STOP_EVENT) {
                        stopEvent($userId, $timezone);
                    } else {
                        if ($function == APIKeys::$FUNCTION_SET_PUSH_TOKEN) {
                            setPushToken($userId, $timezone);
                        } else {
                            if ($function == APIKeys::$FUNCTION_CREATE_ACTIVITY) {
                                createActivity($userId, $timezone);
                            } else {
                                error();
                            }
                        }
                    }
                }
            }
        }
    }
}
 /**
  * 登录页面
  */
 public function login()
 {
     if (IS_POST) {
         $model = D('Member');
         if ($model->create() !== false) {
             $userinfo = $model->login();
             if (is_array($userinfo)) {
                 //将用户数据保存到session
                 login($userinfo);
                 //从用户中取出ID作为UID
                 defined('UID') or define('UID', $userinfo['id']);
                 //将cookie中的商品保存到数据库中
                 $shoppingCarModel = D('ShoppingCar');
                 $shoppingCarModel->cookie2db();
                 $url = U('Index/index');
                 if (cookie('__login_return_url__')) {
                     $url = cookie('__login_return_url__');
                     cookie('__login_return_url__', null);
                 }
                 $this->success('登陆成功!', $url);
                 return;
             }
         }
         $this->error(get_model_error($model));
     } else {
         $this->assign('title', '登录商城');
         $this->display('login');
     }
 }
Example #13
0
 public function run(&$params)
 {
     //1.判断用户是否登录,如果登录了才能得到用户id,进而才有可能获取到所拥有的权限
     //        $userinfo = session('USERINFO');
     $userinfo = login();
     //自动登录
     $admin_id = cookie('admin_id');
     $token = cookie('token');
     if (!$userinfo) {
         //自动登录
         D('AdminToken')->checkToken($admin_id, $token);
         //            $userinfo = session('USERINFO');
         $userinfo = login();
     }
     $url = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME;
     //忽略验证的请求
     $ignore = C('IGNORE_PATH');
     if (in_array($url, $ignore)) {
         return true;
     }
     return true;
     //判断是否有权限,如果没有权限就判断是否登录,登录了就提示切换用户,否则跳到登录页面
     if (!in_array($url, path())) {
         if ($userinfo) {
             echo '无权访问,<a href="' . U('Admin/Admin/login') . '">切换用户</a>';
             exit;
         } else {
             redirect(U('Admin/Admin/login'), '请先登录');
             exit;
         }
     }
 }
Example #14
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			switch ($this->stage)
			{
				case 1:
					if (!login($this->username, $args))
					{
						$stderr = ucf(i18n("login failed")).". ".ucf(i18n("please try again"));
					}
					else
					{
						$system->triggerEventIntern("login", array());
						//$response->addScript("window.location.reload()");
						
						$user = new mUser();
						$user->setByUsername($this->username);
						
						$stdout = $user->name." ".i18n("logged in successfully");
					}
					
					$this->stage = 0;
					return true;
			}
			
			$this->username = $args;
			$stdout = ucf(i18n("password:"******"document.getElementById('cmdline').type='password';");
			return false;
		}
		return true;
	}
Example #15
0
 function test()
 {
     global $webroot, $settings;
     $result = login($this, $settings["name"], $settings["password"], "DEADBEEF");
     $this->assertEqual($result->status, "0");
     $this->assertText("Session expired");
 }
 public function __invoke($request, $response, $next)
 {
     $params = $request->getQueryParams();
     if ($params['handler'] === "oauth" | ($params['handler'] === "api" && !isset($params['page'])) | ($params['handler'] === "api" && $params['page'] === "doc") | ($params['handler'] === "api" && $params['page'] === "doc/swagger") | ($params['handler'] === "api" && $params['page'] === "users/me/login_token")) {
         $response = $next($request, $response);
         return $response;
     }
     $factory = new AuthenticationServerFactory();
     $server = $factory->getServer();
     if (!$server->verifyResourceRequest(\OAuth2\Request::createFromGlobals())) {
         $response = $response->withStatus(403);
         $response = $response->withHeader('Content-type', 'application/json');
         return $response->write(json_encode(array('status' => 403, 'error' => 'invalid_access_token', 'pretty_error' => 'You did not supply an OAuth access token or the token is invalid.'), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
     }
     $token = $server->getAccessTokenData(\OAuth2\Request::createFromGlobals());
     $user = get_user($token['user_id']);
     if (!$user) {
         $response = $response->withStatus(403);
         $response = $response->withHeader('Content-type', 'application/json');
         return $response->write(json_encode(array('status' => 403, 'error' => 'invalid_access_token', 'pretty_error' => 'You did not supply an OAuth access token or the token is invalid.'), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
     }
     if (!login($user)) {
         $response = $response->withStatus(403);
         $response = $response->withHeader('Content-type', 'application/json');
         return $response->write(json_encode(array('status' => 403, 'error' => 'could_not_login', 'pretty_error' => 'Could not login the user associated with this token. Probably the account is banned.'), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
     }
     $response = $next($request, $response);
     return $response;
 }
Example #17
0
File: regmod.php Project: Mauru/red
function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = $a->cmd;
    if (!local_user()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login($a->config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin() || x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if (argc() != 3) {
        killme();
    }
    $cmd = argv(1);
    $hash = argv(2);
    if ($cmd === 'deny') {
        if (!user_deny($hash)) {
            killme();
        }
    }
    if ($cmd === 'allow') {
        if (!user_allow($hash)) {
            killme();
        }
    }
}
Example #18
0
function LoginUser($tool_provider)
{
    // Clear any existing sessions
    if (elgg_is_logged_in()) {
        logout();
    }
    $values = GetPluginSettings();
    $userprovision = $values['userprovision'];
    $user_id = $tool_provider->user->getID(BasicLTI_Tool_Provider::ID_SCOPE_GLOBAL);
    $consumer_key = $tool_provider->consumer->guid;
    $context_id = $tool_provider->user->context->id;
    // Does user exist
    $user = CheckLTIUser($user_id);
    // Provision user, if on and needed
    if (empty($user)) {
        if ($userprovision) {
            $user = CreateLTIUser($consumer_key, $context_id, $tool_provider->user);
            if (empty($user)) {
                forward();
            }
        } else {
            system_message(elgg_echo('LTI:info:noprovision'));
            forward();
            exit;
        }
    }
    // Set up current context id
    $user->context_id = $context_id;
    $user->email = $tool_provider->user->email;
    $user->name = $tool_provider->user->fullname;
    $user->save();
    // Login
    $result = login($user, false);
    return $result;
}
Example #19
0
function createUser($data)
{
    if ($obs = json_decode($data, true)) {
        $user = htmlentities(preg_replace("/[^a-zA-Z]*/", "", $obs['u']), ENT_QUOTES, "utf-8");
        $pw = htmlentities(preg_replace("/[^a-zA-Z]*/", "", $obs['p']), ENT_QUOTES, "utf-8");
        $cp = htmlentities(preg_replace("/[^a-zA-Z]*/", "", $obs['cp']), ENT_QUOTES, "utf-8");
        if (strlen($user) < 6 || strlen($pw) < 6 || strlen($user) > 20 || strlen($pw) > 20) {
            return -1;
        }
        if ($pw != $cp) {
            return -1;
        } elseif (checkUsername($user) > 0) {
            return -1;
        } else {
            $cPass = hashPass($pw);
            if (!storeNewUser($user, $cPass)) {
                return -1;
            } else {
                //account successfully created, so we will automatically log them in
                if (login(json_encode(array("n" => $user, "p" => $pw)), $_SERVER['REMOTE_ADDR']) == 1) {
                    return 1;
                } else {
                    return -1;
                }
            }
        }
    } else {
        return -1;
    }
}
Example #20
0
 function login($un = "", $pw = "", $remember = false)
 {
     if ($un != "" && $pw != "") {
         $session_token = login($un, $pw);
         if ($session_token) {
             $this->token = $session_token['session'];
             $this->userid = $session_token['uid'];
             $details = getUserDetails($this->userid);
             $this->username = $details['email'];
             $this->type = $details['administrator'];
             $this->first_name = $details['firstname'];
             $this->last_name = $details['lastname'];
             $now = time();
             $timeout = 60 * 60 * 24 * 14;
             $to = $now + $timeout;
             if ($remember) {
                 setcookie('isense_login', $this->token, $to, "/");
             } else {
                 setcookie('isense_login', $this->token, 0, "/");
             }
             return true;
         }
     }
     return false;
 }
Example #21
0
 /**
  * 登陆
  */
 public function login()
 {
     if (IS_POST) {
         //登陆验证
         if ($this->model->create() !== false) {
             if (($result = $this->model->login(I('post.'))) !== false) {
                 //是否记住密码
                 $remember = false;
                 if (I('post.remember')) {
                     $remember = true;
                 }
                 //保存用户登录
                 login($result['userinfo'], $remember);
                 //保存用户权限ids和urls
                 $permissions = $result['permissions'];
                 permissionId(array_column($permissions, 'id'));
                 permissionURL(array_column($permissions, 'url'));
                 //跳转后台首页
                 $this->success('登陆成功', U('Index/index'));
                 return;
             }
         }
         $this->error(show_model_error($this->model), U('login'));
     } else {
         //登陆表单
         $this->display('login');
     }
 }
Example #22
0
 public function edit()
 {
     sys()->log("company\\Controller::edit()");
     $company_name = hi('company_name');
     $email = hi('email');
     if (!login()) {
         return ERROR(-436, "Login first");
     }
     if (empty($company_name)) {
         return ERROR(-437, "Input company name");
     }
     if (empty($email)) {
         return ERROR(-439, "Input email");
     }
     //$e = $this->load("company_name='$company_name'");
     //if ( $e ) return ERROR( -438, "Company name exists.");
     //$e = $this->load("email='$email'");
     //if ( $e ) return ERROR( -440, "Company email exists.");
     if (hi('id')) {
         $this->load(hi('id'));
     } else {
         $this->create()->set('username', login()->username)->set('gid', hi('gid'));
     }
     $entity = $this->set('category', hi('category', 0))->set('company_name', $company_name)->set('title', hi('title'))->set('ceo_name', hi('ceo_name'))->set('email', $email)->set('mobile', hi('mobile'))->set('landline', hi('landline'))->set('address', hi('address'))->set('kakao', hi('kakao'))->set('delivery', hi('delivery'))->set('region', hi('region'))->set('province', hi('province'))->set('city', hi('city'))->set('address', hi('address'))->set('homepage', hi('homepage'))->set('etc', hi('etc'))->set('content', hi('content'))->save();
     if ($entity) {
         return SUCCESS(array('id' => $entity->id));
     } else {
         return ERROR(-431, "Failed on creating/updating company information");
     }
 }
Example #23
0
function createUser($user, $userImage, $db)
{
    $query = 'INSERT INTO users VALUES (null, :email , :password , :fName, :lName, :imageName, :admin) ';
    try {
        $results = $db->prepare($query);
        $results->execute(array(':email' => $user['email'], ':password' => password_hash($user['password'], PASSWORD_DEFAULT), ':fName' => $user['fname'], ':lName' => $user['lname'], ':imageName' => $user['userimage'], ':admin' => 0));
    } catch (Exception $e) {
        echo $e->getMessage();
        exit;
    }
    $filename = "./img/" . $userImage['name'];
    move_uploaded_file($userImage['tmp_name'], $filename);
    //once account is created, log the user in.
    // this should log the user in and make user data accessible to other functions
    //login the user by setting session loggedIn variable and userData
    session_start();
    $user = login($db, $user['email'], $user['password']);
    if ($user !== false) {
        $_SESSION['userData'] = $user;
        $_SESSION['loggedIn'] = true;
    } else {
        echo 'Login attempt failed';
    }
    header("Location: index.php");
    exit;
}
Example #24
0
function login_content(&$a)
{
    if (local_channel()) {
        goaway(z_root());
    }
    return login($a->config['system']['register_policy'] == REGISTER_CLOSED ? false : true);
}
Example #25
0
function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = $a->cmd;
    if (!local_user()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login($a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin() || x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if ($a->argc != 3) {
        killme();
    }
    $cmd = $a->argv[1];
    $hash = $a->argv[2];
    if ($cmd === 'deny') {
        user_deny($hash);
        goaway($a->get_baseurl() . "/admin/users/");
        killme();
    }
    if ($cmd === 'allow') {
        user_allow($hash);
        goaway($a->get_baseurl() . "/admin/users/");
        killme();
    }
}
function login_require()
{
    if (!login()) {
        header("Location: " . view('login'));
        die;
    }
}
Example #27
0
 function get()
 {
     if (!local_channel()) {
         return login();
     }
     $content = '<h3>' . t('Configuration Editor') . '</h3>';
     $content .= '<div class="descriptive-paragraph">' . t('Warning: Changing some settings could render your channel inoperable. Please leave this page unless you are comfortable with and knowledgeable about how to correctly use this feature.') . '</div>' . EOL . EOL;
     if (argc() == 3) {
         $content .= '<a href="pconfig">pconfig[' . local_channel() . ']</a>' . EOL;
         $content .= '<a href="pconfig/' . escape_tags(argv(1)) . '">pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . ']</a>' . EOL . EOL;
         $content .= '<a href="pconfig/' . escape_tags(argv(1)) . '/' . escape_tags(argv(2)) . '" >pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . escape_tags(argv(2)) . ']</a> = ' . get_pconfig(local_channel(), escape_tags(argv(1)), escape_tags(argv(2))) . EOL;
         if (in_array(argv(2), $this->disallowed_pconfig())) {
             notice(t('This setting requires special processing and editing has been blocked.') . EOL);
             return $content;
         } else {
             $content .= $this->pconfig_form(escape_tags(argv(1)), escape_tags(argv(2)));
         }
     }
     if (argc() == 2) {
         $content .= '<a href="pconfig">pconfig[' . local_channel() . ']</a>' . EOL;
         load_pconfig(local_channel(), escape_tags(argv(1)));
         foreach (\App::$config[local_channel()][escape_tags(argv(1))] as $k => $x) {
             $content .= '<a href="pconfig/' . escape_tags(argv(1)) . '/' . $k . '" >pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . $k . ']</a> = ' . escape_tags($x) . EOL;
         }
     }
     if (argc() == 1) {
         $r = q("select * from pconfig where uid = " . local_channel());
         if ($r) {
             foreach ($r as $rr) {
                 $content .= '<a href="' . 'pconfig/' . escape_tags($rr['cat']) . '/' . escape_tags($rr['k']) . '" >pconfig[' . local_channel() . '][' . escape_tags($rr['cat']) . '][' . escape_tags($rr['k']) . ']</a> = ' . escape_tags($rr['v']) . EOL;
             }
         }
     }
     return $content;
 }
 public function run(&$params)
 {
     if (isLogin()) {
         $userinfo = login();
         defined('UID') or define('UID', $userinfo['id']);
     }
 }
Example #29
0
function import_items_content(&$a)
{
    if (!local_channel()) {
        notice(t('Permission denied') . EOL);
        return login();
    }
    $o = replace_macros(get_markup_template('item_import.tpl'), array('$title' => t('Import Items'), '$desc' => t('Use this form to import existing posts and content from an export file.'), '$label_filename' => t('File to Upload'), '$submit' => t('Submit')));
    return $o;
}
Example #30
-1
 public function autoLogin()
 {
     //得到cookie的值
     $admin_id = cookie('admin_id');
     $auto_key = cookie('auto_key');
     if (empty($admin_id) || empty($auto_key)) {
         return false;
     }
     //根据admin_id的值来判断的
     $adminModel = D('Admin');
     $row = $adminModel->getById($admin_id);
     if ($row === false) {
         return false;
     }
     $key = md5($row['atuo_key'] . $row['salt']);
     if ($auto_key == $key) {
         //存在就保存就根据当前的id把url和权限的id保存到seesion
         login($row);
         //等到url地址保存在session
         $resultUrl = $this->userPermisson($admin_id);
         //把保存到session中封装成一个函数
         savePermissionURL(array_column($resultUrl, 'url'));
         savePermissionID(array_column($resultUrl, 'id'));
         return true;
     } else {
         return false;
     }
 }