function internal_error($type, $msg = "") { if ($msg == "") { $msg = $type; } header('FirePHP-Data: {"msg":"' . str_replace("\n", "", addslashes($msg)) . '"}'); $p = new intOutput(); $p->set($type); error_log("Lucid Error: " . $type . " (" . $msg . ")"); die; }
function _checkUserQuota() { $quota = $this->_checkUserQuota1(); $current = $this->_getSize($this->_basePath("/")); if ($current >= $quota) { if ($quota == 0) { return 0; } //no quota $blah = new intOutput(); $blah->set("quota_exceeded"); die; } return true; }
if ($_GET['action'] == "save") { $p = $User->get_current(); if ($p == false) { internal_error("generic_err", "user not logged in"); } $result = $Config->filter("userid", $p->id); if ($result == false) { $u = new $Config(array(userid => $p->id)); } else { $u = $result[0]; } $u->value = $_POST['value']; $u->save(); if ($_POST['logged'] == true) { $p->logged = true; $p->save(); } $out = new intOutput(); $out->set("ok"); } if ($_GET['action'] == "load") { $p = $User->get_current(); $result = $Config->filter("userid", $p->id); if ($result == false) { echo "{}"; } else { $result = $result[0]; echo $result->value; } } }