function save()
 {
     $data = $this->input->post();
     $dm = new DataManager($this->dm_profile);
     if ($dm->save($data) === false) {
         var_dump($dm->getErrors());
         exit;
     }
     redirect('/' . $this->controller);
 }
Пример #2
0
                 } catch (dbx\Exception $ex) {
                     error_log("/dropbox-auth-finish: error communicating with Dropbox API: " . $ex->getMessage());
                     respondWithError(500, "Internal Server Error");
                     exit;
                 }
                 // NOTE: A real web app would store the access token in a database.
                 $_SESSION['access-token'] = $accessToken;
                 $_user = new DataManager('User');
                 $_user->setField('userName', 'HackTheVisual');
                 $_user->setField('session', $accessToken);
                 $_user->save();
                 $_folder = new DataManager('Picture');
                 $_folder->setField('idUser', 1);
                 $_folder->setField('path', '/Pictures');
                 $_folder->setField('isFolder', true);
                 $_folder->save();
                 header('Location: ' . getPath(""));
                 echo renderHtmlPage("Authorized!", "Auth complete, <a href='" . htmlspecialchars(getPath("")) . "'>click here</a> to browse.");
             } else {
                 if ($requestPath === "/dropbox-auth-unlink") {
                     // "Forget" the access token.
                     unset($_SESSION['access-token']);
                     echo renderHtmlPage("Unlinked.", "Go back <a href='" . htmlspecialchars(getPath("")) . "'>home</a>.");
                 } else {
                     echo renderHtmlPage("Bad URL", "No handler for {$requestPath}");
                     exit;
                 }
             }
         }
     }
 }