Цвета и градиенты ников

10.47K
.
Beibarys, Старый файл с функциями сохранил? Востанови его
-----
Поддержку модуля надо закрывать, так как модуль древний
.
elkol, дай мне пожалуйста самую последнюю версию для джон 4.4 c инсталл все в одном архиве
.
Beibarys, http://johncms.com/forum/index ... 29413
Вот, вроде
.
# elkol (08.08.2013 / 20:46)
Beibarys, http://johncms.com/forum/index ... 06901
Вот, вроде
этот не работает
.
Beibarys, Всё должно работать
.
# elkol (08.08.2013 / 20:48)
Beibarys, Всё должно работать
щас, снова все восстановлю
.
свой восстановил, сразу ошибки пропали, из за чего это??
я в functions.php добавил тока это
-----------------------------------------------------------------
    Градиенты
    -----------------------------------------------------------------
    */
function gradient($text,$from='',$to='', $mode="hex")
{
    if($mode=="hex")
    {
        $to  = hexdec($to[0].$to[1]).",".hexdec($to[2].$to[3]).",".hexdec($to[4].$to[5]);
        $from= hexdec($from[0].$from[1]).",".hexdec($from[2].$from[3]).",".hexdec($from[4].$from[5]);
    }

    if( empty($text) )
        return '';
    else
        $levels=strlen($text);

    if (empty($from))
                $from = array(0,0,255);
    else
                $from = explode(",", $from);

    if (empty($to))

                $to = array(255,0,0);
    else
                $to = explode(",", $to);

        $output = "";

        for ($i=1;$i<=$levels;$i++)
        {
                for ($ii=0;$ii<3;$ii++)
                {
                        $tmp[$ii] = $from[$ii] - $to[$ii];
                        $tmp[$ii] = floor($tmp[$ii] / $levels);
                        $rgb[$ii] = $from[$ii] - ($tmp[$ii] * $i);

                        if ($rgb[$ii] > 255) $rgb[$ii] = 255;

                        $rgb[$ii] = dechex($rgb[$ii]);
                        $rgb[$ii] = strtoupper($rgb[$ii]);

                        if (strlen($rgb[$ii]) < 2) $rgb[$ii] = "0$rgb[$ii]";
                }
           $output .= ''.$rgb[0].$rgb[1].$rgb[2].'' == '000000' ? '' . mb_substr($text, ($i-1), 1) . '' : "<font color=\"#".$rgb[0].$rgb[1].$rgb[2]."\">" . mb_substr($text, ($i-1), 1) ."</font>";
        }
        return $output;
}

    /*
    -----------------------------------------------------------------
    Отображения личных данных пользователя
    -----------------------------------------------------------------
    $user          (array)     массив запроса в таблицу `users`
    $arg           (array)     Массив параметров отображения
       [lastvisit] (boolean)   Дата и время последнего визита
       [stshide]   (boolean)   Скрыть статус (если есть)
       [iphide]    (boolean)   Скрыть (не показывать) IP и UserAgent
       [iphist]    (boolean)   Показывать ссылку на историю IP

       [header]    (string)    Текст в строке после Ника пользователя
       [body]      (string)    Основной текст, под ником пользователя
       [sub]       (string)    Строка выводится вверху области "sub"
       [footer]    (string)    Строка выводится внизу области "sub"
    -----------------------------------------------------------------
    */
    public static function display_user($user = false, $arg = false)
    {
        global $rootpath, $mod;
        $out = false;
$colornick = mysql_fetch_assoc(mysql_query("select `colornick`,`colornick2` from `users` where `id`='".$user['id']."';"));
$colornickk = mysql_fetch_assoc(mysql_query("select `colornick`,`colornick2` from `users` where `id`='".$user['id']."';"));
        if (!$user['id']) {
            $out = '<b>' . self::$lng['guest'] . '</b>';
            if (!empty($user['name']))
                $out .= ': ' . $user['name'];
            if (!empty($arg['header']))
                $out .= ' ' . $arg['header'];
        } else {
            if (self::$user_set['avatar']) {
                $out .= '<table cellpadding="0" cellspacing="0"><tr><td>';
                if (file_exists(($rootpath . 'files/users/avatar/' . $user['id'] . '.png')))
                    $out .= '<img src="' . self::$system_set['homeurl'] . '/files/users/avatar/' . $user['id'] . '.png" width="32" height="32" alt="" />&#160;';
                else
                    $out .= '<img src="' . self::$system_set['homeurl'] . '/images/empty.png" width="32" height="32" alt="" />&#160;';
                $out .= '</td><td>';
            }
            if ($user['sex'])
                $out .= '<img src="' . self::$system_set['homeurl'] . '/theme/' . self::$user_set['skin'] . '/images/' . ($user['sex'] == 'm' ? 'm' : 'w') . ($user['datereg'] > time() - 86400 ? '_new' : '')
                        . '.png" width="16" height="16" align="middle" alt="' . ($user['sex'] == 'm' ? 'М' : 'Ж') . '" />&#160;';
            else
                $out .= '<img src="' . self::$system_set['homeurl'] . '/images/del.png" width="12" height="12" align="middle" />&#160;';
            $out .= !self::$user_id || self::$user_id == $user['id'] ? '<b>'.functions::gradient('' . $user['name'] . '', '' . $colornick['colornick'] . '',''.$colornick['colornick2'].'').'</b>' : '<a href="' . self::$system_set['homeurl'] . '/users/profile.php?user=' . $user['id'] . '"><b>'.functions::gradient('' . $user['name'] . '', '' . $colornickk['colornick'] . '',''.$colornickk['colornick2'].'').'</b></a>';
            $rank = array(
                0 => '',
                1 => '(GMod)',
                2 => '(CMod)',
                3 => '(FMod)',
                4 => '(DMod)',
                5 => '(LMod)',
                6 => '(Smd)',
                7 => '(Adm)',
                9 => '(SV!)'
            );
            $out .= ' ' . $rank[$user['rights']];
            $out .= (time() > $user['lastdate'] + 300 ? '<span class="red"> [Off]</span>' : '<span class="green"> [ON]</span>');
            if (!empty($arg['header']))
                $out .= ' ' . $arg['header'];
            if (!isset($arg['stshide']) && !empty($user['status']))
                $out .= '<div class="status"><img src="' . self::$system_set['homeurl'] . '/theme/' . self::$user_set['skin'] . '/images/label.png" alt="" align="middle" />&#160;' . $user['status'] . '</div>';
            if (self::$user_set['avatar'])
                $out .= '</td></tr></table>';
        }
        if (isset($arg['body']))
            $out .= '<div>' . $arg['body'] . '</div>';
        $ipinf = !isset($arg['iphide']) && (self::$user_rights || ($user['id'] && $user['id'] == self::$user_id)) ? 1 : 0;
        $lastvisit = time() > $user['lastdate'] + 300 && isset($arg['lastvisit']) ? self::display_date($user['lastdate']) : false;
        if ($ipinf || $lastvisit || isset($arg['sub']) && !empty($arg['sub']) || isset($arg['footer'])) {
            $out .= '<div class="sub">';
            if (isset($arg['sub']))
                $out .= '<div>' . $arg['sub'] . '</div>';
            if ($lastvisit)
                $out .= '<div><span class="gray">' . self::$lng['last_visit'] . ':</span> ' . $lastvisit . '</div>';
            $iphist = '';
            if ($ipinf) {
                $out .= '<div><span class="gray">' . self::$lng['browser'] . ':</span> ' . $user['browser'] . '</div>' .
                        '<div><span class="gray">' . self::$lng['ip_address'] . ':</span> ';
                $hist = $mod == 'history' ? '&amp;mod=history' : '';
                $ip = long2ip($user['ip']);
                if (self::$user_rights && isset($user['ip_via_proxy']) && $user['ip_via_proxy']) {
                    $out .= '<b class="red"><a href="' . self::$system_set['homeurl'] . '/' . self::$system_set['admp'] . '/index.php?act=search_ip&amp;ip=' . $ip . $hist . '">' . $ip . '</a></b> / ';
                    $out .= '<a href="' . self::$system_set['homeurl'] . '/' . self::$system_set['admp'] . '/index.php?act=search_ip&amp;ip=' . long2ip($user['ip_via_proxy']) . $hist . '">' . long2ip($user['ip_via_proxy']) . '</a>';
                } elseif (self::$user_rights) {
                    $out .= '<a href="' . self::$system_set['homeurl'] . '/' . self::$system_set['admp'] . '/index.php?act=search_ip&amp;ip=' . $ip . $hist . '">' . $ip . '</a>';
                } else {
                    $out .= $ip . $iphist;
                }
                if (isset($arg['iphist'])) {
                    $iptotal = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_users_iphistory` WHERE `user_id` = '" . $user['id'] . "'"), 0);
                    $out .= '<div><span class="gray">' . self::$lng['ip_history'] . ':</span> <a href="' . self::$system_set['homeurl'] . '/users/profile.php?act=ip&amp;user=' . $user['id'] . '">[' . $iptotal . ']</a></div>';
                }
                $out .= '</div>';
            }
            if (isset($arg['footer']))
                $out .= $arg['footer'];
            $out .= '</div>';
        }
        return $out;
    }

    /*
.
Beibarys, Из-за последней функции
.
У меня не выходит! Уже 5-тый раз ставлю! Кто-нить может бесплатно на 4.4.0 поставить?
.
кидала
спс. все работает на 5.1.0
Всего: 630