1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Merge pull request #3 from livestreet/master

update
This commit is contained in:
vatseek 2013-03-31 23:59:34 -07:00
commit 5dc19f68f3
7 changed files with 166 additions and 9 deletions

View file

@ -2,6 +2,7 @@ language: php
php:
- 5.3
- 5.4
before_script:
# export virtual display

View file

@ -79,6 +79,67 @@ return array(
array('border'=>'#int','cellpadding'=>'#int','cellspacing'=>'#int','align'=>array('right', 'left', 'center'),'height'=>'#int','width'=>'#int')
),
),
// допустимые комбинации значений у параметров
'cfgSetTagParamCombination' => array(
array(
'param',
'name',
array(
'allowScriptAccess' => array(
'value'=>array('sameDomain'),
),
'movie' => array(
'value'=>array('#domain'=>array('youtube.com','rutube.ru','vimeo.com')),
),
'align' => array(
'value'=>array('bottom','middle','top','left','right'),
),
'base' => array(
'value'=>true,
),
'bgcolor' => array(
'value'=>true,
),
'border' => array(
'value'=>true,
),
'devicefont' => array(
'value'=>true,
),
'flashVars' => array(
'value'=>true,
),
'hspace' => array(
'value'=>true,
),
'quality' => array(
'value'=>array('low','medium','high','autolow','autohigh','best'),
),
'salign' => array(
'value'=>array('L','T','R','B','TL','TR','BL','BR'),
),
'scale' => array(
'value'=>array('scale','showall','noborder','exactfit'),
),
'tabindex' => array(
'value'=>true,
),
'title' => array(
'value'=>true,
),
'type' => array(
'value'=>true,
),
'vspace' => array(
'value'=>true,
),
'wmode' => array(
'value'=>array('window','opaque','transparent'),
),
),
true, // Удалять тег, если нет основного значения параметра в списке комбинаций
),
),
// Параметры тегов являющиеся обязательными
'cfgSetTagParamsRequired' => array(
array(

View file

@ -157,6 +157,7 @@ class Jevix{
const TR_TAG_CALLBACK = 15; // Тег обрабатывается callback-функцией - в обработку уходит только контент тега(короткие теги не обрабатываются)
const TR_TAG_BLOCK_TYPE = 16; // Тег после которого не нужна автоподстановка доп. <br>
const TR_TAG_CALLBACK_FULL = 17; // Тег обрабатывается callback-функцией - в обработку уходит весь тег
const TR_PARAM_COMBINATION = 18; // Проверка на возможные комбинации значений параметров тега
/**
* Классы символов генерируются symclass.php
@ -362,7 +363,46 @@ class Jevix{
if(!isset($this->tagsRules[$tag])) throw new Exception("Тег $tag отсутствует в списке разрешённых тегов");
$this->tagsRules[$tag][self::TR_TAG_CALLBACK_FULL] = $callback;
}
/**
* КОНФИГУРАЦИЯ: Устанавливаем комбинации значений параметров для тега
*
* @param string $tag тег
* @param string $param атрибут
* @param array $aCombinations Список комбинаций значений. Пример: array('myvalue'=>array('attr1'=>array('one','two'),'attr2'=>'other'))
* @param bool $bRemove Удаляеть тег или нет, если в списке нет значения основного атрибута
*/
function cfgSetTagParamCombination($tag, $param, $aCombinations,$bRemove=false){
if(!isset($this->tagsRules[$tag])) throw new Exception("Tag $tag is missing in allowed tags list");
if(!isset($this->tagsRules[$tag][self::TR_PARAM_COMBINATION])) {
$this->tagsRules[$tag][self::TR_PARAM_COMBINATION] = array();
}
/**
* Переводим в нижний регистр значений параметров
* Ужасный код
*/
$aCombinationsResult=array();
foreach($aCombinations as $k=>$aAttr) {
$aAttrResult=array();
foreach($aAttr as $kk => $mValue) {
if (is_string($mValue)) {
$mValue=mb_strtolower($mValue);
} elseif (is_array($mValue)) {
foreach($mValue as $kkk=>$vvv) {
if (is_string($vvv)) {
$mValue[$kkk]=mb_strtolower($vvv);
}
}
}
$aAttrResult[$kk]=$mValue;
}
$aCombinationsResult[mb_strtolower($k)]=$aAttrResult;
}
$this->tagsRules[$tag][self::TR_PARAM_COMBINATION][$param] = array('combination'=>$aCombinationsResult,'remove'=>$bRemove);
}
/**
* Автозамена
*
@ -1050,7 +1090,52 @@ class Jevix{
if (!isset($tagRules[self::TR_TAG_IS_EMPTY]) or !$tagRules[self::TR_TAG_IS_EMPTY]) {
if(!$short && $content == '') return '';
}
// Проверка на допустимые комбинации
if (isset($tagRules[self::TR_PARAM_COMBINATION])) {
$aRuleCombin=$tagRules[self::TR_PARAM_COMBINATION];
$resParamsList=$resParams;
foreach($resParamsList as $param => $value) {
$value=mb_strtolower($value);
if (isset($aRuleCombin[$param]['combination'][$value])) {
foreach($aRuleCombin[$param]['combination'][$value] as $sAttr=>$mValue) {
if (isset($resParams[$sAttr])) {
$bOK=false;
$sValueParam=mb_strtolower($resParams[$sAttr]);
if (is_string($mValue)) {
if ($mValue==$sValueParam) {
$bOK=true;
}
} elseif(is_array($mValue)) {
if (isset($mValue['#domain']) and is_array($mValue['#domain'])) {
if(!preg_match('/javascript:/ui', $sValueParam)) {
foreach ($mValue['#domain'] as $sDomain) {
$sDomain=preg_quote($sDomain);
if (preg_match("@^(http|https|ftp)://([\w\d]+\.)?{$sDomain}/@ui",$sValueParam)) {
$bOK=true;
break;
}
}
}
} elseif (in_array($sValueParam, $mValue)) {
$bOK=true;
}
} elseif($mValue===true) {
$bOK=true;
}
if (!$bOK) {
unset($resParams[$sAttr]);
}
}
}
} elseif(isset($aRuleCombin[$param]['remove']) and $aRuleCombin[$param]['remove']) {
return '';
}
}
}
// Если тег обрабатывает "полным" колбеком
if (isset($tagRules[self::TR_TAG_CALLBACK_FULL])) {
$text = call_user_func($tagRules[self::TR_TAG_CALLBACK_FULL], $tag, $resParams, $content);

Binary file not shown.

View file

@ -76,11 +76,24 @@ class ModuleSession extends Module {
Config::Get('sys.session.host')
);
if(!session_id()) {
/**
* Попытка подменить идентификатор имени сессии через куку
*/
if (isset($_COOKIE[Config::Get ('sys.session.name')]) and !is_string($_COOKIE[Config::Get ('sys.session.name')])) {
die("Hacking attemp! Please check cookie PHP session name.");
}
/**
* Попытка подменить идентификатор имени сессии в реквесте
*/
$aRequest=array_merge($_GET,$_POST); // Исключаем попадаение $_COOKIE в реквест
if (@ini_get ('session.use_only_cookies') === "0" and isset($aRequest[Config::Get ('sys.session.name')]) and !is_string($aRequest[Config::Get ('sys.session.name')])) {
die("Hacking attemp! Please check cookie PHP session name.");
}
/**
* Даем возможность флешу задавать id сессии
*/
$sUserAgent=isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
if ($sUserAgent and (in_array($sUserAgent,$this->aFlashUserAgent) or strpos($sUserAgent,"Adobe Flash Player")===0) and preg_match("/^[\w\d]{5,40}$/",getRequest('SSID'))) {
if ($sUserAgent and (in_array($sUserAgent,$this->aFlashUserAgent) or strpos($sUserAgent,"Adobe Flash Player")===0) and is_string(getRequest('SSID')) and preg_match("/^[\w\d]{5,40}$/",getRequest('SSID'))) {
session_id(getRequest('SSID'));
} else {
session_regenerate_id();

View file

@ -1,6 +1,3 @@
{include file='window_load_img.tpl' sToLoad='page_text'}
{if $oConfig->GetValue('view.tinymce')}
<script type="text/javascript" src="{cfg name='path.root.engine_lib'}/external/tinymce-jq/tiny_mce.js"></script>
{literal}
@ -12,7 +9,7 @@
{/literal}
{else}
{include file='window_load_img.tpl' sToLoad='page_text'}
{include file='modals/modal_load_img.tpl' sToLoad='page_text'}
<script type="text/javascript">
jQuery(function($){
ls.lang.load({lang_load name="panel_b,panel_i,panel_u,panel_s,panel_url,panel_url_promt,panel_code,panel_video,panel_image,panel_cut,panel_quote,panel_list,panel_list_ul,panel_list_ol,panel_title,panel_clear_tags,panel_video_promt,panel_list_li,panel_image_promt,panel_user,panel_user_promt"});

View file

@ -660,7 +660,7 @@ return array(
'settings_profile_photo_change' => 'Channge photo',
'settings_profile_photo_upload' => 'Upload photo',
'settings_profile_field_error_max' => 'You can not add more than %%count%% identical contacts',
'settings_profile_submit' => 'save profile',
'settings_profile_submit' => 'Save profile',
'settings_profile_submit_ok' => 'Profile successfully saved',
'settings_invite' => 'Invitations management',
'settings_invite_notice' => 'You can invite to the site of his friends to do this, simply enter their e-mail and click',
@ -1208,4 +1208,4 @@ return array(
'14' => '[UTC + 14] Line Island Time'
)
);
?>
?>