public function getDocAtom($r) { $r->checkCache(); $url = 'http://quickdraw.laits.utexas.edu/dase1/media/keanepj/text/000598739.txt'; //$url = 'http://harpo.laits.utexas.edu:5984/test/1c919eeb2a40d850ec57b47334ba4f5c/study_set.atom'; //$url = 'http://harpo.laits.utexas.edu:1978/one'; $r->renderResponse(Dase_Http::get($url, 'xxxx', 'xxx')); }
public function isManager($collection_ascii_id) { $url = $this->config->getAppSetting('remote_url') . '/manager/' . $collection_ascii_id . '/' . $this->eid . '.json'; $res = Dase_Http::get($url); if ('200' == $res[0]) { $data = Dase_Json::toPhp($res[1]); if (isset($data['auth_level'])) { return $data['auth_level']; } } return false; }
public function getCollections($r) { $user = $r->getUser(); //if no collections, redirect to archive admin screen //will force login screen for non-superusers if no collections $c = new Dase_DBO_Collection($this->db); if (!$c->findCount() && $user && $user->is_superuser) { $r->renderRedirect('admin'); } $tpl = new Dase_Template($r); //$feed = Dase_Atom_Feed::retrieve($r->app_root.'/collections.atom'); //$tpl->assign('collections',$feed); $res = Dase_Http::get($r->app_root . '/collections.json'); $collections = Dase_Json::toPhp($res[1]); $tpl->assign('collections', $collections); $r->renderResponse($tpl->fetch('collection/list.tpl')); }
function scrubIndex($collection_ascii_id, $config, $db, $display = true) { $solr_version = '2.2'; $solr_base_url = $config->getSearch('solr_base_url'); $solr_update_url = $solr_base_url . '/update'; $j = 0; for ($i = 0; $i < 999999; $i++) { if (0 === $i % 100) { $solr_search_url = $solr_base_url . '/select/?q=c:' . $collection_ascii_id . '&version=' . $solr_version . '&rows=100&start=' . $i; list($http_code, $res) = Dase_Http::get($solr_search_url, null, null); $sx = simplexml_load_string($res); $num = 0; foreach ($sx->result as $result) { if (count($result->doc)) { foreach ($result->doc as $doc) { foreach ($doc->str as $str) { if ('_id' == $str['name']) { $j++; if ($display) { print "START {$i} ({$j}) "; } $unique = (string) $str; if (Dase_DBO_Item::getByUnique($db, $unique)) { if ($display) { print "FOUND {$unique}\n"; } } else { $num++; $delete_doc = '<delete><id>' . $unique . '</id></delete>'; $resp = Dase_Http::post($solr_update_url, $delete_doc, null, null, 'text/xml'); if ($display) { print "SCRUBBED {$unique}\n"; } } } } } } else { Dase_Http::post($solr_update_url, '<commit/>', null, null, 'text/xml'); return "scrubbed {$num} records"; } } } } }
public function getSolrResponse($item_unique) { $url = $this->solr_base_url . "/select/?q=_id:" . $item_unique . "&version=" . $this->solr_version; list($http_code, $res) = Dase_Http::get($url, null, null); if ('4' == substr($http_code, 0, 1) || '5' == substr($http_code, 0, 1)) { Dase_Log::debug(LOG_FILE, 'SOLR ERROR :' . $res); return '<error/>'; } return $res; }
public function get() { $url = $this->getUrl(); $res = Dase_Http::get($url); return Dase_Json::toPhp($res[1]); }
public function getExerciseEdit($r) { $t = new Dase_Template($r); $ex = new Dase_DBO_Exercise($this->db); if (!$ex->load($r->get('id'))) { $r->renderRedirect('home'); } if ($this->user->eid != $ex->creator_eid) { $r->renderError(401, 'unauthorized'); } // media $media_url = "https://dase.laits.utexas.edu/search.json?q=&collection_ascii_id=hdportal&max=999"; $resp = Dase_Http::get($media_url); $data = Dase_Json::toPhp($resp[1]); $t->assign('feed', $data); // all categories $cset = array(); $ex->getCreator(); $ex->getLines(); $ex->getSet(); $t->assign('exercise', $ex); $t->assign('exercise_sets', Dase_DBO_ExerciseSet::getAll($this->db)); $r->renderResponse($t->fetch('exercise_edit.tpl')); }