Пример #1
0
 /**
  * Close the cURL connection.
  */
 public static function closeCurl()
 {
     if (!is_null(self::$curl)) {
         curl_close(self::$curl);
         self::$curl = null;
     }
 }
Пример #2
0
 public function updateUser()
 {
     $user = false;
     $updateError = null;
     if ($this->passwordOld !== $this->passwordNew) {
         $webserviceUrl = String::prepare('%svisualization/wo/user', WEBSERVICE_URL);
         $webserviceParams = array('user' => WEBSERVICE_USER, 'password' => WEBSERVICE_PASSWORD, 'userName' => $this->user['UserName'], 'userKey' => $this->user['ApiKey'], 'userPasswordOld' => $this->passwordOld, 'userPasswordNew' => $this->passwordNew, 'userPasswordConfirm' => $this->passwordConfirm, 'format' => 'application/json');
         $requestContents = Connectivity::runCurl($webserviceUrl, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => http_build_query($webserviceParams)));
         if ($requestContents) {
             $jsonOutput = json_decode($requestContents, true);
             if (isset($jsonOutput['response']['user']) && $jsonOutput['response']['user']) {
                 $userOutput = $jsonOutput['response']['user'];
                 if ($userOutput['user'] && !$userOutput['error']) {
                     $user = $userOutput['user'];
                 } else {
                     $updateError = is_array($userOutput['error']) ? implode('<br>', Collection::flatten($userOutput['error'])) : $userOutput['error'];
                 }
             }
         }
         if ($user) {
             $saltSize = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);
             $salt = base64_encode(mcrypt_create_iv($saltSize, MCRYPT_RAND));
             $this->vizDb->update(self::DB_CONNECTION_VIZ_WRITE, 'VisualizationUser', array('Password' => hash('sha256', $salt . $this->passwordNew), 'PasswordSalt' => $salt), 'Name=?', array($this->user['UserName']));
             Session::setData(REQUEST_PARAMETER_USER_NAME, $user);
         } elseif (empty($updateError)) {
             $updateError = __('An unknown error occured while updating');
         }
     } else {
         $updateError = __('The new password can not be equal to the old password');
     }
     // Return the user update result
     return array(REQUEST_RESULT => $user ? true : false, REQUEST_ERROR => $updateError);
 }
Пример #3
0
 function QueryNominatim($query, $countryCodes = [], $searchLimit = "10", $boundingBox = [])
 {
     $curlString = self::NOMINATIM_URL_BASE . '/search?format=json';
     $curlString .= '&limit=' . $searchLimit;
     $curlString .= '&email=' . self::NOMINATIM_EMAIL;
     $curlString .= '&addressdetails=1';
     if ($countryCodes) {
         $curlString .= "&countrycodes=" . implode(',', $countryCodes);
     }
     if ($boundingBox) {
         $curlString .= "&viewbox=" . $boundingBox["west"];
         $curlString .= "," . $boundingBox["north"];
         $curlString .= "," . $boundingBox["east"];
         $curlString .= "," . $boundingBox["south"];
         $curlString .= "&bounded=1";
     }
     $curlString .= '&q=' . $query;
     if (printOutput()) {
         echo "<br>Executing query: " . $curlString . "<br>";
     }
     if (self::LIMIT_QUERIES) {
         while ($this->lastQueryTime + 1.0 > microtime(true)) {
             time_nanosleep(0, 10000);
         }
     }
     $this->lastQueryTime = microtime(true);
     return json_decode(Connectivity::runCurl($curlString), true);
 }
Пример #4
0
 public function setPropositionLayer()
 {
     $propositionResult = false;
     if ($this->visualization[REQUEST_PARAMETER_MYMAP]) {
         $vizJSON = $this->getVisualizationJSON();
         $propositionsLayer = array();
         if (isset($vizJSON['layers'])) {
             $layer = end($vizJSON['layers']);
             if (isset($layer['type']) && $layer['type'] === 'layergroup') {
                 foreach ($layer['options']['layer_definition']['layers'] as $groupLayer) {
                     // substr: remove the date from the end of the layer name (Ymd_His)
                     if (isset($groupLayer['options']['layer_name']) && String::endsWith(substr($groupLayer['options']['layer_name'], 0, -16), '_propose')) {
                         $propositionsLayer = $groupLayer;
                         break;
                     }
                 }
             }
         }
         if (!$propositionsLayer) {
             $vizResult = Connectivity::runCurl(String::prepare('http://%s.spotzi.me/api/v1/viz/%s?api_key=%s', $this->user['UserName'], $this->visualization[REQUEST_PARAMETER_VIZ_ID], $this->user['ApiKey']));
             if ($vizResult) {
                 $visualization = json_decode($vizResult, true);
                 if (isset($visualization['related_tables'])) {
                     $table = reset($visualization['related_tables']);
                     $tableId = $table['id'];
                     $tableResult = Connectivity::runCurl(String::prepare('http://%s.spotzi.me/api/v1/tables/%s?api_key=%s', $this->user['UserName'], $tableId, $this->user['ApiKey']));
                     if ($tableResult) {
                         $originalTable = json_decode($tableResult, true);
                         // substr: retrieve the base table name and date from the original table name (Ymd_His)
                         $originalName = substr($originalTable['name'], 0, -16);
                         $originalDate = substr($originalTable['name'], -15);
                         // the_geom_type: geometry, multipolygon, point, multilinestring
                         $createTableResult = Connectivity::runCurl(String::prepare('http://%s.spotzi.me/api/v1/tables?api_key=%s', $this->user['UserName'], $this->user['ApiKey']), array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('name' => substr($originalName, 0, 22) . '_propose_' . $originalDate, 'description' => __('Update propositions for %s', $originalTable['name']), 'tags' => 'update,propose,propositions')));
                         if ($createTableResult) {
                             $newTable = json_decode($createTableResult, true);
                             $newTableName = $newTable['name'];
                             Connectivity::runCurl(String::prepare('http://%s.spotzi.me/api/v1/tables/%s?api_key=%s', $this->user['UserName'], $newTable['id'], $this->user['ApiKey']), array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_POSTFIELDS => json_encode(array('privacy' => 'PUBLIC'))));
                             Connectivity::closeCurl();
                             $columns = array(' ADD COLUMN user_id text NOT NULL', ' ADD COLUMN visualization_id text NOT NULL', ' ADD COLUMN column_data text', ' ADD COLUMN the_geom_old geometry');
                             $columnQuery = "ALTER TABLE \"{$newTableName}\"" . implode(',', $columns) . ';';
                             $sqlResult = Connectivity::runCurl(String::prepare('http://%s.spotzi.me/api/v2/sql', $this->user['UserName']), array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('q' => $columnQuery, 'api_key' => $this->user['ApiKey'])));
                             $layerParams = array('kind' => 'carto', 'order' => 2, 'options' => array('table_name' => $newTableName, 'user_name' => $this->user['UserName'], 'interactivity' => 'cartodb_id', 'visible' => false, 'style_version' => '2.1.1', 'tile_style' => "#{$newTableName} {\n        // points\n        [mapnik-geometry-type=point] {\n                marker-fill: #77BBDD;\n                marker-opacity: 0.5;\n                marker-width: 12;\n                marker-line-color: #222222;\n                marker-line-width: 3;\n                marker-line-opacity: 1;\n                marker-placement: point;\n                marker-type: ellipse;\n                marker-allow-overlap: true;\n        }\n\n        //lines\n        [mapnik-geometry-type=linestring] {\n                line-color: #77BBDD;\n                line-width: 2;\n                line-opacity: 0.5;\n        }\n\n        //polygons\n        [mapnik-geometry-type=polygon] {\n                polygon-fill: #77BBDD;\n                polygon-opacity: 0.5;\n                line-opacity: 1;\n                line-color: #222222;\n        }\n}"));
                             $layerCreateResult = Connectivity::runCurl(String::prepare('http://%s.spotzi.me/api/v1/maps/%s/layers?api_key=%s', $this->user['UserName'], $visualization['map_id'], $this->user['ApiKey']), array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_POSTFIELDS => json_encode($layerParams)));
                             $propositionResult = (bool) $layerCreateResult;
                         }
                     }
                 }
             }
         }
     }
     return array(REQUEST_RESULT => $propositionResult);
 }
Пример #5
0
 public function getFeature()
 {
     $webserviceUrl = WEBSERVICE_URL . 'visualization/wo/map_feature';
     $webserviceParams = array('user' => WEBSERVICE_USER, 'password' => WEBSERVICE_PASSWORD, 'userName' => $this->user['UserName'], 'userKey' => $this->user['ApiKey'], 'visualizationId' => $this->visualization[REQUEST_PARAMETER_VIZ_ID], 'layerId' => $this->layerId, 'featureId' => $this->featureId, 'format' => 'application/json');
     $result = false;
     $webserviceResult = Connectivity::runCurl(Url::buildUrl($webserviceUrl, $webserviceParams));
     if ($webserviceResult) {
         $webserviceContents = json_decode($webserviceResult, true);
         if (isset($webserviceContents['response']['map_feature'])) {
             $result = $webserviceContents['response']['map_feature'];
         }
     }
     return array(REQUEST_RESULT => $result);
 }
Пример #6
0
 public function delete()
 {
     $webserviceUrl = WEBSERVICE_URL . 'visualization/wo/visualization';
     $webserviceParams = array('user' => WEBSERVICE_USER, 'password' => WEBSERVICE_PASSWORD, 'userName' => $this->user['UserName'], 'userKey' => $this->user['ApiKey'], 'visualizationId' => $this->visualizationId, 'format' => 'application/json');
     $webserviceResult = Connectivity::runCurl($webserviceUrl . '?' . http_build_query($webserviceParams), array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
     $result = false;
     if ($webserviceResult) {
         $webserviceContents = json_decode($webserviceResult, true);
         if (isset($webserviceContents['response']['visualization'])) {
             $result = (bool) $webserviceContents['response'];
         }
     }
     return array(REQUEST_RESULT => $result);
 }
Пример #7
0
 protected function getVisualizationJSON()
 {
     if (!$this->vizJSON) {
         $vizUrl = $this->getParam(REQUEST_PARAMETER_VIZ_URL);
         if ($vizUrl) {
             $vizJSONResult = Connectivity::runCurl($vizUrl);
             if ($vizJSONResult) {
                 $vizJSON = json_decode($vizJSONResult, true);
                 if ($vizJSON) {
                     $this->vizJSON = $vizJSON;
                 }
             }
         }
     }
     return $this->vizJSON;
 }
Пример #8
0
 public function update()
 {
     $result = false;
     if (isset($this->visualization[REQUEST_PARAMETER_VIZ_ID])) {
         $mapPrivacy = $this->getParam('mapPrivacy');
         $mapPrivacyUsers = $this->getParam('mapPrivacyUsers');
         $editPrivacy = $this->getParam('editPrivacy');
         $editPrivacyUsers = $this->getParam('editPrivacyUsers');
         $editMode = $this->getParam('editMode') === 'on';
         $apiUrl = String::prepare('http://%s.spotzi.me/api/v1/viz/%s?api_key=%s', $this->user['UserName'], $this->visualization[REQUEST_PARAMETER_VIZ_ID], $this->user['ApiKey']);
         $apiParams = array('map_options' => json_encode(array('map_privacy' => $mapPrivacy, 'map_privacy_users' => $mapPrivacyUsers, 'edit_privacy' => $editPrivacy, 'edit_privacy_users' => $editPrivacyUsers ? $editPrivacyUsers : $mapPrivacyUsers, 'edit_mode' => $editMode)));
         Connectivity::runCurl($apiUrl, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_POSTFIELDS => json_encode($apiParams)));
         $httpCode = Connectivity::getCurlInfo(CURLINFO_HTTP_CODE);
         $result = $httpCode === 200;
     }
     // Return the update result
     return array(REQUEST_RESULT => $result);
 }
Пример #9
0
 public function create()
 {
     $webserviceUrl = WEBSERVICE_URL . 'visualization/wo/visualization';
     $webserviceParams = array('user' => WEBSERVICE_USER, 'password' => WEBSERVICE_PASSWORD, 'userName' => $this->user['UserName'], 'userKey' => $this->user['ApiKey'], 'format' => 'application/json');
     $visualizationName = $this->getParam('createName');
     if ($visualizationName) {
         $webserviceParams['visualizationName'] = strip_tags($visualizationName);
     }
     $webserviceResult = Connectivity::runCurl($webserviceUrl, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $webserviceParams));
     $result = false;
     if ($webserviceResult) {
         $webserviceContents = json_decode($webserviceResult, true);
         if (isset($webserviceContents['response']['visualization'])) {
             $result = $webserviceContents['response']['visualization'];
         }
     }
     if ($result === false) {
         ErrorHandler::error(E_NOTICE, "The visualization '%s' could not be created, result: %s", $visualizationName ? $webserviceParams['visualizationName'] : '', $webserviceResult);
     }
     return array(REQUEST_RESULT => $result);
 }
Пример #10
0
 public function validate()
 {
     $webserviceUrl = String::prepare('%svisualization/wo/user?user=%s&password=%s&userName=%s&userPassword=%s&format=application/json', WEBSERVICE_URL, WEBSERVICE_USER, WEBSERVICE_PASSWORD, $this->userName, $this->userPassword);
     $requestContents = Connectivity::runCurl($webserviceUrl);
     $validateResult = false;
     $validateError = null;
     if ($requestContents) {
         $jsonOutput = json_decode($requestContents, true);
         if (isset($jsonOutput['response']['user'])) {
             $validateResult = true;
             Session::setData(REQUEST_PARAMETER_LOGGEDIN, true);
             Session::setData('freshLogin', true);
             Session::setData(REQUEST_PARAMETER_USER_NAME, $jsonOutput['response']['user']);
         }
     }
     if (!$validateResult && empty($validateError)) {
         $validateError = __('Your user name or password is incorrect');
     }
     // Return the validation result
     return array(REQUEST_RESULT => $validateResult, REQUEST_ERROR => $validateError);
 }
Пример #11
0
 /**
  *
  * @return string
  */
 protected function prepareVisualization()
 {
     $loggedIn = Session::getData(REQUEST_PARAMETER_LOGGEDIN);
     $sessionViz = Session::getData(REQUEST_PARAMETER_VIZ);
     $user = Session::getData(REQUEST_PARAMETER_USER_NAME);
     $visualization = array('communityMaps' => array(), 'myMaps' => array());
     // Community maps
     $webserviceUrl = String::prepare('%svisualization/wo/community?user=%s&password=%s&userName=%s&userKey=%s&format=application/json', WEBSERVICE_URL, WEBSERVICE_USER, WEBSERVICE_PASSWORD, $user['UserName'], $user['ApiKey']);
     $requestContents = Connectivity::runCurl($webserviceUrl);
     if ($requestContents) {
         $jsonOutput = json_decode($requestContents, true);
         if (isset($jsonOutput['response']['community'])) {
             $visualization['communityMaps'] = $jsonOutput['response']['community'];
         }
     }
     // My maps
     if ($loggedIn) {
         $webserviceUrl = String::prepare('%svisualization/wo/visualization?user=%s&password=%s&userName=%s&userKey=%s&format=application/json', WEBSERVICE_URL, WEBSERVICE_USER, WEBSERVICE_PASSWORD, $user['UserName'], $user['ApiKey']);
         $requestContents = Connectivity::runCurl($webserviceUrl);
         if ($requestContents) {
             $jsonOutput = json_decode($requestContents, true);
             if (isset($jsonOutput['response']['visualization'])) {
                 $visualization['myMaps'] = $jsonOutput['response']['visualization'];
             }
         }
     }
     // Set the default visualization
     $vizUrl = isset($sessionViz[REQUEST_PARAMETER_VIZ_URL]) ? $sessionViz[REQUEST_PARAMETER_VIZ_URL] : '';
     // Fallback for the default visualization
     if (empty($visualization['defaultVisualization'])) {
         if (!$vizUrl) {
             $vizUrl = $loggedIn && isset($sessionViz[REQUEST_PARAMETER_VIZ_URL]) ? $sessionViz[REQUEST_PARAMETER_VIZ_URL] : null;
         }
         $visualization['defaultVisualization'] = array('Url' => $vizUrl ? $vizUrl : VISUALIZATION_DEFAULT);
         if (!$vizUrl) {
             $this->visualizationSet = false;
         }
     }
     $this->visualization = $visualization;
 }
Пример #12
0
 public function import()
 {
     // Set the script execution settings
     $importSize = String::formatBytes(VISUALIZATION_IMPORT_SIZE, 'mB');
     setExecutionSettings($importSize + 256);
     $result = false;
     $error = null;
     $fileName = File::handleUpload(DIR_TEMP, 'importFile', null, array(), VISUALIZATION_IMPORT_SIZE);
     if ($fileName) {
         $fileInfo = pathinfo($fileName);
         $fileNameNew = str_replace(' ', '_', substr(strtolower($fileInfo['filename']), 0, 22)) . '_' . Date::format('now', 'Ymd_His') . '.' . $fileInfo['extension'];
         $destinationDir = '\\\\db-images\\data.spotzi.com\\import\\' . $this->user['UserName'];
         if (!is_dir($destinationDir)) {
             mkdir($destinationDir);
         }
         $destination = $destinationDir . '\\' . $fileNameNew;
         if (is_dir($destinationDir) && copy(DIR_TEMP . $fileName, $destination)) {
             $importName = $this->getParam('importName');
             if (!$importName) {
                 $importName = ucwords(substr(str_replace('_', ' ', $fileName), 0, strrpos($fileName, '.')));
             }
             $dataUrl = 'http://data.spotzi.com/import/' . $this->user['UserName'] . '/' . $fileNameNew;
             $this->vizDb->insert(self::DB_CONNECTION_VIZ_WRITE, 'VisualizationImport', array('Service' => 'geonovum', 'UserName' => $this->user['UserName'], 'Email' => $this->user['Email'], 'Name' => $importName, 'DataUrl' => $dataUrl, 'DebugImport' => debugMode()));
             $webserviceUrl = String::prepare('%svisualization/wo/import?user=%s&password=%s&userName=%s&userKey=%s&callback=%s&format=application/json', WEBSERVICE_URL, WEBSERVICE_USER, WEBSERVICE_PASSWORD, $this->user['UserName'], $this->user['ApiKey'], Url::buildPlatformURL(false, 'import', 'import', 'finish'));
             Connectivity::runCurlAsync($webserviceUrl);
             $result = true;
         } else {
             $error = __('An error occured while preparing the file');
         }
         File::delete(DIR_TEMP . $fileName);
     } else {
         $error = __('An error occured while uploading the file');
     }
     if ($result === false) {
         ErrorHandler::error(E_NOTICE, "The import failed, file name: %s\nerror: %s", $fileName, $error);
     }
     return array(REQUEST_RESULT => $result, REQUEST_ERROR => $error);
 }
Пример #13
0
 /**
  * Shorten a URL.
  *
  * @param       string          $url            URL to shorten
  * @return      string                          Shortened URL
  */
 public static function shorten($url)
 {
     // Prepare the URL parameters
     $params = array('access_token' => BITLY_TOKEN, 'longUrl' => $url);
     $options = array(CURLOPT_SSL_VERIFYPEER => false);
     // Retrieve the URL
     $requestContents = Connectivity::runCurl(BITLY_URL . '?' . http_build_query($params), $options);
     // Parse and return the URL
     $requestJSON = json_decode($requestContents, true);
     return $requestJSON && isset($requestJSON['data']['url']) ? $requestJSON['data']['url'] : $url;
 }
Пример #14
0
 protected function registerNewsletterSubscription($email)
 {
     $isNL = $this->request->locale === 'nl_NL';
     // Add the user to the newsletter subscription list
     $curlData = json_encode(array('api_method' => 'subscriber_add', 'api_key' => self::NEWSLETTER_API_KEY, 'api_data' => array('email' => $email, 'list_id' => array($isNL ? self::NEWSLETTER_MAILINGLIST_NL : self::NEWSLETTER_MAILINGLIST_EN))));
     Connectivity::runCurl(self::NEWSLETTER_API_URL, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $curlData, CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Content-Length: ' . strlen($curlData))));
 }
Пример #15
0
 function __construct($id, $passwd, $db)
 {
     parent::__construct($id, $passwd, $db);
 }
Пример #16
0
 public function addFeature()
 {
     $this->featureArray = ['visualizationId' => $this->visualization[REQUEST_PARAMETER_VIZ_ID], 'featureAction' => $this->action];
     switch ($this->action) {
         case EDITOR_ACTION_NEW_FEATURE:
             $this->featureArray['the_geom'] = $this->the_geom;
             $this->featureArray['geom_type'] = $this->geom_type;
             $this->featureArray['featureStyle'] = $this->featureStyle;
             break;
         case EDITOR_ACTION_EDIT_DATA:
             $this->featureArray['featureId'] = $this->featureId;
             $this->featureArray['layerId'] = $this->layerId;
             $this->featureArray['geom_type'] = $this->geom_type;
             $this->featureArray['featureStyle'] = $this->featureStyle;
             break;
         case EDITOR_ACTION_EDIT_GEOM:
             $this->featureArray['featureId'] = $this->featureId;
             $this->featureArray['layerId'] = $this->layerId;
             $this->featureArray['the_geom'] = $this->the_geom;
             $this->featureArray['geom_type'] = $this->geom_type;
             break;
         case EDITOR_ACTION_DELETE:
             $this->featureArray['featureId'] = $this->featureId;
             $this->featureArray['layerId'] = $this->layerId;
             break;
     }
     if (in_array($this->action, [EDITOR_ACTION_NEW_FEATURE, EDITOR_ACTION_EDIT_DATA])) {
         $fileName = File::handleUpload(DIR_TEMP, 'imageurl', null, array(), 26214400);
         //25 MB
         $imageurl = '';
         if ($fileName) {
             if (exif_imagetype(DIR_TEMP . $fileName)) {
                 $fileNameNew = Date::format('now', 'YmdHis') . '_' . str_replace(' ', '_', $fileName);
                 $destinationDir = '\\\\db-images\\images.spotzi.com\\mapbuilder\\users\\' . $this->user['UserName'];
                 if (!is_dir($destinationDir)) {
                     mkdir($destinationDir);
                 }
                 $destination = $destinationDir . '\\' . $fileNameNew;
                 if (is_dir($destinationDir) && copy(DIR_TEMP . $fileName, $destination)) {
                     $importName = substr(str_replace('_', ' ', $fileName), 0, strrpos($fileName, '.'));
                     $imageurl = 'http://images.spotzi.com/mapbuilder/users/' . $this->user['UserName'] . '/' . $fileNameNew;
                 }
                 File::delete(DIR_TEMP . $fileName);
             } else {
                 File::delete(DIR_TEMP . $fileName);
                 ErrorHandler::error(E_ERROR, String::prepare('%s is not an image', $fileName));
             }
         } else {
             $imageurl = $this->getParam('image');
         }
         $this->featureArray['name'] = $this->getParam('name') ? $this->getParam('name') : '';
         $this->featureArray['description'] = $this->getParam('description') ? $this->getParam('description') : '';
         $this->featureArray['imageurl'] = $imageurl ? $imageurl : '';
     }
     $this->feature = json_encode($this->featureArray);
     $webserviceUrl = WEBSERVICE_URL . 'visualization/wo/map_feature';
     $webserviceParams = array('user' => WEBSERVICE_USER, 'password' => WEBSERVICE_PASSWORD, 'userName' => $this->user['UserName'], 'userKey' => $this->user['ApiKey'], 'feature' => $this->feature, 'format' => 'application/json');
     $result = false;
     $webserviceResult = Connectivity::runCurl($webserviceUrl, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $webserviceParams));
     if ($webserviceResult) {
         $webserviceContents = json_decode($webserviceResult, true);
         if (isset($webserviceContents['response']['map_feature'])) {
             $result = $webserviceContents['response']['map_feature'];
         }
     }
     return array(REQUEST_RESULT => $result);
 }
Пример #17
0
	<body>
	<?php 
include_once './Development/commonfiles/header.php';
?>
	<div class="container main">

<?php 
include_once './Development/commonfiles/Connectivity.php';
include_once './Development/commonfiles/Main.php';
if (!isset($_COOKIE["UserId"])) {
    if (isset($_POST["txtEmailId"]) && isset($_POST["txtPassword"])) {
        $userEmailId = $_POST["txtEmailId"];
        $password = $_POST["txtPassword"];
        echo 'poseted data: <br/>';
        echo $userEmailId . '    ' . $password;
        $con = new Connectivity();
        $main = new Main();
        if ($main->ValidatePassword($password)) {
            $query = "select UserId from UsersDetails where EmailId='" . $userEmailId . "' and Password='******'";
            echo $query . "<br/>";
            $rows = $con->getData($query);
            echo "<br/>" . sizeof($rows) . "<br/>";
            if (sizeof($rows) > 0) {
                foreach ($rows as $data) {
                    foreach ($data as $d) {
                        //print_r ($data);
                        foreach ($d as $d1) {
                            echo $d1 . "  ";
                        }
                    }
                    echo "<br/>";