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);
 }
Example #2
0
 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);
 }
Example #3
0
 public static function getUpdatePackages()
 {
     if (is_array(self::$updatePackages)) {
         return self::$updatePackages;
     }
     self::$updatePackages = self::getPackages();
     foreach (self::$updatePackages as $key => $addon) {
         if (is_dir(rex_path::addon($key)) && isset($addon['files'])) {
             self::unsetOlderVersions($key, OOAddon::getVersion($key));
         } else {
             unset(self::$updatePackages[$key]);
         }
     }
     return self::$updatePackages;
 }
Example #4
0
 /**
  * Checks whether the requirements are met.
  *
  * @return boolean
  */
 protected static function checkRequirements($config)
 {
     global $REX;
     $errors = array();
     if ($config['rex_version'] != '') {
         $rex_version = $REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . $REX['MINORVERSION'];
         if (version_compare($rex_version, $config['rex_version'], '<')) {
             $errors['de_de'][] = 'Die REDAXO Version reicht nicht aus. Es wird mindestens Version ' . $config['rex_version'] . ' benötigt. Sie nutzen aktuell die Version ' . $rex_version;
             $errors['en_en'][] = 'The REDAXO version is not sufficient. At least version ' . $config['rex_version'] . ' is needed. Currently version ' . $rex_version . ' is installed.';
         }
     }
     if ($config['php_version'] != '') {
         if (version_compare(PHP_VERSION, $config['php_version']) < 0) {
             $errors['de_de'][] = 'PHP version >=' . $config['php_version'] . ' wird gebraucht!';
             $errors['en_en'][] = 'PHP version >=' . $config['php_version'] . ' needed!';
         }
     }
     if (count($config['required_addons']) >= 1) {
         foreach ($config['required_addons'] as $addon_name => $addon_version) {
             if (is_numeric($addon_name)) {
                 $addon_name = $addon_version;
                 $addon_version = '';
             }
             if (!\OOAddon::isAvailable($addon_name)) {
                 $de = $addon_version != '' ? ' in der Version "' . $addon_version . '"' : '';
                 $en = $addon_version != '' ? ' in version "' . $addon_version . '"' : '';
                 $errors['de_de'][] = 'Installiere und aktiviere das AddOn "' . $addon_name . '"' . $de . '.';
                 $errors['en_en'][] = 'Install and activate the addon "' . $addon_name . '"' . $en . '.';
             }
             if (\OOAddon::isAvailable($addon_name) && $addon_version != '' && version_compare(\OOAddon::getVersion($addon_name), $addon_version, '<')) {
                 $errors['de_de'][] = 'Die Version des AddOns "' . $addon_name . '" reicht nicht aus. Es wird mindestens Version ' . $addon_version . ' benötigt. Sie nutzen aktuell die Version ' . \OOAddon::getVersion($addon_name);
                 $errors['en_en'][] = 'The version of the addon "' . $addon_name . '" is not sufficient. At least version ' . $addon_version . ' is needed. Currently version ' . \OOAddon::getVersion($addon_name) . ' is installed.';
             }
         }
     }
     if (count($errors) >= 1) {
         $lang = $REX['LOGIN']->getLanguage();
         $lang = $lang != 'de_de' ? 'en_en' : $lang;
         $style = ' style="position: relative; display: block; padding-left: 10px; font-weight: 400;"';
         $bullet = '<i style="position: absolute; left: 0;">&bullet;</i>';
         $warning = '<b' . $style . '>' . $bullet . implode('</b><b' . $style . '>' . $bullet, $errors[$lang]) . '</b>';
         self::$message = $warning;
         return false;
     }
     return true;
 }
echo $I18N->msg("credits_author");
?>
</th>
				<th><?php 
echo $I18N->msg("credits_supportpage");
?>
</th>
			</tr>
			</thead>

			<tbody>

		<?php 
foreach (OOAddon::getRegisteredAddons() as $addon) {
    $isActive = OOAddon::isActivated($addon);
    $version = OOAddon::getVersion($addon);
    $author = OOAddon::getAuthor($addon);
    $supportPage = OOAddon::getSupportPage($addon);
    if ($isActive) {
        $cl = 'rex-clr-grn';
    } else {
        $cl = 'rex-clr-red';
    }
    if ($version) {
        $version = '[' . $version . ']';
    }
    if ($author) {
        $author = htmlspecialchars($author);
    }
    if (!$isActive) {
        $author = $I18N->msg('credits_addon_inactive');
Example #6
0
if ($pluginname != '') {
    $addonManager = new rex_pluginManager($PLUGINS, $addonname);
} else {
    $addonManager = new rex_addonManager($ADDONS);
}
// ----------------- HELPPAGE
if ($subpage == 'help' && $addonname != '') {
    if ($pluginname != '') {
        $helpfile = rex_plugins_folder($addonname, $pluginname);
        $version = OOPlugin::getVersion($addonname, $pluginname);
        $author = OOPlugin::getAuthor($addonname, $pluginname);
        $supportPage = OOPlugin::getSupportPage($addonname, $pluginname);
        $addonname = $addonname . ' / ' . $pluginname;
    } else {
        $helpfile = rex_addons_folder($addonname);
        $version = OOAddon::getVersion($addonname);
        $author = OOAddon::getAuthor($addonname);
        $supportPage = OOAddon::getSupportPage($addonname);
    }
    $helpfile .= DIRECTORY_SEPARATOR . 'help.inc.php';
    $credits = '';
    $credits .= $I18N->msg('credits_name') . ': <span>' . htmlspecialchars($addonname) . '</span><br />';
    if ($version) {
        $credits .= $I18N->msg('credits_version') . ': <span>' . $version . '</span><br />';
    }
    if ($author) {
        $credits .= $I18N->msg('credits_author') . ': <span>' . htmlspecialchars($author) . '</span><br />';
    }
    if ($supportPage) {
        $credits .= $I18N->msg('credits_supportpage') . ': <span><a href="http://' . $supportPage . '" onclick="window.open(this.href); return false;">' . $supportPage . '</a></span><br />';
    }
Example #7
0
                <th class="rex-name">' . $I18N->msg('install_name') . '</th>
                <th class="rex-version">' . $I18N->msg('install_existing_version') . '</th>
                <th class="rex-version">' . $I18N->msg('install_available_versions') . '</th>
            </tr>
            </thead>
            <tbody>';
    if (count($addons)) {
        foreach ($addons as $key => $addon) {
            $availableVersions = array();
            foreach ($addon['files'] as $file) {
                $availableVersions[] = $file['version'];
            }
            $url = 'index.php?page=install&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-name">' . htmlspecialchars($addon['name']) . '</td>
                    <td class="rex-version">' . htmlspecialchars(OOAddon::getVersion($key)) . '</td>
                    <td class="rex-version">' . htmlspecialchars(implode(', ', $availableVersions)) . '</td>
                </tr>';
        }
    } else {
        $content .= '
            <tr class="rex-table-no-results">
                <td colspan="5">' . $I18N->msg('install_installed_addons_not_found') . '</td>
            </tr>';
    }
    $content .= '</tbody></table></div>';
}
echo $content;
Example #8
0
<?php

/**
 * XForm
 * @author jan.kristinus[at]redaxo[dot]org Jan Kristinus
 * @author <a href="http://www.yakamara.de">www.yakamara.de</a>
 */
$addonname = 'xform';
$I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/xform/lang/');
$msg = '';
if ($REX['VERSION'] != '4' || $REX['SUBVERSION'] < '5') {
    $msg = $I18N->msg('xform_install_redaxo_version_problem', '4.5');
} elseif (version_compare(PHP_VERSION, '5.3.0', '<')) {
    $msg = $I18N->msg('xform_install_checkphpversion', PHP_VERSION);
} elseif (OOAddon::isAvailable('phpmailer') != 1 || OOAddon::getVersion('phpmailer') < '2.8') {
    $msg = $I18N->msg('xform_install_phpmailer_version_problem', '2.8');
} else {
    // AUTOINSTALL THESE PLUGINS
    $autoinstall = array('email', 'setup', 'manager');
    // GET ALL ADDONS & PLUGINS
    $all_addons = rex_read_addons_folder();
    $all_plugins = array();
    foreach ($all_addons as $_addon) {
        $all_plugins[$_addon] = rex_read_plugins_folder($_addon);
    }
    // DO AUTOINSTALL
    $pluginManager = new rex_pluginManager($all_plugins, $addonname);
    foreach ($autoinstall as $pluginname) {
        // INSTALL PLUGIN
        if (($instErr = $pluginManager->install($pluginname)) !== true) {
            $msg = $instErr;
Example #9
0
?>
</th>
				<th><?php 
echo $I18N->msg("credits_supportpage");
?>
</th>
			</tr>
			</thead>

			<tbody>

		<?php 
$ADDONS = rex_read_addons_folder();
foreach ($ADDONS as $cur) {
    $isActive = OOAddon::isActivated($cur);
    $version = OOAddon::getVersion($cur);
    $author = OOAddon::getAuthor($cur);
    $supportPage = OOAddon::getSupportPage($cur);
    if ($isActive) {
        $cl = 'rex-clr-grn';
    } else {
        $cl = 'rex-clr-red';
    }
    echo '<tr><td><span class="' . $cl . '">' . $cur . '</span> [<a href="index.php?page=addon&amp;spage=help&amp;addonname=' . $cur . '">?</a>]</td><td class="' . $cl . '">';
    if ($version) {
        echo '[' . $version . ']';
    }
    echo '</td><td class="' . $cl . '">';
    if ($author) {
        echo $author;
    }
    		</h2>
            	<table class="rex-table">
        			<tr>
        				<th>Info</th>
        				<th>Wert</th>
        				<th>Info</th>
        			</tr>
        			
        			<tr>
        			    <td>Installer Version</td>
        			    <td><?php 
    echo OOAddon::getVersion('installer');
    ?>
</td>
        			    <td><?php 
    if (checkAddonVersion(OOAddon::getVersion('installer'), $installer_version)) {
        echo 'Update Verfügbar. <a href="#installer">Jetzt Installieren</a>';
    } else {
        echo "Neueste Version installert";
    }
    ?>
        			    </td>
        			</tr>
        			
        			<tr>
        			    <td>
        			    	<p>Verfügbare AddOns für Deine Versionsauswahl <strong>REX <?php 
    echo rex_session('userexversion');
    ?>
</strong>.</p><br>
        			    	<p>Deine REX-Version: <strong><?php 
<?php

/**
 * editme
 *
 * @author jan@kristinus.de
 *
 * @package redaxo4
 * @version svn:$Id$
 */
$error = '';
if (!OOAddon::isAvailable('xform')) {
    $error = 'AddOn "XForm" ist nicht installiert und aktiviert.';
} elseif (OOAddon::getVersion('xform') < '2.2') {
    $error = 'Das AddOn "XForm" muss mindestens in der Version 2.2 vorhanden sein.';
} elseif (!rex_xform_manager::createBasicSet('em')) {
    $error = 'Der XForm Manager hat das "em" BasicSet nicht installieren können.';
}
if ($error == '') {
    $REX['ADDON']['install']['editme'] = 1;
} else {
    $REX['ADDON']['installmsg']['editme'] = $error;
}
$fields[11]['prio'] = 500;
$fields[11]['list_hidden'] = 0;
$fields[11]['f1'] = 'activation_key';
$fields[11]['f2'] = 'Aktivierungsschlüssel';
$fields[11]['search'] = '1';
$fields[12] = $fields[1];
$fields[12]['prio'] = 510;
$fields[12]['list_hidden'] = 0;
$fields[12]['f1'] = 'session_key';
$fields[12]['f2'] = 'Session Key';
$fields[121]['search'] = '1';
if (OOAddon::isAvailable('xform') != 1 || OOAddon::isAvailable('phpmailer') != 1) {
    // Installation nicht erfolgreich
    $REX['ADDON']['install']['community'] = 0;
    $REX['ADDON']['installmsg']['community'] = 'AddOn "XForm" und/oder "PHPMailer" ist nicht installiert und aktiviert.';
} elseif (OOAddon::getVersion('xform') < "2.2") {
    $REX['ADDON']['install']['community'] = 0;
    $REX['ADDON']['installmsg']['community'] = 'Das AddOn "XForm" muss mindestens in der Version 2.2 vorhanden sein.';
} elseif (!rex_xform_manager::createBasicSet('com')) {
    $REX['ADDON']['install']['community'] = 0;
    $REX['ADDON']['installmsg']['community'] = 'Der XForm Manager hat das BasicSet nicht installieren können.';
} elseif (!rex_xform_manager::createTable('com', "rex_com_user", array('search' => 1))) {
    $REX['ADDON']['install']['community'] = 0;
    $REX['ADDON']['installmsg']['community'] = 'Der XForm Manager konnte die Tabelle und Zuweisungen zu "rex_com_user" nicht anlegen.';
} elseif (!rex_xform_manager::addDataFields('com', 'rex_com_user', $fields)) {
    $REX['ADDON']['install']['community'] = 0;
    $REX['ADDON']['installmsg']['community'] = 'Der XForm Manager hat die Data-Tabellen-Felder nicht anlegen können.';
} else {
    $REX['ADDON']['install']['community'] = 1;
    // XForm vorhanden -> install.sql wird automatisch ausgeführt.
}
Example #13
0
    echo rex_warning($e->getMessage());
    $file_id = null;
}
try {
    $addons = rex_install_packages::getMyPackages();
} catch (rex_install_functional_exception $e) {
    echo rex_warning($e->getMessage());
    $addonkey = '';
}
if ($addonkey && isset($addons[$addonkey])) {
    $addon = $addons[$addonkey];
    $file_id = rex_request('file', 'string');
    if ($file_id) {
        $new = $file_id == 'new';
        $file = $new ? array('version' => '', 'description' => '', 'status' => 1, 'redaxo_versions' => array($REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.x')) : $addon['files'][$file_id];
        $newVersion = OOAddon::getVersion($addonkey);
        $redaxo_select = new rex_select();
        $redaxo_select->setName('upload[redaxo][]');
        $redaxo_select->setId('install-packages-upload-redaxo');
        $redaxo_select->setAttribute('class', 'rex-form-select');
        $redaxo_select->setSize(4);
        $redaxo_select->setMultiple(true);
        $redaxo_select->addOption('5.0.x', '5.0.x');
        $redaxo_select->addOption('4.6.x', '4.6.x');
        $redaxo_select->addOption('4.5.x', '4.5.x');
        $redaxo_select->addOption('4.4.x', '4.4.x');
        $redaxo_select->addOption('4.3.x', '4.3.x');
        $redaxo_select->setSelected($file['redaxo_versions']);
        $uploadCheckboxDisabled = '';
        $hiddenField = '';
        if ($new || !OOAddon::isAvailable($addonkey)) {