• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP format_avatar函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAssignedItems

 /**
  * Get feedback items assigned to this user
  * @since Version 3.9
  * @return array
  */
 public function getAssignedItems()
 {
     if (!$this->Staff instanceof User) {
         throw new Exception("You must assign a valid User object before fetching assigned feedback items");
     }
     $query = "SELECT f.*, fs.name AS status_text, fa.feedback_title AS area_text\r\n                FROM feedback AS f \r\n                INNER JOIN feedback_status AS fs ON f.status = fs.id\r\n                INNER JOIN feedback_area AS fa ON f.area = fa.feedback_id\r\n                WHERE f.assigned_to = ?\r\n                ORDER BY f.time DESC";
     $return = array();
     foreach ($this->db->fetchAll($query, $this->Staff->id) as $row) {
         $date = new DateTime(sprintf("@%s", $row['time']));
         $data = array("id" => $row['id'], "message" => $row['message'], "date" => array("absolute" => $date->format("Y-m-d H:i:s"), "relative" => time2str($row['time'])), "area" => array("id" => $row['area'], "text" => $row['area_text']), "status" => array("id" => $row['status'], "text" => $row['status_text']), "author" => array("id" => false, "username" => false, "realname" => false, "email" => $row['email']));
         if (filter_var($row['user_id'], FILTER_VALIDATE_INT) && $row['user_id'] > 0) {
             $Author = new User($row['user_id']);
             $data['author']['id'] = $Author->id;
             $data['author']['username'] = $Author->username;
             $data['author']['realname'] = $Author->real_name;
             $data['author']['url'] = $Author->url->url;
             $data['author']['avatar'] = array("large" => format_avatar($Author->avatar, 120), "small" => format_avatar($Author->avatar, 40));
         }
         $return[] = $data;
     }
     return $return;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:27,代码来源:Feedback.php


示例2: validateAvatar

 /**
  * Validate user avatar
  * @since Version 3.9.1
  * @return \Railpage\Users\User
  *
  * @param boolean $force
  */
 public function validateAvatar($force = false)
 {
     if (!empty($this->avatar)) {
         if ($force || (empty($this->avatar_width) || empty($this->avatar_height) || $this->avatar_width == 0 || $this->avatar_height == 0)) {
             if ($size = @getimagesize($this->avatar)) {
                 $Config = AppCore::getConfig();
                 if ($size[0] >= $Config->AvatarMaxWidth || $size[1] >= $Config->AvatarMaxHeight) {
                     $this->avatar = sprintf("https://static.railpage.com.au/image_resize.php?w=%d&h=%d&image=%s", $Config->AvatarMaxWidth, $Config->AvatarMaxHeight, urlencode($this->avatar));
                     $this->avatar_filename = $this->avatar;
                     $this->avatar_width = $size[0];
                     $this->avatar_height = $size[1];
                 } else {
                     $this->avatar_width = $size[0];
                     $this->avatar_height = $size[1];
                     $this->avatar_filename = $this->avatar;
                 }
                 $this->commit(true);
                 return $this;
             }
         }
     }
     $this->avatar = function_exists("format_avatar") ? format_avatar("http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png", 120, 120) : "http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png";
     $this->avatar_filename = function_exists("format_avatar") ? format_avatar("http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png", 120, 120) : "http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png";
     $this->avatar_width = 120;
     $this->avatar_height = 120;
     return $this;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:34,代码来源:User.php


示例3: comment_process

 public function comment_process($comment, $memprofile)
 {
     global $templates, $cache, $settings, $mybb, $lang;
     MyProfileUtils::lang_load_myprofile();
     $usergroups = $cache->read("usergroups");
     $editable = $this->can_edit_comment($comment);
     $approvable = $this->can_approve_comment($comment);
     $deletable = $this->can_delete_comment($comment);
     /* replyable: well, it's replyable if I'm memprofile, and I'm trying to send a comment to the commentor (but I am not the commentor, otherwise it will be an infinite loop) */
     $replyable = $mybb->user["uid"] == $memprofile["uid"] && $comment["cuid"] != $comment["userid"] && $this->can_send_comments($memprofile, $comment);
     $reportable = $this->can_report_comment($comment);
     /* now we add html content to the comment */
     list($avatar_src, $avatar_width_height) = array_values(format_avatar($comment["avatar"], $comment["avatardimensions"]));
     $date = my_date($settings["dateformat"], $comment["time"]);
     $time = my_date($settings["timeformat"], $comment["time"]);
     $username = format_name(htmlspecialchars_uni($comment["username"]), $comment["usergroup"], $comment["displaygroup"]);
     $profile_link = build_profile_link($username, $comment["cuid"]);
     $message = $this->parse_comment($comment["message"]);
     if ($editable) {
         eval("\$comments_edit = \"" . $templates->get('myprofile_comments_comment_edit') . "\";");
     }
     if ($approvable) {
         $trow_class = "trow_shaded";
         eval("\$comments_approve = \"" . $templates->get('myprofile_comments_comment_approve') . "\";");
     }
     if ($deletable) {
         eval("\$comments_delete = \"" . $templates->get('myprofile_comments_comment_delete') . "\";");
     }
     if ($replyable) {
         $commentor_uid = $comment["cuid"];
         eval("\$comments_reply = \"" . $templates->get('myprofile_comments_comment_reply') . "\";");
     }
     if ($reportable) {
         eval("\$comments_report = \"" . $templates->get('myprofile_comments_comment_report') . "\";");
     }
     if ($comment["isprivate"] == "1") {
         $comment_private = $lang->mp_comments_comment_private;
     }
     if (isset($mybb->input["highlight"]) && $mybb->input["highlight"] == $comment["cid"]) {
         $trow_class = "trow_selected";
     }
     /* last eval() */
     eval("\$comment_content = \"" . $templates->get('myprofile_comments_comment') . "\";");
     //$comment["html"] = $comment_content;
     return $comment_content;
 }
开发者ID:medbenji,项目名称:MyProfile,代码行数:46,代码来源:myprofilecomments.class.php


示例4: build_postbit


//.........这里部分代码省略.........
            $post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']);
            $post['userstars'] = '';
            for ($i = 0; $i < $post['stars']; ++$i) {
                eval("\$post['userstars'] .= \"" . $templates->get("postbit_userstar", 1, 0) . "\";");
            }
            $post['userstars'] .= "<br />";
        }
        $postnum = $post['postnum'];
        $post['postnum'] = my_number_format($post['postnum']);
        $post['threadnum'] = my_number_format($post['threadnum']);
        // Determine the status to show for the user (Online/Offline/Away)
        /*
        $timecut = TIME_NOW - $mybb->settings['wolcutoff'];
        if($post['lastactive'] > $timecut && ($post['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1) && $post['lastvisit'] != $post['lastactive'])
        {
        	eval("\$post['onlinestatus'] = \"".$templates->get("postbit_online")."\";");
        }
        else
        {
        	if($post['away'] == 1 && $mybb->settings['allowaway'] != 0)
        	{
        		eval("\$post['onlinestatus'] = \"".$templates->get("postbit_away")."\";");
        	}
        	else
        	{
        		eval("\$post['onlinestatus'] = \"".$templates->get("postbit_offline")."\";");
        	}
        }
        */
        // Show as always offline
        eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_offline") . "\";");
        $post['useravatar'] = '';
        if (isset($mybb->user['showavatars']) && $mybb->user['showavatars'] != 0 || $mybb->user['uid'] == 0) {
            $useravatar = format_avatar($post['avatar'], $post['avatardimensions'], $mybb->settings['postmaxavatarsize']);
            eval("\$post['useravatar'] = \"" . $templates->get("postbit_avatar") . "\";");
        }
        $post['button_find'] = '';
        if ($mybb->usergroup['cansearch'] == 1) {
            eval("\$post['button_find'] = \"" . $templates->get("postbit_find") . "\";");
        }
        if ($mybb->settings['enablepms'] == 1 && $post['receivepms'] != 0 && $mybb->usergroup['cansendpms'] == 1 && my_strpos("," . $post['ignorelist'] . ",", "," . $mybb->user['uid'] . ",") === false) {
            //eval("\$post['button_pm'] = \"".$templates->get("postbit_pm")."\";");
        }
        $post['button_rep'] = '';
        if ($post_type != 3 && $mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid'] && $post['visible'] == 1) {
            if (!$post['pid']) {
                $post['pid'] = 0;
            }
            eval("\$post['button_rep'] = \"" . $templates->get("postbit_rep_button") . "\";");
        }
        if ($post['website'] != "" && !is_member($mybb->settings['hidewebsite']) && $usergroup['canchangewebsite'] == 1) {
            $post['website'] = htmlspecialchars_uni($post['website']);
            eval("\$post['button_www'] = \"" . $templates->get("postbit_www") . "\";");
        } else {
            $post['button_www'] = "";
        }
        if ($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1) {
            eval("\$post['button_email'] = \"" . $templates->get("postbit_email") . "\";");
        } else {
            $post['button_email'] = "";
        }
        $post['userregdate'] = $lang->na;
        //my_date($mybb->settings['regdateformat'], $post['regdate']);
        // Work out the reputation this user has (only show if not announcement)
        if ($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1) {
            $post['userreputation'] = get_reputation($post['reputation'], $post['uid']);
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:67,代码来源:functions_post.php


示例5: build_profile_link

     $profilelink = build_profile_link($announcement['username'], $announcement['uid']);
 }
 if (!$announcement['username']) {
     $announcement['username'] = $announcement['threadusername'];
 }
 $announcement['subject'] = htmlspecialchars_uni($parser->parse_badwords($announcement['subject']));
 if ($announcement['icon'] > 0 && $icon_cache[$announcement['icon']]) {
     $icon = $icon_cache[$announcement['icon']];
     $icon['path'] = str_replace("{theme}", $theme['imgdir'], $icon['path']);
     $icon['path'] = htmlspecialchars_uni($icon['path']);
     $icon['name'] = htmlspecialchars_uni($icon['name']);
     eval("\$icon = \"" . $templates->get("portal_announcement_icon") . "\";");
 } else {
     $icon = "&nbsp;";
 }
 $useravatar = format_avatar($announcement['avatar'], $announcement['avatardimensions']);
 eval("\$avatar = \"" . $templates->get("portal_announcement_avatar") . "\";");
 $anndate = my_date('relative', $announcement['dateline']);
 if ($announcement['replies']) {
     eval("\$numcomments = \"" . $templates->get("portal_announcement_numcomments") . "\";");
 } else {
     eval("\$numcomments = \"" . $templates->get("portal_announcement_numcomments_no") . "\";");
     $lastcomment = '';
 }
 $senditem = '';
 if ($mybb->user['uid'] > 0 && $mybb->usergroup['cansendemail'] == 1) {
     eval("\$senditem = \"" . $templates->get("portal_announcement_send_item") . "\";");
 }
 $plugins->run_hooks("portal_announcement");
 $parser_options = array("allow_html" => $forum[$announcement['fid']]['allowhtml'], "allow_mycode" => $forum[$announcement['fid']]['allowmycode'], "allow_smilies" => $forum[$announcement['fid']]['allowsmilies'], "allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'], "allow_videocode" => $forum[$announcement['fid']]['allowvideocode'], "filter_badwords" => 1);
 if ($announcement['smilieoff'] == 1) {
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:portal.php


示例6: teamonline_show

function teamonline_show()
{
    global $cache, $groupscache, $db, $mybb, $teamonline, $lang, $theme, $templates, $online;
    $lang->load('teamonline');
    if ($mybb->settings['teamonline_gid']) {
        $gid = " IN (" . $mybb->settings['teamonline_gid'] . ")";
        $timesearch = TIME_NOW - $mybb->settings['wolcutoffmins'] * 60;
        $teamonline_row = '';
        $trowbg = alt_trow();
        $query = $db->query("\n\t\t\tSELECT s.sid, s.ip, s.uid, u.username, s.time, u.avatar, u.usergroup, u.displaygroup, u.invisible\n\t\t\tFROM " . TABLE_PREFIX . "sessions s\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (s.uid=u.uid)\n\t\t\tWHERE u.usergroup {$gid} AND time>'{$timesearch}'\n\t\t\tORDER BY u.username ASC, s.time DESC\n\t\t\t");
        if (!$db->num_rows($query)) {
            eval("\$teamonline_no = \"" . $templates->get("teamonline_no") . "\";");
            $invisible = 0;
            $membercount = 0;
        } else {
            if (!is_array($groupscache)) {
                $groupscache = $cache->read("usergroups");
            }
            while ($online = $db->fetch_array($query)) {
                $invisible_mark = '';
                if ($online['invisible'] == 1) {
                    $invisible_mark = '*';
                }
                if ($online['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $online['uid'] == $mybb->user['uid']) {
                    $avatar_teamonline = format_avatar($online['avatar']);
                    $online['username'] = format_name($online['username'], $online['usergroup'], $online['displaygroup']);
                    $online['profilelink'] = build_profile_link($online['username'], $online['uid']) . $invisible_mark;
                    $online['groupname'] = $groupscache[$online['usergroup']]['title'];
                    eval("\$teamonline_row .= \"" . $templates->get("teamonline_row") . "\";");
                }
                $invisible += $online['invisible'];
                $membercount++;
            }
        }
        eval("\$teamonline = \"" . $templates->get("teamonline") . "\";");
    }
}
开发者ID:ambsalinas,项目名称:anima,代码行数:37,代码来源:teamonline.php


示例7: chatcat_insert_footer

function chatcat_insert_footer()
{
    global $mybb, $templates, $myval;
    $myval = "";
    if ($mybb->settings['chatcat_enable'] == 1) {
        $apikey = $mybb->settings['chatcat_enable_api'];
        $api_url = '';
        if (strlen($mybb->settings['chatcat_enable_api']) != 0) {
            $user = $mybb->user;
            $api_key = $mybb->settings['chatcat_enable_api'];
            $secret = $mybb->settings['chatcat_secret'];
            $uid = $user['uid'];
            if (function_exists('format_avatar')) {
                $useravatar = format_avatar(htmlspecialchars_uni($user['avatar']), $user['avatardimensions'], my_strtolower($mybb->settings['memberlistmaxavatarsize']));
                if (!empty($useravatar['image'])) {
                    $src = $useravatar['image'];
                }
            }
            $username = $user['username'];
            $dateOfBirth = strtotime($user['birthday']) * 1000;
            //var_dump($user);
            // Get the user's description
            $description = $user['fid2'];
            $location = $user['fid1'];
            $sex = $user['fid3'];
            $params = array('api_key' => $api_key, 'secret' => $secret, 'src' => urlencode($src), 'username' => $username, 'description' => $description, 'uid' => $uid, 'dateOfBirth' => $dateOfBirth, 'location' => $location, 'sex' => $sex, 'homepage' => urlencode($mybb->settings['bburl'] . "/" . get_profile_link($uid)));
            $extension = '?';
            foreach ($params as $key => $value) {
                if ($value) {
                    $extension .= $key . '=' . $value . '&';
                }
            }
            $extension = substr($extension, 0, -1);
            $api_url = $mybb->settings['bburl'] . '/ajaxchat.php' . $extension;
        }
        if ($mybb->settings['chatcat_enable_login'] == '') {
            $login_url = $mybb->settings['bburl'] . '/member.php?action=login';
        } else {
            $login_url = $mybb->settings['chatcat_enable_login'];
            if (!preg_match("@^[hf]tt?ps?://@", $login_url)) {
                $login_url = "http://" . $login_url;
            }
        }
        if ($mybb->settings['chatcat_enable_register'] == '') {
            $register_url = $mybb->settings['bburl'] . '/member.php?action=register';
        } else {
            $register_url = $mybb->settings['chatcat_enable_register'];
            if (!preg_match("@^[hf]tt?ps?://@", $register_url)) {
                $register_url = "http://" . $register_url;
            }
        }
        if ($mybb->settings['chatcat_enable_primary'] != '') {
            $primary_url = $mybb->settings['chatcat_enable_primary'];
        } else {
            $primary_url = $mybb->settings['bburl'];
        }
        ?>

    <div ng-app="myApp" ><ng-include src=" baseURL + 'chatcat.html'" ng-controller="AppController"></ng-include></div>
    <script type="text/javascript">

        // Set options here
        var CC_OPTIONS = {

            
            primaryDomain: '<?php 
        echo $primary_url;
        ?>
',
			        

            // Users can create public chat rooms?
            // If this is true users will be able to setup new
            // public rooms
            usersCanCreatePublicRooms: true,

            // Allow anonymous login?
            anonymousLoginEnabled: false,

            // Enable social login - please email us to get your domain whitelisted
            socialLoginEnabled: true,

            // The URL to contact for single sign on
            singleSignOnURL: '<?php 
        echo $api_url;
        ?>
',
            singleSignOnAPILevel: 1,

            // Optional - if this is set the login box will direct users
            // to log in
            loginURL: '<?php 
        echo $login_url;
        ?>
',

            // Optional - if this is set the login box will direct users
            // to register
            registerURL: '<?php 
        echo $register_url;
//.........这里部分代码省略.........
开发者ID:xzdaniels,项目名称:Chatcat,代码行数:101,代码来源:chatcat.php


示例8: load


//.........这里部分代码省略.........
                 $data['organisations'] = array();
                 $query = "SELECT o.* FROM organisation o, organisation_member om WHERE o.organisation_id = om.organisation_id AND om.user_id = ?";
                 if ($orgs = $this->db->fetchAll($query, $this->id)) {
                     foreach ($orgs as $row) {
                         $data['organisations'][$row['organisation_id']] = $row;
                     }
                 }
                 $query = "SELECT oc.* FROM oauth_consumer AS oc LEFT JOIN nuke_users AS u ON u.oauth_consumer_id = oc.id WHERE u.user_id = ?";
                 if ($row = $this->db->fetchRow($query, $this->id)) {
                     $data['oauth_key'] = $row['consumer_key'];
                     $data['oauth_secret'] = $row['consumer_secret'];
                 }
             }
         }
     }
     /**
      * Process some of the returned values
      */
     // Set the full avatar path
     if (!empty($data['user_avatar'])) {
         $data['user_avatar_filename'] = $data['user_avatar'];
         if (!stristr($data['user_avatar'], "http://") && !stristr($data['user_avatar'], "https://")) {
             // Assume local avatar
             $data['user_avatar'] = "http://" . $_SERVER['SERVER_NAME'] . "/modules/Forums/images/avatars/" . $data['user_avatar'];
         }
         if (is_null($data['user_avatar_width']) || is_null($data['user_avatar_height'])) {
             if ($size = @getimagesize($data['user_avatar'])) {
                 $data['user_avatar_width'] = $size[0];
                 $data['user_avatar_height'] = $size[1];
             }
         }
     }
     if (empty($data['user_avatar']) || substr($data['user_avatar'], -9, 5) == "blank") {
         $data['user_avatar'] = format_avatar("http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png", 120, 120);
         $data['user_avatar_filename'] = format_avatar("http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png", 120, 120);
     }
     // Backwards compatibility
     if ($data['timezone']) {
         $timezone = new DateTime(null, new DateTimeZone($data['timezone']));
         $data['user_timezone'] = str_pad($timezone->getOffset() / 60 / 60, 5, ".00");
     }
     // Check for theme existance
     if (class_exists("\\smarty_railpage")) {
         $smarty = new \smarty_railpage();
         if (!$smarty->theme_exists($data['theme']) || $data['theme'] == "MGHTheme" || $data['theme'] == "") {
             $data['theme'] = $this->default_theme;
         }
     }
     // Nice time
     $data['user_lastvisit_nice'] = date($data['user_dateformat'], $data['user_lastvisit']);
     /**
      * Start setting the class vars
      */
     $this->getGroups();
     if (!$cached) {
         $this->setCache($this->mckey, $data, strtotime("+6 hours"));
     }
     $this->provider = isset($data['provider']) ? $data['provider'] : "railpage";
     $this->preferences = json_decode($data['user_opts']);
     $this->guest = false;
     $this->ssl = $data['user_enablessl'];
     $this->username = $data['username'];
     $this->active = $data['user_active'];
     $this->regdate = $data['user_regdate'];
     $this->level = $data['user_level'];
     $this->posts = $data['user_posts'];
开发者ID:doctorjbeam,项目名称:railpagecore,代码行数:67,代码来源:User.php


示例9: recentthread_list_threads

function recentthread_list_threads($return = false)
{
    global $mybb, $db, $templates, $recentthreadtable, $recentthreads, $settings, $canviewrecentthreads, $cache, $theme;
    // First check permissions
    if (!recentthread_can_view()) {
        return;
    }
    require_once MYBB_ROOT . "inc/functions_search.php";
    $threadlimit = (int) $mybb->settings['recentthread_threadcount'];
    if (!$threadlimit) {
        $threadlimit = 15;
    }
    $onlyusfids = array();
    // Check group permissions if we can't view threads not started by us
    $group_permissions = forum_permissions();
    foreach ($group_permissions as $fid => $forum_permissions) {
        if ($forum_permissions['canonlyviewownthreads'] == 1) {
            $onlyusfids[] = $fid;
        }
    }
    if (!empty($onlyusfids)) {
        $where .= "AND ((t.fid IN(" . implode(',', $onlyusfids) . ") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(" . implode(',', $onlyusfids) . "))";
    }
    $approved = 0;
    // Moderators can view unapproved threads
    if ($mybb->usergroup['canmodcp'] == 1) {
        $approved = -1;
    }
    $unsearchableforums = get_unsearchable_forums();
    $unviewableforums = get_unviewable_forums();
    if ($unsearchableforums && $unviewableforums) {
        $forumarray = explode(",", $unsearchableforums . "," . $unviewableforums);
        $newarray = array_unique($forumarray);
        $unsearchableforumssql = " AND t.fid NOT IN(" . implode(",", $newarray) . ") ";
    }
    // Take into account any ignored forums
    if ($mybb->settings['recentthread_forumskip']) {
        $ignoreforums = " AND t.fid NOT IN(" . $mybb->settings['recentthread_forumskip'] . ") ";
    }
    $forums = $cache->read("forums");
    $query = $db->query("\n\t\t\tSELECT t.*, u.username AS userusername, u.usergroup, u.displaygroup, u.avatar as threadavatar, u.avatardimensions as threaddimensions, lp.usergroup AS lastusergroup, lp.avatar as lastavatar, lp.avatardimensions as lastdimensions, lp.displaygroup as lastdisplaygroup\n\t\t\tFROM " . TABLE_PREFIX . "threads t\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=t.uid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users lp ON (t.lastposteruid=lp.uid)\n\t\t\tWHERE 1=1 {$where} AND t.visible > {$approved} {$unsearchableforumssql} {$ignoreforums}\n\t\t\tORDER BY t.lastpost DESC\n\t\t\tLIMIT {$threadlimit}\n\t\t");
    while ($thread = $db->fetch_array($query)) {
        $trow = alt_trow();
        $thread['forum'] = $forums[$thread['fid']]['name'];
        $threadlink = get_thread_link($thread['tid'], "", "newpost");
        $lastpostlink = get_thread_link($thread['tid'], "", "lastpost");
        $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
        $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
        $lastposttimeago = my_date("relative", $thread['lastpost']);
        $lastposter = $thread['lastposter'];
        $lastposteruid = $thread['lastposteruid'];
        $thread['author'] = build_profile_link(format_name($thread['userusername'], $thread['usergroup'], $thread['displaygroup']), $thread['uid']);
        // Don't link to guest's profiles (they have no profile).
        if ($lastposteruid == 0) {
            $lastposterlink = $lastposter;
        } else {
            $lastposterlink = build_profile_link(format_name($lastposter, $thread['lastusergroup'], $thread['lastdisplaygroup']), $lastposteruid);
        }
        if ($mybb->settings['recentthread_threadavatar']) {
            $threadavatar = format_avatar($thread['threadavatar'], $thread['threaddimensions']);
            $avatarurl = $threadavatar['image'];
            $dimensions = $threadavatar['width_height'];
            eval("\$posteravatar = \"" . $templates->get("recentthread_avatar") . "\";");
        }
        if ($mybb->settings['recentthread_lastavatar']) {
            $lastposteravatar = format_avatar($thread['lastavatar'], $thread['lastdimensions']);
            $avatarurl = $lastposteravatar['image'];
            $dimensions = $lastposteravatar['width_height'];
            eval("\$lastavatar = \"" . $templates->get("recentthread_avatar") . "\";");
        }
        // Now check the length of subjects
        $length = (int) $mybb->settings['recentthread_subject_length'];
        if (strlen($thread['subject']) > $length && $length != 0) {
            // Figure out if we need to split it up.
            $title = my_substr($thread['subject'], 0, $length);
            if ($mybb->settings['recentthread_subject_breaker']) {
                $words = explode(" ", $title);
                $count = count($words) - 1;
                $currenttitle = "";
                for ($x = 0; $x < $count; $x++) {
                    $currenttitle .= $words[$x] . " ";
                }
                $thread['subject'] = $currenttitle . " ...";
            }
            if (!$mybb->settings['recentthread_subject_breaker']) {
                $thread['subject'] = $title . "...";
            }
        }
        // Moderator stuff baby!
        if (is_moderator($thread['fid'])) {
            $ismod = TRUE;
            // fetch the inline mod column
        } else {
            $ismod = FALSE;
        }
        if (is_moderator($thread['fid'], "caneditposts") || $fpermissions['caneditposts'] == 1) {
            $can_edit_titles = 1;
        } else {
            $can_edit_titles = 0;
        }
//.........这里部分代码省略.........
开发者ID:ambsalinas,项目名称:anima,代码行数:101,代码来源:recentthread.php


示例10: getContents

 /**
  * List the contents of this folder
  * @since Version 3.3
  * @version 3.3
  * @return array
  * @param object $User
  * @param int $page
  * @param int $items_per_page
  */
 public function getContents($User = false, $page = 1, $items_per_page = 25)
 {
     if (empty($this->folder)) {
         throw new \Exception("Cannot get folder contents - no folder specified");
     }
     if (!$User || !is_object($User)) {
         throw new \Exception("Cannot get folder contents - User object not provided");
     }
     if (!$User->id) {
         throw new \Exception("No user ID available");
     }
     if (!$User->enable_privmsg) {
         throw new \Exception("Private messages not available to this user");
     }
     // Store the user object
     $this->user = $User;
     // Fetch message IDs that have been "deleted" by this user
     $deleted = $this->getDeleted($User->id);
     if (count($deleted)) {
         $exclude_sql = " AND privmsgs_id NOT IN ('" . implode("', '", $deleted) . "') ";
     } else {
         $exclude_sql = "";
     }
     if ($this->folder == PM_INBOX) {
         $pm_folder_sql = "pm.privmsgs_to_userid = " . $this->user->id . " AND (pm.privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
     } elseif ($this->folder == PM_OUTBOX) {
         $pm_folder_sql = "pm.privmsgs_from_userid = " . $this->user->id . " AND (pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . ")";
     } elseif ($this->folder == PM_SENTBOX) {
         $pm_folder_sql = "pm.privmsgs_from_userid = " . $this->user->id . " AND (pm.privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_SENT_MAIL . ")";
     } elseif ($this->folder == PM_SAVEBOX) {
         $pm_folder_sql = "((pm.privmsgs_to_userid = " . $this->user->id . " AND pm.privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . ") OR (pm.privmsgs_from_userid = " . $this->user->id . " AND pm.privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . "))";
     }
     // Which "page" is this?
     if ($page == 1) {
         $start = 0;
     } else {
         $start = $page * $items_per_page;
     }
     // Done checking - get the PMs - sort by date ASC because the uasort() function will fix them up properly
     $query = "SELECT pm.*, pmt.*, ufrom.username AS username_from, ufrom.user_id AS user_id_from, ufrom.user_avatar AS user_avatar_from, uto.username AS username_to, uto.user_id AS user_id_from, uto.user_avatar AS user_avatar_to\r\n\t\t\t\t\t\tFROM nuke_bbprivmsgs AS pm\r\n\t\t\t\t\t\tLEFT JOIN nuke_bbprivmsgs_text AS pmt ON pm.privmsgs_id = pmt.privmsgs_text_id\r\n\t\t\t\t\t\tLEFT JOIN nuke_users AS ufrom ON ufrom.user_id = privmsgs_from_userid\r\n\t\t\t\t\t\tLEFT JOIN nuke_users AS uto ON uto.user_id = privmsgs_to_userid\r\n\t\t\t\t\t\tWHERE " . $pm_folder_sql . "\r\n\t\t\t\t\t\t" . $exclude_sql . "\r\n\t\t\t\t\t\tORDER BY pm.privmsgs_date ASC";
     #LIMIT ".$start.", ".$this->db->real_escape_string($items_per_page);
     #echo $query;
     if ($this->db instanceof \sql_db) {
         if ($rs = $this->db->query($query)) {
             #$total = $this->db->query("SELECT FOUND_ROWS() AS total");
             #$total = $total->fetch_assoc();
             $return = array();
             $return['stat'] = "ok";
             #$return['total'] = $total['total'];
             $return['page'] = $page;
             $return['perpage'] = $items_per_page;
             $return['messages'] = array();
             while ($row = $rs->fetch_assoc()) {
                 // Fix up the sodding non-UTF8 characters
                 $row['privmsgs_text'] = convert_to_utf8($row['privmsgs_text']);
                 $row['privmsgs_subject'] = str_replace("Re: ", "", $row['privmsgs_subject']);
                 if ($row['privmsgs_from_userid'] == $this->user->id) {
                     $pm_from = $row['privmsgs_to_userid'];
                 } else {
                     $pm_from = $row['privmsgs_from_userid'];
                 }
                 $id = md5($row['privmsgs_subject'] . $pm_from);
                 if (function_exists("format_avatar")) {
                     $row['user_avatar_from'] = format_avatar($row['user_avatar_from'], 40, 40);
                     $row['user_avatar_to'] = format_avatar($row['user_avatar_to'], 40, 40);
                 }
                 $return['messages'][$id] = $row;
             }
             // Sort by loco number
             uasort($return['messages'], function ($a, $b) {
                 return strnatcmp($b['privmsgs_date'], $a['privmsgs_date']);
             });
         } else {
             throw new \Exception($this->db->error);
             $return['stat'] = "error";
             $return['error'] = $this->db->error;
         }
         $return['total'] = count($return['messages']);
         $return['messages'] = array_slice($return['messages'], $start, $items_per_page);
         return $return;
     } else {
         $return = array();
         $return['stat'] = "ok";
         $return['page'] = $page;
         $return['perpage'] = $items_per_page;
         $return['messages'] = array();
         foreach ($this->db->fetchAll($query) as $row) {
             $row['privmsgs_text'] = convert_to_utf8($row['privmsgs_text']);
             $row['privmsgs_subject'] = str_replace("Re: ", "", $row['privmsgs_subject']);
             if ($row['privmsgs_from_userid'] == $this->user->id) {
                 $pm_from = $row['privmsgs_to_userid'];
//.........这里部分代码省略.........
开发者ID:doctorjbeam,项目名称:railpagecore,代码行数:101,代码来源:Folder.php


示例11: postParser

     require_once MYBB_ROOT . "inc/class_parser.php";
     $parser = new postParser();
     $pm = '';
     $query = $db->query("\n\t\tSELECT pm.*,u.*, u.username AS fromusername, u.avatar, u.avatardimensions\n\t\tFROM " . TABLE_PREFIX . "privatemessages pm\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=pm.fromid)\n\t\tWHERE pm.folder='1' AND pm.uid='" . $mybb->user['uid'] . "'\n\t\tORDER BY pm.dateline DESC\n\t\tLIMIT 5\n\t");
     if ($db->num_rows($query) > 0) {
         while ($pm = $db->fetch_array($query)) {
             $pmsubject = htmlspecialchars_uni($parser->parse_badwords($pm['subject']));
             $pmsubjectshort = substr($pmsubject, 0, 20) . "...";
             $fromusername = $pm['fromusername'];
             $fromuid = $pm['fromid'];
             $fromuser = build_profile_link($fromusername, $fromuid);
             $pmid = $pm['pmid'];
             $sendpmdate = my_date($mybb->settings['dateformat'], $pm['dateline']);
             $sendpmtime = my_date($mybb->settings['timeformat'], $pm['dateline']);
             $senddate = $sendpmdate . ", " . $sendpmtime;
             $formated_avatar = format_avatar($pm['avatar'], $pm['avatardimensions']);
             $useravatar = "<img src=\"{$formated_avatar['image']}\" valign=\"middle\" />";
             if (!empty($pm['avatar'])) {
                 $avatar = $pm['avatar'];
             } else {
                 $avatar = $mybb->settings['useravatar'];
             }
             //$useravatar = format_avatar($avatar, $pm['avatardimensions']);
             eval("\$listbit .= \"" . $templates->get("inbox_listbit") . "\";");
         }
     } else {
         eval("\$listbit .= \"" . $templates->get("inbox_nomessages") . "\";");
     }
 } else {
     //PM system disabled message
     eval("\$listbit .= \"" . $templates->get("inbox_error_pm_disabled") . "\";");
开发者ID:sunnybutani,项目名称:webc,代码行数:31,代码来源:inbox_list.php


示例12: mylikes_popup

function mylikes_popup()
{
    global $db, $mybb, $lang, $groupscache, $templates;
    if ($mybb->input['action'] == "likes_recount") {
        // Rebuild the cache for this post - the reputation/like counter may have changed
        if (!empty($mybb->input['pid'])) {
            JB_MyLikes_Like::cache($mybb->input['pid']);
        }
        exit;
    }
    if ($mybb->input['action'] != "likes") {
        return;
    }
    if (empty($mybb->input['pid']) || empty($mybb->input['uid'])) {
        error_no_permission();
    }
    $lang->load("mylikes");
    $pid = $mybb->get_input("pid");
    $uid = $mybb->get_input("uid");
    $query = $db->simple_select("reputation", "*", "uid={$uid} AND pid={$pid}");
    $users = "";
    while ($like = $db->fetch_array($query)) {
        $user = get_user($like['adduid']);
        $name = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
        $profile_link = build_profile_link($name, $user['uid'], '_blank', 'if(window.opener) { window.opener.location = this.href; return false; }');
        $send_pm = '';
        if ($mybb->user['receivepms'] != 0 && $user['receivepms'] != 0 && $groupscache[$user['usergroup']]['canusepms'] != 0) {
            eval("\$send_pm = \"" . $templates->get("misc_buddypopup_user_sendpm") . "\";");
        }
        if ($user['lastactive']) {
            $last_active = $lang->sprintf($lang->last_active, my_date('relative', $user['lastactive']));
        } else {
            $last_active = $lang->sprintf($lang->last_active, $lang->never);
        }
        $user['avatar'] = format_avatar(htmlspecialchars_uni($user['avatar']), $user['avatardimensions'], '44x44');
        $online_alt = alt_trow();
        $users .= eval($templates->render("misc_mylikes_like"));
    }
    if (empty($users)) {
        $users = eval($templates->render("misc_mylikes_nolikes"));
    }
    echo eval($templates->render("misc_mylikes", 1, 0));
    exit;
}
开发者ID:JN-Jones,项目名称:MyLikes,代码行数:44,代码来源:mylikes.php


示例13: avatarep_format_avatar

function avatarep_format_avatar($user)
{
    global $mybb, $avatar;
    $size = 2048;
    $dimensions = "30px";
    $avatar = format_avatar($user['avatar'], $dimensions, $size);
    $avatar = htmlspecialchars_uni($avatar['image']);
    if (THIS_SCRIPT == "showthread.php") {
        if ($user['avatartype'] == "upload") {
            $avatar = $mybb->settings['bburl'] . "/" . $user['avatar'];
        } else {
            if ($user['avatartype'] == "gallery") {
                //UPDATE `miforo_users` set avatar = REPLACE(avatar, './uploads/', 'uploads/');
                $avatar = $mybb->settings['bburl'] . "/" . $user['avatar'];
            } else {
                if ($user['avatartype'] == "remote") {
                    $avatar = $user['avatar'];
                } else {
                    if ($user['avatartype'] == "" && $user['avatar']) {
                        $avatar = $mybb->settings['bburl'] . "/images/default_avatar.png";
                    }
                }
            }
        }
    }
    $avatar = $user['avatar'] ? htmlspecialchars_uni($user['avatar']) : $mybb->settings['bburl'] . '/images/default_avatar.png';
    return array('avatar' => $avatar, 'avatarep' => "<img src='" . $avatar . "' class='avatarep_img' alt='{$user['userusername']}' />", 'username' => htmlspecialchars_uni($user['userusername']), 'profilelink' => get_profile_link($user['uid']), 'uid' => (int) $user['uid'], 'usergroup' => (int) $user['usergroup'], 'displaygroup' => (int) $user['displaygroup']);
    return format_avatar($user);
}
开发者ID:ambsalinas,项目名称:anima,代码行数:29,代码来源:avatarep.php


示例14: getArray

 /**
  * Get a standardised array of this data
  * @since Version 3.9.1
  * @return array
  */
 public function getArray()
 {
     $idea = array("id" => $this->id, "title" => $this->title, "description" => function_exists("format_post") ? format_post($this->description) : $this->description, "status" => Ideas::getStatusDescription($this->status), "url" => $this->url->getURLs(), "votes" => array("num" => $this->getVotes(), "text" => $this->getVotes() == 1 ? "1 vote" : sprintf("%d votes", $this->getVotes())), "date" => array("absolute" => $this->User instanceof User ? $this->Date->format($this->User->date_format) : $this->Date->format("F j, Y, g:i a"), "relative" => time2str($this->Date->getTimestamp())), "author" => array("id" => $this->Author->id, "username" => $this->Author->username, "url" => $this->Author->url, "avatar" => array("small" => function_exists("format_avatar") ? format_avatar($this->Author->avatar, 40) : $this->Author->avatar, "large" => function_exists("format_avatar") ? format_avatar($this->Author->avatar, 120) : $this->Author->avatar)), "category" => array("id" => $this->Category->id, "name" => $this->Category->name, "url" => $this->Category->url), "voters" => array());
     return $idea;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:10,代码来源:Idea.php


示例15: loadNotes


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP format_backtrace函数代码示例发布时间:2022-05-15
下一篇:
PHP format_article_note函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap