function execute()
 {
     global $REX;
     $config = OOPlugin::getProperty('cronjob', 'article_status', 'config');
     $from = $config['from'];
     $to = $config['to'];
     $from['before'] = (array) $from['before'];
     $to['before'] = (array) $to['before'];
     $sql = rex_sql::factory();
     // $sql->debugsql = true;
     $sql->setQuery('
   SELECT  name 
   FROM    ' . $REX['TABLE_PREFIX'] . '62_params 
   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, status 
   FROM    ' . $REX['TABLE_PREFIX'] . '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['INCLUDE_PATH'] . '/functions/function_rex_structure.inc.php';
     for ($i = 0; $i < $rows; $i++) {
         if (in_array($sql->getValue('status'), $from['before'])) {
             $status = $from['after'];
         } else {
             $status = $to['after'];
         }
         rex_articleStatus($sql->getValue('id'), $sql->getValue('clang'), $status);
         $sql->next();
     }
     $this->setMessage('Updated articles: ' . $rows);
     return true;
 }
 function getAvailablePlugins()
 {
     global $REX;
     $plugins = OOPlugin::getRegisteredPlugins();
     $avail = array();
     foreach ($plugins as $plugin) {
         if (OOPlugin::getProperty($plugin, 'status', false)) {
             $avail[] = $plugin;
         }
     }
     return $avail;
 }
/**
 * Schreibt Plugineigenschaften in die Datei include/plugins.inc.php
 *
 * @param array Array mit den Namen der Plugins aus dem Verzeichnis addons/plugins
 *
 * @return TRUE bei Erfolg, sonst eine Fehlermeldung
 */
function rex_generatePlugins($PLUGINS)
{
    global $REX;
    $content = '';
    foreach ($PLUGINS as $addon => $_plugins) {
        foreach ($_plugins as $plugin) {
            if (!OOPlugin::isInstalled($addon, $plugin)) {
                OOPlugin::setProperty($addon, $plugin, 'install', 0);
            }
            if (!OOPlugin::isActivated($addon, $plugin)) {
                OOPlugin::setProperty($addon, $plugin, 'status', 0);
            }
            foreach (array('install', 'status') as $prop) {
                $content .= sprintf("\$REX['ADDON']['plugins']['%s']['%s']['%s'] = '%d';\n", $addon, $prop, $plugin, OOPlugin::getProperty($addon, $plugin, $prop));
            }
            $content .= "\n";
        }
    }
    // Da dieser Funktion öfter pro request aufgerufen werden kann,
    // hier die caches löschen
    clearstatcache();
    $file = $REX['INCLUDE_PATH'] . '/plugins.inc.php';
    if (rex_replace_dynamic_contents($file, $content) === false) {
        return 'Datei "' . $file . '" hat keine Schreibrechte';
    }
    return true;
}
 static function getPluginDescription($addon, $plugin)
 {
     return OOPlugin::getProperty($addon, $plugin, 'description');
 }
Пример #5
0
                 $subPage->setHref('index.php?page=' . $addonName . '&subpage=' . $s[0]);
                 $addonPage->addSubPage($subPage);
             } else {
                 if (rex_be_main_page::isValid($s)) {
                     $p = $s->getPage();
                     $REX['PAGES'][$addonName . '_' . $pluginName . '_' . $p->getTitle()] = $s;
                 } else {
                     if (rex_be_page::isValid($s) && $addonPage) {
                         $addonPage->addSubPage($s);
                     }
                 }
             }
         }
         if ($pluginPage) {
             // "navigation" adds attributes to the plugin-root page
             $navProperties = OOPlugin::getProperty($addonName, $pluginName, 'navigation', array());
             // if there are some navigation attributes set, create a main page and apply attributes to it
             if (count($navProperties) > 0) {
                 $mainPluginPage = new rex_be_main_page($addonName, $pluginPage);
                 foreach ($navProperties as $key => $value) {
                     $mainPluginPage->_set($key, $value);
                 }
                 $REX['PAGES'][$addonName . '_' . $pluginName] = $mainPluginPage;
             } else {
                 if ($addonPage) {
                     $addonPage->addSubPage($pluginPage);
                 }
             }
         }
     }
 }
function rex_generatePlugins($plugins)
{
    global $REX;
    natsort($plugins);
    $content = "";
    foreach ($plugins as $cur) {
        if (!OOPlugin::isInstalled($cur)) {
            OOPlugin::setProperty($cur, 'install', 0);
        }
        if (!OOPlugin::isActivated($cur)) {
            OOPlugin::setProperty($cur, 'status', 0);
        }
        $content .= sprintf("%s = %d;\n%s = %d;\n\n", OOPlugin::getAsPropertyString($cur, 'install'), OOPlugin::getProperty($cur, 'install'), OOPlugin::getAsPropertyString($cur, 'status'), OOPlugin::getProperty($cur, 'status'));
    }
    $content .= sprintf("\$REX['ADDON']['pluginlist']['community'] = \"%s\";", implode(',', OOPlugin::getRegisteredPlugins()));
    // Da dieser Funktion öfter pro request aufgerufen werden kann,
    // hier die caches löschen
    clearstatcache();
    $file = rex_plugins_file();
    if (!rex_replace_dynamic_contents($file, $content)) {
        return 'Datei "' . $file . '" hat keine Schreibrechte';
    }
    return true;
}