Exemplo n.º 1
0
function viewthread_updateviews($threadtable)
{
    global $_G;
    if ($_G['setting']['delayviewcount'] == 1 || $_G['setting']['delayviewcount'] == 3) {
        $_G['forum_logfile'] = './data/cache/forum_threadviews_' . intval(getglobal('config/server/id')) . '.log';
        if (substr(TIMESTAMP, -2) == '00') {
            require_once libfile('function/misc');
            updateviews($threadtable, 'tid', 'views', $_G['forum_logfile']);
        }
        if (@($fp = fopen(DISCUZ_ROOT . $_G['forum_logfile'], 'a'))) {
            fwrite($fp, "{$_G['tid']}\n");
            fclose($fp);
        } elseif ($_G['adminid'] == 1) {
            showmessage('view_log_invalid', '', array('logfile' => $_G['forum_logfile']));
        }
    } else {
        DB::query("UPDATE LOW_PRIORITY " . DB::table($threadtable) . " SET views=views+1 WHERE tid='{$_G['tid']}'", 'UNBUFFERED');
    }
}
Exemplo n.º 2
0
                $t = $_G['gp_t'];
                if (empty($k) || empty($t) || $k != substr(md5($aid . $t . md5($_G['config']['security']['authkey'])), 0, 8) || TIMESTAMP - $t > 3600) {
                    dheader('location: forum.php?mod=misc&action=attachcredit&aid=' . $attach['aid'] . '&formhash=' . FORMHASH);
                    exit;
                }
            } else {
                showmessage('attachment_forum_nopermission', NULL, array(), array('login' => 1));
            }
        }
    }
    if (empty($_G['gp_noupdate'])) {
        if ($_G['setting']['delayviewcount'] == 2 || $_G['setting']['delayviewcount'] == 3) {
            $_G['forum_logfile'] = './data/cache/forum_attachviews_' . intval(getglobal('config/server/id')) . '.log';
            if (substr(TIMESTAMP, -1) == '0') {
                require_once libfile('function/misc');
                updateviews('forum_attachment', 'aid', 'downloads', $_G['forum_logfile']);
            }
            if (@($fp = fopen(DISCUZ_ROOT . $_G['forum_logfile'], 'a'))) {
                fwrite($fp, "{$aid}\n");
                fclose($fp);
            } elseif ($_G['adminid'] == 1) {
                showmessage('view_log_invalid', '', array('logfile' => $_G['forum_logfile']));
            }
        } else {
            DB::query("UPDATE " . DB::table('forum_attachment') . " SET downloads=downloads+'1' WHERE aid='{$aid}'", 'UNBUFFERED');
        }
    }
}
$db = DB::object();
$db->close();
!$_G['config']['output']['gzip'] && ob_end_clean();
Exemplo n.º 3
0
 function detailpage($id, $table, $module, $main_content, $menu)
 {
     $CI =& get_instance();
     $data = GetHeaderFooter(1);
     $data = GetSidebar();
     $data['main_content'] = $main_content;
     $filtercontent = array("id_lang" => "where/" . GetIDLang(), "is_publish" => "where/Publish", "id" => "where/" . $id);
     $data['content'] = $rowcontent = ViewRowQuery(GetAll($table, $filtercontent));
     $list = GetAll($table, $filtercontent);
     if ($rowcontent) {
         $contenttitle = $rowcontent['title'];
         $views = $rowcontent['views'];
         updateviews($id, $table, $views);
     } else {
         redirectswitchlang();
     }
     foreach ($list->result_array() as $f) {
         $i = 0;
         $files = "";
         $tags = explode(',', $f['tags']);
         $numItems = count($tags);
         $result = "";
         $files = "SELECT * FROM " . $table . " where id_lang = " . GetIDLang() . " and id <> " . $f['id'] . " and (";
         foreach ($tags as $tag => $val) {
             if ($val != "") {
                 $files .= " tags like '%" . $val . "%'";
                 if (++$i === $numItems) {
                     $files .= "";
                 } else {
                     $files .= " or ";
                 }
             } else {
                 $files .= " tags like '0'";
             }
         }
         $files .= ") limit 0,4";
     }
     $data['rel_link'] = $CI->db->query($files);
     $breadcrumb = "";
     $data['breadcrumb'] = $breadcrumb;
     return $data;
 }
Exemplo n.º 4
0
function viewthread_updateviews()
{
    global $delayviewcount, $timestamp, $tablepre, $tid, $db, $adminid, $thread, $do;
    if ($delayviewcount == 1 || $delayviewcount == 3) {
        $logfile = './forumdata/cache/cache_threadviews.log';
        if (substr($timestamp, -2) == '00') {
            require_once DISCUZ_ROOT . './include/misc.func.php';
            updateviews('threads', 'tid', 'views', $logfile);
        }
        if (@($fp = fopen(DISCUZ_ROOT . $logfile, 'a'))) {
            fwrite($fp, "{$tid}\n");
            fclose($fp);
        } elseif ($adminid == 1) {
            showmessage('view_log_invalid');
        }
    } else {
        $db->query("UPDATE LOW_PRIORITY {$tablepre}threads SET views=views+1 WHERE tid='{$tid}'", 'UNBUFFERED');
    }
}
Exemplo n.º 5
0
	if($redirectcredit) {
		$k = $_GET['ck'];
		$t = $_GET['t'];
		if(empty($k) || empty($t) || $k != substr(md5($aid.$t.md5($authkey)), 0, 8) || $timestamp - $t > 3600) {
			dheader('location: misc.php?action=attachcredit&aid='.$attach['aid'].'&formhash='.FORMHASH);
			exit();
		}
	}
}

if(empty($noupdate)) {
	if($delayviewcount == 2 || $delayviewcount == 3) {
		$logfile = './forumdata/cache/cache_attachviews.log';
		if(substr($timestamp, -1) == '0') {
			require_once DISCUZ_ROOT.'./include/misc.func.php';
			updateviews('attachments', 'aid', 'downloads', $logfile);
		}

		if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
			fwrite($fp, "$aid\n");
			fclose($fp);
		} elseif($adminid == 1) {
			showmessage('view_log_invalid');
		}
	} else {
		$db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');
	}
}

$db->close(); ob_end_clean();
Exemplo n.º 6
0
function viewthread_updateviews() {
	global $delayviewcount, $timestamp, $tablepre, $tid, $db, $adminid, $thread, $do;

	if($delayviewcount == 1 || $delayviewcount == 3) {
		$logfile = './forumdata/cache/cache_threadviews.log';
		if(substr($timestamp, -2) == '00') {
			require_once DISCUZ_ROOT.'./include/misc.func.php';
			updateviews('threads', 'tid', 'views', $logfile);
		}
		if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
			fwrite($fp, "$tid\n");
			fclose($fp);
		} elseif($adminid == 1) {
			showmessage('view_log_invalid');
		}
	} else {

		$db->query("UPDATE LOW_PRIORITY {$tablepre}threads SET views=views+1 WHERE tid='$tid'", 'UNBUFFERED');

		if(is_array($dzfeed_limit['thread_views']) && in_array(($thread['views'] + 1), $dzfeed_limit['thread_views'])) {
			$arg = $data = array();
			$arg['type'] = 'thread_views';
			$arg['fid'] = $thread['fid'];
			$arg['typeid'] = $thread['typeid'];
			$arg['sortid'] = $thread['sortid'];
			$arg['uid'] = $thread['authorid'];
			$arg['username'] = addslashes($thread['author']);
			$data['title']['actor'] = $thread['authorid'] ? "<a href=\"space.php?uid={$thread[authorid]}\" target=\"_blank\">{$thread[author]}</a>" : $thread['author'];
			$data['title']['forum'] = "<a href=\"forumdisplay.php?fid={$thread[fid]}\" target=\"_blank\">".$GLOBALS['forum']['name'].'</a>';
			$data['title']['count'] = $thread['replies'] + 1;
			$data['title']['subject'] = "<a href=\"viewthread.php?tid={$thread[tid]}\" target=\"_blank\">{$thread[subject]}</a>";
			add_feed($arg, $data);
		}

	}
}