Exemple #1
0
function radio_select()
{
    $r = walk_dir('users/' . $_SESSION['qb'], 'funcmp3');
    if ($r) {
        return radio_r($r);
    }
}
Exemple #2
0
function walk($path, $filter)
{
    //echo 'walking '.$path."\n";
    if (is_dir($path)) {
        walk_dir($path, $filter);
    }
    if (is_file($path)) {
        walk_file($path, $filter);
    }
}
Exemple #3
0
function walk_dir($path)
{
    if ($dir = opendir($path)) {
        while (false !== ($file = readdir($dir))) {
            if ($file[0] == ".") {
                continue;
            }
            if (is_dir($path . "/" . $file)) {
                $retval = array_merge($retval, walk_dir($path . "/" . $file));
            } else {
                if (is_file($path . "/" . $file)) {
                    $retval[] = $path . "/" . $file;
                }
            }
        }
        closedir($dir);
    }
    return $retval;
}
function walk_dir($path)
{
    global $dir_arr, $lang;
    $handle = opendir($path);
    //打开目录
    while ($file = readdir($handle)) {
        //如果$file为目录,则不做操作
        if (is_dir($file)) {
            if ($file == ".." || $file == "." || $file[0] == '.') {
                continue;
            } else {
                array_push($dir_arr, $file);
                walk_dir($path . "/" . $file);
                array_pop($dir_arr);
            }
        } else {
            insert_db_per_file($path, $file);
        }
    }
    closedir($handle);
    //关闭目录
}
Exemple #5
0
    $fsroot = binarypool_config::getRoot();
    $root = rtrim($root, '/') . '/';
    $queue = array($root);
    foreach ($exclude as &$path) {
        $path = $root . trim($path, '/') . '/';
    }
    while ($base = array_shift($queue)) {
        $relative = substr($base, strlen($fsroot));
        $callback($bucket, $fsroot, $relative);
        if (file_exists($base)) {
            if ($handle = opendir($base)) {
                while (($child = readdir($handle)) !== FALSE) {
                    if (is_dir($base . $child) && $child != '.' && $child != '..') {
                        $combined_path = $base . $child . '/';
                        if (!in_array($combined_path, $exclude)) {
                            array_unshift($queue, $combined_path);
                        }
                    }
                }
                closedir($handle);
            }
        }
    }
}
foreach ($buckets as $bucket) {
    $storage = new binarypool_storage($bucket);
    printf("[%10s] Processing files.\n", $bucket);
    $processed = 0;
    walk_dir($bucket, binarypool_config::getRoot() . $bucket, 'walk_callback', array('created', 'expiry', 'downloaded'));
    printf("[%10s] %d binaries processed.\n", $bucket, $processed);
}
Exemple #6
0
function patch_varseparator()
{
    $r = walk_dir('/msql', 'repsep');
}
function processLine($line, $hash='') {
global $current_dest;
global $current_dir;
global $ignores;

 if (!is_array($ignores)) {
  $ignores=array();
 }
 if (!is_array($hash)) {
  $hash=array();
 }


 $line=trim($line);

 foreach($hash as $k=>$v) {
  $line=str_replace($k, $v, $line);
 }
 echo $line."\n";

 if (preg_match('/^\/\//', $line)) {

  return;

 } elseif(preg_match('/^IGNORE (.+?)$/i', $line, $matches)) {

  $ignores[]=trim($matches[1]);

 } elseif(preg_match('/^SET (.+?)=(.+?)$/i', $line, $matches)) {

  $key=trim($matches[1]);
  $value=trim($matches[2]);
  $hash[$key]=$value;

 } elseif (preg_match('/^CLEAR (.+?) (\d+) DAYS OLD$/is', $line, $matches)) {

  $from=trim($matches[1]);
  $current_dir=$from;
  $days=(int)($matches[2]);

  if ($days>0) {
   walk_dir($from, "remove_old_files", $days);
  }

 } elseif (preg_match('/^(.+?)\+>(.+?) (\d+) DAYS OLD$/is', $line, $matches)) {

  $from=trim($matches[1]);
  $to=trim($matches[2]);
  $current_dir=$from;
  $current_dest=$to;
  $days=(int)($matches[3]);
  walk_dir($from, "copyNewFile", $days);

 } elseif (preg_match('/^(.+?)<\+(.+?) (\d+) DAYS OLD$/is', $line, $matches)) {

  $to=trim($matches[1]);
  $from=trim($matches[2]);
  $current_dir=$from;
  $current_dest=$to;

  /*
  if (!is_dir2($to) && !@mkdir($to)) {
   echo "\n Cannot make destination dir ($to)\n";
   return;
  }
  */

  $days=(int)($matches[3]);
  walk_dir($from, "copyNewFile", $days);

 } elseif (preg_match('/^(.+?)=>(.+?)$/is', $line, $matches)) {

  $from=trim($matches[1]);
  $to=trim($matches[2]);
  $current_dir=$from;
  $current_dest=$to;

  /*
  if (!is_dir2($to) && !@mkdir($to)) {
   echo "\n Cannot make destination dir ($to)\n";
   return;
  }
  */
  //echo "walking $from\n";

  walk_dir($from, "checkfile");

 } elseif (preg_match('/^(.+?)<=(.+?)$/is', $line, $matches)) {

  $from=trim($matches[2]);
  $to=trim($matches[1]);
  $current_dir=$from;
  $current_dest=$to;

  /*
  if (!is_dir2($to) && !@mkdir($to)) {
   return;
  }
  */

  walk_dir($from, "checkfile");

 } elseif (preg_match('/^(.+?)\!>(.+?)$/is', $line, $matches)) {

  $from=trim($matches[1]);
  $to=trim($matches[2]);
  $current_dir=$from;
  $current_dest=$to;

  /*
  if (!is_dir2($to) && !@mkdir($to)) {
   return;
  }
  */

  walk_dir2($from, "checkfile");

 } elseif (preg_match('/^(.+?)<\!(.+?)$/is', $line, $matches)) {

  $from=trim($matches[2]);
  $to=trim($matches[1]);
  $current_dir=$from;
  $current_dest=$to;

  /*
  if (!is_dir2($to) && !@mkdir($to)) {
   return;
  }
  */

  walk_dir2($from, "checkfile");


 } elseif (preg_match('/^(.+?)->(.+?)$/is', $line, $matches)) {

  $from=trim($matches[1]);
  $to=trim($matches[2]);
  $current_dir=$from;
  $current_dest=$to;

  /*
  if (!is_dir2($to) && !@mkdir($to)) {
   return;
  }
  */

  walk_dir($from, "checkfile", 1);

 } elseif (preg_match('/^(.+?)<-(.+?)$/is', $line, $matches)) {

  $from=trim($matches[2]);
  $to=trim($matches[1]);
  $current_dir=$from;
  $current_dest=$to;

  /*
  if (!is_dir2($to) && !@mkdir($to)) {
   return;
  }
  */

  walk_dir($from, "checkfile", 1);

 }
// echo $line."\n";
}
function walk_dir($dir)
{
    if (!file_exists($dir)) {
        return array();
    }
    $root = scandir($dir);
    $result = array();
    foreach ($root as $value) {
        if ($value === '.' || $value === '..') {
            continue;
        }
        if (is_file("{$dir}/{$value}")) {
            // Add as a file and continue
            $time = filemtime("{$dir}/{$value}");
            $result[] = array("{$dir}/{$value}", $dir, $value, $time);
            continue;
        }
        foreach (walk_dir("{$dir}/{$value}") as $value) {
            $result[] = $value;
        }
    }
    return $result;
}
Exemple #9
0
function fi_deldir($d, $id)
{
    $j = 'users/' . $d;
    if ($id != 'go') {
        return blj('popdel', $id . 'fidld', 'fifunc___fi*deldir_' . ajx($d) . '_go', pictxt('alert', 'really delete directory?'));
    }
    walk_dir($j, "removef");
    rmdir($j);
    return fi_parent($d, $id . 'fidld', 'deleted', 1);
}
Exemple #10
0
function adm_killhub()
{
    $qb = ses('qb');
    $f = 'users/' . $qb;
    walk_dir($f, 'remove');
    rmdir($f);
    $f = 'msql/users/' . $qb . '_cache.php';
    if (is_file($f)) {
        unlink($f);
    }
    for ($i = 1; $i < 10; $i++) {
        $f = 'msql/design/' . $qb . '_design_' . $i . '.php';
        if (is_file($f)) {
            unlink($f);
        }
        $f = 'msql/design/' . $qb . '_clrset_' . $i . '.php';
        if (is_file($f)) {
            unlink($f);
        }
        $f = 'msql/users/' . $qb . '_mods_' . $i . '.php';
        if (is_file($f)) {
            unlink($f);
        }
    }
    update('qda', 'nod', '_' . $qb, 'nod', $qb);
    //msquery('DELETE FROM '.ses('qdm').' WHERE id=(select id from '.ses('qda').' where name="'.$qb.'")');
    //msquery('DELETE FROM '.ses('qda').' WHERE name="'.$qb.'"');
    //msquery('DELETE FROM '.$qdu.' WHERE name="'.$qb.'" LIMIT 1');
    if ($_SESSION['USE'] == $qb) {
        $_SESSION['USE'] = '';
    }
    relod(subdom(prms('default_hub')));
}
Exemple #11
0
<?php

include "init.inc";
extract($_REQUEST, EXTR_PREFIX_ALL | EXTR_REFS, 'rvar');
header('Cache-Control: max-age=0, must-revalidate, no-cache, no-store');
header('Content-Type: text/plain');
$user = sanitize_word($rvar_user);
if (!is_dir("{$root_dir}{$user}")) {
    header('HTTP/1.0 404 Not Found');
    die;
}
date_default_timezone_set('UTC');
print "#\n";
print "# .netskeldb for {$user}\n";
print "#\n";
print "# Generated " . date("d-M-Y @ H:i T") . " by " . $_SERVER['HTTP_HOST'] . "\n";
print "#\n";
$buf = custom_client_script($user);
$scriptsize = strlen($buf);
$scriptmd5 = md5($buf);
print "bin/\t700\t*\n";
print "bin/netskel\t700\t*\t{$scriptsize}\t{$scriptmd5}\t\n";
walk_dir("{$root_dir}{$user}", '');
Exemple #12
0
function adm_hubs($auth)
{
    $goto = '/?admin=hubs';
    $qb = ses('qb');
    $qdu = ses('qdu');
    $USE = ses('USE');
    if ($mna && $auth >= 5) {
        $mna = $_SESSION['mn'] + $mna;
    } else {
        $mna = ses('mn');
    }
    //if($mna)$ret.=balc('ul','panel',m_nodes_b($mna,1));
    $ret .= hublist() . br();
    if ($auth >= 6 && prms('create_hub') == 'on' or $auth >= 7) {
        $ret .= loged('', '', 'create new hub', '10') . br();
    }
    if ($_GET['rename_hub'] && $auth >= 5) {
        //renmae_hub
        if ($_POST['hub_name']) {
            $newname = trim($_POST['hub_name']);
            $_SESSION['mn'][$qb] = $newname;
            update('qdu', 'hub', $newname, 'name', $qb);
        }
        $valu = input2('text', 'hub_name', $_SESSION['mn'][$qb], 'txtx');
        $valu .= input2('submit', 'Submit', 'rename_hub', '');
        $ret .= form($goto . '&rename_hub==', btn('panel', $valu)) . br();
    } elseif ($auth >= 5) {
        $ret .= lkc('popsav', $goto . '&rename_hub==', nms(87)) . ' ';
    }
    //kill_hub
    if ($auth >= 6 && $_GET['kill_hub'] == 'ok') {
        $f = 'users/' . ses('qb');
        walk_dir($f, 'remove');
        rmdir($f);
        $f = 'msql/users/' . $qb . '_cache.php';
        if (is_file($f)) {
            unlink($f);
        }
        for ($i = 1; $i < 10; $i++) {
            $f = 'msql/design/' . $qb . '_design_' . $i . '.php';
            if (is_file($f)) {
                unlink($f);
            }
            $f = 'msql/design/' . $qb . '_clrset_' . $i . '.php';
            if (is_file($f)) {
                unlink($f);
            }
            $f = 'msql/users/' . $qb . '_mods_' . $i . '.php';
            if (is_file($f)) {
                unlink($f);
            }
        }
        msquery('DELETE FROM ' . $qdu . ' WHERE name="' . $qb . '" LIMIT 1');
        $_SESSION['USE'] = '';
        relod(subdom(prms('default_hub')));
    }
    //reinit_hub
    if ($auth >= 6 && $_GET['reinit_hub'] == 'ok') {
        makenew(ses('qb'), 1);
    }
    //publish
    if ($auth >= 6) {
        if ($_GET['publish']) {
            if ($_GET['publish'] == 'off') {
                $actv = 0;
            } else {
                $actv = 1;
            }
            update('qdu', 'active', $actv, 'name', $qb);
        }
        $opened = rse('active', $qdu . ' WHERE name="' . $qb . '"');
        if ($opened == '1') {
            $ere = 'off';
            $st = nms(130);
        } else {
            $ere = 'on';
            $st = nms(131);
        }
        $ret .= lkc('popsav', $goto . '&publish=' . $ere . '#' . $id, offon($opened) . ' ' . $st) . ' ';
        $ret .= lkc('popsav', $goto . '&reinit==', nms(95) . ' ' . nms(103)) . ' ';
    }
    if ($_GET['reinit'] == '=') {
        $ret .= btn('txtx', 'restore all defaults ?') . lkc('txtyl', $goto . '&reinit_hub=ok', 'ok') . ' ';
    }
    if ($auth >= 6) {
        $ret .= lkc('txtyl', $goto . '&kill_hub==', nms(76) . ' ' . nms(100)) . ' ';
        if ($_GET['kill_hub'] == '=') {
            $ret .= btn('txtx', 'All datas will be lost') . lkc('txtyl', $goto . '&kill_hub=ok', 'ok');
        }
    }
    return $ret . br();
}
Exemple #13
0
<?php

//philum_plugin_download
session_start();
require "../progb/lib.php";
require "../progb/spe.php";
//need refresh for each depth
function see_fonts($j, $k, $v, $io)
{
    //$r=array('abscdefghijklmnopqrstuvwxyz','0123456789,;:!?./§&й"\'(-и_за)=');
    $txt = $_GET["txt"] ? $_GET["txt"] : "abcdEFGH1234!й";
    echo $fnt = substr($v, 0, -4);
    echo ': ';
    echo img_txt($txt, $fnt, "") . br();
}
function funcb($j, $k, $v, $n)
{
    echo $j . '/' . $v . '_' . $k . br();
}
walk_dir('../gdf', "see_fonts");
//rmdir($f);
    //echo $file;
    $file = preg_replace("#//+#", '/', $file);
    $IMAGES_BASE_DIR = preg_replace("#//+#", '/', $IMAGES_BASE_DIR);
    $file = preg_replace("#{$IMAGES_BASE_DIR}#", '', $file);
    if (CheckImgExt($file)) {
        //if ($_GET['search'] == ""){
        $files[] = $file;
        //adding filenames to array
        //}else{
        //	if (CheckSearch($file)){
        //		$files[] = $file;
        //	}
        //}
    }
}
foreach (walk_dir($IMAGES_BASE_DIR) as $file) {
    //echo $file;
    $file = preg_replace("#//+#", '/', $file);
    $IMAGES_BASE_DIR = preg_replace("#//+#", '/', $IMAGES_BASE_DIR);
    $file = preg_replace("#{$IMAGES_BASE_DIR}#", '', $file);
    if (CheckPdfExt($file)) {
        //if ($_GET['search'] == ""){
        $pdf[] = $file;
        //adding filenames to array
        //}else{
        //	if (CheckSearch($file)){
        //		$files[] = $file;
        //	}
        //}
    }
}
Exemple #15
0
function plug_publish_site()
{
    $r = dirs();
    //p($r);
    if ($_SESSION['auth'] < 6) {
        return 'no';
    }
    if (!is_dir('_public')) {
        mkdir('_public');
    }
    echo divc('panel', 'this will backup program files in public directory to let users upgrade Philum from this server - ' . lka('/plug/_zip_prog.php?createzip=', 'tar.gz'));
    echo update_msql();
    echo plugin('coreflush') . br();
    echo plugin('philumsize') . br();
    foreach ($r as $k => $v) {
        $xt = substr($v, -3);
        if ($xt == 'php' or $xt == 'css' or $xt == 'txt' or $xt == '.js' or strpos($v, 'philum')) {
            //$pos=strrpos($v,'/'); $j=substr($v,0,$pos); $va=substr($v,$pos+1);
            list($j, $va) = split_one('/', $v, 1);
            funcb($j, $k, $va, '');
            funcc('_public/' . $j, $k, $va, '');
        } else {
            walk_dir('' . $v, 'funcb');
        }
        walk_dir('_public/' . $v, 'funcc');
    }
}
function walk_dir($service, $folderId, $folderName)
{
    $CI =& get_instance();
    // Get the global CI object
    $CI->load->library('zip');
    $fileList = retrieveAllFilesFordownload($service, $folderId);
    if (!empty($fileList)) {
        foreach ($fileList as $file) {
            if ($file->mimeType != "application/vnd.google-apps.folder") {
                $name = $folderName . '/' . $file->title;
                $data = downloadFile($service, $file);
                $CI->zip->add_data($name, $data);
            } else {
                walk_dir($service, $file->id, $folderName . '/' . $file->title);
            }
        }
    }
}
Exemple #17
0
 function downloadzip($id = null, $name = null)
 {
     $client = $this->google_client;
     $client->setAccessToken($this->session->userdata('accessToken'));
     $service = new Google_DriveService($client);
     if ($id == null) {
         $id = $this->input->post('folderid');
     }
     if ($this->input->post('folderid')) {
         $folderdetail = $this->usermodel->getallfolders($id, 'getbyId');
         //pre($folderdetail);
         //pr($id);
     }
     $main_folder = $folderdetail[0]['googleFolderName'];
     //$main_folder = $name;
     //$main_folder_id = "0Bx2xsf5uSuWqb1dfVnNvTGdCcW8";
     $main_folder_id = $folderdetail[0]['googlefolderId'];
     /* Recent document code here */
     $array = array('title' => 'my_backup.zip', 'doc_id' => $main_folder_id, 'doc_type' => 'folder', 'folder_id' => $main_folder_id, 'folder_name' => $main_folder, 'user_id' => $this->session->userdata('userid'), 'action_description' => 'Export folder');
     $this->usermodel->saverecentfiles($array);
     //$this->load->library('zip');
     walk_dir($service, $main_folder_id, $main_folder);
     $this->zip->download('my_backup.zip');
     $this->session->set_flashdata('message', '<div class="alert-success">' . $this->lang->line('file_bkp_msg') . '</div>');
     //$rd = $_SERVER['REQUEST_URI'];
     redirect('users/alldocs');
 }