0) { self::$home_cfg = unserialize($class_database->singleFieldValue('db_accountuser', 'home_cfg', 'usr_id', (int) $_SESSION['USER_ID'])); } self::$db_cache = false; //change here to enable caching } /* content layout */ public static function doLayout() { $cfg = self::$cfg; $language = self::$language; $html = '
' . self::$language['frontend.global.notifications'] . '
'; } $html .= self::userActivity($_q, $show_hidden); if ($page == 1) { $html .= ' '; } } echo $html; } /* generate subscriber activity */ private static function userActivity($_q, $show_hidden) { $html = null; $cfg = self::$cfg; $db = self::$db; $class_filter = self::$filter; $class_database = self::$dbc; $class_language = self::$class_language; $language = self::$language; $usr_id = (int) $_SESSION['USER_ID']; $page = isset($_GET['p']) ? (int) $_GET['p'] : 1; $lim = 10; $page_lim = $page > 1 ? sprintf("%s, %s", ($lim * ($page - 1)), $lim) : $lim; $display = 0; include_once $class_language->setLanguageFile('frontend', 'language.channel'); $ex = array(); $fids = array(); $q = isset($_q[0]) ? implode(' OR ', $_q) . ' OR ' : null; $sql = sprintf("SELECT `act_id` FROM `db_notifications_hidden` WHERE `usr_id`='%s';", $usr_id); $res = $db->execute($sql); if ($res->fields['act_id']) { while (!$res->EOF) { $ex[] = $res->fields['act_id']; $res->MoveNext(); } } $sql = sprintf("SELECT A.`act_id` AS `db_id`, A.`usr_id`, A.`usr_id_to`, A.`act_type`, A.`act_time`, B.`usr_key`, B.`usr_user`, B.`usr_dname`, B.`ch_title` FROM `db_useractivity` A, `db_accountuser` B WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= A.`act_time` AND %s (%sA.`usr_id_to`='%s') AND A.`usr_id`=B.`usr_id` AND A.`act_visible`='1' AND A.`act_deleted`='0' GROUP BY A.`act_id` ORDER BY A.`act_id` DESC LIMIT %s;", (($ex[0] != '' and !$show_hidden) ? "A.`act_id` NOT IN (" . implode(",", $ex) . ") AND" : null), $q, $usr_id, $page_lim); $rs = $db->execute($sql); if ($rs->fields['db_id']) { $db->execute(sprintf("UPDATE `db_notifications_count` SET `nr`=0 WHERE `usr_id`='%s' LIMIT 1;", $usr_id)); if ($db->Affected_Rows()) { $_SESSION['new_notifications'] = 0; } $html .= $page == 1 ? ''; $action_text .= $user_name . ' ' . $language["upage.act." . $action[0]]; $action_text .= '
'; $action_text .= ''; $action_text .= '' . $action[1] . ''; $action_text .= '
'; $action_text .= ''; $action_text .= '
'; $action_text .= ''; break; case "upload": case "like": case "dislike": case "favorite": case "response": $action_text = null; $title = null; if ($user_uname != $_SESSION['USER_NAME']) { $class = $action[0]; $i = $db->execute(sprintf("SELECT A.`file_title`, A.`thumb_cache`, C.`usr_key` FROM `db_%sfiles` A, `db_accountuser` C WHERE A.`usr_id`=C.`usr_id` AND A.`file_key`='%s' LIMIT 1;", $action[1], $action[2])); $title = $i->fields['file_title']; $user_key = $i->fields['usr_key']; $thumb_cache = $i->fields['thumb_cache']; $thumb_cache = $thumb_cache > 1 ? $thumb_cache : null; $url = $cfg['main_url'] . '/' . VGenerate::fileHref($action[1][0], $action[2], $title); if ($action[0] !== 'response') { $action_thumb = VGenerate::thumbSigned($action[1], $action[2], array($user_key, $thumb_cache), (3600 * 24), 0, 1); } else { $u = $db->execute(sprintf("SELECT A.`usr_key`, B.`usr_id`, C.`file_title`, C.`thumb_cache` FROM `db_accountuser` A, `db_%sresponses` B, `db_%sfiles` C WHERE B.`file_key`='%s' AND B.`file_response`='%s' AND A.`usr_id`=B.`usr_id` AND B.`file_response`=C.`file_key` LIMIT 1;", $action[1], $action[1], $action[2], $action[3])); $title2 = $u->fields['file_title']; $user_key2 = $u->fields['usr_key']; $thumb_cache = $u->fields['thumb_cache']; $action_thumb = VGenerate::thumbSigned($action[1], $action[3], array($user_key2, $thumb_cache), (3600 * 24), 0, 1); $url = $cfg['main_url'] . '/' . VGenerate::fileHref($action[1][0], $action[3], $title2); $url .= '&rs=' . md5(date("Y-m-d")); } if ($title) { $action_text .= '';
$action_text .= ' $user_uname]) . '">' . $user_name . ' ' . str_replace('##TYPE##', $language["frontend.global." . $action[1][0]], $language["upage.act." . $action[0]]) . ' ' . ($action[0] !== 'response' ? $language["frontend.global." . $action[1][0] . ($user_key == $_SESSION['USER_KEY'] ? ".y" : ".a")] : null);
$action_text .= '
' . $title . '';
$action_text .= '
'; $action_text .= '
'; $action_text .= ''; } else { $show = false; } } else { $show = false; } break; default: $_x = explode(" ", $action[0]); switch ($_x[0]) { case "comments": $action_text = null; $title = null; $class = $_x[0]; if ($_x[2] == 'channel') { $i = $db->execute(sprintf("SELECT B.`c_usr_id`, B.`c_body`, B.`c_replyto`, C.`usr_id`, C.`usr_user`, C.`usr_key`, C.`usr_dname`, C.`ch_title` FROM `db_%scomments` B, `db_accountuser` C WHERE B.`c_key`='%s' AND B.`file_key`=C.`usr_id` LIMIT 1;", $_x[2], $action[2])); if ($i->fields['c_usr_id'] != $_SESSION['USER_ID']) { $title = $i->fields['ch_title'] != '' ? $i->fields['ch_title'] : ($i->fields['usr_dname'] != '' ? $i->fields['usr_dname'] : $i->fields['usr_user']); $title = $i->fields['usr_user'] == $_SESSION['USER_NAME'] ? $language['upage.act.your.ch'] : $title; $user_key = $i->fields['usr_key']; $url = VHref::channelURL(["username" => $i->fields['usr_user']]) . '/' . VHref::getKey("discussion"); $action_thumb = VUserAccount::getProfileImage($i->fields['usr_id']); } } else { $i = $db->execute(sprintf("SELECT A.`file_title`, A.`thumb_cache`, B.`c_usr_id`, B.`c_body`, B.`c_replyto`, C.`usr_key` FROM `db_%sfiles` A, `db_%scomments` B, `db_accountuser` C WHERE A.`file_key`=B.`file_key` AND A.`usr_id`=C.`usr_id` AND B.`c_key`='%s' LIMIT 1;", $_x[2], $_x[2], $action[2])); if ($i->fields['c_usr_id'] != $_SESSION['USER_ID']) { $title = $i->fields['file_title']; $user_key = $i->fields['usr_key']; $thumb_cache = $i->fields['thumb_cache']; $thumb_cache = $thumb_cache > 1 ? $thumb_cache : null; $url = $cfg['main_url'] . '/' . VGenerate::fileHref($_x[2][0], $action[1], $title); $action_thumb = VGenerate::thumbSigned($_x[2], $action[1], array($user_key, $thumb_cache), (3600 * 24), 0, 1); } } $comment = $i->fields['c_body']; if ($title) { $action_text .= '';
$action_text .= ' $user_uname]) . '">' . $user_name . ' ' . ($i->fields['c_replyto'] == '0' ? $language['upage.act.comment'] : $language['upage.act.reply']);
$action_text .= ' ' . $title . '';
$action_text .= '
' . $comment . '';
$action_text .= '';
$action_text .= ''; $action_text .= '
'; $action_text .= ''; } else { $show = false; } break; case "subscribes": case "follows": $usr_id = $class_database->singleFieldValue('db_accountuser', 'usr_id', 'usr_user', ($_x[0] == 'subscribes' ? $_x[2] : $_x[1])); $action_text = null; $action_thumb = null; $class = $_x[0]; if ($usr_id > 0) { $_uinfo = VUserinfo::getUserInfo($usr_id); $_user_uname = $_uinfo['uname']; $_user_dname = $_uinfo['dname']; $_user_chtitle = $_uinfo['ch_title']; $_user_key = $_uinfo['key']; $_user_name = $_user_dname != '' ? $_user_dname : ($_user_chtitle != '' ? $_user_chtitle : $_user_uname); $title = $_user_name; $url = VHref::channelURL(["username" => $_user_uname]); $action_text .= ''; $action_text .= ' $user_uname]) . '">' . $user_name . ' ' . ($_x[0] == 'subscribes' ? $language['upage.act.subscribe'] : $language['upage.act.follow']); $action_text .= ($user_id_to == $_SESSION['USER_ID'] ? ' ' . $language['upage.act.your.ch'] : ' ' . $title . ''); $action_text .= '
'; $action_text .= ''; $action_text .= '
'; $action_text .= ''; } else { $show = false; } break; case "private": $action_text = null; $action_thumb = null; $title = null; $class = $_x[0]; if ($user_id_to == $_SESSION['USER_ID']) { $pm = $db->execute(sprintf("SELECT `msg_subj`, `msg_body` FROM `db_messaging` WHERE `msg_id`='%s' AND `msg_to`='%s' LIMIT 1;", (int) $action[1], $user_id_to)); $title = $pm->fields['msg_subj']; $comment = VUserinfo::truncateString($pm->fields['msg_body'], 30); $action_text .= '';
$action_text .= ' $user_uname]) . '">' . $user_name . ' ' . $language['upage.act.pmessage'];
$action_text .= ': ' . $title . '';
$action_text .= '
' . $comment . '';
$action_text .= '';
$action_text .= ''; $action_text .= '
'; $action_text .= ''; } else { $show = false; } break; case "friend": $action_text = null; $action_thumb = null; $title = null; $class = $_x[0]; if ($user_id_to == $_SESSION['USER_ID']) { $comment = str_replace('##PMSG##', '' . $language['subnav.entry.contacts.messages'] . '', $language['upage.act.check.pmg']); $action_text .= '';
$action_text .= ' $user_uname]) . '">' . $user_name . ' ' . $language['upage.act.frinvite'];
$action_text .= '
' . $comment . '';
$action_text .= '';
$action_text .= ''; $action_text .= '
'; $action_text .= ''; } else { $show = false; } break; } break; } if ($show) { $html .= ' '; $display += 1; } $rs->MoveNext(); } if ($display == 0) { $html .= '' . $language['frontend.global.notif.text1'] . '
'; $html .= '' . $language['frontend.global.notif.text2'] . '
'; $html .= '