/**
  * CP Utilities
  * @return void
  **/
 function display($tpl = null)
 {
     $task = JRequest::getCmd('task');
     switch ($task) {
         case 'checkdirs':
             $this->assignRef('dirs', getDirs());
             break;
         case 'showce':
             $this->assignRef('available_content_elements', getAvailableContentElements());
             $this->assignRef('installed_content_elements', getInstalledContentElements(true));
             break;
         default:
             break;
     }
     parent::display($tpl);
 }
Beispiel #2
0
 function __construct($name)
 {
     $runningFolder = explode('/', $_SERVER['DOCUMENT_ROOT']);
     $runningFolder = array_pop($runningFolder);
     if (!$runningFolder) {
         $runningFolder = 'acp';
     }
     $this->name = $name;
     $this->path = realpath(__DIR__ . "/../{$runningFolder}/themes/{$name}");
     $manifestFilePath = $this->path . "/manifest.json";
     if (file_exists($manifestFilePath)) {
         $configJson = file_get_contents($this->path . "/manifest.json");
         if (strlen($configJson)) {
             $tempThemeData = json_decode($configJson);
             if (!json_last_error()) {
                 $this->data = $tempThemeData;
             }
         }
     } else {
         $this->data = false;
     }
     $files = getDirs($this->path);
     $allFiles = $files;
     if ($this->data) {
         $parentFiles = getDirs($this->path . "/../" . $this->data->parentTheme);
         $allFiles = array_merge($files, $parentFiles);
         sort($allFiles);
     }
     $this->css = array_filter($allFiles, function ($filename) {
         return substr($filename, -3, 3) === 'css';
     });
     $this->css = array_values($this->css);
     $this->css = array_unique($this->css);
     for ($i = 0; $i < count($this->css); $i++) {
         if (file_exists($this->path . "/" . $this->css[$i])) {
             $this->css[$i] = 'themes/' . $this->name . "/" . $this->css[$i];
         } else {
             if ($this->data) {
                 $this->css[$i] = 'themes/' . $this->data->parentTheme . "/" . $this->css[$i];
             }
         }
     }
 }
function getDirs($directory, $exempt = array('.', '..', '.ds_store', '.svn'), &$files = array())
{
    //没有则创建
    if (is_dir($directory) && !opendir($directory)) {
        mkdir($directory, 0777, TRUE);
    }
    $handle = opendir($directory);
    while (false !== ($resource = readdir($handle))) {
        if (!in_array(strtolower($resource), $exempt)) {
            //排除目录
            if (is_dir($directory . $resource . '/')) {
                array_merge($files, getDirs($directory . $resource . '/', $exempt, $files));
            } else {
                //if(!is_file($directory.'/'.$resource))
                //{
                $files[] = $directory . '/' . $resource;
                //}
            }
        }
    }
    closedir($handle);
    return $files;
}
Beispiel #4
0
function getDirs($root, $dir, $exclusions, $checkChildsOnly = false)
{
    // si checkChildsOnly = true la fonction regarde uniquement s'il exist au moins 1 sous répertore
    if ($checkChildsOnly === true) {
        $result = false;
    } else {
        $result = array();
    }
    if (is_dir($root . $dir)) {
        $dirContents = scandir($root . $dir);
        if (count($dirContents) > 2) {
            natsort($dirContents);
            // natcasesort($dirContents);
            foreach ($dirContents as $dirEntry) {
                $dirEntryFullPath = $root . $dir . $dirEntry;
                if (substr($dirEntry, 0, 1) != "." && is_dir($dirEntryFullPath) && !in_array($dirEntryFullPath, $exclusions)) {
                    if ($checkChildsOnly) {
                        return true;
                    } else {
                        $node = array();
                        $node['id'] = $dirEntryFullPath . "/";
                        $node['text'] = $dirEntry;
                        if (getDirs($root, $node['id'], $exclusions, true) === true) {
                            $node['state'] = 'closed';
                        } else {
                            $node['state'] = 'open';
                            $node['iconCls'] = 'icon-rep';
                        }
                        array_push($result, $node);
                    }
                }
            }
        }
    }
    return $result;
}






<div id="dirList">
	<ul id="info">
	  <li>
		<span id="file">name</span><span class="extension">extension</span><span class="filemtime">last modified</span><span class="mode">mode</span><span class="fs">size</span><span id="fileop">file operations</span>
	  </li>
	</ul>

	<ul><?php 
getDirs($path);
?>
	</ul>
	<ul><?php 
getFiles($path);
?>
</ul>
</div>

<div id="add" class="b">
  <a href="#" title="Create File" onclick="fOp.create('file', '<?php 
echo $pathURL;
?>
'); return false;">Create File:<img src="<?php 
echo $_R['images/addfile.gif'];
?>
Beispiel #6
0
         $t = str_replace('{TEXT}', mysqlErrorEx(), THEME_STRING_ERROR);
     }
     $item = $i % 2 ? THEME_LIST_ITEM_LTEXT_U2 : THEME_LIST_ITEM_LTEXT_U1;
     $data .= THEME_LIST_ROW_BEGIN . str_replace(array('{WIDTH}', '{TEXT}'), array('auto', htmlEntitiesEx($table)), $item) . str_replace(array('{WIDTH}', '{TEXT}'), array('auto', $t), $item) . THEME_LIST_ROW_END;
     $i++;
 }
 //Удаление файлов.
 $root = getDirs($config['reports_path']);
 if ($root !== false) {
     foreach ($root as $rdir) {
         $rdir = $config['reports_path'] . '/' . $rdir;
         $botnets = getDirs($rdir);
         if ($botnets !== false) {
             foreach ($botnets as $botnet) {
                 $botnet = $rdir . '/' . $botnet;
                 $bots = getDirs($botnet);
                 if ($bots !== false) {
                     foreach ($bots as $bot) {
                         $botLower = mb_strtolower(urldecode($bot));
                         $bot = $botnet . '/' . $bot;
                         foreach ($blist as $l) {
                             if (strcmp($botLower, mb_strtolower($l)) === 0) {
                                 if (clearPath($bot)) {
                                     $t = str_replace('{TEXT}', LNG_BA_REMOVE_FREMOVED, THEME_STRING_SUCCESS);
                                 } else {
                                     $t = str_replace('{TEXT}', LNG_BA_REMOVE_FERROR, THEME_STRING_ERROR);
                                 }
                                 $item = $i % 2 ? THEME_LIST_ITEM_LTEXT_U2 : THEME_LIST_ITEM_LTEXT_U1;
                                 $data .= THEME_LIST_ROW_BEGIN . str_replace(array('{WIDTH}', '{TEXT}'), array('auto', htmlEntitiesEx($bot)), $item) . str_replace(array('{WIDTH}', '{TEXT}'), array('auto', $t), $item) . THEME_LIST_ROW_END;
                                 $i++;
                             }
Beispiel #7
0
    }
}
if ($user->isValid()) {
    $_SESSION['id'] = $user->getId();
}
session_write_close();
/* languages */
$checkFn = function ($el) {
    $target = 'locale';
    $domain = 'ucp';
    if (file_exists("../{$target}/{$el}/LC_MESSAGES/{$domain}.mo") || file_exists("../{$target}/{$el}/LC_MESSAGES/{$domain}.po")) {
        return true;
    }
};
$target = 'locale';
$languages = getDirs("../{$target}", $checkFn);
$params = $_GET;
for ($i = 0; $i < count($languages); $i++) {
    $language = $languages[$i];
    $params['lang'] = $language;
    $href = '?' . http_build_query($params);
    $icon = "themes/default/flags/" . strtolower(substr($language, 3)) . ".png";
    $languages[$i] = array($language, $href, $icon);
}
/* Generate menu */
$menu = array();
$menu['index.php'] = array(__('Home'), 0);
if ($user->isValid()) {
    $menu['info.php'] = array(__('My info'), 0);
    if ($user->isEnabled()) {
        if (configgetvalue('system', 'ucp', NULL, 'showMoneyflow')) {
<?php

function getDirs($path)
{
    $directories = glob($path . '*/*', GLOB_ONLYDIR);
    $folders = $return = array();
    foreach ($directories as $directory) {
        $folders[] = basename($directory);
        $files = glob($directory . '/*.php');
        foreach ($files as $file) {
            $return[] = array('checksum' => md5(file_get_contents($file)), 'path' => str_replace('/home/necoyoad/Escritorio/www/myapps/necotienda_standalone/', '', $file), 'version' => (int) $version);
        }
    }
    return $return;
}
$path = '/home/necoyoad/Escritorio/www/myapps/necotienda_standalone/app/shop/';
$link = fopen(__DIR__ . '/shop_map.php', 'w+');
fwrite($link, "<?php\n" . '$map = ' . var_export(getDirs($path), true) . ";");
fclose($link);
Beispiel #9
0
function GetAllDirs($path, &$ci)
{
    $r = getDirs($path);
    if ($r === false) {
        echo ListElement($ci, 0, str_replace('{TEXT}', sprintf(LNG_REPORTS_RESULT_SEDIR, htmlEntitiesEx($path)), THEME_STRING_ERROR), -1, 0);
        $r = array();
    }
    return $r;
}
Beispiel #10
0
function onConfigEdit($configPath, $value, $oldValue)
{
    if ($configPath === '0/0/ucp/documents') {
        $documents = json_decode($value, true);
        $existingFiles = array();
        for ($i = 0; $i < count($documents); $i++) {
            $existingFiles[] = $documents[$i]['fileName'];
        }
        $files = getDirs(UPLOADED_FILES_PATH);
        for ($i = 0; $i < count($files); $i++) {
            if (array_search($files[$i], $existingFiles) === false) {
                unlink(UPLOADED_FILES_PATH . $files[$i]);
            }
        }
    }
    if ($configPath === '0/0/tariff/nightHourEnd') {
        $routersTable = new table('router');
        $rows = $routersTable->load();
        foreach ($rows as $row) {
            controllerRouter($row['id'], 'export', false);
        }
    }
    /*
      if ($configPath==='0/0/cash/withdrawalDay')
      {
        global $db, $mysqlTimeDateFormat;
        $newDay=intval($value);
        $oldDay=intval($oldValue);
    
        $currentDate=new DateTime;
    
        $newDate=new DateTime;
        $newDate->setTime(0, 0);
        $newDate->setDate($newDate->format('Y'), $newDate->format('m'), $newDay);
        var_dump($newDate);
    
        $oldDate=new DateTime;
        $oldDate->setTime(0, 0);
        $oldDate->setDate($oldDate->format('Y'), $oldDate->format('m'), $oldDay);
        var_dump($oldDate);
        
        // Create withdrawal date
        $withdrawalDay=configgetvalue('system', 'cash', NULL, 'withdrawalDay');
        $withdrawalDate=new DateTime('first day of this month midnight');
        $withdrawalDate->modify((intval($withdrawalDay)-1).' day');
    
        if ($currentDate >= $withdrawalDate)
        {
          $newDate->modify('1 month');
          $oldDate->modify('1 month');
        }
        $request= "UPDATE `order` SET `enddate`='{$newDate->format($mysqlTimeDateFormat)}' WHERE `enddate`='{$oldDate->format($mysqlTimeDateFormat)}'";
        d($request);
        $db->query( $request );
      }*/
}
Beispiel #11
0
function getSubDirs($basedir, $currentdir)
{
    $alldirs = getDirs($basedir);
    if ($alldirs) {
        for ($i = 0; $i < sizeof($alldirs); $i++) {
            if ($alldirs[$i] != $currentdir) {
                $retstr .= "<option value='" . $alldirs[$i] . "'>" . $alldirs[$i];
            }
        }
    }
    if ($retstr) {
        if ($currentdir != $basedir) {
            $base = "<option value='{$basedir}'>" . $basedir;
        }
        $retstr = "<option value=''>None selected" . $base . $retstr;
    } else {
        $retstr = "<option value=''>No subdirs";
    }
    return $retstr . "</option>";
}
function getDirs($dir)
{
    $dirfiles1 = scandir($dir);
    //Add files and details to new array
    foreach ($dirfiles1 as $dirfile) {
        if ($dirfile != '.' && $dirfile != '..') {
            $dir1 = explode('./', $dir);
            if ($dir1[1] != null) {
                $dir1 = $dir1[1] . '/';
            } else {
                $dir1 = '';
            }
            if (is_dir($dir . '/' . $dirfile)) {
                foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir1 . $dirfile)) as $file) {
                    $filesize += $file->getSize();
                }
            } else {
                $filesize = filesize($dir1 . $dirfile);
            }
            $filesize = round($filesize, 2);
            $filedate = date('Y-m-d H:i:s', filectime($dir1 . $dirfile));
            array_push($GLOBALS['dirfiles'], array($dirfile, $dir, $filesize, $filedate));
            if (is_dir($dir . '/' . $dirfile)) {
                getDirs($dir . '/' . $dirfile);
            }
        }
    }
}
    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        $this->generator->setOptions($this->option());
        $langPath = $this->getPath();
        $scaffold = $this->option('lang');
        if (!$scaffold) {
            $template = $this->option('template');
            $locales = getDirs($langPath, true);
            foreach ($locales as $locale) {
                if ($locale === 'en/') {
                    $path = $this->getPath($locale);
                    $this->printResult($this->generator->make($path, $template, $finalPath), $path, $finalPath);
                }
            }
        } else {
            // add whatever else is specified in the template/lang to appropriate groups
            $langTemplatePath = $scaffold;
            if ($langTemplatePath) {
                $files = getFiles($langTemplatePath, "*.txt", false);
                $config = \Config::get(GeneratorsServiceProvider::PACKAGE, null);
                foreach ($files as $file) {
                    // here we have group.php to map to lang/en/group.php
                    // and create all the lines in the group
                    $group = basename($file, ".txt");
                    $langTemplate = file_get_contents($langTemplatePath . "/" . $file);
                    $locales = getDirs($langPath, true);
                    foreach ($locales as $locale) {
                        if ($locale === 'en/') {
                            // get the file we are to add to
                            $path = $this->getLangFile($group, $locale);
                            $configRewriter = new TranslationFileRewriter();
                            $exportOptions = array_key_exists('export_format', $config) ? TranslationFileRewriter::optionFlags($config['export_format']) : null;
                            $translationModsText = $this->generator->getLangTemplate($langTemplate);
                            $translationMods = <<<PHP
return array(
{$translationModsText}
);
PHP;
                            try {
                                $newTranslations = eval($translationMods);
                                if ($newTranslations) {
                                    $translations = file_exists($path) ? require $path : [];
                                    $overwrite = $this->option('overwrite');
                                    $needUpdate = merge_translations($translations, $newTranslations, $overwrite);
                                    if ($needUpdate) {
                                        $configRewriter->parseSource(file_exists($path) ? file_get_contents($path) : '');
                                        $output = $configRewriter->formatForExport($translations, $exportOptions);
                                        if (file_put_contents($path, $output) !== false) {
                                            $this->info("Updated translations from template/lang/{$file} in {$path}");
                                        } else {
                                            $this->error("Failed to update translations from template/lang/{$file} in {$path}");
                                        }
                                    } else {
                                        $this->info("Did not need to update changes from template/lang/{$file} in {$path}");
                                    }
                                } else {
                                    $this->error("failed to evaluate changes from template/lang/{$file} for {$path}");
                                }
                            } catch (FatalErrorException $e) {
                                $this->error("failed to evaluate changes from template/lang/{$file}, exception " . $e->getMessage());
                            }
                        }
                    }
                }
            }
        }
    }
Beispiel #14
0
    $xml = new SimpleXMLExtended('<item></item>');
    $note = $xml->addChild('SITENAME');
    $note->addCData($SITENAME);
    $note = $xml->addChild('SITEURL');
    $note->addCData($SITEURL);
    $note = $xml->addChild('TEMPLATE');
    $note->addCData($newTemplate);
    $xml->addChild('PRETTYURLS', $PRETTYURLS);
    $xml->addChild('PERMALINK', $PERMALINK);
    XMLsave($xml, GSDATAOTHERPATH . GSWEBSITEFILE);
    $success = i18n_r('THEME_CHANGED');
    $TEMPLATE = $newTemplate;
    // set new global
}
# get available themes, using folder match required contain template.php
$themes = getDirs(GSTHEMESPATH, GSTEMPLATEFILE);
$theme_options = '';
foreach ($themes as $theme) {
    $sel = $TEMPLATE == $theme ? 'selected' : '';
    $themename = $TEMPLATE == $theme ? $theme . ' (' . i18n_r('ACTIVE') . ')' : $theme;
    $theme_options .= '<option ' . $sel . ' value="' . $theme . '" >' . $themename . '</option>';
}
$pagetitle = i18n_r('THEME_MANAGEMENT');
get_template('header');
?>
	
<?php 
include 'template/include-nav.php';
?>

<div class="bodycontent clearfix">