Пример #1
0
                     }
                 }
             }
             if ($alias_address_count > $max_alias_addresses) {
                 $input_errors[] = sprintf(gettext('The maximum number of entries in an alias has been exceeded (%s)'), $max_alias_addresses);
                 break;
             }
         }
     }
 }
 // Validate the input data expanded above.
 foreach ($input_addresses as $idx => $input_address) {
     if (is_alias($input_address)) {
         if (!alias_same_type($input_address, $_POST['type'])) {
             // But alias type network can include alias type urltable. Feature#1603.
             if (!($_POST['type'] == 'network' && preg_match("/urltable/i", alias_get_type($input_address)))) {
                 $wrongaliases .= " " . $input_address;
             }
         }
     } else {
         if ($_POST['type'] == "port") {
             if (!is_port($input_address) && !is_portrange($input_address)) {
                 $input_errors[] = $input_address . " " . gettext("is not a valid port or alias.");
             }
         } else {
             if ($_POST['type'] == "host" || $_POST['type'] == "network") {
                 if (is_subnet($input_address) || !is_ipaddr($input_address) && !is_hostname($input_address)) {
                     $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s address, FQDN or alias.'), $input_address, $_POST['type']);
                 }
             }
         }
Пример #2
0
             } else {
                 $input_errors[] = gettext("You must provide a valid URL.");
                 $dont_update = true;
                 break;
             }
         }
     }
 } else {
     /* item is a normal alias type */
     $wrongaliases = "";
     for ($x = 0; $x < 4999; $x++) {
         if ($_POST["address{$x}"] != "") {
             if (is_alias($_POST["address{$x}"])) {
                 if (!alias_same_type($_POST["address{$x}"], $_POST['type'])) {
                     // But alias type network can include alias type urltable. Feature#1603.
                     if (!($_POST['type'] == 'network' && alias_get_type($_POST["address{$x}"]) == 'urltable')) {
                         $wrongaliases .= " " . $_POST["address{$x}"];
                     }
                 }
             } else {
                 if ($_POST['type'] == "port") {
                     if (!is_port($_POST["address{$x}"])) {
                         $input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias.");
                     }
                 } else {
                     if ($_POST['type'] == "host" || $_POST['type'] == "network") {
                         if (!is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) {
                             $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
                         }
                     }
                 }
Пример #3
0
     }
     unset($desc_fmt_err_found);
     if ($_POST['type'] == "url_ports") {
         $address = group_ports($address);
     }
 } else {
     /* item is a normal alias type */
     $wrongaliases = "";
     $desc_fmt_err_found = false;
     for ($x = 0; $x < 4999; $x++) {
         if ($_POST["address{$x}"] != "") {
             $_POST["address{$x}"] = trim($_POST["address{$x}"]);
             if (is_alias($_POST["address{$x}"])) {
                 if (!alias_same_type($_POST["address{$x}"], $_POST['type'])) {
                     // But alias type network can include alias type urltable. Feature#1603.
                     if (!($_POST['type'] == 'network' && preg_match("/urltable/i", alias_get_type($_POST["address{$x}"])))) {
                         $wrongaliases .= " " . $_POST["address{$x}"];
                     }
                 }
             } else {
                 if ($_POST['type'] == "port") {
                     if (!is_port($_POST["address{$x}"]) && !is_portrange($_POST["address{$x}"])) {
                         $input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias.");
                     }
                 } else {
                     if ($_POST['type'] == "host" || $_POST['type'] == "network") {
                         if (is_subnet($_POST["address{$x}"]) || !is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) {
                             $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
                         }
                     }
                 }
Пример #4
0
    $sql = "SELECT * FROM tbl_product_type WHERE `type_alias` = ''";
    $query = mysql_query($sql, $conn);
    $row = array();
    while ($result = mysql_fetch_array($query)) {
        array_push($row, $result);
    }
    return $row;
}
function alias_update_type($post_type_id, $post_type_name)
{
    $conn = connDB();
    $sql = "UPDATE tbl_product_type SET `type_alias` = '{$post_type_name}' WHERE `type_id` = '{$post_type_id}'";
    $query = mysql_query($sql, $conn);
}
$alias_check = alias_count_type();
$alias_get = alias_get_type();
if ($alias_check['rows'] > 0) {
    foreach ($alias_get as $alias_get) {
        alias_update_type($alias_get['type_id'], cleanurl($alias_get['type_name']));
    }
}
/* --- END PRODUCT ALIAS --- */
/* --- DISCOUNT --- */
function discount_price($post_disc_id, $post_disc_value, $post_normal_price, $post_start, $post_end)
{
    if ($post_start <= date('Y-m-d') and $post_end >= date('Y-m-d')) {
        if ($post_disc_id == "1" || $post_disc_id == 1) {
            // PERCENTAGE
            $return['now_price'] = $post_normal_price - $post_disc_value / 100 * $post_normal_price;
            $return['was_price'] = $post_normal_price;
            $return['promo_value'] = $post_disc_value / 100 * $post_normal_price;