本文整理汇总了PHP中sreaddir函数的典型用法代码示例。如果您正苦于以下问题:PHP sreaddir函数的具体用法?PHP sreaddir怎么用?PHP sreaddir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sreaddir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deltreedir
function deltreedir($dir)
{
$files = sreaddir($dir);
foreach ($files as $file) {
if (is_dir("{$dir}/{$file}")) {
deltreedir("{$dir}/{$file}");
} else {
@unlink("{$dir}/{$file}");
}
}
}
示例2: deleteitemhtml
function deleteitemhtml($itemidarr)
{
global $_SGLOBAL, $type;
$id = $_SGLOBAL['supe_uid'];
foreach ($itemidarr as $itemid) {
if ($type == 'news') {
$id = $itemid;
}
$idvalue = $id > 9 ? substr($id, -2, 2) : $id;
$filedir = H_DIR . '/' . $idvalue;
if (is_dir($filedir)) {
$filearr = sreaddir($filedir);
foreach ($filearr as $file) {
if (preg_match("/view(space|news)(.*)\\_{$itemid}(\\.|\\_)/i", $file)) {
@unlink($filedir . '/' . $file);
}
}
}
}
}
示例3: deltree
function deltree($str, $undelarr = array())
{
$tplarr = array();
$tplarr = sreaddir($str . 'images/');
if (!empty($tplarr)) {
foreach ($tplarr as $value) {
if (!in_array($value, $undelarr)) {
@unlink($str . 'images/' . $value);
}
}
}
$tplarr = array();
$tplarr = sreaddir($str);
if (!empty($tplarr)) {
foreach ($tplarr as $value) {
if (!in_array($value, $undelarr)) {
@unlink($str . $value);
}
}
}
if (empty($undelarr)) {
@rmdir($str . 'images/');
@rmdir($str);
}
}
示例4: array
}
$configs = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('config'));
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$configs[$value['var']] = shtmlspecialchars($value['datavalue']);
}
if (empty($configs['feedfilternum']) || $configs['feedfilternum'] < 1) {
$configs['feedfilternum'] = 1;
}
$datasets = $datas = $mails = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('data'));
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if ($value['var'] == 'setting' || $value['var'] == 'mail') {
$datasets[$value['var']] = empty($value['datavalue']) ? array() : unserialize($value['datavalue']);
} else {
$datasets[$value['var']] = shtmlspecialchars($value['datavalue']);
}
}
$datas = $datasets['setting'];
$mails = $datasets['mail'];
// templates directory
$templatearr = array('default' => 'default');
$tpl_dir = sreaddir(S_ROOT . './template');
foreach ($tpl_dir as $dir) {
if (file_exists(S_ROOT . './template/' . $dir . '/style.css')) {
$templatearr[$dir] = $dir;
}
}
$templateselect = array($configs['template'] => ' selected');
$toselect = array($configs['timeoffset'] => ' selected');
$onlineip = getonlineip();
示例5: array
//启用
if ($dir == 'uchomedefault') {
$setarr = array('theme' => '', 'css' => '');
} else {
$setarr = array('theme' => $dir, 'css' => '');
}
updatetable('spacefield', $setarr, array('uid' => $_SGLOBAL['supe_uid']));
showmessage('do_success', 'space.php', 0);
} elseif ($op == 'diy') {
//自定义
} else {
//模板列表
$themes = array(array('dir' => 'uchomedefault', 'name' => cplang('the_default_style'), 'pic' => 'image/theme_default.jpg'));
$themes[] = array('dir' => 'uchomediy', 'name' => cplang('the_diy_style'), 'pic' => 'image/theme_diy.jpg');
//获取本地风格目录
$themedirs = sreaddir(S_ROOT . './theme');
foreach ($themedirs as $key => $dirname) {
//样式文件和图片需存在
$now_dir = S_ROOT . './theme/' . $dirname;
if (file_exists($now_dir . '/style.css') && file_exists($now_dir . '/preview.jpg')) {
$themes[] = array('dir' => $dirname, 'name' => getcssname($dirname));
}
}
//时区
$toselect = array($space['timeoffset'] => ' selected');
}
$actives = array('theme' => ' class="active"');
include_once template("cp_theme");
//获取系统风格名
function getcssname($dirname)
{
示例6: explode
$hourarr[$i] = $i;
}
$minuteselect = '';
$cronminutearr = explode("\t", trim($thevalue['minute']));
for ($i = 0; $i < 12; $i++) {
$minuteselect .= '<select name="minute[]"><option value="-1">*</option>';
for ($j = 0; $j <= 59; $j++) {
$selected = '';
if (isset($cronminutearr[$i]) && $cronminutearr[$i] == $j) {
$selected = ' selected';
}
$minuteselect .= '<option value="' . $j . '"' . $selected . '>' . sprintf("%02d", $j) . '</option>';
}
$minuteselect .= '</select>' . ($i == 5 ? '<br>' : ' ');
}
$filearr = sreaddir(S_ROOT . './include/cron/', 'php');
echo '
<script language="javascript">
<!--
function thevalidate(theform) {
theform.thevaluesubmit.disabled = true;
return true;
}
//-->
</script>
';
echo label(array('type' => 'form-start', 'name' => 'thevalueform', 'action' => $theurl, 'other' => ' onSubmit="return thevalidate(this)"'));
echo label(array('type' => 'div-start'));
echo label(array('type' => 'table-start'));
echo label(array('type' => 'input', 'alang' => 'cron_title_name', 'name' => 'name', 'size' => '30', 'width' => '30%', 'value' => $thevalue['name']));
echo label(array('type' => 'radio', 'alang' => 'cron_title_available', 'name' => 'available', 'options' => $availablearr, 'value' => $thevalue['available']));
示例7: showmessage
showmessage('html_update_success', $theurl . '&op=update');
}
} elseif (submitcheck('deletesubmit')) {
//删除文件
$filename = trim($_POST['filename']);
if (empty($filename)) {
showmessage('html_deletefile_filename_error');
}
$filename = preg_quote($filename, "/");
$filename = str_replace('\\*', '.*?', $filename);
$filename = str_replace('\\|', '|', $filename);
$delfilearr = array();
$filearr = sreaddir(H_DIR);
foreach ($filearr as $file) {
if (is_dir(H_DIR . '/' . $file)) {
$subfilearr = sreaddir(H_DIR . '/' . $file);
foreach ($subfilearr as $subfile) {
if (trim(substr(strrchr($subfile, '.'), 1)) == 'html') {
if (preg_match("/^{$filename}/i", $subfile)) {
if (@unlink(H_DIR . '/' . $file . '/' . $subfile)) {
$delfilearr[] = array(H_DIR . '/' . $file . '/' . $subfile, 1);
} else {
$delfilearr[] = array(H_DIR . '/' . $file . '/' . $subfile, 1);
}
}
}
}
} else {
if (preg_match("/^{$filename}/i", $file)) {
if (trim(substr(strrchr($file, '.'), 1)) == 'html') {
if (@unlink(H_DIR . '/' . $file)) {
示例8: exit
<?php
/*
[SupeSite] (C) 2007-2009 Comsenz Inc.
$Id: cleanimporttemp.php 10898 2008-12-31 02:58:50Z zhaofei $
*/
if (!defined('IN_SUPESITE')) {
exit('Access Denied');
}
$filepath = S_ROOT . './data/';
$filename = '';
$filearr = sreaddir($filepath);
foreach ($filearr as $tempfile) {
$filename = $filepath . $tempfile;
if (substr($tempfile, 0, 11) == 'blogimport_') {
if ($_SGLOBAL['timestamp'] - filemtime($filename) > 600) {
if (!@unlink($filename)) {
errorlog('Cron', srealpath($tempfile) . ' Not found or have no access!', 0);
}
}
}
}
示例9: deleteitems
//.........这里部分代码省略.........
//attachments//²»¸Ä±äÓû§Í³¼ÆÊý¾Ý
$uidattachs = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if (!empty($value['filepath'])) {
$filearr[] = A_DIR . '/' . $value['filepath'];
}
if (!empty($value['thumbpath'])) {
$filearr[] = A_DIR . '/' . $value['thumbpath'];
}
}
$_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')");
//spacecomments
$_SGLOBAL['db']->query("DELETE FROM " . tname('spacecomments') . " WHERE itemid IN ('{$itemids}')");
//ɾ³ý²¢¸ü±ítag×ÜÊý
$tagarr = array('existsname' => array(), 'nonename' => array(), 'closename' => array(), 'existsid' => array());
foreach ($itemidarr as $id) {
postspacetag('update', $type, $id, $tagarr, '1');
}
//¾Ù±¨ÐÅÏ¢
$_SGLOBAL['db']->query("DELETE FROM " . tname('reports') . " WHERE itemid IN ('{$itemids}')");
//ɾ³ý¸½¼þ
if (!empty($filearr)) {
foreach ($filearr as $value) {
if (!@unlink($value)) {
errorlog('attachment', 'Unlink ' . $value . ' Error.');
}
}
}
//ɾ³ýhtmlÎļþ
if ($_SCONFIG['makehtml'] == 1) {
include_once S_ROOT . '/data/system/htmlcat.cache.php';
foreach ($delhtmlarr as $catid => $itemidarr) {
foreach ($itemidarr as $itemid) {
$htmlpath = S_ROOT . '/' . substr($_SCONFIG['newspath'], 2) . '/' . substr($catarr[$catid]['htmlpath'], 2);
$syear = sgmdate($value['dateline'], 'Y');
$smoon = sgmdate($value['dateline'], 'n');
$file = $htmlpath . '/' . $syear . '/' . $smoon . '/' . $catarr[$catid]['pre_html'] . $itemid . '.html';
@unlink($file);
}
}
showmessage('delete_html', 'admincp.php?action=makehtml&op=updatehtml&do=updatelisthtml');
} else {
foreach ($itemidarr as $itemid) {
if ($itemtypearr[$itemid] == 'news') {
$id = $itemid;
} else {
$id = $itemuidarr[$itemid];
}
$idvalue = $id > 9 ? substr($id, -2, 2) : $id;
$filedir = H_DIR . '/' . $idvalue;
if (is_dir($filedir)) {
$filearr = sreaddir($filedir);
foreach ($filearr as $file) {
if (preg_match("/\\-{$itemid}(\\.|\\-)/i", $file)) {
@unlink($filedir . '/' . $file);
}
}
}
}
}
updatecredit('delinfo', $uidarr);
} else {
$itemidarr = array();
$oitemidarr = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('postitems') . " WHERE {$colname} IN ({$ids})");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$itemidarr[] = $value['itemid'];
$oitemidarr[] = $value['oitemid'];
$tag_itemid[] = empty($value['oitemid']) ? $value['itemid'] : $value['oitemid'];
}
$itemids = implode('\',\'', $itemidarr);
$oitemids = implode('\',\'', $oitemidarr);
$_SGLOBAL['db']->query("DELETE FROM " . tname('postitems') . " WHERE itemid IN ('{$itemids}')");
$_SGLOBAL['db']->query("DELETE FROM " . tname('postmessages') . " WHERE itemid IN ('{$itemids}')");
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE itemid IN ('{$oitemids}')");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if (!empty($value['filepath'])) {
$filearr[] = A_DIR . '/' . $value['filepath'];
}
if (!empty($value['thumbpath'])) {
$filearr[] = A_DIR . '/' . $value['thumbpath'];
}
}
$_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE itemid IN ('{$oitemids}')");
//ɾ³ý¸½¼þ
if (!empty($filearr)) {
foreach ($filearr as $value) {
if (!@unlink($value)) {
errorlog('attachment', 'Unlink ' . $value . ' Error.');
}
}
}
//ɾ³ý²¢¸ü±ítag×ÜÊý
$tagarr = array('existsname' => array(), 'nonename' => array(), 'closename' => array(), 'existsid' => array());
foreach ($tag_itemid as $id) {
postspacetag('update', $type, $id, $tagarr, '0');
}
}
}
示例10: sreaddir
if (is_dir($dirstr)) {
$filearr = sreaddir($dirstr, array('jpg', 'jpeg', 'gif', 'png'));
if (!empty($filearr)) {
if (is_file($dirstr . '/categories.txt')) {
$catfile = @file($dirstr . '/categories.txt');
$dirarr[$key][0] = trim($catfile[0]);
} else {
$dirarr[$key][0] = trim($value);
}
$dirarr[$key][1] = trim('image/foreground/' . $value . '/');
$dirarr[$key][2] = $filearr;
}
}
}
} elseif ($isdoodle) {
$filearr = sreaddir(S_ROOT . './image/doodle/big', array('jpg', 'jpeg', 'gif', 'png'));
}
}
$max = @ini_get(upload_max_filesize);
$unit = strtolower(substr($max, -1, 1));
if ($unit == 'k') {
$max = intval($max) * 1024;
} elseif ($unit == 'm') {
$max = intval($max) * 1024 * 1024;
} elseif ($unit == 'g') {
$max = intval($max) * 1024 * 1024 * 1024;
}
$albums = getalbums($_SGLOBAL['supe_uid']);
} elseif ($op == "screen" || $op == "doodle") {
if (empty($GLOBALS['HTTP_RAW_POST_DATA'])) {
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
示例11: sreaddir
$cachedir = S_ROOT . './data/robot';
$filearr = sreaddir($cachedir);
foreach ($filearr as $file) {
@unlink($cachedir . '/' . $file);
}
}
if (in_array('tpl', $_POST['filekind'])) {
$cachedir = S_ROOT . './cache/tpl';
$filearr = sreaddir($cachedir);
foreach ($filearr as $file) {
@unlink($cachedir . '/' . $file);
}
}
if (in_array('model', $_POST['filekind'])) {
$cachedir = S_ROOT . './cache/model';
$filearr = sreaddir($cachedir);
if (!empty($filearr)) {
foreach ($filearr as $file) {
@unlink($cachedir . '/' . $file);
}
}
include_once S_ROOT . '/function/model.func.php';
$query = $_SGLOBAL['db']->query('SELECT mid, modelname FROM ' . tname('models'));
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$state = checkmodel($value['modelname']);
if ($state) {
writemodelvalidate('mid', $value['mid']);
}
}
}
if (in_array('ad', $_POST['filekind'])) {
示例12: array
}
echo '
<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><h1>' . $alang['setting_title'] . '</h1></td>
<td class="actions">
</td>
</tr>
</table>
';
//THE VALUE SHOW
if (is_array($thevalue) && $thevalue) {
$pconnectarr = array('0' => $alang['setting_pconnect_0'], '1' => $alang['setting_pconnect_1']);
$dbreportarr = array('0' => $alang['setting_dbreport_0'], '1' => $alang['setting_dbreport_1']);
$timeoffsetarr = array('-12' => '(GMT -12:00) Eniwetok, Kwajalein', '-11' => '(GMT -11:00) Midway Island, Samoa', '-10' => '(GMT -10:00) Hawaii', '-9' => '(GMT -09:00) Alaska', '-8' => '(GMT -08:00) Pacific Time (US & Canada), Tijuana', '-7' => '(GMT -07:00) Mountain Time (US & Canada), Arizona', '-6' => '(GMT -06:00) Central Time (US & Canada), Mexico City', '-5' => '(GMT -05:00) Eastern Time (US & Canada), Bogota, Lima, Quito', '-4' => '(GMT -04:00) Atlantic Time (Canada), Caracas, La Paz', '-3.5' => '(GMT -03:30) Newfoundland', '-3' => '(GMT -03:00) Brassila, Buenos Aires, Georgetown, Falkland Is', '-2' => '(GMT -02:00) Mid-Atlantic, Ascension Is., St. Helena', '-1' => '(GMT -01:00) Azores, Cape Verde Islands', '0' => '(GMT) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia', '1' => '(GMT +01:00) Amsterdam, Berlin, Brussels, Madrid, Paris, Rome', '2' => '(GMT +02:00) Cairo, Helsinki, Kaliningrad, South Africa', '3' => '(GMT +03:00) Baghdad, Riyadh, Moscow, Nairobi', '3.5' => '(GMT +03:30) Tehran', '4' => '(GMT +04:00) Abu Dhabi, Baku, Muscat, Tbilisi', '4.5' => '(GMT +04:30) Kabul', '5' => '(GMT +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent', '5.5' => '(GMT +05:30) Bombay, Calcutta, Madras, New Delhi', '5.75' => '(GMT +05:45) Katmandu', '6' => '(GMT +06:00) Almaty, Colombo, Dhaka, Novosibirsk', '6.5' => '(GMT +06:30) Rangoon', '7' => '(GMT +07:00) Bangkok, Hanoi, Jakarta', '8' => '(GMT +08:00) Beijing, Hong Kong, Perth, Singapore, Taipei', '9' => '(GMT +09:00) Osaka, Sapporo, Seoul, Tokyo, Yakutsk', '9.5' => '(GMT +09:30) Adelaide, Darwin', '10' => '(GMT +10:00) Canberra, Guam, Melbourne, Sydney, Vladivostok', '11' => '(GMT +11:00) Magadan, New Caledonia, Solomon Islands', '12' => '(GMT +12:00) Auckland, Wellington, Fiji, Marshall Island');
$templatearr = sreaddir(S_ROOT . './templates');
$gzipcompressarr = array('0' => $alang['setting_gzipcompress_0'], '1' => $alang['setting_gzipcompress_1']);
$urltypearr = array('1' => $alang['setting_urltype_1'], '4' => $alang['setting_urltype_4'], '2' => $alang['setting_urltype_2'], '5' => $alang['setting_urltype_5'], '3' => $alang['setting_urltype_3']);
$bbsurltypearr = array('site' => $alang['setting_bbsurltype_site'], 'bbs' => $alang['setting_bbsurltype_bbs']);
$attachmentdirtypearr = array('all' => $alang['setting_attachmentdirtype_all'], 'year' => $alang['setting_attachmentdirtype_year'], 'month' => $alang['setting_attachmentdirtype_month'], 'day' => $alang['setting_attachmentdirtype_day'], 'md5' => $alang['setting_attachmentdirtype_md5']);
$debugarr = array('0' => $alang['setting_debug_0'], '1' => $alang['setting_debug_1']);
$watermarkarr = array('0' => $alang['setting_watermark_0'], '1' => $alang['setting_watermark_1']);
$watermarkstatustext = '';
$watermarkstatustext .= '<table cellspacing="0" cellpadding="0" class="watermark"><tr align="center">';
for ($i = 0; $i < 9; $i++) {
$watermarkstatustext .= '<td><input type="radio" name="watermarkstatus" value="' . ($i + 1) . '"> #' . ($i + 1) . '</td>';
if ($i % 3 == 2) {
$watermarkstatustext .= '</tr><tr>';
}
}
$watermarkstatustext .= '</tr></table>';
示例13: intval
}
if ($op == "finish") {
$albumid = intval($_GET['albumid']);
//feed
album_feed($albumid);
exit;
} elseif ($op == 'config') {
$hash = md5($_SGLOBAL['supe_uid'] . UC_KEY);
if ($isupload && !checkperm('allowupload')) {
$hash = '';
} else {
$directory = sreaddir(S_ROOT . './image/foreground');
foreach ($directory as $key => $value) {
$dirstr = S_ROOT . './image/foreground/' . $value;
if (is_dir($dirstr)) {
$filearr = sreaddir($dirstr, array('jpg', 'jpeg', 'gif', 'png'));
if (!empty($filearr)) {
if (is_file($dirstr . '/categories.txt')) {
$catfile = @file($dirstr . '/categories.txt');
$dirarr[$key][0] = trim($catfile[0]);
} else {
$dirarr[$key][0] = trim($value);
}
$dirarr[$key][1] = trim('image/foreground/' . $value . '/');
$dirarr[$key][2] = $filearr;
}
}
}
}
$max = @ini_get(upload_max_filesize);
$unit = strtolower(substr($max, -1, 1));
示例14: flush_file
protected function flush_file()
{
//文件存儲模式=>全部刪除
$cachedir = B_ROOT . './data/cache/block';
$dirs = sreaddir($cachedir);
foreach ($dirs as $value) {
if (is_dir($cachedir . '/' . $value)) {
$filearr = sreaddir($cachedir . '/' . $value, 'data');
foreach ($filearr as $subvalue) {
@unlink($cachedir . '/' . $value . '/' . $subvalue);
}
}
}
return true;
}
示例15: exit
<?php
/*
[UCenter Home] (C) 2007-2008 Comsenz Inc.
$Id: admincp_ip.php 12776 2009-07-20 07:57:21Z zhengqingpeng $
*/
if (!defined('IN_UCHOME') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
// Check Permissions
if (!checkperm('managelog')) {
cpmessage('no_authority_management_operation');
}
$logfiles = sreaddir(S_ROOT . './data/log/', array('php'));
sort($logfiles);
if ($_GET['op'] == 'view') {
$log = array();
if ($_GET['file'] && in_array($_GET['file'], $logfiles)) {
$_GET['line'] = intval($_GET['line']);
$fp = fopen(S_ROOT . './data/log/' . $_GET['file'], 'r');
$offset = 0;
while ($line = fgets($fp)) {
if ($offset++ == $_GET['line']) {
$log = parselog($line, true);
$log['line'] = $_GET['line'];
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('space') . " WHERE uid = '{$log['uid']}'");
$value = $_SGLOBAL['db']->fetch_array($query);
realname_set($value['uid'], $value['username']);
realname_get();
break;
}