Beispiel #1
0
 function fetch_faq_checkbox_tree($parent = 0)
 {
     global $ifaqcache, $faqcache, $faqjumpbits, $faqparent, $vbphrase, $vbulletin;
     static $output = '';
     if ($parentlist === null) {
         $parentlist = $parent;
     }
     if (!is_array($ifaqcache)) {
         cache_ordered_faq(true, false, -1);
     }
     if (!is_array($ifaqcache["{$parent}"])) {
         return;
     }
     $output .= "<ul id=\"li_{$parent}\">";
     foreach ($ifaqcache["{$parent}"] as $key1 => $faq) {
         if ($faq['volatile']) {
             $checked = ' checked="checked"';
             $class = '';
         } else {
             $checked = '';
             $class = ' class="customfaq"';
         }
         $output .= "<li>\n\t\t\t\t<label for=\"{$faq['faqname']}\"{$class}>" . "<input type=\"checkbox\" name=\"faq[{$faq['faqname']}]\" value=\"{$faq['faqname']}\"{$checked} id=\"{$faq['faqname']}\" title=\"{$parentlist}\" />" . ($faq['title'] ? $faq['title'] : $faq['faqname']) . "</label>";
         construct_hidden_code("faqexists[{$faq['faqname']}]", $faq['faqname']);
         if (is_array($ifaqcache["{$faq['faqname']}"])) {
             fetch_faq_checkbox_tree($faq['faqname']);
         }
         $output .= "</li>";
     }
     $output .= '</ul>';
     return $output;
 }
Beispiel #2
0
function fetch_faq_delete_list($parentname)
{
    global $ifaqcache, $vbulletin;
    if (!is_array($ifaqcache)) {
        cache_ordered_faq();
    }
    static $deletelist;
    if (!is_array($deletelist)) {
        $deletelist = array('\'' . $vbulletin->db->escape_string($parentname) . '\'');
    }
    if (is_array($ifaqcache["{$parentname}"])) {
        foreach ($ifaqcache["{$parentname}"] as $faq) {
            $deletelist[] = '\'' . $vbulletin->db->escape_string($faq['faqname']) . '\'';
            fetch_faq_delete_list($faq['faqname']);
        }
    }
    return $deletelist;
}
Beispiel #3
0
        $faqnames[] = "'" . $db->escape_string($faqname) . "'";
    }
    $faqs = $db->query_read("\n\t\tSELECT faqname, displayorder\n\t\tFROM " . TABLE_PREFIX . "faq AS faq\n\t\tWHERE faqname IN (" . implode(', ', $faqnames) . ")\n\t");
    while ($faq = $db->fetch_array($faqs)) {
        if ($faq['displayorder'] != $vbulletin->GPC['order']["{$faq['faqname']}"]) {
            $db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "faq\n\t\t\t\tSET displayorder = " . $vbulletin->GPC['order']["{$faq['faqname']}"] . "\n\t\t\t\tWHERE faqname = '" . $db->escape_string($faq['faqname']) . "'\n\t\t\t");
        }
    }
    define('CP_REDIRECT', "faq.php?faq=" . $vbulletin->GPC['faqparent']);
    print_stop_message('saved_display_order_successfully');
}
// #############################################################################
if ($_REQUEST['do'] == 'modify') {
    $vbulletin->input->clean_array_gpc('r', array('faq' => 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_message('invalid_faq_item_specified');
        }
    }
    $parents = array();
    fetch_faq_parents($faqcache["{$faqparent}"]['faqname']);
    $parents = array_reverse($parents);
    $nav = "<a href=\"faq.php?" . $vbulletin->session->vars['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++;
Beispiel #4
0
		function fetch_faq_checkbox_tree($parent = 0)
		{
			global $ifaqcache, $faqcache, $faqjumpbits, $faqparent, $vbphrase, $vbulletin;
			static $output = '';

			if ($parentlist === null)
			{
				$parentlist = $parent;
			}

			if (!is_array($ifaqcache))
			{
				cache_ordered_faq(true);
			}

			if (!is_array($ifaqcache["$parent"]))
			{
				return;
			}

			$output .= "<ul id=\"li_$parent\">";

			foreach($ifaqcache["$parent"] AS $key1 => $faq)
			{
				if ($faq['volatile'])
				{
					$checked = ' checked="checked"';
					$class = '';
				}
				else
				{
					$checked = '';
					$class = ' class="customfaq"';
				}

				$output .= "<li>
					<label for=\"$faq[faqname]\"$class>" .
					"<input type=\"checkbox\" name=\"faq[$faq[faqname]]\" value=\"$faq[faqname]\"$checked id=\"$faq[faqname]\" title=\"$parentlist\" />"
					. $faq['title'] . "</label>";

				construct_hidden_code("faqexists[$faq[faqname]]", $faq['faqname']);

				if (is_array($ifaqcache["$faq[faqname]"]))
				{
					fetch_faq_checkbox_tree($faq['faqname']);
				}
				$output .= "</li>";
			}

			$output .= '</ul>';

			return $output;
		}
Beispiel #5
0
// #############################################################################
if ($_REQUEST['do'] == 'main') {
    $vbulletin->input->clean_array_gpc('r', array('faq' => TYPE_STR));
    // get parent variable
    if ($vbulletin->GPC['faq'] == '') {
        $faqparent = 'faqroot';
    } else {
        $faqparent = preg_replace('#\\W#', '', $vbulletin->GPC['faq']);
    }
    // set initial navbar entry
    if ($faqparent == 'faqroot') {
        $navbits[''] = $vbphrase['faq'];
    } else {
        $navbits['faq.php' . $vbulletin->session->vars['sessionurl_q']] = $vbphrase['faq'];
    }
    cache_ordered_faq(false, true);
    // get bits for faq text cache
    $faqtext = array();
    if (is_array($ifaqcache["{$faqparent}"])) {
        fetch_faq_text_array($ifaqcache["{$faqparent}"]);
    } else {
        eval(standard_error(fetch_error('invalidid', $vbphrase['faq_item'], $vbulletin->options['contactuslink'])));
    }
    // $censorchars is used in the vb_censor_explain phrase
    $censorchars = $vbulletin->options['censorchar'] . $vbulletin->options['censorchar'] . $vbulletin->options['censorchar'] . $vbulletin->options['censorchar'] . $vbulletin->options['censorchar'];
    require_once DIR . '/includes/functions_misc.php';
    // display FAQs
    $faq = array();
    foreach ($ifaqcache["{$faqparent}"] as $faq) {
        if ($faq['displayorder'] > 0) {
            $text = str_replace(array("\\'", '\\\\$'), array("'", '\\$'), addslashes($faq['text']));
function fetch_faq_delete_list($parentname)
{
    global $ifaqcache;
    if (!is_array($ifaqcache)) {
        cache_ordered_faq();
    }
    static $deletelist;
    if (!is_array($deletelist)) {
        $deletelist = array($parentname);
    }
    if (is_array($ifaqcache["{$parentname}"])) {
        foreach ($ifaqcache["{$parentname}"] as $faq) {
            $deletelist[] = $faq['faqname'];
            fetch_faq_delete_list($faq['faqname']);
        }
    }
    return $deletelist;
}