function listarticles($limit = "false", $from = "false", $cat = "false") { if (defined("KNIFESQL")) { $class = KArticles::connect(); $mysql_query = "SELECT * FROM articles"; $result = mysql_query($mysql_query) or die('Query failed: ' . mysql_error()); while ($article = mysql_fetch_assoc($result)) { $allarticles["{$article['articleid']}"] = $article; } $closed = KArticles::disconnect($class); return $allarticles; } else { $dataclass = KArticles::connect(); $allarticles = $dataclass->settings['articles']; krsort($allarticles); reset($allarticles); /*# usort($allarticles, "comparar"); foreach ($allarticles as $key => $row) { $date[$key] = $key; $status[$key] = $row['status']; } // Sort the data with volume descending, edition ascending // Add $data as the last parameter, to sort by the common key array_multisort($date, SORT_ASC, SORT_STRING, $status, SORT_ASC, SORT_STRING, $allarticles); */ if ($from) { $allarticles = array_slice_key($allarticles, $from); } return $allarticles; } }
function statistic($from, $field) { global $mydb, $lang, $config, $settings; $mydb->select("`{$field}`", "`{$from}`", "`aprove` = '1'"); if ($mydb->fetch_row() > 0) { while ($row = $mydb->fetch_array()) { $fields[] = $row[$field]; } $fields = array_count_values($fields); arsort($fields); $fields = array_slice_key($fields, 0, 10); $statistic = "<TABLE CLASS=PANEL ALIGN=CENTER WIDTH=90% CELLSPACING=0 CELLPADING=0 BORDER=0>"; $statistic .= "<TR><TD class=headerTB ALIGN=CENTER COLSPAN=3>-- {$lang['TOPUSERS']} --</TD>"; $count = 1; foreach ($fields as $key => $rank) { $info = informer($key); $statistic .= "<TR><TD WIDTH=15%>{$count}- </TD><TD WIDTH=55%><A " . tooltip(userinfo, $key) . ">{$info['username']}</A></TD><TD WIDTH=30%>" . $rank . "</TD></TR>"; $count++; } $statistic .= "</TABLE>"; } else { $statistic = "<TABLE CLASS=PANEL ALIGN=CENTER WIDTH=90% CELLSPACING=0 CELLPADING=0 BORDER=0>"; $statistic .= "<TR><TD class=headerTB ALIGN=CENTER COLSPAN=3>{$lang['THERE_IS_NO_ITEM']}</TD></TR>"; $statistic .= "</TABLE>"; } return $statistic; }
function listarticles($limit = "FALSE", $from = "FALSE") { if (defined("KNIFESQL")) { $dataclass = KArticles::connect(); $mysql_query = 'SELECT * FROM `articles`'; $result = mysql_query($mysql_query) or die('Query failed: ' . mysql_error()); while ($article = mysql_fetch_assoc($result)) { $allarticles["{$article['articleid']}"] = $article; } return $allarticles; } else { $dataclass = KArticles::connect(); $allarticles = $dataclass->settings['articles']; krsort($allarticles); reset($allarticles); if ($from) { $allarticles = array_slice_key($allarticles, $from); } return $allarticles; } }