/**
 * Функция подсчитывает количество тем и сообщений каждого пользователя и устанавливает счётчики.
 */
function ForumUpdateUserCounts()
{
    $counts = array();
    foreach (System::database()->Select('forum_posts') as $post) {
        if (!isset($counts[$post['user_id']])) {
            $counts[$post['user_id']] = array('topics' => 0, 'posts' => 0);
        }
        $counts[$post['user_id']]['posts']++;
    }
    foreach (System::database()->Select('forum_topics') as $topic) {
        if (!isset($counts[$topic['starter_id']])) {
            $counts[$topic['starter_id']] = array('topics' => 0, 'posts' => 0);
        }
        $counts[$topic['starter_id']]['topics']++;
    }
    foreach ($counts as $id => $count) {
        UserData('forum_counters', $count, $id);
    }
}
Exemple #2
0
$data = $heading;
foreach ($contenido as $linea) {
    $l = explode('|', $linea);
    switch ($arrHttp["Opcion"]) {
        case "vence":
            $user = $l[2];
            $usr_data = UserData($l[2]);
            $data .= "\n<tr><td valign=top>" . $l[4] . "</td>";
            $data .= $usr_data;
            $data .= "<td valign=top>" . $l[0] . "</td><td valign=top>" . $l[1] . "</td><td valign=top>" . $l[2] . "</td><td valign=top>" . $l[3] . "</td><td valign=top>" . FormatDate($l[5]) . "</td><td valign=top>" . $l[6] . "</td>";
            $data .= "<td valign=top>" . FormatDate($l[7]) . "</td><td valign=top>" . $l[8] . "</td><td valign=top>" . $l[9] . "</td><td valign=top>" . $l[10] . "</td><td valign=top>" . $l[11] . "</td>";
            break;
        case "suspen":
        case "fine":
            $user = $l[2];
            $usr_data = UserData($l[2]);
            $data .= "\n<tr><td valign=top>" . $l[2] . "</td>";
            $data .= $usr_data;
            $data .= "<td valign=top>" . $l[0] . "</td><td valign=top>" . $l[1] . "</td><td valign=top>" . FormatDate($l[3]) . "</td><td valign=top>" . $l[4] . "</td>";
            $data .= "<td valign=top>" . $l[5] . "</td><td valign=top>" . FormatDate($l[6]) . "</td><td valign=top>" . $l[7] . "</td><td valign=top>" . $l[8] . "</td><td valign=top>" . $l[9] . "</td>";
            break;
    }
}
$data .= "\n</table>";
switch ($arrHttp["vp"]) {
    case "WP":
        $filename = $arrHttp["base"] . ".doc";
        header('Content-Type: application/msword; charset=windows-1252');
        header("Content-Disposition: attachment; filename=\"{$filename}\"");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
 /**
  * Функция для чтения и записи индивидуальных настроек пользователя в базе данных.
  * @param $Name $key
  * @param $Value $value
  * @return boolean
  */
 public function Data($Name = null, $Value = null)
 {
     return UserData($Name, $Value);
 }