function return_registration_script()
{
    $registration_script = "var user_name_field = document.getElementById('signup_username');\n";
    // Check if the registration input exists
    $registration_script .= "if (user_name_field){\n";
    // Build the code that will change the school selector to the fields in the database
    //        $registration_script .= build_school_selector();
    //        $registration_script .= build_tool_select();
    //        $registration_script .= build_trade_select();
    // Removed for now because BuddyPress was unhappy
    // Disable and make the username read only
    $registration_script .= "user_name_field.readOnly = true;\n";
    $registration_script .= "user_name_field.placeholder='Select a colour and a tool';\n";
    // Create variables for the drop downs
    $registration_script .= "var color_field = document.getElementById('field_12');\n";
    $registration_script .= "var tool_field = document.getElementById('field_2');\n";
    $registration_script .= "var domain_field = document.getElementById('field_17');\n";
    // Get the school check
    $registration_script .= build_school_check_function();
    $registration_script .= build_tool_check_function();
    $registration_script .= build_color_check_function();
    $registration_script .= check_domain();
    // Add the on change listeners
    $registration_script .= buld_colour_listener();
    $registration_script .= build_tool_listener();
    $registration_script .= build_domain_listener();
    // END IF username field
    $registration_script .= "}";
    // Output the registration
    echo $registration_script;
    die;
}
 protected function validate_new_id()
 {
     $domain_check = check_domain($this->id);
     if ($domain_check != '') {
         $this->errormsg[$this->id_field] = $domain_check;
         return false;
     }
     if (Config::read('vacation_domain') == $this->id) {
         $this->errormsg[$this->id_field] = Config::Lang('domain_conflict_vacation_domain');
         return false;
     }
     # still here? good.
     return true;
 }
    echo "Done. The changes should take effect within the hour. Please be aware some networks may not see the changes for up to 72 hours.<BR>";
}
// Main entry point
if (isset($_REQUEST['action'])) {
    $action = $_REQUEST['action'];
    switch ($action) {
        case "frm_check_domain":
            form_check_domain();
            break;
        case "check_domain":
            if (!isset($_POST['domain'])) {
                echo "Error. No domain specified.";
                die;
            }
            $domain = $_POST['domain'];
            check_domain($domain);
            break;
        case "frm_register_domain":
            if (!isset($_POST['domain'])) {
                echo "Error. No domain specified.";
                die;
            } else {
                $domain = $_POST['domain'];
                frm_register_domain($domain);
            }
            break;
        case "register_domain":
            if (!isset($_POST['domain'])) {
                echo "Error. No domain specified.";
                die;
            }
 protected function _validate_src_server($field, $val)
 {
     if ($val == '') {
         $msg = Config::Lang('pFetchmail_server_missing');
     } else {
         $msg = check_domain($val);
     }
     if ($msg == '') {
         return true;
     } else {
         $this->errormsg[$field] = $msg;
         return false;
     }
 }
Exemple #5
0
 protected function _validate_goto($field, $val)
 {
     if (count($val) == 0) {
         # empty is ok for mailboxes - this is checked in setmore() which can clear the error message
         $this->errormsg[$field] = Config::lang('pEdit_alias_goto_text_error1');
         return false;
     }
     $errors = array();
     foreach ($val as $singlegoto) {
         if (substr($this->id, 0, 1) == '@' && substr($singlegoto, 0, 1) == '@') {
             # domain-wide forward - check only the domain part
             # only allowed if $this->id is a catchall
             # Note: alias domains are better, but we should keep this way supported for backward compatibility
             #       and because alias domains can't forward to external domains
             list(, $domain) = explode('@', $singlegoto);
             $domain_check = check_domain($domain);
             if ($domain_check != '') {
                 $errors[] = "{$singlegoto}: {$domain_check}";
             }
         } else {
             $email_check = check_email($singlegoto);
             if ($email_check != '') {
                 $errors[] = "{$singlegoto}: {$email_check}";
             }
         }
     }
     if (count($errors)) {
         $this->errormsg[$field] = join("   ", $errors);
         # TODO: find a way to display multiple error messages per field
         return false;
     } else {
         return true;
     }
 }
 public function count_all_in_view($atts)
 {
     $fetch_url = full_fetch_url();
     $return_html = '';
     if ($fetch_url) {
         $sc_options = shortcode_atts(array('viewtype' => NULL, 'ln' => NULL, 'domain' => NULL), $atts);
         check_domain($sc_options, 'cic');
         $fetch_url_params = process_fetch_url_params($sc_options);
         $content = file_get_contents($fetch_url . '/rpc/countall/' . $sc_options['domain'] . '?' . $fetch_url_params);
         $json_data = json_decode($content);
         if (!json_last_error() == JSON_ERROR_NONE) {
             $return_html = '<span class="ciocrsd-alert">Error: ' . json_last_error_msg() . '</span>';
         } elseif ($content === FALSE) {
             $return_html = '<span class="ciocrsd-alert">Error: Content not available</span>';
         } else {
             $return_html = $json_data->{'RecordCount'};
         }
     } else {
         do_fetch_url_error();
     }
     return $return_html;
 }
Exemple #7
0
/**
 * check_email
 * Checks if an email is valid - if it is, return true, else false.
 * @param String $email - a string that may be an email address.
 * @return empty string if it's a valid email address, otherwise string with the errormessage
 * TODO: make check_email able to handle already added domains
 */
function check_email($email)
{
    $ce_email = $email;
    //strip the vacation domain out if we are using it
    //and change from blah#foo.com@autoreply.foo.com to blah@foo.com
    if (Config::bool('vacation')) {
        $vacation_domain = Config::read('vacation_domain');
        $ce_email = preg_replace("/@{$vacation_domain}\$/", '', $ce_email);
        $ce_email = preg_replace("/#/", '@', $ce_email);
    }
    // Perform non-domain-part sanity checks
    if (!preg_match('/^[-!#$%&\'*+\\.\\/0-9=?A-Z^_{|}~]+' . '@' . '[^@]+$/i', $ce_email)) {
        return Config::lang_f('pInvalidMailRegex', $email);
    }
    // Determine domain name
    $matches = array();
    if (!preg_match('|@(.+)$|', $ce_email, $matches)) {
        return Config::lang_f('pInvalidMailRegex', $email);
    }
    $domain = $matches[1];
    # check domain name
    return check_domain($domain);
}
     if (isset($_POST['fMaxquota'])) {
         $tMaxquota = escape_string($_POST['fMaxquota']);
     }
     if (isset($_POST['fTransport'])) {
         $tTransport = escape_string($_POST['fTransport']);
     }
     if (isset($_POST['fDefaultaliases'])) {
         $tDefaultaliases = escape_string($_POST['fDefaultaliases']);
     }
     if (isset($_POST['fBackupmx'])) {
         $tBackupmx = escape_string($_POST['fBackupmx']);
     }
     if (domain_exist($fDomain)) {
         $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error'];
     }
     if (empty($fDomain) or !check_domain($fDomain)) {
         $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error2'];
     }
 }
 if ($error != 1) {
     $tAliases = $CONF['aliases'];
     $tMailboxes = $CONF['mailboxes'];
     $tMaxquota = $CONF['maxquota'];
     if ($fBackupmx == "on") {
         $fAliases = -1;
         $fMailboxes = -1;
         $fMaxquota = -1;
         $fBackupmx = 1;
         $sqlBackupmx = db_get_boolean(true);
     } else {
         $fBackupmx = 0;
function main()
{
    $options = parse_args();
    if (array_key_exists('version', $options)) {
        print 'Plugin version: ' . VERSION;
        fullusage();
        nagios_exit('', STATUS_OK);
    }
    check_environment();
    check_domain($options);
}