public function get_code()
 {
     $codeurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" . $this->wxappid . "&redirect_uri=" . urlencode($this->redirect_uri) . "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
     $redirect_uri = UrlEncode("http://www.renrenlie.com/Home/Sunyuetest/code_return");
     $url = "https://open.weixin.qq.com/connect/qrconnect?appid={$this->appid}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect";
     header("location:" . $url);
 }
Ejemplo n.º 2
0
 function GetIpLocation($ip, &$location)
 {
     $location = array();
     if (!strcmp($ip, "127.0.0.1")) {
         $this->error = "{$ip} is not a valid public Internet address!";
         return 0;
     }
     $domain = "ip2country.esymbian.info";
     if (!($connection = $this->timeout ? @fsockopen($domain, 80, $errno, $error, $this->timeout) : @fsockopen($domain, 80))) {
         switch ($error = $this->timeout ? strval($errno) : "??") {
             case "-3":
                 $this->error = "-3 socket could not be created";
                 break;
             case "-4":
                 $this->error = "-4 dns lookup on hostname \"" . $host_name . "\" failed";
                 break;
             case "-5":
                 $this->error = "-5 connection refused or timed out";
                 break;
             case "-6":
                 $this->error = "-6 fdopen() call failed";
                 break;
             case "-7":
                 $this->error = "-7 setvbuf() call failed";
                 break;
             default:
                 $this->error = $error . " could not connect to the host \"" . $domain . "\"";
                 break;
         }
         return 0;
     }
     if ($this->timeout && (function_exists($function = "stream_set_timeout") || function_exists($function = "socket_set_timeout") || function_exists($function = "set_socket_timeout"))) {
         $function($connection, $this->timeout);
     }
     $uri = "/host/" . UrlEncode($ip) . ".html";
     if (!fputs($connection, "GET {$uri} HTTP/1.0\r\n" . "Host: {$domain}\r\n" . "User-Agent: " . $this->http_user_agent . "\r\n" . "\r\n")) {
         $this->error = "could not retrieve the hostipinfo site request response";
         fclose($connection);
         return 0;
     }
     $entrada = "";
     while (!feof($connection)) {
         $entrada = $entrada . fgets($connection, 1024);
     }
     fclose($connection);
     //$entrada = str_replace(" ","",$entrada);
     $location['LAT'] = "";
     $location['LONG'] = "";
     $location['CITY'] = "";
     $location['STATE'] = "";
     if ($posicion1 = strpos($entrada, "<td class=\"rqhost\" width=\"35%\"><b>")) {
         $posicion1 += 34;
         $posicion2 = strpos($entrada, "</b>", $posicion1);
         $location['COUNTRY'] = trim(substr($entrada, $posicion1, $posicion2 - $posicion1));
     } else {
         $location['COUNTRY'] = "";
     }
     return 1;
 }
 function __construct($username, $password, $debug = 0, $httpClientDebug = 0)
 {
     $this->client->debug = $httpClientDebug;
     // prepare the login url
     $authentication = strlen($username) ? UrlEncode($username) . ":" . UrlEncode($password) . "@" : "";
     $this->SWS_URL = $this->PROTOCOL . $authentication . $this->SERVER_NAME . $this->SWS_PATH . $this->SWS_BUTLER_NAME;
     if ($debug >= 1) {
         echo "SWS_URL=" . $this->SWS_URL . "\n";
     }
     $this->client = new http_class();
     $this->client->prefer_curl = 1;
     $this->client->user_agent = 'SWS PHP Client - (httpclient - http://www.phpclasses.org/httpclient $Revision: 1.76 $';
     $this->client->follow_redirect = 1;
     $this->client->authentication_mechanism = 'Basic';
 }
Ejemplo n.º 4
0
    public function setValues($id, $pw, $dnr, $snr, $msg, $customer_id, $campaign_id, $delivery_receipt, $unique_msg_id)
    {
        $ActionResult = false;
        if (160 < strlen($msg)) {
            $NearestSpace = strpos($msg, ' ', 160);
            $Message = substr($msg, 0, $NearestSpace);
            $SecondMessage = substr($msg, $NearestSpace, strlen($msg));
        } else {
            $Message = $msg;
            $SecondMessage = "";
        }
        $url = "http://smsgw1.a2p.mme.syniverse.com/sms.php?" . "id={$id}" . "&pw=" . UrlEncode($pw) . "&drep=" . $delivery_receipt . "&dnr=" . UrlEncode($dnr) . "&snr=" . UrlEncode($snr) . "&dtag=" . $unique_msg_id . "&msg=" . UrlEncode($Message);
        if ($f = @fopen($url, "r")) {
            $answer = fgets($f, 255);
            if (substr($answer, 0, 1) == "+") {
                $res = "success: {$answer}";
                $ActionResult = true;
            } else {
                $res = "failure: {$answer}";
                $ActionResult = $res;
            }
        } else {
            $res = "failure: error opening URL";
        }
        if ($SecondMessage != "") {
            $url = "http://smsgw1.a2p.mme.syniverse.com/sms.php?" . "id={$id}" . "&pw=" . UrlEncode($pw) . "&drep=" . $delivery_receipt . "&dnr=" . UrlEncode($dnr) . "&snr=" . UrlEncode($snr) . "&dtag=" . $unique_msg_id . "&msg=" . UrlEncode($SecondMessage);
            if ($f = @fopen($url, "r")) {
                $answer = fgets($f, 255);
                if (substr($answer, 0, 1) == "+") {
                    $res = "success: {$answer}";
                    $ActionResult = true;
                } else {
                    $res = "failure: {$answer}";
                    $ActionResult = $res;
                }
            } else {
                $res = "failure: error opening URL";
            }
        }
        $db = new DatabaseManager(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
        $SQL = 'INSERT INTO MessagingOutGoingLog(AdminCustomerID,CampaignCampaignID,MessagingMessageTypeID,DeliveryReceipt,Destination,Message,MessageKey,Result) 
VALUES(' . $customer_id . ', ' . $campaign_id . ', 4, "' . $delivery_receipt . '", "' . $dnr . '", "' . mysql_real_escape_string($msg) . '", "' . $unique_msg_id . '", "' . mysql_real_escape_string($res) . '")';
        $db->setQuery($SQL);
        $db->Query();
        return $ActionResult;
    }
Ejemplo n.º 5
0
 private function GenerateSignatureBase($url, $consumerKey, $token, $httpMethod, $timeStamp, $nonce, $signatureType, &$normalizedUrl, &$normalizedRequestParameters)
 {
     $parameters = array();
     $elements = explode('?', $url);
     $parameters = $this->GetQueryParameters($elements[1]);
     $parameters[OAuthBase::$OAUTH_VERSION] = OAuthBase::$OAUTH_VERSION_NUMBER;
     $parameters[OAuthBase::$OAUTH_NONCE] = $nonce;
     $parameters[OAuthBase::$OAUTH_TIMESTAMP] = $timeStamp;
     $parameters[OAuthBase::$OAUTH_SIGNATURE_METHOD] = $signatureType;
     $parameters[OAuthBase::$OAUTH_CONSUMER_KEY] = $consumerKey;
     if (!empty($token)) {
         $parameters[OAuthBase::$OAUTH_TOKEN] = $token;
     }
     $normalizedUrl = $elements[0];
     $normalizedRequestParameters = $this->NormalizeRequestParameters($parameters);
     return $httpMethod . '&' . UrlEncode($normalizedUrl) . '&' . UrlEncode($normalizedRequestParameters);
 }
Ejemplo n.º 6
0
 function send_ewm()
 {
     //-----获取access_token
     $access_token = get_access_token();
     //----生成二维码
     $ewmid = I('ewmid');
     $postUrl = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token;
     $postJson = '{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": ' . $ewmid . '}}}';
     $return = json_decode(http_post($postUrl, $postJson), true);
     if ($return['errcode'] == 0) {
         $ticket = $return['ticket'];
         $qr_code = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . UrlEncode($ticket);
         $this->qr_code_save($qr_code, $ewmid);
         $this->success('生成二维码成功');
     } else {
         $this->error('生成二维码失败,错误的返回码是:' . $res['errcode'] . ', 错误的提示是:' . $res['errmsg']);
     }
 }
Ejemplo n.º 7
0
							"' . CUtil::JSEscape($arFields['PROPERTY_TYPE']) . '",
							"' . CUtil::JSEscape($arFields['USER_TYPE']) . '"
						);
						top.BX.closeWait();
						top.BX.WindowManager.Get().AllowClose();
						top.BX.WindowManager.Get().Close();
					</script>';
                die;
            }
            if (strlen($return_url) > 0) {
                LocalRedirect($return_url);
            } else {
                LocalRedirect('iblock_property_admin.php?lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $intIBlockID . ($_REQUEST["admin"] == "Y" ? "&admin=Y" : "&admin=N"));
            }
        }
        LocalRedirect("iblock_edit_property.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $IBLOCK_ID . "&find_section_section=" . intval($find_section_section) . '&ID=' . intval($str_PROPERTY_ID) . (strlen($return_url) > 0 ? "&return_url=" . UrlEncode($return_url) : "") . ($_REQUEST["admin"] == "Y" ? "&admin=Y" : "&admin=N"));
    }
}
$strReceiver = '';
if (isset($_REQUEST["PARAMS"]['RECEIVER'])) {
    $strReceiver = preg_replace("/[^a-zA-Z0-9_:]/", "", htmlspecialcharsbx($_REQUEST["PARAMS"]['RECEIVER']));
}
if (isset($_REQUEST['saveresult'])) {
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_js.php";
    unset($_POST['saveresult']);
    $PARAMS = $_POST['PARAMS'];
    unset($_POST['PARAMS']);
    $arProperty = array();
    $arFieldsList = $DB->GetTableFieldsList("b_iblock_property");
    foreach ($arFieldsList as $strFieldName) {
        if (!in_array($strFieldName, $arDisabledPropFields)) {
Ejemplo n.º 8
0
 function SendRequest($arguments)
 {
     // support ::fetch, ::wget
     //$this->_redirects = array();
     if (strlen($this->error)) {
         return $this->error;
     }
     if (isset($arguments["ProxyUser"])) {
         $this->proxy_request_user = $arguments["ProxyUser"];
     } elseif (isset($this->proxy_user)) {
         $this->proxy_request_user = $this->proxy_user;
     }
     if (isset($arguments["ProxyPassword"])) {
         $this->proxy_request_password = $arguments["ProxyPassword"];
     } elseif (isset($this->proxy_password)) {
         $this->proxy_request_password = $this->proxy_password;
     }
     if (isset($arguments["ProxyRealm"])) {
         $this->proxy_request_realm = $arguments["ProxyRealm"];
     } elseif (isset($this->proxy_realm)) {
         $this->proxy_request_realm = $this->proxy_realm;
     }
     if (isset($arguments["ProxyWorkstation"])) {
         $this->proxy_request_workstation = $arguments["ProxyWorkstation"];
     } elseif (isset($this->proxy_workstation)) {
         $this->proxy_request_workstation = $this->proxy_workstation;
     }
     switch ($this->state) {
         case "Disconnected":
             return $this->SetError("1 connection was not yet established");
         case "Connected":
             $connect = 0;
             break;
         case "ConnectedToProxy":
             if (strlen($error = $this->ConnectFromProxy($arguments, $headers))) {
                 return $error;
             }
             $connect = 1;
             break;
         default:
             return $this->SetError("2 can not send request in the current connection state");
     }
     if (isset($arguments["RequestMethod"])) {
         $this->request_method = $arguments["RequestMethod"];
     }
     if (isset($arguments["User-Agent"])) {
         $this->user_agent = $arguments["User-Agent"];
     }
     if (!isset($arguments["Headers"]["User-Agent"]) && strlen($this->user_agent)) {
         $arguments["Headers"]["User-Agent"] = $this->user_agent;
     }
     if (strlen($this->request_method) == 0) {
         return $this->SetError("3 it was not specified a valid request method");
     }
     if (isset($arguments["RequestURI"])) {
         $this->request_uri = $arguments["RequestURI"];
     }
     if (strlen($this->request_uri) == 0 || substr($this->request_uri, 0, 1) != "/") {
         return $this->SetError("4 it was not specified a valid request URI");
     }
     $this->request_arguments = $arguments;
     $this->request_headers = isset($arguments["Headers"]) ? $arguments["Headers"] : array();
     $body_length = 0;
     $this->request_body = "";
     $get_body = 1;
     if ($this->request_method == "POST" || $this->request_method == "PUT") {
         if (isset($arguments['StreamRequest'])) {
             $get_body = 0;
             $this->request_headers["Transfer-Encoding"] = "chunked";
         } elseif (isset($arguments["PostFiles"]) || $this->force_multipart_form_post && isset($arguments["PostValues"])) {
             $boundary = "--" . md5(uniqid(time()));
             $this->request_headers["Content-Type"] = "multipart/form-data; boundary=" . $boundary . (isset($arguments["CharSet"]) ? "; charset=" . $arguments["CharSet"] : "");
             $post_parts = array();
             if (isset($arguments["PostValues"])) {
                 $values = $arguments["PostValues"];
                 if (GetType($values) != "array") {
                     return $this->SetError("5 it was not specified a valid POST method values array");
                 }
                 for (Reset($values), $value = 0; $value < count($values); Next($values), $value++) {
                     $input = Key($values);
                     $headers = "--" . $boundary . "\r\nContent-Disposition: form-data; name=\"" . $input . "\"\r\n\r\n";
                     $data = $values[$input];
                     $post_parts[] = array("HEADERS" => $headers, "DATA" => $data);
                     $body_length += strlen($headers) + strlen($data) + strlen("\r\n");
                 }
             }
             $body_length += strlen("--" . $boundary . "--\r\n");
             $files = isset($arguments["PostFiles"]) ? $arguments["PostFiles"] : array();
             Reset($files);
             $end = GetType($input = Key($files)) != "string";
             for (; !$end;) {
                 if (strlen($error = $this->GetFileDefinition($files[$input], $definition))) {
                     return "3 " . $error;
                 }
                 $headers = "--" . $boundary . "\r\nContent-Disposition: form-data; name=\"" . $input . "\"; filename=\"" . $definition["NAME"] . "\"\r\nContent-Type: " . $definition["Content-Type"] . "\r\n\r\n";
                 $part = count($post_parts);
                 $post_parts[$part] = array("HEADERS" => $headers);
                 if (isset($definition["FILENAME"])) {
                     $post_parts[$part]["FILENAME"] = $definition["FILENAME"];
                     $data = "";
                 } else {
                     $data = $definition["DATA"];
                 }
                 $post_parts[$part]["DATA"] = $data;
                 $body_length += strlen($headers) + $definition["Content-Length"] + strlen("\r\n");
                 Next($files);
                 $end = GetType($input = Key($files)) != "string";
             }
             $get_body = 0;
         } elseif (isset($arguments["PostValues"])) {
             $values = $arguments["PostValues"];
             if (GetType($values) != "array") {
                 return $this->SetError("5 it was not specified a valid POST method values array");
             }
             for (Reset($values), $value = 0; $value < count($values); Next($values), $value++) {
                 $k = Key($values);
                 if (GetType($values[$k]) == "array") {
                     for ($v = 0; $v < count($values[$k]); $v++) {
                         if ($value + $v > 0) {
                             $this->request_body .= "&";
                         }
                         $this->request_body .= UrlEncode($k) . "=" . UrlEncode($values[$k][$v]);
                     }
                 } else {
                     if ($value > 0) {
                         $this->request_body .= "&";
                     }
                     $this->request_body .= UrlEncode($k) . "=" . UrlEncode($values[$k]);
                 }
             }
             $this->request_headers["Content-Type"] = "application/x-www-form-urlencoded" . (isset($arguments["CharSet"]) ? "; charset=" . $arguments["CharSet"] : "");
             $get_body = 0;
         }
     }
     if ($get_body && (isset($arguments["Body"]) || isset($arguments["BodyStream"]))) {
         if (isset($arguments["Body"])) {
             $this->request_body = $arguments["Body"];
         } else {
             $stream = $arguments["BodyStream"];
             $this->request_body = "";
             for ($part = 0; $part < count($stream); $part++) {
                 if (isset($stream[$part]["Data"])) {
                     $this->request_body .= $stream[$part]["Data"];
                 } elseif (isset($stream[$part]["File"])) {
                     if (!($file = @fopen($stream[$part]["File"], "rb"))) {
                         return $this->SetPHPError("could not open upload file " . $stream[$part]["File"], $php_errormsg);
                     }
                     while (!feof($file)) {
                         if (GetType($block = @fread($file, $this->file_buffer_length)) != "string") {
                             $error = $this->SetPHPError("could not read body stream file " . $stream[$part]["File"], $php_errormsg);
                             fclose($file);
                             return $error;
                         }
                         $this->request_body .= $block;
                     }
                     fclose($file);
                 } else {
                     return "5 it was not specified a valid file or data body stream element at position " . $part;
                 }
             }
         }
         if (!isset($this->request_headers["Content-Type"])) {
             $this->request_headers["Content-Type"] = "application/octet-stream" . (isset($arguments["CharSet"]) ? "; charset=" . $arguments["CharSet"] : "");
         }
     }
     if (isset($arguments["AuthUser"])) {
         $this->request_user = $arguments["AuthUser"];
     } elseif (isset($this->user)) {
         $this->request_user = $this->user;
     }
     if (isset($arguments["AuthPassword"])) {
         $this->request_password = $arguments["AuthPassword"];
     } elseif (isset($this->password)) {
         $this->request_password = $this->password;
     }
     if (isset($arguments["AuthRealm"])) {
         $this->request_realm = $arguments["AuthRealm"];
     } elseif (isset($this->realm)) {
         $this->request_realm = $this->realm;
     }
     if (isset($arguments["AuthWorkstation"])) {
         $this->request_workstation = $arguments["AuthWorkstation"];
     } elseif (isset($this->workstation)) {
         $this->request_workstation = $this->workstation;
     }
     if (strlen($this->proxy_host_name) == 0 || $connect) {
         $request_uri = $this->request_uri;
     } else {
         switch (strtolower($this->protocol)) {
             case "http":
                 $default_port = 80;
                 break;
             case "https":
                 $default_port = 443;
                 break;
         }
         $request_uri = strtolower($this->protocol) . "://" . $this->host_name . ($this->host_port == 0 || $this->host_port == $default_port ? "" : ":" . $this->host_port) . $this->request_uri;
     }
     if ($this->use_curl) {
         $version = GetType($v = curl_version()) == "array" ? isset($v["version"]) ? $v["version"] : "0.0.0" : (preg_match("#^libcurl/([0-9]+\\.[0-9]+\\.[0-9]+)#", $v, $m) ? $m[1] : "0.0.0");
         $curl_version = 100000 * intval($this->Tokenize($version, ".")) + 1000 * intval($this->Tokenize(".")) + intval($this->Tokenize(""));
         $protocol_version = $curl_version < 713002 ? "1.0" : $this->protocol_version;
     } else {
         $protocol_version = $this->protocol_version;
     }
     $this->request = $this->request_method . " " . $request_uri . " HTTP/" . $protocol_version;
     if ($body_length || ($body_length = strlen($this->request_body))) {
         $this->request_headers["Content-Length"] = $body_length;
     }
     for ($headers = array(), $host_set = 0, Reset($this->request_headers), $header = 0; $header < count($this->request_headers); Next($this->request_headers), $header++) {
         $header_name = Key($this->request_headers);
         $header_value = $this->request_headers[$header_name];
         if (GetType($header_value) == "array") {
             for (Reset($header_value), $value = 0; $value < count($header_value); Next($header_value), $value++) {
                 $headers[] = $header_name . ": " . $header_value[Key($header_value)];
             }
         } else {
             $headers[] = $header_name . ": " . $header_value;
         }
         if (strtolower(Key($this->request_headers)) == "host") {
             $this->request_host = strtolower($header_value);
             $host_set = 1;
         }
     }
     if (!$host_set) {
         $headers[] = "Host: " . $this->host_name;
         $this->request_host = strtolower($this->host_name);
     }
     if (count($this->cookies)) {
         $cookies = array();
         $this->PickCookies($cookies, 0);
         if (strtolower($this->protocol) == "https") {
             $this->PickCookies($cookies, 1);
         }
         if (count($cookies)) {
             $h = count($headers);
             $headers[$h] = "Cookie:";
             for (Reset($cookies), $cookie = 0; $cookie < count($cookies); Next($cookies), $cookie++) {
                 $cookie_name = Key($cookies);
                 $headers[$h] .= " " . $cookie_name . "=" . $cookies[$cookie_name]["value"] . ";";
             }
         }
     }
     $next_state = "RequestSent";
     if ($this->use_curl) {
         if (isset($arguments['StreamRequest'])) {
             return $this->SetError("Streaming request data is not supported when using Curl");
         }
         if ($body_length && strlen($this->request_body) == 0) {
             for ($request_body = "", $success = 1, $part = 0; $part < count($post_parts); $part++) {
                 $request_body .= $post_parts[$part]["HEADERS"] . $post_parts[$part]["DATA"];
                 if (isset($post_parts[$part]["FILENAME"])) {
                     if (!($file = @fopen($post_parts[$part]["FILENAME"], "rb"))) {
                         $this->SetPHPError("could not open upload file " . $post_parts[$part]["FILENAME"], $php_errormsg);
                         $success = 0;
                         break;
                     }
                     while (!feof($file)) {
                         if (GetType($block = @fread($file, $this->file_buffer_length)) != "string") {
                             $this->SetPHPError("could not read upload file", $php_errormsg);
                             $success = 0;
                             break;
                         }
                         $request_body .= $block;
                     }
                     fclose($file);
                     if (!$success) {
                         break;
                     }
                 }
                 $request_body .= "\r\n";
             }
             $request_body .= "--" . $boundary . "--\r\n";
         } else {
             $request_body = $this->request_body;
         }
         $this->_last_ip = '';
         // multihome
         if ($this->_use_multihome && !empty($this->_use_multihome)) {
             $mip = is_array($this->_use_multihome) ? $this->_use_multihome[mt_rand(0, count($this->_use_multihome) - 1)] : $this->_use_multihome;
             $this->_last_ip = $mip;
             curl_setopt($this->connection, CURLOPT_INTERFACE, $mip);
         }
         if ($this->_headers) {
             // curl_setopt($this->connection, CURLOPT_HTTPHEADER, $this->_headers);
             $headers = array_merge($headers, $this->_headers);
         }
         curl_setopt($this->connection, CURLOPT_HEADER, 1);
         curl_setopt($this->connection, CURLOPT_RETURNTRANSFER, 1);
         if ($this->timeout) {
             curl_setopt($this->connection, CURLOPT_TIMEOUT, $this->timeout);
         }
         curl_setopt($this->connection, CURLOPT_SSL_VERIFYPEER, 0);
         curl_setopt($this->connection, CURLOPT_SSL_VERIFYHOST, 0);
         $request = $this->request . "\r\n" . implode("\r\n", $headers) . "\r\n\r\n" . $request_body;
         curl_setopt($this->connection, CURLOPT_CUSTOMREQUEST, $request);
         if ($this->debug) {
             $this->OutputDebug("C " . $request);
         }
         if (!($success = strlen($this->response = curl_exec($this->connection)) != 0)) {
             $error = curl_error($this->connection);
             $this->SetError("Could not execute the request" . (strlen($error) ? ": " . $error : ""));
         }
     } else {
         if ($success = $this->PutLine($this->request)) {
             for ($header = 0; $header < count($headers); $header++) {
                 if (!($success = $this->PutLine($headers[$header]))) {
                     break;
                 }
             }
             if ($success && ($success = $this->PutLine(""))) {
                 if (isset($arguments['StreamRequest'])) {
                     $next_state = "SendingRequestBody";
                 } elseif ($body_length) {
                     if (strlen($this->request_body)) {
                         $success = $this->PutData($this->request_body);
                     } else {
                         for ($part = 0; $part < count($post_parts); $part++) {
                             if (!($success = $this->PutData($post_parts[$part]["HEADERS"])) || !($success = $this->PutData($post_parts[$part]["DATA"]))) {
                                 break;
                             }
                             if (isset($post_parts[$part]["FILENAME"])) {
                                 if (!($file = @fopen($post_parts[$part]["FILENAME"], "rb"))) {
                                     $this->SetPHPError("could not open upload file " . $post_parts[$part]["FILENAME"], $php_errormsg);
                                     $success = 0;
                                     break;
                                 }
                                 while (!feof($file)) {
                                     if (GetType($block = @fread($file, $this->file_buffer_length)) != "string") {
                                         $this->SetPHPError("could not read upload file", $php_errormsg);
                                         $success = 0;
                                         break;
                                     }
                                     if (!($success = $this->PutData($block))) {
                                         break;
                                     }
                                 }
                                 fclose($file);
                                 if (!$success) {
                                     break;
                                 }
                             }
                             if (!($success = $this->PutLine(""))) {
                                 break;
                             }
                         }
                         if ($success) {
                             $success = $this->PutLine("--" . $boundary . "--");
                         }
                     }
                     if ($success) {
                         $sucess = $this->FlushData();
                     }
                 }
             }
         }
     }
     if (!$success) {
         return $this->SetError("5 could not send the HTTP request: " . $this->error);
     }
     $this->state = $next_state;
     return "";
 }
Ejemplo n.º 9
0
                     $val = $arImage["IMG"];
                 }
                 break;
             case 'TIME_ZONE':
                 if ($arResult["User"]["AUTO_TIME_ZONE"] != "N") {
                     continue 2;
                 }
                 break;
             case 'LAST_LOGIN':
                 if (StrLen($val) > 0) {
                     $val = FormatDate($DB->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp($val, FORMAT_DATETIME));
                 }
                 break;
             default:
                 if (in_array($userFieldName, $arParams["SONET_USER_FIELDS_SEARCHABLE"])) {
                     $strSearch = $arParams["PATH_TO_SEARCH_INNER"] . (StrPos($arParams["PATH_TO_SEARCH_INNER"], "?") !== false ? "&" : "?") . "flt_" . StrToLower($userFieldName) . "=" . UrlEncode($val);
                 }
                 break;
         }
         if (in_array($userFieldName, $arParams["USER_FIELDS_MAIN"])) {
             $arResult["UserFieldsMain"]["DATA"][$userFieldName] = array("NAME" => GetMessage("SONET_UP1_" . $userFieldName), "VALUE" => $val, "SEARCH" => $strSearch);
         }
         if (in_array($userFieldName, $arParams["USER_FIELDS_CONTACT"])) {
             $arResult["UserFieldsContact"]["DATA"][$userFieldName] = array("NAME" => GetMessage("SONET_UP1_" . $userFieldName), "VALUE" => $val, "SEARCH" => $strSearch);
         }
         if (in_array($userFieldName, $arParams["USER_FIELDS_PERSONAL"])) {
             $arResult["UserFieldsPersonal"]["DATA"][$userFieldName] = array("NAME" => GetMessage("SONET_UP1_" . $userFieldName), "VALUE" => $val, "SEARCH" => $strSearch);
         }
     }
 }
 if (count($arResult["UserFieldsMain"]["DATA"]) > 0) {
Ejemplo n.º 10
0
 function ActivateCoupon($_283989430, &$_2132833962, $_570174288 = false, $_1009125337 = "Y")
 {
     $_1272261578 = ___1498308727(155);
     CUpdateClient::AddMessage2Log(___1498308727(156));
     $_2050725472 = CUpdateClient::CollectRequestData($_1272261578, $_570174288, $_1009125337, array(), array(), array());
     if ($_2050725472 === False || StrLen($_2050725472) <= 1352 / 2 - 676 || StrLen($_1272261578) > min(156, 0, 52)) {
         if (StrLen($_1272261578) <= min(40, 0, 13.333333333333)) {
             $_1272261578 = ___1498308727(157) . GetMessage(___1498308727(158)) . ___1498308727(159);
         }
     }
     if (StrLen($_1272261578) <= 190 * 2 - 380) {
         $_2050725472 .= ___1498308727(160) . UrlEncode($_283989430) . ___1498308727(161);
         CUpdateClient::AddMessage2Log($GLOBALS['____467353288'][39](___1498308727(162), ___1498308727(163), $_2050725472));
         $_145565738 = CUpdateClient::getmicrotime();
         $_1501652390 = CUpdateClient::GetHTTPPage(___1498308727(164), $_2050725472, $_1272261578);
         if ($GLOBALS['____467353288'][40]($_1501652390) <= min(48, 0, 16)) {
             if (StrLen($_1272261578) <= min(242, 0, 80.666666666667)) {
                 $_1272261578 = ___1498308727(165) . GetMessage(___1498308727(166)) . ___1498308727(167);
             }
         }
         CUpdateClient::AddMessage2Log(___1498308727(168) . Round(CUpdateClient::getmicrotime() - $_145565738, round(0 + 1.5 + 1.5)) . ___1498308727(169));
     }
     if ($GLOBALS['____467353288'][41]($_1272261578) <= 1100 / 2 - 550) {
         $_1322185471 = array();
         CUpdateClient::ParseServerData($_1501652390, $_1322185471, $_1272261578);
     }
     if ($GLOBALS['____467353288'][42]($_1272261578) <= 183 * 2 - 366) {
         if (isset($_1322185471[___1498308727(170)][___1498308727(171)][___1498308727(172)]) && $GLOBALS['____467353288'][43]($_1322185471[___1498308727(173)][___1498308727(174)][___1498308727(175)]) && $GLOBALS['____467353288'][44]($_1322185471[___1498308727(176)][___1498308727(177)][___1498308727(178)]) > 142 * 2 - 284) {
             for ($_774284784 = min(66, 0, 22), $_1749022688 = $GLOBALS['____467353288'][45]($_1322185471[___1498308727(179)][___1498308727(180)][___1498308727(181)]); $_774284784 < $_1749022688; $_774284784++) {
                 if ($GLOBALS['____467353288'][46]($_1322185471[___1498308727(182)][___1498308727(183)][___1498308727(184)][$_774284784][___1498308727(185)][___1498308727(186)]) > 1168 / 2 - 584) {
                     $_1272261578 .= ___1498308727(187) . $_1322185471[___1498308727(188)][___1498308727(189)][___1498308727(190)][$_774284784][___1498308727(191)][___1498308727(192)] . ___1498308727(193);
                 }
                 $_1272261578 .= $_1322185471[___1498308727(194)][___1498308727(195)][___1498308727(196)][$_774284784][___1498308727(197)] . ___1498308727(198);
             }
         }
     }
     if ($GLOBALS['____467353288'][47]($_1272261578) <= 772 - 2 * 386) {
         if (isset($_1322185471[___1498308727(199)][___1498308727(200)][___1498308727(201)]) && $GLOBALS['____467353288'][48]($_1322185471[___1498308727(202)][___1498308727(203)][___1498308727(204)])) {
             COption::$GLOBALS['_____1306963051'][5](___1498308727(205), ___1498308727(206), ___1498308727(207));
             CUpdateClient::__944347844($_1322185471[___1498308727(208)][___1498308727(209)][___1498308727(210)][min(92, 0, 30.666666666667)][___1498308727(211)]);
         }
     }
     if ($GLOBALS['____467353288'][49]($_1272261578) > 160 * 2 - 320) {
         CUpdateClient::AddMessage2Log($_1272261578, ___1498308727(212));
         $_2132833962 .= $_1272261578;
         return False;
     } else {
         return True;
     }
 }
Ejemplo n.º 11
0
		x1.style.display='none';
		x2.style.display='none';
		__CHRow(x3);
	}
}

function __NewDocTempl(id)
{
	window.location='/bitrix/admin/fileman_html_edit.php?lang=<?php 
        echo LANG;
        ?>
&site=<?php 
        echo Urlencode($site);
        ?>
&path=<?php 
        echo UrlEncode($path);
        ?>
&new=y&template='+id;
	new_doc_list.PopupHide();
}

BX.ready(function() {
	BX.addCustomEvent(document.forms.ffilemanedit, 'onAutoSavePrepare', function (ob, handler)
	{
		BX.bind(document.forms.ffilemanedit.propeditmore, 'click', handler);
	});

	BX.addCustomEvent(document.forms.ffilemanedit, 'onAutoSaveRestore', function (ob, data)
	{
		var i = <?php 
        echo count($arAllPropFields);
        ?>
&<?php 
        echo bitrix_sessid_get();
        ?>
&ts=" + ts + "&completed=" + completed + "&startpoint=" + startPoint + "&updRand=" + updRand;
			<?php 
    } elseif ($action == "collect") {
        ?>
				data = "fcajax=cl&region=<?php 
        echo IntVal($region);
        ?>
&exts=<?php 
        echo UrlEncode($_REQUEST['checker_exts']);
        ?>
&pwd=<?php 
        echo UrlEncode($_REQUEST['checker_pwd']);
        ?>
&tm=<?php 
        echo IntVal($_REQUEST['checker_time']);
        ?>
&<?php 
        echo bitrix_sessid_get();
        ?>
&ts=" + ts + "&completed=" + completed + "&startpoint=" + startPoint + "&updRand=" + updRand;
			<?php 
    }
    ?>
			BX.ajax.post("/bitrix/admin/security_file_verifier.php", data, callback);
		}

		function __FCLoadCollectDataResult(result)
Ejemplo n.º 13
0
 function GetIpLocation($ip, &$location)
 {
     $location = array();
     if (!strcmp($ip, "127.0.0.1")) {
         $this->error = "{$ip} is not a valid public Internet address!";
         return 0;
     }
     $domain = "freeipservices.com";
     if (!($connection = $this->timeout ? @fsockopen($domain, 80, $errno, $error, $this->timeout) : @fsockopen($domain, 80))) {
         switch ($error = $this->timeout ? strval($errno) : "??") {
             case "-3":
                 $this->error = "-3 socket could not be created";
                 break;
             case "-4":
                 $this->error = "-4 dns lookup on hostname \"" . $host_name . "\" failed";
                 break;
             case "-5":
                 $this->error = "-5 connection refused or timed out";
                 break;
             case "-6":
                 $this->error = "-6 fdopen() call failed";
                 break;
             case "-7":
                 $this->error = "-7 setvbuf() call failed";
                 break;
             default:
                 $this->error = $error . " could not connect to the host \"" . $domain . "\"";
                 break;
         }
         return 0;
     }
     if ($this->timeout && (function_exists($function = "stream_set_timeout") || function_exists($function = "socket_set_timeout") || function_exists($function = "set_socket_timeout"))) {
         $function($connection, $this->timeout);
     }
     $uri = "/ip2geo?url=" . UrlEncode($ip);
     if (!fputs($connection, "GET {$uri} HTTP/1.0\r\n" . "Host: {$domain}\r\n" . "User-Agent: " . $this->http_user_agent . "\r\n" . "\r\n")) {
         $this->error = "could not retrieve the freeipservices site request response";
         fclose($connection);
         return 0;
     }
     $entrada = "";
     while (!feof($connection)) {
         $entrada = $entrada . fgets($connection, 1024);
     }
     fclose($connection);
     $entrada = str_replace(" ", "", $entrada);
     if ($posicion1 = strpos($entrada, "functiongetLat(){return'")) {
         $posicion1 += 24;
         $posicion2 = strpos($entrada, "';}", $posicion1);
         $location['LAT'] = substr($entrada, $posicion1, $posicion2 - $posicion1);
     } else {
         return 0;
     }
     if ($posicion1 = strpos($entrada, "functiongetLng(){return'")) {
         $posicion1 += 24;
         $posicion2 = strpos($entrada, "';}", $posicion1);
         $location['LONG'] = substr($entrada, $posicion1, $posicion2 - $posicion1);
     } else {
         return 0;
     }
     if ($posicion1 = strpos($entrada, "functiongetCity(){return'")) {
         $posicion1 += 25;
         $posicion2 = strpos($entrada, "';}", $posicion1);
         $location['CITY'] = substr($entrada, $posicion1, $posicion2 - $posicion1);
     } else {
         $location['CITY'] = "";
     }
     if ($posicion1 = strpos($entrada, "functiongetState(){return'")) {
         $posicion1 += 26;
         $posicion2 = strpos($entrada, "';}", $posicion1);
         $location['STATE'] = substr($entrada, $posicion1, $posicion2 - $posicion1);
     } else {
         $location['STATE'] = "";
     }
     if ($posicion1 = strpos($entrada, "functiongetCountry(){return'")) {
         $posicion1 += 28;
         $posicion2 = strpos($entrada, "';}", $posicion1);
         $location['COUNTRY'] = substr($entrada, $posicion1, $posicion2 - $posicion1);
     } else {
         $location['COUNTRY'] = "";
     }
     return 1;
 }
Ejemplo n.º 14
0
?>
">
		<input type="hidden" name="extended" value="Y">
		</table>
	<?endif//if($bSimple):?>

	</td>
	</tr>

	<?$tabControl->EndTab();?>

	<?
	$tabControl->Buttons(
		array(
			"disabled" => false,
			"back_url" => ((strlen($back_url)>0 && strpos($back_url, "/freetrix/admin/fileman_menu_edit.php")!==0) ? htmlspecialcharsex($back_url) : "/freetrix/admin/fileman_admin.php?".$addUrl."&site=".Urlencode($site)."&path=".UrlEncode($arParsedPath["FULL"]))
		)
	);
	?>

	<?$tabControl->End();?>

</form>

<?endif?>
<?php 
echo BeginNote();
?>
<span class="required"><sup>1</sup></span> - <?php 
echo GetMessage("MAIN_PERIOD_NOTE");
echo EndNote();
Ejemplo n.º 15
0
 function AddActionParameter(&$form, $parameter, $value)
 {
     $url = $form->ACTION . (GetType(strpos($form->ACTION, '?')) == 'integer' ? strlen($form->ACTION) > 1 ? '&' : '' : '?') . UrlEncode($parameter) . '=' . UrlEncode($value);
     $p = $this->custom_parameters;
     $tc = count($p);
     for (Reset($p), $c = 0; $c < $tc; Next($p), ++$c) {
         $k = Key($p);
         $url .= '&' . UrlEncode($k) . '=' . UrlEncode($p[$k]);
     }
     $p = $this->external_parameters;
     $tc = count($p);
     for (Reset($p), $c = 0; $c < $tc; Next($p), ++$c) {
         $k = Key($p);
         $this->external_parameters[$k] = $form->GetInputValue($k);
         $url .= '&' . UrlEncode($k) . '=' . UrlEncode($this->external_parameters[$k]);
     }
     return $url;
 }
Ejemplo n.º 16
0
 function get_img()
 {
     if ($this->tickets()) {
         return 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . UrlEncode($this->ticket);
     } else {
         return '';
     }
 }
Ejemplo n.º 17
0
<?php 
$tabControl->BeginNextTab();
?>
	<?php 
if ($ID <= 0 && !is_file($_SERVER["DOCUMENT_ROOT"] . $fname)) {
    ?>
	<tr>
		<td><?php 
    echo GetMessage("FLOW_TEMPLATE");
    ?>
</td>
		<td><select name="template" onchange="window.location='/bitrix/admin/workflow_edit.php?lang=<?php 
    echo LANG;
    ?>
&amp;fname=<?php 
    echo UrlEncode($fname);
    ?>
&amp;template='+escape(this[this.selectedIndex].value)"><?php 
    for ($i = 0; $i < count($arTemplates); $i++) {
        ?>
<option value="<?php 
        echo htmlspecialcharsbx($arTemplates[$i]["file"]);
        ?>
"<?php 
        if ($template == $arTemplates[$i]["file"]) {
            echo " selected";
        }
        ?>
><?php 
        echo htmlspecialcharsbx($arTemplates[$i]["name"]);
        ?>
Ejemplo n.º 18
0
 public static function ActivateCoupon($coupon, &$strError, $lang = false, $stableVersionsOnly = "Y")
 {
     $strError_tmp = "";
     CUpdateClientPartner::AddMessage2Log("exec CUpdateClientPartner::ActivateCoupon");
     $strQuery = CUpdateClientPartner::__CollectRequestData($strError_tmp, $lang, $stableVersionsOnly, array(), array());
     if ($strQuery === False || StrLen($strQuery) <= 0 || StrLen($strError_tmp) > 0) {
         if (StrLen($strError_tmp) <= 0) {
             $strError_tmp = "[RV01] " . GetMessage("SUPZ_NO_QSTRING") . ". ";
         }
     }
     if (StrLen($strError_tmp) <= 0) {
         $strQuery .= "&coupon=" . UrlEncode($coupon) . "&query_type=coupon";
         CUpdateClientPartner::AddMessage2Log(preg_replace("/LICENSE_KEY=[^&]*/i", "LICENSE_KEY=X", $strQuery));
         /*
         foreach ($arFields as $key => $value)
         	$strQuery .= "&".$key."=".urlencode($value);
         */
         $stime = CUpdateClientPartner::__GetMicroTime();
         $content = CUpdateClientPartner::__GetHTTPPage("ACTIV", $strQuery, $strError_tmp);
         if (strlen($content) <= 0) {
             if (StrLen($strError_tmp) <= 0) {
                 $strError_tmp = "[GNSU02] " . GetMessage("SUPZ_EMPTY_ANSWER") . ". ";
             }
         }
         CUpdateClientPartner::AddMessage2Log("TIME ActivateCoupon(request) " . Round(CUpdateClientPartner::__GetMicroTime() - $stime, 3) . " sec");
     }
     if (strlen($strError_tmp) <= 0) {
         $arRes = array();
         CUpdateClientPartner::__ParseServerData($content, $arRes, $strError_tmp);
     }
     if (strlen($strError_tmp) <= 0) {
         if (isset($arRes["DATA"]["#"]["ERROR"]) && is_array($arRes["DATA"]["#"]["ERROR"]) && count($arRes["DATA"]["#"]["ERROR"]) > 0) {
             for ($i = 0, $n = count($arRes["DATA"]["#"]["ERROR"]); $i < $n; $i++) {
                 if (strlen($arRes["DATA"]["#"]["ERROR"][$i]["@"]["TYPE"]) > 0) {
                     $strError_tmp .= "[" . $arRes["DATA"]["#"]["ERROR"][$i]["@"]["TYPE"] . "] ";
                 }
                 $strError_tmp .= $arRes["DATA"]["#"]["ERROR"][$i]["#"] . ". ";
             }
         }
     }
     if (strlen($strError_tmp) > 0) {
         CUpdateClientPartner::AddMessage2Log($strError_tmp, "AC");
         $strError .= $strError_tmp;
         return False;
     } else {
         return True;
     }
 }
Ejemplo n.º 19
0
} else {
    $sDocTitle = GetMessage("SALE_NEW_RECORD");
}
$APPLICATION->SetTitle($sDocTitle);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
/*********************************************************************/
/********************  BODY  *****************************************/
/*********************************************************************/
?>

<?php 
$aMenu = array(array("TEXT" => GetMessage("SSEN_2FLIST"), "ICON" => "btn_list", "LINK" => "/bitrix/admin/sale_status.php?lang=" . LANG . GetFilterParams("filter_")));
if (strlen($ID) > 0 && $saleModulePermissions >= "W") {
    $aMenu[] = array("SEPARATOR" => "Y");
    $aMenu[] = array("TEXT" => GetMessage("SSEN_NEW_STATUS"), "ICON" => "btn_new", "LINK" => "/bitrix/admin/sale_status_edit.php?lang=" . LANG . GetFilterParams("filter_"));
    $aMenu[] = array("TEXT" => GetMessage("SSEN_DELETE_STATUS"), "ICON" => "btn_delete", "LINK" => "javascript:if(confirm('" . GetMessage("SSEN_DELETE_STATUS_CONFIRM") . "')) window.location='/bitrix/admin/sale_status.php?action=delete&ID[]=" . UrlEncode($ID) . "&lang=" . LANG . "&" . bitrix_sessid_get() . "#tb';");
}
$context = new CAdminContextMenu($aMenu);
$context->Show();
?>

<?php 
CAdminMessage::ShowMessage($strError);
?>

<form method="POST" action="<?php 
echo $APPLICATION->GetCurPage();
?>
?" name="fform">
<?php 
echo GetFilterHiddens("filter_");
Ejemplo n.º 20
0
<hr />
<?php 
require 'mime_parser.php';
require 'rfc822_addresses.php';
require 'pop3.php';
stream_wrapper_register('pop3', 'pop3_stream');
/* Register the pop3 stream handler class */
$user = UrlEncode("");
$password = UrlEncode("");
$realm = UrlEncode("");
/* Authentication realm or domain            */
$workstation = UrlEncode("");
/* Workstation for NTLM authentication       */
$apop = 0;
/* Use APOP authentication                   */
$authentication_mechanism = UrlEncode("USER");
/* SASL authentication mechanism             */
$debug = 1;
/* Output debug information                  */
$html_debug = 1;
/* Debug information is in HTML              */
$message = 1;
$message_file = 'pop3://' . $user . ':' . $password . '@localhost/' . $message . '?debug=' . $debug . '&html_debug=' . $html_debug . '&realm=' . $realm . '&workstation=' . $workstation . '&apop=' . $apop . '&authentication_mechanism=' . $authentication_mechanism;
/*
 * Access Gmail POP account
 */
/*
 	$message_file='pop3://'.$user.':'.$password.'@pop.gmail.com:995/1?tls=1&debug=1&html_debug=1';
*/
$mime = new mime_parser_class();
/*
Ejemplo n.º 21
0
">
		<input type="hidden" name="extended" value="Y">
		</table>
	<?php 
        }
        ?>

	</td>
	</tr>

	<?php 
        $tabControl->EndTab();
        ?>

	<?php 
        $tabControl->Buttons(array("disabled" => false, "back_url" => strlen($back_url) > 0 && strpos($back_url, "/bitrix/admin/fileman_menu_edit.php") !== 0 ? htmlspecialcharsex($back_url) : "/bitrix/admin/fileman_admin.php?" . $addUrl . "&site=" . Urlencode($site) . "&path=" . UrlEncode($arParsedPath["FULL"])));
        ?>

	<?php 
        $tabControl->End();
        ?>

</form>

<?php 
    }
    echo BeginNote();
    ?>
<span class="required"><sup>1</sup></span> - <?php 
    echo GetMessage("MAIN_PERIOD_NOTE");
    echo EndNote();
Ejemplo n.º 22
0
    if (IntVal($arParams["USERGROUPS_MODIFY"]) > 0) {
        $arParams["USERGROUPS_MODIFY"] = array($arParams["USERGROUPS_MODIFY"]);
    } else {
        $arParams["USERGROUPS_MODIFY"] = array();
    }
}
if (!Is_Array($arParams["USERGROUPS_RESERVE"])) {
    if (IntVal($arParams["USERGROUPS_RESERVE"]) > 0) {
        $arParams["USERGROUPS_RESERVE"] = array($arParams["USERGROUPS_RESERVE"]);
    } else {
        $arParams["USERGROUPS_RESERVE"] = array();
    }
}
$meetingId = IntVal($arParams["MEETING_ID"]);
if ($meetingId <= 0) {
    $meetingId = IntVal($_REQUEST[$arParams["MEETING_VAR"]]);
}
$arResult["Page"] = Trim($arParams["PAGE_ID"]);
if (StrLen($arResult["Page"]) <= 0) {
    $arResult["Page"] = Trim($_REQUEST[$arParams["PAGE_VAR"]]);
}
$arResult["Urls"]["MeetingList"] = $arParams["PATH_TO_MEETING_LIST"];
$arResult["Urls"]["ModifyMeeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MODIFY_MEETING"], array("meeting_id" => $meetingId));
$arResult["Urls"]["CreateMeeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MODIFY_MEETING"], array("meeting_id" => 0));
$arResult["Urls"]["Meeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MEETING"], array("meeting_id" => $meetingId));
$arResult["Urls"]["Meeting"] .= (StrPos($arResult["Urls"]["Meeting"], "?") === false ? "?" : "&") . "week_start=" . UrlEncode($_REQUEST["week_start"]);
$arResult["Urls"]["ReserveMeeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_RESERVE_MEETING"], array("meeting_id" => $meetingId, "item_id" => 0));
$arResult["Urls"]["Search"] = $arParams["PATH_TO_SEARCH"];
$arResult["Perms"]["CanModify"] = $GLOBALS["USER"]->IsAuthorized() && ($GLOBALS["USER"]->IsAdmin() || Count(Array_Intersect($GLOBALS["USER"]->GetUserGroupArray(), $arParams["USERGROUPS_MODIFY"])) > 0);
$arResult["Perms"]["CanReserve"] = $GLOBALS["USER"]->IsAuthorized() && ($GLOBALS["USER"]->IsAdmin() || Count(Array_Intersect($GLOBALS["USER"]->GetUserGroupArray(), $arParams["USERGROUPS_RESERVE"])) > 0);
$this->IncludeComponentTemplate();
Ejemplo n.º 23
0
		</td>
	</tr>
	<tr>
		<td><?php 
echo GetMessage("MURL_RULE");
?>
:</td>
		<td>
			<input type="text" name="RULE" size="50" maxlength="250" value="<?php 
echo $str_RULE;
?>
">
		</td>
	</tr>

<?php 
$tabControl->EndTab();
?>

<?php 
$tabControl->Buttons(array("disabled" => !$isAdmin, "back_url" => "/bitrix/admin/urlrewrite_list.php?lang=" . LANG . "&filter_site_id=" . UrlEncode($site_id) . "&" . GetFilterParams("filter_", false)));
$tabControl->End();
?>
</form>
<?php 
$tabControl->ShowWarnings("form1", $message);
?>


<?php 
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
Ejemplo n.º 24
0
							<option value="<?php 
echo $id;
?>
"<?if($id == $inh_taskId) echo" selected";?>>
							<?echo htmlspecialcharsbx($ar['title'])?>
							<?if($id=="NOT_REF")
								echo "[".$arPermTypes[$pr_taskId]['title']."]";?>
							</option>
						<?endforeach;?>
						</select>
					</td>
				</tr>
			</table></td>
	</tr>
<?endif; //if($USER->CanDoFileOperation('fm_edit_permission',$arPath)):?>

<?
$tabControl->EndTab();
$tabControl->Buttons(
	array(
		"disabled" => (!$USER->CanDoFileOperation('fm_edit_existent_folder',$arPath)),
		"back_url" => (strlen($back_url) > 0 ? $back_url : "fileman_admin.php?".$addUrl."&site=".$site."&path=".UrlEncode($path))
	)
);
$tabControl->End();
?>
</form>

<?endif?>
<?require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin.php");?>
 function Process()
 {
     switch (intval($this->oauth_version)) {
         case 1:
             $one_a = $this->oauth_version === '1.0a';
             if ($this->debug) {
                 $this->OutputDebug('Checking the OAuth token authorization state');
             }
             if (!$this->GetAccessToken($access_token)) {
                 return false;
             }
             if (isset($access_token['authorized']) && isset($access_token['value'])) {
                 $expired = isset($access_token['expiry']) && strcmp($access_token['expiry'], gmstrftime('%Y-%m-%d %H:%M:%S')) <= 0;
                 if (!$access_token['authorized'] || $expired) {
                     if ($this->debug) {
                         if ($expired) {
                             $this->OutputDebug('The OAuth token expired on ' . $access_token['expiry'] . 'UTC');
                         } else {
                             $this->OutputDebug('The OAuth token is not yet authorized');
                         }
                         $this->OutputDebug('Checking the OAuth token and verifier');
                     }
                     if (!$this->GetRequestToken($token, $verifier)) {
                         return false;
                     }
                     if (!isset($token) || $one_a && !isset($verifier)) {
                         if (!$this->GetRequestDenied($denied)) {
                             return false;
                         }
                         if (isset($denied) && $denied === $access_token['value']) {
                             if ($this->debug) {
                                 $this->OutputDebug('The authorization request was denied');
                             }
                             $this->authorization_error = 'the request was denied';
                             return true;
                         } else {
                             if ($this->debug) {
                                 $this->OutputDebug('Reset the OAuth token state because token and verifier are not both set');
                             }
                             $access_token = array();
                         }
                     } elseif ($token !== $access_token['value']) {
                         if ($this->debug) {
                             $this->OutputDebug('Reset the OAuth token state because token does not match what as previously retrieved');
                         }
                         $access_token = array();
                     } else {
                         if (!$this->GetAccessTokenURL($url)) {
                             return false;
                         }
                         $oauth = array('oauth_token' => $token);
                         if ($one_a) {
                             $oauth['oauth_verifier'] = $verifier;
                         }
                         $this->access_token_secret = $access_token['secret'];
                         if (!$this->SendAPIRequest($url, 'GET', array(), $oauth, array('Resource' => 'OAuth access token'), $response)) {
                             return false;
                         }
                         if (strlen($this->access_token_error)) {
                             $this->authorization_error = $this->access_token_error;
                             return true;
                         }
                         if (!isset($response['oauth_token']) || !isset($response['oauth_token_secret'])) {
                             $this->authorization_error = 'it was not returned the access token and secret';
                             return true;
                         }
                         $access_token = array('value' => $response['oauth_token'], 'secret' => $response['oauth_token_secret'], 'authorized' => true);
                         if (isset($response['oauth_expires_in'])) {
                             $expires = $response['oauth_expires_in'];
                             if (strval($expires) !== strval(intval($expires)) || $expires <= 0) {
                                 return $this->SetError('OAuth server did not return a supported type of access token expiry time');
                             }
                             $this->access_token_expiry = gmstrftime('%Y-%m-%d %H:%M:%S', time() + $expires);
                             if ($this->debug) {
                                 $this->OutputDebug('Access token expiry: ' . $this->access_token_expiry . ' UTC');
                             }
                             $access_token['expiry'] = $this->access_token_expiry;
                         } else {
                             $this->access_token_expiry = '';
                         }
                         if (!$this->StoreAccessToken($access_token)) {
                             return false;
                         }
                         if ($this->debug) {
                             $this->OutputDebug('The OAuth token was authorized');
                         }
                     }
                 } elseif ($this->debug) {
                     $this->OutputDebug('The OAuth token was already authorized');
                 }
                 if (isset($access_token['authorized']) && $access_token['authorized']) {
                     $this->access_token = $access_token['value'];
                     $this->access_token_secret = $access_token['secret'];
                     return true;
                 }
             } else {
                 if ($this->debug) {
                     $this->OutputDebug('The OAuth access token is not set');
                 }
                 $access_token = array();
             }
             if (!isset($access_token['authorized'])) {
                 if ($this->debug) {
                     $this->OutputDebug('Requesting the unauthorized OAuth token');
                 }
                 if (!$this->GetRequestTokenURL($url)) {
                     return false;
                 }
                 $url = str_replace('{SCOPE}', UrlEncode($this->scope), $url);
                 if (!$this->GetRedirectURI($redirect_uri)) {
                     return false;
                 }
                 $oauth = array('oauth_callback' => $redirect_uri);
                 if (!$this->SendAPIRequest($url, 'GET', array(), $oauth, array('Resource' => 'OAuth request token'), $response)) {
                     return false;
                 }
                 if (strlen($this->access_token_error)) {
                     $this->authorization_error = $this->access_token_error;
                     return true;
                 }
                 if (!isset($response['oauth_token']) || !isset($response['oauth_token_secret'])) {
                     $this->authorization_error = 'it was not returned the requested token';
                     return true;
                 }
                 $access_token = array('value' => $response['oauth_token'], 'secret' => $response['oauth_token_secret'], 'authorized' => false);
                 if (!$this->StoreAccessToken($access_token)) {
                     return false;
                 }
             }
             if (!$this->GetDialogURL($url)) {
                 return false;
             }
             $url .= '?oauth_token=' . $access_token['value'];
             if (!$one_a) {
                 if (!$this->GetRedirectURI($redirect_uri)) {
                     return false;
                 }
                 $url .= '&oauth_callback=' . UrlEncode($redirect_uri);
             }
             if ($this->debug) {
                 $this->OutputDebug('Redirecting to OAuth authorize page ' . $url);
             }
             Header('HTTP/1.0 302 OAuth Redirection');
             Header('Location: ' . $url);
             $this->exit = true;
             return true;
         case 2:
             if ($this->debug) {
                 $this->OutputDebug('Checking if OAuth access token was already retrieved from ' . $this->access_token_url);
             }
             if (!$this->GetAccessToken($access_token)) {
                 return false;
             }
             if (isset($access_token['value'])) {
                 if (isset($access_token['expiry']) && strcmp($this->access_token_expiry = $access_token['expiry'], gmstrftime('%Y-%m-%d %H:%M:%S')) < 0) {
                     if ($this->debug) {
                         $this->OutputDebug('The OAuth access token expired in ' . $this->access_token_expiry);
                     }
                 } else {
                     $this->access_token = $access_token['value'];
                     if (isset($access_token['type'])) {
                         $this->access_token_type = $access_token['type'];
                     }
                     if ($this->debug) {
                         $this->OutputDebug('The OAuth access token ' . $this->access_token . ' is valid');
                     }
                     if (strlen($this->access_token_type) && $this->debug) {
                         $this->OutputDebug('The OAuth access token is of type ' . $this->access_token_type);
                     }
                     return true;
                 }
             }
             if ($this->debug) {
                 $this->OutputDebug('Checking the authentication state in URI ' . $_SERVER['REQUEST_URI']);
             }
             if (!$this->GetStoredState($stored_state)) {
                 return false;
             }
             if (strlen($stored_state) == 0) {
                 return $this->SetError('it was not set the OAuth state');
             }
             if (!$this->GetRequestState($state)) {
                 return false;
             }
             if ($state === $stored_state) {
                 if ($this->debug) {
                     $this->OutputDebug('Checking the authentication code');
                 }
                 if (!$this->GetRequestCode($code)) {
                     return false;
                 }
                 if (strlen($code) == 0) {
                     if (!$this->GetRequestError($this->authorization_error)) {
                         return false;
                     }
                     if (isset($this->authorization_error)) {
                         if ($this->debug) {
                             $this->OutputDebug('Authorization failed with error code ' . $this->authorization_error);
                         }
                         switch ($this->authorization_error) {
                             case 'invalid_request':
                             case 'unauthorized_client':
                             case 'access_denied':
                             case 'unsupported_response_type':
                             case 'invalid_scope':
                             case 'server_error':
                             case 'temporarily_unavailable':
                             case 'user_denied':
                                 return true;
                             default:
                                 return $this->SetError('it was returned an unknown OAuth error code');
                         }
                     }
                     return $this->SetError('it was not returned the OAuth dialog code');
                 }
                 if (!$this->GetAccessTokenURL($url)) {
                     return false;
                 }
                 if (!$this->GetRedirectURI($redirect_uri)) {
                     return false;
                 }
                 $values = array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => $redirect_uri, 'grant_type' => 'authorization_code');
                 if (!$this->SendAPIRequest($url, 'POST', $values, null, array('Resource' => 'OAuth access token', 'ConvertObjects' => true), $response)) {
                     return false;
                 }
                 if (strlen($this->access_token_error)) {
                     $this->authorization_error = $this->access_token_error;
                     return true;
                 }
                 if (!isset($response['access_token'])) {
                     if (isset($response['error'])) {
                         $this->authorization_error = 'it was not possible to retrieve the access token: it was returned the error: ' . $response['error'];
                         return true;
                     }
                     return $this->SetError('OAuth server did not return the access token');
                 }
                 $access_token = array('value' => $this->access_token = $response['access_token'], 'authorized' => true);
                 if ($this->debug) {
                     $this->OutputDebug('Access token: ' . $this->access_token);
                 }
                 if (isset($response['expires']) || isset($response['expires_in'])) {
                     $expires = isset($response['expires']) ? $response['expires'] : $response['expires_in'];
                     if (strval($expires) !== strval(intval($expires)) || $expires <= 0) {
                         return $this->SetError('OAuth server did not return a supported type of access token expiry time');
                     }
                     $this->access_token_expiry = gmstrftime('%Y-%m-%d %H:%M:%S', time() + $expires);
                     if ($this->debug) {
                         $this->OutputDebug('Access token expiry: ' . $this->access_token_expiry . ' UTC');
                     }
                     $access_token['expiry'] = $this->access_token_expiry;
                 } else {
                     $this->access_token_expiry = '';
                 }
                 if (isset($response['token_type'])) {
                     $this->access_token_type = $response['token_type'];
                     if ($this->debug) {
                         $this->OutputDebug('Access token type: ' . $this->access_token_type);
                     }
                     $access_token['type'] = $this->access_token_type;
                 } else {
                     $this->access_token_type = '';
                 }
                 if (!$this->StoreAccessToken($access_token)) {
                     return false;
                 }
             } else {
                 if (!$this->GetDialogURL($url)) {
                     return false;
                 }
                 if (strlen($url) == 0) {
                     return $this->SetError('it was not set the OAuth dialog URL');
                 }
                 if (!$this->GetRedirectURI($redirect_uri)) {
                     return false;
                 }
                 if (strlen($this->append_state_to_redirect_uri)) {
                     $redirect_uri .= (strpos($redirect_uri, '?') === false ? '?' : '&') . $this->append_state_to_redirect_uri . '=' . $stored_state;
                 }
                 $url = str_replace('{REDIRECT_URI}', UrlEncode($redirect_uri), str_replace('{CLIENT_ID}', UrlEncode($this->client_id), str_replace('{SCOPE}', UrlEncode($this->scope), str_replace('{STATE}', UrlEncode($stored_state), $url))));
                 if ($this->debug) {
                     $this->OutputDebug('Redirecting to OAuth Dialog ' . $url);
                 }
                 Header('HTTP/1.0 302 OAuth Redirection');
                 Header('Location: ' . $url);
                 $this->exit = true;
             }
             break;
         default:
             return $this->SetError($this->oauth_version . ' is not a supported version of the OAuth protocol');
     }
     return true;
 }
Ejemplo n.º 26
0
 function OnPanelCreate()
 {
     global $APPLICATION, $REQUEST_URI;
     if ($APPLICATION->GetGroupRight("fileman") <= "D") {
         return;
     }
     $cur_page = $APPLICATION->GetCurPage(true);
     $cur_dir = $APPLICATION->GetCurDir();
     //access to curent page
     $page_permission = $APPLICATION->GetFileAccessPermission($cur_page);
     // access to current directory
     $sect_permission = $APPLICATION->GetFileAccessPermission($cur_dir);
     $main_sort = 100;
     $full_src = "";
     $default_edit = COption::GetOptionString("fileman", "default_edit", "html");
     if ($default_edit == "php") {
         $editor_type = "file";
         $full_src = "&full_src=Y";
     } elseif ($default_edit == "text") {
         $editor_type = "file";
     } else {
         $editor_type = "html";
     }
     $aMenuItems = array('create' => array(), 'create_section' => array(), 'edit' => array(), 'edit_section' => array());
     if ($sect_permission >= "W") {
         // New page
         $href = "/bitrix/admin/fileman_" . $editor_type . "_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . UrlEncode($APPLICATION->GetCurDir()) . "&new=Y&templateID=" . urlencode(SITE_TEMPLATE_ID) . "&back_url=" . UrlEncode($REQUEST_URI);
         $APPLICATION->AddPanelButtonMenu('create', array("SEPARATOR" => true, "SORT" => 99));
         $APPLICATION->AddPanelButtonMenu('create', array("TEXT" => GetMessage("fileman_panel_admin"), "TITLE" => GetMessage("fileman_panel_new_page_title"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($href) . "')", "SORT" => 100));
         //New folder
         $href = "/bitrix/admin/fileman_newfolder.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . UrlEncode($APPLICATION->GetCurDir()) . "&back_url=" . UrlEncode($REQUEST_URI);
         $APPLICATION->AddPanelButtonMenu('create_section', array("SEPARATOR" => true, "SORT" => 99));
         $APPLICATION->AddPanelButtonMenu('create_section', array("TEXT" => GetMessage("fileman_panel_admin"), "TITLE" => GetMessage("fileman_panel_new_folder_title"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($href) . "')"));
     }
     // Edit page
     if ($page_permission >= "W") {
         $href = "/bitrix/admin/fileman_" . $editor_type . "_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&templateID=" . urlencode(SITE_TEMPLATE_ID) . $full_src . "&path=" . UrlEncode(isset($_SERVER["REAL_FILE_PATH"]) && $_SERVER["REAL_FILE_PATH"] != "" ? $_SERVER["REAL_FILE_PATH"] : $cur_page) . "&back_url=" . UrlEncode($REQUEST_URI);
         $APPLICATION->AddPanelButtonMenu('edit', array("SEPARATOR" => true, "SORT" => 99));
         $APPLICATION->AddPanelButtonMenu('edit', array("TEXT" => GetMessage("fileman_panel_admin"), "TITLE" => GetMessage("fileman_panel_edit_title"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($href) . "')", "SORT" => 100));
     }
     // Folder properties
     $alt = GetMessage("FILEMAN_FOLDER_PROPS");
     if ($sect_permission >= "W") {
         $href = "/bitrix/admin/fileman_folder.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . UrlEncode($APPLICATION->GetCurDir()) . "&back_url=" . UrlEncode($REQUEST_URI);
         $APPLICATION->AddPanelButtonMenu('edit_section', array("SEPARATOR" => true, "SORT" => 99));
         $APPLICATION->AddPanelButtonMenu('edit_section', array("TEXT" => GetMessage("fileman_panel_admin"), "TITLE" => GetMessage("fileman_panel_folder_prop_title"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($href) . "')", "SORT" => 100));
     }
     //Sticker buttons
     require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/classes/general/sticker.php";
     if (CSticker::CanDoOperation('sticker_view')) {
         $useHotKeys = COption::GetOptionString('fileman', "stickers_use_hotkeys", "Y") == "Y";
         $arMenu = array();
         if (CSticker::CanDoOperation('sticker_new')) {
             $arMenu[] = array("TEXT" => '<div style="float: left; margin: 0 50px 0 0;">' . GetMessage("FMST_PANEL_STICKER_ADD") . '</div>' . ($useHotKeys ? '<div style="float: right;"><nobr>Ctrl+Shift+S</nobr></div>' : ''), "TITLE" => GetMessage("FMST_PANEL_STICKER_ADD_TITLE"), "ICON" => "", "ACTION" => CSticker::GetScriptStr('add'), "DEFAULT" => true, "HK_ID" => "FMST_PANEL_STICKER_ADD");
             $arMenu[] = array("SEPARATOR" => true);
         }
         $curPageCount = CSticker::GetCurPageCount();
         $arMenu[] = array("ID" => "bxst-show-sticker-icon", "TEXT" => '<div style="float: left; margin: 0 50px 0 0;">' . GetMessage("FMST_PANEL_STICKERS_SHOW", array("#COUNT#" => $curPageCount)) . '</div>' . ($useHotKeys ? '<div style="float:right;"><nobr>Ctrl+Shift+X</nobr></div>' : ''), "TITLE" => GetMessage("FMST_PANEL_STICKERS_SHOW_TITLE"), "ICON" => CSticker::GetBShowStickers() ? " checked" : "", "ACTION" => CSticker::GetScriptStr('show'), "HK_ID" => "FMST_PANEL_STICKERS_SHOW");
         $arMenu[] = array("TEXT" => '<div style="float: left; margin: 0 50px 0 0;">' . GetMessage("FMST_PANEL_CUR_STICKER_LIST") . '</div>' . ($useHotKeys ? '<div style="float: right;"><nobr>Ctrl+Shift+L</nobr></div>' : ''), "TITLE" => GetMessage("FMST_PANEL_CUR_STICKER_LIST_TITLE"), "ICON" => "", "ACTION" => CSticker::GetScriptStr('list_cur'), "HK_ID" => "FMST_PANEL_CUR_STICKER_LIST");
         $arMenu[] = array("TEXT" => GetMessage("FMST_PANEL_ALL_STICKER_LIST"), "TITLE" => GetMessage("FMST_PANEL_ALL_STICKER_LIST_TITLE"), "ICON" => "", "ACTION" => CSticker::GetScriptStr('list_all'), "HK_ID" => "FMST_PANEL_ALL_STICKER_LIST");
         $APPLICATION->AddPanelButton(array("HREF" => 'javascript:' . (CSticker::CanDoOperation('sticker_edit') ? CSticker::GetScriptStr('add') : CSticker::GetScriptStr('show')), "TYPE" => "SMALL", "ICON" => "bx-panel-small-stickers-icon", "TEXT" => GetMessage("FMST_PANEL_STICKERS_TOOLTIP_TITLE"), "MAIN_SORT" => "1000", "SORT" => 100, "MENU" => $arMenu, "HK_ID" => "FMST_PANEL_STICKERS", "HINT" => array("TITLE" => CSticker::CanDoOperation('sticker_edit') ? GetMessage("FMST_PANEL_STICKERS_TOOLTIP_TITLE") : GetMessage("FMST_PANEL_STICKERS_SHOW_1"), "TEXT" => CSticker::CanDoOperation('sticker_edit') ? GetMessage("FMST_PANEL_STICKERS_TOOLTIP") . ($useHotKeys ? " (Ctrl+Shift+S)" : "") : GetMessage("FMST_PANEL_STICKERS_ALT") . ($useHotKeys ? " (Ctrl+Shift+X)" : ""))));
         CSticker::Init(array('curPageCount' => $curPageCount));
     }
 }
Ejemplo n.º 27
0
                $arResult["SecondLine"] = "Y";
            } elseif ($perm >= BLOG_PERMS_PREMODERATE) {
                $arResult["urlToNewPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_EDIT"], array("blog" => $arBlog["URL"], "post_id" => "new"));
                $arResult["SecondLine"] = "Y";
            }
            if (CBlog::CanUserManageBlog($arBlog["ID"], $user_id)) {
                $arResult["urlToUserSettings"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arBlog["URL"]));
                $arResult["urlToGroupEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_EDIT"], array("blog" => $arBlog["URL"]));
                $arResult["urlToCategoryEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_CATEGORY_EDIT"], array("blog" => $arBlog["URL"]));
                $arResult["urlToBlogEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG_EDIT"], array("blog" => $arBlog["URL"]));
                $arResult["ThirdLine"] = "Y";
            }
        }
        if (empty($arOwnBlog) || $arOwnBlog["URL"] != $arBlog["URL"]) {
            if (IntVal($user_id) > 0) {
                if (!CBlog::IsFriend($arBlog["ID"], $user_id)) {
                    $arResult["urlToBecomeFriend"] = $arResult["urlToCurrentBlog"] . (strpos($arResult["urlToCurrentBlog"], "?") === false ? "?" : "&") . "become_friend=Y&" . bitrix_sessid_get();
                    $arResult["SecondLine"] = "Y";
                }
                if (!empty($arOwnBlog)) {
                    if (!CBlog::IsFriend($arOwnBlog["ID"], $arBlog["OWNER_ID"])) {
                        $tmpUrl = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arOwnBlog["URL"]));
                        $arResult["urlToAddFriend"] = $tmpUrl . (strpos($tmpUrl, "?") === false ? "?" : "&") . "add_friend[]=" . UrlEncode($arBlog["URL"]) . "&" . bitrix_sessid_get();
                        $arResult["SecondLine"] = "Y";
                    }
                }
            }
        }
    }
}
$this->IncludeComponentTemplate();
Ejemplo n.º 28
0
 function Process()
 {
     if (strlen($this->access_token) || strlen($this->access_token_secret)) {
         if ($this->debug) {
             $this->OutputDebug('The Process function should not be called again if the OAuth token was already set manually');
         }
         return $this->SetError('the OAuth token was already set');
     }
     switch (intval($this->oauth_version)) {
         case 1:
             $one_a = $this->oauth_version === '1.0a';
             if ($this->debug) {
                 $this->OutputDebug('Checking the OAuth token authorization state');
             }
             if (!$this->GetAccessToken($access_token)) {
                 return false;
             }
             if (isset($access_token['expiry'])) {
                 $this->access_token_expiry = $access_token['expiry'];
             }
             if (isset($access_token['authorized']) && isset($access_token['value'])) {
                 $expired = isset($access_token['expiry']) && strcmp($access_token['expiry'], gmstrftime('%Y-%m-%d %H:%M:%S')) <= 0;
                 if (!$access_token['authorized'] || $expired) {
                     if ($this->debug) {
                         if ($expired) {
                             $this->OutputDebug('The OAuth token expired on ' . $access_token['expiry'] . 'UTC');
                         } else {
                             $this->OutputDebug('The OAuth token is not yet authorized');
                         }
                         $this->OutputDebug('Checking the OAuth token and verifier');
                     }
                     if (!$this->GetRequestToken($token, $verifier)) {
                         return false;
                     }
                     if (!isset($token) || $one_a && !isset($verifier)) {
                         if (!$this->GetRequestDenied($denied)) {
                             return false;
                         }
                         if (isset($denied) && $denied === $access_token['value']) {
                             if ($this->debug) {
                                 $this->OutputDebug('The authorization request was denied');
                             }
                             $this->authorization_error = 'the request was denied';
                             return true;
                         } else {
                             if ($this->debug) {
                                 $this->OutputDebug('Reset the OAuth token state because token and verifier are not both set');
                             }
                             $access_token = array();
                         }
                     } elseif ($token !== $access_token['value']) {
                         if ($this->debug) {
                             $this->OutputDebug('Reset the OAuth token state because token does not match what as previously retrieved');
                         }
                         $access_token = array();
                     } else {
                         $this->access_token_secret = $access_token['secret'];
                         $oauth = array('oauth_token' => $token);
                         if ($one_a) {
                             $oauth['oauth_verifier'] = $verifier;
                         }
                         if (!$this->ProcessToken1($oauth, $access_token)) {
                             return false;
                         }
                         if ($this->debug) {
                             $this->OutputDebug('The OAuth token was authorized');
                         }
                     }
                 } elseif ($this->debug) {
                     $this->OutputDebug('The OAuth token was already authorized');
                 }
                 if (isset($access_token['authorized']) && $access_token['authorized']) {
                     $this->access_token = $access_token['value'];
                     $this->access_token_secret = $access_token['secret'];
                     if (isset($access_token['refresh'])) {
                         $this->refresh_token = $access_token['refresh'];
                     }
                     return true;
                 }
             } else {
                 if ($this->debug) {
                     $this->OutputDebug('The OAuth access token is not set');
                 }
                 $access_token = array();
             }
             if (!isset($access_token['authorized'])) {
                 if ($this->debug) {
                     $this->OutputDebug('Requesting the unauthorized OAuth token');
                 }
                 if (!$this->GetRequestTokenURL($url)) {
                     return false;
                 }
                 $url = str_replace('{SCOPE}', UrlEncode($this->scope), $url);
                 if (!$this->GetRedirectURI($redirect_uri)) {
                     return false;
                 }
                 $oauth = array('oauth_callback' => $redirect_uri);
                 $options = array('Resource' => 'OAuth request token', 'FailOnAccessError' => true);
                 $method = strtoupper($this->token_request_method);
                 switch ($method) {
                     case 'GET':
                         break;
                     case 'POST':
                         $options['PostValuesInURI'] = true;
                         break;
                     default:
                         $this->error = $method . ' is not a supported method to request tokens';
                         break;
                 }
                 if (!$this->SendAPIRequest($url, $method, array(), $oauth, $options, $response)) {
                     return false;
                 }
                 if (strlen($this->access_token_error)) {
                     $this->authorization_error = $this->access_token_error;
                     return true;
                 }
                 if (!isset($response['oauth_token']) || !isset($response['oauth_token_secret'])) {
                     $this->authorization_error = 'it was not returned the requested token';
                     return true;
                 }
                 $access_token = array('value' => $response['oauth_token'], 'secret' => $response['oauth_token_secret'], 'authorized' => false);
                 if (isset($response['login_url'])) {
                     $access_token['login_url'] = $response['login_url'];
                 }
                 if (!$this->StoreAccessToken($access_token)) {
                     return false;
                 }
             }
             if (!$this->GetDialogURL($url)) {
                 return false;
             }
             if ($url === 'automatic') {
                 if (!isset($access_token['login_url'])) {
                     return $this->SetError('The request token response did not automatically the login dialog URL as expected');
                 }
                 if ($this->debug) {
                     $this->OutputDebug('Dialog URL obtained automatically from the request token response: ' . $url);
                 }
                 $url = $access_token['login_url'];
             } else {
                 $url .= (strpos($url, '?') === false ? '?' : '&') . 'oauth_token=' . $access_token['value'];
             }
             if (!$one_a) {
                 if (!$this->GetRedirectURI($redirect_uri)) {
                     return false;
                 }
                 $url .= '&oauth_callback=' . UrlEncode($redirect_uri);
             }
             if ($this->debug) {
                 $this->OutputDebug('Redirecting to OAuth authorize page ' . $url);
             }
             $this->Redirect($url);
             $this->exit = true;
             return true;
         case 2:
             if ($this->debug) {
                 if (!$this->GetAccessTokenURL($access_token_url)) {
                     return false;
                 }
                 $this->OutputDebug('Checking if OAuth access token was already retrieved from ' . $access_token_url);
             }
             if (!$this->RetrieveToken($valid)) {
                 return false;
             }
             $expired = strlen($this->access_token_expiry) && strcmp($this->access_token_expiry, gmstrftime('%Y-%m-%d %H:%M:%S')) <= 0 && strlen($this->refresh_token) === 0;
             if ($valid && !$expired) {
                 return true;
             }
             if ($this->debug) {
                 if (!$valid) {
                     $this->OutputDebug('A valid access token is not available');
                 } elseif ($expired) {
                     $this->OutputDebug('The access token expired');
                 }
             }
             switch ($this->grant_type) {
                 case 'authorization_code':
                     if (strlen($this->oauth_username) === 0) {
                         break;
                     }
                 case 'password':
                     if ($this->debug) {
                         $this->OutputDebug('Getting the access token using the username and password');
                     }
                     return $this->ProcessToken2(null, false);
                 case 'client_credentials':
                     if ($this->debug) {
                         $this->OutputDebug('Getting the access token using the client credentials');
                     }
                     return $this->ProcessToken2(null, false);
                 default:
                     return $this->SetError($this->grant_type . ' is not yet a supported OAuth 2 grant type');
             }
             if ($this->debug) {
                 $this->OutputDebug('Checking the authentication state in URI ' . $_SERVER['REQUEST_URI']);
             }
             if (!$this->GetStoredState($stored_state)) {
                 return false;
             }
             if (strlen($stored_state) == 0) {
                 return $this->SetError('it was not set the OAuth state');
             }
             if (!$this->GetRequestState($state)) {
                 return false;
             }
             if ($state === $stored_state) {
                 if ($this->debug) {
                     $this->OutputDebug('Checking the authentication code');
                 }
                 if (!$this->GetRequestCode($code)) {
                     return false;
                 }
                 if (strlen($code) == 0) {
                     if (!$this->GetRequestError($this->authorization_error)) {
                         return false;
                     }
                     if (isset($this->authorization_error)) {
                         if ($this->debug) {
                             $this->OutputDebug('Authorization failed with error code ' . $this->authorization_error);
                         }
                         switch ($this->authorization_error) {
                             case 'invalid_request':
                             case 'unauthorized_client':
                             case 'access_denied':
                             case 'unsupported_response_type':
                             case 'invalid_scope':
                             case 'server_error':
                             case 'temporarily_unavailable':
                             case 'user_denied':
                                 return true;
                             default:
                                 return $this->SetError('it was returned an unknown OAuth error code');
                         }
                     }
                     return $this->SetError('it was not returned the OAuth dialog code');
                 }
                 if (!$this->ProcessToken2($code, false)) {
                     return false;
                 }
             } else {
                 if (!$this->GetRedirectURI($redirect_uri)) {
                     return false;
                 }
                 if (strlen($this->append_state_to_redirect_uri)) {
                     $redirect_uri .= (strpos($redirect_uri, '?') === false ? '?' : '&') . $this->append_state_to_redirect_uri . '=' . $stored_state;
                 }
                 if (!$this->GetDialogURL($url, $redirect_uri, $stored_state)) {
                     return false;
                 }
                 if (strlen($url) == 0) {
                     return $this->SetError('it was not set the OAuth dialog URL');
                 }
                 if ($this->debug) {
                     $this->OutputDebug('Redirecting to OAuth Dialog ' . $url);
                 }
                 $this->Redirect($url);
                 $this->exit = true;
             }
             break;
         default:
             return $this->SetError($this->oauth_version . ' is not a supported version of the OAuth protocol');
     }
     return true;
 }
Ejemplo n.º 29
0
                        } else {
                            //$currentSum += ($arItemsList["BASKET_PRICE"] - $arItemsList["BASKET_DISCOUNT_PRICE"]) * $arItemsList["BASKET_QUANTITY"];
                            $currentSum += $arItemsList["BASKET_PRICE"] * $arItemsList["BASKET_QUANTITY"];
                        }
                    } while ($arItemsList = $dbItemsList->Fetch());
                    $arResult["ROWS"][] = array("NAME" => $currentBasketName, "QUANTITY" => $currentQuantity, "SUM" => $currentSum, "CURRENCY" => $affiliateCurrency, "SUM_FORMAT" => SaleFormatCurrency($currentSum, $affiliateCurrency));
                    $totalQuantity += $currentQuantity;
                    $totalSum += $currentSum;
                    $arResult["TOTAL"] = array("QUANTITY" => $totalQuantity, "SUM" => $totalSum, "CURRENCY" => $affiliateCurrency, "SUM_FORMAT" => SaleFormatCurrency($totalSum, $affiliateCurrency));
                }
                $arResult["FILTER_ID"] = rand(0, 10000);
            } else {
                $arResult = false;
            }
            $this->IncludeComponentTemplate();
        } else {
            LocalRedirect($arParams["REGISTER_PAGE"] . "?REDIRECT_PAGE=" . UrlEncode($APPLICATION->GetCurPage()));
            die;
        }
    } else {
        LocalRedirect($arParams["REGISTER_PAGE"] . "?REDIRECT_PAGE=" . UrlEncode($APPLICATION->GetCurPage()));
        die;
    }
} else {
    ?>
	<b><?php 
    echo ShowError(GetMessage("SPCAS1_NO_SHOP"));
    ?>
</b>
	<?php 
}
Ejemplo n.º 30
0
 /**
  * 
  *
  *
  *
  *
  * @return mixed <p></p>
  *
  *
  * <h4>Example</h4> 
  * <pre>
  * <br><br>
  * </pre>
  *
  *
  *
  * <h4>See Also</h4> 
  * <p></p><a name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/getpanelbuttons.php
  * @author Bitrix
  */
 public static function GetPanelButtons($IBLOCK_ID = 0, $ELEMENT_ID = 0, $SECTION_ID = 0, $arOptions = array())
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     $arButtons = array("view" => array(), "edit" => array(), "configure" => array(), "submenu" => array());
     if (array_key_exists("SECTION_BUTTONS", $arOptions) && $arOptions["SECTION_BUTTONS"] === false) {
         $bSectionButtons = false;
     } else {
         $bSectionButtons = true;
     }
     if (array_key_exists("SESSID", $arOptions) && $arOptions["SESSID"] === false) {
         $bSessID = false;
     } else {
         $bSessID = true;
     }
     $IBLOCK_ID = intval($IBLOCK_ID);
     $ELEMENT_ID = intval($ELEMENT_ID);
     $SECTION_ID = intval($SECTION_ID);
     if ($ELEMENT_ID > 0 && ($IBLOCK_ID <= 0 || $bSectionButtons && $SECTION_ID == 0)) {
         $rsIBlockElement = CIBlockElement::GetList(array(), array("ID" => $ELEMENT_ID, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID"));
         if ($arIBlockElement = $rsIBlockElement->Fetch()) {
             $IBLOCK_ID = $arIBlockElement["IBLOCK_ID"];
             $SECTION_ID = $arIBlockElement["IBLOCK_SECTION_ID"];
         }
     }
     if ($IBLOCK_ID <= 0) {
         return $arButtons;
     }
     $bCatalog = false;
     if (isset($arOptions["CATALOG"]) && $arOptions["CATALOG"] == true) {
         if (CModule::IncludeModule('catalog')) {
             $bCatalog = true;
         }
     }
     $return_url = array("add_element" => "", "edit_element" => "", "edit_iblock" => "", "history_element" => "", "edit_section" => "", "add_section" => "", "delete_section" => "", "delete_element" => "", "element_list" => "", "section_list" => "");
     if (array_key_exists("RETURN_URL", $arOptions)) {
         if (is_array($arOptions["RETURN_URL"])) {
             foreach ($arOptions["RETURN_URL"] as $key => $url) {
                 if (!empty($url) && array_key_exists($key, $return_url)) {
                     $return_url[$key] = $url;
                 }
             }
         } elseif (!empty($arOptions["RETURN_URL"])) {
             foreach ($return_url as $key => $url) {
                 $return_url[$key] = $arOptions["RETURN_URL"];
             }
         }
     }
     $str = "";
     foreach ($return_url as $key => $url) {
         if (empty($url)) {
             if (empty($str)) {
                 if (defined("BX_AJAX_PARAM_ID")) {
                     $str = $APPLICATION->GetCurPageParam("", array(BX_AJAX_PARAM_ID));
                 } else {
                     $str = $APPLICATION->GetCurPageParam();
                 }
             }
             $return_url[$key] = $str;
         }
     }
     $arIBlock = CIBlock::GetArrayByID($IBLOCK_ID);
     $bWorkflow = CModule::IncludeModule("workflow") && $arIBlock["WORKFLOW"] !== "N";
     $s = $bWorkflow ? "&WF=Y" : "";
     $arLabels = $arOptions["LABELS"];
     if ($ELEMENT_ID > 0 && CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ELEMENT_ID, "element_edit")) {
         $url = "/bitrix/admin/" . CIBlock::GetAdminElementEditLink($IBLOCK_ID, $ELEMENT_ID, array("force_catalog" => $bCatalog, "filter_section" => $SECTION_ID, "bxpublic" => "Y", "from_module" => "iblock", "return_url" => $return_url["edit_element"])) . $s;
         $action = $APPLICATION->GetPopupLink(array("URL" => $url, "PARAMS" => array("width" => 700, 'height' => 400, 'resize' => false)));
         $arButton = array("TEXT" => strlen($arLabels["ELEMENT_EDIT_TEXT"]) ? $arLabels["ELEMENT_EDIT_TEXT"] : $arIBlock["ELEMENT_EDIT"], "TITLE" => strlen($arLabels["ELEMENT_EDIT_TITLE"]) ? $arLabels["ELEMENT_EDIT_TITLE"] : $arIBlock["ELEMENT_EDIT"], "ACTION" => 'javascript:' . $action, "ACTION_URL" => $url, "ONCLICK" => $action, "DEFAULT" => $APPLICATION->GetPublicShowMode() != 'configure' ? true : false, "ICON" => "bx-context-toolbar-edit-icon", "ID" => "bx-context-toolbar-edit-element");
         $arButtons["edit"]["edit_element"] = $arButton;
         $arButtons["configure"]["edit_element"] = $arButton;
         $url = str_replace("&bxpublic=Y&from_module=iblock", "", $url);
         $arButton["ACTION"] = "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')";
         unset($arButton["ONCLICK"]);
         $arButtons["submenu"]["edit_element"] = $arButton;
         if ($bWorkflow) {
             $url = "/bitrix/admin/iblock_history_list.php?type=" . $arIBlock["IBLOCK_TYPE_ID"] . "&lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $IBLOCK_ID . "&ELEMENT_ID=" . $ELEMENT_ID . "&filter_section=" . $SECTION_ID . "&return_url=" . UrlEncode($return_url["history_element"]);
             $arButton = array("TEXT" => GetMessage("IBLOCK_PANEL_HISTORY_BUTTON"), "TITLE" => GetMessage("IBLOCK_PANEL_HISTORY_BUTTON"), "ACTION" => "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ID" => "bx-context-toolbar-history-element");
             $arButtons["submenu"]["history_element"] = $arButton;
         }
     }
     if (CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $SECTION_ID, "section_element_bind")) {
         $url = "/bitrix/admin/" . CIBlock::GetAdminElementEditLink($IBLOCK_ID, null, array("force_catalog" => $bCatalog, "filter_section" => $SECTION_ID, "IBLOCK_SECTION_ID" => $SECTION_ID, "bxpublic" => "Y", "from_module" => "iblock", "return_url" => $return_url["add_element"]));
         $action = $APPLICATION->GetPopupLink(array("URL" => $url, "PARAMS" => array("width" => 700, 'height' => 400, 'resize' => false)));
         $arButton = array("TEXT" => strlen($arLabels["ELEMENT_ADD_TEXT"]) ? $arLabels["ELEMENT_ADD_TEXT"] : $arIBlock["ELEMENT_ADD"], "TITLE" => strlen($arLabels["ELEMENT_ADD_TITLE"]) ? $arLabels["ELEMENT_ADD_TITLE"] : $arIBlock["ELEMENT_ADD"], "ACTION" => 'javascript:' . $action, "ACTION_URL" => $url, "ONCLICK" => $action, "ICON" => "bx-context-toolbar-create-icon", "ID" => "bx-context-toolbar-add-element");
         $arButtons["edit"]["add_element"] = $arButton;
         $arButtons["configure"]["add_element"] = $arButton;
         $arButtons["intranet"][] = array('TEXT' => $arButton["TEXT"], 'TITLE' => $arButton["TITLE"], 'ICON' => 'add', 'ONCLICK' => $arButton["ACTION"], 'SORT' => 1000);
         $url = str_replace("&bxpublic=Y&from_module=iblock", "", $url);
         $arButton["ACTION"] = "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')";
         unset($arButton["ONCLICK"]);
         $arButtons["submenu"]["add_element"] = $arButton;
     }
     if ($ELEMENT_ID > 0 && CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ELEMENT_ID, "element_delete")) {
         //Delete Element
         if (!empty($arButtons["edit"])) {
             $arButtons["edit"][] = array("SEPARATOR" => "Y", "HREF" => "");
         }
         if (!empty($arButtons["configure"])) {
             $arButtons["configure"][] = array("SEPARATOR" => "Y", "HREF" => "");
         }
         if (!empty($arButtons["submenu"])) {
             $arButtons["submenu"][] = array("SEPARATOR" => "Y", "HREF" => "");
         }
         $url = CIBlock::GetAdminElementListLink($IBLOCK_ID, array('action' => 'delete'));
         if ($bSessID) {
             $url .= '&' . bitrix_sessid_get();
         }
         $url .= '&ID=' . (preg_match('/^iblock_list_admin\\.php/', $url) ? "E" : "") . $ELEMENT_ID . "&return_url=" . UrlEncode($return_url["delete_element"]);
         $url = "/bitrix/admin/" . $url;
         $arButton = array("TEXT" => strlen($arLabels["ELEMENT_DELETE_TEXT"]) ? $arLabels["ELEMENT_DELETE_TEXT"] : $arIBlock["ELEMENT_DELETE"], "TITLE" => strlen($arLabels["ELEMENT_DELETE_TITLE"]) ? $arLabels["ELEMENT_DELETE_TITLE"] : $arIBlock["ELEMENT_DELETE"], "ACTION" => "javascript:if(confirm('" . GetMessageJS("IBLOCK_PANEL_ELEMENT_DEL_CONF") . "'))jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ACTION_URL" => $url, "ONCLICK" => "if(confirm('" . GetMessageJS("IBLOCK_PANEL_ELEMENT_DEL_CONF") . "'))jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ICON" => "bx-context-toolbar-delete-icon", "ID" => "bx-context-toolbar-delete-element");
         $arButtons["edit"]["delete_element"] = $arButton;
         $arButtons["configure"]["delete_element"] = $arButton;
         $arButtons["submenu"]["delete_element"] = $arButton;
     }
     if ($ELEMENT_ID <= 0 && $bSectionButtons) {
         $rsIBTYPE = CIBlockType::GetByID($arIBlock["IBLOCK_TYPE_ID"]);
         if (($arIBTYPE = $rsIBTYPE->Fetch()) && $arIBTYPE["SECTIONS"] == "Y") {
             if ($SECTION_ID > 0 && CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $SECTION_ID, "section_edit")) {
                 if (!empty($arButtons["edit"])) {
                     $arButtons["edit"][] = array("SEPARATOR" => "Y", "HREF" => "");
                 }
                 if (!empty($arButtons["configure"])) {
                     $arButtons["configure"][] = array("SEPARATOR" => "Y", "HREF" => "");
                 }
                 if (!empty($arButtons["submenu"])) {
                     $arButtons["submenu"][] = array("SEPARATOR" => "Y", "HREF" => "");
                 }
                 $url = "/bitrix/admin/" . CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $SECTION_ID, array("force_catalog" => $bCatalog, "filter_section" => $SECTION_ID, "bxpublic" => "Y", "from_module" => "iblock", "return_url" => $return_url["edit_section"]));
                 $action = $APPLICATION->GetPopupLink(array("URL" => $url, "PARAMS" => array("width" => 700, 'height' => 400, 'resize' => false)));
                 $arButton = array("TEXT" => strlen($arLabels["SECTION_EDIT_TEXT"]) ? $arLabels["SECTION_EDIT_TEXT"] : $arIBlock["SECTION_EDIT"], "TITLE" => strlen($arLabels["SECTION_EDIT_TITLE"]) ? $arLabels["SECTION_EDIT_TITLE"] : $arIBlock["SECTION_EDIT"], "ACTION" => 'javascript:' . $action, "ACTION_URL" => $url, "ICON" => "bx-context-toolbar-edit-icon", "ONCLICK" => $action, "DEFAULT" => $APPLICATION->GetPublicShowMode() != 'configure' ? true : false, "ID" => "bx-context-toolbar-edit-section");
                 $arButtons["edit"]["edit_section"] = $arButton;
                 $arButtons["configure"]["edit_section"] = $arButton;
                 $url = str_replace("&bxpublic=Y&from_module=iblock", "", $url);
                 $arButton["ACTION"] = "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')";
                 unset($arButton["ONCLICK"]);
                 $arButtons["submenu"]["edit_section"] = $arButton;
             }
             if (CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $SECTION_ID, "section_section_bind")) {
                 $url = "/bitrix/admin/" . CIBlock::GetAdminSectionEditLink($IBLOCK_ID, null, array("force_catalog" => $bCatalog, "IBLOCK_SECTION_ID" => $SECTION_ID, "filter_section" => $SECTION_ID, "bxpublic" => "Y", "from_module" => "iblock", "return_url" => $return_url["add_section"]));
                 $action = $APPLICATION->GetPopupLink(array("URL" => $url, "PARAMS" => array("width" => 700, 'height' => 400, 'resize' => false)));
                 $arButton = array("TEXT" => strlen($arLabels["SECTION_ADD_TEXT"]) ? $arLabels["SECTION_ADD_TEXT"] : $arIBlock["SECTION_ADD"], "TITLE" => strlen($arLabels["SECTION_ADD_TITLE"]) ? $arLabels["SECTION_ADD_TITLE"] : $arIBlock["SECTION_ADD"], "ACTION" => 'javascript:' . $action, "ACTION_URL" => $url, "ICON" => "bx-context-toolbar-create-icon", "ID" => "bx-context-toolbar-add-section", "ONCLICK" => $action);
                 $arButtons["edit"]["add_section"] = $arButton;
                 $arButtons["configure"]["add_section"] = $arButton;
                 $url = str_replace("&bxpublic=Y&from_module=iblock", "", $url);
                 $arButton["ACTION"] = "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')";
                 unset($arButton["ONCLICK"]);
                 $arButtons["submenu"]["add_section"] = $arButton;
             }
             //Delete section
             if ($SECTION_ID > 0 && CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $SECTION_ID, "section_delete")) {
                 $url = CIBlock::GetAdminSectionListLink($IBLOCK_ID, array('action' => 'delete'));
                 if ($bSessID) {
                     $url .= '&' . bitrix_sessid_get();
                 }
                 $url .= '&ID[]=' . (preg_match('/^iblock_list_admin\\.php/', $url) ? "S" : "") . $SECTION_ID . "&return_url=" . UrlEncode($return_url["delete_section"]);
                 $url = "/bitrix/admin/" . $url;
                 $arButton = array("TEXT" => strlen($arLabels["SECTION_DELETE_TEXT"]) ? $arLabels["SECTION_DELETE_TEXT"] : $arIBlock["SECTION_DELETE"], "TITLE" => strlen($arLabels["SECTION_DELETE_TITLE"]) ? $arLabels["SECTION_DELETE_TITLE"] : $arIBlock["SECTION_DELETE"], "ACTION" => "javascript:if(confirm('" . GetMessageJS("IBLOCK_PANEL_SECTION_DEL_CONF") . "'))jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ACTION_URL" => $url, "ONCLICK" => "if(confirm('" . GetMessageJS("IBLOCK_PANEL_SECTION_DEL_CONF") . "'))jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ICON" => "bx-context-toolbar-delete-icon", "ID" => "bx-context-toolbar-delete-section");
                 $arButtons["edit"]["delete_section"] = $arButton;
                 $arButtons["configure"]["delete_section"] = $arButton;
                 $arButtons["submenu"]["delete_section"] = $arButton;
             }
         }
     }
     if ($IBLOCK_ID > 0 && CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_admin_display")) {
         if (!empty($arButtons["submenu"])) {
             $arButtons["submenu"][] = array("SEPARATOR" => "Y", "HREF" => "");
         }
         if ($SECTION_ID > 0) {
             $url = "/bitrix/admin/" . CIBlock::GetAdminElementListLink($IBLOCK_ID, array('find_section_section' => $SECTION_ID));
         } else {
             $url = "/bitrix/admin/" . CIBlock::GetAdminElementListLink($IBLOCK_ID, array('find_el_y' => 'Y'));
         }
         $arButton = array("TEXT" => strlen($arLabels["ELEMENTS_NAME_TEXT"]) ? $arLabels["ELEMENTS_NAME_TEXT"] : $arIBlock["ELEMENTS_NAME"], "TITLE" => strlen($arLabels["ELEMENTS_NAME_TITLE"]) ? $arLabels["ELEMENTS_NAME_TITLE"] : $arIBlock["ELEMENTS_NAME"], "ACTION" => "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ACTION_URL" => $url, "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ID" => "bx-context-toolbar-elements-list");
         $arButtons["submenu"]["element_list"] = $arButton;
         $arButtons["intranet"]["element_list"] = array('TEXT' => $arButton["TEXT"], 'TITLE' => $arButton["TITLE"], 'ICON' => 'settings', 'ONCLICK' => $arButton["ACTION"], 'SORT' => 1010);
         $url = "/bitrix/admin/" . CIBlock::GetAdminSectionListLink($IBLOCK_ID, array('find_section_section' => $SECTION_ID));
         $arButton = array("TEXT" => strlen($arLabels["SECTIONS_NAME_TEXT"]) ? $arLabels["SECTIONS_NAME_TEXT"] : $arIBlock["SECTIONS_NAME"], "TITLE" => strlen($arLabels["SECTIONS_NAME_TITLE"]) ? $arLabels["SECTIONS_NAME_TITLE"] : $arIBlock["SECTIONS_NAME"], "ACTION" => "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ACTION_URL" => $url, "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ID" => "bx-context-toolbar-sections-list");
         $arButtons["submenu"]["section_list"] = $arButton;
         if (CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_edit")) {
             $url = "/bitrix/admin/iblock_edit.php?type=" . $arIBlock["IBLOCK_TYPE_ID"] . "&lang=" . LANGUAGE_ID . "&ID=" . $IBLOCK_ID . "&return_url=" . UrlEncode($return_url["edit_iblock"]);
             $arButton = array("TEXT" => GetMessage("IBLOCK_PANEL_EDIT_IBLOCK_BUTTON", array("#IBLOCK_NAME#" => $arIBlock["NAME"])), "TITLE" => GetMessage("IBLOCK_PANEL_EDIT_IBLOCK_BUTTON", array("#IBLOCK_NAME#" => $arIBlock["NAME"])), "ACTION" => "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ACTION_URL" => $url, "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')", "ID" => "bx-context-toolbar-edit-iblock");
             $arButtons["submenu"]["edit_iblock"] = $arButton;
         }
     }
     return $arButtons;
 }