Zeile 44 | Zeile 44 |
---|
$page->output_nav_tabs($sub_tabs, 'browse_plugins');
// Process search requests
|
$page->output_nav_tabs($sub_tabs, 'browse_plugins');
// Process search requests
|
require_once MYBB_ROOT."inc/class_xml.php";
| |
$keywords = "";
|
$keywords = "";
|
if($mybb->input['keywords'])
| if($mybb->get_input('keywords'))
|
{ $keywords = "&keywords=".urlencode($mybb->input['keywords']); }
|
{ $keywords = "&keywords=".urlencode($mybb->input['keywords']); }
|
if($mybb->input['page'])
| if($mybb->get_input('page'))
|
{ $url_page = "&page=".$mybb->get_input('page', MyBB::INPUT_INT); }
| { $url_page = "&page=".$mybb->get_input('page', MyBB::INPUT_INT); }
|
Zeile 67 | Zeile 65 |
---|
// Convert to mods site version codes $search_version = ($major_version_code/100).'x';
|
// Convert to mods site version codes $search_version = ($major_version_code/100).'x';
|
$contents = fetch_remote_file("https://community.mybb.com/xmlbrowse.php?api=2&type=plugins&version={$search_version}{$keywords}{$url_page}", $post_data);
| $contents = fetch_remote_file("https://community.mybb.com/xmlbrowse.php?api=2&type=plugins&version={$search_version}{$keywords}{$url_page}");
|
if(!$contents) {
| if(!$contents) {
|
Zeile 81 | Zeile 79 |
---|
$table->construct_header($lang->latest_version, array("class" => "align_center", 'width' => 125)); $table->construct_header($lang->controls, array("class" => "align_center", 'width' => 125));
|
$table->construct_header($lang->latest_version, array("class" => "align_center", 'width' => 125)); $table->construct_header($lang->controls, array("class" => "align_center", 'width' => 125));
|
$parser = new XMLParser($contents);
| $parser = create_xml_parser($contents);
|
$tree = $parser->get_tree();
if(!is_array($tree) || !isset($tree['results']))
| $tree = $parser->get_tree();
if(!is_array($tree) || !isset($tree['results']))
|
Zeile 119 | Zeile 117 |
---|
} }
|
} }
|
| $no_results = false;
|
if($table->num_rows() == 0) { $table->construct_cell($lang->error_no_results_found, array("colspan" => 3)); $table->construct_row();
|
if($table->num_rows() == 0) { $table->construct_cell($lang->error_no_results_found, array("colspan" => 3)); $table->construct_row();
|
| $no_results = true;
|
}
$search = new Form("index.php?module=config-plugins&action=browse", 'post', 'search_form'); echo "<div style=\"padding-bottom: 3px; margin-top: -9px; text-align: right;\">";
|
}
$search = new Form("index.php?module=config-plugins&action=browse", 'post', 'search_form'); echo "<div style=\"padding-bottom: 3px; margin-top: -9px; text-align: right;\">";
|
if($mybb->input['keywords'])
| if($mybb->get_input('keywords'))
|
{ $default_class = ''; $value = htmlspecialchars_uni($mybb->input['keywords']);
| { $default_class = ''; $value = htmlspecialchars_uni($mybb->input['keywords']);
|
Zeile 181 | Zeile 181 |
---|
// Recommended plugins = Default; Otherwise search results & pagination if($mybb->request_method == "post")
|
// Recommended plugins = Default; Otherwise search results & pagination if($mybb->request_method == "post")
|
{
| {
|
$table->output("<span style=\"float: right;\"><small><a href=\"https://community.mybb.com/mods.php?action=browse&category=plugins\" target=\"_blank\" rel=\"noopener\">{$lang->browse_all_plugins}</a></small></span>".$lang->sprintf($lang->browse_results_for_mybb, $mybb->version));
|
$table->output("<span style=\"float: right;\"><small><a href=\"https://community.mybb.com/mods.php?action=browse&category=plugins\" target=\"_blank\" rel=\"noopener\">{$lang->browse_all_plugins}</a></small></span>".$lang->sprintf($lang->browse_results_for_mybb, $mybb->version));
|
}
| }
|
else
|
else
|
{
| {
|
$table->output("<span style=\"float: right;\"><small><a href=\"https://community.mybb.com/mods.php?action=browse&category=plugins\" target=\"_blank\" rel=\"noopener\">{$lang->browse_all_plugins}</a></small></span>".$lang->sprintf($lang->recommended_plugins_for_mybb, $mybb->version));
|
$table->output("<span style=\"float: right;\"><small><a href=\"https://community.mybb.com/mods.php?action=browse&category=plugins\" target=\"_blank\" rel=\"noopener\">{$lang->browse_all_plugins}</a></small></span>".$lang->sprintf($lang->recommended_plugins_for_mybb, $mybb->version));
|
}
| }
|
|
|
echo "<br />".draw_admin_pagination($mybb->input['page'], 15, $tree['results']['attributes']['total'], "index.php?module=config-plugins&action=browse{$keywords}&page={page}");
| if(!$no_results) { echo "<br />".draw_admin_pagination($mybb->input['page'], 15, $tree['results']['attributes']['total'], "index.php?module=config-plugins&action=browse{$keywords}&page={page}"); }
|
$page->output_footer(); }
| $page->output_footer(); }
|
Zeile 215 | Zeile 218 |
---|
continue; } $plugininfo = $infofunc();
|
continue; } $plugininfo = $infofunc();
|
$plugininfo['guid'] = trim($plugininfo['guid']); $plugininfo['codename'] = trim($plugininfo['codename']);
| $plugininfo['guid'] = isset($plugininfo['guid']) ? trim($plugininfo['guid']) : null; $plugininfo['codename'] = isset($plugininfo['codename']) ? trim($plugininfo['codename']) : null;
|
if($plugininfo['codename'] != "") {
| if($plugininfo['codename'] != "") {
|
Zeile 240 | Zeile 243 |
---|
$url = "https://community.mybb.com/version_check.php?"; $url .= http_build_query(array("info" => $info))."&";
|
$url = "https://community.mybb.com/version_check.php?"; $url .= http_build_query(array("info" => $info))."&";
|
require_once MYBB_ROOT."inc/class_xml.php";
| |
$contents = fetch_remote_file($url);
if(!$contents)
| $contents = fetch_remote_file($url);
if(!$contents)
|
Zeile 251 | Zeile 253 |
---|
$contents = trim($contents);
|
$contents = trim($contents);
|
$parser = new XMLParser($contents);
| $parser = create_xml_parser($contents);
|
$tree = $parser->get_tree();
if(!is_array($tree) || !isset($tree['plugins']))
| $tree = $parser->get_tree();
if(!is_array($tree) || !isset($tree['plugins']))
|
Zeile 304 | Zeile 306 |
---|
if(version_compare($names[$plugin['attributes'][$compare_by]]['version'], $plugin['version']['value'], "<")) { $plugin['download_url']['value'] = htmlspecialchars_uni($plugin['download_url']['value']);
|
if(version_compare($names[$plugin['attributes'][$compare_by]]['version'], $plugin['version']['value'], "<")) { $plugin['download_url']['value'] = htmlspecialchars_uni($plugin['download_url']['value']);
|
$plugin['vulnerable']['value'] = htmlspecialchars_uni($plugin['vulnerable']['value']);
| |
$plugin['version']['value'] = htmlspecialchars_uni($plugin['version']['value']);
|
$plugin['version']['value'] = htmlspecialchars_uni($plugin['version']['value']);
|
| if(isset($plugin['vulnerable']['value'])) { $plugin['vulnerable']['value'] = htmlspecialchars_uni($plugin['vulnerable']['value']); }
|
if($is_vulnerable) {
| if($is_vulnerable) {
|
Zeile 369 | Zeile 375 |
---|
// Activates or deactivates a specific plugin if($mybb->input['action'] == "activate" || $mybb->input['action'] == "deactivate") {
|
// Activates or deactivates a specific plugin if($mybb->input['action'] == "activate" || $mybb->input['action'] == "deactivate") {
|
if(!verify_post_check($mybb->input['my_post_key']))
| if(!verify_post_check($mybb->get_input('my_post_key')))
|
{ flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=config-plugins");
| { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=config-plugins");
|
Zeile 386 | Zeile 392 |
---|
$codename = $mybb->input['plugin']; $codename = str_replace(array(".", "/", "\\"), "", $codename);
|
$codename = $mybb->input['plugin']; $codename = str_replace(array(".", "/", "\\"), "", $codename);
|
$file = basename($codename.".php");
| $file = basename($codename.".php");
|
// Check if the file exists and throw an error if it doesn't if(!file_exists(MYBB_ROOT."inc/plugins/$file")) { flash_message($lang->error_invalid_plugin, 'error'); admin_redirect("index.php?module=config-plugins");
|
// Check if the file exists and throw an error if it doesn't if(!file_exists(MYBB_ROOT."inc/plugins/$file")) { flash_message($lang->error_invalid_plugin, 'error'); admin_redirect("index.php?module=config-plugins");
|
}
| }
|
$plugins_cache = $cache->read("plugins");
|
$plugins_cache = $cache->read("plugins");
|
$active_plugins = $plugins_cache['active'];
| $active_plugins = isset($plugins_cache['active']) ? $plugins_cache['active'] : array();
|
require_once MYBB_ROOT."inc/plugins/$file";
$installed_func = "{$codename}_is_installed"; $installed = true; if(function_exists($installed_func) && $installed_func() != true)
|
require_once MYBB_ROOT."inc/plugins/$file";
$installed_func = "{$codename}_is_installed"; $installed = true; if(function_exists($installed_func) && $installed_func() != true)
|
{
| {
|
$installed = false; }
| $installed = false; }
|
Zeile 418 | Zeile 424 |
---|
{ flash_message($lang->sprintf($lang->plugin_incompatible, $mybb->version), 'error'); admin_redirect("index.php?module=config-plugins");
|
{ flash_message($lang->sprintf($lang->plugin_incompatible, $mybb->version), 'error'); admin_redirect("index.php?module=config-plugins");
|
}
| }
|
// If not installed and there is a custom installation function if($installed == false && function_exists("{$codename}_install")) { call_user_func("{$codename}_install"); $message = $lang->success_plugin_installed;
|
// If not installed and there is a custom installation function if($installed == false && function_exists("{$codename}_install")) { call_user_func("{$codename}_install"); $message = $lang->success_plugin_installed;
|
$install_uninstall = true; }
| $install_uninstall = true; }
|
if(function_exists("{$codename}_activate")) { call_user_func("{$codename}_activate");
| if(function_exists("{$codename}_activate")) { call_user_func("{$codename}_activate");
|
Zeile 435 | Zeile 441 |
---|
$active_plugins[$codename] = $codename; $executed[] = 'activate';
|
$active_plugins[$codename] = $codename; $executed[] = 'activate';
|
}
| }
|
else if($mybb->input['action'] == "deactivate") { $message = $lang->success_plugin_deactivated;
| else if($mybb->input['action'] == "deactivate") { $message = $lang->success_plugin_deactivated;
|
Zeile 443 | Zeile 449 |
---|
if(function_exists("{$codename}_deactivate")) { call_user_func("{$codename}_deactivate");
|
if(function_exists("{$codename}_deactivate")) { call_user_func("{$codename}_deactivate");
|
}
if($mybb->input['uninstall'] == 1 && function_exists("{$codename}_uninstall"))
| }
if($mybb->get_input('uninstall') == 1 && function_exists("{$codename}_uninstall"))
|
{ call_user_func("{$codename}_uninstall"); $message = $lang->success_plugin_uninstalled; $install_uninstall = true; }
|
{ call_user_func("{$codename}_uninstall"); $message = $lang->success_plugin_uninstalled; $install_uninstall = true; }
|
|
|
unset($active_plugins[$codename]);
|
unset($active_plugins[$codename]);
|
}
| }
|
// Update plugin cache $plugins_cache['active'] = $active_plugins; $cache->update("plugins", $plugins_cache);
|
// Update plugin cache $plugins_cache['active'] = $active_plugins; $cache->update("plugins", $plugins_cache);
|
|
|
// Log admin action log_admin_action($codename, $install_uninstall);
if($mybb->input['action'] == "activate")
|
// Log admin action log_admin_action($codename, $install_uninstall);
if($mybb->input['action'] == "activate")
|
{
| {
|
$plugins->run_hooks("admin_config_plugins_activate_commit"); } else
| $plugins->run_hooks("admin_config_plugins_activate_commit"); } else
|
Zeile 501 | Zeile 507 |
---|
// Let's make things easier for our user - show them active // and inactive plugins in different lists $plugins_cache = $cache->read("plugins");
|
// Let's make things easier for our user - show them active // and inactive plugins in different lists $plugins_cache = $cache->read("plugins");
|
$active_plugins = $plugins_cache['active'];
| $active_plugins = array(); if(!empty($plugins_cache['active'])) { $active_plugins = $plugins_cache['active']; }
|
$plugins_list = get_plugins_list();
| $plugins_list = get_plugins_list();
|
Zeile 520 | Zeile 530 |
---|
if(!function_exists($infofunc)) { continue;
|
if(!function_exists($infofunc)) { continue;
|
}
| }
|
$plugininfo = $infofunc(); $plugininfo['codename'] = $codename;
|
$plugininfo = $infofunc(); $plugininfo['codename'] = $codename;
|
if($active_plugins[$codename])
| if(isset($active_plugins[$codename]))
|
{ // This is an active plugin $plugininfo['is_active'] = 1;
$a_plugins[] = $plugininfo;
|
{ // This is an active plugin $plugininfo['is_active'] = 1;
$a_plugins[] = $plugininfo;
|
continue;
| |
}
|
}
|
// Either installed and not active or completely inactive $i_plugins[] = $plugininfo; }
$table = new Table; $table->construct_header($lang->plugin); $table->construct_header($lang->controls, array("colspan" => 2, "class" => "align_center", "width" => 300));
| else { // Either installed and not active or completely inactive $plugininfo['is_active'] = 0; $i_plugins[] = $plugininfo; } }
$table = new Table; $table->construct_header($lang->plugin); $table->construct_header($lang->controls, array("colspan" => 2, "class" => "align_center", "width" => 300));
|
if(empty($a_plugins)) { $table->construct_cell($lang->no_active_plugins, array('colspan' => 3));
| if(empty($a_plugins)) { $table->construct_cell($lang->no_active_plugins, array('colspan' => 3));
|
Zeile 550 | Zeile 562 |
---|
else { build_plugin_list($a_plugins);
|
else { build_plugin_list($a_plugins);
|
}
$table->output($lang->active_plugin);
$table = new Table; $table->construct_header($lang->plugin); $table->construct_header($lang->controls, array("colspan" => 2, "class" => "align_center", "width" => 300));
| }
$table->output($lang->active_plugin);
$table = new Table; $table->construct_header($lang->plugin); $table->construct_header($lang->controls, array("colspan" => 2, "class" => "align_center", "width" => 300));
|
if(empty($i_plugins)) { $table->construct_cell($lang->no_inactive_plugins, array('colspan' => 3));
| if(empty($i_plugins)) { $table->construct_cell($lang->no_inactive_plugins, array('colspan' => 3));
|
Zeile 582 | Zeile 594 |
---|
$table->output($lang->plugins); }
|
$table->output($lang->plugins); }
|
|
|
$page->output_footer(); }
|
$page->output_footer(); }
|
|
|
/** * @return array */ function get_plugins_list() {
|
/** * @return array */ function get_plugins_list() {
|
| $plugins_list = array();
|
// Get a list of the plugin files which exist in the plugins directory $dir = @opendir(MYBB_ROOT."inc/plugins/"); if($dir)
| // Get a list of the plugin files which exist in the plugins directory $dir = @opendir(MYBB_ROOT."inc/plugins/"); if($dir)
|
Zeile 619 | Zeile 633 |
---|
foreach($plugin_list as $plugininfo) {
|
foreach($plugin_list as $plugininfo) {
|
if($plugininfo['website'])
| if(!empty($plugininfo['website']))
|
{ $plugininfo['name'] = "<a href=\"".$plugininfo['website']."\">".$plugininfo['name']."</a>"; }
|
{ $plugininfo['name'] = "<a href=\"".$plugininfo['website']."\">".$plugininfo['name']."</a>"; }
|
if($plugininfo['authorsite'])
| if(!empty($plugininfo['authorsite']))
|
{ $plugininfo['author'] = "<a href=\"".$plugininfo['authorsite']."\">".$plugininfo['author']."</a>"; }
| { $plugininfo['author'] = "<a href=\"".$plugininfo['authorsite']."\">".$plugininfo['author']."</a>"; }
|