示例#1
0
		if(parent) {
			parent.document.getElementById("framedir").value = '<?php 
    echo iif($dotdotdir, $dir);
    ?>
';
		}

	</script>
	<table class="border" border="0" cellspacing="0" cellpadding="4" align="center" style="width: 230px;">
		<tr>
			<td>
			  <?php 
    if ($dotdotdir) {
        ?>
					<a href="admin.php?action=cms&job=doc_select_image&dir=<?php 
        echo extract_dir($dir);
        ?>
"><img src="<?php 
        echo $tpl->img('filetypes/folder');
        ?>
" alt="" border="0" />&nbsp;<em><?php 
        echo $lang->phrase('admin_wysiwyg_prev_dir');
        ?>
</em></a><br>
					<?php 
    }
    $i = -1;
    foreach ($dirs as $i => $dirname) {
        ?>
					<a href="admin.php?action=cms&job=doc_select_image&dir=<?php 
        echo urlencode($dirname);
 function setdir($dirId)
 {
     global $config;
     if ($dirId < 1) {
         $dirId = $config['langdir'];
     }
     $dir = "language/{$dirId}";
     if (@is_dir($dir) == false) {
         $dir = "{$config['fpath']}/language/{$dirId}";
         if (@is_dir($dir) == false) {
             $dir = extract_dir(dirname(__FILE__));
             $dir = "{$dir}/language/{$dirId}";
         }
     }
     $dir = realpath($dir);
     if (file_exists($dir)) {
         $this->dirid = $dirId;
         $this->dir = $dir;
         return true;
     } else {
         return false;
     }
 }
  <tr>
   <td class="ubox" colspan="2" align="center"><input type="submit" name="Submit" value="<?php 
    echo $lang->phrase('admin_explorer_form_extract');
    ?>
"></td>
  </tr>
 </table>
</form>
	<?php 
    echo foot();
} elseif ($job == "extract2") {
    echo head();
    $file = $gpc->get('path', none);
    $dir = $gpc->get('to', none);
    set_chmod($dir, 0777, CHMOD_EX);
    $redirect = 'admin.php?action=explorer&path=' . urlencode(extract_dir($file, false));
    if (!preg_match('#\\.(tar\\.gz|tar|gz|zip)$#is', $file, $ext)) {
        error($redirect, $lang->phrase('admin_explorer_archive_is_not_supported'));
    }
    if (isset($ext[1])) {
        $extension = $ext[1];
        if ($extension == 'zip') {
            include 'classes/class.zip.php';
            $archive = new PclZip($file);
            if ($archive->extract(PCLZIP_OPT_PATH, $dir) == 0) {
                error($redirect, $archive->errorInfo(true));
            }
        } elseif ($extension == 'tar.gz') {
            gzAbortNotLoaded();
            $temp = gzTempfile($file);
            $temp = realpath($temp);
 function showContent($print = true)
 {
     global $lang;
     $dir_list = $file_list = $subdir_size_list = array();
     $total_dir_size = 0;
     if (($dir_handle = opendir($this->path)) === false) {
         error('admin.php?action=explorer', $lang->phrase('admin_explorer_could_not_open_dir') . realpath($this->path));
     }
     while (($file = @readdir($dir_handle)) !== false) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         if (is_dir($this->path . $file)) {
             $dir_list[] = $file;
             if ($this->show_subfolders_size) {
                 $stack = array($this->path . $file . '/');
                 $size = 0;
                 while (count($stack) > 0) {
                     $subdir = array_shift($stack);
                     $subdir_handle = @opendir($subdir);
                     while (($subdir_file = @readdir($subdir_handle)) !== false) {
                         if ($subdir_file == '.' || $subdir_file == '..') {
                             continue;
                         }
                         if ($this->show_subfolders_size) {
                             if (is_dir($subdir . $subdir_file)) {
                                 array_push($stack, $subdir . $subdir_file . '/');
                             }
                         }
                         $size += @filesize($subdir . $subdir_file);
                     }
                     @closedir($subdir_handle);
                 }
                 $subdir_size_list[$file] = $size;
                 $total_dir_size += $size;
             }
         } else {
             $file_list[] = $file;
             $total_dir_size += @filesize($this->path . $file);
         }
     }
     @closedir($dir_handle);
     natcasesort($dir_list);
     natcasesort($file_list);
     $total_files = count($dir_list) + count($file_list);
     $total_size = $this->formatSize($total_dir_size);
     $print_spacer = count($file_list) > 0 && count($dir_list) > 0 ? true : false;
     $page_link = $this->realPath(dirname($this->script_file) . '/' . $this->path);
     $rp = realpath($this->path);
     $root = extract_dir($this->root);
     $rp = str_replace($root, '', $rp);
     $heading_path = $this->realPath($rp);
     $heading_path_parts = explode("/", $heading_path);
     $levels = count($heading_path_parts) - 2;
     for ($heading_path = ""; $levels > -1; $levels--) {
         for ($i = 0, $path = ""; $i < $levels; $i++) {
             $path .= "../";
         }
         $link = '&amp;path=' . urlencode($this->realPath($this->path . $path));
         $heading_path .= '<a href="' . $this->script_file . $link . '">' . array_shift($heading_path_parts) . '</a>' . DIRECTORY_SEPARATOR;
     }
     $newdir = $this->script_file . '&amp;path=' . urlencode(str_replace('/\\', '/', $this->path));
     $newdir_html = '<span style="float: right;"><a class="button" href="' . $newdir . '&job=newdir">' . $lang->phrase('admin_explorer_create_new_directory') . '</a></span>';
     $html = '	   <table cellpadding="4" cellspacing="0" class="border">';
     $html .= "\n" . '		 <tr>';
     $html .= "\n" . '		   <td class="obox"><span style="float: right;"><a class="button" href="admin.php?action=explorer&amp;job=all_chmod">' . $lang->phrase('admin_explorer_check_chmod') . '</a></span>' . iif(count($dir_list) == 0, $newdir_html) . $lang->phrase('admin_explorer_filemanager') . '</td>';
     $html .= "\n" . '		 </tr>';
     $html .= "\n" . '		 <tr>';
     $html .= "\n" . '		   <td class="ubox">' . $lang->phrase('admin_explorer_directory_x') . extract_dir($this->root) . $heading_path . '</td>';
     $html .= "\n" . '		 </tr>';
     $html .= "\n" . '	   </table><br />';
     $html .= "\n" . '	   <table cellpadding="4" cellspacing="0" class="border">';
     if (count($dir_list) > 0) {
         $html .= "\n" . '		 <tr>';
         $html .= "\n" . '		   <td class="obox" colspan="5">' . $newdir_html . $lang->phrase('admin_explorer_directories') . '</td>';
         $html .= "\n" . '		 </tr>';
         $html .= "\n" . '		 <tr>';
         $html .= "\n" . '		   <td class="ubox" width="30%">' . $lang->phrase('admin_explorer_directory') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="9%">' . $lang->phrase('admin_explorer_size') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="20%">' . $lang->phrase('admin_explorer_created_on') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="8%">' . $lang->phrase('admin_explorer_chmod') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="33%">' . $lang->phrase('admin_explorer_action') . '</td>';
         $html .= "\n" . '		 </tr>';
     }
     while (($dir = array_shift($dir_list)) !== NULL) {
         $path_url = '&amp;path=' . urlencode(str_replace('/\\', '/', $this->path) . $dir . '/');
         $link = $this->script_file . $path_url;
         $size = $this->show_subfolders_size ? $this->formatSize($subdir_size_list[$dir]) : "&nbsp;";
         $chmod = get_chmod($this->path . $dir);
         $icon = $this->icons('directory');
         $html .= "\n" . '		 <tr>';
         $html .= "\n" . '		   <td class="mbox">';
         $html .= "\n" . '			 <a href="' . $link . '" target="Main">' . $icon . $dir . '</a>';
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox" align="right">';
         $html .= "\n" . '			 ' . $size;
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox">';
         $html .= "\n" . '			 ' . gmdate("d.m.y, H:i", times(filectime($this->path . $dir)));
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox" align="right">';
         $html .= "\n" . '			 ' . $chmod;
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox">';
         $html .= "\n" . '			<a class="button" href="' . $link . '&job=chmod&type=dir">' . $lang->phrase('admin_explorer_file_chmod') . '</a> <a class="button" href="' . $link . '&job=rename&type=dir">' . $lang->phrase('admin_explorer_file_rename') . '</a> <a class="button" href="' . $link . '&job=delete&type=dir">' . $lang->phrase('admin_explorer_file_delete') . '</a>';
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		 </tr>';
     }
     if ($print_spacer) {
         $html .= "\n" . '   </table><br />';
         $html .= "\n" . '   <table cellpadding="4" cellspacing="0" class="border">';
     }
     if (count($file_list) > 0) {
         $lang->assign('total_files', $total_files);
         $lang->assign('total_size', $total_size);
         $html .= "\n" . '		 <tr>';
         $html .= "\n" . '		   <td class="obox" colspan="6">' . $lang->phrase('admin_explorer_files') . '</td>';
         $html .= "\n" . '		 </tr>';
         $html .= "\n" . '		 <tr>';
         $html .= "\n" . '		   <td class="ubox" width="30%">' . $lang->phrase('admin_explorer_toal_files') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="7%">' . $lang->phrase('admin_explorer_size') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="12%">' . $lang->phrase('admin_explorer_last_modified') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="12%">' . $lang->phrase('admin_explorer_created_on') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="7%">' . $lang->phrase('admin_explorer_chmod') . '</td>';
         $html .= "\n" . '		   <td class="ubox" width="33%">' . $lang->phrase('admin_explorer_action') . '</td>';
         $html .= "\n" . '		 </tr>';
     }
     while (($file = array_shift($file_list)) !== NULL) {
         $extension = preg_replace("/^.*?\\.(\\w{1,8})\$/", "\\1", $file);
         $path_url = '&amp;path=' . urlencode(str_replace('/\\', '/', $this->path) . $file);
         $link = $this->script_file . $path_url;
         $icon = $this->icons($extension);
         $html .= "\n" . '		 <tr>';
         $html .= "\n" . '		   <td class="mbox">';
         $html .= "\n" . '			 <a href="' . str_replace('/\\', '/', $this->path) . $file . '">' . $icon . $file . '</a>';
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox" align="right">';
         $html .= "\n" . '			 ' . $this->formatSize(filesize($this->path . $file));
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox">';
         $html .= "\n" . '			 ' . gmdate("d.m.y, H:i", times(filemtime($this->path . $file)));
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox">';
         $html .= "\n" . '			 ' . gmdate("d.m.y, H:i", times(filectime($this->path . $file)));
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox" align="right">';
         $html .= "\n" . '			 ' . get_chmod($this->path . $file);
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		   <td class="mbox">';
         $html .= "\n" . '			 <a class="button" href="' . $link . '&job=chmod">' . $lang->phrase('admin_explorer_file_chmod') . '</a> <a class="button" href="' . $link . '&job=rename">' . $lang->phrase('admin_explorer_file_rename') . '</a> <a class="button" href="' . $link . '&job=delete">' . $lang->phrase('admin_explorer_file_delete') . '</a>';
         $html .= iif(in_array($extension, $this->extract), ' <a class="button" href="' . $link . '&job=extract">' . $lang->phrase('admin_explorer_file_extract') . '</a>') . iif(in_array($extension, $this->plain), ' <a class="button" href="' . $link . '&job=edit">' . $lang->phrase('admin_explorer_file_edit') . '</a>');
         $html .= "\n" . '		   </td>';
         $html .= "\n" . '		 </tr>';
     }
     $html .= "\n" . '	   </table>';
     if ($print) {
         echo $html;
     } else {
         return $html;
     }
 }
示例#5
0
 $settings = $tempdir . 'design.ini';
 $myini = new INI();
 $myini->write($settings, $info);
 require_once 'classes/class.zip.php';
 $archive = new PclZip($tempdir . $file);
 $v_list = $archive->create($settings, PCLZIP_OPT_REMOVE_PATH, $tempdir);
 if ($v_list == 0) {
     $error = true;
 } else {
     foreach ($dirs as $dir) {
         $archive = new PclZip($tempdir . $file);
         if (!empty($dir['func']) && viscacha_function_exists($dir['func'])) {
             $list = $dir['func']($dir['dir']);
             $v_list = $archive->add($list, PCLZIP_OPT_REMOVE_PATH, $dir['dir'], PCLZIP_OPT_ADD_PATH, extract_dir($dir['dir'], false));
         } else {
             $v_list = $archive->add($dir['dir'], PCLZIP_OPT_REMOVE_PATH, $dir['dir'], PCLZIP_OPT_ADD_PATH, extract_dir($dir['dir'], false));
         }
         if ($v_list == 0) {
             $error = true;
             break;
         }
     }
 }
 if ($error) {
     echo head();
     unset($archive);
     $filesystem->unlink($tempdir . $file);
     $filesystem->unlink($settings);
     error('admin.php?action=designs&job=export&id=' . $id, $archive->errorInfo(true));
 } else {
     viscacha_header('Content-Type: application/zip');
* Magpie mailing list:
* magpierss-general@lists.sourceforge.net
*
*/
// Setup MAGPIE_DIR for use on hosts that don't include
// the current path in include_path.
// with thanks to rajiv and smarty
if (!defined('DIR_SEP')) {
    define('DIR_SEP', DIRECTORY_SEPARATOR);
}
if (!defined('MAGPIE_DIR')) {
    define('MAGPIE_DIR', dirname(__FILE__) . DIR_SEP);
}
require_once MAGPIE_DIR . 'rss_parse.inc.php';
require_once MAGPIE_DIR . 'rss_cache.inc.php';
require_once extract_dir(MAGPIE_DIR) . 'class.snoopy.php';
$grabrss = $scache->load('grabrss');
$grabrss_cache = $grabrss->get();
/* 
 * CONSTANTS - redefine these in your script to change the
 * behaviour of fetch_rss() currently, most options effect the cache
 *
 * MAGPIE_CACHE_ON - Should Magpie cache parsed RSS objects? 
 * For me a built in cache was essential to creating a "PHP-like" 
 * feel to Magpie, see rss_cache.inc for rationale
 *
 *
 * MAGPIE_CACHE_DIR - Where should Magpie cache parsed RSS objects?
 * This should be a location that the webserver can write to.   If this 
 * directory does not already exist Mapie will try to be smart and create 
 * it.  This will often fail for permissions reasons.