Example #1
0
	/**
	 * <p>Возвращает идентификатор сайта, определяя его по текущему хосту. Если идентификатор сайта неверный, то вернет - "false".</p>
	 *
	 *
	 *
	 *
	 * @return mixed 
	 *
	 *
	 * <h4>Example</h4> 
	 * <pre>
	 * &lt;?
	 * require($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/main/include/mainpage.php");
	 * 
	 * if($page = CMainPage::GetIncludeSitePage(<b>CMainPage::GetSiteByHost</b>()))
	 *     require_once($page);
	 * 
	 * require($_SERVER['DOCUMENT_ROOT']."/bitrix/header.php");?&gt;
	 * &lt;?require($_SERVER['DOCUMENT_ROOT']."/bitrix/footer.php");?&gt;
	 * </pre>
	 *
	 *
	 *
	 * <h4>See Also</h4> 
	 * <ul> <li> <a href="https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&amp;LESSON_ID=2833" >Список
	 * терминов</a> </li> <li> <a
	 * href="https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&amp;CHAPTER_ID=03987"
	 * >Конфигурирование многосайтовости</a> </li> </ul><a name="examples"></a>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/main/reference/cmainpage/getsitebyhost.php
	 * @author Bitrix
	 */
	public static function GetSiteByHost()
	{
		$cur_host = $_SERVER["HTTP_HOST"];
		$arURL = parse_url("http://".$cur_host);
		if($arURL["scheme"]=="" && strlen($arURL["host"])>0)
			$CURR_DOMAIN = $arURL["host"];
		else
			$CURR_DOMAIN = $cur_host;

		if(strpos($CURR_DOMAIN, ':')>0)
			$CURR_DOMAIN = substr($CURR_DOMAIN, 0, strpos($CURR_DOMAIN, ':'));
		$CURR_DOMAIN = Trim($CURR_DOMAIN, "\t\r\n\0 .");

		global $DB;
		$strSql =
			"SELECT L.LID as SITE_ID ".
			"FROM b_lang L, b_lang_domain LD ".
			"WHERE L.ACTIVE='Y' ".
			"	AND L.LID=LD.LID ".
			"	AND '".$DB->ForSql($CURR_DOMAIN, 255)."' LIKE ".$DB->Concat("'%'", "LD.DOMAIN")." ".
			"ORDER BY ".$DB->Length("LD.DOMAIN")." DESC, L.SORT";

		$res = $DB->Query($strSql);
		if($ar_res = $res->Fetch())
			return $ar_res["SITE_ID"];

		$sl = CSite::GetDefList();
		while ($slang = $sl->Fetch())
			if($slang["DEF"]=="Y")
				return $slang["SITE_ID"];

		return false;
	}
function GetReportsList($strPath2Export)
{
    $arReports = array();
    CheckDirPath($_SERVER["DOCUMENT_ROOT"] . $strPath2Export);
    if ($handle = opendir($_SERVER["DOCUMENT_ROOT"] . $strPath2Export)) {
        while (($file = readdir($handle)) !== false) {
            if ($file == "." || $file == "..") {
                continue;
            }
            if (is_file($_SERVER["DOCUMENT_ROOT"] . $strPath2Export . $file) && substr($file, strlen($file) - 8) == "_run.php") {
                $export_name = substr($file, 0, strlen($file) - 8);
                $rep_title = $export_name;
                $file_handle = fopen($_SERVER["DOCUMENT_ROOT"] . $strPath2Export . $file, "rb");
                $file_contents = fread($file_handle, 1500);
                fclose($file_handle);
                $arMatches = array();
                if (preg_match("#<title[\\s]*>([^<]*)</title[\\s]*>#i", $file_contents, $arMatches)) {
                    $arMatches[1] = Trim($arMatches[1]);
                    if (strlen($arMatches[1]) > 0) {
                        $rep_title = $arMatches[1];
                    }
                }
                $arReports[$export_name] = array("PATH" => $strPath2Export, "FILE_RUN" => $strPath2Export . $file, "TITLE" => $rep_title);
                if (file_exists($_SERVER["DOCUMENT_ROOT"] . $strPath2Export . $export_name . "_setup.php")) {
                    $arReports[$export_name]["FILE_SETUP"] = $strPath2Export . $export_name . "_setup.php";
                }
            }
        }
    }
    closedir($handle);
    return $arReports;
}
Example #3
0
 public static function CorrectNumber(&$uNumber)
 {
     $uNumber = Trim($uNumber);
     $ret =& $uNumber;
     if (substr($uNumber, 0, 3) == '%2B') {
         $ret = substr($uNumber, 3);
         $uNumber = $ret;
     }
     if (substr($uNumber, 0, 3) == '%2b') {
         $ret = substr($uNumber, 3);
         $uNumber = $ret;
     }
     if (substr($uNumber, 0, 4) == '0098') {
         $ret = substr($uNumber, 4);
         $uNumber = $ret;
     }
     if (substr($uNumber, 0, 3) == '098') {
         $ret = substr($uNumber, 3);
         $uNumber = $ret;
     }
     if (substr($uNumber, 0, 3) == '+98') {
         $ret = substr($uNumber, 3);
         $uNumber = $ret;
     }
     if (substr($uNumber, 0, 2) == '98') {
         $ret = substr($uNumber, 2);
         $uNumber = $ret;
     }
     if (substr($uNumber, 0, 1) == '0') {
         $ret = substr($uNumber, 1);
         $uNumber = $ret;
     }
     return '+98' . $ret;
 }
Example #4
0
function AuditRecords_Main($article)
{
    global $zbp;
    if (isset($_POST['AuditRecords_op'])) {
        $ar = new AuditRecords();
        $ar->LogID = $article->ID;
        $ar->AuthorID = $zbp->user->ID;
        $ar->Logs = Trim(GetVars('AuditRecords_logs', 'POST'));
        $ar->Opeate = GetVars('AuditRecords_op', 'POST');
        if (!$ar->Logs) {
            if ($ar->Opeate == -1) {
                $ar->Logs = "我有更新了,麻烦请审核一下。";
            }
            if ($ar->Opeate == 0) {
                $ar->Logs = "不想写审核意见,还是不通过。";
            }
            if ($ar->Opeate == 1) {
                $ar->Logs = "通过了通过了,真的没有意见。";
            }
        }
        $ar->PostTime = time();
        $ar->Save();
        foreach ($GLOBALS['Filter_Plugin_AuditRecords_Submit'] as $fpname => &$fpsignal) {
            $fpname($article, $ar->Opeate, $ar->Logs);
        }
    }
}
Example #5
0
 function AutoloadClassDefined($className)
 {
     $className = Trim($className);
     if (StrLen($className) <= 0) {
         return False;
     }
     $className = strtolower($className);
     return array_key_exists($className, $GLOBALS["arBitrixModuleClasses"]);
 }
Example #6
0
 function Render($AID)
 {
     $vData = $this->LoadData($AID);
     //        $this->DocTitle = Trim('№ '.$vData['case_id'].' / '.$vData['case']['last_name'].' '.$vData['case']['first_name'][0].'.'.$vData['case']['patr_name'][0].'.');
     //        $this->DocTitle = Trim($vData['case_id'].' / '.FormatShortName($vData['case']['last_name'],$vData['case']['first_name'],$vData['case']['patr_name']));
     $this->DocTitle = Trim($vData['case_id'] . ' / ' . FormatShortNameEx($vData['case']));
     $this->SetMargins(10, 10, 5);
     $this->SetAutoPageBreak(true, 30);
     $this->FirstPage($vData);
 }
Example #7
0
 /**
  * The function returns the languages parameters for region
  * @param int $ID region code
  * @param string $strLang the current language
  * @return array $res region parameters
  */
 function GetRegionLangByID($ID, $strLang = LANGUAGE_ID)
 {
     global $DB;
     $ID = IntVal($ID);
     $strLang = Trim($strLang);
     $strSql = "SELECT * " . "FROM b_sale_location_region_lang " . "WHERE REGION_ID = " . $ID . " " . " AND LID = '" . $DB->ForSql($strLang, 2) . "' ";
     $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($res = $db_res->Fetch()) {
         return $res;
     }
     return False;
 }
function ValidarUserSession()
{
    if (!isset($_SESSION["isAbogado"]) and !isset($_SESSION["idUsuario"])) {
        //validarSesion(false);
        echo "<script src=\"/js/functions.js?rnd=" . RandomNumber() . "\" type=\"text/javascript\"></script>";
        echo "<script>if (!isTopLevel(window)) alert('Se sesión ha expirado.\\nPor favor logueese nuevamente para continuar.');</script>";
        echo "<span id=\"sesionInvalidData\">" . $_SERVER["REMOTE_ADDR"] . " (" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . ")</span><br />";
        echo "<span id=\"sesionInvalidMsg\"> " . Trim("Ha expirado la sesión, por favor ingrese nuevamente sus datos.");
        exit;
    }
    ValidarJS();
}
Example #9
0
 public static function friendly_url($text)
 {
     $friendlyurl = Str_Replace(' ', '-', AddSlashes($text));
     $tbl = array("á" => "a", "ä" => "a", "č" => "c", "ď" => "d", "é" => "e", "ě" => "e", "í" => "i", "ľ" => "l", "ĺ" => "l", "ň" => "n", "ó" => "o", "ö" => "o", "ő" => "o", "ô" => "o", "ř" => "r", "ŕ" => "r", "š" => "s", "ť" => "t", "ú" => "u", "ů" => "u", "ü" => "u", "ű" => "u", "ý" => "y", "ž" => "z", "Á" => "A", "Ä" => "A", "Č" => "C", "Ď" => "D", "É" => "E", "Ě" => "E", "Í" => "I", "Ľ" => "L", "Ĺ" => "L", "Ň" => "N", "Ó" => "O", "Ö" => "O", "Ő" => "O", "Ô" => "O", "Ř" => "R", "Ŕ" => "R", "Š" => "S", "Ť" => "T", "Ú" => "U", "Ů" => "U", "Ü" => "U", "Ű" => "U", "Ý" => "Y", "Ž" => "Z", "'" => "", ",-" => "kc");
     $url = StrTr($friendlyurl, $tbl);
     $text = StrTr($url, "ÁÄČÇĎÉĚËÍŇÓÖŘŠŤÚŮÜÝŽáäčçďéěëíňóöřšťúůüýž", "AACCDEEEINOORSTUUUYZaaccdeeeinoorstuuuyz");
     // somehow I wasnt able to add following characters to previous StrTr strings:
     $text = StrTr($text, "& .,?!_+", "--------");
     //$text = Preg_Replace ("/[^[:alpha:][:digit:]]/", "-", $text);
     $text = Trim($text, "-");
     $text = Preg_Replace("/[-]+/", "-", $text);
     return strtolower($text);
 }
Example #10
0
 public function disconnect()
 {
     if ($this->mbox) {
         $this->expungeDeletedMessages();
         $errors = imap_errors();
         if ($errors) {
             foreach ($errors as $error) {
                 #trigger_error($error);
                 Debug(SPrintF('[system/classes/ImapMailbox]: %s', Trim($error)));
             }
         }
         imap_close($this->mbox);
         $this->mbox = null;
     }
 }
Example #11
0
 function Request($server, $page, $port, $params, $uri = false)
 {
     if ($uri && strlen($uri) > 0) {
         $strURI = $uri;
     } else {
         $strURI = "http://" . $server . (strlen($port) > 0 && intval($port) > 0 ? ":" . intval($port) : "") . (strlen($page) ? $page : "/") . (strlen($params) > 0 ? "?" . $params : "");
     }
     $http = new \Bitrix\Main\Web\HttpClient(array("version" => "1.0", "socketTimeout" => 30, "streamTimeout" => 30, "redirect" => true, "redirectMax" => 5));
     $strData = $http->get($strURI);
     $errors = $http->getError();
     $arRSSResult = array();
     if (!$strData && !empty($errors)) {
         $strError = "";
         foreach ($errors as $errorCode => $errMes) {
             $strError .= $errorCode . ": " . $errMes;
         }
         \CEventLog::Add(array("SEVERITY" => "ERROR", "AUDIT_TYPE_ID" => "XDIMPORT_HTTP", "MODULE_ID" => "xdimport", "ITEM_ID" => "RSS_REQUEST", "DESCRIPTION" => $strError));
     }
     if ($strData) {
         $rss_charset = "windows-1251";
         if (preg_match("/<" . "\\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\\?" . ">/i", $strData, $matches)) {
             $rss_charset = Trim($matches[1]);
         }
         $strData = preg_replace("/<" . "\\?XML.*?\\?" . ">/i", "", $strData);
         $strData = $GLOBALS["APPLICATION"]->ConvertCharset($strData, $rss_charset, SITE_CHARSET);
     }
     if (strlen($strData) > 0) {
         require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
         $objXML = new CDataXML();
         $res = $objXML->LoadString($strData);
         if ($res !== false) {
             $ar = $objXML->GetArray();
             if (is_array($ar) && isset($ar["rss"]) && is_array($ar["rss"]) && isset($ar["rss"]["#"]) && is_array($ar["rss"]["#"]) && isset($ar["rss"]["#"]["channel"]) && is_array($ar["rss"]["#"]["channel"]) && isset($ar["rss"]["#"]["channel"][0]) && is_array($ar["rss"]["#"]["channel"][0]) && isset($ar["rss"]["#"]["channel"][0]["#"])) {
                 $arRSSResult = $ar["rss"]["#"]["channel"][0]["#"];
             } else {
                 $arRSSResult = array();
             }
             $arRSSResult["rss_charset"] = strtolower(SITE_CHARSET);
         }
     }
     if (is_array($arRSSResult) && !empty($arRSSResult)) {
         $arRSSResult = CXDILFSchemeRSS::FormatArray($arRSSResult);
         if (!empty($arRSSResult) && array_key_exists("item", $arRSSResult) && is_array($arRSSResult["item"]) && !empty($arRSSResult["item"])) {
             $arRSSResult["item"] = array_reverse($arRSSResult["item"]);
         }
     }
     return $arRSSResult;
 }
Example #12
0
 function RGBToHex($colorR, $colorG, $colorB)
 {
     $colorR = Trim($colorR);
     $colorG = Trim($colorG);
     $colorB = Trim($colorB);
     //	Calculate every single letter-number
     $a = $this->_convertToHex(floor($colorR / 16));
     $b = $this->_convertToHex($colorR % 16);
     $c = $this->_convertToHex(floor($colorG / 16));
     $d = $this->_convertToHex($colorG % 16);
     $e = $this->_convertToHex(floor($colorB / 16));
     $f = $this->_convertToHex($colorB % 16);
     //	Build the Hexa Code
     $color = $a . $b . $c . $d . $e . $f;
     return $color;
 }
Example #13
0
	static function RequireAutoloadClass($className)
	{
		$className = Trim($className);
		if (StrLen($className) <= 0)
			return False;

		$className = strtolower($className);

		if (array_key_exists($className, $GLOBALS["arBitrixModuleClasses"]))
		{
			require_once($_SERVER["DOCUMENT_ROOT"].((StrLen($GLOBALS["arBitrixModuleClasses"][$className]["module"]) > 0) ? BX_ROOT."/modules/".$GLOBALS["arBitrixModuleClasses"][$className]["module"]."/" : "").$GLOBALS["arBitrixModuleClasses"][$className]["file"]);
			return True;
		}

		return False;
	}
Example #14
0
 function CheckAccess($userID, $itemMD5, $periodLength, $periodType)
 {
     global $DB;
     $userID = IntVal($userID);
     if ($userID <= 0) {
         return false;
     }
     $itemMD5 = Trim($itemMD5);
     if (strlen($itemMD5) <= 0) {
         return false;
     }
     $periodLength = IntVal($periodLength);
     if ($periodLength <= 0) {
         return False;
     }
     $periodType = Trim($periodType);
     $periodType = ToUpper($periodType);
     if (strlen($periodType) <= 0) {
         return False;
     }
     $checkVal = 0;
     if ($periodType == "I") {
         $checkVal = mktime(date("H"), date("i") - $periodLength, date("s"), date("m"), date("d"), date("Y"));
     } elseif ($periodType == "H") {
         $checkVal = mktime(date("H") - $periodLength, date("i"), date("s"), date("m"), date("d"), date("Y"));
     } elseif ($periodType == "D") {
         $checkVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") - $periodLength, date("Y"));
     } elseif ($periodType == "W") {
         $checkVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") - 7 * $periodLength, date("Y"));
     } elseif ($periodType == "M") {
         $checkVal = mktime(date("H"), date("i"), date("s"), date("m") - $periodLength, date("d"), date("Y"));
     } elseif ($periodType == "Q") {
         $checkVal = mktime(date("H"), date("i"), date("s"), date("m") - 3 * $periodLength, date("d"), date("Y"));
     } elseif ($periodType == "S") {
         $checkVal = mktime(date("H"), date("i"), date("s"), date("m") - 6 * $periodLength, date("d"), date("Y"));
     } elseif ($periodType == "Y") {
         $checkVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") - $periodLength);
     }
     if ($checkVal <= 0) {
         return False;
     }
     $dbAuxiliary = CSaleAuxiliary::GetList(array(), array("USER_ID" => $userID, "ITEM_MD5" => $itemMD5, ">=DATE_INSERT" => Date($GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), $checkVal)), false, false, array("*"));
     if ($arAuxiliary = $dbAuxiliary->Fetch()) {
         return $arAuxiliary;
     }
     return false;
 }
 function Update($ID, $arFields)
 {
     global $DB;
     $ID = intval($ID);
     if ($ID <= 0) {
         return false;
     }
     if (!CCatalogProductGroups::CheckFields("UPDATE", $arFields, $ID)) {
         return False;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_product2group", $arFields);
     $strUpdate = Trim($strUpdate);
     if (StrLen($strUpdate) > 0) {
         $strSql = "UPDATE b_catalog_product2group SET " . $strUpdate . " WHERE ID = " . $ID . " ";
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $ID;
 }
Example #16
0
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     global $EVT_DefLabels, $EVT_CalenderSettingNames, $EVT_ServerSettingNames, $EVT_QuerySettingNames, $EVT_DefValues;
     $wg_atts = $args;
     foreach ($instance as $key => $value) {
         $wg_atts[$key] = Trim(empty($instance[$key]) ? $EVT_DefValues[$key] : $instance[$key]);
     }
     $wg_atts['title'] = apply_filters('widget_title', $wg_atts['title']);
     if ($wg_atts['script'] == '') {
         $wg_atts['script'] = 'xml.php';
     }
     $termine = postprocess_xml(evt_getevents($wg_atts, $EVT_QuerySettingNames), 'widget');
     echo $before_widget;
     if ($wg_atts['title']) {
         echo $before_title . $wg_atts['title'] . $after_title;
     }
     echo $termine;
     // Hier ist der richtige Patz um den erzeugten HTML Code auszugeben.
     echo "<p style=\"font-size: x-small;\">Powered by Evangelische Termine Plugin - &copy Thomas Arend, Rheinbach</p>";
     echo $after_widget;
 }
Example #17
0
 public static function SearchUsers($searchString, $groupId = 0, $numberOfUsers = 10)
 {
     global $DB;
     $searchString = Trim($searchString);
     //if (StrLen($searchString) <= 0)
     //	return false;
     $groupId = IntVal($groupId);
     $numberOfUsers = IntVal($numberOfUsers);
     if ($numberOfUsers <= 0) {
         $numberOfUsers = 10;
     }
     $searchPattern = "'" . $DB->ForSql($searchString) . "%'";
     $strSqlFrom = "";
     $strSqlWhere = "";
     if ($groupId > 0) {
         $strSqlFrom = " INNER JOIN b_sonet_user2group UG ON (U.ID = UG.USER_ID AND UG.ROLE <= '" . $DB->ForSql(SONET_ROLES_USER) . "') ";
         $strSqlWhere = " AND UG.GROUP_ID = " . $groupId . " ";
     }
     $strSql = "SELECT U.ID, U.LOGIN, U.EMAIL, U.NAME, U.SECOND_NAME, U.LAST_NAME " . "FROM b_user U " . $strSqlFrom . " " . "WHERE (upper(U.NAME) LIKE upper(" . $searchPattern . ") " . "\tOR upper(U.LAST_NAME) LIKE upper(" . $searchPattern . ") " . "\tOR upper(U.SECOND_NAME) LIKE upper(" . $searchPattern . ") " . "\tOR upper(U.EMAIL) LIKE upper(" . $searchPattern . ") " . "\tOR upper(U.LOGIN) LIKE upper(" . $searchPattern . ")) AND ACTIVE = 'Y' " . $strSqlWhere . " " . "ORDER BY U.LAST_NAME ASC, U.NAME ASC, U.SECOND_NAME ASC " . "LIMIT 0, " . $numberOfUsers . "";
     return $DB->Query($strSql, false, "Function CSocNetUser::SearchUsers: " . __LINE__);
 }
Example #18
0
function TemplateReplace($Text, $Params = array(), $NoBody = TRUE)
{
    #-------------------------------------------------------------------------------
    $Text = Trim($Text);
    #-------------------------------------------------------------------------------
    # проверяем что нам сунули - текст или файл
    if (!Preg_Match('/\\s/', $Text)) {
        #-------------------------------------------------------------------------------
        # достаём текст из файла
        $Path = System_Element(SPrintF('templates/modules/%s.html', $Text));
        #-------------------------------------------------------------------------------
        if (Is_Error($Path)) {
            #-------------------------------------------------------------------------------
            $Text = SprintF('Отсутствует шаблон сообщения (templates/modules/%s.html)', $Text);
            #-------------------------------------------------------------------------------
        } else {
            #-------------------------------------------------------------------------------
            $Text = Trim(IO_Read($Path));
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    if ($NoBody) {
        $Text = SPrintF('<NOBODY><SPAN>%s</SPAN></NOBODY>', $Text);
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Replace = Array_ToLine($Params, '%');
    #-------------------------------------------------------------------------------
    foreach (Array_Keys($Replace) as $Key) {
        $Text = Str_Replace($Key, $Replace[$Key], $Text);
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return $Text;
    #-------------------------------------------------------------------------------
}
 public function SEPARARAPELLIDOS_2eraParte($rng)
 {
     $nombreArr = array();
     $nuevaCadena = '';
     $capturarNombre = False;
     $i;
     //'Dvidir el nombre por palabras en un arreglo
     //nombreArr = Split(Trim(rng.Value))
     $nombreArr = explode(' ', Trim($rng));
     //'Analizar cada palabra dentro del arreglo
     for ($i = 0; $i < count($nombreArr); $i++) {
         switch (strtolower($nombreArr[$i])) {
             case "de":
             case "del":
             case "la":
             case "las":
             case "los":
             case "san":
                 if ($capturarNombre == True) {
                     $nuevaCadena = $nuevaCadena . $nombreArr[$i] . " ";
                 }
                 break;
             default:
                 if ($capturarNombre == False) {
                     $capturarNombre = True;
                 } else {
                     $nuevaCadena = $nuevaCadena . $nombreArr[$i];
                     break 2;
                 }
         }
         //end switch
     }
     //end for
     return $nuevaCadena;
     //self::SEPARARAPELLIDOS_2eraParte(nuevaCadena);
 }
Example #20
0
 function GetByUserID($userID, $currency)
 {
     global $DB;
     $userID = IntVal($userID);
     if ($userID <= 0) {
         return false;
     }
     $currency = Trim($currency);
     $currency = preg_replace("#[\\W]+#", "", $currency);
     if (strlen($currency) <= 0) {
         return false;
     }
     if (isset($GLOBALS["SALE_USER_ACCOUNT"]["SALE_USER_ACCOUNT_CACHE_" . $userID . "_" . $currency]) && is_array($GLOBALS["SALE_USER_ACCOUNT"]["SALE_USER_ACCOUNT_CACHE_" . $userID . "_" . $currency]) && is_set($GLOBALS["SALE_USER_ACCOUNT"]["SALE_USER_ACCOUNT_CACHE_" . $userID . "_" . $currency], "ID")) {
         return $GLOBALS["SALE_USER_ACCOUNT"]["SALE_USER_ACCOUNT_CACHE_" . $userID . "_" . $currency];
     } else {
         $strSql = "SELECT UA.ID, UA.USER_ID, UA.CURRENT_BUDGET, UA.CURRENCY, UA.NOTES, UA.LOCKED, " . "\t" . $DB->DateToCharFunction("UA.TIMESTAMP_X", "FULL") . " as TIMESTAMP_X, " . "\t" . $DB->DateToCharFunction("UA.DATE_LOCKED", "FULL") . " as DATE_LOCKED " . "FROM b_sale_user_account UA " . "WHERE UA.USER_ID = " . $userID . " " . "\tAND UA.CURRENCY = '" . $DB->ForSql($currency) . "' ";
         $dbUserAccount = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arUserAccount = $dbUserAccount->Fetch()) {
             $GLOBALS["SALE_USER_ACCOUNT"]["SALE_USER_ACCOUNT_CACHE_" . $userID . "_" . $currency] = $arUserAccount;
             return $arUserAccount;
         }
     }
     return false;
 }
Example #21
0
 }
 $filter_date_from = $_REQUEST["filter_date_from"];
 $filter_date_to = $_REQUEST["filter_date_to"];
 if (StrLen($filter_date_from) <= 0 && StrLen($filter_date_to) <= 0) {
     $filter_date_from = date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), mktime(0, 0, 0, date("m") - 3, 1, date("Y")));
     $filter_date_to = date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
 }
 $arResult["FILTER"] = array("filter_date_from" => $filter_date_from, "filter_date_to" => $filter_date_to);
 $arResult["CURRENT_PAGE_PARAM"] = $APPLICATION->GetCurPageParam("", array("filter_date_from", "filter_date_to"));
 $arResult["CURRENT_PAGE"] = $APPLICATION->GetCurPage();
 $arFilter = array("=AFFILIATE_ID" => $arAffiliate["ID"], "=ALLOW_DELIVERY" => "Y", "=CANCELED" => "N", "=LID" => SITE_ID);
 if (StrLen($filter_date_from) > 0) {
     $arFilter[">=DATE_ALLOW_DELIVERY"] = Trim($filter_date_from);
 }
 if (StrLen($filter_date_to) > 0) {
     $arFilter["<=DATE_ALLOW_DELIVERY"] = Trim($filter_date_to);
 }
 $dbItemsList = \Bitrix\Sale\Internals\OrderTable::getList(array('filter' => $arFilter, 'select' => array("BASKET_NAME" => 'BASKET.NAME', "BASKET_PRODUCT_ID" => 'BASKET.PRODUCT_ID', "BASKET_MODULE" => 'BASKET.MODULE', "BASKET_PRICE" => 'BASKET.PRICE', "BASKET_CURRENCY" => 'BASKET.CURRENCY', "BASKET_DISCOUNT_PRICE" => 'BASKET.DISCOUNT_PRICE', 'BASKET_QUANTITY' => 'SUM_BASKET_QUANTITY'), 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('SUM_BASKET_QUANTITY', 'SUM(%s)', array('BASKET.QUANTITY'))), 'order' => array("BASKET.MODULE" => "ASC", "BASKET.NAME" => "ASC", "BASKET.PRODUCT_ID" => "ASC"), 'group' => array("BASKET.MODULE", "BASKET.PRODUCT_ID", "BASKET.NAME", "BASKET.PRICE", "BASKET.CURRENCY", "BASKET.DISCOUNT_PRICE")));
 $arResult["ROWS"] = False;
 if ($arItemsList = $dbItemsList->Fetch()) {
     $affiliateCurrency = CSaleLang::GetLangCurrency(SITE_ID);
     $currentBasketModule = $arItemsList["BASKET_MODULE"];
     $currentBasketProductID = $arItemsList["BASKET_PRODUCT_ID"];
     $currentBasketName = $arItemsList["BASKET_NAME"];
     $currentQuantity = 0;
     $currentSum = 0;
     $totalQuantity = 0;
     $totalSum = 0;
     $arResult["ROWS"] = array();
     do {
         if ($currentBasketModule != $arItemsList["BASKET_MODULE"] || $currentBasketProductID != $arItemsList["BASKET_PRODUCT_ID"] || $currentBasketName != $arItemsList["BASKET_NAME"]) {
Example #22
0
	function GetNews($ID, $LANG, $TYPE, $SITE, $PORT, $PATH, $LIMIT = 0)
	{
		if (IntVal($ID)>0)
		{
			$ID = IntVal($ID);
		}
		else
		{
			$ID = Trim($ID);
		}
		$LANG = Trim($LANG);
		$TYPE = Trim($TYPE);
		$LIMIT = IntVal($LIMIT);

		return CIBlockRSS::GetNewsEx($SITE, $PORT, $PATH, "ID=".$ID."&LANG=".$LANG."&TYPE=".$TYPE."&LIMIT=".$LIMIT);
	}
Example #23
0
<table border="0" width="100%" cellpadding="2" cellspacing="2">
	<tr>
	<td class="but2" align="center">
		<?php 
//***************************************************
//***  START ACTION  ********************************
//***************************************************
$strErrorTmp = "";
$bNonePay = True;
if (strlen($_POST["GetPayRes"]) > 0) {
    $cardnum = htmlspecialcharsbx(Trim($_POST["cardnum"]));
    $cardnum = preg_replace("#[\\D]#i", "", $cardnum);
    if (strlen($cardnum) <= 0) {
        $strErrorTmp .= "Please fill in \"Credit Card Number\" field. ";
    }
    $cvv2 = htmlspecialcharsbx(Trim($_POST["cvv2"]));
    if (strlen($cvv2) <= 0) {
        $strErrorTmp .= "Please fill in \"CVV2\" field. ";
    }
    $cardexp1 = IntVal(htmlspecialcharsbx($_POST["cardexp1"]));
    $cardexp2 = IntVal(htmlspecialcharsbx($_POST["cardexp2"]));
    if ($cardexp1 < 1 || $cardexp1 > 12) {
        $strErrorTmp .= "Please fill in \"Expiration Date\" field. ";
    } elseif ($cardexp2 < 4 || $cardexp2 > 99) {
        $strErrorTmp .= "Please fill in \"Expiration Date\" field. ";
    } else {
        $cardexp1 = strlen($cardexp1) < 2 ? "0" . $cardexp1 : $cardexp1;
        $cardexp2 = strlen($cardexp2) < 2 ? "0" . $cardexp2 : $cardexp2;
    }
    $noc = htmlspecialcharsbx(trim($_POST["noc"]));
    if (strlen($noc) <= 0) {
Example #24
0
 }
 $cardexp2 = IntVal($_REQUEST["cardexp2"]);
 if ($cardexp2 < 5 || $cardexp2 > 50) {
     $strPaySysError .= "Please enter valid credit card expiration year" . ". ";
 } elseif (strlen($cardexp2) < 2) {
     $cardexp2 = "0" . $cardexp2;
 }
 $noc = Trim($_REQUEST["noc"]);
 if (strlen($noc) <= 0) {
     $strPaySysError .= "Please enter valid cardholder name" . ". ";
 }
 $address1 = Trim($_REQUEST["address1"]);
 if (strlen($address1) <= 0) {
     $strPaySysError .= "Please enter valid cardholder address" . ". ";
 }
 $zipcode = Trim($_REQUEST["zipcode"]);
 if (strlen($zipcode) <= 0) {
     $strPaySysError .= "Please enter valid cardholder zip" . ". ";
 }
 if (strlen($strPaySysError) <= 0) {
     $ret_var = "";
     $AMT = $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"];
     if ($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"] != "USD") {
         $AMT = CCurrencyRates::ConvertCurrency($AMT, $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], "USD");
         $additor = 1;
         for ($i = 0; $i < SALE_VALUE_PRECISION; $i++) {
             $additor = $additor / 10;
         }
         $AMT_tmp = round($AMT, SALE_VALUE_PRECISION);
         while ($AMT_tmp < $AMT) {
             $AMT_tmp = round($AMT_tmp + $additor, SALE_VALUE_PRECISION);
Example #25
0
<?php

session_start();
$username = isset($HTTP_POST_VARS['username']) ? Trim($HTTP_POST_VARS['username']) : "";
$password = isset($HTTP_POST_VARS['password']) ? Trim($HTTP_POST_VARS['password']) : "";
$user_type = isset($HTTP_POST_VARS['usertype']) ? Trim($HTTP_POST_VARS['usertype']) : "";
$securityno = isset($HTTP_POST_VARS['securitycode']) ? Trim($HTTP_POST_VARS['securitycode']) : "";
$securityno_original = isset($HTTP_POST_VARS['securitycode_original']) ? Trim($HTTP_POST_VARS['securitycode_original']) : "";
$invalidlogin = "";
$activitytype = "";
if ($password != "" && $username != "" && $securityno != "" && $securityno_original != "" && $securityno_original == $securityno) {
    require_once "includes/dbconnection.php";
    $username = strtolower($username);
    if ($username == "admin") {
        $show_sql = mysql_query("select username  from cs_login where username='******' and binary password = '******'", $cnn_cs);
        if (mysql_num_rows($show_sql) > 0) {
            session_register("sessionAdmin");
            session_register("sessionAdminLogged");
            $_SESSION["sessionAdminLogged"] = "InAdmin";
            $_SESSION["sessionAdmin"] = "yes";
            header("location:admin/blank.php");
            exit;
        } else {
            header("location:index.php");
            $invalidlogin = "******";
        }
    } else {
        if ($username == "service") {
            $show_sql = mysql_query("select username  from cs_login where username='******' and binary password = '******'", $cnn_cs);
            if ($show_val = mysql_fetch_array($show_sql)) {
                session_register("sessionService");
include "admin/includes/mailbody_replytemplate.php";
//for getting the reply mail content
$user_reference_num = "";
$company = isset($HTTP_POST_VARS['gateway']) ? Trim($HTTP_POST_VARS['gateway']) : "";
$username = isset($HTTP_POST_VARS['username']) ? Trim($HTTP_POST_VARS['username']) : "";
$password = isset($HTTP_POST_VARS['password']) ? Trim($HTTP_POST_VARS['password']) : "";
$companyname = isset($HTTP_POST_VARS['companyname']) ? Trim($HTTP_POST_VARS['companyname']) : "";
$email = isset($HTTP_POST_VARS['email']) ? Trim($HTTP_POST_VARS['email']) : "";
$gatewayid = isset($HTTP_POST_VARS['gatewayid']) ? Trim($HTTP_POST_VARS['gatewayid']) : "";
//$username = str_replace("'","",$username);
//$password = str_replace("'","",$password);
//$companyname = str_replace("'","",$companyname);
$transaction_type = isset($HTTP_POST_VARS['rad_order_type']) ? Trim($HTTP_POST_VARS['rad_order_type']) : "";
$how_about_us = isset($HTTP_POST_VARS['how_about_us']) ? Trim($HTTP_POST_VARS['how_about_us']) : "";
$voulmeNumber = isset($HTTP_POST_VARS['merchant_voulme']) ? Trim($HTTP_POST_VARS['merchant_voulme']) : "";
$reseller = isset($HTTP_POST_VARS['reseller']) ? Trim($HTTP_POST_VARS['reseller']) : "";
$msgtodisplay = "";
if ($transaction_type == "tele") {
    $send_ecommercemail = 0;
} else {
    $send_ecommercemail = 1;
}
$qry_select1 = "Select companyname,email ,url1  from cs_companydetails where userid='{$gatewayid}'";
$rst_select1 = mysql_query($qry_select1, $cnn_cs);
$rst_result1 = mysql_fetch_array($rst_select1);
$companyname1 = $rst_result1['companyname'];
$email1 = $rst_result1['email'];
$url1 = $rst_result1['url1'];
$current_date_time = func_get_current_date_time();
$user_nameexist = 0;
if ($company) {
Example #27
0
 if ($dir == $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/reports/") {
     if (is_file($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/reports/" . $file)) {
         $file_contents = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/reports/" . $file);
     }
 }
 if (empty($file_contents)) {
     $file_contents = file_get_contents($dir . $file);
 }
 $rep_langs = "";
 $arMatches = array();
 if (preg_match("#<title([\\s]+langs[\\s]*=[\\s]*\"([^\"]*)\"|)[\\s]*>([^<]*)</title[\\s]*>#i", $file_contents, $arMatches)) {
     $arMatches[3] = Trim($arMatches[3]);
     if (strlen($arMatches[3]) > 0) {
         $rep_title = $arMatches[3];
     }
     $arMatches[2] = Trim($arMatches[2]);
     if (strlen($arMatches[2]) > 0) {
         $rep_langs = $arMatches[2];
     }
 }
 if (strlen($rep_langs) > 0) {
     $bContinue = true;
     foreach ($arSysLangs as $sysLang) {
         if (strpos($rep_langs, $sysLang) !== false) {
             $bContinue = false;
             break;
         }
     }
     if ($bContinue) {
         continue;
     }
Example #28
0
 function GetMessagesForChat($currentUserID, $userID, $date = false, $arNavStartParams = false, $replyMessId = false)
 {
     global $DB;
     $currentUserID = IntVal($currentUserID);
     if ($currentUserID <= 0) {
         return false;
     }
     $userID = IntVal($userID);
     if ($date !== false) {
         $date = Trim($date);
         if (StrLen($date) <= 0) {
             return false;
         }
         if (!preg_match("#\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d#i", $date)) {
             return false;
         }
     }
     $replyMessId = intval($replyMessId);
     //time zone
     $diff = false;
     if (CTimeZone::Enabled()) {
         $diff = CTimeZone::GetOffset();
     }
     if ($diff !== false && $diff != 0) {
         $sDateFmt = "DATE_FORMAT(DATE_ADD(DATE_CREATE, INTERVAL " . $diff . " SECOND), '%Y-%m-%d %H:%i:%s') as DATE_CREATE_FMT, ";
     } else {
         $sDateFmt = "DATE_FORMAT(DATE_CREATE, '%Y-%m-%d %H:%i:%s') as DATE_CREATE_FMT, ";
     }
     $strSql = "SELECT 'IN' as WHO, ID, FROM_USER_ID as USER_ID, TITLE, MESSAGE, DATE_VIEW as DATE_VIEW, DATE_CREATE, " . "\t" . $sDateFmt . "\t" . $DB->DateToCharFunction("DATE_CREATE", "FULL") . " as DATE_CREATE_FORMAT " . "FROM b_sonet_messages " . "WHERE TO_USER_ID = " . $currentUserID . " " . ($userID > 0 ? "\tAND FROM_USER_ID = " . $userID . " " : "") . "\tAND TO_DELETED = 'N' " . "\tAND (IS_LOG IS NULL OR NOT IS_LOG = 'Y') " . ($date !== false && $replyMessId <= 0 ? " AND MESSAGE_TYPE = 'P' AND DATE_CREATE > '" . $DB->ForSql($date) . "' " : "") . ($replyMessId > 0 ? " AND MESSAGE_TYPE = 'P' AND ID >= '" . $replyMessId . "' " : "") . "UNION ALL " . "SELECT 'OUT' as WHO, ID, TO_USER_ID as USER_ID, TITLE, MESSAGE, DATE_CREATE as DATE_VIEW, DATE_CREATE, " . "\t" . $sDateFmt . "\t" . $DB->DateToCharFunction("DATE_CREATE", "FULL") . " as DATE_CREATE_FORMAT " . "FROM b_sonet_messages " . "WHERE FROM_USER_ID = " . $currentUserID . " " . ($userID > 0 ? "\tAND TO_USER_ID = " . $userID . " " : "") . "\tAND FROM_DELETED = 'N' " . "\tAND (IS_LOG IS NULL OR NOT IS_LOG = 'Y') " . ($date !== false && $replyMessId <= 0 ? " AND MESSAGE_TYPE = 'P' AND DATE_CREATE > '" . $DB->ForSql($date) . "' " : "") . ($replyMessId > 0 ? " AND MESSAGE_TYPE = 'P' AND ID >= '" . $replyMessId . "' " : "") . "ORDER BY DATE_CREATE " . ($date !== false ? "ASC" : "DESC") . " ";
     if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) <= 0) {
         $strSql_tmp = "SELECT COUNT(M.ID) as CNT " . "FROM b_sonet_messages M " . "WHERE (M.TO_USER_ID = " . $currentUserID . " " . ($userID > 0 ? "\tAND M.FROM_USER_ID = " . $userID . " " : "") . "\tAND M.TO_DELETED = 'N' " . "\tOR " . "\tM.FROM_USER_ID = " . $currentUserID . " " . ($userID > 0 ? "\tAND M.TO_USER_ID = " . $userID . " " : "") . "\tAND M.FROM_DELETED = 'N') " . "\tAND (IS_LOG IS NULL OR NOT IS_LOG = 'Y') " . ($date !== false || $replyMessId > 0 ? " AND M.MESSAGE_TYPE = 'P' " : "");
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if ($arRes = $dbRes->Fetch()) {
             $cnt = $arRes["CNT"];
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . IntVal($arNavStartParams["nTopCount"]);
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
Example #29
0
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("blog")) {
    ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL"));
    return;
}
$arParams["MESSAGE_COUNT"] = IntVal($arParams["MESSAGE_COUNT"]) > 0 ? IntVal($arParams["MESSAGE_COUNT"]) : 6;
$arParams["PREVIEW_WIDTH"] = IntVal($arParams["PREVIEW_WIDTH"]) > 0 ? IntVal($arParams["PREVIEW_WIDTH"]) : 100;
$arParams["PREVIEW_HEIGHT"] = IntVal($arParams["PREVIEW_HEIGHT"]) > 0 ? IntVal($arParams["PREVIEW_HEIGHT"]) : 100;
$arParams["SORT_BY1"] = strlen($arParams["SORT_BY1"]) > 0 ? $arParams["SORT_BY1"] : "DATE_PUBLISH";
$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["MESSAGE_LENGTH"] = IntVal($arParams["MESSAGE_LENGTH"]) > 0 ? $arParams["MESSAGE_LENGTH"] : 100;
$arParams["BLOG_URL"] = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($arParams["BLOG_URL"]));
$arParams["USE_SOCNET"] = $arParams["USE_SOCNET"] == "Y" ? "Y" : "N";
// activation rating
CRatingsComponentsMain::GetShowRating($arParams);
CpageOption::SetOptionString("main", "nav_page_in_session", "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]);
    }
}
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 {
Example #30
0
<?php

$EmailFrom = "*****@*****.**";
$EmailTo = "*****@*****.**";
$Subject = "By day I want to...";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK = true;
if (!$validationOK) {
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <{$EmailFrom}>");