示例#1
0
文件: release.php 项目: staabm/redaxo
 private function createArchives()
 {
     $path = rex_path::base('releases/' . $this->version . '/');
     if (file_exists($path)) {
         rex_dir::deleteFiles($path);
     }
     rex_dir::create($path);
     $complete = new ZipArchive();
     $update = new ZipArchive();
     $complete->open($path . 'redaxo_' . $this->version . '.zip', ZipArchive::CREATE);
     $update->open($path . 'redaxo_update_' . $this->version . '.zip', ZipArchive::CREATE);
     $files = ['assets/.redaxo', 'media/.redaxo', 'redaxo/cache/.htaccess', 'redaxo/cache/.redaxo', 'redaxo/data/.htaccess', 'redaxo/data/.redaxo', 'redaxo/src/.htaccess', 'redaxo/index.php', 'index.php', 'LICENSE.md', 'README.md'];
     foreach ($files as $file) {
         $complete->addFile(rex_path::base($file), $file);
     }
     $this->addDir($complete, rex_path::core(), 'redaxo/src/core');
     $this->addDir($update, rex_path::core(), 'core');
     foreach (self::$addons as $addon) {
         $this->addDir($complete, rex_path::addon($addon), 'redaxo/src/addons/' . $addon);
         $this->addDir($update, rex_path::addon($addon), 'addons/' . $addon);
     }
     $this->addDir($complete, rex_path::core('assets'), 'assets');
     $addon = rex_addon::get('be_style');
     $this->addDir($complete, $addon->getPath('assets'), 'assets/addons/be_style');
     $this->addDir($complete, $addon->getPlugin('redaxo')->getPath('assets'), 'assets/addons/be_style/plugins/redaxo');
     $files = (require $addon->getPath('vendor_files.php'));
     foreach ($files as $source => $destination) {
         $complete->addFile($addon->getPath($source), 'assets/addons/be_style/' . $destination);
     }
     $complete->close();
     $update->close();
 }
示例#2
0
function focus_setup_metainfo()
{
    global $REX;
    if (!isset($REX['USER'])) {
        return;
    }
    $install_metas = array('med_focuspoint_data' => array('Focuspoint Data', 'med_focuspoint_data', 200, '', 1, '', '', '', ''), 'med_focuspoint_css' => array('Focuspoint CSS', 'med_focuspoint_css', 201, '', 1, '', '', '', ''));
    $db = new rex_sql();
    foreach ($db->getDbArray('SHOW COLUMNS FROM `rex_file` LIKE \'med_focuspoint_%\';') as $column) {
        unset($install_metas[$column['Field']]);
    }
    foreach ($install_metas as $k => $v) {
        $db->setQuery('SELECT `name` FROM `rex_62_params` WHERE `name`=\'' . $k . '\';');
        if ($db->getRows() > 0) {
            // FIELD KNOWN TO METAINFO BUT MISSING IN ARTICLE..
            $db->setQuery('ALTER TABLE `rex_file` ADD `' . $k . '` TEXT NOT NULL;');
            if ($REX['REDAXO']) {
                echo rex_info('Metainfo Feld ' . $k . ' wurde repariert.');
            }
        } else {
            if (!function_exists('a62_add_field')) {
                require_once $REX['INCLUDE_PATH'] . '/addons/metainfo/functions/function_metainfo.inc.php';
            }
            a62_add_field($v[0], $v[1], $v[2], $v[3], $v[4], $v[5], $v[6], $v[7], $v[8]);
            if ($REX['REDAXO']) {
                echo rex_info('Metainfo Feld ' . $k . ' wurde angelegt.');
            }
        }
    }
    rex_file::copy(rex_path::addon("focuspoint", "classes/class.rex_effect_focuspoint_resize.inc.php"), rex_path::addon("image_manager", "classes/effects/class.rex_effect_focuspoint_resize.inc.php"));
}
 public function execute()
 {
     global $I18N;
     $addonkey = rex_request('addonkey', 'string');
     $upload = rex_request('upload', array(array('upload_file', 'bool'), array('oldversion', 'string'), array('redaxo', 'array[string]'), array('description', 'string'), array('status', 'int'), array('replace_assets', 'bool'), array('ignore_tests', 'bool')));
     $file = array();
     $archive = null;
     $file['version'] = $upload['upload_file'] ? OOAddon::getVersion($addonkey) : $upload['oldversion'];
     $file['redaxo_versions'] = $upload['redaxo'];
     $file['description'] = stripslashes($upload['description']);
     $file['status'] = $upload['status'];
     if ($upload['upload_file']) {
         $archive = rex_path::addonCache('install', md5($addonkey . time()) . '.zip');
         $exclude = array();
         if ($upload['replace_assets']) {
             $exclude[] = 'files';
         }
         if ($upload['ignore_tests']) {
             $exclude[] = 'tests';
         }
         rex_install_archive::copyDirToArchive(rex_path::addon($addonkey), $archive, null, $exclude);
         if ($upload['replace_assets']) {
             rex_install_archive::copyDirToArchive(rex_path::addonAssets($addonkey), $archive, $addonkey . '/files');
         }
         $file['checksum'] = md5_file($archive);
     }
     rex_install_webservice::post(rex_install_packages::getPath('?package=' . $addonkey . '&file_id=' . rex_request('file', 'int', 0)), array('file' => $file), $archive);
     if ($archive) {
         rex_file::delete($archive);
     }
     unset($_REQUEST['addonkey']);
     unset($_REQUEST['file']);
     rex_install_packages::deleteCache();
     return $I18N->msg('install_info_addon_uploaded', $addonkey);
 }
 public function __construct($tableName, $fieldset, $whereCondition, $method = 'post', $debug = false)
 {
     parent::rex_form($tableName, $fieldset, $whereCondition, $method, $debug);
     if (OOAddon::isAvailable('metainfo')) {
         require_once rex_path::addon('metainfo', 'extensions/extension_art_metainfo.inc.php');
         $this->sqlFields = _rex_a62_metainfo_sqlfields(global_settings_metainfo::PREFIX, '');
     }
 }
示例#5
0
 protected function doAction()
 {
     if (($msg = $this->extractArchiveTo(rex_path::addon($this->addonkey))) !== true) {
         return $msg;
     }
     rex_package_manager::synchronizeWithFileSystem();
     rex_install_packages::addedPackage($this->addonkey);
 }
示例#6
0
 public function __construct()
 {
     $this->root_dir = rex_path::addon('be_style');
     $this->scss_file = rex_path::addon('be_style', 'assets') . 'styles.scss';
     $this->css_file = rex_path::addon('be_style', 'assets') . 'styles.css';
     $this->formatter = 'scss_formatter_compressed';
     $this->strip_comments = true;
 }
示例#7
0
 public function __construct($tableName, $fieldset, $whereCondition, $method = 'post', $debug = false)
 {
     parent::rex_form($tableName, $fieldset, $whereCondition, $method, $debug);
     if (OOAddon::isAvailable('metainfo')) {
         require_once rex_path::addon('metainfo', 'extensions/extension_art_metainfo.inc.php');
         $sqlCols = rex_asd_news_config::getConfig('sql');
         $this->sqlFields = _rex_a62_metainfo_sqlfields('asd_', 'AND (`p`.`restrictions` = "" OR p.`restrictions` LIKE "%|' . $this->getValue($sqlCols['category']) . '|%") ');
     }
 }
示例#8
0
 public function execute()
 {
     $config = rex_plugin::get('cronjob', 'article_status')->getProperty('config');
     $from = $config['from'];
     $to = $config['to'];
     $from['before'] = (array) $from['before'];
     $to['before'] = (array) $to['before'];
     $sql = rex_sql::factory();
     // $sql->setDebug();
     $sql->setQuery('
         SELECT  name
         FROM    ' . rex::getTablePrefix() . 'metainfo_field
         WHERE   name="' . $from['field'] . '" OR name="' . $to['field'] . '"
     ');
     $rows = $sql->getRows();
     if ($rows < 2) {
         if ($rows == 0) {
             $msg = 'Metainfo fields "' . $from['field'] . '" and "' . $to['field'] . '" not found';
         } else {
             $field = $sql->getValue('name') == $from['field'] ? $to['field'] : $from['field'];
             $msg = 'Metainfo field "' . $field . '" not found';
         }
         $this->setMessage($msg);
         return false;
     }
     $time = time();
     $sql->setQuery('
         SELECT  id, clang_id, status
         FROM    ' . rex::getTablePrefix() . 'article
         WHERE
             (     ' . $from['field'] . ' > 0
             AND   ' . $from['field'] . ' < ' . $time . '
             AND   status IN (' . implode(',', $from['before']) . ')
             AND   (' . $to['field'] . ' > ' . $time . ' OR ' . $to['field'] . ' = 0 OR ' . $to['field'] . ' = "")
             )
         OR
             (     ' . $to['field'] . ' > 0
             AND   ' . $to['field'] . ' < ' . $time . '
             AND   status IN (' . implode(',', $to['before']) . ')
             )
     ');
     $rows = $sql->getRows();
     include_once rex_path::addon('structure', 'functions/function_rex_structure.php');
     for ($i = 0; $i < $rows; ++$i) {
         if (in_array($sql->getValue('status'), $from['before'])) {
             $status = $from['after'];
         } else {
             $status = $to['after'];
         }
         rex_article_service::articleStatus($sql->getValue('id'), $sql->getValue('clang_id'), $status);
         $sql->next();
     }
     $this->setMessage('Updated articles: ' . $rows);
     return true;
 }
示例#9
0
文件: setup.php 项目: skerbis/redaxo
 /**
  * very basic setup steps, so everything is in place for our browser-based setup wizard.
  *
  * @param string $skinAddon
  * @param string $skinPlugin
  */
 public static function init($skinAddon = 'be_style', $skinPlugin = 'redaxo')
 {
     // initial purge all generated files
     rex_delete_cache();
     // delete backend session
     rex_backend_login::deleteSession();
     // copy alle media files of the current rex-version into redaxo_media
     rex_dir::copy(rex_path::core('assets'), rex_path::assets());
     // copy skins files/assets
     rex_dir::copy(rex_path::addon($skinAddon, 'assets'), rex_path::addonAssets($skinAddon));
     rex_dir::copy(rex_path::plugin($skinAddon, $skinPlugin, 'assets'), rex_path::pluginAssets($skinAddon, $skinPlugin));
 }
示例#10
0
 function readFolder($dir)
 {
     if (!is_dir($dir)) {
         rex_dir::copy(rex_path::addon('import_export', 'backup'), rex_path::addonData('import_export', 'backups'));
     }
     $hdl = opendir($dir);
     $folder = array();
     while (false !== ($file = readdir($hdl))) {
         $folder[] = $file;
     }
     return $folder;
 }
示例#11
0
 public static function getMyPackages()
 {
     if (is_array(self::$myPackages)) {
         return self::$myPackages;
     }
     self::$myPackages = self::getPackages('?only_my=1');
     foreach (self::$myPackages as $key => $addon) {
         if (!is_dir(rex_path::addon($key))) {
             unset(self::$myPackages[$key]);
         }
     }
     return self::$myPackages;
 }
示例#12
0
 public function execute()
 {
     include_once rex_path::addon('import_export', 'functions/function_import_export.php');
     include_once rex_path::addon('import_export', 'functions/function_import_folder.php');
     $filename = $this->getParam('filename', self::DEFAULT_FILENAME);
     $filename = str_replace('%REX_SERVER', parse_url(rex::getServer(), PHP_URL_HOST), $filename);
     $filename = str_replace('%REX_VERSION', rex::getVersion(), $filename);
     $filename = strftime($filename);
     $file = $filename;
     $dir = getImportDir() . '/';
     $ext = '.sql';
     if (file_exists($dir . $file . $ext)) {
         $i = 1;
         while (file_exists($dir . $file . '_' . $i . $ext)) {
             ++$i;
         }
         $file = $file . '_' . $i;
     }
     if (rex_a1_export_db($dir . $file . $ext)) {
         $message = $file . $ext . ' created';
         if ($this->sendmail) {
             if (!rex_addon::get('phpmailer')->isAvailable()) {
                 $this->setMessage($message . ', mail not sent (addon "phpmailer" isn\'t activated)');
                 return false;
             }
             $mail = new rex_mailer();
             $mail->AddAddress($this->mailaddress);
             $mail->Subject = rex_i18n::msg('im_export_mail_subject');
             $mail->Body = rex_i18n::msg('im_export_mail_body', rex::getServerName());
             $mail->AddAttachment($dir . $file . $ext, $filename . $ext);
             if ($mail->Send()) {
                 $this->setMessage($message . ', mail sent');
                 return true;
             }
             $this->setMessage($message . ', mail not sent');
             return false;
         }
         $this->setMessage($message);
         return true;
     }
     $this->setMessage($file . $ext . ' not created');
     return false;
 }
示例#13
0
 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('You do not have the permission!');
     }
     $addonkey = rex_request('addonkey', 'string');
     $upload = rex_request('upload', [['upload_file', 'bool'], ['oldversion', 'string'], ['redaxo', 'array[string]'], ['description', 'string'], ['status', 'int'], ['replace_assets', 'bool'], ['ignore_tests', 'bool']]);
     $file = [];
     $archive = null;
     $file['version'] = $upload['upload_file'] ? rex_addon::get($addonkey)->getVersion() : $upload['oldversion'];
     $file['redaxo_versions'] = $upload['redaxo'];
     $file['description'] = $upload['description'];
     $file['status'] = $upload['status'];
     try {
         if ($upload['upload_file']) {
             $archive = rex_path::addonCache('install', md5($addonkey . time()) . '.zip');
             $exclude = [];
             if ($upload['replace_assets']) {
                 $exclude[] = 'assets';
             }
             if ($upload['ignore_tests']) {
                 $exclude[] = 'tests';
             }
             rex_install_archive::copyDirToArchive(rex_path::addon($addonkey), $archive, null, $exclude);
             if ($upload['replace_assets']) {
                 rex_install_archive::copyDirToArchive(rex_url::addonAssets($addonkey), $archive, $addonkey . '/assets');
             }
             $file['checksum'] = md5_file($archive);
         }
         rex_install_webservice::post(rex_install_packages::getPath('?package=' . $addonkey . '&file_id=' . rex_request('file', 'int', 0)), ['file' => $file], $archive);
     } catch (rex_functional_exception $e) {
         throw new rex_api_exception($e->getMessage());
     }
     if ($archive) {
         rex_file::delete($archive);
     }
     unset($_REQUEST['addonkey']);
     unset($_REQUEST['file']);
     rex_install_packages::deleteCache();
     return new rex_api_result(true, rex_i18n::msg('install_info_addon_uploaded', $addonkey));
 }
示例#14
0
 public function asImage()
 {
     if ($this->asImage) {
         return;
     }
     $this->asImage = true;
     $this->image = [];
     $this->image['format'] = strtolower(rex_file::extension($this->getMediapath()));
     $this->image['src'] = false;
     // if mimetype detected and in imagemap -> change format
     if (class_exists('finfo') && ($finfo = new finfo(FILEINFO_MIME_TYPE))) {
         if ($ftype = @$finfo->file($this->image['filepath'])) {
             if (array_key_exists($ftype, $this->mimetypeMap)) {
                 $this->image['format'] = $this->mimetypeMap[$ftype];
             }
         }
     }
     if ($this->image['format'] == 'jpg' || $this->image['format'] == 'jpeg') {
         $this->image['format'] = 'jpeg';
         $this->image['src'] = @imagecreatefromjpeg($this->getMediapath());
     } elseif ($this->image['format'] == 'gif') {
         $this->image['src'] = @imagecreatefromgif($this->getMediapath());
     } elseif ($this->image['format'] == 'wbmp') {
         $this->image['src'] = @imagecreatefromwbmp($this->getMediapath());
     } else {
         $this->image['src'] = @imagecreatefrompng($this->getMediapath());
         if ($this->image['src']) {
             imagealphablending($this->image['src'], false);
             imagesavealpha($this->image['src'], true);
             $this->image['format'] = 'png';
         }
     }
     if (!$this->image['src']) {
         $this->setMediapath(rex_path::addon('media_manager', 'media/warning.jpg'));
         $this->asImage();
     } else {
         $this->refreshImageDimensions();
     }
 }
示例#15
0
<?php

rex_yform::addTemplatePath(rex_path::addon('yform', 'ytemplates'));
示例#16
0
 public function __destruct()
 {
     rex_dir::delete(rex_path::addon('.new.' . $this->addonkey));
 }
示例#17
0
文件: addon.php 项目: staabm/redaxo
 /**
  * {@inheritdoc}
  */
 public function getPath($file = '')
 {
     return rex_path::addon($this->getName(), $file);
 }
示例#18
0
                </div>
                <script type="text/javascript">
                     <!--
                    jQuery(function($) {
                        $("#serverbezeichnung").focus();
                    });
                     //-->
                </script>';
}
// ---------------------------------- MODUS 3 | Datenbank anlegen ...
if ($checkmodus == 3 && $send == 1) {
    $err_msg = '';
    $dbanlegen = rex_post('dbanlegen', 'int', '');
    // -------------------------- Benötigte Tabellen prüfen
    $requiredTables = array($REX['TABLE_PREFIX'] . 'action', $REX['TABLE_PREFIX'] . 'article', $REX['TABLE_PREFIX'] . 'article_slice', $REX['TABLE_PREFIX'] . 'clang', $REX['TABLE_PREFIX'] . 'file', $REX['TABLE_PREFIX'] . 'file_category', $REX['TABLE_PREFIX'] . 'module_action', $REX['TABLE_PREFIX'] . 'module', $REX['TABLE_PREFIX'] . 'template', $REX['TABLE_PREFIX'] . 'user');
    rex_dir::copy(rex_path::addon('import_export', 'backup'), rex_path::addonData('import_export', 'backups'));
    if ($dbanlegen == 4) {
        // ----- vorhandenen seite updaten
        $info_msg = '';
        // import uploaded 4.x dump
        if (isset($_FILES['FORM']) && $_FILES['FORM']['size']['importfile'] < 1) {
            // no upload file error
            $err_msg = $I18N->msg('setup_03801') . '<br>';
        } else {
            // drop rex_* tables
            $info_msg .= rex_setup_dropREXtables();
            // set database default charset
            $info_msg .= rex_setup_setDBcharset('utf8 COLLATE utf8_general_ci');
            // create temp sql dump from upload
            $tmp_sql = getImportDir() . '/temp.sql';
            if (@move_uploaded_file($_FILES['FORM']['tmp_name']['importfile'], $tmp_sql)) {
示例#19
0
文件: boot.php 项目: skerbis/redaxo
<?php

/**
 * Backendstyle Addon.
 *
 * @author jan.kristinus[at]redaxo[dot]de Jan Kristinus
 * @author <a href="http://www.yakamara.de">www.yakamara.de</a>
 * @author markus[dot]staab[at]redaxo[dot]de Markus Staab
 * @author <a href="http://www.redaxo.org">www.redaxo.org</a>
 *
 * @package redaxo5
 */
$mypage = 'be_style';
/* Addon Parameter */
if (rex::isBackend()) {
    require_once rex_path::addon($mypage, 'extensions/function_extensions.php');
    rex_extension::register('PACKAGES_INCLUDED', 'rex_be_add_page');
    $files = [$this->getPath('vendor/bootstrap/assets/javascripts/bootstrap.js') => $this->getAssetsPath('javascripts/bootstrap.js'), $this->getPath('vendor/bootstrap/assets/fonts/bootstrap/glyphicons-halflings-regular.eot') => $this->getAssetsPath('fonts/bootstrap/glyphicons-halflings-regular.eot'), $this->getPath('vendor/bootstrap/assets/fonts/bootstrap/glyphicons-halflings-regular.svg') => $this->getAssetsPath('fonts/bootstrap/glyphicons-halflings-regular.svg'), $this->getPath('vendor/bootstrap/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf') => $this->getAssetsPath('fonts/bootstrap/glyphicons-halflings-regular.ttf'), $this->getPath('vendor/bootstrap/assets/fonts/bootstrap/glyphicons-halflings-regular.woff') => $this->getAssetsPath('fonts/bootstrap/glyphicons-halflings-regular.woff'), $this->getPath('vendor/font-awesome/fonts/fontawesome-webfont.eot') => $this->getAssetsPath('fonts/fontawesome-webfont.eot'), $this->getPath('vendor/font-awesome/fonts/fontawesome-webfont.svg') => $this->getAssetsPath('fonts/fontawesome-webfont.svg'), $this->getPath('vendor/font-awesome/fonts/fontawesome-webfont.ttf') => $this->getAssetsPath('fonts/fontawesome-webfont.ttf'), $this->getPath('vendor/font-awesome/fonts/fontawesome-webfont.woff') => $this->getAssetsPath('fonts/fontawesome-webfont.woff'), $this->getPath('vendor/font-awesome/fonts/FontAwesome.otf') => $this->getAssetsPath('fonts/FontAwesome.otf')];
    foreach ($files as $source => $destination) {
        if (!file_exists($destination)) {
            rex_file::copy($source, $destination);
        }
    }
    rex_extension::register('PACKAGES_INCLUDED', function () {
        if (rex::getUser() && $this->getProperty('compile')) {
            $compiler = new rex_scss_compiler();
            $scss_files = rex_extension::registerPoint(new rex_extension_point('BE_STYLE_SCSS_FILES', [$this->getPath('scss/master.scss')]));
            $compiler->setScssFile($scss_files);
            //$compiler->setScssFile($this->getPath('scss/master.scss'));
            // Compile in backend assets dir
            $compiler->setCssFile($this->getPath('assets/css/styles.css'));
示例#20
0
 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('You do not have the permission!');
     }
     $installAddon = rex_addon::get('install');
     $versions = self::getVersions();
     $versionId = rex_request('version_id', 'int');
     if (!isset($versions[$versionId])) {
         return null;
     }
     $version = $versions[$versionId];
     if (!rex_string::versionCompare($version['version'], rex::getVersion(), '>')) {
         throw new rex_api_exception(sprintf('Existing version of Core (%s) is newer than %s', rex::getVersion(), $version['version']));
     }
     try {
         $archivefile = rex_install_webservice::getArchive($version['path']);
     } catch (rex_functional_exception $e) {
         throw new rex_api_exception($e->getMessage());
     }
     $message = '';
     $temppath = rex_path::coreCache('.new.core/');
     try {
         if ($version['checksum'] != md5_file($archivefile)) {
             throw new rex_functional_exception($installAddon->i18n('warning_zip_wrong_checksum'));
         }
         if (!rex_install_archive::extract($archivefile, $temppath)) {
             throw new rex_functional_exception($installAddon->i18n('warning_core_zip_not_extracted'));
         }
         if (!is_dir($temppath . 'core')) {
             throw new rex_functional_exception($installAddon->i18n('warning_zip_wrong_format'));
         }
         $coreAddons = [];
         /** @var rex_addon[] $updateAddons */
         $updateAddons = [];
         if (is_dir($temppath . 'addons')) {
             foreach (rex_finder::factory($temppath . 'addons')->dirsOnly() as $dir) {
                 $addonkey = $dir->getBasename();
                 $addonPath = $dir->getRealPath() . '/';
                 if (!file_exists($addonPath . rex_package::FILE_PACKAGE)) {
                     continue;
                 }
                 $config = rex_file::getConfig($addonPath . rex_package::FILE_PACKAGE);
                 if (!isset($config['version']) || rex_addon::exists($addonkey) && rex_string::versionCompare($config['version'], rex_addon::get($addonkey)->getVersion(), '<')) {
                     continue;
                 }
                 $coreAddons[$addonkey] = $addonkey;
                 if (rex_addon::exists($addonkey)) {
                     $updateAddons[$addonkey] = rex_addon::get($addonkey);
                     $updateAddonsConfig[$addonkey] = $config;
                 }
             }
         }
         //$config = rex_file::getConfig($temppath . 'core/default.config.yml');
         //foreach ($config['system_addons'] as $addonkey) {
         //    if (is_dir($temppath . 'addons/' . $addonkey) && rex_addon::exists($addonkey)) {
         //        $updateAddons[$addonkey] = rex_addon::get($addonkey);
         //    }
         //}
         $this->checkRequirements($temppath, $version['version'], $updateAddonsConfig);
         if (file_exists($temppath . 'core/update.php')) {
             include $temppath . 'core/update.php';
         }
         foreach ($updateAddons as $addonkey => $addon) {
             if ($addon->isInstalled() && file_exists($file = $temppath . 'addons/' . $addonkey . '/' . rex_package::FILE_UPDATE)) {
                 try {
                     $addon->includeFile($file);
                     if ($msg = $addon->getProperty('updatemsg', '')) {
                         throw new rex_functional_exception($msg);
                     }
                     if (!$addon->getProperty('update', true)) {
                         throw new rex_functional_exception(rex_i18n::msg('package_no_reason'));
                     }
                 } catch (rex_functional_exception $e) {
                     throw new rex_functional_exception($addonkey . ': ' . $e->getMessage(), $e);
                 } catch (rex_sql_exception $e) {
                     throw new rex_functional_exception($addonkey . ': SQL error: ' . $e->getMessage(), $e);
                 }
             }
         }
         // create backup
         $installConfig = rex_file::getCache($installAddon->getDataPath('config.json'));
         if (isset($installConfig['backups']) && $installConfig['backups']) {
             rex_dir::create($installAddon->getDataPath());
             $archive = $installAddon->getDataPath(strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', rex::getVersion())) . '.zip');
             rex_install_archive::copyDirToArchive(rex_path::core(), $archive);
             foreach ($updateAddons as $addonkey => $addon) {
                 rex_install_archive::copyDirToArchive($addon->getPath(), $archive, 'addons/' . $addonkey);
             }
         }
         // copy plugins to new addon dirs
         foreach ($updateAddons as $addonkey => $addon) {
             foreach ($addon->getRegisteredPlugins() as $plugin) {
                 $pluginPath = $temppath . 'addons/' . $addonkey . '/plugins/' . $plugin->getName();
                 if (!is_dir($pluginPath)) {
                     rex_dir::copy($plugin->getPath(), $pluginPath);
                 } elseif ($plugin->isInstalled() && is_dir($pluginPath . '/assets')) {
                     rex_dir::copy($pluginPath . '/assets', $plugin->getAssetsPath());
                 }
             }
         }
         // move temp dirs to permanent destination
         rex_dir::delete(rex_path::core());
         rename($temppath . 'core', rex_path::core());
         if (is_dir(rex_path::core('assets'))) {
             rex_dir::copy(rex_path::core('assets'), rex_path::coreAssets());
         }
         foreach ($coreAddons as $addonkey) {
             if (isset($updateAddons[$addonkey])) {
                 rex_dir::delete(rex_path::addon($addonkey));
             }
             rename($temppath . 'addons/' . $addonkey, rex_path::addon($addonkey));
             if (is_dir(rex_path::addon($addonkey, 'assets'))) {
                 rex_dir::copy(rex_path::addon($addonkey, 'assets'), rex_path::addonAssets($addonkey));
             }
         }
     } catch (rex_functional_exception $e) {
         $message = $e->getMessage();
     } catch (rex_sql_exception $e) {
         $message = 'SQL error: ' . $e->getMessage();
     }
     rex_file::delete($archivefile);
     rex_dir::delete($temppath);
     if ($message) {
         $message = $installAddon->i18n('warning_core_not_updated') . '<br />' . $message;
         $success = false;
     } else {
         $message = $installAddon->i18n('info_core_updated');
         $success = true;
         rex_delete_cache();
         rex_install_webservice::deleteCache('core');
     }
     $result = new rex_api_result($success, $message);
     if ($success) {
         $result->setRequiresReboot(true);
     }
     return $result;
 }
示例#21
0
 /**
  * set all necessary information about the addon
  * @param $folder
  * @param $table
  * @param $tableCategory
  */
 public static function init($folder, $table, $tableCategory)
 {
     global $REX;
     self::$folderName = $folder;
     self::$tableName = $REX['TABLE_PREFIX'] . $table;
     self::$tableNameCategory = $REX['TABLE_PREFIX'] . $tableCategory;
     self::$defaultConfigFile = rex_path::addon(self::$folderName, 'data/config.json');
     self::$configFile = rex_path::addonData(self::$folderName, 'config.json');
     self::$defaultConfig = json_decode(file_get_contents(self::$defaultConfigFile), true);
     self::$config = json_decode(file_get_contents(self::$configFile), true);
     self::setBaseUrl();
 }
示例#22
0
<?php

$file = rex_file::get(rex_path::addon('aufgaben', 'CHANGELOG.md'));
$Parsedown = new Parsedown();
$content = '<div id="aufgaben">' . $Parsedown->text($file) . '</div>';
$fragment = new rex_fragment();
$fragment->setVar('title', $this->i18n('aufgaben_changelog'));
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
示例#23
0
 /**
  * @param string $file
  * @return string
  */
 public static function getModulCode($file)
 {
     $file = rex_path::addon(rex_asd_news_config::getName(), 'modules/' . $file);
     return file_get_contents($file);
 }
示例#24
0
文件: manager.php 项目: DECAF/redaxo
 /**
  * Synchronizes the packages with the file system.
  */
 public static function synchronizeWithFileSystem()
 {
     $config = rex::getConfig('package-config');
     $addons = self::readPackageFolder(rex_path::src('addons'));
     $registeredAddons = array_keys(rex_addon::getRegisteredAddons());
     foreach (array_diff($registeredAddons, $addons) as $addonName) {
         $manager = rex_addon_manager::factory(rex_addon::get($addonName));
         $manager->_delete(true);
         unset($config[$addonName]);
     }
     foreach ($addons as $addonName) {
         if (!rex_addon::exists($addonName)) {
             $config[$addonName]['install'] = false;
             $config[$addonName]['status'] = false;
             $registeredPlugins = [];
         } else {
             $addon = rex_addon::get($addonName);
             $config[$addonName]['install'] = $addon->isInstalled();
             $config[$addonName]['status'] = $addon->isAvailable();
             $registeredPlugins = array_keys($addon->getRegisteredPlugins());
         }
         $plugins = self::readPackageFolder(rex_path::addon($addonName, 'plugins'));
         foreach (array_diff($registeredPlugins, $plugins) as $pluginName) {
             $manager = rex_plugin_manager::factory(rex_plugin::get($addonName, $pluginName));
             $manager->_delete(true);
             unset($config[$addonName]['plugins'][$pluginName]);
         }
         foreach ($plugins as $pluginName) {
             $plugin = rex_plugin::get($addonName, $pluginName);
             $config[$addonName]['plugins'][$pluginName]['install'] = $plugin->isInstalled();
             $config[$addonName]['plugins'][$pluginName]['status'] = $plugin->getProperty('status');
         }
         if (isset($config[$addonName]['plugins']) && is_array($config[$addonName]['plugins'])) {
             ksort($config[$addonName]['plugins']);
         }
     }
     ksort($config);
     rex::setConfig('package-config', $config);
     rex_addon::initialize();
 }
示例#25
0
文件: setup.php 项目: skerbis/redaxo
 if (count($errors) > 0) {
     $errors[] = rex_view::error(rex_i18n::msg('setup_503'));
     $submit_message = rex_i18n::msg('setup_512');
 }
 $dbchecked = array_fill(0, 6, '');
 switch ($createdb) {
     case 1:
     case 2:
     case 3:
     case 4:
         $dbchecked[$createdb] = ' checked="checked"';
         break;
     default:
         $dbchecked[0] = ' checked="checked"';
 }
 $export_addon_dir = rex_path::addon('import_export');
 require_once $export_addon_dir . '/functions/function_folder.php';
 require_once $export_addon_dir . '/functions/function_import_folder.php';
 // Vorhandene Exporte auslesen
 $sel_export = new rex_select();
 $sel_export->setName('import_name');
 $sel_export->setId('rex-form-import-name');
 $sel_export->setSize(1);
 $sel_export->setStyle('class="form-control rex-js-import-name"');
 $sel_export->setAttribute('onclick', 'checkInput(\'createdb_3\')');
 $export_dir = getImportDir();
 $exports_found = false;
 if (is_dir($export_dir)) {
     if ($handle = opendir($export_dir)) {
         $export_archives = [];
         $export_sqls = [];
示例#26
0
文件: import.php 项目: alsahh/redaxo
 private static function import($import_sql, $import_archiv = null)
 {
     $err_msg = '';
     if (!is_dir(rex_path::addon('backup'))) {
         $err_msg .= rex_i18n::msg('setup_510') . '<br />';
     } else {
         if (file_exists($import_sql) && ($import_archiv === null || $import_archiv !== null && file_exists($import_archiv))) {
             rex_i18n::addDirectory(rex_path::addon('backup', 'lang/'));
             // DB Import
             $state_db = rex_backup::importDb($import_sql);
             if ($state_db['state'] === false) {
                 $err_msg .= nl2br($state_db['message']) . '<br />';
             }
             // Archiv optional importieren
             if ($state_db['state'] === true && $import_archiv !== null) {
                 $state_archiv = rex_backup::importFiles($import_archiv);
                 if ($state_archiv['state'] === false) {
                     $err_msg .= $state_archiv['message'] . '<br />';
                 }
             }
         } else {
             $err_msg .= rex_i18n::msg('setup_509') . '<br />';
         }
     }
     return $err_msg;
 }
示例#27
0
           <col width="40">
           <col width="153">
           <col width="*">
           <col width="153">
         </colgroup>
      <thead>
         <tr>
             <th class="rex-icon"><a class="rex-i-refresh rex-i-element" href="index.php?page=install&amp;subpage=add&amp;func=reload" title="' . $I18N->msg('install_reload') . '"><span class="rex-i-element-text">' . $I18N->msg('install_reload') . '</span></a></th>
             <th class="rex-key">' . $I18N->msg('install_key') . '</th>
             <th class="rex-shortdescription">' . $I18N->msg('install_shortdescription') . '</th>
             <th class="rex-function">' . $I18N->msg('install_header_function') . '</th>
         </tr>
      </thead>
      <tbody>';
 foreach ($addons as $key => $addon) {
     if (is_dir(rex_path::addon($key))) {
         $content .= '
             <tr>
                 <td class="rex-icon"><span class="rex-i-element rex-i-addon"><span class="rex-i-element-text"></span></span></td>
                 <td class="rex-key">' . htmlspecialchars($key) . '</td>
                 <td class="rex-shortdescription"><h4>' . htmlspecialchars($addon['name']) . '</h4><i>' . htmlspecialchars($addon['author']) . '</i><br /><br />' . nl2br(htmlspecialchars($addon['shortdescription'])) . '</td>
                 <td class="rex-view">' . $I18N->msg('install_addon_already_exists') . '</td>
             </tr>';
     } else {
         $url = 'index.php?page=install&amp;subpage=add&amp;addonkey=' . htmlspecialchars($key);
         $content .= '
             <tr>
                 <td class="rex-icon"><a href="' . $url . '"><span class="rex-i-element rex-i-addon"><span class="rex-i-element-text"></span></span></a></td>
                 <td class="rex-key"><a href="' . $url . '">' . htmlspecialchars($key) . '</a></td>
                 <td class="rex-shortdescription"><h4>' . htmlspecialchars($addon['name']) . '</h4><i>' . htmlspecialchars($addon['author']) . '</i><br /><br />' . nl2br(htmlspecialchars($addon['shortdescription'])) . '</td>
                 <td class="rex-view"><a href="' . $url . '" class="rex-link rex-view">' . $I18N->msg('install_view') . '</a></td>
示例#28
0
function getImportDir()
{
    return rex_path::addon('import_export', 'backup');
}
示例#29
0
<?php

/**
 * rex5_multiupload Addon.
 * @author Friends Of REDAXO
 * @package redaxo
 * @var rex_addon $this
 */
$addon = rex_addon::get('rex5_multiupload');
$addon->getProperty("php_debug");
if ($addon->getProperty("php_debug")) {
    ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 1);
}
require_once rex_path::addon("rex5_multiupload", "fragments/action.upload.php");
示例#30
0
<?php

$func = rex_request('func', 'string');
if ($func == 'import_beispieldaten') {
    $current_user = rex::getUser()->getId();
    $sql = rex_sql::factory();
    //$sql->setDebug();
    $sql->setQuery('SELECT * FROM rex_user WHERE id = ' . $current_user);
    $user = $sql->getValue('name');
    $qry = "\n\n  -- Aufgaben\n\n  INSERT IGNORE `rex_aufgaben` VALUES\n      (1, 'Fav Icon erstellen', 'Wird immer benötigt',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n      (2, 'Touch Icon erstellen', '',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n      (3, 'Meta Infos erstellen', 'Sind Ortsbezogene meta Infos wichtig?',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n      (4, 'Print.css entwickeln', 'Wird immer vergessen',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n      (5, 'robots.txt prüfen', ':-)',7,1,0,1,now(),now(),'{$user}','{$user}','','');\n\n  -- Kategorien\n\n  INSERT IGNORE `rex_aufgaben_categories` VALUES\n      (1,'Grundlagen','#9EAEC2'),\n      (2,'Backend','#588D76'),\n      (3,'Design','#8D588A'),\n      (4,'Funktion','#9EAEC2'),\n      (5,'Fehler','#72A3A7'),\n      (6,'Wunsch','#FFD83D'),\n      (7,'SEO','#437047');\n\n-- User Settings\n\n  INSERT IGNORE `rex_aufgaben_user_settings` VALUES (1,{$current_user},5);\n  ";
    $sql = rex_sql::factory();
    // $sql->setDebug();
    $sql->setQuery($qry);
    echo '<div class="alert alert-success">Der Beispieldaten wurden eingefügt.</div>';
    $func = '';
}
$file = rex_file::get(rex_path::addon('aufgaben', 'README.md'));
$Parsedown = new Parsedown();
$content = '<div id="aufgaben">' . $Parsedown->text($file);
$content .= '
<hr/>
<p><a href="index.php?page=aufgaben/info&amp;func=import_beispieldaten"><i class="rex-icon rex-icon-module"></i> Beispieldaten importieren</a>
</p>
</div>
';
$fragment = new rex_fragment();
$fragment->setVar('title', 'Hilfe');
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');