1058 |
1058 |
1059 if(isset($_POST['save'])) |
1059 if(isset($_POST['save'])) |
1060 { |
1060 { |
1061 if(isset($_POST['enable_uploads']) && getConfig('enable_uploads') != '1') |
1061 if(isset($_POST['enable_uploads']) && getConfig('enable_uploads') != '1') |
1062 { |
1062 { |
1063 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'upload_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\');'); |
1063 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'upload_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1064 if ( !$q ) |
1064 if ( !$q ) |
1065 $db->_die(); |
1065 $db->_die(); |
1066 setConfig('enable_uploads', '1'); |
1066 setConfig('enable_uploads', '1'); |
1067 } |
1067 } |
1068 else if ( !isset($_POST['enable_uploads']) && getConfig('enable_uploads') == '1' ) |
1068 else if ( !isset($_POST['enable_uploads']) && getConfig('enable_uploads') == '1' ) |
1069 { |
1069 { |
1070 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'upload_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\');'); |
1070 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'upload_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1071 if ( !$q ) |
1071 if ( !$q ) |
1072 $db->_die(); |
1072 $db->_die(); |
1073 setConfig('enable_uploads', '0'); |
1073 setConfig('enable_uploads', '0'); |
1074 } |
1074 } |
1075 if(isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') != '1') |
1075 if(isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') != '1') |
1076 { |
1076 { |
1077 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'magick_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\');'); |
1077 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'magick_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1078 if ( !$q ) |
1078 if ( !$q ) |
1079 $db->_die(); |
1079 $db->_die(); |
1080 setConfig('enable_imagemagick', '1'); |
1080 setConfig('enable_imagemagick', '1'); |
1081 } |
1081 } |
1082 else if ( !isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') == '1' ) |
1082 else if ( !isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') == '1' ) |
1083 { |
1083 { |
1084 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'magick_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\');'); |
1084 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'magick_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1085 if ( !$q ) |
1085 if ( !$q ) |
1086 $db->_die(); |
1086 $db->_die(); |
1087 setConfig('enable_imagemagick', '0'); |
1087 setConfig('enable_imagemagick', '0'); |
1088 } |
1088 } |
1089 if(isset($_POST['cache_thumbs'])) |
1089 if(isset($_POST['cache_thumbs'])) |
1094 { |
1094 { |
1095 setConfig('cache_thumbs', '0'); |
1095 setConfig('cache_thumbs', '0'); |
1096 } |
1096 } |
1097 if(isset($_POST['file_history']) && getConfig('file_history') != '1' ) |
1097 if(isset($_POST['file_history']) && getConfig('file_history') != '1' ) |
1098 { |
1098 { |
1099 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'filehist_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\');'); |
1099 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');'); |
1100 if ( !$q ) |
1100 if ( !$q ) |
1101 $db->_die(); |
1101 $db->_die(); |
1102 setConfig('file_history', '1'); |
1102 setConfig('file_history', '1'); |
1103 } |
1103 } |
1104 else if ( !isset($_POST['file_history']) && getConfig('file_history') == '1' ) |
1104 else if ( !isset($_POST['file_history']) && getConfig('file_history') == '1' ) |
1105 { |
1105 { |
1106 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'filehist_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\');'); |
1106 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');'); |
1107 if ( !$q ) |
1107 if ( !$q ) |
1108 $db->_die(); |
1108 $db->_die(); |
1109 setConfig('file_history', '0'); |
1109 setConfig('file_history', '0'); |
1110 } |
1110 } |
1111 if(file_exists($_POST['imagemagick_path']) && $_POST['imagemagick_path'] != getConfig('imagemagick_path')) |
1111 if(file_exists($_POST['imagemagick_path']) && $_POST['imagemagick_path'] != getConfig('imagemagick_path')) |
1113 if ( defined('ENANO_DEMO_MODE') ) |
1113 if ( defined('ENANO_DEMO_MODE') ) |
1114 // Hackish but safe. |
1114 // Hackish but safe. |
1115 $_POST['imagemagick_path'] = '/usr/bin/convert'; |
1115 $_POST['imagemagick_path'] = '/usr/bin/convert'; |
1116 $old = getConfig('imagemagick_path'); |
1116 $old = getConfig('imagemagick_path'); |
1117 $oldnew = "{$old}||{$_POST['imagemagick_path']}"; |
1117 $oldnew = "{$old}||{$_POST['imagemagick_path']}"; |
1118 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES(\'security\',\'magick_path\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',\'' . $db->escape($oldnew) . '\');'); |
1118 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'magick_path\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ',\'' . $db->escape($oldnew) . '\');'); |
1119 if ( !$q ) |
1119 if ( !$q ) |
1120 $db->_die(); |
1120 $db->_die(); |
1121 setConfig('imagemagick_path', $_POST['imagemagick_path']); |
1121 setConfig('imagemagick_path', $_POST['imagemagick_path']); |
1122 } |
1122 } |
1123 else if ( $_POST['imagemagick_path'] != getConfig('imagemagick_path') ) |
1123 else if ( $_POST['imagemagick_path'] != getConfig('imagemagick_path') ) |
1264 echo '</form>'; |
1264 echo '</form>'; |
1265 ?> |
1265 ?> |
1266 <?php |
1266 <?php |
1267 } |
1267 } |
1268 |
1268 |
1269 /* |
|
1270 function page_Admin_PluginManager() |
|
1271 { |
|
1272 global $db, $session, $paths, $template, $plugins; // Common objects |
|
1273 global $lang; |
|
1274 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
1275 { |
|
1276 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
|
1277 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
|
1278 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
|
1279 return; |
|
1280 } |
|
1281 |
|
1282 if(isset($_GET['action'])) |
|
1283 { |
|
1284 if ( !isset($_GET['plugin']) ) |
|
1285 { |
|
1286 echo '<div class="error-box">No plugin specified.</div>'; |
|
1287 } |
|
1288 else if ( !preg_match('/^[A-z0-9_\.-]+\.php$/', $_GET['plugin']) ) |
|
1289 { |
|
1290 echo '<div class="error-box">Hacking attempt</div>'; |
|
1291 } |
|
1292 else |
|
1293 { |
|
1294 $plugin =& $_GET['plugin']; |
|
1295 switch($_GET['action']) |
|
1296 { |
|
1297 case "enable": |
|
1298 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES(\'security\',\'plugin_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',"' . $db->escape($session->username) . '","' . $db->escape($_GET['plugin']) . '");'); |
|
1299 if ( !$q ) |
|
1300 $db->_die(); |
|
1301 setConfig("plugin_$plugin", '1'); |
|
1302 break; |
|
1303 case "disable": |
|
1304 if ( defined('ENANO_DEMO_MODE') && strstr($_GET['plugin'], 'Demo') ) |
|
1305 { |
|
1306 echo('<h3>' . $lang->get('acppl_err_heading') . '</h3> |
|
1307 <p>' . $lang->get('acppl_err_demo_plugin') . '</p>'); |
|
1308 break; |
|
1309 } |
|
1310 if ( !in_array($plugin, $plugins->system_plugins) ) |
|
1311 { |
|
1312 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES(\'security\',\'plugin_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',"' . $db->escape($session->username) . '","' . $db->escape($_GET['plugin']) . '");'); |
|
1313 if ( !$q ) |
|
1314 $db->_die(); |
|
1315 setConfig("plugin_$plugin", '0'); |
|
1316 } |
|
1317 else |
|
1318 { |
|
1319 echo '<h3>' . $lang->get('acppl_err_heading') . '</h3> |
|
1320 <p>' . $lang->get('acppl_err_system_plugin') . '</p>'; |
|
1321 } |
|
1322 break; |
|
1323 case "reimport": |
|
1324 $plugin_id = substr($plugin, 0, -4); |
|
1325 if ( isset($plugins->loaded_plugins[$plugin_id]) ) |
|
1326 { |
|
1327 // plugin file is safe, call import |
|
1328 $lang->import_plugin( ENANO_ROOT . "/plugins/$plugin" ); |
|
1329 echo '<div class="info-box">' . $lang->get('acppl_msg_reimport_success') . '</div>'; |
|
1330 } |
|
1331 break; |
|
1332 } |
|
1333 } |
|
1334 } |
|
1335 $dir = './plugins/'; |
|
1336 $plugin_list = Array(); |
|
1337 $system = Array(); |
|
1338 $show_system = ( isset($_GET['show_system']) && $_GET['show_system'] == 'yes' ); |
|
1339 |
|
1340 if (is_dir($dir)) |
|
1341 { |
|
1342 if ($dh = opendir($dir)) |
|
1343 { |
|
1344 while (($file = readdir($dh)) !== false) |
|
1345 { |
|
1346 if(preg_match('#^(.*?)\.php$#is', $file) && $file != 'index.php') |
|
1347 { |
|
1348 unset($thelist); |
|
1349 if ( in_array($file, $plugins->system_plugins) ) |
|
1350 { |
|
1351 if ( !$show_system ) |
|
1352 continue; |
|
1353 $thelist =& $system; |
|
1354 } |
|
1355 else |
|
1356 { |
|
1357 $thelist =& $plugin_list; |
|
1358 } |
|
1359 $f = file_get_contents($dir . $file); |
|
1360 $f = explode("\n", $f); |
|
1361 $f = array_slice($f, 2, 7); |
|
1362 $f[0] = substr($f[0], 13, strlen($f[0])); |
|
1363 $f[1] = substr($f[1], 12, strlen($f[1])); |
|
1364 $f[2] = substr($f[2], 13, strlen($f[2])); |
|
1365 $f[3] = substr($f[3], 8, strlen($f[3])); |
|
1366 $f[4] = substr($f[4], 9, strlen($f[4])); |
|
1367 $f[5] = substr($f[5], 12, strlen($f[5])); |
|
1368 $thelist[$file] = Array(); |
|
1369 $thelist[$file]['name'] = $f[0]; |
|
1370 $thelist[$file]['uri'] = $f[1]; |
|
1371 $thelist[$file]['desc'] = $f[2]; |
|
1372 $thelist[$file]['auth'] = $f[3]; |
|
1373 $thelist[$file]['vers'] = $f[4]; |
|
1374 $thelist[$file]['aweb'] = $f[5]; |
|
1375 |
|
1376 if ( preg_match('/^[a-z0-9]+_[a-z0-9_]+$/', $thelist[$file]['name']) ) |
|
1377 $thelist[$file]['name'] = $lang->get($thelist[$file]['name']); |
|
1378 |
|
1379 if ( preg_match('/^[a-z0-9]+_[a-z0-9_]+$/', $thelist[$file]['desc']) ) |
|
1380 $thelist[$file]['desc'] = $lang->get($thelist[$file]['desc']); |
|
1381 |
|
1382 } |
|
1383 } |
|
1384 closedir($dh); |
|
1385 } |
|
1386 else |
|
1387 { |
|
1388 echo '<div class="error-box">' . $lang->get('acppl_err_open_dir') . '</div>'; |
|
1389 return; |
|
1390 } |
|
1391 } |
|
1392 else |
|
1393 { |
|
1394 echo '<div class="error-box">' . $lang->get('acppl_err_missing_dir') . '</div>'; |
|
1395 return; |
|
1396 } |
|
1397 echo('<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"> |
|
1398 <tr> |
|
1399 <th>' . $lang->get('acppl_col_filename') . '</th> |
|
1400 <th>' . $lang->get('acppl_col_name') . '</th> |
|
1401 <th>' . $lang->get('acppl_col_description') . '</th> |
|
1402 <th>' . $lang->get('acppl_col_author') . '</th> |
|
1403 <th>' . $lang->get('acppl_col_version') . '</th> |
|
1404 <th></th> |
|
1405 </tr>'); |
|
1406 $plugin_files_1 = array_keys($plugin_list); |
|
1407 $plugin_files_2 = array_keys($system); |
|
1408 $plugin_files = array_values(array_merge($plugin_files_1, $plugin_files_2)); |
|
1409 $cls = 'row2'; |
|
1410 for ( $i = 0; $i < sizeof($plugin_files); $i++ ) |
|
1411 { |
|
1412 $cls = ( $cls == 'row2' ) ? 'row3' : 'row2'; |
|
1413 $this_plugin = ( isset($system[$plugin_files[$i]]) ) ? $system[$plugin_files[$i]] : $plugin_list[$plugin_files[$i]]; |
|
1414 $is_system = ( @$system[$plugin_files[$i]] ); |
|
1415 $bgcolor = ''; |
|
1416 if ( $is_system && $cls == 'row2' ) |
|
1417 $bgcolor = ' style="background-color: #FFD8D8;"'; |
|
1418 else if ( $is_system && $cls == 'row3' ) |
|
1419 $bgcolor = ' style="background-color: #FFD0D0;"'; |
|
1420 echo '<tr> |
|
1421 <td class="'.$cls.'"'.$bgcolor.'>'.$plugin_files[$i].'</td> |
|
1422 <td class="'.$cls.'"'.$bgcolor.'><a href="'.$this_plugin['uri'].'">'.$this_plugin['name'].'</a></td> |
|
1423 <td class="'.$cls.'"'.$bgcolor.'>'.$this_plugin['desc'].'</td> |
|
1424 <td class="'.$cls.'"'.$bgcolor.'><a href="'.$this_plugin['aweb'].'">'.$this_plugin['auth'].'</a></td> |
|
1425 <td class="'.$cls.'"'.$bgcolor.'>'.$this_plugin['vers'].'</td> |
|
1426 <td class="'.$cls.'"'.( $bgcolor != '' ? str_replace_once(';', '; text-align: center;', $bgcolor) : ' style="text-align: center;"' ).' nowrap="nowrap">'; |
|
1427 if ( !in_array($plugin_files[$i], $plugins->system_plugins) ) |
|
1428 { |
|
1429 if ( getConfig('plugin_'.$plugin_files[$i]) == '1' ) |
|
1430 { |
|
1431 echo '<a href="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'&show_system=' . ( $show_system ? 'yes' : 'no' ) . '&action=disable&plugin='.$plugin_files[$i].'">' . $lang->get('acppl_btn_disable') . '</a>'; |
|
1432 echo ' | '; |
|
1433 echo '<a title="' . $lang->get('acppl_btn_reimport_tip') . '" href="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'&show_system=' . ( $show_system ? 'yes' : 'no' ) . '&action=reimport&plugin='.$plugin_files[$i].'">' . $lang->get('acppl_btn_reimport') . '</a>'; |
|
1434 } |
|
1435 else |
|
1436 { |
|
1437 echo '<a href="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'&show_system=' . ( $show_system ? 'yes' : 'no' ) . '&action=enable&plugin='.$plugin_files[$i].'">' . $lang->get('acppl_btn_enable') . '</a>'; |
|
1438 } |
|
1439 } |
|
1440 else |
|
1441 { |
|
1442 echo $lang->get('acppl_lbl_system_plugin'); |
|
1443 } |
|
1444 echo '</td></tr>'; |
|
1445 } |
|
1446 $showhide_link = ( $show_system ) ? |
|
1447 '<a style="color: white;" href="' . makeUrlNS('Special', 'Administration', 'module=' . $paths->cpage['module'] . '&show_system=no', true) . '">' . $lang->get('acppl_btn_hide_system') . '</a>' : |
|
1448 '<a style="color: white;" href="' . makeUrlNS('Special', 'Administration', 'module=' . $paths->cpage['module'] . '&show_system=yes', true) . '">' . $lang->get('acppl_btn_show_system') . '</a>' ; |
|
1449 echo '<tr><th colspan="6" class="subhead">'.$showhide_link.'</th></tr>'; |
|
1450 echo '</table></div>'; |
|
1451 } |
|
1452 */ |
|
1453 |
|
1454 function page_Admin_DBBackup() |
1269 function page_Admin_DBBackup() |
1455 { |
1270 { |
1456 global $db, $session, $paths, $template, $plugins; // Common objects |
1271 global $db, $session, $paths, $template, $plugins; // Common objects |
1457 global $lang; |
1272 global $lang; |
1458 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1273 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |