コード例 #1
0
ファイル: mysql.php プロジェクト: BGCX067/facestor-svn-to-git
 function super_query($query, $multi = false, $cache_prefix = false, $system_cache = false)
 {
     //Если включен кеш, то проверяем на его существование
     if ($cache_prefix) {
         if ($system_cache) {
             $data = system_cache($cache_prefix);
         } else {
             $data = mozg_cache($cache_prefix);
         }
     }
     //Если есть ответ с кеша
     if ($data) {
         $unSerData = unserialize($data);
         if ($unSerData) {
             return $unSerData;
         } else {
             return array();
         }
     } else {
         if (!$multi) {
             $this->query($query);
             $data = $this->get_row();
             $this->free();
             //Если включен кеш, то создаём его
             if ($cache_prefix) {
                 $cache_rows = serialize($data);
                 mozg_create_cache($cache_prefix, $cache_rows);
             }
             return $data;
         } else {
             $this->query($query);
             $rows = array();
             while ($row = $this->get_row()) {
                 $rows[] = $row;
             }
             $this->free();
             //Если включен кеш, то создаём его
             if ($cache_prefix) {
                 $cache_rows = serialize($rows);
                 if ($system_cache) {
                     creat_system_cache($cache_prefix, $cache_rows);
                 } else {
                     mozg_create_cache($cache_prefix, $cache_rows);
                 }
             }
             return $rows;
         }
     }
 }
コード例 #2
0
     if ($check) {
         //Удаляем друга из таблицы друзей
         $db->query("DELETE FROM `" . PREFIX . "_friends` WHERE user_id = '{$user_id}' AND friend_id = '{$delet_user_id}' AND subscriptions = 0");
         //Удаляем у друга из таблицы
         $db->query("DELETE FROM `" . PREFIX . "_friends` WHERE user_id = '{$delet_user_id}' AND friend_id = '{$user_id}' AND subscriptions = 0");
         //Обновляем кол-друзей у юзера
         $db->query("UPDATE `" . PREFIX . "_users` SET user_friends_num = user_friends_num-1 WHERE user_id = '{$user_id}'");
         //Обновляем у друга которого удаляем кол-во друзей
         $db->query("UPDATE `" . PREFIX . "_users` SET user_friends_num = user_friends_num-1 WHERE user_id = '{$delet_user_id}'");
         //Чистим кеш владельцу стр и тому кого удаляем из др.
         mozg_clear_cache_file('user_' . $user_id . '/profile_' . $user_id);
         mozg_clear_cache_file('user_' . $delet_user_id . '/profile_' . $delet_user_id);
         //Удаляем пользователя из кеш файл друзей
         $openMyList = mozg_cache("user_{$user_id}/friends");
         mozg_create_cache("user_{$user_id}/friends", str_replace("u{$delet_user_id}|", "", $openMyList));
         $openTakeList = mozg_cache("user_{$delet_user_id}/friends");
         mozg_create_cache("user_{$delet_user_id}/friends", str_replace("u{$user_id}|", "", $openTakeList));
     } else {
         echo 'no_friend';
     }
     die;
     break;
     //################### Страница заявок в друзья ###################//
 //################### Страница заявок в друзья ###################//
 case "requests":
     $user_id = $user_info['user_id'];
     if ($user_info['user_friends_demands']) {
         $user_speedbar = $user_info['user_friends_demands'] . ' ' . gram_record($user_info['user_friends_demands'], 'friends_demands');
     } else {
         $user_speedbar = $lang['no_requests'];
     }
コード例 #3
0
     die;
     break;
     //################### Удаление из черного списка ###################//
 //################### Удаление из черного списка ###################//
 case "delblacklist":
     NoAjaxQuery();
     $bad_user_id = intval($_POST['bad_user_id']);
     //Проверяем на существование юзера
     $row = $db->super_query("SELECT COUNT(*) AS cnt FROM `" . PREFIX . "_users` WHERE user_id = '{$bad_user_id}'");
     //Выводим свой блеклист для проверка
     $myRow = $db->super_query("SELECT user_blacklist FROM `" . PREFIX . "_users` WHERE user_id = '{$user_id}'");
     $array_blacklist = explode('|', $myRow['user_blacklist']);
     if ($row['cnt'] and in_array($bad_user_id, $array_blacklist) and $user_id != $bad_user_id) {
         $myRow['user_blacklist'] = str_replace("|{$bad_user_id}|", "", $myRow['user_blacklist']);
         $db->query("UPDATE `" . PREFIX . "_users` SET user_blacklist_num = user_blacklist_num-1, user_blacklist = '{$myRow['user_blacklist']}' WHERE user_id = '{$user_id}'");
         $openMyList = mozg_cache("user_{$user_id}/blacklist");
         mozg_create_cache("user_{$user_id}/blacklist", str_replace("|{$bad_user_id}|", "", $openMyList));
     }
     die;
     break;
     //################### Черный список ###################//
 //################### Черный список ###################//
 case "blacklist":
     $row = $db->super_query("SELECT user_blacklist, user_blacklist_num FROM `" . PREFIX . "_users` WHERE user_id = '{$user_id}'");
     $tpl->load_template('settings/blacklist.tpl');
     $tpl->set('{cnt}', '<span id="badlistnum">' . $row['user_blacklist_num'] . '</span> ' . gram_record($row['user_blacklist_num'], 'fave'));
     if ($row['user_blacklist_num']) {
         $tpl->set('[yes-users]', '');
         $tpl->set('[/yes-users]', '');
     } else {
         $tpl->set_block("'\\[yes-users\\](.*?)\\[/yes-users\\]'si", "");
コード例 #4
0
ファイル: groups_forum.php プロジェクト: skypach/skypach.ru
         $row_owner2['msg'] = $db->safesql($row_owner2['msg']);
         $check2 = $db->super_query("SELECT user_last_visit, user_name FROM `" . PREFIX . "_users` WHERE user_id = '{$row_owner2['muser_id']}'");
         $msg = str_replace($check2['user_name'], "<a href=\"/u{$row_owner2['muser_id']}\" onClick=\"Page.Go(this.href); return false\">{$check2['user_name']}</a>", $msg);
         //Всталвяем саму запись в БД
         $db->query("INSERT INTO `" . PREFIX . "_communities_forum_msg` SET fid = '{$fid}', muser_id = '{$user_id}', msg = '{$msg}', mdate = '{$server_time}'");
         $dbid = $db->insert_id();
         //Вставляем в ленту новостей
         $db->query("INSERT INTO `" . PREFIX . "_news` SET ac_user_id = '{$user_id}', action_type = 6, action_text = '{$msg}', obj_id = '{$dbid}', for_user_id = '{$row_owner2['muser_id']}', action_time = '{$server_time}', answer_text = '{$row_owner2['msg']}', link = '/forum{$row['public_id']}?act=view&id={$fid}'");
         //Вставляем событие в моментальные оповещания
         $update_time = $server_time - 70;
         if ($check2['user_last_visit'] >= $update_time) {
             $db->query("INSERT INTO `" . PREFIX . "_updates` SET for_user_id = '{$row_owner2['muser_id']}', from_user_id = '{$user_id}', type = '6', date = '{$server_time}', text = '{$msg}', user_photo = '{$user_info['user_photo']}', user_search_pref = '{$user_info['user_search_pref']}', lnk = '/forum{$row['public_id']}?act=view&id={$fid}'");
             mozg_create_cache("user_{$row_owner2['muser_id']}/updates", 1);
             //ИНАЧЕ Добавляем +1 юзеру для оповещания
         } else {
             $cntCacheNews = mozg_cache("user_{$row_owner2['muser_id']}/new_news");
             mozg_create_cache("user_{$row_owner2['muser_id']}/new_news", $cntCacheNews + 1);
         }
     }
 } else {
     //Всталвяем саму запись в БД
     $db->query("INSERT INTO `" . PREFIX . "_communities_forum_msg` SET fid = '{$fid}', muser_id = '{$user_id}', msg = '{$msg}', mdate = '{$server_time}'");
     $dbid = $db->insert_id();
 }
 mozg_clear_cache_file("groups_forum/forum{$row['public_id']}");
 //Обновляем данные в теме
 $db->query("UPDATE `" . PREFIX . "_communities_forum` SET msg_num = msg_num+1, lastdate = '{$server_time}', lastuser_id = '{$user_id}' WHERE fid = '{$fid}'");
 $tpl->load_template('forum/msg.tpl');
 $msg = preg_replace('`(http(?:s)?://\\w+[^\\s\\[\\]\\<]+)`i', '<a href="/away.php?url=$1" target="_blank">$1</a>', $msg);
 $tpl->set('{text}', stripslashes($msg));
 $tpl->set('{name}', $user_info['user_search_pref']);
コード例 #5
0
ファイル: news.php プロジェクト: BGCX067/facestor-svn-to-git
     } else {
         if ($type == 'videos') {
             $metatags['title'] = $lang['news_videos'];
             $user_speedbar = $lang['news_speedbar_videos'];
             $sql_sort = '2';
             $no_news = '<br /><br />' . $lang['news_none_videos'] . '<br /><br /><br />';
         } else {
             if ($type == 'notifications') {
                 $metatags['title'] = $lang['news_notifications'];
                 $user_speedbar = $lang['news_speedbar_notifications'];
                 $sql_sort = '6,7,8,9,10';
                 $dop_sort = "AND tb1.for_user_id = '{$user_id}'";
                 $no_news = '<br /><br />' . $lang['news_none_notifica'] . '<br /><br /><br />';
                 $sql_where = '';
                 //Обновляем счетчик новых новостей, ставим 0
                 $CacheNews = mozg_cache('user_' . $_SESSION['user_id'] . '/new_news');
                 if ($CacheNews) {
                     mozg_create_cache('user_' . $user_id . '/new_news', '');
                 }
             } else {
                 $metatags['title'] = $lang['news_title'];
                 $user_speedbar = $lang['news_speedbar'];
                 $sql_sort = '1,2,3,11';
                 $no_news = '<br /><br />' . $lang['news_none'] . '<br /><br /><br />';
                 $type = '';
                 $sql_where = "\r\n\t\t\t\t\ttb1.ac_user_id IN (SELECT tb2.friend_id FROM `" . PREFIX . "_friends` tb2 WHERE user_id = '{$user_id}' AND tb1.action_type IN (1,2,3) AND subscriptions != 2) \r\n\t\t\t\tOR \r\n\t\t\t\t\ttb1.ac_user_id IN (SELECT tb2.friend_id FROM `" . PREFIX . "_friends` tb2 WHERE user_id = '{$user_id}' AND tb1.action_type = 11 AND subscriptions = 2) \r\n\t\t\t\tAND";
             }
         }
     }
 }
 if ($_POST['page_cnt'] > 0) {
コード例 #6
0
ファイル: im_chat.php プロジェクト: skypach/skypach.ru
HTML;
                    }
                    $tpl->set('{text}', stripslashes($row['text']));
                    $tpl->compile('content');
                }
            }
            if (!$first_id) {
                $tpl->result['content'] .= '</div></div></div>';
            }
            if (!$first_id) {
                $tpl->load_template('im_chat/form.tpl');
                $tpl->set('{for_user_id}', $for_user_id);
                //Выводим информцию о том кто смотрит страницу для себя
                $myInfo = $db->super_query("SELECT user_name FROM `" . PREFIX . "_users` WHERE user_id = '" . $user_id . "'");
                $tpl->set('{myuser-id}', $user_id);
                $tpl->set('{my-name}', $myInfo['user_name']);
                if ($user_info['user_photo']) {
                    $tpl->set('{my-ava}', '/uploads/users/' . $user_id . '/50_' . $user_info['user_photo']);
                } else {
                    $tpl->set('{my-ava}', '/images/no_ava_50.png');
                }
                $tpl->compile('content');
            }
            AjaxTpl();
            die;
            break;
            //################### Обновление диалогов ###################//
        //################### Обновление диалогов ###################//
        case "upDialogs":
            NoAjaxQuery();
            $update = mozg_cache('user_' . $user_id . '/im_update');
コード例 #7
0
                         $tpl->set('[owner]', '');
                         $tpl->set('[/owner]', '');
                         $tpl->set_block("'\\[not-owner\\](.*?)\\[/not-owner\\]'si", "");
                     } else {
                         $tpl->set('[not-owner]', '');
                         $tpl->set('[/not-owner]', '');
                         $tpl->set_block("'\\[owner\\](.*?)\\[/owner\\]'si", "");
                     }
                     $tpl->compile('content');
                 }
                 navigation($gcount, $row_album['photo_num'], $config['home_url'] . 'albums/view/' . $aid . '/page/');
             } else {
                 msgbox('', '<br /><br />В альбоме нет фотографий<br /><br /><br />', 'info_2');
             }
             //Проверяем на наличии файла с позициям фоток
             $check_pos = mozg_cache('user_' . $row_album['user_id'] . '/position_photos_album_' . $aid);
             //Если нету, то вызываем функцию генерации
             if (!$check_pos) {
                 GenerateAlbumPhotosPosition($row_album['user_id'], $aid);
             }
         } else {
             $user_speedbar = $lang['error'];
             msgbox('', $lang['no_notes'], 'info');
         }
     } else {
         $user_speedbar = $lang['title_albums'];
         msgbox('', $lang['no_notes'], 'info');
     }
     break;
     //################### Страница с новыми фотографиями ###################//
 //################### Страница с новыми фотографиями ###################//
コード例 #8
0
ファイル: index.php プロジェクト: dimasik9081/vkscript
if ($_GET['reg']) {
    $_SESSION['ref_id'] = intval($_GET['reg']);
}
//??????????? ????????
if (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) {
    $xBrowser = 'ie6';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0')) {
    $xBrowser = 'ie7';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 8.0')) {
    $xBrowser = 'ie8';
}
if ($xBrowser == 'ie6' or $xBrowser == 'ie7' or $xBrowser == 'ie8') {
    header("Location: /badbrowser.php");
}
//????????? ???-?? ????? ????????
$CacheNews = mozg_cache('user_' . $user_info['user_id'] . '/new_news');
if ($CacheNews) {
    $new_news = "<div class=\"newNews2\" style=\"margin-left:150px;margin-top:1px\">{$CacheNews}</div>";
    $news_link = '/notifications';
}
//????? ?????????
$user_pm_num = $user_info['user_pm_num'];
if ($user_pm_num) {
    $user_pm_num = "<b class=\"headm_newac\">+{$user_pm_num}</b>";
} else {
    $user_pm_num = '';
}
//????? ??????
$user_friends_demands = $user_info['user_friends_demands'];
if ($user_friends_demands) {
    $demands = "<b class=\"headm_newac\">+{$user_friends_demands}</b>";
コード例 #9
0
ファイル: photo.php プロジェクト: BGCX067/facestor-svn-to-git
 $photo_id = intval($_POST['pid']);
 $fuser = intval($_POST['fuser']);
 $section = $_POST['section'];
 //ЧС
 $CheckBlackList = CheckBlackList($user_id);
 if (!$CheckBlackList) {
     //Получаем ID альбома
     $check_album = $db->super_query("SELECT album_id FROM `" . PREFIX . "_photos` WHERE id = '{$photo_id}'");
     //Если фотография вызвана не со стены
     if (!$fuser and $check_album) {
         //Проверяем на наличии файла с позициям только для этого фоток
         $check_pos = mozg_cache('user_' . $user_id . '/position_photos_album_' . $check_album['album_id']);
         //Если нету, то вызываем функцию генерации
         if (!$check_pos) {
             GenerateAlbumPhotosPosition($user_id, $check_album['album_id']);
             $check_pos = mozg_cache('user_' . $user_id . '/position_photos_album_' . $check_album['album_id']);
         }
         $position = xfieldsdataload($check_pos);
     }
     $row = $db->super_query("SELECT tb1.id, photo_name, comm_num, descr, date, position, tb2.user_id, user_search_pref, user_country_city_name FROM `" . PREFIX . "_photos` tb1, `" . PREFIX . "_users` tb2 WHERE id = '{$photo_id}' AND tb1.user_id = tb2.user_id");
     if ($row) {
         //Вывод названия альбома, приватноть из БД
         $info_album = $db->super_query("SELECT name, privacy FROM `" . PREFIX . "_albums` WHERE aid = '{$check_album['album_id']}'");
         $album_privacy = explode('|', $info_album['privacy']);
         //Проверка естьли запрашиваемый юзер в друзьях у юзера который смотрит стр
         if ($user_info['user_id'] != $row['user_id']) {
             $check_friend = CheckFriends($row['user_id']);
         }
         //Приватность
         if ($album_privacy[0] == 1 or $album_privacy[0] == 2 and $check_friend or $user_info['user_id'] == $row['user_id']) {
             //Если фотография вызвана не со стены
コード例 #10
0
function MyCheckBlackList($userId)
{
    global $user_info;
    $openMyList = mozg_cache("user_{$user_info['user_id']}/blacklist");
    if (stripos($openMyList, "|{$userId}|") !== false) {
        return true;
    } else {
        return false;
    }
}
コード例 #11
0
 }
 $tpl->compile('content');
 //Добавляем действие в ленту новостей "ответы" владельцу фотографии
 if ($user_id != $check_video['owner_user_id']) {
     $check_video['photo'] = str_replace($config['home_url'], '/', $check_video['photo']);
     $comment = str_replace("|", "&#124;", $comment);
     $db->query("INSERT INTO `" . PREFIX . "_news` SET ac_user_id = '{$user_id}', action_type = 9, action_text = '{$comment}|{$check_video['photo']}|{$vid}', obj_id = '{$id}', for_user_id = '{$check_video['owner_user_id']}', action_time = '{$server_time}'");
     //Вставляем событие в моментальные оповещания
     $row_userOW = $db->super_query("SELECT user_last_visit FROM `" . PREFIX . "_users` WHERE user_id = '{$check_video['owner_user_id']}'");
     $update_time = $server_time - 70;
     if ($row_userOW['user_last_visit'] >= $update_time) {
         $db->query("INSERT INTO `" . PREFIX . "_updates` SET for_user_id = '{$check_video['owner_user_id']}', from_user_id = '{$user_id}', type = '3', date = '{$server_time}', text = '{$comment}', user_photo = '{$user_info['user_photo']}', user_search_pref = '{$user_info['user_search_pref']}', lnk = '/video{$check_video['owner_user_id']}_{$vid}'");
         mozg_create_cache("user_{$check_video['owner_user_id']}/updates", 1);
         //ИНАЧЕ Добавляем +1 юзеру для оповещания
     } else {
         $cntCacheNews = mozg_cache('user_' . $check_video['owner_user_id'] . '/new_news');
         mozg_create_cache('user_' . $check_video['owner_user_id'] . '/new_news', $cntCacheNews + 1);
     }
     //Отправка уведомления на E-mail
     if ($config['news_mail_3'] == 'yes') {
         $rowUserEmail = $db->super_query("SELECT user_name, user_email FROM `" . PREFIX . "_users` WHERE user_id = '" . $check_video['owner_user_id'] . "'");
         if ($rowUserEmail['user_email']) {
             include_once ENGINE_DIR . '/classes/mail.php';
             $mail = new dle_mail($config);
             $rowMyInfo = $db->super_query("SELECT user_search_pref FROM `" . PREFIX . "_users` WHERE user_id = '" . $user_id . "'");
             $rowEmailTpl = $db->super_query("SELECT text FROM `" . PREFIX . "_mail_tpl` WHERE id = '3'");
             $rowEmailTpl['text'] = str_replace('{%user%}', $rowUserEmail['user_name'], $rowEmailTpl['text']);
             $rowEmailTpl['text'] = str_replace('{%user-friend%}', $rowMyInfo['user_search_pref'], $rowEmailTpl['text']);
             $rowEmailTpl['text'] = str_replace('{%rec-link%}', $config['home_url'] . 'video' . $check_video['owner_user_id'] . '_' . $vid, $rowEmailTpl['text']);
             $mail->send($rowUserEmail['user_email'], 'Новый комментарий к Вашей видеозаписи', $rowEmailTpl['text']);
         }
コード例 #12
0
ファイル: wall.php プロジェクト: BGCX067/facestor-svn-to-git
     $db->query("INSERT INTO `" . PREFIX . "_news` SET ac_user_id = '{$user_id}', action_type = 1, action_text = '{$wall_text}', obj_id = '{$dbid}', action_time = '{$str_date}'");
 }
 //Если добавляется комментарий к записи то вносим в ленту новостей "ответы"
 if ($fast_comm_id) {
     //Выводим ид владельца записи
     $row_owner = $db->super_query("SELECT author_user_id FROM `" . PREFIX . "_wall` WHERE id = '{$fast_comm_id}'");
     if ($user_id != $row_owner['author_user_id'] and $row_owner) {
         $db->query("INSERT INTO `" . PREFIX . "_news` SET ac_user_id = '{$user_id}', action_type = 6, action_text = '{$wall_text}', obj_id = '{$fast_comm_id}', for_user_id = '{$row_owner['author_user_id']}', action_time = '{$str_date}'");
         //Вставляем событие в моментальные оповещания
         $update_time = $server_time - 70;
         if ($check['user_last_visit'] >= $update_time) {
             $db->query("INSERT INTO `" . PREFIX . "_updates` SET for_user_id = '{$row_owner['author_user_id']}', from_user_id = '{$user_id}', type = '1', date = '{$server_time}', text = '{$wall_text}', user_photo = '{$user_info['user_photo']}', user_search_pref = '{$user_info['user_search_pref']}', lnk = '/wall{$for_user_id}_{$fast_comm_id}'");
             mozg_create_cache("user_{$row_owner['author_user_id']}/updates", 1);
             //ИНАЧЕ Добавляем +1 юзеру для оповещания
         } else {
             $cntCacheNews = mozg_cache('user_' . $row_owner['author_user_id'] . '/new_news');
             mozg_create_cache('user_' . $row_owner['author_user_id'] . '/new_news', $cntCacheNews + 1);
         }
         //Отправка уведомления на E-mail
         if ($config['news_mail_2'] == 'yes') {
             $rowUserEmail = $db->super_query("SELECT user_name, user_email FROM `" . PREFIX . "_users` WHERE user_id = '" . $row_owner['author_user_id'] . "'");
             if ($rowUserEmail['user_email']) {
                 include_once ENGINE_DIR . '/classes/mail.php';
                 $mail = new dle_mail($config);
                 $rowMyInfo = $db->super_query("SELECT user_search_pref FROM `" . PREFIX . "_users` WHERE user_id = '" . $user_id . "'");
                 $rowEmailTpl = $db->super_query("SELECT text FROM `" . PREFIX . "_mail_tpl` WHERE id = '2'");
                 $rowEmailTpl['text'] = str_replace('{%user%}', $rowUserEmail['user_name'], $rowEmailTpl['text']);
                 $rowEmailTpl['text'] = str_replace('{%user-friend%}', $rowMyInfo['user_search_pref'], $rowEmailTpl['text']);
                 $rowEmailTpl['text'] = str_replace('{%rec-link%}', $config['home_url'] . 'wall' . $row_owner['author_user_id'] . '_' . $fast_comm_id, $rowEmailTpl['text']);
                 $mail->send($rowUserEmail['user_email'], 'Ответ на запись', $rowEmailTpl['text']);
             }
コード例 #13
0
ファイル: audio_player.php プロジェクト: skypach/skypach.ru
             }
         }
         $artist = $db->safesql($row['artist']);
         $name = $db->safesql($row['name']);
         $newStatus = '<div class="staticpl_translatl" onClick="gStatus.open()"><div class="statipl_music"></div>' . $artist . ' &ndash; ' . $name . '</div><audio' . $aid;
         //Обновляем статус
         $db->query("UPDATE `" . PREFIX . "_users` SET user_status = '{$newStatus}' WHERE user_id = '{$user_id}'");
         //Чистим кеш
         mozg_clear_cache_file("user_{$user_id}/profile_{$user_id}");
     }
     break;
     //################### Выключение трансляции ###################//
 //################### Выключение трансляции ###################//
 case "notranslate":
     //Выводим пред. статус
     $checkPrevStatus = mozg_cache("user_{$user_id}/old_status");
     $checkExp = explode('<audio', $checkPrevStatus);
     if (!$checkExp[1]) {
         $newStatus = $db->safesql($checkPrevStatus);
     } else {
         $newStatus = '';
     }
     //Обновляем статус
     $db->query("UPDATE `" . PREFIX . "_users` SET user_status = '{$newStatus}' WHERE user_id = '{$user_id}'");
     //Чистим кеш
     mozg_create_cache("user_{$user_id}/old_status", "");
     mozg_clear_cache_file("user_{$user_id}/profile_{$user_id}");
     break;
 default:
     //################### Вывод всех аудио ###################//
     $get_user_id = intval($_POST['get_user_id']);
コード例 #14
0
ファイル: profile1.php プロジェクト: skypach/skypach.ru
     }
     $sql_videos = $db->super_query("SELECT SQL_CALC_FOUND_ROWS id, title, add_date, comm_num, photo FROM `" . PREFIX . "_videos` WHERE owner_user_id = '{$id}' {$sql_privacy} ORDER by `add_date` DESC LIMIT 0,2", 1, "user_{$id}/page_videos_user{$cache_pref_videos}");
     $tpl->load_template('profile_video.tpl');
     foreach ($sql_videos as $row_videos) {
         $tpl->set('{photo}', $row_videos['photo']);
         $tpl->set('{id}', $row_videos['id']);
         $tpl->set('{user-id}', $id);
         $tpl->set('{title}', stripslashes($row_videos['title']));
         $tpl->set('{comm-num}', $row_videos['comm_num'] . ' ' . gram_record($row_videos['comm_num'], 'comments'));
         megaDate(strtotime($row_videos['add_date']), '');
         $tpl->compile('videos');
     }
 }
 //################### Подписки ###################//
 if ($row['user_subscriptions_num']) {
     $tpl->result['subscriptions'] = mozg_cache('/subscr_user_' . $id);
     if (!$tpl->result['subscriptions']) {
         $sql_subscriptions = $db->super_query("SELECT SQL_CALC_FOUND_ROWS tb1.friend_id, tb2.user_search_pref, user_photo, user_country_city_name, user_status FROM `" . PREFIX . "_friends` tb1, `" . PREFIX . "_users` tb2 WHERE tb1.user_id = '{$id}' AND tb1.friend_id = tb2.user_id AND  \ttb1.subscriptions = 1 ORDER by `friends_date` DESC LIMIT 0,5", 1);
         $tpl->load_template('profile_subscription.tpl');
         foreach ($sql_subscriptions as $row_subscr) {
             $tpl->set('{user-id}', $row_subscr['friend_id']);
             $tpl->set('{name}', $row_subscr['user_search_pref']);
             if ($row_subscr['user_status']) {
                 $tpl->set('{info}', stripslashes(substr($row_subscr['user_status'], 0, 24)));
             } else {
                 $country_city = explode('|', $row_subscr['user_country_city_name']);
                 $tpl->set('{info}', $country_city[1]);
             }
             if ($row_subscr['user_photo']) {
                 $tpl->set('{ava}', $config['home_url'] . 'uploads/users/' . $row_subscr['friend_id'] . '/50_' . $row_subscr['user_photo']);
             } else {
コード例 #15
0
<?php

/* 
	Appointment: Моментальные оповещания
	File: updates.php 
*/
if (!defined('MOZG')) {
    die('Hacking attempt!');
}
NoAjaxQuery();
if ($logged) {
    $user_id = $user_info['user_id'];
    $cntCacheUp = mozg_cache("user_{$user_id}/updates");
    if ($cntCacheUp) {
        $update_time = $server_time - 70;
        $row = $db->super_query("SELECT id, type, from_user_id, text, lnk, user_search_pref, user_photo FROM `" . PREFIX . "_updates` WHERE for_user_id = '{$user_id}' AND date > '{$update_time}' ORDER by `date` ASC");
        if ($row) {
            if ($row['user_photo']) {
                $ava = "/uploads/users/{$row['from_user_id']}/50_{$row['user_photo']}";
            } else {
                $ava = "/templates/Default/images/no_ava_50.png";
            }
            echo $row['type'] . '|' . $row['user_search_pref'] . '|' . $row['from_user_id'] . '|' . stripslashes($row['text']) . '|' . $server_time . '|' . $ava . '|' . $row['lnk'];
            $db->query("DELETE FROM `" . PREFIX . "_updates` WHERE id = '{$row['id']}'");
        } else {
            mozg_create_cache("user_{$user_id}/updates", '');
        }
    }
}
die;
コード例 #16
0
ファイル: gifts.php プロジェクト: skypach/skypach.ru
 $row = $db->super_query("SELECT user_balance FROM `" . PREFIX . "_users` WHERE user_id = '{$user_id}'");
 if ($gifts['price'] and $user_id != $for_user_id) {
     if ($row['user_balance'] >= $gifts['price']) {
         $db->query("INSERT INTO `" . PREFIX . "_gifts` SET uid = '{$for_user_id}', gift = '{$gift}', msg = '{$msg}', privacy = '{$privacy}', gdate = '{$server_time}', from_uid = '{$user_id}', status = 1");
         $db->query("UPDATE `" . PREFIX . "_users` SET user_balance = user_balance-{$gifts['price']} WHERE user_id = '{$user_id}'");
         $db->query("UPDATE `" . PREFIX . "_users` SET user_gifts = user_gifts+1 WHERE user_id = '{$for_user_id}'");
         //Вставляем событие в моментальные оповещания
         $row_owner = $db->super_query("SELECT user_last_visit FROM `" . PREFIX . "_users` WHERE user_id = '{$for_user_id}'");
         $update_time = $server_time - 70;
         if ($row_owner['user_last_visit'] >= $update_time) {
             $action_update_text = "<img src=\"/uploads/gifts/{$gift}.png\" align=\"right\" width=\"50\">";
             $db->query("INSERT INTO `" . PREFIX . "_updates` SET for_user_id = '{$for_user_id}', from_user_id = '{$user_info['user_id']}', type = '7', date = '{$server_time}', text = '{$action_update_text}', user_photo = '{$user_info['user_photo']}', user_search_pref = '{$user_info['user_search_pref']}', lnk = '/gifts{$user_info['user_id']}'");
             mozg_create_cache("user_{$for_user_id}/updates", 1);
         }
         //Добавляем +1 юзеру для оповещания
         $cntCacheNews = mozg_cache("user_{$for_user_id}/new_gift");
         mozg_create_cache("user_{$for_user_id}/new_gift", $cntCacheNews + 1);
         mozg_mass_clear_cache_file("user_{$for_user_id}/profile_{$for_user_id}|user_{$for_user_id}/gifts");
         //Отправка уведомления на E-mail
         if ($config['news_mail_6'] == 'yes') {
             $rowUserEmail = $db->super_query("SELECT user_name, user_email FROM `" . PREFIX . "_users` WHERE user_id = '" . $for_user_id . "'");
             if ($rowUserEmail['user_email']) {
                 include_once ENGINE_DIR . '/classes/mail.php';
                 $mail = new dle_mail($config);
                 $rowMyInfo = $db->super_query("SELECT user_search_pref FROM `" . PREFIX . "_users` WHERE user_id = '" . $user_id . "'");
                 $rowEmailTpl = $db->super_query("SELECT text FROM `" . PREFIX . "_mail_tpl` WHERE id = '6'");
                 $rowEmailTpl['text'] = str_replace('{%user%}', $rowUserEmail['user_name'], $rowEmailTpl['text']);
                 $rowEmailTpl['text'] = str_replace('{%user-friend%}', $rowMyInfo['user_search_pref'], $rowEmailTpl['text']);
                 $rowEmailTpl['text'] = str_replace('{%rec-link%}', $config['home_url'] . 'gifts' . $for_user_id, $rowEmailTpl['text']);
                 $mail->send($rowUserEmail['user_email'], 'Вам отправили новый подарок', $rowEmailTpl['text']);
             }