Project

General

Profile

« Previous | Next » 

Revision 1676

Added by Dietmar over 12 years ago

  1. fixed backup_droplets working with php as Apache Module (Tks to Ruebenwurzel)
    ! update function rm_full_dir in /framework/functions.php
    ! To disable Run-time notices and receive warnings

View differences:

branches/2.8.x/CHANGELOG
12 12
===============================================================================
13 13

  
14 14

  
15

  
16

  
15
24 Apr-2012 Build 1676 Dietmar Woellbrink (Luisehahne)
16
# fixed backup_droplets working with php as Apache Module (Tks to Ruebenwurzel)
17
! update function rm_full_dir in /framework/functions.php
18
! To disable Run-time notices and receive warnings
17 19
24 Apr-2012 Build 1675 Dietmar Woellbrink (Luisehahne)
18 20
# fixed /framework/functions.php missing global $MESSAGE in function rebuildFolderProtectFile
19 21
18 Apr-2012 Build 1674 Dietmar Woellbrink (Luisehahne)
......
149 151
# Droplet [SectionPiocker] fixed
150 152
+ Added new droplets [ShowWysiwyg] and [ShowRandomWysiwyg]
151 153
24 Feb-2012 Build 1620 Dietmar Woellbrink (Luisehahne)
152
# fixed FCKeditor lang files to utf-8 (Tks to Ruebenwurzel
154
# fixed FCKeditor lang files to utf-8 (Tks to Ruebenwurzel)
153 155
24 Feb-2012 Build 1619 Dietmar Woellbrink (Luisehahne)
154 156
! forgot info.php
155 157
24 Feb-2012 Build 1618 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1675');
54
if(!defined('REVISION')) define('REVISION', '1676');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/functions.php
30 30
 * @param string $directory :
31 31
 * @param bool $empty : true if you want the folder just emptied, but not deleted
32 32
 *                      false, or just simply leave it out, the given directory will be deleted, as well
33
 * @return boolean: list of ro-dirs
33
 * @return boolean: true/false
34 34
 * @from http://www.php.net/manual/de/function.rmdir.php#98499
35 35
 */
36
function rm_full_dir($directory, $empty = false) {
37
    
36
function rm_full_dir($directory, $empty = false)
37
{
38 38
	if(substr($directory,-1) == "/") {
39 39
        $directory = substr($directory,0,-1);
40 40
    }
41 41
   // If suplied dirname is a file then unlink it
42
    if (is_file( $directory )) {
42
    if (is_file( $directory )&& is_writable( $directory )) {
43 43
	  $retval = unlink($directory);
44 44
	  clearstatcache();
45 45
      return $retval;
46 46
    }
47
    if(!file_exists($directory) || !is_dir($directory)) {
47
    if(!is_writable($directory) || !is_dir($directory)) {
48 48
        return false;
49 49
    } elseif(!is_readable($directory)) {
50 50
        return false;
......
65 65
        }
66 66
        closedir($directoryHandle);
67 67
        if($empty == false) {
68
            if(!rmdir($directory)) {
69
                return false;
68
            if(is_dir($directory) && is_writable(dirname($directory))) {
69
                return rmdir($directory);
70
            } else {
71
				return false;
70 72
            }
71 73
        }
72 74
        return true;
......
419 421
 * the function also prevents the owner to loose rw-rights
420 422
 * @param string $sName
421 423
 * @param int rights in dec-value. 0= use wb-defaults
422
 * @return bool 
424
 * @return bool
423 425
 */
424 426
function change_mode($sName, $iMode = 0)
425 427
{
branches/2.8.x/wb/modules/droplets/tool.php
42 42
	echo "\n</style>\n";
43 43
}
44 44

  
45
$temp_dir = '/temp/droplets/';
45 46
// Get userid for showing admin only droplets or not
46
$loggedin_user = ($admin->ami_group_member('1') ? 1 : $admin->user_id());
47
$loggedin_user = ($admin->ami_group_member('1') ? 1 : $admin->get_user_id());
47 48
$loggedin_group = $admin->get_groups_id();
48 49
$admin_user = ( ($admin->get_home_folder() == '') && ($admin->ami_group_member('1') ) || ($loggedin_user == '1'));
49 50

  
......
61 62
if( !$database->get_one($sql) ) {
62 63
	include('install.php');
63 64
}
65
// delete backup folder if possible
66
if(is_writeable(dirname(WB_PATH.$temp_dir))) {
67
 	rm_full_dir ( WB_PATH.$temp_dir );
68
}
64 69
?><br />
65 70
<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%">
66 71
<tr>
branches/2.8.x/wb/modules/droplets/backup_droplets.php
5 5
 * @package         droplet
6 6
 * @author          Ruud Eisinga (Ruud) John (PCWacht)
7 7
 * @author          WebsiteBaker Project
8
 * @copyright       2004-2009, Ryan Djurovich
9
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @copyright       2009-2012, Website Baker Org. e.V.
10 9
 * @link			http://www.websitebaker2.org/
11 10
 * @license         http://www.gnu.org/licenses/gpl.html
12 11
 * @platform        WebsiteBaker 2.8.x
......
26 25
$admin = new admin('admintools', 'admintools');
27 26
$admintool_link = ADMIN_URL .'/admintools/index.php';
28 27
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
29
$template_edit_link = ADMIN_URL .'/admintools/tool.php?tool=templateedit';
30 28
$sOverviewDroplets = $TEXT['LIST_OPTIONS'];
31 29

  
32 30
// protect from CSRF
......
43 41
</h4>
44 42
<?php
45 43

  
46
$temp_dir = WB_PATH.'/temp/droplets/';
47
$temp_file = '/modules/droplets/backup-droplets.zip';
48
// make the temporary working directory
49
mkdir($temp_dir);
50
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_droplets`  ';
51
$sql .= 'ORDER BY `modified_when` DESC';
52
$query_droplets = $database->query($sql);
53
while($droplet = $query_droplets->fetchRow()) {
54
	echo 'Saving: '.$droplet["name"].'.php<br />';
55
	$sFile = $temp_dir.$droplet["name"].'.php';
56
	$fh = fopen($sFile, 'w') ;
57
	fwrite($fh, '//:'.$droplet['description']."\n");
58
	fwrite($fh, '//:'.str_replace("\n"," ",$droplet['comments'])."\n");
59
	fwrite($fh, $droplet['code']);
60
	fclose($fh);
44
$OK  = ' <span style="color:#006400; font-weight:bold;">OK</span> ';
45
$FAIL = ' <span style="color:#ff0000; font-weight:bold;">FAILED</span> ';
46

  
47
$temp_dir = '/temp/droplets/';
48
$temp_file = $temp_dir.'backup-droplets.zip';
49

  
50
if(is_writeable(dirname(WB_PATH.$temp_dir))) {
51
 	rm_full_dir ( WB_PATH.$temp_dir );
61 52
}
53

  
54
$msg = createFolderProtectFile(rtrim( WB_PATH.$temp_dir,'/') );
55
if(sizeof($msg)) {
56
	print '<h4 class="warning">';
57
	echo implode('<br />',$msg).'<br />'.$MESSAGE['MEDIA_DIR_NOT_MADE'].'<br />';
58
	print '</h4>';
59
}
60

  
61
	$sFilesToZip = '';
62
	$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_droplets`  ';
63
	$sql .= 'ORDER BY `modified_when` DESC';
64

  
65
	$query_droplets = $database->query($sql);
66
	while($droplet = $query_droplets->fetchRow()) {
67
		echo 'Saving: /temp/droplets/'.$droplet["name"].'.php';
68
		$sFile = $droplet["name"].'.php';
69
		if($fh = fopen(WB_PATH.$temp_dir.$sFile, 'w'))
70
		{
71
			fwrite($fh, '//:'.$droplet['description']."\n");
72
			fwrite($fh, '//:'.str_replace("\n"," ",$droplet['comments'])."\n");
73
			fwrite($fh, $droplet['code']);
74
			fclose($fh);
75
			echo " $OK<br />";
76
		} else {
77
			echo " $FAIL<br />";		}
78
	$sFilesToZip .= WB_PATH.$temp_dir.$sFile.',';
79
	}
80

  
81
$sFilesToZip = rtrim($sFilesToZip,',');
82

  
62 83
echo '<br />Create archive: backup-droplets.zip<br />';
63 84

  
64 85
require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');
65 86
$archive = new PclZip(WB_PATH.$temp_file);
66
$file_list = $archive->create($temp_dir, PCLZIP_OPT_REMOVE_ALL_PATH);
87

  
88
$file_list = $archive->create($sFilesToZip , PCLZIP_OPT_ADD_PATH, WB_PATH.$temp_dir );
67 89
if ($file_list == 0){
68 90
	echo "Packaging error: '.$archive->errorInfo(true).'";
69 91
	die("Error : ".$archive->errorInfo(true));
70 92
}
71
else {
93
elseif(is_readable(WB_PATH.$temp_file)) {
72 94
	echo '<br /><br />Backup created - <a href="'.WB_URL.$temp_file.'">Download</a>';
73 95
}
74

  
75
delete_directory ( $temp_dir );
76

  
77
function delete_directory($dirname) {
78
    if (is_dir($dirname))
79
        $dir_handle = opendir($dirname);
80
    if (!$dir_handle)
81
        return false;
82
    while($file = readdir($dir_handle)) {
83
        if ($file != "." && $file != "..") {
84
            if (!is_dir($dirname."/".$file))
85
                unlink($dirname."/".$file);
86
            else
87
                delete_directory($dirname.'/'.$file);          
88
        }
89
    }
90
    closedir($dir_handle);
91
    rmdir($dirname);
92
    return true;
96
else {
97
	echo '<br /><br />Backup not created - <a href="'.$module_edit_link.'">'.$TEXT['BACK'].'</a>';
93 98
}
94 99

  
95 100
$admin->print_footer();
branches/2.8.x/DEVINFOS
4 4
$Id$
5 5

  
6 6

  
7

  
8

  
9
24 Apr-2012 Build 1676
10
----------------------
11
If you use function rm_full_dir
12
now disable Run-time notices and return boolean: 
13
create your own error messages
14

  
7 15
17 Apr-2012 Build 1665
8 16
----------------------
9 17
add developer informations in advanced settings 
10
info will be shown in footer only for system admins
18
info will be shown in footer only for system admin
11 19

  
12 20
add page_icon_dir in advanced settings
13 21
default directory /templates/*/title_images

Also available in: Unified diff