Универсальный парсер

Универсальный парсер 0.7.2

Lektor

Пользователь
все сделал по мануалу,но потом вот такая штука вылезает...как бороться ?
мне сложно вас понять, вы же не внесли изменений в файл аякс.пхп
просто выполните
PHP:
#
#-----[ OPEN ]------------------------------------------
#
ajax.php

#
#-----[ FIND ]------------------------------------------
#
        require(INC_DIR .'sitemap.php');
        break;

#
#-----[ AFTER, ADD ]------------------------------------------
#
    case 'pars':
        require(INC_DIR . 'functions_parser.php');
        break;

#
#-----[ FIND ]------------------------------------------
#
        'manage_group'      => array('user'),

#
#-----[ AFTER, ADD ]------------------------------------------
#
        'pars'          => array('user'),

#
#-----[ FIND ]------------------------------------------
#
        require(AJAX_DIR . 'edit_group_profile.php');
    }

#
#-----[ AFTER, ADD ]------------------------------------------
#
    function pars()
    {
        require(AJAX_DIR . 'parser.php');
    }
 

teckto

Пользователь
Извиняюсь!высылаю по новой.
<?php

define('BB_SCRIPT', 'ajax');
define('IN_AJAX', true);

$ajax = new ajax_common();

require('./common.php');

$ajax->init();

// Init userdata
$user->session_start();

// Exit if board is disabled via ON/OFF trigger or by admin
if ($ajax->action != 'manage_admin')
{
if ($bb_cfg['board_disable'])
{
$ajax->ajax_die($lang['BOARD_DISABLE']);
}
else if (file_exists(BB_DISABLED))
{
$ajax->ajax_die($lang['BOARD_DISABLE_CRON']);
}
}

// Load actions required modules
switch ($ajax->action)
{
case 'view_post':
case 'chat_message':
require(INC_DIR . 'bbcode.php');
break;

case 'update_peers':
require(BB_ROOT .'mult/config.php');
require(BB_ROOT .'mult/func.php');
require(BB_ROOT .'mult/class.remote.php');
require(BB_ROOT .'mult/class.fbenc.php');
require(BB_ROOT .'mult/class.bittorrent.php');
require(BB_ROOT .'mult/class.getpeers.php');
break;

case 'posts':
case 'post_mod_comment':
require(INC_DIR . 'bbcode.php');
require(INC_DIR . 'functions_post.php');
require(INC_DIR . 'functions_admin.php');
break;

case 'view_torrent':
case 'mod_action':
case 'change_tor_status':
case 'gen_passkey':
require(ATTACH_DIR . 'attachment_mod.php');
require(INC_DIR . 'functions_torrent.php');
break;

case 'change_torrent':
require(ATTACH_DIR . 'attachment_mod.php');
require(INC_DIR . 'functions_torrent.php');
break;

case 'user_register':
require(INC_DIR . 'functions_validate.php');
break;

case 'manage_user':
case 'manage_admin':
require(INC_DIR . 'functions_admin.php');
break;

case 'group_membership':
case 'manage_group':
require(INC_DIR . 'functions_group.php');
break;

case 'pars':
require(INC_DIR .'functions_parser.php');
break;

case 'sitemap';
require(INC_DIR .'class.sitemap.php');
break;


}

// Position in $ajax->valid_actions['xxx']
define('AJAX_AUTH', 0); // 'guest', 'user', 'mod', 'admin', 'super_admin'

$ajax->exec();

//
// Ajax
//
class ajax_common
{
var $request = array();
var $response = array();

var $valid_actions = array(
// ACTION NAME AJAX_AUTH
'edit_user_profile' => array('admin'),
'change_user_rank' => array('admin'),
'change_user_opt' => array('admin'),
'manage_user' => array('admin'),
'manage_admin' => array('admin'),
'sitemap' => array('admin'),

'mod_action' => array('mod'),
'topic_tpl' => array('mod'),
'group_membership' => array('mod'),
'post_mod_comment' => array('mod'),

'avatar' => array('user'),
'gen_passkey' => array('user'),
'change_torrent' => array('user'),
'change_tor_status' => array('user'),
'manage_group' => array('user'),
'pars' => array('user'),


'view_post' => array('guest'),
'view_torrent' => array('guest'),
'user_register' => array('guest'),
'posts' => array('guest'),
'index_data' => array('guest'),
'update_peers' => array('mod'),
'chat_message' => array('user'),
'index_ajax_del' => array('mod'),
);

var $action = null;

/**
* Constructor
*/
function ajax_common()
{
ob_start(array(&$this, 'ob_handler'));
header('Content-Type: text/plain');
}

/**
* Perform action
*/
function exec()
{
global $lang;

// Exit if we already have errors
if (!empty($this->response['error_code']))
{
$this->send();
}

// Check that requested action is valid
$action = $this->action;

if (!$action || !is_string($action))
{
$this->ajax_die('no action specified');
}
elseif (!$action_params =& $this->valid_actions[$action])
{
$this->ajax_die('invalid action: ' . $action);
}

// Auth check
switch ($action_params[AJAX_AUTH])
{
// GUEST
case 'guest':
break;

// USER
case 'user':
if (IS_GUEST)
{
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
break;

// MOD
case 'mod':
if (!IS_AM)
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
$this->check_admin_session();
break;

// ADMIN
case 'admin':
if (!IS_ADMIN)
{
$this->ajax_die($lang['ONLY_FOR_ADMIN']);
}
$this->check_admin_session();
break;

// SUPER_ADMIN
case 'super_admin':
if (!IS_SUPER_ADMIN)
{
$this->ajax_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$this->check_admin_session();
break;

default:
trigger_error("invalid auth type for $action", E_USER_ERROR);
}

// Run action
$this->$action();

// Send output
$this->send();
}

/**
* Exit on error
*/
function ajax_die($error_msg, $error_code = E_AJAX_GENERAL_ERROR)
{
$this->response['error_code'] = $error_code;
$this->response['error_msg'] = $error_msg;

$this->send();
}

/**
* Initialization
*/
function init()
{
$this->request = $_POST;
$this->action =& $this->request['action'];
}

/**
* Send data
*/
function send()
{
$this->response['action'] = $this->action;

if (DBG_USER && SQL_DEBUG && !empty($_COOKIE['sql_log']))
{
$this->response['sql_log'] = get_sql_log();
}

// sending output will be handled by $this->ob_handler()
exit();
}

/**
* OB Handler
*/
function ob_handler($contents)
{
if (DBG_USER)
{
if ($contents)
{
$this->response['raw_output'] = $contents;
}
}

$response_js = bb_json_encode($this->response);

if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))
{
if (UA_GZIP_SUPPORTED && strlen($response_js) > 2000)
{
header('Content-Encoding: gzip');
$response_js = gzencode($response_js, 1);
}
}

return $response_js;
}

/**
* Admin session
*/
function check_admin_session()
{
global $user;

if (!$user->data['session_admin'])
{
if (empty($this->request['user_password']))
{
$this->prompt_for_password();
}
else
{
$login_args = array(
'login_username' => $user->data['username'],
'login_password' => $_POST['user_password'],
);
if (!$user->login($login_args, true))
{
$this->ajax_die('Wrong password');
}
}
}
}

/**
* Prompt for password
*/
function prompt_for_password()
{
$this->response['prompt_password'] = 1;
$this->send();
}

/**
* Prompt for confirmation
*/
function prompt_for_confirm($confirm_msg)
{
if (empty($confirm_msg)) $this->ajax_die('false');

$this->response['prompt_confirm'] = 1;
$this->response['confirm_msg'] = $confirm_msg;
$this->send();
}

/**
* Verify mod rights
*/
function verify_mod_rights($forum_id)
{
global $userdata, $lang;

$is_auth = auth(AUTH_MOD, $forum_id, $userdata);

if (!$is_auth['auth_mod'])
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
}

function edit_user_profile()
{
require(AJAX_DIR . 'edit_user_profile.php');
}

function change_user_rank()
{
require(AJAX_DIR . 'change_user_rank.php');
}

function change_user_opt()
{
require(AJAX_DIR . 'change_user_opt.php');
}

function gen_passkey()
{
require(AJAX_DIR . 'gen_passkey.php');
}

function group_membership()
{
require(AJAX_DIR . 'group_membership.php');
}

function manage_group()
{
require(AJAX_DIR . 'edit_group_profile.php');
}

function pars()
{
require(AJAX_DIR . 'parser.php');
}

function post_mod_comment()
{
require(AJAX_DIR . 'post_mod_comment.php');
}

function view_post()
{
require(AJAX_DIR . 'view_post.php');
}

function change_tor_status()
{
require(AJAX_DIR . 'change_tor_status.php');
}

function change_torrent()
{
require(AJAX_DIR . 'change_torrent.php');
}

function view_torrent()
{
require(AJAX_DIR . 'view_torrent.php');
}

function user_register()
{
require(AJAX_DIR . 'user_register.php');
}

function mod_action()
{
require(AJAX_DIR . 'mod_action.php');
}

function posts()
{
require(AJAX_DIR . 'posts.php');
}

function manage_user()
{
require(AJAX_DIR . 'manage_user.php');
}

function manage_admin()
{
require(AJAX_DIR . 'manage_admin.php');
}

function topic_tpl()
{
require(AJAX_DIR . 'topic_tpl.php');
}

function index_data()
{
require(AJAX_DIR . 'index_data.php');
}

function avatar()
{
require(AJAX_DIR . 'avatar.php');
}

function sitemap()
{
require(AJAX_DIR .'sitemap.php');
}

function chat_message ()
{
global $userdata, $bb_cfg, $lang;

$mode = (int) $this->request['mode'];
$message = (string) @$this->request['message'];

if ($mode == 1)
{
if (!$message)
{
$this->ajax_die($lang['SHOUTBOX_ERR']);
}

if (!IS_ADMIN)
{
$chk = DB()->fetch_row('SELECT MAX(shout_session_time) AS last_post_time FROM bb_shout WHERE shout_user_id = ' . $userdata['user_id']);
if ($chk['last_post_time'] > 0 && (time() - $chk['last_post_time']) < $bb_cfg['flood_interval'])
{
$this->ajax_die($lang['flood_error']);
}
}
if (!empty($message))
{
DB()->query('INSERT INTO bb_shout (shout_text, shout_session_time, shout_user_id, shout_ip, shout_username) VALUES ("' . DB()->escape($message) . '", ' . time() . ', ' . $userdata['user_id'] . ', "' . USER_IP . '", "' . DB()->escape($userdata['username']) . '")');
CACHE('bb_cache')->rm('shout_data');
}
}

$shout_data = '';
if (!$shout_rows = CACHE('bb_cache')->get('shout_data'))
{
$shout_rows = DB()->fetch_rowset("SELECT s.*, u.username, u.user_id, u.user_rank,
u.avatar_ext_id
FROM bb_shout s, " . BB_USERS . " u
WHERE s.shout_user_id=u.user_id AND u.user_id = u.user_id
ORDER BY s.shout_session_time DESC LIMIT 50");
CACHE('bb_cache')->set('shout_data', $shout_rows);
}

foreach ($shout_rows AS $i => $shout_row)
{
$row_class = !($i % 2) ? 'row1' : 'row2';
$shout_data .= '<div id="shout_' . $shout_row['shout_id'] . '" class="chat-comment ' . $row_class . '"><div style="min-height: 32px;">';
$shout_data .= ($shout_row['user_id'] == GUEST_UID) ? '' : '<a href="' . PROFILE_URL . $shout_row['user_id'] . '">';
$shout_data .= str_replace('<img', '<img align="left" height="32" width="32" style="padding-right: 3px;"', get_avatar($shout_row['user_id'], $shout_row['avatar_ext_id']));
$shout_data .= ($shout_row['user_id'] == GUEST_UID) ? '' : '</a>';

//$shout_data .= (IS_AM) ? '<span class="floatR"><span title="Удалить" class="clickable" onclick="ajax.index_ajax_del(' . $shout_row['shout_id'] . '); return false;">&nbsp;<img src="images/shout_delete.png" alt="" /></span></span>' : '';

$shout_data .= '<span class="bold" onclick="add_nick(\'' . $shout_row['username'] . ', \'); return false;">' . profile_url($shout_row) . '</span><div class="small">' . bb_date($shout_row['shout_session_time'], 'd-m-Y H:i', 'false') . '</div></div>';
$shout_data .= '<div class="spacer_2"></div><span style="font-size: 11px;">' . bbcode2html($shout_row['shout_text']) . '</span></div>';
}

$this->response['message'] = $shout_data;
}

function index_ajax_del()
{
$id = (int) $this->request['id'];

DB()->query("DELETE FROM bb_shout WHERE shout_id = $id");
CACHE('bb_cache')->rm('shout_data');

$this->response['id'] = $id;
}

function update_peers()
{
global $db, $cfg_ann, $lang;
$seed = $leech = 0;
$topic_id = (int) $this->request['topic_id'];
$row = DB()->fetch_row("SELECT info_hash FROM ".BB_BT_TORRENTS." WHERE topic_id = ".$topic_id." LIMIT 1");
if($row && $info_hash = $row['info_hash'])
{
$gp = new getpeers();
$data = $gp->get_peers(1, serialize($cfg_ann), bin2hex($info_hash), false);
foreach($data['peers'] as $announce)
{
$seed = (int) $seed + $announce[0];
$leech = (int) $leech + $announce[1];
}
//DB()->query("UPDATE ".BB_BT_TORRENTS." SET last_update = ".$data['last_update'].", ext_seeder = ".$seed.", ext_leecher = ".$leech." WHERE info_hash = '".DB()->escape($info_hash)."'");
DB()->query("UPDATE ".BB_BT_TORRENTS." SET last_update = ".$data['last_update'].", ext_seeder = ".$seed.", ext_leecher = ".$leech." WHERE topic_id = $topic_id");
$html = '<div class="mrg_4 pad_4">';
$html .= '<span class="seed">'. $lang['SEEDERS'] .':&nbsp; <b>'. $seed .'</b> &nbsp;[&nbsp; 0 KB/s &nbsp;]</span> &nbsp;';
$html .= '<span class="leech">'. $lang['LEECHERS'] .':&nbsp; <b>'. $leech .'</b> &nbsp;[&nbsp; 0 KB/s &nbsp;]</span> &nbsp;';
$html .= '</div>';
}
$this->response['html'] = $html;
$this->response['topic_id'] = $topic_id;
}
}
 

Lektor

Пользователь
Проверьте где у вас находятся файлы:
functions_parser.php
parser.php
и соответствует ли их местонахождение этим строкам
require(INC_DIR .'functions_parser.php');
require(AJAX_DIR . 'parser.php');
 

Exile

Администратор
teckto в приложенном файле лично я особых ошибок не вижу. Если у вас появляется ошибка, в папке с логами (logs или internal_data/logs) должен быть файл текстовый начинающийся на php_ - что в нем во время ошибки появляется?
 

teckto

Пользователь
functions_parser.php находится в папке инклюдс, parser.php в папке аякс

вот из лога ,прилагается
[03-Mar-2015 23:07:09] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 71
[03-Mar-2015 23:07:09] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 125
[03-Mar-2015 23:07:18] PHP Notice: Undefined index: L_KINOPOISK in /var/www/u293115/data/www/speedix.ru/cache/tpl_default_posting_editor.tpl.php on line 94
[03-Mar-2015 23:07:18] PHP Notice: Undefined index: L_IMDB in /var/www/u293115/data/www/speedix.ru/cache/tpl_default_posting_editor.tpl.php on line 95
[03-Mar-2015 23:07:28] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 71
[03-Mar-2015 23:07:28] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 125
[03-Mar-2015 23:08:03] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 71
[03-Mar-2015 23:08:03] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 125
[03-Mar-2015 23:08:18] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 71
[03-Mar-2015 23:08:18] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 125
[03-Mar-2015 23:08:31] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 71
[03-Mar-2015 23:08:31] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 118
[03-Mar-2015 23:08:31] PHP Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 220
[03-Mar-2015 23:08:31] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 230
[03-Mar-2015 23:08:46] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 71
[03-Mar-2015 23:08:46] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 118
[03-Mar-2015 23:08:46] PHP Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 220
[03-Mar-2015 23:08:46] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 230
[03-Mar-2015 23:28:05] PHP Notice: Undefined index: L_KINOPOISK in /var/www/u293115/data/www/speedix.ru/includes/template.php(259) : eval()'d code on line 94
[03-Mar-2015 23:28:05] PHP Notice: Undefined index: L_IMDB in /var/www/u293115/data/www/speedix.ru/includes/template.php(259) : eval()'d code on line 95
[03-Mar-2015 23:31:52] PHP Notice: Undefined index: warning in /var/www/u293115/data/www/speedix.ru/includes/cron/jobs/warning_update.php on line 5
[03-Mar-2015 23:58:41] PHP Notice: Undefined index: L_KINOPOISK in /var/www/u293115/data/www/speedix.ru/cache/tpl_default_posting_editor.tpl.php on line 94
[03-Mar-2015 23:58:41] PHP Notice: Undefined index: L_IMDB in /var/www/u293115/data/www/speedix.ru/cache/tpl_default_posting_editor.tpl.php on line 95
[04-Mar-2015 00:12:46] PHP Notice: Undefined index: warning in /var/www/u293115/data/www/speedix.ru/includes/cron/jobs/warning_update.php on line 5
 
Последнее редактирование модератором:

Exile

Администратор
[03-Mar-2015 23:08:31] PHP Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 220
Пишите хостеру. Прямо жалобу на эту ошибку, они поймут.
 

teckto

Пользователь
[04-Mar-2015 20:44:44] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 71
[04-Mar-2015 20:44:44] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 118
[04-Mar-2015 20:44:44] PHP Notice: Undefined offset: 1 in /var/www/u293115/data/www/speedix.ru/includes/functions_parser.php on line 230
С хостером связались, все в порядке,но у нас по прежнему не работает!
 
Сверху