define('SEARCH_STATUS_UNKNOWN', 0);
define('SEARCH_STATUS_CREATED', 1);
define('SEARCH_STATUS_SCHEDULED', 2);
define('SEARCH_STATUS_PROCESSING', 3);
define('SEARCH_STATUS_SUSPENDED', 4);
define('SEARCH_STATUS_PARTIAL_RESULT_READY', 5);
define('SEARCH_STATUS_RESULT_READY', 6);
define('SEARCH_STATUS_FAILED', 7);
define('SEARCH_STATUS_TOO_MANY_RECORDS', 8);
define('SEARCH_TIMEOUT', 300000000);
//5 minutes
define('POLLING_INTERVAL', 100000);
//100ms
$errorStatuses = array(SEARCH_STATUS_UNKNOWN, SEARCH_STATUS_SUSPENDED, SEARCH_STATUS_PARTIAL_RESULT_READY, SEARCH_STATUS_FAILED, SEARCH_STATUS_TOO_MANY_RECORDS);
$requestId = $response;
pollStatus($requestId, $errorStatuses);
$decodedFinalResults = getDecodedFinalResults($requestId);
if (empty($decodedFinalResults)) {
    throw new EmptyResponseException("No results retrieved from Chemspider.");
}
//add Data To DataGraph
$searchType = getSearchType($this->Request->getPathWithoutExtension());
$resultBNode = '_:searchResult';
$this->DataGraph->add_literal_triple($resultBNode, RDF_TYPE, $searchType);
$unreservedParameters = $this->Request->getUnreservedParams();
foreach ($unreservedParameters as $name => $value) {
    $processedName = str_replace('.', '#', $name);
    $predicate = OPS_CHEMSPIDER_PREFIX . $processedName;
    $this->DataGraph->add_literal_triple($resultBNode, $predicate, $value);
}
foreach ($decodedFinalResults as $elem) {
Exemple #2
0
 /**
  * Lock the voting for a poll.
  * Must be called with a topic specified in the URL.
  * An admin always has over riding permission to lock a poll.
  * If not an admin must have poll_lock_any permission, otherwise must
  * be poll starter with poll_lock_own permission.
  * Upon successful completion of action will direct user back to topic.
  * Accessed via ?action=lockvoting.
  */
 public function action_lockvoting()
 {
     global $topic, $user_info;
     require_once SUBSDIR . '/Poll.subs.php';
     checkSession('get');
     // Get the poll starter, ID, and whether or not it is locked.
     $poll = pollStatus($topic);
     // If the user _can_ modify the poll....
     if (!allowedTo('poll_lock_any')) {
         isAllowedTo('poll_lock_' . ($user_info['id'] == $poll['id_member'] ? 'own' : 'any'));
     }
     // It's been locked by a non-moderator.
     if ($poll['locked'] == '1') {
         $poll['locked'] = '0';
     } elseif ($poll['locked'] == '2' && allowedTo('moderate_board')) {
         $poll['locked'] = '0';
     } elseif ($poll['locked'] == '2' && !allowedTo('moderate_board')) {
         fatal_lang_error('locked_by_admin', 'user');
     } elseif ($poll['locked'] == '0' && allowedTo('moderate_board')) {
         $poll['locked'] = '2';
     } else {
         $poll['locked'] = '1';
     }
     // Lock!  *Poof* - no one can vote.
     lockPoll($poll['id_poll'], $poll['locked']);
     redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
 }