diff --git a/README.md b/README.md index bba957a..1cd5e01 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Hollpee builder +# Hollpee builder (edition for PHP 7.4) Hollpee - позволит создавать профессиональные Landing Page с адаптивным дизайном. Сайт можно скачать и установить на свой хостинг вместе с CMS Hollpee. Она специально разработана для лендингов: визуальный редактор, мини CRM, интеграции, a/b тест и мультилендинги. [База знаний редактора Hollpee builde](https://github.com/hollpee-builder/helpdesk) @@ -10,7 +10,7 @@ Hollpee - позволит создавать профессиональные L ## УСТАНОВКА WINDOWS: -Скачайте архив с сервисом +Скачайте архив с сервисом  @@ -25,14 +25,14 @@ Hollpee - позволит создавать профессиональные L post_max_size=128M В некоторых локальных серверах нельзя будет выставить значение в 512, а только в 256, выставляйте на сколько получится. -Эти значения нужны, чтобы можно было загружать большие файлы в сервисе. +Эти значения нужны, чтобы можно было загружать большие файлы в сервисе. Так же вам необходимо включить модуль SQLite3 ## Пример настройки для локального веб-сервера http://www.wampserver.com/ru/ Скачайте локальный веб-сервер и установите его. -Запустите его и настройте версию php = 7.3. +Запустите его и настройте версию php = 7.3. Перейдите в Wampserver -> PHP -> PHP Settings и выключите галочки напротив display_errors, так же изменитене значение memory_limit, upload_max_filesize, post_max_size, как указано на скрине ниже. @@ -73,16 +73,16 @@ Hollpee - позволит создавать профессиональные L  -Теперь вам необходимо перезагрузить программу Wampserver. Для этого закройте ее и снова откройте. После этого у вас в меню +Теперь вам необходимо перезагрузить программу Wampserver. Для этого закройте ее и снова откройте. После этого у вас в меню Wampserver -> Your VirtualHosts должны появиться созданные виртуальные хосты  Последняя настройка для этой программы. Откройте файл "C:\wamp64\wampmanager.conf". И отредактируйте строчку с словом navigator вначале строки, в ней будет указан путь к браузеру IE, вам нужно заменить его на Chrome: Это нужно для того, чтобы в Wampserver по умолчанию использовался браузер Chrome - + navigator ="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" - +  Теперь если перейти в браузер и открыть сайт http://hollpee.local должен открыться редактор @@ -108,7 +108,7 @@ Wampserver -> Your VirtualHosts должны появиться созданны memory_limit=512M upload_max_filesize=512M - post_max_size=128M + post_max_size=128M Активировать модуль rewrite @@ -135,12 +135,12 @@ Wampserver -> Your VirtualHosts должны появиться созданны - + Создайте папку /var/www/builder поместите в нее содержимое редактора Hollpee builder, назначте права доступа на эту папку chown www-data:www-data -R /var/www/builder chmod 770 -R /var/www/builder -Добавьте в файл /etc/hosts +Добавьте в файл /etc/hosts 127.0.0.1 builder.local После этого Перезагрузите apache2 @@ -150,7 +150,7 @@ Wampserver -> Your VirtualHosts должны появиться созданны Теперь если в браузере набрать builder.local должен открыть редактор ## Если у вас не загружается внутренний формат -Внутренние форматы сделанные до 2019-11-02 13:00 не будут загружаться в сервисе. Для того, чтобы их загрузить вам необходимо +Внутренние форматы сделанные до 2019-11-02 13:00 не будут загружаться в сервисе. Для того, чтобы их загрузить вам необходимо разархивировать архив. После этого у вас дожна появиться папка с названием вашего архива, зайдите в нее и в ней вы должны увидеть файлы и папки: file, fonts, images, avatar.png, hollpee_meta.txt, site.txt и так далее. Выберите все эти файлы и создайте zip ахив. После нужно изменить расширение с .zip на .hollpee. Теперь этот файл должен загрузиться в сервисе. diff --git a/application/controllers/ChoseStyleController.php b/application/controllers/ChoseStyleController.php index 3d13754..ea43fb4 100755 --- a/application/controllers/ChoseStyleController.php +++ b/application/controllers/ChoseStyleController.php @@ -1,4 +1,4 @@ -getListStyle(); + $listSites = $this->getListStyle(); $error = ''; $paramChoseStyle = array( 'error'=>$error,//ошибка 'listSites'=>$listSites);//выбор стилей @@ -26,8 +26,8 @@ function indexAction() $stylesheet = ' '; $titleContent = Resource::$page_chosenstyle_title; - - $param = array( 'content'=>$content, + + $param = array( 'content'=>$content, 'stylesheet'=>$stylesheet, 'titleContent'=>$titleContent, 'type'=>'site', @@ -53,12 +53,12 @@ private function getListStyle() foreach ($listType as $styleType) { $pathType = $_SERVER['DOCUMENT_ROOT'].'/site/style/'.$styleType.'/'; - $dir = opendir($pathType); - while ($folder = readdir($dir)) { + $dir = @opendir($pathType); + while ($folder = @readdir($dir)) { if ($folder == '.' || $folder == '..') continue; $listStyle[$styleType][$folder] = 'avatar.png'; } - closedir($dir); + @closedir($dir); } return $listStyle; @@ -76,7 +76,7 @@ private function getListStyle() public function getSitesCategoryAction() { $category = Clear::leaveNumber($_POST['category']); - echo $this->objAttach->getSitesCategory($category); + echo $this->objAttach->getSitesCategory($category); } /*****************************************************************************************/ @@ -87,7 +87,7 @@ public function getSitesCategoryAction() * */ public function addStyleSiteAction() - { + { // параметры стиля $paramsSite = array(); $paramsSite['profile_id'] = $this->user_id; @@ -98,7 +98,7 @@ public function addStyleSiteAction() // создаем сайт $siteObj = new Site(); $newSiteId = $siteObj->addStyleSite($paramsSite); - + if ($newSiteId) { // перенаправляем на страницу редактора $editorHref = '/editor/?site='.$newSiteId; @@ -146,13 +146,13 @@ private function getStyleAdd() { $styleId = Clear::leaveNumber($_GET['style_id']); $styleType = $this->getSiteType($_GET['style_type']); - + $styleName = Clear::leaveLettersAndNumber($_GET['style_name']); $pathStyle = $_SERVER['DOCUMENT_ROOT'].'/site/style/'.$styleType.'/'.$styleId; $this->pathStyle = $pathStyle; $siteString = file_get_contents($pathStyle.'/site.txt'); - + $projectId = $_SESSION['project']; $paramsProject = array('profile_id'=>$this->user_id, 'project_id'=>$projectId); $isProjectExists = DbSite::getInstance()->isProjectExists($paramsProject); @@ -168,7 +168,7 @@ private function getStyleAdd() $site['style_id'] = $styleId; $site['style_name'] = $styleName; $site['type'] = $styleType; - + $siteCode = json_decode($siteString, true); unset($siteCode['profile_id']); unset($siteCode['project_id']); @@ -185,13 +185,13 @@ private function getStyleAdd() /*******************************************************************************************/ /** * Просмотр - * - * @return html отдает сраницу + * + * @return html отдает сраницу * * @uses DbStyle::getStyleSite() /application/models/db/DbStyle.php выбирает с бд определенную страницу */ public function showAction() - { + { // id страницы $styleId = Clear::leaveNumber($_GET['id']); $styleType = $this->getSiteType($_GET['type']); @@ -200,14 +200,14 @@ public function showAction() // нету страницы if (!file_exists($pathStyle)) { - header("Location: /error404"); + header("Location: /error404"); exit; } $pathFileShow = $pathStyle.'/show.txt'; - + /***************/ - // если нет файла show, создаем его + // если нет файла show, создаем его if (!file_exists($pathFileShow)) { $pathFileSite = $pathStyle.'/site.txt'; $fileSite = file_get_contents($pathFileSite); @@ -219,11 +219,11 @@ public function showAction() $fullSite = file_get_contents($pathFileShow); $fullSite = json_decode($fullSite, true); - + // добавляем фрифты $font = DbUserProfile::getInstance()->getFont(array('profile_id'=>$this->user_id)); $fullSite["font"] = $font; - + $fullSite = json_encode($fullSite, true); $content = '
'; @@ -243,8 +243,8 @@ public function showAction() echo $result; } -/************************************************************************************/ - +/************************************************************************************/ + /** * Отдает тип сайта @@ -255,7 +255,7 @@ public function showAction() function getSiteType($type) { if ($type == 'mlp') $siteType = 'mlp'; - else if ($type == 'longreads') $siteType = 'longreads'; + else if ($type == 'longreads') $siteType = 'longreads'; else $siteType = 'lp'; return $siteType; diff --git a/application/controllers/EditorController.php b/application/controllers/EditorController.php index fa0ddfa..a2afc87 100755 --- a/application/controllers/EditorController.php +++ b/application/controllers/EditorController.php @@ -1,4 +1,4 @@ -user_id.'/'.$siteId.'/file/files'; if (!file_exists($folderFilesPath)) mkdir($folderFilesPath); /***********/ - + $paramsSite = array('profile_id'=>$this->user_id, 'site_id'=>$siteId); $isExistsSite = DbSiteEditor::getInstance()->isExistsSite($paramsSite); @@ -70,21 +70,21 @@ public function getJs($siteId, $siteInfo) // полностью сайт $fullSite = $this->getFullSite($siteId); $fullSite['type_access'] = $siteInfo['type_access']; - + // данные пользователя $paramsData = array("profile_id"=>$this->user_id); $userData = DbUserProfile::getInstance()->getData($paramsData); - + $siteId = $fullSite['site_id']; $params = array('profile_id'=>$this->user_id, 'site_id'=>$siteId); $projectId = $siteInfo['project_id']; - // переводим в json + // переводим в json unset($fullSite['project_id']); $fullSite = json_encode($fullSite, true); $userData = $userData[0]["data"]; - + $exitHref = '/sites/?project='.$projectId;// href show $showId = $siteId; $showHref = '/show?id='.$showId; @@ -94,7 +94,7 @@ public function getJs($siteId, $siteInfo) $params = array( 'jsonSite'=>$fullSite, - 'jsonUser'=>$userData, + 'jsonUser'=>$userData, 'exitHref'=>$exitHref, 'showHref'=>$showHref, 'sitePublished'=>$sitePublished, @@ -113,20 +113,20 @@ public function getJs($siteId, $siteInfo) protected function getFullSite($siteId) { $params = array('profile_id'=>$this->user_id, 'site_id'=>$siteId); - + //получаем полностью сайт $fullSite = $this->objSite->getFullSite($params); // нету сайта if (!$fullSite["site_id"]) exit; $projectId = $fullSite['project_id']; - + // преобразуем массив чтобы ключом к страницы был его id $listPages = $fullSite["pages"]; $fullSite["pages"] = array(); foreach ($listPages as $pageData) { $fullSite["pages"][$pageData["page_id"]] = $pageData; - } + } return $fullSite; } @@ -138,7 +138,7 @@ protected function getFullSite($siteId) * */ function saveAction() - { + { $site = htmlspecialchars_decode(urldecode($_POST['site'])); $siteId = Clear::leaveNumber($_POST['site_id']); $res = $this->objSite->saveSite($this->user_id, $siteId, $site); @@ -153,12 +153,12 @@ function saveAction() */ public function saveSiteAvatarAction() { - $avatarData = base64_decode($_POST['data']); - $siteId = Clear::leaveNumber($_POST['site_id']); + $avatarData = base64_decode($_POST['data']); + $siteId = Clear::leaveNumber($_POST['site_id']); $imgPath = $_SERVER['DOCUMENT_ROOT'] . '/user/' . $this->user_id . '/' . $siteId . '/avatar.png'; - - file_put_contents($imgPath, $avatarData); + + file_put_contents($imgPath, $avatarData); echo $imgPath; } @@ -166,12 +166,12 @@ public function saveSiteAvatarAction() /************************************************************************************/ /***изображения*************************************************************************/ /** - * отдаем картинки определеной категории + * отдаем картинки определеной категории * AJAX * * @see ajax */ - public function getFileHolAction() + public function getFileHolAction() { $fileType = $this->getFileType(); $siteId = Clear::leaveNumber($_POST['site']); @@ -180,7 +180,7 @@ public function getFileHolAction() $result = $this->getImgDir($path); //получить картинки категории echo json_encode($result, true); - + } private function getRootFilePath($fileType, $siteId) @@ -190,7 +190,7 @@ private function getRootFilePath($fileType, $siteId) return $path; } - protected function getImgDir($path, $folder = '') + protected function getImgDir($path, $folder = '') { $path_full = $_SERVER['DOCUMENT_ROOT'] . '/' . $path; @@ -218,7 +218,7 @@ protected function getImgDir($path, $folder = '') if (is_dir($file_path_full)) { $listChildFolder = $this->getImgDir($file_path, $nameFile); $list = array_merge($list, $listChildFolder); - } + } } } //закрываем директорию @@ -236,7 +236,7 @@ protected function getPropertyImg($file_path, $folder, $file) $path_full = $_SERVER['DOCUMENT_ROOT'] .'/'. $file_path; //разрешение файла - $screen = getimagesize($path_full); + $screen = @getimagesize($path_full); $type = is_dir($path_full) ? 'dir' : 'file'; @@ -264,7 +264,7 @@ protected function getPropertyImg($file_path, $folder, $file) private function getFileType() { $fileType = $_POST['file_type']; - + if ($fileType == "video") $fileType = "file"; else $fileType = "img"; @@ -272,15 +272,15 @@ private function getFileType() } /*********************************************************************************/ - + /** * Сохраняет шрифт * - * + * */ public function uploadFontsAction() { - //данные + //данные $file = $_POST['content']; // имя @@ -289,7 +289,7 @@ public function uploadFontsAction() $fileNameMain = preg_replace('/\./', '', $fileNameMain); $fileFolder = $fileNameMain; $fileName = $fileNameMain . '.ttf'; - + // создаем папку для шрифта $siteId = Clear::leaveNumber($_POST['site_id']); @@ -308,14 +308,14 @@ public function uploadFontsAction() // сохраняем $fileObj = new File(); $fontName = $fileObj->save($fileName, $file, $pathFolder); - + // преобразовываем в другие форматы $fontPath = $fullPathFolder . '/' . $fileFolder; system('ttf2woff '.$fontPath.'.ttf '.$fontPath.'.woff > /dev/null'); system('ttf2svg '.$fontPath.'.ttf '.$fullPathFolder.' > /dev/null'); echo $fontName; - } + } /** * Удаление шрифта @@ -350,20 +350,20 @@ public function saveFontAction() $fullSite = DbSiteEditor::getInstance()->getFullSite($params); $fullSite['font'] = json_decode($_POST['font'], true); - DbSiteEditor::getInstance()->saveSite($this->user_id, $siteId, $fullSite); + DbSiteEditor::getInstance()->saveSite($this->user_id, $siteId, $fullSite); } /*************************************************************************************************/ - + /** * Сохраняет картинку * AJAX - * + * */ public function saveFileHolAction() - { + { $folderUser = '/user/'.$this->user_id; - //данные + //данные $file = $_POST['content']; if (!$file) exit; @@ -376,11 +376,11 @@ public function saveFileHolAction() else $fileType = "img"; $pathRoot = $this->getRootFilePath($fileType, $siteId); - + $pathFolder = $pathRoot.'/'.$folder; $fileObj = new File(); $fileName = $fileObj->save($fileName, $file, $pathFolder); - + $newImgProperty = $this->getPropertyImg($pathFolder.'/'.$fileName, $folder, $fileName); echo json_encode($newImgProperty, true); } @@ -407,7 +407,7 @@ private function checkFileValid($fileName) /** * Сохраняем фаил - * + * * @see this.saveFileAction() */ private function saveFile($imgPath, $imgData, $pathFolder, $fileName) @@ -424,7 +424,7 @@ private function saveFile($imgPath, $imgData, $pathFolder, $fileName) * @see $this->saveFileAction() */ private function getNewImagePath($pathFolder, $fileName) - { + { $imageProperty = array(); preg_match_all("|^([\w\-\.]+)\.([\w]+)$|i", $fileName, $imageProperty); $name = $imageProperty[1][0]; @@ -436,7 +436,7 @@ private function getNewImagePath($pathFolder, $fileName) $imgPath = $pathFolder.'/'.$nameNum.'.'.$unit; if (!file_exists($imgPath)) break; } - + return $imgPath; } @@ -461,7 +461,7 @@ private function getPathFile() { $fileName = ConvertStr::ruToEn($_POST['name']); $fileName = preg_replace("/\.\./", '', $fileName); - + $folder = $_POST['folder']; $folder = preg_replace("|\/|", '___flsh___', $folder); $folder = ConvertStr::ruToEn($folder); @@ -476,10 +476,10 @@ private function getPathFile() $folderPath = $pathRoot.'/'.$folder.'/'.$fileName; return array( - 'path' => $folderPath, - 'file_name' => $fileName, + 'path' => $folderPath, + 'file_name' => $fileName, 'folder' => $folder); - } + } /** * Переместить картинку @@ -499,7 +499,7 @@ function moveImgAction() // заменяем бд if ($usedImage) { $usedImage = json_decode($usedImage, true); - + $res = DbSiteEditor::getInstance()->moveImage($usedImage, $oldSrc, $newSrc, $profileId); if (!$res) return false; } @@ -526,16 +526,16 @@ function createFileFolderHolAction() // создаем папку if (!file_exists($folderPathFull)) { mkdir($folderPathFull); - + $newFolderProperty = $this->getPropertyImg($folderPath, $folder, $fileName); echo json_encode($newFolderProperty); } } /********************************************************************************************/ - + /** - * Сохранение данных пользователя + * Сохранение данных пользователя * * */ @@ -554,12 +554,12 @@ public function saveUserDataAction() private function saveDataUser($userData) { // $userData = json_encode(json_decode($userData, true), true); - + // сохраняем данные позователя $paramsUser = array('profile_id'=>$this->user_id, 'data'=>$userData); DbUserProfile::getInstance()->saveData($paramsUser); - } - + } + /**********************************************************************************/ /**********************************************************************************/ /**********************************************************************************/ @@ -578,13 +578,13 @@ private function isTemplateModeDeveloper() private function isTemplateModeDeveloperReplace() { /*************/ - // if ($this->isTemplateModeDeveloper()) return true; + // if ($this->isTemplateModeDeveloper()) return true; /*************/ return false; } - + private function getTemplateFolderPath() { $templateFolderPath = $_SERVER['DOCUMENT_ROOT'].'/user'; @@ -610,12 +610,12 @@ public function saveNewTemplateAction() if (!$this->isTemplateModeDeveloper()) { $this->saveDataUser($_POST['user']); } - /*************/ + /*************/ // данные $newTemplateId = Clear::leaveLettersAndNumber($_POST['new_id']); $listImg = json_decode($_POST['list_img'], true); - + // пути $templateFolderPath = $this->getTemplateFolderPath(); if (!file_exists($templateFolderPath)) mkdir($templateFolderPath); @@ -645,12 +645,12 @@ private function saveNewTemplate($newTemplateId, $newTemplate) { // получаем шаблоны пользователя $paramsGet = array('profile_id'=>$this->user_id); - + $templateFolderPath = $this->getTemplateFolderPath(); $userCodeFolderPath = $templateFolderPath.'/0_code'; - + if (!file_exists($userCodeFolderPath)) mkdir($userCodeFolderPath); - + /*********/ /******/ $this->saveNewTemplateCode($userCodeFolderPath, $newTemplate, $newTemplateId); @@ -672,23 +672,23 @@ private function copyImgNewTemplate($listImg, $templatePath) { // создаем папку if (!file_exists($templatePath)) mkdir($templatePath); - + // копируем изображение foreach ($listImg as $imgSrc) { $imgSrc = preg_replace('/\.\./', '', $imgSrc); - $imgPathOrg = $_SERVER['DOCUMENT_ROOT'] . '/' . $imgSrc; - - $imgName = array(); + $imgPathOrg = $_SERVER['DOCUMENT_ROOT'] . '/' . $imgSrc; + + $imgName = array(); preg_match_all('/[^\/]+$/', $imgSrc, $imgName); $imgPathNew = $templatePath . '/' . $imgName[0][0]; - + copy($imgPathOrg, $imgPathNew); } } /** * Сохраняем папку для шаблона - * + * * */ private function saveNewTemplateFolder($siteId, $newTemplateId, $folder) @@ -712,7 +712,7 @@ private function saveNewTemplateFolder($siteId, $newTemplateId, $folder) /** * Копируем файлы шаблона - * + * * */ private function copyTemplateFolder($rootTemplatePath, $templateId, $siteId, $folder) @@ -748,7 +748,7 @@ private function deleteTemplateFile($rootTemplatePath, $templateId) public function saveTemplateAvatarAction() { $templateId = Clear::leaveLettersAndNumber($_POST['template_id']); - $avatarData = base64_decode($_POST['data']); + $avatarData = base64_decode($_POST['data']); $pathRoot = $_SERVER['DOCUMENT_ROOT']; $imgName = 'avatar_' . $templateId . '.png'; @@ -757,7 +757,7 @@ public function saveTemplateAvatarAction() $avatarFolderPath = $templateFolderPath . '/0_avatar'; if (!file_exists($avatarFolderPath)) mkdir($avatarFolderPath); $imgPath = $avatarFolderPath . '/' . $imgName; - + file_put_contents($imgPath, $avatarData); echo $imgPath; @@ -768,13 +768,13 @@ public function saveTemplateAvatarAction() /** * Добавление шаблона на страницу * - * + * */ public function addTemplateAction() { $templateId = Clear::leaveLettersAndNumber($_POST['template_id']); $siteId = Clear::leaveNumber($_POST['site_id']); - $folderType = $_POST['folder_type']; + $folderType = $_POST['folder_type']; $typeAccess = preg_replace('/\.\./', '', $_POST['type_access']); $isStdType = $typeAccess != "my"; @@ -787,7 +787,7 @@ public function addTemplateAction() $rootTemplatePath = $_SERVER['DOCUMENT_ROOT'].'/user/'.$userId.'/0_template'; $pathTemplate = $rootTemplatePath . '/' . $templateId; - // получаем путь изображений + // получаем путь изображений $folderName = ConvertStr::ruToEn($_POST['template_name']); $fileObj = new File(); $pathSiteImg = $rootPath . '/' . $siteId . '/img'; @@ -799,7 +799,7 @@ public function addTemplateAction() if (file_exists($userCodeFolderPath)) { $template = file_get_contents($userCodeFolderPath); - // это времено пока все шаблоны, не уберутся с bd + // это времено пока все шаблоны, не уберутся с bd } else { $params = array('profile_id' => $this->user_id); $listTemplate = DbUserProfile::getInstance()->getTemplate($params); @@ -810,7 +810,7 @@ public function addTemplateAction() // копируем изображения и файлы if (!$isStdType) { $this->copyImgAddTemplate($pathTemplate, $pathSiteImgNew); - $this->copyTemplateFolder($rootTemplatePath, $templateId, $siteId, $_POST['folder']); + $this->copyTemplateFolder($rootTemplatePath, $templateId, $siteId, $_POST['folder']); } $res = array('template' => $template, 'folder_name' => $folderName); @@ -828,7 +828,7 @@ private function copyImgAddTemplate($pathTemplate, $pathSiteImgNew) } }; closedir($dir); - + if ($isExistsImg) { // копируем изображения mkdir($pathSiteImgNew); @@ -839,7 +839,7 @@ private function copyImgAddTemplate($pathTemplate, $pathSiteImgNew) /** * Удаление шаблона * - * + * */ public function deleteTemplateAction() { @@ -865,4 +865,4 @@ public function deleteTemplateAction() }//end class -?> \ No newline at end of file +?> diff --git a/application/views/admin.php b/application/views/admin.php index b6f140f..75141fc 100755 --- a/application/views/admin.php +++ b/application/views/admin.php @@ -9,9 +9,9 @@ - + - + @@ -22,7 +22,7 @@ - + @@ -39,7 +39,7 @@
-
+
-
+