/** * 31 July 2007 * This function should now be deprecated */ function getOverallLadder($num_to_show, $round_id, $page = 0, $field = 'points', $dir = 'desc') { global $database; if ($field == 'pointst') { $field = 'points'; } else { if ($field == 'prect') { $field = 'precision'; } } $offset = $page * $num_to_show; //$query = "SELECT user_id, SUM(`$field`) AS total FROM #__jtips_history GROUP BY user_id ORDER BY total $dir"; $query = "SELECT #__jtips_history.user_id, SUM(`{$field}`) AS total" . " FROM #__jtips_history JOIN #__jtips_users ON #__jtips_history.user_id = #__jtips_users.id" . " JOIN #__users ON #__jtips_users.user_id = #__users.id" . " GROUP BY #__jtips_history.user_id ORDER BY total {$dir}"; if ($num_to_show) { $query .= " LIMIT {$num_to_show} OFFSET {$offset}"; } // BUG 368 - Call to undefined function jTipsDebug - not called as part of static class jTipsLogger::jTipsDebug($query, "jHistory::getOverallLadder"); $database->setQuery($query); $row = $database->loadResultArray(); $users = array(); foreach ($row as $user_id) { $jTipsUser = new jTipsUser($database); $jTipsUser->load($user_id); array_push($users, $jTipsUser); } return $users; }
static function _log($item, $prepend = "") { global $jTips, $mosConfig_absolute_path; $file_path = $mosConfig_absolute_path . "/components/com_jtips/jtips.log"; $level = empty($prepend) ? 'INFO' : strtoupper($prepend); if (isset($jTips['DebugLevel']) and !in_array($level, $jTips['DebugLevel'])) { return true; } if (isJoomla15()) { jimport('joomla.filesystem.file'); if (JFile::exists($file_path)) { $size = filesize($file_path); $human = round($size / (1024 * 1024), 4); if ($human >= 10) { if (JFile::exists($file_path . ".0")) { JFile::delete($file_path . ".0"); } JFile::move($file_path, $file_path . ".0"); } } } else { if (file_exists($file_path)) { $size = filesize($file_path); $human = round($size / (1024 * 1024), 4); if ($human >= 10) { if (file_exists($file_path . ".0")) { @unlink($file_path . ".0"); } @rename($file_path, $file_path . ".0"); } } } if (!empty($prepend) and is_string($prepend)) { $prepend .= " "; } $log = "jLOG " . gmdate('Y-m-d H:i:s') . ": " . $prepend . stripslashes(print_r($item, true)) . "\n"; if (isJoomla15()) { $data = ''; if (JFile::exists($file_path)) { $data = JFile::read($file_path); $data .= $log; } return JFile::write($file_path, $data); } else { if (!($handle = fopen($file_path, 'a'))) { jTipsLogger::jTipsDebug("FAILED TO OPEN LOG FILE!", false); } else { if (fwrite($handle, $log) === false) { jTipsLogger::jTipsDebug("FAILED TO WRITE TO LOG FILE!", false); return false; } return fclose($handle); } } }