Перейти к содержанию

promo

Новичок
  • Постов

    1
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные promo

  1. Добрый день, столкнулся с такими ошибками 

     

     .--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
     | File                                                                       | Function                                                                      | Line No.          |
     |----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
     | applications/forums/modules_public/forums/topics.php                | [public_forums_forums_topics].returnLastPost                                  | 1065              |
     '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
     | applications/forums/modules_public/forums/topics.php                | [public_forums_forums_topics]._doViewCheck                                    | 188               |
     '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
     | sources/base/ipsController.php                                      | [public_forums_forums_topics].doExecute                                       | 302               |
     '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
     ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Date: Sat, 20 Dec 2014 00:29:26 +0000
     Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC LIMIT 0,1' at line 1
     
    по порядку.. .
     строка 1065 = $this->returnLastPost();
    функция 

    public function returnLastPost( $topicData=false )


    {
    /* Init */
    $topicData = ( $topicData === false ) ? $this->registry->getClass('topics')->getTopicData() : $topicData;
    $forumData = $this->forumClass->getForumById( $topicData['forum_id'] );
    $permissionData = $this->registry->getClass('topics')->getPermissionData();
    $st = 0;
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');
    $_posts = $topicData['posts'];

    if( $this->registry->class_forums->canQueuePosts( $topicData['forum_id'] ) )
    {
    $_posts += intval($topicData['topic_queuedposts']);
    }

    if( $permissionData['softDeleteSee'] )
    {
    $_posts += intval($topicData['topic_deleted_posts']);
    }

    /* Can we deal with hidden posts? */
    if ( $this->registry->class_forums->canQueuePosts( $topicData['forum_id'] ) )
    {
    if ( $permissionData['softDeleteSee'] )
    {
    /* See queued and soft deleted */
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ) );
    }
    else
    {
    /* Otherwise, see queued and approved */
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ) );
    }
    }
    else
    {
    /* We cannot see hidden posts */
    if ( $permissionData['softDeleteSee'] )
    {
    /* See queued and soft deleted */
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted') );
    }
    }

    if( $_posts )
    {
    if ( (($_posts + 1) % $this->settings['display_max_posts']) == 0 )
    {
    $pages = ($_posts + 1) / $this->settings['display_max_posts'];
    }
    else
    {
    $number = ( ($_posts + 1) / $this->settings['display_max_posts'] );
    $pages = ceil( $number );
    }

    $st = ($pages - 1) * $this->settings['display_max_posts'];

    if( $this->settings['post_order_sort'] == 'desc' )
    {
    $st = (ceil(($_posts/$this->settings['display_max_posts'])) - $pages) * $this->settings['display_max_posts'];
    }
    }

    $this->DB->build( array( 'select' => 'pid',
    'from' => 'posts',
    'where' => "topic_id=".$topicData['tid'] . $query,
    'ORDER' => $this->settings['post_order_column'].' DESC',
    'limit' => array( 0,1 ) ) );

    $this->DB->execute();

    $post = $this->DB->fetch();

    $this->registry->output->silentRedirect($this->settings['base_url']."showtopic=".$topicData['tid']."&pid={$post['pid']}&st={$st}&"."#entry".$post['pid'], $topicData['title_seo'] );
    }

     
    строка 188 = /* Specific view? */ $this->_doViewCheck();
    функция

    protected function _doViewCheck()


    {
    /* Init */
    $topicData = $this->registry->getClass('topics')->getTopicData();
    $forumData = $this->forumClass->getForumById( $topicData['forum_id'] );
    $permissionData = $this->registry->getClass('topics')->getPermissionData();

    if ( $this->request['view'] )
    {
    /* Determine what we can see */
    $_approved = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'visible' ), '' );

    /* Can we deal with hidden posts? */
    if ( $this->registry->class_forums->canQueuePosts( $topicData['forum_id'] ) )
    {
    if ( $permissionData['TopicSoftDeleteSee'] )
    {
    /* See queued and soft deleted */
    $_approved = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ), '' );
    }
    else
    {
    /* Otherwise, see queued and approved */
    $_approved = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'visible', 'hidden' ), '' );
    }
    }
    else
    {
    /* We cannot see hidden posts */
    if ( $permissionData['TopicSoftDeleteSee'] )
    {
    /* See queued and soft deleted */
    $_approved = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'approved', 'sdeleted' ), '' );
    }
    }

    if ( $this->request['view'] == 'getnextunread' )
    {
    $tid = $this->registry->getClass('topics')->getNextUnreadTopicId();

    if ( $tid )
    {
    $topic = $this->registry->getClass('topics')->getTopicById( $tid );

    $this->returnNewPost( $topic );
    }
    else
    {
    $this->registry->output->showError( 'topics_none_newer', 10356, null, null, 404 );
    }
    }
    else if ($this->request['view'] == 'new')
    {
    //-----------------------------------------
    // Newer
    //-----------------------------------------

    $this->DB->build( array(
    'select' => 'tid, title_seo',
    'from' => 'topics',
    'where' => "forum_id={$forumData['id']} AND {$_approved} AND state <> 'link' AND last_post > {$topicData['last_post']}",
    'ORDER' => 'last_post',
    'LIMIT' => array( 0,1 )
    ) );
    $this->DB->execute();

    if ( $this->DB->getTotalRows() )
    {
    $this->topic = $this->DB->fetch();

    $this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid'], $topicData['title_seo'] );
    }
    else
    {
    $this->registry->output->showError( 'topics_none_newer', 10356, null, null, 404 );
    }
    }
    else if ($this->request['view'] == 'old')
    {
    //-----------------------------------------
    // Older
    //-----------------------------------------

    $this->DB->build( array(
    'select' => 'tid, title_seo',
    'from' => 'topics',
    'where' => "forum_id={$forumData['id']} AND {$_approved} AND state <> 'link' AND last_post < {$topicData['last_post']}",
    'order' => 'last_post DESC',
    'limit' => array( 0,1 )
    ) );

    $this->DB->execute();

    if ( $this->DB->getTotalRows() )
    {
    $this->topic = $this->DB->fetch();

    $this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid'], $topicData['title_seo'] );
    }
    else
    {
    $this->registry->output->showError( 'topics_none_older', 10357, null, null, 404 );
    }
    }
    else if ($this->request['view'] == 'getlastpost')
    {
    //-----------------------------------------
    // Last post
    //-----------------------------------------

    $this->returnLastPost();
    }
    else if ($this->request['view'] == 'getnewpost')
    {
    $this->returnNewPost();
    }
    else if ($this->request['view'] == 'findpost')
    {
    //-----------------------------------------
    // Find a post
    //-----------------------------------------

    $pid = intval($this->request['p']);
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');

    /* Can we deal with hidden posts? */
    if ( $this->registry->class_forums->canQueuePosts( $topicData['forum_id'] ) )
    {
    if ( $permissionData['softDeleteSee'] )
    {
    /* See queued and soft deleted */
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ) );
    }
    else
    {
    /* Otherwise, see queued and approved */
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ) );
    }
    }
    else
    {
    /* We cannot see hidden posts */
    if ( $permissionData['softDeleteSee'] )
    {
    /* See queued and soft deleted */
    $query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted') );
    }
    }

    if ( $pid > 0 )
    {
    $sort_value = $pid;
    $sort_field = ($this->settings['post_order_column'] == 'pid') ? 'pid' : 'post_date';

    if($sort_field == 'post_date')
    {
    $date = $this->DB->buildAndFetch( array( 'select' => 'post_date', 'from' => 'posts', 'where' => 'pid=' . $pid ) );

    $sort_value = $date['post_date'];
    }

    $this->DB->build( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$topicData['tid']} AND {$sort_field} <=" . intval( $sort_value ) . $query ) );
    $this->DB->execute();

    $cposts = $this->DB->fetch();

    if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
    {
    $pages = ($cposts['posts']) / $this->settings['display_max_posts'];
    }
    else
    {
    $number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
    $pages = ceil($number);
    }

    $st = ($pages - 1) * $this->settings['display_max_posts'];

    if( $this->settings['post_order_sort'] == 'desc' )
    {
    $st = (ceil(($topicData['posts']/$this->settings['display_max_posts'])) - $pages) * $this->settings['display_max_posts'];
    }

    $search_hl = '';
    if( !empty( $this->request['hl'] ) )
    {
    $search_hl .= "&hl={$this->request['hl']}";
    }

    if( !empty( $this->request['fromsearch'] ) )
    {
    $search_hl .= "&fromsearch={$this->request['fromsearch']}";
    }

    $this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid']."&st={$st}&p={$pid}{$search_hl}"."&#entry".$pid, $topicData['title_seo'] );
    }
    else
    {
    $this->returnLastPost();
    }
    }
    }
    }

     
    строка 302 = $this->doExecute( $registry );
    функция 

    protected function doExecute( ipsRegistry $registry )


    {
    $modules_dir = ( IPS_AREA != 'admin' ) ? 'modules_public' : 'modules_admin';
    $filepath = IPSLib::getAppDir( IPS_APP_COMPONENT ) . '/' . $modules_dir . '/' . ipsRegistry::$current_module . '/' . ipsRegistry::$current_section . '.php';
    $filepath = str_replace( DOC_IPS_ROOT_PATH, '', $filepath );

    //-----------------------------------------
    // Redirect to board index
    //-----------------------------------------

    if ( ! (IPS_APP_COMPONENT == 'forums' AND ipsRegistry::$current_module == 'forums' AND ipsRegistry::$current_section == 'boards') )
    {
    if( IPB_THIS_SCRIPT == 'admin' )
    {
    $registry->output->silentRedirect( ipsRegistry::$settings['_base_url'] );
    }
    else
    {
    $registry->output->silentRedirect( ipsRegistry::$settings['_original_base_url'] );
    }
    }

    //-----------------------------------------
    // Uh oh, this is a big one.. (no forums app)
    //-----------------------------------------

    if ( ! is_file( $filepath ) )
    {
    $this->registry->getClass('output')->showError( array( 'command_file_missing', $filepath ), 401100, null, null, 404 );
    }
    else
    {
    $this->registry->getClass('output')->showError( array( 'command_class_incorrect', $filepath ), 401200, null, null, 404 );
    }
    }

     
    помогите решить проблему...
    при переходе по такого ввида ссылке htp://сайт.ru/index.php?/topic/1-топик/page__view__getlastpost
    получаю всем знакомый экран
    a9f68348fa.png
×
×
  • Создать...