/** * Gets the data for a field, verify it and pre-save it. * @param SPEntry $entry * @param string $tsId * @param string $request * @return array */ public function submit(&$entry, $tsId = null, $request = 'POST') { if (count($this->verify($entry, $request))) { return SPRequest::search($this->nid, $request); } else { return array(); } }
/** * Gets the data for a field, verify it and pre-save it. * @param SPEntry $entry * @param string $tsId * @param string $request * @return void */ public function submit(&$entry, $tsId = null, $request = 'POST') { $data = $this->fetchData($this->multi ? SPRequest::arr($this->nid, array(), $request) : SPRequest::word($this->nid, null, $request)); if (count($this->verify($entry, $request, $data))) { return SPRequest::search($this->nid, $request); } else { return array(); } }
/** * Gets the data for a field, verify it and pre-save it. * @param SPEntry $entry * @param string $tsId * @param string $request * @return void */ public function submit(&$entry, $tsId = null, $request = 'POST') { $data = $this->verify($entry, $request); if (strlen($data)) { return SPRequest::search($this->nid, $request); } else { return array(); } }
private function downloadRequest() { $pid = SPRequest::cmd('exid'); $msg = SPFactory::Controller('progress'); $msg->progress(50, Sobi::Txt('EX.CONNECTING_TO_REPO')); $pid = explode('.', $pid); $repo = $pid[0]; $tid = $pid[1]; $pid = $pid[2]; $data = SPRequest::search('sprpfield_'); $answer = array(); $msg->progress(55, Sobi::Txt('EX.PARSING_RESPONSE')); if (count($data)) { foreach ($data as $k => $v) { $v = strlen($v) && $v != '' ? $v : SPC::NO_VALUE; $answer[str_replace('sprpfield_', null, $k)] = $v; } } $defFile = SPLoader::path("etc.repos.{$repo}.repository", 'front', true, 'xml'); $repository = SPFactory::Instance('services.installers.repository'); $repository->loadDefinition($defFile); try { $repository->connect(); } catch (SPException $x) { $msg->error(SPLang::e('REPO_ERR', $x->getMessage())); exit; } $callback = SPRequest::word('callback'); try { array_unshift($answer, $pid); array_unshift($answer, $tid); array_unshift($answer, $repository->get('token')); $msg->progress(60, Sobi::Txt('EX.SENDING_REQUEST_TO', array('repo' => $repository->get('name')))); $response = call_user_func_array(array($repository, $callback), $answer); // sleep( 2 ); } catch (SPException $x) { $msg->error(SPLang::e('REPO_ERR', $x->getMessage())); exit; } $this->downloadResponse($response, $repository, $msg); }
protected function session(&$ssid) { /* if it wasn't new search */ $ssid = SPRequest::cmd('ssid', SPRequest::cmd('ssid', null, 'cookie')); $new = false; /* otherwise create new ssid */ if (!$ssid) { $ssid = microtime(true) * 100 . '.' . rand(0, 99); $new = true; } $attr = array('ssid' => $ssid, 'uid' => Sobi::My('id'), 'browserData' => SPConfig::serialize(SPBrowser::getInstance())); /* get search request */ if (!count($this->_request)) { $r = SPRequest::search('field_'); if (is_array($r) && count($r)) { $attr['requestData'] = SPConfig::serialize($r); } } /* determine the search parameters */ if ($new) { $attr['searchCreated'] = 'FUNCTION:NOW()'; } /* finally save */ try { $this->_db->insertUpdate('spdb_search', $attr); } catch (SPException $x) { Sobi::Error($this->name(), SPLang::e('CANNOT_CREATE_SESSION_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__); } return SPCookie::set('ssid', $ssid, SPCookie::days(7)); }