public function get_next_practice_id() { $result = -1; if ($query = $this->db->query("SELECT MAX(practiceid) AS `prid` FROM `am_practice`;")) { if ($query->num_rows() > 0) { if ($row = $query->result()) { $result = $row[0]->prid; } } $query->free_result(); } if ($result == "" || $result == -1) { $result = "AMPR-A00001"; } else { if (Intval(substr($result, 6)) == 99999) { if (ord(substr($result, 5, 1)) == 'z') { $result = -1; } else { $val = char(ord(substr($result, 5, 1)) + 1); $result = "AMPR-" . $val . "00001"; } } else { $val = Intval(substr($result, 6)) + 1; $result = substr($result, 0, 6) . ($val < 10000 ? $val < 1000 ? $val < 100 ? $val < 10 ? "0000" . $val : "000" . $val : "00" . $val : "0" . $val : $val); } } return $result; }
public static function CheckFields(&$arFields, $ID = false) { /** @global CMain $APPLICATION */ global $APPLICATION; $arMsg = array(); if ($ID > 0) { unset($arFields["ID"]); } global $DB; if (($ID === false || is_set($arFields, "TASK_ID")) && strlen($arFields["TASK_ID"]) <= 0) { $arMsg[] = array("id" => "TASK_ID", "text" => GetMessage("CTRLR_TASK_ERR_ID")); } elseif (is_set($arFields, "TASK_ID")) { $arTaskID = CControllerTask::GetTaskArray(); if (!isset($arTaskID[$arFields['TASK_ID']])) { $arMsg[] = array("id" => "TASK_ID", "text" => GetMessage("CTRLR_TASK_ERR_BAD_ID")); } } if (($ID === false || is_set($arFields, "CONTROLLER_MEMBER_ID")) && Intval($arFields["CONTROLLER_MEMBER_ID"]) <= 0) { $arMsg[] = array("id" => "CONTROLLER_MEMBER_ID", "text" => GetMessage("CTRLR_TASK_ERR_CLIENTID")); } if (isset($arFields["INIT_EXECUTE"])) { $arFields["INIT_CRC"] = crc32($arFields["INIT_EXECUTE"]); } if (count($arMsg) <= 0 && $ID === false) { $strSql = "\n\t\t\t\tSELECT INIT_EXECUTE\n\t\t\t\tFROM b_controller_task\n\t\t\t\tWHERE CONTROLLER_MEMBER_ID='" . IntVal($arFields["CONTROLLER_MEMBER_ID"]) . "'\n\t\t\t\tAND TASK_ID='" . $DB->ForSQL($arFields["TASK_ID"], 255) . "'\n\t\t\t\tAND DATE_EXECUTE IS NULL\n\t\t\t"; $dbr = $DB->Query($strSql); while ($ar = $dbr->Fetch()) { if (intval($ar["INIT_EXECUTE"]) == intval($arFields["INIT_EXECUTE"])) { $arMsg[] = array("id" => "TASK_ID", "text" => GetMessage("CTRLR_TASK_ERR_ALREADY") . " [" . IntVal($arFields["CONTROLLER_MEMBER_ID"]) . "]."); break; } } } $APPLICATION->ResetException(); if ($ID === false) { foreach (GetModuleEvents("controller", "OnBeforeTaskAdd", true) as $arEvent) { $bEventRes = ExecuteModuleEventEx($arEvent, array($arFields)); if ($bEventRes === false) { if ($err = $APPLICATION->GetException()) { $arMsg[] = array("id" => "ID", "text" => $err->GetString() . " [" . IntVal($arFields["CONTROLLER_MEMBER_ID"]) . "]."); } else { $arMsg[] = array("id" => "ID", "text" => "Unknown error." . " [" . IntVal($arFields["CONTROLLER_MEMBER_ID"]) . "]."); } break; } } } if (count($arMsg) > 0) { $e = new CAdminException($arMsg); $APPLICATION->ThrowException($e); return false; } if ($ID === false && !is_set($arFields, "DATE_CREATE")) { $arFields["~DATE_CREATE"] = $DB->CurrentTimeFunction(); } return true; }
function CheckFields(&$arFields, $ID = false) { $arErrMsg = array(); if ($ID > 0) { unset($arFields["ID"]); } global $DB; if (($ID === false || is_set($arFields, "TASK_ID")) && strlen($arFields["TASK_ID"]) <= 0) { $arMsg[] = array("id" => "TASK_ID", "text" => GetMessage("CTRLR_TASK_ERR_ID")); } elseif (is_set($arFields, "TASK_ID")) { $arTaskID = CControllerTask::GetTaskArray(); if (!isset($arTaskID[$arFields['TASK_ID']])) { $arMsg[] = array("id" => "TASK_ID", "text" => GetMessage("CTRLR_TASK_ERR_BAD_ID")); } } if (($ID === false || is_set($arFields, "CONTROLLER_MEMBER_ID")) && Intval($arFields["CONTROLLER_MEMBER_ID"]) <= 0) { $arMsg[] = array("id" => "CONTROLLER_MEMBER_ID", "text" => GetMessage("CTRLR_TASK_ERR_CLIENTID")); } if (isset($arFields["INIT_EXECUTE"])) { $arFields["INIT_CRC"] = crc32($arFields["INIT_EXECUTE"]); } if (count($arMsg) <= 0 && $ID === false) { $strSql = "\n\t\t\t\tSELECT INIT_EXECUTE\n\t\t\t\tFROM b_controller_task\n\t\t\t\tWHERE CONTROLLER_MEMBER_ID='" . IntVal($arFields["CONTROLLER_MEMBER_ID"]) . "'\n\t\t\t\tAND TASK_ID='" . $DB->ForSQL($arFields["TASK_ID"], 255) . "'\n\t\t\t\tAND DATE_EXECUTE IS NULL\n\t\t\t"; $dbr = $DB->Query($strSql); while ($ar = $dbr->Fetch()) { if (intval($ar["INIT_EXECUTE"]) == intval($arFields["INIT_EXECUTE"])) { $arMsg[] = array("id" => "TASK_ID", "text" => GetMessage("CTRLR_TASK_ERR_ALREADY") . " [" . IntVal($arFields["CONTROLLER_MEMBER_ID"]) . "]."); break; } } } if (count($arMsg) > 0) { $e = new CAdminException($arMsg); $GLOBALS["APPLICATION"]->ThrowException($e); return false; } if ($ID === false && !is_set($arFields, "DATE_CREATE")) { $arFields["~DATE_CREATE"] = $DB->CurrentTimeFunction(); } return true; }
function quickaddtocartform_add($data, $form) { $shoppingCart = ShoppingCart::singleton(); $buyableID = intval($data["BuyableID"]); $buyableClassName = Convert::raw2sql($data["BuyableClassName"]); $version = Intval($data["Version"]); $quantity = floatval($data["Quantity"]); $status = "bad"; $message = _t("AddToCartPage.ERRORPRODUCTNOTADDED", "ERROR: Product Not Added - make sure to find a product first."); if (class_exists($buyableClassName) && EcommerceDBConfig::is_buyable($buyableClassName)) { $buyable = $buyableClassName::get()->byID($buyableID); if ($buyable) { $shoppingCart->addBuyable($buyable, $quantity); $status = "good"; $message = _t("AddToCartPage.ADDED", "Added"); } } if (Director::is_ajax()) { return $shoppingCart->setMessageAndReturn($message, $status, $form); } else { $form->setMessage($message, $status); $this->redirectBack(); } }
public function get_next_id($practice, $practiceprefix) { $result = -1; if ($query = $this->db->query("SELECT MAX(deviceid) AS `did` FROM `" . $practice . "_device`;")) { if ($query->num_rows() > 0) { if ($row = $query->result()) { $result = $row[0]->did; } } $query->free_result(); } if ($result == "" || $result == -1) { if ($practice == "am") { $result = "AMD-A001"; } else { $result = $practiceprefix . "D-A001"; } } else { if (Intval(substr($result, 5)) == 999) { if (ord(substr($result, 4, 1)) == 'Z') { $result = -1; } else { $val = char(ord(substr($result, 4, 1)) + 1); $result = substr($result, 0, 4) . $val . "001"; } } else { $val = Intval(substr($result, 5)) + 1; $result = substr($result, 0, 5) . ($val < 100 ? $val < 10 ? "00" . $val : "0" . $val : $val); } } return $result; }
function Delete($ID) { /** * @global CMain $APPLICATION * @global CDatabase $DB */ global $APPLICATION; $ID = Intval($ID); foreach (GetModuleEvents("main", "OnBeforeEventMessageDelete", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($ID)) === false) { $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME']; if ($ex = $APPLICATION->GetException()) { $err .= ': ' . $ex->GetString(); } $APPLICATION->throwException($err); return false; } } @set_time_limit(600); //check module event for OnDelete foreach (GetModuleEvents("main", "OnEventMessageDelete", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($ID)); } Mail\Internal\EventMessageSiteTable::delete($ID); $result = Mail\Internal\EventMessageTable::delete($ID); if ($result->isSuccess()) { $res = new CDBResultEventMultiResult(); $res->affectedRowsCount = 1; } else { $res = false; } return $res; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("blog")) { ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL")); return; } $arParams["ID"] = IntVal($arParams["ID"]); $arParams["BLOG_URL"] = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($arParams["BLOG_URL"])); $arParams["TB_LENGTH"] = Intval($arParams["TB_LENGTH"]); if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") { $arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]); } else { $arParams["CACHE_TIME"] = 0; } if (strLen($arParams["BLOG_VAR"]) <= 0) { $arParams["BLOG_VAR"] = "blog"; } if (strLen($arParams["PAGE_VAR"]) <= 0) { $arParams["PAGE_VAR"] = "page"; } if (strLen($arParams["POST_VAR"]) <= 0) { $arParams["POST_VAR"] = "id"; } $arParams["PATH_TO_TRACKBACK"] = trim($arParams["PATH_TO_TRACKBACK"]); if (strlen($arParams["PATH_TO_TRACKBACK"]) <= 0) { $arParams["PATH_TO_TRACKBACK"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=trackback&" . $arParams["BLOG_VAR"] . "=#blog#" . "&" . $arParams["POST_VAR"] . "=#post_id#"); } $arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
/** * Conjunto de funciones para ordenar y filtrar en relación de la URL * * @author Jonathan Sandoval <*****@*****.**> * @return Array(Distribuidor) Conjunto de Distribuidores despueś de analizar la URL */ static function frontendFunctions() { // Obtención de los datos de la URL $url = ControladorBaseDatos::getRestoURL(); $attribArray = array("ID", "Direccion", "Nombre"); //Revisa si se desea eliminar un Distribuidor if (strripos($url, "?action=delete&distribuidor_id=") !== false) { $id_distribuidor = Intval(substr($url, strlen("?action=delete&distribuidor_id="))); /* Validación del tipo de Distribuidor */ if (self::eliminarDistribuidor($id_distribuidor) == false) { $error = ControladorBaseDatos::getLastError(); if ($error != "") { $error = substr($error, strpos($error, '`herremex`.`') + strlen('`herremex`.`')); $error = substr($error, strpos($error, '`herremex`.`') + strlen('`herremex`.`')); $error = substr($error, 0, strpos($error, '`')); echo "<script>\n alert('La tabla \\'{$error}\\' está ocupando al distribuidor');\n </script>"; } } } $distribuidores = self::obtenerDistribuidores(); // Revisa si desea buscar por nombre if (strpos($url, "?keyword=") !== false) { $to_search = substr($url, strlen("?keyword=")); $to_search = substr($to_search, 0, strpos($to_search, '&')); if ($to_search !== "") { //Filtra en relación de todo su nombre $distribuidores = self::obtenerDistribuidorNombreoID($to_search, $to_search); } } // Si desea buscar de modo avanzado if (strpos($url, "?keyword_id=") !== false) { $myurl = $url; $distribuidorTemp = array(); $distribuidores = array(); $keywArray = array("?keyword_id=", "keyword_direccion=", "keyword_nombre="); //Rescara los valores de cada kwyword y los agrega a un objeto Distribuidor foreach ($keywArray as $key => $keyword) { $myurl = substr($myurl, stripos($myurl, $keyword)); $distribuidorTemp[$attribArray["{$key}"]] = substr($myurl, stripos($myurl, $keyword) + strlen($keyword), stripos($myurl, "&") - strlen($keyword)); } //Filtra en relación de los datos del objeto obtenido $distribuidores = self::filtrarDistribuidores(self::array_Distribuidor($distribuidorTemp)); } //Retorna el conjunto de Distribuidores después de las operaciones return $distribuidores; }
function evalua($valor) { if ($valor == 0) { return 'cero'; } $decimales = 0; $letras = ''; while ($valor != 0) { // Validamos si supera los 100 millones if ($valor >= 1000000000) { return 'Límite de aplicación exedido.'; } //Centenas de Millón if ($valor < 1000000000 and $valor >= 100000000) { if (intval($valor / 100000000) == 1 and $valor - intval($valor / 100000000) * 100000000 < 1000000) { $letras .= (string) 'cien millones '; } else { $letras .= $this->centenas(intval($valor / 100000000)); if (intval($valor / 100000000) != 1 and intval($valor / 100000000) != 5 and intval($valor / 100000000) != 7 and intval($valor / 100000000) != 9) { $letras .= (string) 'ciento '; } else { $letras .= (string) ' '; } } $valor = $valor - Intval($valor / 100000000) * 100000000; } //Decenas de Millón if ($valor < 100000000 and $valor >= 10000000) { if (intval($valor / 1000000) < 16) { $tempo = $this->decenas(intval($valor / 1000000)); $letras .= (string) $tempo; $letras .= (string) ' millones '; $valor = $valor - intval($valor / 1000000) * 1000000; } else { $letras .= $this->decenas(intval($valor / 10000000) * 10); $valor = $valor - intval($valor / 10000000) * 10000000; if ($valor > 1000000) { $letras .= $letras . ' y '; } } } //Unidades de Millon if ($valor < 10000000 and $valor >= 1000000) { $tempo = intval($valor / 1000000); if ($tempo == 1) { $letras .= (string) ' un millón '; } else { $tempo = unidades(intval($valor / 1000000)); $letras .= (string) $tempo; $letras .= (string) " millones "; } $valor = $valor - intval($valor / 1000000) * 1000000; } //Centenas de Millar if ($valor < 1000000 and $valor >= 100000) { $tempo = intval($valor / 100000); $tempo2 = $valor - $tempo * 100000; if ($tempo == 1 and $tempo2 < 1000) { $letras .= (string) 'cien mil '; } else { $tempo = $this->centenas(intval($valor / 100000)); $letras .= (string) $tempo; $tempo = intval($valor / 100000); if ($tempo != 1 and $tempo != 5 and $tempo != 7 and $tempo != 9) { $letras .= (string) 'ciento '; } else { $letras .= (string) ' '; } } $valor = $valor - intval($valor / 100000) * 100000; } //Decenas de Millar if ($valor < 100000 and $valor >= 10000) { $tempo = intval($valor / 1000); if ($tempo < 16) { $tempo = $this->decenas(intval($valor / 1000)); $letras .= (string) $tempo; $letras .= (string) ' mil '; $valor = $valor - intval($valor / 1000) * 1000; } else { $tempo = $this->decenas(intval($valor / 10000) * 10); $letras .= (string) $tempo; $valor = $valor - intval($valor / 10000) * 10000; if ($valor > 1000) { $letras .= (string) ' y '; } else { $letras .= (string) ' mil '; } } } //Unidades de Millar if ($valor < 10000 and $valor >= 1000) { $tempo = intval($valor / 1000); if ($tempo == 1) { $letras .= (string) ''; } else { $tempo = $this->unidades(intval($valor / 1000)); $letras .= (string) $tempo; } $letras .= (string) ' mil '; $valor = $valor - intval($valor / 1000) * 1000; } //Centenas if ($valor < 1000 and $valor > 99) { if (intval($valor / 100) == 1 and $valor - intval($valor / 100) * 100 < 1) { $letras .= 'cien '; } else { $temp = intval($valor / 100); $l2 = $this->centenas($temp); $letras .= (string) $l2; if (intval($valor / 100) != 1 and intval($valor / 100) != 5 and intval($valor / 100) != 7 and intval($valor / 100) != 9) { $letras .= 'ciento '; } else { $letras .= (string) ' '; } } $valor = $valor - intval($valor / 100) * 100; } //Decenas if ($valor < 100 and $valor > 9) { if ($valor < 16) { $tempo = $this->decenas(intval($valor)); $letras .= $tempo; $Numer = $valor - Intval($valor); } else { $tempo = $this->decenas(Intval($valor / 10) * 10); $letras .= (string) $tempo; $valor = $valor - Intval($valor / 10) * 10; if ($valor > 0.99) { $letras .= (string) ' y '; } } } //Unidades if ($valor < 10 and $valor > 0.99) { $tempo = $this->unidades(intval($valor)); $letras .= (string) $tempo; $valor = $valor - intval($valor); } //Decimales if ($decimales <= 0) { if ($letras != "Error en Conversión a Letras" and strlen(trim($letras)) > 0) { $letras .= (string) ' '; } } return $letras; } }
function Delete($ID) { global $DB; $ID = Intval($ID); $strSql = "DELETE FROM b_mail_filter_cond WHERE ID=".$ID; return $DB->Query($strSql, true); }
function GetCount() { global $DB; $r = $DB->Query("SELECT COUNT('x') as C FROM b_user"); $r = $r->Fetch(); return Intval($r["C"]); }
/** * Conjunto de funciones para ordenar y filtrar en relación de la URL * * @author Jonathan Sandoval <*****@*****.**> * @return Array(Empleado) Conjunto de Empleados despueś de analizar la URL */ static function frontendFunctions() { // Obtención de los datos de la URL $url = ControladorBaseDatos::getRestoURL(); $attribArray = array("ID", "CURP", "Nombre", "Segundo_Nombre", "Apellido_Paterno", "Apellido_Materno", "Turno", "Tipo_Empleado", "Calle", "Colonia", "NoCasa_Ext", "NoCasa_Int", "Ciudad", "Password"); //Revisa si se desea eliminar un Empleado if (strripos($url, "?action=delete&empleado_id=") !== false) { $id_empleado = Intval(substr($url, strlen("?action=delete&empleado_id="))); /* Validación del tipo de Empleado */ if (self::eliminarEmpleado($id_empleado) == false) { $error = ControladorBaseDatos::getLastError(); if ($error != "") { $error = substr($error, strpos($error, '`herremex`.`') + strlen('`herremex`.`')); $error = substr($error, strpos($error, '`herremex`.`') + strlen('`herremex`.`')); $error = substr($error, 0, strpos($error, '`')); echo "<script>\n alert('La tabla \\'{$error}\\' está ocupando al empleado');\n </script>"; } } } $empleados = self::obtenerEmpleados(); // Revisa si desea buscar por nombre if (strpos($url, "?keyword=") !== false) { $to_search = substr($url, strlen("?keyword=")); $to_search = substr($to_search, 0, strpos($to_search, '&')); if ($to_search !== "") { //Filtra en relación de todo su nombre $empleados = self::obtenerEmpleadoNombres($to_search, $to_search, $to_search, $to_search); } } // Si desea buscar de modo avanzado if (strpos($url, "?keyword_id=") !== false) { $myurl = $url; $empleadoTemp = array(); $empleados = array(); $keywArray = array("?keyword_id=", "keyword_curp=", "keyword_primer_nombre=", "keyword_segundo_nombre=", "keyword_apellido_paterno=", "keyword_apellido_materno=", "keyword_turno=", "keyword_tipo=", "keyword_calle=", "keyword_colonia=", "keyword_ext=", "keyword_Int=", "keyword_ciudad="); //Rescara los valores de cada kwyword y los agrega a un objeto Empleado foreach ($keywArray as $key => $keyword) { $myurl = substr($myurl, stripos($myurl, $keyword)); $empleadoTemp[$attribArray["{$key}"]] = substr($myurl, stripos($myurl, $keyword) + strlen($keyword), stripos($myurl, "&") - strlen($keyword)); } //Filtra en relación de los datos del objeto obtenido $empleados = self::filtrarEmpleados(self::array_Empleado($empleadoTemp)); } //Retorna el conjunto de Empleados después de las operaciones return $empleados; }
/** * Clears the cart contents completely by removing the orderID from session, and * thus creating a new cart on next request. * @return Boolean */ public function clear() { //we keep this here so that a flush can be added... set_time_limit(1200); self::$singletoncart = null; $this->order = null; $this->messages = array(); foreach (self::$session_variable_names as $name) { $sessionVariableName = $this->sessionVariableName($name); Session::set($sessionVariableName, null); Session::clear($sessionVariableName); Session::save(); } $memberID = Intval(Member::currentUserID()); if ($memberID) { $orders = Order::get()->filter(array("MemberID" => $memberID)); if ($orders && $orders->count()) { foreach ($orders as $order) { if (!$order->IsSubmitted()) { $order->delete(); } } } } return true; }
$arParams["PATH_TO_PAYMENT"] = Trim($arParams["PATH_TO_PAYMENT"]); if (strlen($arParams["PATH_TO_PAYMENT"]) <= 0) { $arParams["PATH_TO_PAYMENT"] = "payment.php"; } $arParams["PATH_TO_AUTH"] = Trim($arParams["PATH_TO_AUTH"]); if (strlen($arParams["PATH_TO_AUTH"]) <= 0) { $arParams["PATH_TO_AUTH"] = "/auth/"; } $arParams["PAY_FROM_ACCOUNT"] = $arParams["PAY_FROM_ACCOUNT"] == "N" ? "N" : "Y"; $arParams["COUNT_DELIVERY_TAX"] = $arParams["COUNT_DELIVERY_TAX"] == "Y" ? "Y" : "N"; $arParams["COUNT_DISCOUNT_4_ALL_QUANTITY"] = $arParams["COUNT_DISCOUNT_4_ALL_QUANTITY"] == "Y" ? "Y" : "N"; $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] = $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" ? "Y" : "N"; $arParams["DELIVERY_NO_AJAX"] = $arParams["DELIVERY_NO_AJAX"] == "Y" ? "Y" : "N"; $arParams["USE_PREPAYMENT"] = $arParams["USE_PREPAYMENT"] == 'Y' ? 'Y' : 'N'; $arParams["DISPLAY_IMG_HEIGHT"] = Intval($arParams["DISPLAY_IMG_HEIGHT"]) <= 0 ? 90 : Intval($arParams["DISPLAY_IMG_HEIGHT"]); $arParams["DISPLAY_IMG_WIDTH"] = Intval($arParams["DISPLAY_IMG_WIDTH"]) <= 0 ? 90 : Intval($arParams["DISPLAY_IMG_WIDTH"]); $arParams["DELIVERY_TO_PAYSYSTEM"] = strlen($arParams["DELIVERY_TO_PAYSYSTEM"]) <= 0 ? "d2p" : trim($arParams["DELIVERY_TO_PAYSYSTEM"]); $GLOBALS['CATALOG_ONETIME_COUPONS_BASKET'] = null; $GLOBALS['CATALOG_ONETIME_COUPONS_ORDER'] = null; $arResult = array("PERSON_TYPE" => array(), "PAY_SYSTEM" => array(), "ORDER_PROP" => array(), "DELIVERY" => array(), "TAX" => array(), "ERROR" => array(), "ORDER_PRICE" => 0, "ORDER_WEIGHT" => 0, "VATE_RATE" => 0, "VAT_SUM" => 0, "bUsingVat" => false, "BASKET_ITEMS" => array(), "BASE_LANG_CURRENCY" => CSaleLang::GetLangCurrency(SITE_ID), "WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, SITE_ID)), "WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, SITE_ID)), "TaxExempt" => array(), "DISCOUNT_PRICE" => 0, "DISCOUNT_PERCENT" => 0, "DELIVERY_PRICE" => 0, "TAX_PRICE" => 0, "PAYED_FROM_ACCOUNT_FORMATED" => false, "ORDER_TOTAL_PRICE_FORMATED" => false, "ORDER_WEIGHT_FORMATED" => false, "ORDER_PRICE_FORMATED" => false, "VAT_SUM_FORMATED" => false, "DELIVERY_SUM" => false, "DELIVERY_PROFILE_SUM" => false, "DELIVERY_PRICE_FORMATED" => false, "DISCOUNT_PERCENT_FORMATED" => false, "PAY_FROM_ACCOUNT" => false, "CURRENT_BUDGET_FORMATED" => false, "USER_ACCOUNT" => false, "DISCOUNTS" => array(), "AUTH" => array(), "HAVE_PREPAYMENT" => false, "PREPAY_PS" => array(), "PREPAY_ADIT_FIELDS" => "", "PREPAY_ORDER_PROPS" => array()); $arUserResult = array("PERSON_TYPE_ID" => false, "PAY_SYSTEM_ID" => false, "DELIVERY_ID" => false, "ORDER_PROP" => false, "DELIVERY_LOCATION" => false, "TAX_LOCATION" => false, "PAYER_NAME" => false, "USER_EMAIL" => false, "PROFILE_NAME" => false, "PAY_CURRENT_ACCOUNT" => false, "CONFIRM_ORDER" => false, "FINAL_STEP" => false, "ORDER_DESCRIPTION" => false, "PROFILE_ID" => false, "PROFILE_CHANGE" => false, "DELIVERY_LOCATION_ZIP" => false); $arResult["AUTH"]["new_user_registration_email_confirmation"] = COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y" ? "Y" : "N"; $arResult["AUTH"]["new_user_registration"] = COption::GetOptionString("main", "new_user_registration", "Y") == "Y" ? "Y" : "N"; $arParams["ALLOW_AUTO_REGISTER"] = $arParams["ALLOW_AUTO_REGISTER"] == "Y" ? "Y" : "N"; if ($arParams["ALLOW_AUTO_REGISTER"] == "Y" && ($arResult["AUTH"]["new_user_registration_email_confirmation"] == "Y" || $arResult["AUTH"]["new_user_registration"] == "N")) { $arParams["ALLOW_AUTO_REGISTER"] = "N"; } $arParams["SEND_NEW_USER_NOTIFY"] = $arParams["SEND_NEW_USER_NOTIFY"] == "N" ? "N" : "Y"; $allCurrency = CSaleLang::GetLangCurrency(SITE_ID); if (!$arParams["DELIVERY_NO_SESSION"]) { $arParams["DELIVERY_NO_SESSION"] = "N";
function Delete($ID) { global $DB; $ID = Intval($ID); $bCanDelete = true; $db_events = GetModuleEvents("main", "OnBeforeEventMessageDelete"); while ($arEvent = $db_events->Fetch()) { if (ExecuteModuleEventEx($arEvent, array($ID)) === false) { $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME']; if ($ex = $APPLICATION->GetException()) { $err .= ': ' . $ex->GetString(); } $APPLICATION->throwException($err); return false; } } @set_time_limit(600); //check module event for OnDelete $events = GetModuleEvents("main", "OnEventMessageDelete"); while ($arEvent = $events->Fetch()) { ExecuteModuleEventEx($arEvent, array($ID)); } $DB->Query("DELETE FROM b_event_message_site WHERE EVENT_MESSAGE_ID=" . $ID, true); return $DB->Query("DELETE FROM b_event_message WHERE ID=" . $ID, true); }
<?php if ($_POST) { $con = mysqli_connect("***", "***", "***", "tickets") or die("cannot connect to database"); $result_set = mysqli_query($con, "SELECT * FROM `closedtickets` "); $row = mysqli_fetch_array($result_set); $Id = Intval($_POST['Id']); $Title = $row['Title']; $Priority = $row['Priority']; $Description = $row['Description']; $Department = $row['Department']; $Email = $row['Email']; $Date = date("H:i:s m-d-Y"); //Deletes original copy of selected data $sqll = "DELETE FROM `tickets`.`closedtickets` WHERE `closedtickets`.`Id` = '{$Id}' LIMIT 1 "; mysqli_query($con, $sqll); //reloads page header('location: ClosedTickets.php'); } ?>
Протяженность: <?php echo $node->content; ?> м.<br> <?php $node = $xml->SelectNodes('/info/traffic/time'); ?> Последнее обновление: <?php echo $node->content; ?> </span> </td> <?php $node = $xml->SelectNodes('/info/traffic/level'); $t = Intval($node->content); ?> <td nowrap="yes" width="20%"><span class="traf<?php echo intval(($t + 1) / 2); ?> "><?php echo $t; ?> </span></td> </tr> </table> <?php if ($arGadgetParams["SHOW_URL"] == "Y") { ?> <br /> <?php
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("blog")) { ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL")); return; } if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") { $arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]); } else { $arParams["CACHE_TIME"] = 0; } $arParams["BLOG_COUNT"] = intval($arParams["BLOG_COUNT"]); if (Intval($arParams["BLOG_COUNT"]) <= 0) { $arParams["BLOG_COUNT"] = 6; } $arParams["SORT_BY1"] = strlen($arParams["SORT_BY1"]) > 0 ? $arParams["SORT_BY1"] : "DATE_CREATE"; $arParams["SORT_ORDER1"] = strlen($arParams["SORT_ORDER1"]) > 0 ? $arParams["SORT_ORDER1"] : "DESC"; $arParams["SORT_BY2"] = strlen($arParams["SORT_BY2"]) > 0 ? $arParams["SORT_BY2"] : "ID"; $arParams["SORT_ORDER2"] = strlen($arParams["SORT_ORDER2"]) > 0 ? $arParams["SORT_ORDER2"] : "DESC"; $arParams["SHOW_DESCRIPTION"] = $arParams["SHOW_DESCRIPTION"] == "N" ? "N" : "Y"; $arParams["USE_SOCNET"] = $arParams["USE_SOCNET"] == "Y" ? "Y" : "N"; if (!is_array($arParams["GROUP_ID"])) { $arParams["GROUP_ID"] = array($arParams["GROUP_ID"]); } foreach ($arParams["GROUP_ID"] as $k => $v) { if (IntVal($v) <= 0) { unset($arParams["GROUP_ID"][$k]); }
function UpdateSearch($ID, $bOverWrite = false) { if (!CModule::IncludeModule("search")) { return; } global $DB; $ID = Intval($ID); static $arGroups = array(); static $arSITE = array(); $strSql = "\n\t\t\tSELECT BS.ID, BS.NAME, BS.DESCRIPTION_TYPE, BS.DESCRIPTION, BS.XML_ID as EXTERNAL_ID,\n\t\t\t\tBS.CODE, BS.IBLOCK_ID, B.IBLOCK_TYPE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("BS.TIMESTAMP_X") . " as LAST_MODIFIED,\n\t\t\t\tB.CODE as IBLOCK_CODE, B.XML_ID as IBLOCK_EXTERNAL_ID, B.SECTION_PAGE_URL,\n\t\t\t\tB.ACTIVE as ACTIVE1,\n\t\t\t\tBS.GLOBAL_ACTIVE as ACTIVE2,\n\t\t\t\tB.INDEX_SECTION, B.RIGHTS_MODE\n\t\t\tFROM b_iblock_section BS, b_iblock B\n\t\t\tWHERE BS.IBLOCK_ID=B.ID\n\t\t\t\tAND BS.ID=" . $ID; $dbrIBlockSection = $DB->Query($strSql); if ($arIBlockSection = $dbrIBlockSection->Fetch()) { $IBLOCK_ID = $arIBlockSection["IBLOCK_ID"]; $SECTION_URL = "=ID=" . $arIBlockSection["ID"] . "&EXTERNAL_ID=" . $arIBlockSection["EXTERNAL_ID"] . "&IBLOCK_TYPE_ID=" . $arIBlockSection["IBLOCK_TYPE_ID"] . "&IBLOCK_ID=" . $arIBlockSection["IBLOCK_ID"] . "&IBLOCK_CODE=" . $arIBlockSection["IBLOCK_CODE"] . "&IBLOCK_EXTERNAL_ID=" . $arIBlockSection["IBLOCK_EXTERNAL_ID"] . "&CODE=" . $arIBlockSection["CODE"]; if ($arIBlockSection["ACTIVE1"] != "Y" || $arIBlockSection["ACTIVE2"] != "Y" || $arIBlockSection["INDEX_SECTION"] != "Y") { CSearch::DeleteIndex("iblock", "S" . $arIBlockSection["ID"]); return; } if (!array_key_exists($IBLOCK_ID, $arGroups)) { $arGroups[$IBLOCK_ID] = array(); $strSql = "SELECT GROUP_ID " . "FROM b_iblock_group " . "WHERE IBLOCK_ID= " . $IBLOCK_ID . " " . "\tAND PERMISSION>='R' " . "ORDER BY GROUP_ID"; $dbrIBlockGroup = $DB->Query($strSql); while ($arIBlockGroup = $dbrIBlockGroup->Fetch()) { $arGroups[$IBLOCK_ID][] = $arIBlockGroup["GROUP_ID"]; if ($arIBlockGroup["GROUP_ID"] == 2) { break; } } } if (!array_key_exists($IBLOCK_ID, $arSITE)) { $arSITE[$IBLOCK_ID] = array(); $strSql = "SELECT SITE_ID " . "FROM b_iblock_site " . "WHERE IBLOCK_ID= " . $IBLOCK_ID; $dbrIBlockSite = $DB->Query($strSql); while ($arIBlockSite = $dbrIBlockSite->Fetch()) { $arSITE[$IBLOCK_ID][] = $arIBlockSite["SITE_ID"]; } } $BODY = $arIBlockSection["DESCRIPTION_TYPE"] == "html" ? CSearch::KillTags($arIBlockSection["DESCRIPTION"]) : $arIBlockSection["DESCRIPTION"]; $BODY .= $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("IBLOCK_" . $arIBlockSection["IBLOCK_ID"] . "_SECTION", $arIBlockSection["ID"]); if ($arIBlockSection["RIGHTS_MODE"] !== "E") { $arPermissions = $arGroups[$IBLOCK_ID]; } else { $obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $arIBlockSection["ID"]); $arPermissions = $obSectionRights->GetGroups(array("section_read")); } CSearch::Index("iblock", "S" . $ID, array("LAST_MODIFIED" => $arIBlockSection["LAST_MODIFIED"], "TITLE" => $arIBlockSection["NAME"], "PARAM1" => $arIBlockSection["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "SITE_ID" => $arSITE[$IBLOCK_ID], "PERMISSIONS" => $arPermissions, "URL" => $SECTION_URL, "BODY" => $BODY), $bOverWrite); } }
$arParams["PATH_TO_PERSONAL"] = "index.php"; } $arParams["PATH_TO_PAYMENT"] = Trim($arParams["PATH_TO_PAYMENT"]); if (strlen($arParams["PATH_TO_PAYMENT"]) <= 0) { $arParams["PATH_TO_PAYMENT"] = "payment.php"; } $arParams["PATH_TO_AUTH"] = Trim($arParams["PATH_TO_AUTH"]); if (strlen($arParams["PATH_TO_AUTH"]) <= 0) { $arParams["PATH_TO_AUTH"] = "/auth/"; } $arParams["PAY_FROM_ACCOUNT"] = $arParams["PAY_FROM_ACCOUNT"] == "N" ? "N" : "Y"; $arParams["COUNT_DELIVERY_TAX"] = $arParams["COUNT_DELIVERY_TAX"] == "Y" ? "Y" : "N"; $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] = $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" ? "Y" : "N"; $arParams["DELIVERY_NO_AJAX"] = $arParams["DELIVERY_NO_AJAX"] == "Y" ? "Y" : "N"; $arParams["USE_PREPAYMENT"] = $arParams["USE_PREPAYMENT"] == 'Y' ? 'Y' : 'N'; $arParams["DISPLAY_IMG_HEIGHT"] = Intval($arParams["DISPLAY_IMG_HEIGHT"]) <= 0 ? 90 : Intval($arParams["DISPLAY_IMG_HEIGHT"]); $arParams["DELIVERY_TO_PAYSYSTEM"] = strlen($arParams["DELIVERY_TO_PAYSYSTEM"]) <= 0 ? "d2p" : trim($arParams["DELIVERY_TO_PAYSYSTEM"]); if (!isset($arParams["DISABLE_BASKET_REDIRECT"]) || 'Y' !== $arParams["DISABLE_BASKET_REDIRECT"]) { $arParams["DISABLE_BASKET_REDIRECT"] = "N"; } $bUseAccountNumber = COption::GetOptionString("sale", "account_number_template", "") !== "" ? true : false; $arResult = array("PERSON_TYPE" => array(), "PAY_SYSTEM" => array(), "ORDER_PROP" => array(), "DELIVERY" => array(), "TAX" => array(), "ERROR" => array(), "ORDER_PRICE" => 0, "ORDER_WEIGHT" => 0, "VATE_RATE" => 0, "VAT_SUM" => 0, "bUsingVat" => false, "BASKET_ITEMS" => array(), "BASE_LANG_CURRENCY" => CSaleLang::GetLangCurrency(SITE_ID), "WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, SITE_ID)), "WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, SITE_ID)), "TaxExempt" => array(), "DISCOUNT_PRICE" => 0, "DISCOUNT_PERCENT" => 0, "DELIVERY_PRICE" => 0, "TAX_PRICE" => 0, "PAYED_FROM_ACCOUNT_FORMATED" => false, "ORDER_TOTAL_PRICE_FORMATED" => false, "ORDER_WEIGHT_FORMATED" => false, "ORDER_PRICE_FORMATED" => false, "VAT_SUM_FORMATED" => false, "DELIVERY_SUM" => false, "DELIVERY_PROFILE_SUM" => false, "DELIVERY_PRICE_FORMATED" => false, "DISCOUNT_PERCENT_FORMATED" => false, "PAY_FROM_ACCOUNT" => false, "CURRENT_BUDGET_FORMATED" => false, "USER_ACCOUNT" => false, "DISCOUNTS" => array(), "AUTH" => array(), "HAVE_PREPAYMENT" => false, "PREPAY_PS" => array(), "PREPAY_ADIT_FIELDS" => "", "PREPAY_ORDER_PROPS" => array()); $arUserResult = array("PERSON_TYPE_ID" => false, "PAY_SYSTEM_ID" => false, "DELIVERY_ID" => false, "ORDER_PROP" => false, "DELIVERY_LOCATION" => false, "TAX_LOCATION" => false, "PAYER_NAME" => false, "USER_EMAIL" => false, "PROFILE_NAME" => false, "PAY_CURRENT_ACCOUNT" => false, "CONFIRM_ORDER" => false, "FINAL_STEP" => false, "ORDER_DESCRIPTION" => false, "PROFILE_ID" => false, "PROFILE_CHANGE" => false, "DELIVERY_LOCATION_ZIP" => false); $arResult["DELIVERY_EXTRA"] = isset($_POST["DELIVERY_ID"]) && isset($_POST["DELIVERY_EXTRA"][$_POST["DELIVERY_ID"]]) ? $_POST["DELIVERY_EXTRA"][$_POST["DELIVERY_ID"]] : array(); $arResult["AUTH"]["new_user_registration_email_confirmation"] = COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y" ? "Y" : "N"; $arResult["AUTH"]["new_user_registration"] = COption::GetOptionString("main", "new_user_registration", "Y") == "Y" ? "Y" : "N"; $arParams["ALLOW_AUTO_REGISTER"] = $arParams["ALLOW_AUTO_REGISTER"] == "Y" ? "Y" : "N"; if ($arParams["ALLOW_AUTO_REGISTER"] == "Y" && ($arResult["AUTH"]["new_user_registration_email_confirmation"] == "Y" || $arResult["AUTH"]["new_user_registration"] == "N")) { $arParams["ALLOW_AUTO_REGISTER"] = "N"; } $arParams["SEND_NEW_USER_NOTIFY"] = $arParams["SEND_NEW_USER_NOTIFY"] == "N" ? "N" : "Y";
die; } if (!CModule::IncludeModule("blog")) { ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL")); return; } if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") { $arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]); } else { $arParams["CACHE_TIME"] = 0; } $arParams["BLOG_COUNT"] = intval($arParams["BLOG_COUNT"]); if (Intval($arParams["BLOG_COUNT"]) <= 0) { $arParams["BLOG_COUNT"] = 6; } if (Intval($arParams["PERIOD_DAYS"]) <= 0) { $arParams["PERIOD_DAYS"] = 30; } $arParams["SORT_BY1"] = strlen($arParams["SORT_BY1"]) > 0 ? $arParams["SORT_BY1"] : "DATE_CREATE"; $arParams["SORT_ORDER1"] = strlen($arParams["SORT_ORDER1"]) > 0 ? $arParams["SORT_ORDER1"] : "DESC"; $arParams["SORT_BY2"] = strlen($arParams["SORT_BY2"]) > 0 ? $arParams["SORT_BY2"] : "ID"; $arParams["SORT_ORDER2"] = strlen($arParams["SORT_ORDER2"]) > 0 ? $arParams["SORT_ORDER2"] : "DESC"; $arParams["SHOW_DESCRIPTION"] = $arParams["SHOW_DESCRIPTION"] == "N" ? "N" : "Y"; $arParams["USE_SOCNET"] = $arParams["USE_SOCNET"] == "Y" ? "Y" : "N"; if (!is_array($arParams["GROUP_ID"])) { $arParams["GROUP_ID"] = array($arParams["GROUP_ID"]); } foreach ($arParams["GROUP_ID"] as $k => $v) { if (IntVal($v) <= 0) { unset($arParams["GROUP_ID"][$k]); }
function Delete($ID) { /** * @global CMain $APPLICATION * @global CDatabase $DB */ global $DB, $APPLICATION; $ID = Intval($ID); foreach (GetModuleEvents("main", "OnBeforeEventMessageDelete", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($ID)) === false) { $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME']; if ($ex = $APPLICATION->GetException()) { $err .= ': ' . $ex->GetString(); } $APPLICATION->throwException($err); return false; } } @set_time_limit(600); //check module event for OnDelete foreach (GetModuleEvents("main", "OnEventMessageDelete", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($ID)); } $DB->Query("DELETE FROM b_event_message_site WHERE EVENT_MESSAGE_ID=" . $ID, true); return $DB->Query("DELETE FROM b_event_message WHERE ID=" . $ID, true); }
function UpdateSearch($ID, $bOverWrite = false) { if (!CModule::IncludeModule("search")) { return; } global $DB; $ID = Intval($ID); static $strElementSql = false; if (!$strElementSql) { $strElementSql = "\n\t\t\t\tSELECT BE.ID, BE.NAME, BE.XML_ID as EXTERNAL_ID,\n\t\t\t\t\tBE.PREVIEW_TEXT_TYPE, BE.PREVIEW_TEXT, BE.CODE,\n\t\t\t\t\tBE.TAGS,\n\t\t\t\t\tBE.DETAIL_TEXT_TYPE, BE.DETAIL_TEXT, BE.IBLOCK_ID, B.IBLOCK_TYPE_ID,\n\t\t\t\t\t" . $DB->DateToCharFunction("BE.TIMESTAMP_X") . " as LAST_MODIFIED,\n\t\t\t\t\t" . $DB->DateToCharFunction("BE.ACTIVE_FROM") . " as DATE_FROM,\n\t\t\t\t\t" . $DB->DateToCharFunction("BE.ACTIVE_TO") . " as DATE_TO,\n\t\t\t\t\tBE.IBLOCK_SECTION_ID,\n\t\t\t\t\tB.CODE as IBLOCK_CODE, B.XML_ID as IBLOCK_EXTERNAL_ID, B.DETAIL_PAGE_URL,\n\t\t\t\t\tB.VERSION, B.RIGHTS_MODE, B.SOCNET_GROUP_ID\n\t\t\t\tFROM b_iblock_element BE, b_iblock B\n\t\t\t\tWHERE BE.IBLOCK_ID=B.ID\n\t\t\t\t\tAND B.ACTIVE='Y'\n\t\t\t\t\tAND BE.ACTIVE='Y'\n\t\t\t\t\tAND B.INDEX_ELEMENT='Y'\n\t\t\t\t\t" . CIBlockElement::WF_GetSqlLimit("BE.", "N") . "\n\t\t\t\t\tAND BE.ID="; } $dbrIBlockElement = $DB->Query($strElementSql . $ID); if ($arIBlockElement = $dbrIBlockElement->Fetch()) { $IBLOCK_ID = $arIBlockElement["IBLOCK_ID"]; $DETAIL_URL = "=ID=" . urlencode($arIBlockElement["ID"]) . "&EXTERNAL_ID=" . urlencode($arIBlockElement["EXTERNAL_ID"]) . "&IBLOCK_SECTION_ID=" . urlencode($arIBlockElement["IBLOCK_SECTION_ID"]) . "&IBLOCK_TYPE_ID=" . urlencode($arIBlockElement["IBLOCK_TYPE_ID"]) . "&IBLOCK_ID=" . urlencode($arIBlockElement["IBLOCK_ID"]) . "&IBLOCK_CODE=" . urlencode($arIBlockElement["IBLOCK_CODE"]) . "&IBLOCK_EXTERNAL_ID=" . urlencode($arIBlockElement["IBLOCK_EXTERNAL_ID"]) . "&CODE=" . urlencode($arIBlockElement["CODE"]); static $arGroups = array(); if (!array_key_exists($IBLOCK_ID, $arGroups)) { $arGroups[$IBLOCK_ID] = array(); $strSql = "SELECT GROUP_ID " . "FROM b_iblock_group " . "WHERE IBLOCK_ID= " . $IBLOCK_ID . " " . "\tAND PERMISSION>='R' " . "ORDER BY GROUP_ID"; $dbrIBlockGroup = $DB->Query($strSql); while ($arIBlockGroup = $dbrIBlockGroup->Fetch()) { $arGroups[$IBLOCK_ID][] = $arIBlockGroup["GROUP_ID"]; if ($arIBlockGroup["GROUP_ID"] == 2) { break; } } } static $arSITE = array(); if (!array_key_exists($IBLOCK_ID, $arSITE)) { $arSITE[$IBLOCK_ID] = array(); $strSql = "SELECT SITE_ID " . "FROM b_iblock_site " . "WHERE IBLOCK_ID= " . $IBLOCK_ID; $dbrIBlockSite = $DB->Query($strSql); while ($arIBlockSite = $dbrIBlockSite->Fetch()) { $arSITE[$IBLOCK_ID][] = $arIBlockSite["SITE_ID"]; } } $BODY = ($arIBlockElement["PREVIEW_TEXT_TYPE"] == "html" ? CSearch::KillTags($arIBlockElement["PREVIEW_TEXT"]) : $arIBlockElement["PREVIEW_TEXT"]) . "\r\n" . ($arIBlockElement["DETAIL_TEXT_TYPE"] == "html" ? CSearch::KillTags($arIBlockElement["DETAIL_TEXT"]) : $arIBlockElement["DETAIL_TEXT"]); static $arProperties = array(); if (!array_key_exists($IBLOCK_ID, $arProperties)) { $arProperties[$IBLOCK_ID] = array(); $rsProperties = CIBlockProperty::GetList(array("sort" => "asc", "id" => "asc"), array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SEARCHABLE" => "Y", "CHECK_PERMISSIONS" => "N")); while ($ar = $rsProperties->Fetch()) { if (strlen($ar["USER_TYPE"]) > 0) { $arUT = CIBlockProperty::GetUserType($ar["USER_TYPE"]); if (array_key_exists("GetSearchContent", $arUT)) { $ar["GetSearchContent"] = $arUT["GetSearchContent"]; } elseif (array_key_exists("GetPublicViewHTML", $arUT)) { $ar["GetSearchContent"] = $arUT["GetPublicViewHTML"]; } } $arProperties[$IBLOCK_ID][$ar["ID"]] = $ar; } } //Read current property values from database $strProperties = ""; if (count($arProperties[$IBLOCK_ID]) > 0) { if ($arIBlockElement["VERSION"] == 1) { $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_property\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t\tAND IBLOCK_PROPERTY_ID in (" . implode(", ", array_keys($arProperties[$IBLOCK_ID])) . ")\n\t\t\t\t\t"); while ($ar = $rs->Fetch()) { $strProperties .= "\r\n"; $arProperty = $arProperties[$IBLOCK_ID][$ar["IBLOCK_PROPERTY_ID"]]; if ($arProperty["GetSearchContent"]) { $strProperties .= CSearch::KillTags(call_user_func_array($arProperty["GetSearchContent"], array($arProperty, array("VALUE" => $ar["VALUE"]), array()))); } elseif ($arProperty["PROPERTY_TYPE"] == 'L') { $arEnum = CIBlockPropertyEnum::GetByID($ar["VALUE"]); if ($arEnum !== false) { $strProperties .= $arEnum["VALUE"]; } } elseif ($arProperty["PROPERTY_TYPE"] == 'F') { $arFile = CIBlockElement::__GetFileContent($ar["VALUE"]); if (is_array($arFile)) { $strProperties .= $arFile["CONTENT"]; $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")]; } } else { $strProperties .= $ar["VALUE"]; } } } else { $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_prop_m" . $IBLOCK_ID . "\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t\tAND IBLOCK_PROPERTY_ID in (" . implode(", ", array_keys($arProperties[$IBLOCK_ID])) . ")\n\t\t\t\t\t"); while ($ar = $rs->Fetch()) { $strProperties .= "\r\n"; $arProperty = $arProperties[$IBLOCK_ID][$ar["IBLOCK_PROPERTY_ID"]]; if ($arProperty["GetSearchContent"]) { $strProperties .= CSearch::KillTags(call_user_func_array($arProperty["GetSearchContent"], array($arProperty, array("VALUE" => $ar["VALUE"]), array()))); } elseif ($arProperty["PROPERTY_TYPE"] == 'L') { $arEnum = CIBlockPropertyEnum::GetByID($ar["VALUE"]); if ($arEnum !== false) { $strProperties .= $arEnum["VALUE"]; } } elseif ($arProperty["PROPERTY_TYPE"] == 'F') { $arFile = CIBlockElement::__GetFileContent($ar["VALUE"]); if (is_array($arFile)) { $strProperties .= $arFile["CONTENT"]; $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")]; } } else { $strProperties .= $ar["VALUE"]; } } $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_prop_s" . $IBLOCK_ID . "\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t"); if ($ar = $rs->Fetch()) { foreach ($arProperties[$IBLOCK_ID] as $property_id => $property) { if (array_key_exists("PROPERTY_" . $property_id, $ar) && $property["MULTIPLE"] == "N" && strlen($ar["PROPERTY_" . $property_id]) > 0) { $strProperties .= "\r\n"; if ($property["GetSearchContent"]) { $strProperties .= CSearch::KillTags(call_user_func_array($property["GetSearchContent"], array($property, array("VALUE" => $ar["PROPERTY_" . $property_id]), array()))); } elseif ($property["PROPERTY_TYPE"] == 'L') { $arEnum = CIBlockPropertyEnum::GetByID($ar["PROPERTY_" . $property_id]); if ($arEnum !== false) { $strProperties .= $arEnum["VALUE"]; } } elseif ($property["PROPERTY_TYPE"] == 'F') { $arFile = CIBlockElement::__GetFileContent($ar["PROPERTY_" . $property_id]); if (is_array($arFile)) { $strProperties .= $arFile["CONTENT"]; $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")]; } } else { $strProperties .= $ar["PROPERTY_" . $property_id]; } } } } } } $BODY .= $strProperties; if ($arIBlockElement["RIGHTS_MODE"] !== "E") { $arPermissions = $arGroups[$IBLOCK_ID]; } else { $obElementRights = new CIBlockElementRights($IBLOCK_ID, $arIBlockElement["ID"]); $arPermissions = $obElementRights->GetGroups(array("element_read")); } $arFields = array("LAST_MODIFIED" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : $arIBlockElement["LAST_MODIFIED"], "DATE_FROM" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : false, "DATE_TO" => strlen($arIBlockElement["DATE_TO"]) > 0 ? $arIBlockElement["DATE_TO"] : false, "TITLE" => $arIBlockElement["NAME"], "PARAM1" => $arIBlockElement["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "SITE_ID" => $arSITE[$IBLOCK_ID], "PERMISSIONS" => $arPermissions, "URL" => $DETAIL_URL, "BODY" => $BODY, "TAGS" => $arIBlockElement["TAGS"]); if ($arIBlockElement["SOCNET_GROUP_ID"] > 0) { $arFields["PARAMS"] = array("socnet_group" => $arIBlockElement["SOCNET_GROUP_ID"]); } CSearch::Index("iblock", $ID, $arFields, $bOverWrite); } else { CSearch::DeleteIndex("iblock", $ID); } }
function NumerosALetras($Numero) { $Decimales = 0; //$Numero = intval($Numero); $letras = ""; while ($Numero != 0) { // '*---> Validación si se pasa de 100 millones if ($Numero >= 1000000000) { $letras = "Error en Conversión a Letras"; $Numero = 0; $Decimales = 0; } // '*---> $this->Centenas de Millón if ($Numero < 1000000000 and $Numero >= 100000000) { if (Intval($Numero / 100000000) == 1 and $Numero - Intval($Numero / 100000000) * 100000000 < 1000000) { $letras .= (string) "cien millones "; } else { $letras = $letras & $this->Centenas(Intval($Numero / 100000000)); if (Intval($Numero / 100000000) != 1 and Intval($Numero / 100000000) != 5 and Intval($Numero / 100000000) != 7 and Intval($Numero / 100000000) != 9) { $letras .= (string) "cientos "; } else { $letras .= (string) " "; } } $Numero = $Numero - Intval($Numero / 100000000) * 100000000; } // '*---> $this->Decenas de Millón if ($Numero < 100000000 and $Numero >= 10000000) { if (Intval($Numero / 1000000) < 16) { $tempo = $this->Decenas(Intval($Numero / 1000000)); $letras .= (string) $tempo; $letras .= (string) " millones "; $Numero = $Numero - Intval($Numero / 1000000) * 1000000; } else { $letras = $letras & $this->Decenas(Intval($Numero / 10000000) * 10); $Numero = $Numero - Intval($Numero / 10000000) * 10000000; if ($Numero > 1000000) { $letras .= $letras & " y "; } } } // '*---> $this->Unidades de Millón if ($Numero < 10000000 and $Numero >= 1000000) { $tempo = Intval($Numero / 1000000); if ($tempo == 1) { $letras .= (string) " un millón "; } else { $tempo = $this->Unidades(Intval($Numero / 1000000)); $letras .= (string) $tempo; $letras .= (string) " millones "; } $Numero = $Numero - Intval($Numero / 1000000) * 1000000; } // '*---> $this->Centenas de Millar if ($Numero < 1000000 and $Numero >= 100000) { $tempo = Intval($Numero / 100000); $tempo2 = $Numero - $tempo * 100000; if ($tempo == 1 and $tempo2 < 1000) { $letras .= (string) "cien mil "; } else { $tempo = $this->Centenas(Intval($Numero / 100000)); $letras .= (string) $tempo; $tempo = Intval($Numero / 100000); if ($tempo != 1 and $tempo != 5 and $tempo != 7 and $tempo != 9) { $letras .= (string) "cientos "; } else { $letras .= (string) " "; } } $Numero = $Numero - Intval($Numero / 100000) * 100000; } // '*---> $this->Decenas de Millar if ($Numero < 100000 and $Numero >= 10000) { $tempo = Intval($Numero / 1000); if ($tempo < 16) { $tempo = $this->Decenas(Intval($Numero / 1000)); $letras .= (string) $tempo; $letras .= (string) " mil "; $Numero = $Numero - Intval($Numero / 1000) * 1000; } else { $tempo = $this->Decenas(Intval($Numero / 10000) * 10); $letras .= (string) $tempo; $Numero = $Numero - Intval($Numero / 10000) * 10000; if ($Numero > 1000) { $letras .= (string) " y "; } else { $letras .= (string) " mil "; } } } // '*---> $this->Unidades de Millar if ($Numero < 10000 and $Numero >= 1000) { $tempo = Intval($Numero / 1000); if ($tempo == 1) { $letras .= (string) "un"; } else { $tempo = $this->Unidades(Intval($Numero / 1000)); $letras .= (string) $tempo; } $letras .= (string) " mil "; $Numero = $Numero - Intval($Numero / 1000) * 1000; } // '*---> $this->Centenas if ($Numero < 1000 and $Numero > 99) { if (Intval($Numero / 100) == 1 and $Numero - Intval($Numero / 100) * 100 < 1) { $letras = $letras & "cien "; } else { $temp = Intval($Numero / 100); $l2 = $this->Centenas($temp); $letras .= (string) $l2; if (Intval($Numero / 100) != 1 and Intval($Numero / 100) != 5 and Intval($Numero / 100) != 7 and Intval($Numero / 100) != 9) { $letras .= "cientos "; } else { $letras .= (string) " "; } } $Numero = $Numero - Intval($Numero / 100) * 100; } // '*---> $this->Decenas if ($Numero < 100 and $Numero > 9) { if ($Numero < 16) { $tempo = $this->Decenas(Intval($Numero)); $letras .= $tempo; $Numero = $Numero - Intval($Numero); } else { $tempo = $this->Decenas(Intval($Numero / 10) * 10); $letras .= (string) $tempo; $Numero = $Numero - Intval($Numero / 10) * 10; if ($Numero > 0.99) { $letras .= (string) " y "; } } } // '*---> $this->Unidades if ($Numero < 10 and $Numero > 0.99) { $tempo = $this->Unidades(Intval($Numero)); $letras .= (string) $tempo; $Numero = $Numero - Intval($Numero); } // '*---> Decimales if ($Decimales > 0) { $letras .= (string) " con "; $Decimales = $Decimales * 100; echo "*"; $Decimales = number_format($Decimales, 2); echo $Decimales; $tempo = $this->Decenas(Intval($Decimales)); $letras .= (string) $tempo; $letras .= (string) "centavos"; } else { if ($letras != "Error en Conversión a Letras" and strlen(Trim($letras)) > 0) { $letras .= (string) " "; } } return $letras; } }
$where = "and nickname LIKE '%" . $_GPC['nickname'] . "%'"; } else { $where = ""; } if ($_GPC['unusual']) { $where1 = "and black=1"; } else { $where1 = ""; } //粉丝的支付情况,返现情况 $fans = pdo_fetchall("select * from " . tablename('enjoy_circle_fans') . " where uniacid=" . $uniacid . " " . $where . "" . $where1 . " order by uid desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize); // echo "select * from ".tablename('enjoy_circle_log')." as a left join ".tablename('enjoy_circle_fans')." as b // on a.uid=b.uid where a.uniacid=".$uniacid." and a.rid=".$rid." ".$where."".$where1." LIMIT " . ($pindex - 1) * $psize . ',' . $psize; for ($i = 0; $i < count($fans); $i++) { $fans[$i]['topic'] = pdo_fetchcolumn("select count(*) from " . tablename('enjoy_circle_comment') . " where cuid=" . $fans[$i]['uid'] . " group by tid"); $fans[$i]['topic'] = Intval($fans[$i]['topic']); } // var_dump($fans); // exit(); //抽奖码 // $dcodes=pdo_fetchall("select * from ".tablename('enjoy_circle_dcode')." where rid=".$rid." and uniacid=".$uniacid.""); // foreach ($dcodes as $k=>$v){ // $dcode[$v['uid']].=$v['dcode']." "; // } // var_dump($dcode); // exit(); //实际参加人数 $countadd = pdo_fetchcolumn("select count(*) from " . tablename('enjoy_circle_fans') . " where uniacid=" . $uniacid . ""); //$add=pdo_fetchcolumn("select count(*) from ".tablename('enjoy_circle_log')." where rid=".$rid." and uniacid=".$uniacid.""); $pager = pagination($countadd, $pindex, $psize); //粉丝总人数
/** * * initialize three arrays : $_conf, $_hosts, $_dbData * */ private static function _init($clusterName) { //initialize $_conf self::$_conf = Bd_Conf::getConf("/db/cluster/{$clusterName}"); if (self::$_conf === false || $clusterName == '') { self::$_error['errno'] = CLUSTERNAME_ERROR; self::$_error['error'] = 'Cannot find matched cluster:' . $clusterName . ' in configure file, please check'; Bd_Log::warning(self::$_error['error'], self::$_error['errno']); return false; } //initialize args which use default value $default_conf = array('retry_interval_s' => '', 'balance_strategy' => '', 'hook_before_query' => '', 'hook_after_query' => '', 'connect_timeout_s' => Intval(ceil(self::$_conf['connect_timeout_ms'] / 1000)), 'read_timeout_s' => Intval(ceil(self::$_conf['read_timeout_ms'] / 1000)), 'write_timeout_s' => Intval(ceil(self::$_conf['write_timeout_ms'] / 1000)), 'retry_times' => 1, 'charset' => ''); self::$_conf = array_merge($default_conf, self::$_conf); //init connect flag if (!array_key_exists('connect_flag', self::$_conf) || '' === self::$_conf['connect_flag']) { self::$_conf['connect_flag'] = 0; } else { $flags = explode('|', self::$_conf['connect_flag']); $res = ''; foreach ($flags as $flag) { if (NULL != ($t = constant(trim($flag)))) { $res |= $t; } else { self::$_error['errno'] = MYSQL_FLAGS_ERROR; self::$_error['error'] = 'Mysql connect flags:' . trim($flag) . ' is invalid'; Bd_Log::warning(self::$_error['error'], self::$_error['errno']); return false; } } self::$_conf['connect_flag'] = $res; } //initialize $_dbData if (self::$_conf['retry_interval_s'] !== '0' && self::$_conf['retry_interval_s'] !== '') { self::$_dbData['status_manager'] = new Bd_Db_StatusManFile(DATA_PATH . '/db/'); } $className = self::$_conf['balance_strategy'] === '' ? 'Bd_Db_RandBalancer' : self::$_conf['balance_strategy']; if (!class_exists($className)) { self::$_error['errno'] = LOAD_CLASS_ERROR; self::$_error['error'] = 'Cannot initialize balance selector, class:' . $className . 'not exists'; Bd_Log::warning(self::$_error['error'], self::$_error['errno']); return false; } self::$_dbData['host_selector'] = new $className(); //initialize $_hosts if (!array_key_exists('host', self::$_conf)) { self::$_error['errno'] = SET_HOSTS_ERROR; self::$_error['error'] = 'No host was setted for cluster:' . $clusterName . ' in configure file'; Bd_Log::warning(self::$_error['error'], self::$_error['errno']); return false; } self::$_hosts['valid_hosts'] = self::$_conf['host']; unset(self::$_hosts['failed_hosts']); if (array_key_exists('status_manager', self::$_dbData)) { foreach (self::$_hosts['valid_hosts'] as $key => $host) { $status = self::$_dbData['status_manager']->load($host['ip'], $host['port']); if (NULL !== $status && $status['last_failed_time'] + self::$_conf['retry_interval_s'] > time()) { self::$_hosts['failed_hosts'][$key]['ip'] = $host['ip']; self::$_hosts['failed_hosts'][$key]['port'] = $host['port']; self::$_hosts['failed_hosts'][$key]['status'] = $status; unset(self::$_hosts['valid_hosts'][$key]); } } } return true; }
<table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>Node</th> <th>Date</th> <th>KWH</th> <th>Cost</th> </tr> </thead> <tbody> <?php $month = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); while ($row = mysql_fetch_array($result)) { $tes = strtotime($row['datetime']); $ddt = date('m', $tes); $realdate = Intval($ddt); ?> <tr> <td><?php echo $row['sensor_id']; ?> </td> <td><?php echo $month[$realdate - 1] . " " . date('Y', $tes); ?> </td> <td><?php echo $row['kwh']; ?> </td> <td><?php
public function num2str($tt) { $tt = $tt + 0.008999999999999999; $Numero = intval($tt); $Decimales = $tt - Intval($tt); $Decimales = $Decimales * 100; $Decimales = Intval($Decimales); $x = $this->NumerosALetras($Numero); if ($Decimales > 0) { $x .= " con " . $this->NumerosALetras($Decimales); } return strtoupper($x); }