function verify_upload_folder($attachpath)
{
    if ($attachpath == '') {
        print_stop_message2('please_complete_required_fields');
    }
    // Get realpath.
    $test = realpath($attachpath);
    if (!$test) {
        // If above fails, try relative path instead.
        $test = realpath(DIR . DIRECTORY_SEPARATOR . $attachpath);
    }
    if (!is_dir($test) or !is_writable($test)) {
        print_stop_message2(array('test_file_write_failed', $attachpath));
    }
    if (!is_dir($test . '/test')) {
        @umask(0);
        if (!@mkdir($test . '/test', 0777)) {
            print_stop_message2(array('test_file_write_failed', $attachpath));
        }
    }
    @chmod($test . '/test', 0777);
    if ($fp = @fopen($test . '/test/test.attach', 'wb')) {
        fclose($fp);
        if (!@unlink($test . '/test/test.attach')) {
            print_stop_message2(array('test_file_write_failed', $attachpath));
        }
        @rmdir($test . '/test');
    } else {
        print_stop_message2(array('test_file_write_failed', $attachpath));
    }
}
Example #2
0
function verify_upload_folder($imagepath)
{
    if ($imagepath == '') {
        print_stop_message2('please_complete_required_fields');
    }
    // Get realpath.
    $test = realpath($imagepath);
    if (!$test) {
        // If above fails, try relative path instead.
        $test = realpath(DIR . DIRECTORY_SEPARATOR . $imagepath);
    }
    if ($fp = @fopen($test . '/test.image', 'wb')) {
        fclose($fp);
        if (!@unlink($test . '/test.image')) {
            print_stop_message2(array('test_file_write_failed', $imagepath));
        }
        return true;
    } else {
        print_stop_message2(array('test_file_write_failed', $imagepath));
    }
}
Example #3
0
        if (can_access_logs($vb5_config['SpecialUsers']['canpruneadminlog'], 1)) {
            print_form_header('apilog', 'prunelog');
            print_table_header($vbphrase['prune_api_log']);
            print_input_row($vbphrase['remove_entries_logged_by_apiclientid'], 'apiclientid');
            print_input_row($vbphrase['remove_entries_older_than_days'], 'daysprune', 30);
            print_submit_row($vbphrase['prune_api_log'], 0);
        } else {
            echo '<p>' . $vbphrase['control_panel_log_pruning_permission_restricted'] . '</p>';
        }
    }
}
// ###################### Start view client #######################
if ($_REQUEST['do'] == 'viewclient') {
    $vbulletin->input->clean_array_gpc('r', array('apiclientid' => vB_Cleaner::TYPE_UINT));
    if (!$vbulletin->GPC['apiclientid'] or !($client = vB::getDbAssertor()->getRow('api_fetchclientbyid', array('apiclientid' => $vbulletin->GPC['apiclientid'])))) {
        print_stop_message2(array('invalidid', 'apiclientid'));
    }
    print_form_header('api', 'viewclient');
    print_table_header($vbphrase['apiclient']);
    print_label_row($vbphrase['apiclientid'], $client['apiclientid']);
    print_label_row($vbphrase['apiclientname'], vB_String::htmlSpecialCharsUni($client['clientname']));
    print_label_row($vbphrase['apiclientversion'], vB_String::htmlSpecialCharsUni($client['clientversion']));
    print_label_row($vbphrase['apiclient_platformname'], vB_String::htmlSpecialCharsUni($client['platformname']));
    print_label_row($vbphrase['apiclient_platformversion'], vB_String::htmlSpecialCharsUni($client['platformversion']));
    print_label_row($vbphrase['apiclient_uniqueid'], vB_String::htmlSpecialCharsUni($client['uniqueid']));
    print_label_row($vbphrase['apiclient_initialipaddress'], iif(!empty($client['initialipaddress']), "<a href=\"usertools.php?" . vB::getCurrentSession()->get('sessionurl') . "do=doips&amp;depth=2&amp;ipaddress={$client['initialipaddress']}&amp;hash=" . CP_SESSIONHASH . "\">{$client['initialipaddress']}</a>", "&nbsp;"));
    print_label_row($vbphrase['apiclient_initialtime'], vbdate($vbulletin->options['dateformat'] . ' ' . $vbulletin->options['timeformat'], $client['dateline']));
    print_label_row($vbphrase['apiclient_lastactivity'], vbdate($vbulletin->options['dateformat'] . ' ' . $vbulletin->options['timeformat'], $client['lastactivity']));
    print_label_row($vbphrase['apiclient_clienthash'], $client['clienthash']);
    print_label_row($vbphrase['apiclient_secret'], $client['secret']);
    print_label_row($vbphrase['apiclient_apiaccesstoken'], $client['apiaccesstoken']);
                                $options = array();
                                foreach ($optionfields as $fieldname => $optionname) {
                                    if ($profilefield["{$fieldname}"]) {
                                        $options[] = $optionname;
                                    }
                                }
                                $options = implode(', ', $options) . '&nbsp;';
                                echo "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"{$bgclass}\"><strong>{$profilefield['title']} <dfn>{$types["{$profilefield['type']}"]}</dfn></strong></td>\n\t\t\t\t\t\t\t\t\t<td class=\"{$bgclass}\">{$options}</td>\n\t\t\t\t\t\t\t\t\t<td class=\"{$bgclass}\">field{$_profilefieldid}</td>\n\t\t\t\t\t\t\t\t\t<td class=\"{$bgclass}\"><input type=\"text\" class=\"bginput\" name=\"order[{$_profilefieldid}]\" value=\"{$profilefield['displayorder']}\" size=\"5\" /></td>\n\t\t\t\t\t\t\t\t\t<td class=\"{$bgclass}\">" . construct_link_code($vbphrase['edit'], "profilefield.php?" . vB::getCurrentSession()->get('sessionurl') . "do=edit&amp;profilefieldid={$_profilefieldid}") . construct_link_code($vbphrase['delete'], "profilefield.php?" . vB::getCurrentSession()->get('sessionurl') . "do=remove&profilefieldid={$_profilefieldid}") . "</td>\n\t\t\t\t\t\t\t\t</tr>";
                            }
                        }
                    }
                }
                print_description_row("<input type=\"submit\" class=\"button\" value=\"{$vbphrase['save_display_order']}\" accesskey=\"s\" />", 0, 5, 'tfoot', vB_Template_Runtime::fetchStyleVar('right'));
                if (++$areacount < $numareas) {
                    print_table_break('');
                }
            }
        }
        print_table_footer();
    } else {
        print_stop_message2('no_profile_fields_defined');
    }
}
// #############################################################################
print_cp_footer();
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 83432 $
|| #######################################################################
\*=========================================================================*/
Example #5
0
    print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
}
// ###################### Start Kill #######################
if ($_POST['do'] == 'kill') {
    $rankapi->delete($rankId);
    print_stop_message2('deleted_user_rank_successfully', 'ranks', array('do' => 'modify'));
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'modify') {
    $ranks = $rankapi->fetchAll();
    print_form_header('', '');
    print_table_header($vbphrase['user_rank_manager_gcprank']);
    print_description_row($vbphrase['user_ranks_desc'] . '<br /><br />' . construct_phrase($vbphrase['it_is_recommended_that_you_update_user_titles'], vB::getCurrentSession()->get('sessionurl')), '', 0);
    print_table_footer();
    if (!$ranks or count($ranks) == 0) {
        print_stop_message2('no_user_ranks_defined');
    }
    print_form_header('', '');
    // the $tempgroup check in the foreach below relies on the first pass of $tempgroup not being 0,
    // which it will be if it is init to false.
    $tempgroup = null;
    foreach ($ranks as $rank) {
        if ($tempgroup != $rank['usergroupid']) {
            if (!empty($tempgroup)) {
                print_table_break();
            }
            $tempgroup = $rank['usergroupid'];
            print_table_header($rank['usergroupid'] == 0 ? $vbphrase['all_usergroups'] : $rank['title'], 5, 1);
            print_cells_row(array($vbphrase['user_rank'], $vbphrase['minimum_posts'], $vbphrase['display_type'], $vbphrase['stack_rank'], $vbphrase['controls']), 1, '', -1);
        }
        $count = 0;
Example #6
0
                    $usercss->invalid["{$selectorname}"]["{$property}"] = ' usercsserror ';
                    continue;
                }
            }
            $usercss->parse($selectorname, $property, $value);
        }
    }
    if (!empty($usercss->error)) {
        print_cp_message(implode("<br />", $usercss->error));
    } else {
        if (!empty($usercss->invalid)) {
            print_stop_message2('invalid_values_customize_profile');
        }
    }
    $usercss->save();
    print_stop_message2('saved_profile_customizations_successfully', 'user', array('do' => 'edit', 'u' => $userinfo['userid']));
}
// ########################################################################
if ($_REQUEST['do'] == 'usercss') {
    require_once DIR . '/includes/adminfunctions_template.php';
    ?>
	<script type="text/javascript" src="<?php 
    echo $vbulletin->options['bburl'];
    ?>
/clientscript/vbulletin_cpcolorpicker.js?v=<?php 
    echo SIMPLE_VERSION;
    ?>
"></script>
	<?php 
    $colorPicker = construct_color_picker(11);
    $allowedfonts = $usercss->build_admin_select_option($vbulletin->options['usercss_allowed_fonts'], 'usercss_font_');
            }
            break;
        case 'deny':
            $usergroupcache =& vB::getDatastore()->getValue('usergroupcache');
            foreach ($usergroupcache as $group) {
                /*insert query*/
                vB::getDbAssertor()->assertQuery('replacePermissions', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'nodeid' => $vbulletin->GPC['nodeid'], 'usergroupid' => $group['usergroupid'], 'forumpermissions' => 0, 'moderatorpermissions' => 0, 'createpermissions' => 0, 'forumpermissions2' => 0, 'edit_time' => 2, 'require_moderate' => 1, 'maxtags' => 0, 'maxstartertags' => 0, 'maxothertags' => 0, 'maxattachments' => 0, 'maxchannels' => 0, 'channeliconmaxsize' => 0));
            }
            break;
        default:
            print_stop_message2('invalid_quick_set_action');
    }
    build_channel_permissions();
    vB_Cache::instance()->event('perms_changed');
    vB::getUserContext()->rebuildGroupAccess();
    print_stop_message2('saved_channel_permissions_successfully', 'forumpermission', array('do' => 'modify', 'n' => $vbulletin->GPC['nodeid']));
}
// ###################### Start fpgetstyle #######################
function fetch_forumpermission_style($permissions)
{
    global $vbulletin;
    if (!($permissions & $vbulletin->bf_ugp_forumpermissions['canview'])) {
        return " style=\"list-style-type:circle;\"";
    } else {
        return '';
    }
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'modify') {
    print_form_header('', '');
    print_table_header($vbphrase['additional_functions_gcppermission']);
Example #8
0
                $criteria_sql[] = array('noticeid' => $noticeid, 'criteriaid' => $criteriaid, 'condition1' => trim($criteria['condition1']), 'condition2' => trim($criteria['condition2']), 'condition3' => trim($criteria['condition3']));
            }
        }
        // insert criteria
        $assertor->insertMultiple('vBForum:noticecriteria', array('noticeid', 'criteriaid', 'condition1', 'condition2', 'condition3'), $criteria_sql);
    }
    // insert / update phrase
    $userInfo = vB_User::fetchUserInfo();
    $options = vB::getDatastore()->getValue('options');
    $assertor->assertQuery('replaceIntoPhrases', array('languageid' => 0, 'varname' => 'notice_' . $noticeid . '_html', 'text' => $vbulletin->GPC['html'], 'product' => 'vbulletin', 'fieldname' => 'global', 'enteredBy' => $userInfo['username'], 'dateline' => vB::getRequest()->getTimeNow(), 'version' => $options['templateversion']));
    // update the datastore notice cache
    build_notice_datastore();
    // rebuild languages
    require_once DIR . '/includes/adminfunctions_language.php';
    build_language(-1);
    print_stop_message2(array('saved_notice_x_successfully', $vbulletin->GPC['title']), 'notice', array('do' => 'modify'));
}
// #############################################################################
// edit a notice
if ($_REQUEST['do'] == 'edit' or $_REQUEST['do'] == 'add') {
    $vbulletin->input->clean_array_gpc('r', array('noticeid' => vB_Cleaner::TYPE_UINT));
    // initialize some data storage
    $notice_cache = array();
    $notice_name_cache = array();
    $criteria_cache = array();
    // cache all notices
    $notice_result = $assertor->getRows('vBForum:notice', array(), 'displayorder');
    $max_displayorder = 0;
    foreach ($notice_result as $notice) {
        $notice_cache["{$notice['noticeid']}"] = $notice;
        if ($notice['noticeid'] != $vbulletin->GPC['noticeid']) {
Example #9
0
                autoexport_write_faq($product['product']);
            }
        }
    }
    vb_Cache::instance()->event('vB_FAQ_chg');
    print_stop_message2('saved_display_order_successfully', 'faq', array('faq' => $vbulletin->GPC['faqparent']));
}
// #############################################################################
if ($_REQUEST['do'] == 'modify') {
    $vbulletin->input->clean_array_gpc('r', array('faq' => vB_Cleaner::TYPE_STR));
    $faqparent = iif(empty($vbulletin->GPC['faq']), 'faqroot', $vbulletin->GPC['faq']);
    cache_ordered_faq();
    if (!is_array($ifaqcache["{$faqparent}"])) {
        $faqparent = $faqcache["{$faqparent}"]['faqparent'];
        if (!is_array($ifaqcache["{$faqparent}"])) {
            print_stop_message2('invalid_faq_item_specified');
        }
    }
    global $parents;
    $parents = array();
    fetch_faq_parents($faqcache["{$faqparent}"]['faqname']);
    $parents = array_reverse($parents);
    $nav = "<a href=\"faq.php?" . vB::getCurrentSession()->get('sessionurl') . "\">{$vbphrase['faq']}</a>";
    if (!empty($parents)) {
        $i = 1;
        foreach ($parents as $link => $name) {
            $nav .= '<br />' . str_repeat('&nbsp; &nbsp; ', $i) . iif(empty($link), $name, "<a href=\"{$link}\">{$name}</a>");
            $i++;
        }
        $nav .= '
			<span class="smallfont">' . construct_link_code($vbphrase['edit'], "faq.php?" . vB::getCurrentSession()->get('sessionurl') . "do=edit&amp;faq=" . urlencode($faqparent)) . construct_link_code($vbphrase['add_child_faq_item'], "faq.php?" . vB::getCurrentSession()->get('sessionurl') . "do=add&amp;faq=" . urlencode($faqparent)) . construct_link_code($vbphrase['delete'], "faq.php?" . vB::getCurrentSession()->get('sessionurl') . "do=delete&amp;faq=" . urlencode($faqparent)) . '</span>';
Example #10
0
        print_description_row(construct_phrase($vbphrase['are_you_sure_you_want_to_prune_x_log_entries_from_scheduled_task_log'], vb_number_format($logs['count'])));
        print_submit_row($vbphrase['yes'], 0, 0, $vbphrase['no']);
    } else {
        print_stop_message2('no_matches_found_gerror');
    }
}
// ###################### Start do prune log #######################
if ($_POST['do'] == 'doprunelog') {
    $vbulletin->input->clean_array_gpc('p', array('varname' => vB_Cleaner::TYPE_STR, 'datecut' => vB_Cleaner::TYPE_INT));
    $conditions = array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE);
    if (!empty($vbulletin->GPC['varname'])) {
        $conditions[vB_dB_Query::CONDITIONS_KEY][] = array('field' => 'varname', 'value' => $vbulletin->GPC['varname'], vB_dB_Query::OPERATOR_KEY => vB_dB_Query::OPERATOR_EQ);
    }
    $conditions[vB_dB_Query::CONDITIONS_KEY][] = array('field' => 'dateline', 'value' => $vbulletin->GPC['datecut'], vB_dB_Query::OPERATOR_KEY => vB_dB_Query::OPERATOR_LT);
    $logs = $assertor->assertQuery('vBForum:cronlog', $conditions);
    print_stop_message2('pruned_scheduled_task_log_successfully', 'cronlog', array('do' => 'choose'));
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'choose') {
    $cronjobs = $assertor->getRows('cron', array(), 'varname');
    $filelist = array();
    $filelist[0] = $vbphrase['all_scheduled_tasks'];
    foreach ($cronjobs as $file) {
        $filelist["{$file['varname']}"] = isset($vbphrase['task_' . $file['varname'] . '_title']) ? htmlspecialchars_uni($vbphrase['task_' . $file['varname'] . '_title']) : $file['varname'];
    }
    $perpage = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 40 => 40, 50 => 50, 100 => 100);
    $orderby = array('date' => $vbphrase['date'], 'action' => $vbphrase['action']);
    print_form_header('cronlog', 'view');
    print_table_header($vbphrase['scheduled_task_log_viewer']);
    print_select_row($vbphrase['log_entries_to_show_per_page'], 'perpage', $perpage, 15);
    print_select_row($vbphrase['show_only_entries_generated_by'], 'varname', $filelist);
Example #11
0
    }
    $vbulletin->GPC['navprefs'] = preg_replace('#[^a-z0-9_,]#i', '', $vbulletin->GPC['navprefs']);
    $_REQUEST['do'] = 'savenavprefs';
}
if ($_REQUEST['do'] == 'buildbitfields') {
    require_once DIR . '/includes/class_bitfield_builder.php';
    vB_Bitfield_Builder::save();
    build_channel_permissions();
    print_stop_message2('rebuilt_bitfields_successfully', 'index');
}
if ($_REQUEST['do'] == 'buildvideo' and (vB::getUserContext()->hasAdminPermission('canadminstyles') or vB::getUserContext()->hasAdminPermission('canadmintemplates'))) {
    require_once DIR . '/includes/functions_databuild.php';
    build_bbcode_video();
    print_cp_header();
    vB_Library::instance('style')->buildAllStyles();
    print_stop_message2('rebuilt_video_bbcodes_successfully', 'index');
}
if ($_REQUEST['do'] == 'buildnavprefs') {
    $vbulletin->input->clean_array_gpc('r', array('prefs' => vB_Cleaner::TYPE_STR, 'dowhat' => vB_Cleaner::TYPE_STR, 'id' => vB_Cleaner::TYPE_INT));
    $vbulletin->GPC['prefs'] = preg_replace('#[^a-z0-9_,]#i', '', $vbulletin->GPC['prefs']);
    $_tmp = preg_split('#,#', $vbulletin->GPC['prefs'], -1, PREG_SPLIT_NO_EMPTY);
    $_navprefs = array();
    foreach ($_tmp as $_val) {
        $_navprefs["{$_val}"] = $_val;
    }
    unset($_tmp);
    if ($vbulletin->GPC['dowhat'] == 'collapse') {
        // remove an item from the list
        unset($_navprefs[$vbulletin->GPC['id']]);
    } else {
        // add an item to the list
Example #12
0
        print_stop_message2('invalid_hook');
    }
    if (!$vbulletin->GPC['hookname'] or !$vbulletin->GPC['title'] or !$vbulletin->GPC['template']) {
        print_stop_message2('please_complete_required_fields');
    }
    $hookdata = array('hookid' => $vbulletin->GPC['hookid'], 'hookname' => $vbulletin->GPC['hookname'], 'title' => $vbulletin->GPC['title'], 'arguments' => $hook_api->encodeArguments($vbulletin->GPC['arguments']), 'product' => $vbulletin->GPC['product'], 'active' => $vbulletin->GPC['active'], 'template' => $vbulletin->GPC['template'], 'hookorder' => $vbulletin->GPC['hookorder']);
    $hookid = $hook_api->saveHook($vbulletin->GPC['hookid'], $hookdata);
    // stuff to handle the redirect
    $args = array();
    if ($vbulletin->GPC['return']) {
        $args = array('do' => 'edit', 'hookid' => $hookid);
    }
    if ($vbulletin->GPC['hookid']) {
        print_stop_message2('updated_hook_successfully', 'hook', $args);
    } else {
        print_stop_message2('added_hook_successfully', 'hook', $args);
    }
}
// #############################################################################
if ($_REQUEST['do'] == 'edit' or $_REQUEST['do'] == 'add') {
    $products = fetch_product_list();
    $hooklocations = $hook_api->getXmlHooks();
    $hook = $hook_api->getHookInfo($vbulletin->GPC['hookid']);
    if (!$hook) {
        $hook = array('active' => 1, 'arguments' => '', 'hookorder' => 10);
    }
    $hook['arguments'] = $hook_api->decodeArguments($hook['arguments']);
    print_form_header('hook', 'update');
    construct_hidden_code('hookid', $hook['hookid']);
    if ($_REQUEST['do'] == 'add') {
        $heading = $vbphrase['add_new_hook'];
Example #13
0
require_once dirname(__FILE__) . '/global.php';
// ############################# LOG ACTION ###############################
if (empty($_REQUEST['do'])) {
    log_admin_action();
}
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$vbulletin->input->clean_array_gpc('r', array('redirect' => vB_Cleaner::TYPE_NOHTML));
# Not sure where this comes from
if (!empty($vbulletin->GPC['redirect'])) {
    $redirect = vB_String::parseUrl($vbulletin->GPC['redirect']);
    $pathinfo = pathinfo($redirect['path']);
    $file = $pathinfo['filename'];
    parse_str($redirect['query'], $args);
    print_stop_message2('redirecting_please_wait', $file, $args);
}
// #############################################################################
// ############################### LOG OUT OF CP ###############################
// #############################################################################
if ($_REQUEST['do'] == 'cplogout') {
    vbsetcookie('cpsession', '', false, true, true);
    $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "cpsession WHERE userid = " . $vbulletin->userinfo['userid'] . " AND hash = '" . $vbulletin->db->escape_string($vbulletin->GPC[COOKIE_PREFIX . 'cpsession']) . "'");
    $sessionurl_js = vB::getCurrentSession()->get('sessionurl_js');
    if (!empty($sessionurl_js)) {
        exec_header_redirect('index.php?' . $sessionurl_js);
    } else {
        exec_header_redirect('index.php');
    }
}
if (empty($_REQUEST['do'])) {
/**
* Imports a language from a language XML file
*
* @param	string	XML language string
* @param	integer	Language to overwrite
* @param	string	Override title for imported language
* @param	boolean	Allow import of language from mismatched vBulletin version
* @param	boolean	Allow user-select of imported language
* @param	boolean	Echo output..
* @param	boolean	Read charset from XML header
*
* @return	Returns false if the custom language was not imported (used in final_upgrade) OR
*			returns the languageid if, if the custom language import was successful (also used in final_upgrade)
*/
function xml_import_language($xml = false, $languageid = -1, $title = '', $anyversion = false, $userselect = true, $output = true, $readcharset = false)
{
    global $vbulletin, $vbphrase;
    print_dots_start('<b>' . $vbphrase['importing_language'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    require_once DIR . '/includes/class_xml.php';
    require_once DIR . '/includes/functions_misc.php';
    $xmlobj = new vB_XML_Parser($xml, $GLOBALS['path'], $readcharset);
    if ($xmlobj->error_no() == 1) {
        print_dots_stop();
        print_stop_message2('no_xml_and_no_path');
    } else {
        if ($xmlobj->error_no() == 2) {
            print_dots_stop();
            print_stop_message('please_ensure_x_file_is_located_at_y', 'vbulletin-language.xml', $GLOBALS['path']);
        }
    }
    if (!($arr =& $xmlobj->parse())) {
        print_dots_stop();
        print_stop_message('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line());
    }
    if (!$arr['phrasetype']) {
        print_dots_stop();
        print_stop_message2('invalid_file_specified');
    }
    $title = empty($title) ? $arr['name'] : $title;
    $version = $arr['vbversion'];
    $master = $arr['type'] == 'master' ? 1 : 0;
    $just_phrases = $arr['type'] == 'phrases' ? 1 : 0;
    if (!empty($arr['settings'])) {
        $langinfo = $arr['settings'];
    }
    $officialcustom = false;
    //Check custom language revision. See also VBV-9215.
    if (!$master and $arr['product'] == 'vbulletin' and !empty($arr['revision']) and !empty($arr['vblangcode'])) {
        $test = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "language WHERE vblangcode = '" . $vbulletin->db->escape_string($arr['vblangcode']) . "'");
        if ($test['languageid']) {
            if (intval($test['revision']) >= intval($arr['revision'])) {
                // Same or newer language revision has been installed
                // We shouldn't print_stop_message() as the upgrader may continue processing other custom languages
                return false;
            }
            $languageid = $test['languageid'];
        }
        $langinfo['revision'] = intval($arr['revision']);
        $langinfo['vblangcode'] = trim($arr['vblangcode']);
        $officialcustom = true;
    } else {
        $langinfo['revision'] = 0;
        $langinfo['vblangcode'] = '';
    }
    $langinfo['product'] = empty($arr['product']) ? 'vbulletin' : $arr['product'];
    // look for skipped groups
    $skipped_groups = array();
    if (!empty($arr['skippedgroups'])) {
        $skippedgroups =& $arr['skippedgroups']['skippedgroup'];
        if (!is_array($skippedgroups)) {
            $skippedgroups = array($skippedgroups);
        }
        foreach ($skippedgroups as $skipped) {
            if (is_array($skipped)) {
                $skipped_groups[] = $vbulletin->db->escape_string($skipped['value']);
            } else {
                $skipped_groups[] = $vbulletin->db->escape_string($skipped);
            }
        }
    }
    if ($skipped_groups) {
        $sql_skipped = "AND " . TABLE_PREFIX . "phrase.fieldname NOT IN ('" . implode("', '", $skipped_groups) . "')";
    } else {
        $sql_skipped = '';
    }
    foreach ($langinfo as $key => $val) {
        $langinfo["{$key}"] = $vbulletin->db->escape_string(trim($val));
    }
    $langinfo['options'] = intval($langinfo['options']);
    $langinfo['revision'] = intval($langinfo['revision']);
    if ($version != $vbulletin->options['templateversion'] and !$master) {
        if (strtok($version, '.') != strtok($vbulletin->options['templateversion'], '.')) {
            print_dots_stop();
            print_stop_message('upload_file_created_with_different_major_version', $vbulletin->options['templateversion'], $version);
        }
        if (!$anyversion) {
            print_dots_stop();
            print_stop_message('upload_file_created_with_different_version', $vbulletin->options['templateversion'], $version);
        }
    }
    //set up the phrase array
    $arr = $arr['phrasetype'];
    if (!is_array($arr[0])) {
        $arr = array($arr);
    }
    // check if we need to convert the phrases to the current board's charset.
    $convertPhrases = false;
    $boardCharset = strtolower(vB_Template_Runtime::fetchStyleVar('charset'));
    $phrasesCharset = isset($langinfo['charset']) ? strtolower($langinfo['charset']) : $boardCharset;
    if (!empty($boardCharset) and $boardCharset != $phrasesCharset) {
        $convertPhrases = true;
        $langinfo['charset'] = $boardCharset;
        // since we're converting the phrases to the board charset, make sure the inserted language uses the board's charset & informs the browser correctly.
    }
    //spin through the phrases to check validity.  We want to do this *before* we prep for import
    //so that if we abort do to an error, we haven't made any changes first
    foreach (array_keys($arr) as $key) {
        $phraseTypes =& $arr["{$key}"];
        if (is_array($phraseTypes['phrase'])) {
            foreach ($phraseTypes['phrase'] as $key2 => $phrase) {
                if (is_array($phrase)) {
                    $check = $phrase['value'];
                } else {
                    $check = $phrase;
                }
                if ($convertPhrases) {
                    // convert it from the language file's encoding to the board's encoding
                    $check = vB_String::toCharset($check, $phrasesCharset, $boardCharset);
                    if (is_array($phrase)) {
                        $arr[$key]['phrase'][$key2]['value'] = $check;
                    } else {
                        $arr[$key]['phrase'][$key2] = $check;
                    }
                }
                if (!validate_string_for_interpolation($check)) {
                    print_dots_stop();
                    print_stop_message2(array('phrase_text_not_safe', $phrase['name']));
                }
            }
        }
    }
    // prepare for import
    if ($master) {
        // lets stop it from dieing cause someone borked a previous update
        $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "phrase WHERE languageid = -10");
        // master style
        if ($output and VB_AREA != 'Install' and VB_AREA != 'Upgrade') {
            echo "<h3>{$vbphrase['master_language']}</h3>\n<p>{$vbphrase['please_wait']}</p>";
            vbflush();
        }
        $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "phrase SET\n\t\t\t\tlanguageid = -10\n\t\t\tWHERE languageid = -1\n\t\t\t\tAND (product = '" . $vbulletin->db->escape_string($langinfo['product']) . "'" . iif($langinfo['product'] == 'vbulletin', " OR product = ''") . ")\n\t\t\t\t{$sql_skipped}\n\t\t");
        $languageid = -1;
    } else {
        if ($languageid == 0) {
            // creating a new language
            if ($just_phrases) {
                print_dots_stop();
                print_stop_message2(array('language_only_phrases', $title));
            } else {
                if ($test = $vbulletin->db->query_first("SELECT languageid FROM " . TABLE_PREFIX . "language WHERE title = '" . $vbulletin->db->escape_string($title) . "'")) {
                    if ($officialcustom) {
                        // Rename the old language
                        $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "language SET title = CONCAT(title, '_old') WHERE title = '" . $vbulletin->db->escape_string($title) . "' AND languagecode");
                    } else {
                        print_dots_stop();
                        print_stop_message2(array('language_already_exists', $title));
                    }
                }
            }
            if ($output and VB_AREA != 'Install' and VB_AREA != 'Upgrade') {
                echo "<h3><b>" . construct_phrase($vbphrase['creating_a_new_language_called_x'], $title) . "</b></h3>\n<p>{$vbphrase['please_wait']}</p>";
                vbflush();
            }
            /*insert query*/
            $vbulletin->db->query_write("\n\t\t\t\tINSERT INTO " . TABLE_PREFIX . "language (\n\t\t\t\t\ttitle, options, languagecode, charset, revision, vblangcode,\n\t\t\t\t\tdateoverride, timeoverride, decimalsep, thousandsep,\n\t\t\t\t\tregistereddateoverride, calformat1override, calformat2override, locale, logdateoverride\n\t\t\t\t) VALUES (\n\t\t\t\t\t'" . $vbulletin->db->escape_string($title) . "', {$langinfo['options']}, '{$langinfo['languagecode']}', '{$langinfo['charset']}', {$langinfo['revision']}, '" . $vbulletin->db->escape_string($langinfo['vblangcode']) . "',\n\t\t\t\t\t'{$langinfo['dateoverride']}', '{$langinfo['timeoverride']}', '{$langinfo['decimalsep']}', '{$langinfo['thousandsep']}',\n\t\t\t\t\t'{$langinfo['registereddateoverride']}', '{$langinfo['calformat1override']}', '{$langinfo['calformat2override']}', '{$langinfo['locale']}', '{$langinfo['logdateoverride']}'\n\t\t\t\t)\n\t\t\t");
            $languageid = $vbulletin->db->insert_id();
        } else {
            // overwriting an existing language
            if ($getlanguage = $vbulletin->db->query_first("SELECT title FROM " . TABLE_PREFIX . "language WHERE languageid = {$languageid}")) {
                if (!$just_phrases) {
                    if ($output and VB_AREA != 'Install' and VB_AREA != 'Upgrade') {
                        echo "<h3><b>" . construct_phrase($vbphrase['overwriting_language_x'], $getlanguage['title']) . "</b></h3>\n<p>{$vbphrase['please_wait']}</p>";
                        vbflush();
                    }
                    $vbulletin->db->query_write("\n\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "language SET\n\t\t\t\t\t\t\toptions = {$langinfo['options']},\n\t\t\t\t\t\t\tlanguagecode = '{$langinfo['languagecode']}',\n\t\t\t\t\t\t\tcharset = '{$langinfo['charset']}',\n\t\t\t\t\t\t\tlocale = '{$langinfo['locale']}',\n\t\t\t\t\t\t\timagesoverride = '{$langinfo['imagesoverride']}',\n\t\t\t\t\t\t\tdateoverride = '{$langinfo['dateoverride']}',\n\t\t\t\t\t\t\ttimeoverride = '{$langinfo['timeoverride']}',\n\t\t\t\t\t\t\tdecimalsep = '{$langinfo['decimalsep']}',\n\t\t\t\t\t\t\tthousandsep = '{$langinfo['thousandsep']}',\n\t\t\t\t\t\t\tregistereddateoverride = '{$langinfo['registereddateoverride']}',\n\t\t\t\t\t\t\tcalformat1override = '{$langinfo['calformat1override']}',\n\t\t\t\t\t\t\tcalformat2override = '{$langinfo['calformat2override']}',\n\t\t\t\t\t\t\tlogdateoverride = '{$langinfo['logdateoverride']}',\n\t\t\t\t\t\t\trevision = {$langinfo['revision']}\n\t\t\t\t\t\tWHERE languageid = {$languageid}\n\t\t\t\t\t");
                    $vbulletin->db->query_write("\n\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "phrase, " . TABLE_PREFIX . "phrase AS phrase2\n\t\t\t\t\t\tSET " . TABLE_PREFIX . "phrase.languageid = -11\n\t\t\t\t\t\tWHERE " . TABLE_PREFIX . "phrase.languageid = {$languageid}\n\t\t\t\t\t\t\tAND (" . TABLE_PREFIX . "phrase.product = '" . $vbulletin->db->escape_string($langinfo['product']) . "'" . iif($langinfo['product'] == 'vbulletin', " OR " . TABLE_PREFIX . "phrase.product = ''") . ")\n\t\t\t\t\t\t\tAND (phrase2.product = '" . $vbulletin->db->escape_string($langinfo['product']) . "'" . iif($langinfo['product'] == 'vbulletin', " OR phrase2.product = ''") . ")\n\t\t\t\t\t\t\tAND " . TABLE_PREFIX . "phrase.varname = phrase2.varname\n\t\t\t\t\t\t\tAND phrase2.languageid = 0\n\t\t\t\t\t\t\tAND " . TABLE_PREFIX . "phrase.fieldname = phrase2.fieldname\n\t\t\t\t\t\t\t{$sql_skipped}\n\t\t\t\t\t");
                    $vbulletin->db->query_write("\n\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "phrase SET\n\t\t\t\t\t\t\tlanguageid = -10\n\t\t\t\t\t\tWHERE languageid = {$languageid}\n\t\t\t\t\t\t\tAND (product = '" . $vbulletin->db->escape_string($langinfo['product']) . "'" . iif($langinfo['product'] == 'vbulletin', " OR product = ''") . ")\n\t\t\t\t\t\t\t{$sql_skipped}\n\t\t\t\t\t");
                }
            } else {
                print_stop_message2('cant_overwrite_non_existent_language');
            }
        }
    }
    // get current phrase types
    $current_phrasetypes = fetch_phrasetypes_array(false);
    if (!$master) {
        $globalPhrases = array();
        $getphrases = $vbulletin->db->query_read("\n\t\t\tSELECT varname, fieldname\n\t\t\tFROM " . TABLE_PREFIX . "phrase\n\t\t\tWHERE languageid IN (0, -1)\n\t\t");
        while ($getphrase = $vbulletin->db->fetch_array($getphrases)) {
            $globalPhrases["{$getphrase['varname']}~{$getphrase['fieldname']}"] = true;
        }
    }
    // import language
    // track new phrasetypes
    $new_phrasetypes = array();
    foreach (array_keys($arr) as $key) {
        $phraseTypes =& $arr["{$key}"];
        $sql = array();
        $strlen = 0;
        if ($phraseTypes['fieldname'] == '' or !preg_match('#^[a-z0-9_]+$#i', $phraseTypes['fieldname'])) {
            continue;
        }
        $fieldname = $phraseTypes['fieldname'];
        if (!is_array($phraseTypes['phrase'][0])) {
            $phraseTypes['phrase'] = array($phraseTypes['phrase']);
        }
        // check if the phrasetype is new
        if (!isset($current_phrasetypes[$fieldname]) and !empty($phraseTypes['phrase'])) {
            $new_phrasetypes[] = array('fieldname' => $fieldname, 'title' => $phraseTypes['name']);
        }
        // Send some output to the browser inside this loop so certain hosts
        // don't artificially kill the script. See bug #34585
        if ($output) {
            echo ' ';
            vbflush();
        }
        foreach ($phraseTypes['phrase'] as $phrase) {
            if ($master) {
                $insertLanguageId = -1;
            } else {
                if (!isset($globalPhrases["{$phrase['name']}~{$fieldname}"])) {
                    $insertLanguageId = 0;
                } else {
                    if ($phrase['custom']) {
                        // this is a custom phrase (language 0) -- we don't want it to end up in the custom language
                        continue;
                    } else {
                        $insertLanguageId = $languageid;
                    }
                }
            }
            $sql[] = "\n\t\t\t\t({$insertLanguageId},\n\t\t\t\t'" . $vbulletin->db->escape_string($fieldname) . "',\n\t\t\t\t'" . $vbulletin->db->escape_string($phrase['name']) . "',\n\t\t\t\t'" . $vbulletin->db->escape_string($phrase['value']) . "',\n\t\t\t\t'" . $vbulletin->db->escape_string($langinfo['product']) . "',\n\t\t\t\t'" . $vbulletin->db->escape_string($phrase['username']) . "',\n\t\t\t\t" . intval($phrase['date']) . ",\n\t\t\t\t'" . $vbulletin->db->escape_string($phrase['version']) . "')\n\t\t\t";
            $strlen += strlen(end($sql));
            if ($strlen > 102400) {
                // insert max of 100k of phrases at a time
                /*insert query*/
                $vbulletin->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "phrase\n\t\t\t\t\t\t(languageid, fieldname, varname, text, product, username, dateline, version)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(",\n", $sql));
                $sql = array();
                $strlen = 0;
            }
            // Send some output to the browser inside this loop so certain hosts
            // don't artificially kill the script. See bug #34585
            if ($output) {
                echo ' ';
                vbflush();
            }
        }
        if ($sql) {
            /*insert query*/
            $vbulletin->db->query_write("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "phrase\n\t\t\t\t\t(languageid, fieldname, varname, text, product, username, dateline, version)\n\t\t\t\tVALUES\n\t\t\t\t\t" . implode(",\n", $sql));
        }
        unset($arr["{$key}"], $phraseTypes);
    }
    unset($sql, $arr, $current_phrasetypes);
    // insert any new phrasetypes
    foreach ($new_phrasetypes as $phrasetype) {
        add_phrase_type($phrasetype['fieldname'], $phrasetype['title'], $langinfo['product']);
    }
    $vbulletin->db->query_write("\n\t\tUPDATE IGNORE " . TABLE_PREFIX . "phrase\n\t\tSET " . TABLE_PREFIX . "phrase.languageid = {$languageid}\n\t\tWHERE " . TABLE_PREFIX . "phrase.languageid = -11\n\t\t\tAND (" . TABLE_PREFIX . "phrase.product = '" . $vbulletin->db->escape_string($langinfo['product']) . "'" . iif($langinfo['product'] == 'vbulletin', " OR " . TABLE_PREFIX . "phrase.product = ''") . ")\n\t\t\t{$sql_skipped}\n\t");
    // now delete any phrases that were moved into the temporary language for safe-keeping
    $vbulletin->db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "phrase\n\t\tWHERE languageid IN (-10, -11)\n\t\t\tAND (product = '" . $vbulletin->db->escape_string($langinfo['product']) . "'" . iif($langinfo['product'] == 'vbulletin', " OR product = ''") . ")\n\t\t\t{$sql_skipped}\n\t");
    vB_Api::instanceInternal('phrase')->setPhraseDate();
    print_dots_stop();
    return $languageid;
}
Example #15
0
    print_description_row('<label for="rb_itemtype_announcement"><input type="radio" name="itemtype" value="announcement" id="rb_itemtype_announcement"' . $checked['itemtype']['announcement'] . "  />{$vbphrase['post_items_as_announcements']}</label>", false, 2, 'thead', 'left', 'itemtype');
    print_yes_no_row($vbphrase['allow_html_in_announcements'], 'options[allowhtml]', $feed['options']['allowhtml']);
    print_input_row($vbphrase['days_for_announcement_to_remain_active'], 'endannouncement', $feed['endannouncement']);
    construct_hidden_code('rssfeedid', $feed['rssfeedid']);
    print_submit_row('', $vbphrase['reset'], 2, '', "<input type=\"submit\" class=\"button\" name=\"preview\" tabindex=\"1\" accesskey=\"p\" value=\"{$vbphrase['preview_feed']}\" />");
}
if ($_REQUEST['do'] == 'modify') {
    $feeds = array();
    $feeds_result = $assertor->getRows('vBForum:getRssFeedsDetailed');
    if (count($feeds_result)) {
        foreach ($feeds_result as $feed) {
            $feeds["{$feed['rssfeedid']}"] = $feed;
        }
    }
    if (empty($feeds)) {
        print_stop_message2(array('no_feeds_defined', vB::getCurrentSession()->get('sessionurl')));
    } else {
        ?>
	<script type="text/javascript">
		$(document).ready(function() {
			function verifyAllChecked() {
				// Search if any check boxes are already checked.
				if ($('.rssenabled:checked').length == $('.rssenabled').length)
				{
					$('[name="allbox"]').prop('checked', true);
				}
				else
				{
					$('[name="allbox"]').prop('checked', false);
				}
			}
Example #16
0
                if (!$vbulletin->usergroupcache["2"]['usertitle']) {
                    $gettitle = $assertor->getRow('usertitle', array(vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'minposts', 'value' => $getuserid[posts], vB_dB_Query::OPERATOR_KEY => vB_dB_Query::OPERATOR_LTE))), array('field' => array('minposts'), 'direction' => array(vB_dB_Query::SORT_DESC)));
                    $usertitle = $gettitle['title'];
                } else {
                    $usertitle = $vbulletin->usergroupcache["2"]['usertitle'];
                }
            } else {
                $usertitle = $getuserid['usertitle'];
            }
            $userdm = new vB_Datamanager_User($vbulletin, vB_DataManager_Constants::ERRTYPE_SILENT);
            $userdm->set_existing($getuserid);
            $userdm->set('usergroupid', 2);
            $getuserid['usergroupid'] = 2;
            if ($getuserid['displaygroupid'] == 7) {
                $userdm->set('displaygroupid', 2);
                $getuserid['displaygroupid'] = 2;
            }
            $userdm->set('usertitle', $usertitle);
            $userdm->save();
            unset($userdm);
        }
        print_stop_message2('deleted_moderators_successfully', 'moderator', array('do' => 'showlist'));
    }
}
print_cp_footer();
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 83432 $
|| #######################################################################
\*=========================================================================*/
Example #17
0
    construct_hidden_code('questionid', $question['questionid']);
    print_table_header(construct_phrase($vbphrase['confirm_deletion_x'], htmlspecialchars_uni($question['text'])));
    print_description_row($vbphrase['are_you_sure_you_want_to_delete_this_question']);
    print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
}
// ###################### Kill Answer #######################
if ($_POST['do'] == 'killquestion') {
    $question = vB::getDbAssertor()->getRow('vBForum:fetchQuestionByPhrase', array('questionid' => $vbulletin->GPC['questionid']));
    if (!$question) {
        print_stop_message2(array('invalid_x_specified', $vbphrase['question']));
    }
    $deleteAnswer = vB::getDbAssertor()->assertQuery('vBForum:hvanswer', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'questionid' => $question['questionid']));
    $deleteQuestion = vB::getDbAssertor()->assertQuery('vBForum:hvquestion', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'questionid' => $question['questionid']));
    $deletePhrase = vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'fieldname' => 'hvquestion', 'varname' => 'question' . $question['questionid']));
    require_once DIR . '/includes/adminfunctions_language.php';
    build_language();
    print_stop_message2('deleted_question_successfully', 'verify');
}
// ###################### Intro Screen #######################
if ($_POST['do'] == 'updateoptions') {
    $vbulletin->input->clean_array_gpc('p', array('setting' => vB_Cleaner::TYPE_ARRAY));
    save_settings($vbulletin->GPC['setting']);
    print_stop_message2('saved_settings_successfully', 'verify');
}
print_cp_footer();
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 83432 $
|| #######################################################################
\*=========================================================================*/
Example #18
0
    $conditions[] = array('field' => 'dateline', 'value' => $vbulletin->GPC['datecut'], 'operator' => vB_dB_Query::OPERATOR_LT);
    if (!empty($vbulletin->GPC['modaction'])) {
        $conditions[] = array('field' => 'action', 'value' => $vbulletin->GPC['modaction'], 'operator' => vB_dB_Query::OPERATOR_INCLUDES);
    }
    if (!empty($vbulletin->GPC['userid'])) {
        $conditions[] = array('field' => 'userid', 'value' => $vbulletin->GPC['userid'], 'operator' => vB_dB_Query::OPERATOR_EQ);
    }
    if ($vbulletin->GPC['product']) {
        if ($vbulletin->GPC['product'] == 'vbulletin') {
            $conditions[] = array('field' => 'product', 'value' => array('', 'vbulletin'), 'operator' => vB_dB_Query::OPERATOR_EQ);
        } else {
            $conditions[] = array('field' => 'product', 'value' => $vbulletin->GPC['product'], 'operator' => vB_dB_Query::OPERATOR_EQ);
        }
    }
    vB::getDbAssertor()->delete('moderatorlog', $conditions);
    print_stop_message2('pruned_moderator_log_successfully', 'modlog', array('do' => 'choose'));
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'choose') {
    $users = vB::getDbAssertor()->assertQuery('chooseModLog');
    $userlist = array('no_value' => $vbphrase['all_log_entries']);
    foreach ($users as $user) {
        $userlist["{$user['userid']}"] = $user['username'];
    }
    print_form_header('modlog', 'view');
    print_table_header($vbphrase['moderator_log_viewer']);
    print_input_row($vbphrase['log_entries_to_show_per_page'], 'perpage', 15);
    print_select_row($vbphrase['show_only_entries_generated_by'], 'userid', $userlist);
    print_time_row($vbphrase['start_date'], 'startdate', 0, 0);
    print_time_row($vbphrase['end_date'], 'enddate', 0, 0);
    if (count($products = fetch_product_list()) > 1) {
Example #19
0
        print_form_header('forum', 'doorder');
        print_table_header($vbphrase['channel_manager_gforum'], 2);
        print_cells_row(array($vbphrase['channel'], $vbphrase['controls']), 1, 'tcat');
        $cell = array();
        $select = '<select name="nodeid" id="sel_foruid" tabindex="1" class="bginput">';
        $select .= construct_channel_chooser($vbulletin->GPC['nodeid'], true);
        $select .= "</select>\n";
        $cell[] = $select;
        $cell[] = "\n\t<select name=\"controls\" class=\"bginput\">\n" . construct_select_options($channeloptions) . "\t</select><input type=\"button\" class=\"button\" value=\"" . $vbphrase['go'] . "\" onclick=\"js_channel_jump(js_returnid());\" />\n\t";
        print_cells_row($cell);
        print_table_footer(2, construct_button_code($vbphrase['add_new_forum_gforum'], "forum.php?" . vB::getCurrentSession()->get('sessionurl') . "do=add"));
    }
}
// ###################### Start update #######################
if ($_REQUEST['do'] == 'view') {
    $vbulletin->input->clean_array_gpc('r', array('nodeid' => vB_Cleaner::TYPE_UINT));
    $channel = vB_Api::instanceInternal('node')->getNode($vbulletin->GPC['nodeid']);
    if (empty($channel)) {
        print_stop_message2('invalid_channel_specified');
    }
    $path = vB_Api::instanceInternal('route')->getUrl($channel['routeid'], array(), array());
    $baseurl = vB::getDatastore()->getOption('frontendurl');
    print_cp_redirect($baseurl . $path);
}
print_cp_footer();
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 85086 $
|| #######################################################################
\*=========================================================================*/
Example #20
0
        $data['publishdate'] = 0;
    }
    if ($data['showpublished'] == $previousData['showpublished']) {
        unset($data['publishdate']);
        // no change required
    }
    unset($data['showpublished']);
    // check if displayorder update is necessary
    if ($data['displayorder'] === $previousData['displayorder']) {
        unset($data['displayorder']);
        // 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);
Example #21
0
            $styleAPI->updateStyle($style[styleid], $style['title'], $style['parentid'], $uperm, $order, false, $style['guid']);
        }
    }
    $args = array();
    parse_str(vB::getCurrentSession()->get('sessionurl'), $args);
    $args['do'] = 'modify';
    print_cp_redirect2('template', $args);
}
// #############################################################################
// Main style generator display
if ($_REQUEST['do'] == 'stylegenerator') {
    global $vbphrase, $vbulletin;
    $vbulletin->input->clean_array_gpc('p', array('data' => vB_Cleaner::TYPE_STR, 'parentid' => vB_Cleaner::TYPE_INT, 'name' => vB_Cleaner::TYPE_STR, 'displayorder' => vB_Cleaner::TYPE_INT, 'userselect' => vB_Cleaner::TYPE_STR));
    $vbulletin->input->clean_array_gpc('r', array('save' => vB_Cleaner::TYPE_STR));
    if (is_browser('ie') and !is_browser('ie', 7)) {
        print_stop_message2('style_generator_browser_not_supported');
    }
    // Variables that decides who, what, when, where and how of saving the style.
    $styledata = $vbulletin->GPC['data'];
    $styleparentid = $vbulletin->GPC['parentid'];
    $styletitle = $vbulletin->GPC['name'];
    $styleanyversion = true;
    $styledisplayorder = $vbulletin->GPC['displayorder'];
    $styleuserselectable = $vbulletin->GPC['userselect'];
    // url response tell us where to save the xml
    $stylesave = $vbulletin->GPC['save'];
    if ($stylesave) {
        $version = ADMIN_VERSION_VBULLETIN;
        $stylexml = generate_style($styledata, $styleparentid, $styletitle, $styleanyversion, $styledisplayorder, $styleuserselectable, $version);
    }
    //  Modified version of the "Color Scheme Designer 3"
Example #22
0
        print_form_header('adminlog', 'doprunelog');
        construct_hidden_code('datecut', $datecut);
        construct_hidden_code('script', $vbulletin->GPC['script']);
        construct_hidden_code('userid', $vbulletin->GPC['userid']);
        print_table_header($vbphrase['prune_control_panel_log']);
        print_description_row(construct_phrase($vbphrase['are_you_sure_you_want_to_prune_x_log_entries_from_control_panel_log'], vb_number_format($logs['total'])));
        print_submit_row($vbphrase['yes'], 0, 0, $vbphrase['no']);
    } else {
        print_stop_message2('no_log_entries_matched_your_query');
    }
}
// ###################### Start do prune log #######################
if ($_POST['do'] == 'doprunelog' and can_access_logs($vb5_config['SpecialUsers']['canpruneadminlog'], 0, '<p>' . $vbphrase['control_panel_log_pruning_permission_restricted'] . '</p>')) {
    $vbulletin->input->clean_array_gpc('p', array('userid' => vB_Cleaner::TYPE_INT, 'script' => vB_Cleaner::TYPE_STR, 'datecut' => vB_Cleaner::TYPE_INT));
    $assertor->assertQuery('vBForum:deleteAdminLogByDateCut', array('datecut' => $vbulletin->GPC['datecut'], 'userid' => $vbulletin->GPC['userid'], 'script' => $vbulletin->GPC['script']));
    print_stop_message2('pruned_control_panel_log_successfully', 'adminlog', array('do' => 'choose'));
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'choose') {
    if (can_access_logs($vb5_config['SpecialUsers']['canviewadminlog'], 1)) {
        $show_admin_log = true;
    } else {
        echo '<p>' . $vbphrase['control_panel_log_viewing_restricted'] . '</p>';
    }
    if ($show_admin_log) {
        log_admin_action();
        $files = $assertor->assertQuery('vBForum:fetchDistinctScript', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED));
        $filelist = array('no_value' => $vbphrase['all_scripts_glogging']);
        if ($files and $files->valid()) {
            foreach ($files as $file) {
                $file['script'] = htmlspecialchars_uni($file['script']);
Example #23
0
     $groupsmenu["{$id}"] = htmlspecialchars_uni($usergroup['title']) . " ({$vbphrase['join_requests']}: " . vb_number_format($usergroup['joinrequests']) . ")";
 }
 print_form_header('usergroup', 'viewjoinrequests', 0, 1, 'chooser');
 print_label_row($vbphrase['usergroup'], '<select name="usergroupid" onchange="this.form.submit();" class="bginput">' . construct_select_options($groupsmenu, $vbulletin->GPC['usergroupid']) . '</select><input type="submit" class="button" value="' . $vbphrase['go'] . '" />', 'thead');
 print_table_footer();
 unset($groupsmenu);
 // now if we are being asked to display a particular usergroup, do so.
 if ($vbulletin->GPC['usergroupid']) {
     try {
         $requests = vB_Api::instanceInternal('usergroup')->fetchJoinRequests($vbulletin->GPC['usergroupid']);
     } catch (vB_Exception_Api $e) {
         $errors = $e->get_errors();
         print_stop_message2($errors[0]);
     }
     if (empty($requests)) {
         print_stop_message2('no_join_requests_matched_your_query');
     }
     // everything seems okay, so make a total record for this usergroup
     $usergroup =& $usergroups["{$vbulletin->GPC['usergroupid']}"];
     // query the usergroup leaders of this usergroup
     $leaders = array();
     $getleaders = $assertor->assertQuery('vBForum:getUserGroupLeaders', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'usergroupid' => $vbulletin->GPC['usergroupid']));
     if ($getleaders and $getleaders->valid()) {
         foreach ($getleaders as $getleader) {
             $leaders[] = "<a href=\"user.php?" . vB::getCurrentSession()->get('sessionurl') . "do=edit&amp;u={$getleader['userid']}\">{$getleader['username']}</a>";
         }
     }
     unset($getleader);
     print_form_header('usergroup', 'processjoinrequests');
     construct_hidden_code('usergroupid', $vbulletin->GPC['usergroupid']);
     print_table_header("{$usergroup['title']} - ({$vbphrase['join_requests']}: {$usergroup['joinrequests']})", 6);
Example #24
0
        $_languageid = vB_Api::instanceInternal('language')->save($vbulletin->GPC, $vbulletin->GPC['dolanguageid']);
    } catch (vB_Exception_Api $e) {
        $errors = $e->get_errors();
        if (!empty($errors)) {
            $error = array_shift($errors);
            print_stop_message2($error);
        }
        print_stop_message2('error');
    }
    if ($vbulletin->GPC['isdefault'] and $vbulletin->GPC['dolanguageid'] != $vbulletin->options['languageid']) {
        $do = 'setdefault';
    } else {
        $do = 'modify';
    }
    build_language_datastore();
    print_stop_message2(array('saved_language_x_successfully', $vbulletin->GPC['title']), 'language', array('dolanguageid' => $vbulletin->GPC['dolanguageid'], 'do' => $do));
}
// ##########################################################################
if ($_REQUEST['do'] == 'edit_settings') {
    $language = vB_Api::instanceInternal('language')->fetchAll($vbulletin->GPC['dolanguageid']);
    $getoptions = convert_bits_to_array($language['options'], $vbulletin->bf_misc_languageoptions);
    $language = array_merge($language, $getoptions);
    print_form_header('language', 'update_settings');
    construct_hidden_code('dolanguageid', $vbulletin->GPC['dolanguageid']);
    print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbphrase['language'], $language['title'], $language['languageid']));
    print_description_row($vbphrase['general_settings'], 0, 2, 'thead');
    print_input_row($vbphrase['title'], 'title', $language['title'], 0);
    if ($vb5_config['Misc']['debug']) {
        print_input_row($vbphrase['vblangcode'], 'vblangcode', $language['vblangcode'], 0);
        print_input_row($vbphrase['revision'], 'revision', $language['revision'], 0);
    } elseif (!empty($language['vblangcode']) and !empty($language['revision'])) {
    }
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'modify') {
    print_form_header('', '');
    print_table_header($vbphrase['subscription_permissions_gsubscription']);
    print_description_row('
		<div class="darkbg" style="border: 2px inset">	<ul class="darkbg">
		<li><b>' . $vbphrase['color_key'] . '</b></li>
		<li class="col-g">' . $vbphrase['allowed_can_access_subscription'] . '</li>
		<li class="col-c">' . $vbphrase['denied_can_not_access_subscription'] . '</li>
		</ul></div>
	');
    print_table_footer();
    if (empty($subobj->subscriptioncache)) {
        print_stop_message2(array('nosubscriptions', $vbulletin->options['bbtitle']));
    }
    // query subscription permissions
    $subscriptionpermissions = $assertor->getRows('vBForum:subscriptionpermission');
    $permscache = array();
    foreach ($subscriptionpermissions as $sperm) {
        $permscache["{$sperm['subscriptionid']}"]["{$sperm['usergroupid']}"] = true;
    }
    echo '<center><div class="tborder" style="width: 100%">';
    echo '<div class="alt1" style="padding: 8px">';
    echo '<div class="darkbg" style="padding: 4px; border: 2px inset; text-align: ' . vB_Template_Runtime::fetchStyleVar('left') . '">';
    $indent = '   ';
    echo "{$indent}<ul class=\"lsq\">\n";
    foreach ($subobj->subscriptioncache as $subscriptionid => $subscription) {
        $title = $vbphrase['sub' . $subscriptionid . '_title'];
        // forum title and links
if ($_POST['do'] == 'updatebangroup') {
    $vbulletin->input->clean_array_gpc('p', array('method' => vB_Cleaner::TYPE_NOHTML, 'amount' => vB_Cleaner::TYPE_UINT, 'usergroupid' => vB_Cleaner::TYPE_INT, 'banusergroupid' => vB_Cleaner::TYPE_UINT, 'period' => vB_Cleaner::TYPE_NOHTML));
    if (empty($vbulletin->GPC['amount'])) {
        print_stop_message2('please_complete_required_fields');
    }
    if (empty($vbulletin->GPC['infractionbanid'])) {
        $vbulletin->GPC['infractionbanid'] = vB::getDbAssertor()->assertQuery('infractionban', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_INSERT, 'amount' => 0));
    }
    vB::getDbAssertor()->assertQuery('infractionban', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'amount' => $vbulletin->GPC['amount'], 'method' => $vbulletin->GPC['method'], 'usergroupid' => $vbulletin->GPC['usergroupid'], 'banusergroupid' => $vbulletin->GPC['banusergroupid'], 'period' => $vbulletin->GPC['period'], vB_dB_Query::CONDITIONS_KEY => array('infractionbanid' => $vbulletin->GPC['infractionbanid'])));
    print_stop_message2('saved_automatic_ban_successfully', 'admininfraction', array('do' => 'modify'));
}
// ###################### Start Remove #######################
if ($_REQUEST['do'] == 'removebangroup') {
    print_form_header('admininfraction', 'killbangroup');
    construct_hidden_code('infractionbanid', $vbulletin->GPC['infractionbanid']);
    print_table_header(construct_phrase($vbphrase['confirm_deletion_x'], $vbphrase['automatic_ban']));
    print_description_row($vbphrase['are_you_sure_you_want_to_delete_this_automatic_ban']);
    print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
}
// ###################### Start Kill #######################
if ($_POST['do'] == 'killbangroup') {
    vB::getDbAssertor()->assertQuery('infractionban', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'infractionbanid' => $vbulletin->GPC['infractionbanid']));
    print_stop_message2('deleted_automatic_ban_successfully', 'admininfraction', array('do' => 'modify'));
}
print_cp_footer();
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 84573 $
|| #######################################################################
\*=========================================================================*/
Example #27
0
    $vbulletin->input->clean_array_gpc('p', array('cronid' => vB_Cleaner::TYPE_INT));
    vB_Api::instanceInternal('cron')->delete($vbulletin->GPC['cronid']);
    print_stop_message2('deleted_scheduled_task_successfully', 'cronadmin', array('do' => 'modify'));
}
// ###################### Start switchactive #######################
if ($_REQUEST['do'] == 'switchactive') {
    $vbulletin->input->clean_array_gpc('r', array('cronid' => vB_Cleaner::TYPE_INT));
    verify_cp_sessionhash();
    try {
        vB_Api::instanceInternal('cron')->switchActive($vbulletin->GPC['cronid']);
    } catch (vB_Exception_Api $e) {
        $errors = $e->get_errors();
        $errors = array_pop($errors);
        print_stop_message2($errors[0]);
    }
    print_stop_message2('enabled_disabled_scheduled_task_successfully', 'cronadmin', array('do' => 'modify'));
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'modify') {
    $phrase_names = array('min_abbr', 'hour_abbr', 'day_abbr', 'month_abbr', 'dow_acronym', 'title', 'next_time', 'controls', 'edit', 'disable', 'enable', 'delete', 'run_now', 'add_new_scheduled_task_gcron', 'go', 'n_a', 'add_new_scheduled_task_gcron', 'save_enabled_status', 'all_times_are_gmt_x_time_now_is_y');
    $crons = vB_Api::instanceInternal('cron')->fetchAll();
    foreach ($crons as $cron) {
        $phrase_names[] = 'task_' . $cron['varname'] . '_title';
        $phrase_names[] = 'task_' . $cron['varname'] . '_desc';
    }
    function fetch_cron_timerule($cron)
    {
        global $vbphrase;
        $t = array('hour' => $cron['hour'], 'day' => $cron['day'], 'month' => -1, 'weekday' => $cron['weekday']);
        // set '-1' fields as
        foreach ($t as $field => $value) {
Example #28
0
    print_table_header(construct_phrase($vbphrase['confirm_deletion_of_attachment_type_x'], $vbulletin->GPC['extension']));
    print_description_row("\n\t\t<blockquote><br />" . construct_phrase($vbphrase['are_you_sure_you_want_to_delete_the_attachment_type_x'], $vbulletin->GPC['extension']) . "\n\t\t<br /></blockquote>\n\t");
    print_submit_row($vbphrase['yes'], 0, 2, $vbphrase['no']);
}
// ###################### Kill File Type ####################
if ($_POST['do'] == 'killtype') {
    $vbulletin->input->clean_array_gpc('r', array('extension' => vB_Cleaner::TYPE_STR));
    vB::getDbAssertor()->delete('vBForum:attachmenttype', array('extension' => $vbulletin->GPC['extension']));
    vB::getDbAssertor()->delete('vBForum:attachmentpermission', array('extension' => $vbulletin->GPC['extension']));
    build_attachment_permissions();
    print_stop_message2('deleted_attachment_type_successfully', 'attachment', array('do' => 'types'));
}
// ###################### Requild Attachment ####################
if ($_REQUEST['do'] == 'rebuild') {
    $vbulletin->input->clean_array_gpc('r', array('type' => vB_Cleaner::TYPE_STR));
    if ($vbulletin->GPC['type'] == 'all') {
        vB::getDbAssertor()->update('vBForum:filedataresize', array('reload' => 1), vB_dB_Query::CONDITION_ALL);
    } elseif (in_array(strtolower($vbulletin->GPC['type']), array('icon', 'thumb', 'small', 'medium', 'large'))) {
        vB::getDbAssertor()->update('vBForum:filedataresize', array('reload' => 1), array('resize_type' => strtolower($vbulletin->GPC['type'])));
    } else {
        print_stop_message2(array('invalid_attachment_type_x', $vbulletin->GPC['type']));
    }
    print_stop_message2('attachment_rebuild_successful', 'options', array('do' => 'options', 'dogroup' => 'attachment'));
}
print_cp_footer();
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 83432 $
|| #######################################################################
\*=========================================================================*/
Example #29
0
    }
    $assertor->update('usertitle', array('title' => $vbulletin->GPC['title'], 'minposts' => $vbulletin->GPC['minposts']), array('usertitleid' => $vbulletin->GPC['usertitleid']));
    print_stop_message2(array('saved_user_title_x_successfully', $vbulletin->GPC['title']), 'usertitle', array('do' => 'modify'));
}
// ###################### Start Remove #######################
if ($_REQUEST['do'] == 'remove') {
    print_form_header('usertitle', 'kill');
    construct_hidden_code('usertitleid', $vbulletin->GPC['usertitleid']);
    print_table_header($vbphrase['confirm_deletion_gcpglobal']);
    print_description_row($vbphrase['are_you_sure_you_want_to_delete_this_user_title']);
    print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
}
// ###################### Start Kill #######################
if ($_POST['do'] == 'kill') {
    $assertor->delete('usertitle', array('usertitleid' => $vbulletin->GPC['usertitleid']));
    print_stop_message2('deleted_user_title_successfully', 'usertitle', array('do' => 'modify'));
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'modify') {
    $usertitles = $assertor->getRows('usertitle', array(), 'minposts');
    ?>
	<script type="text/javascript">
	function js_usergroup_jump(usertitleid, obj)
	{
		task = obj.options[obj.selectedIndex].value;
		switch (task)
		{
			case 'edit': window.location = "usertitle.php?<?php 
    echo vB::getCurrentSession()->get('sessionurl_js');
    ?>
do=edit&usertitleid=" + usertitleid; break;
function exec_complete_reminder($reminderid)
{
    global $vbulletin, $permissions, $vbphrase;
    $reminderid = intval($reminderid);
    $event = $vbulletin->db->query_first("\n\t\tSELECT reminder.*, u1.username AS username, u2.username AS completedname\n\t\tFROM " . TABLE_PREFIX . "reminder AS reminder\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS u1 ON(u1.userid = reminder.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS u2 ON(u2.userid = reminder.completedby)\n\t\tWHERE reminderid = {$reminderid}\n\t");
    // check to see if the event is for administrators only,
    // and if it is deny permission to non admins
    if ($event['adminonly'] and !($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])) {
        print_stop_message2('no_permission');
    } elseif ($event['completedby']) {
        print_stop_message('event_already_complete', $event['completedname'], vbdate($vbphrase['adminfunctions_reminder_complete_date'], $event['completedtime'], 1), vbdate($vbphrase['adminfunctions_reminder_complete_time'], $event['completedtime']));
    } else {
        $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "reminder\n\t\t\t\tSET\tcompletedby = " . $vbulletin->userinfo['userid'] . ",\n\t\t\t\t\tcompletedtime = " . TIMENOW . "\n\t\t\tWHERE reminderid = {$reminderid}\n\t\t");
        print_stop_message2(array('completed_x_successfully', $vbphrase['reminder_gcpglobal']));
    }
}