Revision 509
Added by ryan over 18 years ago
| tags/2.6.6/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.6 ------------------------------------- |
|
| 14 |
01-Jul-2007 Matthias Gallas |
|
| 15 |
# Fixed converting issue with some ISO-charsets and speeded up converting on large pages (thanks to Thorn) |
|
| 16 |
01-Jul-2007 Ryan Djurovich |
|
| 17 |
# Fixed bug where error message not displayed when script fails to create a page |
|
| 18 |
# Fixed bugs introduced in [484] |
|
| 19 |
14-May-2007 Matthias Gallas |
|
| 20 |
+ Added support for ISO-8859-6.(Thanks to thorn) |
|
| 21 |
12-May-2007 Christian Sommer |
|
| 22 |
+ Replaced functions page_css and page_javascript by register_frontend_modfiles |
|
| 23 |
+ Added function register_backend_modfiles to allow backend modules to use optional CSS and JS files |
|
| 24 |
+ Added the JS framework codepress to allow syntax highlighting for JS, HTML, PHP code (textarea) |
|
| 25 |
+ Added the new function register_frontend_modfiles to the built in templates |
|
| 26 |
08-May-2007 Matthias Gallas |
|
| 27 |
+ Added wrapper to functions.php if mb_string is not available (Thanks to thorn) |
|
| 28 |
+ Added new functions page_css and page_javascript to the built in templates |
|
| 29 |
+ Added search highlight class to css files of the built in templates |
|
| 30 |
30-Apr-2007 Matthias Gallas |
|
| 31 |
# Fixed ticket #392; root_parent not being set correctly (Thanks to eggsurplus) |
|
| 32 |
10-Apr-2007 Matthias Gallas |
|
| 33 |
+ Optimized search and highlighting funktions (Thanks to thorn) |
|
| 34 |
03-Apr-2007 Matthias Gallas |
|
| 35 |
# Fixed a bug in menulink; if you deleted a menulink page the linked page was also deleted |
|
| 36 |
in the pages directory (Special thanks to "Funky_MF" for the fix) |
|
| 37 |
01-Apr-2007 Matthias Gallas |
|
| 38 |
# Fixed issues with some languages when UTF8 is used. Removed all htmlentites |
|
| 39 |
from the code (revoked changeset 396) and added new functions instead. Adapted the |
|
| 40 |
search and the highlighting to use the new functions. With this changes WB can now |
|
| 41 |
be used with charset UTF8 for all languages. Very special thanks to Thorn who wrote |
|
| 42 |
and tested this changes. |
|
| 43 |
12-Mar-2007 Matthias Gallas |
|
| 44 |
+ Added multilingual support to search |
|
| 45 |
03-Mar-2007 Matthias Gallas |
|
| 46 |
+ Added new function for highlighting search results in the content area |
|
| 47 |
(Special thanks to "thorn" and "Funky_MF") |
|
| 48 |
# Fixed some issues in search with special chars |
|
| 49 |
(Special thanks to "thorn" and "Funky_MF") |
|
| 50 |
22-Feb-2007 Christian Sommer |
|
| 51 |
# Fixed bug in changeset 428 (page files were not deleted in /pages folder due to a typo in wb/framework/function.php) |
|
| 52 |
16-Feb-2007 Christian Sommer |
|
| 53 |
! Suppressed PHP warnings and errors when reading empty intro.php |
|
| 54 |
16-Feb-2007 Christian Sommer |
|
| 55 |
# Applied fix to enable parsing of PHP code in the intro.php |
|
| 56 |
12-Feb-2007 Christian Sommer |
|
| 57 |
! Added functions page_css and page_javascript which allow to include optional |
|
| 58 |
module files module.css and module.js into the <head> section. This allows to |
|
| 59 |
create valid (X)HTML, as CSS definitions of modules are included in the head section |
|
| 60 |
12-Feb-2007 Christian Sommer |
|
| 61 |
! Security enhancement (reduced number of login trials from 50 to 3) |
|
| 62 |
02-Feb-2007 Matthias Gallas |
|
| 63 |
# Applied fix for ticket #380 (Thanks to pcwacht) |
|
| 64 |
30-Jan-2007 Ryan Djurovich |
|
| 65 |
# Applied fix for ticket #376 |
|
| 66 |
29-Jan-2007 Matthias Gallas |
|
| 67 |
+ Added new variable $MODULE_DESCRIPTION wich allows to have optional a language |
|
| 68 |
specific description of the modules in the language files of the modules. |
|
| 69 |
21-Jan-2007 Matthias Gallas |
|
| 70 |
# Fixed issue in the search table entries of form modul |
|
| 71 |
13-Jan-2007 Matthias Gallas |
|
| 72 |
# Fixed some bugs in rss.php |
|
| 73 |
07-Jan-2007 Matthias Gallas |
|
| 74 |
# Fixed error when uninstalling the news modul |
|
| 75 |
02-Jan-2007 Matthias Gallas |
|
| 76 |
+ Added id keywords to all missing files |
|
| 77 |
# Fixed issue with Permissions for pages sections |
|
| 78 |
27-Dec-2006 Matthias Gallas |
|
| 79 |
# Fixed form modul stores empty records |
|
| 80 |
------------------------------------- 2.6.5 ------------------------------------- |
|
| 81 |
25-Dec-2006 Ryan Djurovich |
|
| 82 |
! Changed links to WB help website |
|
| 83 |
24-Dec-2006 Matthias Gallas |
|
| 84 |
# Fixed some minor javascript errors in admin (thanks to pcwacht) |
|
| 85 |
# Fixed root_parent doesn't get updated when moving item in menu (#305) |
|
| 86 |
! Changed all copyright notices to include now 2007 |
|
| 87 |
23-Dec-2006 Matthias Gallas |
|
| 88 |
# Fixed IE allows to set a page as parent of itself (#320) |
|
| 89 |
# Fixed problem with Page Title has to be escaped (#287) |
|
| 90 |
# Fixed the possibility to call the index.php of the templates directly in the browser (#291) |
|
| 91 |
21-Dec-2006 Matthias Gallas |
|
| 92 |
# Fixed missing message when adding a site without page title (#300) |
|
| 93 |
21-Dec-2006 Ryan Djurovich |
|
| 94 |
# Fixed bug with captcha script (#346) |
|
| 95 |
20-Dec-2006 Matthias Gallas |
|
| 96 |
# Fixed Return to Search Results Page (#365) |
|
| 97 |
! Set Version to 2.6.5 |
|
| 98 |
- Removed Changeset 365 because this will be a part of WB 2.7.x |
|
| 99 |
# Fixed a little typo error in class.admin.php (#364) |
|
| 100 |
26-Nov-2006 Ryan Djurovich |
|
| 101 |
+ Added new script that could possibly be apart of 2.7.x as a replacement |
|
| 102 |
for having the pages directory |
|
| 103 |
17-Nov-2006 Matthias Gallas |
|
| 104 |
# Fixed fatal error in line 46 news/comment.php (thanks to eki)(#358) |
|
| 105 |
15-Nov-2006 Matthias Gallas |
|
| 106 |
# Fixed again intropage doesn't work (#71) |
|
| 107 |
20-Oct-2006 Matthias Gallas |
|
| 108 |
+ Added phpmailer class (thanks to doc) |
|
| 109 |
+ Added Remember-expanded-pages-in-admin (thanks to ephraimt) |
|
| 110 |
+ Added List sorting in admin area (thanks to rsmith) |
|
| 111 |
# Fixed table width 100% are wrong displayed in container templates |
|
| 112 |
when IE is used (#350) |
|
| 113 |
# Fixed large space between menupoints in IE (#349) |
|
| 114 |
# Fixed Website description is not displayed when no page description |
|
| 115 |
available (#348) |
|
| 116 |
# Fixed group images in news modul cannot be stored (#342) |
|
| 117 |
# Fixed Typo in form/save_field.php (#341) |
|
| 118 |
# Fixed files in /pages/posts folder are not deleted (#340) |
|
| 119 |
# Fixed specialchars problem in the news modul (#339) |
|
| 120 |
# Fixed news modul stores empty records (#338) |
|
| 121 |
# Fixed Captcha didn't work in news comments (#337) |
|
| 122 |
# Fixed various php notices (#334) |
|
| 123 |
+ Added new upgrade_function (thanks to kozmoz) |
|
| 124 |
# Fixed addons table isn't updated when a modul is updated (#332) |
|
| 125 |
# Fixed spelling errors in the signup2.php (#330) |
|
| 126 |
# Fixed MySQL 5.x missing default values for INT fields in all system |
|
| 127 |
and modules tables (#329) |
|
| 128 |
# Fixed installer does not insert admin user (#328) |
|
| 129 |
+ Added support for getting page ID of page that referred search |
|
| 130 |
request (#327) (thanks to brofield) |
|
| 131 |
# Fixed search results generate invalid XHTML and notify warnings (#326) |
|
| 132 |
Stefan Braunewell |
|
| 133 |
# Fixed Field 'last_reset' doesn't have a default value (#313) |
|
| 134 |
+ Added get_post_escaped to wb class which automatically calls add_slashes |
|
| 135 |
on get_post output and used it in form/save_field.php |
|
| 136 |
------------------------------------- 2.6.4 ------------------------------------- |
|
| 137 |
20-May-2006 Ryan Djurovich |
|
| 138 |
# Fixed security issues related to #237 |
|
| 139 |
# Fixed typo in news save comment page (#282) |
|
| 140 |
# Fixed typo in news delete post page (#283) |
|
| 141 |
! Added multi-submission protection to form module (#119) |
|
| 142 |
# Added notice for when PHP Session Support appears to be disabled in installer, |
|
| 143 |
even if it is enabled and the problem actually lies in the users browser (#154) |
|
| 144 |
19-May-2006 Ryan Djurovich |
|
| 145 |
# Fixed problem in forgotten login form where email field is too short (#207) |
|
| 146 |
# Fixed typo in forgotten login details email (#190) |
|
| 147 |
15-May-2006 Stefan Braunewell |
|
| 148 |
# Fixed security issues (#237) |
|
| 149 |
03-May-2006 Stefan Braunewell |
|
| 150 |
# Fixed problems with pre-2.6.0 modules in section list |
|
| 151 |
# Fixed e-mail bug caused by From: headers in internal mail function calls |
|
| 152 |
(#189) |
|
| 153 |
# E-mail validation in install script now accepts new top-level domains |
|
| 154 |
(#162) |
|
| 155 |
# Error status is now overwritten by next database query (#182) |
|
| 156 |
# Fixed obscure problem in htmlarea install script |
|
| 157 |
------------------------------------- 2.6.3 ------------------------------------- |
|
| 158 |
19-Mar-2006 Stefan Braunewell |
|
| 159 |
# Fixed ticket #146: problems removing groups from viewers list of a page |
|
| 160 |
16-Mar-2006 Stefan Braunewell |
|
| 161 |
! Changed link target selection. Now self, top and new. (Ticket #145) |
|
| 162 |
# Fixed ticket #143. Charset setting is now used in admin login and forgot |
|
| 163 |
password pages. |
|
| 164 |
# Some changes to the SQL code in the install script for improved |
|
| 165 |
compatibility with new MySQL versions |
|
| 166 |
# Fixed ticket #134 - error on browsing media. |
|
| 167 |
+ Improved backup module: new choice between full database or WB-related |
|
| 168 |
backup. |
|
| 169 |
# Fixed ticket #141 - admin now sees all folders in media |
|
| 170 |
# Fixed e-mail sending problems due to additional parameter in mail call. |
|
| 171 |
# Applied fix regarding ticket #138: new users now get deleted if |
|
| 172 |
sending e-mail fails. |
|
| 173 |
# Fixed ticket #137: Last Reset timer not reset in frontend forgotten |
|
| 174 |
password process |
|
| 175 |
# Removed duplicate expression from modules/news/install.php which caused |
|
| 176 |
problems in installation |
|
| 177 |
|
|
| 178 |
01-Mar-2006 Stefan Braunewell |
|
| 179 |
# Fixed ticket #68 - Safari problem with displaying all parents. |
|
| 180 |
# Fixed ticket #136 - mailing forgotten password in admin login screen leads |
|
| 181 |
to fatal error. |
|
| 182 |
! Renamed tag [PROCESSTIME] to [PROCESS_TIME] |
|
| 183 |
------------------------------------- 2.6.2 ------------------------------------- |
|
| 184 |
03-Feb-2006 Stefan Braunewell (very big special thanks to John and Alex) |
|
| 185 |
# Fixed ticket #104 - commas in form field descriptions not allowed. |
|
| 186 |
# Cookie REMEMBER_KEY wasn't cleared in account/logout |
|
| 187 |
and expiration date is now set to time in the past. |
|
| 188 |
# Smart login not working. |
|
| 189 |
! Changed mail calls to new function $wb->mail. |
|
| 190 |
# Form: ticket 124 added captcha settings check |
|
| 191 |
# Ticket 118 added formfield type to check for email/text |
|
| 192 |
# Ticket 115 changed comparision /modules/form/view.php |
|
| 193 |
# Added correct timecheck in form submissions |
|
| 194 |
! Changed captcha.php call to include timestamp |
|
| 195 |
! Changed the e-mail validation code and added a mail function to class wb. |
|
| 196 |
! Forgotten password: if sending of e-mail fails, restore old password. |
|
| 197 |
Ticket #110 |
|
| 198 |
! Added more charset options. Ticket #102 - thanks to ruebenwurzel! |
|
| 199 |
! Character encoding setting also affects admin backend. |
|
| 200 |
Mentioned in ticket #102. |
|
| 201 |
! Reintroduced page languages setting. If switched to off, page |
|
| 202 |
languages are only used to determine the language file for the |
|
| 203 |
universal texts. If on, displayed page and menu are affected by |
|
| 204 |
the language session variable. |
|
| 205 |
# Fixed bugs in show_breadcrumbs code and added parameter "depth" |
|
| 206 |
to set the number of levels to be show. |
|
| 207 |
# Fixed a bug where access settings of registered and private pages |
|
| 208 |
were displayed incorrectly. |
|
| 209 |
# Fixed captcha being cached. |
|
| 210 |
# Added an exit call after every heading("Location:...")
|
|
| 211 |
redirector to prevent unwanted execution of code. |
|
| 212 |
# Bug #122. Replaced empty field check by check that setting name is |
|
| 213 |
not "wb_version". |
|
| 214 |
# Replaced all remaining occurrences of '/media' by MEDIA_DIRECTORY - bug #108. |
|
| 215 |
# Fixed bug #99 and two additional instances of typo |
|
| 216 |
catpcha instead of captcha. |
|
| 217 |
# Fixed some typos |
|
| 218 |
# Fixed some notices and warnings. |
|
| 219 |
# Fixed bug #105 - back buttons in addon detail pages not editable. |
|
| 220 |
! Replace 'admin' by 'wb' in all account pages. |
|
| 221 |
!/# Moved print_success and print_error code to class.wb.php. |
|
| 222 |
Added correct parameters to these functions in account pages. |
|
| 223 |
------------------------------------- 2.6.1 ------------------------------------- |
|
| 224 |
12-Dec-2005 Ryan Djurovich |
|
| 225 |
# Fixed security vulnerability in class.login.php |
|
| 226 |
# Fixed typo in EN language file |
|
| 227 |
# Fixed captcha problems (when feature is disabled) in form module and sign-up |
|
| 228 |
! Added charset encoding to admin templates |
|
| 229 |
! Added extra code to check for selection of addon upon uninstalling |
|
| 230 |
# Fixed bugs in RSS news feeder |
|
| 231 |
# Fixed bug with PAGE_DESCRIPTION not being set on any page |
|
| 232 |
------------------------------------- 2.6.0 ------------------------------------- |
|
| 233 |
28-Nov-2005 Ryan Djurovich |
|
| 234 |
+ Added default charset option to (advanced) settings |
|
| 235 |
# Form module email fields now have email address validation |
|
| 236 |
# Fixed spacing in form submissions |
|
| 237 |
27-Nov-2005 Ryan Djurovich |
|
| 238 |
+ Added captcha verification to sign-up form |
|
| 239 |
+ Added Captcha to News module |
|
| 240 |
24-Nov-2005 Stefan Braunewell |
|
| 241 |
! Applied aportale's patch to use label instead of javascript toggle code |
|
| 242 |
20-Nov-2005 Ryan Djurovich |
|
| 243 |
! News mod now hides read more link if no need for it (see ticket #56) |
|
| 244 |
+ Added support for mailto: links in the menu link mod |
|
| 245 |
# Added direct-access redirection on some files (see ticket #37) |
|
| 246 |
+ Added extra characters to convert.php (see ticket #64) |
|
| 247 |
# Fixed ticket #65 (last_reset check in account/forgot_form.php) |
|
| 248 |
29-Sep-2005 Ryan Djurovich |
|
| 249 |
! Cleaned up form buttons in Settings |
|
| 250 |
! Moved some options into Advanced Settings |
|
| 251 |
# Semi-disabled "separate" page trash option |
|
| 252 |
+ Created a backup module/tool for backing-up the database |
|
| 253 |
(thanks to John (pcwacht) for the original code) |
|
| 254 |
+ Created new "blank template", which can be used in case where you don't |
|
| 255 |
want anything wrapping page-content. |
|
| 256 |
19-Sep-2005 Ryan Djurovich |
|
| 257 |
+ Added _license field for all add-ons to specify a license |
|
| 258 |
! Renamed _designed_for variables (for all addons) to _platform |
|
| 259 |
+ Created addons table for faster internal referencing of installed addons |
|
| 260 |
! Fixed some links, including the "Help" button in Admin |
|
| 261 |
# Used nl2br to display body correctly when viewing form-submissions |
|
| 262 |
15-Sep-2005 Stefan Braunewell |
|
| 263 |
+ Added table module with columns 'name','type' and 'directory' as an |
|
| 264 |
index. |
|
| 265 |
+ Added entry to settings table 'wb_version' which holds the version |
|
| 266 |
number and can be utilized in future upgrade scripts. |
|
| 267 |
! Added upgrade functionality also for templates and languages. |
|
| 268 |
#/! Template/modules installation now respects paths. |
|
| 269 |
! Moved updates from config.php to database. |
|
| 270 |
Created initialize.php (required by config.php) to read settings. |
|
| 271 |
11-Sep-2005 Stefan Braunewell |
|
| 272 |
! HTMLArea is now a module instead of a core component. Files moved |
|
| 273 |
from "include" to "modules". |
|
| 274 |
+ Implemented Installation of modules on top of an older version. This is |
|
| 275 |
done via checking $module_version. Instead of install.php, upgrade.php |
|
| 276 |
is then called if it exists in the module package. |
|
| 277 |
For module developers: $module_version and $new_module_version are |
|
| 278 |
accessible in upgrade.php to find out what upgrade steps need to be taken. |
|
| 279 |
! Changed column names in mod_news_posts from short,long to content_short, |
|
| 280 |
content_long. |
|
| 281 |
09-Sep-2005 Stefan Braunewell |
|
| 282 |
+ Added new advanced setting "Rename Files On Upload". File extensions can be |
|
| 283 |
given so that respective files will have a ".txt" appended on media upload. |
|
| 284 |
# Fixed "None found" message bug when user has no top level page edit |
|
| 285 |
rights. |
|
| 286 |
# Fixed missing parent option 'none' - ticket #12 - and a minor scope bug. |
|
| 287 |
+ Added breadcrumbs code. Call using $wb->breadcrumbs(). |
|
| 288 |
+ Added utf-8 character encoding meta tag into all stock templates. |
|
| 289 |
# Fixed bug when changing a page's parent |
|
| 290 |
! Changed the way blocks are treated. Added new frontend class attribute |
|
| 291 |
default_block_content that controls what is shown on pages such as |
|
| 292 |
search, login, etc. (Ticket #16) |
|
| 293 |
+ Added support for WYSIWYG editor modules (wysiwygmod) |
|
| 294 |
+ When trying to access a registered page, user is automatically redirected |
|
| 295 |
there on successful login. |
|
| 296 |
# Fixed various issues with system search (mainly related to stripslashes() |
|
| 297 |
# Removed stripslashes() in many places in the code. Added check for |
|
| 298 |
magic_quotes_gpc to new wb class method add_slashes(). Now database contest |
|
| 299 |
is independent of magic_quotes setting.. |
|
| 300 |
05-Sep-2005 Stefan Braunewell |
|
| 301 |
# Fixed bug concerning direct access of preferences page. |
|
| 302 |
# Reworked page visibility and menu item visibility code (frontend login |
|
| 303 |
problem). |
|
| 304 |
# Pages in link list in htmlarea popup are now correctly ordered. |
|
| 305 |
# Fixed bug where group with existing name can be added. |
|
| 306 |
04-Sep-2005 Ryan Djurovich |
|
| 307 |
+ Added and RSS newsfeed script to the News module |
|
| 308 |
04-Sep-2005 Stefan Braunewell |
|
| 309 |
! Rewrote menu function. Parameters are now given as attributes to frontend class. |
|
| 310 |
# Fixed some occurrences of potential direct access path disclosure |
|
| 311 |
# Added directory check to browse.php to prevent xss exploit by trusted users. |
|
| 312 |
! Updated code to reflect move to Subversion repository system. |
|
| 313 |
27-Aug-2005 Stefan Braunewell |
|
| 314 |
# Fixed bugs 4,5,6,8,9 in bug tracker |
|
| 315 |
! Removed 'USER_LANGUAGE' and 'GET_LANGUAGE' constants. |
|
| 316 |
A GET['lang'] now sets the session language variable. |
|
| 317 |
26-Aug-2005 Stefan Braunewell |
|
| 318 |
! Moved redundant code into the new class functions. Created |
|
| 319 |
'compatibility.php' for backward compatibility with |
|
| 320 |
modules and templates. Variables and functions can still be accessed |
|
| 321 |
in the old way. |
|
| 322 |
!/+ Reorganized core frontend files, added new base class 'wb' from |
|
| 323 |
which 'admin' and the new 'frontend' class inherit. Moved all frontend |
|
| 324 |
function into new class. Completely rewrote core index.php. |
|
| 325 |
Now all variables and functions that are available to templates and |
|
| 326 |
modules are attributes and methods of the frontend and the wb classes |
|
| 327 |
------------------------------------- 2.5.2 ------------------------------------- |
|
| 328 |
23-Jun-2005 Ryan Djurovich |
|
| 329 |
! create_access_file now creates all parent directories if needed |
|
| 330 |
# Fixed bug when moving page with subpages to another level |
|
| 331 |
# Fixed bug when saving "Settings" (in Admin) on Windows/IIS |
|
| 332 |
# Fixed bug where query was not setting error correctly in class.database.php |
|
| 333 |
22-Jun-2005 Ryan Djurovich |
|
| 334 |
# Fixed bug where template permissions were not saved when a adding group |
|
| 335 |
21-Jun-2005 Ryan Djurovich |
|
| 336 |
# Added htmlspecialchars for modifying WYSIWYG, news, etc. modules (Bug #78) |
|
| 337 |
# Fixed language problems in some area's of Admin. (Bug #70) |
|
| 338 |
# Added a space in website/page keywords (Bug #69) |
|
| 339 |
# Fixed bugs on settings2.php (Bug #52) |
|
| 340 |
! Links inserted with HTMLArea now use [wblink--PAGE_ID--] instead of raw URL |
|
| 341 |
13-Jun-2005 Ryan Djurovich |
|
| 342 |
# Fixed bug (#88) with news module |
|
| 343 |
! Title of Administration login page now taken from language file (Bug #72) |
|
| 344 |
# Fixed redirection admin/home to admin/start on admin/index.php |
|
| 345 |
# Fixed bug with forgotten password page in admin (Bug #81) |
|
| 346 |
25-Apr-2005 Ryan Djurovich |
|
| 347 |
# Fixed numerous bugs with module uninstallation |
|
| 348 |
# Fixed bug when uploading files in Administration -> Media |
|
| 349 |
! Installer no-longer requires you to accept the GNU GPL |
|
| 350 |
------------------------------------- 2.5.1 ------------------------------------- |
|
| 351 |
16-Apr-2005 Ryan Djurovich |
|
| 352 |
# Fixed two bugs with account login/logout |
|
| 353 |
------------------------------------- 2.5.1 ------------------------------------- |
|
| 354 |
15-Apr-2005 Ryan Djurovich |
|
| 355 |
# Fixed bug where non-english characters can get used in page filenames. Many |
|
| 356 |
measuers have been added (including a new file: wb/framework/convert.php), |
|
| 357 |
to prevent any possible errors that can occur in page filenames. |
|
| 358 |
# Fixed invalid meta tags in stock templates (meta tags were not closed) |
|
| 359 |
# Removed lines 401, 402, and 425 of wb/index.php - not needed |
|
| 360 |
# Fixed bug where search and account pages are shown in every block |
|
| 361 |
that is in a template |
|
| 362 |
# Fixed numerous bugs with media home directories feature |
|
| 363 |
10-Apr-2005 Ryan Djurovich |
|
| 364 |
# Fixed bugs in account/login.php and logout.php where users |
|
| 365 |
gets redirected to /pages |
|
| 366 |
------------------------------------- 2.5.0 ------------------------------------- |
|
| 367 |
08-Apr-2005 Ryan Djurovich |
|
| 368 |
- Removed section language feature |
|
| 369 |
+ Added page language feature (replaces need for sections language feature) |
|
| 370 |
# Fixed bug where pages using menu_link module can have the URL changed |
|
| 371 |
- Page directory no longer stored in link field in pages table, it is now added |
|
| 372 |
when the page_link function is called - this makes changing the pages |
|
| 373 |
directory much easier and quicker |
|
| 374 |
! Pages with visibility of "none" are now no longer directly accessable |
|
| 375 |
+ Added new visibility setting "hidden", acts exactly like none did previously |
|
| 376 |
! Template info file can now specify number of menu's available and relative names |
|
| 377 |
! Template info file can now specify number of blocks's available and relative names |
|
| 378 |
------------------------------------- 2.4.3 ------------------------------------- |
|
| 379 |
07-Apr-2005 Ryan Djurovich |
|
| 380 |
# page_filename function has been rewritten using str_replace |
|
| 381 |
function, which should be faster and will allow characters |
|
| 382 |
from other languages into filenames |
|
| 383 |
! Created new media_filename function, which is now used |
|
| 384 |
by all media functions (create,upload,rename) to determine |
|
| 385 |
which characters should be removed from a desired filename |
|
| 386 |
+ New button in Administration page list to view specific page |
|
| 387 |
# Updated the page_link function to now be compatible with menu link |
|
| 388 |
module when setting pages directory to root |
|
| 389 |
# Fixed bugs in search when using "Any Words" option |
|
| 390 |
# Fixed bug with news module when pages directory set to root |
|
| 391 |
! Changed URL of documentation website on Administration Start page |
|
| 392 |
------------------------------------- 2.4.2 ------------------------------------- |
|
| 393 |
05-Apr-2005 Ryan Djurovich |
|
| 394 |
# Fixed bug where file could be renamed to nothing in Media |
|
| 395 |
! Optimised Media create folder, upload file, and rename functions |
|
| 396 |
# Fixed bug where stripslashes not run on news post titles in admin |
|
| 397 |
05-Apr-2005 Stefan Braunewell |
|
| 398 |
# Fixed bug concerning usage of the private_sql variable |
|
| 399 |
# Fixed bug conerning sub-pages being displayed in menus incorrectly |
|
| 400 |
------------------------------------- 2.4.1 ------------------------------------- |
|
| 401 |
04-Apr-2005 Ryan Djurovich |
|
| 402 |
! Pages with visibility of "none" are again directly accessable |
|
| 403 |
# Fixed bugs regarding renaming files and directories in Media section |
|
| 404 |
! When home folders disabled, all folders now visible in Media section |
|
| 405 |
------------------------------------- 2.4.0 ------------------------------------- |
|
| 406 |
03-Apr-2005 Ryan Djurovich |
|
| 407 |
- Removed recently added visibility setting of "heading", and relative config vars |
|
| 408 |
+ Added new "menu" field to pages table, and new setting "multiple menus" |
|
| 409 |
which replaces the need for the menu headings feature |
|
| 410 |
+ Added links to top of groups and users sections, linking to each other |
|
| 411 |
! Change menu width in "Round" template to 170px (was 150px) |
|
| 412 |
# Change page "are you sure" deletion message to mention that it will delete |
|
| 413 |
all sub-pages as well |
|
| 414 |
# Fixed many bugs with news module when viewing posts by group |
|
| 415 |
! Pages with visibility of "none" are now no longer directly accessable |
|
| 416 |
02-Apr-2005 Ryan Djurovich |
|
| 417 |
- Removed need to specify DB_URL when calling database class |
|
| 418 |
# Stopped fields without a type specified from being shown in form mod |
|
| 419 |
# Changed '/media' to MEDIA_DIRECTORY on HTMLArea popup windows |
|
| 420 |
for insert link and insert image |
|
| 421 |
+ Added setting which allows you to specify the default WYSIWYG style |
|
| 422 |
+ Added "Server Email" option, to specify what is used in "From" field when |
|
| 423 |
sending emails using the PHP mail function. Default is admins email address. |
|
| 424 |
# Search now excludes pages which have a visibility of none or heading |
|
| 425 |
! Pages are now given modified_when and modified_by when added |
|
| 426 |
01-Apr-2005 Ryan Djurovich |
|
| 427 |
+ Added option to News module to specify how many posts should be listed |
|
| 428 |
per page (by default it is set to unlimited, which functions like previous version) |
|
| 429 |
# Added stripslashes when display page titles in search |
|
| 430 |
+ Page descriptions and last updated date now shown in search by default |
|
| 431 |
30-Mar-2005 Ryan Djurovich |
|
| 432 |
+ Added new feature for Media home folders, where a folder can be specified |
|
| 433 |
for a specific user or group of users only |
|
| 434 |
! Changed URL of Help button to http://www.websitebaker.org/docs/ |
|
| 435 |
+ Added new feature for "Page Trash" - two modes available: inline and separate |
|
| 436 |
! When pages are deleted, all sub-pages are now deleted (instead of being moved |
|
| 437 |
up a level) |
|
| 438 |
29-Mar-2005 Ryan Djurovich |
|
| 439 |
- Removed Database Settings from Administration Settings (options will not be |
|
| 440 |
available in 3.x, so trying to match interface with WB 3.x plans |
|
| 441 |
! Changed the name of Path Settings to Filesystem Settings in Administration |
|
| 442 |
Settings, and removed ability to change path/url options - matching interface |
|
| 443 |
plans for WB 3.x |
|
| 444 |
+ Added same options for OS and file permissions as installer to Settings |
|
| 445 |
! Sessions now named with APP_NAME.'_session_id' (e.g. default is wb_session_id) |
|
| 446 |
28-Mar-2005 Ryan Djurovich |
|
| 447 |
+ New functions available to templates to simplify creation of them. This aims |
|
| 448 |
to "future-proof" templates for WB 3.x plans. |
|
| 449 |
! Default templates updated to support some of the new functions |
|
| 450 |
+ Added field to pages table "page_trail" which stores a list of the pages |
|
| 451 |
parents. This field was needed by the new page_menu function |
|
| 452 |
+ Added option for page visibility "heading" to enabled support for multiple |
|
| 453 |
menu's. Also, this helps to "future-proof" templates for WB 3.x plans |
|
| 454 |
+ Added option for page visibility "registered", which acts a little like |
|
| 455 |
private, but is still shown in the menu (although users need to log in to view |
|
| 456 |
the pages content) |
|
| 457 |
+ Form module submissions now saved to database, and feature now added to |
|
| 458 |
limit number of submissions per hour to prevent spamming |
|
| 459 |
+ New field for Form module: email. Allows you to specify their email in |
|
| 460 |
"from" field on module settings. |
|
| 461 |
# Fixed bug when displaying comments in News module (WB Bug #14) |
|
| 462 |
+ New "under contruction" message if no pages exist |
|
| 463 |
! Cleaned-up wb/index.php |
|
| 464 |
27-Mar-2005 Ryan Djurovich |
|
| 465 |
+ Created advanced mkdir and chmod functions |
|
| 466 |
# Fixed bug in media where wrong file/folder is deleted |
|
| 467 |
+ Complete overhall of installer - now only one step! It has been greatly |
|
| 468 |
simplified in many ways, has much better validation, reports error much more |
|
| 469 |
nicely, and automatically logs the user into the Administrations |
|
| 470 |
+ Must now specify OS type - allows for customizable file permission settings |
|
| 471 |
+ Sections can now have a language code assigned to them |
|
| 472 |
+ Sections can now have a block name/id assigned to them |
|
| 473 |
! Home section of Administration renamed to Start, to save confusion with saying |
|
| 474 |
Homepage (because this term could either mean the main website or Home section |
|
| 475 |
in Administration). Also, this aims to unify the interface with WB 3.x plans |
|
| 476 |
! Moved Users and Groups sections under Access section. This aims to unify the |
|
| 477 |
interface with WB 3.x plans, which help to unclutter the menu |
|
| 478 |
! Interface for Settings section has been imporved for usability purposes |
|
| 479 |
# Fixed HTMLArea where no scrollbar for "insert link" and "insert image" dialogs |
|
| 480 |
by placing media list inside an iframe |
|
| 481 |
# Fixed stripslashes problem for viewing news comments |
|
| 482 |
! Added code from Formesque module (an advanced version of the original Form |
|
| 483 |
module, modified by Rudolph Lartey from www.carbonect.com), and made further |
|
| 484 |
interface improvements for select box/checkbox group/radio group options. |
|
| 485 |
# Possibly fixed bugs where an S appears before file and dir modes |
|
| 486 |
# Fixed bug where users can be added with same emails (in Administration) |
|
| 487 |
- Removed support for PEAR, as it was deemed an unnecessary addition which only |
|
| 488 |
makes code more bulky, and removing it will decrease package size a lot |
|
| 489 |
+ New "homepage redirect" option so first page is included and not redirected to |
|
| 490 |
# Fixed text not being shown when module uninstalled |
|
| 491 |
! Imporved interface for basic group permissions |
|
| 492 |
26-Mar-2005 Stefan Braunewell |
|
| 493 |
# Fixed bug with front-end logins |
|
| 494 |
# Fixed bug when saving intro page |
|
| 495 |
+ Added check on sign-up if e-mail exists (thanks to P. Melief) |
|
| 496 |
# Fixed bugs concerning moving/deleting pages |
|
| 497 |
# Fixed list of parents in page settings |
|
| 498 |
# Fixed mkdir without mode parameter |
|
| 499 |
# Added a check on install to ensure PHP 4.1.x compatibility (thanks to Wanderer) |
|
| 500 |
+ Added support for PAGES_DIRECTORY set to root |
|
| 501 |
+ Search form now supports quotes (thanks to Manafta) |
|
| 502 |
# Fixed page section ordering |
|
| 503 |
# News items are displayed with name of poster instead of "Unknown" |
|
| 504 |
# Deletion confirmation popup window in media section now shows correct file name |
|
| 505 |
------------------------------------- 2.3.1 ------------------------------------- |
|
| 506 |
03-Fed-2005 Ryan Djurovich |
|
| 507 |
+ Now there is two types of "filesystem modes", one for directories and one |
|
| 508 |
for files. Having different settings is very common for most servers, so |
|
| 509 |
this addition should fix many problems people had with 2.3.0. |
|
| 510 |
- Removed filesystem mode options from installation |
|
| 511 |
! Removed duplicate text on installation step 3 for timezone |
|
| 512 |
! All "access files" for the news module now stored in pages/posts instead |
|
| 513 |
of a sub-dir relative to the page (this fixes many bugs) |
|
| 514 |
# Fixed major bugs when deleting pages with sub-pages |
|
| 515 |
! Removed the restrictions that prevent a user for changing a pages level |
|
| 516 |
# Fixed bug with "toggle" plus/minus in IE for pages list |
|
| 517 |
# Fixed some bugs where /pages was not replaced with PAGES_DIRECTORY constant |
|
| 518 |
------------------------------------- 2.3.0 ------------------------------------- |
|
| 519 |
26-Jan-2005 Ryan Djurovich |
|
| 520 |
# Fixed bug in framework/functions.php that made root parent always equal 8 |
|
| 521 |
# Added missing braces in lines 182 and 208 of admin/pages/settings2.php |
|
| 522 |
# Fixed SQL-query on line 172, placing a / after $old_link |
|
| 523 |
# Added eregi checks for PAGES_DIRECTORY on lines 140 and 150 of |
|
| 524 |
admin/pages/settings2.php |
|
| 525 |
# Added ordering cleaning to delete_post.php on line 53 for news module |
|
| 526 |
! GMT option is selected for "Default Timezone" in the installer, instead |
|
| 527 |
of the old "Please select" message (which had the same value as GMT) |
|
| 528 |
28-Jan-2005 Ryan Djurovich |
|
| 529 |
! Ability to specify the chmod number when WB uploads files, etc. |
|
| 530 |
! Modified file headers (copyright/license notice) so they now look almost the |
|
| 531 |
same, independant of font. Also, it now covers copyright for 2005. |
|
| 532 |
30-Jan-2005 Ryan Djurovich |
|
| 533 |
# Added code on wb/admin/pages/delete.php to remove sections from the sections |
|
| 534 |
table when a page is deleted. |
|
| 535 |
+ New 'Smart Login' prevents users from using external password managers, |
|
| 536 |
and can be set to remember the users password using cookies. |
|
| 537 |
! SourceForge CVS module now called websitebaker2 (instead of just |
|
| 538 |
websitebaker). Also, all file versions have been reset. |
|
| 539 |
01-Fed-2005 Ryan Djurovich |
|
| 540 |
! Added code to prevent from changing a pages level (it simply disables |
|
| 541 |
the select box), to prevent many possible bugs. |
|
| 542 |
------------------------------------- 2.2.4 ------------------------------------- |
|
| 543 |
23-Dec-2004 Ryan Djurovich |
|
| 544 |
! Change 'EXACT_PHRASE' to 'EXACT_MATCH' on line 261 of wb/languages/EN.php |
|
| 545 |
# Fixed multi-language support in search |
|
| 546 |
+ Added more detailed options to list of PHP error reporting level's |
|
| 547 |
- Removed ability to change language and PHP error reporting level |
|
| 548 |
on installation to make things easier for newbie's |
|
| 549 |
+ Ability to select custom spacer for page filename's |
|
| 550 |
! Changed the way a language code is found on language installation |
|
| 551 |
+ Added template permissions to groups |
|
| 552 |
# Fixed bug when trying to change email from Preferences (admin and frontend) |
|
| 553 |
# Fixed bug with auto-selection of "System Default" for Preferences |
|
| 554 |
! News module now use's WYSIWYG for modifying news posts |
|
| 555 |
+ Ability to specify both the pages and media target directories |
|
| 556 |
------------------------------------ 2.2.3-c ------------------------------------ |
|
| 557 |
22-Dec-2004 Ryan Djurovich |
|
| 558 |
# Fixed problem with DB password being reset if Settings saved in basic mode |
|
| 559 |
------------------------------------ 2.2.3-b ------------------------------------ |
|
| 560 |
21-Dec-2004 Ryan Djurovich |
|
| 561 |
# Fixed minor bug on admin templates section |
|
| 562 |
# Fixed bug on rename.php and rename2.php in admin media section |
|
| 563 |
------------------------------------- 2.2.3 ------------------------------------- |
|
| 564 |
20-Dec-2004 Ryan Djurovich |
|
| 565 |
+ Added WB release version in Administration (top right corner) |
|
| 566 |
! New option to prevent users from adding level 0 pages |
|
| 567 |
# Fixed bug when deleting post's in News module |
|
| 568 |
+ Added new field in pages table for "root" parent (level 0 parent), for |
|
| 569 |
extra flexability in creating templates |
|
| 570 |
! Round template now supports unlimited page levels |
|
| 571 |
------------------------------------- 2.2.2 ------------------------------------- |
|
| 572 |
18-Dec-2004 Ryan Djurovich |
|
| 573 |
+ New option under Search Settings for selecting custom template for search |
|
| 574 |
+ New option when changing page settings to set the target |
|
| 575 |
# Fixed error when saving a user after editing |
|
| 576 |
! Users can now modify sub-page if they dont have permissions on the parent |
|
| 577 |
------------------------------------- 2.2.1 ------------------------------------- |
|
| 578 |
15-Dec-2004 Ryan Djurovich |
|
| 579 |
# Fixed bug when changing password on preferences form (front-end) |
|
| 580 |
# Fixed bug when retrieving user details (administration) |
|
| 581 |
# Added check to see if module, template, or language is in use when deleting |
|
| 582 |
# Fixed up email that is sent to user from a submitted form |
|
| 583 |
# Fixed major problem with module permissions which stopped it from working |
|
| 584 |
------------------------------------- 2.2.0 ------------------------------------- |
|
| 585 |
14-Dec-2004 (Correct date[s] unkown) Ryan Djurovich |
|
| 586 |
+ Multiple-level page support |
|
| 587 |
+ Multiple section's for pages (including interface) |
|
| 588 |
! Removed text created using two words on all areas |
|
| 589 |
(e.g. {Intro} {PAGE} is now {INTRO_PAGE})
|
|
| 590 |
this is for better language support |
|
| 591 |
+ Added Languages section |
|
| 592 |
! Moved Templates and Modules under Add-ons section |
|
| 593 |
! Changed name of "Default" template to "Round" |
|
| 594 |
+ Added "All CSS" template |
|
| 595 |
+ Added "Jump" |
|
| 596 |
+ Added |
|
| 597 |
! Modified "Box" template to support multiple page levels |
|
| 598 |
+ Added "Menu Link" module |
|
| 599 |
+ Added "News" module |
|
| 600 |
+ Added "Code" module |
|
| 601 |
+ Added "Form" module |
|
| 602 |
+ Added "Wrapper" module |
|
| 603 |
! Changed name of "Normal Page" module to "WYSIWYG" |
|
| 604 |
+ Created new admin wrapper script to ease module develpment |
|
| 605 |
+ Media now automatically creates index.php file for every |
|
| 606 |
sub-folder made (for security purposes) |
|
| 607 |
! Change "Help" link in Administration menu so it now directs |
|
| 608 |
to the the new Website Baker documentation website found at: |
|
| 609 |
http://www.websitebaker.org/documentation |
|
| 610 |
! Password is now required to change email in preferences |
|
| 611 |
+ User can now select custom Language and Date & Time Formats |
|
| 612 |
+ Added search functionality, with three different "methods": |
|
| 613 |
1. Using all words 2. Using any words 3. Exact match |
|
| 614 |
+ Added native MySQL database support |
|
| 0 | 615 | |
| tags/2.6.6/wb/framework/frontend.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 |
This file is purely for ensuring compatibility with 3rd party |
|
| 28 |
contributions made for WB version 2.5.2 or below |
|
| 29 |
*/ |
|
| 30 |
if(!defined('WB_URL')) {
|
|
| 31 |
header('Location: ../index.php');
|
|
| 32 |
exit(0); |
|
| 33 |
} |
|
| 34 |
|
|
| 35 |
// references to objects and variables that changed their names |
|
| 36 |
|
|
| 37 |
$admin = &$wb; |
|
| 38 |
|
|
| 39 |
$default_link=&$wb->default_link; |
|
| 40 |
|
|
| 41 |
$page_trail=&$wb->page_trail; |
|
| 42 |
$page_description=&$wb->page_description; |
|
| 43 |
$page_keywords=&$wb->page_keywords; |
|
| 44 |
$page_link=&$wb->link; |
|
| 45 |
|
|
| 46 |
// extra_sql is not used anymore - this is basically a register_globals exploit prevention... |
|
| 47 |
$extra_sql=&$wb->extra_sql; |
|
| 48 |
$extra_where_sql=&$wb->extra_where_sql; |
|
| 49 |
|
|
| 50 |
$query="SELECT directory FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'snippet'"; |
|
| 51 |
$query_result=$database->query($query); |
|
| 52 |
if ($query_result->numRows()>0) {
|
|
| 53 |
while ($row = $query_result->fetchRow()) {
|
|
| 54 |
$module_dir = $row['directory']; |
|
| 55 |
if (file_exists(WB_PATH.'/modules/'.$module_dir.'/include.php')) {
|
|
| 56 |
include(WB_PATH.'/modules/'.$module_dir.'/include.php'); |
|
| 57 |
} |
|
| 58 |
} |
|
| 59 |
} |
|
| 60 |
|
|
| 61 |
// Frontend functions |
|
| 62 |
if (!function_exists('page_link')) {
|
|
| 63 |
function page_link($link) {
|
|
| 64 |
global $wb; |
|
| 65 |
return $wb->page_link($link); |
|
| 66 |
} |
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
//function to highlight search results |
|
| 70 |
function search_highlight($foo='', $arr_string=array()) {
|
|
| 71 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 72 |
require(WB_PATH.'/search/search_convert.php'); |
|
| 73 |
$foo = entities_to_umlauts($foo, 'UTF-8'); |
|
| 74 |
array_walk($arr_string, create_function('&$v,$k','$v = preg_quote($v, \'/\');'));
|
|
| 75 |
$search_string = implode("|", $arr_string);
|
|
| 76 |
$string = entities_to_umlauts($search_string, 'UTF-8'); |
|
| 77 |
$string = strtr($string, $string_ul_umlauts); |
|
| 78 |
// do some magic to prevent < > ... from being highlighted |
|
| 79 |
$foo = strtr($foo, array("<"=>"!,,!", ">"=>"!,,,!", "&"=>"!,,,,!", """=>"!,,,,,!", "'"=>"!,,,,,,!"));
|
|
| 80 |
$string = strtr($string, array("<"=>"!,,!", ">"=>"!,,,!", "&"=>"!,,,,!", """=>"!,,,,,!", "'"=>"!,,,,,,!"));
|
|
| 81 |
$foo = preg_replace('/('.$string.')(?=[^>]*<)/iUS', '<span class="highlight">$1</span>',$foo);
|
|
| 82 |
$pos = strpos($foo, '<'); |
|
| 83 |
if ($pos === false) { // "===" means identicaly
|
|
| 84 |
$foo = preg_replace('/('.$string.')/i', '<span class="highlight">$1</span>',$foo);
|
|
| 85 |
} |
|
| 86 |
$foo = strtr($foo, array("!,,!"=>"<", "!,,,!"=>">", "!,,,,!"=>"&", "!,,,,,!"=>""", "!,,,,,,!"=>"'"));
|
|
| 87 |
//$foo = umlauts_to_defcharset($foo, 'UTF-8'); |
|
| 88 |
if(DEFAULT_CHARSET != 'utf-8') {
|
|
| 89 |
$foo = umlauts_to_entities($foo, 'UTF-8'); |
|
| 90 |
} |
|
| 91 |
return $foo; |
|
| 92 |
} |
|
| 93 |
|
|
| 94 |
// Old menu call invokes new menu function |
|
| 95 |
if (!function_exists('page_menu')) {
|
|
| 96 |
function page_menu($parent = 0, $menu_number = 1, $item_template = '<li[class]>[a] [menu_title] [/a]</li>', $menu_header = '<ul>', $menu_footer = '</ul>', $default_class = ' class="menu_default"', $current_class = ' class="menu_current"', $recurse = LEVEL) {
|
|
| 97 |
global $wb; |
|
| 98 |
$wb->menu_number=$menu_number; |
|
| 99 |
$wb->menu_item_template=$item_template; |
|
| 100 |
$wb->menu_item_footer=''; |
|
| 101 |
$wb->menu_parent = $parent; |
|
| 102 |
$wb->menu_header = $menu_header; |
|
| 103 |
$wb->menu_footer = $menu_footer; |
|
| 104 |
$wb->menu_default_class = $default_class; |
|
| 105 |
$wb->menu_current_class = $current_class; |
|
| 106 |
$wb->menu_recurse = $recurse+2; |
|
| 107 |
$wb->menu(); |
|
| 108 |
unset($wb->menu_parent); |
|
| 109 |
unset($wb->menu_number); |
|
| 110 |
unset($wb->menu_item_template); |
|
| 111 |
unset($wb->menu_item_footer); |
|
| 112 |
unset($wb->menu_header); |
|
| 113 |
unset($wb->menu_footer); |
|
| 114 |
unset($wb->menu_default_class); |
|
| 115 |
unset($wb->menu_current_class); |
|
| 116 |
unset($wb->menu_start_level); |
|
| 117 |
unset($wb->menu_collapse); |
|
| 118 |
unset($wb->menu_recurse); |
|
| 119 |
} |
|
| 120 |
} |
|
| 121 |
|
|
| 122 |
if (!function_exists('show_menu')) {
|
|
| 123 |
function show_menu($menu_number = NULL, $start_level=NULL, $recurse = NULL, $collapse = NULL, $item_template = NULL, $item_footer = NULL, $menu_header = NULL, $menu_footer = NULL, $default_class = NULL, $current_class = NULL, $parent = NULL) {
|
|
| 124 |
global $wb; |
|
| 125 |
if (isset($menu_number)) |
|
| 126 |
$wb->menu_number=$menu_number; |
|
| 127 |
if (isset($start_level)) |
|
| 128 |
$wb->menu_start_level=$start_level; |
|
| 129 |
if (isset($recurse)) |
|
| 130 |
$wb->menu_recurse=$recurse; |
|
| 131 |
if (isset($collapse)) |
|
| 132 |
$wb->menu_collapse=$collapse; |
|
| 133 |
if (isset($item_template)) |
|
| 134 |
$wb->menu_item_template=$item_template; |
|
| 135 |
if (isset($item_footer)) |
|
| 136 |
$wb->menu_item_footer=$item_footer; |
|
| 137 |
if (isset($menu_header)) |
|
| 138 |
$wb->menu_header=$menu_header; |
|
| 139 |
if (isset($menu_footer)) |
|
| 140 |
$wb->menu_footer=$menu_footer; |
|
| 141 |
if (isset($default_class)) |
|
| 142 |
$wb->menu_default_class=$default_class; |
|
| 143 |
if (isset($current_class)) |
|
| 144 |
$wb->menu_current_class=$current_class; |
|
| 145 |
if (isset($parent)) |
|
| 146 |
$wb->menu_parent=$parent; |
|
| 147 |
$wb->menu(); |
|
| 148 |
unset($wb->menu_recurse); |
|
| 149 |
unset($wb->menu_parent); |
|
| 150 |
unset($wb->menu_start_level); |
|
| 151 |
} |
|
| 152 |
} |
|
| 153 |
|
|
| 154 |
if (!function_exists('page_content')) {
|
|
| 155 |
function page_content($block = 1) {
|
|
| 156 |
// Get outside objects |
|
| 157 |
global $TEXT,$MENU,$HEADING,$MESSAGE; |
|
| 158 |
global $globals; |
|
| 159 |
global $database; |
|
| 160 |
global $wb; |
|
| 161 |
$admin = & $wb; |
|
| 162 |
if ($wb->page_access_denied==true) {
|
|
| 163 |
echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS']; |
|
| 164 |
exit(); |
|
| 165 |
} |
|
| 166 |
if(isset($globals) AND is_array($globals)) { foreach($globals AS $global_name) { global $$global_name; } }
|
|
| 167 |
// Make sure block is numeric |
|
| 168 |
if(!is_numeric($block)) { $block = 1; }
|
|
| 169 |
// Include page content |
|
| 170 |
if(!defined('PAGE_CONTENT') OR $block!=1) {
|
|
| 171 |
$page_id=$wb->page_id; |
|
| 172 |
// First get all sections for this page |
|
| 173 |
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
|
|
| 174 |
// If none were found, check if default content is supposed to be shown |
|
| 175 |
if($query_sections->numRows() == 0) {
|
|
| 176 |
if ($wb->default_block_content=='none') {
|
|
| 177 |
return; |
|
| 178 |
} |
|
| 179 |
if (is_numeric($wb->default_block_content)) {
|
|
| 180 |
$page_id=$wb->default_block_content; |
|
| 181 |
} else {
|
|
| 182 |
$page_id=$wb->default_page_id; |
|
| 183 |
} |
|
| 184 |
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
|
|
| 185 |
// Still no cotent found? Give it up, there's just nothing to show! |
|
| 186 |
if($query_sections->numRows() == 0) {
|
|
| 187 |
return; |
|
| 188 |
} |
|
| 189 |
} |
|
| 190 |
// Loop through them and include their module file |
|
| 191 |
while($section = $query_sections->fetchRow()) {
|
|
| 192 |
$section_id = $section['section_id']; |
|
| 193 |
$module = $section['module']; |
|
| 194 |
// highlights searchresults |
|
| 195 |
if (isset($_GET['searchresult']) AND is_numeric($_GET['searchresult']) ) {
|
|
| 196 |
if (isset($_GET['sstring']) AND !empty($_GET['sstring']) ){
|
|
| 197 |
$arr_string = explode(" ", $_GET['sstring']);
|
|
| 198 |
if($_GET['searchresult'] == 2) {
|
|
| 199 |
// exact match |
|
| 200 |
$arr_string[0] = strtr($arr_string[0], "_"," "); |
|
| 201 |
} |
|
| 202 |
ob_start(); //start output buffer |
|
| 203 |
require(WB_PATH.'/modules/'.$module.'/view.php'); |
|
| 204 |
$foo = ob_get_contents(); // put outputbuffer in $foo |
|
| 205 |
ob_end_clean(); // clear outputbuffer |
|
| 206 |
echo search_highlight($foo, $arr_string); |
|
| 207 |
} |
|
| 208 |
} else {
|
|
| 209 |
require(WB_PATH.'/modules/'.$module.'/view.php'); |
|
| 210 |
} |
|
| 211 |
} |
|
| 212 |
} else {
|
|
| 213 |
require(PAGE_CONTENT); |
|
| 214 |
} |
|
| 215 |
} |
|
| 216 |
} |
|
| 217 |
|
|
| 218 |
if (!function_exists('show_content')) {
|
|
| 219 |
function show_content($block=1) {
|
|
| 220 |
page_content($block); |
|
| 221 |
} |
|
| 222 |
} |
|
| 223 |
|
|
| 224 |
if (!function_exists('show_breadcrumbs')) {
|
|
| 225 |
function show_breadcrumbs($sep=' > ',$tier=1,$links=true,$depth=-1) {
|
|
| 226 |
global $wb; |
|
| 227 |
$page_id=$wb->page_id; |
|
| 228 |
if ($page_id!=0) |
|
| 229 |
{
|
|
| 230 |
global $database; |
|
| 231 |
$bca=$wb->page_trail; |
|
| 232 |
$counter=0; |
|
| 233 |
foreach ($bca as $temp) |
|
| 234 |
{
|
|
| 235 |
if ($counter>=($tier-1) AND ($depth<0 OR $tier+$depth>$counter)) |
|
| 236 |
{
|
|
| 237 |
if ($counter>=$tier) echo $sep; |
|
| 238 |
$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp");
|
|
| 239 |
$page=$query_menu->fetchRow(); |
|
| 240 |
if ($links==true AND $temp!=$page_id) |
|
| 241 |
echo '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>'; |
|
| 242 |
else |
|
| 243 |
echo $page['menu_title']; |
|
| 244 |
} |
|
| 245 |
$counter++; |
|
| 246 |
} |
|
| 247 |
} |
|
| 248 |
} |
|
| 249 |
} |
|
| 250 |
|
|
| 251 |
// Function for page title |
|
| 252 |
if (!function_exists('page_title')) {
|
|
| 253 |
function page_title($spacer = ' - ', $template = '[WEBSITE_TITLE][SPACER][PAGE_TITLE]') {
|
|
| 254 |
$vars = array('[WEBSITE_TITLE]', '[PAGE_TITLE]', '[MENU_TITLE]', '[SPACER]');
|
|
| 255 |
$values = array(WEBSITE_TITLE, PAGE_TITLE, MENU_TITLE, $spacer); |
|
| 256 |
echo str_replace($vars, $values, $template); |
|
| 257 |
} |
|
| 258 |
} |
|
| 259 |
|
|
| 260 |
// Function for page description |
|
| 261 |
if (!function_exists('page_description')) {
|
|
| 262 |
function page_description() {
|
|
| 263 |
global $wb; |
|
| 264 |
if ($wb->page_description!='') {
|
|
| 265 |
echo $wb->page_description; |
|
| 266 |
} else {
|
|
| 267 |
echo WEBSITE_DESCRIPTION; |
|
| 268 |
} |
|
| 269 |
} |
|
| 270 |
} |
|
| 271 |
|
|
| 272 |
// Function for page keywords |
|
| 273 |
if (!function_exists('page_keywords')) {
|
|
| 274 |
function page_keywords() {
|
|
| 275 |
global $wb; |
|
| 276 |
if ($wb->page_keywords!='') {
|
|
| 277 |
echo $wb->page_keywords; |
|
| 278 |
} else {
|
|
| 279 |
echo WEBSITE_KEYWORDS; |
|
| 280 |
} |
|
| 281 |
} |
|
| 282 |
} |
|
| 283 |
|
|
| 284 |
// Function for page header |
|
| 285 |
if (!function_exists('page_header')) {
|
|
| 286 |
function page_header($date_format = 'Y') {
|
|
| 287 |
echo WEBSITE_HEADER; |
|
| 288 |
} |
|
| 289 |
} |
|
| 290 |
|
|
| 291 |
// Function for page footer |
|
| 292 |
if (!function_exists('page_footer')) {
|
|
| 293 |
function page_footer($date_format = 'Y') {
|
|
| 294 |
global $starttime; |
|
| 295 |
$vars = array('[YEAR]', '[PROCESS_TIME]');
|
|
| 296 |
$processtime=array_sum(explode(" ",microtime()))-$starttime;
|
|
| 297 |
$values = array(date($date_format),$processtime); |
|
| 298 |
echo str_replace($vars, $values, WEBSITE_FOOTER); |
|
| 299 |
} |
|
| 300 |
} |
|
| 301 |
|
|
| 302 |
// Function to add optional module Javascript or CSS stylesheets into the <head> section of the frontend |
|
| 303 |
if(!function_exists('register_frontend_modfiles')) {
|
|
| 304 |
function register_frontend_modfiles($file_id="css") {
|
|
| 305 |
// sanity check of parameter passed to the function |
|
| 306 |
$file_id = strtolower($file_id); |
|
| 307 |
if($file_id !== "css" && $file_id !== "javascript" && $file_id !== "js") {
|
|
| 308 |
return; |
|
| 309 |
} |
|
| 310 |
|
|
| 311 |
global $wb, $database; |
|
| 312 |
// define default baselink and filename for optional module javascript and stylesheet files |
|
| 313 |
$head_links = ""; |
|
| 314 |
if($file_id == "css") {
|
|
| 315 |
$base_link = '<link href="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.css"';
|
|
| 316 |
$base_link.= 'rel="stylesheet" type="text/css" media="screen" />'; |
|
| 317 |
$base_file = "frontend.css"; |
|
| 318 |
} else {
|
|
| 319 |
$base_link = '<script type="text/javascript" src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.js"></script>';
|
|
| 320 |
$base_file = "frontend.js"; |
|
| 321 |
} |
|
| 322 |
|
|
| 323 |
// gather information for all models embedded on actual page |
|
| 324 |
$page_id = $wb->page_id; |
|
| 325 |
$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
|
|
| 326 |
WHERE page_id=$page_id AND module<>'wysiwyg'"); |
|
| 327 |
|
|
| 328 |
while($row = $query_modules->fetchRow()) {
|
|
| 329 |
// check if page module directory contains a frontend.js or frontend.css file |
|
| 330 |
if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
|
|
| 331 |
// create link with frontend.js or frontend.css source for the current module |
|
| 332 |
$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
|
|
| 333 |
// ensure that frontend.js or frontend.css is only added once per module type |
|
| 334 |
if(strpos($head_links, $tmp_link) === false) {
|
|
| 335 |
$head_links .= $tmp_link ."\n"; |
|
| 336 |
} |
|
| 337 |
} |
|
| 338 |
} |
|
| 339 |
// write out links with all external module javascript/CSS files, remove last line feed |
|
| 340 |
echo $head_links; |
|
| 341 |
} |
|
| 342 |
} |
|
| 343 |
|
|
| 344 |
// Begin WB < 2.4.x template compatibility code |
|
| 345 |
// Make extra_sql accessable through private_sql |
|
| 346 |
$private_sql = $extra_sql; |
|
| 347 |
$private_where_sql = $extra_where_sql; |
|
| 348 |
// Query pages for menu |
|
| 349 |
$menu1 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '0' AND $extra_where_sql ORDER BY position ASC");
|
|
| 350 |
// Check if current pages is a parent page and if we need its submenu |
|
| 351 |
if(PARENT == 0) {
|
|
| 352 |
// Get the pages submenu |
|
| 353 |
$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PAGE_ID."' AND $extra_where_sql ORDER BY position ASC");
|
|
| 354 |
} else {
|
|
| 355 |
// Get the pages submenu |
|
| 356 |
$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PARENT."' AND $extra_where_sql ORDER BY position ASC");
|
|
| 357 |
} |
|
| 358 |
// End WB < 2.4.x template compatibility code |
|
| 359 |
// Include template file |
|
| 360 |
|
|
| 361 |
|
|
| 362 |
?> |
|
| 0 | 363 | |
| tags/2.6.6/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 |
|
| 327 |
$database = new database(); |
|
| 328 |
// Get id's |
|
| 329 |
$query = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE parent = '$parent'");
|
|
| 330 |
if($query->numRows() > 0) {
|
|
| 331 |
while($fetch = $query->fetchRow()) {
|
|
| 332 |
$subs[] = $fetch['page_id']; |
|
| 333 |
// Get subs of this sub |
|
| 334 |
$subs = get_subs($fetch['page_id'], $subs); |
|
| 335 |
} |
|
| 336 |
} |
|
| 337 |
// Return subs array |
|
| 338 |
return $subs; |
|
| 339 |
} |
|
| 340 |
|
|
| 341 |
// Function as replacement for php's htmlspecialchars() |
|
| 342 |
function my_htmlspecialchars($string) {
|
|
| 343 |
$string = preg_replace("/&(?=[#a-z0-9]+;)/i", "_x_", $string);
|
|
| 344 |
$string = strtr($string, array("<"=>"<", ">"=>">", "&"=>"&", "\""=>""", "\'"=>"'"));
|
|
| 345 |
$string = preg_replace("/_x_(?=[#a-z0-9]+;)/i", "&", $string);
|
|
| 346 |
return($string); |
|
| 347 |
} |
|
| 348 |
|
|
| 349 |
// Function to convert a string from $from- to $to-encoding, using mysql |
|
| 350 |
function my_mysql_iconv($string, $from, $to) {
|
|
| 351 |
// keep current character set values |
|
| 352 |
global $database; |
|
| 353 |
$query = $database->query("SELECT @@character_set_client");
|
|
| 354 |
if($query->numRows() > 0) {
|
|
| 355 |
$res = $query->fetchRow(); |
|
| 356 |
$character_set_database = $res['@@character_set_client']; |
|
| 357 |
} else { echo mysql_error()."\n<br />"; }
|
|
| 358 |
$query = $database->query("SELECT @@character_set_results");
|
|
| 359 |
if($query->numRows() > 0) {
|
|
| 360 |
$res = $query->fetchRow(); |
|
| 361 |
$character_set_results = $res['@@character_set_results']; |
|
| 362 |
} else { echo mysql_error()."\n<br />"; }
|
|
| 363 |
$query = $database->query("SELECT @@collation_connection");
|
|
| 364 |
if($query->numRows() > 0) {
|
|
| 365 |
$res = $query->fetchRow(); |
|
| 366 |
$collation_results = $res['@@collation_connection']; |
|
| 367 |
} else { echo mysql_error()."\n<br />"; }
|
|
| 368 |
// set new character set values |
|
| 369 |
$query = $database->query("SET character_set_client=$from");
|
|
| 370 |
$query = $database->query("SET character_set_results=$to");
|
|
| 371 |
$query = $database->query("SET collation_connection=utf8_unicode_ci");
|
|
| 372 |
$string_escaped = mysql_real_escape_string($string); |
|
| 373 |
// convert the string |
|
| 374 |
$query = $database->query("SELECT '$string_escaped'");
|
|
| 375 |
if($query->numRows() > 0) {
|
|
| 376 |
$res = $query->fetchRow(); |
|
| 377 |
$converted_string = $res[0]; |
|
| 378 |
} else { echo mysql_error()."\n<br />"; }
|
|
| 379 |
// restore previous character set values |
|
| 380 |
$query = $database->query("SET character_set_client=$character_set_database");
|
|
| 381 |
$query = $database->query("SET character_set_results=$character_set_results");
|
|
| 382 |
$query = $database->query("SET collation_connection=$collation_results");
|
|
| 383 |
return $converted_string; |
|
| 384 |
} |
|
| 385 |
|
|
| 386 |
// Function as wrapper for mb_convert_encoding |
|
| 387 |
// converts $charset_in to $charset_out or |
|
| 388 |
// UTF-8 to HTML-ENTITIES or HTML-ENTITIES to UTF-8 |
|
| 389 |
function mb_convert_encoding_wrapper($string, $charset_out, $charset_in) {
|
|
| 390 |
if ($charset_out == $charset_in) {
|
|
| 391 |
return $string; |
|
| 392 |
} |
|
| 393 |
$use_iconv = true; |
|
| 394 |
$use_mbstring = true; |
|
| 395 |
/* |
|
| 396 |
if(version_compare(PHP_VERSION, "5.1.0", "<")) {
|
|
| 397 |
$use_mbstring = false; // don't rely on mb_convert_encoding if php<5.1.0 |
|
| 398 |
$use_iconv = false; // don't rely on iconv neither |
|
| 399 |
} |
|
| 400 |
*/ |
|
| 401 |
|
|
| 402 |
// try mb_convert_encoding(). This can handle to or from HTML-ENTITIES, too |
|
| 403 |
if ($use_mbstring && function_exists('mb_convert_encoding')) {
|
|
| 404 |
// there's no GB2312 or ISO-8859-11 encoding in php's mb_* functions |
|
| 405 |
if ($charset_in=='ISO-8859-11' || $charset_in=='GB2312') {
|
|
| 406 |
if ($use_iconv && function_exists('iconv')) {
|
|
| 407 |
$string = iconv($charset_in, 'UTF-8', $string); |
|
| 408 |
} |
|
| 409 |
else {
|
|
| 410 |
if ($charset_in == 'GB2312') {
|
|
| 411 |
$string=my_mysql_iconv($string, 'gb2312', 'utf8'); |
|
| 412 |
} else {
|
|
| 413 |
$string=my_mysql_iconv($string, 'tis620', 'utf8'); |
|
| 414 |
} |
|
| 415 |
} |
|
| 416 |
$charset_in='UTF-8'; |
|
| 417 |
if ($charset_out == 'UTF-8') {
|
|
| 418 |
return $string; |
|
| 419 |
} |
|
| 420 |
} |
|
| 421 |
if ($charset_out=='ISO-8859-11' || $charset_out=='GB2312') {
|
|
| 422 |
$string=mb_convert_encoding($string, 'UTF-8', $charset_in); |
|
| 423 |
if ($use_iconv && function_exists('iconv')) {
|
|
| 424 |
$string = iconv('UTF-8', $charset_out, $string);
|
|
| 425 |
} |
|
| 426 |
else {
|
|
| 427 |
if ($charset_out == 'GB2312') {
|
|
| 428 |
$string=my_mysql_iconv($string, 'utf8', 'gb2312'); |
|
| 429 |
} else {
|
|
| 430 |
$string=my_mysql_iconv($string, 'utf8', 'tis620'); |
|
| 431 |
} |
|
| 432 |
} |
|
| 433 |
} else {
|
|
| 434 |
$string = strtr($string, array("<"=>"&_lt;", ">"=>"&_gt;", "&"=>"&_amp;", """=>"&_quot;", "'"=>"&_#39;"));
|
|
| 435 |
$string=mb_convert_encoding($string, $charset_out, $charset_in); |
|
| 436 |
$string = strtr($string, array("&_lt;"=>"<", "&_gt;"=>">", "&_amp;"=>"&", "&_quot;"=>""", "&_#39;"=>"'"));
|
|
| 437 |
} |
|
| 438 |
return $string; |
|
| 439 |
} |
|
| 440 |
|
|
| 441 |
// try iconv(). This can't handle to or from HTML-ENTITIES. |
|
| 442 |
if ($use_iconv && function_exists('iconv') && $charset_out!='HTML-ENTITIES' && $charset_in!='HTML-ENTITIES' ) {
|
|
| 443 |
$string = iconv($charset_in, $charset_out, $string); |
|
| 444 |
return $string; |
|
| 445 |
} |
|
| 446 |
|
|
| 447 |
// do the UTF-8->HTML-ENTITIES or HTML-ENTITIES->UTF-8 translation if mb_convert_encoding isn't available |
|
| 448 |
if (($charset_in=='HTML-ENTITIES' && $charset_out=='UTF-8') || ($charset_in=='UTF-8' && $charset_out=='HTML-ENTITIES')) {
|
|
| 449 |
$string = string_decode_encode_entities($string, $charset_out, $charset_in); |
|
| 450 |
return $string; |
|
| 451 |
} |
|
| 452 |
|
|
| 453 |
// mb_convert_encoding() and iconv() aren't available, so use my_mysql_iconv() |
|
| 454 |
if ($charset_in == 'ISO-8859-1') { $mysqlcharset_from = 'latin1'; }
|
|
| 455 |
elseif ($charset_in == 'ISO-8859-2') { $mysqlcharset_from = 'latin2'; }
|
|
| 456 |
elseif ($charset_in == 'ISO-8859-3') { $mysqlcharset_from = 'latin1'; }
|
|
| 457 |
elseif ($charset_in == 'ISO-8859-4') { $mysqlcharset_from = 'latin7'; }
|
|
| 458 |
elseif ($charset_in == 'ISO-8859-5') { $string = convert_cyr_string ($string, "iso8859-5", "windows-1251" ); $mysqlcharset_from = 'cp1251'; }
|
|
| 459 |
elseif ($charset_in == 'ISO-8859-6') { $mysqlcharset_from = ''; } //?
|
|
| 460 |
elseif ($charset_in == 'ISO-8859-7') { $mysqlcharset_from = 'greek'; }
|
|
| 461 |
elseif ($charset_in == 'ISO-8859-8') { $mysqlcharset_from = 'hebrew'; }
|
|
| 462 |
elseif ($charset_in == 'ISO-8859-9') { $mysqlcharset_from = 'latin5'; }
|
|
| 463 |
elseif ($charset_in == 'ISO-8859-10') { $mysqlcharset_from = 'latin1'; }
|
|
| 464 |
elseif ($charset_in == 'BIG5') { $mysqlcharset_from = 'big5'; }
|
|
| 465 |
elseif ($charset_in == 'ISO-2022-JP') { $mysqlcharset_from = ''; } //?
|
|
| 466 |
elseif ($charset_in == 'ISO-2022-KR') { $mysqlcharset_from = ''; } //?
|
|
| 467 |
elseif ($charset_in == 'GB2312') { $mysqlcharset_from = 'gb2312'; }
|
|
| 468 |
elseif ($charset_in == 'ISO-8859-11') { $mysqlcharset_from = 'tis620'; }
|
|
| 469 |
elseif ($charset_in == 'UTF-8') { $mysqlcharset_from = 'utf8'; }
|
|
| 470 |
else { $mysqlcharset_from = 'latin1'; }
|
|
| 471 |
|
|
| 472 |
if ($charset_out == 'ISO-8859-1') { $mysqlcharset_to = 'latin1'; }
|
|
| 473 |
elseif ($charset_out == 'ISO-8859-2') { $mysqlcharset_to = 'latin2'; }
|
|
| 474 |
elseif ($charset_out == 'ISO-8859-3') { $mysqlcharset_to = 'latin1'; }
|
|
| 475 |
elseif ($charset_out == 'ISO-8859-4') { $mysqlcharset_to = 'latin7'; }
|
|
| 476 |
elseif ($charset_out == 'ISO-8859-5') { $mysqlcharset_to = 'cp1251'; } // use convert_cyr_string afterwards
|
|
| 477 |
elseif ($charset_out == 'ISO-8859-6') { $mysqlcharset_to = ''; } //?
|
|
| 478 |
elseif ($charset_out == 'ISO-8859-7') { $mysqlcharset_to = 'greek'; }
|
|
| 479 |
elseif ($charset_out == 'ISO-8859-8') { $mysqlcharset_to = 'hebrew'; }
|
|
| 480 |
elseif ($charset_out == 'ISO-8859-9') { $mysqlcharset_to = 'latin5'; }
|
|
| 481 |
elseif ($charset_out == 'ISO-8859-10') { $mysqlcharset_to = 'latin1'; }
|
|
| 482 |
elseif ($charset_out == 'BIG5') { $mysqlcharset_to = 'big5'; }
|
|
| 483 |
elseif ($charset_out == 'ISO-2022-JP') { $mysqlcharset_to = ''; } //?
|
|
| 484 |
elseif ($charset_out == 'ISO-2022-KR') { $mysqlcharset_to = ''; } //?
|
|
| 485 |
elseif ($charset_out == 'GB2312') { $mysqlcharset_to = 'gb2312'; }
|
|
| 486 |
elseif ($charset_out == 'ISO-8859-11') { $mysqlcharset_to = 'tis620'; }
|
|
| 487 |
elseif ($charset_out == 'UTF-8') { $mysqlcharset_to = 'utf8'; }
|
|
| 488 |
else { $mysqlcharset_to = 'latin1'; }
|
|
| 489 |
|
|
| 490 |
if ($mysqlcharset_from!="" && $mysqlcharset_to!="" && $mysqlcharset_from!=$mysqlcharset_to) {
|
|
| 491 |
$string=my_mysql_iconv($string, $mysqlcharset_from, $mysqlcharset_to); |
|
Also available in: Unified diff
Created 2.6.6 tag