function rex_a256_search_mpool_query($params) { global $REX; if (!$REX['USER']->hasPerm('be_search[mediapool]')) { return $params['subject']; } $media_name = rex_request('a256_media_name', 'string'); if ($media_name == '') { return $params['subject']; } $qry = $params['subject']; $category_id = $params['category_id']; $qry = str_replace('f.category_id=' . $category_id, '1=1', $qry); $where = " (f.filename LIKE '%" . $media_name . "%' OR f.title LIKE '%" . $media_name . "%')"; $searchmode = OOAddon::getProperty('be_search', 'searchmode', 'local'); // global search - all if ($searchmode == 'global') { $qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry); return $qry; // local search - all categories and with no category } elseif ($category_id == 0) { $qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry); // local search - categorie and subcategories } else { $where .= ' AND f.category_id = c.id '; $where .= " AND (c.path LIKE '%|" . $params['category_id'] . "|%' OR c.id=" . $params['category_id'] . ') '; $qry = str_replace('FROM ', 'FROM ' . $REX['TABLE_PREFIX'] . 'file_category c,', $qry); $qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry); } return $qry; }
function rex_a256_search_mpool_query($params) { global $REX; if (!$REX['USER']->hasPerm('be_search[mediapool]')) { return $params['subject']; } $media_name = rex_request('a256_media_name', 'string'); if ($media_name == '') { return $params['subject']; } $qry = $params['subject']; $category_id = $params['category_id']; $where = " f.category_id = c.id AND (f.filename LIKE '%" . $media_name . "%' OR f.title LIKE '%" . $media_name . "%')"; switch (OOAddon::getProperty('be_search', 'searchmode', 'local')) { case 'local': // Suche auf aktuellen Kontext eingrenzen if ($category_id != 0) { $where .= " AND (c.path LIKE '%|" . $params['category_id'] . "|%' OR c.id=" . $params['category_id'] . ") "; } else { $qry = str_replace('f.category_id=0', '1=1', $qry); } } $qry = str_replace('FROM ', 'FROM ' . $REX['TABLE_PREFIX'] . 'file_category c,', $qry); $qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry); return $qry; }
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); }
function rex_uninstall_addon($addons, $addonname, $regenerate_addons = true) { global $REX, $I18N; $state = true; $uninstall_file = $REX['INCLUDE_PATH'] . "/addons/{$addonname}/uninstall.inc.php"; if (is_readable($uninstall_file)) { include $uninstall_file; // Wurde das "uninstall" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch if (OOAddon::isInstalled($addonname) || !empty($REX['ADDON']['installmsg'][$addonname])) { $state = $I18N->msg('addon_no_uninstall', $addonname) . '<br/>'; if (empty($REX['ADDON']['installmsg'][$addonname])) { $state .= $I18N->msg('addon_no_reason'); } else { $state .= $REX['ADDON']['installmsg'][$addonname]; } } else { $state = rex_deactivate_addon($addons, $addonname); if ($state === true && $regenerate_addons) { // regenerate Addons file $state = rex_generateAddons($addons); } } } else { $state = $I18N->msg("addon_uninstall_not_found"); } return $state; }
/** * Gibt ein Array von verf�gbaren Addons zur�ck. * * @return array Array der verf�gbaren Addons */ function getAvailableAddons() { $avail = array(); foreach (OOAddon::getRegisteredAddons() as $addonName) { if (OOAddon::isAvailable($addonName)) { $avail[] = $addonName; } } return $avail; }
/** * added the metafields * @return string */ public static function addFields() { global $REX; $class = ''; if (OOAddon::isAvailable('tinymce')) { $class = 'tinyMCEEditor'; } elseif (OOAddon::isAvailable('ckeditor')) { $class = 'ckeditor'; } return self::checkErrorMessage(a62_add_field('translate:content_category', 'asd_category', 2, '', 3, '', 'SELECT `name`, `id` FROM ' . rex_asd_news_config::getTableCategory()), a62_add_field('translate:asd_news_picture', 'asd_picture', 3, '', 6, ''), a62_add_field('translate:asd_news_text', 'asd_text', 4, 'class=' . $class, 2, '')); }
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 rexMediaButtonField($name, $label, $attributes = array(), $id = '') { global $REX; $this->popupButtonField($name, $label, $attributes, $id); $this->enablePreview(); if (OOAddon::isAvailable('image_resize')) { $this->setPreviewUrl('index.php?rex_resize=100w__%filename%'); } else { $this->setPreviewUrl($REX['MEDIAFOLDER'] . '/%filename%'); } }
/** * set the property for the metainfo. * added Entrys in metaTables and prefixes */ public static function setProperty() { global $REX; $metaTables = OOAddon::getProperty('metainfo', 'metaTables', array()); $metaTables[self::PREFIX] = $REX['TABLE_PREFIX'] . self::TABLE; OOAddon::setProperty('metainfo', 'metaTables', $metaTables); $prefixes = OOAddon::getProperty('metainfo', 'prefixes', array()); if (!in_array(self::PREFIX, $prefixes)) { $prefixes[] = self::PREFIX; } OOAddon::setProperty('metainfo', 'prefixes', $prefixes); }
protected function textile($string) { if (OOAddon::isAvailable("textile")) { if ($string != "") { $string = str_replace("\t", "", $string); $string = htmlspecialchars_decode($string); $string = str_replace("<br />", "", $string); return rex_a79_textile($string); } } else { return $string; } }
function setProperty($plugin, $property, $value) { global $REX; // Plugin in Liste aufnehmen $plugins = OOPlugin::getRegisteredPlugins(); if (!in_array($plugin, $plugins)) { $plugins[$plugin] = $plugin; OOAddon::setProperty('community', 'pluginlist', $plugins); } if (!isset($REX['ADDON']['plugins']['community'][$plugin])) { $REX['ADDON']['plugins']['community'][$plugin] = array(); } // Property fuer das Plugin setzen $REX['ADDON']['plugins']['community'][$plugin][$property] = $value; }
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; }
function rex_a256_search_mpool_query($params) { global $REX, $REX_USER; if (!($REX_USER->isAdmin() || $REX_USER->hasPerm('be_search[medienpool]'))) { return $params['subject']; } $media_name = rex_request('a256_media_name', 'string'); if ($media_name == '') { return $params['subject']; } $category_id = $params['category_id']; $qry = "SELECT *\n FROM " . $REX['TABLE_PREFIX'] . "file f, " . $REX['TABLE_PREFIX'] . "file_category c\n WHERE f.category_id = c.id AND (filename LIKE '%" . $media_name . "%' OR title LIKE '%" . $media_name . "%')"; switch (OOAddon::getProperty('be_search', 'searchmode', 'local')) { case 'local': // Suche auf aktuellen Kontext eingrenzen if ($category_id != 0) { $qry .= " AND (c.path LIKE '%|" . $params['category_id'] . "|%' OR c.id=" . $params['category_id'] . ") "; } } $qry .= 'ORDER BY f.updatedate desc'; $qry = rex_register_extension_point('A256_MEDIENPOOL_QUERY', $qry); return $qry; }
" /> </a> <a href="#" onclick="deleteREXLink(3);return false;"> <img src="media/file_del.gif" width="16" height="16" title="<?php echo $I18N_KURSE->msg('remove_link'); ?> " alt="<?php echo $I18N_KURSE->msg('remove_link'); ?> " /> </a> </p> </div> <?php if (OOAddon::isActivated('multinewsletter')) { ?> <div class="rex-form-row rex-form-element-v1"> <p class="rex-form-text"> <label for="multinewsletter_group"><?php echo $I18N_KURSE->msg('multinewsletter_gruppe'); ?> </label> <?php require_once $REX['INCLUDE_PATH'] . '/addons/multinewsletter/classes/class.multinewsletter_group.inc.php'; $groups = new rex_select(); $groups->setSize(1); $groups->setAttribute('class', 'myrex_select'); $groups->addOption($I18N_KURSE->msg('multinewsletter_nicht_anmelden'), '0'); $newsletter_groups = MultinewsletterGroupList::getAll($REX['TABLE_PREFIX']); foreach ($newsletter_groups as $group) {
function a401_perform_ajax($_rex_ajax, $rxa, $REX) { $rxa['ajaxdir'] .= $REX['REDAXO'] ? 'backend/' : 'frontend/'; if (!$REX['REDAXO'] and !$rxa['settings']['frontend_active']) { return; } if ($REX['REDAXO'] and !$rxa['settings']['backend_active']) { return; } if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $rxa['ajaxdir'] = str_replace("/", "\\", $rxa['ajaxdir']); } // Code ausführen falls die Datei vorhanden ist if (file_exists($rxa['ajaxdir'] . $_rex_ajax . '.inc.php')) { @ob_end_clean(); @ob_end_clean(); // Fix für REDAXO < 4.2.x if (isset($REX_ARTICLE)) { $REX['ARTICLE'] = $REX_ARTICLE; } // Include der Datei include_once $rxa['ajaxdir'] . $_rex_ajax . '.inc.php'; exit; } else { if (trim($REX["ADDON"][$rxa['name']]["settings"]["errormail"]) != '') { $_subject = 'REX_Ajax Error ' . $REX['SERVER'] . ' ' . $REX['SERVERNAME']; $_mailtext = $_subject . "\n\n" . date('d.m.Y h:i:s') . "\n\n"; ob_start(); var_dump($_REQUEST); $_mailtext .= "_REQUEST\n"; $_mailtext .= ob_get_contents(); ob_end_clean(); ob_start(); var_dump($_SESSION); $_mailtext .= "\n_SESSION\n"; $_mailtext .= ob_get_contents(); ob_end_clean(); ob_start(); var_dump($_SERVER); $_mailtext .= "\n_SERVER\n"; $_mailtext .= ob_get_contents(); ob_end_clean(); $_to = $REX["ADDON"][$rxa['name']]["settings"]["errormail"]; $_header = 'From: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'Reply-To: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if (OOAddon::isAvailable('phpmailer')) { if (!isset($I18N)) { $I18N = rex_create_lang($REX['LANG']); } include $REX['INCLUDE_PATH'] . '/addons/phpmailer/config.inc.php'; $mail = new rex_mailer(); $mail->From = $REX['ERROR_EMAIL']; $mail->Subject = $_subject; $mail->Body = $_mailtext; $mail->AddAddress($_to, ''); $mail->Send(); } else { @mail($_to, $_subject, $_mailtext, $_header); } } } }
}); </script>'; } if ($func == 'add' || $func == 'edit') { if (rex_asd_news_config::isControlPlugin()) { foreach (array('REX_FORM_SAVED', 'REX_FORM_DELETED') as $extension) { rex_register_extension($extension, 'url_generate::generatePathFile'); } } $title = $func == 'add' ? $I18N->msg('add') : $I18N->msg('edit'); $form = new rex_news_form(rex_asd_news_config::getTable(), ucfirst($title), 'id=' . $id . ' AND clang = ' . $clang); $form->divId = 'asd_news-addon-editmode'; $field = $form->addTextField('title'); $field->setLabel($I18N->msg('asd_news_title')); if (OOAddon::isAvailable('metainfo')) { $form->addRawField($form->getMetainfoExtension()); } $form->addHiddenField('clang', (int) $clang); $form->addHiddenField('updatedAt', $now->format('Y-m-d H:i:s')); $form->addHiddenField('updatedBy', $REX['USER']->getValue('user_id')); $form->addParam('clang', (int) $clang); $form->addParam('id', (int) $id); if ($func == 'add') { $id = rex_asd_news::getLastNewsId() + 1; } $form->addHiddenField('id', $id); if ($func == 'add') { $form->addHiddenField('createdAt', $now->format('Y-m-d H:i:s')); $form->addHiddenField('createdBy', $REX['USER']->getValue('user_id')); rex_register_extension('REX_FORM_SAVED', function ($subject) use($clang, $REX, $id) {
<?php $mypage = 'd2u_stellenmarkt'; // Jetzt das SQL dieses Addons installieren $error = rex_install_dump(dirname(__FILE__) . '/install.sql'); if (!OOAddon::isActivated('xoutputfilter')) { // xoutputfilter aktivieren $error = "Das Addon XOutputFilter ist für die Installation notwendig"; } if ($error != 1) { $REX['ADDON']['installmsg'][$mypage] = $error; } else { $REX['ADDON']['install'][$mypage] = true; }
foreach ($ADDONS as $cur) { if (OOAddon::isSystemAddon($cur)) { $delete = $I18N->msg("addon_systemaddon"); } else { $delete = '<a href="index.php?page=addon&addonname=' . $cur . '&delete=1" onclick="return confirm(\'' . htmlspecialchars($I18N->msg('addon_delete_question', $cur)) . '\');">' . $I18N->msg("addon_delete") . '</a>'; } if (OOAddon::isInstalled($cur)) { $install = $I18N->msg("addon_yes") . ' - <a href="index.php?page=addon&addonname=' . $cur . '&install=1">' . $I18N->msg("addon_reinstall") . '</a>'; $uninstall = '<a href="index.php?page=addon&addonname=' . $cur . '&uninstall=1" onclick="return confirm(\'' . htmlspecialchars($I18N->msg("addon_uninstall_question", $cur)) . '\');">' . $I18N->msg("addon_uninstall") . '</a>'; } else { $install = $I18N->msg("addon_no") . ' - <a href="index.php?page=addon&addonname=' . $cur . '&install=1">' . $I18N->msg("addon_install") . '</a>'; $uninstall = $I18N->msg("addon_notinstalled"); } if (OOAddon::isActivated($cur)) { $status = $I18N->msg("addon_yes") . ' - <a href="index.php?page=addon&addonname=' . $cur . '&activate=0">' . $I18N->msg("addon_deactivate") . '</a>'; } elseif (OOAddon::isInstalled($cur)) { $status = $I18N->msg("addon_no") . ' - <a href="index.php?page=addon&addonname=' . $cur . '&activate=1">' . $I18N->msg("addon_activate") . '</a>'; } else { $status = $I18N->msg("addon_notinstalled"); } echo ' <tr> <td class="rex-icon"><img src="media/addon.gif" alt="' . htmlspecialchars($cur) . '" title="' . htmlspecialchars($cur) . '"/></td> <td>' . htmlspecialchars($cur) . ' [<a href="index.php?page=addon&spage=help&addonname=' . $cur . '">?</a>]</td> <td>' . $install . '</td> <td>' . $status . '</td> <td>' . $uninstall . '</td> <td>' . $delete . '</td> </tr>' . "\n "; } echo '</tbody>
/** * Schreibt Addoneigenschaften in die Datei include/addons.inc.php * @param array Array mit den Namen der Addons aus dem Verzeichnis addons/ */ function rex_generateAddons($ADDONS, $debug = false) { global $REX; natsort($ADDONS); $content = "// --- DYN\n\n"; foreach ($ADDONS as $cur) { if (!OOAddon::isInstalled($cur)) { $REX['ADDON']['install'][$cur] = 0; } if (!OOAddon::isActivated($cur)) { $REX['ADDON']['status'][$cur] = 0; } $content .= "\$REX['ADDON']['install']['{$cur}'] = " . $REX['ADDON']['install'][$cur] . ";\n" . "\$REX['ADDON']['status']['{$cur}'] = " . $REX['ADDON']['status'][$cur] . ";\n\n"; } $content .= "// --- /DYN"; $file = $REX['INCLUDE_PATH'] . "/addons.inc.php"; // Sichergehen, dass die Datei existiert und beschreibbar ist if (is_writable($file)) { if (!($h = fopen($file, "r"))) { return 'Konnte Datei "' . $file . '" nicht lesen'; } $fcontent = fread($h, filesize($file)); $fcontent = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $content, $fcontent); fclose($h); if (!($h = fopen($file, "w+"))) { return 'Konnte Datei "' . $file . '" nicht zum schreiben oeffnen'; } //if (!fwrite($h, $fcontent, strlen($fcontent))) { if (!fwrite($h, $fcontent, strlen($fcontent))) { return 'Konnte Inhalt nicht in Datei "' . $file . '" schreiben'; } fclose($h); // alles ist gut gegangen return true; } else { return 'Datei "' . $file . '" hat keine Schreibrechte'; } }
/** * Gibt die URL der Terminkategorie zurück. * @global mixed[] $REX Redaxo Variable * @var boolean $path_only Gibt an, ob die URL mit Domain oder ohne erstellt * werden soll. * @return String URL für das Objekt */ function getURL($path_only = FALSE) { if ($this->url == "") { global $REX; $pathname = ''; if (OOAddon::isActivated('seo42')) { // Mit SEO42 require_once dirname(__FILE__) . "/../../seo42/classes/class.seo42_rewrite.inc.php"; // Dann Redaxo Artikelfolge if ($REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'] > 0 && $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'] != $REX['START_ARTICLE_ID']) { $kategorie = OOCategory::getCategoryById($REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']); $hauptkategorien = $kategorie->getPathAsArray(); for ($i = 0; $i < count($hauptkategorien); $i++) { $hauptkategorie = OOCategory::getCategoryById($hauptkategorien[$i], $REX['CUR_CLANG']); if ($hauptkategorie instanceof OOCategory) { $pathname = seo42_appendToPath($pathname, $hauptkategorie->getName(), $hauptkategorie->getId(), $REX['CUR_CLANG']); } } if ($kategorie->getName() != "") { $pathname = seo42_appendToPath($pathname, $kategorie->getName(), $kategorie->getId(), $REX['CUR_CLANG']); } else { // Wenn angegebener Artikel keine Kategorie ist, sondern nur Artikelname hat $pathname = seo42_appendToPath($pathname, $kategorie->getValue("name"), $kategorie->getId(), $REX['CUR_CLANG']); } } // Art der Startkachel $pathname = seo42_appendToPath($pathname, $REX['ADDON']['d2u_kurse']['settings']['termin_titel'], $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']); // Die Elternkategorie if ($this->eltern_terminkategorie !== FALSE) { $pathname = seo42_appendToPath($pathname, $this->eltern_terminkategorie->name, $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']); } // Die Terminkategorie $pathname = seo42_appendToPath($pathname, $this->name, $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']); $pathname = substr($pathname, 0, -1) . $REX['ADDON']['seo42']['settings']['url_ending']; } else { // Ohne SEO42 $parameterArray = array(); $parameterArray['terminkategorie_id'] = $this->terminkategorie_id; $pathname = rex_getUrl($REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG'], $parameterArray, "&"); } $this->url = $pathname; } if ($path_only) { return $this->url; } else { return $REX['SERVER'] . $this->url; } }
function rex_uninstall_addon($addons, $addonname) { global $REX, $I18N; $state = true; $install_dir = $REX['INCLUDE_PATH'] . '/addons/' . $addonname; $uninstall_file = $install_dir . '/uninstall.inc.php'; $uninstall_sql = $install_dir . '/uninstall.sql'; if (is_readable($uninstall_file)) { require $uninstall_file; // Wurde das "uninstall" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch if (OOAddon::isInstalled($addonname) || !empty($REX['ADDON']['installmsg'][$addonname])) { $state = $I18N->msg('addon_no_uninstall', $addonname) . '<br/>'; if (empty($REX['ADDON']['installmsg'][$addonname])) { $state .= $I18N->msg('addon_no_reason'); } else { $state .= $REX['ADDON']['installmsg'][$addonname]; } } else { $state = rex_deactivate_addon($addons, $addonname); if ($state === true && is_readable($uninstall_sql)) { $state = rex_install_dump($uninstall_sql); if ($state !== true) { $state = 'Error found in uninstall.sql:<br />' . $state; } } if ($state === true) { // regenerate Addons file $state = rex_generateAddons($addons); } } } else { $state = $I18N->msg("addon_uninstall_not_found"); } // Fehler beim uninstall -> Addon bleibt installiert if ($state !== true) { $REX['ADDON']['install'][$addonname] = 1; } return $state; }
if ($as !== false) { // --- addon gefunden $perm = $REX['ADDON']['perm'][$as]; $hasPerm = $perm == '' || $REX_USER->hasPerm($perm) || $REX_USER->hasPerm('admin[]'); // Suche zuerst nach einem Addon, dass so heisst wie die aktuelle page // z.b addons/structure/pages/index.inc.php $addon_page = $REX['INCLUDE_PATH'] . '/addons/' . $page . '/pages/index.inc.php'; if (file_exists($addon_page) && $hasPerm && OOAddon::isAvailable($page)) { $withheader = false; $REX['PAGEPATH'] = $addon_page; } else { // Kein Addon gefunden, also suchen wir nach einem Addon, // dass vorgegeben hat, eine Page zu haben, die so heisst, wie die aktuelle // z.b addons/xxx/pages/structure.inc.php $addon_page = $REX['INCLUDE_PATH'] . '/addons/' . $as . '/pages/' . $page . '.inc.php'; if (file_exists($addon_page) && $hasPerm && OOAddon::isAvailable($as)) { $withheader = false; $REX['PAGEPATH'] = $addon_page; } } } } // ----- standard pages if ($REX['PAGEPATH'] == '' && $page == 'addon' && ($REX_USER->hasPerm('addon[]') || $REX_USER->hasPerm('admin[]'))) { $page_name = $I18N->msg('addon'); } elseif ($REX['PAGEPATH'] == '' && $page == 'specials' && ($REX_USER->hasPerm('specials[]') || $REX_USER->hasPerm('admin[]'))) { $page_name = $I18N->msg('specials'); } elseif ($REX['PAGEPATH'] == '' && $page == 'module' && ($REX_USER->hasPerm('module[]') || $REX_USER->hasPerm('admin[]'))) { $page_name = $I18N->msg('modules'); } elseif ($REX['PAGEPATH'] == '' && $page == 'template' && ($REX_USER->hasPerm('template[]') || $REX_USER->hasPerm('admin[]'))) { $page_name = $I18N->msg('template');
<?php $mypage = 'import_export'; if ($REX['REDAXO'] && is_object($REX["USER"])) { $I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang/'); $REX['ADDON']['rxid'][$mypage] = '1'; $REX['ADDON']['name'][$mypage] = $I18N->msg("im_export_importexport"); $REX['ADDON']['perm'][$mypage] = 'import_export[export]'; $REX['ADDON']['version'][$mypage] = "1.3"; $REX['ADDON']['author'][$mypage] = "Jan Kristinus, Markus Staab"; $REX['ADDON']['supportpage'][$mypage] = 'forum.redaxo.de'; $REX['PERM'][] = 'import_export[export]'; $REX['PERM'][] = 'import_export[import]'; $REX['ADDON']['pages'][$mypage] = array(); if ($REX["USER"]->hasPerm('import_export[import]') || $REX["USER"]->isAdmin()) { $REX['ADDON']['pages'][$mypage][] = array('import', $I18N->msg('im_export_import')); } $REX['ADDON']['pages'][$mypage][] = array('', $I18N->msg('im_export_export')); } if (OOAddon::isAvailable('cronjob')) { require_once dirname(__FILE__) . '/classes/class.cronjob.inc.php'; rex_register_extension('CRONJOB_TYPES', array('rex_cronjob_manager', 'registerExtension'), array('class' => 'rex_cronjob_export')); }
$this_REX = $REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . ($REX['MINORVERSION'] = "1"); if (version_compare($this_REX, $requiered_REX, '<')) { $REX['ADDON']['installmsg'][$mypage] = 'Dieses Addon benötigt Redaxo Version ' . $requiered_REX . ' oder höher.'; $REX['ADDON']['install'][$mypage] = 0; $do_install = false; } // CHECK PHP VERSION //////////////////////////////////////////////////////////////////////////////// if (intval(PHP_VERSION) < $requiered_PHP) { $REX['ADDON']['installmsg'][$mypage] = 'Dieses Addon benötigt mind. PHP ' . $requiered_PHP . '!'; $REX['ADDON']['install'][$mypage] = 0; $do_install = false; } // CHECK REQUIERED ADDONS //////////////////////////////////////////////////////////////////////////////// foreach ($requiered_addons as $a) { if (!OOAddon::isInstalled($a)) { $REX['ADDON']['installmsg'][$mypage] = '<br />Addon "' . $a . '" ist nicht installiert. >>> <a href="index.php?page=addon&addonname=' . $a . '&install=1">jetzt installieren</a> <<<'; $do_install = false; } else { if (!OOAddon::isAvailable($a)) { $REX['ADDON']['installmsg'][$mypage] = '<br />Addon "' . $a . '" ist nicht aktiviert. >>> <a href="index.php?page=addon&addonname=' . $a . '&activate=1">jetzt aktivieren</a> <<<'; $do_install = false; } } } // DO INSTALL //////////////////////////////////////////////////////////////////////////////// if ($do_install) { $REX['ADDON']['install'][$mypage] = 1; }
/** * Schreibt Addoneigenschaften in die Datei include/addons.inc.php * * @param array Array mit den Namen der Addons aus dem Verzeichnis addons/ * * @return TRUE bei Erfolg, sonst FALSE */ function rex_generateAddons($ADDONS) { global $REX; natsort($ADDONS); $content = ''; foreach ($ADDONS as $addon) { if (!OOAddon::isInstalled($addon)) { OOAddon::setProperty($addon, 'install', 0); } if (!OOAddon::isActivated($addon)) { OOAddon::setProperty($addon, 'status', 0); } foreach (array('install', 'status') as $prop) { $content .= sprintf("\$REX['ADDON']['%s']['%s'] = '%d';\n", $prop, $addon, OOAddon::getProperty($addon, $prop)); } $content .= "\n"; } // Da dieser Funktion öfter pro request aufgerufen werden kann, // hier die caches löschen clearstatcache(); $file = $REX['INCLUDE_PATH'] . '/addons.inc.php'; if (rex_replace_dynamic_contents($file, $content) === false) { return 'Datei "' . $file . '" hat keine Schreibrechte'; } return true; }
/** * @param $addons,... */ public static function setSeoAddon($addons) { $addons = func_get_args(); foreach ($addons as $addon) { if (OOAddon::isAvailable($addon)) { self::$seoAddon = $addon; // Kompatibilität erhalten rex_asd_news::$SEO_ADDON = self::$seoAddon; } } self::$seoSettings = self::setSeoSettings(); if (self::$seoAddon) { self::$urlControlPlugin = OOPlugin::isAvailable(self::$seoAddon, 'url_control'); } // Kompatibilität erhalten rex_asd_news::$SEO_URL_CONTROL = self::$urlControlPlugin; }
/** * Hilfsfunktion zur Installation. * * @param int $step Installationsschritt * @return string */ function _a_63_install($step = 0) { global $REX; /** * init */ $error = ''; $tmpFolder = $REX['MEDIAFOLDER'] . '/' . $REX['TEMP_PREFIX'] . '/'; $mediaFolder = $REX['MEDIAFOLDER'] . '/' . $REX['TEMP_PREFIX'] . '/guestbook_63/'; $cssPathSource = '/addons/guestbook/css/'; $cssFile = 'guestbook.css'; static $_a63_checkTabelle = ''; switch ($step) { case 1: /** * pruefe config/ auf Schreibrechte */ $error = rex_is_writable(dirname(__FILE__) . '/config'); break; case 2: /** * pruefe config/status.txt auf Schreibrechte */ $error = rex_is_writable(dirname(__FILE__) . '/config/status.txt'); break; case 3: /** * das addon_framework muss installiert und aktiviert sein */ if (!OOAddon::isAvailable('addon_framework')) { $error = 'Required addon "addon_framework" is either not installed or not activated!'; } break; case 4: // erstelle tmp-Ordner, wenn nicht schon vorhanden if (!is_dir($tmpFolder) && !mkdir($tmpFolder)) { $error = 'Unable to create folder "' . $tmpFolder . '"'; } @chmod($tmpFolder, $REX['DIRPERM']); break; case 5: // erstelle AddOn-Ordner im tmp-Ordner if (!is_dir($mediaFolder) && !mkdir($mediaFolder)) { $error = 'Unable to create folder "' . $mediaFolder . '"'; } @chmod($mediaFolder, $REX['DIRPERM']); break; case 6: // kopiere CSS in Mediafolder $cssSrc = $REX['INCLUDE_PATH'] . $cssPathSource . $cssFile; $cssDst = $mediaFolder . $cssFile; if (!file_exists($cssDst) && !copy($cssSrc, $cssDst)) { $error = 'Unable to copy file to "' . $cssDst . '"'; } // setze Rechte nach master.inc.php-Vorgabe @chmod($cssDst, $REX['FILEPERM']); break; case 7: // Gibt es die GB-Tabelle schon? $_a63_checkTabelle = rex_a63_CheckTabelle(); // SQL wird nur ausgefuehrt, wenn die Tabelle noch nicht in der DB existiert. if (!$_a63_checkTabelle) { $error = rex_install_dump(dirname(__FILE__) . '/install_tabelle.sql', false); } break; case 8: // installiere die benoetigten Module und Aktionen // ToDo: eine Ueberpruefung ob die Module und Aktionen schon installiert ist waere notwendig // ToDo: aber dazu fehlen noch einige Vorraussetzungen in den Redaxotabellen selbst $error = rex_install_dump(dirname(__FILE__) . '/install_moduleaction.sql', false); break; case 9: // DB-Daten installiert? Dann hiermit weiter. include dirname(__FILE__) . '/install.php'; // rex_a63_installAction2Modul(Name des Modules, Name der Action) $error = rex_a63_installAction2Modul('Gaestebuch - Eintragsliste', 'Gaestebuch - Eintragsliste StatusPerDatei'); break; default: $error = $I18N_A63('Fehler bei der Installation. Kein passender Installationsschritt gefunden.'); break; } return $error; }
<?php $mypage = 'd2u_stellenmarkt'; // Sprachobjekt $I18N_STELLEN = new i18n($REX['LANG'], $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang'); $REX['ADDON']['page'][$mypage] = $mypage; $REX['ADDON']['name'][$mypage] = "Stellenmarkt"; $REX['ADDON']['version'][$mypage] = '2.0.7'; $REX['ADDON']['perm'][$mypage] = $mypage . '[]'; $REX['ADDON']['author'][$mypage] = "www.design-to-use.de - Tobias Krais - http://www.design-to-use.de/"; $REX['PERM'][] = $mypage . '[]'; // SEO42 Erweiterung if (OOAddon::isActivated('seo42')) { // SEO42 require_once dirname(__FILE__) . "/extensions/seo42.inc.php"; // URLs fuer SEO42 bekannt machen rex_register_extension('SEO42_PATHLIST_CREATED', 'd2u_stellenmarkt_extended_urls'); // URLs in Sitemap eintragen rex_register_extension('SEO42_SITEMAP_ARRAY_CREATED', 'd2u_stellenmarkt_extended_sitemap'); } rex_register_extension('OOMEDIA_IS_IN_USE', 'rex_d2u_stellenmarkt_media_is_in_use'); // add subpages $REX['ADDON'][$mypage]['SUBPAGES'] = array(array('', $I18N_STELLEN->msg('stellenangebote')), array('kategorien', $I18N_STELLEN->msg('kategorien')), array('kontakte', $I18N_STELLEN->msg('kontakte'))); if (OOPlugin::isAvailable('d2u_stellenmarkt', 'hr4you_sync')) { array_push($REX['ADDON'][$mypage]['SUBPAGES'], array('hr4you_sync', 'HR4YOU Sync')); } /** * Prüft ob dieses Addon Medien im Medienpool nutzt. * @global array $REX Redaxo Einstellungen * @param type $params Übergabeparameter des Extension Points * @return string Warnnachricht als Array
function rex_setup_addons($uninstallBefore = false, $installDump = true) { global $REX, $I18N; require_once $REX['INCLUDE_PATH'] . '/functions/function_rex_addons.inc.php'; $state = true; $addonErr = ''; $ADDONS = rex_read_addons_folder(); foreach ($REX['SYSTEM_ADDONS'] as $systemAddon) { if ($state === true && $uninstallBefore) { $state = rex_uninstall_addon($ADDONS, $systemAddon); } if ($state === true && !OOAddon::isInstalled($systemAddon)) { $state = rex_install_addon($ADDONS, $systemAddon, $installDump); } if ($state === true && !OOAddon::isActivated($systemAddon)) { $state = rex_activate_addon($ADDONS, $systemAddon); } if ($state !== true) { $addonErr .= '<li>' . $systemAddon . '<ul><li>' . $state . '</li></ul></li>'; } } if ($addonErr != '') { $addonErr = '<ul> <li> <h3>' . $I18N->msg('setup_011', '<span class="rex-error">', '</span>') . '</h3> <ul>' . $addonErr . '</ul> </li> </ul>'; } return $addonErr; }
<?php /** * * @package redaxo4 * @version svn:$Id$ */ // *************************************** CONFIG $thumbs = true; $image_manager = OOAddon::isAvailable('image_manager'); $image_resize = OOAddon::isAvailable('image_resize'); // *************************************** KATEGORIEN CHECK UND AUSWAHL // ***** kategorie auswahl $db = rex_sql::factory(); $file_cat = $db->getArray('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file_category ORDER BY name ASC'); // ***** select bauen $sel_media = new rex_mediacategory_select($check_perm = false); $sel_media->setId("rex_file_category"); $sel_media->setName("rex_file_category"); $sel_media->setSize(1); $sel_media->setStyle('class="rex-form-select"'); $sel_media->setSelected($rex_file_category); $sel_media->setAttribute('onchange', 'this.form.submit();'); $sel_media->addOption($I18N->msg('pool_kats_no'), "0"); // ----- EXTENSION POINT echo rex_register_extension_point('PAGE_MEDIAPOOL_HEADER', '', array('subpage' => $subpage, 'category_id' => $rex_file_category)); // ***** formular $cat_out = '<div class="rex-form" id="rex-form-mediapool-selectcategory"> <form action="index.php" method="post"> <fieldset class="rex-form-col-1"> <legend>' . $I18N->msg('pool_select_cat') . '</legend>