%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.147.78.151 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/itserw.wishlist/install/ |
Upload File : |
<?php use \Bitrix\Main\Localization\Loc; use \Bitrix\Main\Loader; use \Bitrix\Main\Config\Option; use \Bitrix\Main\Application; use \Itserw\Wishlist; Loc::loadMessages(__FILE__); /** * Class itserw_wishlist */ Class itserw_wishlist extends CModule { var $exclusionAdminFiles; var $MODULE_ID = "itserw.wishlist"; function __construct() { $arModuleVersion = array(); include(__DIR__ . "/version.php"); $this->exclusionAdminFiles = array( '..', '.' ); $this->MODULE_ID = 'itserw.wishlist'; $this->MODULE_VERSION = $arModuleVersion["VERSION"]; $this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"]; $this->MODULE_NAME = Loc::getMessage("ITSERW_WISHLIST_MODULE_NAME"); $this->MODULE_DESCRIPTION = Loc::getMessage("ITSERW_WISHLIST_MODULE_DESC"); $this->PARTNER_NAME = Loc::getMessage("ITSERW_WISHLIST_PARTNER_NAME"); $this->PARTNER_URI = Loc::getMessage("ITSERW_WISHLIST_PARTNER_URI"); $this->MODULE_SORT = 1; $this->SHOW_SUPER_ADMIN_GROUP_RIGHTS = 'Y'; $this->MODULE_GROUP_RIGHTS = "Y"; } public function isVersionD7() { return CheckVersion(\Bitrix\Main\ModuleManager::getVersion('main'), '14.00.00'); } public function GetPath($notDocumentRoot = false) { if ($notDocumentRoot) return str_ireplace(Application::getDocumentRoot(), '', dirname(__DIR__)); else return dirname(__DIR__); } function InstallFiles($arParams = array()) { $path = $this->GetPath() . "/install/components"; if (\Bitrix\Main\IO\Directory::isDirectoryExists($path)) { if (\Bitrix\Main\IO\Directory::isDirectoryExists($_SERVER["DOCUMENT_ROOT"] . '/bitrix/components/itserw')) { CopyDirFiles($path . '/itserw', $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/itserw", true, true); } else { CopyDirFiles($path, $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true); } } else { throw new \Bitrix\Main\IO\InvalidPathException($path); } if (\Bitrix\Main\IO\Directory::isDirectoryExists($path = $this->GetPath() . '/admin')) { CopyDirFiles($this->GetPath() . "/install/admin/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin"); //???? ???? ????? ??? ??????????? if ($dir = opendir($path)) { while (false !== $item = readdir($dir)) { if (in_array($item, $this->exclusionAdminFiles)) continue; file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/' . $this->MODULE_ID . '_' . $item, '<' . '? require($_SERVER["DOCUMENT_ROOT"]."' . $this->GetPath(true) . '/admin/' . $item . '");?' . '>'); } closedir($dir); } } $bReWriteAdditionalFiles = ($arParams["public_rewrite"] == "Y"); if (array_key_exists("public_dir", $arParams) && strlen($arParams["public_dir"])) { $by = "sort"; $order = "asc"; $rsSite = CSite::GetList($by, $order); while ($site = $rsSite->Fetch()) { $source = $this->GetPath() . "/lang/ru/public/"; $target = $site['ABS_DOC_ROOT'] . $site["DIR"] . $arParams["public_dir"] . "/"; if (file_exists($source)) { CheckDirPath($target); $dh = opendir($source); while ($file = readdir($dh)) { if ($file == "." || $file == "..") continue; if ($bReWriteAdditionalFiles || !file_exists($target . $file)) { $fh = fopen($source . $file, "rb"); $php_source = fread($fh, filesize($source . $file)); fclose($fh); if (preg_match_all('/GetMessage\("(.*?)"\)/', $php_source, $matches)) { IncludeModuleLangFile($source . $file, $site["LANGUAGE_ID"]); foreach ($matches[0] as $i => $text) { $php_source = str_replace( $text, '"' . GetMessage($matches[1][$i]) . '"', $php_source ); } } $fh = fopen($target . $file, "wb"); fwrite($fh, $php_source); fclose($fh); } } } } } return true; } function UnInstallFiles() { \Bitrix\Main\IO\Directory::deleteDirectory($_SERVER["DOCUMENT_ROOT"] . '/bitrix/components/itserw/wishlist.list'); if (\Bitrix\Main\IO\Directory::isDirectoryExists($path = $this->GetPath() . '/admin')) { DeleteDirFiles($_SERVER["DOCUMENT_ROOT"] . $this->GetPath() . '/install/admin/', $_SERVER["DOCUMENT_ROOT"] . '/bitrix/admin'); if ($dir = opendir($path)) { while (false !== $item = readdir($dir)) { if (in_array($item, $this->exclusionAdminFiles)) continue; \Bitrix\Main\IO\File::deleteFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/' . $this->MODULE_ID . '_' . $item); } closedir($dir); } } return true; } function InstallDB() { } function UnInstallDB() { global $APPLICATION; Loader::includeModule($this->MODULE_ID); if (\Itserw\Wishlist\DataStorageProperty::getInstance()->isStorage()) { \Itserw\Wishlist\DataStorageProperty::getInstance()->deleteStorage(); } Option::delete($this->MODULE_ID); } function InstallEvents() { \Bitrix\Main\EventManager::getInstance()->registerEventHandler('main', 'OnAfterUserAuthorize', $this->MODULE_ID, '\Itserw\Wishlist\Favorites', 'eventHandler'); } function UnInstallEvents() { \Bitrix\Main\EventManager::getInstance()->unRegisterEventHandler('main', 'OnAfterUserAuthorize', $this->MODULE_ID, '\Itserw\Wishlist\Favorites', 'eventHandler'); } function DoInstall() { global $APPLICATION, $step; $step = intval($step); if ($step < 2) { $APPLICATION->IncludeAdminFile(Loc::getMessage("ITSERW_WISHLIST_INSTALL_TITLE"), $this->GetPath() . "/install/step1.php"); } elseif ($step == 2) { if ($this->isVersionD7()) { \Bitrix\Main\ModuleManager::registerModule($this->MODULE_ID); $this->InstallDB(); $this->InstallEvents(); $this->InstallFiles(array( "public_dir" => $_REQUEST["public_dir"], "public_rewrite" => $_REQUEST["public_rewrite"], )); } else { $APPLICATION->ThrowException(Loc::getMessage("ITSERW_WISHLIST_INSTALL_ERROR_VERSION")); } $APPLICATION->IncludeAdminFile(Loc::getMessage("ITSERW_WISHLIST_INSTALL_TITLE"), $this->GetPath() . "/install/step2.php"); } } function DoUninstall() { global $APPLICATION, $step; $step = intval($step); if ($step < 2) { $APPLICATION->IncludeAdminFile(GetMessage("ITSERW_WISHLIST_UNINSTALL_TITLE"), $this->GetPath() . "/install/unstep1.php"); } elseif ($step == 2) { $this->UnInstallDB(); $this->UnInstallEvents(); $this->UnInstallFiles(); \Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID); $APPLICATION->IncludeAdminFile(Loc::getMessage("ITSERW_WISHLIST_UNINSTALL_TITLE"), $this->GetPath() . "/install/unstep2.php"); } } function GetModuleRightList() { return array( "reference_id" => array("D", "K", "S", "W"), "reference" => array( "[D] " . Loc::getMessage("ITSERW_WISHLIST_DENIED"), "[K] " . Loc::getMessage("ITSERW_WISHLIST_READ_COMPONENT"), "[S] " . Loc::getMessage("ITSERW_WISHLIST_WRITE_SETTINGS"), "[W] " . Loc::getMessage("ITSERW_WISHLIST_FULL")) ); } }