function Get_Fancy_Images($orderby = 'ID', $order = 'ASC', $limit = -1)
     {
         global $wpdb;
         // Check Parameters
         if (!$orderby) {
             $orderby = 'ID';
         }
         if (!In_Array($order, array('ASC', 'DESC', 'RAND'))) {
             $order = 'ASC';
         }
         $limit = IntVal($limit);
         // Build Statement
         $stmt = '
 SELECT attachment.*, gallery.ID gallery_id
 FROM   ' . $wpdb->posts . ' attachment, ' . $wpdb->posts . ' gallery
 WHERE  attachment.post_type = "attachment"
 AND    attachment.post_mime_type LIKE "image/%"
 AND    gallery.post_type = "' . $this->fancy_gallery->gallery_post_type . '"
 AND    attachment.post_parent = gallery.ID
 GROUP BY attachment.ID ';
         if ($order == 'RAND') {
             $stmt .= 'ORDER BY RAND() ';
         } else {
             $stmt .= 'ORDER BY attachment.' . $orderby . ' ' . $order . ' ';
         }
         if ($limit > 0) {
             $stmt .= 'LIMIT ' . $limit;
         }
         return $wpdb->Get_Results($stmt);
     }
Beispiel #2
0
 public static function ValidateLogin(&$ErrorMessage, $SelfURL)
 {
     $Mode = Filter_Input(INPUT_GET, 'openid_mode', FILTER_SANITIZE_SPECIAL_CHARS);
     if ($Mode === 'error') {
         $ErrorMessage = Filter_Input(INPUT_GET, 'openid_error', FILTER_SANITIZE_STRING);
         if (empty($ErrorMessage)) {
             $ErrorMessage = 'Something went wrong.';
         }
         return false;
     } else {
         if ($Mode !== 'id_res') {
             $ErrorMessage = 'Invalid OpenID mode.';
             return false;
         }
     }
     // See http://openid.net/specs/openid-authentication-2_0.html#positive_assertions
     $Arguments = Filter_Input_Array(INPUT_GET, array('openid_ns' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '/^http:\\/\\/specs\\.openid\\.net\\/auth\\/2\\.0$/')), 'openid_op_endpoint' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '/^' . Preg_Quote(self::STEAM_LOGIN, '/') . '$/')), 'openid_claimed_id' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '/^https?:\\/\\/steamcommunity.com\\/openid\\/id\\/(7656119[0-9]{10})\\/?$/')), 'openid_identity' => FILTER_SANITIZE_URL, 'openid_return_to' => FILTER_SANITIZE_URL, 'openid_response_nonce' => FILTER_SANITIZE_STRING, 'openid_assoc_handle' => FILTER_SANITIZE_SPECIAL_CHARS, 'openid_signed' => FILTER_SANITIZE_SPECIAL_CHARS, 'openid_sig' => FILTER_SANITIZE_SPECIAL_CHARS));
     if (!Is_Array($Arguments)) {
         $ErrorMessage = 'Invalid arguments.';
         return false;
     } else {
         if (In_Array(null || false, $Arguments)) {
             $ErrorMessage = 'One of the arguments is invalid and/or missing.';
             return false;
         } else {
             if ($Arguments['openid_claimed_id'] !== $Arguments['openid_identity']) {
                 $ErrorMessage = 'Claimed id must match your identity.';
                 return false;
             } else {
                 if (strpos($Arguments['openid_return_to'], $SelfURL) !== 0) {
                     $ErrorMessage = 'Invalid return uri.';
                     return false;
                 }
             }
         }
     }
     if (Preg_Match('/^https?:\\/\\/steamcommunity.com\\/openid\\/id\\/(7656119[0-9]{10})\\/?$/', $Arguments['openid_identity'], $CommunityID) === 1) {
         $CommunityID = $CommunityID[1];
     } else {
         $ErrorMessage = 'Failed to find your CommunityID. If this issue persists, please contact us.';
         return false;
     }
     $Arguments['openid_mode'] = 'check_authentication';
     // Add mode for verification
     $c = cURL_Init();
     cURL_SetOpt_Array($c, array(CURLOPT_USERAGENT => 'Steam Database Party OpenID Login', CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => self::STEAM_LOGIN, CURLOPT_CONNECTTIMEOUT => 6, CURLOPT_TIMEOUT => 6, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $Arguments));
     $Response = cURL_Exec($c);
     cURL_Close($c);
     if (Preg_Match('/is_valid\\s*:\\s*true/', $Response) === 1) {
         return $CommunityID;
     }
     // If we reach here, then it failed
     $ErrorMessage = 'Failed to verify your login with Steam, it could be down. Check Steam\'s status at http://steamstat.us.';
     return false;
 }
Beispiel #3
0
function System_IsLoaded($Path)
{
    /****************************************************************************/
    $__args_types = array('string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $Loaded = (array) Link_Get('System');
    #-----------------------------------------------------------------------------
    return In_Array($Path, $Loaded);
}
 public function getParams()
 {
     #-------------------------------------------------------------------------------
     $Server = new DomainServer();
     #-------------------------------------------------------------------------------
     $IsSelected = $Server->Select((int) $this->params['ServerID']);
     #-------------------------------------------------------------------------------
     switch (ValueOf($IsSelected)) {
         #-------------------------------------------------------------------------------
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'true':
             #-------------------------------------------------------------------------------
             // For RegRu only
             if ($Server->Settings['Params']['SystemID'] == 'RegRu' && In_Array($this->params['Name'], array('ru', 'su', 'рф'))) {
                 #-------------------------------------------------------------------------------
                 $Domain = SprintF("%s.%s", $this->params['DomainName'], $this->params['Name']);
                 #-------------------------------------------------------------------------------
                 $Result = $Server->GetUploadID($Domain);
                 #-------------------------------------------------------------------------------
                 switch (ValueOf($Result)) {
                     case 'error':
                         return ERROR | @Trigger_Error(500);
                     case 'array':
                         #-------------------------------------------------------------------------------
                         $UploadID = $Result['UploadID'];
                         #-------------------------------------------------------------------------------
                         $this->params['UploadID'] = $UploadID;
                         #-------------------------------------------------------------------------------
                         Debug(SPrintF('[system/classes/DomainOrdersOnRegisterMsg.class.php]: UploadID = %s', $UploadID));
                         #-------------------------------------------------------------------------------
                         break;
                         #-------------------------------------------------------------------------------
                     #-------------------------------------------------------------------------------
                     default:
                         return ERROR | @Trigger_Error(101);
                 }
                 #-------------------------------------------------------------------------------
             }
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     return $this->params;
     #-------------------------------------------------------------------------------
 }
Beispiel #5
0
 static function defineRewriteRules()
 {
     # Add filter permalink structure for post type archive
     $post_type = Get_Post_Type_Object(Post_Type::$post_type_name);
     $archive_url_path = $post_type->rewrite['slug'];
     self::$rewrite_rules[LTrim(SPrintF('%s/filter:([^/]+)/?$', $archive_url_path), '/')] = SPrintF('index.php?post_type=%s&filter=$matches[1]', Post_Type::$post_type_name);
     self::$rewrite_rules[LTrim(SPrintF('%s/filter:([^/]+)/page/([0-9]{1,})/?$', $archive_url_path), '/')] = SPrintF('index.php?post_type=%s&filter=$matches[1]&paged=$matches[2]', Post_Type::$post_type_name);
     # Add filter permalink structure for taxonomy archives
     foreach (Get_Taxonomies(Null, 'objects') as $taxonomy) {
         $taxonomy_slug = $taxonomy->rewrite['slug'];
         if (!In_Array(Post_Type::$post_type_name, $taxonomy->object_type)) {
             continue;
         }
         self::$rewrite_rules[LTrim(SPrintF('%s/([^/]+)/filter:([^/]+)/?$', $taxonomy_slug), '/')] = SPrintF('index.php?%s=$matches[1]&filter=$matches[2]', $taxonomy->name);
         self::$rewrite_rules[LTrim(SPrintF('%s/([^/]+)/filter:([^/]+)/page/([0-9]{1,})/?$', $taxonomy_slug), '/')] = SPrintF('index.php?%s=$matches[1]&filter=$matches[2]&paged=$matches[3]', $taxonomy->name);
     }
 }
 function Get_Fancy_Images($orderby = 'ID', $order = 'ASC', $limit = -1)
 {
     global $wpdb;
     # Check Parameters
     if (!$orderby) {
         $orderby = 'ID';
     }
     if (!In_Array($order, array('ASC', 'DESC', 'RAND'))) {
         $order = 'ASC';
     }
     $limit = IntVal($limit);
     # Build Statement
     $stmt = "\n      SELECT\n        attachment.*,\n        gallery.ID gallery_id\n      FROM\n        {$wpdb->posts} attachment,\n        {$wpdb->posts} gallery\n      WHERE  attachment.post_type = \"attachment\"\n      AND    attachment.post_mime_type LIKE \"image/%\"\n      AND    gallery.post_type = \"{$this->core->gallery_post_type->name}\"\n      AND    attachment.post_parent = gallery.ID\n      GROUP BY attachment.ID ";
     if ($order == 'RAND') {
         $stmt .= 'ORDER BY RAND() ';
     } else {
         $stmt .= 'ORDER BY attachment.' . $orderby . ' ' . $order . ' ';
     }
     if ($limit > 0) {
         $stmt .= 'LIMIT ' . $limit;
     }
     return $wpdb->Get_Results($stmt);
 }
Beispiel #7
0
 function createPay($AppInfo, $PartnerInfo, $ServerInfo, $PassageInfo, $OrderInfo, $Pay)
 {
     $comment = json_decode($AppInfo['comment'], true);
     /* 密钥 */
     if (in_array($OrderInfo['SubPassageId'], array('1001', '1002', '1003', '1004', '1005', '1006', '1009', '1020', '1022', '1032', 'BOCB2C', 'PAB', 'GDB', 'POST', 'HXB', 'BEA', 'SHB', 'ECITIC', 'NBCB', 'NJB', 'GZRCC', 'CBHB', 'BJRCB', 'ZSB', 'SHRCB', 'YP', 'BILL', 'TENPAY', 'ALIPAY'))) {
         $channelid = 1;
         $Amount = trim(sprintf("%10.2F", $OrderInfo['Amount']));
     } else {
         $paytype = 1;
         $Amount = intval($OrderInfo['Amount']);
         if (in_array($OrderInfo['SubPassageId'], array('CMPAY', 'YDSZX'))) {
             $channelid = 2;
         } elseif (In_Array($OrderInfo['SubPassageId'], array('DXCT'))) {
             $channelid = 3;
         } elseif (In_Array($OrderInfo['SubPassageId'], array('UNION'))) {
             $channelid = 4;
         } elseif (In_Array($OrderInfo['SubPassageId'], array('JUNNET'))) {
             $channelid = 5;
         } elseif (In_Array($OrderInfo['SubPassageId'], array('TXTONG'))) {
             $Params['key'] = "game_id=5462&prod_uid=119868&prod_type=1&sign=00ab0a497a5122328fc049b850df61e7";
             $Params['validate'] = "";
             return $Params;
         } elseif (In_Array($OrderInfo['SubPassageId'], array('SDCARD'))) {
             $channelid = 7;
         } elseif (In_Array($OrderInfo['SubPassageId'], array('EFT'))) {
             $channelid = 8;
         } else {
             return False;
         }
     }
     $Fronturl = 'http://passport.limaogame.com/?c=ka91';
     $Bgurl = 'http://payment.limaogame.com/?ctl=callback/ka91';
     $Params['key'] = "orderid=" . $OrderInfo['OrderId'] . "&origin=" . $PassageInfo['StagePartnerId'] . "&chargemoney=" . $Amount . "&channelid=" . $channelid . "&paytype=" . $paytype . "&bankcode=" . $OrderInfo['SubPassageId'] . "&cardno=&cardpwd=&cardamount=&fronturl=" . $Fronturl . "&bgurl=" . $Bgurl . "&ext1=lm&ext2=limaogame";
     $Params['validate'] = "&version=2.0.1&validate=" . substr(md5($Params['key'] . $PassageInfo['StageSecureCode']), 8, 16);
     return $Params;
 }
 function __WalkThrougtTree($path, $arSkipPaths, $level, &$arTs, $fileFunction)
 {
     $path = Str_Replace("\\", "/", $path);
     $path = Trim(Trim($path, "/\\"));
     if (StrLen($path) > 0) {
         $path = "/" . $path;
     }
     $le = false;
     if (StrLen($this->startPath) > 0) {
         if (StrLen($path) <= 0 || StrLen($this->startPath) >= StrLen($path) && SubStr($this->startPath, 0, StrLen($path)) == $path) {
             if (StrLen($path) > 0) {
                 $startPath = SubStr($this->startPath, StrLen($path) + 1);
             } else {
                 $startPath = $this->startPath;
             }
             $pos = StrPos($startPath, "/");
             $le = $pos === false ? false : true;
             if ($pos === false) {
                 $startPathPart = $startPath;
             } else {
                 $startPathPart = SubStr($startPath, 0, $pos);
             }
         }
     }
     $arFiles = array();
     if ($handle = @opendir($_SERVER["DOCUMENT_ROOT"] . $path)) {
         while (($file = readdir($handle)) !== false) {
             if ($file == "." || $file == "..") {
                 continue;
             }
             if (StrLen($startPathPart) > 0 && ($le && $startPathPart > $file || !$le && $startPathPart >= $file)) {
                 continue;
             }
             if (Count($arSkipPaths) > 0) {
                 $bSkip = False;
                 for ($i = 0; $i < count($arSkipPaths); $i++) {
                     if (strlen($path . "/" . $file) >= strlen($arSkipPaths[$i]) && substr($path . "/" . $file, 0, strlen($arSkipPaths[$i])) == $arSkipPaths[$i]) {
                         $bSkip = True;
                         break;
                     }
                 }
                 if ($bSkip) {
                     continue;
                 }
             }
             $arFiles[] = $file;
         }
         closedir($handle);
     }
     for ($i = 0; $i < Count($arFiles) - 1; $i++) {
         for ($j = $i + 1; $j < Count($arFiles); $j++) {
             if ($arFiles[$i] > $arFiles[$j]) {
                 $t = $arFiles[$i];
                 $arFiles[$i] = $arFiles[$j];
                 $arFiles[$j] = $t;
             }
         }
     }
     for ($i = 0; $i < Count($arFiles); $i++) {
         if (is_dir($_SERVER["DOCUMENT_ROOT"] . $path . "/" . $arFiles[$i])) {
             $res = $this->__WalkThrougtTree($path . "/" . $arFiles[$i], $arSkipPaths, $level + 1, $arTs, $fileFunction);
             if (!$res) {
                 return false;
             }
         } else {
             if (Count($this->arCollectedExtensions) > 0) {
                 $fileExt = StrToLower(GetFileExtension($arFiles[$i]));
                 if (!In_Array($fileExt, $this->arCollectedExtensions)) {
                     continue;
                 }
             }
             Call_User_Func(array(&$this, $fileFunction), $path . "/" . $arFiles[$i]);
             $arTs["StatNum"]++;
         }
         if ($arTs["MaxExecutionTime"] > 0 && getmicrotime() - START_EXEC_TIME > $arTs["MaxExecutionTime"]) {
             $arTs["StartPoint"] = $path . "/" . $arFiles[$i];
             return false;
         }
     }
     $arTs["StartPoint"] = "";
     return true;
 }
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     $IsUpdate = DB_Update('DomainOrders', $UDomainOrder, array('ID' => $DomainOrder['ID']));
     if (Is_Error($IsUpdate)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     return array('Status' => 'Ok');
     #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 case 'true':
     #-------------------------------------------------------------------------------
     if (isset($IsInternal)) {
         #-------------------------------------------------------------------------------
         if (In_Array($DomainOrder['StatusID'], array('Active', 'Suspended', 'ForTransfer', 'OnTransfer'))) {
             #-------------------------------------------------------------------------------
             # add admin message
             $Event = array('UserID' => 1, 'PriorityID' => 'Error', 'Text' => SPrintF('Домен %s.%s является свободным, невозможно обновить информацию WhoIs', $DomainOrder['DomainName'], $DomainOrder['SchemeName']), 'IsReaded' => $IsReaded);
             $Event = Comp_Load('Events/EventInsert', $Event);
             if (!$Event) {
                 return ERROR | @Trigger_Error(500);
             }
             #-------------------------------------------------------------------------------
             # update last whois update date
             $IsUpdate = DB_Update('DomainOrders', array('UpdateDate' => Time()), array('ID' => $DomainOrder['ID']));
             if (Is_Error($IsUpdate)) {
                 return ERROR | @Trigger_Error(500);
             }
             #-------------------------------------------------------------------------------
         }
Beispiel #10
0
        #---------------------------------------------------------------------------
        $Option = new Tag('OPTION', array('value' => $OptionID), $Options[$OptionID]);
        #---------------------------------------------------------------------------
        if (!Is_Null($SelectedIDs)) {
            #-------------------------------------------------------------------------
            if (!Is_Array($SelectedIDs)) {
                $SelectedIDs = array($SelectedIDs);
            }
            #-------------------------------------------------------------------------
            if (In_Array($OptionID, $SelectedIDs)) {
                $Option->AddAttribs(array('selected' => 'true'));
            }
        }
        #---------------------------------------------------------------------------
        if (!Is_Null($DisabledIDs)) {
            #-------------------------------------------------------------------------
            if (!Is_Array($DisabledIDs)) {
                $DisabledIDs = array($DisabledIDs);
            }
            #-------------------------------------------------------------------------
            if (In_Array($OptionID, $DisabledIDs)) {
                $Option->AddAttribs(array('disabled' => 'true'));
            }
        }
    }
    #-----------------------------------------------------------------------------
    $Select->AddChild($Option);
}
#-------------------------------------------------------------------------------
return $Select;
#-------------------------------------------------------------------------------
Beispiel #11
0
foreach (Array_Reverse($HostsIDs) as $HostID) {
    #-------------------------------------------------------------------------------
    $Path = SPrintF('%s/hosts/%s/servers', SYSTEM_PATH, $HostID);
    #-------------------------------------------------------------------------------
    if (!Is_Dir($Path)) {
        continue;
    }
    #-------------------------------------------------------------------------------
    $Files = IO_Scan($Path);
    #-------------------------------------------------------------------------------
    if (Is_Error($Files)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    foreach ($Files as $File) {
        if (!In_Array($File, $Array)) {
            $Array[] = $File;
        }
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
foreach ($Array as $Value) {
    #-------------------------------------------------------------------------------
    $Value = Str_Replace('.xml', '', $Value);
    #-------------------------------------------------------------------------------
    $Template = System_XML(SPrintF('servers/%s.xml', $Value));
    if (Is_Error($Template)) {
        return ERROR | @Trigger_Error(500);
    }
         return ERROR | @Trigger_Error(500);
     case 'exception':
         return ERROR | @Trigger_Error(400);
     case 'array':
         break;
     default:
         return ERROR | @Trigger_Error(101);
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 $Order = Current($Orders);
 #-------------------------------------------------------------------------------
 $UserID = $Order['UserID'];
 #-------------------------------------------------------------------------------
 # если сотрудник или исключение - ничего не делаем
 if (In_Array($UserID, $ExcludeIDs)) {
     continue;
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 $Array = array();
 #-------------------------------------------------------------------------------
 foreach ($Orders as $Order) {
     #-------------------------------------------------------------------------------
     if ($Order['StatusID'] == 'Suspended') {
         #-------------------------------------------------------------------------------
         Debug(SPrintF('[comp/Tasks/GC/ResetOrdersDays]: UserID = %s; OrderID = %s в статусе Suspended, все заказы пользователя пропускаются', $UserID, $Order['ID']));
         #-------------------------------------------------------------------------------
         $ExcludeIDs[] = $UserID;
         #-------------------------------------------------------------------------------
         continue 2;
Beispiel #13
0
 /**
 * Удаляет идентификаторы тегов
 *
 * Функция необходима в случае, когда необходимо исключить id тега из списка всех аттрибутов данного тега.
 */
 public function DeleteIDs()
 {
     #-----------------------------------------------------------------------------
     $Names = Func_Get_Args();
     #-----------------------------------------------------------------------------
     $Links =& $this->Links;
     #-----------------------------------------------------------------------------
     foreach (Array_Keys($Links) as $LinkID) {
         #---------------------------------------------------------------------------
         $Attribs =& $Links[$LinkID]->Attribs;
         #---------------------------------------------------------------------------
         if (isset($Attribs['id'])) {
             #-------------------------------------------------------------------------
             if (Count($Names)) {
                 #-----------------------------------------------------------------------
                 if (In_Array($Attribs['id'], $Names)) {
                     unset($Attribs['id']);
                 }
             } else {
                 unset($Attribs['id']);
             }
         }
     }
 }
Beispiel #14
0
 $Text = Str_Replace("  ", " ", $Text);
 # delete carrier return
 $Text = Str_Replace("\r", "", $Text);
 # delete many \n
 $Text = Str_Replace("\n\n", "\n", $Text);
 # prepare for java script
 $Text = Str_Replace("\n", '\\n', $Text);
 # format: SortOrder:ImageName.gif
 # button image, get image name
 $Partition = Explode(":", $Article['Partition']);
 $Extension = isset($Partition[1]) ? Explode(".", StrToLower($Partition[1])) : '';
 #-------------------------------------------------------------------------------
 # если есть чё-то после точки, и если оно похоже на расширение картинки, ставим это как картинку
 $Image = 'Info.gif';
 #дефолтовую информационную картинку
 if (isset($Extension[1]) && In_Array($Extension[1], array('png', 'gif', 'jpg', 'jpeg'))) {
     $Image = $Partition[1];
 }
 #-------------------------------------------------------------------------------
 # делаем кнопку, если это системная кнопка или этого админа
 if (!Preg_Match('/@/', $Partition[0]) && $Partition[0] < 2000 && $__USER['Params']['Settings']['EdeskButtons'] == "No" || StrToLower($Partition[0]) == StrToLower($__USER['Email'])) {
     #-------------------------------------------------------------------------------
     $Comp = Comp_Load('Buttons/Standard', array('onclick' => SPrintF("form.Message.value += '%s';form.Message.focus();", $Text), 'style' => 'cursor: pointer;'), $Article['Title'], $Image);
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     $Tr->AddChild(new Tag('TD', $Comp));
     #-------------------------------------------------------------------------------
 }
 #-------------------------------------------------------------------------------
$DomainOrders = DB_Select('DomainOrdersOwners', $Columns, array('Where' => $Where));
switch (ValueOf($DomainOrders)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return TRUE;
    case 'array':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
foreach ($DomainOrders as $DomainOrder) {
    #-------------------------------------------------------------------------------
    if (!($DomainOrder['StatusID'] == 'ForTransfer' || $DomainOrder['StatusID'] == 'OnTransfer' && In_Array($DomainOrder['Name'], array('ru', 'su', 'рф')))) {
        #-------------------------------------------------------------------------------
        Debug(SPrintF("[Tasks/GC/DeleteDomainForTransfer]: Домен не попал в условие: '%s.%s', статус: '%s'", $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID']));
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    Debug(SPrintF("[Tasks/GC/DeleteDomainForTransfer]: Удаление домена '%s.%s', статус '%s'", $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID']));
    #----------------------------------TRANSACTION----------------------------------
    if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/DeleteDomainForTransfer')))) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    $Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'DomainOrders', 'StatusID' => 'Deleted', 'RowsIDs' => $DomainOrder['ID'], 'Comment' => SPrintF('Заказ домена не был перенесён к регистратору %s, более 180 дней', $DomainOrder['Params']['Name'])));
    #-------------------------------------------------------------------------------
    switch (ValueOf($Comp)) {
 # округляем в большую сторону до 10 рублей
 $NewPriceProlong = Ceil($NewPriceProlong / 10) * 10;
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 # на перенос выставляем максимальную из цен - регистрация/перенос
 $NewPriceTransfer = $NewPriceReg;
 #-------------------------------------------------------------------------------
 if ($NewPriceProlong > $NewPriceReg) {
     $NewPriceTransfer = $NewPriceProlong;
 }
 #-------------------------------------------------------------------------------
 $NewPriceTransfer = In_Array($Key, array('ru', 'su', 'рф')) ? 0 : $NewPriceTransfer;
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 # проверяем наличие такого тарифа в биллинге
 if (In_Array($Key, Array_Keys($Schemes))) {
     #-------------------------------------------------------------------------------
     # тариф есть, сверяем цены
     # регистрация
     #-------------------------------------------------------------------------------
     if ($Settings['DomainPriceDeviationPercent'] || $Settings['DomainPriceDeviationSumm']) {
         #-------------------------------------------------------------------------------
         $Deviation = $Schemes[$Key]['CostOrder'] * (100 + $Settings['DomainPriceDeviationPercent']) / 100 - $Schemes[$Key]['CostOrder'];
         #-------------------------------------------------------------------------------
         if ($Deviation < $Settings['DomainPriceDeviationSumm']) {
             $Deviation = $Settings['DomainPriceDeviationSumm'];
         }
         #-------------------------------------------------------------------------------
         if (Abs($Schemes[$Key]['CostOrder'] - $NewPriceReg) > $Deviation) {
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[comp/Tasks/GC/DomainCheckPriceList]: регистрация, зона = %s; цена не укладывается в девиацию: биллинг = %s; регистратор = %s; расчётная = %s', $Key, $Schemes[$Key]['CostOrder'], $Prices[$Key]['new'], $NewPriceReg));
Beispiel #17
0
<?php

#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('ServiceOrder');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
if (!In_Array($ServiceOrder['StatusID'], array('Waiting', 'Deleted'))) {
    #-------------------------------------------------------------------------------
    $Comp = Comp_Load('Formats/Order/Number', $ServiceOrder['ID']);
    if (Is_Error($Comp)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    return new gException('ORDER_CAN_NOT_DELETED', SPrintF('Заказ #%s не может быть удален, удалить можно только заказы в статусе "Удалён" или "Ожидает оплаты"', $Comp));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Services/Orders/OrdersHistory', array('OrderID' => $ServiceOrder['ID']));
switch (ValueOf($Comp)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return $Comp;
    case 'array':
        #-------------------------------------------------------------------------------
Beispiel #18
0
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$GLOBALS['TaskReturnInfo'] = array();
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# смотрим количество сообщений в очереди
$Config =& Config();
#-------------------------------------------------------------------------------
$Notifies = $Config['Notifies'];
#-------------------------------------------------------------------------------
$Methods = Explode(',', $Task['Params']['Methods']);
#-------------------------------------------------------------------------------
$iWhere = array();
#-------------------------------------------------------------------------------
foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
    if ($Notifies['Methods'][$MethodID]['IsActive'] && In_Array($MethodID, $Methods)) {
        $iWhere[] = SPrintF("`TypeID` = '%s'", $MethodID);
    }
}
#-------------------------------------------------------------------------------
$Where = SPrintF("(%s) AND `IsExecuted` = 'no'", Implode(' OR ', $iWhere));
$Count = DB_Count('TasksOwners', array('Where' => $Where));
#-------------------------------------------------------------------------------
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count > $Settings['Limit'] - 1) {
    #-------------------------------------------------------------------------------
    $GLOBALS['TaskReturnInfo']['Messages In Queue'] = array($Count);
    #-------------------------------------------------------------------------------
Beispiel #19
0
    }
    ?>
			</tr>
		</thead>
		<tbody>
			<?php 
    for ($i = $arResult["LIMITS"]["FROM"]; $i < $arResult["LIMITS"]["TO"]; $i++) {
        ?>
				<tr class="intask-row">
					<td class="intask-cell selected" nowrap><?php 
        echo __RM_MkT($i);
        ?>
</td>
					<?php 
        for ($j = 1; $j <= 7; $j++) {
            if (In_Array($j - 1, $arParams["WEEK_HOLIDAYS"])) {
                continue;
            }
            $currentDay = ConvertTimeStamp(time()) == ConvertTimeStamp(MkTime(0, 0, 0, $arResult["WEEK_START_ARRAY"]["m"], $arResult["WEEK_START_ARRAY"]["d"] + $j - 1, $arResult["WEEK_START_ARRAY"]["Y"]));
            if ($arResult["ITEMS_MATRIX"][$j][$i]) {
                if ($i == 0 || !$arResult["ITEMS_MATRIX"][$j][$i - 1] || $arResult["ITEMS_MATRIX"][$j][$i - 1] != $arResult["ITEMS_MATRIX"][$j][$i]) {
                    $cnt = 0;
                    for ($k = $i; $k < 48; $k++) {
                        if ($arResult["ITEMS_MATRIX"][$j][$i] == $arResult["ITEMS_MATRIX"][$j][$k]) {
                            $cnt++;
                        } else {
                            break;
                        }
                    }
                    ?>
<td class="intask-cell reserved<?php 
Beispiel #20
0
         #-------------------------------------------------------------------------
         foreach (Current($Matches) as $Match) {
             $Finded[Md5($Match)] = Mb_SubStr($Match, 1);
         }
     }
 }
 #-----------------------------------------------------------------------------
 if (Count($Finded) < 1) {
     continue;
 }
 #-----------------------------------------------------------------------------
 $Tr = new Tag('TR');
 #-----------------------------------------------------------------------------
 foreach ($Finded as $Color) {
     #---------------------------------------------------------------------------
     if (In_Array($Color, $Colors)) {
         continue;
     }
     #---------------------------------------------------------------------------
     $Tr->AddChild(new Tag('TD', array('align' => 'center', 'bgcolor' => SPrintF('#%s', $Color), 'height' => 50, 'width' => 50), $Color));
 }
 #-----------------------------------------------------------------------------
 if (Count($Tr->Childs) < 1) {
     continue;
 }
 #-----------------------------------------------------------------------------
 $DOM->AddChild('Into', new Tag('H1', $HostsID));
 #-----------------------------------------------------------------------------
 $Table = new Tag('TABLE', array('class' => 'Standard', 'cellspacing' => 0, 'cellpadding' => 0), $Tr);
 #-----------------------------------------------------------------------------
 $DOM->AddChild('Into', $Table);
 # имя группы серверов
 if (!isset($GroupName) || $GroupName != $Server['ServersGroupName']) {
     $Table[] = SPrintF('- %s / %s', $Server['TemplateID'], $Server['ServersGroupName']);
 }
 #-------------------------------------------------------------------------------
 $GroupName = $Server['ServersGroupName'];
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 # добавляем сервер к списку
 $Comp = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'Servers[]', 'id' => $Server['Address'], 'value' => $Server['ID']));
 if (Is_Error($Comp)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------------
 if (Is_Array($ExtraIPScheme['Params']['Servers'])) {
     if (In_Array($Server['ID'], $ExtraIPScheme['Params']['Servers'])) {
         $Comp->AddAttribs(array('checked' => 'yes'));
     }
 }
 #-------------------------------------------------------------------------------
 # отображаем примечание к серверу как подсказку, если оно есть
 if ($Server['AdminNotice']) {
     #-------------------------------------------------------------------------------
     $LinkID = UniqID('String');
     #-------------------------------------------------------------------------------
     $Links =& Links();
     #-------------------------------------------------------------------------------
     $Text = new Tag('DIV', $Server['Address']);
     #-------------------------------------------------------------------------------
     $Links[$LinkID] =& $Text;
     #-------------------------------------------------------------------------------
Beispiel #22
0
function Comp_IsLoaded($Path)
{
    /****************************************************************************/
    $__args_types = array('string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $Loaded =& Link_Get('Comp/Loaded', 'array');
    #-----------------------------------------------------------------------------
    return In_Array($Path, $Loaded);
}
Beispiel #23
0
        $orderBy = $arParams["ORDER_BY_" . $i];
        if (Array_Key_Exists($orderBy, $arResult["ALLOWED_FIELDS"]) && $arResult["ALLOWED_FIELDS"][$orderBy]["ORDERABLE"]) {
            $arParams["ORDER_DIR_" . $i] = StrToUpper($arParams["ORDER_DIR_" . $i]) == "ASC" ? "ASC" : "DESC";
            $arOrderBy[$orderBy] = $arParams["ORDER_DIR_" . $i];
        }
    }
    if (Count($arOrderBy) <= 0) {
        $arOrderBy["NAME"] = "ASC";
        $arOrderBy["ID"] = "DESC";
    }
    $arFilter = array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y");
    if (Is_Array($arParams["FILTER"])) {
        foreach ($arParams["FILTER"] as $key => $value) {
            $op = "";
            $opTmp = SubStr($key, 0, 1);
            if (In_Array($opTmp, array("!", "<", ">"))) {
                $op = $opTmp;
                $key = SubStr($key, 1);
            }
            if (Array_Key_Exists($key, $arResult["ALLOWED_FIELDS"]) && $arResult["ALLOWED_FIELDS"][$key]["FILTERABLE"]) {
                $arFilter[$op . $key] = $value;
            }
        }
    }
}
if (StrLen($arResult["FatalError"]) <= 0) {
    $arNavStartParams = array("nPageSize" => $arParams["ITEMS_COUNT"], "bShowAll" => false, "bDescPageNumbering" => false);
    $arNavigation = CDBResult::GetNavParams($arNavStartParams);
    $arSelectFields = array("IBLOCK_ID");
    foreach ($arResult["ALLOWED_FIELDS"] as $key => $value) {
        $arSelectFields[] = $key;
Beispiel #24
0
function RuCenter_Contract_Register($Settings, $PepsonID, $Person, $DomainZone)
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'array', 'string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HTTP = array('Address' => $Settings['Address'], 'Port' => $Settings['Port'], 'Host' => $Settings['Address'], 'Protocol' => $Settings['Protocol'], 'Charset' => 'KOI8-R', 'IsLogging' => $Settings['Params']['IsLogging']);
    #-----------------------------------------------------------------------------
    $Query = array();
    #---------------------------------------------------------------------------
    $RequestID = UniqID('ID');
    #---------------------------------------------------------------------------
    $Query[] = 'lang: ru';
    $Query[] = 'request: contract';
    $Query[] = 'operation: create';
    $Query[] = SPrintF('login: %s', $Settings['Login']);
    $Query[] = SPrintF('password: %s', $Settings['Password']);
    $Query[] = SPrintF('request-id: %s', $RequestID);
    #---------------------------------------------------------------------------
    $Query[] = '';
    #---------------------------------------------------------------------------
    $Query[] = '[contract]';
    $Query[] = SPrintF('password: %s', UniqID());
    $Query[] = SPrintF('tech-password: %s', UniqID());
    $Query[] = 'currency-id: RUR';
    #---------------------------------------------------------------------------
    $Query[] = '';
    #---------------------------------------------------------------------------
    switch ($PepsonID) {
        case 'Natural':
            #-----------------------------------------------------------------------
            $Query[] = 'contract-type: PRS';
            $Query[] = SPrintF('person: %s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname']));
            $Query[] = SPrintF('person-r: %s %s %s', $Person['Sourname'], $Person['Name'], $Person['Lastname']);
            $Query[] = SPrintF('country: %s', isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']);
            $Query[] = SPrintF('phone: %s', $Person['Phone']);
            $Query[] = SPrintF('fax-no: %s', $Person['Fax']);
            $Query[] = SPrintF('birth-date: %s', $Person['BornDate']);
            $Query[] = SPrintF('passport: %s %s выдан %s, %s', $Person['PasportLine'], $Person['PasportNum'], $Person['PasportWhom'], $Person['PasportDate']);
            $Query[] = SPrintF('p-addr: %s, %s, %s, %s %s, %s', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['pRecipient']);
            $Query[] = SPrintF('e-mail: %s', $Person['Email']);
            break;
        case 'Juridical':
            #-----------------------------------------------------------------------
            $Query[] = 'client-type: ORG';
            $Query[] = SPrintF('org: %s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull']));
            $Query[] = SPrintF('org-r: %s', SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']));
            $Query[] = SPrintF('country: %s', $Person['jCountry']);
            $Query[] = SPrintF('e-mail: %s', $Person['Email']);
            $Query[] = SPrintF('phone: %s', $Person['Phone']);
            $Query[] = SPrintF('fax-no: %s', $Person['Fax']);
            $Query[] = SPrintF('code: %s', $Person['Inn']);
            $Query[] = SPrintF('kpp: %s', $Person['Kpp']);
            $Query[] = SPrintF('address-r: %s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']);
            $Query[] = SPrintF('p-addr: %s, %s, %s, %s %s, %s "%s"', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['CompanyFormFull'], $Person['CompanyName']);
            $Query[] = SPrintF('d-addr: %s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']);
            break;
        default:
            return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля');
    }
    #-----------------------------------------------------------------------------
    $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query)));
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error('[RuCenter_Contract_Register]: не удалось выполнить запрос к серверу');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) {
        return false;
    }
    #-----------------------------------------------------------------------------
    $Result = Trim($Result['Body']);
    #-----------------------------------------------------------------------------
    if (Preg_Match('/State:\\s([0-9]+)/', $Result, $CodeID)) {
        #---------------------------------------------------------------------------
        $CodeID = Next($CodeID);
        #---------------------------------------------------------------------------
        switch ($CodeID) {
            case '200':
                #-----------------------------------------------------------------------
                if (!Preg_Match('/nic-hdl:\\s([0-9]+\\/[A-Z\\-]+)/', $Result, $ContractID)) {
                    return new gException('LOGIN_NOT_FOUND', 'Неудалось получить номер договора');
                } else {
                    $ContractID = Next($ContractID);
                }
                break;
            case '500':
                return FALSE;
            default:
                return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result));
        }
    } else {
        return new gException('WRONG_ANSWER', $Result);
    }
    #-----------------------------------------------------------------------------
    # Делаем паузу перед запросом
    Sleep(10);
    #-----------------------------------------------------------------------------
    if (!In_Array($DomainZone, array('ru', 'su'))) {
        #---------------------------------------------------------------------------
        $Query = array();
        #---------------------------------------------------------------------------
        $RequestID = UniqID('ID');
        #---------------------------------------------------------------------------
        $Query[] = SPrintF('login: %s', $Settings['Login']);
        $Query[] = SPrintF('password: %s', $Settings['Password']);
        $Query[] = SPrintF('subject-contract: %s', $ContractID);
        $Query[] = 'request: contact';
        $Query[] = 'operation: create';
        $Query[] = 'lang: ru';
        $Query[] = SPrintF('request-id: %s', $RequestID);
        #---------------------------------------------------------------------------
        $Query[] = '';
        #---------------------------------------------------------------------------
        $Query[] = '[contact]';
        $Query[] = SPrintF('status:registrant');
        $Query[] = SPrintF('org:');
        $Query[] = SPrintF('name: %s, %s', Translit($Person['Name']), Translit($Person['Lastname']));
        $Query[] = SPrintF('country: %s', isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']);
        $Query[] = SPrintF('region: %s', Translit($Person['pCity']));
        $Query[] = SPrintF('city: %s', Translit($Person['pCity']));
        $Query[] = SPrintF('street: %s', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])));
        $Query[] = SPrintF('zipcode: %s', $Person['pIndex']);
        $Query[] = SPrintF('phone: %s', $Person['Phone']);
        $Query[] = SPrintF('fax: %s', $Person['Fax']);
        $Query[] = SPrintF('email: %s', $Person['Email']);
        #---------------------------------------------------------------------------
        $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query)));
        if (Is_Error($Result)) {
            return ERROR | @Trigger_Error('[RuCenter_Contract_Register]: не удалось выполнить запрос к серверу');
        }
        #---------------------------------------------------------------------------
        if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) {
            return FALSE;
        }
        #---------------------------------------------------------------------------
        $Result = Trim($Result['Body']);
        #---------------------------------------------------------------------------
        if (Preg_Match('/State:\\s([0-9]+)/', $Result, $CodeID)) {
            #-------------------------------------------------------------------------
            $CodeID = Next($CodeID);
            #-------------------------------------------------------------------------
            switch ($CodeID) {
                case '200':
                    #-----------------------------------------------------------------------
                    if (!Preg_Match('/nic-hdl:([0-9A-Za-z\\-]+)/', $Result, $NicHDL)) {
                        return array('TicketID' => SPrintF('%s:%s', $ContractID, Next($NicHDL)));
                    }
                    #-----------------------------------------------------------------------
                    return new gException('LOGIN_NOT_FOUND', 'Неудалось получить номер договора');
                case '500':
                    return FALSE;
                default:
                    return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result));
            }
        } else {
            return new gException('WRONG_ANSWER', $Result);
        }
    }
    #-----------------------------------------------------------------------------
    return array('TicketID' => $ContractID);
}
Beispiel #25
0
 $UserID = (int) $VPSOrder['UserID'];
 #---------------------------------------------------------------------------
 $IsPermission = Permission_Check('VPSOrdersPay', (int) $GLOBALS['__USER']['ID'], $UserID);
 #---------------------------------------------------------------------------
 switch (ValueOf($IsPermission)) {
     case 'error':
         return ERROR | @Trigger_Error(500);
     case 'exception':
         return ERROR | @Trigger_Error(400);
     case 'false':
         return ERROR | @Trigger_Error(700);
     case 'true':
         #-----------------------------------------------------------------------
         $StatusID = $VPSOrder['StatusID'];
         #-----------------------------------------------------------------------
         if (!In_Array($StatusID, array('Waiting', 'Active', 'Suspended'))) {
             return new gException('VPS_ORDER_CAN_NOT_PAY', 'Заказ не может быть оплачен');
         }
         #-----------------------------------------------------------------------
         $UserID = $VPSOrder['UserID'];
         #-----------------------------------------------------------------------
         $VPSScheme = DB_Select('VPSSchemes', array('ID', 'Name', 'CostDay', 'CostInstall', 'IsActive', 'IsProlong', 'MinDaysPay', 'MinDaysProlong', 'MaxDaysPay'), array('UNIQ', 'ID' => $VPSOrder['SchemeID']));
         #-----------------------------------------------------------------------
         switch (ValueOf($VPSScheme)) {
             case 'error':
                 return ERROR | @Trigger_Error(500);
             case 'exception':
                 return ERROR | @Trigger_Error(400);
             case 'array':
                 #-------------------------------------------------------------------
                 if ($VPSOrder['IsPayed']) {
 public static function sendMsg(Msg $msg, $Methods = array())
 {
     #-------------------------------------------------------------------------------
     $Executor = Comp_Load('www/Administrator/API/ProfileCompile', array('ProfileID' => 100));
     #-------------------------------------------------------------------------------
     switch (ValueOf($Executor)) {
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'exception':
             # No more...
             break;
         case 'array':
             #-------------------------------------------------------------------------------
             $msg->setParam('Executor', $Executor['Attribs']);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $User = DB_Select('Users', array('ID', 'Name', 'Sign', 'Email', 'UniqID', 'IsNotifies', 'Params'), array('UNIQ', 'ID' => $msg->getTo()));
     #-------------------------------------------------------------------------------
     switch (ValueOf($User)) {
         case 'error':
             return ERROR | @Trigger_Error('[Email_Send]: не удалось выбрать получателя');
         case 'exception':
             return new gException('EMAIL_RECIPIENT_NOT_FOUND', 'Получатель письма не найден');
         case 'array':
             #-------------------------------------------------------------------------------
             $TypeID = $msg->getTemplate();
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[system/classes/NotificationManager]: TypeID = %s', $TypeID));
             #-------------------------------------------------------------------------------
             if ($TypeID != 'UserPasswordRestore') {
                 if (!$User['IsNotifies']) {
                     return new gException('NOTIFIES_RECIPIENT_DISABLED', 'Уведомления для получателя отключены');
                 }
             }
             #-------------------------------------------------------------------------------
             $msg->setParam('User', $User);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $From = DB_Select('Users', array('ID', 'Name', 'Sign', 'Email', 'UniqID', 'Params'), array('UNIQ', 'ID' => $msg->getFrom()));
     #-------------------------------------------------------------------------------
     switch (ValueOf($From)) {
         case 'error':
             return ERROR | @Trigger_Error('[Email_Send]: не удалось выбрать отправителя');
         case 'exception':
             return new gException('EMAIL_SENDER_NOT_FOUND', 'Отправитель не найден');
         case 'array':
             #-------------------------------------------------------------------------------
             $msg->setParam('From', $From);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $Config = Config();
     #-------------------------------------------------------------------------------
     $Notifies = $Config['Notifies'];
     #-------------------------------------------------------------------------------
     # вариант когда методы не заданы - значит все доступные
     if (SizeOf($Methods) == 0) {
         #-------------------------------------------------------------------------------
         $Array = array();
         #-------------------------------------------------------------------------------
         foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
             $Array[] = $MethodID;
         }
         #-------------------------------------------------------------------------------
         $Methods = $Array;
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $sentMsgCnt = 0;
     #-------------------------------------------------------------------------------
     foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
         #-------------------------------------------------------------------------------
         if (!$Notifies['Methods'][$MethodID]['IsActive'] || !In_Array($MethodID, $Methods)) {
             continue;
         }
         #-------------------------------------------------------------------------------
         # проверяем контакт, если не мыло - должен быть подтверждён
         if ($MethodID != 'Email') {
             if (!$User['Params']['NotificationMethods'][$MethodID]['Confirmed']) {
                 continue;
             }
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         # кусок от JBS-879
         if (!isset($Notifies['Types'][$TypeID])) {
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[system/classes/NotificationManager]: TypeID = %s not found', $TypeID));
             #-------------------------------------------------------------------------------
         } else {
             #-------------------------------------------------------------------------------
             # такие оповещения вообще могут быть отключены (пока, не настраиваемо, т.к. не нужно)
             if (!$Notifies['Types'][$TypeID]['IsActive']) {
                 continue;
             }
             #-------------------------------------------------------------------------------
             # проверяем, не отключены ли такие оповещения глобально
             $UseName = SPrintF('Use%s', $MethodID);
             #-------------------------------------------------------------------------------
             if (isset($Notifies['Types'][$TypeID][$UseName]) && !$Notifies['Types'][$TypeID][$UseName]) {
                 continue;
             }
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         # проверяем, не отключены ли такие оповещения в настройках юзера
         $Count = DB_Count('Notifies', array('Where' => SPrintF("`UserID` = %u AND `MethodID` = '%s' AND `TypeID` = '%s'", $msg->getTo(), $MethodID, $TypeID)));
         if (Is_Error($Count)) {
             return ERROR | @Trigger_Error(500);
         }
         #-------------------------------------------------------------------------------
         if ($Count) {
             continue;
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         # JBS-1126: save $MethodID settings
         $msg->setParam('MethodSettings', $Notifies['Methods'][$MethodID]);
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         if (!class_exists($MethodID)) {
             return new gException('DISPATCHER_NOT_FOUND', 'Dispatcher not found: ' . $MethodID);
         }
         #-------------------------------------------------------------------------------
         #$dispatcher = $MethodID::get();
         $dispatcher = call_user_func($MethodID . '::get', true);
         #-------------------------------------------------------------------------------
         try {
             #-------------------------------------------------------------------------------
             $dispatcher->send($msg);
             #-------------------------------------------------------------------------------
             $sentMsgCnt++;
             #-------------------------------------------------------------------------------
         } catch (jException $e) {
             #-------------------------------------------------------------------------------
             Debug(SPrintF("[system/classes/NotificationManager]: Error while sending message [userId=%s, message=%s]", $User['ID'], $e->getMessage()));
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     if ($sentMsgCnt < 1) {
         #-------------------------------------------------------------------------------
         Debug(SPrintF("[system/classes/NotificationManager]: Couldn't send notify by any methods to user #%s", $User['ID']));
         #-------------------------------------------------------------------------------
         return new gException('USER_NOT_NOTIFIED', 'Не удалось оповестить пользователя ни одним из методов');
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     return TRUE;
     #-------------------------------------------------------------------------------
     #------------------------------------------------------------------------------
 }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Config = System_XML('config/Config.xml', array(HOST_ID));
if (Is_Error($Config)) {
    return new gException('ERROR_TEMPLATE_LOAD', 'Ошибка загрузки шаблона');
}
#-------------------------------------------------------------------------------
$Params = Array_ToLine($Config);
#-------------------------------------------------------------------------------
foreach (Array_Keys($Params) as $Key) {
    #-------------------------------------------------------------------------------
    if (!In_Array($Key, $ShareConfigsParams)) {
        #-------------------------------------------------------------------------------
        Debug(SPrintF('[comp/Tasks/GC/CheckConfigParams]: в конфигурационном файле обнаружен не используемый параметр: %s', $Key));
        #-------------------------------------------------------------------------------
        if ($Settings['IsEvent']) {
            #-------------------------------------------------------------------------------
            $Event = array('IsReaded' => FALSE, 'PriorityID' => 'System', 'Text' => SPrintF('Обнаружен неиспользуемый параметр конфигурационного файла: %s, со значением (%s). Удалите его, или отключите задачу поиска неиспользуемых параметров. При удалении, будте аккуратны и внимательны, сохраняйте бэкап конфигурационного файла.', $Key, $Params[$Key]));
            $Event = Comp_Load('Events/EventInsert', $Event);
            if (!$Event) {
                return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
 /**
  * generate project based on template
  * @param array $services . note: here '/' in each service name is replaced by '__', to avoid dealing with packages
  * @param string $amfphpEntryPointUrl 
  * @param String absolute url to folder where to put the generated code
  * @return null
  */
 public function generate($services, $amfphpEntryPointUrl, $targetFolder)
 {
     foreach ($services as $service) {
         $service->name = str_replace('/', '__', $service->name);
     }
     $this->services = $services;
     $this->amfphpEntryPointUrl = $amfphpEntryPointUrl;
     Amfphp_BackOffice_ClientGenerator_Util::recurseCopy($this->templateFolderUrl, $targetFolder);
     $it = new RecursiveDirectoryIterator($targetFolder);
     foreach (new RecursiveIteratorIterator($it) as $file) {
         if (In_Array(SubStr($file, StrrPos($file, '.') + 1), $this->codeFileExtensions) == true) {
             $this->fileBeingProcessed = $file;
             $this->processSourceFile($file);
         }
     }
 }
Beispiel #29
0
 $Path = SPrintF('%s/hosts/%s/comp/Statistics', SYSTEM_PATH, $HostID);
 #---------------------------------------------------------------------------
 if (!File_Exists($Path)) {
     continue;
 }
 #---------------------------------------------------------------------------
 $Files = IO_Scan($Path);
 if (Is_Error($Files)) {
     return ERROR | @Trigger_Error(500);
 }
 #---------------------------------------------------------------------------
 foreach ($Files as $File) {
     #-------------------------------------------------------------------------
     $StatisticID = SubStr($File, 0, StriPos($File, '.'));
     #-------------------------------------------------------------------------
     if (!In_Array($StatisticID, $StatisticsIDs)) {
         continue;
     }
     #-------------------------------------------------------------------------
     $Comp = Comp_Load(SPrintF('Statistics/%s', $StatisticID), TRUE, $Folder, $StartDate, $FinishDate + 86400, $Details);
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------
     $Title = $Comp['Title'];
     #-------------------------------------------------------------------------
     echo SPrintF("<P><B>[%s]</B></P>", $Title);
     #-------------------------------------------------------------------------
     $DOM->AddChild('Into', new Tag('H1', $Title));
     #-------------------------------------------------------------------------
     $DOM->AddChild('Into', isset($Comp['DOM']) ? $Comp['DOM'] : new Tag('P', 'Статистика недоступна.'));
Beispiel #30
0
 #-------------------------------------------------------------------------------
 if (!File_Exists($Path)) {
     continue;
 }
 #-------------------------------------------------------------------------------
 $Folder = OpenDir($Path);
 #-------------------------------------------------------------------------------
 if (!$Folder) {
     return ERROR | Trigger_Error('[JBs core]: не возможно открыть папку модулей');
 }
 #-------------------------------------------------------------------------------
 while ($File = ReadDir($Folder)) {
     #-------------------------------------------------------------------------------
     if ($File != '.' && $File != '..' && $File != '.svn' && $File != '.git') {
         #-------------------------------------------------------------------------------
         if (In_Array($File, $Loaded)) {
             continue;
         }
         #-------------------------------------------------------------------------------
         $Module = SPrintF('%s/%s', $Path, $File);
         #-------------------------------------------------------------------------------
         Debug(SPrintF('[JBs core]: загружается модуль (%s)', $Module));
         #-------------------------------------------------------------------------------
         if (Load($Module) === ERROR) {
             return ERROR | Trigger_Error('[JBs core]: не удалось загрузить модуль');
         }
         #-------------------------------------------------------------------------------
         $Loaded[] = $File;
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------