function End($flags = 0) { try { $req = new DATARequest(); $draw = $req->CreatePlotter(); $draw->Create(); $id = $draw->Save(); } catch (ADEIException $e) { $error = $e->getInfo(); try { if (!$draw) { if (!$req) { $req = new REQUEST(); } $draw = $req->CreateTextPlotter(); } // $draw->CreateMessage("Error", "No Data"); $draw->CreateMessage("Error", $error); $id = $draw->Save(); $error = false; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); } } $res = DRAW::Display($id); $this->h->Write($res); }
function CreateInterval(REQUEST $req = NULL, $cache_timewindow = false) { $ivls = array(); if ($cache_timewindow) { if ($req) { $iinfo = $req->GetIntervalInfo(); } else { $iinfo = NULL; } //array(); // if (!$req) $req = new DATARequest($args = array()); foreach ($this as $cachewrap) { $cache = $cachewrap->GetCache(); $ivl = new INTERVAL($iinfo); $ivl->ApplyCache($cache); $cache->LimitInterval($ivl); array_push($ivls, $ivl); } } else { if ($req) { $iinfo = $req->GetIntervalInfo(); } else { $iinfo = NULL; } //array(); foreach ($this as $cachewrap) { $cache = $cachewrap->GetCache(); array_push($ivls, $cache->CreateInterval($iinfo)); } } $ivl = new INTERVAL($iinfo); $ivl->ApplyIntervals($ivls); return $ivl; }
function Search($search_string, $module, SEARCHFilter $filter = NULL, $opts = false) { global $ADEI; $xml = $this->GetOption("xml", $opts); $xslt = $this->GetOption("xslt", $opts, "null"); $noprops = $this->GetOption("noprops", $opts); $nolimits = $this->GetOption("nolimits", $opts); $searchprop = $this->GetOption("searchprop", $opts, false); if ($xml) { if (preg_match("/^(services\\/)?([\\w\\d_]+\\.php)(\\?(.*))?\$/", $xml, $m)) { $adei_url = $ADEI->GetBaseURL(); $xml_url = "{$adei_url}services/" . $m[2]; $xml_props = $m[4]; } else { if ($opts && $opts['xml']) { throw new ADEIException(translate("Proxy-search is allowed to ADEI-services only")); } else { list($xml_url, $xml_props) = preg_split("/\\?/", $xml, 2); } } } else { throw new ADEIException(translate("The proxy URL is required by search module")); } if ($noprops) { $props = array(); } else { $props = $this->req->GetProps(); unset($props['search']); unset($props['search_modules']); } if ($filter && !$nolimits) { $ivl_filter = $filter->GetLimit('interval'); if ($ivl_filter) { $props['window'] = $ivl_filter; } } if ($searchprop === false) { $props['search'] = $search_string; } else { if ($searchprop) { $props[$searchprop] = $search_string; } } if ($props) { $req = new REQUEST($props); $xml_props = $req->GetQueryString($xml_props); $xml = $xml_url . "?" . $xml_props; } else { if ($xml_props) { $xml = $xml_url . "?" . $xml_props; } else { $xml = $xml_url; } } $html = $ADEI->TransformXML($xslt, $xml); $result = new SEARCHResults(NULL, $this, $module, ""); $result->Append(preg_replace("/^\\s*<\\?xml.*\$/m", "", $html)); return $result; }
function ADEIServiceGetUpdateInfo(REQUEST $req) { if ($req->CheckData()) { $query = $req->GetQueryString($extra = array("target" => "alarms_summary", "time_format" => "text")); return array("xml" => "services/control.php?{$query}", "xslt" => "alarms"); } return false; }
function ADEIServiceGetUpdateInfo(REQUEST $req) { $query = $req->GetQueryString($extra = array("target" => "get")); $mod = $req->GetProp("infomod"); if ($mod) { return array("xml" => "services/view.php?{$query}", "xslt" => "views/{$mod}"); } return false; }
function GetQueryString(REQUEST $sreq) { global $ADEI_SETUP; $req = $sreq->GetQueryString(); if ($req) $req .= "&"; else $req = ""; $req .= "setup=" . $ADEI_SETUP; return $req; }
function ADEIServiceGetUpdateInfo(REQUEST $req) { global $ADEI; $xslt_file = $ADEI->GetXSLTFile($req->props['module']); if (file_exists($xslt_file)) { $xslt = $req->props['module']; } else { $xslt = "null"; } $query = $req->GetQueryString(); return array("xml" => "services/" . $req->props['module'] . ".php?{$query}", "xslt" => $xslt); }
function ADEIServiceGetUpdateInfo(REQUEST $req) { if ($req->CheckData()) { if ($req->GetProp("target", false)) { $query = $req->GetQueryString($extra = array("time_format" => "text")); } else { $query = $req->GetQueryString($extra = array("target" => "status", "time_format" => "text")); } return array("xml" => "services/control.php?{$query}", "xslt" => "controlinfo"); } return false; }
public function create(REQUEST $request) { $data = $request->input(); $ques = $request->input('ques'); $ans = $request->input('ans'); $id = $request->input('subissue'); $data = new UserEnquries(); $data->questions = $ques; $data->answers = $ans; $data->subissue_id = $id; $data->save(); return View('register.index'); }
function __construct() { parent::__construct(); $this->RESPONSE_ENCODING = REQUEST::GetResponseEncoding(); $this->item_locator = NULL; $this->control_locator = NULL; }
public static function launch() { if (REQUEST::GET("view") != null) { $view = "Nise\\Project\\" . REQUEST::GET("view"); if (class_exists($view)) { $project = new $view(); } } }
public function addToolToInvoice($invoiceID) { try { $toolID = REQUEST::input('tool'); Invoice::addTool($invoiceID, $toolID); return redirect("/invoices/{$invoiceID}"); } catch (Exception $e) { } }
function FindUIDs() { $res = array(); $flags = 0; if ($this->control) { $flags |= REQUEST::CONTROL; } $req = new REQUEST($tmp = array()); $groups = $req->GetGroups($flags); foreach ($groups as $greq) { $list = $greq->GetItemList($flags); foreach ($list as $id => &$item) { if (isset($item["uid"])) { $uid = $item["uid"]; $res[$uid] = $greq->GetProps(); $res[$uid]['db_mask'] = $id; } } } return $res; }
function GetList($search_data, $module, $opts) { $res = array(); $req = new REQUEST($tmp = array()); if ($module == "control" || $module == "control_group" || $module == "control_item") { $sources = $req->GetSources(); $flags = REQUEST::CONTROL; } else { $sources = $req->GetSources(REQUEST::SKIP_UNCACHED | REQUEST::LIST_ALL); $flags = REQUEST::SKIP_UNCACHED; } foreach ($sources as $sreq) { $title = $sreq->GetSourceTitle(); $groupinfo = $sreq->GetGroupList(); $groups = $sreq->GetGroups(NULL, $flags); foreach ($groups as $gid => $greq) { $gtitle = $title . " -- " . $groupinfo[$gid]["name"]; $props = $greq->GetProps(); if ($module == "group" || $module == "control_group") { array_push($res, array('title' => $gtitle, 'props' => $props, 'description' => false, 'name' => $groupinfo[$gid]["name"])); } elseif ($module == "mask") { $list = $greq->GetMaskList(REQUEST::NEED_INFO); foreach ($list as $mid => &$mask) { $mtitle = $mask["name"] . " (Group: {$gtitle})"; $props['db_mask'] = $mask['mask']; array_push($res, array('title' => $mtitle, 'props' => $props, 'description' => false, 'name' => $mask['name'])); } } else { $list = $greq->GetItemList($flags); foreach ($list as $iid => &$item) { $ititle = $item["name"] . " (Group: {$gtitle})"; $props['db_mask'] = $item['id']; array_push($res, array('title' => $ititle, 'props' => $props, 'description' => false, 'name' => $item['name'], 'uid' => $item['uid'])); } } } } return $res; }
function adeiGroupList($props) { $tmp = preg_split("/&(amp;)?/", $props); $p = array(); foreach ($tmp as $pair) { $res = explode("=", $pair); if (sizeof($res) == 2) { $p[$res[0]] = $res[1]; } } $res = ""; $req = new REQUEST($tmp = array()); $sources = $req->GetSources(REQUEST::SKIP_UNCACHED | REQUEST::LIST_ALL); foreach ($sources as $sreq) { if (isset($p["db_server"]) && strcmp($p["db_server"], $sreq->props["db_server"])) { continue; } if (isset($p["db_name"]) && strcmp($p["db_name"], $sreq->props["db_name"])) { continue; } $title = $sreq->GetSourceTitle(); $groupinfo = $sreq->GetGroupList(); $groups = $sreq->GetGroups(NULL, REQUEST::SKIP_UNCACHED); foreach ($groups as $gid => $greq) { if (isset($p["db_group"]) && strcmp($p["db_group"], $gid)) { continue; } $res .= "!!" . xml_escape($title . " -- " . $groupinfo[$gid]["name"]) . "[br]\n"; $res .= "[preview(" . $greq->GetGroupQueryString($props) . "), link]"; $res .= "[br][br][br]\n"; } } return $res; }
<?php global $ADEI; global $ADEI_SETUP; global $fix_time; if (strtolower($_REQUEST['encoding'] == 'text')) { $text = true; } else { $text = false; } $target = $_REQUEST['target']; try { $req = new REQUEST(); $xslt = $req->GetProp('xslt'); } catch (ADEIException $ae) { $xslt = false; } switch ($target) { case "version": if (file_exists("VERSION")) { $stat = stat("VERSION"); $date = date("Ymd", $stat["mtime"]); $version = file_get_contents("VERSION"); if (preg_match("/^\\s*([\\d.]+)\\s*(cvs)?/i", $version, $m)) { $version = $m[1]; if ($m[2]) { $release = 0; } else { $release = 1; } } else {
if ($mod['title']) { $title = xml_escape($mod['title']); $title = "title=\"{$title}\""; } else { $title = ""; } fwrite($out, "<module name=\"{$mod['module']}\" {$title}>"); if ($mod['description']) { fwrite($out, "<description>"); fwrite($out, $mod['description']); fwrite($out, "</description>"); } if ($mod['results']) { fwrite($out, "<results>"); foreach ($mod['results'] as &$r) { $rreq = new REQUEST($r['props']); $props = xml_escape($rreq->GetQueryString()); if ($r['title']) { $title = xml_escape($r['title']); } else { $title = preg_replace("/&/", ",", $props); } $extra = ""; if ($r['certain']) { $extra = " certain=\"1\""; } fwrite($out, "<Value title=\"{$title}\" props=\"{$props}\"{$extra}>"); if ($r['description']) { fwrite($out, "<description>"); fwrite($out, $r['description']); fwrite($out, "</description>");
private static function has_redirect($value, $subview = false) { if (CONFIG::has_attribute($value, "redirect")) { if (!$subview) { self::$allowed_in_view = false; } else { self::$allowed_in_subview = false; } REQUEST::$REDIRECT_URI = trim($value["@attributes"]["redirect"], "/"); } }
public static function apply() { Output\OUTPUT::set_static_file(); if (self::has_attribute(self::get("primary_database")[0], "alias", true)) { CONFIG::$primarydatabase = self::get("primary_database")[0]["@attributes"]["alias"]; } foreach (self::get("rewrite_rules") as $value) { REQUEST::translate($value); } foreach (self::get("links") as $value) { self::set_table_links($value); } if (REQUEST::$is_static == true && !empty(Output\OUTPUT::$static_file)) { Output\OUTPUT::static_file(); } if (REQUEST::redirect()) { header("Location: " . REQUEST::root() . "/" . REQUEST::redirect_uri()); } foreach (self::get("accounttypes") as $value) { ACCOUNT::translate($value); } foreach (self::get("database") as $value) { if (self::has_attribute($value, "alias", true)) { $alias = $value["@attributes"]["alias"]; unset($value["@attributes"]["alias"]); $config = $value["@attributes"]; unset($value["@attributes"]); if (!isset($config["tablelinks"]) && isset(self::$table_links[$alias])) { $config["tablelinks"] = self::$table_links[$alias]; } Database\DATABASE::register_database($alias, $config); foreach (self::get("table") as $subvalue) { if (!self::find_previous_config("table:", $subvalue) && !empty($subvalue)) { if (isset($value["@attributes"]["database_alias"]) && $value["@attributes"]["database_alias"] == $alias) { self::configure_database($subvalue); } } } } } foreach (self::get("form") as $value) { if (self::has_attribute($value, "name", true)) { FORM::translate($value["@attributes"]["name"], $value); } } foreach (self::get("project") as $value) { foreach ($value as $subkey => $subvalue) { if (self::startswith(strtolower($subkey), "include:") && self::has_attribute($subvalue, "file", true)) { $file = $subvalue["@attributes"]["file"]; if (file_exists(self::$projectdir . "/" . $file . ".php")) { include self::$projectdir . "/" . $file . ".php"; } } } } ACCOUNT::set_database_config(); REQUEST::init(); ACCOUNT::access(); if (ACCOUNT::redirect()) { header("Location: " . REQUEST::root() . "/" . REQUEST::redirect_uri()); } REQUEST::access(); }
echo "</menu>"; return; */ function ListExperiments(&$list, &$query) { global $item_tag; global $item_title; foreach ($list as $eid => $exp) { $exp_name = xml_escape($exp["name"]); $equery = $query . "__" . $exp['start'] . "-" . $exp['stop']; $res .= "<{$item_tag} {$item_title}=\"{$exp_name}\" id=\"SetQuery__{$equery}\"/>"; } return $res; } try { $req = new REQUEST(); $list = $req->GetSources(REQUEST::LIST_ALL); $data = ""; $source = ""; foreach ($list as $sreq) { $src_name = xml_escape($sreq->props['db_server'] . "." . $sreq->props['db_name']); $query = $sreq->props['db_server'] . "__" . $sreq->props['db_name']; try { $s_data = "<{$item_tag} {$item_title}=\"{$src_name}\" id=\"SetQuery__{$query}\" withoutImages=\"yes\">"; $s_source = "<{$item_tag} {$item_title}=\"{$src_name}\" id=\"SetSource__{$query}\" withoutImages=\"yes\">"; $reader = $sreq->CreateReader(); $groups = $reader->GetGroupList(); $glist = $sreq->GetGroups(); foreach ($glist as $gid => $greq) { $group =& $groups[$gid]; $gr_name = xml_escape($group['name']);
<?php require "../../adei.php"; try { $req = new REQUEST(); $search = $req->CreateSearcher(); # $res = $search->Search("!\"a b c\" d -e +('f g ' !(!i (k))) | l \"m n\""); # print_r($res); # $res = $search->Search("+sinus | cos1 interval:2006"); # $res = $search->Search(" interval: January 25"); # $res = $search->Search("{interval} January 25"); # $res = $search->Search("sinus"); # $res = $search->Search("January 2005"); # $res = $search->Search("{proxy(xml=http://ipepdvadei/adei/services/katrin.php?target=runs;xslt=katrinsearch)} interval:200-300"); // $res = $search->Search("{proxy(xml=http://localhost/zweb/services/katrin.php?target=runs;xslt=katrinsearch;noprops)}"); // $res = $search->Search("{proxy(xml=http://ipepdvadei.ka.fzk.de/adei/services/katrin.php?target=runs)} interval:200-300"); // $res = $search->Search("Temperatures interval: Jan 1, 2005"); $res = $search->Search("temperature -3624"); print_r($res); } catch (ADEIException $e) { echo "ERROR: " . $e->getInfo(); }
header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); if (isset($_GET["id"])) { $id = $_GET["id"]; } else { try { $req = new DATARequest(); $draw = $req->CreatePlotter(); $draw->Create(); $id = $draw->Save(); } catch (ADEIException $e) { $error = $e->getInfo(); try { if (!$draw) { if (!$req) { $req = new REQUEST(); } $draw = $req->CreateTextPlotter(); } // $draw->CreateMessage("Error", "No Data"); $draw->CreateMessage("Error", $error); $id = $draw->Save(); $error = false; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); } } } if (!$error) { $res = DRAW::Display($id); if (!$res) {
/** * Detach User Product * * Method will detach/remove an attached product from user. * */ public function delete_user_product(REQUEST $request) { $validator = Validator::make($request->all(), ['product_id' => 'required']); if ($validator->fails()) { return response()->json(['success' => '0', 'data' => $this->formatValidationErrors($validator)], 200); } $user = User::find($this->getUserId())->products()->updateExistingPivot($request->product_id, array('status' => '0')); return $this->_output_200(); }
} */ /* $cprops = $props; foreach (array_keys($groups) as $group) { $cprops['db_group'] = $group; $lg = new LOGGROUP($cprops); $zlg = new ZEUSLogGroup($lg); $cache = new CACHE($cprops, $zeus); $cache->Update(); }*/ } catch (ADEIException $e) { $e->logInfo("Backup is failed", $reader ? $reader : $req); $error = $e->getInfo(); } return $error ? $error : 0; } $req = new REQUEST($config); $list = $req->GetSources(); foreach ($list as $sreq) { $opts =& $sreq->GetOptions(); $backup = $opts->Get('backup'); if ($backup) { $err = DoBackup($sreq, $backup); if ($err) { echo $sreq->GetLocationString() . ", Error: {$err}\n"; } } }
function ADEIServiceGetUpdateInfo(REQUEST $req) { $query = $req->GetQueryString(); return array("xml" => "services/" . $req->props['module'] . ".php?{$query}", "xslt" => "settings"); }
function GetGroupList($flags = 0) { if ($flags & REQUEST::LIST_ALL) { return REQUEST::GetGroupList($flags); } $list = array(); if (isset($this->props['db_group'])) { if ($rdr) { $reader =& $rdr; } else { $reader = $this->CreateReader(); } $grp = $reader->CreateGroup($req = array('db_group' => $this->props['db_group'])); $list = $reader->GetGroupInfo($grp, $flags); } else { if ($rdr) { $reader =& $rdr; } else { $reader = $this->CreateReader(); } $list = $reader->GetGroupList($flags); } if ($flags & REQUEST::SKIP_UNCACHED && !$this->srv['virtual']) { $cache = new CACHEDB(); $cached_groups = $cache->ListCachedGroups($this->props['db_name'], $this->props['db_server']); # print_r($list); # print_r($cached_groups); foreach (array_keys($list) as $key) { if (!in_array($list[$key]['gid'], $cached_groups)) { unset($list[$key]); } } } if ($list) { foreach ($list as &$gr) { $gr['db_group'] = $gr['gid']; $gr['db_group_name'] = $gr['name']; } } return $list; }
<?php global $ADEI_TIMINGS; global $EXPORT_SAMPLING_RATES; global $EXPORT_FORMATS; header("Content-type: text/xml"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); global $ADEI_INFO_MODULES; define("OUTPUT_LIST_MODE", 1); define("OUTPUT_XML_MODE", 2); define("OUTPUT_UPDATE_MODE", 3); try { $req = new REQUEST($_GET); switch ($req->props['type']) { case "": case "info": $modules =& $ADEI_INFO_MODULES; $argument = "infomod"; break; default: throw new ADEIException(translate("Unknown view type (%s) is specified", $_GET['target'])); } switch ($req->props['target']) { case 'list': $mode = OUTPUT_LIST_MODE; break; case 'update_options': case 'update': $mode = OUTPUT_UPDATE_MODE; break;
<?php require "../../adei.php"; header("Content-type: application/json"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); $_POST['props'] = "{\"db_server\": \"autogen\", \"db_name\": \"minutely\", \"db_group\": \"default\", \"db_mask\": \"6\", \"experiment\": \"0-0\", \"window\": \"1104537600-1262304000,-2:2\", \"width\": 1024, \"height\": 768, \"hide_axes\": 0, \"show_gaps\": \"POINTS\"}"; try { $req = new REQUEST(); if ($req->CheckData()) { $req = $req->CreateDataRequest(); $time[1] = gettimeofday(true); $draw = $req->CreatePlotter(); // print_r($draw->cache->req); $time[2] = gettimeofday(true); $draw->Create(); $time[3] = gettimeofday(true); $file = $draw->Save(); $time[4] = gettimeofday(true); $scale = $draw->GetScaleInfo(); $time[5] = gettimeofday(true); foreach ($time as $i => $tm) { echo $tm . " - " . $i . "\n"; } echo "Main computations: " . ($time[4] - $time[3]) . "\n"; echo time() . " - 3\n"; echo time() . " - Starting\n"; } } catch (ADEIException $e) { $error = $e->getMessage(); }
} else { throw new ADEIException(translate("The source is not specified")); } } $pos = array_search("-parallel", $_SERVER['argv']); if ($pos) { if ($source_param) { throw new ADEIException(translate("The source can't be specified in the parallel mode")); } unset($_SERVER['argv'][$pos]); $partype = "sources"; if ($pos + 1 < $params && substr($_SERVER['argv'][$pos + 1], 0, 1) != "-") { $partype = $_SERVER['argv'][$pos + 1]; unset($_SERVER['argv'][$pos + 1]); } $req = new REQUEST(); switch ($partype) { case "servers": $list = $req->GetServerList(); break; case "sources": $list = $req->GetSourceList($list_flags); break; case "groups": $list = $req->GetGroupList($list_flags); break; default: throw new ADEIException(translate("Unsupported type of parallelization (%s)", $partype)); } $params = implode(" ", $_SERVER['argv']); chdir($curdir);
<?php header("Content-type: image/png"); $req = new REQUEST(); $w = $req->CreateImageHelper(); $w->Create(); $id = $w->Save(); $w->Display($id);