//модуле хранилища Chpu_1_0
class Chpu extends CModule {
static $instance;
private $_chpu = array();
public function __construct() {
self::$instance = $this;
}
public function Initialize() {
$this->_chpu = array(
(object)array('pattern' => '/news\/(.*?)\.html/i', 'replace' => function($match) {
if(strstr($match[1], '_') !== false)
return 'news/'.$match[1].'.html';
$m = explode('-', $match[1]);
$m = end($m);
return 'news/news_'.$m.'.html';
}, 'urlreplace' => function($url, $folder, $publication, $storage, $args) {
if(count($storage) > 1) {
$d = new DataRow($storage[0], $storage[1]);
if(!is_empty($d->hid)) {
return '/news/'.$d->hid.'-'.$d->id.'.html'.($args && $args->Count() > 0 ? '?'.$args->ToString('&', '=') : '');
}
}
}),
(object)array('pattern' => '/(temi|heavy)\/(.*?)\.html/i', 'replace' => function($match) {
if(strstr($match[2], '_') !== false)
return $match[1].'/'.$match[2].'.html';
$m = explode('-', $match[2]);
$m = end($m);
return $match[1].'/stories_'.$m.'.html';
}, 'urlreplace' => function($url, $folder, $publication, $storage, $args) {
if(count($storage) > 1) {
$d = new DataRow($storage[0], $storage[1]);
if(!is_empty($d->hid)) {
return '/'.($d->ishash == 1 ? 'heavy' : 'temi').'/'.$d->hid.'-'.$d->id.'.html'.($args && $args->Count() > 0 ? '?'.$args->ToString('&', '=') : '');
}
}
}),
(object)array('pattern' => '/programmi\/.*?\-?(\d+)\.html/i', 'replace' => function($match) {
if(strstr($match[0], 'programmparts_') === false) {
$m = explode('-', $match[1]);
$m = end($m);
$reader = Core::$instance->dbe->ExecuteReader('select * from sys_links where link_parent_id=7 and link_id='.$m);
if($reader->Count() > 0)
return 'programmi/'.$m.'.html';
else
return 'programmi/programmparts_'.$m.'.html';
}
else
return $match[0];
}, 'urlreplace' => function($url, $folder, $publication, $storage, $args) {
if($publication) {
if(!is_empty($publication->datarow->hid)) {
return $folder->Url().$publication->datarow->hid.'-'.$publication->id.'.html'.($args && $args->Count() > 0 ? '?'.$args->ToString('&', '=') : '');
}
}
else if($storage && count($storage) > 1) {
$d = new DataRow($storage[0], $storage[1]);
if(!is_empty($d->hid)) {
return $folder->Url().$d->hid.'-'.$storage[1].'.html';
}
}
}),
(object)array('pattern' => '/kino\/.*?\-?(\d+)\.html/i', 'replace' => function($match) {
if(strstr($match[0], 'programmparts_') === false) {
$m = explode('-', $match[1]);
$m = end($m);
$reader = Core::$instance->dbe->ExecuteReader('select * from sys_links where link_parent_id=30 and link_id='.$m);
if($reader->Count() > 0)
return 'kino/'.$m.'.html';
else
return 'kino/p $args->navigator->datarow) {
//нужно переадресовать
$hid = $args->navigator->publication ? $args->navigator->publication->datarow->hid : $args->navigator->datarow->hid;
if($hid) {
$url = $args->navigator->Url($args->navigator->folder, $args->navigator->publication, array($args->navigator->datarow->storage->table,$args->navigator->datarow->id));
header('Location: '.$url);
exit;
}
}
$query = preg_replace_callback($chpu->pattern, $chpu->replace, $query);
$_SERVER['REQUEST_URI'] = $query;
break;
}
}
return $args;
}
}
?>
Warning: chmod(): No such file or directory in /app/public/core/kernel/system/filesystem.cls.php on line 118
Warning: Cannot modify header information - headers already sent by (output started at /app/public/files/_cache/code/module_Chpu.php:193) in /app/public/index.php on line 51
Fatal error: Class 'Tags' not found in /app/public/files/_cache/code/storage_news_item.php on line 30