| 1 | <?php
|
|---|
| 2 | /* -----------------------------------------------------------------------------------------
|
|---|
| 3 | $Id: module_export.php 12513 2020-01-10 17:45:38Z GTB $
|
|---|
| 4 |
|
|---|
| 5 | modified eCommerce Shopsoftware
|
|---|
| 6 | http://www.modified-shop.org
|
|---|
| 7 |
|
|---|
| 8 | Copyright (c) 2009 - 2013 [www.modified-shop.org]
|
|---|
| 9 | --------------------------------------------------------------
|
|---|
| 10 | based on:
|
|---|
| 11 | (c) 2000-2001 The Exchange Project (earlier name of osCommerce)
|
|---|
| 12 | (c) 2002-2003 osCommerce(modules.php,v 1.45 2003/05/28); www.oscommerce.com
|
|---|
| 13 | (c) 2003 nextcommerce (modules.php,v 1.23 2003/08/19); www.nextcommerce.org
|
|---|
| 14 | (c) 2006 xt:Commerce (module_export.php)
|
|---|
| 15 | --------------------------------------------------------------
|
|---|
| 16 | Contribution
|
|---|
| 17 | image_processing_step (step-by-step Variante B) by INSEH 2008-03-26
|
|---|
| 18 | image_processing_new_step (mit leeren Verzeichnissen step-by-step Variante C) by INSEH 2008-03-26
|
|---|
| 19 | image_processing_new_step2 (mit leeren Verzeichnissen step-by-step Variante D) by INSEH 2008-03-26
|
|---|
| 20 |
|
|---|
| 21 | Released under the GNU General Public License
|
|---|
| 22 | --------------------------------------------------------------*/
|
|---|
| 23 |
|
|---|
| 24 | require('includes/application_top.php');
|
|---|
| 25 |
|
|---|
| 26 | // include needed functions (for modules)
|
|---|
| 27 | require_once(DIR_WS_FUNCTIONS . 'export_functions.php');
|
|---|
| 28 |
|
|---|
| 29 | if (!is_writeable(DIR_FS_CATALOG . 'export/')) {
|
|---|
| 30 | $messageStack->add(ERROR_EXPORT_FOLDER_NOT_WRITEABLE, 'error');
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | // set default file extension
|
|---|
| 34 | $file_extension = '.php';
|
|---|
| 35 |
|
|---|
| 36 | if (isset($_GET['error'])) {
|
|---|
| 37 | $map='error';
|
|---|
| 38 | if ($_GET['kind']=='success') $map='success';
|
|---|
| 39 | $messageStack->add($_GET['error'], $map);
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | $set = (isset($_GET['set']) ? strip_tags($_GET['set']) : '');
|
|---|
| 43 | $module_class = (isset($_GET['module']) ? strip_tags($_GET['module']) : '');
|
|---|
| 44 | $box = (isset($_GET['box']) ? true : false);
|
|---|
| 45 |
|
|---|
| 46 | if (xtc_not_null($set)) {
|
|---|
| 47 | switch ($set) {
|
|---|
| 48 | case 'system':
|
|---|
| 49 | $module_type = 'system';
|
|---|
| 50 | $module_directory = DIR_FS_ADMIN.DIR_WS_MODULES . 'system/';
|
|---|
| 51 | $module_directory_include = DIR_WS_ADMIN.DIR_WS_MODULES . 'system/';
|
|---|
| 52 | $module_key = 'MODULE_SYSTEM_INSTALLED';
|
|---|
| 53 | define('HEADING_TITLE', HEADING_TITLE_MODULES_SYSTEM);
|
|---|
| 54 | break;
|
|---|
| 55 | case 'export':
|
|---|
| 56 | default:
|
|---|
| 57 | $module_type = 'export';
|
|---|
| 58 | $module_directory = DIR_FS_ADMIN.DIR_WS_MODULES . 'export/';
|
|---|
| 59 | $module_directory_include = DIR_WS_ADMIN.DIR_WS_MODULES . 'export/';
|
|---|
| 60 | $module_key = 'MODULE_EXPORT_INSTALLED';
|
|---|
| 61 | define('HEADING_TITLE', HEADING_TITLE_MODULES_EXPORT);
|
|---|
| 62 | break;
|
|---|
| 63 | }
|
|---|
| 64 | }
|
|---|
| 65 | $action = (isset($_GET['action']) ? $_GET['action'] : '');
|
|---|
| 66 |
|
|---|
| 67 | if (xtc_not_null($action)) {
|
|---|
| 68 | //load language file for action
|
|---|
| 69 | if (file_exists(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . basename($module_class) . '.php')) {
|
|---|
| 70 | include_once(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . basename($module_class) . '.php');
|
|---|
| 71 | }
|
|---|
| 72 | switch ($action) {
|
|---|
| 73 | //BOF NEW MODULE PROCESSING
|
|---|
| 74 | case 'module_processing_do':
|
|---|
| 75 | $class = basename($module_class);
|
|---|
| 76 | include($module_directory . $class . $file_extension);
|
|---|
| 77 | $module = new $class();
|
|---|
| 78 | $module->process($_GET['file']);
|
|---|
| 79 | $get_params = isset($module->get_params) ? $module->get_params : '';
|
|---|
| 80 | //convert params array to params string
|
|---|
| 81 | $params = convert_params_array_to_string($get_params);
|
|---|
| 82 | $modulelink = xtc_href_link(FILENAME_MODULE_EXPORT, $params);
|
|---|
| 83 | $recursive_call = isset($module->recursive_call) ? $module->recursive_call : '';
|
|---|
| 84 | $infotext = isset($module->infotext) ? $module->infotext : '';
|
|---|
| 85 | break;
|
|---|
| 86 | //EOF NEW MODULE PROCESSING
|
|---|
| 87 | case 'save':
|
|---|
| 88 | if (is_array($_POST['configuration'])) {
|
|---|
| 89 | if (count($_POST['configuration'])) {
|
|---|
| 90 | foreach ($_POST['configuration'] as $key => $value) {
|
|---|
| 91 | if (is_array($_POST['configuration'][$key])) {
|
|---|
| 92 | // multi language config
|
|---|
| 93 | if (gettype(array_shift(array_keys($_POST['configuration'][$key]))) == 'string') {
|
|---|
| 94 | $config_value = array();
|
|---|
| 95 | foreach ($_POST['configuration'][$key] as $k => $v) {
|
|---|
| 96 | if (xtc_not_null($v)) {
|
|---|
| 97 | $config_value[] = $k . '::' . $v;
|
|---|
| 98 | }
|
|---|
| 99 | }
|
|---|
| 100 | $value = implode('||', $config_value);
|
|---|
| 101 | } else {
|
|---|
| 102 | $value = implode(',', $_POST['configuration'][$key]);
|
|---|
| 103 | }
|
|---|
| 104 | }
|
|---|
| 105 | xtc_db_query("UPDATE " . TABLE_CONFIGURATION . "
|
|---|
| 106 | SET configuration_value = '" . xtc_db_input($value) . "',
|
|---|
| 107 | last_modified = NOW()
|
|---|
| 108 | WHERE configuration_key = '" . $key . "'");
|
|---|
| 109 | if (@strpos($key,'FILE') !== false) $file = $value;
|
|---|
| 110 | }
|
|---|
| 111 | }
|
|---|
| 112 | }
|
|---|
| 113 | $class = basename($module_class);
|
|---|
| 114 | include($module_directory . $class . $file_extension);
|
|---|
| 115 | $module = new $class();
|
|---|
| 116 | //BOF NEW MODULE PROCESSING
|
|---|
| 117 | if (isset($_POST['process']) && $_POST['process'] == 'module_processing_do') {
|
|---|
| 118 | $get_params = isset($module->get_params) ? $module->get_params : array();
|
|---|
| 119 | //add post params to get params
|
|---|
| 120 | $post_params = isset($module->post_params) ? $module->post_params : array();
|
|---|
| 121 | reset($post_params);
|
|---|
| 122 | foreach ($post_params as $key => $pparam) {
|
|---|
| 123 | $get_params[$pparam] = $_POST[$pparam];
|
|---|
| 124 | }
|
|---|
| 125 | //convert params array to params string
|
|---|
| 126 | $params = convert_params_array_to_string($get_params);
|
|---|
| 127 | if (trim($params) != '') {
|
|---|
| 128 | xtc_redirect(xtc_href_link(FILENAME_MODULE_EXPORT,$params));
|
|---|
| 129 | } else {
|
|---|
| 130 | $messageStack->add(ERROR_PARAMETERS_NOT_SET, 'error');//PARAMETER ERROR
|
|---|
| 131 | }
|
|---|
| 132 | //EOF NEW MODULE PROCESSING
|
|---|
| 133 | } else {
|
|---|
| 134 | $module->process($file);
|
|---|
| 135 | xtc_redirect(xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class));
|
|---|
| 136 | }
|
|---|
| 137 | break;
|
|---|
| 138 |
|
|---|
| 139 | case 'install':
|
|---|
| 140 | case 'update':
|
|---|
| 141 | case 'backupconfirm':
|
|---|
| 142 | case 'removeconfirm':
|
|---|
| 143 | case 'restoreconfirm':
|
|---|
| 144 | case 'custom':
|
|---|
| 145 | $class = basename($module_class);
|
|---|
| 146 | if (file_exists($module_directory . $class . $file_extension)) {
|
|---|
| 147 | include($module_directory . $class . $file_extension);
|
|---|
| 148 | $module = new $class();
|
|---|
| 149 | if ($action == 'install') {
|
|---|
| 150 | $module->install();
|
|---|
| 151 | } elseif ($action == 'removeconfirm') {
|
|---|
| 152 | $module->remove();
|
|---|
| 153 | } elseif ($action == 'update') {
|
|---|
| 154 | // update keys
|
|---|
| 155 | $module->update();
|
|---|
| 156 | $messageStack->add_session(MODULE_UPDATE_CONFIRM, 'success');
|
|---|
| 157 | } elseif ($action == 'backupconfirm') {
|
|---|
| 158 | // save values
|
|---|
| 159 | xtc_backup_configuration($module->keys());
|
|---|
| 160 | $messageStack->add_session(MODULE_BACKUP_CONFIRM, 'success');
|
|---|
| 161 | } elseif ($action == 'restoreconfirm') {
|
|---|
| 162 | // reset backup values
|
|---|
| 163 | xtc_restore_configuration($module->keys());
|
|---|
| 164 | $messageStack->add_session(MODULE_RESTORE_CONFIRM, 'success');
|
|---|
| 165 | } elseif ($action == 'custom') {
|
|---|
| 166 | // call custom method
|
|---|
| 167 | if (method_exists($module,'custom')) {
|
|---|
| 168 | $module->custom();
|
|---|
| 169 | }
|
|---|
| 170 | }
|
|---|
| 171 |
|
|---|
| 172 | }
|
|---|
| 173 | xtc_redirect(xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class));
|
|---|
| 174 | break;
|
|---|
| 175 | }
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 | //########## FUNCTIONS ##########//
|
|---|
| 179 |
|
|---|
| 180 | function get_module_info($module)
|
|---|
| 181 | {
|
|---|
| 182 | $module_info = array('code' => $module->code,
|
|---|
| 183 | 'title' => $module->title,
|
|---|
| 184 | 'description' => $module->description,
|
|---|
| 185 | 'extended_description' => isset($module->extended_description) ? $module->extended_description : '',
|
|---|
| 186 | 'status' => $module->check());
|
|---|
| 187 |
|
|---|
| 188 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|---|
| 189 | if ((property_exists ($module, 'deleteData')) && (isset($module->deleteData)))
|
|---|
| 190 | {
|
|---|
| 191 | $module_info['deleteData'] = $module->deleteData;
|
|---|
| 192 | }
|
|---|
| 193 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|---|
| 194 |
|
|---|
| 195 | $module_info['properties'] = isset($module->properties) ? $module->properties : array();
|
|---|
| 196 | $module_info['keys_dispnone'] = isset($module->keys_dispnone) ? $module->keys_dispnone : array();
|
|---|
| 197 | $module_keys = method_exists($module,'keys') ? $module->keys() : array();
|
|---|
| 198 |
|
|---|
| 199 | $keys_extra = array();
|
|---|
| 200 | for ($j = 0, $k = sizeof($module_keys); $j < $k; $j++) {
|
|---|
| 201 | $key_value_query = xtc_db_query("SELECT configuration_key,
|
|---|
| 202 | configuration_value,
|
|---|
| 203 | use_function,
|
|---|
| 204 | set_function
|
|---|
| 205 | FROM " . TABLE_CONFIGURATION . "
|
|---|
| 206 | WHERE configuration_key = '" . $module_keys[$j] . "'");
|
|---|
| 207 | $key_value = xtc_db_fetch_array($key_value_query);
|
|---|
| 208 | if ($key_value['configuration_key'] !='') {
|
|---|
| 209 | $keys_extra[$module_keys[$j]]['title'] = constant(strtoupper($key_value['configuration_key'] .'_TITLE'));
|
|---|
| 210 | }
|
|---|
| 211 | $keys_extra[$module_keys[$j]]['value'] = $key_value['configuration_value'];
|
|---|
| 212 | if ($key_value['configuration_key'] !='') {
|
|---|
| 213 | $keys_extra[$module_keys[$j]]['description'] = constant(strtoupper($key_value['configuration_key'] .'_DESC'));
|
|---|
| 214 | }
|
|---|
| 215 | $keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];
|
|---|
| 216 | $keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];
|
|---|
| 217 | }
|
|---|
| 218 | $module_info['keys'] = $keys_extra;
|
|---|
| 219 | return $module_info;
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 | function create_directory_array($module_directory,$file_extension)
|
|---|
| 223 | {
|
|---|
| 224 | global $module, $module_type;
|
|---|
| 225 | $directory_array = array(array());
|
|---|
| 226 | if ($dir = @dir($module_directory)) {
|
|---|
| 227 | while ($file = $dir->read()) {
|
|---|
| 228 | if (!is_dir($module_directory . $file)) {
|
|---|
| 229 | if (substr($file, strrpos($file, '.')) == $file_extension) {
|
|---|
| 230 | if (file_exists(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file)) {
|
|---|
| 231 | include_once(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file);
|
|---|
| 232 | }
|
|---|
| 233 | include_once($module_directory . $file);
|
|---|
| 234 | $class = substr($file, 0, strrpos($file, '.'));
|
|---|
| 235 | if (xtc_class_exists($class)) {
|
|---|
| 236 | $module = new $class();
|
|---|
| 237 | }
|
|---|
| 238 | if (method_exists($module,'check') && $module->check() > 0) {
|
|---|
| 239 | $directory_array[0][] = $file;
|
|---|
| 240 | } else {
|
|---|
| 241 | $directory_array[1][] = $file;
|
|---|
| 242 | }
|
|---|
| 243 | unset($module);
|
|---|
| 244 | }
|
|---|
| 245 | }
|
|---|
| 246 | }
|
|---|
| 247 | if (is_array($directory_array[0])) {
|
|---|
| 248 | sort($directory_array[0]);
|
|---|
| 249 | $directory_array[0] = array_values($directory_array[0]);
|
|---|
| 250 | }
|
|---|
| 251 | if (is_array($directory_array[1])) {
|
|---|
| 252 | sort($directory_array[1]);
|
|---|
| 253 | $directory_array[1] = array_values($directory_array[1]);
|
|---|
| 254 | }
|
|---|
| 255 | ksort($directory_array);
|
|---|
| 256 | $dir->close();
|
|---|
| 257 | }
|
|---|
| 258 | return $directory_array;
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 | function convert_params_array_to_string($params_array)
|
|---|
| 262 | {
|
|---|
| 263 | reset($params_array);
|
|---|
| 264 | $params = array();
|
|---|
| 265 | foreach ($params_array as $key => $value) {
|
|---|
| 266 | if (is_array($value)) {
|
|---|
| 267 | reset($value);
|
|---|
| 268 | foreach ($value as $key2 => $value2) {
|
|---|
| 269 | $params[] = $key.'_'.strtolower($key2) .'='. $value2;
|
|---|
| 270 | }
|
|---|
| 271 | } else {
|
|---|
| 272 | $params[] = $key .'='. $value;
|
|---|
| 273 | }
|
|---|
| 274 | }
|
|---|
| 275 | $params_string = implode('&', $params);
|
|---|
| 276 | return $params_string;
|
|---|
| 277 | }
|
|---|
| 278 |
|
|---|
| 279 | function check_update_needed($module_type) {
|
|---|
| 280 | global $module_directory, $messageStack;
|
|---|
| 281 |
|
|---|
| 282 | $installed_array = explode(';', constant('MODULE_'.strtoupper($module_type).'_INSTALLED'));
|
|---|
| 283 | $info = array();
|
|---|
| 284 | if (count($installed_array) > 0) {
|
|---|
| 285 | foreach ($installed_array as $file) {
|
|---|
| 286 | if (is_file($module_directory . $file)) {
|
|---|
| 287 | if (is_file(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file)) {
|
|---|
| 288 | include_once(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file);
|
|---|
| 289 | }
|
|---|
| 290 | include_once($module_directory . $file);
|
|---|
| 291 | $class = substr($file, 0, strpos($file, '.'));
|
|---|
| 292 | if (xtc_class_exists($class)) {
|
|---|
| 293 | $module = new $class();
|
|---|
| 294 | if ($module instanceof $class && $module->check() > 0) {
|
|---|
| 295 | $key_array = $module->keys();
|
|---|
| 296 | foreach ($key_array as $key) {
|
|---|
| 297 | if (!defined($key)) {
|
|---|
| 298 | $info[] = '<li>'.$class.'</li>';
|
|---|
| 299 | break;
|
|---|
| 300 | }
|
|---|
| 301 | }
|
|---|
| 302 | }
|
|---|
| 303 | }
|
|---|
| 304 | }
|
|---|
| 305 | }
|
|---|
| 306 | }
|
|---|
| 307 | return $info;
|
|---|
| 308 | }
|
|---|
| 309 |
|
|---|
| 310 | //########## OUTPUT ##########//
|
|---|
| 311 | require (DIR_WS_INCLUDES.'head.php');
|
|---|
| 312 | if (xtc_not_null($action) && !$box) {
|
|---|
| 313 | echo '<link href="includes/css/module_box_full.css" rel="stylesheet" type="text/css" />';
|
|---|
| 314 | if (file_exists('includes/css/'.basename($module_class).'.css')) {
|
|---|
| 315 | echo '<link href="includes/css/'.basename($module_class).'.css" rel="stylesheet" type="text/css" />';
|
|---|
| 316 | }
|
|---|
| 317 | }
|
|---|
| 318 | ?>
|
|---|
| 319 | </head>
|
|---|
| 320 | <body>
|
|---|
| 321 | <!-- header //-->
|
|---|
| 322 | <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
|
|---|
| 323 | <!-- header_eof //-->
|
|---|
| 324 | <!-- body //-->
|
|---|
| 325 | <?php
|
|---|
| 326 | //BOF NEW MODULE PROCESSING
|
|---|
| 327 | echo isset($modulelink) ? xtc_draw_form('modul_continue',FILENAME_MODULE_EXPORT, $params, 'post') : '';
|
|---|
| 328 |
|
|---|
| 329 | echo isset($recursive_call) ? $recursive_call : '';
|
|---|
| 330 | //EOF NEW MODULE PROCESSING
|
|---|
| 331 | ?>
|
|---|
| 332 | <table class="tableBody">
|
|---|
| 333 | <tr>
|
|---|
| 334 | <?php //left_navigation
|
|---|
| 335 | if (USE_ADMIN_TOP_MENU == 'false') {
|
|---|
| 336 | echo '<td class="columnLeft2">'.PHP_EOL;
|
|---|
| 337 | echo '<!-- left_navigation //-->'.PHP_EOL;
|
|---|
| 338 | require_once(DIR_WS_INCLUDES . 'column_left.php');
|
|---|
| 339 | echo '<!-- left_navigation eof //-->'.PHP_EOL;
|
|---|
| 340 | echo '</td>'.PHP_EOL;
|
|---|
| 341 | }
|
|---|
| 342 | ?>
|
|---|
| 343 | <!-- body_text //-->
|
|---|
| 344 | <td class="boxCenter">
|
|---|
| 345 | <div class="pageHeadingImage"><?php echo xtc_image(DIR_WS_ICONS.'heading/icon_modules.png'); ?></div>
|
|---|
| 346 | <div class="pageHeading pdg2"><?php echo HEADING_TITLE; ?><br /></div>
|
|---|
| 347 | <div class="main">Modules</div>
|
|---|
| 348 | <?php if ($set == 'export' && !xtc_not_null($action)) { ?>
|
|---|
| 349 | <div style="clear:both;margin:10px 0;"><span class="main important_info"><?php echo TEXT_MODULE_INFO; ?></span></div>
|
|---|
| 350 | <?php } ?>
|
|---|
| 351 | <table class="tableCenter">
|
|---|
| 352 | <tr>
|
|---|
| 353 | <?php
|
|---|
| 354 | if(!xtc_not_null($action) || $box) {
|
|---|
| 355 | $info = check_update_needed($module_type);
|
|---|
| 356 | if (count($info) > 0) {
|
|---|
| 357 | echo '<div class="error_message">'.TEXT_MODULE_UPDATE_NEEDED.'<ul>'.implode('', $info).'</ul></div>';
|
|---|
| 358 | }
|
|---|
| 359 | ?>
|
|---|
| 360 | <td class="boxCenterLeft">
|
|---|
| 361 | <table class="tableBoxCenter collapse">
|
|---|
| 362 | <?php
|
|---|
| 363 | $directory_array = create_directory_array($module_directory,$file_extension);
|
|---|
| 364 | $installed_modules = array();
|
|---|
| 365 | foreach ($directory_array as $directory_array) {
|
|---|
| 366 | for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) {
|
|---|
| 367 | $file = $directory_array[$i];
|
|---|
| 368 | if (file_exists(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file)) {
|
|---|
| 369 | include_once(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file);
|
|---|
| 370 | }
|
|---|
| 371 | include_once($module_directory . $file);
|
|---|
| 372 | $class = substr($file, 0, strrpos($file, '.'));
|
|---|
| 373 | if (xtc_class_exists($class)) {
|
|---|
| 374 | $module = new $class();
|
|---|
| 375 | if ($module->check() > 0) {
|
|---|
| 376 | if (($module->sort_order > 0) && !isset($installed_modules[$module->sort_order])) {
|
|---|
| 377 | $installed_modules[$module->sort_order] = $file;
|
|---|
| 378 | } else {
|
|---|
| 379 | $installed_modules[] = $file;
|
|---|
| 380 | }
|
|---|
| 381 | }
|
|---|
| 382 | if ((!$module_class || (isset($module_class) && ($module_class == $class))) && !isset($mInfo)) {
|
|---|
| 383 | $module_info = get_module_info($module);
|
|---|
| 384 | $mInfo = new objectInfo($module_info);
|
|---|
| 385 | }
|
|---|
| 386 | if ($module->check() > 0 && !isset($installed)) {
|
|---|
| 387 | $installed = true;
|
|---|
| 388 | ?>
|
|---|
| 389 | <tr class="dataTableHeadingRow sub">
|
|---|
| 390 | <td colspan="3" class="dataTableHeadingContent txta-c" ><?php echo TABLE_HEADING_MODULES_INSTALLED; ?></td>
|
|---|
| 391 | </tr>
|
|---|
| 392 | <tr class="dataTableHeadingRow">
|
|---|
| 393 | <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODULES; ?></td>
|
|---|
| 394 | <td class="dataTableHeadingContent txta-c"><?php echo TABLE_HEADING_STATUS; ?> </td>
|
|---|
| 395 | <td class="dataTableHeadingContent txta-r"><?php echo TABLE_HEADING_ACTION; ?> </td>
|
|---|
| 396 | </tr>
|
|---|
| 397 | <?php
|
|---|
| 398 | } elseif ($module->check() < 1 && !isset($deinstalled) && isset($installed)) {
|
|---|
| 399 | $deinstalled = true;
|
|---|
| 400 | ?>
|
|---|
| 401 | <tr><td colspan="3" style="height:35px;"> </td></tr>
|
|---|
| 402 | <tr class="dataTableHeadingRow sub">
|
|---|
| 403 | <td colspan="3" class="dataTableHeadingContent txta-c" ><?php echo TABLE_HEADING_MODULES_NOT_INSTALLED; ?></td>
|
|---|
| 404 | </tr>
|
|---|
| 405 | <tr class="dataTableHeadingRow">
|
|---|
| 406 | <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODULES; ?></td>
|
|---|
| 407 | <td class="dataTableHeadingContent txta-c"><?php echo TABLE_HEADING_STATUS; ?> </td>
|
|---|
| 408 | <td class="dataTableHeadingContent txta-r"><?php echo TABLE_HEADING_ACTION; ?> </td>
|
|---|
| 409 | </tr>
|
|---|
| 410 | <?php
|
|---|
| 411 | }
|
|---|
| 412 |
|
|---|
| 413 | if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code)) {
|
|---|
| 414 | if ($module->check() > 0) {
|
|---|
| 415 | $tr_attribute = 'class="dataTableRowSelected" onmouseover="this.style.cursor=\'pointer\'" onclick="document.location.href=\'' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $class . '&action=edit') . '\'"';
|
|---|
| 416 | } else {
|
|---|
| 417 | $tr_attribute = 'class="dataTableRowSelected"';
|
|---|
| 418 | }
|
|---|
| 419 | } else {
|
|---|
| 420 | $tr_attribute = 'class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'pointer\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $class) . '\'"';
|
|---|
| 421 | }
|
|---|
| 422 | ?>
|
|---|
| 423 | <tr <?php echo $tr_attribute;?>>
|
|---|
| 424 | <td class="dataTableContent"><?php echo $module->title; ?></td>
|
|---|
| 425 | <td class="dataTableContent txta-c">
|
|---|
| 426 | <?php
|
|---|
| 427 | if ($module->check() > 0) {
|
|---|
| 428 | if (isset($module->enabled) && $module->enabled) {
|
|---|
| 429 | echo xtc_image(DIR_WS_IMAGES . 'icon_lager_green.gif', BUTTON_STATUS_ON);
|
|---|
| 430 | } else {
|
|---|
| 431 | echo xtc_image(DIR_WS_IMAGES . 'icon_lager_red.gif', BUTTON_STATUS_OFF);
|
|---|
| 432 | }
|
|---|
| 433 | }
|
|---|
| 434 | ?>
|
|---|
| 435 |
|
|---|
| 436 | </td>
|
|---|
| 437 | <td class="dataTableContent txta-r"><?php if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) { echo xtc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ICON_ARROW_RIGHT); } else { echo '<a href="' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $class) . '">' . xtc_image(DIR_WS_IMAGES . 'icon_arrow_grey.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
|
|---|
| 438 | </tr>
|
|---|
| 439 | <?php
|
|---|
| 440 | }
|
|---|
| 441 | }
|
|---|
| 442 | }
|
|---|
| 443 | ksort($installed_modules);
|
|---|
| 444 | $check_query = xtc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_key . "'");
|
|---|
| 445 | if (xtc_db_num_rows($check_query)) {
|
|---|
| 446 | $check = xtc_db_fetch_array($check_query);
|
|---|
| 447 | if ($check['configuration_value'] != implode(';', $installed_modules)) {
|
|---|
| 448 | xtc_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $installed_modules) . "', last_modified = now() where configuration_key = '" . $module_key . "'");
|
|---|
| 449 | }
|
|---|
| 450 | } else {
|
|---|
| 451 | xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ( '" . $module_key . "', '" . implode(';', $installed_modules) . "','6', '0', now())");
|
|---|
| 452 | }
|
|---|
| 453 | ?>
|
|---|
| 454 | </table>
|
|---|
| 455 | <div class="smallText pdg2"><?php echo TEXT_MODULE_DIRECTORY . $module_directory_include; ?></div>
|
|---|
| 456 | </td>
|
|---|
| 457 | <?php
|
|---|
| 458 | }
|
|---|
| 459 | //BOC BOX RIGHT
|
|---|
| 460 | $heading = array();
|
|---|
| 461 | $contents = array();
|
|---|
| 462 | switch ($action) {
|
|---|
| 463 | case 'module_processing_do':
|
|---|
| 464 | case 'ready':
|
|---|
| 465 | case 'edit':
|
|---|
| 466 | if (isset($module_class) && !isset($mInfo)) {
|
|---|
| 467 | $heading = array();
|
|---|
| 468 | $contents = array();
|
|---|
| 469 | $class = basename($module_class);
|
|---|
| 470 | if (file_exists(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $class . '.php')) {
|
|---|
| 471 | include_once(DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $class . '.php');
|
|---|
| 472 | }
|
|---|
| 473 | include($module_directory . $class . '.php');
|
|---|
| 474 | if (xtc_class_exists($class)) {
|
|---|
| 475 | $module = new $class();
|
|---|
| 476 | $module_info = get_module_info($module);
|
|---|
| 477 | $mInfo = new objectInfo($module_info);
|
|---|
| 478 | }
|
|---|
| 479 | }
|
|---|
| 480 | $keys = '';
|
|---|
| 481 |
|
|---|
| 482 | reset($mInfo->keys_dispnone);
|
|---|
| 483 | foreach ($mInfo->keys_dispnone as $key => $value) {
|
|---|
| 484 | unset($mInfo->keys[$value]);
|
|---|
| 485 | }
|
|---|
| 486 |
|
|---|
| 487 | reset($mInfo->keys);
|
|---|
| 488 | foreach ($mInfo->keys as $key => $value) {
|
|---|
| 489 | $keys .= '<b>' . $value['title'] . '</b><br />' . $value['description'].'<br />';
|
|---|
| 490 | if ($value['set_function']) {
|
|---|
| 491 | if (strpos($value['set_function'], '->') !== false) {
|
|---|
| 492 | $class_method = explode('->', $value['set_function']);
|
|---|
| 493 | if (!isset(${$class_method[0]}) || !is_object(${$class_method[0]})) { // DokuMan - 2011-05-10 - check if object is first set
|
|---|
| 494 | include(DIR_WS_CLASSES . $class_method[0] . '.php');
|
|---|
| 495 | ${$class_method[0]} = new $class_method[0]();
|
|---|
| 496 | }
|
|---|
| 497 | $keys .= call_user_func_array(array(${$class_method[0]}, $class_method[1]), array($value['value'], $key));
|
|---|
| 498 | } else {
|
|---|
| 499 | eval('$keys .= ' . $value['set_function'] . "'" . encode_htmlspecialchars($value['value'], ENT_QUOTES) . "', '" . $key . "');");
|
|---|
| 500 | }
|
|---|
| 501 | } else {
|
|---|
| 502 | $keys .= xtc_draw_input_field('configuration[' . $key . ']', encode_htmlspecialchars($value['value']), 'class="inputModule"');
|
|---|
| 503 | }
|
|---|
| 504 | $keys .= '<br /><br />';
|
|---|
| 505 | }
|
|---|
| 506 | $keys = substr($keys, 0, strrpos($keys, '<br /><br />'));
|
|---|
| 507 | $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');
|
|---|
| 508 | $contents = array('form' => (isset($mInfo->properties['form_edit']) ? $mInfo->properties['form_edit'] : xtc_draw_form('modules', FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $mInfo->code . '&action=save','post')));
|
|---|
| 509 | $contents[] = array('text' => $keys);
|
|---|
| 510 | // display module fields
|
|---|
| 511 | $contents[] = $module->display();
|
|---|
| 512 | break;
|
|---|
| 513 |
|
|---|
| 514 | case 'restore':
|
|---|
| 515 | $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');
|
|---|
| 516 | $contents = array ('form' => (isset($mInfo->properties['form_restore']) ? $mInfo->properties['form_restore'] : xtc_draw_form('modules', FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class . '&action=restoreconfirm')));
|
|---|
| 517 | $contents[] = array ('text' => '<br />'.TEXT_INFO_MODULE_RESTORE);
|
|---|
| 518 | if (isset($mInfo->properties['restore']) && count($mInfo->properties['restore']) > 0) {
|
|---|
| 519 | foreach($mInfo->properties['restore'] as $key) {
|
|---|
| 520 | $contents[] = array ('text' => '<br />'.$key);
|
|---|
| 521 | }
|
|---|
| 522 | }
|
|---|
| 523 | $contents[] = array ('align' => 'center', 'text' => '<br /><input type="submit" class="button" onclick="this.blur();" value="'. BUTTON_RESTORE .'"><a class="button" onclick="this.blur();" href="'.xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class).'">' . BUTTON_CANCEL . '</a>');
|
|---|
| 524 | break;
|
|---|
| 525 | case 'backup':
|
|---|
| 526 | $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');
|
|---|
| 527 | $contents = array ('form' => (isset($mInfo->properties['form_backup']) ? $mInfo->properties['form_backup'] : xtc_draw_form('modules', FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class . '&action=backupconfirm')));
|
|---|
| 528 | $contents[] = array ('text' => '<br />'.TEXT_INFO_MODULE_BACKUP);
|
|---|
| 529 | if (isset($mInfo->properties['backup']) && count($mInfo->properties['backup']) > 0) {
|
|---|
| 530 | foreach($mInfo->properties['backup'] as $key) {
|
|---|
| 531 | $contents[] = array ('text' => '<br />'.$key);
|
|---|
| 532 | }
|
|---|
| 533 | }
|
|---|
| 534 | $contents[] = array ('align' => 'center', 'text' => '<br /><input type="submit" class="button" onclick="this.blur();" value="'. BUTTON_BACKUP .'"><a class="button" onclick="this.blur();" href="'.xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class).'">' . BUTTON_CANCEL . '</a><br/><br/>');
|
|---|
| 535 | break;
|
|---|
| 536 | case 'remove':
|
|---|
| 537 | $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');
|
|---|
| 538 | $contents = array ('form' => (isset($mInfo->properties['form_remove']) ? $mInfo->properties['form_remove'] : xtc_draw_form('modules', FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class . '&action=removeconfirm')));
|
|---|
| 539 | $contents[] = array ('text' => '<br />'.TEXT_INFO_MODULE_REMOVE);
|
|---|
| 540 | if (isset($mInfo->properties['remove']) && count($mInfo->properties['remove']) > 0) {
|
|---|
| 541 | foreach($mInfo->properties['remove'] as $key) {
|
|---|
| 542 | $contents[] = array ('text' => '<br />'.$key);
|
|---|
| 543 | }
|
|---|
| 544 | }
|
|---|
| 545 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|---|
| 546 | define('TXT_DELETE_DATA', 'gespeicherte Daten löschen');
|
|---|
| 547 | if(isset($mInfo->deleteData)){ $contents[] = array ('text' => '<label>' . xtc_draw_checkbox_field('deleteData', 'deleteData', $mInfo->deleteData,'', 'id="deleteData"').TXT_DELETE_DATA.'</label><br />'. PHP_EOL); }
|
|---|
| 548 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|---|
| 549 | $contents[] = array ('align' => 'center', 'text' => '<br /><input type="submit" class="button" onclick="this.blur();" value="'. BUTTON_MODULE_REMOVE .'"><a class="button" onclick="this.blur();" href="'.xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $module_class).'">' . BUTTON_CANCEL . '</a><br/><br/>');
|
|---|
| 550 | break;
|
|---|
| 551 |
|
|---|
| 552 | default:
|
|---|
| 553 | if (isset($mInfo) && is_object($mInfo)) {
|
|---|
| 554 | $heading[] = array('text' => '<b>' . $mInfo->title . ($mInfo->status > 1 ? ' '.sprintf(MULTIPLE_INSTALLATION,$mInfo->status) : '') . '</b>');
|
|---|
| 555 | if ($mInfo->status != '0') {
|
|---|
| 556 | $keys = '';
|
|---|
| 557 | reset($mInfo->keys);
|
|---|
| 558 | foreach ($mInfo->keys as $value) {
|
|---|
| 559 | $keys .= '<b>' . $value['title'] . '</b><br />';
|
|---|
| 560 | if ($value['use_function']) {
|
|---|
| 561 | $use_function = $value['use_function'];
|
|---|
| 562 | if (strpos($use_function, '->') !== false) {
|
|---|
| 563 | $class_method = explode('->', $use_function);
|
|---|
| 564 | if (!is_object(${$class_method[0]})) {
|
|---|
| 565 | include(DIR_WS_CLASSES . $class_method[0] . '.php');
|
|---|
| 566 | ${$class_method[0]} = new $class_method[0]();
|
|---|
| 567 | }
|
|---|
| 568 | $keys .= xtc_call_function($class_method[1], $value['value'], ${$class_method[0]});
|
|---|
| 569 | } else {
|
|---|
| 570 | $keys .= xtc_call_function($use_function, $value['value']);
|
|---|
| 571 | }
|
|---|
| 572 | } else {
|
|---|
| 573 | $keys .= (strlen($value['value']) > 30) ? substr(strip_tags($value['value']),0,30) . ' ...' : $value['value'];
|
|---|
| 574 | }
|
|---|
| 575 | $keys .= '<br /><br />';
|
|---|
| 576 | }
|
|---|
| 577 | $btn_edit = isset($mInfo->properties['btn_edit']) && trim($mInfo->properties['btn_edit']) != '' ? $mInfo->properties['btn_edit'] : (($set == 'system') ? BUTTON_EDIT : BUTTON_START);
|
|---|
| 578 | $keys = substr($keys, 0, strrpos($keys, '<br /><br />'));
|
|---|
| 579 | $contents[] = array('align' => 'center', 'text' => (!isset($mInfo->properties['process_key']) || (isset($mInfo->properties['process_key']) && $mInfo->properties['process_key'] == 1)
|
|---|
| 580 | ? '<a class="button btnbox" onclick="this.blur();" href="' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $mInfo->code . '&action=edit') . '">' . $btn_edit . '</a>'
|
|---|
| 581 | : '').
|
|---|
| 582 | (!isset($mInfo->properties['process_key']) || (isset($mInfo->properties['process_key']) && $mInfo->properties['process_key'] == 1)
|
|---|
| 583 | ?
|
|---|
| 584 | '<a class="button btnbox" onclick="this.blur();" href="' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $mInfo->code . '&action=backup&box=1') . '">' . BUTTON_BACKUP . '</a>'.
|
|---|
| 585 | '<a class="button btnbox" onclick="this.blur();" href="' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $mInfo->code . '&action=restore&box=1') . '">' . BUTTON_RESTORE . '</a>'
|
|---|
| 586 | : '').
|
|---|
| 587 | '<a class="button btnbox" onclick="this.blur();" href="' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module=' . $mInfo->code . '&action=remove&box=1') . '">' . BUTTON_MODULE_REMOVE . '</a>'
|
|---|
| 588 | );
|
|---|
| 589 | $contents[] = array('text' => '<br />' . $mInfo->description);
|
|---|
| 590 | $contents[] = array('text' => '<br />' . $keys);
|
|---|
| 591 | } else {
|
|---|
| 592 | $contents[] = array('align' => 'center', 'text' => '<a class="button btnbox" onclick="this.blur();" href="' . xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set. '&module=' . $mInfo->code . '&action=install') . '">' . BUTTON_MODULE_INSTALL . '</a>');
|
|---|
| 593 | $contents[] = array('text' => '<br />' . $mInfo->description);
|
|---|
| 594 | }
|
|---|
| 595 | }
|
|---|
| 596 | break;
|
|---|
| 597 | }
|
|---|
| 598 |
|
|---|
| 599 | if ( (xtc_not_null($heading)) && (xtc_not_null($contents)) ) {
|
|---|
| 600 | echo ' <td class="boxRight">' . PHP_EOL;
|
|---|
| 601 | echo '<div class="modulbox">' . PHP_EOL;
|
|---|
| 602 | $box = new box;
|
|---|
| 603 | echo $box->infoBox($heading, $contents);
|
|---|
| 604 | //BOF NEW MODULE PROCESSING
|
|---|
| 605 | if ($action=='module_processing_do') {
|
|---|
| 606 | echo $infotext;
|
|---|
| 607 | }
|
|---|
| 608 |
|
|---|
| 609 | if ($action=='ready') {
|
|---|
| 610 | echo sprintf(MODULE_STEP_READY_STYLE_TEXT,(isset($module->ready_text) ? $module->ready_text : ''));
|
|---|
| 611 | echo sprintf(MODULE_STEP_READY_STYLE_BACK,xtc_button_link(BUTTON_BACK, xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $set . '&module='.$mInfo->code))) ;
|
|---|
| 612 | }
|
|---|
| 613 | //EOF NEW MODULE PROCESSING
|
|---|
| 614 | if (isset($mInfo->properties['add_content'])) {
|
|---|
| 615 | echo $mInfo->properties['add_content'];
|
|---|
| 616 | }
|
|---|
| 617 | echo '</div>' . PHP_EOL;
|
|---|
| 618 | echo ' </td>' . PHP_EOL;
|
|---|
| 619 | }
|
|---|
| 620 | //EOC BOX RIGHT
|
|---|
| 621 | ?>
|
|---|
| 622 | </tr>
|
|---|
| 623 | </table>
|
|---|
| 624 | </td>
|
|---|
| 625 | <!-- body_text_eof //-->
|
|---|
| 626 | </tr>
|
|---|
| 627 | </table>
|
|---|
| 628 | <!-- body_eof //-->
|
|---|
| 629 | <!-- footer //-->
|
|---|
| 630 | <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
|
|---|
| 631 | <!-- footer_eof //-->
|
|---|
| 632 | <br />
|
|---|
| 633 | </body>
|
|---|
| 634 | </html>
|
|---|
| 635 | <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
|
|---|