コード例 #1
0
function list_active_plugins()
{
    $q = sql_get_array("SELECT name FROM settings;");
    $plugins = array();
    for ($n = 0; $n < count($q); $n++) {
        if (preg_match('/plugin_([^.]+):active/i', $q[$n]['name'], $plugin_match)) {
            $plugins[] = $plugin_match[1];
        }
    }
    return $plugins;
}
コード例 #2
0
ファイル: cron.php プロジェクト: laiello/planetoid-project
 if (SQL_TYPE == 'pgsql') {
     $db_link = pg_connect('host=' . SQL_HOST . ' port=' . SQL_PORT . ' dbname=' . SQL_DB_NAME . ' user='******' password='******'Could not connect: ' . pg_last_error());
 } else {
     if (SQL_TYPE == 'mysql') {
         $db_link = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die('Could not connect: ' . mysql_error());
         mysql_select_db(SQL_DB_NAME) or die('Fatal error: Failed to open connection to MySQL!<br/>Check your configuration');
     }
 }
 if ($n = 0) {
     sql_query("INSERT INTO settings VALUES(" . sql_autoid('settings') . ", 'pcron', 'true');");
 } else {
     sql_query("UPDATE settings SET value='true' WHERE name='pcron';");
 }
 $feeds = array();
 $feeds_d = array();
 $feeds_q = sql_get_array("SELECT * FROM feeds;");
 for ($n = 0; $n < count($feeds_q); $n++) {
     $feed = $feeds_q[$n];
     if ($feed['approved'] == 1) {
         $feeds[] = $feed['url'];
     }
     $feeds_d[] = $feed;
 }
 cache(serialize($feeds), $feeds_ch);
 cache(serialize($feeds_d), $feeds_d_ch);
 sleep(1);
 refresh_cache(false);
 sql_close();
 log_cache_refresh($start_caching, time());
 /* We have been working hard, we should sleep now :)  */
 if (!isset($_GET['force'])) {