public function plugin($parameter1 = NULL, $parameter2 = NULL)
 {
     switch ($parameter1) {
         case 'showall':
             $return = '';
             $available_plugin = json_decode(available_plugin(), TRUE);
             $plugins = $available_plugin['plugins'];
             foreach ($plugins as $key => $val) {
                 if (is_plugin_active($key)) {
                     $key = '[active] ' . $key;
                 } else {
                     $key = '[deactive] ' . $key;
                 }
                 $return[] = "\t" . $key . "\n";
             }
             return implode('', $return);
             break;
         case 'active':
             if (isset($parameter2)) {
                 $return = disable_plugin('1', $parameter2);
                 $args = json_decode($return, TRUE);
                 return $args['mes'];
             } else {
                 $return = '';
                 $active_plugin = json_decode(list_plugin(1), TRUE);
                 foreach ($active_plugin as $key => $val) {
                     $return[] = "\t" . $val . "\n";
                 }
                 return implode('', $return);
             }
             break;
         case 'deactive':
             if (isset($parameter2)) {
                 return disable_plugin('0', $parameter2);
                 $args = json_decode($return, TRUE);
                 return $args['mes'];
             } else {
                 $return = '';
                 $active_plugin = json_decode(list_plugin(0), TRUE);
                 foreach ($active_plugin as $key => $val) {
                     $return[] = "\t" . $val . "\n";
                 }
                 return implode('', $return);
             }
             break;
         case 'drop':
             if (isset($parameter2)) {
                 return drop_plugin($parameter2);
                 $args = json_decode($return, TRUE);
                 return $args['mes'];
             } else {
                 $mes = _('Vui lòng nhập plugin key muốn xóa');
                 return $mes;
             }
             break;
         default:
             $help = "\tplugin showall : " . _('Hiển thị tất cả plugin hiện có') . "\n" . "\tplugin active : " . _('Hiển thị tất cả plugin đang chạy') . "\n" . "\tplugin active [pluginkey] : " . _('Kích hoạt plugin [pluginkey]') . "\n" . "\tplugin deactive : " . _('Hiển thị tất cả plugin đang tắt') . "\n" . "\tplugin deactive [pluginkey] : " . _('Tắt plugin [pluginkey]') . "\n" . "\tplugin drop [pluginkey]: " . _('Xóa plugin [pluginkey]') . "\n" . "" . "\n";
             return $help;
     }
 }
function LoadActivePlugins()
{
    foreach (active_plugins() as $plugin_filename => $active) {
        $path = PLUGINS_DIRECTORY . '/' . $plugin_filename;
        if (is_file($path)) {
            include $path;
        } else {
            disable_plugin($plugin_filename);
        }
    }
}
Exemple #3
0
function hj_forum_init()
{
    $plugin = 'hypeForum';
    // Make sure hypeFramework is active and precedes hypeForum in the plugin list
    if (!is_callable('hj_framework_path_shortcuts')) {
        register_error(elgg_echo('framework:error:plugin_order', array($plugin)));
        disable_plugin($plugin);
        forward('admin/plugins');
    }
    // Run upgrade scripts
    hj_framework_check_release($plugin, HYPEFORUM_RELEASE);
    $shortcuts = hj_framework_path_shortcuts($plugin);
    // Helper Classes
    elgg_register_classes($shortcuts['classes']);
    // Libraries
    $libraries = array('base', 'forms', 'page_handlers', 'actions', 'assets', 'views', 'menus', 'hooks');
    foreach ($libraries as $lib) {
        $path = "{$shortcuts['lib']}{$lib}.php";
        if (file_exists($path)) {
            elgg_register_library("forum:library:{$lib}", $path);
            elgg_load_library("forum:library:{$lib}");
        }
    }
    // Search
    elgg_register_entity_type('object', 'hjforum');
    elgg_register_entity_type('object', 'hjforumtopic');
    elgg_register_entity_type('object', 'hjforumpost');
    if (HYPEFORUM_GROUP_FORUMS) {
        // Add group option
        add_group_tool_option('forums', elgg_echo('hj:forum:groupoption:enableforum'), true);
        elgg_extend_view('groups/tool_latest', 'framework/forum/group_module');
    }
    // Notification
    register_notification_object('object', 'hjforumtopic', elgg_echo('hj:forum:newforumtopic'));
    register_notification_object('object', 'hjforumpost', elgg_echo('hj:forum:newforumpost'));
    elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'hj_forum_notify_message');
    elgg_register_plugin_hook_handler("register", "menu:forums_sidebar_tree", "forums_sidebar_tree_hook");
}
Exemple #4
0
/**
 * Init plugin
 */
function init()
{
    if (!elgg_is_admin_logged_in()) {
        return;
    }
    // Make sure roles plugin is active
    if (!is_callable('roles_init')) {
        register_error(elgg_echo(PLUGIN_ID . ':plugin_dependancy_error'));
        disable_plugin(PLUGIN_ID);
        forward('admin/plugins');
    }
    elgg_unregister_event_handler('ready', 'system', 'roles_check_update');
    // Register actions
    elgg_register_action('roles/edit', __DIR__ . '/actions/edit.php', 'admin');
    elgg_register_action('roles/permissions', __DIR__ . '/actions/permissions.php', 'admin');
    elgg_register_action('roles/set', __DIR__ . '/actions/set.php', 'admin');
    // Register JS and CSS
    elgg_register_simplecache_view('css/roles/ui/admin');
    elgg_register_css('roles.ui.admin', elgg_get_simplecache_url('css', 'roles/ui/admin'));
    elgg_register_simplecache_view('css/roles/ui/set');
    elgg_register_css('roles.ui.set', elgg_get_simplecache_url('css', 'roles/ui/set'));
    elgg_register_simplecache_view('js/roles/ui/admin');
    elgg_register_js('roles.ui.admin', elgg_get_simplecache_url('js', 'roles/ui/admin'));
    elgg_register_simplecache_view('js/roles/ui/set');
    elgg_register_js('roles.ui.set', elgg_get_simplecache_url('js', 'roles/ui/set'));
    // Override roles config once roles specified by other plugins have been created
    //elgg_register_plugin_hook_handler('roles:config', 'role', __NAMESPACE__ . '\\get_roles_config');
    // Pretty URL for roles
    elgg_register_entity_url_handler('object', 'role', __NAMESPACE__ . '\\url_handler');
    // Register admin menu items
    elgg_register_event_handler('pagesetup', 'system', __NAMESPACE__ . '\\menu_setup');
    // Allow admins to set the role from user hover menu
    elgg_register_plugin_hook_handler('register', 'menu:user_hover', __NAMESPACE__ . '\\user_hover_menu_setup');
    // Register an ajax view to pull up a roles form
    elgg_extend_view('navigation/menu/user_hover', 'roles/ui/user_hover');
    elgg_register_ajax_view('roles/ajax/set');
}
/** Xóa plugin */
function drop_plugin($plugin_key = FALSE)
{
    disable_plugin('1', $plugin_key);
    $path = BASEPATH . '/' . HM_PLUGIN_DIR . '/' . $plugin_key;
    DeleteDir($path);
    $mes = $plugin_key . ' deleted';
    $args = array('status' => 'success', 'mes' => $mes);
    return json_encode($args);
}
/**
 * Plugin Installer (this is a copy of enable actions of core)
 * 
 * @package plugin_installer
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
// block non-admin users
admin_gatekeeper();
// Validate the action
action_gatekeeper();
// Get the plugin
$plugin = get_input('plugin');
if (!is_array($plugin)) {
    $plugin = array($plugin);
}
foreach ($plugin as $p) {
    // Re enable
    if (disable_plugin($p) && enable_plugin($p)) {
        system_message(sprintf(elgg_echo('plugin_installer:plugin_admin:reactivate:yes'), $p));
    } else {
        register_error(sprintf(elgg_echo('plugin_installer:plugin_admin:reactivate:no'), $p));
    }
}
elgg_view_regenerate_simplecache();
$cache = elgg_get_filepath_cache();
$cache->delete('view_paths');
forward($vars['url'] . "pg/admin/plugins/");
exit;
<?php

global $CONFIG;
/// Deprecate kses and activate htmlawed
/**
 * Kses appears to be a dead project so we are deprecating it in favour of htmlawed.
 */
disable_plugin('kses', $CONFIG->site->guid);
enable_plugin('htmlawed', $CONFIG->site->guid);
Exemple #8
0
/**
 * main function that register everything
 *
 * @global <type> $CONFIG
 */
function init_izap_videos()
{
    global $CONFIG;
    // render this plugin from izap-elgg-bridge now
    if (is_plugin_enabled('izap-elgg-bridge')) {
        func_init_plugin_byizap(array('plugin' => array('name' => GLOBAL_IZAP_VIDEOS_PLUGIN)));
    } else {
        register_error('This plugin needs izap-elgg-bridge');
        disable_plugin(GLOBAL_IZAP_VIDEOS_PLUGIN);
    }
    // for the first time, admin settings are not set so send admin to the setting page, to set the default settings
    if (isadminloggedin() && (int) datalist_get('izap_videos_installtime') == 0) {
        datalist_set('izap_videos_installtime', time());
        forward($CONFIG->wwwroot . 'pg/videos/adminSettings/' . get_loggedin_user()->username . '?option=settings');
    }
    // extend the views
    if (is_callable('elgg_extend_view')) {
        $extend_view = 'elgg_extend_view';
    } else {
        $extend_view = 'extend_view';
    }
    // include the main lib file
    include dirname(__FILE__) . '/lib/izapLib.php';
    // load all the required files
    izapLoadLib_izap_videos();
    // register pagehandler
    register_page_handler('videos', 'pageHandler_izap_videos');
    register_page_handler('izap_videos_files', 'pageHandler_izap_videos_files');
    // register the notification hook
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'izap_videos', elgg_echo('izap_videos:newVideoAdded'));
    }
    $period = get_plugin_setting('izap_cron_time', GLOBAL_IZAP_VIDEOS_PLUGIN);
    if (isOnserverEnabled() && is_plugin_enabled('crontrigger') && $period != 'none') {
        register_plugin_hook('cron', $period, 'izap_queue_cron');
    }
    // asking group to include the izap_videos
    if (is_callable('add_group_tool_option')) {
        add_group_tool_option('izap_videos', elgg_echo('izap_videos:group:enablevideo'), true);
    }
    // register the notification hook
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'izap_videos', elgg_echo('izap_videos:newVideoAdded'));
    }
    // skip tags from filteration
    if (is_old_elgg()) {
        //allow some tags for elgg lesser than 1.6
        $CONFIG->allowedtags['object'] = array('width' => array(), 'height' => array(), 'classid' => array(), 'codebase' => array(), 'data' => array(), 'type' => array());
        $CONFIG->allowedtags['param'] = array('name' => array(), 'value' => array());
        $CONFIG->allowedtags['embed'] = array('src' => array(), 'type' => array(), 'wmode' => array(), 'width' => array(), 'height' => array());
    } else {
        $allowed_tags = get_plugin_setting('izapHTMLawedTags', GLOBAL_IZAP_VIDEOS_PLUGIN);
        $CONFIG->htmlawed_config['elements'] = 'object, embed, param, p, img, b, i, ul, li, ol, u, a, s, blockquote, br, strong, em' . ($allowed_tags ? ', ' . $allowed_tags : '');
    }
    run_function_once('izapSetup_izap_videos');
    $extend_view('css', 'izap_videos/css/default');
    $extend_view('metatags', 'izap_videos/js/javascript');
    //$extend_view('profile/menu/links','izap_videos/menu');
    $extend_view('groups/right_column', 'izap_videos/gruopVideos', 1);
    // only if enabled by admin
    if (izapIncludeIndexWidget_izap_videos()) {
        $extend_view('index/righthandside', 'izap_videos/customindexVideos');
    }
    // only if enabled by admin
    if (izapTopBarWidget_izap_videos()) {
        $extend_view('elgg_topbar/extend', 'izap_videos/navBar');
    }
    // finally lets register the object
    register_entity_type('object', 'izap_videos');
}
<?php

/**
 * Elgg 1.8-svn upgrade 2011021800
 * goodbye_walled_garden
 *
 * Removes the Walled Garden plugin in favor of new system settings
 */
global $CONFIG;
$access = elgg_set_ignore_access(TRUE);
if (elgg_is_active_plugin('walledgarden')) {
    disable_plugin('walledgarden');
    set_config('allow_registration', FALSE);
    set_config('walled_garden', TRUE);
} else {
    set_config('allow_registration', TRUE);
    set_config('walled_garden', FALSE);
}
// this was for people who manually set the config option
$disable_registration = elgg_get_config('disable_registration');
if ($disable_registration !== null) {
    $allow_registration = !$disable_registration;
    elgg_save_config('allow_registration', $allow_registration);
    $site = elgg_get_site_entity();
    $query = "DELETE FROM {$CONFIG->dbprefix}config\n\t\t\t\tWHERE name = 'disable_registration' AND site_guid = {$site->guid}";
    delete_data($query);
}
elgg_set_ignore_access($access);
Exemple #10
0
 public static function commit_saisie(&$tab_new_values, $session)
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $return = '';
     if ($session == "") {
         $URL = "{$PHP_SELF}";
     } else {
         $URL = "{$PHP_SELF}?session={$session}";
     }
     $timeout = 2;
     // temps d'attente pour rafraichir l'écran après l'update !
     foreach ($tab_new_values as $key => $value) {
         // CONTROLE gestion_conges_exceptionnels
         // si désactivation les conges exceptionnels, on verif s'il y a des conges exceptionnels enregistres ! si oui : changement impossible !
         if ($key == "gestion_conges_exceptionnels" && $value == "FALSE") {
             $sql_abs = "SELECT ta_id, ta_libelle FROM conges_type_absence WHERE ta_type='conges_exceptionnels' ";
             $ReqLog_abs = \includes\SQL::query($sql_abs);
             if ($ReqLog_abs->num_rows != 0) {
                 $return .= '<b>' . _('config_abs_desactive_cong_excep_impossible') . '</b><br>';
                 $value = "TRUE";
                 $timeout = 5;
             }
         }
         // CONTROLE jour_mois_limite_reliquats
         // si modif de jour_mois_limite_reliquats, on verifie le format ( 0 ou jj-mm) , sinon : changement impossible !
         if ($key == "jour_mois_limite_reliquats" && $value != "0") {
             $t = explode("-", $value);
             if (checkdate($t[1], $t[0], date("Y")) == FALSE) {
                 $return .= '<b>' . _('config_jour_mois_limite_reliquats_modif_impossible') . '</b><br>';
                 $sql_date = "SELECT conf_valeur FROM conges_config WHERE conf_nom='jour_mois_limite_reliquats' ";
                 $ReqLog_date = \includes\SQL::query($sql_date);
                 $data = $ReqLog_date->fetch_row();
                 $value = $data[0];
                 $timeout = 5;
             }
         }
         if (preg_match("/_installed\$/", $key) && $value == "1") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             install_plugin($plugin);
         } elseif (preg_match("/_installed\$/", $key) && $value == "0") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             uninstall_plugin($plugin);
         }
         if (preg_match("/_activated\$/", $key) && $value == "1") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             activate_plugin($plugin);
         } elseif (preg_match("/_activated\$/", $key) && $value == "0") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             disable_plugin($plugin);
         }
         // Mise à jour
         $sql2 = 'UPDATE conges_config SET conf_valeur = \'' . addslashes($value) . '\' WHERE conf_nom ="' . \includes\SQL::quote($key) . '" ';
         $ReqLog2 = \includes\SQL::query($sql2);
     }
     $_SESSION['config'] = init_config_tab();
     // on re-initialise le tableau des variables de config
     // enregistrement dans les logs
     $comment_log = "nouvelle configuration de php_conges ";
     log_action(0, "", "", $comment_log);
     $return .= '<span class="messages">' . _('form_modif_ok') . '</span><br>';
     $return .= '<META HTTP-EQUIV=REFRESH CONTENT="' . $timeout . '; URL=' . $URL . '">';
     return $return;
 }
                $manifest = true;
                $plugin_name = str_ireplace("/manifest.xml", "", $entry['name']);
            } elseif (stristr($entry['name'], "start.php") && substr_count($entry['name'], "/") == 1) {
                $start = true;
            }
        }
        if (!$manifest) {
            register_error(elgg_echo('plugin_installer:upload:error:nomanifest'));
        } elseif (!$start) {
            register_error(elgg_echo('plugin_installer:upload:error:nostart'));
        } else {
            if (!file_exists($CONFIG->pluginspath . $plugin_name) || $overwrite) {
                $extract = $zip->extractTo($CONFIG->pluginspath);
                $zip->close();
                if ($extract === TRUE && file_exists($CONFIG->pluginspath . $plugin_name)) {
                    disable_plugin($plugin_name);
                    enable_plugin($plugin_name);
                    regenerate_plugin_list();
                    system_message(elgg_echo('plugin_installer:upload:success'));
                } else {
                    register_error(elgg_echo('plugin_installer:upload:error:unzip'));
                }
            } else {
                register_error(elgg_echo('plugin_installer:upload:error:pluginexists'));
            }
        }
    } else {
        register_error(elgg_echo('plugin_installer:upload:error'));
    }
    $filehandler->delete();
} else {
<?php

/**
 * Disable plugin action.
 * 
 * @package Elgg
 * @subpackage Core
 * @author Curverider Ltd
 * @link http://elgg.org/
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
// block non-admin users
admin_gatekeeper();
// Validate the action
action_gatekeeper();
$plugins = get_installed_plugins();
foreach ($plugins as $p => $data) {
    // Disable
    if (disable_plugin($p)) {
        system_message(sprintf(elgg_echo('admin:plugins:disable:yes'), $p));
    } else {
        register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p));
    }
}
elgg_view_regenerate_simplecache();
elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
exit;
Exemple #13
0
<?php

/**
 * Upgrades the oAuth Library plugin name
 */
if (elgg_is_active_plugin('oauth')) {
    disable_plugin('oauth');
    enable_plugin('oauth_lib');
}
<?php

global $CONFIG;
/**
 * Disable update client since this has now been removed.
 */
disable_plugin('updateclient', $CONFIG->site->guid);
<?php

/** 
 * Tệp tin xử lý plugin trong admin
 * Vị trí : admin/plugin.php 
 */
if (!defined('BASEPATH')) {
    exit('403');
}
/** gọi tệp tin admin base */
require_once dirname(__FILE__) . '/admin.php';
/** gọi model xử lý plugin */
require_once dirname(__FILE__) . '/plugin/plugin_model.php';
$key = hm_get('key');
$id = hm_get('id');
$action = hm_get('action');
switch ($action) {
    case 'available':
        echo available_plugin();
        break;
    case 'disable_plugin':
        echo disable_plugin(0);
        break;
    case 'active_plugin':
        echo disable_plugin(1);
        break;
}
Exemple #16
0
<?php

global $CONFIG;
/**
 * Disable members plugin as it has been moved into core.
 */
disable_plugin('members', $CONFIG->site->guid);
/**
 * For now, loads plugins directly
 *
 * @todo Add proper plugin handler that launches plugins in an admin-defined order and activates them on admin request
 * @package Elgg
 * @subpackage Core
 */
function load_plugins()
{
    global $CONFIG;
    if (!empty($CONFIG->pluginspath)) {
        // See if we have cached values for things
        $cached_view_paths = elgg_filepath_cache_load();
        if ($cached_view_paths) {
            $CONFIG->views = unserialize($cached_view_paths);
        }
        // temporary disable all plugins if there is a file called 'disabled' in the plugin dir
        if (file_exists($CONFIG->pluginspath . "disabled")) {
            return;
        }
        $plugins = get_plugin_list();
        if (sizeof($plugins)) {
            foreach ($plugins as $mod) {
                if (is_plugin_enabled($mod)) {
                    if (file_exists($CONFIG->pluginspath . $mod)) {
                        if (!(include $CONFIG->pluginspath . $mod . "/start.php")) {
                            // automatically disable the bad plugin
                            disable_plugin($mod);
                            // register error rather than rendering the site unusable with exception
                            register_error(sprintf(elgg_echo('PluginException:MisconfiguredPlugin'), $mod));
                            // continue loading remaining plugins
                            continue;
                        }
                        if (!$cached_view_paths) {
                            if (is_dir($CONFIG->pluginspath . $mod . "/views")) {
                                if ($handle = opendir($CONFIG->pluginspath . $mod . "/views")) {
                                    while ($viewtype = readdir($handle)) {
                                        if (!in_array($viewtype, array('.', '..', '.svn', 'CVS')) && is_dir($CONFIG->pluginspath . $mod . "/views/" . $viewtype)) {
                                            autoregister_views("", $CONFIG->pluginspath . $mod . "/views/" . $viewtype, $CONFIG->pluginspath . $mod . "/views/", $viewtype);
                                        }
                                    }
                                }
                            }
                        }
                        if (is_dir($CONFIG->pluginspath . $mod . "/languages")) {
                            register_translations($CONFIG->pluginspath . $mod . "/languages/");
                        }
                    }
                }
            }
        }
        // Cache results
        if (!$cached_view_paths) {
            elgg_filepath_cache_save(serialize($CONFIG->views));
        }
    }
}