예제 #1
0
function scan_dir($path, $project)
{
    global $projects;
    $children = [];
    $dh = opendir($path);
    while (($entry = readdir($dh)) !== false) {
        if (preg_match('/^[.]/', $entry)) {
            continue;
        }
        $entry_path = $path . '/' . $entry;
        if (is_dir($entry_path)) {
            $entry_children = scan_dir($entry_path, $project);
            if (!empty($entry_children)) {
                $children[] = ['text' => $entry, 'id' => $entry_path, 'lines' => [], 'children' => $entry_children];
            }
        } elseif (preg_match('/[.]php$/', $entry)) {
            $lines = [];
            foreach (explode("\n", file_get_contents($entry_path)) as $i => $line) {
                $lines[] = ['line' => $i, 'code' => $line];
            }
            $children[] = ['leaf' => true, 'id' => preg_replace('/^' . preg_quote($projects[$project], '/') . '/', $project, $entry_path), 'text' => $entry, 'lines' => $lines];
        }
    }
    closedir($dh);
    return $children;
}
예제 #2
0
function wlist()
{
    $lines = null;
    $args = func_get_args();
    switch ($args[0]) {
        case 'scan':
            if ($elements = scan_dir($args[2]['path'], 'DIR')) {
                foreach ($elements as $value) {
                    if (is_file($args[2]['path'] . $value . $args[2]['find'])) {
                        $about = @parse_ini_file($args[2]['path'] . $value . '/protocol/about.gl.php');
                        $name = $about['product'] ? $about['product'] : $value;
                        $lines[$name] = $args[3] ? href(THIS, $args[3], $value) : href($value);
                        unset($about);
                    }
                }
            }
            break;
        default:
            if (is_array($args[2])) {
                foreach ($args[2] as $link => $name) {
                    $lines[$link] = href(THIS, $args[3], $name);
                }
            }
            break;
    }
    //Выводим массив ссылок ;)
    if ($lines) {
        foreach ($lines as $name => $link) {
            form("label", icon($args[1]) . '<a href="' . $link . '">' . $name . '</a>');
        }
    } else {
        html('<br> Wlist lib. (C) Kazin Fedor, 2010');
    }
}
예제 #3
0
function scan_dir($id)
{
    $result = true;
    foreach ($GLOBALS['db']->select("dir", ['owner' => $_SESSION["username"], 'parent' => $id]) as $d) {
        $result = scan_dir($d["id"]);
    }
    $result = delete_dir($id);
    return $result;
}
예제 #4
0
파일: games.php 프로젝트: ECP-Black/ECP
function get_icons()
{
    $files = scan_dir('images/games', true);
    $string = '<option value="0">' . CHOOSE . '</option>';
    foreach ($files as $value) {
        $string .= '<option value="' . $value . '">' . $value . '</option>';
    }
    return $string;
}
예제 #5
0
파일: topics.php 프로젝트: ECP-Black/ECP
function get_topic_pics($pic = '')
{
    $pics = '<option value="0">' . CHOOSE . '</option>';
    $folder = scan_dir('images/topics/', true);
    foreach ($folder as $value) {
        $pic == $value ? $sub = 'selected' : ($sub = '');
        $pics .= '<option ' . $sub . ' value="' . $value . '">' . $value . '</option>';
    }
    return $pics;
}
예제 #6
0
function scan_dir($id, $per)
{
    $result = true;
    foreach ($GLOBALS['db']->select("dir", ['parent' => $id]) as $k) {
        $result = $GLOBALS['db']->update("dir", ['share' => $per], ['id' => $k['id']]);
        $result = scan_dir($k["id"], $per);
    }
    foreach ($GLOBALS['db']->select("file", ['dir' => $id]) as $d) {
        $result = $GLOBALS['db']->update("file", ['share' => $per], ['id' => $d['id']]);
    }
    return $result;
}
예제 #7
0
파일: index.php 프로젝트: cheevauva/trash
function appendix_scan_dir($link = ' ')
{
    $dir = scan_dir(str_replace('kernel/', '', GLISS_DIR) . 'appendix', DIR);
    foreach ($dir as $key => $value) {
        if ($link == $value) {
            $sel = '" selected >';
        } else {
            $sel = '" >';
        }
        echo '<option value="' . $value . $sel . $value . '</option>' . "\n";
    }
}
예제 #8
0
 function scan_dir($dir, $pfix = "")
 {
     $r = array();
     $dh = opendir($dir);
     while ($fn = readdir($dh)) {
         if (is_dir("{$dir}/{$pfix}{$fn}")) {
             $r += scan_dir($dir, "{$pfix}{$fn}/");
         } else {
             $r[] = "{$pfix}{$fn}";
         }
     }
     return $r;
 }
예제 #9
0
	function scan_dir ($dir, $exceptions_array){
		$scand_dir = scandir($dir);
		$scan_dir_string = array();
		foreach ($scand_dir as $file) {
			if(!in_array(strtolower($file), $exceptions_array)){
				$scan_file = $dir.'/'.$file;
				if(is_dir($scan_file)){
					$scan_file= scan_dir ($scan_file, $exceptions_array);
				}
				array_push($scan_dir_string, $scan_file);
			}
		}
		return implode(',', $scan_dir_string);
	}
예제 #10
0
function scan_dir($location)
{
    $output = '';
    foreach ($GLOBALS['db']->select('dir', ['parent' => $location, 'owner' => $_SESSION["username"], 'recycle' => '0']) as $d) {
        $sdir = $GLOBALS['db']->select('dir', ['parent' => $d["id"], 'owner' => $_SESSION["username"], 'recycle' => '0']);
        if ($sdir[0]["id"] != null) {
            $output .= '<li><span class="tree-indicator"><i class="ion-ios7-minus-empty"></i></span>
                        <a href="#" class="filetreeselector" data-id="' . $d["id"] . '">' . $d["name"] . '</a>
                        <ul class="dir-tree" data-parent="' . $d["id"] . '">' . scan_dir($d["id"]) . '</ul></li>';
        } else {
            $output .= '<li><a href="#" class="filetreeselector" data-id="' . $d["id"] . '" >' . $d["name"] . '</a></li>';
        }
    }
    return $output;
}
예제 #11
0
파일: settings.php 프로젝트: ECP-Black/ECP
 function admin_settings()
 {
     global $db, $countries;
     if (isset($_POST['submit'])) {
         unset($_POST['submit']);
         $_POST['SITE_URL'] = strrpos($_POST['SITE_URL'], '/') !== strlen($_POST['SITE_URL']) - 1 ? check_url($_POST['SITE_URL'] . '/') : check_url($_POST['SITE_URL']);
         $sql = 'UPDATE ' . DB_PRE . 'ecp_settings SET ';
         foreach ($_POST as $key => $value) {
             $sql .= $key . ' = "' . strsave($value) . '", ';
         }
         $sql = substr($sql, 0, strlen($sql) - 2);
         if ($db->query($sql)) {
             header('Location: ?section=admin&site=settings');
         }
     } else {
         $dir = scan_dir('templates', true);
         $designs = '';
         foreach ($dir as $value) {
             if (is_dir('templates/' . $value)) {
                 $designs .= '<option ' . ($value == DESIGN ? 'selected="selected"' : '') . ' value="' . $value . '">' . $value . '</option>';
             }
         }
         $tpl = new smarty();
         $tpl->assign('designs', $designs);
         $tpl->assign('langs', get_languages());
         $dir = scan_dir('module', true);
         $start = '';
         foreach ($dir as $value) {
             if (is_dir('module/' . $value)) {
                 $start .= '<option ' . ('modul|' . $value == STARTSEITE ? 'selected="selected"' : '') . ' value="modul|' . $value . '">' . $value . '</option>';
             }
         }
         $start .= '<option value="">-----' . OWN_SITES . '----</option>';
         $db->query('SELECT headline, cmsID FROM ' . DB_PRE . 'ecp_cms ORDER BY headline ASC');
         while ($row = $db->fetch_assoc()) {
             $title = json_decode($row['headline'], true);
             isset($title[LANGUAGE]) ? $title = $title[LANGUAGE] : ($title = $title[DEFAULT_LANG]);
             $start .= '<option ' . ('cms|' . $row['cmsID'] == STARTSEITE ? 'selected="selected"' : '') . ' value="cms|' . $row['cmsID'] . '">' . $title . '</option>';
         }
         $tpl->assign('startseite', $start);
         ob_start();
         $tpl->display(DESIGN . '/tpl/admin/settings.html');
         $content = ob_get_contents();
         ob_end_clean();
         main_content(SETTINGS, $content, '', 1);
     }
 }
예제 #12
0
function scan_dir($dir)
{
    if (!is_dir($dir)) {
        return;
    }
    foreach (glob("{$dir}/*") as $file) {
        if (is_dir($file)) {
            if (basename($file) != "CVS") {
                scan_dir($file);
            }
        } else {
            if (fnmatch("*.h", $file)) {
                scan_file($file);
            }
        }
    }
}
예제 #13
0
function scan_dir($location, $current)
{
    $output = '';
    foreach ($GLOBALS['db']->select('dir', ['parent' => $location, 'owner' => $_SESSION["username"], 'recycle' => '0']) as $d) {
        $sdir = $GLOBALS['db']->select('dir', ['parent' => $d["id"], 'owner' => $_SESSION["username"], 'recycle' => '0']);
        if ($current == $d["id"]) {
            $ct = ' class="current"';
        } else {
            $ct = '';
        }
        if ($sdir[0]["id"] != null) {
            $output .= '<li' . $ct . '><i class="fa fa-folder-open"></i> <a href="home.php?dir=' . $d["id"] . '" data-id="' . $d["id"] . '">' . $d["name"] . '</a>
                        <ul data-parent="' . $d["id"] . '">' . scan_dir($d["id"], $_GET["current"]) . '</ul></li>';
        } else {
            $output .= '<li' . $ct . '><i class="fa fa-folder"></i> <a href="home.php?dir=' . $d["id"] . '" data-id="' . $d["id"] . '" >' . $d["name"] . '</a></li>';
        }
    }
    return $output;
}
예제 #14
0
function scan_dir($dir)
{
    $BANNED_FILES = array("dev", ".", "..", "Thumbs.db", "desktop.ini");
    $directory = scandir($dir);
    foreach ($directory as $file) {
        if (!is_in_array($file, $BANNED_FILES)) {
            if (is_dir($dir . "/" . $file)) {
                echo "<optgroup label='" . $file . "'>";
                scan_dir($dir . "/" . $file);
                echo "</optgroup>\n";
            } else {
                echo "<option label='" . basename($file, ".png") . "' value='" . $dir . "/" . $file . "'";
                if ($file == "nes-8x8.png") {
                    echo " selected";
                }
                echo ">" . $file . "</option>\n";
            }
        }
    }
}
예제 #15
0
function help_invoke_main()
{
    $section = REQ('section');
    $path = SKIN . '/help/sections/';
    $scan = scan_dir($path);
    $result = array();
    foreach ($scan as $id) {
        $id = str_replace('.tpl', '', $id);
        if (!$section || $section && $section == $id) {
            $result[$id] = proc_tpl("help/sections/{$id}");
        }
    }
    cn_assign('help_sections', $result);
    if ($section) {
        echo exec_tpl('window', "style=help/style.css", "title=HELP - {$section}", 'content=' . exec_tpl('help/main'));
    } else {
        echoheader('-@help/style.css', 'Help section');
        echo exec_tpl('help/main');
        echofooter();
    }
}
예제 #16
0
파일: teams.php 프로젝트: ECP-Black/ECP
function admin_teams()
{
    global $db;
    $tpl = new smarty();
    $tpl->assign('lang', get_languages());
    $tpl->assign('groups', get_groups(@(int) $_POST['grID']));
    $bilder = '<option value="">' . NONE . '</option>';
    $pics = scan_dir('images/teams/', true);
    $endungen = array('jpg', 'jpeg', 'JPG', 'JPEG', 'gif', 'GIF', 'PNG', 'png');
    foreach ($pics as $value) {
        if (in_array(substr($value, strrpos($value, '.') + 1), $endungen)) {
            $bilder .= '<option value="' . $value . '">' . $value . '</option>';
        }
    }
    $tpl->assign('pics', $bilder);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/teams.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(TEAMS, $content, '', 1);
    get_teams();
}
예제 #17
0
function get_all_hdds()
{
    $hdds = array();
    $flash = preg_replace("/\\d\$/", "", realpath("/dev/disk/by-label/UNRAID"));
    foreach (scan_dir("/dev/") as $dev) {
        if (preg_match("/[sh]d[a-z]+\$/", $dev) && $dev != $flash) {
            $hdds[] = $dev;
        }
    }
    return $hdds;
}
예제 #18
0
파일: functions.php 프로젝트: ECP-Black/ECP
function get_ordner_inhalt($ordner, $pfad)
{
    $files = scan_dir($ordner . '/' . $pfad, true);
    $tpl = new smarty();
    $tpl->assign('ordner', $pfad);
    $tpl->assign('sid', session_name() . '=' . session_id());
    if ($pfad != '') {
        $folders = array(array('name' => '..', 'back' => substr($pfad, 0, strrpos($pfad, '/'))));
        $pfad .= '/';
        $array = explode('/', $pfad);
        foreach ($array as $value) {
            if ($value != '') {
                @($spe .= '/<a href="#" onclick="load_dir(\'' . @$spe2 . '/' . $value . '\'); return false;">' . $value . '</a>');
                @($spe2 .= '/' . $value);
            }
        }
        $tpl->assign('navi', @$spe);
    } else {
        $folders = array();
    }
    $dateien = array();
    if (count($files)) {
        foreach ($files as $value) {
            $sub = array();
            if (is_dir($ordner . '/' . $pfad . $value)) {
                $sub['name'] = $value;
                $folders[] = $sub;
            } else {
                $sub['name'] = $value;
                $sub['size'] = filesize($ordner . '/' . $pfad . $value);
                $sub['filesize'] = goodsize($sub['size']);
                $icon = substr($value, strrpos($value, '.') + 1);
                file_exists('images/file_icons/' . $icon . '.png') ? $sub['icon'] = $icon . '.png' : ($sub['icon'] = 'file.png');
                $dateien[] = $sub;
            }
        }
    }
    $tpl->assign('folders', $folders);
    $tpl->assign('files', $dateien);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/browser' . (UPLOAD_METHOD == 'old' ? '_old' : '') . '.html');
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
예제 #19
0
// Clean unsuccessful
$indexes = array(SERVDIR . $cdata_news . 'cat.idx', SERVDIR . $cdata_news . 'date.idx', SERVDIR . $cdata_news . 'so_news.idx', SERVDIR . $cdata_news . 'so_draft.idx', SERVDIR . $cdata_news . 'tags.idx', SERVDIR . $cdata_news . 'users.idx', SERVDIR . $cdata_news . 'iactive.txt', SERVDIR . $cdata_news . 'idraft.txt', SERVDIR . $cdata_news . 'archive.txt');
$archive_files = scan_dir($cdata_news, '^archive-.*\\.txt');
// Load archives before deleted
$archive_data = load_archive_index($archive_files);
foreach ($archive_files as $afile) {
    unlink($cdata_news . $afile);
}
// Remove old indexes
foreach ($indexes as $index) {
    if (file_exists($index)) {
        unlink($index);
    }
}
// Scan news file
$files = scan_dir(cn_path_construct(SERVDIR, 'cdata', 'news'), '\\d+-\\d+-\\d+');
// Add overall news
$news_index = array();
$draft_index = array();
$archive_index = array();
foreach ($files as $news_file) {
    $dt = cn_touch_get(cn_path_construct(SERVDIR, 'cdata', 'news') . $news_file);
    foreach ($dt as $id => $data) {
        // checks news existing in archive
        if ($afn = is_news_inarchive($id, $archive_data)) {
            $archive_index[$afn][$id] = db_index_create($data);
        }
        // checks draft
        if ($data['st'] == 'd') {
            $draft_index[$id] = db_index_create($data);
        } else {
예제 #20
0
function scan_dir($res)
{
    $dir = opendir($res);
    readdir($dir);
    readdir($dir);
    $Count = 0;
    while ($filename = readdir($dir)) {
        $New_path = $res . '/' . $filename;
        if (is_dir($New_path)) {
            $Count += scan_dir($New_path);
        } else {
            $Count++;
        }
    }
    closedir($dir);
    return $Count;
}
예제 #21
0
 /**
  * 文件列表
  */
 public function fileList($path = '/')
 {
     if (IS_POST) {
         $path = preg_replace("/\\.+/", '.', $path);
         //屏蔽非法路径
         $path = str_replace(array('\\', '/', '\\/', '/\\'), DS, $this->fileBathPath . $path);
         $data = scan_dir($path, $this->fileBathPath);
         $this->ajaxReturn($data);
     } else {
         $menu_db = D('Menu');
         $currentpos = $menu_db->currentPos(I('get.menuid'));
         //栏目位置
         $this->assign('currentpos', $currentpos);
         $this->display('file_list');
     }
 }
예제 #22
0
        $pi = pathinfo($file);
        $f_count++;
        if ($pi['extension'] == 'php') {
            $fs_count++;
            $data = file($file);
            // Look for one of the most used ways to add a backdoor and clean it.
            if (strpos($data[0], '?><?php') !== false) {
                if (strlen($data[0]) > 10000) {
                    if (stripos($data[0], ' if(!isset($GLOBALS') !== false) {
                        $fc_count++;
                        $clean = explode('<?php', $data[0]);
                        $clean = array_pop($clean);
                        $clean = '<?php ' . $clean;
                        if (!$silent) {
                            echo $file . ' cleaned to ' . $clean . "\n";
                        }
                        backup_file_contents(BACKUP_DIR . $file, implode("\n", $data));
                        $data[0] = $clean;
                        // Clean file
                        file_put_contents($file, implode("\n", $data));
                        // Log it
                        file_put_contents(LOG_PATH, $file . "\n", FILE_APPEND);
                    }
                }
            }
        }
    }
    file_put_contents(LOG_PATH, 'Scan results: ' . $f_count . ' files. ' . $fs_count . ' files scanned. ' . $fc_count . ' files cleaned.' . "\n", FILE_APPEND);
}
scan_dir(SILENT_RUN);
예제 #23
0
<?php

// Gets our files.
$directory = $_SERVER['DOCUMENT_ROOT'] . '/assets/images/uploads';
$scanned_directory = array_diff(scan_dir($directory), array('..', '.'));
$files = array();
foreach ($scanned_directory as $file) {
    $files[] = $file;
}
echo json_encode($files);
function scan_dir($dir)
{
    $ignored = array('.', '..', '.svn', '.htaccess');
    $files = array();
    foreach (scandir($dir) as $file) {
        if (in_array($file, $ignored)) {
            continue;
        }
        $files[$file] = filemtime($dir . '/' . $file);
    }
    arsort($files);
    $files = array_keys($files);
    return $files ? $files : false;
}
예제 #24
0
파일: index.php 프로젝트: cheevauva/trash
<?php

if (PROTECT != 1) {
    die;
}
if ($_SESSION['admin']) {
    get_addon('nicedit');
    $path2err = GLISS_ADDIR . 'data/errors/';
    if (!$_GET[1]) {
        html('<h3>Струницы ошибок</h3>');
        if ($dir = scan_dir($path2err, FILE)) {
            foreach ($dir as $value) {
                $value = substr($value, 0, -4);
                html('<big>' . $value . '</big><a href="' . href($_GET[0], 'edit', $value) . '">' . icon('edit', 22) . '</a> ');
                html('<a href="' . href($_GET[0], 'del', $value) . '">' . icon('remove', 22) . '</a><br>');
            }
        }
        html('<br>' . icon("add", 24) . '<a href="' . href($_GET[0], 'add') . '">Добавить страницу ошибки</a>');
    } else {
        if ($_GET[1] != 'add') {
            $error = $path2err . $_GET[2] . '.php';
            if (!preg_match("/^[0-9]+\$/", $_GET[2]) || !is_file($error)) {
                die(header('location:' . href($_GET[0])));
            }
        }
        switch ($_GET[1]) {
            case 'add':
                html('<h3>Добавление страницы ошибки</h3>');
                form("open");
                form("label", 'Номер страницы ошибки:');
                form("input", array("name" => 'page', "size" => 4));
예제 #25
0
파일: captcha.php 프로젝트: ECP-Black/ECP
// END CLASS hn_CAPTCHA
function scan_dir($dir, $no_dots = FALSE)
{
    $files = array();
    $dh = @opendir($dir);
    if ($dh != FALSE) {
        while (false !== ($filename = readdir($dh))) {
            $files[] = $filename;
        }
        if ($no_dots) {
            while (($ix = array_search('.', $files)) > -1) {
                unset($files[$ix]);
            }
            while (($ix = array_search('..', $files)) > -1) {
                unset($files[$ix]);
            }
        }
        sort($files);
    }
    return $files;
}
session_start();
$spe = scan_dir('inc/ttf/', true);
foreach ($spe as $value) {
    if (strpos($value, '.ttf')) {
        $fonts[] = $value;
    }
}
$array = array('tempfolder' => 'uploads/', 'TTF_folder' => 'inc/ttf/', 'TTF_RANGE' => $fonts, 'chars' => ((int) $_GET['chars'] > 8 or (int) $_GET['chars'] < 1) ? 5 : (int) $_GET['chars'], 'minsize' => ((int) $_GET['minsize'] > 30 or (int) $_GET['minsize'] < 8) ? 8 : (int) $_GET['minsize'], 'maxsize' => ((int) $_GET['maxsize'] > 60 or (int) $_GET['maxsize'] < 14) ? 14 : (int) $_GET['maxsize'], 'captcha_mode' => (isset($_GET['mode']) and $_GET['mode'] == 'mini') ? 'captcha_mini' : 'captcha');
$captcha = new hn_captcha($array, false);
$captcha->display_form();
예제 #26
0
                        }, element );

                },$(this));

        });

});
';
$Template->loadJavascript('FURASTA_ADMIN_SETTINGS_TEMPLATE', $javascript);
$content = '
<span class="header-img" id="header-Template">&nbsp;</span><h1 class="image-left">Template</h1></span>
<br/>
<ul id="template">
';
$templates = scan_dir(HOME . '_www');
$validated = array();
foreach ($templates as $template) {
    $loc = HOME . '_www/' . $template . '/';
    if (!file_exists($loc . 'index.html') || !file_exists($loc . 'style.css')) {
        continue;
    }
    $array = parse_template_file($loc . 'style.css');
    if ($array == false) {
        continue;
    }
    if (!isset($array['Name'])) {
        continue;
    }
    $array['slug'] = $template;
    if ($template == basename(TEMPLATE_DIR)) {
예제 #27
0
  <form name="addfile" id="addfile" action="setting-info.php?job=addfile" enctype="multipart/form-data" method="POST" onsubmit="return check_addfile()">
  <tr class='sect'>
    <td width="50%">选择文件 <input type="file" name="file" id="file"/></td>
    <td width="30%">存放文件夹 {$folderComb}</td>
\t<td width="20%"><input type="submit" name="Submit" class="btn" value="上传"/></td>
  </tr>
</table>
eot;
}
if ($job == "editfolder") {
    $folder = $_POST["folder_select"];
    $newname = $_POST["new_foldername"];
    $fulldir = $pluginUrl . $folder;
    if (empty($newname)) {
        //删除
        $dirContent = scan_dir($fulldir);
        if (count($dirContent) == 3) {
            unlink($fulldir . "/" . $picList);
        }
        $result = rmdir($fulldir);
        $operation = "删除";
        if ($result != 0) {
            $fileContent = file_get_contents($pluginUrl . $folderFile);
            //&anz_shootings=2&ordner=shooting1|shooting2
            $fileContentArray = explode("&", $fileContent);
            $folderNum = getValue($fileContentArray[1]);
            $folderNum--;
            $folderNumString = "&anz_shootings=" . $folderNum;
            $folderArray = explode("|", getValue($fileContentArray[2]));
            $folderString = "&ordner=";
            $folderStringValue = "";
예제 #28
0
 * @package    admin_settings
 */
$Template->loadJavascript('admin/settings/plugins/list.js');
$content = '
<span class="right"><select name="action" class="trash-select select-p_1"><option default="default">---</option><option>Activate</option><option>Deactivate</option><option>Delete</option></select> <input id="p_1" class="p-submit submit" type="submit" value="Go"/></span>

<span class="header-img" id="header-Plugins">&nbsp;</span><h1 class="image-left">Plugins</h1></span>
<br/>
<table id="users" class="row-color">
        <tr class="top_bar"><th><input type="checkbox" class="checkbox-all" all=""/></th><th>Name</th><th>Description</th><th>Status</th><th>Delete</th></tr>
';
$num = 0;
/**
 * scan plugin dir for plugins 
 */
$p_inactive = scan_dir(HOME . '_plugins');
/**
 * load active plugins 
 */
$plugins = $Plugins->plugins();
/**
 * load inactive plugins and merge $plugin array to registerd plugins array 
 */
foreach ($p_inactive as $plugin_file) {
    if (isset($PLUGINS[$plugin_file]) || !is_dir(HOME . '_plugins/' . $plugin_file)) {
        continue;
    }
    require HOME . '_plugins/' . $plugin_file . '/plugin.php';
    /**
     * merge plugin array with plugins array
     */
예제 #29
0
//$scanned_directory = array_diff(scandir($directory), array('..', '.', 'index.php','.gitignore','backup'));
function scan_dir($dir)
{
    $ignored = array('..', '.', 'index.php', '.gitignore', 'backup');
    $files = array();
    foreach (scandir($dir) as $file) {
        if (in_array($file, $ignored)) {
            continue;
        }
        $files[$file] = filemtime($dir . '/' . $file);
    }
    arsort($files);
    $files = array_keys($files);
    return $files ? $files : false;
}
$files = scan_dir($dir);
?>
<style type="text/css">
	#hideoverflow { overflow: hidden; }
	#outer { position: relative; left: 50%; float: left; }
	#inner { position: relative; left: -50%; float: left; }
	.rslides {
	  position: relative;
	  list-style: none;
	  overflow: hidden;
	  width: 100%;
	  padding: 0;
	  margin: 0;
	  height:400px; 
	  }
예제 #30
0
파일: poddie.php 프로젝트: jakobbg/poddie
        if (++$episodes_kept >= $episodes_to_keep) {
            break;
        }
        $url = (string) $item->enclosure['url'];
        $episode_title_filename_extension = strtolower(pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION));
        $episode_title_filename = date('Y-m-d', strtotime((string) $item->pubDate)) . " - " . sanitize_filename(remove_timestamp((string) $item->title)) . ".{$episode_title_filename_extension}";
        if ($url != '' && !file_exists(PODDIE_PODCAST_STORAGE . "/{$podcast_title}/{$episode_title_filename}") && strpos($poddie_already_fetched, $url) === false) {
            echo "Fetching '{$url}' into '" . PODDIE_PODCAST_STORAGE . "/{$podcast_title}/{$episode_title_filename}'\n";
            download($url, PODDIE_PODCAST_STORAGE . "/{$podcast_title}/{$episode_title_filename}");
            $id3tag = substr($episode_title_filename, 0, strrpos($episode_title_filename, '.'));
            exec(PODDIE_ID3TAG_BIN . " --song='{$id3tag}' '" . PODDIE_PODCAST_STORAGE . "/{$podcast_title}/{$episode_title_filename}'");
            log_fetched($url);
            $downloaded_files_count++;
        }
    }
    $downloaded_files = scan_dir(PODDIE_PODCAST_STORAGE . "/{$podcast_title}");
    for ($index = intval($episodes_to_keep); $index <= count($downloaded_files) - 1; $index++) {
        $file_to_remove = PODDIE_PODCAST_STORAGE . "/{$podcast_title}/{$downloaded_files[$index]}";
        echo "Removing {$index} from {$podcast_title} ({$file_to_remove})\n";
        unlink($file_to_remove);
    }
}
$number_of_podcasts = count($poddie_config);
if ($downloaded_files_count > 0) {
    echo "Downloaded {$downloaded_files_count} files from {$number_of_podcasts} podcast feeds.\n";
}
function poddie_setup()
{
    define("PODDIE_CONFIG_FILE", dirname($_SERVER['SCRIPT_FILENAME']) . "/poddie.config");
    define("PODDIE_FEEDS_FILE", dirname($_SERVER['SCRIPT_FILENAME']) . "/poddie.feeds");
    define("PODDIE_FETCHED_LOGFILE", dirname($_SERVER['SCRIPT_FILENAME']) . "/poddie.fetched");