if (empty($_SERVER['HTTP_X_GITHUB_EVENT']) || empty($_SERVER['HTTP_X_HUB_SIGNATURE'])) { CoreUtils::notFound(); } $payloadHash = hash_hmac('sha1', file_get_contents('php://input'), GH_WEBHOOK_SECRET); if ($_SERVER['HTTP_X_HUB_SIGNATURE'] !== "sha1={$payloadHash}") { CoreUtils::notFound(); } switch (strtolower($_SERVER['HTTP_X_GITHUB_EVENT'])) { case 'push': $output = array(); chdir(PROJPATH); exec("git reset HEAD --hard", $output); exec("git pull", $output); $output = implode("\n", $output); if (empty($output)) { HTTP::statusCode(500, AND_DIE); } $arr[] = "\n"; exec("composer update --no-dev 2>&1", $arr); $output .= implode("\n", $arr); echo $output; break; case 'ping': echo "pong"; break; default: CoreUtils::notFound(); } exit; } CoreUtils::notFound();
/** * Display a 404 page */ static function notFound() { if (POST_REQUEST || isset($_GET['via-js'])) { $RQURI = rtrim(str_replace('via-js=true', '', $_SERVER['REQUEST_URI']), '?&'); Response::fail("HTTP 404: " . (POST_REQUEST ? 'Endpoint' : 'Page') . " ({$RQURI}) does not exist"); } HTTP::statusCode(404); global $do; $do = '404'; self::loadPage(array('title' => '404', 'view' => '404')); }
$exists = 'exists on DeviantArt'; if (isset($un)) { $exists = "<a href='http://{$un}.deviantart.com/'>{$exists}</a>"; } $SubMSG = "If this user {$exists}, sign in to import their details."; } } $canEdit = $sameUser = false; } else { $sameUser = $signedIn && $User->id === $currentUser->id; $canEdit = !$sameUser && Permission::sufficient('staff') && Permission::sufficient($User->role); $pagePath = "/@{$User->name}"; CoreUtils::fixPath($pagePath); } if (isset($MSG)) { HTTP::statusCode(404); } else { if ($sameUser) { $CurrentSession = $currentUser->Session; $Database->where('id != ?', array($CurrentSession['id'])); } $Sessions = $Database->where('user', $User->id)->orderBy('lastvisit', 'DESC')->get('sessions', null, 'id,created,lastvisit,platform,browser_name,browser_ver,user_agent,scope'); } $settings = array('title' => !isset($MSG) ? ($sameUser ? 'Your' : CoreUtils::posess($User->name)) . ' ' . ($sameUser || $canEdit ? 'account' : 'profile') : 'Account', 'no-robots', 'do-css', 'js' => array('user')); if ($canEdit) { $settings['js'][] = 'user-manage'; } $showSuggestions = $User->getPendingReservationCount() < 4; if ($showSuggestions) { $settings['js'][] = 'user-suggestion'; $settings['css'][] = 'user-suggestion';