1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-15 23:38:18 +03:00

Merge commit '6603689ea8c0606acff7bcca60da2213e78ad2ed' into framework

This commit is contained in:
Mzhelskiy Maxim 2012-12-24 17:47:28 +04:00
commit b8b3a822cb
21 changed files with 92 additions and 34 deletions

2
.gitignore vendored
View file

@ -4,4 +4,4 @@
/logs/
/tmp/
/config/config.local.php
/.idea/
/.idea/

View file

@ -12,4 +12,8 @@ RewriteRule ^(.*)$ ./index.php
order allow,deny
deny from all
</Files>
<Files "plugin.xml">
order allow,deny
deny from all
</Files>

View file

@ -23,7 +23,6 @@ $config['view']['name'] = 'Your Site'; // назван
$config['view']['description'] = 'Description your site'; // seo description
$config['view']['keywords'] = 'site, google, internet'; // seo keywords
$config['view']['noindex'] = true; // "прятать" или нет ссылки от поисковиков, оборачивая их в тег <noindex> и добавляя rel="nofollow"
$config['view']['no_assign'] = array('db'); // список групп конфигурации, которые необходимо исключить из передачи во Viewer. Только для системного пользования.
/**
* Настройка пагинации
*/
@ -38,7 +37,12 @@ $config['pagination']['pages']['count'] = 4; // количес
* и возможно придёться увеличить значение $config['path']['offset_request_url'] на число вложенных директорий,
* например, для директории первой вложенности www.site.ru/livestreet/ поставить значение равное 1
*/
$config['path']['root']['web'] = 'http://'.$_SERVER['HTTP_HOST']; // полный WEB адрес сайта
if (isset($_SERVER['HTTP_HOST'])) {
$config['path']['root']['web'] = 'http://'.$_SERVER['HTTP_HOST']; // полный WEB адрес сайта
} else {
// for CLI scripts. or you can append "HTTP_HOST=http://yoursite.url" before script run command
$config['path']['root']['web'] = null;
}
$config['path']['root']['server'] = dirname(dirname(__FILE__)); // полный путь до сайта в файловой системе
/**
* Для CLI режима использовать
@ -58,6 +62,7 @@ $config['path']['smarty']['template'] = '___path.root.server___/templates/skin/_
$config['path']['smarty']['compiled'] = '___path.root.server___/templates/compiled';
$config['path']['smarty']['cache'] = '___path.root.server___/templates/cache';
$config['path']['smarty']['plug'] = '___path.root.engine___/modules/viewer/plugs';
$config['smarty']['compile_check'] = true; // Проверять или нет файлы шаблона на изменения перед компиляцией, false может значительно увеличить быстродействие, но потребует ручного удаления кеша при изменения шаблона
/**
* Настройки плагинов
*/
@ -94,7 +99,7 @@ $config['sys']['mail']['smtp']['auth'] = true; // Испо
*/
// Устанавливаем настройки кеширования
$config['sys']['cache']['use'] = true; // использовать кеширование или нет
$config['sys']['cache']['type'] = 'file'; // тип кеширования: file и memory. memory использует мемкеш
$config['sys']['cache']['type'] = 'file'; // тип кеширования: file, xcache и memory. memory использует мемкеш, xcache - использует XCache
$config['sys']['cache']['dir'] = '___path.root.server___/tmp/'; // каталог для файлового кеша, также используется для временных картинок. По умолчанию подставляем каталог для хранения сессий
$config['sys']['cache']['prefix'] = 'livestreet_cache'; // префикс кеширования, чтоб можно было на одной машине держать несколько сайтов с общим кешевым хранилищем
$config['sys']['cache']['directory_level'] = 1; // уровень вложенности директорий файлового кеша
@ -151,7 +156,6 @@ $config['module']['image']['default']['path']['fonts'] = '___path.root.se
$config['module']['image']['default']['jpg_quality'] = 95; // Число от 0 до 100
// Модуль Security
$config['module']['security']['key'] = "livestreet_security_key"; // ключ сессии для хранения security-кода
$config['module']['security']['hash'] = "livestreet_security_key"; // "примесь" к строке, хешируемой в качестве security-кода
// Модуль Ls
$config['module']['ls']['send_general'] = true; // Отправка на сервер LS общей информации о сайте (домен, версия LS и плагинов)

View file

@ -161,6 +161,12 @@ return array(
array('±', '©', '©', '®', '©', '©', '®')
)
),
// Список допустимых протоколов для ссылок
'cfgSetLinkProtocolAllow' => array(
array(
array('http','https','ftp')
)
),
'cfgSetTagNoTypography' => array(
array(
array('code','video','object')

View file

@ -18,7 +18,7 @@
/**
* Основные константы
*/
define('LS_VERSION','1.0.1');
define('LS_VERSION','1.0.2.dev');
/**
* Operations with Config object
@ -48,7 +48,7 @@ if ($hDirConfig = opendir($sDirConfig)) {
// то сливаем старые и новое значения ассоциативно
Config::Set(
$sKey,
func_array_merge_assoc(Config::Get($sKey), $aConfig)
func_array_merge_assoc(Config::Get($sKey), $aConfig)
);
}
}
@ -114,7 +114,7 @@ if ($hDirConfig = opendir($sDirConfig)) {
// то сливаем старые и новое значения ассоциативно
Config::Set(
$sKey,
func_array_merge_assoc(Config::Get($sKey), $aConfig)
func_array_merge_assoc(Config::Get($sKey), $aConfig)
);
}
}
@ -157,7 +157,7 @@ if($aPluginsList=@file($sPluginsListFile)) {
// то сливаем старые и новое значения ассоциативно
Config::Set(
$sKey,
func_array_merge_assoc(Config::Get($sKey), $aConfig)
func_array_merge_assoc(Config::Get($sKey), $aConfig)
);
}
}
@ -170,7 +170,7 @@ if($aPluginsList=@file($sPluginsListFile)) {
if($aIncludeFiles and count($aIncludeFiles)) {
foreach ($aIncludeFiles as $sPath) {
require_once($sPath);
}
}
}
}
}

View file

@ -111,7 +111,7 @@ abstract class Action extends LsObject {
}
/**
* Добавляет евент в экшен, используя регулярное вырожение для евента и параметров
* Добавляет евент в экшен, используя регулярное выражение для евента и параметров
*
*/
protected function AddEventPreg() {

View file

@ -1156,7 +1156,7 @@ class LS extends LsObject {
*
* @return Engine
*/
public function E() {
static public function E() {
return Engine::GetInstance();
}
/**
@ -1167,7 +1167,7 @@ class LS extends LsObject {
* @param array $aParams Параметры для передачи в конструктор
* @return Entity
*/
public function Ent($sName,$aParams=array()) {
static public function Ent($sName,$aParams=array()) {
return Engine::GetEntity($sName,$aParams);
}
/**
@ -1179,7 +1179,7 @@ class LS extends LsObject {
* @param DbSimple_Mysql|null $oConnect Объект коннекта к БД
* @return mixed
*/
public function Mpr($sClassName,$sName=null,$oConnect=null) {
static public function Mpr($sClassName,$sName=null,$oConnect=null) {
return Engine::GetMapper($sClassName,$sName,$oConnect);
}
/**
@ -1188,7 +1188,7 @@ class LS extends LsObject {
*
* @return ModuleUser_EntityUser
*/
public function CurUsr() {
static public function CurUsr() {
return self::E()->User_GetUserCurrent();
}
/**
@ -1198,7 +1198,7 @@ class LS extends LsObject {
*
* @return bool
*/
public function Adm() {
static public function Adm() {
return self::CurUsr() && self::CurUsr()->isAdministrator();
}
/**

2
engine/console/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

View file

@ -74,10 +74,10 @@ class PluginExample extends Plugin {
// Инициализация плагина
public function Init() {
$this->Viewer_AppendStyle(Plugin::GetTemplatePath(__CLASS__)."/css/style.css"); // Добавление своего CSS
$this->Viewer_AppendScript(Plugin::GetTemplatePath(__CLASS__)."/js/script.js"); // Добавление своего JS
$this->Viewer_AppendStyle(Plugin::GetTemplatePath(__CLASS__)."css/style.css"); // Добавление своего CSS
$this->Viewer_AppendScript(Plugin::GetTemplatePath(__CLASS__)."js/script.js"); // Добавление своего JS
//$this->Viewer_AddMenu('blog',Plugin::GetTemplatePath(__CLASS__).'/menu.blog.tpl'); // например, задаем свой вид меню
//$this->Viewer_AddMenu('blog',Plugin::GetTemplatePath(__CLASS__).'menu.blog.tpl'); // например, задаем свой вид меню
}
}
?>

2
engine/include/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

View file

@ -102,6 +102,19 @@ function getRequest($sName,$default=null,$sType=null) {
return $default;
}
/**
* функция доступа к GET POST параметрам, которая значение принудительно приводит к строке
*
* @param string $sName
* @param mixed $default
* @param string $sType
*
* @return string
*/
function getRequestStr($sName,$default=null,$sType=null) {
return (string)getRequest($sName,$default,$sType);
}
/**
* Определяет был ли передан указанный параметр методом POST
*

View file

@ -123,6 +123,8 @@ class Jevix{
protected $tagsStack;
protected $openedTag;
protected $autoReplace; // Автозамена
protected $linkProtocolAllow=array();
protected $linkProtocolAllowDefault=array('http','https','ftp');
protected $isXHTMLMode = true; // <br/>, <img/>
protected $isAutoBrMode = true; // \n = <br/>
protected $isAutoLinkMode = true;
@ -371,6 +373,23 @@ class Jevix{
$this->autoReplace = array('from' => $from, 'to' => $to);
}
/**
* Устанавливает список разрешенных протоколов для ссылок (http, ftp и т.п.)
*
* @param array $aProtocol Список протоколов
* @param bool $bClearDefault Удалить дефолтные протоколы?
*/
function cfgSetLinkProtocolAllow($aProtocol, $bClearDefault=false){
if (!is_array($aProtocol)) {
$aProtocol=array($aProtocol);
}
if ($bClearDefault) {
$this->linkProtocolAllow=$aProtocol;
} else {
$this->linkProtocolAllow=array_merge($this->linkProtocolAllowDefault,$aProtocol);
}
}
/**
* Включение или выключение режима XTML
*
@ -984,7 +1003,8 @@ class Jevix{
continue(2);
}
// HTTP в начале если нет
if(!preg_match('/^(http|https|ftp):\/\//ui', $value) && !preg_match('/^(\/|\#)/ui', $value) && !preg_match('/^(mailto):/ui', $value) ) $value = 'http://'.$value;
$sProtocols=join('|',$this->linkProtocolAllow ? $this->linkProtocolAllow : $this->linkProtocolAllowDefault);
if(!preg_match('/^('.$sProtocols.'):\/\//ui', $value) && !preg_match('/^(\/|\#)/ui', $value) && !preg_match('/^(mailto):/ui', $value) ) $value = 'http://'.$value;
break;
case '#image':

View file

@ -33,8 +33,8 @@ if(isset($_REQUEST[session_name()])){
}
foreach ($_REQUEST as $key => $value) {
if (preg_match("/^[\w\d]{5,40}$/",(string)$value)) {
session_name($key);
if (preg_match("/^.{5,100}$/",(string)$value)) {
@session_name($key);
session_start();
break;
}

View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

2
engine/modules/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

View file

@ -96,7 +96,7 @@ class ModulePlugin extends Module {
$this->Xlang($oXml,'name',$sLang);
$this->Xlang($oXml,'author',$sLang);
$this->Xlang($oXml,'description',$sLang);
$oXml->homepage=$this->Text_Parser($oXml->homepage);
$oXml->homepage=$this->Text_Parser((string)$oXml->homepage);
$oXml->settings=preg_replace('/{([^}]+)}/',Router::GetPath('$1'),$oXml->settings);
$this->aPluginsList[$sPlugin]['property']=$oXml;
@ -354,6 +354,7 @@ class ModulePlugin extends Module {
$aActivePlugins=$this->GetActivePlugins();
foreach ($aPlugins as $sPluginCode) {
if (!is_string($sPluginCode)) continue;
/**
* Если плагин активен, деактивируем его
*/

View file

@ -31,14 +31,14 @@
*/
class ModuleValidate_EntityValidatorEmail extends ModuleValidate_EntityValidator {
/**
* Регулярное вырожение для проверки емайла
* Регулярное выражение для проверки емайла
*
* @var string
* @see http://www.regular-expressions.info/email.html
*/
public $pattern='/^[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/';
/**
* Регулярное вырожение для проверки емайла с именем отправителя.
* Регулярное выражение для проверки емайла с именем отправителя.
* Используется только при allowName = true
*
* @var string

View file

@ -67,13 +67,13 @@ class ModuleValidate_EntityValidatorNumber extends ModuleValidate_EntityValidato
*/
public $msgTooSmall;
/**
* Регулярное вырожение для целого числа
* Регулярное выражение для целого числа
*
* @var string
*/
public $integerPattern='/^\s*[+-]?\d+\s*$/';
/**
* Регулярное вырожение для числа, допускается дробное
* Регулярное выражение для числа, допускается дробное
*
* @var string
*/

View file

@ -202,11 +202,12 @@ class ModuleViewer extends Module {
$this->sHtmlDescription=Config::Get('view.description');
/**
* Создаём объект Smarty и устанавливаем необходиму параметры
* Создаём объект Smarty и устанавливаем необходимые параметры
*/
$this->oSmarty = $this->CreateSmartyObject();
$this->oSmarty->error_reporting=error_reporting()^E_NOTICE; // подавляем NOTICE ошибки - в этом вся прелесть смарти )
$this->oSmarty->setTemplateDir(array_merge((array)Config::Get('path.smarty.template'),array(Config::Get('path.root.server').'/plugins/')));
$this->oSmarty->compile_check=Config::Get('smarty.compile_check');
/**
* Для каждого скина устанавливаем свою директорию компиляции шаблонов
*/
@ -214,7 +215,7 @@ class ModuleViewer extends Module {
if(!is_dir($sCompilePath)) @mkdir($sCompilePath);
$this->oSmarty->setCompileDir($sCompilePath);
$this->oSmarty->setCacheDir(Config::Get('path.smarty.cache'));
$this->oSmarty->setPluginsDir(array_merge(array(Config::Get('path.smarty.plug'),'plugins'),$this->oSmarty->getPluginsDir()));
$this->oSmarty->addPluginsDir(array(Config::Get('path.smarty.plug'),'plugins'));
/**
* Получаем настройки JS, CSS файлов
*/
@ -1029,13 +1030,12 @@ class ModuleViewer extends Module {
* использует файловое кеширование
*
* @param array $aFiles Список файлов
* @param string $sType Тип файло - js, css
* @param string $sType Тип файла - js, css
* @return array
*/
protected function Compress($aFiles,$sType) {
$sCacheDir = $this->sCacheDir."/".Config::Get('view.skin');
$sCacheName = $sCacheDir."/".md5(serialize($aFiles).'_head').".{$sType}";
$sPathServer = Config::Get('path.root.server');
$sPathWeb = Config::Get('path.root.web');
/**
* Если кеш существует, то берем из кеша
@ -1054,7 +1054,7 @@ class ModuleViewer extends Module {
ob_start();
foreach ($aFiles as $sFile) {
// если файл локальный
if (strpos($sFile,Config::Get('path.root.web'))!==false) {
if (strpos($sFile, $sPathWeb)!==false) {
$sFile=$this->GetServerPath($sFile);
}
list($sFile,)=explode('?',$sFile,2);

View file

@ -1,5 +1,5 @@
{hook run='content_end'}
</div> <!-- /content -->
{hook run='content_end'}
</div> <!-- /content -->
{if !$noSidebar}
{include file='sidebar.tpl'}