function akismet_admin() { global $mybb, $db, $page, $lang; if ($page->active_action != "akismet") { return; } $page->add_breadcrumb_item($lang->akismet); if ($mybb->input['delete_all'] && $mybb->request_method == "post") { // User clicked no if ($mybb->input['no']) { admin_redirect("index.php?module=forum-akismet"); } if ($mybb->request_method == "post") { // Delete the template $db->delete_query("posts", "visible = '-4'"); // Log admin action log_admin_action(); flash_message($lang->success_deleted_spam, 'success'); admin_redirect("index.php?module=forum-akismet"); } else { $page->output_confirm_action("index.php?module=forum-akismet&delete_all=1", $lang->confirm_spam_deletion); } } if ($mybb->input['unmark'] && $mybb->request_method == "post") { $unmark = $mybb->input['akismet']; if (empty($unmark)) { flash_message($lang->error_unmark, 'error'); admin_redirect("index.php?module=forum-akismet"); } $posts_in = ''; $comma = ''; foreach ($unmark as $key => $val) { $posts_in .= $comma . intval($key); $comma = ','; } $query = $db->simple_select("posts", "pid, tid", "pid IN ({$posts_in}) AND replyto = '0'"); while ($post = $db->fetch_array($query)) { $threadp[] = $post['tid']; } if (!is_array($threadp)) { $threadp = array(); } $thread_list = implode(',', $threadp); $query = $db->query("\r\n\t\t\tSELECT p.tid, f.usepostcounts, p.uid, p.fid, p.dateline, p.replyto, t.lastpost, t.lastposter, t.lastposteruid, t.subject\r\n\t\t\tFROM " . TABLE_PREFIX . "posts p\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid=p.fid)\r\n\t\t\tWHERE p.pid IN ({$posts_in}) AND p.visible = '-4'\r\n\t\t"); while ($post = $db->fetch_array($query)) { // Fetch the last post for this forum $query2 = $db->query("\r\n\t\t\t\tSELECT tid, lastpost, lastposter, lastposteruid, subject\r\n\t\t\t\tFROM " . TABLE_PREFIX . "threads\r\n\t\t\t\tWHERE fid='{$post['fid']}' AND visible='1' AND closed NOT LIKE 'moved|%'\r\n\t\t\t\tORDER BY lastpost DESC\r\n\t\t\t\tLIMIT 0, 1\r\n\t\t\t"); $lastpost = $db->fetch_array($query2); if ($post['lastpost'] > $lastpost['lastpost']) { $lastpost['lastpost'] = $post['lastpost']; $lastpost['lastposter'] = $post['lastposter']; $lastpost['lastposteruid'] = $post['lastposteruid']; $lastpost['subject'] = $post['subject']; $lastpost['tid'] = $post['tid']; } $update_count = array("lastpost" => intval($lastpost['lastpost']), "lastposter" => $db->escape_string($lastpost['lastposter']), "lastposteruid" => intval($lastpost['lastposteruid']), "lastposttid" => intval($lastpost['tid']), "lastpostsubject" => $db->escape_string($lastpost['subject'])); $db->update_query("forums", $update_count, "fid='{$post['fid']}'"); $query2 = $db->query("\r\n\t\t\t\tSELECT u.uid, u.username, p.username AS postusername, p.dateline\r\n\t\t\t\tFROM " . TABLE_PREFIX . "posts p\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\r\n\t\t\t\tWHERE p.tid='{$post['tid']}' AND p.visible='1' OR p.pid = '{$post['pid']}'\r\n\t\t\t\tORDER BY p.dateline DESC\r\n\t\t\t\tLIMIT 1"); $lastpost = $db->fetch_array($query2); $query2 = $db->query("\r\n\t\t\t\tSELECT u.uid, u.username, p.username AS postusername, p.dateline\r\n\t\t\t\tFROM " . TABLE_PREFIX . "posts p\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\r\n\t\t\t\tWHERE p.tid='{$post['tid']}'\r\n\t\t\t\tORDER BY p.dateline ASC\r\n\t\t\t\tLIMIT 0,1\r\n\t\t\t"); $firstpost = $db->fetch_array($query2); if (!$firstpost['username']) { $firstpost['username'] = $firstpost['postusername']; } if (!$lastpost['username']) { $lastpost['username'] = $lastpost['postusername']; } if (!$lastpost['dateline']) { $lastpost['username'] = $firstpost['username']; $lastpost['uid'] = $firstpost['uid']; $lastpost['dateline'] = $firstpost['dateline']; } $lastpost['username'] = $db->escape_string($lastpost['username']); $firstpost['username'] = $db->escape_string($firstpost['username']); $query2 = $db->simple_select("users", "akismetstopped", "uid='{$post['uid']}'"); $akismetstopped = $db->fetch_field($query2, "akismetstopped") - 1; if ($akismetstopped < 0) { $akismetstopped = 0; } $db->update_query("users", array('akismetstopped' => $akismetstopped), "uid='{$post['uid']}'"); $update_array = array('username' => $firstpost['username'], 'uid' => intval($firstpost['uid']), 'lastpost' => intval($lastpost['dateline']), 'lastposter' => $lastpost['username'], 'lastposteruid' => intval($lastpost['uid'])); $db->update_query("threads", $update_array, "tid='{$post['tid']}'"); if ($post['usepostcounts'] != 0) { $db->write_query("UPDATE " . TABLE_PREFIX . "users SET postnum=postnum+1 WHERE uid = '{$post['uid']}'"); } $newthreads = $newreplies = 0; if ($post['replyto'] == 0) { ++$newthreads; } else { ++$newreplies; } update_thread_counters($post['tid'], array('replies' => '+' . $newreplies)); update_forum_counters($post['fid'], array('threads' => '+' . $newthreads, 'posts' => '+1')); } $approve = array("visible" => 1); if ($thread_list) { $db->update_query("threads", $approve, "tid IN ({$thread_list})"); } $db->update_query("posts", $approve, "pid IN ({$posts_in})"); // Log admin action log_admin_action(); flash_message($lang->success_unmarked, 'success'); admin_redirect("index.php?module=forum-akismet"); } if ($mybb->input['delete'] && $mybb->request_method == "post") { $deletepost = $mybb->input['akismet']; if (empty($deletepost)) { flash_message($lang->error_deletepost, 'error'); admin_redirect("index.php?module=forum-akismet"); } $posts_in = ''; $comma = ''; foreach ($deletepost as $key => $val) { $posts_in .= $comma . intval($key); $comma = ','; } $query = $db->simple_select("posts", "pid, tid", "pid IN ({$posts_in}) AND replyto = '0'"); while ($post = $db->fetch_array($query)) { $threadp[$post['pid']] = $post['tid']; } if (!is_array($threadp)) { $threadp = array(); } require_once MYBB_ROOT . "inc/functions_upload.php"; foreach ($deletepost as $pid => $val) { if (array_key_exists($pid, $threadp)) { $db->delete_query("posts", "pid IN ({$posts_in})"); $db->delete_query("attachments", "pid IN ({$posts_in})"); // Get thread info $query = $db->simple_select("threads", "poll", "tid='" . $threadp[$pid] . "'"); $poll = $db->fetch_field($query, 'poll'); // Delete threads, redirects, favorites, polls, and poll votes $db->delete_query("threads", "tid='" . $threadp[$pid] . "'"); $db->delete_query("threads", "closed='moved|" . $threadp[$pid] . "'"); $db->delete_query("threadsubscriptions", "tid='" . $threadp[$pid] . "'"); $db->delete_query("polls", "tid='" . $threadp[$pid] . "'"); $db->delete_query("pollvotes", "pid='{$poll}'"); } // Remove attachments remove_attachments($pid); // Delete the post $db->delete_query("posts", "pid='{$pid}'"); } // Log admin action log_admin_action(); flash_message($lang->success_spam_deleted, 'success'); admin_redirect("index.php?module=forum-akismet"); } if (!$mybb->input['action']) { require MYBB_ROOT . "inc/class_parser.php"; $parser = new postParser(); $page->output_header($lang->akismet); $form = new Form("index.php?module=forum-akismet", "post"); $table = new Table(); $table->construct_header($form->generate_check_box("checkall", 1, '', array('class' => 'checkall')), array('width' => '5%')); $table->construct_header("Title / Username / Post", array('class' => 'align_center')); $mybb->input['page'] = intval($mybb->input['page']); if ($mybb->input['page'] > 0) { $start = $mybb->input['page'] * 20; } else { $start = 0; } $query = $db->simple_select("posts", "COUNT(pid) as spam", "visible = '-4'"); $total_rows = $db->fetch_field($query, 'spam'); if ($start > $total_rows) { $start = $total_rows - 20; } if ($start < 0) { $start = 0; } $query = $db->simple_select("posts", "*", "visible = '-4'", array('limit_start' => $start, 'limit' => '20', 'order_by' => 'dateline', 'order_dir' => 'desc')); while ($post = $db->fetch_array($query)) { if ($post['uid'] != 0) { $username = "******"../" . str_replace("{uid}", $post['uid'], PROFILE_URL) . "\" target=\"_blank\">" . format_name($post['username'], $post['usergroup'], $post['displaygroup']) . "</a>"; } else { $username = $post['username']; } $table->construct_cell($form->generate_check_box("akismet[{$post['pid']}]", 1, '')); $table->construct_cell("<span style=\"float: right;\">{$lang->username} {$username}</span> <span style=\"float: left;\">{$lang->title}: " . htmlspecialchars_uni($post['subject']) . " <strong>(" . my_date($mybb->settings['dateformat'], $post['dateline']) . ", " . my_date($mybb->settings['timeformat'], $post['dateline']) . ")</strong></span>"); $table->construct_row(); $parser_options = array("allow_html" => 0, "allow_mycode" => 0, "allow_smilies" => 0, "allow_imgcode" => 0, "me_username" => $post['username'], "filter_badwords" => 1); $post['message'] = $parser->parse_message($post['message'], $parser_options); $table->construct_cell($post['message'], array("colspan" => 2)); $table->construct_row(); } $num_rows = $table->num_rows(); if ($num_rows == 0) { $table->construct_cell($lang->no_spam_found, array("class" => "align_center", "colspan" => 2)); $table->construct_row(); } $table->output($lang->detected_spam_messages); echo "<br />" . draw_admin_pagination($mybb->input['page'], 20, $total_rows, "index.php?module=forum-akismet&page={page}"); $buttons[] = $form->generate_submit_button($lang->unmark_selected, array('name' => 'unmark')); $buttons[] = $form->generate_submit_button($lang->deleted_selected, array('name' => 'delete')); if ($num_rows > 0) { $buttons[] = $form->generate_submit_button($lang->delete_all, array('name' => 'delete_all', 'onclick' => "return confirm('{$lang->confirm_spam_deletion}');")); } $form->output_submit_wrapper($buttons); $form->end(); $page->output_footer(); } exit; }
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_post_tool); $form->output_submit_wrapper($buttons); $form->end(); $page->output_footer(); } if (!$mybb->input['action']) { $plugins->run_hooks("admin_config_mod_tools_start"); $page->output_header($lang->mod_tools . " - " . $lang->thread_tools); $sub_tabs['thread_tools'] = array('title' => $lang->thread_tools, 'link' => "index.php?module=config-mod_tools", 'description' => $lang->thread_tools_desc); $sub_tabs['add_thread_tool'] = array('title' => $lang->add_new_thread_tool, 'link' => "index.php?module=config-mod_tools&action=add_thread_tool"); $sub_tabs['post_tools'] = array('title' => $lang->post_tools, 'link' => "index.php?module=config-mod_tools&action=post_tools"); $sub_tabs['add_post_tool'] = array('title' => $lang->add_new_post_tool, 'link' => "index.php?module=config-mod_tools&action=add_post_tool"); $page->output_nav_tabs($sub_tabs, 'thread_tools'); $table = new Table(); $table->construct_header($lang->title); $table->construct_header($lang->controls, array('class' => "align_center", 'colspan' => 2)); $query = $db->simple_select('modtools', 'tid, name, description, type', "type='t'", array('order_by' => 'name')); while ($tool = $db->fetch_array($query)) { $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=edit_thread_tool&tid={$tool['tid']}\"><strong>" . htmlspecialchars_uni($tool['name']) . "</strong></a><br /><small>" . htmlspecialchars_uni($tool['description']) . "</small>"); $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=edit_thread_tool&tid={$tool['tid']}\">{$lang->edit}</a>", array('width' => 100, 'class' => "align_center")); $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=delete_thread_tool&tid={$tool['tid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_thread_tool_deletion}')\">{$lang->delete}</a>", array('width' => 100, 'class' => "align_center")); $table->construct_row(); } if ($table->num_rows() == 0) { $table->construct_cell($lang->no_thread_tools, array('colspan' => 3)); $table->construct_row(); } $table->output($lang->thread_tools); $page->output_footer(); }
function newpoints_shop_admin_stats() { global $form, $db, $lang, $mybb; newpoints_lang_load("newpoints_shop"); echo "<br />"; // table $table = new Table(); $table->construct_header($lang->newpoints_shop_item, array('width' => '30%')); $table->construct_header($lang->newpoints_shop_username, array('width' => '30%')); $table->construct_header($lang->newpoints_shop_price, array('width' => '20%', 'class' => 'align_center')); $table->construct_header($lang->newpoints_shop_date, array('width' => '20%', 'class' => 'align_center')); $query = $db->simple_select('newpoints_log', '*', 'action=\'shop_purchase\'', array('order_by' => 'date', 'order_dir' => 'DESC', 'limit' => intval($mybb->settings['newpoints_shop_lastpurchases']))); while ($stats = $db->fetch_array($query)) { $data = explode('-', $stats['data']); $item = newpoints_shop_get_item($data[0]); $table->construct_cell(htmlspecialchars_uni($item['name'])); $link = build_profile_link(htmlspecialchars_uni($stats['username']), intval($stats['uid'])); $table->construct_cell($link); $table->construct_cell(newpoints_format_points($data[1]), array('class' => 'align_center')); $table->construct_cell(my_date($mybb->settings['dateformat'], intval($stats['date']), '', false) . ", " . my_date($mybb->settings['timeformat'], intval($stats['date'])), array('class' => 'align_center')); $table->construct_row(); } if ($table->num_rows() == 0) { $table->construct_cell($lang->newpoints_error_gathering, array('colspan' => 4)); $table->construct_row(); } $table->output($lang->newpoints_stats_lastpurchases); }
$editable_lang = 'threadfields_editable_admin'; break; case XTHREADS_EDITABLE_NONE: $editable_lang = 'threadfields_editable_none'; break; } $table->construct_cell($lang->{$editable_lang}); } $table->construct_cell($form->generate_text_box('threadfields_order_' . $tfname, $tf['disporder'], array('class' => 'text_input align_center', 'style' => 'width: 80%;', 'id' => 'threadfields_order_' . $tfname)), array('class' => 'align_center')); $table->construct_cell($form->generate_check_box('threadfields_mark_' . $tfname . '" title="' . $lang->threadfields_delete_field, '1', '', array('style' => 'vertical-align: middle;', 'id' => 'threadfields_mark_' . $tfname)), array('class' => 'align_center')); $table->construct_row(array('id' => 'threadfields_row_' . $tfname)); $js_indexes .= ',"' . $tfname . '"'; } $db->free_result($query); $showsubmit = false; if (!$table->num_rows()) { $table->construct_cell($lang->no_threadfields, array('colspan' => 6)); $table->construct_row(); } else { $showsubmit = true; } $table->output($lang->custom_threadfields); if ($js_indexes && $js_indexes != '""') { ?> <script type="text/javascript"> <!-- function xt_fields_delcheck() { var c=this.checked; var n=this.id.substr(<?php echo strlen('threadfields_mark_'); ?>
/** * Count the number of rows in the form container. Useful for displaying a 'no rows' message. * * @return int The number of rows in the form container. */ function num_rows() { return $this->_container->num_rows(); }
function automedia_admin() { global $db, $lang, $mybb, $page, $cache, $run_module, $action_file; if (!isset($lang->automedia_modules)) { $lang->load("automedia"); } if ($page->active_action != 'automedia') { return false; } if ($run_module == 'tools' && $action_file == 'automedia') { $page->add_breadcrumb_item($lang->automedia, 'index.php?module=tools-automedia'); // Show site modules if ($mybb->input['action'] == "" || !$mybb->input['action']) { $page->add_breadcrumb_item($lang->automedia_modules); $page->output_header($lang->automedia_modules . ' - ' . $lang->automedia_modules); $sub_tabs['automedia'] = array('title' => $lang->automedia_modules, 'link' => 'index.php?module=tools-automedia', 'description' => $lang->automedia_modules_description1); if ($mybb->settings['av_adultsites'] == 1) { $sub_tabs['special'] = array('title' => $lang->automedia_adult, 'link' => 'index.php?module=tools-automedia&action=adult', 'description' => $lang->automedia_adult_description1); } $page->output_nav_tabs($sub_tabs, 'automedia'); $aotable = new Table(); $aotable->construct_header('#'); $aotable->construct_header($lang->automedia_oembed_desc); if (isset($mybb->settings['av_embera']) && $mybb->settings['av_embera'] == 1) { $aotable->construct_cell('<img src="styles/default/images/icons/success.png" width="16px" height="16px" alt="OK" />'); $aotable->construct_cell($lang->automedia_modules_embera); $aotable->construct_row(); } if (isset($mybb->settings['av_embedly']) && $mybb->settings['av_embedly'] == 1 && !empty($mybb->settings['av_embedly_key']) && $mybb->settings['av_embedly_key'] != "") { $aotable->construct_cell('<img src="styles/default/images/icons/success.png" width="16px" height="16px" alt="' . $lang->automedia_modules_success . '" />'); $aotable->construct_cell($lang->automedia_modules_embedly); $aotable->construct_row(); } $aotable->output($lang->automedia_oembed); $amtable = new Table(); $amtable->construct_header('#'); $amtable->construct_header($lang->automedia_modules_description2); $amtable->construct_header('<div style="text-align: center;">' . $lang->automedia_modules_status . '</div>'); $amtable->construct_header('<div style="text-align: center;">' . $lang->automedia_modules_options . ':</div>'); $folder = MYBB_ROOT . "inc/plugins/automedia/mediasites/"; if (is_dir($folder)) { $mediafiles = scandir($folder); $mediatitles = str_replace(".php", "", $mediafiles); $query = $db->simple_select('automedia', 'name', "class='site'"); // Find missing files for active modules while ($missing = $db->fetch_array($query)) { if (!in_array($missing['name'], $mediatitles)) { $missingfile = ucfirst(htmlspecialchars_uni($missing['name'])); $amtable->construct_cell('<strong>!</strong>'); $amtable->construct_cell('<strong>' . $missingfile . '</strong> (<a href="' . $sub_tabs['automedia']['link'] . '&action=deactivate&site=' . urlencode($missing['name']) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_deactivate . '</strong></a>)'); $amtable->construct_cell($lang->automedia_modules_notfound . ' ' . $folder . '' . htmlspecialchars_uni($missing['name']) . '.php', array('colspan' => '2')); $amtable->construct_row(); } } $i = 1; foreach ($mediafiles as $sites) { // Fetch all files in the folder $siteinfo = pathinfo($folder . "/" . $sites); if ($sites != "." && $sites != "..") { $filetype = "php"; // We need only php files if ($siteinfo['extension'] == $filetype) { $site = str_replace(".php", "", $sites); $media = ucfirst(htmlspecialchars_uni($site)); $check = file_get_contents($folder . $siteinfo['basename']); if (preg_match('"function automedia_"isU', $check)) { $amtable->construct_cell($i); $amtable->construct_cell('<a href="' . $sub_tabs['automedia']['link'] . '&action=showsite&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $media . '</strong></a>'); $query2 = $db->simple_select('automedia', '*', "name='" . htmlspecialchars_uni($site) . "'"); $active = $db->fetch_array($query2); if ($active && $active['class'] == "site") { $amtable->construct_cell('<div style="text-align: center;"><img src="' . $mybb->asset_url . '/images/mod-on.png" width="32" height="32" alt="' . $lang->automedia_modules_success . '" />'); $amtable->construct_cell('<div style="text-align: center;"><a href="' . $sub_tabs['automedia']['link'] . '&action=deactivate&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_deactivate . '</strong></a></div>'); } else { $amtable->construct_cell('<div style="text-align: center;"><img src="' . $mybb->asset_url . '/images/mod-off.png" width="32" height="32" alt="' . $lang->automedia_modules_fail . '" />'); $amtable->construct_cell('<div style="text-align: center;"><a href="' . $sub_tabs['automedia']['link'] . '&action=activate&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_activate . '</strong></a></div>'); } $amtable->construct_row(); $i++; } } } } if ($amtable->num_rows() == 0) { $amtable->construct_cell($lang->automedia_modules, array('colspan' => '4')); $amtable->construct_row(); } } else { $amtable->construct_cell($lang->automedia_modules_missing_sitesfolder, array('colspan' => '4')); $amtable->construct_row(); } $amtable->output($lang->automedia_modules); echo '<div style="text-align: center;"> <a href="' . $sub_tabs['automedia']['link'] . '&action=activateallsites&my_post_key=' . $mybb->post_code . '"><span style="border: 3px double #0F5C8E; padding: 3px; background: #fff url(images/submit_bg.png) repeat-x top; color: #0F5C8E; margin-right: 3px;">' . $lang->automedia_modules_activateall . '</span></a> </div>'; $page->output_footer(); } // Show special modules if ($mybb->input['action'] == "adult" && $mybb->settings['av_adultsites'] == 1) { $page->add_breadcrumb_item($lang->automedia_adult); $page->output_header($lang->automedia_modules . ' - ' . $lang->automedia_adult); $sub_tabs['automedia'] = array('title' => $lang->automedia_modules, 'link' => 'index.php?module=tools-automedia', 'description' => $lang->automedia_modules); if ($mybb->settings['av_adultsites'] == 1) { $sub_tabs['special'] = array('title' => $lang->automedia_adult, 'link' => 'index.php?module=tools-automedia&action=adult', 'description' => $lang->automedia_adult_description1); } $page->output_nav_tabs($sub_tabs, 'special'); $amtable = new Table(); $amtable->construct_header('#'); $amtable->construct_header($lang->automedia_modules_description2); $amtable->construct_header('<div style="text-align: center;">' . $lang->automedia_modules_status . '</div>'); $amtable->construct_header('<div style="text-align: center;">' . $lang->automedia_modules_options . ':</div>'); $folder = MYBB_ROOT . "inc/plugins/automedia/special/"; if (is_dir($folder)) { $mediafiles = scandir($folder); $mediatitles = str_replace(".php", "", $mediafiles); $query = $db->simple_select('automedia', 'name', "class='special'"); // Find missing files for active modules while ($missing = $db->fetch_array($query)) { if (!in_array($missing['name'], $mediatitles)) { $missingfile = ucfirst(htmlspecialchars_uni($missing['name'])); $amtable->construct_cell('<strong>!</strong>'); $amtable->construct_cell('<strong>' . $missingfile . '</strong> (<a href="' . $sub_tabs['automedia']['link'] . '&action=adultdeactivate&site=' . urlencode($missing['name']) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_deactivate . '</strong></a>)'); $amtable->construct_cell($lang->automedia_modules_notfound . ' ' . $folder . '' . htmlspecialchars_uni($missing['name']) . '.php', array('colspan' => '2')); $amtable->construct_row(); } } $i = 1; foreach ($mediafiles as $sites) { // Fetch all files in the folder $siteinfo = pathinfo($folder . "/" . $sites); if ($sites != "." && $sites != "..") { $filetype = "php"; // We need only php files if ($siteinfo['extension'] == $filetype) { $site = str_replace(".php", "", $sites); $media = ucfirst(htmlspecialchars_uni($site)); $check = file_get_contents($folder . $siteinfo['basename']); if (preg_match('"function automedia_"isU', $check)) { $amtable->construct_cell($i); $amtable->construct_cell('<a href="' . $sub_tabs['automedia']['link'] . '&action=showspecial&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $media . '</strong></a>'); $query = $db->simple_select('automedia', '*', "name='" . htmlspecialchars_uni($site) . "'"); $active = $db->fetch_array($query); if ($active && $active['class'] == "special") { $amtable->construct_cell('<div style="text-align: center;"><img src="' . $mybb->asset_url . '/images/mod-on.png" width="32" height="32" alt="' . $lang->automedia_modules_success . '" />'); $amtable->construct_cell('<div style="text-align: center;"><a href="' . $sub_tabs['automedia']['link'] . '&action=adultdeactivate&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_deactivate . '</strong></a></div>'); } else { $amtable->construct_cell('<div style="text-align: center;"><img src="' . $mybb->asset_url . '/images/mod-off.png" width="32" height="32" alt="' . $lang->automedia_modules_fail . '" />'); $amtable->construct_cell('<div style="text-align: center;"><a href="' . $sub_tabs['automedia']['link'] . '&action=adultactivate&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_activate . '</strong></a></div>'); } $amtable->construct_row(); $i++; } } } } if ($amtable->num_rows() == 0) { $amtable->construct_cell($lang->automedia_adult, array('colspan' => '4')); $amtable->construct_row(); } } else { $amtable->construct_cell($lang->automedia_modules_missing_specialfolder, array('colspan' => '4')); $amtable->construct_row(); } $amtable->output($lang->automedia_modules); echo '<div style="text-align: center;"> <a href="' . $sub_tabs['automedia']['link'] . '&action=activateallspecial&my_post_key=' . $mybb->post_code . '"><span style="border: 3px double #0F5C8E; padding: 3px; background: #fff url(images/submit_bg.png) repeat-x top; color: #0F5C8E; margin-right: 3px;">' . $lang->automedia_modules_activateall . '</span></a> </div>'; $page->output_footer(); } // Activate site module if ($mybb->input['action'] == 'activate') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia"); } else { $site = htmlspecialchars_uni($mybb->input['site']); $query_act1 = $db->simple_select('automedia', '*', "name='" . $site . "'"); $active1 = $db->fetch_array($query_act1); if (!$active1) { $automedia_site = array("name" => $site, "class" => "site"); $db->insert_query("automedia", $automedia_site); automedia_cache(); $mybb->input['module'] = $lang->av_plugin_title; $mybb->input['action'] = $lang->automedia_modules_active . " "; log_admin_action(ucfirst($site)); flash_message($lang->automedia_modules_active, 'success'); admin_redirect("index.php?module=tools-automedia"); } else { flash_message($lang->automedia_modules_notfound, 'error'); } } exit; } // Activate special module if ($mybb->input['action'] == 'adultactivate') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia&action=adult"); } else { $site = htmlspecialchars_uni($mybb->input['site']); $query_act2 = $db->simple_select('automedia', '*', "name='" . $site . "'"); $active2 = $db->fetch_array($query_act2); if (!$active2) { $automedia_special = array("name" => $site, "class" => "special"); $db->insert_query("automedia", $automedia_special); automedia_cache(); $mybb->input['module'] = $lang->av_plugin_title; $mybb->input['action'] = $lang->automedia_modules_active . " "; log_admin_action(ucfirst($site)); flash_message($lang->automedia_modules_active, 'success'); admin_redirect("index.php?module=tools-automedia&action=adult"); } else { flash_message($lang->automedia_modules_notfound, 'error'); } } exit; } // Deactivate site module if ($mybb->input['action'] == 'deactivate') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia"); } else { $site = htmlspecialchars_uni($mybb->input['site']); $query_del1 = $db->simple_select('automedia', '*', "name='" . $site . "'"); $delete1 = $db->fetch_array($query_del1); if ($delete1['name'] == $site) { $db->delete_query('automedia', "name='{$site}'"); automedia_cache(); $mybb->input['module'] = $lang->av_plugin_title; $mybb->input['action'] = $lang->automedia_modules_deleted . " "; log_admin_action(ucfirst($site)); flash_message($lang->automedia_modules_deleted, 'success'); admin_redirect("index.php?module=tools-automedia"); } else { flash_message($lang->automedia_modules_notfound, 'error'); } } exit; } // Deactivate special module if ($mybb->input['action'] == 'adultdeactivate') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia&action=adult"); } else { $site = htmlspecialchars_uni($mybb->input['site']); $query_del2 = $db->simple_select('automedia', '*', "name='" . $site . "'"); $delete2 = $db->fetch_array($query_del2); if ($delete2['name'] == $site) { $db->delete_query('automedia', "name='{$site}'"); automedia_cache(); $mybb->input['module'] = $lang->av_plugin_title; $mybb->input['action'] = $lang->automedia_modules_deleted . " "; log_admin_action(ucfirst($site)); flash_message($lang->automedia_modules_deleted, 'success'); admin_redirect("index.php?module=tools-automedia&action=adult"); } else { flash_message($lang->automedia_modules_notfound, 'error'); } } exit; } // Activate all site modules if ($mybb->input['action'] == 'activateallsites') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia"); } else { $folder1 = MYBB_ROOT . "inc/plugins/automedia/mediasites/"; if (is_dir($folder1)) { $mediafiles1 = scandir($folder1); foreach ($mediafiles1 as $sites1) { // Fetch all files in the folder $siteinfo1 = pathinfo($folder1 . "/" . $sites1); if ($sites1 != "." && $sites1 != "..") { $filetype1 = "php"; // We need only php files if ($siteinfo1['extension'] == $filetype1) { $media1 = str_replace(".php", "", $sites1); $check1 = file_get_contents($folder1 . $siteinfo1['basename']); if (preg_match('"function automedia_"isU', $check1)) { $query_ex = $db->simple_select('automedia', 'name', "name='" . htmlspecialchars_uni($media1) . "'"); $modactive = $db->fetch_array($query_ex); if (!$modactive) { // activate site $automedia_site1 = array("name" => htmlspecialchars_uni($media1), "class" => "site"); $db->insert_query("automedia", $automedia_site1); } } } } } automedia_cache(); } } admin_redirect("index.php?module=tools-automedia"); exit; } // Activate all special modules if ($mybb->input['action'] == 'activateallspecial') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia"); } else { $folder2 = MYBB_ROOT . "inc/plugins/automedia/special/"; if (is_dir($folder2)) { $mediafiles2 = scandir($folder2); foreach ($mediafiles2 as $sites2) { // Fetch all files in the folder $siteinfo2 = pathinfo($folder2 . "/" . $sites2); if ($sites2 != "." && $sites2 != "..") { $filetype2 = "php"; // We need only php files if ($siteinfo2['extension'] == $filetype2) { $media2 = str_replace(".php", "", $sites2); $check2 = file_get_contents($folder2 . $siteinfo2['basename']); if (preg_match('"function automedia_"isU', $check2)) { $query_ex2 = $db->simple_select('automedia', 'name', "name='" . htmlspecialchars_uni($media2) . "'"); $modactive2 = $db->fetch_array($query_ex2); if (!$modactive2) { // add site $automedia_site2 = array("name" => htmlspecialchars_uni($media2), "class" => "special"); $db->insert_query("automedia", $automedia_site2); } } } } } automedia_cache(); } } admin_redirect("index.php?module=tools-automedia&action=adult"); exit; } // Show site module code if ($mybb->input['action'] == 'showsite') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia"); } else { $site = htmlspecialchars_uni($mybb->input['site']); $page->add_breadcrumb_item($lang->automedia_modules_embedcode); $page->output_header($lang->automedia_modules_showcode); $sub_tabs['automedia'] = array('title' => $lang->automedia_modules, 'link' => 'index.php?module=tools-automedia', 'description' => $lang->automedia_modules); if ($mybb->settings['av_adultsites'] == 1) { $sub_tabs['special'] = array('title' => $lang->automedia_adult, 'link' => 'index.php?module=tools-automedia&action=adult', 'description' => $lang->automedia_adult_description1); } $sub_tabs['embedcode'] = array('title' => $lang->automedia_modules_embedcode, 'link' => 'index.php?module=tools-automedia&action=showsite&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '', 'description' => $lang->automedia_modules_viewcode); $page->output_nav_tabs($sub_tabs, 'embedcode'); $amtable = new Table(); $amtable->construct_header(ucfirst($site) . ' ' . $lang->automedia_modules_embedcode . ':'); $codefile = MYBB_ROOT . "inc/plugins/automedia/mediasites/" . $site . ".php"; if (is_file($codefile)) { $embedcode = file_get_contents($codefile); $showcode = @highlight_string($embedcode, true); $amtable->construct_cell($showcode); } $amtable->construct_row(); $amtable->output($lang->automedia_modules_showcode); $page->output_footer(); } exit; } // Show special module code if ($mybb->input['action'] == 'showspecial') { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=tools-automedia"); } else { $site = htmlspecialchars_uni($mybb->input['site']); $page->add_breadcrumb_item($lang->automedia_modules_embedcode); $page->output_header($lang->automedia_modules_showcode); $sub_tabs['automedia'] = array('title' => $lang->automedia_modules, 'link' => 'index.php?module=tools-automedia', 'description' => $lang->automedia_modules); if ($mybb->settings['av_adultsites'] == 1) { $sub_tabs['special'] = array('title' => $lang->automedia_adult, 'link' => 'index.php?module=tools-automedia&action=adult', 'description' => $lang->automedia_adult_description1); } $sub_tabs['embedcode'] = array('title' => $lang->automedia_modules_embedcode, 'link' => 'index.php?module=tools-automedia&action=showspecial&site=' . urlencode($site) . '&my_post_key=' . $mybb->post_code . '', 'description' => $lang->automedia_modules_viewcode); $page->output_nav_tabs($sub_tabs, 'embedcode'); $amtable = new Table(); $amtable->construct_header(ucfirst($site) . ' ' . $lang->automedia_modules_embedcode . ':'); $codefile = MYBB_ROOT . "inc/plugins/automedia/special/" . $site . ".php"; if (is_file($codefile)) { $embedcode = file_get_contents($codefile); $showcode = @highlight_string($embedcode, true); $amtable->construct_cell($showcode); } $amtable->construct_row(); $amtable->output($lang->automedia_modules_showcode); $page->output_footer(); } exit; } // Reapply template edits if ($mybb->input['action'] == "templateedits") { if (!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=config-plugins"); } else { automedia_reapply_template_edits(); admin_redirect("index.php?module=config-plugins"); } exit; } } }
$table->construct_cell("<div class=\"float_right\"><img src=\"styles/{$page->style}/images/icons/{$perm_type}.png\" title=\"{$lang->perms_type_user}\" alt=\"{$perm_type}\" /></div><div><strong><a href=\"index.php?module=user-admin_permissions&action=edit&uid={$admin['uid']}\" title=\"{$lang->edit_user}\">{$admin['username']}</a></strong><br /><small>{$usergroup_list}</small></div>"); $table->construct_cell(my_date('relative', $admin['lastactive']), array("class" => "align_center")); $popup = new PopupMenu("adminperm_{$admin['uid']}", $lang->options); if (!is_super_admin($admin['uid'])) { if ($admin['permissions'] != "") { $popup->add_item($lang->edit_permissions, "index.php?module=user-admin_permissions&action=edit&uid={$admin['uid']}"); $popup->add_item($lang->revoke_permissions, "index.php?module=user-admin_permissions&action=delete&uid={$admin['uid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_perms_deletion2}')"); } else { $popup->add_item($lang->set_permissions, "index.php?module=user-admin_permissions&action=edit&uid={$admin['uid']}"); } } $popup->add_item($lang->view_log, "index.php?module=tools-adminlog&uid={$admin['uid']}"); $table->construct_cell($popup->fetch(), array("class" => "align_center")); $table->construct_row(); } } if (empty($usergroups) || $table->num_rows() == 0) { $table->construct_cell($lang->no_user_perms, array("colspan" => "3")); $table->construct_row(); } $table->output($lang->user_permissions); echo <<<LEGEND <br /> <fieldset> <legend>{$lang->legend}</legend> <img src="styles/{$page->style}/images/icons/user.png" alt="{$lang->using_individual_perms}" style="vertical-align: middle;" /> {$lang->using_individual_perms}<br /> <img src="styles/{$page->style}/images/icons/group.png" alt="{$lang->using_group_perms}" style="vertical-align: middle;" /> {$lang->using_group_perms}<br /> <img src="styles/{$page->style}/images/icons/default.png" alt="{$lang->using_default_perms}" style="vertical-align: middle;" /> {$lang->using_default_perms}</fieldset> LEGEND; $page->output_footer(); }