private function _content_menu_domainacccess()
 {
     if (module_exists('domain')) {
         $domains = $this->_content_menu_domain_list();
         if (isset($_SESSION['content_menu_domain_filter'])) {
             return $domains[$_SESSION['content_menu_domain_filter']];
         }
         if (count($domains) > 1) {
             return domain_default(FALSE, FALSE);
         }
     }
     return FALSE;
 }
Пример #2
0
/**
 * Allows modules to specify the target link for a Drupal path.
 *
 * Note: This hook is not meant to be used for node paths, which
 * are handled by hook_domain_source_alter(). This hook is split
 * from hook_domain_source_alter() for better performance.
 *
 * Currently, no modules in the package implement this hook.
 *
 * @param &$source
 *   The domain array from domain_get_node_match(), passed by reference.
 * @param $nid
 *   The identifier of the obect being rewritten. For nodes, this is the node id.
 *   In other instances, we may pass a $path string or other variable.
 * @return
 *   No return value; modify $source by reference.
 */
function hook_domain_source_path_alter(&$source, $path)
{
    // Always make admin links go to the primary domain.
    $base = arg(0, $path);
    if ($base == 'admin') {
        $source = domain_default();
    }
}
Пример #3
0
function form_actions()
{
    global $actions;
    /* if we are to save this form, instead of display it */
    if (isset($_POST['selected_items'])) {
        $selected_items = unserialize(stripslashes($_POST['selected_items']));
        if ($_POST['drp_action'] == '1') {
            /* delete */
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                domain_remove($selected_items[$i]);
            }
        } elseif ($_POST['drp_action'] == '2') {
            /* disable */
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                domain_disable($selected_items[$i]);
            }
        } elseif ($_POST['drp_action'] == '3') {
            /* enable */
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                domain_enable($selected_items[$i]);
            }
        } elseif ($_POST['drp_action'] == '4') {
            /* default */
            if (sizeof($selected_items) > 1) {
                /* error message */
            } else {
                for ($i = 0; $i < count($selected_items); $i++) {
                    /* ================= input validation ================= */
                    input_validate_input_number($selected_items[$i]);
                    /* ==================================================== */
                    domain_default($selected_items[$i]);
                }
            }
        }
        header('Location: user_domains.php');
        exit;
    }
    /* setup some variables */
    $d_list = '';
    $d_array = array();
    /* loop through each of the data queries and process them */
    while (list($var, $val) = each($_POST)) {
        if (ereg('^chk_([0-9]+)$', $var, $matches)) {
            /* ================= input validation ================= */
            input_validate_input_number($matches[1]);
            /* ==================================================== */
            $d_list .= '<li>' . db_fetch_cell_prepared('SELECT domain_name FROM user_domains WHERE domain_id = ?', array($matches[1])) . '</li>';
            $d_array[] = $matches[1];
        }
    }
    top_header();
    html_start_box('<strong>' . $actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
    print "<form action='user_domains.php' method='post'>\n";
    if (isset($d_array) && sizeof($d_array)) {
        if ($_POST['drp_action'] == '1') {
            /* delete */
            print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following User Domain(s) will be deleted.</p>\n\t\t\t\t\t\t<p><ul>{$d_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
            $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue' title='Delete User Domain(s)'>";
        } else {
            if ($_POST['drp_action'] == '2') {
                /* disable */
                print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following User Domain(s) will be disabled.</p>\n\t\t\t\t\t\t<p><ul>{$d_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue' title='Disable User Domain(s)'>";
            } else {
                if ($_POST['drp_action'] == '3') {
                    /* enable */
                    print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following User Domain(s) will be enabled.</p>\n\t\t\t\t\t\t<p><ul>{$d_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                    $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue' title='Enabled User Domain(s)'>";
                } else {
                    if ($_POST['drp_action'] == '4') {
                        /* default */
                        print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following User Domain will become the default.</p>\n\t\t\t\t\t\t<p><ul>{$d_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                        $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue' title='Make Selected Domain Default'>";
                    }
                }
            }
        }
    } else {
        print "<tr><td class='even'><span class='textError'>You must select at least one data input method.</span></td></tr>\n";
        $save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
    }
    print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($d_array) ? serialize($d_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST['drp_action'] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>";
    html_end_box();
    bottom_footer();
}