0 Пользователей и 1 Гость просматривают эту тему.
  • 37 Ответов
  • 4026 Просмотров
*

nicalf

  • Захожу иногда
  • 58
  • 1 / 0
Я нашел это через Отладку системы:
JROOT/modules/mod_news_pro_gk4/gk_classes/gk.source.joomla.php:64
JROOT/modules/mod_news_pro_gk4/helper.php:291
JROOT/modules/mod_news_pro_gk4/mod_news_pro_gk4.php:29
JROOT/libraries/cms/module/helper.php:190
JROOT/modules/mod_maximenuck/helper.php:352
JROOT/modules/mod_maximenuck/helper.php:236
JROOT/modules/mod_maximenuck/mod_maximenuck.php:27
JROOT/libraries/cms/module/helper.php:190
JROOT/libraries/joomla/document/html/renderer/module.php:103
JROOT/templates/mountains/warp/systems/joomla/helpers/modules.php:86
JROOT/templates/mountains/warp/systems/joomla/layouts/modules.php:10
JROOT/templates/mountains/warp/helpers/template.php:49
JROOT/templates/mountains/warp/systems/joomla/helpers/modules.php:64
JROOT/templates/mountains/layouts/template.php:80
JROOT/templates/mountains/warp/helpers/template.php:49
JROOT/templates/mountains/index.php:19
JROOT/libraries/joomla/document/html/html.php:578
JROOT/libraries/joomla/document/html/html.php:635
JROOT/libraries/joomla/document/html/html.php:455
JROOT/libraries/cms/application/cms.php:1045
JROOT/libraries/cms/application/site.php:729
JROOT/libraries/cms/application/cms.php:258
JROOT/index.php:45
*

Arkadiy

  • Гуру
  • 5317
  • 463 / 2
  • Крепитесь, други.
Вы действительно нашли источник этого запроса и там действительно так написано?
*

nicalf

  • Захожу иногда
  • 58
  • 1 / 0
Вы действительно нашли источник этого запроса и там действительно так написано?

Если я все правильно понял, то да. Как вообще эта ошибка могла появиться, ума не приложу, вчера еще все нормально было


*

nicalf

  • Захожу иногда
  • 58
  • 1 / 0
Вы действительно нашли источник этого запроса и там действительно так написано?

Кажется, нашел

<?php
/**
* News class
* @package News Show Pro GK4
* @Copyright (C) 2009-2011 Gavick.com
* @ All rights reserved
* @ Joomla! is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: GK4 1.0 $
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
class NSP_GK4_Joomla_Source {   
   // Method to get sources of articles
   function getSources($config) {
      //
      $db = JFactory::getDBO();
      // if source type is section / sections
      $source = false;
      $where1 = '';
      $where2 = '';
      //
      if($config['data_source'] == 'com_categories'){
         $source = $config['com_categories'];
         $where1 = ' c.id = ';
         $where2 = ' OR c.id = ';
      } else {
         $source = strpos($config['com_articles'],',')!== false ? explode(',', $config['com_articles']) : $config['com_articles'];
         $where1 = ' content.id = ';
         $where2 = ' OR content.id = ';   
      }
      //   
      $where = ''; // initialize WHERE condition
      // generating WHERE condition
      for($i = 0;$i < count($source);$i++){
         if(count($source) == 1) $where .= (is_array($source))? $where1.$source[0] : $where1.$source;
         else $where .= ($i == 0)? $where1.$source[$i] : $where2.$source[$i];      
      }
      
      if($where != '') {
         $where = 'AND (' . $where . ')';
      }
      //
      $query_name = '
         SELECT DISTINCT
            c.id AS CID
         FROM
            #__categories AS c
         LEFT JOIN
            #__content AS content
            ON
            c.id = content.catid    
         WHERE
            1 = 1
            '.$where.'
            AND
            c.extension = '.$db->quote('com_content').'
            AND
            c.published = 1
            ';   
      // Executing SQL Query
      $db->setQuery($query_name);
      //
      return $db->loadObjectList();
   }
   // Method to get articles in standard mode
   function getArticles($categories, $config, $amount) {   
      //
      $sql_where = '';
      //
      if($categories) {      
         $j = 0;
         // getting categories ItemIDs
         foreach ($categories as $item) {
            $sql_where .= ($j != 0)? ' OR content.catid = '.$item->CID : ' content.catid = '.$item->CID;
            $j++;
         }   
      }
      // Overwrite SQL query when user set IDs manually
      if($config['data_source'] == 'com_articles' && $config['com_articles'] != ''){
         // initializing variables
         $sql_where = '';
         $ids = explode(',', $config['com_articles']);
         //
         for($i = 0; $i < count($ids); $i++ ){   
            // linking string with content IDs
            $sql_where .= ($i != 0)? ' OR content.id = '.$ids[$i] : ' content.id = '.$ids[$i];
         }
      }
      // Arrays for content
      $content_id = array();
      $content_iid = array();
      $content_cid = array();
      $content_title = array();
      $content_text = array();
      $content_date = array();
      $content_date_publish = array();
      $content_author = array();
      $content_catname = array();
      $content_hits = array();
      $content_email = array();
      $content_rating_sum = array();
      $content_rating_count = array();
      $content_images = array();
      $news_amount = 0;
      // Initializing standard Joomla classes and SQL necessary variables
      $db = JFactory::getDBO();
      $user = JFactory::getUser();
      $authorised = $user->getAuthorisedViewLevels();
      $access = JComponentHelper::getParams( 'com_content' )->get('show_noauth');
      if($config['unauthorized']) {
         $access_con = '';
      } else {
         $access_con = ' AND content.access IN ('. implode(',', $user->getAuthorisedViewLevels()).') ';
      }
      // check if the timezone offset is set
      if($config['time_offset'] == 0) {
         $date = JFactory::getDate();
      } else {
         $date = JFactory::getDate($config['time_offset'].' hour '.date('Y-m-d H:i:s', strtotime('now')));
      }
      $now  = $date->toSql(true);
      $nullDate = $db->getNullDate();
      // if some data are available
      if(count($categories) > 0){
         // when showing only frontpage articles is disabled
         if($config['only_frontpage'] == 0 && $config['news_frontpage'] == 0) {
             $frontpage_con = ' AND content.featured = 0 ';
         } else if($config['only_frontpage'] == 1) {
            $frontpage_con = ' AND content.featured = 1';
         }
         $since_con = '';
         if($config['news_since'] !== '') $since_con = ' AND content.created >= ' . $db->Quote($config['news_since']);
         // Ordering string
         $order_options = '';
         // When sort value is random
         if($config['news_sort_value'] == 'random') {
            $order_options = ' RAND() ';
         }else{ // when sort value is different than random
            if($config['news_sort_value'] != 'fordering') $order_options = ' content.'.$config['news_sort_value'].' '.$config['news_sort_order'].' ';
            else $order_options = ' frontpage.ordering '.$config['news_sort_order'].' ';
         }   
         // language filters
         $lang_filter = '';
         if (JFactory::getApplication()->getLanguageFilter()) {
            $lang_filter = ' AND content.language in ('.$db->quote(JFactory::getLanguage()->getTag()).','.$db->quote('*').') ';
         }
         
         if($config['data_source'] != 'com_all_articles') {
            $sql_where = ' AND ( ' . $sql_where . ' ) ';
         }         // creating SQL query
         $query_news = '
         SELECT
            content.id AS IID,
            '.($config['use_title_alias'] ? 'content.alias' : 'content.title').' AS title,
            content.introtext AS text,
            content.created AS date,
            content.publish_up AS date_publish,
            content.hits AS hits,
            content.images AS images   
         FROM
            #__content AS content
         WHERE
            content.state = 1
                    '. $access_con .'
                AND ( content.publish_up = '.$db->Quote($nullDate).' OR content.publish_up <= '.$db->Quote($now).' )
               AND ( content.publish_down = '.$db->Quote($nullDate).' OR content.publish_down >= '.$db->Quote($now).' )
            '.$sql_where.'
            '.$lang_filter.'
            '.$frontpage_con.'
            '.$since_con.'
         ORDER BY
            '.$order_options.'
         LIMIT
            '.($config['startposition']).','.($amount + (int)$config['startposition']).';
         ';
         // run SQL query
         $db->setQuery($query_news);
         // when exist some results
         if($news = $db->loadObjectList()) {
            // generating tables of news data
            foreach($news as $item) {                  
                $id = $item->ID;
               if (!($access || in_array($item->access, $authorised))) { $id = 0; }
               $content_iid[] = $item->IID; // news IDs
               $content_title[] = $item->title; // news titles
               $content_text[] = $item->text; // news text;
               $content_date[] = $item->date; // news dates
               $content_date_publish[] = $item->date_publish; // news dates
               $content_hits[] = $item->hits; // news hits
               $content_images[] = $item->images; // news images
                $news_amount++;   // news amount
            }
         }
         
         
         // generate SQL WHERE condition
         $second_sql_where = '';
         for($i = 0; $i < count($content_iid); $i++) {
            $second_sql_where .= (($i != 0)? ' OR ' : ''). ' content.id = '.$content_iid[$i];
         }
         
         if($second_sql_where != '') {
            $second_sql_where = ' AND (' . $second_sql_where . ')';
         }   
         // second SQL query to get rest of the data and avoid the DISTINCT
         $second_query_news = '
         SELECT
            categories.title AS cat,
            content.id AS ID,
            content.access AS access,
            categories.title AS cat,
            users.email AS author_email,
            '.$config['username'].' AS author,
            content_rating.rating_sum AS rating_sum,
            content_rating.rating_count AS rating_count,
            categories.id AS CID   
         FROM
            #__content AS content
            LEFT JOIN
               #__categories AS categories
               ON categories.id = content.catid
            LEFT JOIN
               #__content_frontpage AS frontpage
               ON content.id = frontpage.content_id     
            LEFT JOIN
               #__users AS users
               ON users.id = content.created_by          
            LEFT JOIN
               #__content_rating AS content_rating
               ON content_rating.content_id = content.id
         WHERE
            1=1
            '.$second_sql_where.'
            '.$frontpage_con.'
             AND categories.published = 1
         ORDER BY
            '.$order_options.'
         ';
         // run the query
         $db->setQuery($second_query_news);
         // when exist some results
         if($news2 = $db->loadObjectList()) {
            // generating tables of news data
            foreach($news2 as $item) {                  
                $pos = array_search($item->ID, $content_iid);
                $id = $item->ID;
               if (!($access || in_array($item->access, $authorised))) { $id = 0; }
                 $content_id[$pos] = $id; // news IDs
               $content_cid[$pos] = $item->CID; // news CIDs
               $content_author[$pos] = $item->author; // news author
               $content_catname[] = $item->cat; // news category name
               $content_catname[$pos] = $item->cat; // news category name
               $content_email[$pos] = $item->author_email; // news author emails
               $content_rating_sum[$pos] = $item->rating_sum; // news rating sum
               $content_rating_count[$pos] = $item->rating_count; // news rating count
            }
         }      
         
      }
      // Returning data in hash table
      return array(
         "ID" => $content_id,
         "IID" => $content_iid,
         "CID" => $content_cid,
         "title" => $content_title,
         "text" => $content_text,
         "date" => $content_date,
         "date_publish" => $content_date_publish,
         "author" => $content_author,
         "catname" => $content_catname,
         "hits" => $content_hits,
         "email" => $content_email,
         "news_amount" => $news_amount,
         "rating_sum" => $content_rating_sum,
         "rating_count" => $content_rating_count,
         "images" => $content_images
      );
   }
}
/* EOF */
*

nicalf

  • Захожу иногда
  • 58
  • 1 / 0
Arkadiy, подскажите, пжл, где необходимо исправить конструкцию?
*

Arkadiy

  • Гуру
  • 5317
  • 463 / 2
  • Крепитесь, други.
Вот уж придумали, $source = $config['com_categories'] тут ошибка, но просто ее не исправить, посмотрите этот конфиг, возможно там категории не выбраны.
*

nicalf

  • Захожу иногда
  • 58
  • 1 / 0
Arkadiy, спасибо! Решил пойти по пути наименьшего сопротивления, ошибки из-за модуля GK4, его удалил и установил GK5
*

Arkadiy

  • Гуру
  • 5317
  • 463 / 2
  • Крепитесь, други.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Помогите оптимизировать getDBO запрос

Автор goga_pgasovav

Ответов: 5
Просмотров: 442
Последний ответ 10.12.2020, 12:36:56
от goga_pgasovav
[решено] создать MySQL-запрос по красоте :)

Автор effrit

Ответов: 13
Просмотров: 854
Последний ответ 30.09.2017, 16:58:21
от effrit
Запрос в бд

Автор sSeifeRr

Ответов: 7
Просмотров: 855
Последний ответ 02.08.2017, 18:28:19
от sSeifeRr
sql запрос из материла Joomla

Автор xak400

Ответов: 1
Просмотров: 849
Последний ответ 30.06.2017, 09:45:32
от SmokerMan
Как составить запрос с выбором данных из строки с разделителем?

Автор denism300

Ответов: 34
Просмотров: 1764
Последний ответ 20.11.2016, 21:48:07
от robert