/** * Locks a specific script for unauthenticated requests. */ function lock() { if (!authenticated()) { header('Location: ' . R . 'auth/?referer=' . $_SERVER['REQUEST_URI']); exit; } }
function autherized($userid, $pageauth) { if (!isset($pageauth)) { return 1; } if (authenticated()) { return 1; } return 0; }
?> </div> <!-- end Authentication status --> <br clear="all" /> <?php // if $_GET['status'] is populated then we have a response // about a syndicated upload from YouTube's servers if (isset($_GET['status'])) { isset($_GET['code']) ? $code = $_GET['code'] : ($code = null); isset($_GET['id']) ? $id = $_GET['id'] : ($id = null); print '<div id="generalStatus">' . uploadStatus($_GET['status'], $code, $id) . '<div id="detailedUploadStatus"></div></div>'; } ?> <!-- General status --> <?php if (authenticated()) { printAuthenticatedActions(); } ?> <!-- end General status --> <br clear="all" /> <div id="searchResults"> <div id="searchResultsListColumn"> <div id="searchResultsVideoList"></div> <div id="searchResultsNavigation"> <form id="navigationForm" action="javascript:void();"> <input type="button" id="previousPageButton" onclick="ytVideoApp.listVideos(ytVideoApp.previousQueryType, ytVideoApp.previousSearchTerm, ytVideoApp.previousPage);" value="Back" style="display: none;" /> <input type="button" id="nextPageButton" onclick="ytVideoApp.listVideos(ytVideoApp.previousQueryType, ytVideoApp.previousSearchTerm, ytVideoApp.nextPage);" value="Next" style="display: none;" /> </form> </div> </div>
}); $app->get('/friends', function () use($app) { authenticated(); $query = 'SELECT * FROM relations WHERE one = ? OR another = ? ORDER BY created_at DESC'; $friends = array(); $stmt = db_execute($query, array(current_user()['id'], current_user()['id'])); while ($rel = $stmt->fetch()) { $key = $rel['one'] == current_user()['id'] ? 'another' : 'one'; if (isset($friends[$rel[$key]])) { $friends[$rel[$key]] = $rel['created_at']; } } $app->render('friends.php', array('friends' => $friends)); }); $app->post('/friends/:account_name', function ($account_name) use($app) { authenticated(); if (!is_friend_account($account_name)) { $user = user_from_account($account_name); if (!$user) { abort_content_not_found(); } db_execute('INSERT INTO relations (one, another) VALUES (?,?), (?,?)', array(current_user()['id'], $user['id'], $user['id'], current_user()['id'])); $app->redirect('/friends'); } }); $app->get('/initialize', function () use($app) { db_execute("DELETE FROM relations WHERE id > 500000"); db_execute("DELETE FROM footprints WHERE id > 500000"); db_execute("DELETE FROM entries WHERE id > 500000"); db_execute("DELETE FROM comments WHERE id > 1500000"); });
} // load objects from configuration if (!$err) { try { $moviemasher_client =& MovieMasher::fromConfig('MovieMasher.xml', 'Client'); $moviemasher_file =& MovieMasher::fromConfig('MovieMasher.xml', 'File'); } catch (Exception $ex) { $err = xml_safe($ex->getMessage()); } } // load utilities if (!$err && !@(include_once 'MovieMasher/lib/authutils.php')) { $err = 'Problem loading utility script'; } // see if the user is autheticated (will NOT exit) if (!$err && !authenticated()) { $err = 'Unauthenticated access'; } // check to make sure required parameters have been sent if (!$err) { $job = empty($_REQUEST['job']) ? '' : $_REQUEST['job']; $id = empty($_REQUEST['id']) ? '' : $_REQUEST['id']; if (!($job && $id)) { $err = 'Parameters job, id required'; } } // make sure required configuration options have been set if (!$err) { $uploads_locally = $moviemasher_file->uploadsLocally(); $renders_locally = $moviemasher_client->rendersLocally(); $path_media = $moviemasher_client->getOption('PathMedia');
} // load objects from configuration if (!$err) { try { $moviemasher_client =& MovieMasher::fromConfig('MovieMasher.xml', 'Client'); $moviemasher_file =& MovieMasher::fromConfig('MovieMasher.xml', 'File'); } catch (Exception $ex) { $err = xml_safe($ex->getMessage()); } } // load utilities if (!$err && !@(include_once 'MovieMasher/lib/authutils.php')) { $err = 'Problem loading utility script'; } // see if the user is autheticated (will NOT exit) if (!$err && !authenticated($moviemasher_client)) { $err = 'Unauthenticated access'; } // check to make sure required parameters have been sent if (!$err) { $id = empty($_REQUEST['id']) ? '' : $_REQUEST['id']; if (!$id) { $err = 'Parameter id required'; } } if (!$err) { // set $err for log entry $progress = @file_get_contents('php://input'); if (!$progress) { $err = 'No request body provided'; }
<?php if (!authenticated()) { echo "echo Authentication failed!\n"; echo "sleep 3\n"; echo "chain --replace --autofree {$url}boot.php\n"; exit; }
$response = User::getUsersByName($search, $user_id); } else { $result = (object) array('status' => -1, 'status_explanation' => 'Insufficient data provided.'); } header('Content-Type: application/json'); echo json_encode($response, JSON_PRETTY_PRINT); }, $f3->get('route_ttl')); /** * Route: Get user information by ID * * @example /user/@id */ $f3->route('POST /user/@id', function ($f3, $params) use($db) { $id = $f3->get('PARAMS.id'); // If user sending request is authenticated if ($sender_id = authenticated()) { $user = new User(null, $id); if ($user_info = $user->getInfo(false)) { $response = (object) array('status' => 1, 'status_explanation' => 'Success.', 'handle' => $user_info->handle, 'first_name' => $user_info->first_name, 'last_name' => $user_info->last_name, 'image' => $user_info->image); } else { $response = (object) array('status' => -2, 'status_explanation' => 'Couldn\'t fetch user information from database.'); } } else { $response = (object) array('status' => -1, 'status_explanation' => 'Insufficient data provided.'); } header('Content-Type: application/json'); echo json_encode($response, JSON_PRETTY_PRINT); }, $f3->get('route_ttl')); /** * Route: Retrieve all achievements * @todo the achievement system needs to be finished. Right now it just returns a list of available achievements. Nothing more.