Jump to content
View in the app

A better way to browse. Learn more.

IPBMafia.ru - поддержка Invision Community, релизы, темы, плагины и приложения

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Вывод аватарки на сайт с Ibp 3.4.5

Featured Replies

Posted

Здравствуйте форумчане.

Столкнулся с такой проблемой, не могу вывести на сайт с форума аватарку профиля.

Подскажите что нужно дописать ???  Вот скрипт .

 

<?php 
 
class ForumThreads extends CWidget
{
    /**
     * @var CDbConnection
     */
    private $db;



    public function init()
    {
        $data = array(
            'content' => array(),
            'error'   => Yii::t('main', 'Модуль отключен.'),
        );


        if(config('forum_threads.allow') == 1)
        {
            $data = cache()->get(CacheNames::FORUM_THREADS);

            if($data === FALSE)
            {
                $data = array();

                try
                {
                    // Подключаюсь к БД
                    $this->db = Yii::createComponent(array(
                        'class' => 'CDbConnection',
                        'connectionString' => 'mysql:host=' . config('forum_threads.db_host') . ';port=' . config('forum_threads.db_port') . ';dbname=' . config('forum_threads.db_name'),
                        'enableProfiling' => YII_DEBUG,
                        'enableParamLogging' => TRUE,
                        'username' => config('forum_threads.db_user'),
                        'password' => config('forum_threads.db_pass'),
                        'charset' => 'utf8',
                        'emulatePrepare' => TRUE,
                        'tablePrefix' => config('forum_threads.prefix'),
                    ));

                    app()->setComponent('ForumThreadsDb', $this->db);

                    $forumType = config('forum_threads.type');

                    if(method_exists($this, $forumType))
                    {
                        $data['content'] = $this->$forumType();

                        foreach($data['content'] as $k => $v)
                        {
                            $data['content'][$k]['user_link']  = $this->getUserLink($v['starter_id'], $v['starter_name']);
                            $data['content'][$k]['theme_link'] = $this->getForumLink($v['id_topic'], $v['title'], $v['id_forum']);
                            $data['content'][$k]['start_date'] = $this->getStartDate($v['start_date']);
                        }

                        if(config('forum_threads.cache'))
                        {
                            cache()->set(CacheNames::FORUM_THREADS, $data, config('forum_threads.cache') * 60);
                        }
                    }
                    else
                    {
                        $data['error'] = Yii::t('main', 'Метод для обработки форума: :type не найден.', array(':type' => '<b>' . $forumType . '</b>'));
                    }
                }
                catch(Exception $e)
                {
                    $data['error'] = $e->getMessage();
                }
            }
        }

        app()->controller->renderPartial('//forum-threads', $data);
    }

    /**
     * Ссылка на форум
     *
     * @param int $id_topic
     * @param string $title
     * @param int $id_forum
     *
     * @return string
     */
    private function getForumLink($id_topic, $title, $id_forum)
    {
        $link = rtrim(config('forum_threads.link'), '/') . '/';

        switch(config('forum_threads.type'))
        {
            case 'ipb':
                $link .= 'index.php?/topic/' . $id_topic . '-' . $title . '/';
                break;

        }

        return $link;
    }

	
    /**
     * Ссылка на автора темы
     *
     * @param int $user_id
     * @param string $user_name
     *
     * @return string
     */
    private function getUserLink($user_id, $user_name)
    {
        $link = rtrim(config('forum_threads.link'), '/') . '/';

        switch(config('forum_threads.type'))
        {
            case 'ipb':
                $link .= 'index.php?/user/' . $user_id . '-' . $user_name . '/';
                break;
        }

        return $link;
    }

    /**
     * Форматирует дату
     *
     * @param int|string $time
     *
     * @return string
     */
    private function getStartDate($time)
    {
        if(!is_numeric($time))
        {
            $time = strtotime($time);
        }

        return date(config('forum_threads.date_format'), $time);
    }


    /**
     * Запросы к форуму Ipb
     *
     * @return array
     */
    private function ipb()
    {
        $limit = (int) config('forum_threads.limit');

        $command = $this->db->createCommand()
            ->select('tid AS id_topic,start_date,starter_name,starter_id,forum_id AS id_forum,title')
            ->where('tdelete_time = 0 AND approved = 1')
            ->from('{{topics}}')
            ->order('start_date DESC')
            ->limit($limit);

        if(config('forum_threads.id_deny') != '')
        {
            $ids = explode(',', config('forum_threads.id_deny'));
            $ids = $this->filterIds($ids);

            $command->where(array('not in', 'forum_id', $ids));
        }

        return $command->queryAll();
    }

}
 

 

Guest
This topic is now closed to further replies.

Последние посетители 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.