Exemplo n.º 1
0
 public function process($loadReferencedRecords = array())
 {
     set_time_limit(0);
     ignore_user_abort(true);
     $this->deleteCancelFile();
     $filter = $this->grid->getFilter();
     $filter->setLimit(0);
     $ids = array();
     foreach (ActiveRecordModel::getFieldValues($this->grid->getModelClass(), $filter, array('ID'), ActiveRecordModel::LOAD_REFERENCES) as $row) {
         $ids[] = $row['ID'];
     }
     $totalCount = count($ids);
     $progress = 0;
     $response = new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->completionMessage);
     ActiveRecord::beginTransaction();
     $chunkSize = count($ids) / self::MASS_ACTION_CHUNK_SIZE > 5 ? self::MASS_ACTION_CHUNK_SIZE : ceil(count($ids) / 5);
     foreach (array_chunk($ids, $chunkSize) as $chunk) {
         $response->flush('|' . base64_encode(json_encode(array('total' => $totalCount, 'progress' => $progress, 'pid' => $this->pid))));
         $this->processSet(ActiveRecordModel::getRecordSet($this->grid->getModelClass(), new ARSelectFilter(new INCond(new ARFieldHandle($this->grid->getModelClass(), 'ID'), $chunk)), $loadReferencedRecords));
         $progress += count($chunk);
     }
     ActiveRecord::commit();
     $response->flush('|');
     return $response;
 }
Exemplo n.º 2
0
 /**
  * @brief sets a global system value
  * @param array $urlParams: an array with the values, which were matched in 
  *                          the routes file
  */
 public function setSystemValue($urlParams = array())
 {
     $value = $this->params('somesetting');
     $this->api->setSystemValue('somesetting', $value);
     $response = new JSONResponse($this->appName);
     $params = array('somesetting' => $value);
     $response->setParams($params);
     return $response;
 }
Exemplo n.º 3
0
 public function import()
 {
     //ignore_user_abort(true);
     set_time_limit(0);
     $validator = $this->buildValidator();
     if (!$validator->isValid()) {
         return new JSONResponse(array('errors' => $validator->getErrorList()));
     }
     $dsn = $this->request->get('dbType') . '://' . $this->request->get('dbUser') . ($this->request->get('dbPass') ? ':' . $this->request->get('dbPass') : '') . '@' . $this->request->get('dbServer') . '/' . $this->request->get('dbName');
     try {
         $cart = $this->request->get('cart');
         ClassLoader::import('library.import.driver.' . $cart);
         $driver = new $cart($dsn, $this->request->get('filePath'));
     } catch (SQLException $e) {
         $validator->triggerError('dbServer', $e->getNativeError());
         $validator->saveState();
         return new JSONResponse(array('errors' => $validator->getErrorList()));
     }
     if (!$driver->isDatabaseValid()) {
         $validator->triggerError('dbName', $this->maketext('_invalid_database', $driver->getName()));
         $validator->saveState();
         return new JSONResponse(array('errors' => $validator->getErrorList()));
     }
     if (!$driver->isPathValid()) {
         $validator->triggerError('filePath', $this->maketext('_invalid_path', $driver->getName()));
         $validator->saveState();
         return new JSONResponse(array('errors' => $validator->getErrorList()));
     }
     $importer = new LiveCartImporter($driver);
     $response = new JSONResponse(null);
     // get importable data types
     $response->flush($this->getResponse(array('types' => $importer->getItemTypes())));
     ActiveRecord::beginTransaction();
     // process import
     try {
         while (true) {
             $result = $importer->process();
             $response->flush($this->getResponse($result));
             //echo '|' . round(memory_get_usage() / (1024*1024), 1) . " ($result[type] : " . array_shift(array_shift(ActiveRecord::getDataBySQL("SELECT COUNT(*) FROM " . $result['type']))) . ")<br> \n";
             if (is_null($result)) {
                 break;
             }
         }
     } catch (Exception $e) {
         print_r($e->getMessage());
         ActiveRecord::rollback();
     }
     if (!$this->application->isDevMode() || 1) {
         ActiveRecord::commit();
     } else {
         ActiveRecord::rollback();
     }
     $importer->reset();
     return $response;
 }
 public function write($dump)
 {
     $data = $dump['data'];
     $appStatus = $dump['status'];
     $body = json_encode(array('status' => $appStatus, 'result' => array('data' => $data)));
     parent::write($body);
 }
Exemplo n.º 5
0
 /**
         See JSONMessage constructor.
 */
 public function __construct(JSONRequest $req)
 {
     parent::__construct($req);
     $pay = $req->getPayload();
     if (!@is_array($pay)) {
         throw new Exception($this->getType() . " requires a payload object!", 1);
     }
     $proj = @$pay['project'];
     if (!$proj) {
         throw new Exception($this->getType() . " requires a 'project' property in the payload!", 2);
     }
     $page = @$pay['page'];
     if (!$page) {
         throw new Exception($this->getType() . " requires a 'page' property in the payload!", 2);
     }
     $rev = (int) @$pay['r'];
     $url = 'http://' . $proj . '.googlecode.com/svn/wiki/' . $page . '.wiki' . ($rev ? '?r=' . $rev : '');
     $fh = @file_get_contents($url, 'r');
     if (false === $fh) {
         throw new Exception($this->getType() . " could not open URL [{$url}]!", 3);
     }
     $opay = array();
     $opay['url'] = $url;
     $opay['project'] = $proj;
     $opay['page'] = $page;
     if ($rev) {
         $opay['r'] = $rev;
     }
     $opay['content'] = $fh;
     $this->setPayload($opay);
 }
Exemplo n.º 6
0
 function getTemplateInfo()
 {
     header("Content-Type: text/plain; charset=UTF-8");
     jincimport('core.messagefactory');
     jincimport('utility.jsonresponse');
     $tem_id = JRequest::getInt('id', 0);
     $minstance = MessageFactory::getInstance();
     if (!($template = $minstance->loadTemplate($tem_id))) {
         $template = new MessageTemplate(0);
     }
     // Building JSON response
     $response = new JSONResponse();
     $response->set('subject', $template->get('subject'));
     $response->set('body', $template->get('body'));
     echo $response->toString();
 }
Exemplo n.º 7
0
 /**
         See JSONMessage constructor.
 */
 public function __construct(JSONRequest $req)
 {
     parent::__construct($req);
     $pay = $req->getPayload(array());
     if (!@is_array($pay)) {
         throw new Exception($this->getType() . " requires a payload object!", 1);
     }
     $proj = @$pay['project'];
     if (!$proj) {
         throw new Exception($this->getType() . " requires a 'project' property in the payload!", 2);
     }
     $url = 'http://' . $proj . '.googlecode.com/svn/wiki/';
     $fh = @file_get_contents($url, 'r');
     if (false === $fh) {
         throw new Exception($this->getType() . " could not open URL [{$url}]!", 3);
     }
     $opay = array();
     $opay['project'] = $proj;
     $opay['url'] = $url;
     $m = array();
     preg_match_all("/>([a-zA-Z]\\w+)\\.wiki</", $fh, $m);
     /*
             $li = array();
             if($m) for( $i = 0; $i < count($m[1]); ++$i )
             {
                 $x = $m[1];
                 array_push( $li, $x[$i] );
             }*/
     //$opay['matches'] = $m;
     $opay['pages'] = @$m[1] ? $m[1] : null;
     $this->setPayload($opay);
 }
Exemplo n.º 8
0
 function getDefaultTemplate()
 {
     header("Content-Type: text/plain; charset=UTF-8");
     jincimport('core.newsletterfactory');
     jincimport('utility.jsonresponse');
     jincimport('utility.jinchtmlhelper');
     $id = JRequest::getInt('id', 0);
     $tem_id = 0;
     $tag_string = '';
     $ninstance = NewsletterFactory::getInstance();
     if ($newsletter = $ninstance->loadNewsletter($id, false)) {
         $tem_id = $newsletter->get('default_template');
     }
     // Building JSON response
     $response = new JSONResponse();
     $response->set('tem_id', (int) $tem_id);
     echo $response->toString();
 }
Exemplo n.º 9
0
                    $errors .= "Please enter a valid email \n";
                }
                if (empty($message) || !preg_match("/^[a-zA-Z ]*\$/", $message)) {
                    $errors .= "Please enter a valid message \n";
                }
                if (!empty($errors)) {
                    $json = array('error' => $errors);
                    echo JSONResponse::send($json);
                    return;
                }
                $sendgrid = new SendGrid('API_KEY_HERE');
                $email = new SendGrid\Email();
                $email->addTo($app->config->get('smtp')->to)->setFrom('*****@*****.**')->setSubject('Inquiry from ' . $name)->setText($message);
                try {
                    $sendgrid->send($email);
                } catch (\SendGrid\Exception $e) {
                    $json = array('error' => '');
                    foreach ($e->getErrors() as $err) {
                        $json['error'] .= $err . "\n";
                    }
                    echo JSONResponse::send($json);
                }
                $json = array('message' => 'success');
                echo JSONResponse::send($json);
            } catch (Exception $e) {
                $json = array('error' => $e->getMessage());
                echo JSONResponse::send($json);
            }
        });
    });
});
Exemplo n.º 10
0
 function removeAttribute($attr_name)
 {
     jincimport('utility.servicelocator');
     jincimport('utility.jsonresponse');
     $servicelocator = ServiceLocator::getInstance();
     $logger = $servicelocator->getLogger();
     $response = new JSONResponse();
     if (strlen($attr_name) == 0) {
         $response->set('status', -1);
         $response->set('errcode', 'COM_JINC_ERR044');
         $response->set('errmsg', JText::_('COM_JINC_ERR044'));
         return $response->toString();
     }
     $dbo =& JFactory::getDBO();
     $attr_name_db = $dbo->escape($attr_name);
     $query = 'SELECT name FROM #__jinc_newsletter ' . 'WHERE attribs LIKE  ' . $dbo->quote('%' . $attr_name_db . '%', false);
     $dbo->setQuery($query);
     $logger->debug('JINCModelAttributes: Executing query: ' . $query);
     $result = $dbo->loadAssoc();
     if ($result == null) {
         $query = 'DROP TABLE IF EXISTS `#__jinc_attribute_' . $attr_name_db . '`';
         $logger->debug('JINCModelAttributes: Executing query: ' . $query);
         $dbo->setQuery($query);
         if (!$dbo->query()) {
             $response->set('status', -1);
             $response->set('errcode', 'COM_JINC_ERR046');
             $response->set('errmsg', JText::_('COM_JINC_ERR046'));
             return $response->toString();
         }
         $query = 'DELETE FROM #__jinc_attribute  ' . 'WHERE name = ' . $dbo->quote($attr_name_db, false);
         $logger->debug('JINCModelAttributes: Executing query: ' . $query);
         $dbo->setQuery($query);
         if ($dbo->query()) {
             $response->set('status', 0);
             $this->storeAttributeForm();
         } else {
             $response->set('status', -1);
             $response->set('errcode', 'COM_JINC_ERR046');
             $response->set('errmsg', JText::_('COM_JINC_ERR046'));
         }
     } else {
         $response->set('status', -1);
         $response->set('errcode', 'COM_JINC_ERR045');
         $response->set('errmsg', JText::_('COM_JINC_ERR045') . ' ' . $result['name']);
     }
     return $response->toString();
 }
Exemplo n.º 11
0
 /**
     See JSONMessage constructor.
 */
 public function __construct(JSONRequest $req)
 {
     parent::__construct($req);
     $ans = array();
     $errval = -42;
     $payload = $req->getPayload(array());
     $got = 0;
     $ar = $req->getOptions();
     if ($ar) {
         $this->opt = array_merge($this->opt, $ar);
     }
     $ar = @$payload['get'];
     if (null !== $ar) {
         ++$got;
         $ans['get'] = $this->getEnv($ar);
     }
     $ar = @$payload['clearCookies'];
     if ($ar) {
         ++$got;
         $sessname = session_name();
         foreach ($_COOKIE as $k => $v) {
             if ($sessname === $k) {
                 continue;
             }
             $this->setCookie($k, false);
             //$this->log[] = "Unset cookie [$k].";
         }
         $ans['cleared'] = true;
         // we do this to force the payload to be-a {object} instead of [array]
         $this->setResult(0, $this->log[] = "Cookies cleared.");
     }
     $ar = @$payload['set'];
     if ($ar) {
         ++$got;
         $ans['set'] = $this->setEnv($ar);
     }
     if (!$got) {
         $this->setResult(1, "Usage error: no action specified.");
     }
     if (count($this->log)) {
         $ans['log'] = $this->log;
     }
     $this->setPayload($ans);
 }
Exemplo n.º 12
0
<?php

describe("JSON Response", function () {
    before(function () {
        $response = new JSONResponse(array("id" => "100", array("location" => array("city" => "Pico Rivera", "state" => "CA"))));
        return $response;
    });
    it("generates json response", function ($response) {
        $data = '{"id":"100","0":{"location":{"city":"Pico Rivera","state":"CA"}}}';
        assert_equal($data, $response->to_json());
    });
    it("retrieves values", function ($response) {
        $json = json_decode($response->to_json(), true);
        assert_equal($json["id"], "100");
        assert_array($json[0]);
        assert_array($json[0]["location"]);
        assert_equal($json[0]["location"]["city"], "Pico Rivera");
        assert_equal($json[0]["location"]["state"], "CA");
    });
});
Exemplo n.º 13
0
 function deleteReport($proc_id)
 {
     jincimport('core.messagefactory');
     jincimport('utility.jsonresponse');
     jincimport('utility.servicelocator');
     $servicelocator = ServiceLocator::getInstance();
     $logger = $servicelocator->getLogger();
     $response = new JSONResponse();
     $minstance = MessageFactory::getInstance();
     if ($minstance->deleteReport($proc_id)) {
         $response->set('status', 0);
     } else {
         $response->set('status', -1);
     }
     $logger->debug('JSON: ' . $response->toString());
     return $response->toString();
 }
 /**
  * destroy
  */
 function destroy()
 {
     $res = new JSONResponse();
     if ($this->dbo->destroy($this->id)) {
         $res->success = true;
         $res->message = 'Eintrag gelöscht: ' . $this->id;
     } else {
         $res->message = 'Konnte den Eintrag nicht löschen';
     }
     return $res->to_json();
 }
Exemplo n.º 15
0
 private function send(NewsletterMessage $newsletter)
 {
     set_time_limit(0);
     $response = new JSONResponse(null);
     $data = $this->getRecipientData($this->request->toArray());
     $total = count($data);
     $subscribers = $users = array();
     foreach ($data as $row) {
         if ($row['userID']) {
             $users[] = $row['userID'];
         } else {
             $subscribers[] = $row['subscriberID'];
         }
     }
     $progress = 0;
     foreach (array('User' => $users, 'NewsletterSubscriber' => $subscribers) as $table => $ids) {
         foreach (array_chunk($ids, self::PROGRESS_FLUSH_INTERVAL) as $chunk) {
             foreach (ActiveRecordModel::getRecordSet($table, new ARSelectFilter(new InCond(new ARFieldHandle($table, 'ID'), $chunk))) as $recipient) {
                 $progress++;
                 $newsletter->send($recipient, $this->application);
                 if ($progress % self::PROGRESS_FLUSH_INTERVAL == 0 || $total == $progress) {
                     $response->flush($this->getJsonResponse(array('progress' => $progress, 'total' => $total)));
                 }
             }
             ActiveRecord::clearPool();
         }
     }
     $newsletter->markAsSent();
     $response->flush($this->getJsonResponse(array('progress' => 0, 'total' => $total)));
     exit;
 }
Exemplo n.º 16
0
 public function import()
 {
     $options = unserialize(base64_decode($this->request->get('options')));
     $response = new JSONResponse(null);
     if (file_exists($this->getCancelFile())) {
         unlink($this->getCancelFile());
     }
     if (!$this->request->get('continue')) {
         $this->clearCacheProgress();
     }
     $import = $this->getImportInstance();
     set_time_limit(0);
     ignore_user_abort(true);
     $profile = new CsvImportProfile($import->getClassName());
     // map CSV fields to LiveCart fields
     $params = $this->request->get('params');
     foreach ($this->request->get('column') as $key => $value) {
         if ($value) {
             $fieldParams = !empty($params[$key]) ? $params[$key] : array();
             $profile->setField($key, $value, array_filter($fieldParams));
         }
     }
     $profile->setParam('isHead', $this->request->get('firstHeader'));
     if ($this->request->get('saveProfile')) {
         $path = $this->getProfileDirectory($import) . $this->request->get('profileName') . '.ini';
         $profile->setFileName($path);
         $profile->save();
     }
     // get import root category
     if ($import->isRootCategory()) {
         $profile->setParam('category', $this->request->get('category'));
     }
     $import->beforeImport($profile);
     $csv = new CsvFile($this->request->get('file'), $this->request->get('delimiter'));
     $total = $csv->getRecordCount();
     if ($this->request->get('firstHeader')) {
         $total -= 1;
     }
     if ($this->request->get('firstHeader')) {
         $import->skipHeader($csv);
         $import->skipHeader($csv);
     }
     $progress = 0;
     $processed = 0;
     if ($this->request->get('continue')) {
         $import->setImportPosition($csv, $this->getCacheProgress() + 1);
         $progress = $this->getCacheProgress();
     } else {
         if (!empty($options['transaction'])) {
             ActiveRecord::beginTransaction();
         }
     }
     if (empty($options['transaction'])) {
         $this->request->set('continue', true);
     }
     $import->setOptions($options);
     if ($uid = $this->request->get('uid')) {
         $import->setUID($uid);
     }
     do {
         $progress += $import->importFileChunk($csv, $profile, 1);
         // continue timed-out import
         if ($this->request->get('continue')) {
             $this->setCacheProgress($progress);
         }
         ActiveRecord::clearPool();
         if ($progress % self::PROGRESS_FLUSH_INTERVAL == 0 || $total == $progress) {
             $response->flush($this->getResponse(array('progress' => $progress, 'total' => $total, 'uid' => $import->getUID(), 'lastName' => $import->getLastImportedRecordName())));
             //echo '|' . round(memory_get_usage() / (1024*1024), 1) . '|' . count($categories) . "\n";
         }
         // test non-transactional mode
         //if (!$this->request->get('continue')) exit;
         if (connection_aborted()) {
             if ($this->request->get('continue')) {
                 exit;
             } else {
                 $this->cancel();
             }
         }
     } while (!$import->isCompleted($csv));
     if (!empty($options['missing']) && 'keep' != $options['missing']) {
         $filter = $import->getMissingRecordFilter($profile);
         if ('disable' == $options['missing']) {
             $import->disableRecords($filter);
         } else {
             if ('delete' == $options['missing']) {
                 $import->deleteRecords($filter);
             }
         }
     }
     $import->afterImport();
     if (!$this->request->get('continue')) {
         //ActiveRecord::rollback();
         ActiveRecord::commit();
     }
     $response->flush($this->getResponse(array('progress' => 0, 'total' => $total)));
     //echo '|' . round(memory_get_usage() / (1024*1024), 1);
     exit;
 }
Exemplo n.º 17
0
 public function update()
 {
     $this->config->set('MODULE_STATS_UPDATED', null);
     $this->config->save();
     $response = new JSONResponse('');
     $updatePath = $this->getRepoResponse('package/updatePath', array('from' => $this->request->get('from'), 'to' => $this->request->get('to')));
     $flush = array('path' => $updatePath);
     $flush['status'] = $this->translate($updatePath ? '_status_fetch' : '_status_nothing_to_fetch');
     $response->flushChunk($flush);
     if (!$updatePath) {
         return $response;
     }
     require_once ClassLoader::getRealPath('library.pclzip') . '/pclzip.lib.php';
     // process update
     $module = $this->application->getConfigContainer()->getModule($this->request->get('id'));
     foreach ($updatePath as $key => $package) {
         $tmpFile = ClassLoader::getRealPath('cache.') . 'update' . rand(1, 5000000) . '.zip';
         $tmpDir = substr($tmpFile, 0, -4);
         $response->flushChunk(array('package' => $package, 'status' => $this->translate('_status_fetch')));
         file_put_contents($tmpFile, $this->getRepoResponse('package/download', $package, true));
         $archive = new PclZip($tmpFile);
         mkdir($tmpDir);
         $archive->extract($tmpDir);
         unlink($tmpFile);
         $res = $module->applyUpdate($tmpDir);
         if ($res === true) {
             $response->flushChunk(array('status' => 'ok'));
         } else {
             $errs = array('_err_update_copy_msg', '_err_update_db', '_err_update_custom');
             $response->flushChunk(array('status' => 'err', 'msg' => $this->maketext($errs[$res[0]], array($res[1]))));
             $res = false;
         }
         $this->application->rmdir_recurse($tmpDir);
         if (!$res) {
             return;
         }
     }
     $response->flushChunk(array('final' => $this->makeText('_update_complete', array($this->translate($module->getName())))));
 }
Exemplo n.º 18
0
 public function step5()
 {
     Loader::model('file_set');
     Loader::model('file_list');
     $response = new JSONResponse();
     $response->setStatus(false);
     $user = $this->post("user");
     $repos = $this->post("repos");
     $file = $this->post("file");
     $plugin = new PluginArchive();
     $pluginDir = $plugin->unzip($file);
     $u = new User();
     $fs = FileSet::createAndGetSet($repos, 1, $u->getUserID());
     $importer = new MootoolsPluginImporter($fs);
     $importFiles = $importer->getComponentFiles($pluginDir . "/Source/");
     $resultFiles = array();
     foreach ($importFiles as $file) {
         $result = $importer->canImport($file);
         if ($result) {
             $resultFiles[$file] = $importer->addFile($file);
         }
     }
     $response->setMessage(t("Plugin taking was completed."));
     $response->setParameter("files", $resultFiles);
     $response->setStatus(true);
     $response->flush();
 }
Exemplo n.º 19
0
 /**
  * Shortcut for rendering a JSON response
  * @param array $data: the PHP array that will be put into the JSON data index
  * @param string $errorMsg: If you want to return an error message, pass one
  * @param string $file: the file where the error message happened
  * @return a JSONResponse
  */
 protected function renderJSON($data = array(), $errorMsg = null, $file = '')
 {
     $response = new JSONResponse($this->appName);
     $response->setParams($data);
     if ($errorMsg !== null) {
         $response->setErrorMessage($errorMsg, $file);
     }
     return $response;
 }
Exemplo n.º 20
0
 public static function send($res)
 {
     self::$json = $res;
     return json_encode(self::$json);
 }
Exemplo n.º 21
0
            return;
        }
        $DB = new Database();
        $RecoveryHash = $DB->StoreRecoveryHash($EmailAddress);
        $EmailObject = new Email();
        $EmailObject->SendRecoveryEmail($EmailAddress, $RecoveryHash);
        print JSONResponse::PrepareResponse(true, "Sent", null);
        break;
    case 'updatepassword':
        if (isset($_REQUEST['e']) && isset($_REQUEST['p']) && isset($_REQUEST['h'])) {
            $EmailAddress = $_REQUEST['e'];
            $NewPassword = $_REQUEST['p'];
            $Hash = $_REQUEST['h'];
        } else {
            return;
        }
        $NewHash = Hash::GenerateHash($NewPassword);
        $DB = new Database();
        $DB->UpdateRecoveryPassword($EmailAddress, $Hash, $NewHash);
        break;
    case 'resetportfolio':
        $DB = new Database();
        UserManagement::InitSession();
        $DB->ResetPortfolio($_SESSION['User']->user_id);
        print JSONResponse::PrepareResponse(true, "Sent", null);
        break;
    case 'testmessage':
        $EmailObject = new Email();
        $EmailObject->SendWelcomeEmail("*****@*****.**", "test");
        break;
}
Exemplo n.º 22
0
 /**
         See JSONMessage constructor.
 */
 public function __construct(JSONRequest $req)
 {
     parent::__construct($req);
     $tr = $req->get('timestamp');
     $ts = $this->get('timestamp');
     $ar = array('timeDiffSeconds' => ($ts - $tr) / 1000, 'requestTime' => $tr, 'pingPayload' => $req->getPayload());
     $this->setResult(0, 'Pong');
     $this->setPayload($ar);
 }
Exemplo n.º 23
0
 /**
     See JSONMessage constructor.
 */
 public function __construct(JSONRequest $req)
 {
     parent::__construct($req);
     $a = array();
     $q = self::quotes();
     $respay = $req->getPayload();
     if ($respay && @is_array($respay) && @$respay['fetchAll']) {
         $a['credits'] = array('originalListAuthor' => 'Brandon Checketts', 'originalURL' => 'http://www.apeleon.net/~microbit/brandon.html');
         $a['quotes'] = $q;
     } else {
         $c = count($q);
         $n = $c ? rand(0, $c - 1) : 0;
         $a['quote'] = $q[$n];
         $a['number'] = $n;
         $a['of'] = $c;
     }
     $this->setPayload($a);
 }