function TestComponent() { global $APPLICATION; $client = new CSOAPClient("bitrix.soap", $APPLICATION->GetCurPage()); $client->setLogin("admin"); $client->setPassword("123456"); $request = new CSOAPRequest("GetHTTPUserInfo", CWebService::GetDefaultTargetNS()); //$request->addParameter("stub", 0); $response = $client->send($request); if ($response->FaultString) { echo $response->FaultString; } else { echo "Call GetHTTPUserInfo(): <br>" . mydump($response->Value) . "<br>"; } }
COption::RemoveOption("statistic", "sql_to_run"); } if ($strError == "") { LocalRedirect($APPLICATION->GetCurPage() . "?mid=" . urlencode($mid) . "&lang=" . urlencode(LANGUAGE_ID) . "&back_url_settings=" . urlencode($_REQUEST["back_url_settings"]) . "&" . $tabControl2->ActiveTabParam()); } } if (strlen($optimize) > 0 && $REQUEST_METHOD == "POST" && $STAT_RIGHT >= "W" && check_bitrix_sessid()) { set_time_limit(0); ignore_user_abort(true); $fname = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/install/db/" . strtolower($statDB->type) . "/optimize.sql"; if (file_exists($fname)) { $arErrors = $statDB->RunSQLBatch($fname); if (!$arErrors) { $_SESSION["STAT_strNote"] .= GetMessage("STAT_OPT_OPTIMIZED") . "<br>"; } else { $strError .= GetMessage("STAT_OPT_OPTIMIZE_ERRORS") . "<br>" . mydump($arErrors) . "<br>"; } } if ($strError == "") { LocalRedirect($APPLICATION->GetCurPage() . "?mid=" . urlencode($mid) . "&lang=" . urlencode(LANGUAGE_ID) . "&back_url_settings=" . urlencode($_REQUEST["back_url_settings"]) . "&" . $tabControl2->ActiveTabParam()); } } if (strlen($strError) > 0) { CAdminMessage::ShowMessage($strError); } if (strlen($_SESSION["STAT_strNote"]) > 0) { CAdminMessage::ShowNote($_SESSION["STAT_strNote"]); unset($_SESSION["STAT_strNote"]); } $tabControl->Begin(); ?>
function SendError($error) { if(defined('ERROR_EMAIL') && ERROR_EMAIL <> '') { $from = (defined('ERROR_EMAIL_FROM') && ERROR_EMAIL_FROM <> ''? ERROR_EMAIL_FROM : '*****@*****.**'); $reply_to = (defined('ERROR_EMAIL_REPLY_TO') && ERROR_EMAIL_REPLY_TO <> ''? ERROR_EMAIL_REPLY_TO : '*****@*****.**'); bxmail(ERROR_EMAIL, $_SERVER['HTTP_HOST'].": Error!", $error. "HTTP_GET_VARS:\n".mydump($_GET)."\n\n". "HTTP_POST_VARS:\n".mydump($_POST)."\n\n". "HTTP_COOKIE_VARS:\n".mydump($_COOKIE)."\n\n". "HTTP_SERVER_VARS:\n".mydump($_SERVER)."\n\n", "From: ".$from."\r\n". "Reply-To: ".$reply_to."\r\n". "X-Mailer: PHP/" . phpversion() ); } }
<?php require_once "../../config/init.php"; mydump(pmail(array('*****@*****.**'), 'test', 'test444', false, '*****@*****.**'));
public static function Dump($obj) { echo '<pre>', mydump($obj), '</pre>'; }
function &__generate($method, &$params, $namespace = false, $soapAction = false) { $this->fault = null; $this->__options['input'] = 'parse'; $this->__options['result'] = 'parse'; $this->__options['parameters'] = false; if ($params && gettype($params) != 'array') { $params = array($params); } if (gettype($namespace) == 'array') { foreach ($namespace as $optname => $opt) { $this->__options[strtolower($optname)] = $opt; } if (isset($this->__options['namespace'])) { $namespace = $this->__options['namespace']; } else { $namespace = false; } } else { // We'll place $soapAction into our array for usage in the // transport. $this->__options['soapaction'] = $soapAction; $this->__options['namespace'] = $namespace; } if ($this->__endpointType == 'wsdl') { $this->_setSchemaVersion($this->_wsdl->xsd); // Get port name. if (!$this->_portName) { $this->_portName = $this->_wsdl->getPortName($method); } if (PEAR::isError($this->_portName)) { return $this->_raiseSoapFault($this->_portName); } // Get endpoint. $this->_endpoint = $this->_wsdl->getEndpoint($this->_portName); if (PEAR::isError($this->_endpoint)) { return $this->_raiseSoapFault($this->_endpoint); } // Get operation data. $opData = $this->_wsdl->getOperationData($this->_portName, $method); if (PEAR::isError($opData)) { return $this->_raiseSoapFault($opData); } $namespace = $opData['namespace']; $this->__options['style'] = $opData['style']; $this->__options['use'] = $opData['input']['use']; $this->__options['soapaction'] = $opData['soapAction']; // Set input parameters. mydump('debug'); mydump($this->__options); mydump($opData); mydump($params); if ($this->__options['input'] == 'parse') { $this->__options['parameters'] = $opData['parameters']; $nparams = array(); if (isset($opData['input']['parts']) && count($opData['input']['parts'])) { $i = 0; foreach ($opData['input']['parts'] as $name => $part) { $xmlns = ''; $attrs = array(); // Is the name a complex type? if (isset($part['element'])) { $xmlns = $this->_wsdl->namespaces[$part['namespace']]; $part = $this->_wsdl->elements[$part['namespace']][$part['type']]; $name = $part['name']; } if (isset($params[$name]) || $this->_wsdl->getDataHandler($name, $part['namespace'])) { $nparams[$name] =& $params[$name]; } else { // We now force an associative array for // parameters if using WSDL. return $this->_raiseSoapFault("The named parameter {$name} is not in the call parameters."); } if (gettype($nparams[$name]) != 'object' || !is_a($nparams[$name], 'SOAP_Value')) { // Type is likely a qname, split it apart, and get // the type namespace from WSDL. $qname =& new QName($part['type']); if ($qname->ns) { $type_namespace = $this->_wsdl->namespaces[$qname->ns]; } elseif (isset($part['namespace'])) { $type_namespace = $this->_wsdl->namespaces[$part['namespace']]; } else { $type_namespace = null; } $qname->namespace = $type_namespace; $type = $qname->name; $pqname = $name; if ($xmlns) { $pqname = '{' . $xmlns . '}' . $name; } $nparams[$name] =& new SOAP_Value($pqname, $qname->fqn(), $nparams[$name], $attrs); } else { // WSDL fixups to the SOAP value. } } } $params =& $nparams; //unset($nparams); } } else { $this->_setSchemaVersion(SOAP_XML_SCHEMA_VERSION); } // Serialize the message. $this->_section5 = isset($this->__options['use']) && $this->__options['use'] == 'literal'; if (!isset($this->__options['style']) || $this->__options['style'] == 'rpc') { $this->__options['style'] = 'rpc'; $this->docparams = true; $mqname =& new QName($method, $namespace); $methodValue =& new SOAP_Value($mqname->fqn(), 'Struct', $params); $soap_msg =& $this->_makeEnvelope($methodValue, $this->headersOut, $this->_encoding, $this->__options); } else { if (!$params) { $mqname =& new QName($method, $namespace); $mynull = null; $params =& new SOAP_Value($mqname->fqn(), 'Struct', $mynull); } elseif ($this->__options['input'] == 'parse') { if (is_array($params)) { $nparams = array(); $keys = array_keys($params); foreach ($keys as $k) { if (gettype($params[$k]) != 'object') { $nparams[] =& new SOAP_Value($k, false, $params[$k]); } else { $nparams[] =& $params[$k]; } } $params =& $nparams; } if ($this->__options['parameters']) { $mqname =& new QName($method, $namespace); $params =& new SOAP_Value($mqname->fqn(), 'Struct', $params); } } $soap_msg =& $this->_makeEnvelope($params, $this->headersOut, $this->_encoding, $this->__options); } unset($this->headersOut); if (PEAR::isError($soap_msg)) { return $this->_raiseSoapFault($soap_msg); } // Handle MIME or DIME encoding. // TODO: DIME encoding should move to the transport, do it here for // now and for ease of getting it done. if (count($this->__attachments)) { if (isset($this->__options['attachments']) && $this->__options['attachments'] == 'Mime' || isset($this->__options['Mime'])) { $soap_msg =& $this->_makeMimeMessage($soap_msg, $this->_encoding); } else { // default is dime $soap_msg =& $this->_makeDIMEMessage($soap_msg, $this->_encoding); $this->__options['headers']['Content-Type'] = 'application/dime'; } if (PEAR::isError($soap_msg)) { return $this->_raiseSoapFault($soap_msg); } } // Instantiate client. if (is_array($soap_msg)) { $soap_data =& $soap_msg['body']; if (count($soap_msg['headers'])) { if (isset($this->__options['headers'])) { $this->__options['headers'] = array_merge($this->__options['headers'], $soap_msg['headers']); } else { $this->__options['headers'] = $soap_msg['headers']; } } } else { $soap_data =& $soap_msg; } return $soap_data; }
function Send($object, $template_name, $recipients, $dump = false) { global $_CONF; $smarty = new Smarty(); $smarty->assign($object->getValues()); $subject = " "; $headers = " "; $smarty->assign('msubject', $subject); $smarty->assign('mheaders', $headers); $out = $smarty->fetch($_CONF[root_dir] . $_CONF[emails_dir] . $_CONF[$template_name]); $body = $smarty->getSmartyVar('capture.body'); $subject = $smarty->getSmartyVar('capture.subject'); $from = $smarty->getSmartyVar('capture.from'); if (empty($from)) { $from = $_CONF[mail_from]; } $headers = array(); if ($add_h = explode("\n", $smarty->getSmartyVar('capture.headers'))) { $headers = array_merge($headers, $add_h); } if (!is_array($recipients) && is_string($recipients)) { $recipients = array($recipients); } if ($dump) { mydump($body); mydump($subject); mydump($headers); mydump($recipients); exit; } if ($_CONF[mail_enabled] != 'FALSE') { return pmail($recipients, $body, $subject, $headers, $from); } //exit(); }
/** * Send outgoing request, and read/parse response, via HTTPS * * @param string &$msg outgoing SOAP package * @param string $action SOAP Action * @return string &$response response data, minus http headers * @access private */ function &_sendHTTPS(&$msg, $options) { /* NOTE This function uses the CURL functions * Your php must be compiled with CURL */ if (!extension_loaded('curl')) { return $this->_raiseSoapFault('CURL Extension is required for HTTPS'); } $ch = curl_init(); if (isset($options['proxy_host'])) { // $options['http_proxy'] == 'hostname:port' $host = $options['proxy_host']; $port = isset($options['proxy_port']) ? $options['proxy_port'] : 8080; curl_setopt($ch, CURLOPT_PROXY, $host . ":" . $port); } if (isset($options['proxy_user'])) { // $options['http_proxy_userpw'] == 'username:password' curl_setopt($ch, CURLOPT_PROXYUSERPWD, $options['proxy_user'] . ':' . $options['proxy_pass']); } if (isset($options['user'])) { curl_setopt($ch, CURLOPT_USERPWD, $options['user'] . ':' . $options['pass']); } if (!isset($options['soapaction'])) { $options['soapaction'] = ''; } curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml;charset=' . $this->encoding, 'SOAPAction: "' . $options['soapaction'] . '"')); curl_setopt($ch, CURLOPT_USERAGENT, $this->_userAgent); if ($this->timeout) { curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); //times out after 4s } curl_setopt($ch, CURLOPT_POSTFIELDS, $msg); curl_setopt($ch, CURLOPT_URL, $this->url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); if (defined('CURLOPT_HTTP_VERSION')) { curl_setopt($ch, CURLOPT_HTTP_VERSION, 1); } curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); if (isset($options['curl'])) { foreach ($options['curl'] as $key => $val) { curl_setopt($ch, $key, $val); } } // Save the outgoing XML. This doesn't quite match _sendHTTP // as CURL generates the headers, but having the XML is // usually the most important part for tracing/debugging. $this->outgoing_payload = $msg; $this->incoming_payload = curl_exec($ch); mydump('tut'); mydump($this->outgoing_payload); mydump($this->incoming_payload); if (!$this->incoming_payload) { $m = 'curl_exec error ' . curl_errno($ch) . ' ' . curl_error($ch); curl_close($ch); return $this->_raiseSoapFault($m); } curl_close($ch); if (!$this->_parseResponse()) { return $this->fault; } return $this->response; }
echo '</div>'; } echo '</div>'; } ++$i; echo '<div id="tab_' . $i . '" class="tab">'; echo '<h2>Dataframe</h2>'; $cmd = 'data.frame(sexe=c("F","M","F","M"), age=c(10,22,23,44), weight=c(20,55,60,67))'; $x = $r->evalString($cmd, Rserve_Connection::PARSER_REXP); mydump($x, 'REXP object'); mydump($x->getClass(), 'getClass()'); mydump($x->getRowNames(), 'getRowNames()'); mydump($x->getNames(), 'getNames()'); mydump($x->nrow(), 'nrow()'); mydump($x->ncol(), 'ncol()'); echo '</div>'; ++$i; echo '<div id="tab_' . $i . '" class="tab">'; echo '<h2>Complex</h2>'; $cmd = 'x = 1:10 + rnorm(10)*1i'; $x = $r->evalString($cmd, Rserve_Connection::PARSER_REXP); mydump($x, 'REXP object'); echo $x->toHTML(); $x = $r->evalString($cmd, Rserve_Connection::PARSER_NATIVE); mydump($x, 'Native'); echo '</div>'; $r->close(); } catch (Exception $e) { echo $e; } require 'example/foot.php';
<?php define('XOX_LIB', '../lib'); require_once XOX_LIB . '/navigation/class.navigation.php'; require_once 'debug.php'; // create navigation and set pass through $nav = new xoxNavigation('www.xox.php'); $nav->addPassthru('url'); mydump($nav);
function getReport() { mydump(parent::getMessage()); }
function insertRow($table, $idfield, $values, $dbtypes = false) { global $merchant; global $_CONF; if (!is_array($dbtypes)) { $dbtypes = $this->getTableInfo($table); } if (is_array($values)) { foreach ($values as $key => $val) { if (!empty($dbtypes[$key]) && $key != 'server_id' && $key != $idfield && !is_null($val) && $val != '') { switch ($dbtypes[$key]->Type) { case 'int': case 'tinyint': case 'float': $val = mysql_real_escape_string($val + 0); break; case 'datetime': case 'date': if (empty($val) || $val == '0000-00-00 00:00:00') { $val = 'now()'; } else { $val = sprintf("'%s'", mysql_real_escape_string($val)); } break; case 'set': unset($setval); if (is_array($val)) { foreach ($val as $setkey => $setvalue) { if (!empty($setvalue)) { $setval[] = $setvalue; } } $val = sprintf("'%s'", is_array($setval) ? mysql_real_escape_string(implode(',', $setval)) : ''); } else { $val = false; } break; default: $val = sprintf("'%s'", mysql_real_escape_string($val)); break; } if (!empty($val)) { $qfields .= sprintf("%s,", mysql_real_escape_string($key)); $qvalues .= sprintf("%s,", $val); } } } } global $_CONF; if ($_CONF[db_use_generated_id] == "auto_increment") { } else { if ($_CONF[db_use_generated_id] == "TRUE") { $id = $this->genID(); $qfields .= sprintf("%s,", mysql_real_escape_string($idfield)); $qvalues .= sprintf("%s,", $id); } else { $que = sprintf("select %s as max_id from %s order by %s desc limit 1", mysql_real_escape_string($idfield), mysql_real_escape_string($table), mysql_real_escape_string($idfield)); $res = mysql_fetch_assoc($this->query($que)); $id = $res[max_id] + 1; $qfields .= sprintf("%s,", mysql_real_escape_string($idfield)); $qvalues .= sprintf("%s,", $id); } } if ($_CONF[db_add_serverID]) { $qfields .= sprintf("%s,", mysql_real_escape_string('server_id')); $qvalues .= sprintf("%s,", $this->_serverID); } $qfields = substr($qfields, 0, -1); $qvalues = substr($qvalues, 0, -1); $que = sprintf("insert into %s (%s) values (%s)", mysql_real_escape_string($table), $qfields, $qvalues); mylog($que, 'dbupdate'); try { if ($res = $this->query($que)) { return mysql_insert_id($this->link) ? mysql_insert_id($this->link) : $id; } else { throw new MysqlException("Can't insert data into table {$table}: " . mysql_error($this->link)); } } catch (MysqlException $e) { if ($_CONF[db_use_generated_id] == "TRUE" && mysql_errno($this->link) == 1062) { mydump($e->getReport()); usleep(rand(200, 400)); $this->insertRow($table, $idfield, $values, $dbtypes); } else { throw $e; } } }