Beispiel #1
0
function sitetemplate_get_boxes($app)
{
    $boxes = Dir::getStruct('inc/app/' . $app . '/boxes');
    foreach ($boxes as $k => $b) {
        if ($b == 'CVS' || !@file_exists($b . '/index.php') || strpos($b, '.') === 0) {
            unset($boxes[$k]);
        }
    }
    foreach ($boxes as $k => $b) {
        $boxes[$k] = str_replace('inc/app/' . $app . '/boxes/', '', $b);
    }
    return $boxes;
}
Beispiel #2
0
 function ImagechooserAdminEditForm()
 {
     parent::MailForm(__FILE__);
     global $cgi;
     page_title(intl_get('Editing properties') . ': ' . $cgi->location . '/' . $cgi->src);
     $info = pathinfo($cgi->src);
     $this->widgets['new_name']->setValue($cgi->src);
     $this->widgets['new_name']->addRule('func "imagechooser_rule_name_invalid"', intl_get('Your filename does not appear to be valid.'));
     $this->widgets['new_name']->addRule('func "imagechooser_rule_name_extension"', intl_get('Your filename must end in') . ' .' . strtolower($info['extension']));
     $this->widgets['new_name']->addRule('func "imagechooser_rule_name_exists"', intl_get('The filename you chose already exists, please choose another.'));
     $dirs = Dir::getStruct('pix');
     $locations = array('/pix' => '/pix');
     foreach ($dirs as $k => $v) {
         if (strpos($v, 'CVS') !== false) {
             continue;
         }
         $locations['/' . $v] = '/' . $v;
     }
     $this->widgets['new_location']->setValues($locations);
     $this->widgets['new_location']->setValue($cgi->location);
 }
Beispiel #3
0
 /**
  * Retrieve the list of items.
  *
  * @return array
  *
  */
 function getList($basedir = false)
 {
     if (!$basedir) {
         $basedir = $this->basedir;
     }
     loader_import('saf.File.Directory');
     $res = assocify(Dir::getStruct($basedir));
     $list = array('' => ucfirst('default'));
     foreach ($res as $file) {
         if (preg_match('|/CVS$|', $file)) {
             continue;
         }
         $file = str_replace($basedir . '/', '', $file);
         $list[$file] = $file;
     }
     return $list;
 }
Beispiel #4
0
}
page_title('Applying Upgrade 4.2.11');
echo '<p><strong>Applying database updates...</strong></p>';
// database updates
if (upgrade_db(true)) {
    echo '<p>Done.</p>';
} else {
    echo '<p>Error: ' . db_error() . '</p>';
    return;
}
echo '<p><strong>Fixing Web Files...</strong></p><p>';
set_time_limit(0);
$c = 0;
// 1. fix folder names
loader_import('saf.File.Directory');
$struct = Dir::getStruct('inc/data');
foreach ($struct as $dir) {
    $lower = strtolower($dir);
    if ($dir != $lower) {
        rename($dir, $lower);
    }
}
// 2. select all web files
$files = db_shift_array('select distinct name from sitellite_filesystem_sv order by name asc');
foreach ($files as $file) {
    $lower = strtolower($file);
    if ($file != $lower) {
        // 3. rename in filesystem
        rename('inc/data/' . $file, 'inc/data/' . $lower);
        // 4. rename in db
        db_execute('update sitellite_filesystem_sv set name = ? where name = ?', $lower, $file);
Beispiel #5
0
$root = 'inc/app';
loader_import('saf.File.Directory');
$data = array('location' => 'inc/app', 'boxes' => array(), 'name' => $parameters['name']);
if (empty($cgi->format)) {
    $cgi->format = 'html';
}
if (!empty($cgi->app)) {
    $data['location'] = $data['location'] . '/' . $cgi->app;
} else {
    echo 'Error: app not specified';
    exit;
}
$data['appname'] = $cgi->appname;
$data['description'] = $cgi->desc;
page_title(intl_get('Folder') . ': ' . $data['location']);
$allBoxes = Dir::getStruct($data['location']);
//its only a box if the folder is not CVS, does have an index.php file, and is not a form
foreach ($allBoxes as $key => $box) {
    if ($box == 'CVS' || !@file_exists($box . '/index.php') || strpos($box, '.') === 0) {
        unset($allBoxes[$key]);
    }
}
//make sure access.php has sitellite_inline=on
foreach ($allBoxes as $key => $box) {
    $b = str_replace('inc/app/' . $cgi->app . '/boxes/', '', $box);
    $access = loader_box_get_access($b, $cgi->app);
    if (!$access['sitellite_inline']) {
        unset($allBoxes[$key]);
    }
}
$index = strlen($data['location']) + strlen('boxes') + 2;
Beispiel #6
0
$root = 'inc/app';
loader_import('saf.File.Directory');
$data = array('location' => 'inc/app' . $folder, 'forms' => array());
if (empty($cgi->format)) {
    $cgi->format = 'html';
}
if (!empty($cgi->app)) {
    $data['location'] = $data['location'] . '/' . $cgi->app;
} else {
    echo 'Error: app not specified';
    exit;
}
$data['name'] = $cgi->name;
$data['description'] = $cgi->desc;
page_title(intl_get('Folder') . ': ' . $data['location']);
$allForms = Dir::getStruct($data['location']);
//its only a form if the folder is not CVS, does have an index.php file, and is not a box
foreach ($allForms as $key => $form) {
    if (strpos($form, 'CVS') == true || !file_exists($form . '/index.php') || strpos($form, 'boxes') == true) {
        unset($allForms[$key]);
    }
}
//make sure access.php has sitellite_inline=on
/* disabled for debugging
foreach($allBoxes as $key=>$form){
	if(file_exists($form . '/access.php'))
	{	$access_file = parse_ini_file($form . '/access.php');
		if($access_file['sitellite_inline']==false) {
			unset($allBoxes[$key]);
		}
	}
Beispiel #7
0
 loader_import('saf.File.Directory');
 foreach ($folders as $name => $info) {
     switch ($info['type']) {
         case 'site':
             // 1. wget the site
             shell_exec('wget -m -w 2 -E -P tmp/ http://' . $info['domain'] . ' > /dev/null 2>&1');
             // 2. set $info['folder']
             $info['folder'] = 'tmp/' . $info['domain'];
             // 3. set $info['prefix'] as $info['domain']
             $info['prefix'] = 'http://' . $info['domain'];
             // 4. proceed with what's below
         // 4. proceed with what's below
         case 'folder':
         default:
             $files = array();
             $folders = array_merge(array($info['folder']), Dir::getStruct($info['folder']));
             foreach ($folders as $folder) {
                 if (preg_match('/CVS$/', $folder)) {
                     continue;
                 }
                 $list = Dir::fetch($folder);
                 foreach ($list as $f) {
                     if (strpos($f, '.') === 0 || @is_dir($folder . '/' . $f)) {
                         continue;
                     } elseif (preg_match('/\\.(jpg|png|gif|css|js)$/i', $f)) {
                         continue;
                     }
                     $pref = str_replace($info['folder'], '', $folder);
                     if (!preg_match('|/$|', $pref)) {
                         $pref .= '/';
                     }
Beispiel #8
0
 /**
  * Returns the "structure" of the filesystem below the specified path.
  * This is a list of sub-directories, recursively.
  *
  * @access	public
  * @param	string	$path
  * @return	array	files
  *
  */
 function getStruct($path)
 {
     $struct = array();
     $files = Dir::fetch($path);
     foreach ($files as $file) {
         if (strpos($file, '.') === 0 || !@is_dir($path . '/' . $file)) {
             continue;
         }
         $struct[] = $path . '/' . $file;
         foreach (Dir::getStruct($path . '/' . $file) as $file) {
             $struct[] = $file;
         }
     }
     return $struct;
 }