HowTo Simpla CMS - NULL INFO

ifelse

Team member
VIP Simple
Verified
Joined
Nov 27, 2015
Messages
932
Reaction score
342
Как обнулить / собрать свой вылеченный дистрибутив Simpla CMS ?

Спасибо за информацию от ув. spl33n. Немного допиливаю инструкцию.

Скачиваем последний дистрибутив Simpla CMS с .

Распаковываем simpla.zip

Распаковываем simpla_source.zip в папку simpla_source, и в конце, после изменения всех необходимых файлов, делаем новый архив из папки /simpla_source в архив simpla_source.zip

0. В файле /api/Managers.php
Меняем строчку:
PHP:
    public $permissions_list = array('products', 'categories', 'brands', 'features', 'orders', 'labels',
       'users', 'groups', 'coupons', 'pages', 'blog', 'comments', 'feedbacks', 'import', 'export',
       'backup', 'stats', 'design', 'settings', 'currency', 'delivery', 'payment', 'managers', 'license');
На следующую:
PHP:
    public $permissions_list = array('products', 'categories', 'brands', 'features', 'orders', 'labels',
       'users', 'groups', 'coupons', 'pages', 'blog', 'comments', 'feedbacks', 'import', 'export',
       'backup', 'stats', 'design', 'settings', 'currency', 'delivery', 'payment', 'managers');

1. /simpla_source/config/config.php
удаляем строчку номер 3:
PHP:
license = xxxxxxxx xxxxxxxxxx ...

2. Удаляем файл:
/simpla_source/simpla/LicenseAdmin.php

3. В файле
/simpla_source/simpla/IndexAdmin.php
корректно! удаляем строчку номер 52:
PHP:
      'LicenseAdmin' => 'license'

А точнее приводим строчки 51-52:
PHP:
       'ManagerAdmin'        => 'managers',
       'LicenseAdmin'        => 'license'
К следующему виду:
PHP:
       'ManagerAdmin'        => 'managers'
- без запятой в конце!

4. В файле
/simpla_source/simpla/IndexAdmin.php
удаляем строчки номер 61-84 (62-85):
PHP:
       $p=11; $g=2; $x=7; $r = ''; $s = $x;
       $bs = explode(' ', $this->config->license);
       foreach($bs as $bl){
           for($i=0, $m=''; $i<strlen($bl)&&isset($bl[$i+1]); $i+=2){
               $a = base_convert($bl[$i], 36, 10)-($i/2+$s)%26;
               $b = base_convert($bl[$i+1], 36, 10)-($i/2+$s)%25;
               $m .= ($b * (pow($a,$p-$x-1) )) % $p;}
           $m = base_convert($m, 10, 16); $s+=$x;
           for ($a=0; $a<strlen($m); $a+=2) $r .= @chr(hexdec($m{$a}.$m{($a+1)}));}

       @list($l->domains, $l->expiration, $l->comment) = explode('#', $r, 3);

       $l->domains = explode(',', $l->domains);
       $h = getenv("HTTP_HOST");
       if(substr($h, 0, 4) == 'www.') $h = substr($h, 4);
       if((!in_array($h, $l->domains) || (strtotime($l->expiration)<time() && $l->expiration!='*')) && $this->request->get('module')!='LicenseAdmin')
           header('location: '.$this->config->root_url.'/simpla/index.php?module=LicenseAdmin');
         else
         {
             $l->valid = true;
           $this->design->assign('license', $l);
       }
 
       $this->design->assign('license', $l);


5. В файле /simpla_source/index.php
Удаляем строки 56-75 которые выглядят так:
PHP:
$p=11; $g=2; $x=7; $r = ''; $s = $x;
$bs = explode(' ', $view->config->license);
foreach($bs as $bl){
   for($i=0, $m=''; $i<strlen($bl)&&isset($bl[$i+1]); $i+=2){
       $a = base_convert($bl[$i], 36, 10)-($i/2+$s)%26;
       $b = base_convert($bl[$i+1], 36, 10)-($i/2+$s)%25;
       $m .= ($b * (pow($a,$p-$x-1) )) % $p;}
   $m = base_convert($m, 10, 16); $s+=$x;
   for ($a=0; $a<strlen($m); $a+=2) $r .= @chr(hexdec($m{$a}.$m{($a+1)}));}

@list($l->domains, $l->expiration, $l->comment) = explode('#', $r, 3);

$l->domains = explode(',', $l->domains);

$h = getenv("HTTP_HOST");
if(substr($h, 0, 4) == 'www.') $h = substr($h, 4);
if((!in_array($h, $l->domains) || (strtotime($l->expiration)<time() && $l->expiration!='*')))
{
   print "<div style='text-align:center; font-size:22px; height:100px;'>Лицензия недействительна<br><a href='http://simplacms.ru'>Скрипт интернет-магазина Simpla</a></div>";
}

6. Удалить строчки 21-22 в файле /simpla_source/simpla/design/html/license.tpl
PHP:
<input class="button_green button_save" type="submit" name="" value="Сохранить" />
<a href='http://simplacms.ru/check?domain={$smarty.server.HTTP_HOST|escape}'>Проверить лицензию</a>

7. Удалить строчки 117-124 в файле /simpla_source/simpla/design/html/index.tpl
PHP:
   {if in_array('license', $manager->permissions)}
       {if $license->valid}
       Лицензия действительна {if $license->expiration != '*'}до {$license->expiration}{/if} для домен{$license->domains|count|plural:'а':'ов'} {foreach $license->domains as $d}{$d}{if !$d@last}, {/if}{/foreach}.
       <a href='index.php?module=LicenseAdmin'>Управление лицензией</a>.
       {else}
       Лицензия недействительна. <a href='index.php?module=LicenseAdmin'>Управление лицензией</a>.
       {/if}
   {/if}

7.1. Заменить строчки 106-107 в файле /simpla_source/simpla/design/html/manager.tpl
Заменить строчки:
PHP:
                   'managers'   =>'Менеджеры',
                   'license'    =>'Управление лицензией'
на следующие:
PHP:
                   'managers'   =>'Менеджеры'

Теперь можно создать архив из вашей папки /simpla_source/*.* в simpla_source.zip
Важно! Архив .zip должен быть создан так же как и оригинал, т.е. при открытии архива вы должны видеть в корне архива сразу все папки с файлами cms: ajax, api, cache и т.д.

После созданного архива simpla_source.zip проделываем заключительные действия:

8. В файле /install.php
удаляем строчки номер 55-56:
PHP:
           case 'license':
               license(); break;
8.1. В файле /install.php
удаляем строчки номер 275-329 (277-327):
PHP:
//
//  Настройка лицензии
//
function license()
{
   $license = '';
   $error = '';

   if($result = file_get_contents("http://license.simplacommerce.com/index.php?host=".$_SERVER['HTTP_HOST']))
   {
        $testlicense = $result;
   }


   if(!empty($_POST['license']))
   {
       $license = $_POST['license'];
       if(!$enddate = check_license($license))
       {
           $error = 'Лицензия недействительна';
       }
       elseif(!is_writable('config/config.php'))
       {
           $error = 'Поставьте права на запись для файла config/config.php';
       }
       else
       {
           # Запишем конфиги с базой
           $conf = file_get_contents('config/config.php');
           $conf = preg_replace("/license.*/i", 'license = "'.$license.'"', $conf);
           $cf = fopen('config/config.php', 'w');
           fwrite($cf, $conf);
           fclose($cf);
 
           print "<p>Благодарим вас за использование лицензионной версии Simpla!</p>";
           print "<p>Ваша лицензия действительна до: $enddate;</p>";
           print "<p><form method=get><input type='hidden' name='step' value='final'><input type='submit' value='продолжить →'></form></p>";
           exit();
       }

 
 
   }

   print "<p>Для работы Simpla необходим лицензионный ключ:</p>";
   if(!empty($error))
       print "<p class=error>$error</p>";
   print "<p><form method=post name=license><textarea name=license style='width:600px; height:100px;'>".$_POST['license']."</textarea>";
   if(!empty($testlicense))
   print "<table><tr><td><p><input type='button' value='получить тестовый ключ' onclick=\"document.license.license.value='$testlicense';\"></p></td><td><p><input type='hidden' name='step' value='license'><input type='submit' value='продолжить →'></form></p></td></tr></table>";
   else
   print "<table><tr><td><p><a target=_blank href='http://license.simplacommerce.com/index.php?domain=".$_SERVER['HTTP_HOST']."'>Получить тестовый ключ</a></p></td><td><p><input type='hidden' name='step' value='license'><input type='submit' value='продолжить →'></form></p></td></tr></table>";
 

}

8.2. Для корректной установки скрипта в файле /install.php находим и меняем строчку (примерно в пределах) 310-313:
НАХОДИМ:
PHP:
           print "<p><form method=get><input type='hidden' name='step' value='license'><input type='submit' value='продолжить >'></form></p>";
МЕНЯЕМ НА:
PHP:
           print "<p><form method=get><input type='hidden' name='step' value='final'><input type='submit' value='продолжить >'></form></p>";

8.3. В файле /install.php удаляем строчки:
PHP:
function check_license($license)
{
       $p=11; $g=2; $x=7; $r = ''; $s = $x;
       $bs = explode(' ', $license);   
       foreach($bs as $bl){
           for($i=0, $m=''; $i<strlen($bl)&&isset($bl[$i+1]); $i+=2){
               $a = base_convert($bl[$i], 36, 10)-($i/2+$s)%26;
               $b = base_convert($bl[$i+1], 36, 10)-($i/2+$s)%25;
               $m .= ($b * (pow($a,$p-$x-1) )) % $p;}
           $m = base_convert($m, 10, 16); $s+=$x;
           for ($a=0; $a<strlen($m); $a+=2) $r .= @chr(hexdec($m{$a}.$m{($a+1)}));}

       @list($l->domains, $l->expiration, $l->comment) = explode('#', $r, 3);

       $l->domains = explode(',', $l->domains);

       $h = getenv("HTTP_HOST");
       if(substr($h, 0, 4) == 'www.') $h = substr($h, 4);
       if(!in_array($h, $l->domains) || (strtotime($l->expiration)<time() && $l->expiration!='*'))
           return false;
         else
         {
             return $l->expiration;
       }

}

Теперь можно установить и проверить вашу вылеченную симплу ;)

Обнуление Okay CMS здесь
 
Top