1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +02:00

e_status and e_latest upgraded to new class format.

This commit is contained in:
Cameron
2012-12-08 01:31:00 -08:00
parent 159fb63bfb
commit e95e27b5c5
6 changed files with 99 additions and 16 deletions

View File

@@ -314,6 +314,7 @@ class admin_shortcodes
$sql = e107::getDb(); $sql = e107::getDb();
$ns = e107::getRender(); $ns = e107::getRender();
$pref = e107::getPref(); $pref = e107::getPref();
$mes = e107::getMessage();
$active_uploads = $sql -> db_Count('upload', '(*)', 'WHERE upload_active = 0'); $active_uploads = $sql -> db_Count('upload', '(*)', 'WHERE upload_active = 0');
$submitted_news = $sql -> db_Count('submitnews', '(*)', 'WHERE submitnews_auth = 0'); $submitted_news = $sql -> db_Count('submitnews', '(*)', 'WHERE submitnews_auth = 0');
@@ -324,6 +325,8 @@ class admin_shortcodes
$text .= "<div style='padding-bottom: 2px;'>".E_16_UPLOADS.($active_uploads ? " <a href='".e_ADMIN."upload.php'>".ADLAN_LAT_7.": $active_uploads</a>" : ' '.ADLAN_LAT_7.': '.$active_uploads).'</div>'; $text .= "<div style='padding-bottom: 2px;'>".E_16_UPLOADS.($active_uploads ? " <a href='".e_ADMIN."upload.php'>".ADLAN_LAT_7.": $active_uploads</a>" : ' '.ADLAN_LAT_7.': '.$active_uploads).'</div>';
// for BC only.
if(vartrue($pref['e_latest_list'])) if(vartrue($pref['e_latest_list']))
{ {
foreach($pref['e_latest_list'] as $val) foreach($pref['e_latest_list'] as $val)
@@ -331,10 +334,27 @@ class admin_shortcodes
if (is_readable(e_PLUGIN.$val.'/e_latest.php')) if (is_readable(e_PLUGIN.$val.'/e_latest.php'))
{ {
include_once(e_PLUGIN.$val.'/e_latest.php'); include_once(e_PLUGIN.$val.'/e_latest.php');
if(!class_exists($val."_latest"))
{
$mes->addDebug("<strong>".$val ."</strong> using deprecated e_latest method");
}
} }
} }
} }
$configs = e107::getAddonConfig('e_latest');
foreach($configs as $k=>$v)
{
foreach($v as $val)
{
$link = "<a href='".$val['url']."'>".$val['title'].": ".$val['total']."</a>";
$text .= "<div style='padding-bottom: 2px;'>".$val['icon']." ".$link."</div>\n";
}
}
$messageTypes = array('Broken Download', 'Dev Team Message'); $messageTypes = array('Broken Download', 'Dev Team Message');
$queryString = ''; $queryString = '';
foreach($messageTypes as $types) foreach($messageTypes as $types)
@@ -924,7 +944,12 @@ class admin_shortcodes
{ {
function admin_status($parm='') function admin_status($parm='')
{ {
global $sql, $ns, $pref; $mes = e107::getMessage();
$sql = e107::getDb();
$ns = e107::getRender();
$pref = e107::getPref();
$members = $sql -> db_Count('user'); $members = $sql -> db_Count('user');
$unverified = $sql -> db_Count('user', '(*)', 'WHERE user_ban=2'); $unverified = $sql -> db_Count('user', '(*)', 'WHERE user_ban=2');
$banned = $sql -> db_Count('user', '(*)', 'WHERE user_ban=1'); $banned = $sql -> db_Count('user', '(*)', 'WHERE user_ban=1');
@@ -940,7 +965,9 @@ class admin_shortcodes
<div style='padding-bottom: 2px;'>".E_16_USER." {$unver}</div> <div style='padding-bottom: 2px;'>".E_16_USER." {$unver}</div>
<div style='padding-bottom: 2px;'>".E_16_BANLIST." ".$lban."</div> <div style='padding-bottom: 2px;'>".E_16_BANLIST." ".$lban."</div>
<div style='padding-bottom: 2px;'>".E_16_COMMENT." ".$lcomment."</div>\n\n"; <div style='padding-bottom: 2px;'>".E_16_COMMENT." ".$lcomment."</div>\n\n";
// for BC only.
if(vartrue($pref['e_status_list'])) if(vartrue($pref['e_status_list']))
{ {
foreach($pref['e_status_list'] as $val) foreach($pref['e_status_list'] as $val)
@@ -949,10 +976,26 @@ class admin_shortcodes
if (is_readable(e_PLUGIN.$val.'/e_status.php')) if (is_readable(e_PLUGIN.$val.'/e_status.php'))
{ {
include_once(e_PLUGIN.$val.'/e_status.php'); include_once(e_PLUGIN.$val.'/e_status.php');
if(!class_exists($val."_status"))
{
$mes->addDebug("<strong>".$val ."</strong> using deprecated e_status method");
}
} }
} }
} }
// New in v2.x
$configs = e107::getAddonConfig('e_status');
foreach($configs as $k=>$v)
{
foreach($v as $val)
{
$link = "<a href='".$val['url']."'>".$val['title'].": ".$val['total']."</a>";
$text .= "<div style='padding-bottom: 2px;'>".$val['icon']." ".$link."</div>\n";
}
}
if($flo = $sql->db_Count('generic', '(*)', "WHERE gen_type='failed_login'")) if($flo = $sql->db_Count('generic', '(*)', "WHERE gen_type='failed_login'"))
{ {
$text .= "\n\t\t\t\t\t<div style='padding-bottom: 2px;'>".E_16_FAILEDLOGIN." <a href='".e_ADMIN_ABS."fla.php'>".ADLAN_146.": $flo</a></div>"; $text .= "\n\t\t\t\t\t<div style='padding-bottom: 2px;'>".E_16_FAILEDLOGIN." <a href='".e_ADMIN_ABS."fla.php'>".ADLAN_146.": $flo</a></div>";

View File

@@ -1632,6 +1632,7 @@ class e107
public function getAddonConfig($addonName, $className = '') public function getAddonConfig($addonName, $className = '')
{ {
$new_addon = array(); $new_addon = array();
$sql = e107::getDb(); // Might be used by older plugins.
$filename = $addonName; // e.g. 'e_cron'; $filename = $addonName; // e.g. 'e_cron';
if(!$className) if(!$className)

View File

@@ -1977,7 +1977,9 @@ class e107plugin
$method_name = $what."_".$when; $method_name = $what."_".$when;
// {PLUGIN}_setup.php should ALWAYS be the name. // {PLUGIN}_setup.php should ALWAYS be the name of the file..
// if (varset($this->plug_vars['@attributes']['setupFile'])) // if (varset($this->plug_vars['@attributes']['setupFile']))
// { // {
// $setup_file = e_PLUGIN.$this->plugFolder.'/'.$this->plug_vars['@attributes']['setupFile']; // $setup_file = e_PLUGIN.$this->plugFolder.'/'.$this->plug_vars['@attributes']['setupFile'];
@@ -2011,13 +2013,13 @@ class e107plugin
} }
else else
{ {
$mes->add("Setup Class ".$class_name." NOT found.", E_MESSAGE_DEBUG); // $mes->add("Setup Class ".$class_name." NOT found.", E_MESSAGE_DEBUG);
return FALSE; return FALSE;
} }
} }
else else
{ {
$mes->add("Optional Setup File NOT Found ".$path."_setup.php ", E_MESSAGE_DEBUG); //$mes->add("Optional Setup File NOT Found ".$path."_setup.php ", E_MESSAGE_DEBUG);
} }
return FALSE; // IMPORTANT. return FALSE; // IMPORTANT.

View File

@@ -25,6 +25,22 @@
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
$chatbox_posts = $sql -> db_Count('chatbox'); class chatbox_menu_status // include plugin-folder in the name.
$text .= "<div style='padding-bottom: 2px;'><img src='".e_PLUGIN_ABS."chatbox_menu/images/chatbox_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ".ADLAN_115.": ".$chatbox_posts."</div>"; {
function config()
{
$sql = e107::getDb();
$chatbox_posts = $sql -> db_Count('chatbox');
$var[0]['icon'] = "<img src='".e_PLUGIN_ABS."chatbox_menu/images/chatbox_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ";
$var[0]['title'] = ADLAN_115;
$var[0]['url'] = e_PLUGIN."chatbox_menu/admin_chatbox.php";
$var[0]['total'] = $chatbox_posts;
return $var;
}
}
?> ?>

View File

@@ -1,15 +1,22 @@
<?php <?php
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
$reported_posts = $sql->db_Count('generic', '(*)', "WHERE gen_type='reported_post' OR gen_type='Reported Forum Post'");
$text .= "<div style='padding-bottom: 2px;'>
<img src='".e_PLUGIN."forum/images/forums_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ";
if ($reported_posts) { class forum_latest // include plugin-folder in the name.
$text .= "<a href='".e_PLUGIN."forum/forum_admin.php?sr'>".ADLAN_LAT_6.": ".$reported_posts."</a>"; {
} else { function config()
$text .= ADLAN_LAT_6.": ".$reported_posts; {
$sql = e107::getDb();
$reported_posts = $sql->db_Count('generic', '(*)', "WHERE gen_type='reported_post' OR gen_type='Reported Forum Post'");
$var[0]['icon'] = E_16_FORUM;
$var[0]['title'] = ADLAN_LAT_6;
$var[0]['url'] = e_PLUGIN."forum/forum_admin.php";
$var[0]['total'] = $reported_posts;
return $var;
}
} }
$text .= '</div>';
?> ?>

View File

@@ -1,6 +1,20 @@
<?php <?php
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
$forum_posts = $sql->db_Count('forum_post');
$text .= "<div style='padding-bottom: 2px;'>".E_16_FORUM." ".ADLAN_113.": ".$forum_posts."</div>"; class forum_status // include plugin-folder in the name.
{
function config()
{
$sql = e107::getDb();
$forum_posts = $sql->db_Count('forum_post');
$var[0]['icon'] = E_16_FORUM;
$var[0]['title'] = ADLAN_113;
$var[0]['url'] = e_PLUGIN."forum/forum_admin.php";
$var[0]['total'] = $forum_posts;
return $var;
}
}
?> ?>