start( $_POST['username'], $_POST['password'] ); } elseif ( !isset($_SESSION['shell']) ) { $_SESSION['shell'] = new Shell(); $_SESSION['shell']->printLogin(); } // make things easier for devs by making $_SESSION['shell'] available at simply $shell. $shell = $_SESSION['shell']; if ( !isset($_SESSION['display']) ) { $_SESSION['display'] = new Display(); } else { $_SESSION['display']->clear(); } $display = $_SESSION['display']; // grab any cookie data, if there is any /* if (isset($_COOKIE['helga'])) { $_SESSION['cookie_data'] = unserialize($_COOKIE['helga']); } */ // set up the current project info. // if we're being passed a projectId, we're being asked to switch to that project. // if the session contains no current project, try obtain a default project from // the current user. otherwise, the user is not switching projects and already has // a current project, so do nothing. if ( isset( $_REQUEST['projectId'] ) ) { $_SESSION['projectId'] = $_REQUEST['projectId']; try { $baseName = $shell->exec('::helga::assets::getBaseNameFromId ' . $_SESSION['projectId']); $_SESSION['projectName'] = $baseName; $_SESSION['projectFullName'] = $shell->exec('hget attr fullName -name ' . $_SESSION['projectName']); } catch (Exception $e) { $display->add($e->getMessage()); $display->printHtml(); exit; } $display->getShowPrivs(); } elseif ( !isset( $_SESSION['projectId'] ) ) { try { $_SESSION['projectName'] = $shell->exec('hget attr defaultProject -name /users/guest'); $info = $shell->decode($shell->exec('hget attr assetId,fullName -web -name ' . $_SESSION['projectName'])); } catch (Exception $e) { $display->add($e->getMessage()); $display->printHtml(); exit; } $_SESSION['projectId'] = $info[0]; $_SESSION['projectFullName'] = $info[1]; $display->getShowPrivs(); } ?>