//$crons_result = $vbulletin->db->query_read("SELECT varname, active FROM " . TABLE_PREFIX . "cron"); $crons_result = vB::getDbAssertor()->assertQuery('cron'); foreach ($crons_result as $cron) { $old = $cron['active'] ? 1 : 0; $new = $vbulletin->GPC['enabled']["{$cron['varname']}"] ? 1 : 0; if ($old != $new) { $updates["{$cron['varname']}"] = $new; } } if (!empty($updates)) { vB::getDbAssertor()->assertQuery('updateCron', array('updates' => $updates)); } $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl_js'), $args); $args['do'] = 'modify'; print_cp_redirect2('cronadmin', $args); } // ###################### Start run cron ####################### if ($_REQUEST['do'] == 'runcron') { $vbulletin->input->clean_array_gpc('r', array('cronid' => vB_Cleaner::TYPE_INT, 'varname' => vB_Cleaner::TYPE_STR)); $nextitem = null; if ($vbulletin->GPC['cronid']) { $nextitem = vB_Api::instanceInternal('cron')->fetchById($vbulletin->GPC['cronid']); } else { if ($vbulletin->GPC['varname']) { $nextitem = vB_Api::instanceInternal('cron')->fetchByVarName($vbulletin->GPC['varname']); } } if ($nextitem) { ignore_user_abort(1); @set_time_limit(0);
} else { if ($vbulletin->GPC['dismiss']) { $adminmessageid = intval($vbulletin->GPC['dismiss'][0]); vB::getDbAssertor()->update('adminmessage', array('status' => 'dismissed'), array('adminmessageid' => $adminmessageid)); } else { if ($vbulletin->GPC['acpnews']) { $items = preg_split('#\\s*,\\s*#s', $vbulletin->userinfo['dismissednews'], -1, PREG_SPLIT_NO_EMPTY); $items[] = intval($vbulletin->GPC['acpnews'][0]); $vbulletin->userinfo['dismissednews'] = implode(',', array_unique($items)); $admindata =& datamanager_init('Admin', $vbulletin, vB_DataManager_Constants::ERRTYPE_CP); if ($getperms = $assertor->getRow('vBForum:administrator', array('userid' => $vbulletin->userinfo['userid']))) { $admindata->set_existing($vbulletin->userinfo); } else { $admindata->set('userid', $vbulletin->userinfo['userid']); } $admindata->set('dismissednews', $vbulletin->userinfo['dismissednews']); $admindata->save(); } } } $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl_js'), $args); $args['do'] = 'home'; print_cp_redirect2('index', $args); } /*=========================================================================*\ || ####################################################################### || # Downloaded: 15:45, Tue Sep 8th 2015 || # CVS: $RCSfile$ - $Revision: 84798 $ || ####################################################################### \*=========================================================================*/
echo "</p>\n"; } // ############################################################################# // rebuilds all parent lists and id cache lists if ($_REQUEST['do'] == 'rebuild') { if (!vB::getUserContext()->hasAdminPermission('canadmintemplates')) { print_cp_no_permission(); } $vbulletin->input->clean_array_gpc('r', array('renumber' => vB_Cleaner::TYPE_INT, 'install' => vB_Cleaner::TYPE_INT, 'goto' => vB_Cleaner::TYPE_STR)); echo "<p> </p>"; vB_Library::instance('style')->buildAllStyles($vbulletin->GPC['renumber'], $vbulletin->GPC['install']); $execurl = vB_String::parseUrl($vbulletin->GPC['goto']); $pathinfo = pathinfo($execurl['path']); $file = $pathinfo['basename']; parse_str($execurl['query'], $args); print_cp_redirect2($file, $args); } // ############################################################################# // hex convertor if ($_REQUEST['do'] == 'colorconverter') { $vbulletin->input->clean_array_gpc('r', array('hex' => vB_Cleaner::TYPE_NOHTML, 'rgb' => vB_Cleaner::TYPE_NOHTML, 'hexdec' => vB_Cleaner::TYPE_STR, 'dechex' => vB_Cleaner::TYPE_STR)); if ($vbulletin->GPC['dechex']) { $vbulletin->GPC['rgb'] = preg_split('#\\s*,\\s*#si', $vbulletin->GPC['rgb'], -1, PREG_SPLIT_NO_EMPTY); $vbulletin->GPC['hex'] = '#'; foreach ($vbulletin->GPC['rgb'] as $i => $value) { $vbulletin->GPC['hex'] .= strtoupper(str_pad(dechex($value), 2, '0', STR_PAD_LEFT)); } $vbulletin->GPC['rgb'] = implode(',', $vbulletin->GPC['rgb']); } else { if ($vbulletin->GPC['hexdec']) { if (preg_match('/#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/siU', $vbulletin->GPC['hex'], $matches)) {
vB_Api::instanceInternal('options')->updateAttachSetting(ATTACH_AS_FILES_NEW); $vboptions = vB::getDatastore()->getValue('options'); } $attachments = vB::getDbAssertor()->assertQuery('vBForum:fetchFiledataLimit', array(vB_dB_Query::PARAM_LIMITSTART => $vbulletin->GPC['startat'], vB_dB_Query::PARAM_LIMIT => $vbulletin->GPC['perpage'])); if ($attachments->valid()) { $attachmentids = array(); foreach ($attachments as $attachment) { $attachmentids[] = $attachment['filedataid']; } vB::getDbAssertor()->update('filedata', array('filedata' => ''), array('filedataid' => $attachmentids)); vB::getDbAssertor()->update('vBForum:filedataresize', array('resize_filedata' => ''), array('filedataid' => $attachmentids)); $finishat = $vbulletin->GPC['startat'] + $vbulletin->GPC['perpage']; $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args = array_merge($args, array('do' => 'confirmattachmentremove', 'startat' => $finishat, "pp" => $vbulletin->GPC['perpage'], "removeattachments" => 1)); print_cp_redirect2('attachment', $args); echo "<p><a href=\"attachment.php?" . vB::getCurrentSession()->get('sessionurl') . "do=confirmattachmentremove&startat={$finishat}&removeattachments=1" . "&pp=" . $vbulletin->GPC['perpage'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>"; } else { // Again, make sure we are on attachments as files setting. vB_Api::instanceInternal('options')->updateAttachSetting(ATTACH_AS_FILES_NEW); print_stop_message2(array('attachments_moved_to_the_filesystem', vB::getCurrentSession()->get('sessionurl')), NULL, array(), null, 'attachment.php?do=stats'); } } else { print_stop_message2('attachments_not_moved_to_the_filesystem', NULL, array(), null, 'attachment.php?do=stats'); } } // ###################### Search attachments #################### $vbulletin->input->clean_array_gpc('r', array('massdelete' => vB_Cleaner::TYPE_STR)); if ($_REQUEST['do'] == 'search' and $vbulletin->GPC['massdelete']) { $vbulletin->input->clean_array_gpc('r', array('a_delete' => vB_Cleaner::TYPE_ARRAY_UINT)); // they hit the mass delete submit button
unset($userpic); } } $vbulletin->options['usefileavatar'] = true; } $lastuser = $image['userid']; } } $userid = $assertor->getRow('vBForum:fetchUserIdByAvatar', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'lastuser' => $lastuser)); if ($lastuser and $userid) { $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args['do'] = 'domoveavatar'; $args['startat'] = $finishat; $args['pp'] = $vbulletin->GPC['perpage']; print_cp_redirect2('avatar', $args); echo "<p><a href=\"avatar.php?" . vB::getCurrentSession()->get('sessionurl') . "do=domoveavatar&startat={$finishat}&pp=" . $vbulletin->GPC['perpage'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>"; } else { if (!$vbulletin->options['usefileavatar']) { $assertor->assertQuery('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'value' => 1, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'varname', 'value' => 'usefileavatar', 'operator' => vB_dB_Query::OPERATOR_EQ)))); vB::getDatastore()->build_options(); $assertor->assertQuery('vBForum:clearPictureData', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_METHOD)); $assertor->assertQuery('vBForum:optimizePictureTables', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_METHOD)); print_stop_message2('images_moved_to_the_filesystem', 'avatar', array('do' => 'storage')); } else { $assertor->assertQuery('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'value' => 0, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'varname', 'value' => 'usefileavatar', 'operator' => vB_dB_Query::OPERATOR_EQ)))); vB::getDatastore()->build_options(); print_stop_message2('images_moved_to_the_database', 'avatar', array('do' => 'storage')); } } }
// no change required } // if the desired parent is a child, show an error / go back page $closureQry = vB::getDbAssertor()->getRow('vBForum:closure', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'parent' => $channelid, 'child' => $data['parentid'])); if (!empty($closureQry)) { print_stop_message2('invalid_parent_category'); } // if the parentid is the same, OR the current channel is the top level channel, just unset the parentid. if ($data['parentid'] == $previousData['parentid'] or $channelid == $articleChannelId) { unset($data['parentid']); } // update the channel if (!empty($data)) { vB_Api::instanceInternal('content_channel')->update($channelid, $data); } print_cp_redirect2('cms', array('do' => 'categorylist'), 1); } // ###################### Start tag list ####################### if ($_REQUEST['do'] == 'taglist') { $channelInfoArray = array(); $categoriesList = getFullCategoryList($channelInfoArray); // grab all CMS content $searchResults = vB::getDbAssertor()->getRows('vBAdminCP:getFullFilteredCMSContentNodeids', array('channelids' => array_keys($channelInfoArray))); // the posts count must be populated $tags = array(); foreach ($searchResults as $node) { if (isset($node['taglist']) and !empty($node['taglist'])) { foreach (explode(',', $node['taglist']) as $tagtext) { if (!isset($tags[$tagtext]['posts'])) { $tags[$tagtext]['posts'] = 1; } else {
if ($vbulletin->GPC['prev'] != '' or $vbulletin->GPC['next'] != '') { if ($vbulletin->GPC['prev'] != '') { $vbulletin->GPC['pagenumber'] -= 1; } else { $vbulletin->GPC['pagenumber'] += 1; } } if ($vbulletin->GPC['fieldname'] == '') { $vbulletin->GPC['fieldname'] = 'global'; } // *********************** if ($vbulletin->GPC['dolanguageid'] == -2) { $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args['fieldname'] = $vbulletin->GPC['fieldname']; print_cp_redirect2('phrase', $args, 0); } else { if ($vbulletin->GPC['dolanguageid'] == 0) { $_REQUEST['do'] = 'modify'; } else { // *********************** $perpage = 10; print_phrase_ref_popup_javascript(); ?> <script type="text/javascript"> <!-- function js_fetch_default(varname) { var P = eval('document.forms.cpform.P_' + varname); var D = eval('document.forms.cpform.D_' + varname); P.value = D.value;
if (count($stylevars) == 0) { print_stop_message2('nothing_to_do'); } else { $deletestylevars = array(); foreach ($stylevars as $stylevar) { $deletestylevars[] = $stylevar['stylevarid']; } if (!empty($deletestylevars)) { vB::getDbAssertor()->assertQuery('vBForum:stylevar', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'stylevarid', 'value' => $deletestylevars, vB_Db_Query::OPERATOR_KEY => vB_Db_Query::OPERATOR_EQ), array('field' => 'styleid', 'value' => $style['styleid'], vB_Db_Query::OPERATOR_KEY => vB_Db_Query::OPERATOR_EQ)))); print_rebuild_style($style['styleid']); } $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args['do'] = 'modify'; $args['dostyleid'] = $style['styleid']; print_cp_redirect2('stylevar', $args, 1); vB_Library::instance('Style')->setCssDate(); } } else { print_stop_message2('invalid_style_specified'); } } // ############################################################################# // revert all StyleVars in a style if ($_REQUEST['do'] == 'revertall') { if ($vbulletin->GPC['dostyleid'] != -1 and $style = $assertor->getRow('vBForum:style', array('styleid' => $vbulletin->GPC['dostyleid']))) { if (!$style['parentlist']) { $style['parentlist'] = '-1'; } $stylevars = $assertor->getRows('vBForum:getStylevarsToRevert', array('parentlist' => explode(',', $style['parentlist']), 'styleid' => $style['styleid'])); if (count($stylevars) == 0) {
// ######################################################################## if ($_POST['do'] == 'dobuildsitemap') { $runner = new vB_SiteMapRunner_Admin($vbulletin); $status = $runner->check_environment(); if ($status['error']) { print_stop_message2($status['error']); } echo '<div>' . construct_phrase($vbphrase['processing_x'], '...') . '</div>'; vbflush(); $runner->generate(); if ($runner->is_finished) { $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args['do'] = 'buildsitemap'; $args['success'] = 1; print_cp_redirect2('sitemap', $args); } else { echo '<div>' . construct_phrase($vbphrase['processing_x'], $runner->written_filename) . '</div>'; print_form_header('sitemap', 'dobuildsitemap', false, true, 'cpform_dobuildsitemap'); print_submit_row($vbphrase['next_page'], 0); print_form_auto_submit('cpform_dobuildsitemap'); } } // ######################################################################## print_cp_footer(); /*=========================================================================*\ || ####################################################################### || # Downloaded: 15:45, Tue Sep 8th 2015 || # CVS: $RCSfile$ - $Revision: 83435 $ || ####################################################################### \*=========================================================================*/
// make random number if (empty($user['activationid'])) { //none exists so create one $user['activationid'] = build_user_activation_id($user['userid'], 2, 0); } else { $user['activationid'] = fetch_random_string(40); $assertor->assertQuery('useractivation', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'dateline' => $timeNow, 'activationid' => $user['activationid'], vB_dB_Query::CONDITIONS_KEY => array('userid' => $user['userid'], 'type' => 0))); } $vboptions = vB::getDatastore()->getValue('options'); $maildata = vB_Api::instanceInternal('phrase')->fetchEmailPhrases('activateaccount', array($user['username'], $vboptions['bbtitle'], $vboptions['frontendurl'], $user['userid'], $user['activationid'], $vboptions['webmasteremail']), array($user['username']), $user['languageid']); vB_Mail::vbmail($user['email'], $maildata['subject'], $maildata['message'], true); } } echo $vbphrase['okay'] . '</p><p><b>' . vB_Phrase::fetchSinglePhrase('emails_sent_successfully') . '</b></p>'; $args['do'] = 'find'; print_cp_redirect2('user', $args, true); } else { eval(standard_error(fetch_error('invalidemail', $vbulletin->options['contactuslink']))); } } // ############################# user change history ######################### if ($_REQUEST['do'] == 'changehistory') { require_once DIR . '/includes/class_userchangelog.php'; require_once DIR . '/includes/functions_misc.php'; $vbulletin->input->clean_array_gpc('r', array('userid' => vB_Cleaner::TYPE_UINT)); if ($vbulletin->GPC['userid']) { // initalize the $user storage $users = false; // create the vb_UserChangeLog instance and set the execute flag (we want to do the query, not just to build) $userchangelog = new vb_UserChangeLog($vbulletin); $userchangelog->set_execute(true);
while ($post = $vbulletin->db->fetch_array($posts)) { $result = vB_Api::instance('node')->deleteNodes($post['nodeid']); if (isset($result['errors'])) { print_stop_message2($result['errors'][0]); } echo construct_phrase($vbphrase['processing_x'], $post['postid']) . "<br />\n"; vbflush(); $gotsome = true; } if ($gotsome) { $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args['do'] = 'removeorphanposts'; $args['startat'] = $finishat; $args['pp'] = $vbulletin->GPC['perpage']; print_cp_redirect2('misc', $args); echo "<p><a href=\"misc.php?" . vB::getCurrentSession()->get('sessionurl') . "do=removeorphanposts&pp=" . $vbulletin->GPC['perpage'] . "&startat={$finishat}\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>"; } else { print_stop_message2('deleted_orphan_posts_successfully', 'misc'); } } // ###################### Anonymous Survey Code ####################### if ($_REQUEST['do'] == 'survey') { if (!$maintainAll) { print_cp_no_permission(); } // first we'd like extra phrase groups from the cphome fetch_phrase_group('cphome'); /* All the functions are prefixed with @ to supress errors, this allows us to get feedback from hosts which have almost everything useful disabled
if ($_POST['do'] == 'doimport') { if (!vB::getUserContext()->hasAdminPermission('canadminsettingsall')) { print_cp_no_permission(); } $vbulletin->input->clean_array_gpc('p', array('serverfile' => vB_Cleaner::TYPE_STR, 'restore' => vB_Cleaner::TYPE_BOOL, 'blacklist' => vB_Cleaner::TYPE_BOOL)); $vbulletin->input->clean_array_gpc('f', array('settingsfile' => vB_Cleaner::TYPE_FILE)); if (is_demo_mode()) { print_cp_message('This function is disabled within demo mode'); } $doImport = vB_Api::instance('Options')->importSettingsXML($vbulletin->GPC['settingsfile'], $vbulletin->GPC['serverfile'], $vbulletin->GPC['restore'], $vbulletin->GPC['blacklist']); if (isset($doImport['errors'])) { print_stop_message2($doImport['errors'][0]); } else { $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); print_cp_redirect2('options', $args, 0); } } // ###################### Start import settings XML ####################### if ($_REQUEST['do'] == 'files') { if (!vB::getUserContext()->hasAdminPermission('canadminsettingsall')) { print_cp_no_permission(); } if (is_demo_mode()) { print_cp_message('This function is disabled within demo mode'); } $vbulletin->input->clean_array_gpc('r', array('type' => vB_Cleaner::TYPE_NOHTML)); // download form print_form_header('options', 'download', 0, 1, 'downloadform', '90%', '', true, 'post" target="download'); print_table_header($vbphrase['download']); print_select_row($vbphrase['product'], 'product', fetch_product_list());
$result = $template_api->fetchReplacementVar($vbulletin->GPC['findtext'], $vbulletin->GPC['dostyleid']); if (isset($result['errors'][0])) { print_stop_message2($result['errors'][0]); } $existing = $result['replacmentvar']; if ($existing) { print_stop_message2(array('replacement_already_exists', htmlspecialchars($existing['title']), htmlspecialchars($existing['template']), "replacement.php?" . vB::getCurrentSession()->get('sessionurl') . "do=edit&dostyleid={$existing['styleid']}&templateid={$existing['templateid']}")); } else { $result = $template_api->insertReplacementVar($vbulletin->GPC['dostyleid'], $vbulletin->GPC['findtext'], $vbulletin->GPC['replacetext']); if (isset($result['errors'][0])) { print_stop_message2($result['errors'][0]); } $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args['do'] = 'modify'; print_cp_redirect2('replacement', $args, 1); } } // *********************** add ********************* if ($_REQUEST['do'] == 'add') { print_form_header('replacement', 'insert'); print_table_header($vbphrase['add_new_replacement_variable']); print_style_chooser_row('dostyleid', $vbulletin->GPC['dostyleid'], MASTERSTYLE, $vbphrase['style'], iif($vb5_config['Misc']['debug'] == 1, 1, 0)); print_input_row("{$vbphrase['search_for_text']} <dfn>({$vbphrase['case_insensitive']})</dfn>", 'findtext', ''); print_textarea_row($vbphrase['replace_with_text'], 'replacetext', '', 5, 50); print_submit_row($vbphrase['save']); } // *********************** modify ********************* if ($_REQUEST['do'] == 'modify') { print_form_header('', ''); print_table_header($vbphrase['color_key']);
$vbulletin->GPC['replacement'] = array(); foreach ($temp as $key => $replacebits) { $vbulletin->GPC['replacement']["{$replacebits['find']}"] = $replacebits['replace']; $vbulletin->GPC['delete']['replacement']["{$replacebits['find']}"] = $vbulletin->GPC['delete']['replacement']["{$key}"]; } build_special_templates($vbulletin->GPC['replacement'], 'replacement', 'replacement'); } print_rebuild_style($vbulletin->GPC['dostyleid'], iif($vbulletin->GPC['dostyleid'] == -1, $vbphrase['master_style'], $style['title']), $vbulletin->GPC['dowhat']['css'], $vbulletin->GPC['dowhat']['stylevars'], $vbulletin->GPC['dowhat']['replacements'], $vbulletin->GPC['dowhat']['posteditor']); $args = array(); parse_str(vB::getCurrentSession()->get('sessionurl'), $args); $args['do'] = 'edit'; $args['dostyleid'] = $vbulletin->GPC['dostyleid']; $args['group'] = $vbulletin->GPC['group']; $args['dowhat'] = $vbulletin->GPC['passthru_dowhat']; $args['colorPickerType'] = $vbulletin->GPC['colorPickerType']; print_cp_redirect2('css', $args, 1); } // ###################### Start Choose What to Edit ####################### if ($_REQUEST['do'] == 'edit') { if ($_REQUEST['dowhat'] == 'templates' and !can_administer('canadmintemplates') or $_REQUEST['dowhat'] != 'templates' and !can_administer('canadminstyles')) { print_cp_no_permission(); } $vbulletin->input->clean_array_gpc('r', array('dostyleid' => vB_Cleaner::TYPE_INT, 'group' => vB_Cleaner::TYPE_STR, 'dowhat' => vB_Cleaner::TYPE_STR)); if ($vbulletin->GPC['dostyleid'] == 0 or $vbulletin->GPC['dostyleid'] < -1) { $vbulletin->GPC['dostyleid'] = 1; } if (!empty($vbulletin->GPC['dowhat'])) { $_REQUEST['do'] = 'doedit'; } else { if ($vbulletin->GPC['dostyleid'] == -1) { $style = array('styleid' => -1, 'title' => $vbphrase['master_style']);