当前位置: 首页>>代码示例>>PHP>>正文


PHP User函数代码示例

本文整理汇总了PHP中User函数的典型用法代码示例。如果您正苦于以下问题:PHP User函数的具体用法?PHP User怎么用?PHP User使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了User函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: AllowUse

function AllowUse($modname = false)
{
    global $_openSIS;
    if (!$modname) {
        $modname = $_REQUEST['modname'];
    }
    if ($modname == 'Students/Student.php' && $_REQUEST['category_id']) {
        $modname = $modname . '&category_id=' . $_REQUEST['category_id'];
    }
    if (!$_openSIS['AllowUse']) {
        if (User('PROFILE_ID') != '') {
            $_openSIS['AllowUse'] = DBGet(DBQuery("SELECT MODNAME FROM PROFILE_EXCEPTIONS WHERE PROFILE_ID='" . User('PROFILE_ID') . "' AND CAN_USE='Y'"), array(), array('MODNAME'));
        } else {
            $_openSIS['AllowUse'] = DBGet(DBQuery("SELECT MODNAME FROM STAFF_EXCEPTIONS WHERE USER_ID='" . User('STAFF_ID') . "' AND CAN_USE='Y'"), array(), array('MODNAME'));
        }
    }
    if (!$_openSIS['AllowUse']) {
        $_openSIS['AllowUse'] = array(true);
    }
    if (count($_openSIS['AllowUse'][$modname])) {
        return true;
    } else {
        return false;
    }
}
开发者ID:26746647,项目名称:Belize-openSIS,代码行数:25,代码来源:AllowEdit.fnc.php

示例2: save

 /**
  * @param \yii\authclient\ClientInterface $Client
  * @return bool
  * @throws \yii\base\InvalidConfigException
  */
 public function save(\yii\authclient\ClientInterface $Client)
 {
     /** @var Account\backend\Module $Module */
     $Module = \Yii::$app->getModule($this->accountModule);
     $roles = $Module->roles;
     /** @var AccountModel $Account */
     $Account = \Yii::createObject(AccountModel::class);
     $Account->appendClientAttributes($Client);
     $Account->setAttributes(['email' => $this->email]);
     $Account->validate() && $Account->save();
     $AuthResponse = AccountAuthResponseModel::createLog($Client);
     if ($Account->hasErrors()) {
         $AuthResponse->result = Json::encode($Account->getErrors());
     } else {
         $AuthResponse->result = (string) $Account->id;
         $Account->pushSocialLink($Client);
         AuthManager()->assign(RbacFactory::Role($roles['user']), $Account->id);
         $SignInFormModel = \Yii::createObject(SignInForm::class);
         User()->login($Account, $SignInFormModel::REMEMBER_TIME);
     }
     $AuthResponse->validate() && $AuthResponse->save();
     if ($Account->hasErrors()) {
         $this->populateErrors($Account, 'name');
     }
     return !$Account->hasErrors();
 }
开发者ID:cookyii,项目名称:module-account,代码行数:31,代码来源:FillAttributesForm.php

示例3: AllowUse

function AllowUse($modname = false)
{
    global $_openSIS;
    if (!$modname) {
        $modname = $_REQUEST['modname'];
    }
    if ($modname == 'Students/Student.php' && $_REQUEST['category_id']) {
        $modname = $modname . '&category_id=' . $_REQUEST['category_id'];
    }
    if (!$_openSIS['AllowUse']) {
        if (User('PROFILE_ID') != '') {
            $_openSIS['AllowUse'] = DBGet(DBQuery('SELECT MODNAME FROM profile_exceptions WHERE PROFILE_ID=\'' . User('PROFILE_ID') . '\' AND CAN_USE=\'Y\''), array(), array('MODNAME'));
        } else {
            $_openSIS['AllowUse'] = DBGet(DBQuery('SELECT MODNAME FROM staff_exceptions WHERE USER_ID=\'' . User('STAFF_ID') . '\' AND CAN_USE=\'Y\''), array(), array('MODNAME'));
        }
    }
    if (!$_openSIS['AllowUse']) {
        $_openSIS['AllowUse'] = array(true);
    }
    if (count($_openSIS['AllowUse'][$modname])) {
        return true;
    } else {
        return false;
    }
}
开发者ID:SysBind,项目名称:opensis-ml,代码行数:25,代码来源:AllowEdit.fnc.php

示例4: get_pages

 public static function get_pages($lang = NULL)
 {
     if ($lang == NULL) {
         $lang = Settings::get_lang('current');
     }
     self::$ci->load->model('page_model');
     $pages = self::$ci->page_model->get_lang_list(NULL, $lang);
     // Should never be displayed : no pages are set.
     if (empty($pages)) {
         show_error('Internal error : <b>No pages found.</b><br/>Solution: <b>Create at least one online page.</b>', 500);
         exit;
     }
     /* Spread authorizations from parents pages to chidrens.
      * This adds the group ID to the childrens pages of a protected page
      * If you don't want this, just uncomment this line.
      */
     // self::$ci->page_model->spread_authorizations($pages);
     // Filter pages regarding the authorizations
     if (User()->get('role_level') < 1000) {
         $pages = array_values(array_filter($pages, array(__CLASS__, '_filter_pages_authorization')));
     }
     // Set all abolute URLs one time, for perf.
     self::init_absolute_urls($pages, $lang);
     return $pages;
 }
开发者ID:trk,项目名称:ionize,代码行数:25,代码来源:Pages.php

示例5: core_user_update_users_object

function core_user_update_users_object()
{
    //first, gather the necessary variables
    global $_REQUEST;
    //gather the Moodle user ID
    if (User('PROFILE') == 'student') {
        $rosario_id = UserStudentID();
        $moodle_id = DBGet(DBQuery("SELECT moodle_id FROM moodlexrosario WHERE rosario_id='" . $rosario_id . "' AND \"column\"='student_id'"));
    } else {
        $rosario_id = User('STAFF_ID');
        $moodle_id = DBGet(DBQuery("SELECT moodle_id FROM moodlexrosario WHERE rosario_id='" . $rosario_id . "' AND \"column\"='staff_id'"));
    }
    if (count($moodle_id)) {
        $moodle_id = (double) $moodle_id[1]['MOODLE_ID'];
    } else {
        return '';
    }
    //then, convert variables for the Moodle object:
    /*
    list of ( 
    	object {
    		id double   //ID of the user
    		password string  Optional //Plain text password consisting of any characters
    		//note Francois: the password must respect the Moodle policy: 8 chars min., 1 number, 1 min, 1 maj and 1 non-alphanum at least.
    	} 
    )
    */
    $password = $_REQUEST['values']['new'];
    $users = array(array('id' => $moodle_id, 'password' => $password));
    return array($users);
}
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:31,代码来源:Preferences.php

示例6: getIslove

 public function getIslove()
 {
     $category_id = $this->id;
     $user_id = User()->id;
     $record = ManyCategoryUser::model()->findByAttributes(array('category_id' => $category_id, 'user_id' => $user_id));
     return $record === null ? false : true;
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:7,代码来源:Category.php

示例7: GetStaffList

function GetStaffList(&$extra)
{
    global $profiles_RET;
    $functions = array('PROFILE' => 'makeProfile');
    switch (User('PROFILE')) {
        case 'admin':
            $profiles_RET = DBGet(DBQuery("SELECT * FROM USER_PROFILES"), array(), array('ID'));
            $sql = "SELECT CONCAT(\n\t\t\t\t\tCOALESCE(s.LAST_NAME,' '),', ',COALESCE(s.FIRST_NAME,' '),' ',COALESCE(s.MIDDLE_NAME,' ')) AS FULL_NAME,\n\t\t\t\t\ts.PROFILE,s.PROFILE_ID,s.STAFF_ID,s.SCHOOLS " . $extra['SELECT'] . "\n\t\t\t\tFROM\n\t\t\t\t\tSTAFF s " . $extra['FROM'] . "\n\t\t\t\tWHERE\n\t\t\t\t\ts.SYEAR='" . UserSyear() . "'";
            if ($_REQUEST['_search_all_schools'] != 'Y') {
                $sql .= " AND (s.SCHOOLS LIKE '%," . UserSchool() . ",%' OR s.SCHOOLS IS NULL OR s.SCHOOLS='') ";
            }
            if ($_REQUEST['username']) {
                $sql .= "AND UPPER(s.USERNAME) LIKE '" . strtoupper($_REQUEST['username']) . "%' ";
            }
            if ($_REQUEST['last']) {
                $sql .= "AND UPPER(s.LAST_NAME) LIKE '" . strtoupper($_REQUEST['last']) . "%' ";
            }
            if ($_REQUEST['first']) {
                $sql .= "AND UPPER(s.FIRST_NAME) LIKE '" . strtoupper($_REQUEST['first']) . "%' ";
            }
            if ($_REQUEST['profile']) {
                $sql .= "AND s.PROFILE='" . $_REQUEST['profile'] . "' ";
            }
            $sql .= $extra['WHERE'] . ' ';
            $sql .= "ORDER BY FULL_NAME";
            if ($extra['functions']) {
                $functions += $extra['functions'];
            }
            return DBGet(DBQuery($sql), $functions);
            break;
    }
}
开发者ID:SoftScape,项目名称:opensis,代码行数:32,代码来源:GetStaffList.fnc.php

示例8: user_news_comments

function user_news_comments()
{
    global $user;
    $html = '<div class="col-md-12"><h1>' . user_news_comments_title() . '</h1>';
    if (isset($_REQUEST["nid"]) && preg_match("/^[0-9]{1,}\$/", $_REQUEST['nid']) && sql_num_query("SELECT * FROM `News` WHERE `ID`='" . sql_escape($_REQUEST['nid']) . "' LIMIT 1") > 0) {
        $nid = $_REQUEST["nid"];
        list($news) = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($nid) . "' LIMIT 1");
        if (isset($_REQUEST["text"])) {
            $text = preg_replace("/([^\\p{L}\\p{P}\\p{Z}\\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['text']));
            sql_query("INSERT INTO `NewsComments` (`Refid`, `Datum`, `Text`, `UID`) VALUES ('" . sql_escape($nid) . "', '" . date("Y-m-d H:i:s") . "', '" . sql_escape($text) . "', '" . sql_escape($user["UID"]) . "')");
            engelsystem_log("Created news_comment: " . $text);
            $html .= success(_("Entry saved."), true);
        }
        $html .= display_news($news);
        $comments = sql_select("SELECT * FROM `NewsComments` WHERE `Refid`='" . sql_escape($nid) . "' ORDER BY 'ID'");
        foreach ($comments as $comment) {
            $user_source = User($comment['UID']);
            if ($user_source === false) {
                engelsystem_error(_("Unable to load user."));
            }
            $html .= '<div class="panel panel-default">';
            $html .= '<div class="panel-body">' . nl2br($comment['Text']) . '</div>';
            $html .= '<div class="panel-footer text-muted">';
            $html .= '<span class="glyphicon glyphicon-time"></span> ' . $comment['Datum'] . '&emsp;';
            $html .= User_Nick_render($user_source);
            $html .= '</div>';
            $html .= '</div>';
        }
        $html .= '<hr /><h2>' . _("New Comment:") . '</h2>';
        $html .= form(array(form_textarea('text', _("Message"), ''), form_submit('submit', _("Save"))), page_link_to('news_comments') . '&nid=' . $news['ID']);
    } else {
        $html .= _("Invalid request.");
    }
    return $html . '</div>';
}
开发者ID:max-weller,项目名称:engelsystem,代码行数:35,代码来源:user_news.php

示例9: HackingLog

function HackingLog()
{
    echo "You're not allowed to use this program! This attempted violation has been logged and your IP address was captured.";
    Warehouse('footer');
    if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    if ($openSISNotifyAddress) {
        mail($openSISNotifyAddress, 'HACKING ATTEMPT', "INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('{$_SERVER['SERVER_NAME']}','{$ip}','" . date('Y-m-d') . "','{$openSISVersion}','{$_SERVER['PHP_SELF']}','{$_SERVER['DOCUMENT_ROOT']}','{$_SERVER['SCRIPT_NAME']}','{$_REQUEST['modname']}','" . User('USERNAME') . "')");
    }
    /*if($openSISNotifyAddress)
    		mail($openSISNotifyAddress,'HACKING ATTEMPT',"INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$_SERVER[REMOTE_ADDR]','".date('Y-m-d')."','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','$_REQUEST[modname]','".User('USERNAME')."')");*/
    if (false && function_exists('mysql_query')) {
        if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $ip = $_SERVER['REMOTE_ADDR'];
        }
        $link = @mysql_connect('os4ed.com', 'openSIS_log', 'openSIS_log');
        @mysql_select_db('openSIS_log');
        @mysql_query("INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('{$_SERVER['SERVER_NAME']}','{$ip}','" . date('Y-m-d') . "','{$openSISVersion}','{$_SERVER['PHP_SELF']}','{$_SERVER['DOCUMENT_ROOT']}','{$_SERVER['SCRIPT_NAME']}','{$_REQUEST['modname']}','" . User('USERNAME') . "')");
        @mysql_close($link);
        /*$link = @mysql_connect('os4ed.com','openSIS_log','openSIS_log');
        		@mysql_select_db('openSIS_log');
        		@mysql_query("INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$_SERVER[REMOTE_ADDR]','".date('Y-m-d')."','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','$_REQUEST[modname]','".User('USERNAME')."')");
        		@mysql_close($link);*/
    }
}
开发者ID:26746647,项目名称:Belize-openSIS,代码行数:30,代码来源:HackingLog.php

示例10: PortalPollsDisplay

function PortalPollsDisplay($value, $name)
{
    global $THIS_RET;
    static $js_included = false;
    $poll_id = $THIS_RET['ID'];
    //get poll:
    $poll_RET = DBGet(DBQuery("SELECT EXCLUDED_USERS, VOTES_NUMBER, DISPLAY_VOTES FROM PORTAL_POLLS WHERE ID='" . $poll_id . "'"));
    $poll_questions_RET = DBGet(DBQuery("SELECT ID, QUESTION, OPTIONS, TYPE, VOTES FROM PORTAL_POLL_QUESTIONS WHERE PORTAL_POLL_ID='" . $poll_id . "' ORDER BY ID"));
    if (!$poll_RET || !$poll_questions_RET) {
        return ErrorMessage(array('Poll does not exist'));
    }
    //should never be displayed, so do not translate
    //verify if user is in excluded users list (format = '|[profile_id]:[user_id]')
    $profile_id = User('PROFILE_ID');
    if ($profile_id != 0) {
        //modif Francois: call right Student/Staff ID
        $user_id = UserStaffID();
    } else {
        $user_id = UserStudentID();
    }
    $excluded_user = '|' . $profile_id . ':' . $user_id;
    if (mb_strpos($poll_RET[1]['EXCLUDED_USERS'], $excluded_user) !== false) {
        return PortalPollsVotesDisplay($poll_id, $poll_RET[1]['DISPLAY_VOTES'], $poll_questions_RET, $poll_RET[1]['VOTES_NUMBER']);
    }
    //user already voted, display votes
    $PollForm = '';
    if (!$js_included) {
        $PollForm .= includeOnceJquery();
        $PollForm .= '<script type="text/javascript" src="assets/js/jquery.form.js"></script>';
        $PollForm .= '<script type="text/javascript">
			$(document).ready(function() {
				$(\'.formPortalPoll\').ajaxForm({ //send the votes in AJAX
					success: function(data,status,xhr,form) {
						$(form).parent().html(data);
					}
				});
			});
		</script>';
        $js_included = true;
    }
    $PollForm .= '<div id="divPortalPoll' . $poll_id . '" style="max-height:350px; overflow-y:auto;"><form method="POST" class="formPortalPoll" action="ProgramFunctions/PortalPolls.fnc.php"><input type="hidden" name="profile_id" value="' . $profile_id . '" /><input type="hidden" name="user_id" value="' . $user_id . '" /><input type="hidden" name="total_votes_string" value="' . _('Total Participants') . '" /><input type="hidden" name="poll_completed_string" value="' . _('Poll completed') . '" /><TABLE  class="width-100p cellspacing-0">';
    foreach ($poll_questions_RET as $question) {
        $PollForm .= '<TR><TD><b>' . $question['QUESTION'] . '</b></TD><TD><TABLE class="width-100p cellspacing-0">';
        $options_array = explode('<br />', nl2br($question['OPTIONS']));
        $checked = true;
        foreach ($options_array as $option_nb => $option_label) {
            if ($question['TYPE'] == 'multiple_radio') {
                $PollForm .= '<TR><TD><label><input type="radio" name="votes[' . $poll_id . '][' . $question['ID'] . ']" value="' . $option_nb . '" ' . ($checked ? 'checked' : '') . ' /> ' . $option_label . '</label></TD></TR>' . "\n";
            } else {
                //multiple
                $PollForm .= '<TR><TD><label><input type="checkbox" name="votes[' . $poll_id . '][' . $question['ID'] . '][]" value="' . $option_nb . '" /> ' . $option_label . '</label></TD></TR>' . "\n";
            }
            $checked = false;
        }
        $PollForm .= '</TABLE></TD></TR>';
    }
    $PollForm .= '</TD></TR></TABLE><P><input type="submit" value="' . _('Submit') . '" /></P></form></div>';
    return $PollForm;
}
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:59,代码来源:PortalPolls.fnc.php

示例11: UserStudentID

function UserStudentID()
{
    if (User('PROFILE') == 'student') {
        return $_SESSION['STUDENT_ID'];
    } else {
        return $_SESSION['student_id'];
    }
}
开发者ID:26746647,项目名称:openSIS,代码行数:8,代码来源:Current.php

示例12: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     // Models
     $this->load->model(array('role_model', 'resource_model', 'rule_model', 'user_model'), '', TRUE);
     // Current connected user level
     $this->current_role = User()->get_role();
 }
开发者ID:trk,项目名称:ionize,代码行数:12,代码来源:role.php

示例13: isAccept

 public function isAccept()
 {
     $r = false;
     $record = ManyAttackAccept::model()->findByAttributes(array('attack_id' => User()->id, 'accept_id' => $this->id));
     if ($record != null) {
         $r = true;
     }
     return $r;
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:9,代码来源:User.php

示例14: Developer

function Developer($name, $title, $skills)
{
    $user = User($name, $title);
    if (!is_array($skills)) {
        $skills = array($skills);
    }
    $user['skills'] = $skills;
    return $user;
    return $user;
}
开发者ID:Irfan-Ullah,项目名称:oop-basics,代码行数:10,代码来源:functional.php

示例15: actionLove

 public function actionLove()
 {
     $record = ManyCategoryUser::model()->deleteAll(array('user_id' => User()->id));
     $nodes = $_POST['nodes'];
     foreach ($nodes as $node) {
         $rel = new ManyCategoryUser();
         $rel->category_id = $node;
         $rel->user_id = User()->id;
         $rel->save();
     }
     $this->redirect(rurl());
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:12,代码来源:FController.php


注:本文中的User函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。