// Controller "includes" & reads all of your database connections // & business logic for this app // include "models/Views.Class.php"; include "models/CreateData.Class.php"; include "models/ReadData.Class.php"; include "models/UpdateData.Class.php"; include "models/DeleteData.Class.php"; include "models/Login.Class.php"; include "models/DBCredentials.php"; // Instantiate and make new copies of you Classes inside files above // Store in variables so that we can work with them later $views = new Views(); $create = new CreateData(); $read = new ReadData(); $update = new UpdateData(); $delete = new DeleteData(); $login = new Login(); // Controller starts routing the user based on the form "action" from Views; //Process if the action is not empty, if so move to next if statement //if statements act like switches for when a neccesary model is called upon from user at view //selected action can be seen in url // ! its important to have consistent $salt phrase unless database connection won't work for retrival if (!empty($_GET["action"])) { if ($_GET["action"] == "home") { //Shows Header & Both Forms; Then, show footer $views->getView("views/header.php"); $views->getView("views/signup_form.php"); $views->getView("views/login_form.php"); $views->getView("views/footer.php"); }
} print_r($metaData); } $title = preg_replace("/[^a-z0-9]+/i", " ", $repoName); $url = $repo['homepage'] ? $repo['homepage'] : ($metaData['uri'] ? $metaData['uri'] : $metaData['url']); if ($url && substr(strtolower($url), 0, 4) != "http") { $url = 'http://' . $url; } $screenshot_file = ""; if ($url && !$image) { $screenshot_file = "screenshots/{$repoName}.jpg"; if (!file_exists($screenshot_file)) { echo "- creating screenshot: {$url} => screenshots/{$repoName}.jpg\n"; $create = `phantomjs update-screenshot.js {$url} screenshots-large/{$repoName}.png`; $some = `convert screenshots-large/{$repoName}.png -background white -resize 600x -crop 600x400+0+0 -strip -quality 80 {$screenshot_file}`; } else { echo "-screenshot already there.\n"; } if (file_exists($screenshot_file)) { $image = $screenshot_file; } } $allRepos[$repoName] = ['updated_at' => $repo['updated_at'], 'created_at' => $repo['created_at'], 'description' => $repo['description'], 'name' => $repoName, 'title' => $title, 'total_tasks' => $total, 'closed_tasks' => $closed, 'users' => $users, 'image' => $image, 'html_url' => $repo['html_url'], 'url' => $url, 'forum' => $metaData['forum'], 'status' => $metaData['status'], 'meta' => $metaData]; print_r($allRepos[$repoName]); } usort($allRepos, 'repoSort'); file_put_contents("json/repos_meta.json", json_encode($allRepos)); } } $class = new UpdateData(); $class->run($argv[1]);