} if ($all != '6') { printHTMLHeader($omit, $url, $cl, $multi, $all, $started); } if ($multi == '1' && !$url) { // Wait for admin's first thread activation die; } if ($multi_indexer > '1') { // superess output for multithreaded indexing $cl = '1'; $command_line = '1'; } if ($all == '1') { // for command line operation: index all sites in database index_all(); } if ($all == '2') { // index all new sites, never indexed before index_new(); } if ($all == '3') { // index all erased sites index_erased(); } if ($all == '4') { // 'Erase & Re-index all' for command line operation erase(); $log_handle = create_logFile($id); index(); }
function admin($pageid, $userid) { if (isset($_GET['doaction']) && $_GET['doaction'] == 'getsuggestions' && isset($_GET['forwhat'])) { if (strlen($_GET['forwhat']) >= 3) { echo getSuggestions($_GET['forwhat']); disconnect(); exit; } } global $urlRequestRoot, $templateFolder, $cmsFolder, $ICONS; if (isset($_GET['indexsite'])) { global $sourceFolder; require "{$sourceFolder}/modules/search/admin/spider.php"; if ($_GET['indexsite'] == 1) { $serveruri = isset($_SERVER['ORIG_SCRIPT_NAME']) ? $_SERVER['ORIG_SCRIPT_NAME'] : $_SERVER['SCRIPT_NAME']; $uri = substr($serveruri, 0, stripos($serveruri, "index.php")); $site = "http://" . $_SERVER['HTTP_HOST'] . $uri . "home/"; index_site($site, 0, -1, 'full', "", "+\n&", 0); displayinfo("Index for site created"); } else { index_all(); } } $result = mysql_fetch_array(mysql_query("SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute` = 'reindex_frequency'")); if ($result != NULL) { $threshold = $result['value']; } else { $threshold = 30; } $result = mysql_fetch_array(mysql_query("SELECT to_days(CURRENT_TIMESTAMP)-to_days(`indexdate`) AS 'diff' FROM `sites` WHERE `url` LIKE '%home%'")); if ($result == NULL) { displayinfo("It seems the site doesn't have index for the search to work. Click <a href='./+admin&indexsite=1'>here</a> to index the site."); } else { if ($result['diff'] > $threshold) { displayinfo("Your site index was created {$result['diff']} days before. Click <a href='./+admin&indexsite=2'>here</a> to reindex your site."); } } $quicklinks = <<<ADMINPAGE \t<fieldset> \t<legend>{$ICONS['Website Administration']['small']}Website Administration</legend> \t<a name='quicklinks'></a> \t<table class="iconspanel"> \t<tr> \t<td><a href="./+admin&subaction=global"><div>{$ICONS['Global Settings']['large']}<br/>Global Settings</div></a></td>\t \t<td><a href="./+admin&subaction=template"><div>{$ICONS['Templates Management']['large']}<br/>Templates Management</div></a></td> \t<td><a href="./+admin&subaction=module"><div>{$ICONS['Modules Management']['large']}<br/>Module Management</div></a></td> \t<td><a href="./+admin&subaction=widgets"><div>{$ICONS['Widgets']['large']}<br/>Widgets Management</div></a></td> \t</tr> \t<tr> \t<td><a href="./+admin&subaction=icon"><div>{$ICONS['Icons']['large']}<br/>Icons Management</div></a></td> \t<td><a href="./+admin&subaction=email"><div>{$ICONS['Email Registrants']['large']}<br/>Email Registrants</div></a></td> \t<td><a href="./+admin&subaction=editgroups"><div>{$ICONS['User Groups']['large']}<br/>Group Management</div></a></td> \t<td><a href="./+admin&subaction=expert"><div>{$ICONS['Site Maintenance']['large']}<br/>Site Maintenance</div></a></td> \t</tr> \t<tr> \t \t<td colspan=2><a href="./+admin&subaction=useradmin"><div>{$ICONS['User Management']['large']}<br/>User Management</div></a></td> \t<td colspan=2><a href="./+admin&subaction=editprofileform"><div>{$ICONS['User Profile']['large']}<br/>User Profiles</div></a></td> \t</tr> \t</table> \t</fieldset> ADMINPAGE; if (isset($_GET['subaction'])) { require_once "email.lib.php"; if ($_GET['subaction'] == "email") { return displayEmail() . $quicklinks; } else { if ($_GET['subaction'] == "openemail") { return displayEmail(escape($_GET['name'])) . $quicklinks; } else { if ($_GET['subaction'] == "emailsend") { sendEmail(); return displayEmail(escape($_POST['emailtemplates'])) . $quicklinks; } else { if ($_GET['subaction'] == "emailsave") { saveEmail(); return displayEmail(escape($_POST['emailtemplates'])) . $quicklinks; } } } } } if (isset($_GET['subaction']) && ($_GET['subaction'] == 'module' || $_GET['subaction'] == 'template')) { $type = escape($_GET['subaction']); if ($type == 'module') { displaywarning("Module Installation/Uninstallation has the potential to completely bring down the CMS, so Install only modules from trusted source"); } require_once "module.lib.php"; require_once "template.lib.php"; $type = ucfirst($type); $function = "handle{$type}Management"; $op = $function(); if ($op != "") { return $op . $quicklinks; } return managementForm($type) . $quicklinks; } global $sourceFolder; if (!isset($_GET['subaction']) && !isset($_GET['subsubaction'])) { return $quicklinks; } require_once "users.lib.php"; $op = ""; $ophead = ""; $str = ""; if (isset($_GET['subaction']) || isset($_GET['subsubaction']) || isset($_GET['id']) || isset($_GET['movePermId']) || isset($_GET['module'])) { if (isset($_GET['subaction']) && $_GET['subaction'] == 'global' && isset($_POST['update_global_settings'])) { updateGlobalSettings(); } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'global' && isset($_GET['del_black'])) { delete_blacklist(); } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'useradmin') { $op .= handleUserMgmt(); $ophead = "{$ICONS['User Management']['small']}User Management"; } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'widgets') { $op .= handleWidgetAdmin($pageid); $ophead = "{$ICONS['Widgets']['small']}Widgets Management"; } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'icon') { require_once "iconmanagement.lib.php"; $res = handleIconManagement(); if (isset($_GET['iconURL'])) { return $res; } $op .= $res; $ophead = "{$ICONS['Icons']['small']}Icons Management"; } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'editgroups') { require_once "permission.lib.php"; $pagepath = array(); parseUrlDereferenced($pageid, $pagepath); $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagepath, $userid, array_reverse(getGroupIds($userid)), $virtue); $modifiableGroups = getModifiableGroups($userid, $maxPriorityGroup); $op .= groupManagementForm($userid, $modifiableGroups, $pagepath); $ophead = "{$ICONS['Group Management']['small']}Group Management"; } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'reloadtemplates') { $op .= reloadTemplates(); $ophead = "{$ICONS['Templates Management']['small']}Reloading Templates"; } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'reloadmodules') { $op .= reloadModules(); $ophead = "{$ICONS['Modules Management']['small']}Reloading Modules"; } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'checkPerm') { $op .= admin_checkFunctionPerms(); $ophead = "{$ICONS['Access Permissions']['small']}Checking Permissions Consistency"; } elseif (isset($_GET['subaction']) && $_GET['subaction'] == 'checkAdminUser') { $op .= admin_checkAdminUser(); $ophead = "Checking Administrator User"; } elseif (isset($_GET['subaction']) && $_GET['subaction'] == 'checkAdminPerms') { $op .= admin_checkAdminPerms(); $ophead = "Checking Administrator Permissions"; } elseif (isset($_GET['subaction']) && $_GET['subaction'] == 'changePermRank') { $op .= admin_changePermRank(); $ophead = "{$ICONS['Access Permissions']['small']}Changing Permissions Rank"; } elseif (isset($_GET['subaction']) && $_GET['subaction'] == 'editprofileform' || isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'editprofileform') { $op .= admin_editProfileForm(); $ophead = "{$ICONS['User Profile']['small']}Edit User Profile Form"; } elseif (isset($_GET['id'])) { $op .= admin_userAdmin(); } elseif (isset($_GET['movePermId'])) { $op .= admin_changePermRank(); $ophead = "{$ICONS['Access Permissions']['small']}Changing Permissions Rank"; } elseif (isset($_GET['module'])) { $op .= admin_changePermRank(escape($_GET['module'])); $ophead = "{$ICONS['Access Permissions']['small']}Changing Permissions Rank for module '" . escape($_GET['module']) . "'"; } } } } } } } } } } if ($op != "") { $op = "<fieldset><legend>{$ophead}</legend>{$op}</fieldset>"; } if (isset($_GET['subaction']) && $_GET['subaction'] == 'global') { $str .= globalSettingsForm(); } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'editgroups') { //do nothing so that "expert only" doesn't comes up } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'useradmin') { $op .= userManagementForm(); } else { if (isset($_GET['subaction']) && $_GET['subaction'] == 'expert') { $str .= "<fieldset><legend>{$ICONS['Site Maintenance']['small']}Experts Only</legend>"; $str .= '<a href="./+admin&subaction=checkPerm">Check Permission List</a><br />'; $str .= '<a href="./+admin&subaction=checkAdminUser">Check Admin User</a><br />'; $str .= '<a href="./+admin&subaction=checkAdminPerms">Check Admin Perms</a><br />'; $str .= '<a href="./+admin&subaction=changePermRank">Change Perm Ranks</a><br />'; $str .= '<a href="./+admin&subaction=reloadtemplates">Reload Templates</a><br />'; $str .= '<a href="./+admin&subaction=reloadmodules">Reload Modules</a><br />'; $str .= '<a href="./+admin&indexsite=2">Reindex Site for Searching</a></br/></fieldset>'; } } } } return $str . $op . $quicklinks; }