return array("id" => $user->id, "name" => $user->name, "username" => $user->username, "email" => $user->email, "lastauth" => $user->lastauth, "logged" => $user->logged, "exists" => true); } else { return array("exists" => false); } } $info = Zend_Json::decode($_POST['users']); $arr = array(); foreach ($info as $item) { array_push($arr, core_user_get($item)); } $out = new JsonOutput($arr); } if ($_GET['action'] == "isAdmin") { $u = $User->get_current(); $out = new jsonOutput(); $out->append("isAdmin", $u->has_permission("core.administration")); } if ($_GET['action'] == "set") { $id = $_POST['id']; $info = array(); $cur = $User->get_current(); if (is_numeric($id) && $cur->has_permission("core.administration")) { $user = $User->get($id); if ($user === false) { internal_error("generic_err"); } } else { if (is_numeric($id)) { internal_error("permission_denied"); } else { $user = $cur;
} if ($act == "checkpermissions") { $dirs = array("../backend/", "../files/", "../public/", "../tmp/", "../desktop/dojotoolkit/lucid/resources/themes/", "../desktop/dojotoolkit/lucid/apps/"); $out = new jsonOutput(); foreach ($dirs as $dir) { $key = str_replace("../", "", $dir); if (!is_writable($dir)) { $out->append($key, "not writable (chmod to 777 or chown to webserver's user)"); } else { $out->append($key, "ok"); } } } if ($act == "checkenvironment") { $out = new jsonOutput(); if (file_exists("../backend/configuration.php")) { $out->append("Checking for any existing configuration...", "warn: Existing configuration found, continuing will overwrite."); } else { $out->append("Checking for any existing configuration...", "ok: None found."); } if (function_exists("ftp_connect")) { $out->append("Checking for FTP support...", "ok: FTP Supported"); } else { $out->append("Checking for FTP support...", "warn: FTP Not Supported - FTP will not be functional"); } if (function_exists("ssh2_connect")) { $out->append("Checking for SFTP support...", "ok: SFTP Supported"); } else { $out->append("Checking for SFTP support...", "warn: SFTP Not Supported - SFTP will not be functional"); } }
$app = $p[0]; } foreach (array('name', 'author', 'email', 'version', 'maturity', 'category') as $item) { if (isset($_POST[$item])) { $app->{$item} = $_POST[$item]; } } $app->save(); //} if (isset($_POST['filename'])) { $_POST['filename'] = str_replace("..", "", $_POST['filename']); file_put_contents($GLOBALS['path'] . "/../desktop/dojotoolkit/lucid/apps/" . $_POST['filename'], $_POST['content']); } $out = new jsonOutput(array("status" => "ok")); if ($app) { $out->append("sysname", $app->sysname); } } if ($_GET['action'] == "createFolder") { import("models.user"); $user = $User->get_current(); if (!$user->has_permission("core.app.write")) { internal_error("permission_denied"); } $_POST['dirname'] = str_replace("..", "", $_POST['dirname']); mkdir($GLOBALS['path'] . "/../desktop/dojotoolkit/lucid/apps/" . $_POST['dirname'], 0777); $out = new intOutput("ok"); } if ($_GET['action'] == "remove") { function rmdir_recurse($file) {
array_push($val, $o); } $out->set($val); } if ($_GET['action'] == "online") { $online = 0; $total = 0; $p = $User->all(); foreach ($p as $u) { $total++; if ($u->logged == 1) { $online++; } } $o = new jsonOutput(); $o->append("online", $online); $o->append("total", $total); } } if ($_GET['section'] == "quota") { if ($_GET['action'] == "list") { import("models.quota"); $list = $Quota->all(); $fin = array(); foreach ($list as $item) { array_push($fin, array("type" => $item->type, "size" => $item->size)); } $out = new jsonOutput($fin); } if ($_GET['action'] == "set") { import("models.quota");