• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_dir_empty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: iterate

function iterate($path)
{
    $array_dir = @scandir($path);
    @asort($array_dir);
    foreach ($array_dir as $value) {
        if (is_dir($value) && strcmp($value, ".") && strcmp($value, "..")) {
            if (!is_dir_empty($value)) {
                chdir($value);
                parse();
                iterate(getcwd(), $value);
                chdir("..");
            }
        }
    }
}
开发者ID:genji993,项目名称:MangaEdenPARSER,代码行数:15,代码来源:mangaeden_parser.php


示例2: deleteDirectory

function deleteDirectory($path)
{
    $newpath = "";
    $dir = explode('/', $path);
    $flag = "";
    ksort($dir);
    $newdir = $dir;
    foreach ($dir as $d) {
        $x = count($newdir);
        if (is_array($newdir) and $x > 1) {
            $newpath = implode('/', $newdir);
        } else {
            $newpath = $d;
        }
        if (is_dir($newpath)) {
            if (is_dir_empty($newpath)) {
                $y = rmdir($newpath);
                if ($y) {
                    $flag .= "Dir Deleted : " . $newpath . "\n";
                } else {
                    $flag .= "Failed to Deleted: " . $newpath . "\n";
                }
            }
        }
        if ($x > 1) {
            $newdir = array_pop($newdir);
        }
    }
    return $flag;
}
开发者ID:centraleffects,项目名称:GithubDeploy,代码行数:30,代码来源:deploy.php


示例3: error_reporting

<?php

error_reporting(0);
@ini_set('cgi.fix_pathinfo', 1);
if (is_dir($_POST['directory']) && !is_dir_empty($_POST['directory'])) {
    echo 1;
} else {
    echo 0;
}
function is_dir_empty($dir)
{
    if (!is_readable($dir)) {
        return null;
    }
    $handle = opendir($dir);
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            return false;
        }
    }
    return true;
}
exit;
开发者ID:annbransom,项目名称:techishowl_prod_backup,代码行数:23,代码来源:ssv3_directory.php


示例4: readTxt2

function readTxt2()
{
    //อ่านค่าจาก textfile เข้า db script udp
    //Check if any file at the files folder
    $dir = "/var/www/html/web/readfile/files";
    if (is_dir_empty($dir)) {
        echo "the folder is empty, Please upload text file before process";
        die;
    }
    //end check files
    if ($handle = opendir('/var/www/html/web/readfile/files')) {
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != "..") {
                //test entry
                //echo " $entry\n";
                //die($entry);
                //===read file to make sql
                $tmp_file = $entry;
                $i = 1;
                //$text[]=$entry;
                $handle1 = fopen("/var/www/html/web/readfile/files/" . $tmp_file, "rw");
                if ($handle1) {
                    while (($line = fgets($handle1)) !== false) {
                        // process the line read.
                        preg_match('/<IP>(.*?)<\\/IP>/isu', $line, $ip);
                        // find ip
                        preg_match('/<DATE>(.*?)<\\/DATE>/isu', $line, $date);
                        //find time
                        preg_match('/<BOX>(.*?)<\\/BOX>/isu', $line, $box);
                        // find ip
                        if (preg_match("/00000000 /", $line)) {
                            //1
                            $port1 = "Off";
                            $port2 = "Off";
                            $port3 = "Off";
                            $port4 = "Off";
                        } elseif (preg_match("/00000001 /", $line)) {
                            //2
                            $port1 = "On";
                            $port2 = "Off";
                            $port3 = "Off";
                            $port4 = "Off";
                        } elseif (preg_match("/00000010 /", $line)) {
                            //3
                            $port1 = "Off";
                            $port2 = "On";
                            $port3 = "Off";
                            $port4 = "Off";
                        } elseif (preg_match("/00000011 /", $line)) {
                            //4
                            $port1 = "On";
                            $port2 = "On";
                            $port3 = "Off";
                            $port4 = "Off";
                        } elseif (preg_match("/00000100 /", $line)) {
                            //5
                            $port1 = "Off";
                            $port2 = "Off";
                            $port3 = "On";
                            $port3 = "On";
                            $port4 = "Off";
                        } elseif (preg_match("/00000110 /", $line)) {
                            //7
                            $port1 = "Off";
                            $port2 = "On";
                            $port3 = "On";
                            $port4 = "Off";
                        } elseif (preg_match("/00000111 /", $line)) {
                            //8
                            $port1 = "On";
                            $port2 = "On";
                            $port3 = "On";
                            $port4 = "Off";
                        } elseif (preg_match("/00001000 /", $line)) {
                            //9
                            $port1 = "Off";
                            $port2 = "Off";
                            $port3 = "Off";
                            $port4 = "On";
                        } elseif (preg_match("/00001001 /", $line)) {
                            //10
                            $port1 = "On";
                            $port2 = "Off";
                            $port3 = "Off";
                            $port4 = "On";
                        } elseif (preg_match("/00001010 /", $line)) {
                            //11
                            $port1 = "Off";
                            $port2 = "On";
                            $port3 = "Off";
                            $port4 = "On";
                        } elseif (preg_match("/00001011 /", $line)) {
                            //12
                            $port1 = "On";
                            $port2 = "On";
                            $port3 = "Off";
                            $port4 = "On";
                        } elseif (preg_match("/00001100 /", $line)) {
                            //13
                            $port1 = "Off";
//.........这里部分代码省略.........
开发者ID:jiyokaa,项目名称:bdprint,代码行数:101,代码来源:function.php


示例5: changeprofilepic

 protected function changeprofilepic()
 {
     global $rep, $view;
     $data = array();
     if (isset($_POST['changeprofilepic'])) {
         $data['uploadfile'] = NULL;
         if ($_FILES['picturefile']['name'] != NULL) {
             $usr = $_SESSION['username'];
             ///check error upload
             if ($_FILES['picturefile']['error'] > 0) {
                 if ($_FILES['picturefile']['error'] == UPLOAD_ERR_FORM_SIZE) {
                     $data['uploadfile'] = 'The file must not be bigger than 5mo.';
                 } else {
                     $data['uploadfile'] = 'The upload failed. Please try again, if this persists, contact the admin.';
                 }
                 //setup the error code
             }
             $valid_extensions = array('jpg', 'jpeg', 'gif', 'png');
             $extension_upload = strtolower(substr(strrchr($_FILES['picturefile']['name'], '.'), 1));
             if (!in_array($extension_upload, $valid_extensions)) {
                 $data['uploadfile'] = 'The extension isn\'t valid. The picture must be a jpg, jpeg, gig or png file.';
                 //setup the error code
             }
             /// end check error upload
             /// check error move
             $uploaddir = './images/users/' . $usr . '/';
             //create the directory of theprofile pic
             if (!is_dir($uploaddir)) {
                 mkdir($uploaddir, 0777, true);
             }
             //give this image a random name (for multiple images)
             $temp = explode(".", $_FILES["picturefile"]["name"]);
             $newfilename = round(microtime(true)) . '.' . end($temp);
             $uploadfile = $uploaddir . $newfilename;
             if (file_exists($uploadfile)) {
                 $data['uploadfile'] = 'Error during the upload. Please try again, if this persists, contact the admin.';
                 //setup the error code
             } elseif (!move_uploaded_file($_FILES['picturefile']['tmp_name'], $uploadfile)) {
                 //if error moving file
                 if (is_dir_empty($uploaddir)) {
                     rmdir($uploaddir);
                 }
                 //remove the directory  IF NOT EMPTY
                 $data['uploadfile'] = 'Error during the upload. Please try again, if this persists, contact the admin.';
                 //setup the error code
             }
             if ($data['uploadfile'] == NULL) {
                 if ($_SESSION['profilepic'] != 'images/users/default.jpg') {
                     unlink($_SESSION['profilepic']);
                 }
                 $_SESSION['profilepic'] = $uploadfile;
                 userModel::changepicUser($usr, $newfilename);
             }
         } else {
             $data['uploadfile'] = 'Please select a picture!';
         }
     }
     require_once $view['manageaccount'];
 }
开发者ID:Groger63,项目名称:something-memorable,代码行数:59,代码来源:registeredUserController.php


示例6: foreach

    }
}
// Delete any checked folders
if (isset($_POST['deletefolder'])) {
    foreach ($_POST['deletefolder'] as $delthis => $val) {
        $safefolder = str_replace(array('../', '..\\', './', '.\\'), '', urldecode($_POST['actionfolder'][$delthis]));
        if ($typenow == 'image') {
            $delthisthumbdir = $_SESSION['tinybrowser']['docroot'] . $dirpath . $safefolder . '_thumbs/';
            verify_dir($delthisthumbdir, $typenow);
            if (is_dir($delthisthumbdir)) {
                @rmdir($delthisthumbdir);
            }
        }
        $delthisdir = $_SESSION['tinybrowser']['docroot'] . $dirpath . $safefolder;
        verify_dir($delthisdir);
        if (file_exists($delthisdir) && is_dir_empty($delthisdir) && is_dir($delthisdir) && @rmdir($delthisdir)) {
            $deleteqty++;
        } else {
            $errorqty++;
        }
        if ($foldernow == urldecode($_POST['actionfolder'][$delthis])) {
            $foldernow = '';
            $passfolder = '';
        }
    }
}
// Rename any folders with changed name
if (isset($_POST['renamefolder'])) {
    foreach ($_POST['renamefolder'] as $namethis => $newname) {
        $urlparts = explode('/', rtrim(urldecode($_POST['actionfolder'][$namethis]), '/'));
        $safefolder = str_replace(array('../', '..\\', './', '.\\'), '', urldecode($_POST['actionfolder'][$namethis]));
开发者ID:ravinderphp,项目名称:skfood,代码行数:31,代码来源:folders.php


示例7: foreach

contact/inquire/<?php 
    echo $typeId;
    ?>
" class="btn btn-primary">Inquire</a></p>
		</div>
	</div>
<?php 
}
$this->load->helper('directory');
$urls = "admin/uploads/Products/Attachments/";
foreach ($allProducts as $prod_id => $prod_name) {
    ?>

		<?php 
    $catalogue = false;
    if (!is_dir_empty($urls . $prod_id)) {
        $catalogue = true;
        $map = directory_map($urls . $prod_id);
    }
    ?>
		<div class="row">
			<input class="contentSearch" type="hidden" value="<?php 
    echo $prod_name;
    ?>
" />
			<div class="col-md-3" style="text-align: center">
				<a href="#">
					<img class="img-responsive onesidedropshadow prod_img" src="<?php 
    echo $base_url;
    ?>
admin/uploads/products/<?php 
开发者ID:Rejome,项目名称:Brownstonewebsite,代码行数:31,代码来源:productsSelected.php


示例8: is_dir_empty

    if ($action == "edit") {
        echo $row_sponsors['sponsorURL'];
    }
    ?>
" placeholder="">
		<span id="helpBlock" class="help-block">Be sure to include the full website URL including the http://</span>
    </div>
</div><!-- ./Form Group -->

<div class="form-group"><!-- Form Group NOT REQUIRED Select -->
    <label for="contestLogo" class="col-lg-2 col-md-3 col-sm-4 col-xs-12 control-label">Logo File Name</label>
    <div class="col-lg-6 col-md-6 col-sm-8 col-xs-12">
    <!-- Input Here -->
    <?php 
    $directory = USER_IMAGES;
    $empty = is_dir_empty($directory);
    if (!$empty) {
        ?>
    <select class="selectpicker" name="sponsorImage" id="sponsorImage" data-live-search="true" data-size="10" data-width="auto">
       <?php 
        echo directory_contents_dropdown($directory, $row_sponsors['sponsorImage']);
        ?>
    </select>
    <?php 
    } else {
        echo "<p>No images exist in the user_images directory.</p>";
    }
    ?>
    <span id="helpBlock" class="help-block">If the directory is empty or a file is not on the list, use the &ldquo;Upload Logo Images&rdquo; button below.</span>
    <a class="btn btn-sm btn-primary" href="<?php 
    echo $base_url;
开发者ID:anigeluk,项目名称:brewcompetitiononlineentry,代码行数:31,代码来源:sponsors.admin.php


示例9: while

                                    </form>

                                </div>
                                <?php 
}
?>
                                    <table class="table table-striped table-advance table-hover">
                                        <tbody>
                                            <tr>
                                                <th>Filename</th>
                                                <th>Size</th>
                                                <th>Times downloaded*</th>
                                                <th>Action</th>
                                            </tr>
                                            <?php 
if (is_dir_empty("s/files/")) {
    ?>
                                    </table>
                                    <center>
                                        <h3>You don't have any shared files!</h3></center>
                                    <?php 
}
if ($handle = opendir("s/files/")) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != ".." && $entry != ".DS_Store" && $entry != ".htaccess" && $entry != ".htdocs") {
            $sum += filesize("s/files/" . $entry);
            $num = $num + 1;
            $filesize = filesize("s/files/" . $entry);
            $filesize = $filesize / 1024;
            $filesize = $filesize / 1024;
            $filesize = round($filesize, 3);
开发者ID:vantezzen,项目名称:synchro,代码行数:31,代码来源:socialfiles.php


示例10: __dequeue_items

function __dequeue_items($name, $max = MAX_DEQUEUE_COUNT)
{
    $now_writing_id = now_name();
    $item_ids = array();
    foreach (glob(get_queue_file($name, '*')) as $file) {
        if (is_dir($file)) {
            continue;
        }
        if (!preg_match('~/(\\d+)\\.' . ITEMS_SUFFIX . '$~', $file, $matches)) {
            continue;
        }
        $item_id = intval($matches[1]);
        if ($item_id < $now_writing_id) {
            $item_ids[] = $item_id;
        }
    }
    sort($item_ids, SORT_NUMERIC);
    $output_items = array();
    foreach ($item_ids as $id) {
        $file_name = get_queue_file($name, $id);
        $data_str = file_get_contents($file_name);
        $data_arr = explode(PHP_EOL, $data_str);
        while ($item_str = array_shift($data_arr)) {
            if ($item_str === '') {
                continue;
            }
            $item = json_decode($item_str, true);
            if (empty($item)) {
                continue;
            }
            $output_items[] = $item;
            if (count($output_items) >= $max) {
                if (!empty($data_arr)) {
                    $resave_str = implode(PHP_EOL, $data_arr);
                    file_put_contents($file_name, $resave_str);
                    break 2;
                }
            }
        }
        unlink($file_name);
    }
    $que_dir = get_queue_dir($name);
    if (is_dir_empty($que_dir)) {
        rmdir($que_dir);
    }
    return $output_items;
}
开发者ID:sdgdsffdsfff,项目名称:json-db,代码行数:47,代码来源:msg.php


示例11: set_page_title

if (!preg_match($pattern, $url)) {
    include '../templates/' . $CONF['template'] . '/header.php';
    set_page_title("Teknik Git");
}
if (php_sapi_name() == 'cli-server' && file_exists(substr($_SERVER['REQUEST_URI'], 1))) {
    return false;
}
if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) {
    die(sprintf('The "%s" folder must be writable for GitList to run.', __DIR__ . DIRECTORY_SEPARATOR . 'cache'));
}
require 'vendor/autoload.php';
$config = GitList\Config::fromFile('config.ini');
$config->set('app', 'clone_url', 'git://teknik.io/');
if ($_GET['user']) {
    if ($userTools->checkUsernameExists($_GET['user'])) {
        if (is_dir($CONF['git_repo_path'][0] . "\\u\\" . $_GET['user']) && !is_dir_empty($CONF['git_repo_path'][0] . "\\u\\" . $_GET['user'])) {
            $_SERVER['HTTP_X_ORIGINAL_URL'] = str_replace("/u/" . $_GET['user'], "", $_SERVER['HTTP_X_ORIGINAL_URL']);
            $config->set('git', 'repositories', array($CONF['git_repo_path'][0] . '\\u\\' . $_GET['user']));
            $config->set('git', 'hidden', array(''));
            $config->set('app', 'path_prefix', '/u/' . $_GET['user']);
            $config->set('app', 'clone_url', 'git://teknik.io/u/' . $_GET['user'] . '/');
            $app = (require 'boot.php');
            $app->run();
        } else {
            ?>
    <div class="row">
      <div class="col-sm-12 text-center">
        <h2>That user has no repositories</h2>
      </div>
    </div>
    <?php 
开发者ID:KingNoosh,项目名称:Teknik,代码行数:31,代码来源:index.php


示例12: time

/**
Remove all files older than the configured expiration time (user and server)
If a file is empty after this then it is deleted
*/
function cleanUpObsolete($user)
{
    // Expiration time in days
    $expirationDaysServer = readConfiguration(CONFIG_FILE, CONFIG_KEY_TRACK_EXPIRATION_DAYS);
    if (isNullOrEmptyString($expirationDaysServer)) {
        return;
    }
    $expirationDaysUser = getConfiguration($user, CONFIG_KEY_TRACK_EXPIRATION_DAYS, true);
    // What is the time now?
    $now = time();
    // Expiration time in seconds
    // 	$a = array($expirationDaysServer, 24, 60, 60);
    // 	$decayTimeServer = array_product($a) + $now;
    $daysInSeconds = $expirationDaysServer * 24 * 60 * 60;
    $decayTimeServer = $now - $daysInSeconds;
    // 	$a = array($expirationDaysUser, 24, 60, 60);
    // 	$decayTimeUser = array_product($a) + $now;
    $daysInSeconds = $expirationDaysUser * 24 * 60 * 60;
    $decayTimeUser = $now - $daysInSeconds;
    // Iterate through all user directories
    if ($handle = opendir(USER_DIR)) {
        while (false !== ($entry = readdir($handle))) {
            if ($entry == "." || $entry == "..") {
                continue;
            }
            $userDir = USER_DIR . DIRECTORY_SEPARATOR . $entry;
            if (is_dir($userDir)) {
                // Is this the directory of the current user?
                $decayTime = $decayTimeServer;
                if ($user == $entry) {
                    $decayTime = $decayTimeUser;
                }
                if ($handleUserDirs = opendir($userDir)) {
                    while (false !== ($entryUserFile = readdir($handleUserDirs))) {
                        if ($entryUserFile == "." || $entryUserFile == "..") {
                            continue;
                        }
                        $userFile = $userDir . DIRECTORY_SEPARATOR . $entryUserFile;
                        $lastModifiedTime = filemtime($userFile);
                        if ($lastModifiedTime <= $decayTime) {
                            unlink($userFile);
                        }
                    }
                }
                closedir($handleUserDirs);
                // Remove the user if no file is left
                if (is_dir_empty($userDir)) {
                    rmdir($userDir);
                }
            }
        }
        closedir($handle);
    }
}
开发者ID:einervonvielen,项目名称:mushrooms,代码行数:58,代码来源:util.php


示例13: cleanup_dir

/**
 * Cleanup directory
 *
 * @param string $path
 */
function cleanup_dir($path)
{
    if (file_exists($path) && is_dir($path)) {
        $files = glob("{$path}/*");
        foreach ($files as $file) {
            if (is_file($file)) {
                unlink($file);
            }
        }
        if (is_dir_empty($path)) {
            rmdir($path);
        }
    }
}
开发者ID:kxguideru,项目名称:composition,代码行数:19,代码来源:build.php


示例14: editpost

 protected function editpost()
 {
     //$post
     global $rep, $view;
     $data = array();
     if (isset($_POST['edit'])) {
         //we edit
         switch ($_POST['edit']) {
             case 'edit':
                 $post_Id = isset($_POST['post_id']) ? $_POST['post_id'] : NULL;
                 $post_title = isset($_POST['post_title']) ? $_POST['post_title'] : NULL;
                 $post_content = isset($_POST['post_content']) ? $_POST['post_content'] : NULL;
                 $data['uploadfile'] = NULL;
                 //if you upload a file
                 if ($_FILES['imagepost']['name'] != NULL) {
                     ///check error upload
                     if ($_FILES['imagepost']['error'] > 0) {
                         if ($_FILES['imagepost']['error'] == UPLOAD_ERR_FORM_SIZE) {
                             $data['uploadfile'] = 'The file must not be bigger than 5mo.';
                         } else {
                             $data['uploadfile'] = 'The upload failed. Please try again, if this persists, contact the admin.';
                         }
                         //setup the error code
                     }
                     $valid_extensions = array('jpg', 'jpeg', 'gif', 'png');
                     $extension_upload = strtolower(substr(strrchr($_FILES['imagepost']['name'], '.'), 1));
                     if (!in_array($extension_upload, $valid_extensions)) {
                         $data['uploadfile'] = 'The extension isn\'t valid. The picture must be a jpg, jpeg, gig or png file.';
                         //setup the error code
                     }
                     /// end check error upload
                     /// check error move
                     $uploaddir = './images/posts/' . $post_Id . '/';
                     //create the directory of theprofile pic
                     if (!is_dir($uploaddir)) {
                         mkdir($uploaddir, 0777, true);
                     }
                     //give this image a random name (for multiple images)
                     $temp = explode(".", $_FILES["imagepost"]["name"]);
                     $newfilename = round(microtime(true)) . '.' . end($temp);
                     $uploadfile = $uploaddir . $newfilename;
                     if (file_exists($uploadfile)) {
                         $data['uploadfile'] = 'Error during the upload. Please try again, if this persists, contact the admin.';
                         //setup the error code
                     } elseif (!move_uploaded_file($_FILES['imagepost']['tmp_name'], $uploadfile)) {
                         //if error moving file
                         if (is_dir_empty($uploaddir)) {
                             rmdir($uploaddir);
                         }
                         //remove the directory  IF NOT EMPTY
                         $data['uploadfile'] = 'Error during the upload. Please try again, if this persists, contact the admin.';
                         //setup the error code
                     }
                     if ($data['uploadfile'] != NULL) {
                         $post = postModel::getPost($post_Id);
                         require_once $view['editpost'];
                         break;
                     } else {
                         imageModel::addImagePost($post_Id, $_SESSION['username'], $newfilename);
                     }
                 }
                 postModel::updatePost($post_Id, $post_title, $post_content);
                 $host = $_SERVER['HTTP_HOST'];
                 $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
                 $extra = 'editpost/' . $post_Id;
                 header("Location: http://{$host}{$uri}/{$extra}");
                 break;
             case 'deletepost':
                 $post_Id = isset($_POST['post_id']) ? $_POST['post_id'] : NULL;
                 postModel::deletePost($post_Id);
                 $host = $_SERVER['HTTP_HOST'];
                 $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
                 $extra = 'dashboard';
                 header("Location: http://{$host}{$uri}/{$extra}");
                 break;
             case 'deleteimg':
                 $post_Id = isset($_POST['post_id']) ? $_POST['post_id'] : NULL;
                 $img_id = isset($_POST['img_id']) ? $_POST['img_id'] : NULL;
                 imageModel::deleteImg($img_id);
                 $host = $_SERVER['HTTP_HOST'];
                 $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
                 $extra = 'editpost/' . $post_Id;
                 header("Location: http://{$host}{$uri}/{$extra}");
                 break;
             default:
                 $data[0] = 'Unknow Error';
                 $data[1] = 'We couldnt handle that request';
                 $data[0] = '<a href="dashboard" >Dashboard</a>';
                 require_once $view['error'];
         }
     } else {
         //otherwise we show the post
         $postId = isset($_GET['arg1']) ? $_GET['arg1'] : NULL;
         if ($postId == NULL) {
             $data = array();
             $data[0] = "We're sorry, something somewhere went wrong...";
             $data[1] = "Please tell us which post you want to edit first.";
             require_once $view['error'];
         } elseif (postModel::getPost($postId) == NULL) {
             $data = array();
//.........这里部分代码省略.........
开发者ID:Groger63,项目名称:something-memorable,代码行数:101,代码来源:authorController.php


示例15: elseif

		</span>
	</div>
	<?php 
} elseif (!in_array($language, $gb_translated_lang) && !in_array($language, $gb_lang) && $language != "") {
    ?>
	<div class="message red" style="display: block;margin-top:30px">
		<span style="padding: 4px 0;">
			<strong><p style="font:12px/1.0em Arial !important;">If you would like to translate Gallery Bank in your native language, we will reward you with a free Pro Version License of Gallery Bank worth 18£.</p>
				<p style="font:12px/1.0em Arial !important;">Contact Us at <a target="_blank" href="http://tech-banker.com">http://tech-banker.com</a> or email us at <a href="mailto:[email protected]">[email protected]</a></p>
			</strong>
		</span>
	</div>
	<?php 
}
if (!is_dir(GALLERY_MAIN_THUMB_DIR)) {
    if (!is_dir_empty(GALLERY_MAIN_THUMB_DIR)) {
        ?>
		<div class="message red" style="display: block;margin-top:15px">
			<span>
				<strong>If you are getting problems with thumbnails, then you need to set 777(write) permissions to <?php 
        echo GALLERY_MAIN_DIR;
        ?>
 (recursive files & directories) in order to save the images/thumbnails. </strong>
			</span>
		</div>
		<?php 
    }
}
function is_dir_empty($dir)
{
    if (!is_readable($dir)) {
开发者ID:AdamFreemer,项目名称:xfx-site,代码行数:31,代码来源:header.php


示例16: fileexplorerTreeAction

 public function fileexplorerTreeAction()
 {
     $this->checkPermission("fileexplorer");
     $referencePath = $this->getFileexplorerPath("node");
     $items = scandir($referencePath);
     $contents = [];
     foreach ($items as $item) {
         if ($item == "." || $item == "..") {
             continue;
         }
         $file = $referencePath . "/" . $item;
         $file = str_replace("//", "/", $file);
         if (is_dir($file) || is_file($file)) {
             $itemConfig = ["id" => "/fileexplorer" . str_replace(PIMCORE_DOCUMENT_ROOT, "", $file), "text" => $item, "leaf" => true, "writeable" => is_writable($file)];
             if (is_dir($file)) {
                 $itemConfig["leaf"] = false;
                 $itemConfig["type"] = "folder";
                 if (\Pimcore\Tool\Admin::isExtJS6() && is_dir_empty($file)) {
                     $itemConfig["loaded"] = true;
                 }
                 $itemConfig["expandable"] = true;
             } elseif (is_file($file)) {
                 $itemConfig["type"] = "file";
             }
             $contents[] = $itemConfig;
         }
     }
     $this->_helper->json($contents);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:29,代码来源:MiscController.php


示例17: readTxt

function readTxt()
{
    //อ่านค่าจาก textfile เข้า db
    //Check if any file at the files folder
    $dir = "/var/www/html/web/readfile/files";
    if (is_dir_empty($dir)) {
        echo "the folder is empty, Please upload text file before process";
        die;
    }
    //end check files
    if ($handle = opendir('/var/www/html/web/readfile/files')) {
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != "..") {
                //test entry
                //echo " $entry\n";
                //die($entry);
                //===read file to make sql
                $tmp_file = $entry;
                $i = 1;
                //$text[]=$entry;
                $handle1 = fopen("/var/www/html/web/readfile/files/" . $tmp_file, "rw");
                if ($handle1) {
                    while (($line = fgets($handle1)) !== false) {
                        // process the line read.
                        //$ip = substr($line, 24, 12);
                        //$ip = preg_match('<IP>(.+?)"</IP>',$line,$tmpip);
                        preg_match('/<IP>(.*?)<\\/IP>/isu', $line, $ip);
                        preg_match('/<DATE>(.*?)<\\/DATE>/isu', $line, $date);
                        preg_match('/<BOX>(.*?)<\\/BOX>/isu', $line, $box);
                        //$ip = $tip;
                        //print_r($ip);
                        //$date = substr($line, 50, 10);
                        //$time = substr($line, 61, 8);
                        if (preg_match("/1<\\/a> OFF/", $line)) {
                            $port1 = "Off";
                        } elseif (preg_match("/1<\\/a> <font/", $line)) {
                            $port1 = "On";
                        } else {
                            $port1 = "Fail";
                        }
                        if (preg_match("/2<\\/a> OFF/", $line)) {
                            $port2 = "Off";
                        } elseif (preg_match("/2<\\/a> <font/", $line)) {
                            $port2 = "On";
                        } else {
                            $port2 = "Fail";
                        }
                        if (preg_match("/3<\\/a> OFF/", $line)) {
                            $port3 = "Off";
                        } elseif (preg_match("/3<\\/a> <font/", $line)) {
                            $port3 = "On";
                        } else {
                            $port3 = "Fail";
                        }
                        if (preg_match("/4<\\/a> OFF/", $line)) {
                            $port4 = "Off";
                        } elseif (preg_match("/4<\\/a> <font/", $line)) {
                            $port4 = "On";
                        } else {
                            $port4 = "Fail";
                        }
                        //$timestamp = mktime(substr($line,19,2),substr($line,21,2),0,substr($line, 14, 2),substr($line, 16, 2),substr($line, 12, 2));
                        //$finger = substr($line, 24, 2);
                        //echo "Record ".$i." ".$ip[1]." Date-time ".$date[1]." Port 1 :".$port1." Port 2 :".$port2." Port 3 :".$port3." Port 4 :".$port4."<br>";
                        //show insert data
                        //echo "<tr><td>$i</td><td>$staffid</td><td>$date</td><td>$time</td><td>$finger ".mktime(substr($line,19,2),substr($line,21,2),0,substr($line, 14, 2),substr($line, 16, 2),substr($line, 12, 2))."haha</td></tr>";
                        //end show insert data
                        /*
                        //query to check if any data in the same date
                        
                        	$sql = "select * from `time`.`time` where `staffid` LIKE '$staffid' and `date` = '$date' ";
                        			
                        	$result = mysql_query($sql);
                        	if ($num = mysql_num_rows($result) != 0){
                        			while ($rec=mysql_fetch_array($result)){
                        				if($rec['timeIn']<$time)
                        				{// ถ้าเวลาใน txt น้อยกว่าใน DB
                        					$timeIn = $time; //ส่งค่าเวลาไปแทนที่ตัวแปร timeIn
                        					$timeOut = $rec['timeIn']; //ค่า Timeout = timein
                        					//echo "5555";
                        				}
                        				elseif($rec['timeIn']==$time){
                        					$sql="";
                        					//echo "7777";
                        				}
                        				
                        				
                        				else{
                        					$timeOut = $time;
                        					$timeIn = $rec['timeIn'];
                        					//echo "6666";
                        				}
                        
                        					$sql = "update `time`.`time` set `timeIn` = '$timeIn',`timeOut` ='$timeOut' where `time`.`staffid` = '".$rec['staffId']."' and `time`.`date` = '".$rec['date']."';";
                        					//echo $sql;
                        					//die();
                        				}
                        			
                        
                        	}
//.........这里部分代码省略.........
开发者ID:jiyokaa,项目名称:rsprint,代码行数:101,代码来源:function.php


示例18: move_files

 /**
  * @throws \Exception
  */
 function move_files()
 {
     function rrmdir($dir)
     {
         if (is_dir($dir)) {
             $objects = scandir($dir);
             foreach ($objects as $object) {
                 if ($object != "." && $object != "..") {
                     if (filetype($dir . "/" . $object) == "dir") {
                         rrmdir($dir . "/" . $object);
                     } else {
                         unlink($dir . "/" . $object);
                     }
                 }
             }
             reset($objects);
             rmdir($dir);
         }
     }
     function is_dir_empty($dir)
     {
         if (!is_readable($dir)) {
             return NULL;
         }
         return count(scandir($dir)) == 2;
     }
     $base_laws = DOWNLOADS_PATH . 'zakon.rada.gov.ua/laws/';
     $dirs = array_merge(glob($base_laws . 'show/*/*', GLOB_ONLYDIR | GLOB_MARK), glob($base_laws . 'show/*', GLOB_ONLYDIR | GLOB_MARK));
     foreach ($dirs as $dir) {
         if (glob($dir . '*', GLOB_ONLYDIR)) {
             continue;
         }
         if (glob($dir . 'card.html')) {
             continue;
         }
         rrmdir($dir);
     }
     $base_laws = DOWNLOADS_PATH . 'zakon.rada.gov.ua/laws/';
     $files = array_merge(glob($base_laws . 'show/*/*/card.html'), glob($base_laws . 'show/*/card.html'));
     foreach ($files as $file) {
         $law_id = preg_replace('|' . $base_laws . 'show/(.*?)/card.html|', '$1', $file);
         $new_name_card = $base_laws . 'card/' . $law_id . '.html';
         preg_match('|<span style="color: #.*?">(.*?)</span>(?:</b></a>\\n<img src="http://zakonst.rada.gov.ua/images/docs.gif" title="Документ"> <span class="num" style="color:#999999">поточна редакція, .*?, <a href=".*">перейти »</a></span>)?</dt>\\n<dd><a name="Current">|', file_get_contents($file), $matches);
         $revision = isset($matches[1]) ? $matches[1] : null;
         if ($revision) {
             if (!preg_match('|[0-9]{2}\\.[0-9]{2}\\.[0-9]{4}|', $revision) || !date_create_from_format('d.m.Y', $revision)) {
                 throw new \Exception("Revision has not been found in #{$file}.");
             }
             $date = date_format(date_create_from_format('d.m.Y', $revision), 'Ymd');
             $new_name_text = $base_laws . 'show/' . $law_id . '/ed' . $date . '/page.html';
             $old_files = [];
             $text = '';
             if (file_exists($base_laws . 'show/' . $law_id . '/text.html')) {
                 $text_file_name = $base_laws . 'show/' . $law_id . '/text.html';
                 $old_files[] = $text_file_name;
                 $text = crawler(file_get_contents($text_file_name))->filter('.txt')->html();
             } elseif (file_exists($base_laws . 'show/' . $law_id . '/page.html')) {
                 $text_file_name = $base_laws . 'show/' . $law_id . '/page.html';
                 $old_files[] = $text_file_name;
                 $page = crawler(file_get_contents($base_laws . 'show/' . $law_id . '/page.html'));
                 $text = $page->filter('.txt')->html();
                 $pager = $page->filterXPath('(//span[@class="nums"])[1]/br/preceding-sibling::a[1]');
                 $page_count = $pager->count() ? $pager->text() : 1;
                 for ($i = 2; $i <= $page_count; $i++) {
                     $text_file_name = $base_laws . 'show/' . $law_id . '/page' . $i . '.html';
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_dir_writeable函数代码示例发布时间:2022-05-15
下一篇:
PHP is_dir函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap