_blockRegExp = '@(.*)@sm'; $this->_varRegExp = '@{(' . $this->_blocknameRegExp . ')}@sm'; $this->_root = $root; } function _addBlock($name, $content) { // удаляем потомков и добаляем в список блоков $this->_deleteChild($name); $this->_blocks[$name] = $content; } function _deleteBlock($name) { unset($this->_children[$name]); unset($this->_blocks[$name]); } function _addChild($parent, $child) { $this->_children[$parent][$child] = true; } function _clearBlockContent($block, $child) { $this->_blocks[$block] = preg_replace( '@(.*)@sm', ' ', $this->_blocks[$block]); } function _deleteChild($parent) { if (!empty($this->_children[$parent])) { foreach($this->_children[$parent] AS $child => $val) { $this->_deleteChild($child); unset($this->_children[$parent][$child]); } } unset($this->_block[$parent]); } function _buildBlock($crntBlockName) { $crntBlockContent = $this->_blocks[$crntBlockName]; // ищем в контенте блока вложенных блоков if (preg_match_all($this->_blockRegExp, $crntBlockContent, $regs, PREG_SET_ORDER)) { foreach ($regs as $k => $match) { // получем имя и контент блока-потомка, добавляем блок в общий список // и как потомок текущему блоку $fndBlockName = $match[1]; $fndBlockContent = $match[2]; $this->_addBlock($fndBlockName, $fndBlockContent); $this->_addChild($crntBlockName, $fndBlockName); $this->_buildBlock($fndBlockName); // очищаем контент блока потомков в текущем блоке $this->_clearBlockContent($crntBlockName, $fndBlockName); } } } /* Функция находит строку ..... и заменяет ее на результат исполнения РНР-кода, находящегося внутри. */ function parsePHP(&$content) { preg_match_all('@(.*?)@sm',$content,$regs); if (isset($regs[0][0])) { foreach ($regs[1] as $i=>$php_code) { ob_start(); eval($php_code); $content=str_replace($regs[0][$i],ob_get_contents(),$content); ob_end_clean(); } } } function _parseBlock($crntBlockName) { if (!empty($this->_children[$crntBlockName])) { // достаём потомки блока $children = $this->_children[$crntBlockName]; reset($children); foreach($children AS $childName => $val) // парсим блок, если у него есть потомки if (!empty($this->_children[$childName])) $this->_parseBlock($childName); $parsed = false; if (!empty($this->_parsed[$crntBlockName])) $parsed = true; // блок пропарсен else { reset($children); foreach($children AS $childName => $val) if (!empty($this->_parsed[$childName])) { // если пропарсен хотя бы один блок-потомок $parsed = true; break; } } // парсим текущий блок, если он или хотя бы один из его потомков был пропарсен if ($parsed) { if (empty($this->_parsed[$crntBlockName])) $this->_parsed[$crntBlockName] = $this->_blocks[$crntBlockName]; reset($children); foreach($children AS $childName => $val) { $parseContent = empty($this->_parsed[$childName]) ? '' : $this->_parsed[$childName]; // заменяем дочерний блок на пропарсенный $this->_parsed[$crntBlockName] = preg_replace( '@(.*)@sm', $parseContent, $this->_parsed[$crntBlockName]); // убиваем дочерний пропарсенный блок unset($this->_parsed[$childName]); } } } } function parseBlock($block, $variables = array()) { // добавляем контент блока if (empty($this->_parsed[$block])) $this->_parsed[$block] = ''; $this->_parsed[$block] .= $this->_blocks[$block]; // парсим блок $this->_parseBlock($block); // парсим переменные if (!empty($variables)) { foreach($variables AS $var => $value) $this->_parsed[$block] = preg_replace( '@{' . $var . '}@sm', $value, $this->_parsed[$block]); } // удаляем переменные, которые есть в блоке, но не указаны в $variables if (preg_match_all($this->_varRegExp, $this->_parsed[$block], $regs, PREG_SET_ORDER)) { foreach ($regs as $k => $match) $this->_parsed[$block] = preg_replace('@{' . $match[1] . '}@sm', '', $this->_parsed[$block]); } } function loadTemplateFile($filename, $parentBlockName = '') { // Добавляем файл только если еще не добавляли if (!in_array($filename,$this->loaded_files)) { $this->loaded_files[]=$filename; // читаем файла шаблона $content = file_get_contents($this->_root . "/" . $filename); $this->parsePHP($content); // если блоков ещё нет, это первый if (empty($this->_blocks)) { // создаём исходный блок _INIT $this->_addBlock('_INIT', $content); $this->_buildBlock('_INIT'); } elseif (empty($parentBlockName)) { // если не задан блок-родитель, то создаём временный блок, // выбераем содержмое и удаляем его $this->_addBlock('_TEMP', $content); $this->_buildBlock('_TEMP'); $this->_deleteBlock('_TEMP'); } else $this->_buildBlock($parentBlockName); } } function show() { $this->_parseBlock('_INIT'); echo $this->_parsed['_INIT']; } // ******** ONLY DEBUG FUNCTION ***** function showBlocks() { foreach($this->_blocks AS $block => $content) { echo "Имя блока: " . $block . "
"; echo "Потомки: "; if (!empty($this->_children[$block])) { foreach ($this->_children[$block] AS $name => $val) echo $name . "; "; } else echo "нет"; echo "
"; echo "Контент: \n" . $this->_blocks[$block]; echo "\n

"; } } // ******** / ONLY DEBUG FUNCTION ***** } ?>_load(); } function loadEx() { $this->_load('ex'); } function loadAll() { $this->_load('all'); } function loadCustom($params=array()) { $this->paramsCustom=array(); foreach ($params as $param) $this->paramsCustom[]=array('name' => $param); $this->_load('custom'); } function _load($ext=false) { if ( !($this->{$this->id_field}) ) return; $sel=$this->buildSel($ext); $filter=$this->buildFilter(); foreach ($this->usedTables as $table) $tables[]='`'.$table.'`'; $tables=implode(',', $tables); $sql="SELECT $sel FROM $tables WHERE $filter"; $res=doSQL($sql,__LINE__,__FILE__); $r=mysql_fetch_array($res); foreach ($this->chooseParams as $paramName) { foreach ($this->$paramName as $param) $this->info[$param['name']]=$r['base_'.$param['name']]; foreach ($this->usedClass as $itemName=>$className) { $$itemName = new $className($r[$itemName.'_'.$this->id_field]); foreach ($$itemName->$paramName as $param) $$itemName->info[$param['name']]=$r[$itemName.'_'.$param['name']]; $this->$itemName=$$itemName; } } } function buildFilter() { $filter[] = "`".$this->table."`.`".$this->id_field."`='".$this->{$this->id_field}."'"; // выбирать текущую запись foreach ($this->usedClass as $itemName=>$className) { //определение полей, по которым делается выборка //например, для выборки рубрики для фото ($foto->rubric->id) //ищется поле среди параметров фото, по которому идёт выборка рубрики - //это поле rubric_id. $classItem = new $className(); foreach ($this->params as $param) if ($param['filter']==$itemName) $filter[] = '`'.$this->table.'`.`'.$param['name']."`=`".$classItem->table.'`.`'.$this->id_field.'`'; // получается: fotos.rubric_id=rubric.id } return $filter=implode(' AND ', $filter); } function buildSel($ext=false) { $this->chooseParams=array(); // названия загружаемых параметров switch ($ext) { case 'ex': $this->chooseParams[]='paramsEx'; break; case 'all': $this->chooseParams[]='paramsEx'; $this->chooseParams[]='params'; break; case 'custom': $this->chooseParams[]='paramsCustom'; break; default: $this->chooseParams[]='params'; break; } foreach ($this->chooseParams as $paramName) { foreach ($this->$paramName as $param) $sel[]='`'.$this->table.'`.`'.$param['name'].'` as base_'.$param['name']; $this->usedTables[$this->table]=$this->table; foreach ($this->usedClass as $itemName=>$className) { $$itemName = new $className(); foreach ($$itemName->$paramName as $param) $sel[]='`'.$$itemName->table.'`.`'.$param['name'].'` as '.$itemName.'_'.$param['name']; $this->usedTables[$$itemName->table]=$$itemName->table; } } return $sel=implode(',', $sel); } /* Сохранять параметры нужно только текущего класса. Допустим текущий класс - cFoto. Сохраняются параметры фото, в том числе rubric_id и user_id. $foto->save(); Если понадобится расширенная информация о рубрике (пользователе), то нужно вызвать $foto->load(); Так получится загрузка $foto->rubric->id и $foto->user->id. */ function buildIncOrdernum() { $sql="SELECT MAX(ordernum) as ordernum FROM `".$this->table."`"; $res = doSQL($sql,__LINE__,__FILE__); $r=mysql_fetch_array($res); $this->info['ordernum'] = $r['ordernum']+1; } function prepareToSave() { if (empty($this->info)) return; foreach ($this->info as $param=>$value) $this->info[$param]=addslashes($value); } function save() { if (empty($this->info)) return; $params=array_merge($this->params,$this->paramsEx); if ($this->{$this->id_field}) { foreach ($params as $param) if (isset($this->info[$param['name']])) $sel[]='`'.$param['name']."`='".stripslashes(addslashes($this->info[$param['name']]))."'"; $sel = implode(',', $sel); $sql = "UPDATE `".$this->table."` SET $sel WHERE `".$this->id_field."`='".$this->{$this->id_field}."'"; doSQL($sql,__LINE__,__FILE__); } else { foreach ($params as $param) { if ($param['name']==$this->id_field) continue; $sel[]='`'.$param['name'].'`'; $val[]="'".stripslashes(addslashes(@$this->info[$param['name']]))."'"; } $sel = implode(',', $sel); $val = implode(',', $val); $sql = "INSERT INTO `".$this->table."` ($sel) VALUES ($val)"; doSQL($sql,__LINE__,__FILE__); $this->id=mysql_insert_id(); } } function del() { if ( !($this->{$this->id_field}) ) return; $sql = "DELETE FROM `".$this->table."` WHERE `".$this->id_field."`='".$this->{$this->id_field}."'"; doSQL($sql,__LINE__,__FILE__); $this->id=null; $this->info=array(); } function isSavedItem() { if ( !($this->{$this->id_field}) ) return; $sql = "SELECT `id` FROM `".$this->table."` WHERE `".$this->id_field."`='".$this->{$this->id_field}."'"; $res = doSQL($sql,__LINE__,__FILE__); return mysql_num_rows($res)>0 ? true:false; } } ?> limit="$from"; if ($count) $this->limit.=", $count"; } function setOrder($field,$sort='asc') { if (!empty($this->order)) $this->order .=','; $this->order .= $field.' '.strtoupper($sort); } function setGroup($field) { $this->group = $field; } function setPreSel($sel) { $this->pre_sel[] = $sel; } function addTable($table) { $this->usedTables[] = $table; } function buildSel() { $classItem = new $this->baseClass(); foreach ($classItem->params as $param) $sel[]='`'.$classItem->table.'`.`'.$param['name'].'` as base_'.$param['name']; // fotos.id as base_id, fotos.name as base_name $this->usedTables[$classItem->table] = $classItem->table; foreach ($this->usedClass as $itemName=>$className) { $$itemName = new $className(); foreach ($$itemName->params as $param) $sel[]='`'.$$itemName->table.'`.`'.$param['name'].'` as '.$itemName.'_'.$param['name']; // в итоге получается user.id as user_id, rubric.name as rubric_name,... $this->usedTables[$$itemName->table] = $$itemName->table; } $sel=array_merge($sel,$this->pre_sel); return implode(',',$sel); } function clearFilter() { $this->filter=array(); } function clearLimit() { $this->limit=null; } function clearGroup() { $this->group=null; } function clearOrder() { $this->order=null; } function clearPreSel() { $this->pre_sel=array(); } function buildFilter() { $filter = array(); $baseItem = new $this->baseClass(); foreach ($this->usedClass as $itemName=>$className) { $classItem = new $className(); foreach ($baseItem->params as $param) if ($param['filter']==$itemName) $filter[] = '`'.$baseItem->table.'`.`'.$param['name']."`=`".$classItem->table.'`.`'.$this->id_field.'`'; } return $filter; } function getList() { $sel = $this->buildSel(); // выбираем используемые таблицы для FROM foreach ($this->usedTables as $table) $tables[]='`'.$table.'`'; $tables=implode(',',$tables); $sql = "SELECT $sel FROM $tables"; ### Фильтры $filter=$this->buildFilter(); $filter=array_merge($this->filter,$filter); if ($filter) $sql .= " WHERE " . implode(' AND ', $filter); if (!empty($this->group)) $sql .= " GROUP BY " . $this->group; if (!empty($this->order)) $sql .= " ORDER BY " . $this->order; if (!empty($this->limit)) $sql .= " LIMIT ".$this->limit; $res = doSQL($sql,__LINE__,__FILE__); //echo $sql."

"; $items = array(); while($r = mysql_fetch_array($res)) { $newItem=new $this->baseClass($r['base_'.$this->id_field]); //$newItem=new cFoto(2154); foreach ($newItem->params as $param) $newItem->info[$param['name']]=$r['base_'.$param['name']]; //$newItem->info['rubric_id']=$r['base_rubric_id']; // подключение других используемых классов foreach ($this->usedClass as $itemName=>$className) { $$itemName=new $className($r[$itemName.'_'.$this->id_field]); // $rubric = new cRubric(23); // $user = new cUser(55) foreach ($$itemName->params as $param) $$itemName->info[$param['name']]=$r[$itemName.'_'.$param['name']]; //$rubric->info['name']=$r['rubric_name']; //$user->info['name']=$r['user_name']; $newItem->$itemName=$$itemName; //$newItem->rubric= объект 'рубрика'; //$newItem->user= объект 'автор'; } $items[$r['base_'.$this->id_field]]=$newItem; } return $items; } function getCount() { $sql = "SELECT COUNT(`".$this->table."`.`id`) as count FROM `".$this->table."`"; ### Фильтры if ($this->filter) $sql .= " WHERE " . implode(' AND ', $this->filter); if (!empty($this->order)) $sql .= " ORDER BY " . $this->order; $res = doSQL($sql,__LINE__,__FILE__); $r=mysql_fetch_array($res); return $r['count']; } } ?> className=get_class($this); //Определяем имя класса, экземпляры которого будут составлять дерево $this->baseClass='cNode'; $this->baseRootClass='cRootNode'; } function load() { //Создаем корневой узел $this->nodes[TREE_ROOT_NODE_ID] = new $this->baseRootClass(); //Выбираем из БД информацию обо всех остальных узлах $nodes = $this->getList(); //Если такие узлы есть, то соединяем их между собой в дерево if (!empty($nodes)) $this->makeTree($this->nodes[TREE_ROOT_NODE_ID], $nodes); } //Создание фильтров function setFilter($filter=array()) { foreach ($filter as $filter_id => $value) { switch ($filter_id) { //Фильтр по видимости case FILTER_VISIBLE: $this->filter[] = "`visible` = '".$value."'"; break; case FILTER_IN_START: $this->filter[] = "`in_start` = '".$value."'"; break; //Фильтр по узлам case FILTER_PARENT_NODES: foreach ($value as $val) $nodes[]="`parent_id` = '".$val."'"; $this->filter[] = '('.implode(' OR ', $nodes).')'; break; } } } //Создание дерева узлов. $parent_node - узел, к которому прикрепляются узлы из списка $nodes function makeTree(&$parent_node, $nodes) { //Перебираем весь список узлов, и прикрепляем их к узлу $parent_node foreach ($nodes as $node_id=>$node) { if ($node->info['parent_id'] == $parent_node->id) { //добавляем ноду в общий список $this->nodes[$node_id] = $node; //добавляем родителя текущей ноде $this->nodes[$node_id]->parent_node = &$parent_node; //добавляем текущую ноду как потомка родитею $parent_node->children[$node_id] = &$this->nodes[$node_id]; //Удаляем текущий просматриваемый узел из списка (он уже прикреплен к дереву и нам не нужен) unset($nodes[$node_id]); //Повторяем всю процедуру для текущего узла $this->makeTree($this->nodes[$node_id], $nodes); } } } function getNode($id) { if (!empty($this->nodes[$id])) return $this->nodes[$id]; return $this->getRootNode(); } function getRootNode() { return $this->nodes[TREE_ROOT_NODE_ID]; } } class cOrderedTree extends cTree { var $ordernum_field="ordernum"; //Перемещение ноды вверх/вниз по текущему уровню function move($node_id,$direction) { //получаем узел, который будем двигать $curr_node = &$this->getNode($node_id); // echo '

';print_r($curr_node);

        //Проверка, стоит ли вообще что-то перемещать
        if ($curr_node->getBrothersCount()<2) return false; //Если есть соседние разделы
            if ($direction!="up" and $direction!="down") return false; //Если параметр $direction указан верно
        if ($curr_node->isRoot()) return false;        //А также если не пытаемся переместить корневой раздел
                if ($this->isNodeLast($node_id) and $direction=="down") return false; //Перемещаем самый нижний вниз
                if ($this->isNodeFirst($node_id) and $direction=="up") return false; //Перемещаем самый верхний вверх

        //Получаем список узлов текущего уровня
        $nodes = $curr_node->parent_node->children;

        //Создаём пустые объекты узлов (нужны для сравнения в if для начала процесса)
        $next_node = new $this->baseClass();
                $next_node->info['ordernum'] = 999999999999;
        $prev_node = new $this->baseClass();
                $prev_node->info['ordernum'] = 0;

        //Находим предыдущий и следующий узел
        foreach ($nodes as $node)
        {
                        if ($node->id!=$node_id)
                        {
                                //Если узел ниже текущего, но ближе к нему, то делаем его следующим узлом
                                if ($node->info[$this->ordernum_field] > $curr_node->info[$this->ordernum_field] and
                                        $node->info[$this->ordernum_field] < $next_node->info[$this->ordernum_field])
                                        $next_node = $node;
                                //Если у узел выше текущего, но ближе к нему, то делаем его предыдущим узлом
                                if ($node->info[$this->ordernum_field] < $curr_node->info[$this->ordernum_field] and
                                        $node->info[$this->ordernum_field] > $prev_node->info[$this->ordernum_field])
                                        $prev_node = $node;
                        }
                }

                $order=$curr_node->info[$this->ordernum_field];
        //Сохраняем результаты (меняем местави значения ordernum, если нашлись нужные объекты)
        if ($direction=='up')
        {
            $curr_node->info[$this->ordernum_field]=$prev_node->info[$this->ordernum_field];
            $prev_node->info[$this->ordernum_field]=$order;
            $prev_node->save();
        }
        else
        {
            $curr_node->info[$this->ordernum_field]=$next_node->info[$this->ordernum_field];
            $next_node->info[$this->ordernum_field]=$order;
            $next_node->save();
        }
                $curr_node->save();
                return true;
        }

    //Проверка на то, что нода ПЕРВАЯ в списке текущего раздела
        function isNodeFirst($node_id)
    {
                $node = $this->getNode($node_id);
        if (!$node->isRoot())
        {
            foreach ($node->parent_node->children as $child)
                        {
                                if ($child->info['ordernum']<$node->info['ordernum'])
                                        return false;
                        }
                }
        return true;
    }

    //Проверка на то, что нода ПОСЛЕДНЯЯ в списке текущего раздела
    function isNodeLast($node_id)
    {
                $node = $this->getNode($node_id);
        if (!$node->isRoot())
        {
            foreach ($node->parent_node->children as $child)
                if ($child->info['ordernum']>$node->info['ordernum'])
                    return false;
        }
        return true;
    }

        //Возвращает максимальный ordernum из списка потомков узла с id = $node_id
        function getMaxOrderNum($node_id)
        {
                $node = $this->getNode($node_id);
                $max=0;
                foreach ($node->children as $child_id=>$child)
                {
                        if ($child->info[$this->ordernum_field] > $max)
                                $max = $child->info[$this->ordernum_field];
                }
                return $max;
        }
}

/* УЗЛЫ - НОДЫ */
//Корневой узел дерева
class cRootNode extends cItem
{
    //Служебные поля
        var $id = TREE_ROOT_NODE_ID;
        var $table = TABLE_SHOP_NODES;

        //Товары
        var $items = array();

    //Характеристики узла
    var $params = array(
                array('name' => 'id'),
                array('name' => 'parent_id'),
                array('name' => 'name'),
                array('name' => 'text'),
                array('name' => 'url_name'),
                array('name' => 'visible'),
                array('name' => 'in_start'),
                array('name' => 'ordernum'),
                array('name' => 'sites_count'),
                array('name' => 'banner_top'),
                array('name' => 'banner_left'),
                array('name' => 'banner_bottom'),
                );
        var $paramsEx = array(
                );

        //параметры
        var $info = array(
                'id' => TREE_ROOT_NODE_ID,
                'name' => TREE_ROOT_NODE_NAME,
                'parent_id' => 0,
                'visible' => 1,
                'ordernum' => 0,
                );

        //Потомки узла
        var $children = array();

        //Атрибуты узла
        var $attributes = array();

        function cRootNode()
        {
        }

        //Возвращает текущий уровень вложенности узла
        function getLevel()
        {
                return TREE_ROOT_NODE_LEVEL;
        }

        //Возвращает количество узлов, находящихся на одном уровне с текущим в своей ветке
        function getBrothersCount()
        {
                return 1;
        }

        //Возвращяет количество потомков текущего узла
        function getChildrenCount()
        {
                return count($this->children);
        }

        function isRoot()
        {
                return true;
        }

        //Проверка видимости узла с учётом наследственности (видимости предыдущих узлов)
        function _isVisible($node)
        {
                if ($node->isRoot()) return true;
                return $node->info['visible'] ? $this->_isVisible($node->parent_node) : false;
        }

        function _isEmpty($node)
        {
                if ($node->getItemsCount()>0) return false;
                foreach ($node->children as $child_id=>$child)
                {
                        if (($child->getItemsCount()+$node->getItemsCountNext()) > 0)
                                return false;
                        $this->_isEmpty($child);
                }
                return true;
        }

        function isEmpty()
        {
                return $this->_isEmpty($this);
        }

        function isVisible()
        {
                //проверяем видимость
                return $this->_isVisible($this);
        }

        function getItemsCount()
        {
                if (!$this->id) return false;
                return $this->info['sites_count'];
        }

        //считает кол-во сайтов в рубриках, последующих
        function getItemsCountNext()
        {
                return $this->_getItemsCountNext($this);
        }

        function _getItemsCountNext(&$node,$count=0)
        {
                foreach ($node->children as $child_id=>$child)
                {
                        $count += $child->getItemsCount();
                        $count += $child->getItemsCountNext();
                }
                return $count;
        }

        //функция возвращает url рубрики через url_name, если оно не заполнено, тогда rubric{ID}
        function getNodeUrl()
        {
                return $this->_getNodeUrl($this);
        }

        function _getNodeUrl(&$node, $url_name='')
        {
                if ($node->isRoot()) return $url_name;
                else
                {
                        $new_url_name = ((!empty($node->info['url_name'])) ? $node->info['url_name'] : 'rubric'.$node->id) .'/';
                        return $this->_getNodeUrl($node->parent_node, $new_url_name.$url_name);
                }
        }
}

//Не-корневой (любой) узел дерева
class cNode extends cRootNode
{
        var $parent_node;

        function cNode($id=null)
        {
                $this->id = $id;
        }

        //Возвращает текущий уровень вложенности узла
        function getLevel()
        {
                $level = $this->parent_node->getLevel();
                return $level + 1;
        }

        //Возвращает количество узлов, находящихся на одном уровне с текущим в своей ветке
        function getBrothersCount()
        {
                return $this->parent_node->getChildrenCount();
        }

        function isRoot()
        {
                return false;
        }
}
?>
template_file = $tpl;
		tplloadTemplateFile($tpl . '.tpl');
	}

	function buildUrl($page)
	{
		$href = $this->url_pattern;
		foreach ($this->vars AS $key=>$value)
			$href = str_replace('%'. $key .'%', $value, $href);
		$href = str_replace('%PAGE%', $page, $href);
		return $href;
	}

	function isShowPages($curr_page,$page,$amount_pages)
	{
		if ($amount_pages > 1 AND $amount_pages < 100) 
		{
			if ($page > $curr_page-4 AND $page < $curr_page+4) return true;
			if (($page < 2 AND $curr_page > 2) OR ($page > $amount_pages-1 AND $curr_page < $amount_pages-1))  return true;
		}
		else return true;
	}

	function parse($block, $form='standart')
	{
		$amount_pages = ceil($this->total_items_count/$this->per_page);
		$page = getInt($this->page_field,1);

		if ($amount_pages > 1)
		{
			$prev_showed=false;
			for ($i=1; $i<=$amount_pages; $i++)
			{
				if ($this->isShowPages($page,$i,$amount_pages))
				{
					if ($i != $page)
					{
						if ($form=='standart')
						{
							tplParseBlock($block.'_unselected', array(
								'HREF' => $this->buildUrl($i),
								'PAGE' => $i,
								));
						}
						elseif ($form=='search')
						{
							tplParseBlock($block.'_unselected', array(
								'STR' => getVar('query'),
								'PAGE' => $i,
								'IN_USER' => $this->in_user,
								'IN_COMMENT' => $this->in_comm,
								'IN_ANNOUNCE' => $this->in_ann,
							));
						}
					}
					else tplParseBlock($block.'_selected', array('PAGE' => $i));
					$prev_showed=true;
				}
				else 
				{
					if ($prev_showed)
						tplParseBlock($block.'_separator');
					$prev_showed=false;
				}

				tplParseBlock($block.'_page');
			}

			if ($page>1)
			{
				if ($form=='standart')
				{
					tplParseBlock($block.'_prev', array(
						'HREF' => $this->buildUrl($page-1),
						'PAGE' => $page-1,
						));
				}
				elseif ($form=='search')
				{
					tplParseBlock($block.'_prev', array(
						'STR' => getVar('query'),
						'PAGE' => $page-1,
						'IN_USER' => $this->in_user,
						'IN_COMMENT' => $this->in_comm,
						'IN_ANNOUNCE' => $this->in_ann,
						));
				}
			}
			else tplParseBlock($block.'_unactiv_prev');

			if ($page<$amount_pages)
			{
				if ($form=='standart')
				{
					tplParseBlock($block.'_next', array(
						'HREF' => $this->buildUrl($page+1),
						'PAGE' => $page+1,
						));
				}
				elseif ($form=='search')
				{
					tplParseBlock($block.'_next', array(
						'STR' => getVar('query'),
						'PAGE' => $page+1,
						'IN_USER' => $this->in_user,
						'IN_COMMENT' => $this->in_comm,
						'IN_ANNOUNCE' => $this->in_ann,
						));
				}
			}
			else tplParseBlock($block.'_unactiv_next');

			tplParseBlock($block);
		}
	}
}
?>
Fatal error: Class 'cList' not found in /var/www/psystems/data/www/forumlist.ru/classes/class.section.php on line 2