3 /***************************************************************************
\r
4 * xs_include_import.php
\r
5 * ---------------------
\r
6 * copyright : (C) 2003 - 2005 CyberAlien
\r
7 * support : http://www.phpbbstyles.com
\r
11 * file revision : 70
\r
12 * project revision : 78
\r
13 * last modified : 05 Dec 2005 13:54:54
\r
15 ***************************************************************************/
\r
17 /***************************************************************************
\r
19 * This program is free software; you can redistribute it and/or modify
\r
20 * it under the terms of the GNU General Public License as published by
\r
21 * the Free Software Foundation; either version 2 of the License, or
\r
22 * (at your option) any later version.
\r
24 ***************************************************************************/
\r
26 if (!defined('IN_PHPBB') || !defined('IN_XS'))
\r
28 die("Hacking attempt");
\r
32 function generate_actions_files($dir)
\r
35 // remove trailing /
\r
36 $pos = strrpos($dir, '/');
\r
37 $dir = $pos === strlen($dir) - 1 ? substr($dir, 0, $pos) : $dir;
\r
38 $arr = array('processing: '.$dir);
\r
39 for($i=0; $i<count($items); $i++)
\r
41 if($items[$i]['dir'] === $dir)
\r
44 'command' => 'upload',
\r
45 'local' => $items[$i]['tmp'],
\r
46 'remote' => $items[$i]['file']
\r
53 function generate_actions_dirs($dir = '')
\r
57 if($dir && substr($dir, strlen($dir) - 1) !== '/')
\r
63 // remove trailing /
\r
64 $pos = strrpos($dir, '/');
\r
65 $str = $pos === strlen($dir) - 1 ? substr($dir, 0, $pos) : $dir;
\r
66 // get last directory name
\r
67 $pos = strrpos($str, '/');
\r
68 $str = $pos ? substr($str, $pos + 1) : $str;
\r
70 'command' => 'mkdir',
\r
75 'command' => 'chdir',
\r
80 'command' => 'exec',
\r
81 'list' => generate_actions_files($dir)
\r
83 // create subdirectories
\r
84 $len = strlen($dir);
\r
85 for($i=0; $i<count($dirs); $i++)
\r
88 if(substr($str, 0, $len) === $dir)
\r
92 $str = substr($str, $len + 1);
\r
94 $pos = strpos($str, '/');
\r
95 if($pos == strlen($str) - 1)
\r
98 'command' => 'exec',
\r
99 'list' => generate_actions_dirs($dirs[$i])
\r
107 function generate_style_name($str)
\r
109 $str = 'style_' . $str . '_%02d' . STYLE_EXTENSION;
\r
114 $filename = sprintf($str, $num);
\r
115 $found = @file_exists(XS_TEMP_DIR.$filename);
\r