Project

General

Profile

« Previous | Next » 

Revision 1237

Added by Dietmar over 14 years ago

Ticket #904 fix if templatename is equal language

View differences:

branches/2.8.x/CHANGELOG
12 12

  
13 13
------------------------------------- 2.8.1 -------------------------------------
14 14
11-Jan-2010 Dietmar Woellbrink (Luisehahne)
15
!	Ticket #904 fix if templatename is equal language
16
11-Jan-2010 Dietmar Woellbrink (Luisehahne)
15 17
!	Ticket #905 fix search.php 'registered' hardcoded
16 18
10-Jan-2010 Dietmar Woellbrink (Luisehahne)
17 19
!	Ticket #903 fix CSS-errors in WB backend
branches/2.8.x/wb/admin/interface/version.php
2 2
/****************************************************************************
3 3
* SVN Version information:
4 4
*
5
* $Id: version.php 1235 2010-01-10 14:11:00Z Luisehahne $
5
* $Id: version.php 1236 2010-01-11 12:37:12Z Luisehahne $
6 6
*
7 7
*
8 8
*
......
56 56
 * @author       Ryan Djurovich
57 57
 * @copyright    2004-2009, Ryan Djurovich
58 58
 * @copyright    2009-2010, Website Baker Org. e.V.
59
 * @version      $Id: version.php 1235 2010-01-10 14:11:00Z Luisehahne $
59
 * @version      $Id: version.php 1236 2010-01-11 12:37:12Z Luisehahne $
60 60
 * @platform     WebsiteBaker 2.8.x
61 61
 * @requirements >= PHP 4.3.4
62 62
 * @license      http://www.gnu.org/licenses/gpl.html
......
70 70

  
71 71
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
72 72
if(!defined('VERSION')) define('VERSION', '2.8.1');
73
if(!defined('REVISION')) define('REVISION', '1236');
73
if(!defined('REVISION')) define('REVISION', '1237');
74 74

  
75 75
?>
branches/2.8.x/wb/framework/functions.php
1 1
<?php
2
/****************************************************************************
3
* SVN Version information:
4
*
5
* $Id$
6
*
7
*
8
*
9
*****************************************************************************
10
*                          WebsiteBaker
11
*
12
* WebsiteBaker Project <http://www.websitebaker2.org/>
13
* Copyright (C) 2009, Website Baker Org. e.V.
14
*         http://start.websitebaker2.org/impressum-datenschutz.php
15
* Copyright (C) 2004-2009, Ryan Djurovich
16
*
17
*                        About WebsiteBaker
18
*
19
* Website Baker is a PHP-based Content Management System (CMS)
20
* designed with one goal in mind: to enable its users to produce websites
21
* with ease.
22
*
23
*****************************************************************************
24
*
25
*****************************************************************************
26
*                        LICENSE INFORMATION
27
*
28
* WebsiteBaker is free software; you can redistribute it and/or
29
* modify it under the terms of the GNU General Public License
30
* as published by the Free Software Foundation; either version 2
31
* of the License, or (at your option) any later version.
32
*
33
* WebsiteBaker is distributed in the hope that it will be useful,
34
* but WITHOUT ANY WARRANTY; without even the implied warranty of
35
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36
* See the GNU General Public License for more details.
37
*
38
* You should have received a copy of the GNU General Public License
39
* along with this program; if not, write to the Free Software
40
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
41
****************************************************************************
42
*
43
*                   WebsiteBaker Extra Information
44
*
45
* Website Baker functions file
46
* This file contains general functions used in Website Baker
47
*
48
*
49
*
50
*
51
*****************************************************************************/
52
/**
53
 *
54
 * @category     frontend
55
 * @package      framework
56
 * @author       Ryan Djurovich
57
 * @copyright    2004-2009, Ryan Djurovich
58
 * @copyright    2009-2010, Website Baker Org. e.V.
59
 * @version      $Id$
60
 * @platform     WebsiteBaker 2.8.x
61
 * @requirements >= PHP 4.3.4
62
 * @license      http://www.gnu.org/licenses/gpl.html
63
 *
64
 */
2 65

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
/*
27

  
28
Website Baker functions file
29
This file contains general functions used in Website Baker
30

  
31
*/
32

  
33 66
// Stop this file from being accessed directly
34 67
if(!defined('WB_URL')) {
35 68
	header('Location: ../index.php');
......
48 81
    }
49 82

  
50 83
    // Empty the folder
51
	if (is_dir($directory)) {
52
    $dir = dir($directory);
53
    while (false !== $entry = $dir->read()) {
54
        // Skip pointers
55
        if ($entry == '.' || $entry == '..') {
56
            continue;
57
        }
84
	if (is_dir($directory))
85
    {
86
        $dir = dir($directory);
87
        while (false !== $entry = $dir->read())
88
        {
89
            // Skip pointers
90
            if ($entry == '.' || $entry == '..') {
91
                continue;
92
            }
58 93

  
59
        // Deep delete directories      
60
        if (is_dir("$directory/$entry")) {
61
            rm_full_dir("$directory/$entry");
62
        } else {
63
            unlink("$directory/$entry");
94
            // Deep delete directories
95
            if (is_dir("$directory/$entry")) {
96
                rm_full_dir("$directory/$entry");
97
            }
98
            else
99
            {
100
                unlink("$directory/$entry");
101
            }
64 102
        }
65
    }
66 103

  
67
    // Now delete the folder
68
    $dir->close();
69
    return rmdir($directory);
104
        // Now delete the folder
105
        $dir->close();
106
        return rmdir($directory);
70 107
	}
71 108
}
72 109

  
73 110
// Function to open a directory and add to a dir list
74
function directory_list($directory) {
75
	
111
function directory_list($directory)
112
{
76 113
	$list = array();
77 114

  
78
	// Open the directory then loop through its contents
79
	$dir = dir($directory);
80
	while (false !== $entry = $dir->read()) {
81
		// Skip pointers
82
		if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
83
			continue;
84
		}
85
		// Add dir and contents to list
86
		if (is_dir("$directory/$entry")) {
87
			$list = array_merge($list, directory_list("$directory/$entry"));
88
			$list[] = "$directory/$entry";
89
		}
90
	}
115
	if (is_dir($directory))
116
    {
117
    	// Open the directory then loop through its contents
118
    	$dir = dir($directory);
119
    	while (false !== $entry = $dir->read()) {
120
    		// Skip pointers
121
    		if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
122
    			continue;
123
    		}
124
    		// Add dir and contents to list
125
    		if (is_dir("$directory/$entry")) {
126
    			$list = array_merge($list, directory_list("$directory/$entry"));
127
    			$list[] = "$directory/$entry";
128
    		}
129
    	}
91 130

  
92
	// Now return the list
131
        $dir->close();
132
    }
133
    // Now return the list
93 134
	return $list;
94 135
}
95 136

  
96 137
// Function to open a directory and add to a dir list
97
function chmod_directory_contents($directory, $file_mode) {
98
	
99
	// Set the umask to 0
100
	$umask = umask(0);
101
	
102
	// Open the directory then loop through its contents
103
	$dir = dir($directory);
104
	while (false !== $entry = $dir->read()) {
105
		// Skip pointers
106
		if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
107
			continue;
108
		}
109
		// Chmod the sub-dirs contents
110
		if(is_dir("$directory/$entry")) {
111
			chmod_directory_contents("$directory/$entry", $file_mode);
112
		}
113
		change_mode($directory.'/'.$entry);
114
	}
115
	
116
	// Restore the umask
117
	umask($umask);
138
function chmod_directory_contents($directory, $file_mode)
139
{
140
	if (is_dir($directory))
141
    {
142
    	// Set the umask to 0
143
    	$umask = umask(0);
118 144

  
145
    	// Open the directory then loop through its contents
146
    	$dir = dir($directory);
147
    	while (false !== $entry = $dir->read()) {
148
    		// Skip pointers
149
    		if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
150
    			continue;
151
    		}
152
    		// Chmod the sub-dirs contents
153
    		if(is_dir("$directory/$entry")) {
154
    			chmod_directory_contents("$directory/$entry", $file_mode);
155
    		}
156
    		change_mode($directory.'/'.$entry);
157
    	}
158
        $dir->close();
159
    	// Restore the umask
160
    	umask($umask);
161
    }
119 162
}
120 163

  
121 164
// Function to open a directory and add to a file list
......
124 167
	$list = array();
125 168
	$skip_file = false;
126 169
	
127
	// Open the directory then loop through its contents
128
	$dir = dir($directory);
129
	while (false !== $entry = $dir->read()) {
170
	if (is_dir($directory))
171
    {
172
    	// Open the directory then loop through its contents
173
    	$dir = dir($directory);
174
    }
175
	while (false !== $entry = $dir->read())
176
    {
130 177
		// Skip pointers
131
		if($entry == '.' || $entry == '..') {
178
		if($entry == '.' || $entry == '..')
179
        {
132 180
			$skip_file = true;
133 181
		}
134 182
		// Check if we to skip anything else
135 183
		if($skip != array()) {
136
			foreach($skip AS $skip_name) {
137
				if($entry == $skip_name) {
184
			foreach($skip AS $skip_name)
185
            {
186
				if($entry == $skip_name)
187
                {
138 188
					$skip_file = true;
139 189
				}
140 190
			}
141 191
		}
142 192
		// Add dir and contents to list
143
		if($skip_file != true AND is_file("$directory/$entry")) {
193
		if($skip_file != true AND is_file("$directory/$entry"))
194
        {
144 195
			$list[] = "$directory/$entry";
145 196
		}
146 197
		
147 198
		// Reset the skip file var
148 199
		$skip_file = false;
149 200
	}
150

  
201
    $dir->close();
151 202
	// Now delete the folder
152 203
	return $list;
153 204
}
......
195 246
}
196 247

  
197 248
// Function to create directories
198
function make_dir($dir_name, $dir_mode = OCTAL_DIR_MODE) {
199
	if(!file_exists($dir_name)) {
249
function make_dir($dir_name, $dir_mode = OCTAL_DIR_MODE)
250
{
251
	if(!is_dir($dir_name))
252
    {
200 253
		$umask = umask(0);
201 254
		mkdir($dir_name, $dir_mode);
202 255
		umask($umask);
......
208 261

  
209 262
// Function to chmod files and directories
210 263
function change_mode($name) {
211
	if(OPERATING_SYSTEM != 'windows') {
264
	if(OPERATING_SYSTEM != 'windows')
265
    {
212 266
		// Only chmod if os is not windows
213
		if(is_dir($name)) {
267
		if(is_dir($name))
268
        {
214 269
			$mode = OCTAL_DIR_MODE;
215
		} else {
270
		}
271
        else
272
        {
216 273
			$mode = OCTAL_FILE_MODE;
217 274
		}
218
		if(file_exists($name)) {
275

  
276
		if(file_exists($name))
277
        {
219 278
			$umask = umask(0);
220 279
			chmod($name, $mode);
221 280
			umask($umask);
222 281
			return true;
223
		} else {
282
		}
283
        else
284
        {
224 285
			return false;	
225 286
		}
226
	} else {
287
	}
288
    else
289
    {
227 290
		return true;
228 291
	}
229 292
}
......
819 882
			if(!isset($template_platform) AND isset($template_designed_for)) { $template_platform = $template_designed_for; }
820 883
			if(!isset($template_function)) { $template_function = 'template'; }
821 884
			// Check that it doesn't already exist
822
			$result = $database->query("SELECT addon_id FROM ".TABLE_PREFIX."addons WHERE directory = '".$template_directory."' LIMIT 0,1");
885
			$result = $database->query("SELECT addon_id FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '".$template_directory."' LIMIT 0,1");
823 886
			if($result->numRows() == 0) {
824 887
				// Load into DB
825 888
				$query = "INSERT INTO ".TABLE_PREFIX."addons ".

Also available in: Unified diff