$val) { $msg .= $key . ': ' . $val . "\n"; } $msg .= 'GET' . "\n" . '=======' . "\n"; foreach ($_GET as $key => $val) { $msg .= $key . ': ' . $val . "\n"; } $msg .= "\n\n" . 'POST' . "\n" . '=======' . "\n"; foreach ($_POST as $key => $val) { $msg .= $key . ': ' . $val . "\n"; } $msg .= "\n\n" . 'SERVER' . "\n" . '=======' . "\n"; foreach ($_SERVER as $key => $val) { $msg .= $key . ': ' . $val . "\n"; } //mail('dan@skybluecreations.com', '500 Error [Paperless Wedding UK]', $msg); header("Location: /500.php?uri=" . urlencode($_SERVER['REQUEST_URI'])); # from /error-capture, you can use another redirect, to e.g. home page } } //register_shutdown_function('shutdown'); } // check cms is installed? if (!(PHP_SAPI === 'cli') && !file_exists(PROJECT_ROOT . '/cms/.installed')) { header('Location: https://cms.paperlesswedding.com/wizard.php'); die(); } require_once INCLUDE_ROOT . 'global_functions.php';// require the global functions for templates to hook into the class if (file_exists($_GLOBAL['SITE_ROOT'] . '/templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/functions.php')) { include_once $_GLOBAL['SITE_ROOT'] . '/templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/functions.php'; } $minimize = new \Paperless\Utility\Minimize(); // make class instance // load dynamic scripts, i.e css, js, images /*if (isset($_GET['dynamic_load'])) { header("Cache-Control: private, max-age=604800, pre-check=10800"); header("Pragma: private"); header("Expires: " . gmdate('D, d M Y H:i:s', strtotime('+1 months')) . " GMT"); if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { // if the browser has a cached version of this image, send 304 header('Last-Modified: ' . $_SERVER['HTTP_IF_MODIFIED_SINCE'], true, 304); exit; } if ($_GET['dynamic_load'] === 'scripts') { $script = $_GET['resource']; $parts = pathinfo($script); $path = null; if (array_key_exists('extension', $parts)) { switch ($parts['extension']) { case 'css': header('Content-type: text/css'); $path = 'css'; break; case 'js': header('Content-type: text/javascript'); $path = 'js'; break; default: die('CSS, JS Only.'); } } $file = 'templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/assets/' . $path . '/' . (($parts['dirname'] === '.') ? null : $parts['dirname'] . '.') . $parts['basename']; if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == filemtime($file))) { // send the last mod time of the file back header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT', true, 304); exit; } if (!file_exists($file)) { header("HTTP/1.0 404 Not Found"); die(); } $content = file_get_contents($file); print($content); die(); } if ($_GET['dynamic_load'] === 'images') { $image = $_GET['resource']; $parts = pathinfo($image); if (array_key_exists('extension', $parts)) { switch ($parts['extension']) { case 'gif': header('Content-type: image/gif'); break; case 'jpeg': case 'jpg': header('Content-type: image/jpeg'); break; case 'png': header('Content-type: image/png'); break; case 'svg': header('Content-type: image/svg+xml'); break; default: die('Images Only.'); } } $file = 'templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/assets/images/' . (($parts['dirname'] === '.') ? null : $parts['dirname'] . '/') . $parts['basename']; if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == filemtime($file))) { // send the last mod time of the file back header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT', true, 304); exit; } if (!file_exists($file)) { header("HTTP/1.0 404 Not Found"); die(); } $content = file_get_contents($file); print($content); die(); } }*/ if (isset($_GET['cron']) && $_GET['cron'] === 'rem_sending') { $_GET['debug'] = 1; } // finish load dynamic scripts /** @var \Paperless\Planner\Frontend\Site $site */ $site = $container->get('legacy:frontend:site'); try { // throw new \RuntimeException('Testing Rollbar Person'); } catch (\Exception $e) { // \Rollbar\Rollbar::log(\Rollbar\Payload\Level::ERROR, $e); } if (php_sapi_name() === 'cli') { require 'cli.php'; die('1'); } $cache = new \Paperless\Utility\FileCache($site); ob_start(); if (isset($site->get_sitemap)) { header('Content-type: application/xml'); echo ''; ?> monthly 0.8 'id', 'val' => '0', '_operator' => ' <> '); $sql_order['direction'] = 'DESC'; $sql_order['val'] = 'date_edited'; $items = $site->getList('pages', 0, 99999, $sql_where, $sql_order, true); if ($items) { foreach ($items as $key => $val) { if ($val['published_to'] === '["57"]') { continue; } ?> generateLink($val) ?> monthly 0.5 get_preview) && !isset($site->get_category)) { $link = $site->generateLink($site->get_preview, true); header('Location: ' . $link . '?preview'); die(); } /** @var \MagmaSoftwareEngineering\Rollout\Rollout\GroupDefinitionAwareRollout $rollout */ if (isset($site->get_webhook) && !$rollout->isActive(FEATURE_NOTIFICATION_INBOUND_SENDGRID, $container->get('service:userType')) ) { $sendGrid = $container->get('settings')['sendGrid']; $debug = false; if (!empty($sendGrid['debug']) && $sendGrid['debug'] === true) { $debug = true; $logger->debug('SendGrid: Legacy: Start'); /** @var \Slim\Http\Request $request */ $request = $container->get('request'); $logger->debug('SendGrid response: Content-Type: ' . $request->getContentType()); } $path = __DIR__ . DIRECTORY_SEPARATOR . 'webhooks'; $filename = 'webhook-test-' . time() . '.txt'; if ($debug) { $logger->debug('SendGrid: Webhook', ['path' => $path, 'filename' => $filename]); } $rawPostData = file_get_contents('php://input'); $fp = fopen($path . DIRECTORY_SEPARATOR . $filename, 'ab'); fwrite($fp, "\n" . 'get' . "\n"); fwrite($fp, json_encode($_GET)); fwrite($fp, "\n" . 'post' . "\n"); fwrite($fp, $rawPostData); fclose($fp); $response = json_decode($rawPostData); foreach ($response as $hook) { if (!isset($hook->sendhash) || !strpos($hook->sendhash, '-')) { continue; } // Hashes were interested in are like INVITATION-X04DZ7G1A7QG5WPGKG45A9OL list($type) = explode('-', $hook->sendhash); if ($type === 'STD') { $manageArray = []; $manageArray[] = ['key' => 'action', 'val' => $hook->event]; $manageArray[] = ['key' => 'sendhash', 'val' => $hook->sendhash]; $manageArray[] = ['key' => 'email', 'val' => $hook->email]; $manageArray[] = ['key' => 'date_created', 'val' => date('Y-m-d H:i:s', $hook->timestamp)]; $reason = ''; if ($hook->event === 'dropped' || $hook->event === 'bounce') { $reason = $hook->reason; } $manageArray[] = ['key' => 'reason', 'val' => $reason]; $args = ['operator' => 'insert', 'table' => 'std_webhooks', 'data' => $manageArray]; $res = $site->query($args); } if ($type === 'MARKETING') { $manageArray = []; $manageArray[] = ['key' => 'action', 'val' => $hook->event]; $manageArray[] = ['key' => 'date_created', 'val' => date('Y-m-d H:i:s', $hook->timestamp)]; if ($hook->event === 'dropped' || $hook->event === 'bounce') { $manageArray[] = ['key' => 'reason', 'val' => $hook->reason]; } $args = [ 'operator' => 'update', 'table' => 'marketing_completed', 'data' => $manageArray, 'where' => [ '_relation' => 'AND', ['key' => 'email', 'val' => $hook->email, '_operator' => '='], ['key' => 'sendhash', 'val' => $hook->sendhash, '_operator' => '='] ] ]; $res = $site->query($args); } if ($type === 'INVITATION') { if ($hook->event === 'processed') { $manageArray = []; $manageArray[] = ['key' => 'sent', 'val' => '1']; $manageArray[] = ['key' => 'sent_date', 'val' => date('Y-m-d H:i:s', $hook->timestamp)]; $args = [ 'operator' => 'update', 'table' => 'guests', 'data' => $manageArray, 'where' => [ '_relation' => 'AND', ['key' => 'email', 'val' => $hook->email, '_operator' => '='], ['key' => 'sendhash', 'val' => $hook->sendhash, '_operator' => '='] ] ]; $res = $site->query($args); } if ($hook->event === 'delivered') { $manageArray = []; $manageArray[] = ['key' => 'delivered', 'val' => '1']; $manageArray[] = ['key' => 'delivered_date', 'val' => date('Y-m-d H:i:s', $hook->timestamp)]; $args = [ 'operator' => 'update', 'table' => 'guests', 'data' => $manageArray, 'where' => [ '_relation' => 'AND', ['key' => 'email', 'val' => $hook->email, '_operator' => '='], ['key' => 'sendhash', 'val' => $hook->sendhash, '_operator' => '='] ] ]; $res = $site->query($args); } if ($hook->event === 'open' || $hook->event === 'click') { $manageArray = []; $manageArray[] = ['key' => 'opened', 'val' => '1']; $manageArray[] = ['key' => 'opened_date', 'val' => date('Y-m-d H:i:s', $hook->timestamp)]; $args = [ 'operator' => 'update', 'table' => 'guests', 'data' => $manageArray, 'where' => [ '_relation' => 'AND', ['key' => 'email', 'val' => $hook->email, '_operator' => '='], ['key' => 'sendhash', 'val' => $hook->sendhash, '_operator' => '='] ] ]; $res = $site->query($args); } if ($hook->event === 'dropped' || $hook->event === 'bounce') { $manageArray = []; $manageArray[] = ['key' => 'rejected', 'val' => '1']; $manageArray[] = ['key' => 'rejected_reason', 'val' => $hook->reason]; $args = [ 'operator' => 'update', 'table' => 'guests', 'data' => $manageArray, 'where' => [ '_relation' => 'AND', ['key' => 'email', 'val' => $hook->email, '_operator' => '='], ['key' => 'sendhash', 'val' => $hook->sendhash, '_operator' => '='] ] ]; $res = $site->query($args); $sql = "SELECT * FROM `guests` WHERE `sendhash`='" . $hook->sendhash . "' AND `email`='" . $hook->email . "'"; $guest = $site->runQuery($sql); if (empty($guest[0])) { header('Content-Type: application/json'); die(json_encode(['message' => 'Guest not found'])); } $guest = $guest[0]; $details = []; $details['id'] = $guest['id']; $details['email'] = $guest['email']; $details['name'] = json_decode($guest['adults'], true)[0]; $site->user_id = $guest['login']; $site->addToTimeline('email-failed', $details); } } if ($debug) { $logger->debug( 'SendGrid: Webhook: Response: ' . $type, [ 'email' => $hook->email, 'event' => $hook->event, 'sendhash' => $hook->sendhash, 'reason' => $hook->reason ?? '', 'data' => $manageArray ?? [], ] ); } } if ($debug) { $logger->debug('SendGrid: Legacy: End'); } header('Content-Type: application/json'); die(json_encode(['message' => 'OK'])); } if (isset($site->get_ytupload)) { $valid_types = ['mp4', 'mpeg4', 'avi', 'wmv', 'mpegps', 'flv', 'webm', '3gpp', 'mov']; foreach ($_FILES as $file) { $extParts = explode('.', strtolower($file['name'])); $ext = end($extParts); if (!in_array($ext, $valid_types)) { die('bad ext'); } $upload_dir = $_GLOBAL['SITE_UPLOAD']; $filename = $_COOKIE['id'] . '-user-' . uniqid('', false) . '.' . $ext; $ok = move_uploaded_file($file['tmp_name'], $upload_dir . $filename); if ($ok) { $key = file_get_contents('upload/token.txt'); $application_name = 'XXXXXX'; $client_secret = 'qYh3jCJAg2Vt46re_GQ_BrYA'; $client_id = '1064476581395-r41vbhmi27e5bj9gu1lusd4somfb2gj4.apps.googleusercontent.com'; $scope = [ 'https://www.googleapis.com/auth/youtube.upload', 'https://www.googleapis.com/auth/youtube', 'https://www.googleapis.com/auth/youtubepartner' ]; $videoPath = $upload_dir . $filename; $videoTitle = "PW Embed Video: " . $site->user_uri; $videoDescription = "embedded video"; $videoCategory = "22"; $videoTags = []; try { // Client init $client = new Google_Client(); $client->setLogger($logger); $client->setApplicationName($application_name); $client->setClientId($client_id); $client->setAccessType('offline'); $client->setAccessToken($key); $client->setScopes($scope); $client->setClientSecret($client_secret); if ($client->getAccessToken()) { /** * Check to see if our access token has expired. If so, get a new one and save it to file for future use. */ if ($client->isAccessTokenExpired()) { $newToken = json_decode($client->getAccessToken()); $client->refreshToken($newToken->refresh_token); file_put_contents('upload/token.txt', $client->getAccessToken()); } $youtube = new Google_Service_YouTube($client); // Create a snipet with title, description, tags and category id $snippet = new Google_Service_YouTube_VideoSnippet(); $snippet->setTitle($videoTitle); $snippet->setDescription($videoDescription); $snippet->setCategoryId($videoCategory); $snippet->setTags($videoTags); // Create a video status with privacy status. Options are "public", "private" and "unlisted". $status = new Google_Service_YouTube_VideoStatus(); $status->setPrivacyStatus('unlisted'); // Create a YouTube video with snippet and status $video = new Google_Service_YouTube_Video(); $video->setSnippet($snippet); $video->setStatus($status); // Size of each chunk of data in bytes. Setting it higher leads faster upload (less chunks, // for reliable connections). Setting it lower leads better recovery (fine-grained chunks) $chunkSizeBytes = 1 * 1024 * 1024; // Setting the defer flag to true tells the client to return a request which can be called // with ->execute(); instead of making the API call immediately. $client->setDefer(true); // Create a request for the API's videos.insert method to create and upload the video. $insertRequest = $youtube->videos->insert("status,snippet", $video); // Create a MediaFileUpload object for resumable uploads. $media = new Google_Http_MediaFileUpload($client, $insertRequest, 'video/*', null, true, $chunkSizeBytes); $media->setFileSize(filesize($videoPath)); // Read the media file and upload it chunk by chunk. $status = false; $handle = fopen($videoPath, "rb"); while (!$status && !feof($handle)) { $chunk = fread($handle, $chunkSizeBytes); $status = $media->nextChunk($chunk); } fclose($handle); /** * Video has successfully been upload, now lets perform some cleanup functions for this video */ if ($status->status['uploadStatus'] === 'uploaded') { // Actions to perform for a successful upload $thumb = $status['modelData']['snippet']['thumbnails']['default']['url']; die('{"files":[{"name":"' . $status->id . '","size":"1212121","type":"video\/' . $ext . '","url":"' . addslashes($thumb) . '","thumbnailUrl":"' . addslashes($thumb) . '","deleteUrl":"https:\/\/dev.paperlesswedding.com\/?file=98-user-54eddfd381d0e.jpg","deleteType":"DELETE"}]}'); } // If you want to make other calls after the file upload, set setDefer back to false $client->setDefer(false); } else { echo 'Problems creating the client'; $logger->warning('Problems creating the Google Client'); } } catch (Google_Service_Exception $e) { print "Caught Google service Exception " . $e->getCode() . " message is " . $e->getMessage(); print "Stack trace is " . $e->getTraceAsString(); } catch (Exception $e) { print "Caught Google service Exception " . $e->getCode() . " message is " . $e->getMessage(); print "Stack trace is " . $e->getTraceAsString(); } } } die(); } if (isset($site->get_csvupload) && !$rollout->isActive(FEATURE_GUESTLIST_CSVUPLOAD, $container->get('service:userType')) ) { ob_start(); $upload_handler = new \Blueimp\UploadHandler(); $res = ob_get_clean(); $res = json_decode($res, true); $lines = ''; if (isset($res['files'][0]['name'])) { $name = $res['files'][0]['name']; $nameParts = explode('.', $name); $extension = strtolower(end($nameParts)); if ($extension !== 'csv' && $extension !== 'txt') { die(json_encode(array('result' => 'error'))); } $file = file('files/' . $name); foreach ($file as $key => $val) { $tmp = str_getcsv($val, ',', '"'); if (!(count($tmp) > 1)) { $tmp = explode(',', trim($val)); } $l = ''; if (filter_var($tmp[0], FILTER_VALIDATE_EMAIL)) { foreach ($tmp as $tmpkey => $tmpval) { $tmp[$tmpkey] = trim($tmpval); } $buffer = fopen('php://memory', 'r+b'); fputcsv($buffer, $tmp, ',', '"'); rewind($buffer); $l = fgets($buffer); fclose($buffer); $lines .= trim($l) . "\n"; } } die(json_encode(array('result' => 'ok', 'lines' => $lines))); } die(); } if (isset($site->get_3dsframe)) { require('ajax_includes/get_3dsframe.php'); } if (isset($site->get_3dsprocess)) { require('ajax_includes/get_3dsprocess.php'); } if (isset($site->get_api)) { if (isset($site->post_token_request)) { $request_code = md5($site->post_token_request); die(json_encode(['code' => strrev($request_code)])); } $hash = strrev(md5($site->post_email)); if (!isset($site->post_auth) || $site->post_auth != $hash) { die(json_encode(['status' => 'error', 'code' => 'auth-fail', 'message' => 'Authentication code failed'])); } $session = $site->login(); if (!$session) { die(json_encode([ 'status' => 'error', 'code' => 'login-fail', 'message' => 'Email or password incorrect' ])); } if ($site->user_id && $session) { $api_auth = base64_encode($site->user_id . '@' . str_rot13($session) . '@' . md5($site->user_id . '@' . str_rot13($session))); $api_trimmed = rtrim($api_auth, '='); $api_diff = strlen($api_auth) - strlen($api_trimmed); $api_trimmed .= '&rt=' . $api_diff; die(json_encode([ 'status' => 'ok', 'code' => 'login-success', 'message' => 'Logged in authenticated', 'url' => 'https://www.paperlesswedding.com/?apiauth=' . $api_trimmed ])); } die(json_encode(['status' => 'error', 'code' => 'unknown-error', 'message' => 'Something went wrong'])); } if (isset($site->get_apiauth)) { $auth = $site->get_apiauth; $eq = $site->get_rt; if ($eq > 0) { $auth .= str_repeat('=', $eq); } $auth = base64_decode($auth); list($id, $session, $md5) = explode('@', $auth); $session = str_rot13($session); $site->cook_id = $id; $site->cook_session = $session; setcookie('id', $id, strtotime('+12 months'), '/', 'paperlesswedding.com'); setcookie('session', $session, strtotime('+12 months'), '/', 'paperlesswedding.com'); setcookie('oldsite', true, false, '/', 'paperlesswedding.com'); $site->triggerUserParams(); if ($site->user_loggedin) { header('Location: /~'); } else { header('Location: /sign-up'); } die(); } if (isset($site->get_cmsajax) && $site->get_action === 'login') { $id = $site->get_id; $session = $site->get_session; setcookie('id', $id, strtotime('+1 day'), '/', 'paperlesswedding.com'); setcookie('loginid', $id, strtotime('+1 day'), '/', 'paperlesswedding.com'); setcookie('dashboardsession', $session, strtotime('+1 day'), '/', 'paperlesswedding.com'); ?> Redirecting.. get_ajax)) { if ($rollout->isActive(FEATURE_MODULE_RSVP, $site)) { if (isset($site->get_rsvpform)) { require('ajax_includes/get_rsvpform.php'); } if ($site->post_action === 'manual-rsvp') { require('ajax_includes/action_manual_rsvp.php'); } if ($site->post_action === 'rsvp-list') { require('ajax_includes/action_rsvp_list.php'); } } if (isset($site->post_approve)) { require('ajax_includes/post_approve.php'); } if (isset($site->post_delete)) { require('ajax_includes/post_delete.php'); } if ($site->post_action === 'newsletter-signup') { require('ajax_includes/action_newsletter_signup.php'); } if ($site->post_action === 'backup-site') { require('ajax_includes/action_backup_site.php'); } if ($site->post_action === 'activity-bar') { require('ajax_includes/action_activity_bar.php'); } if ($site->post_action === 'bulk-delete-guests') { require('ajax_includes/action_bulk_delete_guests.php'); } if ($site->post_action === 'download-guests') { require('ajax_includes/action_download_guests.php'); } if ($rollout->isActive(FEATURE_MODULE_REMINDERS, $site)) { if ($site->post_action === 'reminders-lookup') { require('ajax_includes/action_reminders_lookup.php'); } if ($site->post_action === 'reminders-new') { require('ajax_includes/action_reminders_new.php'); } if ($site->post_action === 'reminders-send') { require('ajax_includes/action_reminders_send.php'); } } if ($site->post_action === 'guestbook-save') { require('ajax_includes/action_guestbook_save.php'); } if ($site->post_action === 'reset_password') { require('ajax_includes/action_reset_password.php'); } if ($site->post_action === 'wishlist-lookup') { require('ajax_includes/action_wishlist_lookup.php'); } if ($site->post_action === 'wishlist-save') { require('ajax_includes/action_wishlist_save.php'); } if ($site->post_action === 'guests-import') { require('ajax_includes/action_guests_import.php'); } if ($site->post_action === 'fb-login') { require('ajax_includes/action_facebook_login.php'); } if ($site->post_action === 'preview-changes') { require('ajax_includes/action_preview_changes.php'); } if ($site->post_action === 'initial-setup') { require('ajax_includes/action_initial_setup.php'); } if ($site->post_action === 'download_ical') { require('ajax_includes/action_download_ical.php'); } if ($site->post_action === 'account-edit') { require('ajax_includes/action_account_edit.php'); } if ($site->post_action === 'download') { require('ajax_includes/action_download.php'); } if ($rollout->isActive(FEATURE_MODULE_SAVE_THE_DATE, $site)) { if ($site->post_action === 'save-the-date-new') { require('ajax_includes/action_save_the_date_new.php'); } if ($site->post_action === 'save-the-date-preview') { require('ajax_includes/action_save_the_date_preview.php'); } if ($site->post_action === 'save-the-date-edit') { require('ajax_includes/action_save_the_date_edit.php'); } if ($site->post_action === 'save-the-date-send') { require('ajax_includes/action_save_the_date_send.php'); } } if ($rollout->isActive(FEATURE_MODULE_INVITES, $site)) { if ($site->post_action === 'invite-send') { require('ajax_includes/action_invite_send.php'); } if ($site->post_action === 'invite-preview') { require('ajax_includes/action_invite_preview.php'); } if ($site->post_action === 'invite-new') { require('ajax_includes/action_invite_new.php'); } if ($site->post_action === 'invite-edit') { require('ajax_includes/action_invite_edit.php'); } } if ($site->post_action === 'advert_impression') { require('ajax_includes/action_advert_impression.php'); } if ($site->post_action === 'advert_click') { require('ajax_includes/action_advert_click.php'); } if ($site->post_action === 'take-payment') { require('ajax_includes/action_take_payment.php'); } if ($site->post_action === 'set_homepage') { require('ajax_includes/action_set_homepage.php'); } if ($rollout->isActive(FEATURE_MODULE_THEMES, $site)) { if ($site->post_action === 'settheme') { require('ajax_includes/action_settheme.php'); } if ($site->post_action === 'view_theme') { require('ajax_includes/action_viewtheme.php'); } if ($site->post_action === 'screenshot_lookup') { require('ajax_includes/action_screenshot_lookup.php'); } if ($site->post_action === 'load_themes') { require('ajax_includes/action_load_themes.php'); } if ($site->post_action === 'adminsavetheme') { require('ajax_includes/adminsavetheme.php'); } if ($site->post_action === 'savetheme') { require('ajax_includes/savetheme.php'); } } if ($site->post_action === 'parsexls') { require('ajax_includes/parsexls.php'); } if ($site->post_action === 'domain_lookup') { require('ajax_includes/domain_lookup.php'); } if ($site->post_action === 'guest-new') { require('ajax_includes/action_guest_new.php'); } if ($site->post_action === 'guest-edit') { require('ajax_includes/action_guest_edit.php'); } if ($rollout->isActive(FEATURE_MODULE_MY_WEBSITE, $site)) { if ($site->post_action === 'mypages-new') { require('ajax_includes/action_mypages_new.php'); } if ($site->post_action === 'mypages-edit') { require('ajax_includes/action_mypages_edit.php'); } if ($site->post_action === 'mypages-menu') { require('ajax_includes/action_mypages_menu.php'); } } if ($rollout->isActive(FEATURE_MODULE_EVENTS, $site)) { if ($site->post_action === 'event-new') { require('ajax_includes/action_event_new.php'); } if ($site->post_action === 'event-edit') { require('ajax_includes/action_event_edit.php'); } } if ($rollout->isActive(FEATURE_MODULE_VENUES, $site)) { if ($site->post_action === 'venue-new') { require('ajax_includes/action_venue_new.php'); } if ($site->post_action === 'venue-edit') { require('ajax_includes/action_venue_edit.php'); } } if ($site->post_action === 'uri_suggestions') { require('ajax_includes/action_uri_suggestions.php'); } // process external link tracking if ($site->post_action === 'ext_click_track') { $site->trackLink(); } // process advert tracking if ($site->post_action === 'advert_track') { $site->advertClick(); } // process newsletter signup if ($site->post_action === 'ext_newsletter_signup') { $site->newsletterSignup(); } if ($site->post_action === 'login') { require('ajax_includes/action_login.php'); } if ($site->post_action === 'guest-recover') { require('ajax_includes/action_guest_login.php'); } if ($site->post_action === 'register') { require('ajax_includes/action_register.php'); } die(); } $adminkey = '95a99eae64712f567f872734e5db5eb6'; if (isset($site->get_activate)) { require('ajax_includes/get_activate.php'); } $zoom = '100%'; if (isset($site->cook_zoom)) { $zoom = $site->cook_zoom; } // set up variables $is_category = $is_page = $is_gallery = $is_404 = $category = $subcategory = $content = $template = $template_url = $path_url = $is_bbc = $get_category = false; $js_load = array(); // set default weather locations $site->cook_ww_locname = 'London, United Kingdom'; $site->cook_ww_loc = 'zmw:00000.1.03772.json'; $site->reRunCookies(); // re parse cookies to make sure we overwrite the defaults // set template URL (this is nearly obsolete as we no longer reference template directory explicitly) $template_url = '/templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/'; // set the current URI $current_url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; // set the default template file $template = false; // set the path url $path_url = '/'; // start processing what page we are on $site->cronning = true; // if we are inside a category, set up the category variable if (isset($site->get_category)) { $category = $site->getDetailsFromURL($site->get_category, 'pages'); if ($category) { $category['title'] = isset($category['title']) ? htmlspecialchars($category['title']) : ''; $category['summary'] = isset($category['summary']) ? htmlspecialchars($category['summary']) : ''; $category['content'] = isset($category['content']) ? $category['content'] : ''; $template_name = ''; // set the user defined template files $templateParts = explode('|', $category['template']); $template = $templateParts[0]; if (isset($templateParts[1])) { $template_name = $templateParts[1]; } } } else { // if we are not inside a category, assume it is the homepage and lookup the homepage details $category = $site->getDetailsFromURL('home', 'pages'); // set the user defined template files $templateParts = explode('|', $category['template']); $template = $templateParts[0]; if (isset($templateParts[1])) { $template_name = $templateParts[1]; } } // set up current page as category (this gets overwritten if we are in subcat or content) $site->category = $category; $site->current = $category; // build up the path url if (isset($category['url'])) { $path_url .= $category['url'] . '/'; } // if we are inside a subcategory, set up the subcategory variable if (isset($site->get_subcategory)) { $subcategory = $site->getDetailsFromURL($site->get_subcategory, 'pages'); if ($subcategory) { $template_name = ''; // set the user defined template files $templateParts = explode('|', $subcategory['template']); $template = $templateParts[0]; if (isset($templateParts[1])) { $template_name = $templateParts[1]; } // if no template selected, use the parent template definitions if (!$template || false !== stripos($template, 'null')) { $templateParts = explode('|', $category['template_inner']); $template = $templateParts[0]; if (isset($templateParts[1])) { $template_name = $templateParts[1]; } } $subcategory['title'] = isset($subcategory['title']) ? htmlspecialchars($subcategory['title']) : ''; $subcategory['summary'] = isset($subcategory['summary']) ? htmlspecialchars($subcategory['summary']) : ''; //$subcategory['content'] = $subcategory['content']; // set up current page as subcategory (this gets overwritten if we are in content) $site->subcategory = $subcategory; $site->current = $subcategory; // build up the path url $path_url .= $subcategory['url'] . '/'; } } // if we are inside a content, set up the content variable if (isset($site->get_content)) { $content = $site->getDetailsFromURL($site->get_content, 'pages'); $template_name = ''; // set the user defined template files $templateParts = explode('|', $content['template']); $template = $templateParts[0]; if (isset($templateParts[1])) { $template_name = $templateParts[1]; } // if no template selected, use the parent template definitions if (!$template || false !== stripos($template, 'null')) { $templateParts = explode('|', $subcategory['template_inner']); $template = $templateParts[0]; if (isset($templateParts[1])) { $template_name = $templateParts[1]; } } $content['title'] = isset($content['title']) ? htmlspecialchars($content['title']) : ''; $content['summary'] = isset($content['summary']) ? htmlspecialchars($content['summary']) : ''; // set up current page as subcategory (this gets overwritten if we are in content) $site->content = $content; $site->current = $content; } // if no template is defined, through an error page if (!$category) { require '_usersite.php'; /** @var \Slim\Http\Request $request */ $request = $container->get('request'); $uriPath = $request->getUri()->getPath(); if (!$usersite && (empty($uriPath) || $uriPath === '/')) { $app->respond($response->withRedirect( 'https://' . getLocale() . '.' . PAPERLESS_DOMAIN_NAME, \Slim\Http\StatusCode::HTTP_FOUND )); exit; } /** @var \Slim\Views\Twig $view */ $view = $container->get('view'); $app->respond( $view->render($response, '@global/404.html.twig') ->withStatus(\Slim\Http\StatusCode::HTTP_NOT_FOUND) ->withHeader('Content-Type', 'text/html')); exit; } // if debug mode is on ( &debug ), dump all useful information if (isset($site->get_debug)) { print('
');
    var_dump($category);
    var_dump($subcategory);
    var_dump($content);

    var_dump($_GET);
    var_dump($_POST);

    print('templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/' . $template);
    print('
'); print($template . ' ' . $template_name); print('
'); } site_ready(); // start minifying the content //ob_start(array($minimize, 'sanitize_output')); // include the selected templates if (!$site->user_loggedin && isset($site->current['id']) && !in_array((int)$site->current['id'], [424, 21, 41], true)) { header('Location: https://www.paperlesswedding.com/authenticate?logged-out=automated'); die(); } if (is_file(stream_resolve_include_path('templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/' . $template))) { include('templates/' . $_GLOBAL['SITE_TEMPLATE'] . '/' . $template); } else { /** @var \Slim\Views\Twig $view */ $view = $container->get('view'); $app->respond( $view->render($response, '@global/404.html.twig') ->withStatus(\Slim\Http\StatusCode::HTTP_NOT_FOUND) ->withHeader('Content-Type', 'text/html')); exit; } $cache->setCache(ob_get_clean()); // increment the current page view count by 1 $site->pageView();