<?php $filename = filename(__FILE__); $github = \shgysk8zer0\Core\resources\Parser::parseFile('github.json'); $PDO = new \shgysk8zer0\Core\PDO($github); $parser = new \Parsedown\Parsedown(); $start = (array_key_exists('commit_start', $_REQUEST) and is_numeric($_REQUEST['commit_start'])) ? abs((int) $_REQUEST['commit_start']) : 0; $end = $start + 10; $commits = $PDO("SELECT\n\t\t\t`SHA`,\n\t\t\t`Branch`,\n\t\t\t`Commit_URL` AS `URL`,\n\t\t\t`Commit_Message` AS `Message`,\n\t\t\t`Author_Username` AS `Author`,\n\t\t\t`Author_Email` AS `Email`,\n\t\t\t`Time` AS `Timestamp`\n\t\tFROM `Commits`\n\t\tWHERE `Branch` = 'refs/heads/master'\n\t\tORDER BY `Timestamp`\n\t\tDESC\n\t\tLIMIT {$start}, 10;"); array_walk($commits, function (\stdClass &$commit) { $commit->Message = mb_convert_encoding($commit->Message, 'utf-8'); $commit->Message = explode(PHP_EOL, $commit->Message); }); ?> <dialog id="<?php echo $filename; ?> _dialog"> <button type="button" data-delete="#<?php echo $filename; ?> _dialog"></button> <br /> <table border="1"> <caption> Recent commits to <a href="<?php echo $github->repository->html_url; ?> "> <?php
require_login('admin'); if (array_key_exists('prompt_value', $_POST) and strlen($_POST['prompt_value'])) { $command = 'git ' . escapeshellcmd($_POST['prompt_value']); $result = `{$command}`; $resp->notify($command, $result, 'images/logos/git.png'); } break; case 'recent_commits': $resp->remove('#recent_commits_dialog, .backdrop')->append('body', load_results('recent_commits'))->showModal('#recent_commits_dialog'); break; case 'github_issues': $resp->append('body', load_results('github_issues'))->showModal('#github_issues_dialog'); break; case 'README': $readme = new \shgysk8zer0\Core\File('README.md'); $parser = new \Parsedown\Parsedown(); $dialog = new \shgysk8zer0\Core\Elements\Dialog('README', $parser->text($readme)); $resp->append('body', $dialog)->showModal($dialog->id); break; case 'update_icons': require_login('admin'); $icons = \shgysk8zer0\Core\resources\Parser::parseFile('icons.json'); $found = array_filter(array_unique($icons->icons), 'file_exists'); if (count($found) === count($icons->icons)) { if (SVG_symbols($icons->icons, $icons->output)) { $resp->notify('Success!', "Icons have been saved to {$icons->output}"); } else { $resp->notify('We have a problem :(', 'Was unable to update combined SVG due to an error parsing or saving the file', 'images/octicons/svg/bug.svg'); } } else { $resp->notify('We have a problem :(', 'Some icons are missing. Check your browser\'s log', 'images/octicons/svg/bug.svg')->log(['Icons' => $icons, 'Found' => $found, 'Missing' => array_diff($icons->icons, $found)]);
function get_readme() { $parsedown = new \Parsedown\Parsedown(); return $parsedown->text(file_get_contents(README)); }
<?php $file = filename(__FILE__); $github = \shgysk8zer0\Core\Resources\Parser::parseFile('github.json'); $PDO = new \shgysk8zer0\Core\PDO($github); $parser = new \Parsedown\Parsedown(); if (!$PDO->connected) { return; } $issues = $PDO->prepare("SELECT `Number`,\n\t\t\t`Repository` AS `repo`,\n\t\t\t`Repository_URL` AS `repo_url`,\n\t\t\t`Title`,\n\t\t\t`Body`,\n\t\t\t`URL`,\n\t\t\t`Labels`,\n\t\t\t`Assignee`,\n\t\t\t`Milestone`,\n\t\t\t`Milestone_URL`,\n\t\t\t`Created_At` AS `Created`,\n\t\t\t`Updated_At` AS `Updated`\n\t\tFROM `Issues`\n\t\tWHERE `State` = :state\n\t\tORDER BY `Created` ASC;")->execute(['state' => 'open'])->getResults(); $new_issue = "<a href=\"https://github.com/{$github->repository->full_name}/issues/new\" target=\"_blank\" title=\"New\" role=\"button\" data-icon=\"+\"></a>"; ?> <dialog id="<?php echo $file; ?> _dialog"> <button type="button" data-delete="#<?php echo $file; ?> _dialog"></button><br /> <table border="1"> <caption> <?php echo count($issues); ?> Open Issues on <a href="<?php echo $github->repository->html_url; ?> " target="_blank"><?php echo $github->repository->name; ?>
require_login('admin'); if (array_key_exists('prompt_value', $_POST) and strlen($_POST['prompt_value'])) { $command = 'git ' . escapeshellcmd($_POST['prompt_value']); $result = `{$command}`; $resp->notify($command, $result, 'images/logos/git.png'); } break; case 'recent_commits': $resp->remove('#recent_commits_dialog, .backdrop')->append('body', load_results('recent_commits'))->showModal('#recent_commits_dialog'); break; case 'github_issues': $resp->append('body', load_results('github_issues'))->showModal('#github_issues_dialog'); break; case 'README': $readme = new \shgysk8zer0\Core\File('README.md'); $parser = new \Parsedown\Parsedown(); $resp->append('body', '<dialog id="README_dialog"> <button data-delete="#README_dialog"> </button><br />' . $parser->text($readme) . '</dialog>')->showModal('#README_dialog'); break; case 'update_icons': require_login('admin'); $icons = \shgysk8zer0\Core\resources\Parser::parseFile('icons.json'); $found = array_filter(array_unique($icons->icons), 'file_exists'); if (count($found) === count($icons->icons)) { if (SVG_symbols($icons->icons, $icons->output)) { $resp->notify('Success!', "Icons have been saved to {$icons->output}"); } else { $resp->notify('We have a problem :(', 'Was unable to update combined SVG due to an error parsing or saving the file', 'images/octicons/svg/bug.svg'); } } else {