Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: plugins.php 5404 2011-03-19 01:17:10Z jammerx2 $
| * $Id$
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 90 | Zeile 90 |
---|
$parser = new XMLParser($contents); $tree = $parser->get_tree();
|
$parser = new XMLParser($contents); $tree = $parser->get_tree();
|
if(!array_key_exists("results", $tree))
| if(!is_array($tree) || !isset($tree['results']))
|
{ $page->output_inline_error($lang->error_communication_problem); $page->output_footer();
| { $page->output_inline_error($lang->error_communication_problem); $page->output_footer();
|
Zeile 105 | Zeile 105 |
---|
unset($tree['results']['result']); $tree['results']['result'][0] = $only_plugin; }
|
unset($tree['results']['result']); $tree['results']['result'][0] = $only_plugin; }
|
| require_once MYBB_ROOT . '/inc/class_parser.php'; $post_parser = new postParser();
|
foreach($tree['results']['result'] as $result) {
|
foreach($tree['results']['result'] as $result) {
|
| $result['name']['value'] = htmlspecialchars_uni($result['name']['value']); $result['description']['value'] = htmlspecialchars_uni($result['description']['value']); $result['author']['value'] = $post_parser->parse_message($result['author']['value'], array( 'allow_html' => true ) ); $result['version']['value'] = htmlspecialchars_uni($result['version']['value']); $result['download_url']['value'] = htmlspecialchars_uni(html_entity_decode($result['download_url']['value']));
|
$table->construct_cell("<strong>{$result['name']['value']}</strong><br /><small>{$result['description']['value']}</small><br /><i><small>{$lang->created_by} {$result['author']['value']}</small></i>"); $table->construct_cell($result['version']['value'], array("class" => "align_center")); $table->construct_cell("<strong><a href=\"http://mods.mybb.com/view/{$result['download_url']['value']}\" target=\"_blank\">{$lang->download}</a></strong>", array("class" => "align_center")); $table->construct_row();
|
$table->construct_cell("<strong>{$result['name']['value']}</strong><br /><small>{$result['description']['value']}</small><br /><i><small>{$lang->created_by} {$result['author']['value']}</small></i>"); $table->construct_cell($result['version']['value'], array("class" => "align_center")); $table->construct_cell("<strong><a href=\"http://mods.mybb.com/view/{$result['download_url']['value']}\" target=\"_blank\">{$lang->download}</a></strong>", array("class" => "align_center")); $table->construct_row();
|
}
| }
|
}
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();
|
}
| }
|
$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;\">";
|
Zeile 148 | Zeile 160 |
---|
var search = document.getElementById('search_keywords'); search.onfocus = function()
|
var search = document.getElementById('search_keywords'); search.onfocus = function()
|
{
| {
|
if(this.value == '{$lang->search_for_plugins}') { $(this).removeClassName('search_default');
| if(this.value == '{$lang->search_for_plugins}') { $(this).removeClassName('search_default');
|
Zeile 161 | Zeile 173 |
---|
{ $(this).addClassName('search_default'); this.value = '{$lang->search_for_plugins}';
|
{ $(this).addClassName('search_default'); this.value = '{$lang->search_for_plugins}';
|
} }
| } }
|
// fix the styling used if we have a different default value if(search.value != '{$lang->search_for_plugins}') {
| // fix the styling used if we have a different default value if(search.value != '{$lang->search_for_plugins}') {
|
Zeile 243 | Zeile 255 |
---|
$parser = new XMLParser($contents); $tree = $parser->get_tree();
|
$parser = new XMLParser($contents); $tree = $parser->get_tree();
|
| if(!is_array($tree) || !isset($tree['plugins'])) { $page->output_inline_error($lang->error_communication_problem); $page->output_footer(); exit; }
|
if(array_key_exists('error', $tree['plugins'])) { switch($tree['plugins'][0]['error'])
| if(array_key_exists('error', $tree['plugins'])) { switch($tree['plugins'][0]['error'])
|
Zeile 285 | Zeile 304 |
---|
{ if(version_compare($names[$plugin['attributes']['guid']]['version'], $plugin['version']['value'], "<")) {
|
{ if(version_compare($names[$plugin['attributes']['guid']]['version'], $plugin['version']['value'], "<")) {
|
| $plugin['download_url']['value'] = htmlspecialchars_uni($plugin['download_url']['value']); $plugin['version']['value'] = htmlspecialchars_uni($plugin['version']['value']);
|
$table->construct_cell("<strong>{$names[$plugin['attributes']['guid']]['name']}</strong>"); $table->construct_cell("{$names[$plugin['attributes']['guid']]['version']}", array("class" => "align_center")); $table->construct_cell("<strong><span style=\"color: #C00\">{$plugin['version']['value']}</span></strong>", array("class" => "align_center")); $table->construct_cell("<strong><a href=\"http://mods.mybb.com/view/{$plugin['download_url']['value']}\" target=\"_blank\">{$lang->download}</a></strong>", array("class" => "align_center")); $table->construct_row(); }
|
$table->construct_cell("<strong>{$names[$plugin['attributes']['guid']]['name']}</strong>"); $table->construct_cell("{$names[$plugin['attributes']['guid']]['version']}", array("class" => "align_center")); $table->construct_cell("<strong><span style=\"color: #C00\">{$plugin['version']['value']}</span></strong>", array("class" => "align_center")); $table->construct_cell("<strong><a href=\"http://mods.mybb.com/view/{$plugin['download_url']['value']}\" target=\"_blank\">{$lang->download}</a></strong>", array("class" => "align_center")); $table->construct_row(); }
|
}
| }
|
if($table->num_rows() == 0) {
| if($table->num_rows() == 0) {
|
Zeile 321 | Zeile 343 |
---|
); $page->output_nav_tabs($sub_tabs, 'update_plugins');
|
); $page->output_nav_tabs($sub_tabs, 'update_plugins');
|
|
|
$table->output($lang->plugin_updates); $page->output_footer();
| $table->output($lang->plugin_updates); $page->output_footer();
|
Zeile 333 | Zeile 355 |
---|
if(!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error');
|
if(!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error');
|
admin_redirect("index.php?module=config-plugins"); }
| admin_redirect("index.php?module=config-plugins"); }
|
if($mybb->input['action'] == "activate")
|
if($mybb->input['action'] == "activate")
|
{
| {
|
$plugins->run_hooks("admin_config_plugins_activate");
|
$plugins->run_hooks("admin_config_plugins_activate");
|
} else {
| } else {
|
$plugins->run_hooks("admin_config_plugins_deactivate"); } $codename = $mybb->input['plugin']; $codename = str_replace(array(".", "/", "\\"), "", $codename); $file = basename($codename.".php");
|
$plugins->run_hooks("admin_config_plugins_deactivate"); } $codename = $mybb->input['plugin']; $codename = str_replace(array(".", "/", "\\"), "", $codename); $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"); $active_plugins = $plugins_cache['active'];
| $plugins_cache = $cache->read("plugins"); $active_plugins = $plugins_cache['active'];
|
Zeile 369 | Zeile 391 |
---|
} $install_uninstall = false;
|
} $install_uninstall = false;
|
|
|
if($mybb->input['action'] == "activate") { $message = $lang->success_plugin_activated;
// Plugin is compatible with this version? if($plugins->is_compatible($codename) == false)
|
if($mybb->input['action'] == "activate") { $message = $lang->success_plugin_activated;
// Plugin is compatible with this version? if($plugins->is_compatible($codename) == false)
|
{
| {
|
flash_message($lang->sprintf($lang->plugin_incompatible, $mybb->version_code), 'error'); admin_redirect("index.php?module=config-plugins"); }
| flash_message($lang->sprintf($lang->plugin_incompatible, $mybb->version_code), 'error'); admin_redirect("index.php?module=config-plugins"); }
|
Zeile 390 | Zeile 412 |
---|
}
if(function_exists("{$codename}_activate"))
|
}
if(function_exists("{$codename}_activate"))
|
{
| {
|
call_user_func("{$codename}_activate"); }
| call_user_func("{$codename}_activate"); }
|
Zeile 555 | Zeile 577 |
---|
// Plugin is installed but not active else if($installed == true) {
|
// Plugin is installed but not active else if($installed == true) {
|
$table->construct_cell("<a href=\"index.php?module=config-plugins&action=activate&plugin={$codename}&my_post_key={$mybb->post_code}\">{$lang->activate}</a>", array("class" => "align_center", "width" => 150)); if($uninstall_button) { $table->construct_cell("<a href=\"index.php?module=config-plugins&action=deactivate&uninstall=1&plugin={$codename}&my_post_key={$mybb->post_code}\">{$lang->uninstall}</a>", array("class" => "align_center", "width" => 150));
| if($compatibility_warning && !$uninstall_button) { $table->construct_cell("{$compatibility_warning}", array("class" => "align_center", "colspan" => 2));
|
} else {
|
} else {
|
$table->construct_cell(" ", array("class" => "align_center", "width" => 150));
| $table->construct_cell("<a href=\"index.php?module=config-plugins&action=activate&plugin={$codename}&my_post_key={$mybb->post_code}\">{$lang->activate}</a>", array("class" => "align_center", "width" => 150)); if($uninstall_button) { $table->construct_cell("<a href=\"index.php?module=config-plugins&action=deactivate&uninstall=1&plugin={$codename}&my_post_key={$mybb->post_code}\">{$lang->uninstall}</a>", array("class" => "align_center", "width" => 150)); } else { $table->construct_cell(" ", array("class" => "align_center", "width" => 150)); }
|
} } $table->construct_row();
| } } $table->construct_row();
|