function get_files($directory)
{
    // Try to open the directory
    if ($dir = opendir($directory)) {
        // Create an array for all files found
        $tmp = array();
        // Add the files
        while ($file = readdir($dir)) {
            // Make sure the file exists
            if ($file != "." && $file != ".." && $file[0] != '.') {
                // If it's a directiry, list all files within it
                if (is_dir($directory . "/" . $file)) {
                    $tmp2 = get_files($directory . "/" . $file);
                    if (is_array($tmp2)) {
                        $tmp = array_merge($tmp, $tmp2);
                    }
                } else {
                    if (is_readable($directory . "/" . $file)) {
                        $filename = basename(stripslashes($file));
                        $pi = pathinfo($file);
                        if (is_allowed_extension($pi["extension"])) {
                            array_push($tmp, $directory . "/" . $file);
                        }
                    }
                }
            }
        }
        // Finish off the function
        closedir($dir);
        return $tmp;
    }
}
 /**
  * Return array of translation files
  *
  * @param void
  * @return array
  */
 function getTranslationFiles()
 {
     if ($this->translation_files === false) {
         $this->translation_files = array();
         $localization_path = $this->getLocalizationPath();
         $localization_path_len = strlen($localization_path);
         $files = get_files($localization_path, 'php');
         if (is_foreachable($files)) {
             foreach ($files as $path) {
                 $file = substr($path, $localization_path_len + 1);
                 if (!str_starts_with($file, 'module.')) {
                     continue;
                 }
                 // if
                 $this->translation_files[] = substr($file, 7, strlen($file) - 11);
             }
             // foreach
         }
         // if
         if (count($this->translation_files) < 1) {
             $this->translation_files = null;
         }
         // if
     }
     // if
     return $this->translation_files;
 }
Example #3
0
    function index()
    {
        $domains = get_domains();
        header('Content-type: text/xml');
        echo '<?xml version="1.0" encoding="UTF-8"?>';
        ?>
		<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc><?php 
        echo site_url();
        ?>
</loc><priority>1</priority></url><?php 
        //foreach domain
        foreach ($domains as $domain) {
            //if not a separator
            if ($domain['type'] != 'separator') {
                //get files
                $files = get_files($domain['webname']);
                foreach ($files as $file) {
                    //get rid off extension
                    $file = str_replace("." . $domain['type'], "", $file);
                    //extract segments
                    $date = extract_feed_date($file, $domain['webname']);
                    //make url
                    $url = site_url($domain['webname'] . '/' . $date['y'] . '/' . $date['m'] . '/' . $date['d']);
                    //display URL tag
                    echo '<url><loc>' . $url . '</loc></url>';
                }
            }
        }
        echo "</urlset>";
    }
Example #4
0
File: motm.php Project: nopuls/dzcp
function motm()
{
    global $db, $allowHover;
    $userpics = get_files(basePath . '/inc/images/uploads/userpics/');
    $qry = db("SELECT * FROM " . $db['users'] . " WHERE level >= 2");
    while ($rs = _fetch($qry)) {
        foreach ($userpics as $userpic) {
            $tmpId = intval($userpic);
            if ($tmpId == $rs['id']) {
                $temparr[] = $rs['id'];
                $a++;
                break;
            }
        }
    }
    $arrayID = rand(0, count($temparr) - 1);
    $uid = $temparr[$arrayID];
    $get = _fetch(db("SELECT * FROM " . $db['users'] . " WHERE id = '" . $uid . "'"));
    if (!empty($get) && !empty($temparr)) {
        $status = $get['status'] == 1 || $get['level'] == 1 ? _aktiv : _inaktiv;
        if ($allowHover == 1) {
            $info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . rawautor($get['id']) . '</td></tr><tr><td width=80px><b>' . _posi . ':</b></td><td>' . getrank($get['id']) . '</td></tr><tr><td><b>' . _status . ':</b></td><td>' . $status . '</td></tr><tr><td><b>' . _age . ':</b></td><td>' . getAge($get['bday']) . '</td></tr><tr><td colspan=2 align=center>' . jsconvert(userpic($get['id'])) . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
        }
        $member = show("menu/motm", array("uid" => $get['id'], "upic" => userpic($get['id'], 130, 161), "info" => $info));
    } else {
        $member = '';
    }
    return empty($member) ? '' : '<table class="navContent" cellspacing="0">' . $member . '</table>';
}
 public function down()
 {
     $filenames = get_files(Config::get('log_dir'));
     foreach ($filenames as $filename) {
         unlink($filename);
     }
     rmdir(Config::get('log_dir'));
 }
Example #6
0
 public function execute()
 {
     global $CFG, $DB;
     $options = $this->expandedOptions;
     $dataroot = run_external_command("du -s {$CFG->dataroot}", "Couldn't find dataroot directory");
     $pattern = '/\\d*/';
     preg_match($pattern, $dataroot[0], $matches);
     $filedir = run_external_command("du -s {$CFG->dataroot}/filedir", "Couldn't find filedir directory");
     preg_match($pattern, $filedir[0], $dir_matches);
     $sql_query = "SELECT SUM(filesize) AS total FROM {files}";
     $all_files = $DB->get_record_sql($sql_query);
     $sql_query = "SELECT DISTINCT contenthash, SUM(filesize) AS total FROM {files}";
     if (is_a($DB, 'pgsql_native_moodle_database')) {
         $sql_query .= " GROUP BY contenthash";
         $distinct_contenthash = $DB->get_records_sql($sql_query);
         $total = 0;
         foreach ($distinct_contenthash as $k => $v) {
             $total += $v->total;
         }
         $distinctfilestotal = $total;
     } else {
         $distinct_contenthash = $DB->get_record_sql($sql_query);
         $distinctfilestotal = $distinct_contenthash->total;
     }
     $filesbycourse = array();
     if ($courses = get_all_courses()) {
         foreach ($courses as $course) {
             $subcontexts = get_sub_context_ids($course->ctxpath);
             $filesbycourse[$course->id] = array('unique' => 0, 'all' => 0);
             foreach ($subcontexts as $subcontext) {
                 if ($files = get_files($subcontext->id)) {
                     foreach ($files as $file) {
                         $filesbycourse[$course->id]['unique'] += file_is_unique($file->contenthash, $subcontext->id) ? $file->filesize : 0;
                         $filesbycourse[$course->id]['all'] += $file->filesize;
                     }
                 }
             }
         }
     }
     $sortarray = higher_size($filesbycourse);
     $backups = backup_size();
     $data = array('dataroot' => $matches[0], 'filedir' => $dir_matches[0], 'files total' => $all_files->total, 'distinct files total' => $distinctfilestotal);
     foreach ($sortarray as $courseid => $values) {
         $data["Course {$courseid} files total"] = strval($values['all']);
         $data["Course {$courseid} files unique"] = strval($values['unique']);
     }
     foreach ($backups as $key => $values) {
         $data["Backup {$values->username}"] = strval($values->backupsize);
     }
     if ($options['json']) {
         echo json_encode($data);
     } else {
         foreach ($data as $k => $v) {
             echo "{$k}: " . display_size($v) . "\n";
         }
     }
 }
Example #7
0
 /**
  * test getting a list of all of a certain file from a directory
  */
 public function testScandir()
 {
     $files = get_files(SITE_ROOT . 'htdoc/css/', 'css', true);
     // assert we have files back
     $this->assertArrayCountGreaterThanOrEqual($files, 1);
     // assert each file is a file and exists
     foreach ($files as $file) {
         $this->assertTrue(is_file($file));
     }
 }
Example #8
0
function find_removed_files($newPath, $oldPath)
{
    $ret = array();
    $newFiles = get_files($newPath);
    $oldFiles = get_files($oldPath);
    foreach ($oldFiles as $of) {
        if (!in_array($of, $newFiles)) {
            $ret[] = $of;
        }
    }
    return $ret;
}
Example #9
0
function rrdclean_fill_table()
{
    global $config, $rra_path;
    /* suppress warnings */
    error_reporting(0);
    /* install the rrdclean error handler */
    set_error_handler('rrdclean_error_handler');
    /* delete old file names table */
    rrdclean_truncate_tables();
    get_files();
    clearstatcache();
    /* restore original error handler */
    restore_error_handler();
}
Example #10
0
 /**
  * used in dev and to generate the final css, this scans a directory and created one css file
  *
  * @return void
  * @author Craig Ulliott
  */
 public function generate()
 {
     $files = get_files(SITE_ROOT . 'htdoc/css/', 'css');
     // we arrange our files alphabetically to determine the order css is generated
     sort($files);
     // we bring all the css in and parse it as php, so output buffering is the best means to capture the output
     ob_start();
     foreach ($files as $css_file) {
         // get and parse stylesheet
         include $css_file;
     }
     $css = ob_get_contents();
     //clean up
     ob_end_clean();
     v('content/text/css', $css);
 }
Example #11
0
function random_gallery()
{
    global $db;
    $imgArr = array();
    $files = get_files('../gallery/images/');
    $get = _fetch(db("SELECT * FROM " . $db['gallery'] . " ORDER BY RAND()"));
    foreach ($files as $file) {
        if (intval($file) == $get['id']) {
            array_push($imgArr, $file);
        }
    }
    shuffle($imgArr);
    if (!empty($imgArr[0])) {
        $gallery = show("menu/random_gallery", array("image" => $imgArr[0], "id" => $get['id'], "kat" => re($get['kat'])));
    }
    return empty($gallery) ? '' : '<table class="navContent" cellspacing="0">' . $gallery . '</table>';
}
Example #12
0
 /**
  * Retrieve all files in a specified directory
  * @param <string> $folder Directory path to search for files
  * @param <boolean> $includeSubs (optional) TRUE if sub directories should be included
  * @return <array> List of files retrieved
  * @category Files
  * <code>
  *  $result = Files::getFiles('C:/xampp/', TRUE);
  * </code>
  */
 function getFiles($folder, $includeSubs = FALSE)
 {
     try {
         // Remove any trailing slash
         if (substr($folder, -1) == '/') {
             $folder = substr($folder, 0, -1);
         }
         // Make sure a valid folder was passed
         if (!file_exists($folder) || !is_dir($folder) || !is_readable($folder)) {
             return FALSE;
             exit;
         }
         // Grab a file handle
         $allFiles = FALSE;
         if ($handle = opendir($folder)) {
             $allFiles = array();
             // Start looping through a folder contents
             while ($file = @readdir($handle)) {
                 // Set the full path
                 $path = $folder . '/' . $file;
                 // Filter out this and parent folder
                 if ($file != '.' && $file != '..') {
                     // Test for a file or a folder
                     if (is_file($path)) {
                         $allFiles[] = $path;
                     } elseif (is_dir($path) && $includeSubs) {
                         // Get the subfolder files
                         $subfolderFiles = get_files($path, TRUE);
                         // Anything returned
                         if ($subfolderFiles) {
                             $allFiles = array_merge($allFiles, $subfolderFiles);
                         }
                     }
                 }
             }
             // Cleanup
             closedir($handle);
         }
         // Return the file array
         @sort($allFiles);
         return $allFiles;
     } catch (Exception $err) {
         return $err->getMessage();
     }
 }
Example #13
0
 function _get_previous_feed($domains, $webname, $date)
 {
     //get files of this site
     $files = get_files($webname);
     $result = false;
     if ($files) {
         $count = count($files) - 1;
         //count -1 because last file because it doesnt has a previous file
         //files loop
         for ($i = 0; $i < $count; $i++) {
             if ($files[$i] == $webname . $date['y'] . $date['m'] . $date['d'] . "." . $domains[$webname]['type']) {
                 $result = $files[$i + 1];
                 //get the previous
             }
         }
         return $result;
     }
 }
Example #14
0
function repo_update()
{
    if (!is_dir('pool')) {
        mkdir('pool', 0777);
    }
    $files = get_files('pool_old');
    $i = 0;
    foreach ($files as $file) {
        copy_to_pool($file);
        apk_icon($file);
        $i++;
    }
    echo "{$i}: Aplicaiones Agregadas\n";
    //update_from_pool();
    //if (!isset($params['dir']) && $params['update']) {
    //    update_from_pool();
    //}
}
Example #15
0
 function sync_globals()
 {
     $this->EE->load->helper('devkit_helper');
     $vars = array();
     $vars['performed'] = array();
     if ($this->EE->config->item('save_tmpl_files') == 'y') {
         $tmpl_basepath = $this->EE->config->slash_item('tmpl_file_basepath') . $this->EE->config->slash_item('site_short_name');
         if ($tmpl_basepath != $this->EE->config->slash_item('site_short_name') && file_exists($tmpl_basepath)) {
             $global_variables = get_files($tmpl_basepath . 'global_variables/');
             $snippets = get_files($tmpl_basepath . 'snippets/');
             foreach ($global_variables as $global_variable_filename) {
                 $this->EE->db->where('variable_name', $global_variable_filename);
                 $this->EE->db->from('global_variables');
                 $global_variable_data = file_get_contents($tmpl_basepath . 'global_variables/' . $global_variable_filename);
                 if ($this->EE->db->count_all_results() == 0) {
                     $this->EE->db->insert('global_variables', array('variable_name' => $global_variable_filename, 'variable_data' => $global_variable_data));
                     $vars['performed'][] = 'Inserted <strong>global_variable</strong> <em>' . $global_variable_filename . "</em>";
                 } else {
                     $this->EE->db->where('variable_name', $global_variable_filename);
                     $this->EE->db->update('global_variables', array('variable_data' => $global_variable_data));
                     $vars['performed'][] = 'Updated <strong>global_variable</strong> <em>' . $global_variable_filename . "</em>";
                 }
             }
             foreach ($snippets as $snippet_filename) {
                 $this->EE->db->like('snippet_name', $snippet_filename);
                 $this->EE->db->from('snippets');
                 $snippet_data = file_get_contents($tmpl_basepath . 'snippets/' . $snippet_filename);
                 if ($this->EE->db->count_all_results() == 0) {
                     $this->EE->db->insert('snippets', array('snippet_name' => $snippet_filename, 'snippet_contents' => $snippet_data));
                     $vars['performed'][] = 'Inserted <strong>snippet</strong> <em>' . $snippet_filename . "</em>";
                 } else {
                     $this->EE->db->where('snippet_name', $snippet_filename);
                     $this->EE->db->update('snippets', array('snippet_contents' => $snippet_data));
                     $vars['performed'][] = 'Updated <strong>snippet</strong> <em>' . $snippet_filename . "</em>";
                 }
             }
         } else {
             show_error('Template basepath not defined - or not found (' . $tmpl_basepath . ')');
         }
     } else {
         show_error('Save templates as files must be set to Yes in Global Template Preferences');
     }
     return $this->content_wrapper('sync', 'dev_sync_globals', $vars);
 }
Example #16
0
/**
 * this is used in dev and by the production push scripts to list out and subsequently 
 * build things like css and js files
 *
 * @param string $base_path 
 * @param string $extension 
 * @param bool $recursive 
 * @param bool $relative_paths 
 * @return array
 * @author Craig Ulliott
 */
function get_files($base_path, $extension, $recursive = true, $relative_paths = false)
{
    // to hold the files we find
    $return = array();
    // scan the folder and look for files with this extension
    if ($files = scandir($base_path)) {
        // for each file we find
        foreach ($files as $file_name) {
            // we skip these
            if ($file_name == '.' || $file_name == '..') {
                continue;
            }
            $file = $base_path . $file_name;
            // if we found a directory, then look inside it
            if (is_dir($file) && $recursive) {
                $dir = $file . '/';
                // recursively call this method on the folder
                foreach (get_files($dir, $extension, $recursive) as $from_child) {
                    $return[] = $from_child;
                }
            }
            // if this is a file and if the extensions the same (case insensitive comparison)
            // we also add the period to be extra sure we are catching a full file extension
            if (is_file($file) && strcasecmp(substr($file, -strlen('.' . $extension)), '.' . $extension) == 0) {
                $return[] = $file;
            }
        }
    }
    // for relative paths we strip the begining of the string off here
    // this is never done when called recursively
    if ($relative_paths) {
        // the number of paths we will loop through
        $path_count = count($return);
        // the position in the string we will strip to
        $start_position = strlen($base_path);
        // strip each one
        for ($i = 0; $i < $path_count; $i++) {
            $return[$i] = substr($return[$i], $start_position);
        }
    }
    return $return;
}
Example #17
0
File: uotm.php Project: nopuls/dzcp
function uotm()
{
    global $db, $allowHover;
    $imgFiles = array();
    $folder = get_files('../inc/images/uploads/userpics');
    foreach ($folder as $file) {
        array_push($imgFiles, $file);
    }
    if (count($imgFiles) != 0) {
        $userid = intval($imgFiles[rand(0, count($imgFiles) - 1)]);
        $get = _fetch(db("SELECT id,nick,country,bday FROM " . $db['users'] . " WHERE id = '" . $userid . "'"));
        if (!empty($get)) {
            if ($allowHover == 1) {
                $info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . rawautor($get['id']) . '</td></tr><tr><td width=50%><b>' . _age . ':</b></td><td>' . getAge($get['bday']) . '</td></tr><tr><td colspan=2 align=center>' . jsconvert(userpic($get['id'])) . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
            }
            $uotm = show("menu/uotm", array("uid" => $userid, "upic" => userpic($get['id'], 130, 161), "info" => $info));
        }
    }
    return empty($uotm) ? '' : '<table class="navContent" cellspacing="0">' . $uotm . '</table>';
}
Example #18
0
function get_no_signed_files()
{
    require_once 'utils.php';
    $no_signed_files = array();
    $config = parse_ini_file("everything.ini");
    $path = $config['sf_dir'];
    $files = get_files();
    if (is_array($files)) {
        foreach ($files as $k => $v) {
            $file = basename($v);
            $name = explode(".", $file);
            $name[count($name) - 1] = "sig";
            $sig_file = implode(".", $name);
            if (!file_exists($path . $sig_file)) {
                $no_signed_files[$file] = $sig_file;
            }
        }
    }
    return $no_signed_files;
}
Example #19
0
function rrdclean_fill_table()
{
    global $config, $rra_path;
    /* suppress warnings */
    error_reporting(0);
    /* install the rrdclean error handler */
    set_error_handler("rrdclean_error_handler");
    /* delete old file names table */
    rrdclean_delete_table();
    /* create new file names table */
    rrdclean_create_table();
    $files_unused = get_files();
    $i = 0;
    if (sizeof($files_unused) > 0) {
        foreach ($files_unused as $unused_file) {
            $filesize = filesize($rra_path . "/" . $unused_file);
            $filemtime = filemtime($rra_path . "/" . $unused_file);
            $last_mod = date("Y-m-d H:i:s", $filemtime);
            $size = round($filesize / 1024 / 1024, 2);
            /*
             * see, if any data source is still associated to this rrd file
             * currently depends on a single <path_rra>
             */
            $data_source = db_fetch_row("SELECT DISTINCT " . "`data_source_path`, " . "`name_cache`, " . "`local_data_id`, " . "`data_template_id`, " . "`data_template`.`name` " . "FROM " . "`data_template_data` " . "LEFT JOIN " . "`data_template` " . "ON " . "`data_template_data`.`data_template_id`=`data_template`.`id` " . "WHERE " . "`data_source_path`=" . '"<path_rra>/' . $unused_file . '"');
            if (isset($data_source)) {
                $sql = "INSERT INTO `plugin_rrdclean` VALUES('" . "" . "', '" . $unused_file . "', '" . $last_mod . "', '" . $size . "', '" . $data_source["name_cache"] . "', '" . $data_source["local_data_id"] . "', '" . $data_source["data_template_id"] . "', '" . $data_source["name"] . "')";
            } else {
                $sql = "INSERT INTO `plugin_rrdclean` VALUES('" . "" . "', '" . $unused_file . "', '" . $last_mod . "', '" . $size . "', '" . "None" . "', '" . 0 . "', '" . 0 . "', '" . "None" . "')";
            }
            db_execute($sql);
            $i++;
        }
        clearstatcache();
    }
    /* restore original error handler */
    restore_error_handler();
}
Example #20
0
<?php

$p->title = "SEO BY PAGE - " . $_SERVER['SERVER_NAME'];
$p->template('intranet', 'top');
$my = get_files();
?>
<br />
<div style="margin-top:10x; padding:20px; background:#eeeee2; border:1px solid #ccc; width: 30%; float:left;">
<?php 
foreach ($my['dirs'] as $dir) {
    $path = "pages/" . $dir;
    $dir = str_replace("/", "", $dir);
    if ($dir != 'admin' && $dir != 'cron' && $dir != 'svn') {
        $id = str_replace('.', '__', str_replace('/', '', str_replace('_', '', $path)));
        ?>
			<div style="margin-bottom:4px;">
				<span class="directory" status="closed" dirid="<?php 
        echo $id;
        ?>
" path="<?php 
        echo $path;
        ?>
">
					<span id="images_<?php 
        echo $id;
        ?>
">
						<img src="/images/plus.png" width="9" height="9" />...<img src="/images/closed-folder.png" width="16" height="13" />
					</span> 
					<?php 
        echo $dir;
 /**
  * loadLanguageFiles
  *
  * @access private
  * @param String $dir Select files from this dir
  * @param String $ext Select files with given extension
  * @return string
  */
 private function loadLanguageFiles($dir, $ext = 'php')
 {
     trace(__FILE__, "loadLanguageFiles({$dir}, {$ext}):begin");
     $files = get_files($dir, $ext);
     // Loop through files and add langs
     if (is_array($files)) {
         foreach ($files as $file) {
             //try {
             $langs = (include_once $file);
             //} catch (Exception $e) {}
             if (is_array($langs)) {
                 $this->langs->append($langs);
             }
             // if
         }
         // foreach
     }
     // if
 }
Example #22
0
     $navigation .= empty($getnav['name']) ? '' : '<option value="' . re($getnav['placeholder']) . '-' . ($getnav['pos'] + 1) . '" ' . $sel[$i] . '>' . _nach . ' -> ' . navi_name(re($getnav['name'])) . '</option>';
     $i++;
 }
 if ($get['shown'] == 1) {
     $sshown = "checked=\"checked\"";
 }
 if ($get['navi'] == 1) {
     $roster = "selected=\"selected\"";
 }
 if ($get['status'] == 1) {
     $status = "selected=\"selected\"";
 }
 if ($get['team_show'] == 1) {
     $team_show = "selected=\"selected\"";
 }
 $files = get_files('../inc/images/gameicons/');
 for ($i = 0; $i < count($files); $i++) {
     if ($files[$i] == $get['icon']) {
         $sel = "selected=\"selected\"";
     } else {
         $sel = "";
     }
     if (preg_match("#\\.gif|.jpg|.png#Uis", $files[$i])) {
         $gameicons .= show(_select_field, array("value" => $files[$i], "sel" => $sel, "what" => strtoupper(preg_replace("#\\.(.*?)\$#", "", $files[$i]))));
     }
 }
 foreach ($picformat as $end) {
     if (file_exists(basePath . '/inc/images/squads/' . intval($_GET['id']) . '.' . $end)) {
         $image = '<img src="../inc/images/squads/' . intval($_GET['id']) . '.' . $end . '" width="200" alt="" onmouseover="DZCP.showInfo(\'<tr><td><img src=../inc/images/squads/' . intval($_GET['id']) . '.' . $end . ' alt= /></tr></td>\')" onmouseout="DZCP.hideInfo()" /><br />';
         break;
     }
Example #23
0
include './build-functions.php';
include './build-properties.php';
$build_start = microtime_float();
echo "Cleaning up Distribution Directory";
rmdirr($OUTPUT_DIR);
if (!is_dir($TMP_DIR)) {
    mkdir($TMP_DIR, 0700);
}
if (!is_dir($OUTPUT_DIR)) {
    mkdir($OUTPUT_DIR, 0700);
}
echo "Building Uncompressed File: {$OUTPUT_DIR}{$OUTPUT_FILE}\n\r";
$time_start = microtime_float();
$fpOut = fopen($OUTPUT_DIR . $OUTPUT_FILE, "w");
fwrite($fpOut, $LICENSE_TEXT);
$src = get_files($SOURCE_DIR);
foreach ($src as $i => $fn) {
    echo "- Reading {$fn}\n";
    $fp = fopen($fn, "r") or die("Failed: Cannot open {$fn}");
    $contents = "";
    while (!feof($fp)) {
        $contents .= fgets($fp);
    }
    $contents = substr($contents, strpos($contents, "*/") + 2);
    fwrite($fpOut, $contents);
    fclose($fp);
}
echo "Finished building {$OUTPUT_DIR}{$OUTPUT_FILE} (" . filesize($OUTPUT_DIR . $OUTPUT_FILE) . " bytes): Took " . (microtime_float() - $time_start) . "s\n\n";
fclose($fpOut);
echo "Building Compressed File: {$OUTPUT_DIR}{$OUTPUT_FILE_COMPRESSED}\n\r";
$time_start = microtime_float();
Example #24
0
/**
 * Dumps a CSS/JS file
 *
 * @param $name
 * @param $mimetype
 */
function dump($name, $mimetype, $cachekey)
{
    global $cachedirdrupal;
    global $nocache;
    global $config;
    $starttime = microtime(true);
    $excludes = array();
    $dependencies = array();
    $patterns = array();
    $filetype = substr(strrchr($name, '.'), 1);
    $output = '';
    $minify = isset($_REQUEST['min']);
    $debugjavascript = $filetype === 'js' && isset($_REQUEST['debug']);
    if ($debugjavascript) {
        $output .= '// load js files in a synchronous way' . PHP_EOL;
    }
    // check whether the file is in drupal cache
    if (!is_dir($cachedirdrupal)) {
        mkdir($cachedirdrupal, 0755);
    }
    $cachefile = $cachedirdrupal . '/terrific-' . $cachekey . '-' . $name;
    if ($nocache || !is_file($cachefile)) {
        // collect excluded pattern & (less/scss) dependencies & patterns
        foreach ($config->assets->{$name} as $pattern) {
            $firstchar = substr($pattern, 0, 1);
            if ($firstchar === '!') {
                $excludes[] = substr($pattern, 1);
            } else {
                if ($firstchar === '+') {
                    $dependencies[] = substr($pattern, 1);
                } else {
                    $patterns[] = $pattern;
                }
            }
        }
        $dependencies = get_files($dependencies);
        $excludes = array_merge($dependencies, $excludes);
        $files = get_files($patterns, $excludes);
        foreach ($files as $entry) {
            if (!$debugjavascript) {
                $format = substr(strrchr($entry, '.'), 1);
                $output .= compile(BASE . $entry, $format, $dependencies);
            } else {
                $output .= "document.write('<script type=\"text/javascript\" src=\"{$entry}\"><\\/script>');" . PHP_EOL;
            }
        }
        if ($minify) {
            switch ($filetype) {
                case 'css':
                    require BASE . 'app/library/cssmin/cssmin.php';
                    $output = CssMin::minify($output);
                    break;
                case 'js':
                    require BASE . 'app/library/jshrink/Minifier.php';
                    $output = \JShrink\Minifier::minify($output);
                    break;
            }
        }
        $time_taken = microtime(TRUE) - $starttime;
        $output = get_asset_banner($name, $filetype, $minify, $time_taken) . $output;
        file_put_contents($cachefile, $output);
    } else {
        $output = file_get_contents($cachefile);
    }
    ob_start("ob_gzhandler");
    header('Content-Type: ' . $mimetype);
    echo $output;
    ob_end_flush();
}
Example #25
0
					<label for="edit_file">' . $file . '</label>
					<textarea name="edit_file" cols="28" rows="30" style="width:480px;">' . $file_html . '</textarea>
				</p>
				
				<p>
					<span class="note">
					<input name="update_file" value="update" type="submit"/>
					</span>
				</p>
				</form>
		';
}
// get aside content
$list_files = '';
$theme_dir = WW_ROOT . '/ww_view/themes/' . $edit_theme . '/';
$theme_files = get_files($theme_dir, 'css');
sort($theme_files);
if (!empty($theme_files)) {
    $list_files = '
		<ul>';
    foreach ($theme_files as $th_f) {
        $file_link = $_SERVER["PHP_SELF"] . '?page_name=editor&amp;theme=' . $edit_theme . '&amp;file=';
        $list_files .= '
			<li>
				<a href="' . $file_link . $th_f['filename'] . '">' . $th_f['filename'] . '</a> (' . $th_f['size'] . 'b)
			</li>';
    }
    $list_files .= '
		</ul>';
}
$list_themes = '';
* provide aloha link suggestion
*/
/*
// also possible: use the lookup filter here to not send a json with 10000s of entries
$lookup = false;
if (isset($_REQUEST['lookup'])) {
	$lookup = $_REQUEST['lookup'];
}
*/
// read all available files
$results = array();
// all pages
$files = get_files('../');
$results = array_merge($results, $files);
// all uploads
$files = get_files('../uploads/');
$results = array_merge($results, $files);
header('Content-Type:text/javascript');
if (count($results) > 0) {
    $out = '[';
    foreach ($results as $result) {
        $out .= '{"url":"' . $result['link'] . '","name":"' . $result['title'] . '","type":"' . $result['type'] . '"},';
    }
    $out = substr($out, 0, -1);
    $out .= ']';
    echo $out;
}
/**
 * helper functions
*/
function get_files($dir = '../', $dir_path = false)
         } else {
             $qry = db("INSERT INTO " . $sql_prefix . "events_kat\n                     SET `katimg`     = '" . $name . "',\n                         `name`  = '" . up($_POST['kat']) . "'");
             //bild hochladen und nach id bennen
             $getrennt = explode('.', $_FILES['file']['name']);
             $getrennt = array_reverse($getrennt);
             $neuername = mysql_insert_id() . '.' . $getrennt[0];
             copy($tmpname, basePath . "/inc/images/eventkat/" . $neuername . "");
             @unlink($_FILES['file']['tmp_name']);
             $show = info(_config_newskats_added, "?admin=ev_kat");
         }
     }
     //#############################################################################
 } elseif ($_GET['do'] == "edit") {
     $qry = db("SELECT * FROM " . $sql_prefix . "events_kat\n                   WHERE id = '" . intval($_GET['id']) . "'");
     $get = _fetch($qry);
     $files = get_files('../inc/images/eventkat/');
     for ($i = 0; $i < count($files); $i++) {
         if ($get['katimg'] == $files[$i]) {
             $sel = "selected=\"selected\"";
         } else {
             $sel = '';
         }
         $img .= show(_select_field, array("value" => $files[$i], "sel" => $sel, "what" => $files[$i]));
     }
     $upload = show(_config_ev_kats_katbild_upload_edit, array("id" => $_GET['id']));
     $do = show(_config_ev_kats_editid, array("id" => $_GET['id']));
     $show = show($dir . "/eventkatform", array("head" => _config_newskats_edit_head, "nkat" => _config_katname, "kat" => re($get['name']), "value" => _button_value_edit, "id" => $_GET['id'], "nothing" => _nothing, "do" => $do, "nimg" => _config_newskats_katbild, "upload" => $upload, "img" => $img));
     //#############################################################################
 } elseif ($_GET['do'] == "editeventkat") {
     if (empty($_POST['kat'])) {
         $show = error(_config_empty_katname, 1);
Example #28
0
// Typ:       contentmenu
// Rechte:    permission('downloads')
///////////////////////////////
if (_adminMenu != 'true') {
    exit;
}
$where = $where . ': ' . _dl;
if (!permission("downloads")) {
    $show = error(_error_wrong_permissions, 1);
} else {
    if ($_GET['do'] == "new") {
        $qry = db("SELECT * FROM " . $db['dl_kat'] . "\n                   ORDER BY name");
        while ($get = _fetch($qry)) {
            $kats .= show(_select_field, array("value" => $get['id'], "what" => re($get['name']), "sel" => ""));
        }
        $files = get_files('../downloads/files/');
        for ($i = 0; $i < count($files); $i++) {
            $dl .= show(_downloads_files_exists, array("dl" => $files[$i], "sel" => ""));
        }
        $show = show($dir . "/form_dl", array("admin_head" => _downloads_admin_head, "ddownload" => "", "durl" => "", "oder" => _or, "lang" => $language, "file" => $dl, "nothing" => "", "nofile" => _downloads_nofile, "lokal" => _downloads_lokal, "what" => _button_value_add, "do" => "add", "exist" => _downloads_exist, "dbeschreibung" => "", "kat" => _downloads_kat, "kats" => $kats, "url" => _downloads_url, "beschreibung" => _beschreibung, "download" => _downloads_name));
    } elseif ($_GET['do'] == "add") {
        if (empty($_POST['download']) || empty($_POST['url'])) {
            if (empty($_POST['download'])) {
                $show = error(_downloads_empty_download, 1);
            } elseif (empty($_POST['url'])) {
                $show = error(_downloads_empty_url, 1);
            }
        } else {
            if (preg_match("#^www#i", $_POST['url'])) {
                $dl = links($_POST['url']);
            } else {
function admin_started()
{
    if (isset($_POST['filter_button'])) {
        if ($_POST['filter'] == '-1') {
            $_POST['filter'] = 'all';
        }
        set_transient('Filter_By', admin_filter_type($_POST['filter']), 600);
        wp_redirect($_POST['_wp_http_referer']);
        exit;
    }
    if (isset($_POST['page']) && $_POST['page'] == 'collaboration_problem' && isset($_POST['problem']) && is_array($_POST['problem'])) {
        foreach ($_POST['problem'] as $Workroom_Id) {
            wp_delete_post($Workroom_Id);
            delete_post_meta_by_post_id($Workroom_Id);
            $files = get_files($Workroom_Id);
            foreach ($files as $file) {
                wp_delete_post($file->ID);
                delete_post_meta_by_post_id($file->ID);
            }
            $messages = get_messages($Workroom_Id);
            foreach ($messages as $message) {
                wp_delete_post($message->ID);
                delete_post_meta_by_post_id($message->ID);
            }
        }
        wp_redirect($_SERVER['HTTP_REFERER']);
        exit;
    }
}
Example #30
0
File: news.php Project: nopuls/dzcp
     $files = get_files('../inc/images/newskat/');
     for ($i = 0; $i < count($files); $i++) {
         $img .= show(_select_field, array("value" => $files[$i], "sel" => "", "what" => $files[$i]));
     }
     $show = show($dir . "/newskatform", array("head" => _config_newskats_add_head, "nkat" => _config_katname, "kat" => "", "value" => _button_value_add, "nothing" => "", "do" => "addnewskat", "nimg" => _config_newskats_katbild, "upload" => _config_neskats_katbild_upload, "img" => $img));
 } elseif ($_GET['do'] == "addnewskat") {
     if (empty($_POST['kat'])) {
         $show = error(_config_empty_katname, 1);
     } else {
         $qry = db("INSERT INTO " . $db['newskat'] . "\n                     SET `katimg`     = '" . up($_POST['img']) . "',\n                         `kategorie`  = '" . up($_POST['kat']) . "'");
         $show = info(_config_newskats_added, "?admin=news");
     }
 } elseif ($_GET['do'] == "edit") {
     $qry = db("SELECT * FROM " . $db['newskat'] . "\n                   WHERE id = '" . intval($_GET['id']) . "'");
     $get = _fetch($qry);
     $files = get_files('../inc/images/newskat/');
     for ($i = 0; $i < count($files); $i++) {
         if ($get['katimg'] == $files[$i]) {
             $sel = "selected=\"selected\"";
         } else {
             $sel = '';
         }
         $img .= show(_select_field, array("value" => $files[$i], "sel" => $sel, "what" => $files[$i]));
     }
     $upload = show(_config_neskats_katbild_upload_edit, array("id" => $_GET['id']));
     $do = show(_config_newskats_editid, array("id" => $_GET['id']));
     $show = show($dir . "/newskatform", array("head" => _config_newskats_edit_head, "nkat" => _config_katname, "kat" => re($get['kategorie']), "value" => _button_value_edit, "id" => $_GET['id'], "nothing" => _nothing, "do" => $do, "nimg" => _config_newskats_katbild, "upload" => $upload, "img" => $img));
 } elseif ($_GET['do'] == "editnewskat") {
     if (empty($_POST['kat'])) {
         $show = error(_config_empty_katname, 1);
     } else {