private function get_weblink()
 {
     if ($this->weblink === null) {
         $this->weblink = WebService::get_weblink('WHERE web.id=:id', array('id' => $this->get_id_in_module()));
     }
     return $this->weblink;
 }
Esempio n. 2
0
 /**
  * Function executes countries request and prepares the $countries array.
  * @access private
  * @return Void
  */
 private function doCtrRequest()
 {
     $source = parent::doRequest();
     /* We make sure there is an XML answer and try to parse it */
     if ($source !== false) {
         parent::parseResponse($source);
         if (count($this->resp_errors_list) == 0) {
             # Add here new country xml properties to handle.
             $__prop = ['code', 'label', 'is_ue', 'states'];
             $this->countries = array();
             foreach ($this->xpath->query('/countries/country') as $k => $country) {
                 $c = (object) [];
                 # Process the random country xml properties.
                 foreach ($__prop as $_k => $_v) {
                     $c->{$_v} = $this->xpath->query('./' . $_v, $country)->item(0)->nodeValue;
                 }
                 # Process some more specific properties.
                 $c->states = [];
                 foreach ($this->xpath->query('./states/state', $country) as $state) {
                     $c->states[] = (object) ['code' => $this->xpath->query('./code', $state)->item(0)->nodeValue, 'label' => $this->xpath->query('./label', $state)->item(0)->nodeValue];
                 }
                 # Add the country object to the collection.
                 $this->countries[$c->code] = $c;
             }
         }
     }
 }
Esempio n. 3
0
 public function run($paramArray, $isAsync, $delay)
 {
     echo "bot started\n";
     if (array_key_exists("WS_WSID", $paramArray) && $paramArray["WS_WSID"] != null) {
         $log = SGAGardeningIssuesAccess::getGardeningIssuesAccess();
         $ws = WebService::newFromID($paramArray["WS_WSID"]);
         $affectedArticles = $this->updateWSResults($ws);
         $this->setNumberOfTasks(2);
     } else {
         $affectedArticles = $this->updateAllWSResults();
     }
     ksort($affectedArticles);
     $affectedArticles = array_flip($affectedArticles);
     echo "\nRefreshing articles: \n";
     foreach ($affectedArticles as $articleId => $dontCare) {
         echo "\t refreshing articleId: " . $articleId . "\n";
         $title = Title::newFromID($articleId);
         $updatejob = new SMWUpdateJob($title);
         $updatejob->run();
     }
     echo "\nbot finished";
     global $smwgDefaultStore;
     if ($smwgDefaultStore == 'SMWTripleStore' || $smwgDefaultStore == 'SMWTripleStoreQuad') {
         define('SMWH_FORCE_TS_UPDATE', 'TRUE');
         smwfGetStore()->initialize(true);
     }
     return '';
 }
Esempio n. 4
0
 public function get_search_request($args)
 {
     $now = new Date();
     $authorized_categories = WebService::get_authorized_categories(Category::ROOT_CATEGORY);
     $weight = isset($args['weight']) && is_numeric($args['weight']) ? $args['weight'] : 1;
     return "SELECT " . $args['id_search'] . " AS id_search,\n\t\t\tw.id AS id_content,\n\t\t\tw.name AS title,\n\t\t\t( 2 * FT_SEARCH_RELEVANCE(w.name, '" . $args['search'] . "') + (FT_SEARCH_RELEVANCE(w.contents, '" . $args['search'] . "') +\n\t\t\tFT_SEARCH_RELEVANCE(w.short_contents, '" . $args['search'] . "')) / 2 ) / 3 * " . $weight . " AS relevance,\n\t\t\tCONCAT('" . PATH_TO_ROOT . "/web/index.php?url=/', id_category, '-', IF(id_category != 0, cat.rewrited_name, 'root'), '/', w.id, '-', w.rewrited_name) AS link\n\t\t\tFROM " . WebSetup::$web_table . " w\n\t\t\tLEFT JOIN " . WebSetup::$web_cats_table . " cat ON w.id_category = cat.id\n\t\t\tWHERE ( FT_SEARCH(w.name, '" . $args['search'] . "') OR FT_SEARCH(w.contents, '" . $args['search'] . "') OR FT_SEARCH_RELEVANCE(w.short_contents, '" . $args['search'] . "') )\n\t\t\tAND id_category IN(" . implode(", ", $authorized_categories) . ")\n\t\t\tAND (approbation_type = 1 OR (approbation_type = 2 AND start_date < '" . $now->get_timestamp() . "' AND (end_date > '" . $now->get_timestamp() . "' OR end_date = 0)))\n\t\t\tORDER BY relevance DESC\n\t\t\tLIMIT 100 OFFSET 0";
 }
 /**
  * @see WebService::call()
  * @param $webServiceRequest WebServiceRequest
  * @return DOMDocument|string the result of the web service or null in case of an error.
  */
 function &call(&$webServiceRequest)
 {
     // Call the web service
     $xmlResult = parent::call($webServiceRequest);
     if (Config::getVar('debug', 'log_web_service_info')) {
         error_log('Time: ' . date('c') . "\nRequest: " . print_r($webServiceRequest, true) . "\nResponse: " . print_r($xmlResult, true) . "\nLast response status: " . $this->_lastResponseStatus . "\n");
     }
     // Catch web service errors
     if (is_null($xmlResult)) {
         return $xmlResult;
     }
     switch ($this->_returnType) {
         case XSL_TRANSFORMER_DOCTYPE_DOM:
             // Create DOM document
             $resultDOM = new DOMDocument('1.0', Config::getVar('i18n', 'client_charset'));
             // Try to handle non-well-formed responses
             $resultDOM->recover = true;
             $resultDOM->loadXML($xmlResult);
             return $resultDOM;
         case XSL_TRANSFORMER_DOCTYPE_STRING:
             return $xmlResult;
         default:
             assert(false);
     }
 }
 /**
  * @see WebService::call()
  * @param $webServiceRequest WebServiceRequest
  * @return DOMDocument|string the result of the web service or null in case of an error.
  */
 function &call(&$webServiceRequest)
 {
     // Call the web service
     $xmlResult = parent::call($webServiceRequest);
     // Catch web service errors
     if (is_null($xmlResult)) {
         return $xmlResult;
     }
     if ($this->_lastResponseStatus >= 400 && $this->_lastResponseStatus <= 599) {
         $nullVar = null;
         return $nullVar;
     }
     switch ($this->_returnType) {
         case XSL_TRANSFORMER_DOCTYPE_DOM:
             // Create DOM document
             $resultDOM = new DOMDocument('1.0', Config::getVar('i18n', 'client_charset'));
             // Try to handle non-well-formed responses
             $resultDOM->recover = true;
             $resultDOM->loadXML($xmlResult);
             return $resultDOM;
         case XSL_TRANSFORMER_DOCTYPE_STRING:
             return $xmlResult;
         default:
             assert(false);
     }
 }
 public function execute(HTTPRequestCustom $request)
 {
     $id = $request->get_getint('id', 0);
     if (!empty($id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
         try {
             $this->weblink = WebService::get_weblink('WHERE web.id = :id', array('id' => $id));
         } catch (RowNotFoundException $e) {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
     if ($this->weblink !== null && $this->weblink->is_visible()) {
         if (!PersistenceContext::get_querier()->row_exists(PREFIX . 'events', 'WHERE id_in_module=:id_in_module AND module=\'web\' AND current_status = 0', array('id_in_module' => $this->weblink->get_id()))) {
             $contribution = new Contribution();
             $contribution->set_id_in_module($this->weblink->get_id());
             $contribution->set_entitled(StringVars::replace_vars(LangLoader::get_message('contribution.deadlink', 'common'), array('link_name' => $this->weblink->get_name())));
             $contribution->set_fixing_url(WebUrlBuilder::edit($this->weblink->get_id())->relative());
             $contribution->set_description(LangLoader::get_message('contribution.deadlink_explain', 'common'));
             $contribution->set_poster_id(AppContext::get_current_user()->get_id());
             $contribution->set_module('web');
             $contribution->set_type('alert');
             $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(WebService::get_categories_manager()->get_heritated_authorizations($this->weblink->get_id_category(), Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT));
             ContributionService::save_contribution($contribution);
         }
         DispatchManager::redirect(new UserContributionSuccessController());
     } else {
         $error_controller = PHPBoostErrors::unexisting_page();
         DispatchManager::redirect($error_controller);
     }
 }
Esempio n. 8
0
 public function uninstall()
 {
     $this->drop_tables();
     ConfigManager::delete('web', 'config');
     CacheManager::invalidate('module', 'web');
     WebService::get_keywords_manager()->delete_module_relations();
 }
 public function execute(HTTPRequestCustom $request)
 {
     $id = $request->get_getint('id', 0);
     if (!empty($id)) {
         try {
             $this->weblink = WebService::get_weblink('WHERE web.id = :id', array('id' => $id));
         } catch (RowNotFoundException $e) {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
     if ($this->weblink !== null && !DownloadAuthorizationsService::check_authorizations($this->weblink->get_id_category())->read()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     } else {
         if ($this->weblink !== null && $this->weblink->is_visible()) {
             $this->weblink->set_number_views($this->weblink->get_number_views() + 1);
             WebService::update_number_views($this->weblink);
             WebCache::invalidate();
             AppContext::get_response()->redirect($this->weblink->get_url()->absolute());
         } else {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
 }
Esempio n. 10
0
 /**
  * Function executes parcel point request and prepares the $points array.
  * @access private
  * @return Void
  */
 private function doSimpleRequest($type)
 {
     $source = parent::doRequest();
     /* We make sure there is an XML answer and try to parse it */
     if ($source !== false) {
         parent::parseResponse($source);
         if (count($this->resp_errors_list) == 0) {
             $point = $this->xpath->query('/' . $type)->item(0);
             $point_detail = array('code' => $this->xpath->query('./code', $point)->item(0)->nodeValue, 'name' => $this->xpath->query('./name', $point)->item(0)->nodeValue, 'address' => $this->xpath->query('./address', $point)->item(0)->nodeValue, 'city' => $this->xpath->query('./city', $point)->item(0)->nodeValue, 'zipcode' => $this->xpath->query('./zipcode', $point)->item(0)->nodeValue, 'country' => $this->xpath->query('./country', $point)->item(0)->nodeValue, 'latitude' => $this->xpath->query('./latitude', $point)->item(0)->nodeValue, 'longitude' => $this->xpath->query('./longitude', $point)->item(0)->nodeValue, 'phone' => $this->xpath->query('./phone', $point)->item(0)->nodeValue, 'description' => $this->xpath->query('./description', $point)->item(0)->nodeValue);
             /* We get open and close informations  */
             $schedule = array();
             foreach ($this->xpath->query('./schedule/day', $point) as $d => $day_node) {
                 $childs = $this->xpath->query('*', $day_node);
                 foreach ($childs as $child_node) {
                     if ($child_node->nodeName != '#text') {
                         $schedule[$d][$child_node->nodeName] = $child_node->nodeValue;
                     }
                 }
             }
             $point_detail['schedule'] = $schedule;
             /* We store the data in the right array (defined by $type) */
             if (!isset($this->points[$type])) {
                 $this->points[$type] = array();
             }
             $this->points[$type][] = $point_detail;
         }
     }
 }
 public function requestUriWillDispatch($requestUri)
 {
     if (false !== strpos($requestUri, '/debug/')) {
         MDict::D('is_debug', true);
         $requestUri = (string) substr($requestUri, strlen('/debug'));
     }
     $requestUri = parent::requestUriWillDispatch($requestUri);
     return $requestUri;
 }
Esempio n. 12
0
 /**
  * FaqWebService::__construct() - pass parameters to parent construct and
  * set the service and tag properties
  *
  * @param array $lobjUrlParams
  * @param sp_DBConnector $lobjDBConnector
  */
 function __construct($lobjUrlParams, $lobjDBConnector)
 {
     //need to implement! will echo error message!
     header("HTTP/1.1 501 No Implementation");
     die("Sorry. FAQ service is not available yet. Check back later.");
     parent::__construct($lobjUrlParams, $lobjDBConnector);
     $this->mstrService = 'faqs';
     $this->mstrTag = 'faq';
 }
Esempio n. 13
0
 /**
  * Function which gets news list details.
  * @access private
  * @return false if server response isn't correct; true if it is
  */
 private function doSimpleRequest()
 {
     $source = parent::doRequest();
     /* Uncomment if ou want to display the XML content */
     /* We make sure there is an XML answer and try to parse it */
     if ($source !== false) {
         parent::parseResponse($source);
         return count($this->resp_errors_list) == 0;
     }
     return false;
 }
 private function get_weblink(HTTPRequestCustom $request)
 {
     $id = $request->get_getint('id', 0);
     if (!empty($id)) {
         try {
             $this->weblink = WebService::get_weblink('WHERE web.id=:id', array('id' => $id));
         } catch (RowNotFoundException $e) {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
 }
Esempio n. 15
0
 public function init()
 {
     try {
         $init = new \XmlProcess();
         $init->readFile();
         $xml = $init->convertXmlToObject();
         $xml->DatosPoliza->InformacionPoliza->primerNombreTomador = self::validatePostField('primerNombreTomador');
         $xml->DatosPoliza->InformacionPoliza->direccionTomador = self::validatePostField('direccionTomador');
         $xml->DatosPoliza->InformacionPoliza->ciudadTomador = self::validatePostField('ciudadTomador');
         $xml->DatosPoliza->InformacionPoliza->numeroPoliza = self::validatePostField('numeroPoliza');
         $xml->DatosPoliza->InformacionPoliza->numeroCertificado = self::validatePostField('numeroCertificado');
         $xml->DatosPoliza->InformacionPoliza->numeroFactura = self::validatePostField('numeroFactura');
         $xml->DatosPoliza->DatosRiesgo->numeroRiesgo = self::validatePostField('numeroRiesgo');
         $xml->DatosPoliza->InformacionPoliza->fechaExpedicion = self::validatePostField('fechaExpedicion');
         $xml->DatosPoliza->InformacionPoliza->tipoModificacion = self::validatePostField('tipoModificacion');
         $_SESSION['XML'] = base64_encode($init->__toString());
         if ($_SESSION['XML'] != '') {
             $ws = new \WebService();
             $ws->setDriver($_SESSION['XML']);
             $ws->callWS();
             $result = $ws->getResult();
             if (isset($result)) {
                 $_SESSION['RESULT'] = $result;
             }
             $_SESSION['ERROR'] = $ws->getError();
             if (is_array($_SESSION['RESULT']) && count($_SESSION['RESULT'])) {
                 if (isset($result['return'])) {
                     $_SESSION['BASE64'] = $result['return'];
                     $_SESSION['ERROR'] = '';
                 } else {
                     $_SESSION['BASE64'] = '';
                     $_SESSION['ERROR'] = $_SESSION['ERROR'] . ' | No se encuentra variable "RetornoBase64"';
                 }
             }
         }
     } catch (Exception $e) {
         Logger::error($e);
     }
 }
 /**
  * @see WebService::call()
  * @param $webServiceRequest WebServiceRequest
  * @return array The result of the web service or null in case of an error.
  */
 function &call(&$webServiceRequest)
 {
     // Call the web service
     $jsonResult = parent::call($webServiceRequest);
     // Catch web service errors
     if (is_null($jsonResult)) {
         return $jsonResult;
     }
     $resultArray = json_decode($jsonResult, true);
     // Catch decoding errors.
     if (!is_array($resultArray)) {
         return null;
     }
     return $resultArray;
 }
Esempio n. 17
0
 /**
  * Function executes carrier request and prepares the $list_points array.
  * @access private
  * @return Void
  */
 private function doCarrierRequest()
 {
     $source = $this->doRequest();
     /* We make sure there is an XML answer and try to parse it */
     if ($source !== false) {
         parent::parseResponse($source);
         if (count($this->resp_errors_list) == 0) {
             /* The XML file is loaded, we now gather the datas */
             $carriers = $this->xpath->query('/operators/operator');
             foreach ($carriers as $carrier) {
                 $result = $this->parseCarrierNode($carrier);
                 /* We use the 'code' data as index (maybe using the $c index is better) */
                 //$code = $this->xpath->query('./code', $carrier)->item(0)->nodeValue;
                 $this->carriers[$result['code']] = $result;
             }
         }
     }
 }
Esempio n. 18
0
    public function get_feed_data_struct($idcat = 0, $name = '')
    {
        if (WebService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
            $querier = PersistenceContext::get_querier();
            $category = WebService::get_categories_manager()->get_categories_cache()->get_category($idcat);
            $site_name = GeneralConfig::load()->get_site_name();
            $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
            $feed_module_name = LangLoader::get_message('module_title', 'common', 'web');
            $data = new FeedData();
            $data->set_title($feed_module_name . ' - ' . $site_name);
            $data->set_date(new Date());
            $data->set_link(SyndicationUrlBuilder::rss('web', $idcat));
            $data->set_host(HOST);
            $data->set_desc($feed_module_name . ' - ' . $site_name);
            $data->set_lang(LangLoader::get_message('xml_lang', 'main'));
            $data->set_auth_bit(Category::READ_AUTHORIZATIONS);
            $categories = WebService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
            $ids_categories = array_keys($categories);
            $now = new Date();
            $results = $querier->select('SELECT web.id, web.id_category, web.name, web.rewrited_name, web.contents, web.short_contents, web.creation_date, web.partner_picture, cat.rewrited_name AS rewrited_name_cat
				FROM ' . WebSetup::$web_table . ' web
				LEFT JOIN ' . WebSetup::$web_cats_table . ' cat ON cat.id = web.id_category
				WHERE web.id_category IN :ids_categories
				AND (approbation_type = 1 OR (approbation_type = 2 AND start_date < :timestamp_now AND (end_date > :timestamp_now OR end_date = 0)))
				ORDER BY web.creation_date DESC', array('ids_categories' => $ids_categories, 'timestamp_now' => $now->get_timestamp()));
            foreach ($results as $row) {
                $row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root';
                $link = WebUrlBuilder::display($row['id_category'], $row['rewrited_name_cat'], $row['id'], $row['rewrited_name']);
                $item = new FeedItem();
                $item->set_title($row['name']);
                $item->set_link($link);
                $item->set_guid($link);
                $item->set_desc(FormatingHelper::second_parse($row['contents']));
                $item->set_date(new Date($row['creation_date'], Timezone::SERVER_TIMEZONE));
                $item->set_image_url($row['partner_picture']);
                $item->set_auth(WebService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
                $data->add_item($item);
            }
            $results->dispose();
            return $data;
        }
    }
Esempio n. 19
0
 /**
  * Function executes order request and prepares the $order_info array.
  * @access private
  * @return Void
  */
 private function doStatusRequest()
 {
     $source = parent::doRequest();
     /* We make sure there is an XML answer and try to parse it */
     if ($source !== false) {
         parent::parseResponse($source);
         if (count($this->resp_errors_list) == 0) {
             /* The XML file is loaded, we now gather the datas */
             $labels = array();
             $order_labels = $this->xpath->evaluate('/order/labels/*');
             foreach ($order_labels as $label_index => $label) {
                 $labels[$label_index] = $label->nodeValue;
             }
             $documents = array();
             $order_documents = $this->xpath->evaluate('/order/documents/*');
             foreach ($order_documents as $docs) {
                 $documents[$docs->nodeName] = $docs->nodeValue;
             }
             $this->order_info = array('emcRef' => $this->xpath->evaluate('/order/emc_reference')->item(0)->nodeValue, 'state' => $this->xpath->evaluate('/order/state')->item(0)->nodeValue, 'opeRef' => $this->xpath->evaluate('/order/carrier_reference')->item(0)->nodeValue, 'labelAvailable' => (bool) $this->xpath->evaluate('/order/label_available')->item(0)->nodeValue, 'labelUrl' => $this->xpath->evaluate('/order/label_url')->item(0)->nodeValue, 'labels' => $labels, 'documents' => $documents);
         }
     }
 }
 public static function GetData()
 {
     $response = new simpleResponse();
     include './inc/incWebServiceSessionValidation.php';
     try {
         $parameters = WebService::collectParameters();
         $widget = da_widgets::GetWidget($parameters->widget_id);
         $page = da_apps_registry::GetPage($widget->page_id);
         $response->status = "OK";
         $response->message = "";
         $response->data = new stdClass();
         $response->data->widget = $widget;
         $response->data->page = $page;
     } catch (Exception $ex) {
         $response->status = "EXCEPTION";
         $response->message = $ex->getMessage();
         $response->data = new stdClass();
         $response->data->widget = $widget;
         $response->data->page = $page;
     }
     return $response;
 }
Esempio n. 21
0
 public static function factory(WebService $ws, array $parameters = [])
 {
     return new self($ws, $ws->post("SELECT FROM 'INFO'.'INFO'", $parameters));
 }
Esempio n. 22
0
 /**
  * Post request on api/v1/user_keys to generate API keys
  * @access public
  * @param Array $params Params
  * @return String
  */
 public function postUserKeys($params)
 {
     $this->setOptions(array('action' => 'api/v1/user_keys'));
     $this->param = array_merge($this->param, $params);
     $this->setPost();
     $source = parent::doRequest();
     if ($source !== false) {
         parent::parseResponse($source);
         // The request is ok, we return trimed response
         $nodes = $this->xpath->query('/user/response');
         if (isset($nodes->item(0)->nodeValue)) {
             return trim($nodes->item(0)->nodeValue);
         } else {
             return trim($nodes->item);
         }
     } else {
         return $this->resp_error;
     }
 }
 private function generate_response()
 {
     $weblink = $this->get_weblink();
     $category = $weblink->get_category();
     $response = new SiteDisplayResponse($this->tpl);
     $graphical_environment = $response->get_graphical_environment();
     $graphical_environment->set_page_title($weblink->get_name(), $this->lang['module_title']);
     $graphical_environment->get_seo_meta_data()->set_canonical_url(WebUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $weblink->get_id(), $weblink->get_rewrited_name()));
     $breadcrumb = $graphical_environment->get_breadcrumb();
     $breadcrumb->add($this->lang['module_title'], WebUrlBuilder::home());
     $categories = array_reverse(WebService::get_categories_manager()->get_parents($weblink->get_id_category(), true));
     foreach ($categories as $id => $category) {
         if ($category->get_id() != Category::ROOT_CATEGORY) {
             $breadcrumb->add($category->get_name(), WebUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name()));
         }
     }
     $breadcrumb->add($weblink->get_name(), WebUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $weblink->get_id(), $weblink->get_rewrited_name()));
     return $response;
 }
Esempio n. 24
0
 public function get_file($id, $file = '')
 {
     $ids = explode('|', $id);
     $content = WebService::download($this->id, $ids[1]);
     $path = $this->prepare_file($file);
     $fp = fopen($path, 'w');
     fwrite($fp, $content);
     fclose($fp);
     return array('path' => $path, 'url' => '');
 }
function smwf_wsu_processStep2($name)
{
    global $smwgDIIP;
    require_once $smwgDIIP . '/specials/WebServices/SMW_WebService.php';
    require_once $smwgDIIP . '/specials/WebServices/SMW_WSStorage.php';
    $webService = WebService::newFromName($name);
    $results = new SimpleXMLElement("<p>" . $webService->getResult() . "</p>");
    $response = "";
    foreach ($results->children() as $result) {
        foreach ($result->children() as $part) {
            if (($part->attributes()->property != DI_ALL_SUBJECTS || $part->attributes()->name != DI_ALL_SUBJECTS_ALIAS) && ($part->attributes()->property != DI_ALL_PROPERTIES || $part->attributes()->name != DI_ALL_PROPERTIES_ALIAS) && ($part->attributes()->property != DI_ALL_OBJECTS || $part->attributes()->name != DI_ALL_OBJECTS_ALIAS)) {
                if (strlen('' . $part->attributes()->name) > 0) {
                    //this is for ignoring namespace definitions
                    $response .= $result->attributes()->name;
                    $response .= "." . $part->attributes()->name;
                    $response .= ";";
                }
            }
        }
    }
    return $response;
}
 protected function get_categories_manager()
 {
     return WebService::get_categories_manager();
 }
Esempio n. 27
0
 /**
  * 增加回复
  */
 public function addqa()
 {
     import('@.Util.WebService');
     $webService = new WebService();
     $webService->setUrl(C('SEND_ORDER_URL'));
     $webService->setGet(array('c' => 'InterfaceWorkOrder', 'a' => 'Reply'));
     //追问地址
     $curTime = C('CURRENT_TIME');
     $sendArr['id'] = intval($_POST['id']);
     $workOrderDao = M('work_order');
     $data = $workOrderDao->find($sendArr['id']);
     if ($data['user_account'] != $this->uwanName) {
         $this->error('提问失败,参数错误');
     }
     //防止参数注入
     $sendArr['content'] = stripcslashes($_POST['content']);
     $sendArr['_sign'] = md5(C('SEND_KEY') . $curTime);
     $sendArr['_verifycode'] = $curTime;
     $webService->setPost($sendArr);
     $webService->sendData();
     $backParams = $webService->getRaw();
     $backParams = json_decode($backParams);
     if ($backParams->status == 1) {
         $this->assign("jumpUrl", U("Question/detail/id/{$sendArr['id']}"));
         $this->success("您的问题已受理,此问题的等候队列:第 " . $this->_getQueue($data['game_type'], $data['room_id']) . " 位,请耐等侍。");
     } else {
         $this->ajaxReturn(null, '追问错误,请重试', 0);
         $this->error("提交失败!");
     }
 }
Esempio n. 28
0
 /**
  * DatabaseWebService::__construct() - pass parameters to parent construct and
  * set the service and tag properties
  *
  * @param array $lobjUrlParams
  * @param DBConnector $lobjDBConnector
  */
 function __construct($lobjUrlParams, $lobjDBConnector)
 {
     parent::__construct($lobjUrlParams, $lobjDBConnector);
     $this->mstrService = 'databases';
     $this->mstrTag = 'database';
 }
Esempio n. 29
0
    curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    if ($customHeader) {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $customHeader);
    }
    //Test if ssl use is required
    if (strncasecmp($url, "https", 5) === 0) {
        curl_setopt($ch, CURLOPT_SSLVERSION, 3);
        // Force use of SSL version 3
        // SSL options
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        // Prodution server should have 2 value. 1 just checks common name
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, False);
        // Validates the server certificate against the CA
    }
    $output = curl_exec($ch);
    if (!$output && $errors) {
        return array('errors' => curl_error($ch), 'response' => $output);
    }
    return $output;
}
if (!isset($_GET['feed'])) {
    $response = new ResponseWithError();
    $response->setFeed(new stdClass());
    $response->setError("No object set");
    echo json_encode($response);
    return;
} else {
    $services = new WebService();
    $services->requestGoogleApi();
}
Esempio n. 30
0
 /**
  * Generates the headline for the page list and the HTML encoded list of pages which
  * shall be shown.
  */
 protected function getPages()
 {
     wfProfileIn(__METHOD__ . ' (SMW)');
     $r = '';
     global $wgArticlePath;
     $ws = WebService::newFromID($this->getTitle()->getArticleID());
     if ($ws != null) {
         if (strpos($wgArticlePath, "?") > 0) {
             $url = Title::makeTitleSafe(NS_SPECIAL, "DefineWebService")->getFullURL() . "&wwsdId=" . $this->getTitle()->getArticleID();
         } else {
             $url = Title::makeTitleSafe(NS_SPECIAL, "DefineWebService")->getFullURL() . "?wwsdId=" . $this->getTitle()->getArticleID();
         }
         $r .= '<h4><span class="mw-headline"><a href="' . $url . '">' . wfMsg('smw_wws_edit_in_gui') . '</a></span></h4>';
     }
     $ti = htmlspecialchars($this->mTitle->getText());
     // list articles
     $nav = $this->myGetNavigationLinks('WWSArticleResults', $this->mArticles, $this->mFromArticle, $this->mUntilArticle, 'fromarticle', 'untilarticle');
     $r .= '<a name="WWSArticleResults"></a>' . "<div id=\"mw-pages\">\n";
     $r .= '<h4><span class="mw-headline">' . wfMsg('smw_wws_articles_header', $ti) . "</h4>\n";
     $r .= wfMsg('smw_wws_articlecount', min($this->limit, count($this->mArticles))) . "\n";
     $r .= $nav;
     $r .= $this->myShortList($this->mArticles, $this->articles_start_char, $this->mUntilArticle) . "\n</div>";
     $r .= $nav;
     wfProfileOut(__METHOD__ . ' (SMW)');
     return $r;
 }