function rex_mailer() { global $REX; $this->From = '*****@*****.**'; $this->FromName = 'Mailer'; $this->ConfirmReadingTo = ''; $this->AdminBcc = ''; $this->Mailer = 'mail'; $this->Host = 'localhost'; $this->Port = 25; $this->CharSet = 'utf-8'; $this->WordWrap = 120; $this->Encoding = '8bit'; $this->Priority = 3; $this->SMTPSecure = ''; $this->SMTPAuth = false; $this->Username = ''; $this->Password = ''; $settings = rex_path::addonData('phpmailer', 'settings.inc.php'); if (file_exists($settings)) { include $settings; } $this->PluginDir = $REX['INCLUDE_PATH'] . '/addons/phpmailer/classes/'; if ($this->AdminBcc !== '') { parent::AddBCC($this->AdminBcc); } }
public function doAction() { $path = rex_path::addon($this->addonkey); $temppath = rex_path::addon('.new.' . $this->addonkey); if (($msg = $this->extractArchiveTo($temppath)) !== true) { return $msg; } if ($this->addon->isAvailable() && ($msg = $this->checkRequirements()) !== true) { return $msg; } // ---- include update.php if ($this->addon->isInstalled() && file_exists($temppath . rex_package::FILE_UPDATE)) { try { $this->addon->includeFile('../.new.' . $this->addonkey . '/' . rex_package::FILE_UPDATE); } catch (rex_functional_exception $e) { return $e->getMessage(); } catch (rex_sql_exception $e) { return 'SQL error: ' . $e->getMessage(); } if (($msg = $this->addon->getProperty('updatemsg', '')) != '') { return $msg; } if (!$this->addon->getProperty('update', true)) { return rex_i18n::msg('package_no_reason'); } } // ---- backup $assets = $this->addon->getAssetsPath(); if (rex_addon::get('install')->getConfig('backups')) { $archivePath = rex_path::addonData('install', $this->addonkey . '/'); rex_dir::create($archivePath); $archive = $archivePath . strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', $this->addon->getVersion('0'))) . '.zip'; rex_install_archive::copyDirToArchive($path, $archive); if (is_dir($assets)) { rex_install_archive::copyDirToArchive($assets, $archive, 'assets'); } } // ---- copy plugins to new addon dir foreach ($this->addon->getRegisteredPlugins() as $plugin) { $pluginPath = $temppath . '/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()); } } // ---- update main addon dir rex_dir::delete($path); rename($temppath, $path); // ---- update assets $origAssets = $this->addon->getPath('assets'); if ($this->addon->isInstalled() && is_dir($origAssets)) { rex_dir::copy($origAssets, $assets); } $this->addon->setProperty('version', $this->file['version']); rex_install_packages::updatedPackage($this->addonkey, $this->fileId); }
public function doAction() { global $I18N, $REX; // $REX is needed for update.inc.php $path = rex_path::addon($this->addonkey); $temppath = rex_path::addon('.new.' . $this->addonkey); if (($msg = $this->extractArchiveTo($temppath)) !== true) { return $msg; } // ---- include update.php if (file_exists($temppath . 'update.inc.php')) { try { require $temppath . 'update.inc.php'; } catch (rex_install_functional_exception $e) { return $e->getMessage(); } if (($msg = OOAddon::getProperty($this->addonkey, 'updatemsg', '')) != '') { return $msg; } if (!OOAddon::getProperty($this->addonkey, 'update', true)) { return $I18N->msg('package_no_reason'); } } // ---- backup $assets = rex_path::addonAssets($this->addonkey); if (OOAddon::getProperty('install', 'backups')) { $archivePath = rex_path::addonData('install', $this->addonkey . '/'); rex_dir::create($archivePath); $archive = $archivePath . strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', OOAddon::getVersion($this->addonkey))) . '.zip'; rex_install_archive::copyDirToArchive($path, $archive); if (is_dir($assets)) { rex_install_archive::copyDirToArchive($assets, $archive, 'assets'); } } // ---- copy plugins to new addon dir foreach (OOPlugin::getRegisteredPlugins($this->addonkey) as $plugin) { $pluginPath = $temppath . '/plugins/' . $plugin; if (!is_dir($pluginPath)) { rex_dir::copy(rex_path::plugin($this->addonkey, $plugin), $pluginPath); } elseif (OOPlugin::isInstalled($this->addonkey, $plugin) && is_dir($pluginPath . '/files')) { rex_dir::copy($pluginPath . '/files', rex_path::pluginAssets($this->addonkey, $plugin)); } } // ---- update main addon dir rex_dir::delete($path); rename($temppath, $path); // ---- update assets $origAssets = rex_path::addon($this->addonkey, 'assets'); if (is_dir($origAssets)) { rex_dir::copy($origAssets, $assets); } OOAddon::setProperty($this->addonkey, 'version', $this->file['version']); rex_install_packages::updatedPackage($this->addonkey, $this->fileId); }
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; }
public function log($success, $message) { $name = $this->name; if (!$name) { if ($this->cronjob instanceof rex_cronjob) { $name = rex::isBackend() ? $this->cronjob->getTypeName() : $this->cronjob->getType(); } else { $name = '[no name]'; } } $log = new rex_log_file(rex_path::addonData('cronjob', 'cronjob.log'), 2000000); $data = [$success ? 'SUCCESS' : 'ERROR', $this->id ?: '--', $name, strip_tags($message)]; $log->add($data); }
private function backup() { $content = '<!-- ' . PHP_EOL . date('d.m.Y H:i:s') . PHP_EOL; $content .= 'From : ' . $this->From . PHP_EOL; $content .= 'To : ' . implode(', ', array_column($this->getToAddresses(), 0)) . PHP_EOL; $content .= 'Subject : ' . $this->Subject . PHP_EOL; $content .= ' -->' . PHP_EOL; $content .= $this->Body; $dir = rex_path::addonData('phpmailer', 'mail_backup/' . date('Y') . '/' . date('m')); $count = 1; $backupFile = $dir . '/' . date('Y-m-d_H_i_s') . '.html'; while (file_exists($backupFile)) { $backupFile = $dir . '/' . date('Y-m-d_H_i_s') . '_' . ++$count . '.html'; } rex_file::put($backupFile, $content); }
function getImportDir() { return rex_path::addonData('import_export', 'backups'); }
<?php /** @var i18n $I18N */ $content = ''; $settings = rex_post('settings', array(array('backups', 'bool', false), array('api_login', 'string'), array('api_key', 'string')), null); if (is_array($settings)) { $settingsContent = "<?php\n\n"; foreach ($settings as $key => $value) { $settingsContent .= "\$REX['ADDON'][" . var_export($key, true) . "]['install'] = " . var_export($value, true) . ";\n"; OOAddon::setProperty('install', $key, $value); } if (rex_file::put(rex_path::addonData('install', 'settings.inc.php'), $settingsContent)) { echo rex_info($I18N->msg('install_settings_saved')); } else { echo rex_warning($I18N->msg('install_settings_not_saved')); } rex_install_webservice::deleteCache(); } $content .= ' <div class="rex-addon-output"> <h2 class="rex-hl2">' . $I18N->msg('install_subpage_settings') . '</h2> <div class="rex-form"> <form action="index.php?page=install&subpage=settings" method="post"> <fieldset class="rex-form-col-1"> <legend>' . $I18N->msg('install_settings_general') . '</legend> <div class="rex-form-wrapper">'; $content .= ' <div class="rex-form-row"> <p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
*/ echo rex_view::title(rex_i18n::msg('yform')); $page = rex_request('page', 'string', ''); $yform = new rex_yform(); $yform->setHiddenField('page', $page); $yform->setObjectparams('real_field_names', true); $yform->setObjectparams('hide_top_warning_messages', true); $yform->setObjectparams('form_showformafterupdate', 1); $yform->setValueField('upload', array('name' => 'importfile', 'label' => rex_i18n::msg('yform_manager_tableset_import_jsonimportfile'), 'max_size' => '1000', 'types' => '.json', 'required' => 1, 'messages' => array(rex_i18n::msg('yform_manager_table_importset_warning_min'), rex_i18n::msg('yform_manager_table_importset_warning_max'), rex_i18n::msg('yform_manager_table_importset_warning_type'), rex_i18n::msg('yform_manager_table_importset_warning_selectfile')), 'modus' => 'no_save', 'no_db' => 'no_db')); $form = $yform->getForm(); if ($yform->objparams['actions_executed']) { try { $content = file_get_contents(rex_path::addonData('yform', 'uploads/' . $yform->objparams['value_pool']['email']['importfile'])); rex_yform_manager_table_api::importTablesets($content); echo rex_view::success(rex_i18n::msg('yform_manager_tableset_import_success')); } catch (Exception $e) { echo rex_view::warning(rex_i18n::msg('yform_manager_tableset_import_failed', '', $e->getMessage())); } rex_file::delete(rex_path::addonData('yform', 'uploads/' . $yform->objparams['value_pool']['email']['importfile'])); } else { if ($yform->objparams['send']) { echo rex_view::warning(rex_i18n::msg('yform_manager_tableset_import_warning_selectfile')); } } $fragment = new rex_fragment(); $fragment->setVar('class', 'edit', false); $fragment->setVar('title', rex_i18n::msg('yform_manager_tableset_import')); $fragment->setVar('body', $form, false); // $fragment->setVar('buttons', $buttons, false); $form = $fragment->parse('core/page/section.php'); echo $form;
public function getPath($file = '') { return rex_path::addonData('tests', 'rex_finder_test/' . $file); }
/** * 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(); }
<?php rex_dir::copy(__DIR__ . '/backup', rex_path::addonData('import_export', 'backups')); $REX['ADDON']['install']['import_export'] = 1; // ERRMSG IN CASE: $REX[ADDON][installmsg]["import_export"] = "Leider konnte nichts installiert werden da.";
<?php /** @var i18n $I18N */ $mypage = 'install'; $REX['ADDON']['version'][$mypage] = '1.0.1'; $REX['ADDON']['author'][$mypage] = 'Gregor Harlan'; $REX['ADDON']['supportpage'][$mypage] = 'redaxo.org/de/forum'; if ($REX['REDAXO']) { $I18N->appendFile(__DIR__ . '/lang/'); $REX['ADDON']['name'][$mypage] = $I18N->msg('install_title'); $REX['ADDON']['perm'][$mypage] = 'admin[]'; $REX['ADDON']['navigation'][$mypage]['block'] = 'system'; $REX['ADDON']['pages'][$mypage] = array(array('', $I18N->msg('install_subpage_update')), array('add', $I18N->msg('install_subpage_add')), array('upload', $I18N->msg('install_subpage_upload')), array('settings', $I18N->msg('install_subpage_settings'))); $REX['ADDON']['backups']['install'] = false; $REX['ADDON']['api_login']['install'] = ''; $REX['ADDON']['api_key']['install'] = ''; $settings = rex_path::addonData('install', 'settings.inc.php'); if (file_exists($settings)) { include $settings; } }
<?php /** * image_manager Addon * * @author markus.staab[at]redaxo[dot]de Markus Staab * @author jan.kristinus[at]yakmara[dot]de Jan Kristinus * * @package redaxo4 * @version svn:$Id$ */ // rex_request(); $func = rex_request('func', 'string'); $jpg_quality = rex_request('jpg_quality', 'int'); $old_syntax = rex_request('old_syntax', 'int'); $config_file = rex_path::addonData('image_manager', 'settings.inc.php'); if ($func == 'update') { if ($jpg_quality > 100) { $jpg_quality = 100; } elseif ($jpg_quality < 0) { $jpg_quality = 0; } $REX['ADDON']['image_manager']['jpg_quality'] = $jpg_quality; $content = '<?php $REX[\'ADDON\'][\'image_manager\'][\'jpg_quality\'] = ' . $jpg_quality . '; '; if (rex_file::put($config_file, $content) !== false) { echo rex_info($I18N->msg('imanager_config_saved')); } else { echo rex_warning($I18N->msg('imanager_config_not_saved'));
<?php $REX['ADDON']['yform']['templatepaths'][] = $REX['INCLUDE_PATH'] . '/addons/yform/templates/'; rex_register_extension('ADDONS_INCLUDED', function () { $REX['ADDON']['yform']['templatepaths'][] = rex_path::addonData('yform', 'templates/'); }, array(), REX_EXTENSION_EARLY); include_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/basic/class.rex_radio.inc.php'; include_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/basic/class.rex_yform_list.inc.php'; include_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/basic/class.rex_yform.inc.php'; if ($REX['REDAXO'] && $REX['USER']) { rex_i18n::msgappendFile($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang/'); $REX['ADDON'][$mypage]['SUBPAGES'] = array(); $REX['ADDON'][$mypage]['SUBPAGES'][] = array('', rex_i18n::msg('yform_overview')); if (rex::getUser()->isAdmin()) { $REX['ADDON'][$mypage]['SUBPAGES'][] = array('description', rex_i18n::msg('yform_description')); } function rex_yform_css($params) { $params['subject'] .= "\n " . '<link rel="stylesheet" type="text/css" href="../files/addons/yform/yform.css" media="screen, projection, print" />'; $params['subject'] .= "\n " . '<script src="../files/addons/yform/manager.js" type="text/javascript"></script>'; if ($REX['REDAXO']) { $params['subject'] .= "\n " . '<link rel="stylesheet" type="text/css" href="../files/addons/yform/manager.css" media="screen, projection, print" />'; } return $params['subject']; } rex_register_extension('PAGE_HEADER', 'rex_yform_css'); }
public static function getDir() { $dir = rex_path::addonData('backup'); rex_dir::create($dir); return $dir; }
static function getListValue($params) { $return = ''; $field = new rex_yform_manager_field($params['params']["field"]); if ($field->getElement('modus') == "database") { $return = '[raw data]'; } else { $upload_folder = $field->getElement('upload_folder'); if ($upload_folder == "") { $upload_folder = rex_path::addonData('yform', 'uploads'); } $value = explode("_", $params['value'], 2); if (count($value) == 2) { $hash = $value[0]; $value = $value[1]; $search_path = $upload_folder . '/' . $hash . '_' . $field->getElement('file_prefix'); $files = glob(preg_replace('/(\\*|\\?|\\[)/', '[$1]', $search_path) . '*'); if (count($files) == 1) { $return = '<a href="' . $_SERVER["REQUEST_URI"] . '&rex_upload_downloadfile=' . urlencode($params['value']) . '">' . basename($value) . '</a>'; if (rex_request("rex_upload_downloadfile") == $params['value']) { $file = $upload_folder . '/' . $params['value']; if (file_exists($file)) { ob_end_clean(); $filename = explode("_", basename($file), 2); $filename = $filename[1]; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $filename); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); readfile($file); } } } } } return $return; }
* * @author markus.staab[at]redaxo[dot]de Markus Staab * @author jan.kristinus[at]redaxo[dot]de Jan Kristinus * * @package redaxo4 * @version svn:$Id$ */ $mypage = 'image_manager'; $REX['ADDON']['name'][$mypage] = 'Image Manager'; $REX['ADDON']['perm'][$mypage] = 'image_manager[]'; $REX['ADDON']['version'][$mypage] = '1.2.1'; $REX['ADDON']['author'][$mypage] = 'Markus Staab, Jan Kristinus'; $REX['ADDON']['supportpage'][$mypage] = 'forum.redaxo.de'; $REX['PERM'][] = 'image_manager[]'; $REX['ADDON']['image_manager']['jpg_quality'] = 85; $settings = rex_path::addonData($mypage, 'settings.inc.php'); if (file_exists($settings)) { include $settings; } $REX['ADDON']['image_manager']['classpaths']['effects'] = array(); $REX['ADDON']['image_manager']['classpaths']['effects'][] = dirname(__FILE__) . '/classes/effects/'; require_once dirname(__FILE__) . '/classes/class.rex_image.inc.php'; require_once dirname(__FILE__) . '/classes/class.rex_image_cacher.inc.php'; require_once dirname(__FILE__) . '/classes/class.rex_image_manager.inc.php'; require_once dirname(__FILE__) . '/classes/class.rex_effect_abstract.inc.php'; // RUN ON EP ADDONS_INCLUDED //////////////////////////////////////////////////////////////////////////////// if (!$REX['SETUP']) { rex_register_extension('ADDONS_INCLUDED', 'image_manager_init', array(), REX_EXTENSION_EARLY); } if (!function_exists('image_manager_init')) {
$port = rex_post('port', 'int', $testMailer->Port); $charset = rex_post('charset', 'string', $testMailer->CharSet); $wordwrap = rex_post('wordwrap', 'int', $testMailer->WordWrap); $encoding = rex_post('encoding', 'string', $testMailer->Encoding); $Password = rex_post('Password', 'string', $testMailer->Password); $Username = rex_post('Username', 'string', $testMailer->Username); $smtpauth_default = $testMailer->SMTPAuth ? 'true' : 'false'; $smtpauth = rex_post('smtpauth', 'string', $smtpauth_default); $smtpsecure = rex_post('smtpsecure', 'string', $testMailer->SMTPSecure); $priority = rex_post('priority', 'int', $testMailer->Priority); if ($smtpauth != 'true') { $smtpauth = 'false'; } $message = ''; if (rex_post('btn_save', 'string') != '') { $file = rex_path::addonData('phpmailer', 'settings.inc.php'); $message = $I18N->msg('phpmailer_config_saved_error'); $content = '<?php $this->From = ' . var_export($from, true) . '; $this->FromName = ' . var_export($fromname, true) . '; $this->ConfirmReadingTo = ' . var_export($confirmto, true) . '; $this->AdminBcc = ' . var_export($AdminBcc, true) . '; $this->Mailer = ' . var_export($mailer, true) . '; $this->Host = ' . var_export($host, true) . '; $this->Port = ' . var_export($port, true) . '; $this->CharSet = ' . var_export($charset, true) . '; $this->WordWrap = ' . var_export($wordwrap, true) . '; $this->Encoding = ' . var_export($encoding, true) . '; $this->Priority = ' . var_export($priority, true) . '; $this->SMTPSecure = ' . var_export($smtpsecure, true) . ';
</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)) {
private function getPath($file = '') { return rex_path::addonData('tests', 'rex_file_test/' . $file); }
/** * {@inheritdoc} */ public function getDataPath($file = '') { return rex_path::addonData($this->getName(), $file); }
private static function getPath($path) { $path = strpos($path, '?') === false ? rtrim($path, '/') . '/?' : $path . '&'; $path .= 'rex_version=' . rex::getVersion(); static $config; if (null === $config) { $config = rex_file::getCache(rex_path::addonData('install', 'config.json')); } if (isset($config['api_login']) && $config['api_login'] && isset($config['api_key'])) { $path .= '&api_login='******'api_login']) . '&api_key=' . urlencode($config['api_key']); } return $path; }