Ejemplo n.º 1
0
 function getImages()
 {
     $path = $this->customPath() . 'img/';
     !is_dir($path) && mkdir($path);
     $url = path2uri($path);
     $ret = array();
     foreach (scanDir($path) as $f) {
         if (!is_file($path . $f)) {
             continue;
         }
         $ret[] = $url . $f;
     }
     return $ret;
 }
Ejemplo n.º 2
0
 /**
  * Gets the ThemeMeta of all themes that exist. In other words, this
  * method returns all possible values for which self::themeExists returns
  * true.
  * @return string[] All theme directory names.
  */
 public function getAllThemes()
 {
     $themesDir = $this->website->getUriThemes();
     $rawFiles = scanDir($themesDir);
     $allThemeDirs = array_filter($rawFiles, function ($fileName) use($themesDir) {
         if ($fileName[0] === '.') {
             // Directories starting with . should be ignored. This includes
             //  "./", "../", ".somehiddentheme/"
             return false;
         }
         if (!$this->themeExists($fileName)) {
             // Only include theme directories, not files
             return false;
         }
         return true;
     });
     return array_map(function ($themeName) {
         return $this->getThemeMeta($themeName);
     }, $allThemeDirs);
 }
Ejemplo n.º 3
0
 /**
  * Gets a list of all installed widgets.
  * @return WidgetMeta[] List of all installed widgets.
  */
 public function getInstalledWidgets()
 {
     $widgets = [];
     $directoryToScan = $this->website->getUriWidgets();
     // Check directory
     if (!is_dir($directoryToScan)) {
         return;
     }
     // Scan it
     $files = scanDir($directoryToScan);
     foreach ($files as $file) {
         // Ignore hidden files
         if ($file[0] === '.') {
             continue;
         }
         // Ignore anything that's not a directory
         if (!is_dir($directoryToScan . $file)) {
             continue;
         }
         $widgets[] = new WidgetMeta($file, new InfoFile($directoryToScan . $file . "/info.txt"));
     }
     return $widgets;
 }
Ejemplo n.º 4
0
function copyOverSettings($icvInfo)
{
    global $updateDone;
    // System settings
    echo 'Transposing system settings...<br>';
    transposeSettings(PATH . "lib/config___settings.php", "config___settings.php", "config___settings.php");
    // Users template settings
    echo 'Transposing users template settings...<br>';
    transposeSettings(PATH . "lib/config___users-template.php", "config___users-template.php", "config___users-template.php");
    // Users settings files
    $fileList = scanDir(PATH . "lib/");
    for ($i = 0; $i < count($fileList); $i++) {
        if (strpos($fileList[$i], "config-") > -1) {
            echo 'Transposing users settings file ' . $fileList[$i] . '...<br>';
            transposeSettings(PATH . "lib/" . $fileList[$i], "config___users-template.php", $fileList[$i]);
        }
    }
    echo 'All update tasks completed...<br>';
    $updateDone = true;
}
Ejemplo n.º 5
0
}
if (!$_SESSION['loggedIn']) {
    header("Location: ../");
}
// If we're just getting a branch, get that and set as the finalArray
$scanDir = $docRoot . $iceRoot;
$location = "";
if (isset($_GET['location'])) {
    echo '<div id="branch" style="display: none">';
    $location = str_replace("|", "/", $_GET['location']);
}
if ($location == "/") {
    $location = "";
}
$dirArray = $filesArray = $finalArray = array();
$finalArray = scanDir($scanDir . $location);
foreach ($finalArray as $entry) {
    $canAdd = true;
    for ($i = 0; $i < count($_SESSION['bannedFiles']); $i++) {
        if ($_SESSION['bannedFiles'][$i] != "" && strpos($entry, $_SESSION['bannedFiles'][$i]) !== false) {
            $canAdd = false;
        }
    }
    if ("/" . $entry == $ICEcoderDir) {
        $canAdd = false;
    }
    if ($entry != "." && $entry != ".." && $canAdd) {
        is_dir($docRoot . $iceRoot . $location . "/" . $entry) ? array_push($dirArray, $location . "/" . $entry) : array_push($filesArray, $location . "/" . $entry);
    }
}
natcasesort($dirArray);
Ejemplo n.º 6
0
<?php

$path = "./KO";
$files = scanDir($path);
// on garde le fichiers pendant 30 jours
$datarchiv = date("Y-m-d", mktime(0, 0, 0, date('m'), date('d') - 30, date('Y')));
echo "---" . $datarchiv . "</br>";
$datarchiv = new DateTime($datarchiv);
$datarchiv = $datarchiv->format("Ymd");
foreach ($files as $mp3) {
    if (strpos($mp3, ".mp3")) {
        $mp3_expl = explode("-", $mp3);
        $d = $mp3_expl[2];
        $m = $mp3_expl[1];
        $y = $mp3_expl[0];
        $date_mp3 = "{$y}-{$m}-{$d}";
        echo $date_mp3;
        // test
        $date_mp3 = new DateTime($date_mp3);
        $date_mp3 = $date_mp3->format("Ymd");
        if ($date_mp3 < $datarchiv) {
            unlink("./KO/" . $mp3);
            //echo " -> supp </br>";
        }
        /*else
        		{
        			echo ". </br>";
        		}*/
    }
}
Ejemplo n.º 7
0
 /**
  * Gets all non-hidden direct subdirectories as a 1-dimensional
  * array in the given directory. If the given directory doesn't exist, an
  * empty array is returned.
  * @param string $directory_to_scan THe directory to scan.
  * @return \string The file names, without the path.
  */
 protected function get_sub_directory_names($directory_to_scan)
 {
     $results = [];
     if (is_dir($directory_to_scan)) {
         $files = scanDir($directory_to_scan);
         foreach ($files as $file_name) {
             if ($file_name[0] != '.') {
                 // Ignore hidden files and directories above this one
                 if (is_dir($directory_to_scan . $file_name)) {
                     $results[] = $file_name;
                 }
             }
         }
     }
     return $results;
 }
Ejemplo n.º 8
0
function copyOverSettings($icvInfo)
{
    global $updateDone, $configSettings;
    // System settings
    echo 'Transposing system settings...<br>';
    // Create a new config file if it doesn't exist yet.
    // The reason we create it, is so it has PHP write permissions, meaning we can update it later
    if (!file_exists(dirname(__FILE__) . "/" . $configSettings)) {
        echo 'Creating new settings file...<br>';
        // Include our params to make use of (as $newConfigSettingsFile)
        include dirname(__FILE__) . "/settings-system-params.php";
        if ($fConfigSettings = fopen(dirname(__FILE__) . "/" . $configSettings, 'w')) {
            fwrite($fConfigSettings, $newConfigSettingsFile);
            fclose($fConfigSettings);
        } else {
            die("Cannot update config file lib/" . $configSettings . ". Please check write permissions on lib/ and try again");
        }
    }
    transposeSettings(PATH . "lib/config___settings.php", "config___settings.php", "config___settings.php");
    // Users template settings
    echo 'Transposing users template settings...<br>';
    transposeSettings(PATH . "lib/config___users-template.php", "config___users-template.php", "config___users-template.php");
    // Users settings files
    $fileList = scanDir(PATH . "lib/");
    for ($i = 0; $i < count($fileList); $i++) {
        if (strpos($fileList[$i], "config-") > -1) {
            echo 'Transposing users settings file ' . $fileList[$i] . '...<br>';
            transposeSettings(PATH . "lib/" . $fileList[$i], "config___users-template.php", $fileList[$i]);
        }
    }
    echo 'All update tasks completed...<br>';
    $updateDone = true;
}
Ejemplo n.º 9
0
<?php

$hostDir = dirname(__FILE__);
$hostDir = $hostDir . '\\class';
$filesNames = scanDir($hostDir);
foreach ($filesNames as $fileName) {
    if ($fileName == "." || $fileName === "..") {
        continue;
    } else {
        //echo $fileUrl = $fileName;
        include 'class/' . $fileName;
    }
}
foreach (get_declared_classes() as $class) {
    $reflectionClass = new ReflectionClass($class);
    if ($reflectionClass->isUserDefined()) {
        //echo $reflectionClass->getEndLine();
        //Reflection::export($reflectionClass);
        //Reflection::getName($reflectionClass);
        $className = $reflectionClass->getName();
        $methodsName = $reflectionClass->getMethods();
        //	var_dump($methodsName);exit;
        foreach ($methodsName as $method) {
            $method = new ReflectionMethod($className, $method->name);
            $lines = $method->getEndline() - $method->getStartLine();
            echo "类名:" . $className . "方法名:" . $method->name . "行数:" . $lines;
        }
    }
}
Ejemplo n.º 10
0
<?php

require "application.php";
header("content-type: text/javascript");
if (array_key_exists("type", $_GET) && array_key_exists($_GET["type"], $stcTypes)) {
    $stcType = $stcTypes[$_GET["type"]];
    $strPath = getRootPath() . "/" . $stcType["path"];
    $strPath = str_ireplace("\\", "/", $strPath);
    $strURL = getRootURL() . "/" . $stcType["path"];
    $strURL = str_ireplace("\\", "/", $strURL);
    echo "var " . $stcType["tinyMceVarName"] . " = new Array(";
    if (file_exists($strPath)) {
        $aryEntries = scanDir($strPath);
        $blnComma = false;
        for ($i = 0; $i < count($aryEntries); $i++) {
            $strExt = preg_replace("/^.*\\./", "", $aryEntries[$i]);
            if (array_search($strExt, $stcType["extensions"], true)) {
                if ($blnComma) {
                    echo ",";
                }
                $blnComma = true;
                echo "\r\n\t[\"" . $aryEntries[$i] . "\", \"" . $strURL . "/" . $aryEntries[$i] . "\"]";
            }
        }
    }
    echo "\r\n);";
}
Ejemplo n.º 11
0
 /**
  * Info for the poll
  */
 public function infoPoll()
 {
     $poll = $this->state->poll;
     $voteDir = $this->state->directory . '/votes';
     $poll['count'] = count(scanDir($voteDir)) - 2;
     if ($poll['opened']) {
         unset($poll['answers']);
     } else {
         $answers = array();
         for ($i = 0; $i < $poll['size']; $i++) {
             $answers[$i] = 0;
         }
         foreach (scanDir($voteDir) as $file) {
             if ($file != '.' && $file != '..') {
                 $value = (int) file_get_contents($voteDir . '/' . $file);
                 $answers[$value]++;
             }
         }
         $poll['answers'] = $answers;
     }
     return $poll;
 }
 /**
  * Read the sqldump backup directory - function scanDir() >= php5
  *
  * @param  string $dpath      relative path
  * @param  string $delpath    url path
  */
 function backend_read_backup_dir($dpath, $delpath)
 {
     global $serendipity;
     $dir = array_slice(@scanDir($dpath), 2);
     $url = $serendipity['serendipityHTTPPath'] . 'plugin/guestbookdlsql/';
     if (is_array($dir) && !empty($dir)) {
         $str = '<table width="100%">';
         foreach ($dir as $e) {
             $str .= '<tr><td align="left"><a href="' . $url . $e . '">';
             $str .= $e . '</a></td> <td align="right" class="gb_button"><a href="' . $delpath . $e . '"><input type="submit" class="input_button state_cancel" name="erase file" value=" ' . TEXT_DELETE . ' "></a></td></tr>' . "\n";
         }
         $str .= '</table>';
         return $str;
     }
 }
 /**
  * read the sqldump backup directory - function scanDir() >= php5
  **/
 function backend_read_backup_dir($dpath, $delpath)
 {
     global $serendipity;
     $dir = array_slice(scanDir($dpath), 2);
     $url = $serendipity['serendipityHTTPPath'] . 'plugin/sql_export/';
     echo '<table width="100%">';
     foreach ($dir as $e) {
         echo '<tr><td align="left"><a href="' . $url . $e . '">';
         echo $e . '</a></td> <td align="right"><a href="' . $delpath . $e . '"><input type="button" class="serendipityPrettyButton" name="erase file" value=" ' . DELETE . ' " /></a></td></tr>' . "\n";
     }
     echo '</table>';
 }
Ejemplo n.º 14
0
<style>
a{
        background:orange;
        color:black;
        padding:10px;
        text-decoration:none;
        border:1px solid black;
        position:relative;
        float:left;
        margin-left:20px;
        margin-top:20px;
}
body{
        background:black;
}
</style>
</head>
<body>
<?php 
$s = scanDir('.');
for ($i = 0; $i < count($s); $i++) {
    if ($s[$i] == '.' || $s[$i] == '..' || $s[$i] == 'index.php' || $s[$i] == '.htaccess' || $s[$i] == '.htpasswd') {
        continue;
    } else {
        echo '<a href="javascript:window.open(\'' . $s[$i] . '/index.php\',\'' . $s[$i] . '\',\'width=345,height=265\')">' . str_replace('.jpg', '', $s[$i]) . '</a>' . "\n";
    }
}
?>
</body>
</html>