diff --git a/application/install/backend/core.php b/application/install/backend/core.php index 2b268ecc..2f11ef8d 100644 --- a/application/install/backend/core.php +++ b/application/install/backend/core.php @@ -314,4 +314,107 @@ class InstallCore $data = stripslashes($data); } } + + /** + * Выполняет транслитерацию текста + * + * @param $sText + * @param bool $bLower + * @return mixed|string + */ + static public function transliteration($sText, $bLower = true) + { + $aConverter = array( + 'а' => 'a', + 'б' => 'b', + 'в' => 'v', + 'г' => 'g', + 'д' => 'd', + 'е' => 'e', + 'ё' => 'e', + 'ж' => 'zh', + 'з' => 'z', + 'и' => 'i', + 'й' => 'y', + 'к' => 'k', + 'л' => 'l', + 'м' => 'm', + 'н' => 'n', + 'о' => 'o', + 'п' => 'p', + 'р' => 'r', + 'с' => 's', + 'т' => 't', + 'у' => 'u', + 'ф' => 'f', + 'х' => 'h', + 'ц' => 'c', + 'ч' => 'ch', + 'ш' => 'sh', + 'щ' => 'sch', + 'ь' => "'", + 'ы' => 'y', + 'ъ' => "'", + 'э' => 'e', + 'ю' => 'yu', + 'я' => 'ya', + 'А' => 'A', + 'Б' => 'B', + 'В' => 'V', + 'Г' => 'G', + 'Д' => 'D', + 'Е' => 'E', + 'Ё' => 'E', + 'Ж' => 'Zh', + 'З' => 'Z', + 'И' => 'I', + 'Й' => 'Y', + 'К' => 'K', + 'Л' => 'L', + 'М' => 'M', + 'Н' => 'N', + 'О' => 'O', + 'П' => 'P', + 'Р' => 'R', + 'С' => 'S', + 'Т' => 'T', + 'У' => 'U', + 'Ф' => 'F', + 'Х' => 'H', + 'Ц' => 'C', + 'Ч' => 'Ch', + 'Ш' => 'Sh', + 'Щ' => 'Sch', + 'Ь' => "'", + 'Ы' => 'Y', + 'Ъ' => "'", + 'Э' => 'E', + 'Ю' => 'Yu', + 'Я' => 'Ya', + " " => "-", + "." => "", + "/" => "-", + "_" => "-", + 'і' => 'i', + 'І' => 'I', + 'ї' => 'i', + 'Ї' => 'I', + 'є' => 'e', + 'Є' => 'E', + 'ґ' => 'g', + 'Ґ' => 'G', + '«' => '', + '»' => '', + ); + $sRes = strtr($sText, $aConverter); + if ($sResIconv = @iconv("UTF-8", "ISO-8859-1//IGNORE//TRANSLIT", $sRes)) { + $sRes = $sResIconv; + } + $sRes = preg_replace('/[^A-Za-z0-9\-]/', '', $sRes); + $sRes = preg_replace('/\-{2,}/', '-', $sRes); + if ($bLower) { + $sRes = strtolower($sRes); + } + return $sRes; + } } \ No newline at end of file diff --git a/application/install/backend/step/checkRequirements.php b/application/install/backend/step/checkRequirements.php index 6ddb8f8f..844dbe62 100644 --- a/application/install/backend/step/checkRequirements.php +++ b/application/install/backend/step/checkRequirements.php @@ -45,6 +45,15 @@ class InstallStepCheckRequirements extends InstallStep 'current' => InstallCore::getLang('no') ); } + if (@extension_loaded('xdebug')) { + $iLevel = (int)@ini_get('xdebug.max_nesting_level'); + if ($iLevel < 1000) { + $aRequirements[] = array( + 'name' => 'xdebug', + 'current' => InstallCore::getLang('yes') . " ({$iLevel})" + ); + } + } /** * Права на запись файлов */ diff --git a/application/install/backend/step/updateVersion.php b/application/install/backend/step/updateVersion.php index 3c7d1f69..ea84ad1b 100644 --- a/application/install/backend/step/updateVersion.php +++ b/application/install/backend/step/updateVersion.php @@ -428,6 +428,31 @@ class InstallStepUpdateVersion extends InstallStep } } + + /** + * Конвертируем урлы топиков к ЧПУ формату + */ + $iPage = 1; + $iLimitCount = 50; + $iLimitStart = 0; + while ($aTopics = $this->dbSelect("SELECT * FROM prefix_topic WHERE topic_slug = '' LIMIT {$iLimitStart},{$iLimitCount}")) { + $iPage++; + $iLimitStart = ($iPage - 1) * $iLimitCount; + /** + * Топики + */ + foreach ($aTopics as $aTopic) { + $sSlug = InstallCore::transliteration($aTopic['topic_title']); + $sSlug = $this->GetUniqueTopicSlug($sSlug, $aTopic['topic_id']); + $sSlug = mysqli_escape_string($this->rDbLink, $sSlug); + /** + * Меняем тип топика + */ + $this->dbQuery("UPDATE prefix_topic SET topic_slug = '{$sSlug}' WHERE topic_id ='{$aTopic['topic_id']}'"); + } + } + + /** * Конвертируем аватарки блогов */ @@ -818,4 +843,21 @@ class InstallStepUpdateVersion extends InstallStep return false; } } + + protected function GetUniqueTopicSlug($sSlug, $iSkipTopicId = null) + { + $iPostfix = 0; + do { + $sUrl = $sSlug . ($iPostfix ? '-' . $iPostfix : ''); + $iPostfix++; + } while (($aTopic = $this->getTopicBySlug($sUrl)) and (is_null($iSkipTopicId) or $iSkipTopicId != $aTopic['topic_id'])); + + return $sUrl; + } + + protected function getTopicBySlug($sUrl) + { + $sUrl = mysqli_escape_string($this->rDbLink, $sUrl); + return $this->dbSelectOne("SELECT * FROM prefix_topic WHERE topic_slug = '{$sUrl}' "); + } } \ No newline at end of file diff --git a/application/install/frontend/i18n/ru.php b/application/install/frontend/i18n/ru.php index 7d69064e..99219ab2 100644 --- a/application/install/frontend/i18n/ru.php +++ b/application/install/frontend/i18n/ru.php @@ -39,6 +39,10 @@ return array( 'title' => 'Поддержка XML (SimpleXML)', 'solution' => 'Для корректной работы необходимо расширение SimpleXML. Обратитесь к хостингу.', ), + 'xdebug' => array( + 'title' => 'Использование Xdebug', + 'solution' => 'Для корректной работы необходимо отключить Xdebug или повысить значение xdebug.max_nesting_level до 1000. Обратитесь к хостингу.', + ), 'dir_uploads' => array( 'title' => 'Каталог /uploads', 'solution' => 'Необходимо дать каталогу права на запись.', diff --git a/application/install/frontend/template/steps/installComplete.tpl.php b/application/install/frontend/template/steps/installComplete.tpl.php index 3eb33050..f61d0ca6 100644 --- a/application/install/frontend/template/steps/installComplete.tpl.php +++ b/application/install/frontend/template/steps/installComplete.tpl.php @@ -1,7 +1,5 @@
-

Приятного использования LiveStreet!

- -

- Обязательно удалите каталог /application/install/ -
+

+ Теперь обязательно удалите каталог /application/install/ и можете перейти на сайт. +

\ No newline at end of file diff --git a/application/install/frontend/template/steps/updateComplete.tpl.php b/application/install/frontend/template/steps/updateComplete.tpl.php index 5d6ea9c8..123a347a 100644 --- a/application/install/frontend/template/steps/updateComplete.tpl.php +++ b/application/install/frontend/template/steps/updateComplete.tpl.php @@ -1,7 +1,7 @@
-

Приятного использования новой версией LiveStreet!

- -
- Обязательно удалите каталог /application/install/ -
+

+ Теперь обязательно удалите каталог /application/install/ и можете перейти на сайт. +
+ Приятного использования новой версией LiveStreet! +

\ No newline at end of file