function getFileList($path)
{
    global $list;
    global $i;
    $directory = dir($path);
    while ($entry = $directory->read()) {
        if ($entry != "." && $entry != "..") {
            if (Is_Dir($path . "/" . $entry) && !eregi("__zbSessionTMP", $path . "/" . $entry)) {
                getFileList($path . "/" . $entry);
            } else {
                if (!eregi("now_connect.php", $path . "/" . $entry) && !eregi("now_member_connect.php", $path . "/" . $entry) && !eregi("__zbSessionTMP", $path . "/" . $entry)) {
                    $list[] = str_replace("../", "", $path . "/" . $entry);
                    echo ".";
                    $i++;
                    if ($i > 100) {
                        $i = 0;
                        echo "\n\t\t";
                    }
                }
                flush();
            }
        }
    }
    $directory->close();
}
예제 #2
0
파일: Comp.php 프로젝트: carriercomm/jbs
function Comp_Load($Element)
{
    /****************************************************************************/
    $__args_types = array('string', '*');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HostsIDs = System_HostsIDs(SPrintF('comp/%s.comp.php', $Element));
    if (Is_Error($HostsIDs)) {
        return ERROR | @Trigger_Error('[Comp_Load]: не возможно найти компонент');
    }
    #-----------------------------------------------------------------------------
    $IsCascade = In_Array(COMP_ALL_HOSTS, $__args__, TRUE);
    #-----------------------------------------------------------------------------
    if ($IsCascade) {
        $HostsIDs = Array_Reverse($HostsIDs);
    }
    #-----------------------------------------------------------------------------
    $Result = array();
    #-----------------------------------------------------------------------------
    foreach ($HostsIDs as $HostID) {
        #---------------------------------------------------------------------------
        $Path = SPrintF('%s/hosts/%s/comp/%s.comp.php', SYSTEM_PATH, $HostID, $Element);
        #---------------------------------------------------------------------------
        if (Is_Dir($Path)) {
            return ERROR | @Trigger_Error('[Comp_Load]: объект не является компонентом');
        }
        #---------------------------------------------------------------------------
        $Args = $__args__;
        #---------------------------------------------------------------------------
        Array_UnShift($Args, $Path);
        #---------------------------------------------------------------------------
        $Comp = Call_User_Func_Array('LoadComp', $Args);
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error('[Comp_Load]: не возможно загрузить компонент');
        }
        #---------------------------------------------------------------------------
        if ($IsCascade) {
            $Result[] = $Comp;
        } else {
            #-------------------------------------------------------------------------
            $Result = $Comp;
            #-------------------------------------------------------------------------
            break;
        }
    }
    #-----------------------------------------------------------------------------
    $Loaded =& Link_Get('Comp/Loaded', 'array');
    #-----------------------------------------------------------------------------
    $Loaded[] = $Element;
    #-----------------------------------------------------------------------------
    return $Result;
}
예제 #3
0
 function get_subfolder($directory)
 {
     $arr_folder = (array) Glob($directory . '{,.}*', GLOB_BRACE + GLOB_ONLYDIR);
     $sort_order = array();
     foreach ($arr_folder as $index => $folder) {
         $path = RealPath($folder) . '/';
         if (!Is_Dir($path) || BaseName($folder) == '.' || BaseName($folder) == '..') {
             unset($arr_folder[$index]);
         } else {
             $arr_folder[$index] = $path;
             $sort_order[$index] = StrToLower($folder);
         }
     }
     Array_Multisort($sort_order, $arr_folder);
     return $arr_folder;
 }
예제 #4
0
function RmDirR($xdir)
{
    $d = dir($xdir);
    while ($entry = $d->read()) {
        if ($entry != "." && $entry != "..") {
            if (Is_Dir($xdir . "/" . $entry)) {
                RmDirR($xdir . "/" . $entry);
            } else {
                echo "Deleting {$xdir}/{$entry}<br>\n";
                UnLink($xdir . "/" . $entry);
            }
        }
    }
    $d->close();
    RmDir($xdir);
}
예제 #5
0
 function getModulesList()
 {
     $dir = openDir(DIR_MODULES);
     $lst = array();
     while ($file = readDir($dir)) {
         if (Is_Dir(DIR_MODULES . "{$file}") && $file != "." && $file != "..") {
             $rec = array();
             $rec['FILENAME'] = $file;
             $lst[] = $rec;
         }
     }
     $this->modules = $lst;
     return $lst;
 }
예제 #6
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($parent_name = "")
 {
     if (!Is_Dir(ROOT . "./saverestore")) {
         mkdir(ROOT . "./saverestore", 0777);
     }
     parent::install($parent_name);
 }
예제 #7
0
 function copyFiles($source, $destination, $over = 0, $patterns = 0)
 {
     $res = 1;
     if (!Is_Dir($source)) {
         return 0;
         // cannot create destination path
     }
     if (!Is_Dir($destination)) {
         if (!mkdir($destination)) {
             return 0;
             // cannot create destination path
         }
     }
     if ($dir = @opendir($source)) {
         while (($file = readdir($dir)) !== false) {
             if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..') {
                 //$res=$this->copyTree($source."/".$file, $destination."/".$file, $over, $patterns);
             } elseif (Is_File($source . "/" . $file) && (!file_exists($destination . "/" . $file) || $over)) {
                 if (!is_array($patterns)) {
                     $ok_to_copy = 1;
                 } else {
                     $ok_to_copy = 0;
                     $total = count($patterns);
                     for ($i = 0; $i < $total; $i++) {
                         if (preg_match('/' . $patterns[$i] . '/is', $file)) {
                             $ok_to_copy = 1;
                         }
                     }
                 }
                 if ($ok_to_copy) {
                     $res = copy($source . "/" . $file, $destination . "/" . $file);
                 }
             }
         }
         closedir($dir);
     }
     return $res;
 }
예제 #8
0
/**
* Install
*
* Module installation routine
*
* @access private
*/
 function install() {
  if (!Is_Dir(ROOT."./saverestore")) {
   mkdir(ROOT."./saverestore", 0777);
  }
  parent::install();
 }
예제 #9
0
 function getTree($source, $recursive = 0, $mask = '')
 {
     $res = array();
     $orig_mask = $mask;
     if (!$mask) {
         $mask = '*';
     }
     $mask = preg_quote($mask);
     $mask = str_replace('\\*', '.*?', $mask);
     $mask = '^' . $mask . '$';
     if (!Is_Dir($source)) {
         return 0;
         // incorrect source path
     }
     if ($dir = @opendir($source)) {
         while (($file = readdir($dir)) !== false) {
             if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..' && $recursive) {
                 $res2 = $this->getTree($source . "/" . $file, $recursive, $orig_mask);
                 foreach ($res2 as $k => $v) {
                     $res[$k] = $v;
                 }
             } elseif (Is_File($source . "/" . $file) && preg_match('/' . $mask . '/', $file)) {
                 $res[$source . "/" . $file] = array('FILENAME' => $file, 'SIZE' => filesize($source . "/" . $file), 'MTIME' => filemtime($source . "/" . $file));
             }
         }
         closedir($dir);
     }
     return $res;
 }
예제 #10
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./cms/calendar")) {
         mkdir(ROOT . "./cms/calendar", 0777);
     }
     parent::install();
 }
예제 #11
0
/**
* Install
*
* Module installation routine
*
* @access private
*/
 function install() {
  if (!Is_Dir(ROOT."./settings")) {
   mkdir(ROOT."./settings", 0777);
  }
  parent::install();
 }
예제 #12
0
 function files($parameters="") {
  global $REQUEST_URI;
  global $out;
  global $mode;

  $dir=str_replace('\\\'', "'", $_SERVER['REQUEST_URI']);
  $dir=preg_replace("/^\/.*?\//", "./", $dir);
  $dir=preg_replace("/\?.*?$/", "", $dir);
  $dir=urldecode($dir);

  //echo utf2win($dir);
  //exit;

  $paths=split("/", $dir);
  $old="";
  $history=array();
  foreach($paths as $v) {
   if ($v=="") continue;
   if ($v==".") continue;
   $rec=array();
   $rec['TITLE']=$v;
   $rec['PATH']=$old."$v/";
   $old.="$v/";
   $history[]=$rec;
  }
  $out['HISTORY']=$history;
  $out['CURRENT_DIR_TITLE']=($dir);
  $out['CURRENT_DIR']=urlencode($dir);

  $act_dir=INIT_DIR."$dir";

  if (@$mode=="descr") {
   global $file;
   global $new_descr;
   global $REMOTE_ADDR;
   global $can_edit;
   if (strpos($can_edit, $REMOTE_ADDR)>0) setDescription($act_dir, $file, $new_descr);
   $mode="";
   header("Location:?\n\n");
   exit;
  }

  $descriptions=getDescriptions($act_dir);

  $d=openDir($act_dir);
  $dirs=array();
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..")) {
    continue;
   }
   if (Is_Dir($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    $rec['TITLE_SHORT']=$rec['TITLE'];
    if (strlen($rec['TITLE_SHORT'])>30) {
     $rec['TITLE_SHORT']=substr($rec['TITLE_SHORT'], 0, 30).'...';
    }
    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    $rec['PATH']=urlencode("$file").'/';
    $rec['REAL_PATH']=$dir.$file;
    $dirs[]=$rec;
   }
  }
  closeDir($d);

  $dirs=mysort_array($dirs, "TITLE");

  if (count($dirs)>0) $out['DIRS']=$dirs;

  $d=openDir($act_dir);
  $files=array();
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..") || ($file=="Descript.ion")) {
    continue;
   }
   if (Is_File($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    if (strlen($rec['TITLE'])>30) {
     $rec['TITLE_SHORT']=substr($rec['TITLE'], 0, 30)."...";
    } else {
     $rec['TITLE_SHORT']=$rec['TITLE'];
    }
    $rec['PATH']="$file";
    $size=filesize($act_dir.$file);
    $total_size+=$size;
    if ($size>1024) {
     if ($size>1024*1024) {
      $size=(((int)(($size/1024/1024)*10))/10)." Mb";
     } else {
      $size=(int)($size/1024)." Kb";
     }
    } else {
     $size.=" b";
    }
    $rec['SIZE']=$size;
    $files[]=$rec;
   }
  }
  closeDir($d);

  $files=mysort_array($files, "TITLE");

  if (count($files)>0) $out['FILES']=$files;
  $out['TOTAL_FILES']=count($files);
  $out['TOTAL_DIRS']=count($dirs);

    if ($total_size>1024) {
     if ($total_size>1024*1024) {
      $total_size=(((int)(($total_size/1024/1024)*10))/10)." Mb";
     } else {
      $total_size=(int)($total_size/1024)." Kb";
     }
    } else {
     $total_size.=" b";
    }
    $out['TOTAL_SIZE']=$total_size;
 }
예제 #13
0
 public function Install_Template()
 {
     # Was this a Post request with data enctype?
     if (!Is_Array($_FILES) || empty($_FILES)) {
         return False;
     }
     # Check the files
     foreach ($_FILES as $field_name => $arr_file) {
         if (!Is_File($arr_file['tmp_name'])) {
             unset($_FILES[$field_name]);
         }
     }
     # Check if there are uploaded files
     if (empty($_FILES)) {
         return False;
     }
     # Create template dir
     if (!Is_Dir($this->template_dir)) {
         MkDir($this->template_dir);
         ChMod($this->template_dir, 0755);
     }
     # Copy the template file
     if (isset($_FILES['template_zip'])) {
         # Install the ZIP Template
         $zip_file = $_FILES['template_zip']['tmp_name'];
         require_once 'includes/file.php';
         WP_Filesystem();
         return UnZip_File($zip_file, $this->template_dir);
     } elseif (isset($_FILES['template_php']) && $this->Get_Template_Properties($_FILES['template_php']['tmp_name'])) {
         # Install the PHP Template
         $php_file = $_FILES['template_php']['tmp_name'];
         $template_name = BaseName($_FILES['template_php']['name'], '.php');
         # Create dir and copy file
         if (!Is_Dir($this->template_dir . '/' . $template_name)) {
             MkDir($this->template_dir . '/' . $template_name);
             ChMod($this->template_dir . '/' . $template_name, 0755);
         }
         Copy($php_file, $this->template_dir . '/' . $template_name . '/' . $template_name . '.php');
         ChMod($this->template_dir . '/' . $template_name . '/' . $template_name . '.php', 0755);
     } else {
         return False;
     }
     # Template installed
     return True;
 }
예제 #14
0
파일: IO.php 프로젝트: carriercomm/jbs
function IO_RmDir($Folder)
{
    #-------------------------------------------------------------------------------
    $Folder = Preg_Replace('/\\/{2,}/', '/', rTrim($Folder, '/'));
    #-------------------------------------------------------------------------------
    if (StrPos(SPrintF('/%s/', $Folder), SYSTEM_PATH) === FALSE) {
        return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка безопасности при удалении (%s)', $Folder));
    }
    #-------------------------------------------------------------------------------
    $Entities = IO_Scan($Folder, FALSE);
    if (Is_Error($Entities)) {
        return ERROR | @Trigger_Error('[IO_RmDir]: не удалось получить содержимое папки');
    }
    #-------------------------------------------------------------------------------
    if (Count($Entities)) {
        #-------------------------------------------------------------------------------
        foreach ($Entities as $Entity) {
            #-------------------------------------------------------------------------------
            $Entity = SPrintF('%s/%s', $Folder, $Entity);
            #-------------------------------------------------------------------------------
            if (Is_Dir($Entity)) {
                #-------------------------------------------------------------------------------
                if (Is_Error(IO_RmDir($Entity))) {
                    return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка рекурсивного вызова при удалении (%s)', $Entity));
                }
                #-------------------------------------------------------------------------------
            } else {
                #-------------------------------------------------------------------------------
                if (!UnLink($Entity)) {
                    return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении файла (%s)', $Entity));
                }
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    if (!@RmDir($Folder)) {
        return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении директории (%s)', $Folder));
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return TRUE;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
}
예제 #15
0
파일: index.php 프로젝트: carriercomm/jbs
     if (!@UnLink(SETTINGS_FILE)) {
         Error(SPrintF('Не возможно удалить файл (%s)', SETTINGS_FILE));
     }
 }
 #-------------------------------------------------------------------------------
 if (!Count($__ERRORS)) {
     #-------------------------------------------------------------------------------
     $Files = array('INSTALL', 'install.settings', 'install.my.cnf', 'install/index.php', 'install');
     #-------------------------------------------------------------------------------
     foreach ($Files as $File) {
         #-------------------------------------------------------------------------------
         $File = SPrintF('%s/%s', SYSTEM_PATH, $File);
         #-------------------------------------------------------------------------------
         if (File_Exists($File)) {
             #-------------------------------------------------------------------------------
             if (Is_Dir($File)) {
                 #-------------------------------------------------------------------------------
                 if (!@RmDir($File)) {
                     Error(SPrintF('Не возможно удалить директорию (%s)', $File));
                 }
                 #-------------------------------------------------------------------------------
             } else {
                 #-------------------------------------------------------------------------------
                 if (!@UnLink($File)) {
                     Error(SPrintF('Не возможно удалить файл (%s)', $File));
                 }
                 #-------------------------------------------------------------------------------
             }
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
예제 #16
0
 /**
 * Module tag parsing
 *
 * Used to include other object-modules in current workspace
 *
 * @access private
 * @param string $res template strings
 * @param array $hash data params
 * @param string $dir current template directory (for correct [#inc ...#] tags parsing)
 */
 function parseModules(&$res, &$hash, $dir)
 {
     global $md;
     global $inst;
     $instance = $inst;
     if (preg_match_all('/\\[#module (.*?)#\\]/', $res, $matches, PREG_PATTERN_ORDER)) {
         $count_matches_0 = count($matches[0]);
         for ($i = 0; $i < $count_matches_0; $i++) {
             $data = $matches[1][$i];
             $tmp = "";
             // reading module data from module including directive
             $module_data = array();
             if (preg_match_all('/(\\w+?)="(.*?)"/i', $data, $matches1, PREG_PATTERN_ORDER)) {
                 $count_matches1_0 = count($matches1[0]);
                 for ($k = 0; $k < $count_matches1_0; $k++) {
                     $key = $matches1[1][$k];
                     $value = $matches1[2][$k];
                     if ($key == "template") {
                         $value = $dir . $value;
                     }
                     $module_data[$key] = $value;
                 }
             }
             if (file_exists(DIR_MODULES . $module_data["name"] . '/' . $module_data["name"] . ".class.php") || class_exists($module_data["name"])) {
                 // including module class
                 if (!class_exists($module_data["name"])) {
                     include_once DIR_MODULES . $module_data["name"] . '/' . $module_data["name"] . ".class.php";
                 }
                 // creating code for module creation and running
                 $obj = "\$object{$i}";
                 $code = "";
                 $code .= "{$obj}=new " . $module_data["name"] . ";\n";
                 $code .= $obj . "->owner=&\$this->owner;\n";
                 // setting module parameters from module including directive
                 foreach ($module_data as $k => $v) {
                     if ($k == "name") {
                         continue;
                     }
                     $code .= $obj . "->" . $k . "='" . addslashes($v) . "';\n";
                 }
                 // setting other module parameters
                 // if current request is to this module, then run get params otherwise get params from encoded query
                 if ($md != $module_data["name"] || $module_data["instance"] != '' && $module_data["instance"] != $instance && $instance != '') {
                     // restoring module params from coded string (module should not overwrite this method)
                     $code .= $obj . "->restoreParams();\n";
                 } elseif ($module_data["name"] == $md && ($module_data["instance"] == '' || $module_data["instance"] == $instance || $instance == '')) {
                     // getting module params from query string (every module should handle this method)
                     $code .= $obj . "->getParams();\n";
                 }
                 // repeating module set parameters for security reasons
                 foreach ($module_data as $k => $v) {
                     if ($k == "name") {
                         continue;
                     }
                     $code .= $obj . "->" . $k . "='" . addslashes($v) . "';\n";
                 }
                 StartMeasure("module_" . $module_data["name"]);
                 if (SETTINGS_SITE_LANGUAGE && file_exists(ROOT . 'languages/' . $module_data["name"] . '_' . SETTINGS_SITE_LANGUAGE . '.php')) {
                     include_once ROOT . 'languages/' . $module_data["name"] . '_' . SETTINGS_SITE_LANGUAGE . '.php';
                 }
                 if (file_exists(ROOT . 'languages/' . $module_data["name"] . '_default.php')) {
                     include_once ROOT . 'languages/' . $module_data["name"] . '_default.php';
                 }
                 // run module and insert module result in template
                 $code .= $obj . "->run();\n";
                 $code .= "\$tmp=" . $obj . "->result;\n";
                 eval($code);
                 EndMeasure("module_" . $module_data["name"]);
             } else {
                 // module class file was not found
                 global $current_installing_module;
                 $rep_ext = '';
                 if (preg_match('/\\.dev/is', $_SERVER['HTTP_HOST'])) {
                     $rep_ext = '.dev';
                     $install_dir = "/var/projects/repository/engine_2.x/modules/";
                 }
                 if (preg_match('/\\.jbk/is', $_SERVER['HTTP_HOST'])) {
                     $rep_ext = '.jbk';
                     $install_dir = "d:/jey/projects/repository/engine_2.x/modules/";
                 }
                 if (!$current_installing_module[$module_data["name"]] && $rep_ext != '' && @Is_Dir($install_dir . $module_data["name"])) {
                     //$tmp="<div><iframe src=\"http://installer.dev/installer.php?host=".$_SERVER['HTTP_HOST']."&doc_root=".$_SERVER['DOCUMENT_ROOT']."&mode=install&modules[]=".$module_data["name"]."\" width=100% height=100></iframe></div>";
                     $wnd_name = "win" . rand(1, 10000000);
                     $tmp = "<script language='javascript' type='text/JavaScript'>wnd=window.open(\"http://installer" . $rep_ext . "/installer.php?host=" . $_SERVER['HTTP_HOST'] . "&doc_root=" . $_SERVER['DOCUMENT_ROOT'] . "&mode=install&modules[]=" . $module_data["name"] . "\", \"" . $wnd_name . "\", \"height=400,width=400\");</script>";
                     $current_installing_module[$module_data["name"]] = 1;
                     echo $tmp;
                 } else {
                     $tmp = "<p align=center><font color='red'><b>Module \"" . $module_data["name"] . "\" not found</b> (" . str_replace('#', '', $matches[0][$i]) . ")</font></p>";
                 }
             }
             //echo $matches[0][$i];
             //echo htmlspecialchars($tmp)."\n\n";
             $res = str_replace($matches[0][$i], $tmp, $res);
         }
     }
 }
예제 #17
0
function getFilesTree($destination, $sort = 'name')
{
    if (substr($destination, -1) == '/' || substr($destination, -1) == '\\') {
        $destination = substr($destination, 0, strlen($destination) - 1);
    }
    $res = array();
    if (!Is_Dir($destination)) {
        return $res;
    }
    if ($dir = @opendir($destination)) {
        while (($file = readdir($dir)) !== false) {
            if (Is_Dir($destination . "/" . $file) && $file != '.' && $file != '..') {
                $tmp = getFilesTree($destination . "/" . $file);
                if (is_array($tmp)) {
                    foreach ($tmp as $elem) {
                        $res[] = $elem;
                    }
                }
            } elseif (Is_File($destination . "/" . $file)) {
                $res[] = $destination . "/" . $file;
            }
        }
        closedir($dir);
    }
    if ($sort == 'name') {
        sort($res, SORT_STRING);
    }
    return $res;
}
예제 #18
0
<?php

// Send Header Mime type
Header('Content-Type: text/javascript');
// Load WordPress
$wp_load = 'wp-load.php';
while (!Is_File('wp-load.php')) {
    if (Is_Dir('../')) {
        ChDir('../');
    } else {
        die('Could not find WordPress.');
    }
}
include_once 'wp-load.php';
// Is the class ready?
if (!Class_exists('wp_plugin_fancy_gallery')) {
    die('Could not find the Fancy Gallery Plugin.');
}
/*
 * I use an anonymous function because we are in the global NameSpace.
 * You can access the "Load_Setting" function of the the plugin class via:
 * 
 * $setting = $load_setting($key, $default)
 *    
*/
$load_setting = Create_Function('$key, $default = False', 'return call_user_func(Array(\'wp_plugin_fancy_gallery\', \'load_setting\'), $key, $default);');
// Set image extensions
$arr_type = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'wbmp', 'ico');
?>
jQuery(function(){
예제 #19
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./cms/scenes")) {
         mkdir(ROOT . "./cms/scenes", 0777);
     }
     if (!Is_Dir(ROOT . "./cms/scenes/elements")) {
         mkdir(ROOT . "./cms/scenes/elements", 0777);
     }
     if (!Is_Dir(ROOT . "./cms/scenes/backgrounds")) {
         mkdir(ROOT . "./cms/scenes/backgrounds", 0777);
     }
     parent::install();
 }
예제 #20
0
<?php

/* 
 * usage: <img src="shrink.php?img=images/test.jpg&w=20&h=20">
 */
$img = $_GET['img'];
$w = $_GET['w'];
$h = $_GET['h'];
if (!defined('DIR_CACHE')) {
    define('DIR_CACHE', './image_cache/');
}
if (!Is_Dir(DIR_CACHE)) {
    mkdir(DIR_CACHE, 0777);
}
#IMAGE RESIZE AND SAVE TO FIT IN $new_width x $new_height
if (file_exists($img)) {
    $thumb = strtolower(preg_replace('/\\W/is', "_", "{$img} {$w} {$h}"));
    $changed = 0;
    if (!is_file($img)) {
        $img = "image01.jpg";
    }
    if (file_exists($img) && file_exists(DIR_CACHE . $thumb)) {
        $mtime1 = filemtime(DIR_CACHE . $thumb);
        $mtime2 = filemtime($img);
        if ($mtime2 > $mtime1) {
            $changed = 1;
        }
    } elseif (!file_exists(DIR_CACHE . $thumb)) {
        $changed = 1;
    }
    if ($changed) {
예제 #21
0
#-------------------------------------------------------------------------------
if (!$ServerID) {
    $DOM->AddAttribs('Body', array('onload' => 'SettingsUpdate();'));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# IO_Scan по всем директориям servers - создать массив уникальных имён шаблонов
$HostsIDs = $GLOBALS['HOST_CONF']['HostsIDs'];
#-------------------------------------------------------------------------------
$Templates = $Array = $Array1 = $ServiceIDs = array();
#-------------------------------------------------------------------------------
foreach (Array_Reverse($HostsIDs) as $HostID) {
    #-------------------------------------------------------------------------------
    $Path = SPrintF('%s/hosts/%s/servers', SYSTEM_PATH, $HostID);
    #-------------------------------------------------------------------------------
    if (!Is_Dir($Path)) {
        continue;
    }
    #-------------------------------------------------------------------------------
    $Files = IO_Scan($Path);
    #-------------------------------------------------------------------------------
    if (Is_Error($Files)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    foreach ($Files as $File) {
        if (!In_Array($File, $Array)) {
            $Array[] = $File;
        }
    }
    #-------------------------------------------------------------------------------
예제 #22
0
 function copyTree($source, $destination, $over=0) {

  $res=1;

  if (!Is_Dir($source)) {
   return 0; // incorrect source path
  }

  if (!Is_Dir($destination)) {
   if (!mkdir($destination, 0777)) {
    return 0; // cannot create destination path
   }
  }


 if ($dir = @opendir($source)) { 
  while (($file = readdir($dir)) !== false) { 
    if (Is_Dir($source."/".$file) && ($file!='.') && ($file!='..')) {
     $res=copyTree($source."/".$file, $destination."/".$file, $over);
    } elseif (Is_File($source."/".$file) && (!file_exists($destination."/".$file) || $over)) {
     $res=copy($source."/".$file, $destination."/".$file);
    }
  }   
  closedir($dir); 
 }
 return $res;
 }
예제 #23
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($parent_name = "")
 {
     if (!Is_Dir(ROOT . "./settings")) {
         mkdir(ROOT . "./settings", 0777);
     }
     parent::install($parent_name);
 }
예제 #24
0
파일: lib.php 프로젝트: kkskipper/KNOWME
function zRmDir($path)
{
    $directory = dir($path);
    while ($entry = $directory->read()) {
        if ($entry != "." && $entry != "..") {
            if (Is_Dir($path . "/" . $entry)) {
                zRmDir($path . "/" . $entry);
            } else {
                @UnLink($path . "/" . $entry);
            }
        }
    }
    $directory->close();
    @RmDir($path);
}
/**
* FrontEnd
*
* Module frontend
*
* @access public
*/
function usual(&$out) {


   $terminals=SQLSelect("SELECT * FROM terminals WHERE CANPLAY=1 ORDER BY TITLE");
   $total=count($terminals);
   for($i=0;$i<$total;$i++) {
    //if ($terminals[$i]['NAME']==$session->data['PLAY_TERMINAL']) {
    // $terminals[$i]['SELECTED']=1;
    // $out['TERMINAL_TITLE']=$terminals[$i]['TITLE'];
    //}
   }
   $out['TERMINALS']=$terminals;
   $out['TERMINALS_TOTAL']=count($terminals);


   if ($this->mode=='play') {
    //echo $this->owner->popup;
    global $showplayer;

    $this->showplayer=1;

    if ($this->showplayer) {
     $showplayer=1;
    }
    if ($showplayer) {
     $this->showplayer=1;
     $out['SHOWPLAYER']=1;
    }
    global $terminal_id;
    $out['TERMINAL_ID']=$terminal_id;
   }

 global $collection_id;

 if ($this->collection_id) {
  $collection_id=$this->collection_id;
 }
 $this->collection_id=$collection_id;

 $out['COLLECTIONS']=SQLSelect("SELECT * FROM collections ORDER BY TITLE");

 if (count($out['COLLECTIONS'])==1) {
  $collection_id=$out['COLLECTIONS'][0]['ID'];
  $this->collection_id=$collection_id;
  $out['COLLECTIONS_TOTAL']=1;
 }



 if ($collection_id) {
  $collection=SQLSelectOne("SELECT * FROM collections WHERE ID='".(int)$collection_id."'");
  $path=($collection['PATH']);//addslashes
  $out['COLLECTION_ID']=$collection['ID']; 
 } else {
  return;
 }

 //$this->getConfig();
 //$path=$this->config['PATH'];

// echo $path;
//
  global $folder;

  if ($this->folder) {
   $folder=base64_decode($this->folder);
  } else {
   $this->folder=base64_encode($folder);
  }
  

  $favorites=SQLSelect("SELECT * FROM media_favorites WHERE 1 ORDER BY ID DESC");
  if ($favorites) {
   $total=count($favorites);
   for($i=0;$i<$total;$i++) {
    $favorites[$i]['PATH']=urlencode(utf2win($favorites[$i]['PATH']));
   }
   $out['FAVORITES']=$favorites;
  }

  $folder=str_replace('././', './', $folder);
  $path=str_replace('././', './', $path);


  $act_dir=$path.$folder;



  $out['MEDIA_PATH']=win2utf($path);
  $out['CURRENT_DIR']=win2utf('./'.$folder);
  $out['CURRENT_DIR']=str_replace('././', './', $out['CURRENT_DIR']);
  $out['CURRENT_DIR_TITLE']=$folder;

  $tmp=explode('/', $out['CURRENT_DIR']);
  $total=count($tmp);
  if ($total>0) {
   $spath='.';
   for($i=0;$i<$total;$i++) {
    $tmp_rec=array();
    $tmp_rec['TITLE']=$tmp[$i];
    $spath.='/'.$tmp_rec['TITLE'];
    $spath=str_replace('././', './', $spath);
    $tmp_rec['PATH']=urlencode(utf2win($spath).'/');
    if ($tmp_rec['TITLE']=='.') {
     $tmp_rec['TITLE']='Home';
    }
    $out['HISTORY'][]=$tmp_rec;
    //echo $tmp_rec['PATH']."<br>";
   }
   $out['CURRENT_DIR_TITLE']=($out['HISTORY'][$total-3]['TITLE'].'/'.$out['HISTORY'][$total-2]['TITLE']);
  }


  $out['CURRENT_DIR_TITLE_HTML']=urlencode($out['CURRENT_DIR_TITLE']);
  $out['CURRENT_DIR_HTML']=urlencode('./'.($folder));

  $tmp=SQLSelectOne("SELECT ID FROM media_favorites WHERE LIST_ID='".(int)$list_id."' AND COLLECTION_ID='".$collection['ID']."' AND PATH LIKE '".DBSafe($out['CURRENT_DIR'])."'");
  if ($tmp['ID']) {
   $out['FAVORITE']=1;
  }

  global $file;
  if ($file) {
   $out['FILE']=win2utf($file);
   $out['BASEFILE']=win2utf(basename($file));
   $file=str_replace('/', '\\\\', $file);
   $out['FULLFILE']=win2utf(addslashes($path).$file);
   $out['FULLFILE_S']=str_replace('\\\\', '\\', $out['FULLFILE']);
  }

  if (preg_match('/foto/is', $act_dir) || preg_match('/photo/is', $act_dir)) {
   $out['LIST_MODE']='foto';
  }

  $descriptions=$this->getDescriptions($act_dir);

  global $media_ajax;
  if ($media_ajax) {
   global $op;
   global $list_id;
   global $title;
   global $dir;

   header ("HTTP/1.0: 200 OK\n");
   header ('Content-Type: text/html; charset=utf-8');

   $tmp_path=$dir;

   if ($op=='favorite_add') {
    $rec=array();
    $rec['TITLE']=$title;
    $rec['PATH']=$tmp_path;
    $rec['LIST_ID']=(int)$list_id;
    $rec['COLLECTION_ID']=$collection_id;
    SQLInsert('media_favorites', $rec);
    echo "OK";
   }
   if ($op=='favorite_remove') {
    SQLExec("DELETE FROM media_favorites WHERE LIST_ID='".(int)$list_id."' AND COLLECTION_ID='".$collection['ID']."' AND PATH LIKE '".DBSafe($tmp_path)."'");
    echo "OK";
   }
   exit;
  }


   function sort_files($a, $b) {
    return strcmp(strtoupper($a["TITLE"]), strtoupper($b["TITLE"])); 
   }

  $dirs=array();
  //$act_dir='\\\\home\\media\\';
  //echo $act_dir;
  $d=openDir($act_dir);
  //exit;

  if ($d) {
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..")) {
    continue;
   }
   if (Is_Dir($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    $rec['TITLE_SHORT']=$rec['TITLE'];
    if (strlen($rec['TITLE_SHORT'])>50) {
     $rec['TITLE_SHORT']=substr($rec['TITLE_SHORT'], 0, 50).'...';
    }

    $rec['TITLE']=win2utf($rec['TITLE']);
    $rec['TITLE_SHORT']=win2utf($rec['TITLE_SHORT']);

    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    $rec['PATH']=urlencode(($folder.$file)).'/';
    $rec['REAL_PATH']=$dir.$file;
    $rec['ID']=md5($rec['REAL_PATH']);
    $dirs[]=$rec;
   }
  }

  closeDir($d);
  }


  //$dirs=mysort_array($dirs, "TITLE");
  usort($dirs, 'sort_files');

  //print_r($dirs);

  if (count($dirs)>0) $out['DIRS']=$dirs;

  @$d=openDir($act_dir);
  if ($d) {

  $cover=$this->getCover($act_dir);
  if ($cover) {
   $out['COVER']=$cover;
   $out['COVER_PATH']=urlencode(str_replace('\\\\', '\\', $act_dir).$cover);
  }


  $files=array();
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..") || ($file=="Descript.ion")) {
    continue;
   }
   if (Is_File($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    if (strlen($rec['TITLE'])>50) {
     $rec['TITLE_SHORT']=substr($rec['TITLE'], 0, 50)."...";
    } else {
     $rec['TITLE_SHORT']=$rec['TITLE'];
    }
    $rec['TITLE']=win2utf($rec['TITLE']);
    $rec['TITLE_SHORT']=win2utf($rec['TITLE_SHORT']);
    $rec['REAL_PATH']=($folder.$file);
    $rec['PATH']=urlencode($folder.$file);
    $rec['FULL_PATH']=urlencode(str_replace('\\\\', '\\', $act_dir).$file);
    $size=filesize($act_dir.$file);
    $total_size+=$size;
    if ($size>1024) {
     if ($size>1024*1024) {
      $size=(((int)(($size/1024/1024)*10))/10)." Mb";
     } else {
      $size=(int)($size/1024)." Kb";
     }
    } else {
     $size.=" b";
    }
    $rec['SIZE']=$size;
    $rec['ID']=md5($rec['PATH']);
    $files[]=$rec;
   }
  }
  closeDir($d);
  }

  //$files=mysort_array($files, "TITLE");
  usort($files, 'sort_files');

  if (count($files)>0) {
   $total=count($files);
   $out['TOTAL_FILES']=$total;
   for($i=0;$i<$total;$i++) {
    if (preg_match('/\.jpg$/is', $files[$i]['PATH'])) {
     $files[$i]['IS_FOTO']=1;
    }
    if (($i+1)%4==0) {
     $files[$i]['NEWROW']=1;
    }
   }
   $out['FILES']=$files;
  }



  $out['TOTAL_DIRS']=count($dirs);

    if ($total_size>1024) {
     if ($total_size>1024*1024) {
      $total_size=(((int)(($total_size/1024/1024)*10))/10)." Mb";
     } else {
      $total_size=(int)($total_size/1024)." Kb";
     }
    } else {
     $total_size.=" b";
    }
    $out['TOTAL_SIZE']=$total_size;


}
예제 #26
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./sounds")) {
         mkdir(ROOT . "./sounds", 0777);
     }
     parent::install();
 }
예제 #27
0
 function getModulesList()
 {
     $dir = openDir(DIR_MODULES);
     $lst = array();
     while ($file = readDir($dir)) {
         if (Is_Dir(DIR_MODULES . "{$file}") && $file != "." && $file != "..") {
             $rec = array();
             $rec['FILENAME'] = $file;
             $lst[] = $rec;
         }
     }
     function cmp_modules($a, $b)
     {
         return strcmp($a["FILENAME"], $b["FILENAME"]);
     }
     usort($lst, 'cmp_modules');
     $this->modules = $lst;
     return $lst;
 }
예제 #28
0
function calc_size($adr,&$total,&$dir,&$size){            
	$adr=realpath($adr);
  $dp=OpenDir($adr);

  do{
    $itm=ReadDir($dp);
    if (($itm!=".")&&($itm!="..")&&($itm!="")&&Is_Dir("$adr/$itm")){
      calc_size("$adr/$itm",$total,$dir,$size);
      $dir++;
    }
    elseif (($itm!=".")&&($itm!="..")&&($itm!="")){
      $size = $size+FileSize("$adr/$itm");
      $total++;
    }
  } while ($itm!=false);

  CloseDir($dp);
}
예제 #29
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./cms/products/")) {
         mkdir(ROOT . "./cms/products/", 0777);
     }
     parent::install();
 }
예제 #30
0
#-------------------------------------------------------------------------------
$wadata = SPrintF('%s/wadata', $waPath);
#-------------------------------------------------------------------------------
if (!Is_Link($wadata) && Is_Dir($wadata)) {
    #-------------------------------------------------------------------------------
    if (Is_Error(IO_RmDir(SPrintF('%s///wadata', $waPath)))) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$DataFolder = SPrintF('%s/WhatsApp', $Tmp);
#-------------------------------------------------------------------------------
$LogFile = SPrintF('%s/WhatsApp.%s.log', $DataFolder, Date('Y-m-d'));
#-------------------------------------------------------------------------------
if (!Is_Dir(SPrintF('%s/logs', $DataFolder))) {
    if (!MkDir(SPrintF('%s/logs', $DataFolder), 0750, true)) {
        return ERROR | @Trigger_Error(500);
    }
}
#-------------------------------------------------------------------------------
if (!Is_Link($wadata)) {
    if (!SymLink($DataFolder, $wadata)) {
        return ERROR | @Trigger_Error(500);
    }
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$WhatsAppClient = new WhatsProt($Settings['Login'], $Settings['Params']['Sender'], FALSE, TRUE, $DataFolder);
if (Is_Error($WhatsAppClient)) {
    return ERROR | @Trigger_Error(500);