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


PHP user类代码示例

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


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

示例1: adminNotify

 public function adminNotify()
 {
     if ($this->cookie->check("id_user") and $this->cookie->id_user == 1) {
         //no notificamos a administrador de su propio comentario.
         return;
     }
     $id = $this->registry->lastCommentID;
     $Comment = new comment();
     $comment = $Comment->find($id);
     $comment['content'] = utils::nl2br($comment['content']);
     if (!defined('GESHI_VERSION')) {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content'], 'addTagPRE');
     } else {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content']);
     }
     $User = new user();
     $user = $User->find(1);
     $Post = new post();
     $post = $Post->find($comment['ID_post']);
     $commentsWaiting = $Comment->countCommentsByPost(null, 'waiting');
     $mailStr = "\n\t\t\t<table width=\"100%\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<small>\n\t\t\t\t\t\t<strong>From IP</strong>: {$comment['IP']}<br />\n\t\t\t\t\t\t<strong>URL</strong>: <a href=\"{$comment['url']}\">{$comment['url']}</a><br />\n\t\t\t\t\t\t<strong>Email</strong>: <a href=\"mailto:{$comment['email']}\">{$comment['email']}</a><br />\n\t\t\t\t\t\t<strong>DateTime</strong>: {$comment['created']}<br />\n\t\t\t\t\t</small>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<strong>Author</strong>: {$comment['author']}<br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr><td><strong>Content</strong></td></tr>\n\t\t\t<tr><td bgcolor=\"#f7f7f7\">\n\t\t\t\t{$comment['content']}\n\t\t\t\t<hr />\n\t\t\t</td></tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tModerate comment: <a href=\"{$this->registry->path}comments/edit/{$comment['ID']}\">{$this->registry->path}comments/edit/{$comment['ID']}</a><br />\n\t\t\t\t\t\tView entry: <a href=\"{$this->registry->path}{$post['urlfriendly']}\">{$this->registry->path}{$post['urlfriendly']}</a>\n\t\t\t\t\t</p>\n\t\t\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThere are {$commentsWaiting} comments waiting for approbal. <br />\n\t\t\t\t\t\tPlease moderate comments: <a href=\"{$this->registry->path}comments/waiting\">{$this->registry->path}comments</a>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t";
     $conf = $this->registry->conf;
     $subject = "[{$conf['blog_name']}] Nuevo Comentario en: {$post['title']}";
     $this->enviaMail($user['email'], $subject, $mailStr, $user['email']);
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:25,代码来源:commentNotify.plugin.php

示例2: add

 public function add()
 {
     global $db;
     $recipient = new user();
     if ($recipient->get('name', $this->data['recipient']) == 'done') {
         $sender = new user();
         if ($sender->get('name', $this->data['sender']) == 'done') {
             if (!$sender->isBlocked($recipient->data['id'])) {
                 $this->data['id'] = misc::newId('messages');
                 $sent = strftime('%Y-%m-%d %H:%M:%S', time());
                 $db->query('insert into messages (id, sender, recipient, subject, body, sent, viewed) values ("' . $this->data['id'] . '", "' . $sender->data['id'] . '", "' . $recipient->data['id'] . '", "' . $this->data['subject'] . '", "' . $this->data['body'] . '", "' . $sent . '", "' . $this->data['viewed'] . '")');
                 if ($db->affected_rows() > -1) {
                     $status = 'done';
                 } else {
                     $status = 'error';
                 }
             } else {
                 $status = 'blocked';
             }
         } else {
             $status = 'noSender';
         }
     } else {
         $status = 'noRecipient';
     }
     return $status;
 }
开发者ID:yunsite,项目名称:devana-heroic,代码行数:27,代码来源:message.class.php

示例3: load_user

 private function load_user()
 {
     include_once ROOT_PATH . 'lib/user/user.class.php';
     $user = new user();
     $uinfo = $user->verify_credentials();
     $this->user = $uinfo;
 }
开发者ID:h3len,项目名称:Project,代码行数:7,代码来源:session.php

示例4: openqrm_dhcpd_resource

function openqrm_dhcpd_resource($cmd, $resource_fields)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $resource_id = $resource_fields["resource_id"];
    $resource_ip = $resource_fields["resource_ip"];
    $resource_mac = $resource_fields["resource_mac"];
    if (isset($resource_fields["resource_subnet"])) {
        $resource_subnet = $resource_fields["resource_subnet"];
    } else {
        $resource_subnet = "0.0.0.0";
    }
    $openqrm_admin_user = new user("openqrm");
    $openqrm_admin_user->set_user();
    $openqrm_server = new openqrm_server();
    $event->log("openqrm_new_resource", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-resource-hook.php", "Handling {$cmd} event {$resource_id}/{$resource_ip}/{$resource_subnet}/{$resource_mac}", "", "", 0, 0, $resource_id);
    switch ($cmd) {
        case "add":
            $openqrm_server->send_command($OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager add -d " . $resource_id . " -m " . $resource_mac . " -i " . $resource_ip . " -s " . $resource_subnet . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password . " --openqrm-cmd-mode background");
            break;
        case "remove":
            $openqrm_server->send_command("{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager remove -d " . $resource_id . " -m " . $resource_mac . " -i " . $resource_ip . " -s " . $resource_subnet . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password . " --openqrm-cmd-mode background");
            break;
    }
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:27,代码来源:openqrm-dhcpd-resource-hook.php

示例5: __construct

 /**
  * Layout Page Logic
  * @return 
  * @param $db Object
  */
 function __construct(database $db, user $user)
 {
     $this->db =& $db;
     $this->user =& $user;
     $this->sub_page = Kit::GetParam('sp', _GET, _WORD, 'view');
     $this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
     // If we have modify selected then we need to get some info
     if ($this->layoutid != '') {
         // get the permissions
         Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
         $this->auth = $user->LayoutAuth($this->layoutid, true);
         if (!$this->auth->edit) {
             trigger_error(__("You do not have permissions to edit this layout"), E_USER_ERROR);
         }
         $this->sub_page = "edit";
         $sql = " SELECT layout, description, userid, retired, xml FROM layout ";
         $sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
         if (!($results = $db->query($sql))) {
             trigger_error($db->error());
             trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
         }
         if ($db->num_rows($results) == 0) {
             $this->has_permissions = false;
         }
         while ($aRow = $db->get_row($results)) {
             $this->layout = Kit::ValidateParam($aRow[0], _STRING);
             $this->description = Kit::ValidateParam($aRow[1], _STRING);
             $this->retired = Kit::ValidateParam($aRow[3], _INT);
             $this->xml = $aRow[4];
         }
     }
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:37,代码来源:layout.class.php

示例6: test_customusersetthemectx

 /**
  * Test custom userset theme assignment.
  */
 public function test_customusersetthemectx()
 {
     $this->load_csv_data();
     // ELIS user with the associated moodle user.
     $user = new user(103);
     $muser = $user->get_moodleuser();
     // Userset with a custom theme.
     $userset = new userset(1);
     $userset->field__elis_userset_theme = 'formal_white';
     $userset->field__elis_userset_themepriority = 1;
     $userset->save();
     // Assign the user to the user set.
     $usersetassign = new clusterassignment();
     $usersetassign->userid = $user->id;
     $usersetassign->clusterid = $userset->id;
     $usersetassign->save();
     // Pretend to be that user.
     $this->setUser($muser->id);
     // Initialize page.
     $page = new moodle_page();
     $page->initialise_theme_and_output();
     // Assert we have our theme.
     $this->assertEquals('formal_white', $page->theme->name);
     $this->setUser(null);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:28,代码来源:customusersettheme_test.php

示例7: create_session

 public static function create_session($username, $password, $view)
 {
     $username = str_replace("['\"]", "", $username);
     $password = str_replace("['\"]", "", $password);
     $view = str_replace("['\"]", "", $view);
     $user = new user();
     $keys = array("username", "password");
     $values = array($username, md5($password));
     $user1 = $user->get_with_parameter($keys, $values);
     //error_log(var_export($user1));
     //error_log("view: $view");
     if ($user1 != null) {
         if ($view * 1 === 1 && $user1->has_group(session::GROUP_DASHBOARD) === true || $view * 1 === 2 && $user1->has_group(session::GROUP_METADATA) === true) {
             $session = new session();
             $session->session_id = uniqid();
             $session->user_id = $user1->id;
             $session->activ = 1;
             $d1 = new DateTime();
             $d1->add(new DateInterval("PT30S"));
             $session->duration_time = $d1->format("Y-m-d H:i:s");
             $session->insert();
             return $session;
         }
     }
     return NULL;
 }
开发者ID:hurricanetx,项目名称:holmes-bi,代码行数:26,代码来源:session.php

示例8: duelRankInfo

 public function duelRankInfo(user $user)
 {
     $points = $user->getDuelPoints();
     if ('0' == $points) {
         $level = 0;
     }
     if ('0' < $points && $points <= '1000') {
         $level = 1;
     }
     //incognito
     if ('1000' < $points && $points <= '2000') {
         $level = 2;
     }
     if ('2000' < $points && $points <= '3000') {
         $level = 3;
     }
     if ('3000' < $points) {
         $level = 4;
     }
     //now we are going to determine the place of the user.
     $repository = $this->em->getRepository('BFUserBundle:User');
     $globalRank = $repository->globalDuelRanking();
     $countryRank = $repository->countryDuelRanking($user->getCountry());
     $stateRank = $repository->stateDuelRanking($user->getState());
     $globalRank = array_search($user, $globalRank) + 1;
     $countryRank = array_search($user, $countryRank) + 1;
     $stateRank = array_search($user, $stateRank) + 1;
     //making an object to return all these informations
     $rankInfo = array('level' => $level);
     return $rankInfo;
 }
开发者ID:jojotjebaby,项目名称:Bestfootball,代码行数:31,代码来源:BFUserinfo.php

示例9: show

 public function show()
 {
     $user_id = $this->user['id'];
     include_once ROOT_PATH . 'lib/user/user.class.php';
     $info = new user();
     $user_info = $info->getUserById($user_id, "all");
     $user_info = $user_info[0];
     $id = $user_info['id'];
     $hot_station = $this->mVideo->get_station(0, 0, 0, 10);
     if (is_array($hot_station)) {
         unset($hot_station[count($hot_station) - 1]);
     }
     $hot_video = $this->mVideo->get_video_info(0, 0, 6, '', 2);
     $stationInfo = $this->mVideo->get_user_station();
     $this->page_title = $this->lang['pageTitle'];
     $this->settings['nav_menu'][3] = array("name" => "频道设置", "url" => SNS_VIDEO . SCRIPTNAME, "last" => 1);
     $gScriptName = SCRIPTNAME;
     hg_add_head_element('js-c', "\r\n\t\t\tvar re_back = 'my_station.php';\r\n\t\t\tvar re_back_login = 'login.php';\r\n\t\t");
     hg_add_head_element('js', RESOURCE_DIR . 'scripts/' . 'my.js');
     $this->tpl->addVar('head_line', $this->settings['nav_menu']);
     $this->tpl->addVar('id', $id);
     $this->tpl->addVar('user_id', $user_id);
     $this->tpl->addVar('user_info', $user_info);
     $this->tpl->addVar('hot_station', $hot_station);
     $this->tpl->addVar('hot_video', $hot_video);
     $this->tpl->addVar('stationInfo', $stationInfo);
     $this->tpl->addVar('gScriptName', $gScriptName);
     $this->tpl->addHeaderCode(hg_add_head_element('echo'));
     $this->tpl->setTemplateTitle($this->page_title);
     $this->tpl->outTemplate('my_station');
 }
开发者ID:h3len,项目名称:Project,代码行数:31,代码来源:my_station.php

示例10: displayContent

 protected function displayContent()
 {
     // nl2br converts a new line character to an HTML break tag
     $html = '<p>' . nl2br($this->pageInfo['content']) . '</p>';
     if (!isset($_SESSION['userID'])) {
         return false;
     }
     //instantiate the form
     include 'classes/formsClass.php';
     $form = new form($this->model);
     //instantiate the class user
     include 'classes/userClass.php';
     $user = new user($this->model);
     //instantiate the class centre
     include 'classes/centreClass.php';
     $centre = new centre($this->model);
     $html .= $user->displayUserPage();
     if (!isset($_POST['submitRate'])) {
         $html .= '<div><br/><br/>';
         $html .= $centre->displayCentres();
         $html .= '</div>';
     } else {
         $result = $centre->addRate();
         if (!$result) {
             $html .= '<h4 class="redhead">You have successfully <br/>ranked the centre!</h4>';
             //count function
             //$html .= $centre -> displayNewRanking();
             //display the arrays in the
         } else {
             $html .= '<h4>Sorry, something went wrong please contact us <a href="index.php?page=contact">here</a></h4>';
         }
     }
     return $html;
 }
开发者ID:pamcez,项目名称:Project1PHP,代码行数:34,代码来源:userView.php

示例11: create_kvm_vm

function create_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $vm_type, $vncpassword)
{
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    global $RESOURCE_INFO_TABLE;
    global $event;
    $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Creating KVM VM {$name} on Host resource {$host_resource_id}", "", "", 0, 0, 0);
    // start the vm on the host
    $host_resource = new resource();
    $host_resource->get_instance_by_id($host_resource_id);
    // we need to have an openQRM server object too since some of the
    // virtualization commands are sent from openQRM directly
    $openqrm = new openqrm_server();
    $openqrm_admin_user = new user("openqrm");
    $openqrm_admin_user->set_user();
    $vncpassword_parameter = "";
    if ($vncpassword != '') {
        $vncpassword_parameter = " -v " . $vncpassword;
    }
    // send command to create vm
    $vm_create_cmd = "{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/kvm/bin/openqrm-kvm-vm create -n " . $name . " -y " . $vm_type . " -m " . $mac . " -r " . $memory . " -c " . $cpu . " -b local " . $additional_nic_str . " " . $vncpassword_parameter . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password;
    $host_resource->send_command($host_resource->ip, $vm_create_cmd);
    $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Running {$vm_create_cmd}", "", "", 0, 0, 0);
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:25,代码来源:openqrm-kvm-cloud-hook.php

示例12: IMPORT_MEMBERS

function IMPORT_MEMBERS()
{
    $me = $_SERVER["SERVER_NAME"];
    $error = array();
    $members = unserialize(base64_decode($_POST["MEMBERS"]));
    writelogs("Analyze " . count($members) . " members for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
    while (list($uid, $array) = each($members)) {
        writelogs("Analyze {$uid} for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
        $user = new user($uid);
        if ($user->UserExists) {
            $user->password = $array["password"];
            if ($user->add_user()) {
                $success[] = "{$me}::IMPORT_MEMBERS:: Success updating {$uid} in LDAP database";
            } else {
                $error[] = "Failed updating {$uid} in LDAP database\n {$user->ldap_error}";
            }
            continue;
        }
        while (list($key, $value) = each($array)) {
            $user->{$key} = $value;
        }
        if ($user->add_user()) {
            $success[] = "{$me}::IMPORT_MEMBERS:: Success adding {$uid} in LDAP database";
        } else {
            $error[] = "Failed adding {$uid} in LDAP database\n {$user->ldap_error}";
        }
    }
    if (count($error) > 0) {
        echo "<ERROR>" . @implode("\n", $error) . "</ERROR>";
    }
    if (count($success) > 0) {
        echo "<SUCCESS>" . @implode("\n", $success) . "</SUCCESS>";
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:34,代码来源:import.users.listener.php

示例13: login

 public function login()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'username', 'required|trim|min_length[3]');
     $this->form_validation->set_rules('password', 'password', 'required|trim|min_length[3]');
     if ($this->form_validation->run() == false) {
         $this->load->view('loginview');
     } else {
         $user = new user();
         $user->set_username($this->input->post('username'));
         $user->set_password($this->input->post('password'));
         $mannualauth = new user_mannual_auth($user);
         if ($return = $mannualauth->authenticate()) {
             switch ($return) {
                 case 'ACCOUNT_INVALID':
                     echo $return;
                     break;
                 case 'PASSWORD_INCORRECT':
                     echo $return;
                     break;
                 case 'USER_NOT_FOUND':
                     echo $return;
                     break;
                 default:
                     $mannualauth->role();
                     $this->session->set_userdata('user', serialize($user));
                     redirect('home/dashboard');
                     break;
             }
         } else {
             echo "Error:some problem occured in creation";
         }
     }
 }
开发者ID:shambhukumar,项目名称:Codeigniter_authentication,代码行数:34,代码来源:Logincontroller.php

示例14: loginAction

 public function loginAction()
 {
     $view = (include "../view/loginform.php");
     return $view;
     session_start();
     require_once '../model/loginModel.php';
     $formLogin = true;
     $error = array();
     $user = new user();
     if (empty($_POST)) {
         $result = $user->loginUser($pdo);
         if (isset($_POST['pseudo'])) {
             $error['pseudo'] = 'Veuillez indiquer votre pseudo';
             $formLogin = false;
         }
         if (!isset($_POST['password']) || strlen($_POST['password']) < 6) {
             $error['password'] = 'Saisissez un mot de passe de plus de 6 caracteres';
             $formLogin = false;
         }
         $_POST['password'] = trim(htmlentities(sha1($_POST['password'])));
         if ($result['password'] != $_POST['password']) {
             $error['passcheck'] = 'mot de passe est incorrect';
             $formLogin = false;
         }
         if ($formLogin) {
             http_response_code(400);
             echo json_encode(array('success' => false, "errors" => $errors));
         } else {
             $_SESSION['pseudo'] = $info['pseudo'];
             $_SESSION['id'] = $info['id'];
             $result = $login->loginUser($pdo);
             echo json_encode(array('success' => true, "user" => $_POST));
         }
     }
 }
开发者ID:LattyS,项目名称:my_blog,代码行数:35,代码来源:AuthController.php

示例15: process

 private function process()
 {
     $this->commonProcess();
     $config = services::getService('config');
     $lang = services::getService('lang');
     $params = services::getService('pageParams');
     $mail = services::getService('mail');
     $geo = services::getService('geoinfo');
     $categories = services::getService('cats');
     if ($params->getParam('add_to_adressbook')) {
         $addr = new adressbook();
         $addr->sender_id = $this->user->id;
         $addr->recipient_id = $params->getParam('showmember');
         if (!$addr->find()) {
             $addr->insert();
             $this->addMsg('msg_adressbook_add_success');
         } else {
             $this->addMsg('msg_adressbook_add_allready');
         }
     }
     // build userlist
     // assotiativ array with object and detail-flag
     $smember = new user();
     $smember->id = $params->getParam('showmember');
     $smember->find(true);
     $member = array("obj" => $smember);
     $this->member = $member;
     $this->member['obj']->getPhoto();
     $this->geodist = $geo->getDistance($this->user, $this->member["obj"]);
 }
开发者ID:BackupTheBerlios,项目名称:cosmopool-multi-svn,代码行数:30,代码来源:pageShowMember.php


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