function file_list($dir, $pattern = "")
{
    $arr = array();
    $dir_handle = opendir($dir);
    if ($dir_handle) {
        while (($file = readdir($dir_handle)) !== false) {
            if ($file === '.' || $file === '..') {
                continue;
            }
            $tmp = realpath($dir . '/' . $file);
            if (is_dir($tmp)) {
                $retArr = file_list($tmp, $pattern);
                if (!empty($retArr)) {
                    $arr[] = $retArr;
                }
            } else {
                if ($pattern === "" || preg_match($pattern, $tmp)) {
                    $arr[] = $tmp;
                }
            }
        }
        closedir($dir_handle);
    }
    return $arr;
}
Exemplo n.º 2
0
function file_list($path)
{
    require_once 'thinksaas/class.Diff.php';
    if ($handle = opendir($path)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                if (is_dir($path . "/" . $file)) {
                    file_list($path . "/" . $file);
                } else {
                    $upfile = $path . "/" . $file;
                    $nfile = substr($path . '/' . $file, 18);
                    if (is_file($nfile)) {
                        //if(Diff::compareFiles($nfile, $upfile)){
                        if (copy($upfile, $nfile) === false) {
                            return '1';
                            exit;
                            //不可拷贝就返回1
                        }
                        //}
                    } else {
                        if (copy($upfile, $nfile) === false) {
                            return '1';
                            exit;
                            //不可拷贝就返回1
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 3
0
function compile_markdown_files_metadata($folder, $output_file)
{
    $data = array();
    foreach (file_list($folder) as $file) {
        $data[$file] = parse_file($file);
        $data[$file]['link'] = generate_link($file);
        unset($data[$file]['content']);
    }
    $data_before = <<<EOT
<?php
/*
===== This file is auto-generated. It contains the compiled metadata from the markdown. =====
*/

function compiled_metadata(\$file = null) {
\$data = 
EOT;
    $data_after = <<<EOT
;
\tif (\$file == null || !isset(\$data[\$file])) {
\t\treturn \$data;
\t} else {
\t\treturn \$data[\$file];
\t}
}
EOT;
    $complete_data = $data_before . var_export($data, true) . $data_after;
    $file_handle = fopen($output_file, "w");
    if ($file_handle == false) {
        die('Could not open compiled file to write.');
    }
    if (!fwrite($file_handle, $complete_data)) {
        die('Could not write to file');
    }
}
Exemplo n.º 4
0
function file_list($dir, $fs = array())
{
    $files = glob($dir . '/*');
    if (!is_array($files)) {
        return $fs;
    }
    foreach ($files as $file) {
        if (is_dir($file)) {
            $fs = file_list($file, $fs);
        } else {
            $fs[] = $file;
        }
    }
    return $fs;
}
Exemplo n.º 5
0
function file_list($path)
{
    global $fileList;
    if ($handle = opendir($path)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                if (is_dir($path . "/" . $file)) {
                    file_list($path . "/" . $file);
                } else {
                    //echo $path."/".$file."<br>";
                    $fileList[] = $path . "/" . $file;
                }
            }
        }
    }
    return $fileList;
}
Exemplo n.º 6
0
function file_list($src_path, $dst_path)
{
    if ($handle = opendir($src_path)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && substr($file, 0, 1) != '.') {
                if (is_dir($src_path . "/" . $file)) {
                    $dir = $src_path . "/" . $file;
                    $GLOBALS['out'] .= '创建目录:' . $dst_path . "/" . $file;
                    $GLOBALS['out'] .= "<br>\n";
                    mkdir($dst_path . "/" . $file);
                    file_list($src_path . "/" . $file, $dst_path . "/" . $file);
                } else {
                    $file_path = $src_path . "/" . $file;
                    $rs = file_get_contents($file_path);
                    $GLOBALS['out'] .= '写入文件:' . $dst_path . "/" . $file;
                    $GLOBALS['out'] .= "<br>\n";
                    file_put_contents($dst_path . "/{$file}", $rs);
                }
            }
        }
    }
}
Exemplo n.º 7
0
function imglist_main()
{
    global $print, $x7s, $x7c, $x7p;
    $base_image_dir = "/images/";
    $image_dir = "/images/";
    if (isset($_GET['subdir']) && $_GET['subdir'] != "") {
        $image_dir .= $_GET['subdir'] . "/";
    }
    if ($x7c->permissions['admin_panic'] || authorized($image_dir, $x7p->profile['usergroup'])) {
        $basedir = dirname($_SERVER['DOCUMENT_ROOT'] . $_SERVER['PHP_SELF']);
        $file_path = $basedir . $image_dir;
        $image_root_dir = $basedir . $base_image_dir;
        $error = "<p style=\"color: red; font-weight: bold;\">";
        if (isset($_GET['file'])) {
            $error .= file_upload($file_path);
        } elseif (isset($_GET['delete'])) {
            $error .= file_delete($file_path . $_GET['delete']);
        } elseif (isset($_POST['multidel'])) {
            if ($_POST['action'] == 'delete') {
                foreach ($_POST['multidel'] as $file) {
                    $error .= file_delete($file_path . $file);
                }
            } elseif ($_POST['action'] == 'move') {
                foreach ($_POST['multidel'] as $file) {
                    $error .= file_move($file_path . $file, $image_root_dir . $_POST['dest'] . $file);
                }
            }
        }
        $error .= "</p>";
        $site_path = dirname($_SERVER['PHP_SELF']) . $image_dir;
        $output = file_list($file_path, $site_path);
        $body = $error . $output['body'];
        $head = $output['head'];
        $print->normal_window($head, $body);
    } else {
        return "Non sei autorizzato a vedere questa pagina <br>";
    }
}
Exemplo n.º 8
0
 public function index($folders = [], $style = '', $url = '', $tips = '')
 {
     $files = array();
     $folders = to_array($folders);
     foreach ($folders as $v) {
         $_folder = APPPATH . $v;
         if (!is_dir($_folder)) {
             continue;
         }
         $_f = file_list($_folder, array(APPPATH . 'static' . DIRECTORY_SEPARATOR . '*'));
         foreach ($_f as $_v) {
             $files[] = str_replace(APPPATH, '', $_v);
         }
     }
     $styles = ['ball-pulse' => 3, 'ball-grid-pulse' => 9, 'ball-clip-rotate' => 1, 'ball-clip-rotate-pulse' => 2, 'square-spin' => 1, 'ball-clip-rotate-multiple' => 2, 'ball-pulse-rise' => 5, 'ball-rotate' => 1, 'cube-transition' => 2, 'ball-zig-zag' => 2, 'ball-zig-zag-deflect' => 2, 'ball-triangle-path' => 3, 'ball-scale' => 1, 'line-scale' => 5, 'line-scale-party' => 4, 'ball-scale-multiple' => 3, 'ball-pulse-sync' => 3, 'ball-beat' => 3, 'line-scale-pulse-out' => 5, 'line-scale-pulse-out-rapid' => 5, 'ball-scale-ripple' => 1, 'ball-scale-ripple-multiple' => 3, 'ball-spin-fade-loader' => 8, 'line-spin-fade-loader' => 8, 'triangle-skew-spin' => 1, 'pacman' => 5, 'semi-circle-spin' => 1, 'ball-grid-beat' => 9, 'ball-scale-random' => 3];
     !array_key_exists($style, $styles) && ($style = 'square-spin');
     $this->_files = $files;
     $this->_style = $style;
     $this->_loading_divs = $styles[$style] ?: 1;
     $this->_url = url($url);
     $this->_tips = $tips;
     return $this->view('tools::system.loading');
 }
Exemplo n.º 9
0
function file_list($dir, $pattern = null, $recurse = false)
{
    $result = array();
    if (is_dir($dir) && ($handle = opendir($dir))) {
        while (($file = readdir($handle)) !== false) {
            if (substr($file, 0, 1) != '.' && $file != "Thumbs.db") {
                if (is_dir($dir . $file)) {
                    if ($recurse === true) {
                        foreach (file_list($dir . $file . '/', $pattern, true) as $f => $sf) {
                            $result[$f] = $sf;
                        }
                    }
                } else {
                    if ($pattern == null || instr($file, $pattern)) {
                        $result[$dir . $file] = $file;
                    }
                }
            }
        }
        closedir($handle);
    }
    return $result;
}
Exemplo n.º 10
0
function file_list($dir)
{
    $filter = array(".", "..", "__MACOSX", "nbproject", "_notes", ".DS_Store", ".komodotools", "_tmp", ".git", ".gitignore", ".meta");
    //list des nom de fichier ou de dossier a ne pas indexer
    $list = scandir($dir);
    // on scan le dossier
    $r = array_diff($list, $filter);
    // on filtre le resultat
    $files = [];
    foreach ($r as $key => $val) {
        //on parcour chaque element
        if (is_dir($dir . "/" . $val)) {
            unset($r[$key]);
            // on supprime le nom du dossier dans la liste de resultat car elle utilisé en clé pour les sous dossiers
            $r[$val] = file_list($dir . "/" . $val);
        } else {
            unset($r[$key]);
            // $files[] = $val;
            $r["zzz" . $val] = $val;
        }
    }
    ksort($r);
    return $r;
}
Exemplo n.º 11
0
function file_change_pageby()
{
    event_change_pageby('file');
    file_list();
}
<?php

require_once 'pika-danio.php';
pika_init();
require_once getcwd() . '-custom/extensions/google_drive_connector/file_list.php';
echo file_list(htmlspecialchars($_GET['folder_id']), htmlspecialchars($_GET['prev_folder_id']), htmlspecialchars($_GET['root_folder_id']));
pika_exit();
Exemplo n.º 13
0
    remove_torrent($infohash);
}
$id = is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"])) ? false : $___mysqli_res;
$mc1->delete_value('MyPeers_' . $CURUSER['id']);
//$mc1->delete_value('lastest_tor_');  //
$mc1->delete_value('last5_tor_');
$mc1->delete_value('scroll_tor_');
sql_query("DELETE FROM files WHERE torrent = " . sqlesc($id));
function file_list($arr, $id)
{
    foreach ($arr as $v) {
        $new[] = "({$id}," . sqlesc($v[0]) . "," . $v[1] . ")";
    }
    return join(",", $new);
}
sql_query("INSERT INTO files (torrent, filename, size) VALUES " . file_list($filelist, $id));
//==
$dir = $INSTALLER09['torrent_dir'] . '/' . $id . '.torrent';
if (!bencdec::encode_file($dir, $dict)) {
    stderr('Error', 'Could not properly encode file');
}
@unlink($tmpname);
chmod($dir, 0664);
//==
//=== if it was an offer notify the folks who liked it :D
if ($offer > 0) {
    $res_offer = sql_query('SELECT user_id FROM offer_votes WHERE vote = \'yes\' AND user_id != ' . sqlesc($CURUSER['id']) . ' AND offer_id = ' . sqlesc($offer)) or sqlerr(__FILE__, __LINE__);
    $subject = sqlesc('An offer you voted for has been uploaded!');
    $message = sqlesc("Hi, \n An offer you were interested in has been uploaded!!! \n\n Click  [url=" . $INSTALLER09['baseurl'] . "/details.php?id=" . $id . "]" . htmlsafechars($torrent, ENT_QUOTES) . "[/url] to see the torrent page!");
    while ($arr_offer = mysqli_fetch_assoc($res_offer)) {
        sql_query('INSERT INTO messages (sender, receiver, added, msg, subject, saved, location) 
Exemplo n.º 14
0
function file_list($path, $sub_flag, $file_type)
{
    global $file_nums_all;
    global $file_nums_use;
    global $file_use_arr;
    system("net use  " . $path . " /user:kundyZhang cv0837CVJ ");
    $file_type_arr = explode(",", $file_type);
    if ($handle = opendir($path)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                if (is_dir($path . "\\" . $file)) {
                    //echo StripSlashes($path)."\\".$file."<br>";//目录名称
                    if ($sub_flag == "1") {
                        file_list($path . "\\\\" . $file, "1", $file_type);
                    }
                } else {
                    //echo StripSlashes($path)."\\".$file."<br>";//文件名称
                    $file_nums_all++;
                    $check_file_type = check_file($file);
                    if (in_array($check_file_type["type"], $file_type_arr)) {
                        $file_nums_use++;
                        array_push($file_use_arr, StripSlashes($path) . "\\" . $file);
                    }
                }
            }
        }
    }
}
Exemplo n.º 15
0
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with Website Baker; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
require_once "../../../config.php";
require_once WB_PATH . '/include/captcha/captcha.php';
if (!isset($_SESSION['captcha_time'])) {
    exit;
}
//unset($_SESSION['captcha_time']);
// get lists of fonts and backgrounds
require_once WB_PATH . '/framework/functions.php';
$t_fonts = file_list(WB_PATH . '/include/captcha/fonts');
$t_bgs = file_list(WB_PATH . '/include/captcha/backgrounds');
$fonts = array();
$bgs = array();
foreach ($t_fonts as $file) {
    if (preg_match('/\\.ttf/', $file)) {
        $fonts[] = $file;
    }
}
foreach ($t_bgs as $file) {
    if (preg_match('/\\.png/', $file)) {
        $bgs[] = $file;
    }
}
// make random string
if (!function_exists('randomString')) {
    function randomString($len)
Exemplo n.º 16
0
/**
 * Return an array of strings where each string is a file in $path that
 * is not in $exclude. If $recursive, get all at $path, even child folders.
 *
 * @param string $path
 * @param string $exclude
 * @param boolean $recursive
 * @return array
 */
function file_list($path, $exclude = ".|..", $recursive = true)
{
    $path = rtrim($path, "/") . "/";
    $handle = opendir($path);
    $exclude_ary = explode("|", $exclude);
    $result = array();
    while (false !== ($filename = readdir($handle))) {
        if (in_array(strtolower($filename), $exclude_ary)) {
            continue;
        }
        $file_path = $path . $filename;
        if (is_dir($path . $filename . "/") && $recursive) {
            $result = array_merge($result, file_list($file_path . "/", $exclude));
        } else {
            $result[] = $file_path;
        }
    }
    return $result;
}
Exemplo n.º 17
0
define('VERSION', '1.0.2');
define('SYSTEM_ROOT', dirname(dirname(__FILE__)));
define('DEFAULT_CONTROLLER', 'app');
define('DEFAULT_ACTION', 'index');
$__system__ = SYSTEM_ROOT . '/system';
$__lib__ = SYSTEM_ROOT . '/lib';
require_once "{$__system__}/userdata.php";
require_once "{$__lib__}/userdata_app.php";
$getData = new App_UserData('GET');
$postData = new App_UserData('POST');
// flash! longer then a blink and shorter then a moment
require_once "{$__system__}/flash.php";
session_start();
$flash = new FlashHelper();
// SYSTEM FILES
require_once "{$__system__}/openstruct.php";
require_once "{$__system__}/sys.php";
require_once "{$__system__}/path_manager.php";
require_once "{$__system__}/system_functions.php";
// LIB FILES
foreach (file_list($__lib__) as $file) {
    require_once $file;
}
// SYSTEM USE VARIABLES
$content = '';
// content to render
$data = new OpenStruct();
// data mapped to rendering view
template('template');
// set the default template
init($_SERVER['REQUEST_URI']);
Exemplo n.º 18
0
 $db->nfo = $nfo;
 $db->size = $totallen;
 $db->added = time();
 $db->type = $type;
 $db->userid = USER_ID;
 $db->numfiles = count($filelist);
 $db->category = $_POST['type'];
 $db->youtube = $_POST['youtube'];
 $db->imdb = $_POST['imdb'];
 $db->freeleech = isset($_POST['freeleech']) ? 1 : 0;
 $db->insert();
 $fp = fopen(PATH_TORRENTS . "{$id}.torrent", "w");
 if ($fp) {
     @fwrite($fp, Bcode::benc($dict), strlen(Bcode::benc($dict)));
     fclose($fp);
     $db->query("INSERT INTO {PREFIX}torrents_files (file_torrent, file_name, file_size) VALUES " . file_list($filelist, $id));
     if (isset($_POST['imdb']) && !empty($_POST['imdb'])) {
         $link = $_POST['imdb'];
     } else {
         $link = $descr;
     }
     $m = preg_match("/tt\\d{7}/", $link, $ids);
     if ($m) {
         $link = "http://www.imdb.com/title/" . $ids[0];
         $db = new DB("torrents");
         $db->torrent_imdb = $link;
         $db->update("torrent_id = '" . $db->escape($id) . "'");
         preg_match("#tt(?P<imdbId>[0-9]{7,7})#", $link, $matches);
         if (count($matches) == 0) {
             continue;
         }
Exemplo n.º 19
0
 public function GetSitemapIndexArray()
 {
     $indexArr = array();
     if (count($this->sitemapIndex) == 0) {
         $tmpArr = file_list(self::$sitemap_folder, "/\\.xml\$/i");
         foreach ($tmpArr as $key => $value) {
             $url = self::$website . str_replace(dirname(__FILE__), '', $value);
             //$url = htmlspecialchars($url, ENT_NOQUOTES, "UTF-8");
             $indexArr[$key] = $url;
         }
         //list($tmpArr)= self::$website.'/'.self::$sitemap_folder.'/'.each($tmpArr);
     } else {
         $indexArr = $this->sitemapIndex;
     }
     sort($indexArr);
     return $indexArr;
 }
Exemplo n.º 20
0
    {
        return '<textarea name="' . $name . '" id="' . $id . '" style="width: ' . $width . '; height: ' . $height . ';">' . $content . '</textarea>';
    }
} else {
    $id_list = array("content");
    require_once WB_PATH . '/modules/' . WYSIWYG_EDITOR . '/include.php';
}
// list of existing files
$wbpath = str_replace('\\', '/', WB_PATH);
$basepath = str_replace('\\', '/', WB_PATH . MEDIA_DIRECTORY . '/' . $dlgmodname);
$folder_list = directory_list($basepath);
array_push($folder_list, $basepath);
sort($folder_list);
foreach ($folder_list as $name) {
    // note: the file_list() method returns the full path
    $file_list = file_list($name, array('index.php'));
    sort($file_list);
    foreach ($file_list as $filename) {
        $thumb_count = substr_count($filename, '/thumbs/');
        if ($thumb_count == 0) {
            $data['files'][] = array(WB_URL . str_replace($wbpath, '', $filename), str_replace($basepath . '/', '', $filename));
        }
        $thumb_count = "";
    }
}
// list of existing groups
list($data['groups'], $data['gr2name']) = dlg_getgroups($section_id, false);
$data = (object) $data;
include dirname(__FILE__) . '/templates/default/backend/modify_file.phtml';
// Print admin footer
$admin->print_footer();
Exemplo n.º 21
0
        foreach ($files as $v) {
            $file_a = str_replace('file/update/' . $release . '/source/destoon/', '', $v);
            $file_b = str_replace('source/destoon/', 'backup/', $v);
            if (is_file($file_a)) {
                file_copy($file_a, $file_b);
            }
            file_copy($v, $file_a) or msg('无法覆盖' . str_replace(DT_ROOT . '/', '', $file_a) . '<br/>请设置此文件及上级目录属性为可写,然后刷新此页');
        }
        msg('文件更新成功,开始运行更新..', '?file=' . $file . '&action=cmd&release=' . $release);
        break;
    case 'cmd':
        @(include $release_dir . '/source/cmd.inc.php');
        msg('更新运行成功', '?file=' . $file . '&action=finish&release=' . $release);
        break;
    case 'finish':
        msg('系统更新成功 当前版本V' . DT_VERSION . ' R' . DT_RELEASE, '?file=cloud&action=update', 2);
        break;
    case 'undo':
        is_file($release_dir . '/backup/version.inc.php') or msg('此版本备份文件不存在,无法还原', '?file=cloud&action=update', 2);
        @(include $release_dir . '/source/cmd.inc.php');
        $files = file_list($release_dir . '/backup');
        foreach ($files as $v) {
            file_copy($v, str_replace('file/update/' . $release . '/backup/', '', $v));
        }
        msg('系统还原成功', '?file=cloud&action=update', 2);
        break;
    default:
        $release > DT_RELEASE or msg('当前版本不需要运行此更新', '?file=cloud&action=update', 2);
        msg('在线更新已经启动,开始下载更新..', '?file=' . $file . '&action=download&release=' . $release, 2);
        break;
}
Exemplo n.º 22
0
<?php
$allowed = array('admin');
require("../site_init.php");
require("site_credentials.php");
$smarty->caching = 0;

$data['flags'] = $ar_countries;
$data['privs'] = $ar_priv;
$heads = file_list("../img/heads/","png"); /*Get heads on img folder*/

foreach ($heads as $key => $value)
	if (!preg_match("/_h.png/i", $value)) $data['heads'][$value] = $value; 
	
$smarty->assign($data);

if (isset($_POST['edita_grava'])) {
	$id = intval($_POST['id']);
	$password = $_POST['password'];
	$password2 = $_POST['repassword'];
	$nome = $_POST['nome'];
	$username = cleanquery($_POST['username']);
	$name = $_POST['name'];
	$image = $_POST['image'];
	$head = $_POST['head'];
	$from = $_POST['from'];
	$in = $_POST['in'];
	$location = $_POST['location'];
	$aupairloc = $_POST['aupairloc'];
	$priv = $_POST['priv'];
	//echo $id;exit;
	if ($id=='' && $password=='') { /*USER MUST HAVE A PASSWORD*/
Exemplo n.º 23
0
  '"mysql_fetch_array()","for()","mysql_pconnect()","mysql_select_db()","number_format()","stripos()","array_search()","is_dir()","opendir()","while()","readdir()","closedir()","unlink()","fopen()","fwrite()",'.
  '"fclose()","chmod()","session_id()","parse_str()","debug_print_backtrace()","mail()","func_get_args()","print_r()","curl_setopt()","gmmktime()","floor()","sscanf()","mktime()","preg_replace()","strip_tags()",'.
  '"is_null()","preg_replace_callback()","create_function()","array_reverse()","addslashes()","html()","tabs()","authurl()","epitwitter()","getauthenticateurl()","scripturi()","settoken()","getaccesstoken()",'.
  '"get_accountverify_credentials()","getattributes()","ksort()","init()","subscribe()","reload()","file_get_contents()","validate()","attr()","css()","append()","button()","parse_url()","confirm()","new()",'.
  '"senttourl()","elseif()","catch()","getmessage()","typefunction()","loadthread()","deletecomment()","nl2br()","springcomment()","springvote()","postvote()","cancelvote()","closecommentifempty()","postcomment()",'.
  '"autoresize()","fadeto()","alert()","prepend()","rowcallback2()","chdir()","dirname()","fadeout()","callback()","handlerfunc()","mysql_connect()","mysql_errno()","phpversion()","base64_encode()",'.
  '"controllerclassname()","modelclassname()","memory_get_peak_usage()","array_merge()","bin2hex()","complete()","define()","error()","func_name()","getcwd()","getfile()",'.
  '"getline()","masonry()","set_exception_hander()","shell_exec()","str_word_count()","substr_count()","sum()","set_exception_handler()"]', true)
  as $b) $builtIn[$b] = true;
  
foreach(explode(',', 
  'cqrequest,datetimetostring,datetostring,db_gettables,db_stripprefix,do_fb_login,from,readstringlistfile,send_mail,stringlisttotext,get_user_timeoffset,strip_tags_attributes,'.
  'texttostringlist'
  ) as $b) $ignoreCallCheck[$b.'()'] = true;

foreach(file_list('./', null, true) as $k => $v) if((!strStartsWith($k, './ext') || strStartsWith($k, './ext/installer')) && 
  !strStartsWith($k, './lib/predef/') && (inStr($k, '.php') || inStr($k, '.js')))
{
  $file_id++;
  $parse2['files'][$file_id] = $k;
  foreach(explode(' ', str_replace(
    array(')', '$', ']', '"', ')', '=', "'", '[', ':', '!', '*', '+', '-', '@', '#', '/', '>', chr(10), ',', '.', '(', 'function '), 
    array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '( ', 'function_'), file_get_contents($k))) as $word)
  {
    $word = trim(strtolower($word));
    if(inStr($word, '(') && strlen($word) > 2 && $word[0]!='$')
    {
      if(strStartsWith($word, 'function_')) 
        $parse['func'][substr($word, 9).')'] = $file_id;
      else 
        if(substr($word, 0, 1) != '{') $parse['call'][$word.')'] = $file_id;
Exemplo n.º 24
0
function category_list($message = "")
{
    pagetop(gTxt('categories'), $message);
    $out = array('<table cellspacing="20" align="center">', '<tr>', tdtl(article_list(), ' class="categories"'), tdtl(link_list(), ' class="categories"'), tdtl(image_list(), ' class="categories"'), tdtl(file_list(), ' class="categories"'), '</tr>', endTable());
    echo join(n, $out);
}
Exemplo n.º 25
0
function file_change_max_size()
{
    // DEPRECATED function; removed old code
    file_list();
}
Exemplo n.º 26
0
function file_change_max_size()
{
    $qty = gps('qty');
    safe_update('txp_prefs', "val={$qty}", "name='file_max_upload_size'");
    file_list();
}
Exemplo n.º 27
0
/**
 *
 **/
function manage_backups()
{
    global $admin, $parser, $database, $settings, $MOD_DROPLET;
    $groups = $admin->get_groups_id();
    if (!is_allowed('Manage_backups', $groups)) {
        $admin->print_error($MOD_DROPLET["You don't have the permission to do this"]);
    }
    $rows = array();
    $info = NULL;
    // recover
    if (isset($_REQUEST['recover']) && file_exists(dirname(__FILE__) . '/export/' . $_REQUEST['recover'])) {
        $temp_unzip = LEPTON_PATH . '/temp/unzip/';
        $result = droplet_install(dirname(__FILE__) . '/export/' . $_REQUEST['recover'], $temp_unzip);
        $info = sprintf($MOD_DROPLET['Successfully imported [{{count}}] Droplet(s)'], array('count' => $result['count']));
    }
    // delete single backup
    if (isset($_REQUEST['delbackup']) && file_exists(dirname(__FILE__) . '/export/' . $_REQUEST['delbackup'])) {
        unlink(dirname(__FILE__) . '/export/' . $_REQUEST['delbackup']);
        $info = str_replace("{{file}}", $_REQUEST['delbackup'], $MOD_DROPLET['Backup file deleted: {{file}}']);
    }
    // delete a list of backups
    // get all marked droplets
    $marked = isset($_POST['markeddroplet']) ? $_POST['markeddroplet'] : array();
    if (count($marked)) {
        $deleted = array();
        foreach ($marked as $file) {
            $file = dirname(__FILE__) . '/export/' . $file;
            if (file_exists($file)) {
                unlink($file);
                $deleted[] = str_replace("{{file}}", basename($file), $MOD_DROPLET['Backup file deleted: {{file}}']);
            }
        }
        if (count($deleted)) {
            $info = implode('<br />', $deleted);
        }
    }
    $backups = file_list(dirname(__FILE__) . '/export', array('index.php'));
    if (count($backups) > 0) {
        // sort by name
        sort($backups);
        foreach ($backups as $file) {
            // stat
            $stat = stat($file);
            // get zip contents
            require_once LEPTON_PATH . '/modules/lib_lepton/pclzip/pclzip.lib.php';
            $oZip = new PclZip($file);
            $count = $oZip->listContent();
            $rows[] = array('name' => basename($file), 'size' => $stat['size'], 'date' => strftime('%c', $stat['ctime']), 'files' => count($count), 'listfiles' => implode(", ", array_map(create_function('$cnt', 'return $cnt["filename"];'), $count)), 'download' => LEPTON_URL . '/modules/droplets/export/' . basename($file));
        }
    }
    echo $parser->render('@droplets/backups.lte', array('rows' => $rows, 'info' => $info, 'backups' => count($backups) ? 1 : NULL, 'num_rows' => count($rows)));
}
        // Add a "Log out of Google Drive" button.
        $C .= '<a class="btn" title="Disconnect your Pika CMS account from Google Drive." href="' . $base_url . '/pm.php/google_drive_connector/auth.php?action=unauthorize&username='******'username']);
        $C .= '" target="_blank">Disconnect Drive</a>';
        /* TODO:  Use this button once Pika CMS is using a version of Bootstrap 
        		that includes Font Awesome <i class="icon-signout"></i>
        		*/
        $C .= '
		</div>
	</div>
	</form>';
    } else {
        $clean_username = htmlspecialchars($auth_row['username']);
        $C .= '<p>To upload and view case-related files, you need to connect your Pika CMS account to your Google account. To do so, <a class=""';
        $C .= ' onClick=\'window.open("' . $base_url . '/pm.php/google_drive_connector/auth.php?action=authenticate", "Request for Authorization", "width=450, height=500, scrollbars=yes");\'';
        $C .= '><strong>click here to log into Google Drive</strong></a>.</p>';
        $C .= '<p><em>Please reload or refresh this page once you have logged in</em>.</p>';
    }
    // End Drive Upload Form
    require_once getcwd() . '-custom/extensions/google_drive_connector/file_list.php';
    $a['file_list'] = file_list($case1->google_drive_folder_id, null, $case1->google_drive_folder_id);
    $template = new pikaTempLib('subtemplates/case-drive.html', $a);
    $C .= $template->draw();
    // Handle Drive uploads
    // TODO Move this elsewhere
    if (array_key_exists('file_upload', $_FILES)) {
        $rest = new PikaDrive($auth_row['username']);
        $y = $rest->uploadFile($_FILES['file_upload']['tmp_name'], $_FILES['file_upload']['name'], htmlspecialchars($_POST['folder_id']));
        // $_POST['title'], $_POST['folder_id'])
    }
}
Exemplo n.º 29
0
 public function GenerateFilename($prefix, $curFilename)
 {
     $newFilename = $curFilename;
     $match = array();
     $sitemapFolder = self::$sitemap_folder;
     $tmpArr = file_list($sitemapFolder, "/^(.*){$prefix}(.*)\\.xml\$/i");
     foreach ($tmpArr as $key => $value) {
         $filename = str_replace("{$sitemapFolder}/{$prefix}-", '', $value);
         $filename = str_replace('.xml', '', $filename);
         preg_match_all("/^{$curFilename}\\d*\$/", $filename, $m);
         if (!empty($m[0])) {
             $match[] = $m[0][0];
         }
     }
     sort($match);
     $matchLen = count($match);
     if ($matchLen > 0) {
         $newFilename = sprintf("{$curFilename}%s", str_replace($curFilename, '', $match[$matchLen - 1]) + 1);
     }
     return $newFilename;
 }
Exemplo n.º 30
0
<?php

require_once 'config/tank_config.php';
$getjson = file_get_contents('php://input');
$dataarr = json_decode($getjson, true);
$token = $dataarr['token'];
$tab = $dataarr['tab'];
$pid = $dataarr['pid'];
$projectid = $dataarr['projectid'];
$uid = check_token($token);
if ($uid != 3) {
    $get_function = file_list($uid, "0", $projectid, $pid, $tab);
    $redata = json_encode($get_function);
    echo $redata;
} else {
    echo 3;
}