Example #1
0
    public static function listdir($dir, $dirs_stat)
    {
        $list = \OC\Files\Filesystem::getdirectorycontent($dir);
        if (sizeof($list) > 0) {
            $ret = '';
            //$d=explode('/',$dir);
            foreach ($list as $i) {
                if ($i['type'] == 'dir' && $i['name'] != '.') {
                    if (!isset($i['directory'])) {
                        $i['directory'] = '';
                    }
                    $ret .= '<li class="ui-droppable">
					 	<a href="./?app=files&dir=' . $i['directory'] . '/' . $i['name'] . '" data-pathname="' . $i['directory'] . '/' . $i['name'] . '">' . $i['name'] . '</a>' . listdir($dir . '/' . $i['name'], $dirs_stat) . '
						</li>
					';
                }
            }
            if ($ret != '') {
                $class = 'class="collapsed"';
                if ($dir == '' || isset($dirs_stat[$dir]) && $dirs_stat[$dir] == 'expanded') {
                    $class = 'class="expanded"';
                }
                $ret = '<ul ' . $class . ' data-path="' . $dir . '"><li></li>' . $ret . '</ul>';
            }
            return $ret;
        }
    }
 function print_files()
 {
     $data = array();
     //should declare array to be used to hold valid input files
     echo '<b>Ingesting the data files that are in the data directory!</b>';
     echo '<br>*******************************************************<br>';
     $dirfiles = listdir(ES__PLUGIN_DIR . "data");
     if ($dirfiles) {
         foreach ($dirfiles as $key => $filename) {
             if (substr($filename, -4) == '.txt' && !is_dir($filename)) {
                 $data[$filename] = php_strip_whitespace($filename);
                 $theData = make_post($filename);
                 insert_post($theData);
                 echo "<br>";
                 echo "<br>Finished.";
                 echo "<br>";
             } else {
                 $other[$filename] = !is_dir($filename) ? file_get_contents($filename) : '';
             }
         }
         $myFile = ES__PLUGIN_DIR . "/data/test.txt";
         $fh = fopen($myFile, 'r');
         $theData = fread($fh, filesize($myFile));
         fclose($fh);
     }
     insert_post($theData);
     echo "<br>";
     echo "<br>Finished.";
     echo "<br>";
 }
Example #3
0
function listdir($start_dir = '.')
{
    global $foundPath;
    $files = array();
    if (is_dir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            # loop through the files, skipping . and .., and recursing if necessary
            if (strcmp($file, '.') == 0 || strcmp($file, '..') == 0) {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            if (is_dir($filepath)) {
                $files = array_merge($files, listdir($filepath));
            } else {
                if (strpos($filepath, DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . FILENAME_ORDERS . ".php")) {
                    $foundPath = $filepath;
                }
                array_push($files, $filepath);
            }
        }
        closedir($fh);
    } else {
        # false if the function was called with an invalid non-directory argument
        $files = false;
    }
    return $files;
}
Example #4
0
function hae_skannattu_lasku($kasittele_seuraava = "")
{
    global $kukarow, $yhtiorow;
    $dir = $yhtiorow['skannatut_laskut_polku'];
    if (!is_dir($dir) or !is_writable($dir)) {
        return false;
    }
    // käydään läpi ensin käsiteltävät kuvat
    $files = listdir($dir);
    $files_count = count($files);
    // Jos ei ole yhtään tiedostoa, palautetaan false
    if ($files_count == 0) {
        return false;
    }
    // Tehdään palautusta varten array, palautetaan aina laskujen lukumäärä
    $palautus = array("lukumaara" => $files_count);
    // Katsotaan onko laskuja, jota käyttäjä voisi käsitellä
    $query = "SELECT kesken\n            FROM kuka\n            WHERE yhtio  = '{$kukarow["yhtio"]}'\n            AND extranet = ''";
    $kesken_chk_res = pupe_query($query);
    foreach ($files as $file) {
        $path_parts = pathinfo($file);
        mysql_data_seek($kesken_chk_res, 0);
        while ($kesken_chk_row = mysql_fetch_assoc($kesken_chk_res)) {
            // Jos tiedosto on tällä käyttäjällä kesken
            if (is_numeric($path_parts['filename']) and $path_parts['filename'] == $kukarow['kesken']) {
                // Palautetaan kesken -key, jos tämä on meillä kesken
                $palautus["kesken"] = $path_parts["basename"];
                $palautus["seuraava"] = $path_parts["basename"];
                return $palautus;
            } elseif ($path_parts['filename'] == $kesken_chk_row['kesken']) {
                continue 2;
            }
        }
        // Jos halutaan ottaa seuraava lasku käsittelyyn, päivitetään kuka -tiedot
        if ($kasittele_seuraava != "") {
            // Tämän tiedoston voi käsitellä seuraavaksi, laitetaan se käyttäjälle keskeneräiseksi
            list($micro, $timestamp) = explode(" ", microtime());
            $file_basename = substr($timestamp . substr($micro * 10, 0, 1), 2);
            $kukarow['kesken'] = $file_basename;
            $file_new = $dir . "/" . $file_basename . "." . $path_parts['extension'];
            $query = "UPDATE kuka SET kesken = '{$kukarow["kesken"]}'\n                WHERE yhtio = '{$kukarow["yhtio"]}'\n                AND kuka    = '{$kukarow["kuka"]}'";
            $kesken_upd_res = pupe_query($query);
            if (!rename($file, $file_new)) {
                echo t("Ei pystytä nimeämään tiedostoa") . "<br>";
                return false;
            }
            // Otetaan path parts uudesta tiedostonimestä
            $path_parts = pathinfo($file_new);
        }
        // Tämän laskun voi käsitellä
        $palautus["seuraava"] = $path_parts["basename"];
        return $palautus;
    }
    // Ei löytynyt yhtään sopivaa laskua
    return false;
}
Example #5
0
function plugin_check_main()
{
    global $themechecks, $data, $themename;
    $files = listdir(WP_PLUGIN_DIR);
    if ($files) {
        $css = array();
        $php = array();
        $other = array();
        foreach ($files as $key => $filename) {
            if (substr($filename, -4) == '.php') {
                if (strpos($filename, 'plugins/theme-check') == false && strpos($filename, 'plugins/akismet') == false && strpos($filename, 'plugins/plugin-check') == false) {
                    $php[$filename] = php_strip_whitespace($filename);
                }
            } else {
                if (substr($filename, -4) == '.css') {
                    if (strpos($filename, 'plugins/theme-check') == false && strpos($filename, 'plugins/akismet') == false && strpos($filename, 'plugins/plugin-check') == false) {
                        $css[$filename] = file_get_contents($filename);
                    }
                } else {
                    if (strpos($filename, 'plugins/theme-check') == false && strpos($filename, 'plugins/akismet') == false && strpos($filename, 'plugins/plugin-check') == false) {
                        $other[$filename] = file_get_contents($filename);
                    }
                }
            }
        }
        // run the checks
        $failed = !run_themechecks($php, $css, $other);
        global $checkcount;
        // second loop, to display the errors
        $plugins = get_plugins('/theme-check');
        $version = explode('.', $plugins['theme-check.php']['Version']);
        echo '<p>Running <strong>' . $checkcount . '</strong> tests against <strong>All Plugins</strong> using Theme-check Guidelines Version: <strong>' . $version[0] . '</strong> Plugin revision: <strong>' . $version[1] . '</strong></p>';
        $results = display_themechecks();
        $success = true;
        if (strpos($results, 'WARNING') !== false) {
            $success = false;
        }
        if (strpos($results, 'REQUIRED') !== false) {
            $success = false;
        }
        if ($success === false) {
            echo '<h2>' . __('One or more errors were found</h2>', 'themecheck');
        } else {
            echo '<h2>' . __('Your plugins have passed all the tests!', 'themecheck') . '</h2>';
            tc_success();
        }
        echo '<div class="tc-box">';
        echo '<ul class="tc-result">';
        echo $results;
        echo '</ul></div>';
    }
}
function listdir($dirname, $level=0){
	$ds = opendir($dirname);
	while($file = readdir($ds)){
		$path = $dirname.'/'.$file;
		if($file !='.' && $file != '..'){
			if(is_dir($path)){
				echo str_repeat('&nbsp;&nbsp', $level).'|--'.$file.'<br />';
				$level++;
				listdir($path);
			}else{
				echo str_repeat('&nbsp;&nbsp;', $level),'|--'.$file.'<br />';
			}
		}
	}
}
Example #7
0
function listdir($start_dir = '.')
{
    $files = array();
    if (is_dir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            if (strcmp($file, '.') == 0 || strcmp($file, '..') == 0) {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            if (is_dir($filepath)) {
                $files = array_merge($files, listdir($filepath));
            } else {
                array_push($files, $filepath);
            }
        }
        closedir($fh);
    } else {
        $files = false;
    }
    return $files;
}
Example #8
0
function listdir($dir, $dirs_stat)
{
    $dir = stripslashes($dir);
    $list = \OC\Files\Filesystem::getdirectorycontent($dir);
    if (sizeof($list) > 0) {
        $ret = '';
        foreach ($list as $i) {
            if ($i['type'] == 'dir' && $i['name'] != '.') {
                $ret .= '<li data-dir="' . $dir . '/' . $i['name'] . '" class="tree-' . $i['id'] . '"><a data-pathname="' . $dir . '/' . $i['name'] . '" class="ft_sesam"></a>';
                $ret .= '<a href="./?app=files&dir=' . $dir . '/' . $i['name'] . '" data-pathname="' . $dir . '/' . $i['name'] . '" class="ft_link">';
                $ret .= $i['name'] . '</a>';
                if (in_array($dir . '/' . $i['name'], $dirs_stat)) {
                    $ret .= listdir($dir . '/' . $i['name'], $dirs_stat);
                }
                $ret .= '</li>';
            }
        }
        if ($ret != '') {
            $ret = '<ul data-path="' . $dir . '">' . $ret . '</ul>';
        }
        return stripslashes($ret);
    }
}
Example #9
0
function listdir($start_dir = '.')
{
    $files = array();
    if (isDir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            # loop through the files, skipping . and .., and recursing if necessary
            if (strcmp($file, '.') == 0 || strcmp($file, '..') == 0) {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            if (isDir($filepath)) {
                $files = array_merge($files, listdir($filepath));
            } else {
                array_push($files, $filepath);
            }
        }
        closedir($fh);
    } else {
        # false if the function was called with an invalid non-directory argument
        $files = false;
    }
    return $files;
}
Example #10
0
function listdir($start_dir = '.', $root_dir = null)
{
    if ($root_dir === null) {
        $root_dir = $start_dir;
    }
    $files = array();
    if (is_dir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            if ($file === '.' || $file === '..') {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            array_push($files, substr($filepath, strlen($root_dir) + 1));
            if (is_dir($filepath)) {
                $files = array_merge($files, listdir($filepath, $root_dir));
            }
        }
        closedir($fh);
    } else {
        $files = false;
    }
    return $files;
}
Example #11
0
    echo "Voidaan ajaa vain komentoriviltä!!!\n";
    die;
}
if (!`which recode`) {
    echo "Tarvitaan recode -ohjelma!\n";
    die;
}
$vain_recode = FALSE;
if (isset($argv[1]) and $argv[1] != '') {
    $vain_recode = TRUE;
}
// Pupeasennuksen root
$pupe_root_polku = dirname(__FILE__);
require_once "inc/functions.inc";
// Konvertoidaan kaikki filet:
$files = listdir($pupe_root_polku);
$finfo1 = finfo_open(FILEINFO_MIME_TYPE);
$finfo2 = finfo_open(FILEINFO_MIME_ENCODING);
foreach ($files as $file) {
    if (strpos($file, "UTF8_konversio.php") !== FALSE) {
        continue;
    }
    $mime = finfo_file($finfo1, $file);
    $encd = finfo_file($finfo2, $file);
    if (substr($mime, 0, 4) == "text" and $encd != "utf-8" and $encd != "us-ascii") {
        $mitenmeni = system("recode ISO_8859-1..UTF8 {$file}");
        echo "{$file}, {$encd}\n";
    }
    if ($vain_recode) {
        continue;
    }
    public function render()
    {
        ?>
		<div style="text-align:center;">
			<button type="button" id="import-btn" class="btn">
				<?php 
        echo "Import new zip files";
        ?>
			</button>
			<button type="button" id="update-btn" class="btn">
				<?php 
        echo "Update DB files";
        ?>
			</button>
		</div>
		<?php 
        $files = listdir($this->importpath);
        $fileszip = array();
        // read themelist files
        $themelist = array();
        foreach ($files as $f) {
            if (strpos($f, "themelist.csv") !== false) {
                if (($handle = fopen($f, "r")) !== FALSE) {
                    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                        if (count($data) == 2) {
                            $zipfilename = $data[0];
                            $date = $data[1];
                            $themelist[$zipfilename] = $date;
                        }
                    }
                    fclose($handle);
                }
            }
        }
        $history = new History();
        $countNew = 0;
        $countTotal = 0;
        foreach ($files as $f) {
            $path_parts = pathinfo($f);
            if (isset($path_parts['extension']) && $path_parts['extension'] == "zip") {
                $zipfilename = $path_parts['basename'];
                if (isset($themelist[$zipfilename])) {
                    $timestamp = strtotime($themelist[$zipfilename]);
                    if ($timestamp > 946681200) {
                        $id = $history->getIdFromZipName($zipfilename);
                        if ($id === false) {
                            $fileszip[$f] = $timestamp;
                            $countNew++;
                        }
                        $countTotal++;
                    }
                }
            }
        }
        asort($fileszip);
        echo "<br/>Not imported yet : {$countNew} / {$countTotal}<hr>";
        foreach ($fileszip as $file => $timestamp) {
            echo date("Y-m-d", $timestamp) . ' : ' . $file . '<br>';
        }
        /*	$count = 0;
        		foreach ($fileszip as $f)
        		{
        			if ($count > 5) break;
        			if(USE_DB)
        			{
        				$hash_md5 = md5_file($f); 
        				$hash_alpha = base_convert($hash_md5, 16, 36); // shorten hash to shorten urls (better looking, less bandwidth)
        				while(strlen($hash_alpha) < 25) $hash_alpha = '0'.$hash_alpha;
        				$history = new History();
        				$themeInfo = $history->loadThemeFromHash($hash_alpha);
        				if (!empty($themeInfo)) continue;
        			}
        			
        			$path_parts = pathinfo($f);
        			$path_item = $path_parts['dirname'];
        			$filename = $path_parts['filename'].'.'.$path_parts['extension'];
        		
        			$themeInfo = FileValidator::prepareThemeInfo($path_item.'/'.$filename, $filename, 'application/zip', false);
        
        			if (!empty($themeInfo))
        			{
        				$this->fileValidator = new FileValidator($themeInfo);
        				$this->fileValidator->validate();	
        				$this->fileValidator->serialize();
        				
        				$this->validationResults = $this->fileValidator->getValidationResults(I18N::getCurLang());
        				$themeInfo = $this->fileValidator->themeInfo;
        				echo '<p>'.htmlspecialchars($themeInfo->name).' : '.intval($themeInfo->score).'%</p>';
        				$count++;
        			}
        		}*/
        ?>
		<script>
		var zips = new Array();
		var zip_index = 0;
		var theme_id_sart = 145;
		var theme_id = theme_id_sart;
		<?php 
        $a = array_keys($fileszip);
        for ($i = 0; $i < count($a); $i++) {
            $unixStylePath = str_replace('\\', '/', realpath($a[$i]));
            $index = $a[$i];
            $timestamp = $fileszip[$index];
            echo 'zips[' . $i . '] = new Array("' . $unixStylePath . '","' . $timestamp . '");' . "\n";
        }
        ?>
		
		function importNext()
		{
			$.ajax({
				type: "POST",
				url: "<?php 
        echo TC_HTTPDOMAIN . '/ajax.php?controller=massimport&action=importnext';
        ?>
",
				data : {path : zips[zip_index][0], timestamp : zips[zip_index][1]}
			}).done(function( obj ) {
				obj.index = zip_index++;
				console.log(obj);
				importNext();
			}).fail(function() {
				console.log("ajax error");
			})
		}
				
		$('#import-btn').click(importNext);
		
		function updateNext()
		{
			$.ajax({
				type: "POST",
				url: "<?php 
        echo TC_HTTPDOMAIN . '/ajax.php?controller=massimport&action=updatenext';
        ?>
",
				data : {id : theme_id, timestamp : zips[zip_index][1]}
			}).done(function( obj ) {
				console.log(obj);
				if (obj.nextId == null) {
					console.log("update done");
					theme_id = theme_id_sart;
				} else {
					theme_id = obj.nextId;
					updateNext();
				}
			}).fail(function() {
				console.log("ajax error");
			})
		}
		$('#update-btn').click(updateNext);
		</script>
		<?php 
    }
Example #13
0
function listdir($dir, $level_count = 0)
{
    if (!@($thisdir = opendir($dir))) {
        return;
    }
    while ($item = readdir($thisdir)) {
        if (is_dir("{$dir}/{$item}") && substr("{$item}", 0, 1) != '.') {
            listdir("{$dir}/{$item}", $level_count + 1);
        }
    }
    if ($level_count > 0) {
        $dir = preg_replace("/\\/\\//", "/", $dir);
        $selected = isset($_GET['folder']) && $_GET['folder'] == $dir . '/' ? "selected='selected'" : "";
        $perm = substr(sprintf('%o', fileperms($dir)), -3);
        echo "<option value=\"" . $dir . "/\" {$selected}>[{$perm}] " . $dir . "/</option>\n";
    }
    return;
}
Example #14
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once "openmediavault/autoloader.inc";
    require_once "openmediavault/globals.inc";
    require_once "openmediavault/env.inc";
    require_once "openmediavault/functions.inc";
    // Load and initialize the RPC services that are not handled by the
    // engine daemon.
    $directory = build_path(DIRECTORY_SEPARATOR, $GLOBALS['OMV_DOCUMENTROOT_DIR'], "rpc");
    foreach (listdir($directory, "inc") as $path) {
        require_once $path;
    }
    $rpcServiceMngr =& \OMV\Rpc\ServiceManager::getInstance();
    $rpcServiceMngr->initializeServices();
    // Initialize the data models.
    $modelMngr = \OMV\DataModel\Manager::getInstance();
    $modelMngr->load();
    $session =& \OMV\Session::getInstance();
    $session->start();
    $server = new \OMV\Rpc\Proxy\Json();
    $server->handle();
    $server->cleanup();
} catch (\Exception $e) {
    if (isset($server)) {
        $server->cleanup();
Example #15
0
        } else {
            if (is_dir($filepath)) {
                listdiraux($filepath, $files);
            }
        }
    }
    closedir($handle);
}
/*
* Clean up the documentation directory from prior use
*/
if (is_dir('documentation')) {
    deltree('documentation');
}
mkdir('documentation');
$files = listdir('documentation-base');
sort($files, SORT_LOCALE_STRING);
/*
* Loop through files in documentation-base directory, creating a mirror
* structure in documentation, and applying the post-process rules defined
* below
*/
foreach ($files as $f) {
    $r = str_replace('documentation-base', 'documentation', $f);
    $dList = explode('/', $r);
    $titleList = $dList;
    /*
     * Get rid of the initial directory
     */
    array_shift($titleList);
    $depth = count($dList) - 2;
Example #16
0
function listdir($dir)
{
    $current_dir = opendir($dir);
    while ($entryname = readdir($current_dir)) {
        if (is_dir("{$dir}/{$entryname}") and ($entryname != "." and $entryname != "..")) {
            listdir("{$dir}/{$entryname}");
        } elseif ($entryname != "." and $entryname != "..") {
            unlink("{$dir}/{$entryname}");
        }
    }
    @closedir($current_dir);
    rmdir(${dir});
}
Example #17
0
<?php

// libの読み込み spl_autoload_registerでは0番目のディレクトリを読まない
define('__PHP_LIBS__', __DIR__ . "/../private_html/src/App");
define('__JS_BASES__', __DIR__ . '/../private_html/templates/Elements');
$libs = [__DIR__ . "/../private_html/smarty/libs", __PHP_LIBS__];
// phpパスへの追加
ini_set('include_path', implode(PATH_SEPARATOR, array_merge([ini_get('include_path')], $libs)));
// classの自動読み込み,以後useだけでおk
require_once __PHP_LIBS__ . '/Functions/listdir.php';
spl_autoload_register(function () {
    foreach (listdir(__PHP_LIBS__, ['', 'php']) as $fileName) {
        require_once $fileName;
    }
});
// エラー表示設定
error_reporting(E_ALL ^ E_NOTICE);
// E_NOTICEは非表示
use src\App\DataBase\DataBase;
use src\App\Smarty\SmartyBase;
class Dispatcher extends SmartyBase
{
    private $controllerRoot = './../private_html/src/Controller';
    private $controllerFile;
    private $viewFile;
    private $readDir;
    /**
     * view と controller の読込先ディレクトリの設定
     */
    private function setReadDir($newReadDir)
    {
Example #18
0
function bulk_submit($bulk_action, $d)
{
    global $_POST, $sqlpref, $d, $tbcolor1, $userdir, $tbcolor2;
    if (!$bulk_action) {
        $error .= "Please select an action.<br>\n";
    }
    if (!$_POST[filesel] && !$_POST[foldersel]) {
        $error .= "Please select at least one file to perform an action on.<br>\n";
    }
    if ($_POST[filesel] && $_POST[foldersel]) {
        $delvar = "files/folders and all of their content";
    } elseif ($_POST[filesel] && count($_POST[filesel]) > 1) {
        $delvar = "files";
    } elseif ($_POST[foldersel] && count($_POST[foldersel]) > 1) {
        $delvar = "folders and all of their content";
    } elseif ($_POST[filesel]) {
        $delvar = "file";
    } elseif ($_POST[foldersel]) {
        $delvar = "folder and all of its contents";
    }
    if (!$error && $bulk_action == "delete") {
        page_header("Delete");
        opentitle("Delete");
        opentable("100%");
        echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=100%>\n" . "<form name=bulk_action action=\"?p=bulk_action\" method=post>\n" . "<tr><td><font class=error>Are you sure you want to delete the following {$delvar}?</font><br>\n" . "<tr><td bgcolor={$tbcolor1}>\n";
        $a = 0;
        $b = 0;
        if (is_array($_POST[filesel])) {
            foreach ($_POST[filesel] as $file) {
                echo "{$file} <input type=hidden name=filesel[{$a}] value={$file}><br>\n";
                $a++;
            }
        }
        if (is_array($_POST[foldersel])) {
            foreach ($_POST[foldersel] as $file) {
                echo "{$file}<input type=hidden name=foldersel[{$b}] value={$file}><br>\n";
                $b++;
            }
        }
        echo "<tr><td align=center><br><a href=\"javascript:document.bulk_action.submit();\">Yes</a> | \n" . "<a href=\"?p=home\"> No </a>\n" . "<input type=hidden name=bulk_action value=\"{$bulk_action}\">\n" . "<input type=hidden name=d value=\"{$d}\">\n" . "</td></tr></form></table>\n";
        closetable();
        page_footer();
    } elseif (!$error && $bulk_action == "move") {
        page_header("Move");
        opentitle("Move");
        opentable("100%");
        echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=100%>\n" . "<form name=bulk_action action=\"?p=bulk_action\" method=post>\n" . "<tr><td>Move {$delvar}:\n" . "<tr><td bgcolor={$tbcolor1}>\n";
        $a = 0;
        $b = 0;
        if (is_array($_POST[filesel])) {
            foreach ($_POST[filesel] as $file) {
                echo "{$file} <input type=hidden name=filesel[{$a}] value={$file}><br>\n";
                $a++;
            }
        }
        if (is_array($_POST[foldersel])) {
            foreach ($_POST[foldersel] as $file) {
                echo "{$file}<input type=hidden name=foldersel[{$b}] value={$file}><br>\n";
                $b++;
            }
        }
        echo "<tr><td><select name=ndir size=1>\n" . "<option value=\"" . substr($item, strlen($userdir . $d)) . "/\">" . substr($item, strlen($userdir . $d)) . "/</option>";
        $content = listdir($userdir);
        asort($content);
        foreach ($content as $item) {
            echo "<option value=\"" . substr($item, strlen($userdir)) . "/\">" . substr($item, strlen($userdir)) . "/</option>\n";
        }
        echo "</select> " . "<input type=\"Submit\" value=\"Move\" class=\"button\">\n" . "<input type=hidden name=bulk_action value=\"{$bulk_action}\">\n" . "<input type=hidden name=d value=\"{$d}\">\n" . "</td></tr></form></table>\n";
        closetable();
        page_footer();
    } elseif (!$error && $bulk_action == "chmod") {
        page_header("Change Permissions");
        opentitle("Change Permissions");
        opentable("100%");
        echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=100%>\n" . "<form name=bulk_action action=\"?p=bulk_action\" method=post>\n" . "<tr><td>Change Permissions of {$delvar}:\n" . "<tr><td bgcolor={$tbcolor1}>\n";
        $a = 0;
        $b = 0;
        if (is_array($_POST[filesel])) {
            foreach ($_POST[filesel] as $file) {
                echo "{$file} <input type=hidden name=filesel[{$a}] value={$file}><br>\n";
                $a++;
            }
        }
        if (is_array($_POST[foldersel])) {
            foreach ($_POST[foldersel] as $file) {
                echo "{$file}<input type=hidden name=foldersel[{$b}] value={$file}><br>\n";
                $b++;
            }
        }
        if (is_array($_POST[filesel])) {
            $keys = array_keys($_POST[filesel]);
            $chval = substr(sprintf('%o', @fileperms($userdir . $d . $_POST[filesel][$keys[0]])), -4);
        } else {
            $keys = array_keys($_POST[foldersel]);
            $chval = substr(sprintf('%o', @fileperms($userdir . $d . $_POST[foldersel][$keys[0]])), -4);
        }
        echo "<tr><td><br><table cellpadding=0 cellspacing=0>\n" . "<tr><td><input type=text width=20 size=20 name=ndir value=\"{$chval}\">\n" . "<br><br><input type=\"Submit\" value=\"Change\" class=\"button\">\n" . "<input type=hidden name=bulk_action value=\"{$bulk_action}\">\n" . "<input type=hidden name=d value=\"{$d}\">\n" . "</td></tr></form></table></table>\n";
        closetable();
        page_footer();
    } else {
        page_header("Action");
        opentitle("Action");
        opentable("100%");
        echo "<font class=error>{$error}</font>\n";
        closetable();
        page_footer();
    }
}
Example #19
0
}
function listdiraux($dir, &$files)
{
    $handle = opendir($dir);
    while (($file = readdir($handle)) !== false) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        $filepath = $dir == '.' ? $file : $dir . '/' . $file;
        if (is_link($filepath)) {
            continue;
        }
        if (is_file($filepath)) {
            $files[] = $filepath;
        } else {
            if (is_dir($filepath)) {
                listdiraux($filepath, $files);
            }
        }
    }
    closedir($handle);
}
$files = listdir('.');
sort($files, SORT_LOCALE_STRING);
foreach ($files as $f) {
    if (strstr($f, '.yml')) {
        //if (!$entry['handle'] = fopen($path,'r')) $entry['handle'] = "FAIL";
        echo $f, "\n";
    }
    //    echo  $f, "\n";
}
Example #20
0
    exit;
    /* --// some extra images */
    /* yellow folder */
    // $img = 'R0lGODlhEgAQAOfRAAAAAAAAAAAAAAAAAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMzMzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJmZmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH5BAEKAP8ALAAAAAASABAAAAhhAP8JHEiwYMEqCBEaNFhFBQGHKqosHNjwocWICRVSjMaxo0eOVaxtvEjSYciNEEs+PCmwSjSVKVn+c5my5kqRLV/ajIlzZrSdF2W6hGlRaMajGXv+s8a0qVOnE6NKnfovIAA7';
    /* binary image */
    // $img = 'R0lGODlhEAAQAOMAAISGhMbHxgAAAP///wAAhAD//wAA////AP///////////////////////////////yH5BAEKAAgALAAAAAAQABAAAARcEMkJqq0zg8B7AEKGAENpfqBIEiyLhtpAFEb9SlhF1HYVkgMggGe4kTY+z0cAGFkCgqg06huVBATmBRnaGbACk6nqJUBBh6ixtNFWOClrEDqVUtgwwCE+mUr8GREAOw==';
    /* blank document */
    // $img = 'R0lGODlhEgAQAMIDAMbDxoSChAAAAP///////////////////yH5BAEKAAQALAAAAAASABAAAAM6SLHc9PCFQSsFIcJpKxiZxnWDYAoiaQFoNKpsql7tNtPyHLv3sNu3n6QnVBBrwyBSAWg6n8WTdIpMAAA7';
    /* //-- */
}
function url_encode($url)
{
    return eregi_replace('[+]', '%20', urlencode($url));
}
switch ($_GET['p']) {
    case "source":
        showsource($_GET['file']);
        break;
    case "thumb":
        makethumb(base64_decode($_GET['file']), $GLOBALS['CONFIG']['THUMB_HEIGHT'], $GLOBALS['CONFIG']['THUMB_WIDTH']);
        break;
    case "mime":
        getmimefile($_GET['type']);
        break;
    case "logo":
        getmimefile('logo');
        break;
    default:
        listdir($dir);
        break;
}
Example #21
0
 /** 
  *		Execute all checks 
  **/
 public function validate($checkId = 'ALL')
 {
     $start_time_checker = microtime(true);
     // prepare checks
     foreach (self::$checklistCommon as $check) {
         require_once TC_INCDIR . "/Checks/{$check}.php";
         $c = __NAMESPACE__ . '\\' . $check;
         $newCheck = new $c();
         $this->checklist[] = $newCheck;
     }
     //prepare files
     if (!isset($this->themeInfo)) {
         trigger_error('themeInfo not set in FileValidator::validate', E_USER_ERROR);
         die;
     }
     if (empty($this->themeInfo->hash)) {
         trigger_error('themeInfo->hash empty in FileValidator::validate', E_USER_ERROR);
         die;
     }
     $unzippath = TC_ROOTDIR . '/../themecheck_vault/unzip/' . $this->themeInfo->hash;
     // update themeInfo data that is discovefred in initFromUnzippedArchivee
     $r = $this->themeInfo->initFromUnzippedArchive($unzippath, $this->themeInfo->zipfilename, $this->themeInfo->zipmimetype, $this->themeInfo->zipfilesize);
     $files = listdir($unzippath);
     if ($files) {
         foreach ($files as $key => $filename) {
             if (substr($filename, -4) == '.php') {
                 $this->phpfiles[$filename] = file_get_contents($filename);
                 $this->phpfiles_filtered[$filename] = Helpers::filterPhp($this->phpfiles[$filename]);
             } else {
                 if (substr($filename, -4) == '.css') {
                     $this->cssfiles[$filename] = file_get_contents($filename);
                 } else {
                     // get all other files : txt, xml, jpg, png
                     $sizelimit = 10000;
                     $this->otherfiles[$filename] = !is_dir($filename) ? file_get_contents($filename, false, NULL, -1, $sizelimit) : '';
                 }
             }
         }
     }
     $this->themeInfo->validationDate = time();
     $check_critical = array();
     $check_warnings = array();
     $check_successes = array();
     $check_info = array();
     $check_undefined = array();
     $check_count = 0;
     $score = 0;
     $isThemeforest = true;
     // run validation. Checks are done in all existing languages and return multilingual arrays in place of strings.
     foreach ($this->checklist as $check) {
         $check->setCurrentThemetype($this->themeInfo->themetype);
         $check->setCurrentCmsVersion($this->themeInfo->cmsVersion);
         $check->doCheck($this->phpfiles, $this->phpfiles_filtered, $this->cssfiles, $this->otherfiles);
         foreach ($check->checks as $checkpart) {
             if ($checkId === 'ALL' || $checkpart->id === $checkId) {
                 if ($checkpart->errorLevel !== ERRORLEVEL_UNDEFINED) {
                     $checkpart->title = $check->title;
                     // a bit dirty
                     if ($checkpart->errorLevel == ERRORLEVEL_CRITICAL) {
                         $check_critical[] = $checkpart;
                     } else {
                         if ($checkpart->errorLevel == ERRORLEVEL_WARNING) {
                             $check_warnings[] = $checkpart;
                         } else {
                             if ($checkpart->errorLevel == ERRORLEVEL_SUCCESS) {
                                 $check_successes[] = $checkpart;
                             } else {
                                 if ($checkpart->errorLevel == ERRORLEVEL_INFO) {
                                     $check_info[] = $checkpart;
                                 } else {
                                     $check_undefined[] = $checkpart;
                                 }
                             }
                         }
                     }
                     $check_count++;
                 }
             }
         }
     }
     // score calculation
     $this->themeInfo->check_count = $check_count;
     $this->themeInfo->check_countOK = count($check_successes);
     $this->themeInfo->criticalCount = count($check_critical);
     $this->themeInfo->warningsCount = count($check_warnings);
     $this->themeInfo->infoCount = count($check_info);
     if ($check_count > 0) {
         $this->themeInfo->score = 100 - $this->themeInfo->warningsCount - 20 * $this->themeInfo->criticalCount;
         if ($this->themeInfo->score < 0) {
             $this->themeInfo->score = 0;
         }
     } else {
         $this->themeInfo->score = 0.0;
     }
     // generate validationResults, one for each existing language. Checks are monolingual : no more multilingual arrays.
     global $ExistingLangs;
     foreach ($ExistingLangs as $l) {
         $this->validationResults[$l] = new ValidationResults($l);
         foreach ($check_critical as $checkpart_multi) {
             $this->validationResults[$l]->check_critical[] = $checkpart_multi->getMonolingual($l);
         }
         foreach ($check_warnings as $checkpart_multi) {
             $this->validationResults[$l]->check_warnings[] = $checkpart_multi->getMonolingual($l);
         }
         foreach ($check_successes as $checkpart_multi) {
             $this->validationResults[$l]->check_successes[] = $checkpart_multi->getMonolingual($l);
         }
         foreach ($check_info as $checkpart_multi) {
             $this->validationResults[$l]->check_info[] = $checkpart_multi->getMonolingual($l);
         }
         foreach ($check_undefined as $checkpart_multi) {
             $this->validationResults[$l]->check_undefined[] = $checkpart_multi->getMonolingual($l);
         }
     }
     // generate themeforest themes auxiliary report
     if ($isThemeforest) {
         $this->generateThemeForestReport();
     }
     $this->duration = microtime(true) - $start_time_checker;
 }
Example #22
0
function listdir($wdir)
{
    global $d, $nd, $pathext;
    $hndl = opendir($wdir);
    while ($file = readdir($hndl)) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        if (is_link($wdir . $file)) {
            continue;
        }
        if (!hidecheck($file)) {
            continue;
        }
        if (!UpPathOK($file . '/')) {
            continue;
        }
        if (is_dir($wdir . $file)) {
            if ($pathext != $file . '/') {
                $nd++;
                $d[$nd] = $wdir . $file;
            }
            listdir($wdir . $file . "/");
        }
    }
    closedir($hndl);
    return $d;
}
Example #23
0
<?php

error_reporting(-1);
$_ = $_POST ?: $_GET;
// if (!$_) {return;}
extract($_);
$mode = $mode ?: "ls";
$handle = $handle ?: "../pages";
switch ($mode) {
    case "ls":
        $output = listdir($handle);
        echo json_encode($output);
        break;
    case "alerts":
        alerts();
        break;
    case "faires":
        faires();
        break;
    case "routes":
        routes();
        break;
    default:
        echo "try again.\n";
        break;
}
function pre($i)
{
    echo "<pre>";
    print_r($i);
    echo "</pre>";
Example #24
0
    } else {
        //$userPath = $root . "/sp/assets/users/" . "_" . scrubData($_GET["view"]);
        $userPath = getAssetPath() . "users" . DIRECTORY_SEPARATOR . "_" . scrubData($_GET["view"]);
    }
} else {
    //$userPath = $root . "/sp/assets/users/" . "_" . $this_user[0];
    $userPath = getAssetPath() . "users" . DIRECTORY_SEPARATOR . "_" . $this_user[0];
}
// Collect the filenames from the following two locations and their subdirectories
if (!isset($use_unix_find)) {
    $userFilesCmd = "find " . $userPath . " -type f";
    $userFiles = shell_exec($userFilesCmd);
    $userFiles = preg_split('/\\n/', $userFiles);
    $disposable = array_pop($userFiles);
} else {
    $userFiles = listdir($userPath);
}
$querier = new Querier();
$file_list = "<table width=\"98%\" class=\"striper\">\n    <tr>\n    <th>" . _("File") . "</th>\n    <th>" . _("Size") . "</th>\n    <th>" . _("Owner") . "</th>\n    <th>" . _("Guides") . "</th>\n    <th>" . _("Delete") . "</th>\n    </tr>";
if ($userFiles) {
    $rowcount = 1;
    foreach ($userFiles as $f) {
        $nameParts = array_reverse(preg_split("/[\\/\\\\]/", $f));
        $shortName = $nameParts[0];
        $nu = explode(DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "users", $f);
        //print "<p>" . $nu[1];
        $location_hint = $nameParts[1];
        $linky = $UserPath . $nu[1];
        if (!in_array($shortName, $ignoreMe)) {
            // can we ignore it?
            $fileInfo = stat($f);
Example #25
0
function mov($file)
{
    global $folder, $content, $filefolder;
    if (!$file == "") {
        maintop("Move");
        echo "<form action=\"" . $adminfile . "?op=move\" method=\"post\">\n" . "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">\n" . "Move " . $folder . $file . " to:\n" . "<select name=ndir size=1>\n" . "<option value=\"" . $filefolder . "\">" . $filefolder . "</option>";
        listdir($filefolder);
        echo $content . "</select>" . "</table><br><input type=\"hidden\" name=\"file\" value=\"" . $file . "\">\n" . "<input type=\"hidden\" name=\"folder\" value=\"" . $folder . "\">\n" . "<input type=\"Submit\" value=\"Move\" class=\"button\">\n";
        mainbottom();
    } else {
        home();
    }
}
Example #26
0
    }
    $msg = "<form method=\"post\">{$lang['opt_info_2']} <b>{$do_template}</b>?<br><br>\n        <input class=\"btn btn-success\" type=submit value=\" {$lang['opt_yes']} \"> &nbsp;<input class=\"btn btn-danger\" onClick=\"document.location='?mod=templates';\" type=button value=\"{$lang['opt_no']}\">\n        <input type=hidden name=mod value=templates>\n        <input type=hidden name=subaction value=dodelete>\n        <input type=hidden name=do_template value=\"{$do_template}\">\n        <input type=hidden name=user_hash value=\"{$dle_login_hash}\">\n        </form>";
    msg("info", $lang['opt_info_3'], $msg);
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Удаление шаблона
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if ($subaction == "dodelete") {
    if (strtolower($do_template) == strtolower($config['skin']) or strtolower($do_template) == "smartphone") {
        msg("Error", $lang['opt_error'], $lang['opt_error_4'], "?mod=templates&user_hash={$dle_login_hash}");
    }
    if (!$do_template or preg_match("/[\\||\\'|\\<|\\>|\\[|\\]|\"|\\!|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\+]/", $do_template)) {
        msg("error", $lang['opt_error'], $lang['opt_error_1'], "?mod=templates&user_hash={$dle_login_hash}");
    }
    $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$_TIME}', '{$_IP}', '68', '{$do_template}')");
    listdir(ROOT_DIR . "/templates/" . $do_template);
    msg("info", $lang['opt_info_3'], $lang['opt_info_4'], "?mod=templates&user_hash={$dle_login_hash}");
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Редактирование шаблона
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$show_delete_link = '';
$do_template = trim(totranslit($do_template, false, false));
if ($do_template == '' or !$do_template) {
    $do_template = $config['skin'];
} elseif ($do_template != $config['skin'] and $do_template != "smartphone") {
    $show_delete_link = "<a class=\"btn btn-red\" href=\"?mod=templates&subaction=delete&user_hash={$dle_login_hash}&do_template={$do_template}\">{$lang['opt_dellink']}</a>";
}
if (!@is_dir(ROOT_DIR . '/templates/' . $do_template)) {
    die("Template not found!");
}
Example #27
0
             if (!$muokkauslukko) {
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;<a href='matkalasku.php?toim={$toim}&tee={$tee}&tilausnumero={$tilausnumero}&poistakuva={$liiterow['tunnus']}'>*" . t("poista") . "*</a>";
             }
             echo "<br>\n";
         }
     }
     echo "</td></tr>";
     echo "</table>";
     echo "<br>";
     echo "<font class='message'>" . t("Lisää kuittikopio tai liite") . "</font><hr>";
     echo "<table>";
     echo "<tr>\n          <th>" . t("Valitse tiedosto") . "</th>\n          <td><input name='userfile' type='file'></td>\n          </tr>";
     $dir = $yhtiorow['skannatut_laskut_polku'] . "/matkalaskut/{$laskurow['toim_ovttunnus']}";
     if (is_dir($dir) and is_writable($dir)) {
         // käydään läpi ensin käsiteltävät kuvat
         $files = listdir($dir);
         if (count($files) > 0) {
             echo "<tr>\n              <th>" . t("Tai valitse skannattu kuitti") . "</th>\n              <td>";
             foreach ($files as $kuitti) {
                 $tiedostonimi = basename($kuitti);
                 echo "<input type='checkbox' name='skannattukuitti[]' value='{$tiedostonimi}'> <button onclick=\"window.open('{$kuitti}', '_blank' ,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,left=200,top=100,width=800,height=600'); return false;\">{$tiedostonimi}</button><br>";
             }
             echo "</td></tr>";
         }
     }
     echo "<th>" . t("Liitteen kuvaus") . "</th>\n          <td><input type='text' size='40' name='kuvaselite' value='{$kuvaselite}'></td>\n          <td class='back'><input type='submit' value='" . t("Tallenna liite") . "'></td>\n          </tr>\n          </table><br>";
     echo "</form>";
 } else {
     echo "</table><br>";
 }
 if (mysql_num_rows($keikres) == 0 and ($laskurow["tilaustyyppi"] == "M" or $lisaatapahtumaan == "OK" or $toim == "SUPER")) {
Example #28
0
        }
        $filepath = $dir == '.' ? $file : $dir . '/' . $file;
        if (is_link($filepath)) {
            continue;
        }
        if (is_file($filepath)) {
            $files[] = $file;
        } else {
            if (is_dir($filepath)) {
                listdiraux($filepath, $files);
            }
        }
    }
    closedir($handle);
}
$files = listdir(CAMILA_TABLES_DIR . '/xls/' . $_REQUEST['lang']);
sort($files, SORT_LOCALE_STRING);
foreach ($files as $file) {
    if ($file != '.' && $file != '..' && substr($file, -3) == 'xls') {
        $result = XLS_import(CAMILA_TABLES_DIR . '/xls/' . $_REQUEST['lang'] . '/' . $file, CAMILA_APPLICATION_PREFIX . substr($file, 0, -4), $db);
    }
}
/*if (is_dir(CAMILA_TABLES_DIR)) {
    if ($dh = opendir(CAMILA_TABLES_DIR.'/xls/'.$_REQUEST['lang'])) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..' && substr($file,-3) == 'xls') {
                $result = XLS_import(CAMILA_TABLES_DIR.'/xls/'.$_REQUEST['lang'].'/'.$file, CAMILA_APPLICATION_PREFIX . substr($file,0,-4), $db);
            }

        }
        closedir($dh);
Example #29
0
function check_main($theme)
{
    global $themechecks, $data, $themename;
    $themename = $theme;
    $theme = get_theme_root($theme) . "/{$theme}";
    $files = listdir($theme);
    $data = tc_get_theme_data($theme . '/style.css');
    if ($data['Template']) {
        // This is a child theme, so we need to pull files from the parent, which HAS to be installed.
        $parent = get_theme_root($data['Template']) . '/' . $data['Template'];
        if (!tc_get_theme_data($parent . '/style.css')) {
            // This should never happen but we will check while were here!
            echo '<h2>' . sprintf(__('Parent theme <strong>%1$s</strong> not found! You have to have parent AND child-theme installed!', 'theme-check'), $data['Template']) . '</h2>';
            return;
        }
        $parent_data = tc_get_theme_data($parent . '/style.css');
        $themename = basename($parent);
        $files = array_merge(listdir($parent), $files);
    }
    if ($files) {
        foreach ($files as $key => $filename) {
            if (substr($filename, -4) == '.php') {
                $php[$filename] = php_strip_whitespace($filename);
            } else {
                if (substr($filename, -4) == '.css') {
                    $css[$filename] = file_get_contents($filename);
                } else {
                    $other[$filename] = !is_dir($filename) ? file_get_contents($filename) : '';
                }
            }
        }
        // run the checks
        $success = run_themechecks($php, $css, $other);
        global $checkcount;
        // second loop, to display the errors
        echo '<h2>' . __('Theme Info', 'theme-check') . ': </h2>';
        echo '<div class="theme-info">';
        if (file_exists(trailingslashit(WP_CONTENT_DIR . '/themes') . trailingslashit(basename($theme)) . 'screenshot.png')) {
            $image = getimagesize($theme . '/screenshot.png');
            echo '<div style="float:right" class="theme-info"><img style="max-height:180px;" src="' . trailingslashit(WP_CONTENT_URL . '/themes') . trailingslashit(basename($theme)) . 'screenshot.png" />';
            echo '<br /><div style="text-align:center">' . $image[0] . 'x' . $image[1] . ' ' . round(filesize($theme . '/screenshot.png') / 1024) . 'k</div></div>';
        }
        echo !empty($data['Title']) ? '<p><label>' . __('Title', 'theme-check') . '</label><span class="info">' . $data['Title'] . '</span></p>' : '';
        echo !empty($data['Version']) ? '<p><label>' . __('Version', 'theme-check') . '</label><span class="info">' . $data['Version'] . '</span></p>' : '';
        echo !empty($data['AuthorName']) ? '<p><label>' . __('Author', 'theme-check') . '</label><span class="info">' . $data['AuthorName'] . '</span></p>' : '';
        echo !empty($data['AuthorURI']) ? '<p><label>' . __('Author URI', 'theme-check') . '</label><span class="info"><a href="' . $data['AuthorURI'] . '">' . $data['AuthorURI'] . '</a>' . '</span></p>' : '';
        echo !empty($data['URI']) ? '<p><label>' . __('Theme URI', 'theme-check') . '</label><span class="info"><a href="' . $data['URI'] . '">' . $data['URI'] . '</a>' . '</span></p>' : '';
        echo !empty($data['License']) ? '<p><label>' . __('License', 'theme-check') . '</label><span class="info">' . $data['License'] . '</span></p>' : '';
        echo !empty($data['License URI']) ? '<p><label>' . __('License URI', 'theme-check') . '</label><span class="info">' . $data['License URI'] . '</span></p>' : '';
        echo !empty($data['Tags']) ? '<p><label>' . __('Tags', 'theme-check') . '</label><span class="info">' . implode($data['Tags'], ', ') . '</span></p>' : '';
        echo !empty($data['Description']) ? '<p><label>' . __('Description', 'theme-check') . '</label><span class="info">' . $data['Description'] . '</span></p>' : '';
        if ($data['Template']) {
            if ($data['Template Version'] > $parent_data['Version']) {
                echo '<p>' . sprintf(__('This child theme requires at least version <strong>%1$s</strong> of theme <strong>%2$s</strong> to be installed. You only have <strong>%3$s</strong> please update the parent theme.', 'theme-check'), $data['Template Version'], $parent_data['Title'], $parent_data['Version']) . '</p>';
            }
            echo '<p>' . sprintf(__('This is a child theme. The parent theme is: <strong>%1$s</strong>. These files have been included automatically!', 'theme-check'), $data['Template']) . '</p>';
            if (empty($data['Template Version'])) {
                echo '<p>' . __('Child theme does not have the <strong>Template Version</strong> tag in style.css.', 'theme-check') . '</p>';
            } else {
                echo $data['Template Version'] < $parent_data['Version'] ? '<p>' . sprintf(__('Child theme is only tested up to version %1$s of %2$s breakage may occur! %3$s installed version is %4$s', 'theme-check'), $data['Template Version'], $parent_data['Title'], $parent_data['Title'], $parent_data['Version']) . '</p>' : '';
            }
        }
        echo '</div><!-- .theme-info-->';
        $plugins = get_plugins('/theme-check');
        $version = explode('.', $plugins['theme-check.php']['Version']);
        echo '<p>' . sprintf(__(' Running <strong>%1$s</strong> tests against <strong>%2$s</strong> using Guidelines Version: <strong>%3$s</strong> Plugin revision: <strong>%4$s</strong>', 'theme-check'), $checkcount, $data['Title'], $version[0], $version[1]) . '</p>';
        $results = display_themechecks();
        if (!$success) {
            echo '<h2>' . sprintf(__('One or more errors were found for %1$s.', 'theme-check'), $data['Title']) . '</h2>';
        } else {
            echo '<h2>' . sprintf(__('%1$s passed the tests', 'theme-check'), $data['Title']) . '</h2>';
            tc_success();
        }
        if (!defined('WP_DEBUG') || WP_DEBUG == false) {
            echo '<div class="updated"><span class="tc-fail">' . __('WARNING', 'theme-check') . '</span> ' . __('<strong>WP_DEBUG is not enabled!</strong> Please test your theme with <a href="http://codex.wordpress.org/Editing_wp-config.php">debug enabled</a> before you upload!', 'theme-check') . '</div>';
        }
        echo '<div class="tc-box">';
        echo '<ul class="tc-result">';
        echo $results;
        echo '</ul></div>';
    }
}
Example #30
0
File: xml.php Project: eldiyar/labs
    switch ($action) {
        case "login":
            login();
            break;
        case "logout":
            logout();
            break;
        case "file":
            statfile();
            break;
        case "reg":
            reg();
            break;
        case "list":
        default:
            listdir();
            break;
    }
} else {
    login();
}
function listdir()
{
    global $users, $user, $skip_files, $allowed_types;
    $sizes = array(" байт", " КБ", " МБ", " ГБ", " ТБ", " ПБ", " ЕБ", " ЗБ");
    $curr_dir = preg_replace('/\\/?([^\\/\\\\]*)\\/\\.\\./', '', $_REQUEST['dir']);
    list($user, $pass, $uid, $gid, $extra, $home_dir) = explode(":", $users[$user]);
    $ref_dir = "data" . $home_dir . $curr_dir;
    $stat = array_combine(array_map('trim', file("inc/statkeys.txt")), array_map('trim', file("inc/statvals.txt")));
    $stat[$ref_dir]++;
    file_put_contents("inc/statkeys.txt", implode("\n", array_keys($stat)));