GetProjectsAction.class.php 561 B

1234567891011121314151617
  1. <?php
  2. class GetProjectsAction implements IAction {
  3. public function execute() {
  4. if(!Authorize::isLoggedIn()) {
  5. return array("error" => "Access not authorized");
  6. }
  7. $database = SqliteDatabase::getSingleton();
  8. $projects = $database->queryArray("SELECT rowid AS project_id, * FROM projects WHERE project_id IN (SELECT project_id FROM account_projects WHERE account_id = ".$_SESSION['client_id'].");");
  9. return array("projects" => $projects);
  10. }
  11. private function isLoggedIn() {
  12. return isset($_SESSION['authorized']) && $_SESSION['authorized'];
  13. }
  14. }