Портал на AJAX

Портал на AJAX 1.0.0

Нет прав для скачивания
Совместимость
не проверялся на совместимость
Изменения в БД
требуются
Автор
frost444
Общественное достояние
да
Описание: добавляет главную страницу-портал с новыми раздачами.

Возможности:
  • Вывод последних раздач из определенных разделов
  • AJAX-навигация с заменой хеша адресной строки
  • Минимальная нагрузка из-за отдельного кэша
  • Поиск по тексту происходит уже по кэшу
Инструкция по установке
PHP:
Автор мода: frost444

//-----[Обновления]-----\\

|--(00.00.0000)
   1) измененный код: ---
   2) ---
   info: (1) ---
 
\\-----[Обновления]-----//

####[ОТКРЫТЬ]----- config.php

$bb_cfg['portal_relizi'] = array(
  'on'        => true,
  'on_navi'   => true,
  'on_news'   => true,
  'cache'     => 10,
  'cat_cache' => 24,
  'index_cache' => 20,
  'index_limit' => 20,
);

####[СОХРАНИТЬ_ФАЙЛ]####

####[ОТКРЫТЬ]----- config.php
-----[добавить в конец]-----

$lang['PORTAL'] = 'Портал';
$lang['PORTAL_M'] = 'портал';

####[СОХРАНИТЬ_ФАЙЛ]####

####[ОТКРЫТЬ]----- common.php
-----[найти]-----

                    case 'xcache':
                        if (!isset($this->obj[$cache_name]))

-----[добавить ниже]-----

                    case 'quick':
                        if (!isset($this->obj[$cache_name]) && !isset($this->obj[$cache_dir]))
                        {
                            $this->obj[$cache_name] = new cache_quick($this->cfg['db_dir'] . $cache_name .'/' . $cache_dir .'/');
                        }
                        $this->ref[$cache_name] =& $this->obj[$cache_name];
                        break;
                      
-----[найти]-----

/**
* Datastore
*/
class datastore_common

-----[добавить выше]-----

class cache_quick extends cache_common
{
    var $used   = true;
    var $engine = 'Quickfilecache';
    var $dir    = null;

    function cache_quick ($dir)
    {
        $this->dir = $dir;
        $this->dbg_enabled = sql_dbg_enabled();
    }

    function get ($name)
    {
        $filename = $this->dir . clean_filename($name) . '.php';

        $this->cur_query = "cache->set('$name')";
        $this->debug('start');

        if(file_exists($filename))
        {
            require($filename);
        }

        $this->debug('stop');
        $this->cur_query = null;

        return (!empty($quickcache)) ? $quickcache : false;
    }

    function set ($name, $value)
    {
        if (!function_exists('var_export'))
        {
            return false;
        }

        $this->cur_query = "cache->set('$name')";
        $this->debug('start');

        $filename   = $this->dir . clean_filename($name) . '.php';

        $quickcache = "<?php\n";
        $quickcache .= "if (!defined('BB_ROOT')) die(basename(__FILE__));\n";
        $quickcache .= '$quickcache = ' . var_export($value, true) . ";\n";
        $quickcache .= '?>';

        $this->debug('stop');
        $this->cur_query = null;
        $this->num_queries++;

        return (bool) file_write($quickcache, $filename, false, true, true);
    }
  
    function search ($name, $value)
    {
        $dir = $this->dir;
        $content = scandir($dir);
        $amount_content = sizeof($content);
        $ARRfile = array();
        for($i = '2'; $i < $amount_content; $i++)
        {
            $filename = $content[$i];
            $wayfilename = "$dir$filename";
            require($wayfilename);

            $object = mb_strtolower($value, 'UTF-8');
            $content_file = mb_strtolower($quickcache[$name], 'UTF-8');
          
            $word = explode(" ", $object);
            $matches = array();
            $count_words = preg_match_all('/(?:'.implode('|',$word).')/i', $content_file, $matches);
            $ar_dif = array_diff($word, $matches[0]);
            $result = (count($ar_dif) != 0) ? false: true;

            if($result)
            {
                $ARRfile[] = substr($filename,0,-4);;
            }
        }

        return (sizeof($ARRfile) == 0) ? false : $ARRfile;
    }

    function rm ($name = '')
    {
        $clear = false;
        if($name)
        {
            $filename = $this->dir . clean_filename($name) . '.php';
            if (file_exists($filename))
            {
                $clear = (bool) unlink($filename);
            }
        }
        else
        {
            if (is_dir($this->dir))
            {
                if ($dh = opendir($this->dir))
                {
                    while (($file = readdir($dh)) !== false)
                    {
                        if ($file != "." && $file != "..")
                        {
                            $filename = $this->dir . $file;

                            unlink($filename);
                            $clear = true;
                        }
                    }
                    closedir($dh);
                }
            }
        }
        return $clear;
    }
}
  • 1.JPG
    1.JPG
    72.9 KB · Просмотры: 294
  • 2.jpg
    2.jpg
    274.8 KB · Просмотры: 293
  • 3.jpg
    3.jpg
    432.6 KB · Просмотры: 277
  • 4.JPG
    4.JPG
    24.7 KB · Просмотры: 276
  • 5.JPG
    5.JPG
    35.2 KB · Просмотры: 278
  • Мне нравится
Реакции: boko
Автор
Exile
Скачивания
46
Просмотры
251
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок

Другие ресурсы пользователя Exile

Сверху