Пример #1
0
                $nowfp = $offset / ($dbtdsize + 1);
                if ($node != 'NULL') {
                    fputin($fp, $node, $dbtdsize, $nowfp);
                }
                if ($node != $nowfp) {
                    fputin($fp, $nowfp, $dbtdsize, 'node', $node, Y);
                }
                /*添加数据*/
            }
            fclose($fp);
        }
    }
}
if ($yestime != $tdtime) {
    //* P_unlink($filename);
    pwCache::deleteData($filename);
    pwCache::setData($filename, str_pad("<?php die;?>\tNULL\t{$tdtime}\t", $dbtdsize) . "\n");
    /*24小时初始化一次*/
}
function fputin($fp, $offset, $dbtdsize, $prior = 'M', $next = 'M', $ifadd = 'N')
{
    $offset = $offset * ($dbtdsize + 1);
    /*将行数转换成指针偏移量*/
    fseek($fp, $offset, SEEK_SET);
    if ($ifadd == 'N') {
        $iddata = fread($fp, $dbtdsize);
        $idarray = explode("\t", $iddata);
        fseek($fp, $offset, SEEK_SET);
    }
    if ($next != 'M' && $prior != 'M') {
        /*说明这一数据是被更改的数据段.需要对其他辅助信息进行更改*/
Пример #2
0
                    //更新缓存
                    updatecache_w();
                    //设置字典文件
                    setAllDictionary();
                    //重定向
                    $jumpurl = "{$basename}" . "&action=setting&importshow=1&success=" . $success . "&fail=" . $fail;
                    $show = <<<EOT
<script type="text/javascript">
\tlocation.href = "{$jumpurl}";
</script>
EOT;
                    echo $show;
                } else {
                    adminmsg('upload_error');
                }
                pwCache::deleteData($source);
            }
        } else {
            define('AJAX', 1);
            S::gp(array('class'));
            $class = (int) $class;
            $classdb = array();
            $sql = "SELECT * FROM pw_filter_class WHERE state=1";
            $query = $db->query($sql);
            while ($rt = $db->fetch_array($query)) {
                HtmlConvert($rt);
                $classdb[$rt['id']] = $rt;
            }
            $ajax_basename = EncodeUrl($basename . "&action=class&job=import");
            include_once PrintEot('filterAjax');
            ajax_footer();
Пример #3
0
/**
 * 更新文章列表
 */
function updateArticleHits()
{
    global $hitsize, $hitfile, $db;
    if (file_exists($hitfile)) {
        if (!$hitsize) {
            $hitsize = @filesize($hitfile);
        }
        if ($hitsize < 10240) {
            $hitarray = explode("\t", readover($hitfile));
            $hits = array_count_values($hitarray);
            $count = 0;
            $hits_a = '';
            foreach ($hits as $key => $val) {
                $hits_a .= ",('{$key}','{$val}')";
                if (++$count > 300) {
                    break;
                }
            }
            if ($hits_a) {
                $hits_a = trim($hits_a, ', ');
                $db->query("CREATE TEMPORARY TABLE heap_hitupdate (article_id INT(10) UNSIGNED NOT NULL ,hits SMALLINT(6) UNSIGNED NOT NULL) TYPE = HEAP");
                $db->update("INSERT INTO heap_hitupdate (article_id,hits) VALUES {$hits_a}");
                $db->update("UPDATE pw_cms_articleextend as a, heap_hitupdate as h SET a.hits = a.hits+h.hits WHERE a.article_id=h.article_id");
                $db->query("DELETE FROM heap_hitupdate");
            }
            unset($hitarray, $hits, $hits_a);
        }
        pwCache::deleteData($hitfile);
    }
}
Пример #4
0
 function delTopic($readdb, $recycle = false, $delCredit = true, $extra = array())
 {
     global $db, $db_htmdir, $db_guestread, $windid, $db_ifpwcache, $db_creditset, $timestamp, $onlineip, $credit;
     if ($db_guestread) {
         require_once R_P . 'require/guestfunc.php';
     }
     require_once R_P . 'require/credit.php';
     $updatetop = 0;
     $kmdTids = $specialdb = $tids = $fids = $ttable_a = $ptable_a = $recycledb = $deluids = $delutids = $cydb = $modeldb = $pcdb = $activityDb = array();
     foreach ($readdb as $key => $read) {
         $isInRecycle = $read['fid'] == 0 && $read['ifcheck'] == 1;
         $msg_delrvrc = $msg_delmoney = 0;
         if ($delCredit && !$isInRecycle) {
             /* 删除积分 */
             $creditset = $this->getcreditset($read['fid']);
             $credit->addLog('topic_Delete', $creditset['Delete'], array('uid' => $read['authorid'], 'username' => $read['author'], 'ip' => $onlineip, 'fname' => strip_tags($this->getForumInfo($read['fid'], 'name')), 'operator' => $windid));
             $credit->sets($read['authorid'], $creditset['Delete'], false);
             $msg_delrvrc = abs($creditset['Delete']['rvrc']);
             $msg_delmoney = abs($creditset['Delete']['money']);
         }
         /*记录日志 */
         $logdb[] = array('type' => 'delete', 'username1' => $read['author'], 'username2' => $windid, 'field1' => $read['fid'], 'field2' => $read['tid'], 'field3' => '', 'descrip' => 'del_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'affect' => "{$GLOBALS[db_rvrcname]}:-{$msg_delrvrc},{$GLOBALS[db_moneyname]}:-{$msg_delmoney}", 'tid' => $read['tid'], 'subject' => substrs($read['subject'], 28), 'reason' => $extra['reason']);
         if ($read['modelid']) {
             $modeldb[$read['modelid']][] = $read['tid'];
         } elseif ($read['special'] == 8) {
             //活动
             $activityDb[] = $read['tid'];
         } elseif ($read['special'] > 20) {
             $pcdb[$read['special']][] = $read['tid'];
         } elseif ($read['special'] == 6) {
             $robbuildTids[] = $read['tid'];
         }
         if ($read['special'] > 0 && $read['special'] < 5) {
             $specialdb[$read['special']][] = $read['tid'];
         }
         if ($read['tpcstatus'] && getstatus($read['tpcstatus'], 1)) {
             $cydb[] = $read['tid'];
         }
         $htmurl = R_P . $db_readdir . '/' . $read['fid'] . '/' . date('ym', $read['postdate']) . '/' . $read['tid'] . '.html';
         if (file_exists($htmurl)) {
             P_unlink($htmurl);
         }
         if ($db_guestread) {
             clearguestcache($read['tid'], $read['replies']);
         }
         if ($recycle) {
             $recycledb[] = array('pid' => 0, 'tid' => $read['tid'], 'fid' => $read['fid'], 'deltime' => $GLOBALS['timestamp'], 'admin' => $GLOBALS['windid']);
         }
         $read['specialsort'] > 0 && ($updatetop = 1);
         $read['specialsort'] == PW_THREADSPECIALSORT_KMD && ($kmdTids[] = $read['tid']);
         $ttable_a[GetTtable($read['tid'])] = 1;
         $ptable_a[$read['ptable']] = 1;
         $fids[$read['fid']]['tids'][] = $read['tid'];
         !$isInRecycle && $deluids[$read['authorid']]++;
         if ($read['fid'] > 0 && $read['ifcheck'] < 2) {
             $fids[$read['fid']]['replies'] += $read['replies'];
             if ($read['ifcheck']) {
                 $fids[$read['fid']]['topic']++;
                 $delutids[$read['authorid']][] = $read['tid'];
             }
         }
         $tids[] = $read['tid'];
     }
     if (!$tids) {
         return true;
     }
     require_once R_P . 'require/updateforum.php';
     $deltids = S::sqlImplode($tids);
     /*写操作日志 */
     require_once R_P . 'require/writelog.php';
     foreach ($logdb as $key => $val) {
         writelog($val);
     }
     if ($cydb) {
         $this->_reCountColony($cydb);
     }
     if ($recycle) {
         //$this->db->update("UPDATE pw_threads SET fid='0',ifcheck='1',topped='0' WHERE tid IN($deltids)");
         pwQuery::update('pw_threads', 'tid IN (:tid)', array($tids), array('fid' => '0', 'ifcheck' => '1', 'topped' => '0'));
         //这里的$tid是还未过滤的$deltids
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("UPDATE $pw_posts SET fid='0' WHERE tid IN($deltids)");
             pwQuery::update($pw_posts, 'tid IN(:tid)', array($tids), array('fid' => '0'));
         }
         if ($recycledb) {
             $this->db->update("REPLACE INTO pw_recycle (pid,tid,fid,deltime,admin) VALUES " . S::sqlMulti($recycledb));
         }
         // ThreadManager reflesh memcache
         /*
         $threadlist = L::loadClass("threadlist", 'forum');
         foreach ($fids as $fid => $value) {
         	$threadlist->refreshThreadIdsByForumId($fid);
         }
         
         $threads = L::loadClass('Threads', 'forum');
         $threads->delThreads($tids);
         */
         Perf::gatherInfo('changeThreadWithForumIds', array('fid' => array_keys($fids)));
         Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $tids));
         if ($modeldb) {
             $this->_RecycleModelTopic($modeldb);
         }
         if ($activityDb) {
             $this->_RecycleActivityTopic($activityDb);
         }
         if ($pcdb) {
             $this->_RecyclePcTopic($pcdb);
         }
     } else {
         //* $threadManager = L::loadClass("threadmanager", 'forum'); /* @var $threadManager PW_ThreadManager */
         $threadService = L::loadclass('threads', 'forum');
         foreach ($fids as $fid => $value) {
             //* $threadManager->deleteByThreadIds($fid, $value['tids']);
             $threadService->deleteByThreadIds($value['tids']);
             Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
         }
         foreach ($ttable_a as $pw_tmsgs => $val) {
             //* $this->db->update("DELETE FROM $pw_tmsgs WHERE tid IN($deltids)");
             pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($tids));
         }
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("DELETE FROM $pw_posts WHERE tid IN($deltids)");
             pwQuery::delete($pw_posts, 'tid IN(:tid)', array($tids));
         }
         if ($specialdb) {
             $this->_delSpecialTopic($specialdb);
         }
         if ($modeldb) {
             $this->_delModelTopic($modeldb);
         }
         if ($activityDb) {
             $this->_delActivityTopic($activityDb);
         }
         if ($pcdb) {
             $this->_delPcTopic($pcdb);
         }
         if ($robbuildTids) {
             $robbuildService = L::loadClass("robbuild", 'forum');
             $robbuildService->deleteByTids($robbuildTids);
         }
         if ($cydb) {
             $this->db->update("DELETE FROM pw_argument WHERE tid IN(" . S::sqlImplode($cydb) . ')');
         }
         delete_tag($deltids);
     }
     /* 删除微博 */
     $weiboService = L::loadClass('weibo', 'sns');
     /* @var $weiboService PW_Weibo */
     $weibos = $weiboService->getWeibosByObjectIdsAndType($tids, 'article');
     if ($weibos) {
         $mids = array();
         foreach ($weibos as $key => $weibo) {
             $mids[] = $weibo['mid'];
         }
         $weiboService->deleteWeibos($mids);
     }
     /* delete cache*/
     if ($db_ifpwcache ^ 1) {
         $db->update("DELETE FROM pw_elements WHERE type !='usersort' AND id IN(" . S::sqlImplode($tids) . ')');
     }
     //* P_unlink(D_P . 'data/bbscache/c_cache.php');
     pwCache::deleteData(D_P . 'data/bbscache/c_cache.php');
     /* 扣除积分 */
     $delCredit && $credit->runsql();
     //更新置顶帖表
     $this->db->update("DELETE FROM pw_poststopped WHERE tid IN ({$deltids}) AND pid = '0' AND fid != '0' ");
     if ($delutids) {
         $userCache = L::loadClass('Usercache', 'user');
         $userCache->delete(array_keys($delutids), array('article', 'cardtopic', 'weibo'));
     }
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     foreach ($deluids as $key => $value) {
         $userService->updateByIncrement($key, array(), array('postnum' => -$value));
     }
     $pw_attachs = L::loadDB('attachs', 'forum');
     if ($attachdb = $pw_attachs->getByTid($tids)) {
         delete_att($attachdb, !$recycle);
         require_once R_P . 'require/functions.php';
         pwFtpClose($GLOBALS['ftp']);
     }
     if ($updatetop) {
         if ($kmdTids) {
             $kmdService = L::loadClass('kmdservice', 'forum');
             foreach ($kmdTids as $tid) {
                 $kmdService->initThreadInfoByTid($tid);
             }
         }
         updatetop();
     }
     foreach ($fids as $fid => $value) {
         updateForumCount($fid, -$value['topic'], -$value['replies']);
     }
 }
Пример #5
0
function delforum($fid)
{
    global $db, $db_guestdir, $db_guestthread, $db_guestread;
    $foruminfo = $db->get_one("SELECT fid,fup,forumadmin FROM pw_forums WHERE fid=" . S::sqlEscape($fid));
    //$db->update("DELETE FROM pw_forums WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forums', 'fid=:fid', array($fid));
    //* $db->update("DELETE FROM pw_forumdata WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forumdata', 'fid=:fid', array($fid));
    $db->update("DELETE FROM pw_forumsextra WHERE fid=" . S::sqlEscape($fid));
    $db->update("DELETE FROM pw_permission WHERE fid>'0' AND fid=" . S::sqlEscape($fid));
    if ($foruminfo['forumadmin']) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $forumadmin = explode(",", $foruminfo['forumadmin']);
        foreach ($forumadmin as $key => $value) {
            if ($value) {
                $gid = $userService->getByUserName($value);
                if ($gid['groupid'] == 5 && !ifadmin($value)) {
                    $userService->update($gid['uid'], array('groupid' => -1));
                    admincheck($gid['uid'], $value, $gid['groupid'], '', 'delete');
                }
            }
        }
    }
    if ($db_guestthread || $db_guestread) {
        require_once R_P . 'require/guestfunc.php';
        $db_guestthread && deldir(D_P . "{$db_guestdir}/T_{$fid}");
    }
    //* P_unlink(D_P."data/forums/fid_{$fid}.php");
    pwCache::deleteData(D_P . "data/forums/fid_{$fid}.php");
    require_once R_P . 'require/functions.php';
    require_once R_P . 'require/updateforum.php';
    $pw_attachs = L::loadDB('attachs', 'forum');
    $ttable_a = $ptable_a = array();
    $query = $db->query("SELECT tid,replies,ptable FROM pw_threads WHERE fid=" . S::sqlEscape($fid));
    while ($tpc = $db->fetch_array($query)) {
        $tid = $tpc['tid'];
        $ttable_a[GetTtable($tid)][] = $tid;
        $ptable_a[$tpc['ptable']] = 1;
        $db_guestread && clearguestcache($tid, $tpc['replies']);
        if ($attachdb = $pw_attachs->getByTid($tid)) {
            delete_att($attachdb);
        }
    }
    pwFtpClose($GLOBALS['ftp']);
    foreach ($ttable_a as $pw_tmsgs => $val) {
        //* $val = S::sqlImplode($val,false);
        //* $db->update("DELETE FROM $pw_tmsgs WHERE tid IN($val)");
        pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($val));
    }
    # $db->update("DELETE FROM pw_threads WHERE fid=".S::sqlEscape($fid));
    # ThreadManager
    //* $threadManager = L::loadClass("threadmanager", 'forum');
    //* $threadManager->deleteByForumId($fid);
    $threadService = L::loadclass('threads', 'forum');
    $threadService->deleteByForumId($fid);
    //* Perf::gatherInfo('changeThreadWithForumIds', array('fid'=>$fid));
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        //$db->update("DELETE FROM $pw_posts WHERE fid=".S::sqlEscape($fid));
        pwQuery::delete($pw_posts, 'fid=:fid', array($fid));
    }
    updateforum($foruminfo['fup']);
}
Пример #6
0
 function _cleanCache()
 {
     pwCache::deleteData($this->_getCacheKey());
 }
Пример #7
0
 function _cleanCache()
 {
     pwCache::deleteData($this->_getCacheFilePath());
 }
Пример #8
0
    }
} elseif ($action == 'setting') {
    S::gp(array('mode', 'step'));
    $installfile = S::escapePath(R_P . 'mode/' . $mode . '/config/install.php');
    is_file($installfile) && (require_once $installfile);
} elseif ($action == 'fourmtypecache') {
    S::gp('m', null, '1');
    !array_key_exists($m, $db_modes) && adminmsg('mode_have_noopen');
    $fp = opendir(D_P . 'data/bbscache/');
    while ($filename = readdir($fp)) {
        if ($filename == '..' || $filename == '.') {
            continue;
        }
        if (strpos($filename, 'mode_' . $m) !== false) {
            //* P_unlink(S::escapePath(D_P.'data/bbscache/'.$filename));
            pwCache::deleteData(S::escapePath(D_P . 'data/bbscache/' . $filename));
        }
    }
    closedir($fp);
    $fp = opendir(D_P . 'data/tplcache/');
    while ($filename = readdir($fp)) {
        if ($filename == '..' || $filename == '.' || strpos($filename, '.htm') === false) {
            continue;
        }
        if (strpos($filename, $m . '_') === 0 || $m == 'area' && strpos($filename, 'portal_') === 0) {
            P_unlink(S::escapePath(D_P . 'data/tplcache/' . $filename));
        }
    }
    closedir($fp);
    $fp = opendir($attachdir . '/mini/');
    while ($filename = readdir($fp)) {
Пример #9
0
 function createForum($name, $fup = 0, $descrip = '', $linkurl = '')
 {
     //创建版块
     if (!$name) {
         return new ApiResponse(false);
     }
     //* @include_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
     extract(pwCache::getData(D_P . 'data/bbscache/forum_cache.php', false));
     $forumtype = $forum[$fup]['type'] == 'category' ? 'forum' : ($forum[$fup]['type'] == 'forum' ? 'sub' : 'sub2');
     /*
     $this->db->update("INSERT INTO pw_forums SET " . S::sqlSingle(array(
     	'fup'			=> $fup,
     	'type'			=> $forumtype,
     	'name'			=> $name,
     	'descrip'		=> $descrip,
     	'cms'			=> 0,
     	'ifhide'		=> 1,
     	'allowtype'		=> 3
     )));
     */
     pwQuery::insert('pw_forums', array('fup' => $fup, 'type' => $forumtype, 'name' => $name, 'descrip' => $descrip, 'cms' => 0, 'ifhide' => 1, 'allowtype' => 3));
     $fid = $this->db->insert_id();
     $this->db->update("INSERT INTO pw_forumdata SET fid=" . S::sqlEscape($fid));
     $forumset = array('lock' => 0, 'cutnums' => 0, 'threadnum' => 0, 'readnum' => 0, 'newtime' => 0, 'orderway' => 'lastpost', 'asc' => 'DESC', 'allowencode' => 0, 'anonymous' => 0, 'rate' => 0, 'dig' => 0, 'inspect' => 0, 'watermark' => 0, 'commend' => 0, 'autocommend' => 0, 'commendlist' => '', 'commendnum' => 0, 'commendlength' => 0, 'commendtime' => 0, 'addtpctype' => 0, 'ifrelated' => 0, 'relatednums' => 0, 'relatedcon' => 'ownpost', 'relatedcustom' => array(), 'rvrcneed' => 0, 'moneyneed' => 0, 'creditneed' => 0, 'postnumneed' => 0, 'sellprice' => array(), 'uploadset' => 'money 0', 'rewarddb' => '', 'allowtime' => '');
     $forumset['link'] = $linkurl;
     $forumset = serialize($forumset);
     $this->db->update("INSERT INTO pw_forumsextra SET " . S::sqlSingle(array('fid' => $fid, 'forumset' => $forumset)));
     //* P_unlink(D_P.'data/bbscache/c_cache.php');
     pwCache::deleteData(D_P . 'data/bbscache/c_cache.php');
     require_once R_P . 'admin/cache.php';
     updatecache_f();
     require_once R_P . 'require/updateforum.php';
     $forumtype != 'category' && updatetop();
     return new ApiResponse($fid);
 }
Пример #10
0
    if ($pwSendmail['by'] == 3) {
        $query = $db->query("SELECT m.uid,m.username,m.email FROM pw_members m left join pw_memberdata d USING(uid) {$pwSQL} {$limit}");
    } else {
        $query = $db->query("SELECT uid,username,email FROM pw_members " . $pwSQL . $limit);
    }
    while ($rt = $db->fetch_array($query)) {
        if (!$rt['email'] || !preg_match("/^[-a-zA-Z0-9_\\.]+@([0-9A-Za-z][0-9A-Za-z-]+\\.)+[A-Za-z]{2,5}\$/", $rt['email'])) {
            continue;
        }
        $sendsubject = str_replace(array('$winduid', '$windid', '$email'), array($rt['uid'], $rt['username'], $rt['email']), $pwSendmail['subject']);
        $sendcontent = str_replace(array('$winduid', '$windid', '$email'), array($rt['uid'], $rt['username'], $rt['email']), $pwSendmail['content']);
        sendemail($rt['email'], $sendsubject, $sendcontent, 'email_additional');
    }
    $pwSendmail['step']++;
    $havesend = $pwSendmail['sent'] = $pwSendmail['step'] * $pwSendmail['num'];
    $count = $pwSendmail['count'];
    if ($pwSendmail['count'] > $pwSendmail['sent']) {
        pwCache::setData($tmpCachefile, "<?php\r\ndie();\r\n?>\r\n" . serialize($pwSendmail));
        touch($tmpCachefile);
        $j_url = "{$basename}&action={$action}";
        adminmsg("sendmsg_step", EncodeUrl($j_url), 1);
    } else {
        pwCache::deleteData($tmpCachefile);
        $notExistUsers = $pwSendmail['notExistUsers'];
        !$pwSendmail['notExistUsers'] ? adminmsg('sendmsg_success') : adminmsg('sendmail_success_part');
    }
} elseif ($action == 'erase') {
    PostCheck($verify);
    pwCache::deleteData($tmpCachefile);
    adminmsg('operate_success');
}
Пример #11
0
    }
    //$db->update("UPDATE pw_threads SET fid=".S::sqlEscape($tofid)."WHERE fid=".S::sqlEscape($fid));
    pwQuery::update('pw_threads', 'fid = :fid', array($fid), array('fid' => $tofid));
    $ptable_a = array('pw_posts');
    if ($db_plist && count($db_plist) > 1) {
        foreach ($db_plist as $key => $value) {
            if ($key == 0) {
                continue;
            }
            $ptable_a[] = 'pw_posts' . $key;
        }
    }
    foreach ($ptable_a as $val) {
        //$db->update("UPDATE $val SET fid=".S::sqlEscape($tofid)."WHERE fid=".S::sqlEscape($fid));
        pwQuery::update($val, 'fid=:fid', array($fid), array('fid' => $tofid));
    }
    $db->update("UPDATE pw_attachs SET fid=" . S::sqlEscape($tofid) . "WHERE fid=" . S::sqlEscape($fid));
    //* $db->update("DELETE FROM pw_forums WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forums', 'fid=:fid', array($fid));
    //* $db->update("DELETE FROM pw_forumdata WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forumdata', 'fid=:fid', array($fid));
    $db->update("DELETE FROM pw_forumsextra WHERE fid=" . S::sqlEscape($fid));
    //* P_unlink(D_P."data/forums/fid_{$fid}.php");
    pwCache::deleteData(D_P . "data/forums/fid_{$fid}.php");
    updatecache_f();
    updateforum($tofid);
    if ($forum['type'] == 'sub') {
        updateforum($forum['fup']);
    }
    adminmsg('operate_success');
}
Пример #12
0
function delfcache($fid, $num)
{
    if ($num < 1) {
        return;
    }
    for ($i = 1; $i <= $num; $i++) {
        //* P_unlink(D_P."data/bbscache/fcache_{$fid}_{$i}.php");
        pwCache::deleteData(D_P . "data/bbscache/fcache_{$fid}_{$i}.php");
    }
}
Пример #13
0
        {
            global $type;
            return $a[$type] == $b[$type] ? 0 : ($a[$type] > $b[$type] ? -1 : 1);
        }
        uasort($admindb, "cmp");
        $sort_a[$type] = "class='link_down'";
    }
    require PrintEot('sort');
    footer();
} elseif ($action == 'delsort') {
    PostCheck();
    S::gp(array('month'));
    (!$month || !is_numeric($month) || $groupid != '3') && Showmsg('undefined_action');
    if (file_exists(D_P . 'data/bbscache/admin_sort_' . $month . '.php')) {
        //* P_unlink(D_P.'data/bbscache/admin_sort_'.$month.'.php');
        pwCache::deleteData(D_P . 'data/bbscache/admin_sort_' . $month . '.php');
    }
    refreshto("sort.php?action=admin", 'operate_success');
} elseif ($action == 'favor') {
    $cachetime = pwFilemtime(D_P . "data/bbscache/favor_sort.php");
    if (!$per || !file_exists(D_P . "data/bbscache/favor_sort.php") || $timestamp - $cachetime > $per * 3600) {
        $element = L::loadClass('element');
        $element->setDefaultNum(50);
        $_sort = array();
        $_SORTDB = $element->hotFavorsort();
        pwCache::writeover(D_P . 'data/bbscache/favor_sort.php', "<?php\r\n\$_FAVORS=" . pw_var_export($_SORTDB) . ";\r\n?>");
    } else {
        include pwCache::getPath(D_P . "data/bbscache/favor_sort.php");
        $_SORTDB = $_FAVORS;
        unset($_FAVORS);
    }
Пример #14
0
        $weibos = $weiboService->getWeibosByObjectIdsAndType($selids, 'group_article');
        if ($weibos) {
            $mids = array();
            foreach ($weibos as $key => $weibo) {
                $mids[] = $weibo['mid'];
            }
            $weiboService->deleteWeibos($mids);
        }
        countPosts('-1');
        $credit->runsql();
        sendMawholeMessages($msgdb);
        if ($db_ifpwcache ^ 1) {
            $db->update("DELETE FROM pw_elements WHERE type !='usersort' AND id IN(" . S::sqlImplode($selids) . ')');
        }
        //* P_unlink(D_P.'data/bbscache/c_cache.php');
        pwCache::deleteData(D_P . 'data/bbscache/c_cache.php');
        if (!defined('AJAX')) {
            refreshto("apps.php?q=group&a=thread&cyid={$cyid}", 'deltopic_success');
        } else {
            Showmsg('deltopic_success_ajax');
        }
    }
}
function checkForHeadTopic($toptype, $fid, $selForums)
{
    require_once R_P . 'require/updateforum.php';
    list($catedbs, $top_1, $top_2, $top_3) = getForumListForHeadTopic($fid);
    $topAll = '';
    if ($toptype == 0) {
        return true;
    }
Пример #15
0
        adminmsg('operate_success');
    } elseif ($action == 'delf') {
        $pwServer['REQUEST_METHOD'] != 'POST' && PostCheck($verify);
        S::gp(array('num'));
        S::gp(array('step'), 'GP', 2);
        !is_numeric($num) && ($num = 1000);
        $step = (int) $step;
        $isnum = 1;
        $path = D_P . 'data/bbscache';
        ++$step;
        $fp = opendir($path);
        while ($file = readdir($fp)) {
            if ($file != '' && !in_array($file, array('.', '..')) && preg_match('/^fcache\\_\\d+\\_\\d+\\.php$/i', $file)) {
                ++$isnum;
                //* P_unlink("$path/$file");
                pwCache::deleteData("{$path}/{$file}");
            }
            if ($isnum > $num) {
                break;
            }
        }
        closedir($fp);
        if ($isnum > $num) {
            $url = "{$basename}&action=delf&num={$num}&step={$step}";
            $delnum = $num * $step;
            adminmsg('fcache_delete', EncodeUrl($url), 2);
        }
        adminmsg('operate_success');
    }
}
//class & functions for updatecache
Пример #16
0
    $fid = $searchFid;
    $uid = $searchUid;
    include PrintEot('attachment');
    exit;
    //}
} elseif ($action == 'schdir') {
    S::gp(array('filename', 'filesize', 'ifless', 'postdate1', 'postdate2', 'pernum', 'direct', 'start'));
    if (!$filename && !$filesize && !$postdate1 && !$postdate2) {
        adminmsg('noenough_condition');
    }
    $cache_file = D_P . "data/bbscache/att_" . substr(md5($admin_name), 10, 10) . ".txt";
    if (!$start) {
        $start = 0;
        if (file_exists($cache_file)) {
            //* P_unlink($cache_file);
            pwCache::deleteData($cache_file);
        }
    }
    $num = 0;
    !$pernum && ($pernum = 1000);
    $dir1 = opendir($attachdir);
    while (false !== ($file1 = readdir($dir1))) {
        if ($file1 != '' && $file1 != '.' && $file1 != '..' && !eregi("\\.html\$", $file1)) {
            if (is_dir("{$attachdir}/{$file1}")) {
                $dir2 = opendir("{$attachdir}/{$file1}");
                while (false !== ($file2 = readdir($dir2))) {
                    if (is_file("{$attachdir}/{$file1}/{$file2}") && $file2 != '' && $file2 != '.' && $file2 != '..' && !eregi("\\.html\$", $file2)) {
                        $num++;
                        if ($num > $start) {
                            attachcheck("{$file1}/{$file2}");
                            if ($num - $start >= $pernum) {
Пример #17
0
 function postDelete($tids, $uid)
 {
     global $db_recycle, $db_ifpwcache;
     $tiddb = explode(',', $tids);
     $delids = array();
     foreach ($tiddb as $key => $value) {
         if (is_numeric($value)) {
             $delids[] = $value;
         }
     }
     if (!$delids) {
         return new ApiResponse(false);
     }
     foreach ($readdb as $key => $read) {
         if ($read['authorid'] != $uid) {
             return new ErrorMsg(API_THREAD_AUTHOR_ERROR, 'The author is not right');
         }
     }
     $delarticle = L::loadClass('DelArticle', 'forum');
     $readdb = $delarticle->getTopicDb('tid ' . $delarticle->sqlFormatByIds($delids));
     $delarticle->delTopic($readdb, 0);
     if ($db_ifpwcache ^ 1) {
         $this->db->update("DELETE FROM pw_elements WHERE type !='usersort' AND id IN(" . S::sqlImplode($delids) . ')');
     }
     //* P_unlink(D_P.'data/bbscache/c_cache.php');
     pwCache::deleteData(D_P . 'data/bbscache/c_cache.php');
     return new ApiResponse(true);
 }