Revision 419
Added by ryan almost 19 years ago
| branches/2.6.x/CHANGELOG | ||
|---|---|---|
| 1 |
Change Log |
|
| 2 |
=============================================================================== |
|
| 3 |
Please note: This change log may not be accurate |
|
| 4 |
|
|
| 5 |
$Id$ |
|
| 6 |
|
|
| 7 |
Legend: |
|
| 8 |
+ = Added |
|
| 9 |
- = Removed |
|
| 10 |
# = Bugfix |
|
| 11 |
! = Update/Change |
|
| 12 |
|
|
| 13 |
------------------------------------- 2.6.5 ------------------------------------- |
|
| 14 |
25-Dec-2006 Ryan Djurovich |
|
| 15 |
! Changed links to WB help website |
|
| 16 |
24-Dec-2006 Matthias Gallas |
|
| 17 |
# Fixed some minor javascript errors in admin (thanks to pcwacht) |
|
| 18 |
# Fixed root_parent doesn't get updated when moving item in menu (#305) |
|
| 19 |
! Changed all copyright notices to include now 2007 |
|
| 20 |
23-Dec-2006 Matthias Gallas |
|
| 21 |
# Fixed IE allows to set a page as parent of itself (#320) |
|
| 22 |
# Fixed problem with Page Title has to be escaped (#287) |
|
| 23 |
# Fixed the possibility to call the index.php of the templates directly in the browser (#291) |
|
| 24 |
21-Dec-2006 Matthias Gallas |
|
| 25 |
# Fixed missing message when adding a site without page title (#300) |
|
| 26 |
21-Dec-2006 Ryan Djurovich |
|
| 27 |
# Fixed bug with captcha script (#346) |
|
| 28 |
20-Dec-2006 Matthias Gallas |
|
| 29 |
# Fixed Return to Search Results Page (#365) |
|
| 30 |
! Set Version to 2.6.5 |
|
| 31 |
- Removed Changeset 365 because this will be a part of WB 2.7.x |
|
| 32 |
# Fixed a little typo error in class.admin.php (#364) |
|
| 33 |
26-Nov-2006 Ryan Djurovich |
|
| 34 |
+ Added new script that could possibly be apart of 2.7.x as a replacement |
|
| 35 |
for having the pages directory |
|
| 36 |
17-Nov-2006 Matthias Gallas |
|
| 37 |
# Fixed fatal error in line 46 news/comment.php (thanks to eki)(#358) |
|
| 38 |
15-Nov-2006 Matthias Gallas |
|
| 39 |
# Fixed again intropage doesn't work (#71) |
|
| 40 |
20-Oct-2006 Matthias Gallas |
|
| 41 |
+ Added phpmailer class (thanks to doc) |
|
| 42 |
+ Added Remember-expanded-pages-in-admin (thanks to ephraimt) |
|
| 43 |
+ Added List sorting in admin area (thanks to rsmith) |
|
| 44 |
# Fixed table width 100% are wrong displayed in container templates |
|
| 45 |
when IE is used (#350) |
|
| 46 |
# Fixed large space between menupoints in IE (#349) |
|
| 47 |
# Fixed Website description is not displayed when no page description |
|
| 48 |
available (#348) |
|
| 49 |
# Fixed group images in news modul cannot be stored (#342) |
|
| 50 |
# Fixed Typo in form/save_field.php (#341) |
|
| 51 |
# Fixed files in /pages/posts folder are not deleted (#340) |
|
| 52 |
# Fixed specialchars problem in the news modul (#339) |
|
| 53 |
# Fixed news modul stores empty records (#338) |
|
| 54 |
# Fixed Captcha didn't work in news comments (#337) |
|
| 55 |
# Fixed various php notices (#334) |
|
| 56 |
+ Added new upgrade_function (thanks to kozmoz) |
|
| 57 |
# Fixed addons table isn't updated when a modul is updated (#332) |
|
| 58 |
# Fixed spelling errors in the signup2.php (#330) |
|
| 59 |
# Fixed MySQL 5.x missing default values for INT fields in all system |
|
| 60 |
and modules tables (#329) |
|
| 61 |
# Fixed installer does not insert admin user (#328) |
|
| 62 |
+ Added support for getting page ID of page that referred search |
|
| 63 |
request (#327) (thanks to brofield) |
|
| 64 |
# Fixed search results generate invalid XHTML and notify warnings (#326) |
|
| 65 |
Stefan Braunewell |
|
| 66 |
# Fixed Field 'last_reset' doesn't have a default value (#313) |
|
| 67 |
+ Added get_post_escaped to wb class which automatically calls add_slashes |
|
| 68 |
on get_post output and used it in form/save_field.php |
|
| 69 |
------------------------------------- 2.6.4 ------------------------------------- |
|
| 70 |
20-May-2006 Ryan Djurovich |
|
| 71 |
# Fixed security issues related to #237 |
|
| 72 |
# Fixed typo in news save comment page (#282) |
|
| 73 |
# Fixed typo in news delete post page (#283) |
|
| 74 |
! Added multi-submission protection to form module (#119) |
|
| 75 |
# Added notice for when PHP Session Support appears to be disabled in installer, |
|
| 76 |
even if it is enabled and the problem actually lies in the users browser (#154) |
|
| 77 |
19-May-2006 Ryan Djurovich |
|
| 78 |
# Fixed problem in forgotten login form where email field is too short (#207) |
|
| 79 |
# Fixed typo in forgotten login details email (#190) |
|
| 80 |
15-May-2006 Stefan Braunewell |
|
| 81 |
# Fixed security issues (#237) |
|
| 82 |
03-May-2006 Stefan Braunewell |
|
| 83 |
# Fixed problems with pre-2.6.0 modules in section list |
|
| 84 |
# Fixed e-mail bug caused by From: headers in internal mail function calls |
|
| 85 |
(#189) |
|
| 86 |
# E-mail validation in install script now accepts new top-level domains |
|
| 87 |
(#162) |
|
| 88 |
# Error status is now overwritten by next database query (#182) |
|
| 89 |
# Fixed obscure problem in htmlarea install script |
|
| 90 |
------------------------------------- 2.6.3 ------------------------------------- |
|
| 91 |
19-Mar-2006 Stefan Braunewell |
|
| 92 |
# Fixed ticket #146: problems removing groups from viewers list of a page |
|
| 93 |
16-Mar-2006 Stefan Braunewell |
|
| 94 |
! Changed link target selection. Now self, top and new. (Ticket #145) |
|
| 95 |
# Fixed ticket #143. Charset setting is now used in admin login and forgot |
|
| 96 |
password pages. |
|
| 97 |
# Some changes to the SQL code in the install script for improved |
|
| 98 |
compatibility with new MySQL versions |
|
| 99 |
# Fixed ticket #134 - error on browsing media. |
|
| 100 |
+ Improved backup module: new choice between full database or WB-related |
|
| 101 |
backup. |
|
| 102 |
# Fixed ticket #141 - admin now sees all folders in media |
|
| 103 |
# Fixed e-mail sending problems due to additional parameter in mail call. |
|
| 104 |
# Applied fix regarding ticket #138: new users now get deleted if |
|
| 105 |
sending e-mail fails. |
|
| 106 |
# Fixed ticket #137: Last Reset timer not reset in frontend forgotten |
|
| 107 |
password process |
|
| 108 |
# Removed duplicate expression from modules/news/install.php which caused |
|
| 109 |
problems in installation |
|
| 110 |
|
|
| 111 |
01-Mar-2006 Stefan Braunewell |
|
| 112 |
# Fixed ticket #68 - Safari problem with displaying all parents. |
|
| 113 |
# Fixed ticket #136 - mailing forgotten password in admin login screen leads |
|
| 114 |
to fatal error. |
|
| 115 |
! Renamed tag [PROCESSTIME] to [PROCESS_TIME] |
|
| 116 |
------------------------------------- 2.6.2 ------------------------------------- |
|
| 117 |
03-Feb-2006 Stefan Braunewell (very big special thanks to John and Alex) |
|
| 118 |
# Fixed ticket #104 - commas in form field descriptions not allowed. |
|
| 119 |
# Cookie REMEMBER_KEY wasn't cleared in account/logout |
|
| 120 |
and expiration date is now set to time in the past. |
|
| 121 |
# Smart login not working. |
|
| 122 |
! Changed mail calls to new function $wb->mail. |
|
| 123 |
# Form: ticket 124 added captcha settings check |
|
| 124 |
# Ticket 118 added formfield type to check for email/text |
|
| 125 |
# Ticket 115 changed comparision /modules/form/view.php |
|
| 126 |
# Added correct timecheck in form submissions |
|
| 127 |
! Changed captcha.php call to include timestamp |
|
| 128 |
! Changed the e-mail validation code and added a mail function to class wb. |
|
| 129 |
! Forgotten password: if sending of e-mail fails, restore old password. |
|
| 130 |
Ticket #110 |
|
| 131 |
! Added more charset options. Ticket #102 - thanks to ruebenwurzel! |
|
| 132 |
! Character encoding setting also affects admin backend. |
|
| 133 |
Mentioned in ticket #102. |
|
| 134 |
! Reintroduced page languages setting. If switched to off, page |
|
| 135 |
languages are only used to determine the language file for the |
|
| 136 |
universal texts. If on, displayed page and menu are affected by |
|
| 137 |
the language session variable. |
|
| 138 |
# Fixed bugs in show_breadcrumbs code and added parameter "depth" |
|
| 139 |
to set the number of levels to be show. |
|
| 140 |
# Fixed a bug where access settings of registered and private pages |
|
| 141 |
were displayed incorrectly. |
|
| 142 |
# Fixed captcha being cached. |
|
| 143 |
# Added an exit call after every heading("Location:...")
|
|
| 144 |
redirector to prevent unwanted execution of code. |
|
| 145 |
# Bug #122. Replaced empty field check by check that setting name is |
|
| 146 |
not "wb_version". |
|
| 147 |
# Replaced all remaining occurrences of '/media' by MEDIA_DIRECTORY - bug #108. |
|
| 148 |
# Fixed bug #99 and two additional instances of typo |
|
| 149 |
catpcha instead of captcha. |
|
| 150 |
# Fixed some typos |
|
| 151 |
# Fixed some notices and warnings. |
|
| 152 |
# Fixed bug #105 - back buttons in addon detail pages not editable. |
|
| 153 |
! Replace 'admin' by 'wb' in all account pages. |
|
| 154 |
!/# Moved print_success and print_error code to class.wb.php. |
|
| 155 |
Added correct parameters to these functions in account pages. |
|
| 156 |
------------------------------------- 2.6.1 ------------------------------------- |
|
| 157 |
12-Dec-2005 Ryan Djurovich |
|
| 158 |
# Fixed security vulnerability in class.login.php |
|
| 159 |
# Fixed typo in EN language file |
|
| 160 |
# Fixed captcha problems (when feature is disabled) in form module and sign-up |
|
| 161 |
! Added charset encoding to admin templates |
|
| 162 |
! Added extra code to check for selection of addon upon uninstalling |
|
| 163 |
# Fixed bugs in RSS news feeder |
|
| 164 |
# Fixed bug with PAGE_DESCRIPTION not being set on any page |
|
| 165 |
------------------------------------- 2.6.0 ------------------------------------- |
|
| 166 |
28-Nov-2005 Ryan Djurovich |
|
| 167 |
+ Added default charset option to (advanced) settings |
|
| 168 |
# Form module email fields now have email address validation |
|
| 169 |
# Fixed spacing in form submissions |
|
| 170 |
27-Nov-2005 Ryan Djurovich |
|
| 171 |
+ Added captcha verification to sign-up form |
|
| 172 |
+ Added Captcha to News module |
|
| 173 |
24-Nov-2005 Stefan Braunewell |
|
| 174 |
! Applied aportale's patch to use label instead of javascript toggle code |
|
| 175 |
20-Nov-2005 Ryan Djurovich |
|
| 176 |
! News mod now hides read more link if no need for it (see ticket #56) |
|
| 177 |
+ Added support for mailto: links in the menu link mod |
|
| 178 |
# Added direct-access redirection on some files (see ticket #37) |
|
| 179 |
+ Added extra characters to convert.php (see ticket #64) |
|
| 180 |
# Fixed ticket #65 (last_reset check in account/forgot_form.php) |
|
| 181 |
29-Sep-2005 Ryan Djurovich |
|
| 182 |
! Cleaned up form buttons in Settings |
|
| 183 |
! Moved some options into Advanced Settings |
|
| 184 |
# Semi-disabled "separate" page trash option |
|
| 185 |
+ Created a backup module/tool for backing-up the database |
|
| 186 |
(thanks to John (pcwacht) for the original code) |
|
| 187 |
+ Created new "blank template", which can be used in case where you don't |
|
| 188 |
want anything wrapping page-content. |
|
| 189 |
19-Sep-2005 Ryan Djurovich |
|
| 190 |
+ Added _license field for all add-ons to specify a license |
|
| 191 |
! Renamed _designed_for variables (for all addons) to _platform |
|
| 192 |
+ Created addons table for faster internal referencing of installed addons |
|
| 193 |
! Fixed some links, including the "Help" button in Admin |
|
| 194 |
# Used nl2br to display body correctly when viewing form-submissions |
|
| 195 |
15-Sep-2005 Stefan Braunewell |
|
| 196 |
+ Added table module with columns 'name','type' and 'directory' as an |
|
| 197 |
index. |
|
| 198 |
+ Added entry to settings table 'wb_version' which holds the version |
|
| 199 |
number and can be utilized in future upgrade scripts. |
|
| 200 |
! Added upgrade functionality also for templates and languages. |
|
| 201 |
#/! Template/modules installation now respects paths. |
|
| 202 |
! Moved updates from config.php to database. |
|
| 203 |
Created initialize.php (required by config.php) to read settings. |
|
| 204 |
11-Sep-2005 Stefan Braunewell |
|
| 205 |
! HTMLArea is now a module instead of a core component. Files moved |
|
| 206 |
from "include" to "modules". |
|
| 207 |
+ Implemented Installation of modules on top of an older version. This is |
|
| 208 |
done via checking $module_version. Instead of install.php, upgrade.php |
|
| 209 |
is then called if it exists in the module package. |
|
| 210 |
For module developers: $module_version and $new_module_version are |
|
| 211 |
accessible in upgrade.php to find out what upgrade steps need to be taken. |
|
| 212 |
! Changed column names in mod_news_posts from short,long to content_short, |
|
| 213 |
content_long. |
|
| 214 |
09-Sep-2005 Stefan Braunewell |
|
| 215 |
+ Added new advanced setting "Rename Files On Upload". File extensions can be |
|
| 216 |
given so that respective files will have a ".txt" appended on media upload. |
|
| 217 |
# Fixed "None found" message bug when user has no top level page edit |
|
| 218 |
rights. |
|
| 219 |
# Fixed missing parent option 'none' - ticket #12 - and a minor scope bug. |
|
| 220 |
+ Added breadcrumbs code. Call using $wb->breadcrumbs(). |
|
| 221 |
+ Added utf-8 character encoding meta tag into all stock templates. |
|
| 222 |
# Fixed bug when changing a page's parent |
|
| 223 |
! Changed the way blocks are treated. Added new frontend class attribute |
|
| 224 |
default_block_content that controls what is shown on pages such as |
|
| 225 |
search, login, etc. (Ticket #16) |
|
| 226 |
+ Added support for WYSIWYG editor modules (wysiwygmod) |
|
| 227 |
+ When trying to access a registered page, user is automatically redirected |
|
| 228 |
there on successful login. |
|
| 229 |
# Fixed various issues with system search (mainly related to stripslashes() |
|
| 230 |
# Removed stripslashes() in many places in the code. Added check for |
|
| 231 |
magic_quotes_gpc to new wb class method add_slashes(). Now database contest |
|
| 232 |
is independent of magic_quotes setting.. |
|
| 233 |
05-Sep-2005 Stefan Braunewell |
|
| 234 |
# Fixed bug concerning direct access of preferences page. |
|
| 235 |
# Reworked page visibility and menu item visibility code (frontend login |
|
| 236 |
problem). |
|
| 237 |
# Pages in link list in htmlarea popup are now correctly ordered. |
|
| 238 |
# Fixed bug where group with existing name can be added. |
|
| 239 |
04-Sep-2005 Ryan Djurovich |
|
| 240 |
+ Added and RSS newsfeed script to the News module |
|
| 241 |
04-Sep-2005 Stefan Braunewell |
|
| 242 |
! Rewrote menu function. Parameters are now given as attributes to frontend class. |
|
| 243 |
# Fixed some occurrences of potential direct access path disclosure |
|
| 244 |
# Added directory check to browse.php to prevent xss exploit by trusted users. |
|
| 245 |
! Updated code to reflect move to Subversion repository system. |
|
| 246 |
27-Aug-2005 Stefan Braunewell |
|
| 247 |
# Fixed bugs 4,5,6,8,9 in bug tracker |
|
| 248 |
! Removed 'USER_LANGUAGE' and 'GET_LANGUAGE' constants. |
|
| 249 |
A GET['lang'] now sets the session language variable. |
|
| 250 |
26-Aug-2005 Stefan Braunewell |
|
| 251 |
! Moved redundant code into the new class functions. Created |
|
| 252 |
'compatibility.php' for backward compatibility with |
|
| 253 |
modules and templates. Variables and functions can still be accessed |
|
| 254 |
in the old way. |
|
| 255 |
!/+ Reorganized core frontend files, added new base class 'wb' from |
|
| 256 |
which 'admin' and the new 'frontend' class inherit. Moved all frontend |
|
| 257 |
function into new class. Completely rewrote core index.php. |
|
| 258 |
Now all variables and functions that are available to templates and |
|
| 259 |
modules are attributes and methods of the frontend and the wb classes |
|
| 260 |
------------------------------------- 2.5.2 ------------------------------------- |
|
| 261 |
23-Jun-2005 Ryan Djurovich |
|
| 262 |
! create_access_file now creates all parent directories if needed |
|
| 263 |
# Fixed bug when moving page with subpages to another level |
|
| 264 |
# Fixed bug when saving "Settings" (in Admin) on Windows/IIS |
|
| 265 |
# Fixed bug where query was not setting error correctly in class.database.php |
|
| 266 |
22-Jun-2005 Ryan Djurovich |
|
| 267 |
# Fixed bug where template permissions were not saved when a adding group |
|
| 268 |
21-Jun-2005 Ryan Djurovich |
|
| 269 |
# Added htmlspecialchars for modifying WYSIWYG, news, etc. modules (Bug #78) |
|
| 270 |
# Fixed language problems in some area's of Admin. (Bug #70) |
|
| 271 |
# Added a space in website/page keywords (Bug #69) |
|
| 272 |
# Fixed bugs on settings2.php (Bug #52) |
|
| 273 |
! Links inserted with HTMLArea now use [wblink--PAGE_ID--] instead of raw URL |
|
| 274 |
13-Jun-2005 Ryan Djurovich |
|
| 275 |
# Fixed bug (#88) with news module |
|
| 276 |
! Title of Administration login page now taken from language file (Bug #72) |
|
| 277 |
# Fixed redirection admin/home to admin/start on admin/index.php |
|
| 278 |
# Fixed bug with forgotten password page in admin (Bug #81) |
|
| 279 |
25-Apr-2005 Ryan Djurovich |
|
| 280 |
# Fixed numerous bugs with module uninstallation |
|
| 281 |
# Fixed bug when uploading files in Administration -> Media |
|
| 282 |
! Installer no-longer requires you to accept the GNU GPL |
|
| 283 |
------------------------------------- 2.5.1 ------------------------------------- |
|
| 284 |
16-Apr-2005 Ryan Djurovich |
|
| 285 |
# Fixed two bugs with account login/logout |
|
| 286 |
------------------------------------- 2.5.1 ------------------------------------- |
|
| 287 |
15-Apr-2005 Ryan Djurovich |
|
| 288 |
# Fixed bug where non-english characters can get used in page filenames. Many |
|
| 289 |
measuers have been added (including a new file: wb/framework/convert.php), |
|
| 290 |
to prevent any possible errors that can occur in page filenames. |
|
| 291 |
# Fixed invalid meta tags in stock templates (meta tags were not closed) |
|
| 292 |
# Removed lines 401, 402, and 425 of wb/index.php - not needed |
|
| 293 |
# Fixed bug where search and account pages are shown in every block |
|
| 294 |
that is in a template |
|
| 295 |
# Fixed numerous bugs with media home directories feature |
|
| 296 |
10-Apr-2005 Ryan Djurovich |
|
| 297 |
# Fixed bugs in account/login.php and logout.php where users |
|
| 298 |
gets redirected to /pages |
|
| 299 |
------------------------------------- 2.5.0 ------------------------------------- |
|
| 300 |
08-Apr-2005 Ryan Djurovich |
|
| 301 |
- Removed section language feature |
|
| 302 |
+ Added page language feature (replaces need for sections language feature) |
|
| 303 |
# Fixed bug where pages using menu_link module can have the URL changed |
|
| 304 |
- Page directory no longer stored in link field in pages table, it is now added |
|
| 305 |
when the page_link function is called - this makes changing the pages |
|
| 306 |
directory much easier and quicker |
|
| 307 |
! Pages with visibility of "none" are now no longer directly accessable |
|
| 308 |
+ Added new visibility setting "hidden", acts exactly like none did previously |
|
| 309 |
! Template info file can now specify number of menu's available and relative names |
|
| 310 |
! Template info file can now specify number of blocks's available and relative names |
|
| 311 |
------------------------------------- 2.4.3 ------------------------------------- |
|
| 312 |
07-Apr-2005 Ryan Djurovich |
|
| 313 |
# page_filename function has been rewritten using str_replace |
|
| 314 |
function, which should be faster and will allow characters |
|
| 315 |
from other languages into filenames |
|
| 316 |
! Created new media_filename function, which is now used |
|
| 317 |
by all media functions (create,upload,rename) to determine |
|
| 318 |
which characters should be removed from a desired filename |
|
| 319 |
+ New button in Administration page list to view specific page |
|
| 320 |
# Updated the page_link function to now be compatible with menu link |
|
| 321 |
module when setting pages directory to root |
|
| 322 |
# Fixed bugs in search when using "Any Words" option |
|
| 323 |
# Fixed bug with news module when pages directory set to root |
|
| 324 |
! Changed URL of documentation website on Administration Start page |
|
| 325 |
------------------------------------- 2.4.2 ------------------------------------- |
|
| 326 |
05-Apr-2005 Ryan Djurovich |
|
| 327 |
# Fixed bug where file could be renamed to nothing in Media |
|
| 328 |
! Optimised Media create folder, upload file, and rename functions |
|
| 329 |
# Fixed bug where stripslashes not run on news post titles in admin |
|
| 330 |
05-Apr-2005 Stefan Braunewell |
|
| 331 |
# Fixed bug concerning usage of the private_sql variable |
|
| 332 |
# Fixed bug conerning sub-pages being displayed in menus incorrectly |
|
| 333 |
------------------------------------- 2.4.1 ------------------------------------- |
|
| 334 |
04-Apr-2005 Ryan Djurovich |
|
| 335 |
! Pages with visibility of "none" are again directly accessable |
|
| 336 |
# Fixed bugs regarding renaming files and directories in Media section |
|
| 337 |
! When home folders disabled, all folders now visible in Media section |
|
| 338 |
------------------------------------- 2.4.0 ------------------------------------- |
|
| 339 |
03-Apr-2005 Ryan Djurovich |
|
| 340 |
- Removed recently added visibility setting of "heading", and relative config vars |
|
| 341 |
+ Added new "menu" field to pages table, and new setting "multiple menus" |
|
| 342 |
which replaces the need for the menu headings feature |
|
| 343 |
+ Added links to top of groups and users sections, linking to each other |
|
| 344 |
! Change menu width in "Round" template to 170px (was 150px) |
|
| 345 |
# Change page "are you sure" deletion message to mention that it will delete |
|
| 346 |
all sub-pages as well |
|
| 347 |
# Fixed many bugs with news module when viewing posts by group |
|
| 348 |
! Pages with visibility of "none" are now no longer directly accessable |
|
| 349 |
02-Apr-2005 Ryan Djurovich |
|
| 350 |
- Removed need to specify DB_URL when calling database class |
|
| 351 |
# Stopped fields without a type specified from being shown in form mod |
|
| 352 |
# Changed '/media' to MEDIA_DIRECTORY on HTMLArea popup windows |
|
| 353 |
for insert link and insert image |
|
| 354 |
+ Added setting which allows you to specify the default WYSIWYG style |
|
| 355 |
+ Added "Server Email" option, to specify what is used in "From" field when |
|
| 356 |
sending emails using the PHP mail function. Default is admins email address. |
|
| 357 |
# Search now excludes pages which have a visibility of none or heading |
|
| 358 |
! Pages are now given modified_when and modified_by when added |
|
| 359 |
01-Apr-2005 Ryan Djurovich |
|
| 360 |
+ Added option to News module to specify how many posts should be listed |
|
| 361 |
per page (by default it is set to unlimited, which functions like previous version) |
|
| 362 |
# Added stripslashes when display page titles in search |
|
| 363 |
+ Page descriptions and last updated date now shown in search by default |
|
| 364 |
30-Mar-2005 Ryan Djurovich |
|
| 365 |
+ Added new feature for Media home folders, where a folder can be specified |
|
| 366 |
for a specific user or group of users only |
|
| 367 |
! Changed URL of Help button to http://www.websitebaker.org/docs/ |
|
| 368 |
+ Added new feature for "Page Trash" - two modes available: inline and separate |
|
| 369 |
! When pages are deleted, all sub-pages are now deleted (instead of being moved |
|
| 370 |
up a level) |
|
| 371 |
29-Mar-2005 Ryan Djurovich |
|
| 372 |
- Removed Database Settings from Administration Settings (options will not be |
|
| 373 |
available in 3.x, so trying to match interface with WB 3.x plans |
|
| 374 |
! Changed the name of Path Settings to Filesystem Settings in Administration |
|
| 375 |
Settings, and removed ability to change path/url options - matching interface |
|
| 376 |
plans for WB 3.x |
|
| 377 |
+ Added same options for OS and file permissions as installer to Settings |
|
| 378 |
! Sessions now named with APP_NAME.'_session_id' (e.g. default is wb_session_id) |
|
| 379 |
28-Mar-2005 Ryan Djurovich |
|
| 380 |
+ New functions available to templates to simplify creation of them. This aims |
|
| 381 |
to "future-proof" templates for WB 3.x plans. |
|
| 382 |
! Default templates updated to support some of the new functions |
|
| 383 |
+ Added field to pages table "page_trail" which stores a list of the pages |
|
| 384 |
parents. This field was needed by the new page_menu function |
|
| 385 |
+ Added option for page visibility "heading" to enabled support for multiple |
|
| 386 |
menu's. Also, this helps to "future-proof" templates for WB 3.x plans |
|
| 387 |
+ Added option for page visibility "registered", which acts a little like |
|
| 388 |
private, but is still shown in the menu (although users need to log in to view |
|
| 389 |
the pages content) |
|
| 390 |
+ Form module submissions now saved to database, and feature now added to |
|
| 391 |
limit number of submissions per hour to prevent spamming |
|
| 392 |
+ New field for Form module: email. Allows you to specify their email in |
|
| 393 |
"from" field on module settings. |
|
| 394 |
# Fixed bug when displaying comments in News module (WB Bug #14) |
|
| 395 |
+ New "under contruction" message if no pages exist |
|
| 396 |
! Cleaned-up wb/index.php |
|
| 397 |
27-Mar-2005 Ryan Djurovich |
|
| 398 |
+ Created advanced mkdir and chmod functions |
|
| 399 |
# Fixed bug in media where wrong file/folder is deleted |
|
| 400 |
+ Complete overhall of installer - now only one step! It has been greatly |
|
| 401 |
simplified in many ways, has much better validation, reports error much more |
|
| 402 |
nicely, and automatically logs the user into the Administrations |
|
| 403 |
+ Must now specify OS type - allows for customizable file permission settings |
|
| 404 |
+ Sections can now have a language code assigned to them |
|
| 405 |
+ Sections can now have a block name/id assigned to them |
|
| 406 |
! Home section of Administration renamed to Start, to save confusion with saying |
|
| 407 |
Homepage (because this term could either mean the main website or Home section |
|
| 408 |
in Administration). Also, this aims to unify the interface with WB 3.x plans |
|
| 409 |
! Moved Users and Groups sections under Access section. This aims to unify the |
|
| 410 |
interface with WB 3.x plans, which help to unclutter the menu |
|
| 411 |
! Interface for Settings section has been imporved for usability purposes |
|
| 412 |
# Fixed HTMLArea where no scrollbar for "insert link" and "insert image" dialogs |
|
| 413 |
by placing media list inside an iframe |
|
| 414 |
# Fixed stripslashes problem for viewing news comments |
|
| 415 |
! Added code from Formesque module (an advanced version of the original Form |
|
| 416 |
module, modified by Rudolph Lartey from www.carbonect.com), and made further |
|
| 417 |
interface improvements for select box/checkbox group/radio group options. |
|
| 418 |
# Possibly fixed bugs where an S appears before file and dir modes |
|
| 419 |
# Fixed bug where users can be added with same emails (in Administration) |
|
| 420 |
- Removed support for PEAR, as it was deemed an unnecessary addition which only |
|
| 421 |
makes code more bulky, and removing it will decrease package size a lot |
|
| 422 |
+ New "homepage redirect" option so first page is included and not redirected to |
|
| 423 |
# Fixed text not being shown when module uninstalled |
|
| 424 |
! Imporved interface for basic group permissions |
|
| 425 |
26-Mar-2005 Stefan Braunewell |
|
| 426 |
# Fixed bug with front-end logins |
|
| 427 |
# Fixed bug when saving intro page |
|
| 428 |
+ Added check on sign-up if e-mail exists (thanks to P. Melief) |
|
| 429 |
# Fixed bugs concerning moving/deleting pages |
|
| 430 |
# Fixed list of parents in page settings |
|
| 431 |
# Fixed mkdir without mode parameter |
|
| 432 |
# Added a check on install to ensure PHP 4.1.x compatibility (thanks to Wanderer) |
|
| 433 |
+ Added support for PAGES_DIRECTORY set to root |
|
| 434 |
+ Search form now supports quotes (thanks to Manafta) |
|
| 435 |
# Fixed page section ordering |
|
| 436 |
# News items are displayed with name of poster instead of "Unknown" |
|
| 437 |
# Deletion confirmation popup window in media section now shows correct file name |
|
| 438 |
------------------------------------- 2.3.1 ------------------------------------- |
|
| 439 |
03-Fed-2005 Ryan Djurovich |
|
| 440 |
+ Now there is two types of "filesystem modes", one for directories and one |
|
| 441 |
for files. Having different settings is very common for most servers, so |
|
| 442 |
this addition should fix many problems people had with 2.3.0. |
|
| 443 |
- Removed filesystem mode options from installation |
|
| 444 |
! Removed duplicate text on installation step 3 for timezone |
|
| 445 |
! All "access files" for the news module now stored in pages/posts instead |
|
| 446 |
of a sub-dir relative to the page (this fixes many bugs) |
|
| 447 |
# Fixed major bugs when deleting pages with sub-pages |
|
| 448 |
! Removed the restrictions that prevent a user for changing a pages level |
|
| 449 |
# Fixed bug with "toggle" plus/minus in IE for pages list |
|
| 450 |
# Fixed some bugs where /pages was not replaced with PAGES_DIRECTORY constant |
|
| 451 |
------------------------------------- 2.3.0 ------------------------------------- |
|
| 452 |
26-Jan-2005 Ryan Djurovich |
|
| 453 |
# Fixed bug in framework/functions.php that made root parent always equal 8 |
|
| 454 |
# Added missing braces in lines 182 and 208 of admin/pages/settings2.php |
|
| 455 |
# Fixed SQL-query on line 172, placing a / after $old_link |
|
| 456 |
# Added eregi checks for PAGES_DIRECTORY on lines 140 and 150 of |
|
| 457 |
admin/pages/settings2.php |
|
| 458 |
# Added ordering cleaning to delete_post.php on line 53 for news module |
|
| 459 |
! GMT option is selected for "Default Timezone" in the installer, instead |
|
| 460 |
of the old "Please select" message (which had the same value as GMT) |
|
| 461 |
28-Jan-2005 Ryan Djurovich |
|
| 462 |
! Ability to specify the chmod number when WB uploads files, etc. |
|
| 463 |
! Modified file headers (copyright/license notice) so they now look almost the |
|
| 464 |
same, independant of font. Also, it now covers copyright for 2005. |
|
| 465 |
30-Jan-2005 Ryan Djurovich |
|
| 466 |
# Added code on wb/admin/pages/delete.php to remove sections from the sections |
|
| 467 |
table when a page is deleted. |
|
| 468 |
+ New 'Smart Login' prevents users from using external password managers, |
|
| 469 |
and can be set to remember the users password using cookies. |
|
| 470 |
! SourceForge CVS module now called websitebaker2 (instead of just |
|
| 471 |
websitebaker). Also, all file versions have been reset. |
|
| 472 |
01-Fed-2005 Ryan Djurovich |
|
| 473 |
! Added code to prevent from changing a pages level (it simply disables |
|
| 474 |
the select box), to prevent many possible bugs. |
|
| 475 |
------------------------------------- 2.2.4 ------------------------------------- |
|
| 476 |
23-Dec-2004 Ryan Djurovich |
|
| 477 |
! Change 'EXACT_PHRASE' to 'EXACT_MATCH' on line 261 of wb/languages/EN.php |
|
| 478 |
# Fixed multi-language support in search |
|
| 479 |
+ Added more detailed options to list of PHP error reporting level's |
|
| 480 |
- Removed ability to change language and PHP error reporting level |
|
| 481 |
on installation to make things easier for newbie's |
|
| 482 |
+ Ability to select custom spacer for page filename's |
|
| 483 |
! Changed the way a language code is found on language installation |
|
| 484 |
+ Added template permissions to groups |
|
| 485 |
# Fixed bug when trying to change email from Preferences (admin and frontend) |
|
| 486 |
# Fixed bug with auto-selection of "System Default" for Preferences |
|
| 487 |
! News module now use's WYSIWYG for modifying news posts |
|
| 488 |
+ Ability to specify both the pages and media target directories |
|
| 489 |
------------------------------------ 2.2.3-c ------------------------------------ |
|
| 490 |
22-Dec-2004 Ryan Djurovich |
|
| 491 |
# Fixed problem with DB password being reset if Settings saved in basic mode |
|
| 492 |
------------------------------------ 2.2.3-b ------------------------------------ |
|
| 493 |
21-Dec-2004 Ryan Djurovich |
|
| 494 |
# Fixed minor bug on admin templates section |
|
| 495 |
# Fixed bug on rename.php and rename2.php in admin media section |
|
| 496 |
------------------------------------- 2.2.3 ------------------------------------- |
|
| 497 |
20-Dec-2004 Ryan Djurovich |
|
| 498 |
+ Added WB release version in Administration (top right corner) |
|
| 499 |
! New option to prevent users from adding level 0 pages |
|
| 500 |
# Fixed bug when deleting post's in News module |
|
| 501 |
+ Added new field in pages table for "root" parent (level 0 parent), for |
|
| 502 |
extra flexability in creating templates |
|
| 503 |
! Round template now supports unlimited page levels |
|
| 504 |
------------------------------------- 2.2.2 ------------------------------------- |
|
| 505 |
18-Dec-2004 Ryan Djurovich |
|
| 506 |
+ New option under Search Settings for selecting custom template for search |
|
| 507 |
+ New option when changing page settings to set the target |
|
| 508 |
# Fixed error when saving a user after editing |
|
| 509 |
! Users can now modify sub-page if they dont have permissions on the parent |
|
| 510 |
------------------------------------- 2.2.1 ------------------------------------- |
|
| 511 |
15-Dec-2004 Ryan Djurovich |
|
| 512 |
# Fixed bug when changing password on preferences form (front-end) |
|
| 513 |
# Fixed bug when retrieving user details (administration) |
|
| 514 |
# Added check to see if module, template, or language is in use when deleting |
|
| 515 |
# Fixed up email that is sent to user from a submitted form |
|
| 516 |
# Fixed major problem with module permissions which stopped it from working |
|
| 517 |
------------------------------------- 2.2.0 ------------------------------------- |
|
| 518 |
14-Dec-2004 (Correct date[s] unkown) Ryan Djurovich |
|
| 519 |
+ Multiple-level page support |
|
| 520 |
+ Multiple section's for pages (including interface) |
|
| 521 |
! Removed text created using two words on all areas |
|
| 522 |
(e.g. {Intro} {PAGE} is now {INTRO_PAGE})
|
|
| 523 |
this is for better language support |
|
| 524 |
+ Added Languages section |
|
| 525 |
! Moved Templates and Modules under Add-ons section |
|
| 526 |
! Changed name of "Default" template to "Round" |
|
| 527 |
+ Added "All CSS" template |
|
| 528 |
+ Added "Jump" |
|
| 529 |
+ Added |
|
| 530 |
! Modified "Box" template to support multiple page levels |
|
| 531 |
+ Added "Menu Link" module |
|
| 532 |
+ Added "News" module |
|
| 533 |
+ Added "Code" module |
|
| 534 |
+ Added "Form" module |
|
| 535 |
+ Added "Wrapper" module |
|
| 536 |
! Changed name of "Normal Page" module to "WYSIWYG" |
|
| 537 |
+ Created new admin wrapper script to ease module develpment |
|
| 538 |
+ Media now automatically creates index.php file for every |
|
| 539 |
sub-folder made (for security purposes) |
|
| 540 |
! Change "Help" link in Administration menu so it now directs |
|
| 541 |
to the the new Website Baker documentation website found at: |
|
| 542 |
http://www.websitebaker.org/documentation |
|
| 543 |
! Password is now required to change email in preferences |
|
| 544 |
+ User can now select custom Language and Date & Time Formats |
|
| 545 |
+ Added search functionality, with three different "methods": |
|
| 546 |
1. Using all words 2. Using any words 3. Exact match |
|
| 547 |
+ Added native MySQL database support |
|
| 0 | 548 | |
| branches/2.6.x/wb/framework/class.wb.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2007, 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 |
wb class |
|
| 29 |
|
|
| 30 |
This class is the basis for admin and frontend classes. |
|
| 31 |
|
|
| 32 |
*/ |
|
| 33 |
|
|
| 34 |
// Include PHPLIB template class |
|
| 35 |
require_once(WB_PATH."/include/phplib/template.inc"); |
|
| 36 |
|
|
| 37 |
require_once(WB_PATH.'/framework/class.database.php'); |
|
| 38 |
|
|
| 39 |
// Include new wbmailer class (subclass of PHPmailer) |
|
| 40 |
require_once(WB_PATH."/framework/class.wbmailer.php"); |
|
| 41 |
|
|
| 42 |
class wb |
|
| 43 |
{
|
|
| 44 |
// General initialization function |
|
| 45 |
// performed when frontend or backend is loaded. |
|
| 46 |
function wb() {
|
|
| 47 |
} |
|
| 48 |
|
|
| 49 |
// Check whether we should show a page or not (for front-end) |
|
| 50 |
function show_page($page) {
|
|
| 51 |
// First check if the page is set to private |
|
| 52 |
if($page['visibility'] == 'private' OR $page['visibility'] == 'registered') {
|
|
| 53 |
// Check if the user is logged in |
|
| 54 |
if($this->is_authenticated() == true) {
|
|
| 55 |
// Now check if the user has perms to view it |
|
| 56 |
$viewing_groups = explode(',', $page['viewing_groups']);
|
|
| 57 |
$viewing_users = explode(',', $page['viewing_users']);
|
|
| 58 |
if(is_numeric(array_search($this->get_group_id(), $viewing_groups)) OR is_numeric(array_search($this->get_user_id(), $viewing_users))) {
|
|
| 59 |
return true; |
|
| 60 |
} else {
|
|
| 61 |
return false; |
|
| 62 |
} |
|
| 63 |
} else {
|
|
| 64 |
return false; |
|
| 65 |
} |
|
| 66 |
} elseif($page['visibility'] == 'public') {
|
|
| 67 |
return true; |
|
| 68 |
} else {
|
|
| 69 |
return false; |
|
| 70 |
} |
|
| 71 |
} |
|
| 72 |
|
|
| 73 |
// Check if the user is already authenticated or not |
|
| 74 |
function is_authenticated() {
|
|
| 75 |
if(isset($_SESSION['USER_ID']) AND $_SESSION['USER_ID'] != "" AND is_numeric($_SESSION['USER_ID'])) {
|
|
| 76 |
return true; |
|
| 77 |
} else {
|
|
| 78 |
return false; |
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
// Modified addslashes function which takes into account magic_quotes |
|
| 82 |
function add_slashes($input) {
|
|
| 83 |
if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
|
|
| 84 |
return $input; |
|
| 85 |
} |
|
| 86 |
$output = addslashes($input); |
|
| 87 |
return $output; |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
// Ditto for stripslashes |
|
| 91 |
function strip_slashes($input) {
|
|
| 92 |
if ( !get_magic_quotes_gpc() || ( !is_string($input) ) ) {
|
|
| 93 |
return $input; |
|
| 94 |
} |
|
| 95 |
$output = stripslashes($input); |
|
| 96 |
return $output; |
|
| 97 |
} |
|
| 98 |
|
|
| 99 |
// Escape backslashes for use with mySQL LIKE strings |
|
| 100 |
function escape_backslashes($input) {
|
|
| 101 |
return str_replace("\\","\\\\",$input);
|
|
| 102 |
} |
|
| 103 |
|
|
| 104 |
function page_link($link){
|
|
| 105 |
// Check for :// in the link (used in URL's) as well as mailto: |
|
| 106 |
if(strstr($link, '://') == '' AND substr($link, 0, 7) != 'mailto:') {
|
|
| 107 |
return WB_URL.PAGES_DIRECTORY.$link.PAGE_EXTENSION; |
|
| 108 |
} else {
|
|
| 109 |
return $link; |
|
| 110 |
} |
|
| 111 |
} |
|
| 112 |
|
|
| 113 |
// Get POST data |
|
| 114 |
function get_post($field) {
|
|
| 115 |
if(isset($_POST[$field])) {
|
|
| 116 |
return $_POST[$field]; |
|
| 117 |
} else {
|
|
| 118 |
return null; |
|
| 119 |
} |
|
| 120 |
} |
|
| 121 |
|
|
| 122 |
// Get POST data and escape it |
|
| 123 |
function get_post_escaped($field) {
|
|
| 124 |
$result = $this->get_post($field); |
|
| 125 |
return (is_null($result)) ? null : $this->add_slashes($result); |
|
| 126 |
} |
|
| 127 |
|
|
| 128 |
// Get GET data |
|
| 129 |
function get_get($field) {
|
|
| 130 |
if(isset($_GET[$field])) {
|
|
| 131 |
return $_GET[$field]; |
|
| 132 |
} else {
|
|
| 133 |
return null; |
|
| 134 |
} |
|
| 135 |
} |
|
| 136 |
|
|
| 137 |
// Get SESSION data |
|
| 138 |
function get_session($field) {
|
|
| 139 |
if(isset($_SESSION[$field])) {
|
|
| 140 |
return $_SESSION[$field]; |
|
| 141 |
} else {
|
|
| 142 |
return null; |
|
| 143 |
} |
|
| 144 |
} |
|
| 145 |
|
|
| 146 |
// Get SERVER data |
|
| 147 |
function get_server($field) {
|
|
| 148 |
if(isset($_SERVER[$field])) {
|
|
| 149 |
return $_SERVER[$field]; |
|
| 150 |
} else {
|
|
| 151 |
return null; |
|
| 152 |
} |
|
| 153 |
} |
|
| 154 |
|
|
| 155 |
// Get the current users id |
|
| 156 |
function get_user_id() {
|
|
| 157 |
return $_SESSION['USER_ID']; |
|
| 158 |
} |
|
| 159 |
|
|
| 160 |
// Get the current users group id |
|
| 161 |
function get_group_id() {
|
|
| 162 |
return $_SESSION['GROUP_ID']; |
|
| 163 |
} |
|
| 164 |
|
|
| 165 |
// Get the current users group name |
|
| 166 |
function get_group_name() {
|
|
| 167 |
return $_SESSION['GROUP_NAME']; |
|
| 168 |
} |
|
| 169 |
|
|
| 170 |
// Get the current users username |
|
| 171 |
function get_username() {
|
|
| 172 |
return $_SESSION['USERNAME']; |
|
| 173 |
} |
|
| 174 |
|
|
| 175 |
// Get the current users display name |
|
| 176 |
function get_display_name() {
|
|
| 177 |
return ($_SESSION['DISPLAY_NAME']); |
|
| 178 |
} |
|
| 179 |
|
|
| 180 |
// Get the current users email address |
|
| 181 |
function get_email() {
|
|
| 182 |
return $_SESSION['EMAIL']; |
|
| 183 |
} |
|
| 184 |
|
|
| 185 |
// Get the current users home folder |
|
| 186 |
function get_home_folder() {
|
|
| 187 |
return $_SESSION['HOME_FOLDER']; |
|
| 188 |
} |
|
| 189 |
|
|
| 190 |
// Get the current users timezone |
|
| 191 |
function get_timezone() {
|
|
| 192 |
if(!isset($_SESSION['USE_DEFAULT_TIMEZONE'])) {
|
|
| 193 |
return $_SESSION['TIMEZONE']; |
|
| 194 |
} else {
|
|
| 195 |
return '-72000'; |
|
| 196 |
} |
|
| 197 |
} |
|
| 198 |
|
|
| 199 |
// Validate supplied email address |
|
| 200 |
function validate_email($email) {
|
|
| 201 |
if(eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $email)) {
|
|
| 202 |
return true; |
|
| 203 |
} else {
|
|
| 204 |
return false; |
|
| 205 |
} |
|
| 206 |
} |
|
| 207 |
|
|
| 208 |
// Print a success message which then automatically redirects the user to another page |
|
| 209 |
function print_success($message, $redirect = 'index.php') {
|
|
| 210 |
global $TEXT; |
|
| 211 |
$success_template = new Template(ADMIN_PATH.'/interface'); |
|
| 212 |
$success_template->set_file('page', 'success.html');
|
|
| 213 |
$success_template->set_block('page', 'main_block', 'main');
|
|
| 214 |
$success_template->set_var('MESSAGE', $message);
|
|
| 215 |
$success_template->set_var('REDIRECT', $redirect);
|
|
| 216 |
$success_template->set_var('NEXT', $TEXT['NEXT']);
|
|
| 217 |
$success_template->parse('main', 'main_block', false);
|
|
| 218 |
$success_template->pparse('output', 'page');
|
|
| 219 |
} |
|
| 220 |
|
|
| 221 |
// Print an error message |
|
| 222 |
function print_error($message, $link = 'index.php', $auto_footer = true) {
|
|
| 223 |
global $TEXT; |
|
| 224 |
$success_template = new Template(ADMIN_PATH.'/interface'); |
|
| 225 |
$success_template->set_file('page', 'error.html');
|
|
| 226 |
$success_template->set_block('page', 'main_block', 'main');
|
|
| 227 |
$success_template->set_var('MESSAGE', $message);
|
|
| 228 |
$success_template->set_var('LINK', $link);
|
|
| 229 |
$success_template->set_var('BACK', $TEXT['BACK']);
|
|
| 230 |
$success_template->parse('main', 'main_block', false);
|
|
| 231 |
$success_template->pparse('output', 'page');
|
|
| 232 |
if($auto_footer == true) {
|
|
| 233 |
$this->print_footer(); |
|
| 234 |
} |
|
| 235 |
exit(); |
|
| 236 |
} |
|
| 237 |
|
|
| 238 |
// Validate send email |
|
| 239 |
function mail($fromaddress, $toaddress, $subject, $message) {
|
|
| 240 |
$fromaddress = preg_replace('/[\r\n]/', '', $fromaddress);
|
|
| 241 |
$toaddress = preg_replace('/[\r\n]/', '', $toaddress);
|
|
| 242 |
$subject = preg_replace('/[\r\n]/', '', $subject);
|
|
| 243 |
$message = preg_replace('/[\r\n]/', '<br \>', $message);
|
|
| 244 |
|
|
| 245 |
/* |
|
| 246 |
SOME SERVICE PROVIDERS DO NOT SUPPORT SENDING MAIL VIA PHP AS IT DOES NOT PROVIDE SMTP AUTHENTICATION |
|
| 247 |
NEW WBMAILER CLASS IS ABLE TO SEND OUT MESSAGES USING SMTP WHICH RESOLVE THESE ISSUE |
|
| 248 |
|
|
| 249 |
NOTE: |
|
| 250 |
To use SMTP for sending out mails, you have to specify the SMTP host of your domain |
|
| 251 |
via the variable "WBMAILER_SMTP_HOST" in the "config.php" file |
|
| 252 |
If variable is not defined, the WBMAILER class uses the PHP mail() function per default |
|
| 253 |
|
|
| 254 |
the mail header is automatically created by PHPMailer and therefore commented out |
|
| 255 |
UPDATE INTRODUCED BY DOC (C. SOMMER, 22. October 2006) |
|
| 256 |
*/ |
|
| 257 |
|
|
| 258 |
/* |
|
| 259 |
if ($fromaddress=='') {
|
|
| 260 |
$fromaddress = SERVER_EMAIL; |
|
| 261 |
} |
|
| 262 |
|
|
| 263 |
if(defined('DEFAULT_CHARSET')) {
|
|
| 264 |
$charset = DEFAULT_CHARSET; |
|
| 265 |
} else {
|
|
| 266 |
$charset='utf-8'; |
|
| 267 |
} |
|
| 268 |
|
|
| 269 |
$headers = "MIME-Version: 1.0\n"; |
|
| 270 |
$headers .= "Content-type: text/plain; charset=".$charset."\n"; |
|
| 271 |
$headers .= "X-Priority: 3\n"; |
|
| 272 |
$headers .= "X-MSMail-Priority: Normal\n"; |
|
| 273 |
$headers .= "X-Mailer: Website Baker\n"; |
|
| 274 |
$headers .= "From: ".$fromaddress."\n"; |
|
| 275 |
$headers .= "Return-Path: ".$fromaddress."\n"; |
|
| 276 |
$headers .= "Reply-To: ".$fromaddress."\n"; |
|
| 277 |
$headers .= "\n"; // extra empty line needed?? |
|
| 278 |
|
|
| 279 |
if (OPERATING_SYSTEM=='windows') {
|
|
| 280 |
//str_replace("\n","\r\n",$headers);
|
|
| 281 |
str_replace("\n","\r\n",$message);
|
|
| 282 |
} |
|
| 283 |
|
|
| 284 |
if(mail($toaddress, $subject, $message, $headers)) {
|
|
| 285 |
return true; |
|
| 286 |
} else {
|
|
| 287 |
return false; |
|
| 288 |
} |
|
| 289 |
*/ |
|
| 290 |
|
|
| 291 |
// create PHPMailer object and define default settings |
|
| 292 |
$myMail = new wbmailer(); |
|
| 293 |
|
|
| 294 |
// set user defined from address |
|
| 295 |
if ($fromaddress!='') {
|
|
| 296 |
$myMail->From = $fromaddress; // FROM: |
|
| 297 |
$myMail->AddReplyTo($fromaddress); // REPLY TO: |
|
| 298 |
} |
|
| 299 |
|
|
| 300 |
// define recepient and information to send out |
|
| 301 |
$myMail->AddAddress($toaddress); // TO: |
|
| 302 |
$myMail->Subject = $subject; // SUBJECT |
|
| 303 |
$myMail->Body = $message; // CONTENT (HTML) |
|
| 304 |
$myMail->AltBody = strip_tags($message); // CONTENT (TEXT) |
|
| 305 |
|
|
| 306 |
// check if there are any send mail errors, otherwise say successful |
|
| 307 |
if (!$myMail->Send()) {
|
|
| 308 |
return false; |
|
| 309 |
} else {
|
|
| 310 |
return true; |
|
| 311 |
} |
|
| 312 |
} |
|
| 313 |
|
|
| 314 |
} |
|
| 315 |
?> |
|
| 0 | 316 | |
| branches/2.6.x/wb/framework/class.admin.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2007, 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 |
Admin class |
|
| 29 |
|
|
| 30 |
This class will be used for every program that will be included |
|
| 31 |
in the administration section of Website Baker. |
|
| 32 |
|
|
| 33 |
*/ |
|
| 34 |
|
|
| 35 |
if(!defined('WB_URL')) {
|
|
| 36 |
header('Location: ../index.php');
|
|
| 37 |
exit(0); |
|
| 38 |
} |
|
| 39 |
|
|
| 40 |
require_once(WB_PATH.'/framework/class.wb.php'); |
|
| 41 |
|
|
| 42 |
// Include PHPLIB template class |
|
| 43 |
require_once(WB_PATH."/include/phplib/template.inc"); |
|
| 44 |
|
|
| 45 |
|
|
| 46 |
// Get WB version |
|
| 47 |
require_once(ADMIN_PATH.'/interface/version.php'); |
|
| 48 |
|
|
| 49 |
/* |
|
| 50 |
Begin user changeable settings |
|
| 51 |
*/ |
|
| 52 |
|
|
| 53 |
|
|
| 54 |
class admin extends wb {
|
|
| 55 |
// Authenticate user then auto print the header |
|
| 56 |
function admin($section_name, $section_permission = 'start', $auto_header = true, $auto_auth = true) {
|
|
| 57 |
$this->wb(); |
|
| 58 |
global $MESSAGE; |
|
| 59 |
// Specify the current applications name |
|
| 60 |
$this->section_name = $section_name; |
|
| 61 |
$this->section_permission = $section_permission; |
|
| 62 |
// Authenticate the user for this application |
|
| 63 |
if($auto_auth == true) {
|
|
| 64 |
// First check if the user is logged-in |
|
| 65 |
if($this->is_authenticated() == false) {
|
|
| 66 |
header('Location: '.ADMIN_URL.'/login/index.php');
|
|
| 67 |
exit(0); |
|
| 68 |
} |
|
| 69 |
// Now check if they are allowed in this section |
|
| 70 |
if($this->get_permission($section_permission) == false) {
|
|
| 71 |
die($MESSAGE['ADMIN']['INSUFFICIENT_PRIVELLIGES']); |
|
| 72 |
} |
|
| 73 |
} |
|
| 74 |
// Auto header code |
|
| 75 |
if($auto_header == true) {
|
|
| 76 |
$this->print_header(); |
|
| 77 |
} |
|
| 78 |
} |
|
| 79 |
|
|
| 80 |
// Print the admin header |
|
| 81 |
function print_header($body_tags = '') {
|
|
| 82 |
// Get vars from the language file |
|
| 83 |
global $MENU; |
|
| 84 |
global $MESSAGE; |
|
| 85 |
global $TEXT; |
|
| 86 |
// Connect to database and get website title |
|
| 87 |
global $database; |
|
| 88 |
$get_title = $database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name = 'website_title'");
|
|
| 89 |
$title = $get_title->fetchRow(); |
|
| 90 |
$header_template = new Template(ADMIN_PATH."/interface"); |
|
| 91 |
$header_template->set_file('page', 'header.html');
|
|
| 92 |
$header_template->set_block('page', 'header_block', 'header');
|
|
| 93 |
if(defined('DEFAULT_CHARSET')) {
|
|
| 94 |
$charset=DEFAULT_CHARSET; |
|
| 95 |
} else {
|
|
| 96 |
$charset='utf-8'; |
|
| 97 |
} |
|
| 98 |
$header_template->set_var( array( |
|
| 99 |
'SECTION_NAME' => $MENU[strtoupper($this->section_name)], |
|
| 100 |
'INTERFACE_DIR' => ADMIN_URL.'/interface', |
|
| 101 |
'BODY_TAGS' => $body_tags, |
|
| 102 |
'WEBSITE_TITLE' => ($title['value']), |
|
| 103 |
'TEXT_ADMINISTRATION' => $TEXT['ADMINISTRATION'], |
|
| 104 |
'CHARSET' => $charset, |
|
| 105 |
'VERSION' => VERSION |
|
| 106 |
) |
|
| 107 |
); |
|
| 108 |
// Create the menu |
|
| 109 |
$menu = array( |
|
| 110 |
array(ADMIN_URL.'/start/index.php', '', $MENU['START'], 'start', 0), |
|
| 111 |
array(ADMIN_URL.'/pages/index.php', '', $MENU['PAGES'], 'pages', 1), |
|
| 112 |
array(ADMIN_URL.'/media/index.php', '', $MENU['MEDIA'], 'media', 1), |
|
| 113 |
array(ADMIN_URL.'/addons/index.php', '', $MENU['ADDONS'], 'addons', 1), |
|
| 114 |
array(ADMIN_URL.'/preferences/index.php', '', $MENU['PREFERENCES'], 'preferences', 0), |
|
| 115 |
array(ADMIN_URL.'/settings/index.php', '', $MENU['SETTINGS'], 'settings', 1), |
|
| 116 |
array(ADMIN_URL.'/access/index.php', '', $MENU['ACCESS'], 'access', 1), |
|
| 117 |
array('http://www.websitebaker.org/help/'.WB_VERSION, '_blank', $MENU['HELP'], 'help', 0),
|
|
| 118 |
array(WB_URL.'/', '_blank', $MENU['VIEW'], 'view', 0), |
|
| 119 |
array(ADMIN_URL.'/logout/index.php', '', $MENU['LOGOUT'], 'logout', 0) |
|
| 120 |
); |
|
| 121 |
$header_template->set_block('header_block', 'linkBlock', 'link');
|
|
| 122 |
foreach($menu AS $menu_item) {
|
|
| 123 |
$link = $menu_item[0]; |
|
| 124 |
$target = $menu_item[1]; |
|
| 125 |
$title = $menu_item[2]; |
|
| 126 |
$permission_title = $menu_item[3]; |
|
| 127 |
$required = $menu_item[4]; |
|
| 128 |
$replace_old = array(ADMIN_URL, WB_URL, '/', 'index.php'); |
|
| 129 |
if($required == false OR $this->get_link_permission($permission_title)) {
|
|
| 130 |
$header_template->set_var('LINK', $link);
|
|
| 131 |
$header_template->set_var('TARGET', $target);
|
|
| 132 |
// If link is the current section apply a class name |
|
| 133 |
if($permission_title == strtolower($this->section_name)) {
|
|
| 134 |
$header_template->set_var('CLASS', 'current');
|
|
| 135 |
} else {
|
|
| 136 |
$header_template->set_var('CLASS', '');
|
|
| 137 |
} |
|
| 138 |
$header_template->set_var('TITLE', $title);
|
|
| 139 |
// Print link |
|
| 140 |
$header_template->parse('link', 'linkBlock', true);
|
|
| 141 |
} |
|
| 142 |
} |
|
| 143 |
$header_template->parse('header', 'header_block', false);
|
|
| 144 |
$header_template->pparse('output', 'page');
|
|
| 145 |
} |
|
| 146 |
|
|
| 147 |
// Print the admin footer |
|
| 148 |
function print_footer() {
|
|
| 149 |
$footer_template = new Template(ADMIN_PATH."/interface"); |
|
| 150 |
$footer_template->set_file('page', 'footer.html');
|
|
| 151 |
$footer_template->set_block('page', 'footer_block', 'header');
|
|
| 152 |
$footer_template->parse('header', 'footer_block', false);
|
|
| 153 |
$footer_template->pparse('output', 'page');
|
|
| 154 |
} |
|
| 155 |
|
|
| 156 |
// Return a system permission |
|
| 157 |
function get_permission($name, $type = 'system') {
|
|
| 158 |
// Append to permission type |
|
| 159 |
$type .= '_permissions'; |
|
| 160 |
// Check if we have a section to check for |
|
| 161 |
if($name == 'start') {
|
|
| 162 |
return true; |
|
| 163 |
} else {
|
|
| 164 |
// Set system permissions var |
|
| 165 |
$system_permissions = $this->get_session('SYSTEM_PERMISSIONS');
|
|
| 166 |
// Set module permissions var |
|
| 167 |
$module_permissions = $this->get_session('MODULE_PERMISSIONS');
|
|
| 168 |
// Set template permissions var |
|
| 169 |
$template_permissions = $this->get_session('TEMPLATE_PERMISSIONS');
|
|
| 170 |
// Return true if system perm = 1 |
|
| 171 |
if(is_numeric(array_search($name, $$type))) {
|
|
| 172 |
if($type == 'system_permissions') {
|
|
| 173 |
return true; |
|
| 174 |
} else {
|
|
| 175 |
return false; |
|
| 176 |
} |
|
| 177 |
} else {
|
|
| 178 |
if($type == 'system_permissions') {
|
|
| 179 |
return false; |
|
| 180 |
} else {
|
|
| 181 |
return true; |
|
| 182 |
} |
|
| 183 |
} |
|
| 184 |
} |
|
| 185 |
} |
|
| 186 |
|
|
| 187 |
function get_user_details($user_id) {
|
|
| 188 |
global $database; |
|
| 189 |
$query_user = "SELECT username,display_name FROM ".TABLE_PREFIX."users WHERE user_id = '$user_id'"; |
|
| 190 |
$get_user = $database->query($query_user); |
|
| 191 |
if($get_user->numRows() != 0) {
|
|
| 192 |
$user = $get_user->fetchRow(); |
|
| 193 |
} else {
|
|
| 194 |
$user['display_name'] = 'Unknown'; |
|
| 195 |
$user['username'] = 'unknown'; |
|
| 196 |
} |
|
| 197 |
return $user; |
|
| 198 |
} |
|
| 199 |
|
|
| 200 |
function get_page_details($page_id) {
|
|
| 201 |
global $database; |
|
| 202 |
$query = "SELECT page_id,page_title,modified_by,modified_when FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"; |
|
| 203 |
$results = $database->query($query); |
|
| 204 |
if($database->is_error()) {
|
|
| 205 |
$this->print_header(); |
|
| 206 |
$this->print_error($database->get_error()); |
|
| 207 |
} |
|
| 208 |
if($results->numRows() == 0) {
|
|
| 209 |
$this->print_header(); |
|
| 210 |
$this->print_error($MESSAGE['PAGES']['NOT_FOUND']); |
|
| 211 |
} |
|
| 212 |
$results_array = $results->fetchRow(); |
|
| 213 |
return $results_array; |
|
| 214 |
} |
|
| 215 |
|
|
| 216 |
/** Function get_page_permission takes either a numerical page_id, |
|
| 217 |
* upon which it looks up the permissions in the database, |
|
| 218 |
* or an array with keys admin_groups and admin_users |
|
| 219 |
*/ |
|
| 220 |
function get_page_permission($page,$action='admin') {
|
|
| 221 |
if ($action!='viewing') $action='admin'; |
|
| 222 |
$action_groups=$action.'_groups'; |
|
| 223 |
$action_users=$action.'_users'; |
|
| 224 |
if (is_array($page)) {
|
|
| 225 |
$groups=$page[$action_groups]; |
|
| 226 |
$users=$page[$action_users]; |
|
| 227 |
} else {
|
|
| 228 |
global $database; |
|
| 229 |
$results = $database->query("SELECT $action_groups,$action_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page'");
|
|
| 230 |
$result = $results->fetchRow(); |
|
| 231 |
$groups = explode(',', str_replace('_', '', $result[$action_groups]));
|
|
| 232 |
$users = explode(',', str_replace('_', '', $result[$action_users]));
|
|
| 233 |
} |
|
| 234 |
if(!is_numeric(array_search($this->get_group_id(), $groups)) AND !is_numeric(array_search($this->get_user_id(), $users))) {
|
|
| 235 |
return false; |
|
| 236 |
} |
|
| 237 |
return true; |
|
| 238 |
} |
|
| 239 |
|
|
| 240 |
|
|
| 241 |
// Returns a system permission for a menu link |
|
| 242 |
function get_link_permission($title) {
|
|
| 243 |
$title = str_replace('_blank', '', $title);
|
|
| 244 |
$title = strtolower($title); |
|
| 245 |
// Set system permissions var |
|
| 246 |
$system_permissions = $this->get_session('SYSTEM_PERMISSIONS');
|
|
| 247 |
// Set module permissions var |
|
| 248 |
$module_permissions = $this->get_session('MODULE_PERMISSIONS');
|
|
| 249 |
if($title == 'start') {
|
|
| 250 |
return true; |
|
| 251 |
} else {
|
|
| 252 |
// Return true if system perm = 1 |
|
| 253 |
if(is_numeric(array_search($title, $system_permissions))) {
|
|
| 254 |
return true; |
|
| 255 |
} else {
|
|
| 256 |
return false; |
|
| 257 |
} |
|
| 258 |
} |
|
| 259 |
} |
|
| 260 |
} |
|
| 261 |
|
|
| 262 |
?> |
|
| 0 | 263 | |
| branches/2.6.x/wb/framework/functions.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2007, 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 |
// Stop this file from being accessed directly |
|
| 34 |
if(!defined('WB_URL')) {
|
|
| 35 |
header('Location: ../index.php');
|
|
| 36 |
exit(0); |
|
| 37 |
} |
|
| 38 |
|
|
| 39 |
// Define that this file has been loaded |
|
| 40 |
define('FUNCTIONS_FILE_LOADED', true);
|
|
| 41 |
|
|
| 42 |
// Function to remove a non-empty directory |
|
| 43 |
function rm_full_dir($directory) |
|
| 44 |
{
|
|
| 45 |
// If suplied dirname is a file then unlink it |
|
| 46 |
if (is_file($directory)) {
|
|
| 47 |
return unlink($directory); |
|
| 48 |
} |
|
| 49 |
|
|
| 50 |
// Empty the folder |
|
| 51 |
$dir = dir($directory); |
|
| 52 |
while (false !== $entry = $dir->read()) {
|
|
| 53 |
// Skip pointers |
|
| 54 |
if ($entry == '.' || $entry == '..') {
|
|
| 55 |
continue; |
|
| 56 |
} |
|
| 57 |
|
|
| 58 |
// Deep delete directories |
|
| 59 |
if (is_dir("$directory/$entry")) {
|
|
| 60 |
rm_full_dir("$directory/$entry");
|
|
| 61 |
} else {
|
|
| 62 |
unlink("$directory/$entry");
|
|
| 63 |
} |
|
| 64 |
} |
|
| 65 |
|
|
| 66 |
// Now delete the folder |
|
| 67 |
$dir->close(); |
|
| 68 |
return rmdir($directory); |
|
| 69 |
} |
|
| 70 |
|
|
| 71 |
// Function to open a directory and add to a dir list |
|
| 72 |
function directory_list($directory) {
|
|
| 73 |
|
|
| 74 |
$list = array(); |
|
| 75 |
|
|
| 76 |
// Open the directory then loop through its contents |
|
| 77 |
$dir = dir($directory); |
|
| 78 |
while (false !== $entry = $dir->read()) {
|
|
| 79 |
// Skip pointers |
|
| 80 |
if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
|
|
| 81 |
continue; |
|
| 82 |
} |
|
| 83 |
// Add dir and contents to list |
|
| 84 |
if (is_dir("$directory/$entry")) {
|
|
| 85 |
$list = array_merge($list, directory_list("$directory/$entry"));
|
|
| 86 |
$list[] = "$directory/$entry"; |
|
| 87 |
} |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
// Now return the list |
|
| 91 |
return $list; |
|
| 92 |
} |
|
| 93 |
|
|
| 94 |
// Function to open a directory and add to a dir list |
|
| 95 |
function chmod_directory_contents($directory, $file_mode) {
|
|
| 96 |
|
|
| 97 |
// Set the umask to 0 |
|
| 98 |
$umask = umask(0); |
|
| 99 |
|
|
| 100 |
// Open the directory then loop through its contents |
|
| 101 |
$dir = dir($directory); |
|
| 102 |
while (false !== $entry = $dir->read()) {
|
|
| 103 |
// Skip pointers |
|
| 104 |
if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
|
|
| 105 |
continue; |
|
| 106 |
} |
|
| 107 |
// Chmod the sub-dirs contents |
|
| 108 |
if(is_dir("$directory/$entry")) {
|
|
| 109 |
chmod_directory_contents("$directory/$entry", $file_mode);
|
|
| 110 |
} |
|
| 111 |
change_mode($directory.'/'.$entry, 'file'); |
|
| 112 |
} |
|
| 113 |
|
|
| 114 |
// Restore the umask |
|
| 115 |
umask($umask); |
|
| 116 |
|
|
| 117 |
} |
|
| 118 |
|
|
| 119 |
// Function to open a directory and add to a file list |
|
| 120 |
function file_list($directory, $skip = array()) {
|
|
| 121 |
|
|
| 122 |
$list = array(); |
|
| 123 |
$skip_file = false; |
|
| 124 |
|
|
| 125 |
// Open the directory then loop through its contents |
|
| 126 |
$dir = dir($directory); |
|
| 127 |
while (false !== $entry = $dir->read()) {
|
|
| 128 |
// Skip pointers |
|
| 129 |
if($entry == '.' || $entry == '..') {
|
|
| 130 |
$skip_file = true; |
|
| 131 |
} |
|
| 132 |
// Check if we to skip anything else |
|
| 133 |
if($skip != array()) {
|
|
| 134 |
foreach($skip AS $skip_name) {
|
|
| 135 |
if($entry == $skip_name) {
|
|
| 136 |
$skip_file = true; |
|
| 137 |
} |
|
| 138 |
} |
|
| 139 |
} |
|
| 140 |
// Add dir and contents to list |
|
| 141 |
if($skip_file != true AND is_file("$directory/$entry")) {
|
|
| 142 |
$list[] = "$directory/$entry"; |
|
| 143 |
} |
|
| 144 |
|
|
| 145 |
// Reset the skip file var |
|
| 146 |
$skip_file = false; |
|
| 147 |
} |
|
| 148 |
|
|
| 149 |
// Now delete the folder |
|
| 150 |
return $list; |
|
| 151 |
} |
|
| 152 |
|
|
| 153 |
// Function to get a list of home folders not to show |
|
| 154 |
function get_home_folders() {
|
|
| 155 |
global $database, $admin; |
|
| 156 |
$home_folders = array(); |
|
| 157 |
// Only return home folders is this feature is enabled |
|
| 158 |
// and user is not admin |
|
| 159 |
if(HOME_FOLDERS AND ($_SESSION['GROUP_ID']!='1')) {
|
|
| 160 |
$query_home_folders = $database->query("SELECT home_folder FROM ".TABLE_PREFIX."users WHERE home_folder != '".$admin->get_home_folder()."'");
|
|
| 161 |
if($query_home_folders->numRows() > 0) {
|
|
| 162 |
while($folder = $query_home_folders->fetchRow()) {
|
|
| 163 |
$home_folders[$folder['home_folder']] = $folder['home_folder']; |
|
| 164 |
} |
|
| 165 |
} |
|
| 166 |
function remove_home_subs($directory = '/', $home_folders) {
|
|
| 167 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.$directory)) {
|
|
| 168 |
// Loop through the dirs to check the home folders sub-dirs are not shown |
|
| 169 |
while(false !== ($file = readdir($handle))) {
|
|
| 170 |
if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
|
|
| 171 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 172 |
if($directory != '/') { $file = $directory.'/'.$file; } else { $file = '/'.$file; }
|
|
| 173 |
foreach($home_folders AS $hf) {
|
|
| 174 |
$hf_length = strlen($hf); |
|
| 175 |
if($hf_length > 0) {
|
|
| 176 |
if(substr($file, 0, $hf_length+1) == $hf) {
|
|
| 177 |
$home_folders[$file] = $file; |
|
| 178 |
} |
|
| 179 |
} |
|
| 180 |
} |
|
| 181 |
$home_folders = remove_home_subs($file, $home_folders); |
|
| 182 |
} |
|
| 183 |
} |
|
| 184 |
} |
|
| 185 |
} |
|
| 186 |
return $home_folders; |
|
| 187 |
} |
|
| 188 |
$home_folders = remove_home_subs('/', $home_folders);
|
|
| 189 |
} |
|
| 190 |
return $home_folders; |
|
| 191 |
} |
|
| 192 |
|
|
| 193 |
// Function to create directories |
|
| 194 |
function make_dir($dir_name, $dir_mode = OCTAL_DIR_MODE) {
|
|
| 195 |
if(!file_exists($dir_name)) {
|
|
| 196 |
$umask = umask(0); |
|
| 197 |
mkdir($dir_name, $dir_mode); |
|
| 198 |
umask($umask); |
|
| 199 |
return true; |
|
| 200 |
} else {
|
|
| 201 |
return false; |
|
| 202 |
} |
|
| 203 |
} |
|
| 204 |
|
|
| 205 |
// Function to chmod files and directories |
|
| 206 |
function change_mode($name) {
|
|
| 207 |
if(OPERATING_SYSTEM != 'windows') {
|
|
| 208 |
// Only chmod if os is not windows |
|
| 209 |
if(is_dir($name)) {
|
|
| 210 |
$mode = OCTAL_DIR_MODE; |
|
| 211 |
} else {
|
|
| 212 |
$mode = OCTAL_FILE_MODE; |
|
| 213 |
} |
|
| 214 |
if(file_exists($name)) {
|
|
| 215 |
$umask = umask(0); |
|
| 216 |
chmod($name, $mode); |
|
| 217 |
umask($umask); |
|
| 218 |
return true; |
|
| 219 |
} else {
|
|
| 220 |
return false; |
|
| 221 |
} |
|
| 222 |
} else {
|
|
| 223 |
return true; |
|
| 224 |
} |
|
| 225 |
} |
|
| 226 |
|
|
| 227 |
// Function to figure out if a parent exists |
|
| 228 |
function is_parent($page_id) {
|
|
| 229 |
global $database; |
|
| 230 |
// Get parent |
|
| 231 |
$query = $database->query("SELECT parent FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
|
|
| 232 |
$fetch = $query->fetchRow(); |
|
| 233 |
// If parent isnt 0 return its ID |
|
| 234 |
if($fetch['parent'] == '0') {
|
|
| 235 |
return false; |
|
| 236 |
} else {
|
|
| 237 |
return $fetch['parent']; |
|
| 238 |
} |
|
| 239 |
} |
|
| 240 |
|
|
| 241 |
// Function to work out level |
|
| 242 |
function level_count($page_id) {
|
|
| 243 |
global $database; |
|
| 244 |
// Get page parent |
|
| 245 |
$query_page = $database->query("SELECT parent FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id' LIMIT 1");
|
|
| 246 |
$fetch_page = $query_page->fetchRow(); |
|
| 247 |
$parent = $fetch_page['parent']; |
|
| 248 |
if($parent > 0) {
|
|
| 249 |
// Get the level of the parent |
|
| 250 |
$query_parent = $database->query("SELECT level FROM ".TABLE_PREFIX."pages WHERE page_id = '$parent' LIMIT 1");
|
|
| 251 |
$fetch_parent = $query_parent->fetchRow(); |
|
| 252 |
$level = $fetch_parent['level']; |
|
| 253 |
return $level+1; |
|
| 254 |
} else {
|
|
| 255 |
return 0; |
|
| 256 |
} |
|
| 257 |
} |
|
| 258 |
|
|
| 259 |
// Function to work out root parent |
|
| 260 |
function root_parent($page_id) {
|
|
| 261 |
global $database; |
|
| 262 |
// Get page details |
|
| 263 |
$query_page = $database->query("SELECT parent,level FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id' LIMIT 1");
|
|
| 264 |
$fetch_page = $query_page->fetchRow(); |
|
| 265 |
$parent = $fetch_page['parent']; |
|
| 266 |
$level = $fetch_page['level']; |
|
| 267 |
if($level == 1) {
|
|
| 268 |
return $parent; |
|
| 269 |
} elseif($parent == 0) {
|
|
| 270 |
return $page_id; |
|
| 271 |
} else {
|
|
| 272 |
// Figure out what the root parents id is |
|
| 273 |
$parent_ids = array_reverse(get_parent_ids($page_id)); |
|
| 274 |
return $parent_ids[0]; |
|
| 275 |
} |
|
| 276 |
} |
|
| 277 |
|
|
| 278 |
// Function to get page title |
|
| 279 |
function get_page_title($id) {
|
|
| 280 |
global $database; |
|
| 281 |
// Get title |
|
| 282 |
$query = $database->query("SELECT page_title FROM ".TABLE_PREFIX."pages WHERE page_id = '$id'");
|
|
| 283 |
$fetch = $query->fetchRow(); |
|
| 284 |
// Return title |
|
| 285 |
return $fetch['page_title']; |
|
| 286 |
} |
|
| 287 |
|
|
| 288 |
// Function to get a pages menu title |
|
| 289 |
function get_menu_title($id) {
|
|
| 290 |
// Connect to the database |
|
| 291 |
$database = new database(); |
|
| 292 |
// Get title |
|
| 293 |
$query = $database->query("SELECT menu_title FROM ".TABLE_PREFIX."pages WHERE page_id = '$id'");
|
|
| 294 |
$fetch = $query->fetchRow(); |
|
| 295 |
// Return title |
|
| 296 |
return $fetch['menu_title']; |
|
| 297 |
} |
|
| 298 |
|
|
| 299 |
// Function to get all parent page titles |
|
| 300 |
function get_parent_titles($parent_id) {
|
|
| 301 |
$titles[] = get_menu_title($parent_id); |
|
| 302 |
if(is_parent($parent_id) != false) {
|
|
| 303 |
$parent_titles = get_parent_titles(is_parent($parent_id)); |
|
| 304 |
$titles = array_merge($titles, $parent_titles); |
|
| 305 |
} |
|
| 306 |
return $titles; |
|
| 307 |
} |
|
| 308 |
|
|
| 309 |
// Function to get all parent page id's |
|
| 310 |
function get_parent_ids($parent_id) {
|
|
| 311 |
$ids[] = $parent_id; |
|
| 312 |
if(is_parent($parent_id) != false) {
|
|
| 313 |
$parent_ids = get_parent_ids(is_parent($parent_id)); |
|
| 314 |
$ids = array_merge($ids, $parent_ids); |
|
| 315 |
} |
|
| 316 |
return $ids; |
|
| 317 |
} |
|
| 318 |
|
|
| 319 |
// Function to genereate page trail |
|
| 320 |
function get_page_trail($page_id) {
|
|
| 321 |
return implode(',', array_reverse(get_parent_ids($page_id)));
|
|
| 322 |
} |
|
| 323 |
|
|
| 324 |
// Function to get all sub pages id's |
|
| 325 |
function get_subs($parent, $subs) {
|
|
| 326 |
// Connect to the database |
|
Also available in: Unified diff
Created up-to-date 2.6.x branch (based off 2.6.5 tag)