VDS под LiveStreet CMS
Проверенные дешевые VDS под LiveStreet CMS
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<name>
<lang name="default">TopBlogs2</lang>
</name>
<author>
<lang name="default">Begetan</lang>
</author>
<homepage></homepage>
<version>0.1</version>
<requires>
<livestreet>0.5.0</livestreet>
<plugins>
</plugins>
</requires>
<description>
<lang name="default">Show top rated blogs by count of posts instead of standart LiveStreet blog's rating</lang>
<lang name="russian">Выводит топ блогов по количеству постов, а не по стандартному рейтингу блогов LiveStreet</lang>
</description>
</plugin>
if (!class_exists('Plugin')) die('Are you sure?');
class PluginTopBlogs2 extends Plugin
{
protected $aInherits=array(
'module' => array('ModuleBlog' => '_ModuleTop'),
);
public function Activate() {
return true;
}
public function Init() {
}
}
<?php
class PluginTopBlogs2_ModuleTop extends PluginTopBlogs2_Inherit_ModuleBlog {
protected $oMapperBlog2;
public function GetBlogsRating($iCurrPage,$iPerPage) {
$this->oMapperBlog2 = Engine::GetMapper ( __CLASS__ );
# $aResult=parent::GetBlogsRating($iCurrPage, $iPerPage);
$aResult=$this->GetTopBlogsByPosts($iCurrPage, $iPerPage);
return $aResult;
}
public function GetTopBlogsByPosts($iCurrPage,$iPerPage) {
list ($aTopBlogs, $aRating) = $this->oMapperBlog2->GetTopBlogsByPosts($iCount,$iCurrPage,$iPerPage);
$data = array('collection'=>$aTopBlogs,'count'=>$iCount);
$aBlogs = parent::GetBlogsAdditionalData($data['collection'],array('owner'=>array(),'relation_user'));
# Подменяем рейтинг блога на новый
foreach ( $aBlogs as $oBlog ) {
$oBlog->setRating($aRating[$oBlog->getId()]);
$data2[] = $oBlog;
}
# Обновляем список блогов
$data['collection'] = $data2;
return $data;
}
}
?>
<?php
class PluginTopBlogs2_ModuleTop_MapperTop extends Mapper {
public function GetTopBlogsByPosts (&$iCount,$iCurrPage,$iPerPage) {
$sql = "SELECT t.blog_id, COUNT(t.blog_id) as rating " .
"FROM ".Config::Get('db.table.topic')." as t " .
"GROUP BY t.blog_id " .
"ORDER BY 2 DESC " .
"LIMIT ?d, ?d";
$aReturn=array();
$aReturn2=array();
if ($aRows=$this->oDb->selectPage($iCount,$sql,($iCurrPage-1)*$iPerPage, $iPerPage)) {
foreach ($aRows as $aRow) {
$aReturn[]=$aRow['blog_id'];
$aReturn2[$aRow['blog_id']]=$aRow['rating'];
}
}
return array ($aReturn, $aReturn2);
}
}
?>
find путь/к/лайвстриту/ -type f \( -name '*.tpl' -o -name '*.php' \) -exec sed -i '1 s/^\xef\xbb\xbf//' {} \;
find ./ -type f \( -name '*.tpl' -o -name '*.php' \) -exec sed -i -e '1 s/^\xef\xbb\xbf//' {} \;
php -r "ob_start();
passthru('find ./ -type f \( -name \'*.tpl\' -o -name \'*.php\' \) -print0 | xargs -0r awk \'/^\xEF\xBB\xBF/ {print FILENAME}{nextfile}\'');
foreach(array_filter(explode(\"\n\",ob_get_clean())) as \$f){
echo \"remove BOM from \$f...\n\";
file_put_contents(\$f, substr(file_get_contents(\$f), 3));
};"