function usesubmit()
 {
     global $_G;
     $id = intval($_GET['id']);
     $idtype = $_GET['idtype'];
     magic_check_idtype($id, $idtype);
     $tablename = gettablebyidtype($idtype);
     C::t($tablename)->update_dateline_by_id_idtype_uid($id, $idtype, $_G['timestamp'], $_G['uid']);
     C::t('home_feed')->update($id, array('dateline' => $_G['timestamp']), $idtype, $_G['uid']);
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
     showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['updateline']), array('alert' => 'right', 'showdialog' => 1));
 }
 function usesubmit()
 {
     global $_G;
     $id = intval($_G['gp_id']);
     $idtype = $_G['gp_idtype'];
     magic_check_idtype($id, $idtype);
     $tablename = gettablebyidtype($idtype);
     DB::query("UPDATE " . DB::table($tablename) . " SET dateline = '{$_G['timestamp']}' WHERE {$idtype} = '{$id}' AND uid = '{$_G['uid']}'");
     DB::query("UPDATE " . DB::table('home_feed') . " SET dateline = '{$_G['timestamp']}' WHERE id = '{$id}' AND idtype = '{$idtype}' AND uid = '{$_G['uid']}'");
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
     showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['updateline']), array('showdialog' => 1));
 }
Beispiel #3
0
 function usesubmit()
 {
     global $_G;
     $id = intval($_GET['id']);
     $idtype = $_GET['idtype'];
     $blog = magic_check_idtype($id, $idtype);
     $newdateline = strtotime($_POST['newdateline']);
     if (!$_POST['newdateline'] || $newdateline < strtotime('1970-1-1') || $newdateline > $blog['dateline']) {
         showmessage('magicuse_bad_dateline');
     }
     $tablename = gettablebyidtype($idtype);
     C::t($tablename)->update_dateline_by_id_idtype_uid($id, $idtype, $newdateline, $_G['uid']);
     C::t('home_feed')->update($id, array('dateline' => $newdateline), $idtype, $_G['uid']);
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
     showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['downdateline']), array('alert' => 'right', 'showdialog' => 1));
 }
 function usesubmit()
 {
     global $_G;
     $id = intval($_G['gp_id']);
     $idtype = $_G['gp_idtype'];
     $blog = magic_check_idtype($id, $idtype);
     $newdateline = strtotime($_POST['newdateline']);
     if (!$_POST['newdateline'] || $newdateline < strtotime('1970-1-1') || $newdateline > $blog['dateline']) {
         showmessage('magicuse_bad_dateline');
     }
     $tablename = gettablebyidtype($idtype);
     DB::query("UPDATE " . DB::table($tablename) . " SET dateline='{$newdateline}' WHERE {$idtype}='{$id}' AND uid='{$_G['uid']}'");
     DB::query("UPDATE " . DB::table('home_feed') . " SET dateline='{$newdateline}' WHERE id='{$id}' AND idtype='{$idtype}' AND uid='{$_G['uid']}'");
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
     showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['downdateline']), array('showdialog' => 1));
 }
function hot_update($idtype, $id, $hotuser) {
	global $_SGLOBAL, $_SCONFIG;
	
	$hotusers = empty($hotuser)?array():explode(',', $hotuser);
	if($hotusers && in_array($_SGLOBAL['supe_uid'], $hotusers)) {
		return false;//已经参与
	} else {
		$hotusers[] = $_SGLOBAL['supe_uid'];
		$hotuser = implode(',', $hotusers);
	}
	
	$newhot = count($hotusers)+1;
	if($newhot == $_SCONFIG['feedhotmin']) {
		//奖励
		$tablename = gettablebyidtype($idtype);
		$query = $_SGLOBAL['db']->query("SELECT uid FROM ".tname($tablename)." WHERE $idtype='$id'");
		$item = $_SGLOBAL['db']->fetch_array($query);
		getreward('hotinfo', 1, $item['uid'], '', 0);
	}

	switch ($idtype) {
		case 'blogid':
			$_SGLOBAL['db']->query("UPDATE ".tname('blogfield')." SET hotuser='******' WHERE blogid='$id'");
			$_SGLOBAL['db']->query("UPDATE ".tname('blog')." SET hot=hot+1 WHERE blogid='$id'");
			break;
		case 'tid':
			$_SGLOBAL['db']->query("UPDATE ".tname('post')." SET hotuser='******' WHERE tid='$id' AND isthread='1'");
			$_SGLOBAL['db']->query("UPDATE ".tname('thread')." SET hot=hot+1 WHERE tid='$id'");
			break;
		case 'picid':
			$_SGLOBAL['db']->query("REPLACE INTO ".tname('picfield')." (picid, hotuser) VALUES ('$id', '$hotuser')");
			$_SGLOBAL['db']->query("UPDATE ".tname('pic')." SET hot=hot+1 WHERE picid='$id'");
			break;
		case 'eventid':
			$_SGLOBAL['db']->query("UPDATE ".tname('eventfield')." SET hotuser='******' WHERE eventid='$id'");
			$_SGLOBAL['db']->query("UPDATE ".tname('event')." SET hot=hot+1 WHERE eventid='$id'");
			break;
		case 'sid':
			$_SGLOBAL['db']->query("UPDATE ".tname('share')." SET hot=hot+1, hotuser='******' WHERE sid='$id'");
			break;
		case 'pid':
			$_SGLOBAL['db']->query("UPDATE ".tname('pollfield')." SET hotuser='******' WHERE pid='$id'");
			$_SGLOBAL['db']->query("UPDATE ".tname('poll')." SET hot=hot+1 WHERE pid='$id'");
			break;
		default:
			return false;//其他类型不支持
	}
	//feed热度
	$query = $_SGLOBAL['db']->query("SELECT feedid, friend FROM ".tname('feed')." WHERE id='$id' AND idtype='$idtype'");
	if($feed = $_SGLOBAL['db']->fetch_array($query)) {
		if(empty($feed['friend'])) {//隐私
			$_SGLOBAL['db']->query("UPDATE ".tname('feed')." SET hot=hot+1 WHERE feedid='$feed[feedid]'");
		}
	} elseif($idtype == 'picid') {
		//图片
		include_once(S_ROOT.'./source/function_feed.php');
		feed_publish($id, $idtype);
	}

	return true;
}
function hot_update($idtype, $id, $hotuser)
{
    global $_G;
    $hotusers = empty($hotuser) ? array() : explode(',', $hotuser);
    if ($hotusers && in_array($_G['uid'], $hotusers)) {
        return false;
    } else {
        $hotusers[] = $_G['uid'];
        $hotuser = implode(',', $hotusers);
    }
    $newhot = count($hotusers) + 1;
    if ($newhot == $_G['setting']['feedhotmin']) {
        $tablename = gettablebyidtype($idtype);
        $query = DB::query("SELECT uid FROM " . DB::table($tablename) . " WHERE {$idtype}='{$id}'");
        $item = DB::fetch($query);
        updatecreditbyaction('hotinfo', $item['uid']);
    }
    switch ($idtype) {
        case 'blogid':
            DB::query("UPDATE " . DB::table('home_blogfield') . " SET hotuser='******' WHERE blogid='{$id}'");
            DB::query("UPDATE " . DB::table('home_blog') . " SET hot=hot+1 WHERE blogid='{$id}'");
            break;
        case 'picid':
            DB::query("REPLACE INTO " . DB::table('home_picfield') . " (picid, hotuser) VALUES ('{$id}', '{$hotuser}')");
            DB::query("UPDATE " . DB::table('home_pic') . " SET hot=hot+1 WHERE picid='{$id}'");
            break;
        case 'sid':
            DB::query("UPDATE " . DB::table('home_share') . " SET hot=hot+1, hotuser='******' WHERE sid='{$id}'");
            break;
        default:
            return false;
    }
    $query = DB::query("SELECT feedid, friend FROM " . DB::table('home_feed') . " WHERE id='{$id}' AND idtype='{$idtype}'");
    if ($feed = DB::fetch($query)) {
        if (empty($feed['friend'])) {
            DB::query("UPDATE " . DB::table('home_feed') . " SET hot=hot+1 WHERE feedid='{$feed['feedid']}'");
        }
    } elseif ($idtype == 'picid') {
        require_once libfile('function/feed');
        feed_publish($id, $idtype);
    }
    return true;
}
function magic_check_idtype($id, $idtype)
{
    global $_G;
    include_once libfile('function/spacecp');
    $value = '';
    $tablename = gettablebyidtype($idtype);
    if ($tablename) {
        $value = C::t($tablename)->fetch_by_id_idtype($id);
        if ($value['uid'] != $_G['uid']) {
            $value = null;
        }
    }
    if (empty($value)) {
        showmessage('magicuse_bad_object');
    }
    return $value;
}
Beispiel #8
0
function hot_update($idtype, $id, $hotuser)
{
    global $_G;
    $hotusers = empty($hotuser) ? array() : explode(',', $hotuser);
    if ($hotusers && in_array($_G['uid'], $hotusers)) {
        return false;
    } else {
        $hotusers[] = $_G['uid'];
        $hotuser = implode(',', $hotusers);
    }
    $hotuser = daddslashes($hotuser);
    $newhot = count($hotusers) + 1;
    if ($newhot == $_G['setting']['feedhotmin']) {
        $tablename = gettablebyidtype($idtype);
        if ($tablename) {
            $item = C::t($tablename)->fetch_by_id_idtype($id);
            $itemuid = $item['uid'];
            updatecreditbyaction('hotinfo', $itemuid);
        }
    }
    switch ($idtype) {
        case 'blogid':
            C::t('home_blogfield')->update($id, array('hotuser' => $hotuser));
            C::t('home_blog')->increase($id, 0, array('hot' => 1));
            break;
        case 'picid':
            C::t('home_picfield')->insert(array('picid' => $id, 'hotuser' => $hotuser), 0, 1);
            C::t('home_pic')->update_hot($id);
            break;
        case 'sid':
            C::t('home_share')->update_hot_by_sid($id, $hotuser);
            break;
        default:
            return false;
    }
    if ($feed = C::t('home_feed')->fetch($id, $idtype)) {
        if (empty($feed['friend'])) {
            C::t('home_feed')->update_hot_by_feedid($feed['feedid'], 1);
        }
    } elseif ($idtype == 'picid') {
        require_once libfile('function/feed');
        feed_publish($id, $idtype);
    }
    return true;
}
<?php

if (!defined('iBUAA')) {
    exit('Access Denied');
}
//检查参数
$blog = magic_check_idtype($id, $idtype);
//时空机
if (submitcheck("usesubmit")) {
    $newdateline = sstrtotime($_POST['newdateline']);
    if (!$_POST['newdateline'] || $newdateline < sstrtotime('1970-1-1') || $newdateline > $blog['dateline']) {
        showmessage('magicuse_bad_dateline');
        //输入的时间无效
    }
    //修改对象时间
    $tablename = gettablebyidtype($idtype);
    $_SGLOBAL['db']->query("UPDATE " . tname($tablename) . " SET dateline='{$newdateline}' WHERE {$idtype}='{$id}' AND uid='{$_SGLOBAL['supe_uid']}'");
    //同时修改feed的时间
    $_SGLOBAL['db']->query("UPDATE " . tname('feed') . " SET dateline='{$newdateline}' WHERE id='{$id}' AND idtype='{$idtype}' AND uid='{$_SGLOBAL['supe_uid']}'");
    magic_use($mid, array('id' => $id, 'idtype' => $idtype), true);
    showmessage('magicuse_success', $_POST['refer'], 0);
}
Beispiel #10
0
            $setarr['body_general'] = trim($_POST['body_general']);
        }
        $setarr['image_1'] = trim($_POST['image_1']);
        $setarr['image_1_link'] = trim($_POST['image_1_link']);
        $setarr['image_2'] = trim($_POST['image_2']);
        $setarr['image_2_link'] = trim($_POST['image_2_link']);
        $setarr['image_3'] = trim($_POST['image_3']);
        $setarr['image_3_link'] = trim($_POST['image_3_link']);
        $setarr['image_4'] = trim($_POST['image_4']);
        $setarr['image_4_link'] = trim($_POST['image_4_link']);
        $setarr['dateline'] = $newtimestamp;
        $setarr['hot'] = intval($_POST['hot']);
        updatetable('feed', $setarr, array('feedid' => $feedid));
        if ($setarr['hot'] && $_POST['id'] && $_POST['idtype']) {
            include_once S_ROOT . './source/function_cp.php';
            if ($tablename = gettablebyidtype($_POST['idtype'])) {
                updatetable($tablename, array('hot' => $setarr['hot']), array($_POST['idtype'] => $_POST['id']));
            }
        }
    }
    cpmessage('do_success', 'admincp.php?ac=feed&feedid=' . $feedid);
} elseif (submitcheck('deletesubmit')) {
    include_once S_ROOT . './source/function_delete.php';
    if (!empty($_POST['ids']) && deletefeeds($_POST['ids'])) {
        cpmessage('do_success', $_POST['mpurl']);
    } else {
        cpmessage('choose_to_delete_events', $_POST['mpurl']);
    }
}
if ($_GET['op'] == 'add') {
    if (!$allowmanage) {
Beispiel #11
0
function magic_check_idtype($id, $idtype)
{
    global $_G;
    include_once libfile('function/spacecp');
    $value = '';
    $tablename = gettablebyidtype($idtype);
    if ($tablename) {
        $query = DB::query('SELECT * FROM ' . DB::table($tablename) . " WHERE uid='{$_G['uid']}' AND {$idtype}='{$id}'");
        $value = DB::fetch($query);
    }
    if (empty($value)) {
        showmessage('magicuse_bad_object');
    }
    return $value;
}
Beispiel #12
0
function magic_check_idtype($id, $idtype)
{
    global $_SGLOBAL;
    //检查场合
    $value = '';
    $tablename = gettablebyidtype($idtype);
    if ($tablename) {
        $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($tablename) . " WHERE {$idtype}='{$id}' AND uid = '{$_SGLOBAL['supe_uid']}'");
        $value = $_SGLOBAL['db']->fetch_array($query);
    }
    if (empty($value)) {
        showmessage('magicuse_bad_object');
    }
    return $value;
}