Skip to content

Commit

Permalink
Merge master commit 'ac528e6a2300b092ad285339bf0c002b030c3be2' into f…
Browse files Browse the repository at this point in the history
…ramework
  • Loading branch information
mzhelskiy committed Jan 26, 2013
1 parent e0afa53 commit a410bbc
Show file tree
Hide file tree
Showing 28 changed files with 849 additions and 126 deletions.
15 changes: 10 additions & 5 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ RewriteRule ^(.*)$ ./index.php
# Alternative rule
#RewriteRule ^(.*)$ /index.php


# Deny access
<Files "plugins.dat">
order allow,deny
deny from all
order allow,deny
deny from all
</Files>
<Files "plugin.xml">
order allow,deny
deny from all
order allow,deny
deny from all
</Files>

<Files ~ "\.tpl$">
Order allow,deny
Deny from all
</Files>
83 changes: 83 additions & 0 deletions classes/modules/tools/Tools.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/*-------------------------------------------------------
*
* LiveStreet Engine Social Networking
* Copyright © 2008 Mzhelskiy Maxim
*
*--------------------------------------------------------
*
* Official site: www.livestreet.ru
* Contact e-mail: rus.engine@gmail.com
*
* GNU General Public License, version 2:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
---------------------------------------------------------
*/

/**
* Модуль Tools - различные вспомогательные методы
*
* @package modules.tools
* @since 1.0
*/
class ModuleTools extends Module {
/**
* Инициализация
*
*/
public function Init() {

}

/**
* Строит логарифмическое облако - расчитывает значение size в зависимости от count
* У объектов в коллекции обязательно должны быть методы getCount() и setSize()
*
* @param aray $aCollection Список тегов
* @param int $iMinSize Минимальный размер
* @param int $iMaxSize Максимальный размер
* @return array
*/
public function MakeCloud($aCollection,$iMinSize=1,$iMaxSize=10) {
if (count($aCollection)) {
$iSizeRange=$iMaxSize-$iMinSize;

$iMin=10000;
$iMax=0;
foreach($aCollection as $oObject) {
if ($iMax<$oObject->getCount()) {
$iMax=$oObject->getCount();
}
if ($iMin>$oObject->getCount()) {
$iMin=$oObject->getCount();
}
}
$iMinCount=log($iMin+1);
$iMaxCount=log($iMax+1);
$iCountRange=$iMaxCount-$iMinCount;
if ($iCountRange==0) {
$iCountRange=1;
}
foreach($aCollection as $oObject) {
$iTagSize=$iMinSize+(log($oObject->getCount()+1)-$iMinCount)*($iSizeRange/$iCountRange);
$oObject->setSize(round($iTagSize));
}
}
return $aCollection;
}

/**
* Преобразует спец символы в html последовательнось, поведение аналогично htmlspecialchars, кроме преобразования амперсанта "&"
*
* @param string $sText
*
* @return string
*/
public function Urlspecialchars($sText) {
$aTable=get_html_translation_table();
unset($aTable['&']);
return strtr($sText,$aTable);
}
}
?>
3 changes: 3 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@
"___path.root.engine_lib___/external/jquery/jquery.charcount.js",
"___path.root.engine_lib___/external/prettify/prettify.js",
"___path.root.server___/templates/framework/js/main.js",
"___path.root.server___/templates/framework/js/dropdown.js",
"___path.root.server___/templates/framework/js/modal.js",
"___path.root.server___/templates/framework/js/tab.js",
"___path.root.server___/templates/framework/js/hook.js",
);
$config['head']['default']['css'] = array(
Expand Down
4 changes: 2 additions & 2 deletions config/jevix.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'cfgAllowTags' => array(
// вызов метода с параметрами
array(
array('ls','cut','a', 'img', 'i', 'b', 'u', 's', 'small', 'video', 'em', 'strong', 'nobr', 'li', 'ol', 'ul', 'sup', 'abbr', 'sub', 'acronym', 'h4', 'h5', 'h6', 'br', 'hr', 'pre', 'code', 'object', 'param', 'embed', 'blockquote', 'iframe','table','tbody','thead','th','tr','td'),
array('ls','cut','a', 'img', 'i', 'b', 'u', 's', 'small', 'video', 'em', 'strong', 'nobr', 'li', 'ol', 'ul', 'sup', 'abbr', 'sub', 'acronym', 'h4', 'h5', 'h6', 'br', 'hr', 'pre', 'code', 'codeline', 'object', 'param', 'embed', 'blockquote', 'iframe','table','tbody','thead','th','tr','td'),
),
),
// Коротие теги типа
Expand All @@ -18,7 +18,7 @@
// Преформатированные теги
'cfgSetTagPreformatted' => array(
array(
array('pre','code','video')
array('pre','code','codeline','video')
),
),
// Разрешённые параметры тегов
Expand Down
2 changes: 1 addition & 1 deletion config/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Основные константы
*/
define('LS_VERSION','1.0.2.dev');
define('LS_VERSION','1.1.0.dev');

/**
* Operations with Config object
Expand Down
14 changes: 14 additions & 0 deletions engine/classes/MapperORM.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,29 @@ public static function GetTableName($oEntity) {
* Варианты таблиц:
* prefix_user -> если модуль совпадает с сущностью
* prefix_user_invite -> если модуль не сопадает с сущностью
* Если сущность плагина:
* prefix_pluginname_user
* prefix_pluginname_user_invite
*/
$sClass = Engine::getInstance()->Plugin_GetDelegater('entity', is_object($oEntity)?get_class($oEntity):$oEntity);
$sPluginName = func_underscore(Engine::GetPluginName($sClass));
$sModuleName = func_underscore(Engine::GetModuleName($sClass));
$sEntityName = func_underscore(Engine::GetEntityName($sClass));
if (strpos($sEntityName,$sModuleName)===0) {
$sTable=func_underscore($sEntityName);
} else {
$sTable=func_underscore($sModuleName).'_'.func_underscore($sEntityName);
}
if ($sPluginName) {
$sTablePlugin=$sPluginName.'_'.$sTable;
/**
* Для обратной совместимости с 1.0.1
* Если такая таблица определена в конфиге, то ок, если нет, то используем старый вариант без имени плагина
*/
if (Config::Get('db.table.'.$sTablePlugin)) {
$sTable=$sTablePlugin;
}
}
/**
* Если название таблиц переопределено в конфиге, то возвращаем его
*/
Expand Down
3 changes: 2 additions & 1 deletion engine/include/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ function func_encrypt($sData) {
* @return unknown
*/
function func_getIp() {
return $_SERVER['REMOTE_ADDR'];
// Если запускаем через консоль, то REMOTE_ADDR не определен
return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
}


Expand Down
2 changes: 1 addition & 1 deletion engine/lib/external/Jevix/jevix.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ protected function makeTag($tag, $params, $content, $short, $parentTag = null){

// Если тег обрабатывает "полным" колбеком
if (isset($tagRules[self::TR_TAG_CALLBACK_FULL])) {
$text = call_user_func($tagRules[self::TR_TAG_CALLBACK_FULL], $tag, $resParams);
$text = call_user_func($tagRules[self::TR_TAG_CALLBACK_FULL], $tag, $resParams, $content);
} else {
// Собираем тег
$text='<'.$tag;
Expand Down
2 changes: 2 additions & 0 deletions engine/modules/text/Text.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ protected function FlashParamParser($sText) {
public function CodeSourceParser($sText) {
$sText=str_replace("<code>",'<pre class="prettyprint">',$sText);
$sText=str_replace("</code>",'</pre>',$sText);
$sText=str_replace("<codeline>",'<code class="prettyprint">',$sText);
$sText=str_replace("</codeline>",'</code>',$sText);
return $sText;
}
/**
Expand Down
6 changes: 3 additions & 3 deletions engine/modules/viewer/Viewer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function VarAssign() {
$this->Assign("sHtmlDescription",htmlspecialchars($this->sHtmlDescription));
$this->Assign("aHtmlHeadFiles",$this->aHtmlHeadFiles);
$this->Assign("aHtmlRssAlternate",$this->aHtmlRssAlternate);
$this->Assign("sHtmlCanonical",$this->sHtmlCanonical);
$this->Assign("sHtmlCanonical",$this->Tools_Urlspecialchars($this->sHtmlCanonical));
/**
* Загружаем список активных плагинов
*/
Expand Down Expand Up @@ -1365,7 +1365,7 @@ public function MakePaging($iCount,$iCurrentPage,$iCountPerPage,$iCountPageLine,
'iCurrentPage' => $iCurrentPage,
'iNextPage' => $iNextPage,
'iPrevPage' => $iPrevPage,
'sBaseUrl' => rtrim($sBaseUrl,'/'),
'sBaseUrl' => rtrim($this->Tools_Urlspecialchars($sBaseUrl),'/'),
'sGetParams' => $sGetParams,
);
/**
Expand Down Expand Up @@ -1457,4 +1457,4 @@ public function Shutdown() {
$this->MenuVarAssign();
}
}
?>
?>
2 changes: 1 addition & 1 deletion templates/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Options -Indexes
<Files ~ "\.tpl$">
<Files ~ "(\.tpl)|(\.php)$">
Order allow,deny
Deny from all
</Files>
68 changes: 68 additions & 0 deletions templates/framework/css/buttons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Buttons
*/

.button {
display: inline-block;

padding: 4px 12px;
margin: 0;

text-align: center;
vertical-align: middle;
text-decoration: none;

font-size: 14px;
line-height: 20px;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);

border: 1px solid #ddd;
border-radius: 4px;

color: #333;

background: #fafafa;
background: -moz-linear-gradient(top, #fff 0%, #e6e6e6 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fff), color-stop(100%,#e6e6e6));
background: -webkit-linear-gradient(top, #fff 0%,#e6e6e6 100%);
background: -o-linear-gradient(top, #fff 0%,#e6e6e6 100%);
background: -ms-linear-gradient(top, #fff 0%,#e6e6e6 100%);
background: linear-gradient(top, #fff 0%,#e6e6e6 100%);

-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);

cursor: pointer;

*margin-right: 5px;
*border: 0;
}
.button:hover { text-decoration: none; background: #eee; }
.button:active,
.button.active {
background: #eaeaea;
border-color: #ccc;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .2) inset;
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, .2) inset;
box-shadow: 0 0 5px rgba(0, 0, 0, .2) inset;
}
.button.fl-r { *margin-right: 0; }


/* Button Primary */
.button.button-primary {
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);

background: #006DCC;
background: -moz-linear-gradient(top, #0088cc 0%, #0044cc 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0088cc), color-stop(100%,#0044cc));
background: -webkit-linear-gradient(top, #0088cc 0%,#0044cc 100%);
background: -o-linear-gradient(top, #0088cc 0%,#0044cc 100%);
background: -ms-linear-gradient(top, #0088cc 0%,#0044cc 100%);
background: linear-gradient(top, #0088cc 0%,#0044cc 100%);
}
.button.button-primary:hover { background: #0044cc; }
.button.button-primary.active { background: #006DCC; }
59 changes: 59 additions & 0 deletions templates/framework/css/dropdowns.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Dropdowns
*
* TODO: Add submenu
* TODO: Add arrow support in IE7
*/


/* Base class */
.dropdown {
display: inline-block;
*display: inline; *zoom: 1; /* IE7 */
background: #2891d3;
color: #fff;
border-radius: 2px;
padding: 5px 12px;
margin-bottom: 10px;
}


/* Dropdown toggle */
.dropdown-toggle {
padding-right: 25px !important;
position: relative;
*zoom: 1;
cursor: pointer;
}
.dropdown-toggle:after {
content: "";
position: absolute;
top: 50%; right: 9px;
height: 0; width: 0;
margin-top: -1px;
border: 4px solid transparent; /* IE7 */
border: 4px solid rgba(255,255,255,0);
border-top-color: #fff;
}
.dropdown-toggle.open { background: #0088cc; color: #fff; }
.dropdown-toggle.open:after { border-top-color: #fff; }


/* Dropdown menu */
.dropdown-menu {
position: absolute;
top: 0; left: 0;
z-index: 900;
display: none;
min-width: 150px;
padding: 5px 0;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 6px;
box-shadow: 0 5px 10px rgba(0,0,0,.2);
}
.dropdown-menu li > a { display: block; padding: 5px 12px; white-space: nowrap; }
.dropdown-menu > li.active > a { background: #c8ecff; color: #48a4d5; }
.dropdown-menu > li > a:hover { background: #0088cc; color: #fff; }

.dropdown-menu > li.divider { height: 0; border-top: 1px solid #e1e1e1; margin: 5px 0; }
Loading

0 comments on commit a410bbc

Please sign in to comment.