die('fail<!--separate-->' . $q); break; case 'loadissue': $o = new DbIO('FIssue'); if ($args->args->issueid > 0) { $o->Load($args->args->issueid); if ($o->ID > 0) { $std = new stdClass(); $fields = array('ID', 'IssueID', 'Subject', 'ShortDesc', 'Description', 'Reproduce', 'Status'); foreach ($fields as $fl) { $std->{$fl} = $o->{$fl}; } die('ok<!--separate-->' . json_encode($std)); } } break; case 'deleteissue': $o = new DbIO('FIssue'); if ($args->args->issueid > 0) { $o->Load($args->args->issueid); if ($o->ID > 0) { if ($o->UserID == $User->ID) { $o->Delete(); die('ok<!--separate-->' . json_encode($std)); } } } die('fail<!--separate-->'); break; } die('fail');
// List available systems stored for the current user // List available systems stored for the current user case 'filesystem': if ($row = $SqlDatabase->FetchObject(' SELECT * FROM Filesystem WHERE UserID=\'' . $User->ID . '\' AND ID=\'' . intval($args->args->id) . '\' LIMIT 1 ')) { die('ok<!--separate-->' . json_encode($row)); } break; case 'addfilesystem': $obj = $args->args; if (isset($obj->Name) && strlen($obj->Name) > 0) { $fs = new DbIO('Filesystem'); $fs->Name = $obj->Name; $fs->UserID = $User->ID; if (!$fs->Load()) { $SqlDatabase->query(' INSERT INTO Filesystem ( `Name`, `UserID`, `Server`, `Port`, `Path`, `Type`, `ShortDescription`, `Username`, `Password`, `Mounted` ) VALUES ( "' . mysql_real_escape_string($obj->Name) . '", "' . $User->ID . '", "' . mysql_real_escape_string($obj->Server) . '", "' . intval($obj->Port, 10) . '", "' . mysql_real_escape_string($obj->Path) . '", "' . mysql_real_escape_string($obj->Type) . '", "' . mysql_real_escape_string($obj->ShortDescription) . '",
function createFolder($folderName, $where) { global $Config, $User, $Logger; // New folder $nfo = new DbIO('FSFolder'); $nfo->UserID = $User->ID; $nfo->FilesystemID = $this->ID; // Remove file from path $subFolder = $where; if (strstr($subFolder, ':')) { $subFolder = end(explode(':', $subFolder)); } if (substr($subFolder, -1, 1) == '/') { $subFolder = substr($subFolder, 0, strlen($subFolder) - 1); } if (strstr($subFolder, '/')) { $subFolder = explode('/', $subFolder); array_pop($subFolder); $subFolder = implode('/', $subFolder) . '/'; } if ($fo = $this->getSubFolder($subFolder)) { $nfo->FolderID = $fo->ID; } else { $nfo->FolderID = '0'; } // Get the correct name $nfo->Name = $folderName; // Save $nfo->Save(); // Check save result if ($nfo->ID > 0) { return true; } return false; }