当前位置: 首页>>代码示例>>PHP>>正文


PHP renum函数代码示例

本文整理汇总了PHP中renum函数的典型用法代码示例。如果您正苦于以下问题:PHP renum函数的具体用法?PHP renum怎么用?PHP renum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了renum函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteposts

function deleteposts($tagid, $pids)
{
    global $_SGLOBAL;
    //整理
    $nums = renum($postnums);
    foreach ($nums[0] as $pnum) {
        $_SGLOBAL['db']->query("UPDATE " . tname('thread') . " SET replynum=replynum-{$pnum} WHERE tid IN (" . simplode($tids) . ")");
    }
    //删除
    $_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE pid IN (" . simplode($pids) . ")");
    return true;
}
开发者ID:shiyake,项目名称:php-ihome,代码行数:12,代码来源:do_deletetopic.php

示例2: deleteposts

function deleteposts($tagid, $pids)
{
    global $_SGLOBAL;
    //统计
    $postnums = $mpostnums = $tids = $delposts = $newids = $spaces = array();
    $ismanager = $allowmanage = checkperm('managethread');
    $managebatch = checkperm('managebatch');
    $delnum = 0;
    //群主
    $wheresql = '';
    if (empty($allowmanage) && $tagid) {
        $mtag = getmtag($tagid);
        if ($mtag['grade'] >= 8) {
            $allowmanage = 1;
            $managebatch = 1;
            $wheresql = " AND p.tagid='{$tagid}'";
        }
    }
    //获取积分
    $reward = getreward('delcomment', 0);
    $query = $_SGLOBAL['db']->query("SELECT p.* FROM " . tname('post') . " p WHERE p.pid IN (" . simplode($pids) . ") {$wheresql} ORDER BY p.isthread DESC");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($allowmanage || $value['uid'] == $_SGLOBAL['supe_uid']) {
            if (!$managebatch && $value['uid'] != $_SGLOBAL['supe_uid']) {
                $delnum++;
            }
            $postarr[] = $value;
        }
    }
    if (!$managebatch && $delnum > 1) {
        return array();
    }
    foreach ($postarr as $key => $value) {
        if ($value['isthread']) {
            $tids[] = $value['tid'];
        } else {
            if (!in_array($value['tid'], $tids)) {
                $newids[] = $value['pid'];
                $delposts[] = $value;
                $postnums[$value['tid']]++;
                if ($ismanager && $value['uid'] != $_SGLOBAL['supe_uid']) {
                    //扣除积分
                    $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET credit=credit-{$reward['credit']}, experience=experience-{$reward['experience']} WHERE uid='{$value['uid']}'");
                }
            }
        }
    }
    $delthreads = array();
    if ($tids) {
        $delthreads = deletethreads($tagid, $tids);
    }
    if (empty($delposts)) {
        return $delthreads;
    }
    //整理
    $nums = renum($postnums);
    foreach ($nums[0] as $pnum) {
        $_SGLOBAL['db']->query("UPDATE " . tname('thread') . " SET replynum=replynum-{$pnum} WHERE tid IN (" . simplode($nums[1][$pnum]) . ")");
    }
    //删除
    $_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE pid IN (" . simplode($newids) . ")");
    return $delposts;
}
开发者ID:NaturalWill,项目名称:UCQA,代码行数:63,代码来源:function_delete.php

示例3: album_picnum_stat

function album_picnum_stat($start, $perpage)
{
    global $_G;
    $next = false;
    $updates = array();
    $query = C::t('home_album')->range($start, $perpage);
    foreach ($query as $value) {
        $next = true;
        $count = C::t('home_pic')->check_albumpic($value['albumid']);
        if ($count != $value['picnum']) {
            $updates[$value['albumid']] = $count;
        }
    }
    if (empty($updates)) {
        return $next;
    }
    $nums = renum($updates);
    foreach ($nums[0] as $count) {
        C::t('home_album')->update($nums[1][$count], array('picnum' => $count));
    }
    return $next;
}
开发者ID:softhui,项目名称:discuz,代码行数:22,代码来源:function_admincp.php

示例4: album_picnum_stat

function album_picnum_stat($start, $perpage)
{
    global $_G;
    $next = false;
    $updates = array();
    $query = DB::query("SELECT albumid, picnum FROM " . DB::table('home_album') . " LIMIT {$start},{$perpage}");
    while ($value = DB::fetch($query)) {
        $next = true;
        $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('home_pic') . " WHERE albumid='{$value['albumid']}'"), 0);
        if ($count != $value['picnum']) {
            $updates[$value['albumid']] = $count;
        }
    }
    if (empty($updates)) {
        return $next;
    }
    $nums = renum($updates);
    foreach ($nums[0] as $count) {
        DB::query("UPDATE " . DB::table('home_album') . " SET picnum={$count} WHERE albumid IN (" . dimplode($nums[1][$count]) . ")");
    }
    return $next;
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:22,代码来源:function_admincp.php

示例5: deletecomments

function deletecomments($cids)
{
    global $_G;
    $blognums = $newcids = $dels = $counts = array();
    $allowmanage = checkperm('managecomment');
    $query = C::t('home_comment')->fetch_all($cids);
    $deltypes = array();
    foreach ($query as $value) {
        if ($allowmanage || $value['authorid'] == $_G['uid'] || $value['uid'] == $_G['uid']) {
            $dels[] = $value;
            $newcids[] = $value['cid'];
            $deltypes[] = $value['idtype'] . '_cid';
            if ($value['authorid'] != $_G['uid'] && $value['uid'] != $_G['uid']) {
                $counts[$value['authorid']]['coef'] -= 1;
            }
            if ($value['idtype'] == 'blogid') {
                $blognums[$value['id']]++;
            }
        }
    }
    if (empty($dels)) {
        return array();
    }
    C::t('home_comment')->delete($newcids);
    for ($i = 0; $i < count($newcids); $i++) {
        C::t('common_moderate')->delete($newcids[$i], $deltypes[$i]);
    }
    if ($counts) {
        foreach ($counts as $uid => $setarr) {
            batchupdatecredit('comment', $uid, array(), $setarr['coef']);
        }
    }
    if ($blognums) {
        $nums = renum($blognums);
        foreach ($nums[0] as $num) {
            C::t('home_blog')->increase($nums[1][$num], 0, array('replynum' => -$num));
        }
    }
    return $dels;
}
开发者ID:softhui,项目名称:discuz,代码行数:40,代码来源:function_delete.php

示例6: exit

if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$perbatch = 200;
$logs = array();
$maxnum = $maxlogid = 0;
$query = DB::query("SELECT logid, id, idtype FROM " . DB::table('viewlog') . " ORDER BY logid ASC LIMIT 0,{$perbatch}");
while ($value = DB::fetch($query)) {
    $logs[$value['idtype']][$value['id']]++;
    $maxnum++;
    $maxlogid = $value['logid'];
}
if ($maxnum) {
    if ($maxnum < $perbatch) {
        DB::query("TRUNCATE TABLE " . DB::table('viewlog'));
    } else {
        DB::query("DELETE FROM " . DB::table('viewlog') . " WHERE logid<='{$maxlogid}'");
    }
}
if ($logs['uid']) {
    $nums = renum($logs['uid']);
    foreach ($nums[0] as $num) {
        DB::query("UPDATE " . DB::table('common_member') . " SET viewnum=viewnum+{$num} WHERE uid IN (" . dimplode($nums[1][$num]) . ")");
    }
}
if ($logs['blogid']) {
    $nums = renum($logs['blogid']);
    foreach ($nums[0] as $num) {
        DB::query("UPDATE " . DB::table('home_blog') . " SET viewnum=viewnum+{$num} WHERE blogid IN (" . dimplode($nums[1][$num]) . ")");
    }
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:31,代码来源:cron_viewlog.php

示例7: deletecomments

function deletecomments($cids)
{
    global $_G;
    $blognums = $newcids = $dels = $counts = array();
    $allowmanage = checkperm('managecomment');
    $query = DB::query("SELECT * FROM " . DB::table('home_comment') . " WHERE cid IN (" . dimplode($cids) . ")");
    while ($value = DB::fetch($query)) {
        if ($allowmanage || $value['authorid'] == $_G['uid'] || $value['uid'] == $_G['uid']) {
            $dels[] = $value;
            $newcids[] = $value['cid'];
            if ($value['authorid'] != $_G['uid'] && $value['uid'] != $_G['uid']) {
                $counts[$value['authorid']]['coef'] -= 1;
            }
            if ($value['idtype'] == 'blogid') {
                $blognums[$value['id']]++;
            }
        }
    }
    if (empty($dels)) {
        return array();
    }
    DB::delete('home_comment', "cid IN (" . dimplode($newcids) . ")");
    DB::delete('common_moderate', "id IN (" . dimplode($newcids) . ") AND idtype='cid'");
    if ($counts) {
        foreach ($counts as $uid => $setarr) {
            batchupdatecredit('comment', $uid, array(), $setarr['coef']);
        }
    }
    if ($blognums) {
        $nums = renum($blognums);
        foreach ($nums[0] as $num) {
            DB::query("UPDATE " . DB::table('home_blog') . " SET replynum=replynum-{$num} WHERE blogid IN (" . dimplode($nums[1][$num]) . ")");
        }
    }
    return $dels;
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:36,代码来源:function_delete.php

示例8: tag_blognum_stat

function tag_blognum_stat($start, $perpage) {
	global $_SGLOBAL;
	
	$next = false;
	$updates = array();
	$query = $_SGLOBAL['db']->query("SELECT tagid, blognum FROM ".tname('tag')." LIMIT $start,$perpage");
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		$next = true;
		$count = getcount('tagblog', array('tagid'=>$value['tagid']));
		if($count != $value['blognum']) {
			$updates[$value['tagid']] = $count;
		}
	}
	if(empty($updates)) return $next;

	$nums = renum($updates);
	foreach ($nums[0] as $count) {
		$_SGLOBAL['db']->query("UPDATE ".tname('tag')." SET blognum=$count WHERE tagid IN (".simplode($nums[1][$count]).")");
	}
	return $next;
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:21,代码来源:function_stat.php

示例9: updatespaces

function updatespaces($spaces, $type)
{
    global $_SGLOBAL;
    //空间数据
    if (!($credit = creditrule('pay', $type))) {
        return false;
        //删除不扣分
    }
    $nums = renum($spaces);
    foreach ($nums[0] as $num) {
        //积分
        $newcredit = $num * $credit;
        $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET credit=credit-{$newcredit} WHERE uid IN (" . simplode($nums[1][$num]) . ")");
    }
}
开发者ID:xiaoxiaoleo,项目名称:ngintek,代码行数:15,代码来源:function_delete.php

示例10: die

    die("invoice does not exist");
}
if (!in_array($action, $authorized)) {
    die("action does not exist");
}
function renum($id_facture, $id_facture_ligne, $order = 'DESC')
{
    $sens = $order == 'DESC' ? '<=' : '>=';
    $query = sprintf("SELECT id_facture_ligne, ordre " . "FROM webfinance_invoice_rows " . "WHERE id_facture = %d " . "AND ordre %s (" . "   SELECT ordre " . "   FROM webfinance_invoice_rows " . "   WHERE id_facture_ligne = %d " . ") " . "ORDER BY ordre %s LIMIT 2", $id_facture, $sens, $id_facture_ligne, $order);
    $result = mysql_query($query);
    if (mysql_num_rows($result) != 2) {
        return false;
    }
    $query = "UPDATE webfinance_invoice_rows " . "SET ordre = %d " . "WHERE id_facture_ligne = %d ";
    mysql_query(sprintf($query, mysql_result($result, 0, "ordre"), mysql_result($result, 1, "id_facture_ligne"))) or wf_mysqldie();
    mysql_query(sprintf($query, mysql_result($result, 1, "ordre"), mysql_result($result, 0, "id_facture_ligne"))) or wf_mysqldie();
}
switch ($action) {
    case "raise":
        renum($id_facture, $id_facture_ligne);
        break;
    case "lower":
        renum($id_facture, $id_facture_ligne, 'ASC');
        break;
    case "delete":
        $query = "DELETE FROM webfinance_invoice_rows WHERE id_facture_ligne=" . $id_facture_ligne;
        mysql_query($query) or wf_mysqldie();
        break;
}
header('Location: /prospection/edit_facture.php?id_facture=' . $id_facture . '&id_facture_ligne=' . $id_facture_ligne);
exit;
开发者ID:lopacinski,项目名称:WebFinance,代码行数:31,代码来源:change_rows.php


注:本文中的renum函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。