Exemplo n.º 1
0
if (!plugin_exists($p_name)) {
    error('Plugin does not exist. Please contact bugs@furasta.org for more details.', 'Plugin Error');
}
/**
 * run uninstall script 
 */
$plugin_dir = HOME . '_plugins/' . $p_name;
$file = $plugin_dir . '/uninstall.php';
if (file_exists($file)) {
    require $file;
}
/**
 * remove the plugin's files 
 */
remove_dir($plugin_dir);
/**
 * remove the plugin from plugin array 
 */
$new_plugs = array();
foreach ($PLUGINS as $plugin => $version) {
    if ($plugin == $p_name) {
        continue;
    }
    $new_plugs[$plugin] = $version;
}
/**
 * write new settings to file 
 */
settings_rewrite($SETTINGS, $DB, $new_plugs);
cache_clear();
header('location: settings.php?page=plugins');
Exemplo n.º 2
0
<?php

/**
 * Activate Plugin, Furasta.Org
 *
 * Activates a plugin. This page is accessed via AJAX.
 *
 * @author     Conor Mac Aoidh <*****@*****.**>
 * @license    http://furasta.org/licence.txt The BSD License
 * @version    1.0
 * @package    admin_settings
 */
$p_name = addslashes(@$_GET['p_name']);
if (!plugin_exists($p_name)) {
    error('Plugin "' . $p_name . '" is not available. In order to install the plugin must be downloaded.', 'Plugin Error');
}
$PLUGINS[$p_name] = 0;
/**
 * rewrite settings file with new plugin array 
 */
settings_rewrite($SETTINGS, $DB, $PLUGINS);
cache_clear();
header('location: settings.php?page=plugins');
Exemplo n.º 3
0
 /**
  * jobs
  *
  * this function runs through registered jobs and checks
  * if they are due to be run. if they are it runs them and
  * records the time in the $SETTINGS array so that it can
  * determine later when the job needs to be run again
  *
  * @access public
  * @return void
  */
 public function jobs()
 {
     global $SETTINGS;
     $functions = array();
     // used to delete old jobs from the settings array
     $change = false;
     // should the config be updated
     foreach ($this->plugins as $plugin) {
         if (is_array(@$plugin['general']['jobs'])) {
             foreach ($plugin['general']['jobs'] as $job) {
                 $rate = @$job[0];
                 $function = @$job[1];
                 $time = time();
                 if (!function_exists($function)) {
                     // function does not exist
                     continue;
                 }
                 array_push($functions, $function);
                 /**
                  * if in settings array, check if it should be run now
                  * or not
                  */
                 if (isset($SETTINGS['jobs'][$function])) {
                     $last = $SETTINGS['jobs'][$function];
                     /**
                      * get next execution date
                      */
                     if (in_array($rate, self::$daysofmonth)) {
                         $day = date('dd');
                         if ($rate == 'last') {
                             // get last day of month
                             $rate = date('t', strtotime('today'));
                         }
                         if ($day == $rate) {
                             // this is the dayofmonth
                             $next = $time - 1;
                         }
                     } else {
                         $next = strtotime($rate, $last);
                     }
                     if ($time < $next) {
                         // program has been run already, within range
                         continue;
                     }
                 }
                 /**
                  * call function, if it returns true then
                  * update time in settings file
                  */
                 $success = call_user_func($function);
                 if ($success) {
                     $change = true;
                     $SETTINGS['jobs'][$function] = $time;
                 }
             }
         }
     }
     /**
      * remove old jobs from settings array
      */
     if (is_array(@$SETTINGS['jobs'])) {
         foreach ($SETTINGS['jobs'] as $name => $job) {
             if (!in_array($name, $functions)) {
                 unset($SETTINGS['jobs'][$name]);
                 $change = true;
             }
         }
     }
     /**
      * if settings_rewrite is required, do it!
      */
     if ($change) {
         global $DB, $PLUGINS;
         settings_rewrite($SETTINGS, $DB, $PLUGINS);
     }
 }
Exemplo n.º 4
0
<?php

/**
 * Update File, Furasta.Org
 *
 * When an upgrade is run, this file will be automatically run
 * and it will run upgrade scripts
 *
 * This file is for major updates, for svn revision updates see
 * _inc/upgrade.php
 *
 * @author     Conor Mac Aoidh <*****@*****.**>
 * @license    http://furasta.org/licence.txt The BSD License
 * @version    1.0
 */
$version = 0;
$constants = array();
switch (VERSION) {
}
$constants['VERSION'] = $version;
settings_rewrite($SETTINGS, $DB, $PLUGINS, $constants);
Exemplo n.º 5
0
 *
 * Activates a template.
 *
 * @author     Conor Mac Aoidh <*****@*****.**>
 * @license    http://furasta.org/licence.txt The BSD License
 * @version    1.0
 * @package    admin_settings
 */
require '../../../_inc/define.php';
/**
 * if user not logged in die 
 */
if (!User::verify()) {
    die;
}
$User = User::getInstance();
/**
 * check if user has permission to activate template
 */
if (!$User->hasPerm('s')) {
    error('You have insufficient privelages to view this page. Please contact one of the administrators.', 'Permissions Error');
}
$name = addslashes(@$_GET['name']);
if ($name == '') {
    exit;
}
if (!file_exists(HOME . '_www/' . $name . '/index.html')) {
    error('Incomplete template files.', 'Template Error');
}
settings_rewrite($SETTINGS, $DB, $PLUGINS, array('TEMPLATE_DIR' => HOME . '_www/' . $name . '/'));
header('location: ' . SITE_URL . 'admin/settings.php?page=template');