/** * PUT changes into an existing record * * @param array $params * @param array $postData * @return array */ public function put(array $params, array $postData) { $this->_requireDataType($params); if (!array_get($params, 'id')) { throw new Garp_Content_Api_Rest_Exception(self::EXCEPTION_PUT_WITHOUT_ID); } $model = $this->_normalizeModelName($params['datatype']); // First, see if the record actually exists list($record) = $this->_getSingleResult($params); if (is_null($record['result'])) { return $this->_formatResponse(array('success' => false), 404); } if (!array_get($params, 'relatedType')) { $this->_updateSingle($params, $postData); list($response, $httpCode) = $this->_getSingleResult($params); } else { $schema = new Garp_Content_Api_Rest_Schema('rest'); // Sanity check if related model exists list($relatedRecord) = $this->_getSingleResult(array('datatype' => getProperty('model', $schema->getRelation($params['datatype'], $params['relatedType'])), 'id' => $params['relatedId'])); if (!$relatedRecord['result']) { return $this->_formatResponse(array('success' => false), 404); } $this->_addRelation($params, $postData); list($response, $httpCode) = $this->_getRelatedResults($params); } return $this->_formatResponse($response, $httpCode); }
function __construct() { $this->format = 'application/sparql-results+json'; $dados = new Constant(); $this->http = getProperty($dados->DB_HOST); //http://localhost:8890/sparql/ // }
function consultaSPARQL($sparql) { error_reporting(E_ALL); ini_set("display_errors", 1); $dados = new Constant(); $login = getProperty($dados->DB_LOGIN_SPARQL); $url_sparql = getProperty($dados->DB_URL_SPARQL); //definindo o formato de retorno dos dados $format = 'application/sparql-results+json'; //definindo a consulta $consulta = $sparql; //codificando a consulta $url = urlencode($consulta); //concatenando as string para formar a url de consulta $sparqlURL = $url_sparql . '?query=' . $url; /*Setando o cabecalho da requisicao */ //usando a fun����o curl para conectar com o allegrograph $curl = curl_init(); //inicializando o curl curl_setopt($curl, CURLOPT_USERPWD, $login); //usuario e senha do banco curl_setopt($curl, CURLOPT_URL, $sparqlURL); //definindo a url de consulta curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); //Recebe o retorno da consulta como uma string curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: ' . $format)); //definido o formato de retorno desejado $resposta = curl_exec($curl); //executando o curl e armazenando a resposta numa variavel curl_close($curl); //fechando o curl ///////// come��ando a manipula����o de dados///////////// $objects = array(); $resultado = json_decode($resposta); //Decodificando o objecto json //pegando o valor de interesse no array// foreach ($resultado->results->bindings as $reg) { // primeiro loop $obj = new stdClass(); foreach ($reg as $field => $value) { $obj->{$field} = $value->value; } $objects[] = $obj; } //sai do segundo loop $row = objectToArray($objects); return $row; }
public function testReplaceFieldTag() { $replaceFieldTag = getMethod('MailForm', 'replaceFieldTag'); $RequestParam = getProperty('MailForm', 'RequestParam'); $FormConfig = getProperty('MailForm', 'FormConfig'); $mailform = $this->getMockBuilder('MailForm')->setMethods(array('getDateTime'))->getMock(); $mailform->expects($this->any())->method('getDateTime')->will($this->returnValue('return_getDateTime')); $selectValues = array('1' => 'option1', '2' => 'option2', '3' => 'option3'); $FormConfig->setValue($mailform, array('items' => array('key1' => array('value' => 'string'), 'selectkey' => array('value' => 'select', 'selectvalues' => $selectValues), 'multi-selectkey' => array('value' => 'multi-select', 'selectvalues' => $selectValues)))); $RequestParam->setValue($mailform, array('key1' => 'value1', 'key2' => 'value2', 'selectkey' => '1', 'multi-selectkey' => array('2', '3'))); $this->assertEquals('時間:return_getDateTime', $replaceFieldTag->invokeArgs($mailform, array('時間:{{{datetime}}}'))); $this->assertEquals('key1=value1\\nselectkey=option1\\nmulti-selectkey=option2/option3', $replaceFieldTag->invokeArgs($mailform, array('key1={{{key1}}}\\nselectkey={{{selectkey}}}\\nmulti-selectkey={{{multi-selectkey}}}'))); $RequestParam->setValue($mailform, array()); $this->assertEquals('key1=\\nselectkey=\\nmulti-selectkey=', $replaceFieldTag->invokeArgs($mailform, array('key1={{{key1}}}\\nselectkey={{{selectkey}}}\\nmulti-selectkey={{{multi-selectkey}}}'))); }
$offer_text = preg_replace("/#PROX#ADDRESS#PROX#/", $address, $offer_text); $offer_text = preg_replace("/#PROX#PROPERTY#PROX#/", $propertyName, $offer_text); $offer_text = preg_replace("/MORE OFFERS AT:/", "", $offer_text); $offer_text = preg_replace("/Mas ofertas/", "", $offer_text); $offer_text = preg_replace("/ValuText:/", "", $offer_text); //$offer_text = preg_replace("/http:\/\/vtext.me(\/)?/", $url, $offer_text); $offer_text = preg_replace("/http:\\/\\/vtext.me(\\/)?/", "", $offer_text); //$offer_text = preg_replace("/#PROX#ADDRESS#PROX#/",$property->address,$obj->clean_offer_text); $list[] = "<div id='offer' class=\"listitem\"><div>" . $offer_text . "\n </div></div>"; $list[] = $share; $title .= " - " . $offer_text; } else { header("Location: /"); } } elseif (isset($PROPERTY_id)) { $property = getProperty($mysqli, $PROPERTY_id); if ($property != NULL) { $title .= $property->name; $oList = listOffersByPropertyAndLocale($mysqli, $PROPERTY_id, $locale); $list[] = "<div id='offer' class=\"backitem\">\n <a href=\"/" . $COUNTRY_id . "/" . $locale . "\"><div><span class='larrow'>◄</span>" . $message_back . "</a></div>" . "</div><h2>" . $property->name . "</h2><p>" . $property->address . "</p>"; foreach ($oList as $obj) { $retailer = getRetailerByOffer($mysqli, $obj->id); $list[] = "\n <div class=\"listitem\">\n <a href=\"/" . $COUNTRY_id . "/" . $locale . "/" . $PROPERTY_id . "/" . $obj->id . "\">\n <div id=\"offer-" . $obj->id . "\">" . $retailer->name . "\n <span class=\"arrow\">►</span>\n </div>\n </a>\n </div>"; } } else { header("Location: /404?reason=propertynotfound"); } } elseif (isset($COUNTRY_id)) { $pList = listPropertiesByCountry($mysqli, $COUNTRY_id); $list[] = "<div id='offer' class=\"backitem\">\n <a href=\"/\"><div><span class='larrow'>◄</span>" . $message_back . "</a></div>" . "</div><br/><br/>"; foreach ($pList as $obj) {
protected function _getVisibleModels() { return array_filter((array) Garp_Spawn_Model_Set::getInstance(), getProperty('visible')); }
function rss_scheme_stylesheets($theme = null, $media = null) { if ($theme === null) { list($theme, $media) = getActualTheme(); } $ret = getProperty(rss_theme_option_ref_obj_from_theme($theme, $media), rss_theme_config_override_option_name_mangle('rss.output.theme.scheme')); if ($ret === null) { return ""; } $arr = explode(',', $ret); $ret = ""; $idx = array_pop($arr); foreach (loadSchemeList(false, $theme, $media) as $i => $val) { if ($i == $idx) { if ($i > 0) { if (file_exists(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}") && is_dir(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}")) { foreach (glob(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}/*.css") as $file) { $file = substr($file, strlen(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}/")); $file = getPath() . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}/{$file}"; $ret .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"{$file}\" />\n"; } } } break; } } return $ret; }
<?php require_once 'library/menu.php'; echo "<h1>Tracking</h1>"; if (isset($_GET['number'])) { require_once 'library/fedex-common.php'; //The WSDL is not included with the sample code. //Please include and reference in $path_to_wsdl variable. $path_to_wsdl = "wsdl/TrackService_v10.wsdl"; ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information $request['WebAuthenticationDetail'] = array('ParentCredential' => array('Key' => getProperty('parentkey'), 'Password' => getProperty('parentpassword')), 'UserCredential' => array('Key' => getProperty('key'), 'Password' => getProperty('password'))); $request['ClientDetail'] = array('AccountNumber' => getProperty('shipaccount'), 'MeterNumber' => getProperty('meter')); $request['TransactionDetail'] = array('CustomerTransactionId' => '*** Track Request using PHP ***'); $request['Version'] = array('ServiceId' => 'trck', 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0'); $request['SelectionDetails'] = array('PackageIdentifier' => array('Type' => 'TRACKING_NUMBER_OR_DOORTAG', 'Value' => $_GET['number'])); try { if (setEndpoint('changeEndpoint')) { $newLocation = $client->__setLocation(setEndpoint('endpoint')); } $response = $client->track($request); if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') { if ($response->HighestSeverity != 'SUCCESS') { echo '<table border="1">'; echo '<tr><th>Track Reply</th><th> </th></tr>'; trackDetails($response->Notifications, ''); echo '</table>'; } else { if ($response->CompletedTrackDetails->HighestSeverity != 'SUCCESS') { echo '<table border="1">';
function addSmartPostDetail(){ $smartPostDetail = array( 'Indicia' => 'PARCEL_SELECT', 'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE', 'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION', 'HubId' => getProperty('hubid') //'CustomerManifestId' => 'XXX' ); return $smartPostDetail; }
); $request['ReturnTransitAndCommit'] = true; $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ... $request['RequestedShipment']['ShipTimestamp'] = date('c'); // Service Type and Packaging Type are not passed in the request $request['RequestedShipment']['Shipper'] = array( 'Address'=>getProperty('address1') ); $request['RequestedShipment']['Recipient'] = array( 'Address'=>getProperty('address2') ); $request['RequestedShipment']['ShippingChargesPayment'] = array( 'PaymentType' => 'SENDER', 'Payor' => array( 'ResponsibleParty' => array( 'AccountNumber' => getProperty('billaccount'), 'Contact' => null, 'Address' => array( 'CountryCode' => 'US' ) ) ) ); $request['RequestedShipment']['PackageCount'] = '2'; $request['RequestedShipment']['RequestedPackageLineItems'] = array( '0' => array( 'SequenceNumber' => 1, 'GroupPackageCount' => 1, 'Weight' => array( 'Value' => 2.0, 'Units' => 'LB'
function channel_edit_form($cid) { $sql = "select id, title, url, siteurl, parent, descr, icon, mode, daterefreshed, dateadded from " . getTable("channels") . " where id={$cid}"; $res = rss_query($sql); list($id, $title, $url, $siteurl, $parent, $descr, $icon, $mode, $daterefreshed, $dateadded) = rss_fetch_row($res); $title = htmlentities($title, ENT_QUOTES); // get tags $sql = "select t.tag from " . getTable('tag') . " t " . " inner join " . getTable('metatag') . " m " . " on m.tid = t.id " . "where m.ttype = 'channel' and m.fid = {$cid}"; $res = rss_query($sql); $tags = ""; while ($r = rss_fetch_assoc($res)) { $tags .= $r['tag'] . " "; } echo "<div>\n"; echo "\n\n<h2>" . __('Edit the feed ') . " '{$title}'</h2>\n"; echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "#fa{$cid}\" id=\"channeledit\">\n"; echo "<fieldset id=\"channeleditfs\">"; // Timestamps if (!empty($daterefreshed)) { echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" . "<p><label>" . __('Last Update') . ": " . date("M-d-Y H:i", strtotime($daterefreshed)) . " (Age: " . round((time() - strtotime($daterefreshed)) / 60) . " minutes)</label></p>\n"; } else { echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" . "<p><label>" . __('Last Update') . ": " . __('Never') . "</label></p>\n"; } // Item name echo "<p><label for=\"c_name\">" . __('Title:') . "</label>\n" . "<input type=\"text\" id=\"c_name\" name=\"c_name\" value=\"{$title}\" />" . "<input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CHANNEL . "\" />\n" . "<input type=\"hidden\" name=\"action\" value=\"" . CST_ADMIN_SUBMIT_EDIT . "\" />\n" . "<input type=\"hidden\" name=\"cid\" value=\"{$cid}\" /></p>\n" . "<p><label for=\"c_url\">" . __('RSS URL:') . "</label>\n" . "<a href=\"{$url}\">" . __('(visit)') . "</a>\n" . "<input type=\"text\" id=\"c_url\" name=\"c_url\" value=\"{$url}\" /></p>" . "<p><label for=\"c_siteurl\">" . __('Site URL:') . "</label>\n" . "<a href=\"{$siteurl}\">" . __('(visit)') . "</a>\n" . "<input type=\"text\" id=\"c_siteurl\" name=\"c_siteurl\" value=\"{$siteurl}\" /></p>" . "<p><label for=\"c_parent\">" . __('In folder:') . "</label>\n" . rss_toolkit_folders_combo('c_parent', $parent) . "</p>\n"; // Tags echo "<p><label for=\"c_tags\">" . __('Categories') . ":</label>\n" . "<input type=\"text\" id=\"c_tags\" name=\"c_tags\" value=\"{$tags}\" /></p>"; // Items state if ($mode & RSS_MODE_PRIVATE_STATE) { $pchk = " checked=\"checked\" "; $old_priv = "1"; } else { $pchk = ""; $old_priv = "0"; } if ($mode & RSS_MODE_DELETED_STATE) { $dchk = " checked=\"checked\" "; $old_del = "1"; } else { $dchk = ""; $old_del = "0"; } echo "<p>\n" . "<input style=\"display:inline\" type=\"checkbox\" id=\"c_private\" " . " name=\"c_private\" value=\"1\"{$pchk} />\n" . "<label for=\"c_private\">" . __('This feed is <strong>private</strong>, only admins see it.') . "</label>\n" . "<input type=\"hidden\" name=\"old_priv\" value=\"{$old_priv}\" />\n" . "</p>\n"; echo "<p>\n" . "<input style=\"display:inline\" type=\"checkbox\" id=\"c_deleted\" " . " name=\"c_deleted\" value=\"1\"{$dchk} />\n" . "<label for=\"c_deleted\">" . __("This feed is <strong>deprecated</strong>, it won't be updated anymore and won't be visible in the feeds column.") . "</label>\n" . "<input type=\"hidden\" name=\"old_del\" value=\"{$old_del}\" />\n" . "</p>\n"; // Description $descr = trim(htmlentities(strip_tags($descr), ENT_QUOTES)); echo "<p><label for=\"c_descr\">" . __('Description:') . "</label>\n" . "<input type=\"text\" id=\"c_descr\" name=\"c_descr\" value=\"{$descr}\" /></p>\n"; // Icon if (getConfig('rss.output.showfavicons')) { echo "<p><label for=\"c_icon\">" . __('Shown favicon:') . "</label>\n"; if (trim($icon) != "") { if (substr($icon, 0, 5) == 'blob:') { $icon = substr($icon, 5); } echo "<img src=\"{$icon}\" alt=\"{$title}\" class=\"favicon\" width=\"16\" height=\"16\" />\n"; echo "<span>" . __('(Leave blank for no icon)') . "</span>"; } echo "<input type=\"text\" id=\"c_icon\" name=\"c_icon\" value=\"{$icon}\" /></p>\n"; } else { echo "<p><input type=\"hidden\" name=\"c_icon\" id=\"c_icon\" value=\"{$icon}\" /></p>\n"; } rss_plugin_hook('rss.plugins.admin.feed.properties', $cid); echo "</fieldset>\n"; // Feed properties echo "<fieldset id=\"channeleditpropfs\">"; echo "<p>" . "<span style=\"float:left;\">Allow Gregarius to look for updates in existing items for this feed?</span>" . "<span style=\"float:right;\">[<a href=\"index.php?domain=config&action=edit&key=rss.input.allowupdates&view=config\">Edit the global option</a>]</span>\n" . " " . "</p>"; $rss_input_allowupdates_default_current = getProperty($cid, 'rss.input.allowupdates'); $rss_input_allowupdates_default_value = $rss_input_allowupdates_default = "Use global option (" . (getConfig('rss.input.allowupdates') ? "Yes" : "No") . ")"; echo "<p id=\"rss_input_allowupdates_options\">" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_yes\" " . "name=\"prop_rss_input_allowupdates\" value=\"1\" " . ($rss_input_allowupdates_default_current === true ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_yes\">Yes</label>\n" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_no\" " . "name=\"prop_rss_input_allowupdates\" value=\"0\" " . ($rss_input_allowupdates_default_current === false ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_no\">No</label>" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_default\" " . "name=\"prop_rss_input_allowupdates\" value=\"default\" " . ($rss_input_allowupdates_default_current === null ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_default\">{$rss_input_allowupdates_default}</label>" . "</p>\n"; echo "<p>" . "<span style=\"float:left;\">Refresh Interval (minutes): </span>" . " " . "</p>"; $rss_config_refreshinterval_default_current = getProperty($cid, 'rss.config.refreshinterval'); echo "<p id=\"rss_config_refreshinterval_options\">" . "<input type=\"text\" id=\"rss_config_refreshinterval\" name=\"rss_config_refreshinterval\" value=\"" . (true == empty($rss_config_refreshinterval_default_current) ? 60 : $rss_config_refreshinterval_default_current) . "\">" . "</p>"; echo "</fieldset>\n"; echo "<p style=\"clear:both; padding: 1em 0\"><input type=\"submit\" name=\"action_\" value=\"" . __('Submit Changes') . "\" />" . "<input type=\"button\" name=\"_cancel\" value=\"" . __('Cancel') . "\" onclick=\"history.back(-1);\"></p>"; echo "</form></div>\n"; }
public function total_cadastrados1() { $format = 'application/sparql-results+json'; /*Concatenando string que formar a url*/ $endereco = 'PREFIX des:<http://www.desaparecidos.com.br/rdf/> SELECT (COUNT(distinct ?s) AS ?no) { ?s des:id ?x }'; $url = urlencode($endereco); $dados = new Constant(); $sparqlURL = getProperty($dados->DB_HOST) . '?query=' . $url . '+limit+10'; //http://localhost:10035/repositories/desaparecidos /*Setando o cabecalho da requisicao */ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $sparqlURL); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); //Recebe o output da url como uma string curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: ' . $format, 'Content-Type: application/sparql-results+json')); $resposta = curl_exec($curl); curl_close($curl); ///////// começando a manipulação de dados///////////// $objects = array(); $results = json_decode($resposta); //Decodificando o objecto json //pegando o valor de interesse no array// foreach ($results->results->bindings as $reg) { // primeiro loop $retorno = new stdClass(); //cria uma classe generica do php foreach ($reg->no as $posicao) { //entra no segundo loop $retorno->retorno = $posicao; //faz com que a classe generica do php receba a ultima posicao do segundo loop } //sai do segundo loop $objects[] = $retorno->retorno; } return $objects[0]; /* $this->load->library('virtuoso_query'); //Carrega a classe para gerar consultas sparql $this->load->library('sparql'); //Montando a consulta SPARQL $endereco = 'SELECT (COUNT(distinct ?s) AS ?no) { ?s a [] }'; $url = urlencode($endereco); $sparqlURL = 'http://172.18.40.9:10035/repositories/desaparecidos1?query='.$url.'+limit+10'; //Carregando os dados para consulta no virtuoso $this->virtuoso_query->load_sparql_http('http://172.18.40.9:10035/repositories/desaparecidos1'); $this->virtuoso_query->load_graph(get_graph()); $this->virtuoso_query->load_query_sparql($url); $this->virtuoso_query->load_format('application/sparql-results+json'); //Executa a query SPARQL $this->virtuoso_query->execute(); $quantidade = $this->virtuoso_query->convert_json_to_simple_object(); return $quantidade; */ }
function addShippingChargesPayment(){ $shippingChargesPayment = array( 'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY 'Payor' => array( 'AccountNumber' => getProperty('shipaccount'), 'CountryCode' => 'US') ); return $shippingChargesPayment; }
| - good for ensuring strict SQL while developing | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the 'default' group). | | The $active_record variables lets you determine whether or not to load | the active record class */ $active_group = 'default'; $active_record = TRUE; include 'properties.php'; $dados = new Constant(); $host = getProperty($dados->DB_HOST); $user = getProperty($dados->DB_USER); $pass = getProperty($dados->DB_PASS); $desa = getProperty($dados->DB_DESA); $db['default']['hostname'] = $host; $db['default']['username'] = $user; $db['default']['password'] = $pass; $db['default']['database'] = $desa; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE;
function addCustomClearanceDetail2(){ $customerClearanceDetail = array( 'DutiesPayment' => array( 'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY 'Payor' => array( 'ResponsibleParty' => array( 'AccountNumber' => getProperty('dutyaccount'), 'Contact' => null, 'Address' => array( 'CountryCode' => 'US' ) ) ) ), 'DocumentContent' => 'DOCUMENTS_ONLY', 'TermsOfSale' => 'CFR_OR_CPT', // valid values CFR_OR_CPT, CIF_OR_CIP, DDP, DDU, EXW and FOB_OR_FCA 'CustomsValue' => array( 'Currency' => 'USD', 'Amount' => 100.00 ), 'Commodities' => array( '0' => array( 'NumberOfPieces' => 1, 'Description' => 'Books', 'CountryOfManufacture' => 'US', 'Weight' => array( 'Units' => 'LB', 'Value' => 1.0 ), 'Quantity' => 1, 'QuantityUnits' => 'EA', 'UnitPrice' => array( 'Currency' => 'USD', 'Amount' => 1.000000 ), 'CustomsValue' => array( 'Currency' => 'USD', 'Amount' => 100.000000 ) ) ) ); return $customerClearanceDetail; }
public function rdf($id = -1) { if ($id == -1) { redirect('desaparecido'); exit; } ////////////////////////////Alterado/////////////////////// $ID1 = '"' . $id . '"'; //Carrega a classe de consulta no virtuoso $this->load->library('virtuoso_query'); //Carrega a classe para gerar consultas sparql $this->load->library('sparql'); //Montando a consulta SPARQL $fields = array('foaf:name' => 'nome', 'foaf:nick' => 'apelido', 'foaf:birthday' => 'data_nascimento', 'foaf:gender' => 'sexo', 'foaf:img' => 'imagem', 'foaf:age' => 'idade', 'des:cityDes' => 'cidade', 'des:stateDes' => 'estado', 'dbpprop:height' => 'altura', 'dbpprop:weight' => 'peso', 'des:skin' => 'pele', 'dbpprop:hairColor' => 'cor_cabelo', 'dbpprop:eyeColor' => 'cor_olho', 'des:moreCharacteristics' => 'mais_caracteristicas', 'des:disappearanceDate' => 'data_desaparecimento', 'des:disappearancePlace' => 'local_desaparecimento', 'des:circumstanceLocation' => 'circunstancia_desaparecimento', 'des:dateLocation' => 'data_localizacao', 'des:additionalData' => 'dados_adicionais', 'des:status' => 'status', 'des:source' => 'fonte'); //Defini os prefixos que serão usados $this->sparql->prefix("foaf", "http://xmlns.com/foaf/0.1/"); $this->sparql->prefix("des", get_schema()); $this->sparql->prefix("dbpprop", "http://dbpedia.org/property/"); //Tripla quer será retornada - Está condição deve ser satisfeita para retornar um resultado $this->sparql->new_ptrn("?recurso des:id {$ID1}"); foreach ($fields as $key => $value) { $this->sparql->select("?{$value}"); $this->sparql->optional($this->sparql->new_ptrn("?recurso {$key} ?{$value}")); } //Ordena por nome $this->sparql->order("?nome"); //processa a consulta $query = $this->sparql->query(); //Carregando os dados para consulta no virtuoso /////////////////////////Alterado/////////////////////////////// $dados = new Constant(); $this->virtuoso_query->load_sparql_http(getProperty($dados->DB_HOST)); //http://localhost:8890/sparql/ //'http://localhost:10035/repositories/desaparecidos' $this->virtuoso_query->load_graph(get_graph()); $this->virtuoso_query->load_query_sparql($query); ///////////////////////Alterado/////////////////////////////// $this->virtuoso_query->load_format('application/sparql-results+json'); //application/json //Executa a query SPARQL $this->virtuoso_query->execute(); //Retorna o resultado no formato especificado //$obj_json = $this->virtuoso_query->get_result(); //Retorna como um objeto mais simples ////////////////////Alterado////////////////////////// //$desaparecido = $this->virtuoso_query->convert_json_to_simple_object(0); $retorno[] = $this->virtuoso_query->convert_json_to_simple_object(0); $desaparecido = $retorno[0]; if (sizeof($desaparecido) != 0) { $rdf = '<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:dbpprop="http://dbpedia.org/property/" xmlns:being="http://purl.org/ontomedia/ext/common/being#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:des="http://www.desaparecidos.com.br/rdf/"> <rdf:description rdf:about="http://www.desaparecidos.ufjf.br/desaparecidos/' . $id . '"> <foaf:name>' . (!isset($desaparecido[0]->nome) ? $desaparecido[0]->nome : "vazio") . '</foaf:name> <foaf:nick>' . (isset($desaparecido[0]->apelido) ? $desaparecido[0]->apelido : "") . '</foaf:nick> <foaf:birthday>' . (isset($desaparecido[0]->data_nascimento) ? $desaparecido[0]->data_nascimento : "") . '</foaf:birthday> <foaf:gender>' . (isset($desaparecido[0]->sexo) ? $desaparecido[0]->sexo : "") . '</foaf:gender> <foaf:img>' . (isset($desaparecido[0]->imagem) ? $desaparecido[0]->imagem : "") . '</foaf:img> <foaf:age>' . (isset($desaparecido[0]->idade) ? $desaparecido[0]->idade : "") . '</foaf:age> <des:cityDes>' . (isset($desaparecido[0]->cidade) ? $desaparecido[0]->cidade : "") . '</des:cityDes> <des:cityDes rdf:resource="http://rdf.freebase.com/ns/en.juiz_de_fora" /> <des:cityDes rdf:resource="http://dbpedia.org/resource/Juiz_de_Fora" /> <des:cityDes rdf:resource="" /> <des:cityDes rdf:resource="" /> <des:stateDes>' . (isset($desaparecido[0]->estado) ? $desaparecido[0]->estado : "") . '</des:stateDes> <dbpprop:height>' . (isset($desaparecido[0]->altura) ? $desaparecido[0]->altura : "") . '</dbpprop:height> <dbpprop:weight>' . (isset($desaparecido[0]->peso) ? $desaparecido[0]->peso : "") . '</dbpprop:weight> <des:skin>' . (isset($desaparecido[0]->pele) ? $desaparecido[0]->pele : "") . '</des:skin> <dbpprop:hairColor>' . (isset($desaparecido[0]->cor_cabelo) ? $desaparecido[0]->cor_cabelo : "") . '</dbpprop:hairColor> <dbpprop:eyeColor>' . (isset($desaparecido[0]->cor_olho) ? $desaparecido[0]->cor_olho : "") . '</dbpprop:eyeColor> <des:moreCharacteristics>' . (isset($desaparecido[0]->mais_caracteristicas) ? $desaparecido[0]->mais_caracteristicas : "") . '</des:moreCharacteristics> <des:disappearanceDate>' . (isset($desaparecido[0]->data_desaparecimento) ? $desaparecido[0]->data_desaparecimento : "") . '</des:disappearanceDate> <des:disappearancePlace>' . (isset($desaparecido[0]->local_desaparecimento) ? $desaparecido[0]->local_desaparecimento : "") . '</des:disappearancePlace> <des:circumstanceLocation>' . (isset($desaparecido[0]->circunstancia_desaparecimento) ? $desaparecido[0]->circunstancia_desaparecimento : "") . '</des:circumstanceLocation> <des:dateLocation>' . (isset($desaparecido[0]->data_localizacao) ? $desaparecido[0]->data_localizacao : "") . '</des:dateLocation> <des:additionalData>' . (isset($desaparecido[0]->dados_adicionais) ? $desaparecido[0]->dados_adicionais : "") . '</des:additionalData> <des:status>' . (isset($desaparecido[0]->status) ? $desaparecido[0]->status : "") . '</des:status> <des:source>' . (isset($desaparecido[0]->fonte) ? $desaparecido[0]->fonte : "") . '</des:source> </rdf:description> </rdf:RDF>'; $this->load->helper('download'); force_download('desaparecido-' . $id . '.rdf', $rdf); } else { $this->load->view('tema/pages/pessoa-nao-encontrada'); } }
public function getParams() { $fields = array_filter($this->getModel()->fields->toArray(), getProperty('minLength')); return array_combine(array_map(getProperty('name'), $fields), array_map(getProperty('minLength'), $fields)); }
/** * This section provides a convenient place to setup many commonly used variables * needed for the php sample code to function. */ function getProperty($var) { if ($var == 'key') { return 'XXX'; } if ($var == 'password') { return 'XXX'; } if ($var == 'shipaccount') { return 'XXX'; } if ($var == 'billaccount') { return 'XXX'; } if ($var == 'dutyaccount') { return 'XXX'; } if ($var == 'freightaccount') { return 'XXX'; } if ($var == 'trackaccount') { return 'XXX'; } if ($var == 'dutiesaccount') { return 'XXX'; } if ($var == 'importeraccount') { return 'XXX'; } if ($var == 'brokeraccount') { return 'XXX'; } if ($var == 'distributionaccount') { return 'XXX'; } if ($var == 'locationid') { return 'PLBA'; } if ($var == 'printlabels') { return false; } if ($var == 'printdocuments') { return true; } if ($var == 'packagecount') { return '4'; } if ($var == 'meter') { return 'XXX'; } if ($var == 'shiptimestamp') { return mktime(10, 0, 0, date("m"), date("d") + 1, date("Y")); } if ($var == 'spodshipdate') { return '2014-07-21'; } if ($var == 'serviceshipdate') { return '2017-07-26'; } if ($var == 'readydate') { return '2014-07-09T08:44:07'; } //if($var == 'closedate') Return date("Y-m-d"); if ($var == 'closedate') { return '2014-07-17'; } if ($var == 'pickupdate') { return date("Y-m-d", mktime(8, 0, 0, date("m"), date("d") + 1, date("Y"))); } if ($var == 'pickuptimestamp') { return mktime(8, 0, 0, date("m"), date("d") + 1, date("Y")); } if ($var == 'pickuplocationid') { return 'XXX'; } if ($var == 'pickupconfirmationnumber') { return '1'; } if ($var == 'dispatchdate') { return date("Y-m-d", mktime(8, 0, 0, date("m"), date("d") + 1, date("Y"))); } if ($var == 'dispatchlocationid') { return 'XXX'; } if ($var == 'dispatchconfirmationnumber') { return '1'; } if ($var == 'tag_readytimestamp') { return mktime(10, 0, 0, date("m"), date("d") + 1, date("Y")); } if ($var == 'tag_latesttimestamp') { return mktime(20, 0, 0, date("m"), date("d") + 1, date("Y")); } if ($var == 'expirationdate') { return date("Y-m-d", mktime(8, 0, 0, date("m"), date("d") + 15, date("Y"))); } if ($var == 'begindate') { return '2014-07-22'; } if ($var == 'enddate') { return '2014-07-25'; } if ($var == 'trackingnumber') { return 'XXX'; } if ($var == 'hubid') { return '5531'; } if ($var == 'jobid') { return 'XXX'; } if ($var == 'searchlocationphonenumber') { return '5555555555'; } if ($var == 'customerreference') { return 'Cust_Reference'; } if ($var == 'shipper') { return array('Contact' => array('PersonName' => 'Sender Name', 'CompanyName' => 'Sender Company Name', 'PhoneNumber' => '1234567890'), 'Address' => array('StreetLines' => array('Address Line 1'), 'City' => 'Collierville', 'StateOrProvinceCode' => 'TN', 'PostalCode' => '38017', 'CountryCode' => 'US', 'Residential' => 1)); } if ($var == 'recipient') { return array('Contact' => array('PersonName' => 'Recipient Name', 'CompanyName' => 'Recipient Company Name', 'PhoneNumber' => '1234567890'), 'Address' => array('StreetLines' => array('Address Line 1'), 'City' => 'Herndon', 'StateOrProvinceCode' => 'VA', 'PostalCode' => '20171', 'CountryCode' => 'US', 'Residential' => 1)); } if ($var == 'address1') { return array('StreetLines' => array('10 Fed Ex Pkwy'), 'City' => 'Memphis', 'StateOrProvinceCode' => 'TN', 'PostalCode' => '38115', 'CountryCode' => 'US'); } if ($var == 'address2') { return array('StreetLines' => array('13450 Farmcrest Ct'), 'City' => 'Herndon', 'StateOrProvinceCode' => 'VA', 'PostalCode' => '20171', 'CountryCode' => 'US'); } if ($var == 'searchlocationsaddress') { return array('StreetLines' => array('240 Central Park S'), 'City' => 'Austin', 'StateOrProvinceCode' => 'TX', 'PostalCode' => '78701', 'CountryCode' => 'US'); } if ($var == 'shippingchargespayment') { return array('PaymentType' => 'SENDER', 'Payor' => array('ResponsibleParty' => array('AccountNumber' => getProperty('billaccount'), 'Contact' => null, 'Address' => array('CountryCode' => 'US')))); } if ($var == 'freightbilling') { return array('Contact' => array('ContactId' => 'freight1', 'PersonName' => 'Big Shipper', 'Title' => 'Manager', 'CompanyName' => 'Freight Shipper Co', 'PhoneNumber' => '1234567890'), 'Address' => array('StreetLines' => array('1202 Chalet Ln', 'Do Not Delete - Test Account'), 'City' => 'Harrison', 'StateOrProvinceCode' => 'AR', 'PostalCode' => '72601-6353', 'CountryCode' => 'US')); } }
function addShippingChargesPayment(){ $shippingChargesPayment = array('PaymentType' => 'SENDER', 'Payor' => array( 'ResponsibleParty' => array( 'AccountNumber' => getProperty('billaccount'), 'Contact' => null, 'Address' => array( 'CountryCode' => 'US' ) ) ) ); return $shippingChargesPayment; }
// Copyright 2009, FedEx Corporation. All rights reserved. // Version 12.0.0 require_once '../library/fedex-common.php'; //The WSDL is not included with the sample code. //Please include and reference in $path_to_wsdl variable. $path_to_wsdl = "../wsdl/beta/ShipService_v17.wsdl"; ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information $request['WebAuthenticationDetail'] = array('ParentCredential' => array('Key' => getProperty('parentkey'), 'Password' => getProperty('parentpassword')), 'UserCredential' => array('Key' => getProperty('key'), 'Password' => getProperty('password'))); $request['ClientDetail'] = array('AccountNumber' => getProperty('shipaccount'), 'MeterNumber' => getProperty('meter')); $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Cancel Shipment Request using PHP ***'); $request['Version'] = array('ServiceId' => 'ship', 'Major' => '17', 'Intermediate' => '0', 'Minor' => '0'); $request['ShipTimestamp'] = date('c'); $request['TrackingId'] = array('TrackingIdType' => 'GROUND', 'TrackingNumber' => getProperty('trackingnumber')); $request['DeletionControl'] = 'DELETE_ONE_PACKAGE'; // Package/Shipment try { if (setEndpoint('changeEndpoint')) { $newLocation = $client->__setLocation(setEndpoint('endpoint')); } $response = $client->deleteShipment($request); if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') { printSuccess($client, $response); } else { printError($client, $response); } writeToLog($client); // Write to log file } catch (SoapFault $exception) {
$description = jtrim_desc($products->fields['products_description']); // $images = array( // getImagePath($products->fields['products_image']) // ); // if (preg_match_all('~src=["\'](.+?)["\']~i', $description, $matchImages)) // { // if ($matchImages[1]) // foreach ($matchImages[1] as $mI) // { // $mI = trim($mI, '"\' '); // $mI = ltrim($mI, '/'); // $images[] = getImagePath($mI); // } // } // $images = array_unique($images); $property = getProperty($products->fields['products_id'], $lang_id, true); $str_py = ''; foreach ($property as $k => $o) { $str_py .= '<ul>'; $str_py .= '<li>' . $k . '<ul>'; foreach ($o as $v) { $str_py .= $v; } $str_py .= '</ul></li>'; $str_py .= '</ul>'; } $description .= $str_py; $description .= $currencies->format(zen_get_products_special_price($products->fields['products_id'], true)); $description .= sprintf('{{%s:%s}}', $host, $products->fields['products_id']); $wp_category = array(); foreach ($categores as $c) {
/** * Returns a transformer which gets the value of property $name from its * argument and returns the result. * * @param string $name * * @return callable */ function getProperty($name) { if (!is_array($name)) { return function ($array) use($name) { if (is_object($array) && is_string($name) && !$array instanceof \ArrayAccess) { return $array->{$name}; } elseif ($array instanceof \ArrayAccess || is_array($array) && is_string($name)) { return $array[$name]; } throw new \InvalidArgumentException('Tried to get entry from a scalar variable.'); }; } return function ($array) use($name) { foreach ($name as $key) { $fn = getProperty($key); $array = $fn($array); } return $array; }; }
* Time: 16:19 */ require '../sql/mysql_cls.php'; require 'lib.php'; error_reporting(0); $db = new mysql_cls(); $db->connect(); $database = $_GET['project']; $option = $_GET['option']; $db->changeDB($database); $databases = $db->getAllDBnames(); $data = null; if ($database == "") { $data = $db->getAllDBnames(); } if ($option == "property") { $data = getProperty(); } else { if ($option == "evaluation") { set_time_limit(1800); ////临时设置超时 $data = getEvaluations(); //echo $data; } else { if ($option == "manufacturer") { $data = getManufacturers(); } } } $data = json_encode($data); echo $data;
function addCustomClearanceDetail(){ $customerClearanceDetail = array( 'DutiesPayment' => array( 'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY 'Payor' => array( 'ResponsibleParty' => array( 'AccountNumber' => getProperty('dutyaccount'), 'Contact' => null, 'Address' => array( 'CountryCode' => 'IN' ) ) ) ), 'DocumentContent' => 'NON_DOCUMENTS', 'CustomsValue' => array( 'Currency' => 'INR', 'Amount' => 400.0 ), 'CommercialInvoice' => array( 'Purpose' => 'SOLD', 'CustomerReferences' => array( 'CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => '1234' ) ), 'Commodities' => array( 'NumberOfPieces' => 1, 'Description' => 'Books', 'CountryOfManufacture' => 'IN', 'Weight' => array( 'Units' => 'LB', 'Value' => 1.0 ), 'Quantity' => 4, 'QuantityUnits' => 'EA', 'UnitPrice' => array( 'Currency' => 'INR', 'Amount' => 100.000000 ), 'CustomsValue' => array( 'Currency' => 'INR', 'Amount' => 400.000000 ) ) ); return $customerClearanceDetail; }
public function testMakeAddressText() { $makeAddressText = getMethod('SimpleMailer', 'makeAddressText'); $Encoding = getProperty('SimpleMailer', 'Encoding'); $mailer = new SimpleMailer(); $mailer->setFromEncoding("EUC-JP"); $mailer->setCharSet("UTF-8"); $value = $makeAddressText->invokeArgs($mailer, array('*****@*****.**', '')); $this->assertEquals('*****@*****.**', $value); $value = $makeAddressText->invokeArgs($mailer, array('*****@*****.**', 'test')); $this->assertEquals('test <*****@*****.**>', $value); }
function resource($loggedIn) { $routes = array("settings" => function ($action) { return restRequestSettings($action); }, "gallery" => function ($action) { return restRequestGallery(); }, "portfolio" => function ($action) { return restRequestPortfolio($action, $_GET["id"]); }, "account" => function ($action) { return restRequestAccount($action, $_GET["email"]); }, "invite" => function ($action) { return restRequestInvite($action, $_GET["email"]); }); $type = $_GET["type"]; $action = $_GET["action"] ?: "get"; $_GET["email"] = strtolower($_GET["email"]); $standardAction = in_array($action, array("create", "get", "update", "delete", "list")); if ($type === "security") { $resource = restRequestSecurity($action, $_POST["email"], $_POST["password"], $_POST["confirm"], $_POST["invite"]); } elseif (!$loggedIn) { $resource = restError(401); } elseif ($type === "command") { $resource = runCommand($action); } elseif (isset($routes[$type]) && $standardAction) { $resource = $routes[$type]($action); } else { $resource = restError(400); } logEvent("get-resource", $type, $action, $_GET["id"], !getProperty($resource, "error")); return $resource; }
function addCustomClearanceDetail() { $customerClearanceDetail = array('DutiesPayment' => array('PaymentType' => 'SENDER', 'Payor' => array('ResponsibleParty' => array('AccountNumber' => getProperty('dutyaccount'), 'Contact' => null, 'Address' => array('CountryCode' => 'US')))), 'DocumentContent' => 'NON_DOCUMENTS', 'CustomsValue' => array('Currency' => 'USD', 'Amount' => 400.0), 'Commodities' => array('0' => array('NumberOfPieces' => 1, 'Description' => 'Books', 'CountryOfManufacture' => 'US', 'Weight' => array('Units' => 'LB', 'Value' => 1.0), 'Quantity' => 4, 'QuantityUnits' => 'EA', 'UnitPrice' => array('Currency' => 'USD', 'Amount' => 100.0), 'CustomsValue' => array('Currency' => 'USD', 'Amount' => 400.0))), 'ExportDetail' => array('B13AFilingOption' => 'NOT_REQUIRED')); return $customerClearanceDetail; }
function getUploadsDir() { return getProperty("uploads.dir", $UPLOADS_DIR); }
'MeterNumber' => getProperty('meter') ); $request['TransactionDetail'] = array('CustomerTransactionId' => '*** Track Request using PHP ***'); $request['Version'] = array( 'ServiceId' => 'trck', 'Major' => '9', 'Intermediate' => '1', 'Minor' => '0' ); $request['SelectionDetails'] = array( 'PackageIdentifier' => array( 'Type' => 'CUSTOMER_REFERENCE', 'Value' => getProperty('customerreference') // Replace with a valid customer reference ), 'ShipmentAccountNumber' => getProperty('trackaccount') // Replace with account used for shipment ); try { if(setEndpoint('changeEndpoint')){ $newLocation = $client->__setLocation(setEndpoint('endpoint')); } $response = $client ->track($request); if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR'){ if($response->HighestSeverity != 'SUCCESS'){ echo '<table border="1">'; echo '<tr><th>Track Reply</th><th> </th></tr>';
// echo "*************************************$filename*********************************\n"; $now = floor($json->now); if ($now > $nowArr[$filename]) { $nowArr[$filename] = $now; foreach ($json->aircraft as $aircraft) { if (property_exists($aircraft, "lon")) { $str = $now . ","; $str .= getProperty($aircraft, "hex") . ","; $str .= getProperty($aircraft, "lat") . ","; $str .= getProperty($aircraft, "lon") . ","; $str .= getProperty($aircraft, "altitude") . ","; $str .= "BARO" . ","; $str .= getProperty($aircraft, "track") . ","; $str .= "TRACK,"; $str .= getProperty($aircraft, "speed") . ","; $str .= getProperty($aircraft, "vert_rate") . ","; $str .= "BARO,"; $str .= getProperty($aircraft, "flight") . ","; $str .= $freq; $str .= "\n"; $output .= $str; } } } if (count($json->aircraft) > 0) { file_put_contents("{$filename}.{$now}", $file); } } file_put_contents("/dev/shm/upload/adsb.txt", $output, FILE_APPEND); sleep(5); }