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


PHP functions::get_user方法代码示例

本文整理汇总了PHP中functions::get_user方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::get_user方法的具体用法?PHP functions::get_user怎么用?PHP functions::get_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在functions的用法示例。


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

示例1: vote_photo

-----------------------------------------------------------------
Закрываем от неавторизованных юзеров
-----------------------------------------------------------------
*/
if (!$user_id) {
    require '../incfiles/head.php';
    echo functions::display_error($lng['access_guest_forbidden']);
    require '../incfiles/end.php';
    exit;
}
/*
-----------------------------------------------------------------
Получаем данные пользователя
-----------------------------------------------------------------
*/
$user = functions::get_user($user);
if (!$user) {
    require '../incfiles/head.php';
    echo functions::display_error($lng['user_does_not_exist']);
    require '../incfiles/end.php';
    exit;
}
/*
-----------------------------------------------------------------
Функция голосований за фотографии
-----------------------------------------------------------------
*/
function vote_photo($arg = null)
{
    global $lng, $datauser, $user_id, $ban;
    if ($arg) {
开发者ID:chegestar,项目名称:catroxs,代码行数:31,代码来源:album.php

示例2: mysql_query

<?php

// Проверяем наличие комментируемого объекта
$req_obj = mysql_query("SELECT * FROM `cms_album_files` WHERE `id` = '{$img}'");
if (mysql_num_rows($req_obj)) {
    $res_obj = mysql_fetch_assoc($req_obj);
    /*
    -----------------------------------------------------------------
    Получаем данные владельца Альбома
    -----------------------------------------------------------------
    */
    $owner = functions::get_user($res_obj['user_id']);
    if (!$owner) {
        require '../incfiles/head.php';
        echo functions::display_error($lng['user_does_not_exist']);
        require '../incfiles/end.php';
        exit;
    }
    /*
    -----------------------------------------------------------------
    Показываем выбранную картинку
    -----------------------------------------------------------------
    */
    unset($_SESSION['ref']);
    $req_a = mysql_query("SELECT * FROM `cms_album_cat` WHERE `id` = '" . $res_obj['album_id'] . "'");
    $res_a = mysql_fetch_assoc($req_a);
    if ($res_a['access'] == 1 && $owner['id'] != $user_id && $rights < 6 || $res_a['access'] == 2 && (!isset($_SESSION['ap']) || $_SESSION['ap'] != $res_a['password']) && $owner['id'] != $user_id) {
        // Если доступ закрыт
        require '../incfiles/head.php';
        echo functions::display_error($lng['access_forbidden']) . '<div class="phdr"><a href="album.php?act=list&amp;user=' . $owner['id'] . '">' . $lng_profile['album_list'] . '</a></div>';
        require '../incfiles/end.php';
开发者ID:chegestar,项目名称:catroxs,代码行数:31,代码来源:comments.php

示例3: __construct

 function __construct($arg = array())
 {
     global $mod, $start, $kmess;
     $this->comments_table = $arg['comments_table'];
     $this->object_table = !empty($arg['object_table']) ? $arg['object_table'] : false;
     if (!empty($arg['sub_id_name']) && !empty($arg['sub_id'])) {
         $this->sub_id = $arg['sub_id'];
         $this->url = $arg['script'] . '&amp;' . $arg['sub_id_name'] . '=' . $arg['sub_id'];
     } else {
         //TODO: Доработать на режим без sub_id
         $this->url = $arg['script'];
     }
     $this->item = isset($_GET['item']) ? abs(intval($_GET['item'])) : false;
     // Получаем данные пользователя
     if (core::$user_id) {
         $this->user_id = core::$user_id;
         $this->rights = core::$user_rights;
         $this->ban = core::$user_ban;
     }
     // Назначение пользовательских прав
     if (isset($arg['owner'])) {
         $this->owner = $arg['owner'];
         if (core::$user_id && $arg['owner'] == core::$user_id && !$this->ban) {
             $this->access_delete = isset($arg['owner_delete']) ? $arg['owner_delete'] : false;
             $this->access_reply = isset($arg['owner_reply']) ? $arg['owner_reply'] : false;
             $this->access_edit = isset($arg['owner_edit']) ? $arg['owner_edit'] : false;
         }
     }
     // Открываем доступ для Администрации
     if ($this->rights >= $this->access_level) {
         $this->access_reply = true;
         $this->access_edit = true;
         $this->access_delete = true;
     }
     switch ($mod) {
         case 'reply':
             /*
             -----------------------------------------------------------------
             Отвечаем на комментарий
             -----------------------------------------------------------------
             */
             if ($this->item && $this->access_reply && !$this->ban) {
                 echo '<div class="phdr"><a href="' . $this->url . '"><b>' . $arg['title'] . '</b></a> | ' . core::$lng['reply'] . '</div>';
                 $req = mysql_query("SELECT * FROM `" . $this->comments_table . "` WHERE `id` = '" . $this->item . "' AND `sub_id` = '" . $this->sub_id . "' LIMIT 1");
                 if (mysql_num_rows($req)) {
                     $res = mysql_fetch_assoc($req);
                     $attributes = unserialize($res['attributes']);
                     if (!empty($res['reply']) && $attributes['reply_rights'] > $this->rights) {
                         echo functions::display_error(core::$lng['error_reply_rights'], '<a href="' . $this->url . '">' . core::$lng['back'] . '</a>');
                     } elseif (isset($_POST['submit'])) {
                         $message = $this->msg_check();
                         if (empty($message['error'])) {
                             $attributes['reply_id'] = $this->user_id;
                             $attributes['reply_rights'] = $this->rights;
                             $attributes['reply_name'] = core::$user_data['name'];
                             $attributes['reply_time'] = time();
                             mysql_query("UPDATE `" . $this->comments_table . "` SET\n                                    `reply` = '" . mysql_real_escape_string($message['text']) . "',\n                                    `attributes` = '" . mysql_real_escape_string(serialize($attributes)) . "'\n                                    WHERE `id` = '" . $this->item . "'\n                                ");
                             header('Location: ' . str_replace('&amp;', '&', $this->url));
                         } else {
                             echo functions::display_error($message['error'], '<a href="' . $this->url . '&amp;mod=reply&amp;item=' . $this->item . '">' . core::$lng['back'] . '</a>');
                         }
                     } else {
                         $text = '<a href="' . core::$system_set['homeurl'] . '/users/profile.php?user=' . $res['user_id'] . '"><b>' . $attributes['author_name'] . '</b></a>' . ' (' . functions::display_date($res['time']) . ')<br />' . functions::checkout($res['text']);
                         $reply = functions::checkout($res['reply']);
                         echo $this->msg_form('&amp;mod=reply&amp;item=' . $this->item, $text, $reply) . '<div class="phdr"><a href="' . $this->url . '">' . core::$lng['back'] . '</a></div>';
                     }
                 } else {
                     echo functions::display_error(core::$lng['error_wrong_data'], '<a href="' . $this->url . '">' . core::$lng['back'] . '</a>');
                 }
             }
             break;
         case 'edit':
             /*
             -----------------------------------------------------------------
             Редактируем комментарий
             -----------------------------------------------------------------
             */
             if ($this->item && $this->access_edit && !$this->ban) {
                 echo '<div class="phdr"><a href="' . $this->url . '"><b>' . $arg['title'] . '</b></a> | ' . core::$lng['edit'] . '</div>';
                 $req = mysql_query("SELECT * FROM `" . $this->comments_table . "` WHERE `id` = '" . $this->item . "' AND `sub_id` = '" . $this->sub_id . "' LIMIT 1");
                 if (mysql_num_rows($req)) {
                     $res = mysql_fetch_assoc($req);
                     $attributes = unserialize($res['attributes']);
                     $user = functions::get_user($res['user_id']);
                     if ($user['rights'] > core::$user_rights) {
                         echo functions::display_error(core::$lng['error_edit_rights'], '<a href="' . $this->url . '">' . core::$lng['back'] . '</a>');
                     } elseif (isset($_POST['submit'])) {
                         $message = $this->msg_check();
                         if (empty($message['error'])) {
                             $attributes['edit_id'] = $this->user_id;
                             $attributes['edit_name'] = core::$user_data['name'];
                             $attributes['edit_time'] = time();
                             if (isset($attributes['edit_count'])) {
                                 ++$attributes['edit_count'];
                             } else {
                                 $attributes['edit_count'] = 1;
                             }
                             mysql_query("UPDATE `" . $this->comments_table . "` SET\n                                    `text` = '" . mysql_real_escape_string($message['text']) . "',\n                                    `attributes` = '" . mysql_real_escape_string(serialize($attributes)) . "'\n                                    WHERE `id` = '" . $this->item . "'\n                                ");
                             header('Location: ' . str_replace('&amp;', '&', $this->url));
                         } else {
//.........这里部分代码省略.........
开发者ID:chegestar,项目名称:catroxs,代码行数:101,代码来源:comments.php


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