function simplekaltura_init() { $plugin_root = dirname(__FILE__); elgg_register_library('simplekaltura', "{$plugin_root}/lib/simplekaltura_lib.php"); elgg_register_library('KalturaClient', "{$plugin_root}/vendors/kaltura_client/KalturaClient.php"); elgg_load_library('simplekaltura'); // helper libs $libs = array('swfobject', 'html5', 'utility', 'thumbs'); foreach ($libs as $lib) { $url = elgg_get_simplecache_url('js', "simplekaltura/{$lib}"); elgg_register_js("simplekaltura:{$lib}", $url); } // Register SKUploader elgg_register_external_view('js/simplekaltura/SKUploader.js', TRUE); // Include html5 js library elgg_load_js('simplekaltura:html5'); elgg_load_js('simplekaltura:utility'); elgg_extend_view('css/elgg', 'simplekaltura/css'); // If plugin is properly configured if (simplekaltura_is_configured()) { // Add to main menu $item = new ElggMenuItem('simplekaltura', elgg_get_plugin_setting('kaltura_entity_title', 'simplekaltura'), 'videos'); elgg_register_menu_item('site', $item); // Register page handler elgg_register_page_handler('videos', 'simplekaltura_page_handler'); } else { elgg_add_admin_notice('simpkaltura_not_configured', elgg_echo('simplekaltura:error:pluginnotconfigured')); } // add the group pages tool option add_group_tool_option('simplekaltura', elgg_echo('groups:enablesimplekaltura'), TRUE); // Profile block hook elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'simplekaltura_owner_block_menu'); // Modify entity menu for addional video items elgg_register_plugin_hook_handler('register', 'menu:entity', 'simplekaltura_setup_entity_menu'); // notifications elgg_register_notification_event('object', 'simplekaltura_video', array('create')); elgg_register_plugin_hook_handler('prepare', 'notification:publish:object:simplekaltura_video', 'simplekaltura_prepare_notification'); // actions $actions_root = "{$plugin_root}/actions/simplekaltura"; elgg_register_action('simplekaltura/save', "{$actions_root}/save.php"); elgg_register_action('simplekaltura/update', "{$actions_root}/update.php"); elgg_register_action('simplekaltura/get_embed', "{$actions_root}/get_embed.php"); elgg_register_action('simplekaltura/featured', "{$actions_root}/featured.php", 'admin'); elgg_register_action('videos/delete', "{$actions_root}/delete.php"); elgg_register_action('simplekaltura/migrate', "{$actions_root}/migrate.php", 'admin'); // entity url and icon handlers elgg_register_plugin_hook_handler('entity:url', 'object', 'simplekaltura_url_handler'); elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'simplekaltura_icon_url_override'); // Register type elgg_register_entity_type('object', 'simplekaltura_video'); // register CRON hook to poll video plays/duration/etc.. elgg_register_plugin_hook_handler('cron', 'fifteenmin', 'simplekaltura_bulk_update'); // Most Played Sidebar elgg_extend_view('simplekaltura/sidebar', 'simplekaltura/featured'); elgg_extend_view('simplekaltura/sidebar', 'simplekaltura/most_played'); // Whitelist ajax views elgg_register_ajax_view('simplekaltura/popup'); return TRUE; }
/** * Add a reminder to set default categories. */ function categories_on_activate() { $site = elgg_get_site_entity(); if (!$site->categories) { $url = elgg_normalize_url('admin/plugin_settings/categories'); $message = elgg_echo('categories:on_enable_reminder', array($url)); elgg_add_admin_notice('categories_admin_notice_no_categories', $message); } return TRUE; }
function izap_bridge_init() { global $CONFIG; //including venders directory in default include paths. set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/vendors/'); // initializes the bridge plugin izap_plugin_init(GLOBAL_IZAP_ELGG_BRIDGE); //registering tab view javascript elgg_register_js('jquery.md5', 'mod/izap-elgg-bridge/vendors/tabs_view.js'); //load library for the bridge(using bridge) IzapBase::loadLib(array('plugin' => GLOBAL_IZAP_ELGG_BRIDGE, 'lib' => 'init')); // over-ride "admin" pagehandler elgg_register_page_handler('admin', GLOBAL_IZAP_PAGEHANDLER); // register some basic hooks elgg_register_plugin_hook_handler('register', 'user', 'izap_registration_sniffer'); elgg_register_event_handler('login', 'user', 'izap_login_sniffer'); elgg_register_event_handler('create', 'all', 'izap_entity_creation_sniffer'); elgg_register_event_handler('update', 'all', 'izap_entity_updation_sniffer'); elgg_register_event_handler('delete', 'all', 'izap_entity_deletion_sniffer'); elgg_register_event_handler('ready', 'system', 'system_ready_hook'); elgg_register_plugin_hook_handler('config', 'htmlawed', 'izap_htmlawed_hook'); // set pages for the admin elgg_register_admin_menu_item('administer', 'marked-spammers', 'users'); // @todo: merge to izap menu elgg_register_admin_menu_item('administer', 'suspected-spammers', 'users'); // @todo: merge to izap menu /** * common horizontal control menu hook registration for all plugins dependent * on izap-elgg-bridge */ elgg_register_plugin_hook_handler('register', 'menu:entity', 'izap_entity_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'izap_mark_spammer'); elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'izap_unmark_spammer'); elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'izap_suspected_spammer'); elgg_extend_view('page/elements/footer', GLOBAL_IZAP_ELGG_BRIDGE . '/our_link'); if (elgg_is_admin_logged_in()) { if (IzapBase::pluginSetting(array('name' => 'izap_api_key', 'plugin' => GLOBAL_IZAP_ELGG_BRIDGE)) == '') { elgg_add_admin_notice('api_key', elgg_echo('izap-bridge:add_api')); } } $global_currency = IzapBase::pluginSetting(array('name' => 'izap_site_currency', 'plugin' => GLOBAL_IZAP_ELGG_BRIDGE)); if ($global_currency == '') { $CONFIG->site_currency_name = 'USD'; $CONFIG->SITE_CURRENCY_SIGN = '$'; } else { $site_currency = explode(':', $global_currency); $CONFIG->site_currency_name = $site_currency[0]; $CONFIG->site_currency_sign = $site_currency[1]; } // regiter antispam with elgg elgg_register_ajax_view('/js/antispam/userstats'); }
/** * Constructs a geocoder and builds providers from plugin settings */ function __construct() { if (!isset(self::$adapter)) { self::$adapter = new GuzzleHttpAdapter(); } if (!isset(self::$providers)) { self::$providers = array_filter(array($this->buildFreeGeoIpProvider())); } if (!count(self::$providers)) { elgg_add_admin_notice('geo:providers', elgg_echo('geo:providers:none')); } else { if (!isset(self::$geocoder)) { $geocoder = new Geocoder(); $geocoder->registerProviders(self::$providers); self::$geocoder = $geocoder; } } }
/** * Constructs a geocoder and builds providers from plugin settings */ function __construct() { if (!isset(self::$adapter)) { self::$adapter = new CurlHttpAdapter(); } if (!isset(self::$providers)) { self::$providers = array_filter(array($this->buildGoogleMapsProvider(), $this->buildNominatimProvider(), $this->buildYandexProvider(), $this->buildGoogleMapsBusinessProvider())); } if (!count(self::$providers)) { elgg_add_admin_notice('geo:providers', elgg_echo('geo:providers:none')); } else { if (!isset(self::$geocoder)) { $geocoder = new Geocoder(); $chain = new ChainProvider(self::$providers); $geocoder->registerProvider($chain); self::$geocoder = $geocoder; } } }
/** * Override ElggFile::delete() * * After deleting the file delete also the directory. * * @return bool */ public function delete() { $fs = $this->getFilestore(); $dir = $this->getFileDirectory(); // Delete the file on disc if ($fs->delete($this)) { // Delete the ElggFile entity if (parent::delete()) { // Delete the directory if (is_dir($dir)) { if (rmdir($dir)) { return true; } else { elgg_add_admin_notice('video_dir_delete_failed', elgg_echo('video:dir_delete_failed', $dir)); } } } } return false; }
/** * Loads all active plugins in the order specified in the tool admin panel. * * @note This is called on every page load. If a plugin is active and problematic, it * will be disabled and a visible error emitted. This does not check the deps system because * that was too slow. * * @return bool * @since 1.8.0 * @access private */ function elgg_load_plugins() { $plugins_path = elgg_get_plugins_path(); $start_flags = ELGG_PLUGIN_INCLUDE_START | ELGG_PLUGIN_REGISTER_VIEWS | ELGG_PLUGIN_REGISTER_LANGUAGES | ELGG_PLUGIN_REGISTER_CLASSES; if (!$plugins_path) { return false; } // temporary disable all plugins if there is a file called 'disabled' in the plugin dir if (file_exists("{$plugins_path}/disabled")) { if (elgg_is_admin_logged_in() && elgg_in_context('admin')) { system_message(elgg_echo('plugins:disabled')); } return false; } if (elgg_get_config('system_cache_loaded')) { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS; } if (elgg_get_config('i18n_loaded_from_cache')) { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_LANGUAGES; } $return = true; $plugins = elgg_get_plugins('active'); if ($plugins) { foreach ($plugins as $plugin) { try { $plugin->start($start_flags); } catch (Exception $e) { $plugin->deactivate(); $msg = elgg_echo('PluginException:CannotStart', array($plugin->getID(), $plugin->guid, $e->getMessage())); elgg_add_admin_notice('cannot_start' . $plugin->getID(), $msg); $return = false; continue; } } } return $return; }
/** * Make thumbnails of given video position. Defaults to beginning of video. * * @param Video $video The video object * @param int $position Video position */ function video_create_thumbnails($video, $position = 0) { $icon_sizes = elgg_get_config('icon_sizes'); $square = elgg_get_plugin_setting('square_icons', 'video'); // Default to square thumbnail images if (is_null($square)) { $square = true; } $square = $square == 1 ? true : false; $dir = $video->getFileDirectory(); $guid = $video->getGUID(); // Use default thumbnail as master $imagepath = "{$dir}/icon-master.jpg"; try { $thumbnailer = new VideoThumbnailer(); $thumbnailer->setInputFile($video->getFilenameOnFilestore()); $thumbnailer->setOutputFile($imagepath); $thumbnailer->setPosition($position); $thumbnailer->execute(); } catch (exception $e) { $msg = elgg_echo('VideoException:ThumbnailCreationFailed', array($video->getFilenameOnFilestore(), $e->getMessage(), $thumbnailer->getCommand())); error_log($msg); elgg_add_admin_notice('video_thumbnailing_error', $msg); return false; } $files = array(); // Create the thumbnails foreach ($icon_sizes as $name => $size_info) { // We have already created master image if ($name == 'master') { continue; } $resized = get_resized_image_from_existing_file($imagepath, $size_info['w'], $size_info['h'], $square); if ($resized) { $file = new ElggFile(); $file->owner_guid = $video->owner_guid; $file->container_guid = $guid; $file->setFilename("video/{$guid}/icon-{$name}.jpg"); $file->open('write'); $file->write($resized); $file->close(); $files[] = $file; } else { error_log("ERROR: Failed to create thumbnail '{$name}' for video {$video->getFilenameOnFilestore()}."); // Delete all images if one fails foreach ($files as $file) { $file->delete(); } return false; } } $video->icontime = time(); return true; }
<?php $settings = array('max_users' => 50, 'delete_users' => 0, 'ignore_banned_users' => 1, 'period' => 'fifteenmin', 'max_last_action' => '-90 days', 'max_last_login' => '-90 days', 'max_time_created' => '-90 days', 'max_time_updated' => '-90 days', 'max_objects' => '5', 'max_metadata' => '10', 'max_annotations' => '1', 'offset' => 0); foreach ($settings as $name => $value) { if (!elgg_get_plugin_setting($name, 'stale_users')) { elgg_set_plugin_setting($name, $value, 'stale_users'); } } elgg_add_admin_notice('stale_users_enable', elgg_echo('stale_users:activate'));
/** * Loads all active plugins in the order specified in the tool admin panel. * * @note This is called on every page load. If a plugin is active and problematic, it * will be disabled and a visible error emitted. This does not check the deps system because * that was too slow. * * @return bool * @since 1.8.0 * @access private */ function elgg_load_plugins() { global $CONFIG; $plugins_path = elgg_get_plugins_path(); $start_flags = ELGG_PLUGIN_INCLUDE_START | ELGG_PLUGIN_REGISTER_VIEWS | ELGG_PLUGIN_REGISTER_LANGUAGES | ELGG_PLUGIN_REGISTER_CLASSES; if (!$plugins_path) { return false; } // temporary disable all plugins if there is a file called 'disabled' in the plugin dir if (file_exists("{$plugins_path}/disabled")) { return false; } // Load view caches if available $cached_view_paths = elgg_filepath_cache_load('views'); $cached_view_types = elgg_filepath_cache_load('view_types'); $cached_view_info = is_string($cached_view_paths) && is_string($cached_view_types); if ($cached_view_info) { $CONFIG->views = unserialize($cached_view_paths); $CONFIG->view_types = unserialize($cached_view_types); // don't need to register views $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS; } $return = true; $plugins = elgg_get_plugins('active'); if ($plugins) { foreach ($plugins as $plugin) { try { $plugin->start($start_flags); } catch (Exception $e) { $plugin->deactivate(); $msg = elgg_echo('PluginException:CannotStart', array($plugin->getID(), $plugin->guid, $e->getMessage())); elgg_add_admin_notice('cannot_start' . $plugin->getID(), $msg); $return = false; continue; } } } // Cache results if (!$cached_view_info) { elgg_filepath_cache_save('views', serialize($CONFIG->views)); elgg_filepath_cache_save('view_types', serialize($CONFIG->view_types)); } return $return; }
/** * Trigger the video conversion */ function video_conversion_cron($hook, $entity_type, $returnvalue, $params) { $ia = elgg_set_ignore_access(true); $videos = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'video', 'limit' => 2, 'metadata_name_value_pairs' => array('name' => 'conversion_done', 'value' => 0))); elgg_load_library('elgg:video'); foreach ($videos as $video) { $sources = $video->getSources(); $success = true; foreach ($sources as $source) { // Converted sources may exist if previous conversion has been interrupted if ($source->conversion_done == true) { continue; } try { $filename = $source->getFilenameOnFilestore(); // Create a new video file to data directory $converter = new VideoConverter(); $converter->setInputFile($video->getFilenameOnFilestore()); $converter->setOutputFile($filename); $converter->setResolution($source->resolution); $converter->setBitrate($source->bitrate); $result = $converter->convert(); // Save video details $info = new VideoInfo($source); $source->resolution = $info->getResolution(); $source->bitrate = $info->getBitrate(); $source->conversion_done = true; $source->save(); echo "<p>Successfully created video file {$source->getFilename()}</p>"; } catch (Exception $e) { // Print simple error to screen echo "<p>Failed to create video file {$source->getFilename()}</p>"; $success = false; // Print detailed error to error log $message = elgg_echo('VideoException:ConversionFailed', array($filename, $e->getMessage(), $converter->getCommand())); error_log($message); elgg_add_admin_notice('conversion_error', $message); } } if ($success) { $video->conversion_done = true; add_to_river('river/object/video/create', 'create', $video->getOwnerGUID(), $video->getGUID()); } } elgg_set_ignore_access($ia); return $returnvalue; }
<?php /** * Elgg 1.8.3 upgrade 2012041800 * dont_filter_passwords * * Add admin notice that password handling has changed and if * users can't login to have them reset their passwords. */ elgg_add_admin_notice('dont_filter_passwords', 'Password handling has been updated to be more secure and flexible. ' . 'This change may prevent a small number of users from logging in with their existing passwords. ' . 'If a user is unable to log in, please advise him or her to reset their password, or reset it as an admin user.');
<?php // Register a class for the object/group_request subtype if (get_subtype_id('object', 'group_request')) { update_subtype('object', 'group_request', '\\Groups\\Requests\\Request'); } else { add_subtype('object', 'group_request', '\\Groups\\Requests\\Request'); } $limited_groups = elgg_get_plugin_setting('limited_groups', 'groups'); // Notify admin if group creation has not been restricted to admins if ($limited_groups !== 'yes') { $group_settings = elgg_view('output/url', array('text' => elgg_echo('group_requests:limited_groups:enable'), 'href' => 'admin/plugin_settings/groups')); elgg_add_admin_notice('limited_groups_disabled', elgg_echo('group_requests:limited_groups:disabled', array($group_settings))); }
function event_calendar_check_pending_upgrades() { elgg_load_library('elgg:event_calendar'); elgg_delete_admin_notice('event_calendar_admin_notice_pending_upgrades'); if (event_calendar_is_upgrade_available()) { $message = elgg_echo('event_calendar:admin_notice_pending_upgrades', array(elgg_normalize_url('admin/plugin_settings/event_calendar'))); elgg_add_admin_notice('event_calendar_admin_notice_pending_upgrades', $message); } }
<?php /** * Prompt the user to add categories after activating */ //categories_admin_notice_no_categories $site = get_config('site'); if (!$site->categories) { $message = elgg_echo('categories:on_activate_reminder', array(elgg_normalize_url('admin/plugin_settings/categories'))); elgg_add_admin_notice('categories_admin_notice_no_categories', $message); }
// make sure we have updated plugins _elgg_generate_plugin_entities(); $show_hidden = access_get_show_hidden_status(); access_show_hidden_entities(true); $db_prefix = elgg_get_config('dbprefix'); $site_guid = elgg_get_site_entity()->getGUID(); $old = elgg_get_plugin_from_id('twitterservice'); $new = elgg_get_plugin_from_id('twitter_api'); $has_settings = false; // if not loaded, don't bother. if (!$old || !$new) { return true; } $settings = array('consumer_key', 'consumer_secret', 'sign_on', 'new_users'); foreach ($settings as $setting) { $value = $old->getSetting($setting); if ($value) { $has_settings = true; $new->setSetting($setting, $value); } } // update the user settings $q = "UPDATE {$db_prefix}private_settings\n\tSET name = replace(name, 'twitterservice', 'twitter_api')\n\tWHERE name like '%twitterservice%'"; update_data($q); // if there were settings, emit a notice to re-enable twitter_api if ($has_settings) { elgg_add_admin_notice('twitter_api:disabled', elgg_echo('update:twitter_api:deactivated')); } $old->delete(); access_show_hidden_entities($show_hidden); elgg_set_ignore_access($ia);
<?php /** * Prompt the user to install a tinymce language after activating */ if (elgg_get_config('language') != tinymce_get_site_language()) { $message = elgg_echo('tinymce:lang_notice', array(elgg_echo(elgg_get_config('language')), "http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download", elgg_get_plugins_path() . "tinymce/vendor/tinymce/jscripts/tiny_mce/", elgg_add_action_tokens_to_url(elgg_normalize_url('action/admin/site/flush_cache')))); elgg_add_admin_notice('tinymce_admin_notice_no_lang', $message); }
// Popup width $popupwidth_label = elgg_echo('simplekaltura:admin:popupwidth'); $popupwidth_input = elgg_view('input/text', array('name' => 'params[kaltura_popup_width]', 'value' => $popup_width)); $popup_body = <<<HTML \t<div> \t\t<label>{$popupwidth_label}</label> \t\t{$popupwidth_input} \t</div><br /> \t<div> \t\t<label>{$popupheight_label}</label> \t\t{$popupheight_input} \t</div> HTML; echo elgg_view_module('inline', $popup_label, $popup_body); /************** Upload Module **************/ $upload_label = elgg_echo('simplekaltura:admin:uploadconfig'); // Max upload size input $upload_max_label = elgg_echo('simplekaltura:admin:uploadmax'); $upload_max_input = elgg_view('input/text', array('name' => 'params[kaltura_upload_max]', 'value' => $upload_max)); $upload_body = <<<HTML \t<div> \t\t<label>{$upload_max_label}</label> \t\t{$upload_max_input} \t</div> HTML; echo elgg_view_module('inline', $upload_label, $upload_body); if (simplekaltura_migration_check()) { $url = elgg_normalize_url('admin/simplekaltura/migrate'); $link = elgg_view('output/url', array('text' => $url, 'href' => $url)); elgg_add_admin_notice('simplekaltura_migrate_message', elgg_echo('simplekaltura:migrate:message', array($link))); }
<?php // Create a new table that will hold geometry data for entities $prefix = elgg_get_config('dbprefix'); $tables = get_db_tables(); if (!in_array("{$prefix}entity_geometry", $tables)) { set_time_limit(0); run_sql_script(__DIR__ . '/sql/create_table.sql'); elgg_add_admin_notice("geo:create_table", "MySQL table for storing entity geometry with the name '{$prefix}entity_geometry' has been created"); // Populate geometry table with know information about entities $batch = new ElggBatch('elgg_get_entities_from_metadata', array('metadata_name_value_pairs' => array(array('name' => 'geo:lat', 'value' => null, 'operand' => 'NOT NULL'), array('name' => 'geo:lat', 'value' => '0', 'operand' => '!='), array('name' => 'geo:long', 'value' => null, 'operand' => 'NOT NULL'), array('name' => 'geo:long', 'value' => '0', 'operand' => '!=')), 'order_by' => 'e.guid ASC', 'limit' => 0)); $i = $k = 0; foreach ($batch as $b) { if (elgg_instanceof($b)) { $lat = $b->getLatitude(); $long = $b->getLongitude(); if ($lat && $long) { $query = "INSERT INTO {$prefix}entity_geometry (entity_guid, geometry)\r\n\t\t\t\t\t\t\tVALUES ({$b->guid}, GeomFromText('POINT({$lat} {$long})'))\r\n\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE geometry=GeomFromText('POINT({$lat} {$long})')"; if (insert_data($query)) { $i++; } } else { $k++; } } } elgg_add_admin_notice("geo:import", "'{$prefix}entity_geometry' has been populated with information about the location of {$i} entities; geographic coordinates for {$k} entities were incorrect"); }
<?php /** * Elgg 1.8.15 upgrade 2013060900 * site_secret * * Description */ $strength = _elgg_get_site_secret_strength(); if ($strength !== 'strong') { // a new key is needed immediately register_translations(elgg_get_root_path() . 'languages/'); elgg_add_admin_notice('weak_site_key', elgg_echo("upgrade:site_secret_warning:{$strength}")); }
/** * Register a function as a web service method * * @deprecated 1.9 Enable the web services plugin and use elgg_ws_expose_function(). */ function expose_function($method, $function, array $parameters = NULL, $description = "", $call_method = "GET", $require_api_auth = false, $require_user_auth = false) { elgg_deprecated_notice("expose_function() deprecated for the function elgg_ws_expose_function() in web_services plugin", 1.9); if (!elgg_admin_notice_exists("elgg:ws:1.9")) { elgg_add_admin_notice("elgg:ws:1.9", "The web services are now a plugin in Elgg 1.9.\n\t\t\tYou must enable this plugin and update your web services to use elgg_ws_expose_function()."); } if (function_exists("elgg_ws_expose_function")) { return elgg_ws_expose_function($method, $function, $parameters, $description, $call_method, $require_api_auth, $require_user_auth); } }
/** * Add an admin notice when a new \ElggUpgrade object is created. * * @param string $event * @param string $type * @param \ElggObject $object * @access private */ function _elgg_create_notice_of_pending_upgrade($event, $type, $object) { if ($object instanceof \ElggUpgrade) { // Link to the Upgrades section $link = elgg_view('output/url', array('href' => 'admin/upgrades', 'text' => elgg_echo('admin:view_upgrades'))); $message = elgg_echo('admin:pending_upgrades'); elgg_add_admin_notice('pending_upgrades', "{$message} {$link}"); } }
// store the year for cleanup $year = date('Y', $user_row->time_created); if (!in_array($year, $cleanup_years)) { $cleanup_years[] = $year; } } // remove all dirs that are empty. foreach ($cleanup_years as $year) { remove_dir_if_empty_2013022000($data_root . $year); } if ($failed) { $h = fopen("{$data_root}/2013022000_data_migration.log", 'w'); fwrite($h, implode("\n", $failed)); fclose($h); register_error("Problems migrating user data. See the admin area for more information."); elgg_add_admin_notice('2013022000_data_migration', "There were problems migrating some users' data. See the log file at\n\t\t{$data_root}2013022000_data_migration.log for a list of users who were affected."); } /** * Get the old directory location * * @param stdClass $user_row * @return string */ function make_matrix_2013022000($user_row) { $time_created = date('Y/m/d', $user_row->time_created); return "{$time_created}/{$user_row->guid}/"; } /** * Remove directory if all users moved out of it *
/** * Loads all active plugins in the order specified in the tool admin panel. * * @note This is called on every page load. If a plugin is active and problematic, it * will be disabled and a visible error emitted. This does not check the deps system because * that was too slow. * * @return bool * @access private */ function load() { if ($this->timer) { $this->timer->begin([__METHOD__]); } $plugins_path = elgg_get_plugins_path(); $start_flags = ELGG_PLUGIN_INCLUDE_START | ELGG_PLUGIN_REGISTER_VIEWS | ELGG_PLUGIN_REGISTER_LANGUAGES | ELGG_PLUGIN_REGISTER_CLASSES; if (!$plugins_path) { return false; } // temporary disable all plugins if there is a file called 'disabled' in the plugin dir if (file_exists("{$plugins_path}/disabled")) { if (elgg_is_admin_logged_in() && elgg_in_context('admin')) { system_message(_elgg_services()->translator->translate('plugins:disabled')); } return false; } if (elgg_get_config('system_cache_loaded')) { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS; } if (!empty($GLOBALS['_ELGG']->i18n_loaded_from_cache)) { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_LANGUAGES; } $return = true; $plugins = $this->find('active'); if ($plugins) { foreach ($plugins as $plugin) { $id = $plugin->getID(); try { $plugin->start($start_flags); $this->active_ids[$id] = true; } catch (Exception $e) { $plugin->deactivate(); $msg = _elgg_services()->translator->translate('PluginException:CannotStart', array($id, $plugin->guid, $e->getMessage())); elgg_add_admin_notice("cannot_start {$id}", $msg); $return = false; continue; } } } $this->active_ids_known = true; if ($this->timer) { $this->timer->end([__METHOD__]); } return $return; }
<?php /** * Prompt the user to install a tinymce language after activating */ if (elgg_get_config('language') != extended_tinymce_get_site_language()) { $message = elgg_echo('tinymce:lang_notice', array(elgg_echo(elgg_get_config('language')), "http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download", elgg_get_plugins_path() . "extended_tinymce/vendor/tinymce/jscripts/tiny_mce/", elgg_add_action_tokens_to_url(elgg_normalize_url('action/admin/site/flush_cache')))); elgg_add_admin_notice('extended_tinymce_admin_notice_no_lang', $message); }
* @package Elgg.Core * @subpackage Admin.Plugins */ elgg_generate_plugin_entities(); $installed_plugins = elgg_get_plugins('any'); $show_category = get_input('category', 'all'); $sort = get_input('sort', 'priority'); // Get a list of the all categories // and trim down the plugin list if we're not viewing all categories. // @todo this could be cached somewhere after have the manifest loaded $categories = array(); foreach ($installed_plugins as $id => $plugin) { if (!$plugin->isValid()) { if ($plugin->isActive()) { // force disable and warn elgg_add_admin_notice('invalid_and_deactivated_' . $plugin->getID(), elgg_echo('ElggPlugin:InvalidAndDeactivated', array($plugin->getId()))); $plugin->deactivate(); } continue; } $plugin_categories = $plugin->getManifest()->getCategories(); // handle plugins that don't declare categories // unset them here because this is the list we foreach switch ($show_category) { case 'all': break; case 'active': if (!$plugin->isActive()) { unset($installed_plugins[$id]); } break;
<?php /** * Initialize th plugin */ elgg_register_event_handler('init', 'system', function () { elgg_register_simplecache_view('pusher/settings.js'); elgg_register_plugin_hook_handler('action', 'plugins/settings/save', function ($hook, $type, $return, $params) { if (get_input('plugin_id') == 'pusher') { $link = elgg_view('output/url', array('href' => 'action/admin/site/flush_cache', 'text' => elgg_echo('pusher:settings:notice:link'), 'is_action' => true)); elgg_add_admin_notice('pusher', elgg_echo('pusher:settings:notice', array($link))); } }); });
<?php /** * Elgg 1.8-svn upgrade 2011031400 * oauth_api * * Switches oauth_lib to oauth_api */ $ia = elgg_set_ignore_access(true); // make sure we have updated plugins elgg_generate_plugin_entities(); $show_hidden = access_get_show_hidden_status(); access_show_hidden_entities(true); $old = elgg_get_plugin_from_id('oauth_lib'); $new = elgg_get_plugin_from_id('oauth_api'); if (!$old || !$new) { return true; } $old->deactivate(); $old->delete(); elgg_add_admin_notice('oauth_api:disabled', elgg_echo('update:oauth_api:deactivated')); access_show_hidden_entities($show_hidden); elgg_set_ignore_access($ia);