Revision 1711
Added by Luisehahne about 13 years ago
| index.php | ||
|---|---|---|
| 4 | 4 |
* @category admin |
| 5 | 5 |
* @package start |
| 6 | 6 |
* @author Ryan Djurovich, WebsiteBaker Project |
| 7 |
* @copyright 2009-2011, Website Baker Org. e.V.
|
|
| 7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
|
| 8 | 8 |
* @link http://www.websitebaker2.org/ |
| 9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 10 | 10 |
* @platform WebsiteBaker 2.8.x |
| ... | ... | |
| 13 | 13 |
* @filesource $HeadURL$ |
| 14 | 14 |
* @lastmodified $Date$ |
| 15 | 15 |
* |
| 16 |
*/ |
|
| 17 |
|
|
| 16 |
*/ |
|
| 17 |
//$string = "pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete,admintools |
|
| 18 |
//media,media_create,media_upload,media_view,preferences,preferences_view,pages,pages_modify,pages_view"; |
|
| 19 |
//$regex = "/(pages)+[a-z]*[_]([a-z_0-9]+)[^,]/im"; |
|
| 20 |
//preg_match_all ($regex, $string, $output); |
|
| 21 |
// |
|
| 18 | 22 |
require('../../config.php');
|
| 19 | 23 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 20 | 24 |
$admin = new admin('Start','start');
|
| 21 | 25 |
// --------------------------------------- |
| 26 |
// $database = WbDatabase::getInstance(); |
|
| 22 | 27 |
|
| 23 | 28 |
if(defined('FINALIZE_SETUP')) {
|
| 24 | 29 |
require_once(WB_PATH.'/framework/functions.php'); |
| ... | ... | |
| 52 | 57 |
if($database->query($sql)) { }
|
| 53 | 58 |
} |
| 54 | 59 |
// --------------------------------------- |
| 55 |
$msg = '<br />'; |
|
| 56 | 60 |
// check if it is neccessary to start the uograde-script |
| 61 |
$msg = ''; |
|
| 62 |
|
|
| 63 |
// --------------------------------------- |
|
| 64 |
// check if it is neccessary to start the uograde-script |
|
| 65 |
// --------------------------------------- |
|
| 57 | 66 |
if(($admin->get_user_id()==1) && file_exists(WB_PATH.'/upgrade-script.php')) {
|
| 58 | 67 |
// check if it is neccessary to start the uograde-script |
| 59 | 68 |
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\''; |
| ... | ... | |
| 72 | 81 |
} |
| 73 | 82 |
$msg .= ''.$MESSAGE['START_UPGRADE_SCRIPT_EXISTS'].'<br />'; |
| 74 | 83 |
} |
| 84 |
// --------------------------------------- |
|
| 85 |
// workout to upgrade the groups system_permissions |
|
| 86 |
// --------------------------------------- |
|
| 87 |
if( ($admin->get_user_id()==1) && |
|
| 88 |
file_exists(ADMIN_PATH.'/groups/upgradePermissions.php') && |
|
| 89 |
!defined('GROUPS_UPDATED') )
|
|
| 90 |
{
|
|
| 91 |
// check if it is neccessary to start the uograde-script |
|
| 92 |
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\''; |
|
| 93 |
if($wb_revision = $database->get_one($sql)) {
|
|
| 75 | 94 |
|
| 95 |
} |
|
| 96 |
if (version_compare($wb_revision, '1691' ) < 0) {
|
|
| 97 |
require_once (ADMIN_PATH.'/groups/upgradePermissions.php'); |
|
| 98 |
// build new or changed $sTempPermissions |
|
| 99 |
if(upgrade_group_system_permissions()){
|
|
| 100 |
$cfg = array( |
|
| 101 |
'groups_updated' => time() |
|
| 102 |
); |
|
| 103 |
if(db_update_key_value( 'settings', $cfg )) {
|
|
| 104 |
echo "<div class=\"note center rounded\"><h3>Hello Systemadministrator!</h3>". |
|
| 105 |
"<p style=\"text-align:center;\">". |
|
| 106 |
"The <strong>Administrator Groups Rights </strong> were updated automatically.\n" . |
|
| 107 |
"Please click <a style=\"font-weight:bold;\" " . |
|
| 108 |
"href=\"".ADMIN_URL."/logout/index.php\">on this link</a> to login again!</p>\n". |
|
| 109 |
"<h3>Upgrading only start, if groups rights are not up to date!</h3></div>"; |
|
| 110 |
// Print admin footer |
|
| 111 |
$admin->print_footer(); |
|
| 112 |
exit(0); |
|
| 113 |
|
|
| 114 |
} |
|
| 115 |
} |
|
| 116 |
} |
|
| 117 |
} |
|
| 118 |
|
|
| 119 |
// --------------------------------------- |
|
| 76 | 120 |
// Setup template object, parse vars to it, then parse it |
| 77 | 121 |
// Create new template object |
| 78 |
$template = new Template(dirname($admin->correct_theme_source('start.htt')));
|
|
| 79 |
$template->set_file('page', 'start.htt');
|
|
| 80 |
$template->set_block('page', 'main_block', 'main');
|
|
| 122 |
$oTpl = new Template(dirname($admin->correct_theme_source('start.htt')),'keep');
|
|
| 123 |
$oTpl->set_file('page', 'start.htt');
|
|
| 124 |
$oTpl->set_block('page', 'main_block', 'main');
|
|
| 81 | 125 |
|
| 82 | 126 |
// Insert values into the template object |
| 83 |
$template->set_var(array(
|
|
| 84 |
'WELCOME_MESSAGE' => $MESSAGE['START']['WELCOME_MESSAGE'],
|
|
| 85 |
'CURRENT_USER' => $MESSAGE['START']['CURRENT_USER'],
|
|
| 127 |
$oTpl->set_var(array(
|
|
| 128 |
'WELCOME_MESSAGE' => $MESSAGE['START_WELCOME_MESSAGE'],
|
|
| 129 |
'CURRENT_USER' => $MESSAGE['START_CURRENT_USER'],
|
|
| 86 | 130 |
'DISPLAY_NAME' => $admin->get_display_name(), |
| 87 | 131 |
'ADMIN_URL' => ADMIN_URL, |
| 88 | 132 |
'WB_URL' => WB_URL, |
| 89 | 133 |
'THEME_URL' => THEME_URL, |
| 90 |
'WB_VERSION' => WB_VERSION |
|
| 134 |
'WB_VERSION' => WB_VERSION, |
|
| 135 |
'NO_CONTENT' => '' |
|
| 91 | 136 |
) |
| 92 | 137 |
); |
| 93 | 138 |
|
| 139 |
|
|
| 94 | 140 |
// Insert permission values into the template object |
| 141 |
$oTpl->set_block('main_block', 'show_pages_block', 'show_pages');
|
|
| 95 | 142 |
if($admin->get_permission('pages') != true)
|
| 96 | 143 |
{
|
| 97 |
$template->set_var('DISPLAY_PAGES', 'display:none;');
|
|
| 144 |
$oTpl->set_block('show_pages', '');
|
|
| 145 |
} else {
|
|
| 146 |
$oTpl->parse('show_pages', 'show_pages_block', true);
|
|
| 98 | 147 |
} |
| 148 |
|
|
| 149 |
$oTpl->set_block('main_block', 'show_addons_block', 'show_addons');
|
|
| 150 |
if($admin->get_permission('addons') != true)
|
|
| 151 |
{
|
|
| 152 |
$oTpl->set_block('show_addons', '');
|
|
| 153 |
} else {
|
|
| 154 |
$oTpl->parse('show_addons', 'show_addons_block', true);
|
|
| 155 |
} |
|
| 156 |
|
|
| 157 |
$oTpl->set_block('main_block', 'show_settings_block', 'show_settings');
|
|
| 158 |
if($admin->get_permission('settings') != true)
|
|
| 159 |
{
|
|
| 160 |
$oTpl->set_block('show_settings', '');
|
|
| 161 |
} else {
|
|
| 162 |
$oTpl->parse('show_settings', 'show_settings_block', true);
|
|
| 163 |
} |
|
| 164 |
|
|
| 165 |
$oTpl->set_block('main_block', 'show_access_block', 'show_access');
|
|
| 166 |
if($admin->get_permission('access') != true)
|
|
| 167 |
{
|
|
| 168 |
$oTpl->set_block('show_access', '');
|
|
| 169 |
} else {
|
|
| 170 |
$oTpl->parse('show_access', 'show_access_block', true);
|
|
| 171 |
} |
|
| 172 |
|
|
| 173 |
$oTpl->set_block('main_block', 'show_media_block', 'show_media');
|
|
| 99 | 174 |
if($admin->get_permission('media') != true)
|
| 100 | 175 |
{
|
| 101 |
$template->set_var('DISPLAY_MEDIA', 'display:none;');
|
|
| 176 |
$oTpl->set_block('show_media', '');
|
|
| 177 |
} else {
|
|
| 178 |
$oTpl->parse('show_media', 'show_media_block', true);
|
|
| 102 | 179 |
} |
| 180 |
|
|
| 181 |
$oTpl->set_block('main_block', 'show_admintools_block', 'show_admintools');
|
|
| 182 |
if($admin->get_permission('admintools') != true)
|
|
| 183 |
{
|
|
| 184 |
$oTpl->set_block('show_admintools', '');
|
|
| 185 |
} else {
|
|
| 186 |
$oTpl->parse('show_admintools', 'show_admintools_block', true);
|
|
| 187 |
} |
|
| 188 |
|
|
| 189 |
$oTpl->set_block('main_block', 'show_preferences_block', 'show_preferences');
|
|
| 190 |
if($admin->get_permission('preferences') != true)
|
|
| 191 |
{
|
|
| 192 |
$oTpl->set_block('show_preferences', '');
|
|
| 193 |
} else {
|
|
| 194 |
$oTpl->parse('show_preferences', 'show_preferences_block', true);
|
|
| 195 |
} |
|
| 196 |
|
|
| 197 |
$oTpl->set_block('main_block', 'show_install_block', 'show_install');
|
|
| 198 |
if($admin->ami_group_member('1') != true)
|
|
| 199 |
{
|
|
| 200 |
$oTpl->set_block('show_install', '');
|
|
| 201 |
} else {
|
|
| 202 |
$oTpl->parse('show_install', 'show_install_block', true);
|
|
| 203 |
} |
|
| 204 |
|
|
| 205 |
/* |
|
| 206 |
if($admin->get_permission('pages') != true)
|
|
| 207 |
{
|
|
| 208 |
$oTpl->set_var('DISPLAY_PAGES', 'display:none;');
|
|
| 209 |
} |
|
| 210 |
if($admin->get_permission('media') != true)
|
|
| 211 |
{
|
|
| 212 |
$oTpl->set_var('DISPLAY_MEDIA', 'display:none;');
|
|
| 213 |
} |
|
| 103 | 214 |
if($admin->get_permission('addons') != true)
|
| 104 | 215 |
{
|
| 105 |
$template->set_var('DISPLAY_ADDONS', 'display:none;');
|
|
| 216 |
$oTpl->set_var('DISPLAY_ADDONS', 'display:none;');
|
|
| 106 | 217 |
} |
| 107 | 218 |
if($admin->get_permission('access') != true)
|
| 108 | 219 |
{
|
| 109 |
$template->set_var('DISPLAY_ACCESS', 'display:none;');
|
|
| 220 |
$oTpl->set_var('DISPLAY_ACCESS', 'display:none;');
|
|
| 110 | 221 |
} |
| 111 | 222 |
if($admin->get_permission('settings') != true)
|
| 112 | 223 |
{
|
| 113 |
$template->set_var('DISPLAY_SETTINGS', 'display:none;');
|
|
| 224 |
$oTpl->set_var('DISPLAY_SETTINGS', 'display:none;');
|
|
| 114 | 225 |
} |
| 115 | 226 |
if($admin->get_permission('admintools') != true)
|
| 116 | 227 |
{
|
| 117 |
$template->set_var('DISPLAY_ADMINTOOLS', 'display:none;');
|
|
| 228 |
$oTpl->set_var('DISPLAY_ADMINTOOLS', 'display:none;');
|
|
| 118 | 229 |
} |
| 230 |
*/ |
|
| 119 | 231 |
|
| 120 |
$msg .= (file_exists(WB_PATH.'/install/')) ? $MESSAGE['START']['INSTALL_DIR_EXISTS'] : '';
|
|
| 232 |
$msg .= (file_exists(WB_PATH.'/install/')) ? $MESSAGE['START_INSTALL_DIR_EXISTS'] : '';
|
|
| 121 | 233 |
|
| 122 | 234 |
// Check if installation directory still exists |
| 123 | 235 |
if(file_exists(WB_PATH.'/install/') || file_exists(WB_PATH.'/upgrade-script.php') ) {
|
| 124 | 236 |
// Check if user is part of Adminstrators group |
| 125 | 237 |
if(in_array(1, $admin->get_groups_id())) |
| 126 | 238 |
{
|
| 127 |
$template->set_var('WARNING', $msg );
|
|
| 239 |
$oTpl->set_var('WARNING', $msg );
|
|
| 128 | 240 |
} else {
|
| 129 |
$template->set_var('DISPLAY_WARNING', 'display:none;');
|
|
| 241 |
$oTpl->set_var('DISPLAY_WARNING', 'display:none;');
|
|
| 130 | 242 |
} |
| 131 | 243 |
} else {
|
| 132 |
$template->set_var('DISPLAY_WARNING', 'display:none;');
|
|
| 244 |
$oTpl->set_var('DISPLAY_WARNING', 'display:none;');
|
|
| 133 | 245 |
} |
| 134 | 246 |
|
| 135 | 247 |
// Insert "Add-ons" section overview (pretty complex compared to normal) |
| ... | ... | |
| 166 | 278 |
} |
| 167 | 279 |
|
| 168 | 280 |
// Insert section names and descriptions |
| 169 |
$template->set_var(array(
|
|
| 281 |
$oTpl->set_var(array(
|
|
| 170 | 282 |
'PAGES' => $MENU['PAGES'], |
| 171 | 283 |
'MEDIA' => $MENU['MEDIA'], |
| 172 | 284 |
'ADDONS' => $MENU['ADDONS'], |
| ... | ... | |
| 186 | 298 |
); |
| 187 | 299 |
|
| 188 | 300 |
// Parse template object |
| 189 |
$template->parse('main', 'main_block', false);
|
|
| 190 |
$template->pparse('output', 'page');
|
|
| 301 |
$oTpl->parse('main', 'main_block', false);
|
|
| 302 |
$oTpl->pparse('output', 'page');
|
|
| 191 | 303 |
|
| 192 | 304 |
// Print admin footer |
| 193 | 305 |
$admin->print_footer(); |
Also available in: Unified diff
! update folder admin/start, admin/admintools, admin/skel/htt