Example #1
0
/**
 * Decoding with object_to_coockie ecoded sting into php-object
 *
 * @param string $cookie
 * @return mixed
 */
function cookie_to_object($cookie){
	$z = urldecode($cookie);
	$z = base64_decode($z);
	$z = gzuncompress($z);
	$z = unserialize($z);
  return $z;
}
Example #2
0
 /**
  * 读取缓存
  * 
  * @access public
  * @param string $name
  *            缓存变量名
  * @return mixed
  */
 public function get($name = false)
 {
     N('cache_read', 1);
     $id = shmop_open($this->handler, 'c', 0600, 0);
     if ($id !== false) {
         $ret = unserialize(shmop_read($id, 0, shmop_size($id)));
         shmop_close($id);
         if ($name === false) {
             return $ret;
         }
         $name = $this->options['prefix'] . $name;
         if (isset($ret[$name])) {
             $content = $ret[$name];
             if (C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
                 // 启用数据压缩
                 $content = gzuncompress($content);
             }
             return $content;
         } else {
             return null;
         }
     } else {
         return false;
     }
 }
Example #3
0
 function convert()
 {
     $searchstart = 'stream';
     $searchend = 'endstream';
     $pdfText = '';
     $pos = 0;
     $pos2 = 0;
     $startpos = 0;
     while ($pos !== false && $pos2 !== false) {
         $pos = strpos($this->source, $searchstart, $startpos);
         $pos2 = strpos($this->source, $searchend, $startpos + 1);
         if ($pos !== false && $pos2 !== false) {
             if ($this->source[$pos] == 0xd && $this->source[$pos + 1] == 0xa) {
                 $pos += 2;
             } else {
                 if ($this->source[$pos] == 0xa) {
                     $pos++;
                 }
             }
             if ($this->source[$pos2 - 2] == 0xd && $this->source[$pos2 - 1] == 0xa) {
                 $pos2 -= 2;
             } else {
                 if ($this->source[$pos2 - 1] == 0xa) {
                     $pos2--;
                 }
             }
             $textsection = substr($this->source, $pos + strlen($searchstart) + 2, $pos2 - $pos - strlen($searchstart) - 1);
             $data = @gzuncompress($textsection);
             $pdfText .= $this->extractTextFromPdf($data);
             $startpos = $pos2 + strlen($searchend) - 1;
         }
     }
     return preg_replace('/(\\s)+/', ' ', $pdfText);
 }
Example #4
0
 /**
  * Re-inflates and unserializes a blob of compressed data
  * @param string $data
  * @return mixed            false if an error occurred
  */
 public static function unserialize($data)
 {
     if (Auditing::current()->compressData) {
         $data = gzuncompress($data);
     }
     return unserialize($data);
 }
Example #5
0
function deal_file($params)
{
    global $log;
    if (isset($params['fileContent'])) {
        $log->LogInfo("---------处理后台报文返回的文件---------");
        $fileContent = $params['fileContent'];
        if (empty($fileContent)) {
            $log->LogInfo('文件内容为空');
        } else {
            $content = gzuncompress(base64_decode($fileContent));
            $root = SDK_FILE_DOWN_PATH;
            $filePath = null;
            if (empty($params['fileName'])) {
                $log->LogInfo("文件名为空");
                $filePath = $root . $params['merId'] . '_' . $params['batchNo'] . '_' . $params['txnTime'] . 'txt';
            } else {
                $filePath = $root . $params['fileName'];
            }
            $handle = fopen($filePath, "w+");
            if (!is_writable($filePath)) {
                $log->LogInfo("文件:" . $filePath . "不可写,请检查!");
            } else {
                file_put_contents($filePath, $content);
                $log->LogInfo("文件位置 >:" . $filePath);
            }
            fclose($handle);
        }
    }
}
Example #6
0
 public static function end()
 {
     $content = gzuncompress(gzcompress(ob_get_contents()));
     ob_end_clean();
     $r = RenderingStack::peek();
     if (self::$store_mode == self::STORE_MODE_OVERWRITE || self::$store_mode == self::STORE_MODE_ERROR_ON_OVERWRITE) {
         $r->set(self::$sector_path, $content);
     }
     if (self::$store_mode == self::STORE_MODE_APPEND) {
         if ($r->is_set(self::$sector_path)) {
             $old_content = $r->get(self::$sector_path);
             $r->set(self::$sector_path, $old_content . $content);
         } else {
             $r->set(self::$sector_path, $content);
         }
     }
     if (self::$store_mode == self::STORE_MODE_PREPEND) {
         if ($r->is_set(self::$sector_path)) {
             $old_content = $r->get(self::$sector_path);
             $r->set(self::$sector_path, $content . $old_content);
         } else {
             $r->set(self::$sector_path, $content);
         }
     }
     self::$sector_opened = false;
     self::$store_mode = null;
     self::$sector_path = null;
 }
 public function read($id)
 {
     // Check for the existance of a cookie with the name of the session id
     // Make sure that the cookie is atleast the size of our hash, otherwise it's invalid
     // Return an empty string if it's invalid.
     if (!isset($_COOKIE[$id])) {
         return '';
     }
     // We expect the cookie to be base64 encoded, so let's decode it and make sure
     // that the cookie, at a minimum, is longer than our expact hash length.
     $raw = gzuncompress(base64_decode($_COOKIE[$id]));
     if ($raw === false || strlen($raw) < $this->HASH_LEN) {
         return '';
     }
     // The cookie data contains the actual data w/ the hash concatonated to the end,
     // since the hash is a fixed length, we can extract the last HMAC_LENGTH chars
     // to get the hash.
     $hash = substr($raw, strlen($raw) - $this->HASH_LEN, $this->HASH_LEN);
     $data = substr($raw, 0, -$this->HASH_LEN);
     // Calculate what the hash should be, based on the data. If the data has not been
     // tampered with, $hash and $hash_calculated will be the same
     $hash_calculated = hash_hmac($this->HASH_ALGO, $data, $this->HASH_SECRET);
     // If we calculate a different hash, we can't trust the data. Return an empty string.
     if ($hash_calculated !== $hash) {
         return '';
     }
     // Return the data, now that it's been verified.
     return (string) $data;
 }
 /**
  * 解密网络消息
  * @param $message_str
  * @param bool|true $alloc
  * @param bool $encrypt
  * true 返回 RPCMessage 实例数组 ,
  * false 返回数组
  * @return mixed|null
  */
 static function decodeMessages($message_str, $alloc = true, $encrypt = false)
 {
     try {
         // 解压缩数据
         $unBase64 = base64_decode($message_str);
         if ($unBase64 === FALSE) {
             return null;
         }
         if ($encrypt) {
             // 解密
             for ($i = strlen($unBase64) - 1; $i >= self::NOT_OR_KEY_LEN; $i--) {
                 $unBase64[$i] = $unBase64[$i - self::NOT_OR_KEY_LEN] ^ $unBase64[$i];
             }
             $unBase64 = substr($unBase64, self::NOT_OR_KEY_LEN);
         }
         $messagesData = gzuncompress($unBase64);
         if ($messagesData === FALSE) {
             return null;
         }
         $jsonDecodeMessages = json_decode($messagesData, true);
         $messages = [];
         if ($alloc) {
             foreach ($jsonDecodeMessages as $key => $jsonDecodeMessage) {
                 $messages[$key] = RPCMessage::createWithArray($jsonDecodeMessage);
             }
         } else {
             $messages = $jsonDecodeMessages;
         }
     } catch (\Exception $e) {
         return null;
     }
     return $messages;
 }
 public static function Load($strPostDataState)
 {
     // Pull Out intStateIndex
     if (!is_null(QForm::$EncryptionKey)) {
         // Use QCryptography to Decrypt
         $objCrypto = new QCryptography(QForm::$EncryptionKey, true);
         $intStateIndex = $objCrypto->Decrypt($strPostDataState);
     } else {
         $intStateIndex = $strPostDataState;
     }
     // Pull FormState from Session
     // NOTE: if gzcompress is used, we are restoring the *BINARY* data stream of the compressed formstate
     // In theory, this SHOULD work.  But if there is a webserver/os/php version that doesn't like
     // binary session streams, you can first base64_decode before restoring from session (see note above).
     if (array_key_exists('qform_' . $intStateIndex, $_SESSION)) {
         $strSerializedForm = $_SESSION['qform_' . $intStateIndex];
         // Uncompress (if available)
         if (function_exists('gzcompress')) {
             $strSerializedForm = gzuncompress($strSerializedForm);
         }
         return $strSerializedForm;
     } else {
         return null;
     }
 }
Example #10
0
 function unpack($packed)
 {
     if (!$packed) {
         return false;
     }
     // ZLIB format has a five bit checksum in it's header.
     // Lets check for sanity.
     if ((ord($packed[0]) * 256 + ord($packed[1])) % 31 == 0 and substr($packed, 0, 2) == "‹" or substr($packed, 0, 2) == "xÚ") {
         if (function_exists('gzuncompress')) {
             // Looks like ZLIB.
             $data = gzuncompress($packed);
             return unserialize($data);
         } else {
             // user our php lib. TESTME
             include_once "ziplib.php";
             $zip = new ZipReader($packed);
             list(, $data, $attrib) = $zip->readFile();
             return unserialize($data);
         }
     }
     if (substr($packed, 0, 2) == "O:") {
         // Looks like a serialized object
         return unserialize($packed);
     }
     if (preg_match("/^\\w+\$/", $packed)) {
         return $packed;
     }
     // happened with _BackendInfo problem also.
     trigger_error("Can't unpack bad cached markup. Probably php_zlib extension not loaded.", E_USER_WARNING);
     return false;
 }
 public function __construct()
 {
     session_start();
     if (!$_SESSION['user'] || !$_SESSION['id']) {
         if ($_COOKIE['codekb_user'] && $_COOKIE['codekb_id']) {
             $succ = true;
             if (!session_name('codeKB')) {
                 $succ = false;
             }
             if (!($_SESSION['user'] = gzuncompress(urldecode($_COOKIE['codekb_user'])))) {
                 $succ = false;
             }
             if (!($_SESSION['id'] = gzuncompress(urldecode($_COOKIE['codekb_id'])))) {
                 $succ = false;
             }
             if (!$succ) {
                 throw new CodeKBException(__METHOD__, "admin", "sessionfailed");
             }
         }
     }
     $user = $_SESSION['user'];
     $pass = $_SESSION['id'];
     $db = new CodeKBDatabase();
     $db->dosql("SELECT id " . "FROM users " . "WHERE name = '{$db->string($user)}' AND " . "pass = '******'");
     if ($db->countrows() != 1) {
         return false;
     }
     $this->_name = $user;
     $this->_id = $db->column("id");
     $this->_valid = true;
     return true;
 }
Example #12
0
 /**
  * Render avatar
  */
 private function render($data)
 {
     // Load Class and set parameters
     $chargen = new CharacterRender();
     $chargen->action = CharacterRender::ACTION_IDLE;
     $chargen->direction = CharacterRender::DIRECTION_SOUTH;
     $chargen->body_animation = 0;
     $chargen->doridori = 0;
     $chargen->loadFromSqlData($data);
     // Load images
     $player = $chargen->render();
     $border = imagecreatefrompng(Cache::$path . "avatar/data/border.png");
     $background = imagecreatefromjpeg(Cache::$path . "avatar/data/background01.jpg");
     $output = imagecreatetruecolor(128, 128);
     // Build image
     imagecopy($output, $background, 7, 7, 0, 0, 114, 114);
     imagecopy($output, $player, 7, 7, 35 + 7, 65 + 7, imagesx($player) - 14, imagesx($player) - 14);
     imagecopy($output, $border, 0, 0, 0, 0, 128, 128);
     // Add emblem
     if (!empty($data['emblem_data'])) {
         $binary = @gzuncompress(pack('H*', $data['emblem_data']));
         if ($binary && ($emblem = imagecreatefrombmpstring($binary))) {
             imagecopy($output, $emblem, 128 - 10 - 24, 128 - 10 - 24, 0, 0, 24, 24);
         }
     }
     // Set color for text
     $name_color = imagecolorallocate($output, 122, 122, 122);
     $lvl_color = imagecolorallocate($output, 185, 109, 179);
     $status_color = $data['online'] ? imagecolorallocate($output, 59, 129, 44) : imagecolorallocate($output, 188, 98, 98);
     // Draw text
     imagestring($output, 1, 12, 12, strtoupper($data['name']), $name_color);
     imagestring($output, 1, 12, 25, $data['base_level'] . "/" . $data['job_level'], $lvl_color);
     imagestring($output, 1, 81, 12, $data['online'] ? "ONLINE" : "OFFLINE", $status_color);
     imagepng($output);
 }
Example #13
0
 public function __wakeup()
 {
     if (is_array($this->pages)) {
         return;
     }
     $this->pages = unserialize(gzuncompress($this->pages));
 }
Example #14
0
 /**
  * 得到ID数组
  *
  * @access public
  * @param obj $obj
  * @param array $ids  id集合
  * @return array
  * @author 刘建辉
  * @修改日期 2015-08-03 15:56:28
  */
 public function get($getName, $id)
 {
     $diObj = \Phalcon\DI::getDefault()->get($getName);
     $data = $diObj->get($id);
     $newdataArr = array($id => gzuncompress($data));
     return $newdataArr;
 }
Example #15
0
 public function get($key)
 {
     $hash = md5($key);
     if (self::$_data[$hash]) {
         return unserialize(self::$_data[$hash]);
     }
     $fileName = $this->genFileName($key);
     if (file_exists($fileName) && is_readable($fileName)) {
         $content = file_get_contents($fileName);
         $expireTime = substr($content, 0, 9);
         $lastUpdate = filemtime($fileName);
         if ($expireTime != -1 && TIME - $lastUpdate > $expireTime) {
             if (is_writeable($fileName)) {
                 @unlink($fileName);
                 return false;
             }
         }
         $content = substr($content, 9);
         if (IS_SHM && function_exists('gzuncompress')) {
             $content = gzuncompress($content);
         }
         return unserialize($content);
     }
     return false;
 }
Example #16
0
 /**
  * @param string      $string The serialized data
  * @param string|null $type   If <em>NULL</em> detect type of serialization automatically
  *
  * @return mixed The unserialized data
  *
  * @throws InvalidArgumentException
  */
 public static function unserialize($string, $type = null)
 {
     if ($type === null) {
         list($type, $serializedData) = explode(' ', $string, 2);
     } else {
         $serializedData = $string;
     }
     switch ($type) {
         case self::SERIALIZE_TYPE_BASE64:
             $serializedData = base64_decode($serializedData, true);
             if ($serializedData === false) {
                 return $serializedData;
             }
             return self::unserialize($serializedData);
         case self::SERIALIZE_TYPE_GZIP:
             $serializedData = gzuncompress($serializedData);
             if ($serializedData === false) {
                 return $serializedData;
             }
             return self::unserialize($serializedData);
         case self::SERIALIZE_TYPE_PHP_SERIALIZE:
             return unserialize($serializedData);
         case self::SERIALIZE_TYPE_JSON:
             return json_decode($serializedData, true);
         default:
             throw new InvalidArgumentException();
     }
 }
Example #17
0
 /**
  * Compress
  * @param mixed $data
  * @return string binary blob of data
  */
 public static function uncompress($data)
 {
     if (Audit::getInstance()->compressData) {
         $data = gzuncompress($data);
     }
     return $data;
 }
Example #18
0
 public static function zipRead($fileName, $writeNow = false, $overwrite = false, $checkFolder = false)
 {
     $output = array();
     $allFiles = @explode('/#FILE#/', @file_get_contents($fileName));
     for ($i = 0; $i < count($allFiles); $i++) {
         @(list($filePath, $fileZipContent) = @explode('/#ZIP#/', $allFiles[$i]));
         if ($checkFolder) {
             if (strpos($filePath, $checkFolder) !== 0) {
                 continue;
             }
         }
         $fileUnzipContent = gzuncompress($fileZipContent);
         $output[$i] = array('path' => $filePath, 'content' => $fileUnzipContent);
         if ($writeNow) {
             if ($overwrite || !file_exists($filePath)) {
                 if (!is_dir(dirname($filePath))) {
                     @mkdir(dirname($filePath), 0777, true);
                 }
                 @file_put_contents($filePath, $fileUnzipContent);
                 @chmod($filePath, 0777);
             }
         }
     }
     return $output;
 }
 /**
  * Enable cache de-compression
  *
  * @param \Magento\Framework\App\PageCache\Cache $subject
  * @param string $result
  * @return string|bool
  * @throws \Magento\Framework\Exception\LocalizedException
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterLoad(\Magento\Framework\App\PageCache\Cache $subject, $result)
 {
     if ($result && strpos($result, self::COMPRESSION_PREFIX) === 0) {
         $result = function_exists('gzuncompress') ? gzuncompress(substr($result, strlen(self::COMPRESSION_PREFIX))) : false;
     }
     return $result;
 }
 function preAction()
 {
     global $xoopsUser;
     xoonips_allow_post_method();
     xoonips_deny_guest_access();
     $page = $this->_formdata->getValue('post', 'page', 'i', false);
     xoonips_validate_request($page > 0);
     $resolve_flag = $this->_formdata->getValue('post', 'resolve_conflict_flag', 'i', false);
     xoonips_validate_request(1 == $resolve_flag || 0 == $resolve_flag);
     $itemtype_handler =& xoonips_getormhandler('xoonips', 'item_type');
     foreach ($itemtype_handler->getObjects() as $itemtype) {
         if ('xoonips_index' == $itemtype->get('name')) {
             continue;
         }
         $handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
         $handler->create();
     }
     $sess_hander =& xoonips_getormhandler('xoonips', 'session');
     $sess =& $sess_hander->get(session_id());
     $session = unserialize($sess->get('sess_data'));
     $this->_collection = unserialize(gzuncompress(base64_decode($session['xoonips_import_items'])));
     xoonips_validate_request($this->_collection);
     $this->_collection->setImportAsNewOption(!is_null($this->_formdata->getValue('post', 'import_as_new', 'i', false)));
     $items =& $this->_collection->getItems();
     foreach (array_keys($items) as $key) {
         if (in_array($items[$key]->getPseudoId(), $this->getUpdatablePseudoId())) {
             // set update flag of displayed item
             $items[$key]->setUpdateFlag(in_array($items[$key]->getPseudoId(), $this->getUpdatePseudoId()));
         }
     }
     $this->_params[] = $this->_collection->getItems();
     $this->_params[] = $xoopsUser->getVar('uid');
     $this->_params[] = $this->_collection->getImportAsNewOption();
 }
Example #21
0
 private function load()
 {
     if (file_exists($this->fileName)) {
         $tCounter = 0;
         $tFile = fopen($this->fileName, 'r');
         while (!flock($tFile, LOCK_SH)) {
             usleep(5);
             $tCounter++;
             if ($tCounter == 100) {
                 return false;
             }
         }
         $tContent = fread($tFile, filesize($this->fileName));
         if ($this->useZip) {
             $tContent = gzuncompress($tContent);
         }
         $this->elements = unserialize($tContent);
         flock($tFile, LOCK_UN);
         fclose($tFile);
         $tKeys = array_keys($this->elements);
         foreach ($tKeys as $tKey) {
             $this->maintenance(new CacheKey($tKey));
         }
     }
     return true;
 }
Example #22
0
	/**
	 * Method: read()
	 * 	Reads a cache.
	 *
	 * @access public
	 * @returns mixed Either the content of the cache object, or _boolean_ false.
	 */
	public function read() {
		if(!file_exists($this->_file)){
			return false;
		}
		elseif(!is_readable($this->_file)){
			return false;
		}
		elseif($this->is_expired()){
			return false;
		}
		else{
			$data = file_get_contents($this->_file);
			$data = $this->_gzip ? gzuncompress($data) : $data;
			$data = unserialize($data);

			if ($data === false) {
				/*
					This should only happen when someone changes the gzip settings and there is
					existing data or someone has been mucking about in the cache folder manually.
					Delete the bad entry since the file cache doesn't clean up after itself and
					then return false so fresh data will be retrieved.
				 */
				$this->delete();
				return false;
			}

			return $data;
		}
	}
Example #23
0
 /**
  * 读取缓存
  * @access public
  * @param string $name 缓存变量名
  * @return mixed
  */
 public function get($name)
 {
     $name = $this->options['prefix'] . addslashes($name);
     N('cache_read', 1);
     $result = $this->handler->query('SELECT `data`,`datacrc` FROM `' . $this->options['table'] . '` WHERE `cachekey`=\'' . $name . '\' AND (`expire` =0 OR `expire`>' . time() . ') LIMIT 0,1');
     if (false !== $result) {
         $result = $result[0];
         if (C('DATA_CACHE_CHECK')) {
             //开启数据校验
             if ($result['datacrc'] != md5($result['data'])) {
                 //校验错误
                 return false;
             }
         }
         $content = $result['data'];
         if (C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
             //启用数据压缩
             $content = gzuncompress($content);
         }
         $content = unserialize($content);
         return $content;
     } else {
         return false;
     }
 }
 function handle_import()
 {
     $handle_import = str_replace("-", "_", 'pop_import_file_' . $this->plugin_id);
     if (isset($_REQUEST[$handle_import]) && current_user_can($this->capability)) {
         if (isset($_FILES['pop_import_file']) && $_FILES['pop_import_file']['error'] == 0) {
             $data = unserialize(base64_decode(gzuncompress(file_get_contents($_FILES['pop_import_file']['tmp_name']))));
             //----
             if (property_exists($data, 'id') && property_exists($data, 'name') && property_exists($data, 'options')) {
                 if ($data->id == $this->plugin_id) {
                     $backup = isset($_REQUEST['pop-backup-on-import']) && $_REQUEST['pop-backup-on-import'] == '1' ? true : false;
                     if ($backup) {
                         $saved_options = $this->get_saved_options();
                         $saved_options[] = (object) array('name' => __('Automatic settings backup', 'pop'), 'date' => date('Y-m-d H:i:s'), 'options' => $this->get_options());
                         $var = $this->options_varname . '_saved';
                         if (update_option($var, $saved_options)) {
                         }
                     }
                     $new_options = $data->options;
                     $new_options = is_array($new_options) ? $new_options : array();
                     if ($this->import_option($new_options, true)) {
                     }
                 } else {
                 }
             } else {
             }
             //------
             $goback = add_query_arg('updated', 'true', wp_get_referer());
             $goback = add_query_arg('pop_open_tabs', isset($_REQUEST['pop_open_tabs']) ? $_REQUEST['pop_open_tabs'] : '', $goback);
             wp_redirect($goback);
         }
     }
 }
Example #25
0
 public static function unserialize($cached)
 {
     if (isset($cached['_class']) && !class_exists($cached['_class'])) {
         \Zend_Loader::loadClass($cached['_class']);
     }
     return unserialize(gzuncompress($cached['content']));
 }
 function load($name)
 {
     if (!file_exists($name)) {
         return false;
     }
     if ($fp = fopen($name, 'rb')) {
         $buf = fread($fp, 8);
         $hdr = substr($buf, 0, 3);
         $ver = ord($buf[3]);
         if ($hdr != 'FWS' && $hdr != 'CWS') {
             return false;
         }
         $contents = fread($fp, filesize($name) - 8);
         if ($hdr == 'CWS' && $ver >= 6) {
             $contents = gzuncompress($contents);
         }
         $this->contents = substr($contents, 12);
         $this->_parse_header(substr($buf . $contents, 0, 20));
         fclose($fp);
         $this->loaded = true;
         return true;
     } else {
         return false;
     }
 }
Example #27
0
 /**
  * Returns information whether a key exists in the cache.
  * 
  * @param string $key The data key
  * @throws \InvalidArgumentException
  * @return boolean TRUE if the key exists in the cache, FALSE otherwise.
  */
 public function exists($key)
 {
     if (!is_string($key)) {
         throw new \InvalidArgumentException('The key argument must be of type string');
     }
     $app =& App::$instance;
     $keyMD5 = md5($key);
     $data = $app->data->get(['key' => '.temp/cache/' . substr($keyMD5, 0, 3) . '/' . substr($keyMD5, 3) . '.2', 'result' => ['body']]);
     // @codeCoverageIgnoreStart
     if (isset($data['body'])) {
         try {
             $body = unserialize(gzuncompress($data['body']));
             if ($body[0] > 0) {
                 if ($body[0] > time()) {
                     return true;
                 }
                 return false;
             }
             return true;
         } catch (\Exception $e) {
         }
     }
     // @codeCoverageIgnoreEnd
     return false;
 }
Example #28
0
 function showImg($name)
 {
     $image = ezimg::getImgData($name);
     header("Content-type: image/{$image['type']}");
     echo gzuncompress(base64_decode(str_replace(' ', '', $image['code'])));
     exit;
 }
Example #29
0
 function importConfig($conf_string)
 {
     $conf_string = base64_decode($conf_string);
     if (function_exists("gzcompress")) {
         $conf_string = gzuncompress($conf_string);
     }
     $this->imp = $imp = unserialize($conf_string);
     //print_r($this->imp['global']);
     //import global vars
     $this->_current_display = $imp['global']['display'] == 'inner' ? 'inner' : 'outer';
     $this->_display_action = $imp['global']['display_action'];
     $this->_item_position = $imp['global']['item_position'];
     $this->_current_detail_switch_mode = $imp['global']['detail_switch'];
     $this->_js_callback_func = $imp['global']['js_callback'];
     $this->_extra_url_parameter_string = $imp['global']['extra_url_parameter_string'];
     //import ressources
     if (is_array($imp['ressources'])) {
         foreach ($imp['ressources'] as $v) {
             if (class_exists($v['class_name'])) {
                 $res = new $v['class_name']();
                 $res->importConfig($v);
                 $this->addRessource($res);
             }
         }
     }
 }
Example #30
-1
 /**
  *
  * @param string $func : functioni ke bayad ejra shavad
  * @param array $params : parametr haye tabe'
  * @return array : [error, errMessage] agar be khata khord va [javab ha] agar dorost ejra shod
  */
 function call_soap($func, $params = null)
 {
     require_once '../lib/nusoap.php';
     $client = new nusoap_client("http://" . $this->_remote_ip . "/api/" . $this->_version . "/asa_travel_nusoap_server.php");
     $error = $client->getError();
     if ($error) {
         return array("error", $error);
     }
     $params['time_stamp'] = date('Y-m-d H:i:s');
     $params['_user'] = $this->_user;
     $params['_pass'] = $this->_pass;
     $result = $client->call($func, $params);
     if ($client->fault) {
         return array("error", "ErrorCall");
     } else {
         $error = $client->getError();
         if ($error) {
             return array("error", $error);
         } else {
             $param = json_decode(gzuncompress(base64_decode($result)));
             if ($param[type] == 'sucess') {
                 return $param[message];
             } else {
                 return array("error", $error);
             }
         }
     }
 }