Example #1
0
function ls($pattern = "*", $folder = "", $recursivly = false, $options = array('return_files', 'return_folders'))
{
    if ($folder) {
        $current_folder = realpath('.');
        if (in_array('quiet', $options)) {
            // If quiet is on, we will suppress the 'no such folder' error
            if (!file_exists($folder)) {
                return array();
            }
        }
        if (!chdir($folder)) {
            return array();
        }
    }
    $get_files = in_array('return_files', $options);
    $get_folders = in_array('return_folders', $options);
    $both = array();
    $folders = array();
    // Get the all files and folders in the given directory.
    if ($get_files) {
        $both = glob($pattern, GLOB_BRACE + GLOB_MARK);
    }
    if ($recursivly or $get_folders) {
        $folders = glob("*", GLOB_ONLYDIR + GLOB_MARK);
    }
    //If a pattern is specified, make sure even the folders match that pattern.
    $matching_folders = array();
    if ($pattern !== '*') {
        $matching_folders = glob($pattern, GLOB_ONLYDIR + GLOB_MARK);
    }
    //Get just the files by removing the folders from the list of all files.
    $all = array_values(array_diff($both, $folders));
    if ($recursivly or $get_folders) {
        foreach ($folders as $this_folder) {
            if ($get_folders) {
                //If a pattern is specified, make sure even the folders match that pattern.
                if ($pattern !== '*') {
                    if (in_array($this_folder, $matching_folders)) {
                        array_push($all, $this_folder);
                    }
                } else {
                    array_push($all, $this_folder);
                }
            }
            if ($recursivly) {
                // Continue calling this function for all the folders
                $deep_items = ls($pattern, $this_folder, $recursivly, $options);
                # :RECURSION:
                foreach ($deep_items as $item) {
                    array_push($all, $this_folder . $item);
                }
            }
        }
    }
    if ($folder) {
        chdir($current_folder);
    }
    //echo "LS_called!<br />";
    return $all;
}
Example #2
0
 public static function listSvgWidget()
 {
     $return = array();
     $uploaddir = dirname(__FILE__) . '/../special';
     $data['files'] = ls($uploaddir, "*", false, array('files'));
     $data['folders'] = ls($uploaddir, "*", false, array('folders'));
     for ($index = 0; $index < count($data['folders']); $index++) {
         $data['folders'][$index] = str_replace('/', '', $data['folders'][$index]);
     }
     for ($index = 0; $index < count($data['files']); $index++) {
         $filename = pathinfo($data['files'][$index]);
         for ($nbFolder = 0; $nbFolder < count($data['folders']); $nbFolder++) {
             if ($data['folders'][$nbFolder] == strtolower($filename['filename'])) {
                 $folders['name'] = $data['files'][$index];
                 $folders['folder'] = strtolower($filename['filename']) . '/';
                 $folders['files'] = ls($uploaddir . '/' . strtolower($filename['filename']), "*", false, array('files'));
                 $extension = pathinfo(strtolower($folders['files'][0]));
                 $folders['extension'] = $extension['extension'];
                 //return $folders;.replace(/<?[^>]*>/, "").replace(/<!DOCTYPE[^>]*>/, "").replace(/<!--[^>]*>/, "")
                 if (in_array($folders['extension'], array('svg'))) {
                     for ($nbFile = 0; $nbFile < count($folders['files']); $nbFile++) {
                         $filename = pathinfo($folders['files'][$nbFile]);
                         $folders['svg'][$nbFile]['name'] = $filename['filename'];
                         $folders['svg'][$nbFile]['snap'] = file_get_contents($uploaddir . '/' . $folders['folder'] . $folders['files'][$nbFile]);
                     }
                 }
                 $return[] = $folders;
             }
         }
     }
     return $return;
 }
Example #3
0
 public static function devicesParameters($_device = '')
 {
     $path = dirname(__FILE__) . '/../config/devices';
     if (isset($_device) && $_device != '') {
         $files = ls($path, $_device . '.php', false, array('files', 'quiet'));
         if (count($files) == 1) {
             global $deviceConfiguration;
             require_once $path . '/' . $files[0];
             return $deviceConfiguration[$_device];
         }
     }
     $files = ls($path, '*.php', false, array('files', 'quiet'));
     $return = array();
     foreach ($files as $file) {
         global $deviceConfiguration;
         require_once $path . '/' . $file;
         $return = $return + $deviceConfiguration;
     }
     if (isset($_device) && $_device != '') {
         if (isset($return[$_device])) {
             return $return[$_device];
         }
         return array();
     }
     return $return;
 }
Example #4
0
 public function __construct()
 {
     /* Init rules. */
     $rulesPath = WIKIDOT_ROOT . '/php/utils/karmarules/';
     $files = ls($rulesPath, '*.php');
     foreach ($files as $f) {
         require_once $rulesPath . '/' . $f;
         $cn = str_replace('.php', '', basename($f));
         $this->_rules[] = new $cn();
     }
 }
Example #5
0
 private function compile(array $tokens)
 {
     $cg = (object) ['ts' => TokenStream::fromSlice($tokens), 'parsers' => []];
     traverse(rtoken('/^(T_\\w+)·(\\w+)$/')->onCommit(function (Ast $result) use($cg) {
         $token = $result->token();
         $id = $this->lookupCapture($token);
         $type = $this->lookupTokenType($token);
         $cg->parsers[] = token($type)->as($id);
     }), ($parser = chain(rtoken('/^·\\w+$/')->as('type'), token('('), optional(ls(either(future($parser)->as('parser'), chain(token(T_FUNCTION), parentheses()->as('args'), braces()->as('body'))->as('function'), string()->as('string'), rtoken('/^T_\\w+·\\w+$/')->as('token'), rtoken('/^T_\\w+$/')->as('constant'), rtoken('/^·this$/')->as('this'), label()->as('label'))->as('parser'), token(',')))->as('args'), commit(token(')')), optional(rtoken('/^·\\w+$/')->as('label'), null)))->onCommit(function (Ast $result) use($cg) {
         $cg->parsers[] = $this->compileParser($result->type, $result->args, $result->label);
     }), $this->layer('{', '}', braces(), $cg), $this->layer('[', ']', brackets(), $cg), $this->layer('(', ')', parentheses(), $cg), rtoken('/^···(\\w+)$/')->onCommit(function (Ast $result) use($cg) {
         $id = $this->lookupCapture($result->token());
         $cg->parsers[] = layer()->as($id);
     }), token(T_STRING, '·')->onCommit(function (Ast $result) use($cg) {
         $offset = \count($cg->parsers);
         if (0 !== $this->dominance || 0 === $offset) {
             $this->fail(self::E_BAD_DOMINANCE, $offset, $result->token()->line());
         }
         $this->dominance = $offset;
     }), rtoken('/·/')->onCommit(function (Ast $result) {
         $token = $result->token();
         $this->fail(self::E_BAD_CAPTURE, $token, $token->line());
     }), any()->onCommit(function (Ast $result) use($cg) {
         $cg->parsers[] = token($result->token());
     }))->parse($cg->ts);
     // check if macro dominance '·' is last token
     if ($this->dominance === \count($cg->parsers)) {
         $this->fail(self::E_BAD_DOMINANCE, $this->dominance, $cg->ts->last()->line());
     }
     $this->specificity = \count($cg->parsers);
     if ($this->specificity > 1) {
         if (0 === $this->dominance) {
             $pattern = chain(...$cg->parsers);
         } else {
             /*
               dominat macros are partially wrapped in commit()s and dominance
               is the offset used as the 'event horizon' point... once the entry
               point is matched, there is no way back and a parser error arises
             */
             $prefix = array_slice($cg->parsers, 0, $this->dominance);
             $suffix = array_slice($cg->parsers, $this->dominance);
             $pattern = chain(...array_merge($prefix, array_map(commit::class, $suffix)));
         }
     } else {
         /*
           micro optimization to save one function call for every token on the subject
           token stream whenever the macro pattern consists of a single parser
         */
         $pattern = $cg->parsers[0];
     }
     return $pattern;
 }
Example #6
0
function ls($basePath, $path)
{
    echo "<ul>";
    $files = scandir($basePath . $path);
    foreach ($files as $file) {
        if ($file != "." && $file != ".." && $file != ".svn") {
            echo "<li>";
            if (is_dir($basePath . $path . "/" . $file)) {
                echo $file;
                ls($basePath, $path . "/" . $file);
            } else {
                echo "<a href=\"page.php?p={$path}/{$file}\">{$file}</a>";
            }
            echo "</li>";
        }
    }
    echo "</ul>";
}
Example #7
0
function ls($curpath)
{
    $lsoutput = "";
    $dir = dir($curpath);
    while ($file = $dir->read()) {
        if ($file != "." && $file != "..") {
            if (is_dir($curpath . $file)) {
                $lsoutput .= ls($curpath . $file . "/");
            } else {
                if (notIgnore($curpath . $file)) {
                    $lsoutput .= "      <filename>" . substr($curpath . $file, 2) . "</filename>\n";
                }
            }
        }
    }
    $dir->close();
    return $lsoutput;
}
Example #8
0
 public static function listWidget($_version)
 {
     $path = dirname(__FILE__) . '/../template/' . $_version;
     $files = ls($path, 'cmd.*', false, array('files', 'quiet'));
     $return = array();
     foreach ($files as $file) {
         $informations = explode('.', $file);
         $pathfile = $path . '/' . $file;
         $widget = new self();
         $widget->setType($informations[1]);
         $widget->setSubtype($informations[2]);
         $widget->setName($informations[3]);
         $widget->setVersion($_version);
         $widget->setContent(file_get_contents($pathfile));
         $widget->setPath($pathfile);
         $return[] = $widget;
     }
     return $return;
 }
Example #9
0
File: index.php Project: rafr3/docs
 function ls($path, &$html = array())
 {
     foreach (new FilesystemIterator($path, FilesystemIterator::SKIP_DOTS) as $file) {
         if ($file->getFilename() == '.DS_Store') {
             continue;
         } elseif ($file->isDir()) {
             $html[] = "\n<li>";
             $html[] = $file->getBaseName();
             $html[] = '<ul>';
             $html[] = ls($file->getPathname());
             $html[] = '</ul>';
             $html[] = '</li>';
         } else {
             $link = ltrim(preg_replace('/^' . preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', ROOT), '/') . '/i', '', str_replace(DIRECTORY_SEPARATOR, '/', $file)), '/');
             $html[] = "\n<li>";
             $html[] = '<a href="index.php?doc=' . urlencode($link) . '">' . $file->getBaseName() . '</a>';
             $html[] = '</li>';
         }
     }
     return implode("\n", $html);
 }
Example #10
0
function loadModules()
{
    // Code HTML d'importation
    $scripts = '';
    $styles = '';
    // Liste des modules
    ls('modules', function ($modpath, $modfile) use(&$scripts, &$styles) {
        // Fichiers de scripts/styles
        $modscripts = "{$modpath}/scripts";
        $modstyles = "{$modpath}/styles";
        // echo "$modscripts<br/>";
        // Chargement des scripts
        ls($modscripts, function ($subpath, $subfile) use(&$scripts, $modfile) {
            $scripts .= "<script src='./modules/{$modfile}/scripts/{$subfile}'></script>";
        }, 'is_file');
        // Chargement des styles
        ls($modstyles, function ($subpath, $subfile) use(&$styles, $modfile) {
            $styles .= "<link rel='stylesheet' type='text/css' href='./modules/{$modfile}/styles/{$subfile}'/>";
        }, 'is_file');
    }, 'is_dir');
    // On retourne tout
    return array('styles' => $styles . "\n", 'scripts' => $scripts . "\n");
}
Example #11
0
/**
 * Read the plugin folder and put all the plugins found there in the dropdown menu
 */
function loadPlugins()
{
    global $config;
    $plugins = array();
    // Open plugin directory, and proceed to read its contents
    $dir = joinPath($config['site_folder'], 'plugins');
    $files = ls("*", $dir, false, array('return_folders'));
    foreach ($files as $file) {
        if ($file == 'CVS' . DIRECTORY_SEPARATOR || $file == '.' || $file == '..' || $file == 'api' . DIRECTORY_SEPARATOR || $file == '.svn' . DIRECTORY_SEPARATOR) {
            continue;
        }
        $plugins[] = substr($file, 0, -1);
        //Remove the trailing '/'
    }
    //Show the dropdown menu only if there are plugins
    if (count($plugins)) {
        print '<li class="dropdown"><a href="' . joinPath($config['site_relative_path'], 'plugins/') . '" class="plugin with-icon">Plugins</a>';
        print "\n<ul class='menu-with-icon plugins'>\n";
        foreach ($plugins as $plug) {
            print '<li><a href="' . joinPath($config['site_absolute_path'], 'plugins/', "{$plug}/") . '">' . format($plug) . '</a></li>' . "\n";
        }
        print '</ul></li>';
    }
}
function listCachedProtocols($cacheDir)
{
    $protocolDirs = ls($cacheDir);
    if (count($protocolDirs) > 0) {
        foreach ($protocolDirs as $pdir) {
            $curProtocols = ls($cacheDir . "/" . $pdir);
            if (count($curProtocols) > 0) {
                foreach ($curProtocols as $pname) {
                    $protocols[$pdir][] = $pname;
                    //echo basename($pdir)."/".basename($pname)." ";
                }
            }
        }
    } else {
        $protocols = 0;
    }
    return $protocols;
}
Example #13
0
                        </div>
                        <div class="well col-sm-9" id="bsPanelWidgetImages" style="min-width: 725px;">
                            <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                                <div class="panel panel-default">
                                    <div class="panel-heading" role="tab" id="headingOne">
                                        <h4 class="panel-title">
                                            <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                                {{Bibliothèque d'images : Jeedom}}<small><em><bold> - {{Les divers icônes de Jeedom disponibles}}</bold></em></small>
                                            </a>
                                        </h4>
                                    </div>
                                    <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                                        <div class="panel-body" style="height: 250px; overflow: auto">
                                            <div class="col-sm-12" id="bsIconView">
                                                <?php 
foreach (ls('core/css/icon', '*') as $dir) {
    if (is_dir('core/css/icon/' . $dir) && file_exists('core/css/icon/' . $dir . '/style.css')) {
        $css = file_get_contents('core/css/icon/' . $dir . '/style.css');
        $research = strtolower(str_replace('/', '', $dir));
        preg_match_all("/\\." . $research . "-(.*?):/", $css, $matches, PREG_SET_ORDER);
        $height = ceil(count($matches) / 12) * 80 + 80;
        echo '<div style="height : ' . $height . 'px;"><legend>{{' . str_replace('/', '', $dir) . '}}</legend>';
        $number = 1;
        foreach ($matches as $match) {
            if (isset($match[0])) {
                if ($number == 1) {
                    echo '<div class="row">';
                }
                echo '<div class="col-sm-1 divIconSel">';
                $icon = str_replace(array(':', '.'), '', $match[0]);
                echo '<center><span class="iconSel"><i class=\'icon ' . $icon . '\'></i></span><br/><span class="iconDesc">' . $icon . '</span></center>';
Example #14
0
 public static function getCurrentSysInfoFolder()
 {
     $dir = dirname(__FILE__) . '/../../';
     $ls = ls($dir, 'sysinfo*');
     if (count($ls) != 1) {
         return '';
     }
     return $ls[0];
 }
Example #15
0
function _AllFiles($Dir=false)
{
	global $ExploreDir;
	
	$Dir = !$Dir ? $ExploreDir : $Dir;
	
	$FileArr = ls($Dir);
	$ret[$Dir."/"] = $FileArr["files"];
	
	foreach ($FileArr["dirs"] as $Path)
	{
		$ret = array_merge($ret,_AllFiles($Dir."/".$Path));
	}
	
	$ret = !isset($ret) ? array() : $ret ;
	return $ret;
}
Example #16
0
        $title = $header . ' - ' . $title;
    } else {
        // chapter NOT exist or NOT in menu >>
        $error = TRUE;
    }
}
// handle error >>
if ($error === TRUE) {
    $header = 'Error 404: file not found';
    $content = '<p>Error 404: file not found</p>';
    $title = $header . ' - ' . $title;
}
// get downloadable files >>
$ls_arg = trim(get_tag($content, 'ls'));
if ($ls_arg != '') {
    $ls = ls($ls_arg);
    $_ = explode('<ls>' . $ls_arg . '</ls>', $content);
    $content = implode($ls, $_);
}
// make style >>
$style = read_file($etc . 'master.css');
// load page design >>
include $etc . 'skin.php';
// KERNEL FUNCTIONS >>
// ----------------------------------------------------- //
// read directory handle and return array from file names >>
function read_dir($dir)
{
    if (is_dir($dir)) {
        if (substr($dir, -1) != '/') {
            $dir = $dir . '/';
Example #17
0
 public static function listPlugin($_activateOnly = false, $_orderByCaterogy = false, $_translate = true)
 {
     $listPlugin = array();
     if ($_activateOnly) {
         $sql = "SELECT plugin\n            FROM config\n            WHERE `key`='active'\n            AND `value`='1'";
         $results = DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
         foreach ($results as $result) {
             try {
                 $listPlugin[] = plugin::byId($result['plugin'], $_translate);
             } catch (Exception $e) {
                 log::add('plugin', 'error', $e->getMessage(), 'pluginNotFound::' . $result['plugin']);
             }
         }
     } else {
         $rootPluginPath = dirname(__FILE__) . '/../../plugins';
         foreach (ls($rootPluginPath, '*') as $dirPlugin) {
             if (is_dir($rootPluginPath . '/' . $dirPlugin)) {
                 $pathInfoPlugin = $rootPluginPath . '/' . $dirPlugin . '/plugin_info/info.xml';
                 if (file_exists($pathInfoPlugin)) {
                     try {
                         $listPlugin[] = plugin::byId($pathInfoPlugin, $_translate);
                     } catch (Exception $e) {
                         log::add('plugin', 'error', $e->getMessage(), 'pluginNotFound::' . $pathInfoPlugin);
                     }
                 }
             }
         }
     }
     if ($_orderByCaterogy) {
         $return = array();
         if (count($listPlugin) > 0) {
             foreach ($listPlugin as $plugin) {
                 $category = $plugin->getCategory();
                 if ($category == '') {
                     $category = __('Autre', __FILE__);
                 }
                 if (!isset($return[$category])) {
                     $return[$category] = array();
                 }
                 $return[$category][] = $plugin;
             }
             foreach ($return as &$category) {
                 usort($category, 'plugin::orderPlugin');
             }
             ksort($return);
         }
         return $return;
     } else {
         if (isset($listPlugin) && is_array($listPlugin) && count($listPlugin) > 0) {
             usort($listPlugin, 'plugin::orderPlugin');
             return $listPlugin;
         } else {
             return array();
         }
     }
 }
Example #18
0
<?php

// TWEET NEST
// Load user
require "mpreheader.php";
$pageTitle = "Loading user info";
require "mheader.php";
echo l("Connecting & parsing...\n");
$path = "1/users/show.json?screen_name=" . $config['twitter_screenname'];
echo l("Connecting to: <span class=\"address\">" . ls($path) . "</span>\n");
$data = $twitterApi->query($path);
if ($data) {
    $extra = array("created_at" => (string) $data->created_at, "utc_offset" => (string) $data->utc_offset, "time_zone" => (string) $data->time_zone, "lang" => (string) $data->lang, "profile_background_color" => (string) $data->profile_background_color, "profile_text_color" => (string) $data->profile_text_color, "profile_link_color" => (string) $data->profile_link_color, "profile_sidebar_fill_color" => (string) $data->profile_sidebar_fill_color, "profile_sidebar_border_color" => (string) $data->profile_sidebar_border_color, "profile_background_image_url" => (string) $data->profile_background_image_url, "profile_background_tile" => (string) $data->profile_background_tile);
    echo l("Checking...\n");
    $db->query("DELETE FROM `" . DTP . "tweetusers` WHERE `userid` = '0'");
    // Getting rid of empty users created in error
    $q = $db->query("SELECT * FROM `" . DTP . "tweetusers` WHERE `userid` = '" . $db->s($data->id) . "' LIMIT 1");
    if ($db->numRows($q) <= 0) {
        $iq = "INSERT INTO `" . DTP . "tweetusers` (`userid`, `screenname`, `realname`, `location`, `description`, `profileimage`, `url`, `extra`, `enabled`) VALUES ('" . $db->s($data->id) . "', '" . $db->s($data->screen_name) . "', '" . $db->s($data->name) . "', '" . $db->s($data->location) . "', '" . $db->s($data->description) . "', '" . $db->s($data->profile_image_url) . "', '" . $db->s($data->url) . "', '" . $db->s(serialize($extra)) . "', '1');";
    } else {
        $iq = "UPDATE `" . DTP . "tweetusers` SET `screenname` = '" . $db->s($data->screen_name) . "', `realname` = '" . $db->s($data->name) . "', `location` = '" . $db->s($data->location) . "', `description` = '" . $db->s($data->description) . "', `profileimage` = '" . $db->s($data->profile_image_url) . "', `url` = '" . $db->s($data->url) . "', `extra` = '" . $db->s(serialize($extra)) . "' WHERE `userid` = '" . $db->s($data->id) . "' LIMIT 1";
    }
    echo l("Updating...\n");
    $q = $db->query($iq);
    echo $q ? l(good("Done!")) : l(bad("DATABASE ERROR: " . $db->error()));
} else {
    echo l(bad("No data! Try again later."));
}
require "mfooter.php";
 public function getAssistantFilePath()
 {
     $id = $this->getConfiguration('manufacturer_id') . '.' . $this->getConfiguration('product_type') . '.' . $this->getConfiguration('product_id');
     $files = ls(dirname(__FILE__) . '/../config/devices', $id . '_*.php', false, array('files', 'quiet'));
     foreach (ls(dirname(__FILE__) . '/../config/devices', '*', false, array('folders', 'quiet')) as $folder) {
         foreach (ls(dirname(__FILE__) . '/../config/devices/' . $folder, $id . '_*.php', false, array('files', 'quiet')) as $file) {
             $files[] = $folder . $file;
         }
     }
     if (count($files) > 0) {
         return $files[0];
     }
     return false;
 }
Example #20
0
<?php

define("BASE_DIR", dirname(dirname(__FILE__)));
require_once BASE_DIR . "/include/constants.inc";
require_once BASE_DIR . "/include/globals.inc";
require_once BASE_DIR . "/include/misc.inc";
require_once BASE_DIR . "/include/db.inc";
$dirname = str_replace("\\", "/", BASE_DIR . "/_backup");
db_set_constraints(false);
foreach (ls($dirname) as $file) {
    //if ($file == 'event_guest.sql') {
    //	continue;
    //}
    try {
        db_execute_file($dirname . "/" . $file);
    } catch (Exception $e) {
        echo '<pre>';
        print_r($e);
        echo '</pre>';
        exit;
    }
}
db_set_constraints(true);
?>
<html>
	<head>
		<title>Restoration done</title>
	</head>
	<body>
		Restoration success<br/>
		<a href="../index.php">Go to index</a>
Example #21
0
 case 'securityWarning':
     if ($axValue == 'installer') {
         $tpl->display("security_warning.tpl");
     }
     break;
     /**
      * Display the preferences dialog.
      */
 /**
  * Display the preferences dialog.
  */
 case 'prefs':
     if (isset($kga['customer'])) {
         die;
     }
     $tpl->assign('skins', ls("../skins"));
     $tpl->assign('langs', langs());
     $tpl->assign('timezones', timezoneList());
     $tpl->assign('usr', $kga['usr']);
     $tpl->assign('rate', get_rate($kga['usr']['usr_ID'], NULL, NULL));
     $tpl->display("preferences.tpl");
     break;
     /**
      * Display the dialog to add or edit a customer.
      */
 /**
  * Display the dialog to add or edit a customer.
  */
 case 'add_edit_knd':
     if (isset($kga['customer']) || $kga['usr']['usr_sts'] == 2) {
         die;
Example #22
0
    $c_f_rel .= "{$v}={$v}-index.html\n";
}
foreach ($NAMES as $fls => $met) {
    $context = array_merge($context, array_values($NAMES[$fls]));
}
foreach ($context as $k => $v) {
    foreach ($NAMES as $mk => $mv) {
        if (in_array($v, $mv)) {
            $filelist .= "{$v}={$mk}.{$v}.html\n";
        }
    }
}
$main_classes = implode(",", array_keys($NAMES));
/* Librerías */
//$docs=array("Lib/lib_list.php","Lib/lib_planty.php");
$docs = ls("Lib");
$NAMES = array(array());
$METHODS = array();
foreach ($docs as $k => $file) {
    echo "Parseando {$file}\n.....";
    parse_code($file);
}
echo "<pre>";
print_r($NAMES);
echo "</pre>";
$NAMES = array_slice($NAMES, 1);
foreach (array_keys($NAMES) as $k => $v) {
    $out = fopen($SYS["DOCROOT"] . "Doc/{$v}-index.html", "wt");
    $mdata = '
	<html>
		<head>
Example #23
0
				<ul>
				<li><a href="../index.php" title="Indice">Home</a></li>
			</ul>
			</div>
			</div>
			
			<div id="left_side">
			 <strong>Guestbook</strong><br />
				<a href="./scrivi.php" title="Scrivi nel Guestbook"><strong>Scrivi nel Guestbook</strong></a><br />
				 <p>Ecco a voi il mio guestbook basato sull'engine di viRublog</p>
					<?php 
$pagina = (int) $_GET['p'];
if ($pagina < 1 || !is_numeric($pagina)) {
    $pagina = 1;
}
$vettore = ls("*", "./data/", false);
$lungh_array = count($vettore);
$pathdata = "./data/";
$paginegen = (int) ($lungh_array / 6);
if ($lungh_array % 6 > 0) {
    $paginegen = $paginegen + 1;
}
if ($pagina > $paginegen) {
    $pagina = 1;
}
inpagina($vettore, $lungh_array, $pagina, $pathdata);
echo "<div class=\"sinistra\">" . $lung_array . "go to page:";
for ($i = 1; $i <= $paginegen; ++$i) {
    if ($pagina == $i) {
        echo "{$i} &gt; ";
    } else {
Example #24
0
if (!empty($config['targets']) && is_array($config['targets'])) {
    foreach ($config['targets'] as $name => $val) {
        $targets_select .= '<option value="' . $val . '">' . $name . '</option>';
    }
}
// Log files from the log directory defined in our config.
$logs_select = '';
$logs = ls($config['sources']['log'], '/^.*log$/', 'asc');
foreach ($logs as $filename) {
    $buf = explode('.', $filename);
    $readable = timify($buf[0]);
    $logs_select .= '<option value="' . $filename . '">' . $readable . '</option>' . "\n";
}
// HTML Reports from the reports directory defined in our config.
$reports_select = '';
$reports = ls($config['sources']['reports'], '/^.*html$/', 'asc');
foreach ($reports as $filename) {
    $buf = explode('.', $filename);
    $readable = timify($buf[0], false);
    $reports_select .= '<option value="' . $filename . '">' . $readable . '</option>' . "\n";
}
/**
 * Generate HTML.
 */
$html = '';
$html .= <<<HEADER
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <title>AUS Regression Tests :: mozilla.org</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
Example #25
0
</b></td>
<td><b><?php 
echo $_lang['files_modified'];
?>
</b></td>
<td><b><?php 
echo $_lang['files_filesize'];
?>
</b></td>
<td><b><?php 
echo $_lang['files_fileoptions'];
?>
</b></td>
</tr>
<?php 
ls($startpath);
echo "\n\n\n\n\n\n\n";
if ($folders == 0 && $files == 0) {
    echo '<tr><td colspan="4"><img src="media/style/', $manager_theme, 'images/tree/deletedfolder.gif" border="0" /><span style="color:#888;cursor:default;"> This directory is empty.</span></td></tr>';
}
?>
</table><?php 
echo $_lang['files_directories'], ': <b>', $folders, '</b><br />';
echo $_lang['files_files'], ': <b>', $files, '</b><br />';
echo $_lang['files_data'], ': <b><span dir="ltr">', ufilesize($filesizes), '</span></b><br />';
echo $_lang['files_dirwritable'], ' <b>', is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no'] . '.';
?>
</b><br />
<div align="center">
<img src="<?php 
echo $_style['tx'];
Example #26
0
function importTweets($p)
{
    global $twitterApi, $db, $config, $access, $search;
    $p = trim($p);
    if (!$twitterApi->validateUserParam($p)) {
        return false;
    }
    $maxCount = 200;
    $tweets = array();
    $sinceID = 0;
    $maxID = 0;
    echo l("Importing:\n");
    // Do we already have tweets?
    $pd = $twitterApi->getUserParam($p);
    if ($pd['name'] == "screen_name") {
        $uid = $twitterApi->getUserId($pd['value']);
        $screenname = $pd['value'];
    } else {
        $uid = $pd['value'];
        $screenname = $twitterApi->getScreenName($pd['value']);
    }
    $tiQ = $db->query("SELECT `tweetid` FROM `" . DTP . "tweets` WHERE `userid` = '" . $db->s($uid) . "' ORDER BY `id` DESC LIMIT 1");
    if ($db->numRows($tiQ) > 0) {
        $ti = $db->fetch($tiQ);
        $sinceID = $ti['tweetid'];
    }
    echo l("User ID: " . $uid . "\n");
    // Find total number of tweets
    $total = totalTweets($p);
    if ($total > 3200) {
        $total = 3200;
    }
    // Due to current Twitter limitation
    $pages = ceil($total / $maxCount);
    echo l("Total tweets: <strong>" . $total . "</strong>, Approx. page total: <strong>" . $pages . "</strong>\n");
    if ($sinceID) {
        echo l("Newest tweet I've got: <strong>" . $sinceID . "</strong>\n");
    }
    // Retrieve tweets
    do {
        // Determine path to Twitter timeline resource
        $path = "1/statuses/user_timeline.json?" . $p . "&include_rts=true&include_entities=true&count=" . $maxCount . ($sinceID ? "&since_id=" . $sinceID : "") . ($maxID ? "&max_id=" . $maxID : "");
        // Announce
        echo l("Retrieving page <strong>#" . ($i + 1) . "</strong>: <span class=\"address\">" . ls($path) . "</span>\n");
        // Get data
        $data = $twitterApi->query($path);
        // Drop out on connection error
        if (is_array($data) && $data[0] === false) {
            dieout(l(bad("Error: " . $data[1] . "/" . $data[2])));
        }
        // Start parsing
        echo l("<strong>" . ($data ? count($data) : 0) . "</strong> new tweets on this page\n");
        if (!empty($data)) {
            echo l("<ul>");
            foreach ($data as $i => $tweet) {
                // Shield against duplicate tweet from max_id
                if (!IS64BIT && $i == 0 && $maxID == $tweet->id_str) {
                    unset($data[0]);
                    continue;
                }
                // List tweet
                echo l("<li>" . $tweet->id_str . " " . $tweet->created_at . "</li>\n");
                // Create tweet element and add to list
                $tweets[] = $twitterApi->transformTweet($tweet);
                // Determine new max_id
                $maxID = $tweet->id_str;
                // Subtracting 1 from max_id to prevent duplicate, but only if we support 64-bit integer handling
                if (IS64BIT) {
                    $maxID = (int) $tweet->id - 1;
                }
            }
            echo l("</ul>");
        }
        /*if(count($data) < ($maxCount - 50)){
        			echo l("We've reached last page\n");
        			break;
        		}*/
    } while (!empty($data));
    if (count($tweets) > 0) {
        // Ascending sort, oldest first
        $tweets = array_reverse($tweets);
        echo l("<strong>All tweets collected. Reconnecting to DB...</strong>\n");
        $db->reconnect();
        // Sometimes, DB connection times out during tweet loading. This is our counter-action
        echo l("Inserting into DB...\n");
        $error = false;
        foreach ($tweets as $tweet) {
            $q = $db->query($twitterApi->insertQuery($tweet));
            if (!$q) {
                dieout(l(bad("DATABASE ERROR: " . $db->error())));
            }
            $text = $tweet['text'];
            $te = $tweet['extra'];
            if (is_string($te)) {
                $te = @unserialize($tweet['extra']);
            }
            if (is_array($te)) {
                // Because retweets might get cut off otherwise
                $text = array_key_exists("rt", $te) && !empty($te['rt']) && !empty($te['rt']['screenname']) && !empty($te['rt']['text']) ? "RT @" . $te['rt']['screenname'] . ": " . $te['rt']['text'] : $tweet['text'];
            }
            $search->index($db->insertID(), $text);
        }
        echo !$error ? l(good("Done!\n")) : "";
    } else {
        echo l(bad("Nothing to insert.\n"));
    }
    // Checking personal favorites -- scanning all
    echo l("\n<strong>Syncing favourites...</strong>\n");
    // Resetting these
    $favs = array();
    $maxID = 0;
    $sinceID = 0;
    do {
        $path = "1/favorites.json?" . $p . "&count=" . $maxCount . ($maxID ? "&max_id=" . $maxID : "");
        echo l("Retrieving page <strong>#" . ($i + 1) . "</strong>: <span class=\"address\">" . ls($path) . "</span>\n");
        $data = $twitterApi->query($path);
        if (is_array($data) && $data[0] === false) {
            dieout(l(bad("Error: " . $data[1] . "/" . $data[2])));
        }
        echo l("<strong>" . ($data ? count($data) : 0) . "</strong> total favorite tweets on this page\n");
        if (!empty($data)) {
            echo l("<ul>");
            foreach ($data as $tweet) {
                if (!IS64BIT && $i == 0 && $maxID == $tweet->id_str) {
                    unset($data[0]);
                    continue;
                }
                if ($tweet->user->id_str == $uid) {
                    echo l("<li>" . $tweet->id_str . " " . $tweet->created_at . "</li>\n");
                    $favs[] = $maxID = $tweet->id_str;
                    if (IS64BIT) {
                        $maxID = (int) $tweet->id - 1;
                    }
                }
            }
            echo l("</ul>");
        }
        echo l("<strong>" . count($favs) . "</strong> favorite own tweets so far\n");
        //if(count($data) < ($maxCount - 50)){ break; } // We've reached last page
    } while (!empty($data));
    // Blank all favorites
    $db->query("UPDATE `" . DTP . "tweets` SET `favorite` = '0'");
    // Insert favorites into DB
    $db->query("UPDATE `" . DTP . "tweets` SET `favorite` = '1' WHERE `tweetid` IN ('" . implode("', '", $favs) . "')");
    echo l(good("Updated favorites!"));
}
Example #27
0
<?php 
echo _('NOTE: In some browsers you must select the file in the file-upload dialog and click "OK".  Double-clicking doesn\'t register the file.');
?>
</span>
</span><br />
<?php 
echo _('Upload a new file');
?>
: <input type="file" name="userfile"  size="30" />
<?php 
if ($sys_use_ftpuploads) {
    echo '<p>';
    printf(_('Alternatively, you can use FTP to upload a new file at %1$s'), $sys_ftp_upload_host) . '<br />';
    echo _('Choose an FTP file instead of uploading:') . '<br />';
    $arr[] = '';
    $ftp_files_arr = array_merge($arr, ls($upload_dir, true));
    echo html_build_select_box_from_arrays($ftp_files_arr, $ftp_files_arr, 'ftp_filename', '', false);
    ?>
	</p>
<?php 
}
?>
<table width="60%">
<tr>
<td>
<h4><?php 
echo _('File Type');
?>
:</h4>
<?php 
print frs_show_filetype_popup('type_id');
    }
    if (init('action') == 'getAllPossibleConf') {
        $eqLogic = openzwave::byId(init('id'));
        if (!is_object($eqLogic)) {
            ajax::success();
        }
        ajax::success($eqLogic->getConfFilePath(true));
    }
    if (init('action') == 'getConfiguration') {
        if (init('translation') == 1 && config::byKey('language', 'core', 'fr_FR') != 'fr_FR') {
            ajax::success();
        }
        $id = init('manufacturer_id') . '.' . init('product_type') . '.' . init('product_id');
        $files = ls(dirname(__FILE__) . '/../config/devices', $id . '_*.json', false, array('files', 'quiet'));
        foreach (ls(dirname(__FILE__) . '/../config/devices', '*', false, array('folders', 'quiet')) as $folder) {
            foreach (ls(dirname(__FILE__) . '/../config/devices/' . $folder, $id . '_*.json', false, array('files', 'quiet')) as $file) {
                $files[] = $folder . $file;
            }
        }
        if (count($files) > 0) {
            $content = file_get_contents(dirname(__FILE__) . '/../config/devices/' . $files[0]);
            if (!is_json($content)) {
                ajax::success();
            }
            ajax::success(json_decode($content, true));
        }
        ajax::success();
    }
    throw new Exception('Aucune methode correspondante');
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
Example #29
0
 public static function availableWidget($_version)
 {
     $path = dirname(__FILE__) . '/../template/' . $_version;
     $files = ls($path, 'cmd.*', false, array('files', 'quiet'));
     $return = array();
     foreach ($files as $file) {
         $informations = explode('.', $file);
         if (!isset($return[$informations[1]])) {
             $return[$informations[1]] = array();
         }
         if (!isset($return[$informations[1]][$informations[2]])) {
             $return[$informations[1]][$informations[2]] = array();
         }
         if (isset($informations[3])) {
             $return[$informations[1]][$informations[2]][] = array('name' => $informations[3]);
         }
     }
     foreach (plugin::listPlugin(true) as $plugin) {
         $path = dirname(__FILE__) . '/../../plugins/' . $plugin->getId() . '/core/template/' . $_version;
         $files = ls($path, 'cmd.*', false, array('files', 'quiet'));
         foreach ($files as $file) {
             $informations = explode('.', $file);
             if (count($informations) > 3) {
                 if (!isset($return[$informations[1]])) {
                     $return[$informations[1]] = array();
                 }
                 if (!isset($return[$informations[1]][$informations[2]])) {
                     $return[$informations[1]][$informations[2]] = array();
                 }
                 $return[$informations[1]][$informations[2]][] = array('name' => $informations[3]);
             }
         }
     }
     return $return;
 }
Example #30
0
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<title>Unveil, a simple filesystem browser and security testing tool</title>
</head>
<body>
<p>Powered by <a href="https://github.com/shiflett/unveil">Unveil</a>, a simple filesystem browser and security testing tool by <a href="http://shiflett.org/">Chris Shiflett</a>.</p>
<hr />
<pre>
<?php 
if (isset($_GET['dir'])) {
    ls($_GET['dir']);
} elseif (isset($_GET['file'])) {
    cat($_GET['file']);
} else {
    ls('/');
}
?>
</pre>
<hr />
<pre>
<?php 
$safe = ini_get('safe_mode');
?>
[<code>safe_mode</code>] [<code><?php 
echo $safe;
?>
</code>]
<?php 
$base = ini_get('open_basedir');
?>