Example #1
0
 function sc_admin_latest($parm)
 {
     if ($parm == 'infopanel' && e_PAGE != 'admin.php') {
         return;
     }
     if (ADMIN) {
         if (!function_exists('admin_latest')) {
             function admin_latest($parm = '')
             {
                 $sql = e107::getDb();
                 $ns = e107::getRender();
                 $pref = e107::getPref();
                 $mes = e107::getMessage();
                 $active_uploads = $sql->count('upload', '(*)', 'WHERE upload_active = 0');
                 $submitted_news = $sql->count('submitnews', '(*)', 'WHERE submitnews_auth = 0');
                 $comments_pending = $sql->count("comments", "(*)", "WHERE comment_blocked = 2 ");
                 //	$text = "<div class='left'><div style='padding-bottom: 2px;'>".E_16_NEWS.($submitted_news ? " <a href='".e_ADMIN."newspost.php?mode=sub&amp;action=list'>".ADLAN_LAT_2.": $submitted_news</a>" : ' '.ADLAN_LAT_2.': 0').'</div>';
                 //	$text .= "<div style='padding-bottom: 2px;'>".E_16_COMMENT. " <a href='".e_ADMIN_ABS."comment.php?searchquery=&filter_options=comment_blocked__2'>".ADLAN_LAT_9.": $comments_pending</a></div>";
                 //		$text .= "<div style='padding-bottom: 2px;'>".E_16_UPLOADS." <a href='".e_ADMIN."upload.php'>".ADLAN_LAT_7.": $active_uploads</a></div>";
                 $oldconfigs = array();
                 $oldconfigs['e-news'][0] = array('icon' => E_16_NEWS, 'title' => ADLAN_LAT_2, 'url' => e_ADMIN . "newspost.php?mode=sub&amp;action=list", 'total' => $submitted_news);
                 if (empty($pref['comments_disabled']) && varset($pref['comments_engine'], 'e107') == 'e107') {
                     $oldconfigs['e-comment'][0] = array('icon' => E_16_COMMENT, 'title' => ADLAN_LAT_9, 'url' => e_ADMIN_ABS . "comment.php?searchquery=&filter_options=comment_blocked__2", 'total' => $comments_pending);
                 }
                 $oldconfigs['e-upload'][0] = array('icon' => E_16_UPLOADS, 'title' => ADLAN_LAT_7, 'url' => e_ADMIN . "upload.php", 'total' => $active_uploads);
                 $messageTypes = array('Broken Download', 'Dev Team Message');
                 $queryString = '';
                 foreach ($messageTypes as $types) {
                     $queryString .= " gen_type='{$types}' OR";
                 }
                 $queryString = substr($queryString, 0, -3);
                 if ($amount = $sql->select('generic', '*', $queryString)) {
                     //	$text .= "<br /><b><a href='".e_ADMIN_ABS."message.php'>".ADLAN_LAT_8." [".$amount."]</a></b>";
                     $oldconfigs['e-generic'][0] = array('icon' => E_16_NOTIFY, 'title' => ADLAN_LAT_8, 'url' => e_ADMIN_ABS . "message.php", 'total' => $amount);
                 }
                 if (vartrue($pref['e_latest_list'])) {
                     foreach ($pref['e_latest_list'] as $val) {
                         $text = "";
                         if (is_readable(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");
                                 $oldconfigs[$val] = admin_shortcodes::legacyToConfig($text);
                             }
                         }
                     }
                 }
                 $configs = e107::getAddonConfig('e_dashboard', null, 'latest');
                 if (!is_array($configs)) {
                     $configs = array();
                 }
                 $allconfigs = array_merge($oldconfigs, $configs);
                 $allconfigs = multiarray_sort($allconfigs, 'title');
                 //XXX FIXME - not sorting correctly.
                 $text = "<ul id='e-latest' class='unstyled list-unstyled'>";
                 foreach ($allconfigs as $k => $v) {
                     foreach ($v as $val) {
                         $class = admin_shortcodes::getBadge($val['total']);
                         $link = "<a  href='" . $val['url'] . "'>" . str_replace(":", " ", $val['title']) . " <span class='" . $class . "'>" . $val['total'] . "</span></a>";
                         $text .= "<li class='clearfix'>" . $val['icon'] . " " . $link . "</li>\n";
                     }
                 }
                 $text .= "</ul>";
                 //	$text .= "</div>";
                 return $parm != 'norender' ? $ns->tablerender(ADLAN_LAT_1, $text, '', TRUE) : $text;
             }
         }
         if ($parm == 'request') {
             if (function_exists('latest_request')) {
                 if (latest_request()) {
                     return admin_latest($parm);
                 }
             }
         } else {
             return admin_latest($parm);
         }
     }
 }
Example #2
0
 function sc_admin_latest($parm)
 {
     if (ADMIN) {
         if (!function_exists('admin_latest')) {
             function admin_latest($parm = '')
             {
                 global $sql, $ns, $pref;
                 $active_uploads = $sql->db_Count('upload', '(*)', 'WHERE upload_active = 0');
                 $submitted_news = $sql->db_Count('submitnews', '(*)', 'WHERE submitnews_auth = 0');
                 $text = "<div class='left'><div style='padding-bottom: 2px;'>" . E_16_NEWS . ($submitted_news ? " <a href='" . e_ADMIN . "newspost.php?mode=sub&amp;action=list'>" . ADLAN_LAT_2 . ": {$submitted_news}</a>" : ' ' . ADLAN_LAT_2 . ': 0') . '</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>';
                 if (vartrue($pref['e_latest_list'])) {
                     foreach ($pref['e_latest_list'] as $val) {
                         if (is_readable(e_PLUGIN . $val . '/e_latest.php')) {
                             include_once e_PLUGIN . $val . '/e_latest.php';
                         }
                     }
                 }
                 $messageTypes = array('Broken Download', 'Dev Team Message');
                 $queryString = '';
                 foreach ($messageTypes as $types) {
                     $queryString .= " gen_type='{$types}' OR";
                 }
                 $queryString = substr($queryString, 0, -3);
                 if ($amount = $sql->db_Select('generic', '*', $queryString)) {
                     $text .= "<br /><b><a href='" . e_ADMIN_ABS . "message.php'>" . ADLAN_LAT_8 . " [" . $amount . "]</a></b>";
                 }
                 $text .= "</div>";
                 return $parm != 'norender' ? $ns->tablerender(ADLAN_LAT_1, $text, '', TRUE) : $text;
             }
         }
         if ($parm == 'request') {
             if (function_exists('latest_request')) {
                 if (latest_request()) {
                     return admin_latest($parm);
                 }
             }
         } else {
             return admin_latest($parm);
         }
     }
 }