示例#1
0
文件: html_fun.php 项目: holin/sstour
function fhtml($txt, $html, $dir = "", $mu = "", $cahehtm)
{
    //$txt = file_get_contents($file);
    if ($dir != '') {
        $newdir = explode("/", $dir);
        $listdir = "";
        foreach ($newdir as $value) {
            $listdir .= "/{$value}";
            if (!is_dir(R_P . "html{$listdir}")) {
                mkdir(R_P . "html{$listdir}", 0777);
            }
        }
    }
    if ($mu != '') {
        $patterns = array("/(=)('|\"{0,1})(lang|image|attach|\\.)(\\/)(\\W?)(.*?)(\\W?)( |'|\"|>{1,2})/is");
        $replace = array("\\1\\2{$mu}\\3\\4\\5\\6\\7\\8");
        $txt = preg_replace($patterns, $replace, $txt);
    }
    if ($cahehtm) {
        P_unlink(R_P . $html);
    }
    $fp = fopen(R_P . $html, "w");
    flock($fp, LOCK_EX);
    fwrite($fp, $txt);
    fclose($fp);
    //关闭指针
    if (is_dir($mu) !== TRUE) {
        mkdir($mu, 0777);
    }
    chmod(R_P . $html, 0777);
}
示例#2
0
 function resetCloudWind()
 {
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yunsearch_search'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yunsearch_hook'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yunsearch_search'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yunsearch_domain'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yunsearch_isopen'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yunsearch_unique'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yundefend_shield'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yundefend_shielduser'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yundefend_shieldpost'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yun_model'");
     $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = 'db_yun_expand'");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_aggregate`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_attachs`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_colonys`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_diary`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_forums`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_members`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_postdefend`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_posts`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_postverify`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_setting`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_threads`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_userdefend`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_log_weibos`");
     $GLOBALS['db']->query("TRUNCATE TABLE `pw_yun_setting`");
     P_unlink(D_P . 'data/bbscache/cloudwind_logsettings.php');
     P_unlink(D_P . 'data/bbscache/cloudwind_settings.php');
     P_unlink(D_P . 'data/bbscache/cloudwind_postinfo.php');
     require_once R_P . 'admin/cache.php';
     updatecache_c();
     return true;
 }
 function update()
 {
     if ($this->_fileSize && ($this->_fileSize > $this->_maxFileSizeLimit || $this->_timestamp - $this->_lastUpdateTime > $this->_statisticTimeNode)) {
         $this->_updateDb();
         P_unlink($this->_filePath);
     }
     return true;
 }
示例#4
0
function clearguestcache($tid, $replies)
{
    global $db_readperpage, $db_guestdir;
    $pages = ceil(($replies + 1) / $db_readperpage);
    $tmp = 'R_' . intval($tid / 500);
    for ($i = 1; $i <= $pages; $i++) {
        if (file_exists(D_P . "{$db_guestdir}/{$tmp}/{$tid}_{$i}.html")) {
            P_unlink(D_P . "{$db_guestdir}/{$tmp}/{$tid}_{$i}.html");
        }
    }
}
 function delete($fileName)
 {
     $filepath = $this->directory . $fileName;
     $thumbPath = $this->directory . $this->thumbPrefix . $fileName;
     if (file_exists($filepath)) {
         @P_unlink($filepath);
     }
     if (file_exists($thumbPath)) {
         @P_unlink($thumbPath);
     }
     return true;
 }
 function updateInvokeTagCode($name, $tagCode)
 {
     $temp = $this->getInvokeByName($name);
     $parseTagCode = L::loadClass('ParseTagCode', 'area');
     $parseTagCode->init($name, $tagCode);
     $parsecode = $parseTagCode->getParseCode();
     $newInvokePieces = $parseTagCode->getConditoin();
     $this->_updateInvokePieceTagCode($name, $newInvokePieces);
     $data = array('tagcode' => $tagCode, 'parsecode' => $parsecode);
     $data['pieces'] = $this->getInvokePieces($name);
     $this->updateInvokeByName($name, $data);
     P_unlink($this->getInvokeApiFile($temp['id']));
 }
示例#7
0
 /**
  * 检查用户搜索间隔时间
  * @return unknown_type
  */
 function _checkWaitSegment()
 {
     if (!$this->_waitSegment) {
         return true;
     }
     if (file_exists(D_P . 'data/bbscache/schwait_cache.php')) {
         if ($this->_timestamp - pwFilemtime(D_P . 'data/bbscache/schwait_cache.php') > $this->_waitSegment) {
             P_unlink(D_P . 'data/bbscache/schwait_cache.php');
         } else {
             return false;
         }
     }
     return true;
 }
示例#8
0
文件: hack.php 项目: holin/sstour
function fdelfiletmp($base_dir)
{
    $dir = opendir($base_dir);
    while ($flist = readdir($dir)) {
        if ($flist != "." && $flist != "..") {
            if (filesize($base_dir . "/" . $flist) == 0) {
                P_unlink($base_dir . "/" . $flist);
            }
            if (eregi("(_g.js)\$", $flist)) {
                P_unlink($base_dir . "/" . $flist);
            }
            if (filemtime($base_dir . "/" . $flist) > $mtime[1] + 1000) {
                P_unlink($base_dir . "/" . $flist);
            }
        }
    }
}
示例#9
0
 function resetWind()
 {
     $fields = array('db_yunsearch_search', 'db_yunsearch_hook', 'db_yun_hash', 'db_yunsearch_domain', 'db_yunsearch_isopen', 'db_yunsearch_unique', 'db_yundefend_shield', 'db_yundefend_shielduser', 'db_yundefend_shieldpost', 'db_yun_model', 'db_yun_expand');
     foreach ($fields as $field) {
         $GLOBALS['db']->query("DELETE FROM `pw_config` WHERE db_name = '{$field}'");
     }
     $tables = array('pw_log_aggregate', 'pw_log_attachs', 'pw_log_colonys', 'pw_log_diary', 'pw_log_forums', 'pw_log_members', 'pw_log_postdefend', 'pw_log_posts', 'pw_log_postverify', 'pw_log_setting', 'pw_log_threads', 'pw_log_userdefend', 'pw_log_weibos', 'pw_yun_setting');
     foreach ($tables as $table) {
         $result = $GLOBALS['db']->get_one("SHOW TABLES LIKE '{$table}'");
         if ($result) {
             $GLOBALS['db']->query("TRUNCATE TABLE `{$table}`");
         }
     }
     P_unlink(D_P . 'data/bbscache/cloudwind_logsettings.php');
     P_unlink(D_P . 'data/bbscache/cloudwind_settings.php');
     P_unlink(D_P . 'data/bbscache/cloudwind_postinfo.php');
     require_once R_P . 'admin/cache.php';
     updatecache_c();
     return true;
 }
示例#10
0
 function removeAttach($userId, $id)
 {
     $userId = intval($userId);
     $id = intval($id);
     if (1 > $userId || 1 > $id) {
         return false;
     }
     $msAttachsDao = $this->getMsAttachsDao();
     if (!($msAttach = $msAttachsDao->get($id))) {
         return false;
     }
     $attachsDao = $this->getAttachsDao();
     $attach = $attachsDao->get($msAttach['aid']);
     $file = $this->_attachmentPath . '/' . $attach['attachurl'];
     if (is_file($file)) {
         P_unlink($file);
     }
     $attachsDao->delete(array($attach['aid']));
     $msAttachsDao->delete($id);
     return true;
 }
示例#11
0
 function deleteDir($dir)
 {
     $dir = S::escapePath($dir);
     while (!rmdir($dir)) {
         if (is_dir($dir)) {
             if ($dp = opendir($dir)) {
                 while (($file = readdir($dp)) != false) {
                     if (is_dir($dir . '/' . $file) && $file != '.' && $file != '..') {
                         PW_FileOperate::deleteDir($dir . '/' . $file);
                     } else {
                         if ($file != '.' && $file != '..') {
                             P_unlink($dir . '/' . $file);
                         }
                     }
                 }
                 closedir($dp);
             } else {
                 return false;
             }
         }
     }
 }
示例#12
0
                $pw_posts = GetPtable($threaddb['ptable']);
                $pids = S::sqlImplode($pids);
                $query = $db->query("SELECT pid,fid,tid,aid,author,authorid,postdate,subject,content,anonymous,ifcheck FROM {$pw_posts} WHERE tid='{$dtid}' AND fid='{$dfid}' AND pid IN({$pids})");
                $replydb = array();
                while ($result = $db->fetch_array($query)) {
                    !$result['subject'] && ($result['subject'] = substrs($rt['content'], 35));
                    $result['postdate'] = get_date($result['postdate']);
                    $result['ptable'] = $threaddb['ptable'];
                    $replydb[] = $result;
                }
                /*删除回复*/
                $delarticle->delReply($replydb, false);
                /*删除静态*/
                $htmurl = $db_htmdir . '/' . $dfid . '/' . get_date('ym', $threaddb['postdate']) . '/' . $dtid . '.html';
                if (file_exists(R_P . $htmurl)) {
                    P_unlink(R_P . $htmurl);
                }
            }
            //* P_unlink(D_P.'data/bbscache/c_cache.php');
            pwCache::deleteData(D_P . 'data/bbscache/c_cache.php');
            adminmsg('operate_success', "{$admin_file}?adminjob=superdel&admintype=article&action={$action}&fid={$_POST['fid']}&tid={$_POST['tid']}&pstart={$pstart}&pend={$pend}&author=" . rawurlencode($author) . "&keyword=" . rawurlencode($keyword) . "&userip={$userip}&tcounts={$tcounts}&counts={$counts}&nums={$nums}&ptable={$ptable}&page={$page}");
        }
    } elseif ($action == 'view') {
        S::gp(array('tid', 'pid'));
        $pw_posts = GetPtable('N', $tid);
        $rt = $db->get_one("SELECT COUNT(*) AS sum FROM {$pw_posts} WHERE tid=" . S::sqlEscape($tid) . 'AND pid<' . S::sqlEscape($pid));
        $page = ceil(($rt['sum'] + 1.5) / $db_readperpage);
        ObHeader("read.php?tid={$tid}&page={$page}#{$pid}");
    }
} elseif ($admintype == 'message') {
    $basename = "{$admin_file}?adminjob=superdel&admintype=message";
示例#13
0
 function getReadContent()
 {
     $readdb = array();
     $pw_tmsgs = GetTtable($this->tid);
     $read = $this->db->get_one("SELECT t.*,tm.*,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon ,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.onlinetime,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.starttime,md.thisvisit,md.lastvisit,mb.* FROM pw_threads t LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid LEFT JOIN pw_members m ON m.uid=t.authorid LEFT JOIN pw_memberdata md ON md.uid=t.authorid {$this->tablaadd} WHERE t.tid=" . S::sqlEscape($this->tid));
     if (!$read || $read['special'] || !$read['ifcheck']) {
         return false;
     }
     $this->fid = $read['fid'];
     $this->datedir = date('ym', $read['postdate']);
     if (file_exists(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html")) {
         P_unlink(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html");
     }
     if (!$this->initForum($this->fid)) {
         return false;
     }
     if ($this->isHideContent($read['content'])) {
         return false;
     }
     $this->setSeosetting(&$read);
     $this->vars['forumtitle'] = $this->forumtitle;
     $this->vars['msg_guide'] = $this->guidename . "<em>&gt;</em><a href=\"read.php?tid={$this->tid}\">{$read['subject']}</a>";
     $this->vars['db_metakeyword'] = $read['subject'] . str_replace(array('|', ' - '), ',', $this->forumtitle) . 'phpwind';
     $this->vars['subject'] = $read['subject'];
     $this->vars['titletop1'] = substrs('Re:' . str_replace('&nbsp;', ' ', $read['subject']), L::config('db_titlemax') - 2);
     $this->vars['hits'] = $read['hits'];
     $this->vars['replies'] = $read['replies'];
     $this->vars['tid'] = $this->tid;
     $this->vars['fid'] = $this->fid;
     $this->vars['pwforum'] = $this->forum;
     $this->vars['postUrl'] = 'post.php?fid=' . $this->fid;
     $_pids = array();
     $read['aid'] && ($_pids[] = 0);
     $count = $read['replies'] + 1;
     $this->vars['pages'] = numofpage($count, 1, ceil($count / $this->perpage), "{$GLOBALS['db_bbsurl']}/read.php?tid={$this->tid}&");
     $read['pid'] = 'tpc';
     $readdb[] = $read;
     if ($read['replies'] > 0) {
         $readnum = $this->perpage - 1;
         $pw_posts = GetPtable($read['ptable']);
         $query = $this->db->query("SELECT t.*,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.onlinetime,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.starttime,md.thisvisit,md.lastvisit, mb.* FROM {$pw_posts} t LEFT JOIN pw_members m ON m.uid=t.authorid LEFT JOIN pw_memberdata md ON md.uid=t.authorid {$this->tablaadd} WHERE t.tid=" . S::sqlEscape($this->tid) . " AND ifcheck='1' ORDER BY postdate LIMIT 0,{$readnum}");
         while ($read = $this->db->fetch_array($query)) {
             if ($this->isHideContent($read['content'])) {
                 return false;
             }
             $read['aid'] && ($_pids[] = $read['pid']);
             $readdb[] = $read;
         }
         $this->db->free_result($query);
     }
     if ($_pids) {
         $this->attachShow = new attachShow(false);
         $this->attachShow->init($this->tid, $_pids);
     }
     $this->vars['db_menuinit'] = "'td_post' : 'menu_post','td_post1' : 'menu_post','td_hack' : 'menu_hack'";
     $bandb = $this->forum->forumBan($readdb);
     $authorids = array($read['authorid']);
     $start_limit = 0;
     foreach ($readdb as $key => $read) {
         isset($bandb[$read['authorid']]) && ($read['groupid'] = 6);
         $authorids[] = $read['authorid'];
         $readdb[$key] = $this->htmread($read, $start_limit++);
         $this->vars['db_menuinit'] .= ",'td_read_" . $read['pid'] . "':'menu_read_" . $read['pid'] . "'";
     }
     if (L::config('db_showcustom')) {
         $this->vars['customdb'] = $this->getCustomdb($authorids);
     }
     return $readdb;
 }
示例#14
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');
     $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(" . pwImplode($delids) . ')');
     }
     P_unlink(D_P . 'data/bbscache/c_cache.php');
     return new ApiResponse(true);
 }
示例#15
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=" . pwEscape($fid));
    $db->update("DELETE FROM pw_forums WHERE fid=" . pwEscape($fid));
    $db->update("DELETE FROM pw_forumdata WHERE fid=" . pwEscape($fid));
    $db->update("DELETE FROM pw_forumsextra WHERE fid=" . pwEscape($fid));
    $db->update("DELETE FROM pw_permission WHERE fid>'0' AND fid=" . pwEscape($fid));
    if ($foruminfo['forumadmin']) {
        $forumadmin = explode(",", $foruminfo['forumadmin']);
        foreach ($forumadmin as $key => $value) {
            if ($value) {
                $gid = $db->get_one("SELECT uid,groupid FROM pw_members WHERE username="******"UPDATE pw_members SET groupid='-1' WHERE username="******"{$db_guestdir}/T_{$fid}");
    }
    P_unlink(D_P . "data/forums/fid_{$fid}.php");
    $ttable_a = $ptable_a = array();
    $query = $db->query("SELECT tid,replies,ptable FROM pw_threads WHERE fid=" . pwEscape($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']);
    }
    foreach ($ttable_a as $pw_tmsgs => $val) {
        $val = pwImplode($val, false);
        $db->update("DELETE FROM {$pw_tmsgs} WHERE tid IN({$val})");
    }
    # $db->update("DELETE FROM pw_threads WHERE fid=".pwEscape($fid));
    # ThreadManager
    $threadManager = L::loadClass("threadmanager");
    $threadManager->deleteByForumId($fid);
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        $db->update("DELETE FROM {$pw_posts} WHERE fid=" . pwEscape($fid));
    }
    updateforum($foruminfo['fup']);
}
示例#16
0
function deldir($path)
{
    if (file_exists($path)) {
        if (is_file($path)) {
            P_unlink($path);
        } else {
            $handle = opendir($path);
            while ($file = readdir($handle)) {
                if ($file != '' && !in_array($file, array('.', '..'))) {
                    if (is_dir("{$path}/{$file}")) {
                        deldir("{$path}/{$file}");
                    } else {
                        P_unlink("{$path}/{$file}");
                    }
                }
            }
            closedir($handle);
            rmdir($path);
        }
    }
}
示例#17
0
 function delReplyTopic($tids, $deltpc, $recount, $recycle = false)
 {
     if (!$tids) {
         return array();
     }
     global $db_readdir, $db_guestread;
     $db_guestread && (require_once R_P . 'require/guestfunc.php');
     $deltopic = array();
     $query = $this->db->query("SELECT tid,fid,postdate,lastpost,author,replies,anonymous,ptable,locked FROM pw_threads WHERE tid IN(" . S::sqlImplode($tids) . ")");
     while ($read = $this->db->fetch_array($query)) {
         $htmurl = $db_readdir . '/' . $read['fid'] . '/' . date('ym', $read['postdate']) . '/' . $read['tid'] . '.html';
         if (file_exists(R_P . $htmurl)) {
             P_unlink(R_P . $htmurl);
         }
         if ($db_guestread) {
             clearguestcache($read['tid'], $read['replies']);
         }
         if ($recount) {
             if ($ret = $this->recountTopic($read, in_array($read['tid'], $deltpc), $recycle)) {
                 $deltopic[$read['fid']] += 1;
             }
         }
     }
     //* $threads = L::loadClass('Threads', 'forum');
     //* $threads->delThreads($tids);
     Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $tids));
     return $deltopic;
 }
示例#18
0
function attachcheck($file)
{
    global $cache_file, $attachdir, $admin_pwd, $filename, $filesize, $ifless, $postdate1, $postdate2, $direct, $attachdir;
    if ($filename && strpos($file, $filename) === false) {
        return;
    }
    if ($filesize) {
        if ($ifless && filesize("{$attachdir}/{$file}") >= $filesize * 1024) {
            return;
        } elseif (!$ifless && filesize("{$attachdir}/{$file}") <= $filesize * 1024) {
            return;
        }
    }
    if ($postdate1) {
        $visittime = PwStrtoTime($postdate1);
        if (is_numeric($visittime) && fileatime("{$attachdir}/{$file}") < $visittime) {
            return;
        }
    }
    if ($postdate2) {
        $visittime = PwStrtoTime($postdate2);
        if (is_numeric($visittime) && fileatime("{$attachdir}/{$file}") > $visittime) {
            return;
        }
    }
    if ($_POST['direct']) {
        P_unlink("{$attachdir}/{$file}");
        P_unlink("{$attachdir}/thumb/{$file}");
    } else {
        strlen($file) > 49 && ($file = substr($file, 0, 49));
        writeover($cache_file, str_pad($file, 49) . "\n", "ab");
        //* pwCache::setData($cache_file,str_pad($file,49)."\n", false, "ab");
    }
}
示例#19
0
             $threadIds[] = $v;
             $ttable_a[GetTtable($v)][] = $v;
         }
     }
 }
 !$tids && Showmsg('mawhole_nodata');
 $selids = S::sqlImplode($tids);
 $msgdb = $logdb = array();
 $query = $db->query("SELECT tid,fid,postdate,author,authorid,subject,locked FROM pw_threads WHERE tid IN({$selids})");
 while ($rt = $db->fetch_array($query)) {
     if ($fid != $rt['fid']) {
         Showmsg('admin_forum_right');
     }
     if ($rt['locked'] % 3 != $locked && $locked) {
         if ($locked == 2) {
             P_unlink(R_P . "{$db_readdir}/{$fid}/" . date('ym', $rt['postdate']) . "/{$tid}.html");
         }
         $s = $rt['locked'] > 2 ? $locked + 3 : $locked;
         //$db->update('UPDATE pw_threads SET locked=' . S::sqlEscape($s) . ' WHERE tid=' . S::sqlEscape($rt['tid']));
         pwQuery::update('pw_threads', "tid=:tid", array($rt['tid']), array("locked" => $s));
         if ($ifmsg) {
             if ($locked == 2) {
                 $temp['title'] = 'lock_title_2';
                 $temp['content'] = 'lock_content_2';
             } else {
                 $temp['title'] = 'lock_title';
                 $temp['content'] = 'lock_content';
             }
             $msgdb[] = array('toUser' => $rt['author'], 'title' => getLangInfo('writemsg', $temp['title']), 'content' => getLangInfo('writemsg', $temp['content'], array('manager' => $windid, 'fid' => $fid, 'tid' => $rt['tid'], 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content))));
         }
         $logdb[] = array('type' => 'locked', 'username1' => $rt['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => $rt['tid'], 'field3' => '', 'descrip' => 'lock_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $rt['tid'], 'subject' => substrs($rt['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content));
示例#20
0
 /**
  * 批量处理消息附件信息
  * @param array $messageIds
  * @return unknown_type
  */
 function _deleteAttachsByMessageIds($messageIds)
 {
     if (!$messageIds) {
         return false;
     }
     $msAttachsDao = $this->getMsAttachsDao();
     if (!($msAttachs = $msAttachsDao->getAttachsByMessageIds($messageIds))) {
         return false;
     }
     $attachIds = array();
     foreach ($msAttachs as $attach) {
         $attachIds[] = $attach['aid'];
     }
     $msAttachsDao->deleteAttachsByMessageIds($messageIds);
     $attachsDao = $this->getAttachsDao();
     if (!($attachs = $attachsDao->getsByAids($attachIds))) {
         return false;
     }
     $files = array();
     foreach ($attachs as $attach) {
         $file = $this->_attachmentPath . '/' . $attach['attachurl'];
         if (is_file($file)) {
             P_unlink($file);
         }
     }
     $attachsDao->deleteByAids($attachIds);
     return true;
 }
示例#21
0
 function delete($key)
 {
     $fileName = Cache_Config_Filecache::createFile($key);
     if (!is_file($fileName)) {
         return false;
     }
     P_unlink($fileName);
 }
示例#22
0
 function updateIcon($uid)
 {
     global $atc_attachment_name, $db_ifftp;
     $uid = intval($uid);
     if ($uid < 1 || !S::isArray($_FILES)) {
         return $this->buildResponse(USER_INVALID_PARAMS);
     }
     ACloud_Sys_Core_Common::setGlobal('customized_current_uid', $uid);
     $user = $this->getCurrentUser();
     if (!$user->isLogin()) {
         return $this->buildResponse(USER_NOT_LOGIN);
     }
     $ext = strtolower(substr(strrchr($_FILES['icon']['name'], '.'), 1));
     L::loadClass('faceupload', 'upload', false);
     $face = new FaceUpload($user->uid);
     $icondb = PwUpload::upload($face);
     require_once R_P . 'require/showimg.php';
     $udir = str_pad(substr($user->uid, -2), 2, '0', STR_PAD_LEFT);
     if (!in_array(strtolower($ext), array('gif', 'jpg', 'jpeg', 'png', 'bmp'))) {
         return $this->buildResponse(USER_UPLOAD_CONTENT_ERROR);
     }
     $filename = "{$user->uid}.{$ext}";
     $sourceFilename = "{$user->uid}_tmp.{$ext}";
     $sourceDir = "upload/{$udir}/";
     $middleDir = "upload/middle/{$udir}/";
     $smallDir = "upload/small/{$udir}/";
     $img_w = $img_h = 0;
     $sourceFile = PwUpload::savePath($db_ifftp, $sourceFilename, $sourceDir);
     $middleFile = PwUpload::savePath($db_ifftp, $filename, $middleDir);
     PwUpload::createFolder(dirname($middleFile));
     PwUpload::movefile($sourceFile, $middleFile);
     require_once R_P . 'require/imgfunc.php';
     if (!($img_size = GetImgSize($middleFile))) {
         P_unlink($middleFile);
         return $this->buildResponse(USER_UPLOAD_CONTENT_ERROR);
     }
     list($img_w, $img_h) = getimagesize($middleFile);
     $smallFile = PwUpload::savePath($db_ifftp, $filename, $smallDir);
     $s_ifthumb = 0;
     PwUpload::createFolder(dirname($smallFile));
     if ($ext == 'gif') {
         L::loadClass('gifdecoder', 'utility', false);
         L::loadClass('gif', 'utility', false);
         $gifDecoder = new GIFDecoder($data);
         $frames = $gifDecoder->GIFGetFrames();
         if (!empty($frames)) {
             foreach ($frames as $key => $value) {
                 $frames[$key] = makeAvatarGifThumb($value, $img_w, $img_h, 48, 48);
             }
             $anime = new GIFEncoder($frames, $gifDecoder->GIFGetDelays(), $gifDecoder->GIFGetLoop(), $gifDecoder->GIFGetDisposal(), $gifDecoder->GIFGetTransparentR(), $gifDecoder->GIFGetTransparentG(), $gifDecoder->GIFGetTransparentB(), 'bin');
             $newGifData = $anime->getAnimation();
             PwUpload::createFolder(dirname($smallFile));
             writeover($smallFile, $newGifData);
             $s_ifthumb = 1;
         }
     } elseif (MakeThumb($middleFile, $smallFile, 48, 48)) {
         $s_ifthumb = 1;
     }
     if ($db_ifftp) {
         PwUpload::movetoftp($middleFile, $middleDir . $filename);
         $s_ifthumb && PwUpload::movetoftp($smallFile, $smallDir . $filename);
     }
     $user_a = explode('|', $user->icon);
     $user_a[2] = $img_w;
     $user_a[3] = $img_h;
     $usericon = setIcon("{$udir}/{$user->uid}.{$ext}", 3, $user_a);
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     $userService->update($user->uid, array('icon' => $usericon));
     list($iconurl) = showfacedesign($usericon, 1, 's');
     return $this->buildResponse(0, array('icon' => $iconurl));
 }
示例#23
0
文件: sqladmin.php 项目: holin/sstour
            $url = "admin.php?action={$action}&option={$option}";
            ffile("data/sql_" . date("Ymd") . "_" . $fHtmlcode . "_{$np}.sql", $bak . $bakupdata, "w");
            echo "<meta http-equiv='refresh' content='2;url={$boardurl}{$url}'>";
            //echo "<script type='text/javascript' language='javascript'>parent.sqlFrame.location.reload();</script>";
            die("{$successtext}<BR>");
            //$url = "<meta http-equiv='refresh' content='1;url=admin.php?action={$action}&option={$option}&update=sqlback&tables={$tables}&start={$num[0]}&sizelimit={$sizelimit}&np={$np}&fHtmlcode={$fHtmlcode}'>";
            //$textmesg =  "<a href='admin.php?action={$action}&option={$option}&update=sqlbacktables={$tables}&start={$num[0]}&sizelimit={$sizelimit}&np={$np}&fHtmlcode={$fHtmlcode}'>下一页</a>";
        } else {
            P_unlink("data/backup.php");
            die('数据备份完成<BR>');
        }
    }
}
if ($option == 'sqlbck') {
    if ($type == 'del') {
        P_unlink(R_P . "data/{$id}");
        die(gb2utf8("删除备份文件成功"));
    }
    if ($type == 'into') {
        Cookie("sql_file", $id);
        Showmsg("beingto_page", 1, "sqlbck.php");
    }
    $handle = opendir("data");
    $i = 0;
    while ($file = readdir($handle)) {
        if ($file != "" && $file != '.' && $file != "..") {
            $filers[$i] = $file;
            $code = fHtmlcode();
            //$ODBC['HTMLcode']
            $mu = fencrypt("data", $config['HTMLcode']);
            $md = md5($code . $config['HTMLcode'] . $file . $mu);
示例#24
0
        $i = $step;
        $step++;
        if ($count > 1 && $step <= $count) {
            $j_url = "{$basename}&action=bakin&step={$step}&count={$count}&pre={$pre}";
            adminmsg('bakup_in', EncodeUrl($j_url), 2);
        }
        updatecache();
        adminmsg('operate_success');
    } elseif ($action == 'del') {
        InitGP(array('delfile'), 'P');
        if (!$delfile) {
            adminmsg('operate_error');
        }
        foreach ($delfile as $key => $value) {
            if (eregi("\\.sql\$", $value)) {
                P_unlink(D_P . "data/{$value}");
            }
        }
        adminmsg('operate_success');
    }
}
function bakupdata($tabledb, $start = 0)
{
    global $db, $sizelimit, $tableid, $start, $stop, $rows;
    $tableid = $tableid ? $tableid - 1 : 0;
    $stop = 0;
    $t_count = count($tabledb);
    for ($i = $tableid; $i < $t_count; $i++) {
        $ts = $db->get_one("SHOW TABLE STATUS LIKE " . pwEscape($tabledb[$i]));
        $rows = $ts['Rows'];
        $flag = true;
示例#25
0
function expireguestcache($expireSeconds = 86400)
{
    global $timestamp, $db_guestdir;
    $dir = D_P . "{$db_guestdir}/";
    if ($dirHandler = opendir($dir)) {
        while (($file = readdir($dirHandler)) !== false) {
            $filePath = $dir . $file;
            if (is_file($filePath)) {
                if ($timestamp - pwFilemtime($filePath) > $expireSeconds) {
                    P_unlink($filePath);
                }
            } elseif (is_dir($filePath) && false === strpos($filePath, ".")) {
                $subDir = $filePath . "/";
                $subDirHandler = opendir($subDir);
                while (($file = readdir($subDirHandler)) !== false) {
                    $filePath = $subDir . $file;
                    if (is_file($filePath)) {
                        if ($timestamp - pwFilemtime($filePath) > $expireSeconds) {
                            P_unlink($filePath);
                        }
                    }
                }
                closedir($subDirHandler);
            }
        }
        closedir($dirHandler);
    }
}
示例#26
0
文件: scenic.php 项目: holin/sstour
}
if ($option == 'actsp') {
    $GETSQL->fUpdate("`{$ODBC['tablepre']}scenic`", "`sc_sp`='{$Industry}'", "`sc_id`='{$id}'");
    die($Industry);
}
if ($option == 'delpass') {
    $sql_hotel = $GETSQL->fSql("sc_uid", "`{$ODBC['tablepre']}scenic`", "`sc_id`='{$id}'", "", "", "", "U_B");
    $GETSQL->fUpdate("`{$ODBC['tablepre']}scenic`", "`sc_pass`='0'", "`sc_id`='{$id}'");
    $GETSQL->fUpdate("`{$ODBC['tablepre']}members`", "`groupid`='3'", "`uid`='{$sql_hotel['sc_uid']}' AND `groupid`='5'");
    die(gb2utf8("<a href=\"javascript:getNews('showfilg{$id}','admin.php?action={$action}&option=pass&id={$id}');\">通过</a> <a href=\"javascript:_confirm_msg_show('确定删除景区','getNews(\\\\'showfilg{$id}\\\\',\\\\'admin.php?action={$action}&option=delhotel&id={$id}\\\\');\$(\\\\'list{$id}\\\\').parentNode.removeChild(\$(\\\\'list{$id}\\\\'))','','');\">删除</a>"));
}
if ($option == 'delhotel') {
    include_once GetLang('image');
    include_once Getincludefun("image");
    $sql_hotel = $GETSQL->fSql("sc_id,sc_logo", "`{$ODBC['tablepre']}scenic`", "`sc_id`='{$id}'", "", "", "", "U_B");
    P_unlink(R_P . "{$config['attach']}/{$sql_hotel['sc_logo']}/{$sql_hotel['sc_logo']}");
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenicattr`", "`attr_hid`='{$sql_hotel['sc_id']}'");
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenicthread`", "`thr_hid`='{$sql_hotel['sc_id']}'");
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenicthreadword`", "`word_hid`='{$sql_hotel['sc_id']}'");
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenicword`", "`word_hid`='{$sql_hotel['sc_id']}'");
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenicyou`", "`thr_hid`='{$sql_hotel['sc_id']}'");
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenicyouword`", "`word_hid`='{$sql_hotel['sc_id']}'");
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenic`", "`sc_id`='{$sql_hotel['sc_id']}'");
    $sql_hotelimage = $GETSQL->fSql("hi_src", "`{$ODBC['tablepre']}scenicimage`", "`hi_hid`='{$sql_hotel['sc_id']}'");
    foreach ($sql_hotelimage as $value) {
        P_unlink(R_P . $value['hi_src']);
        P_unlink(R_P . fimgsrc($value['hi_src'], 'simll/'));
    }
    $GETSQL->fDelete("`{$ODBC['tablepre']}scenicimage`", "`hi_hid`='{$sql_hotel['sc_id']}'");
    die(gb2utf8("删除成功"));
}
示例#27
0
function ImgWaterMark($source, $w_pos = 0, $w_img = "", $w_text = "", $w_font = 5, $w_color = "#FF0000", $w_pct)
{
    global $config;
    if (!empty($source) && file_exists($config['sysdir'] . $source)) {
        $source_info = getimagesize($config['sysdir'] . $source);
        $source_w = $source_info[0];
        $source_h = $source_info[1];
        switch ($source_info[2]) {
            case 1:
                $source_img = imagecreatefromgif($config['sysdir'] . $source);
                break;
            case 2:
                $source_img = imagecreatefromjpeg($config['sysdir'] . $source);
                break;
            case 3:
                $source_img = imagecreatefrompng($config['sysdir'] . $source);
                break;
            default:
                return;
        }
    } else {
        return;
    }
    if (!empty($w_img) && file_exists("{$config['sysdir']}image/water/{$w_img}")) {
        $ifWaterImage = 1;
        $water_info = getimagesize("{$config['sysdir']}image/water/{$w_img}");
        $width = $water_info[0];
        $height = $water_info[1];
        switch ($water_info[2]) {
            case 1:
                $water_img = imagecreatefromgif("{$config['sysdir']}image/water/{$w_img}");
                break;
            case 2:
                $water_img = imagecreatefromjpeg("{$config['sysdir']}image/water/{$w_img}");
                break;
            case 3:
                $water_img = imagecreatefrompng("{$config['sysdir']}image/water/{$w_img}");
                break;
            default:
                return;
        }
    } else {
        $ifWaterImage = 0;
        $temp = imagettfbbox(ceil($w_font * 2.5), 0, "./cour.ttf", $w_text);
        //取得使用 TrueType 字体的文本的范围
        $width = $temp[2] - $temp[6];
        $height = $temp[3] - $temp[7];
        unset($temp);
    }
    switch ($w_pos) {
        case 0:
            $wX = rand(0, $source_w - $width);
            $wY = rand(0, $source_h - $height);
            break;
        case 1:
            $wX = 5;
            $wY = 5;
            break;
        case 2:
            $wX = ($source_w - $width) / 2;
            $wY = 0;
            break;
        case 3:
            $wX = $source_w - $width;
            $wY = 0;
            break;
        case 4:
            $wX = 0;
            $wY = $source_h - $height;
            break;
        case 5:
            $wX = ($source_w - $width) / 2;
            $wY = $source_h - $height;
            break;
        case 6:
            $wX = $source_w - $width;
            $wY = $source_h - $height;
            break;
        default:
            $wX = ($source_w - $width) / 2;
            $wY = ($source_h - $height) / 2;
            break;
    }
    imagealphablending($source_img, true);
    if ($ifWaterImage) {
        imagecopymerge($source_img, $water_img, $wX, $wY, 0, 0, $width, $height, $w_pct);
    } else {
        if (!empty($w_color) && strlen($w_color) == 7) {
            $R = hexdec(substr($w_color, 1, 2));
            $G = hexdec(substr($w_color, 3, 2));
            $B = hexdec(substr($w_color, 5));
        } else {
            return;
        }
        imagestring($source_img, $w_font, $wX, $wY, $w_text, imagecolorallocate($source_img, $R, $G, $B));
    }
    P_unlink($source);
    switch ($source_info[2]) {
        case 1:
            imagegif($source_img, $source);
            break;
        case 2:
            imagejpeg($source_img, $source);
            break;
        case 3:
            imagepng($source_img, $source);
            break;
        default:
            return;
    }
    if (isset($water_info)) {
        unset($water_info);
    }
    if (isset($water_img)) {
        imagedestroy($water_img);
    }
    unset($source_info);
    imagedestroy($source_img);
}
示例#28
0
    $path = $db->get_value("SELECT {$fieldname} FROM {$tablename} WHERE tid=" . pwEscape($tid));
    if (strpos($path, '..') !== false) {
        return false;
    }
    $lastpos = strrpos($path, '/') + 1;
    $s_path = substr($path, 0, $lastpos) . 's_' . substr($path, $lastpos);
    if (!file_exists("{$attachpath}/{$path}")) {
        if (pwFtpNew($ftp, $db_ifftp)) {
            $ftp->delete($path);
            $ftp->delete($s_path);
            pwFtpClose($ftp);
        }
    } else {
        P_unlink("{$attachdir}/{$path}");
        if (file_exists("{$attachdir}/{$s_path}")) {
            P_unlink("{$attachdir}/{$s_path}");
        }
    }
    $db->update("UPDATE {$tablename} SET {$fieldname}='' WHERE tid=" . pwEscape($tid));
    echo 'success';
    ajax_footer();
} elseif ($action == 'poplogin') {
    InitGP(array('tid', 'page', 'toread', 'fpage', 'anchor'));
    $jumpurl = $db_bbsurl . '/read.php?tid=' . $tid;
    $page > 1 && ($jumpurl .= '&page=' . $page);
    $fpage && ($jumpurl .= '&fpage=' . $fpage);
    $toread && ($jumpurl .= '&toread=' . $toread);
    $jumpurl .= "#" . $anchor;
    require_once PrintEot('poplogin');
    ajax_footer();
} elseif ($action == 'pingpage') {
示例#29
0
     $deltype = 'delrp';
     $deltitle = $subject ? substrs($subject, 28) : substrs($content, 28);
     $db->update("DELETE FROM {$pw_posts} WHERE pid=" . pwEscape($pid));
     $db->update("UPDATE pw_threads SET replies=replies-1 WHERE tid=" . pwEscape($tid));
     $msg_delrvrc = abs($creditset['Deleterp']['rvrc']);
     $msg_delmoney = abs($creditset['Deleterp']['money']);
     $credit->addLog('topic_Deleterp', $creditset['Deleterp'], array('uid' => $authorid, 'username' => $author, 'ip' => $onlineip, 'fname' => strip_tags($forum[$fid]['name']), 'operator' => $windid));
     $credit->sets($authorid, $creditset['Deleterp'], false);
 }
 $credit->setMdata($authorid, 'postnum', -1);
 $credit->runsql();
 if ($db_guestread) {
     require_once R_P . 'require/guestfunc.php';
     clearguestcache($tid, $rs['replies']);
 }
 P_unlink(D_P . 'data/bbscache/c_cache.php');
 require_once R_P . 'require/updateforum.php';
 updateforum($fid);
 if ($rs['topped']) {
     updatetop();
 }
 $msg_delrvrc = floor($msg_delrvrc / 10);
 require_once R_P . 'require/writelog.php';
 $log = array('type' => 'delete', 'username1' => $author, 'username2' => $windid, 'field1' => $fid, 'field2' => '', 'field3' => '', 'descrip' => $deltype . '_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $tid, 'forum' => $pwforum->foruminfo['name'], 'subject' => $deltitle, 'affect' => "{$db_rvrcname}:-{$msg_delrvrc},{$db_moneyname}:-{$msg_delmoney}", 'reason' => 'edit delete article!');
 writelog($log);
 if ($pwforum->foruminfo['allowhtm'] && $article <= $db_readperpage) {
     $StaticPage = L::loadClass('StaticPage');
     $StaticPage->update($tid);
 }
 if ($deltype == 'delrp') {
     refreshto("read.php?tid={$tid}", 'enter_thread');
示例#30
0
                 $fp1 = opendir("{$path}/{$file}");
                 while ($file1 = readdir($fp1)) {
                     if ($file1 != '' && !in_array($file1, array('.', '..'))) {
                         ++$isnum;
                         P_unlink("{$path}/{$file}/{$file1}");
                         if ($isnum > $num) {
                             break;
                         }
                     }
                 }
                 closedir($fp1);
                 rmdir("{$path}/{$file}");
             }
         } elseif ($selid[1]) {
             ++$isnum;
             P_unlink("{$path}/{$file}");
         }
     }
     if ($isnum > $num) {
         break;
     }
 }
 closedir($fp);
 if ($isnum > $num) {
     $url = "{$basename}&action=delete&num={$num}&step={$step}";
     foreach ($selid as $key => $value) {
         $url .= "&selid[{$key}]={$value}";
     }
     $delnum = $num * $step;
     adminmsg('guestdir_delete', EncodeUrl($url), 2);
 }