/** * will pull in a php template based on $tpl_dir and $name, and passes $tpl_args as arguments usful for template * * @param string $tpl_dir * @param string $name * @param array $tpl_args * @return string */ static function tpl_content($tpl_dir, $name, $tpl_args) { $err_flag = false; $current_path = BASE_TPL_DIR; $folder = BASE_TPL_DIR . $tpl_dir; $file = $folder . '/' . $name; $err = "[current_path]: {$current_path}\n"; $err .= "[folder] : {$folder}\n"; $err .= "[file] : {$file}\n"; $err .= "[real_path] : " . realpath($file) . "\n"; if (!is_dir($folder)) { $err .= "[folder]: {$folder} does not exist\n"; $err_flag = true; } if (!is_file($file)) { $err .= "[file]: {$file} does not exist\n"; $err_flag = true; } if (!substr_count(realpath($file), $current_path)) { $err .= "You are not allowed in here\n"; $err_flag = true; } if ($err_flag) { throw new Exception("<pre>{$err}</pre>"); } if (!count($tpl_args)) { new Log("notice", "should probably pass your arguments to \$tpl_args"); } else { new Log("message", "Template: {$file} Has successfully loaded"); } gen_time('view/' . $name); ob_start(); include_once $file; $content = ob_get_contents(); ob_clean(); ob_flush(); gen_time('view/' . $name); return $content; }
function __destruct() { gen_time('Controllers/Control_Links'); parent::__destruct(); }
public function __destruct() { gen_time('class/Paginate'); }
$youtube = get_youtube_link($params['title'], $cast); mysqli_query($mysqli, "UPDATE youtube SET videoId='{$youtube}',timestamp='{$timestamp}' WHERE id={$id}"); } } else { $cast = array(); if ($c = $mysqli->query("SELECT a.name FROM actors a INNER JOIN roles r ON a.id = r.actor_id AND r.movie_id = {$id}")) { while ($actor = mysqli_fetch_assoc($c)) { $cast[] = $actor['name']; } } $timestamp = date('Y-m-d H:i:s'); $youtube = get_youtube_link($params['title'], $cast); mysqli_query($mysqli, "INSERT INTO youtube VALUES ({$id},'{$youtube}','{$timestamp}')"); } if (strlen($youtube) > 0) { $text = "<span class='link-time'>" . gen_time($timestamp) . "</span>"; $text .= '<i class="fa fa-external-link-square"></i> <a target="_blank" href="http://www.youtube.com/watch?v=' . $youtube . '">Follow link for prices</a>.'; $response = array('link' => "http://www.youtube.com/watch?v={$youtube}", 'text' => $text); echo json_encode($response); } if (strlen($youtube) == 0) { $available = ''; if (isset($_SESSION['user']) && $mysqli->query("SELECT * FROM alerts WHERE id={$id} AND youtube=1 AND username='******'user'] . "'")->num_rows > 0) { $available = "We'll email you when this movie is available on YouTube."; } else { $available = "Want us to <a class='alert-me'><b>email you</b></a> when it becomes available?"; } $text = "Sorry, we don't have a YouTube link.<br>{$available}"; $response = array('link' => '', 'text' => $text); echo json_encode($response); }
</div> <div class="imdb-rating"> <?php if ($params['imdb_rating']) { echo '<div>' . $params['imdb_rating'] . '</div> <a href="http://www.imdb.com/title/' . $params['imdb_id'] . '" target="_blank"> <img class="imdb-icon" alt="IMDb" src="images/imdb_icon.png"> </a>'; } ?> </div> <div class="mov-info-small"> <span> <?php if ($params['runtime'] > 0) { echo "<i class='fa fa-clock-o'></i> " . gen_time($params['runtime']); } if ($params['genres'] !== '') { echo ($params['runtime'] > 0 ? ' - ' : '') . '<i class="fa fa-film"></i> ' . gen_genres($params['genres']); } if ($params['language'] !== '') { echo ($params['genres'] !== '' || $params['runtime'] > 0 ? ' - ' : '') . '<i class="fa fa-comment-o"></i> ' . $params['language']; } ?> </span> </div> <div class="ellipsis"> <div> <?php echo stripslashes(fix_aps($params['synopsis'])); ?>
public function __destruct() { gen_time('class/Model_Posts'); parent::__destruct(); }
public function __destruct() { gen_time('class/DB'); parent::__destruct(); }
public function __destruct() { gen_time('class/Log'); }
echo '<p style="margin: 0px; padding: 0px;"><span style="color: blue">compilation</span> ' . "[{$id}] = {$timing} msec" . "</p>\n"; } else { echo "<!-- compilation: [{$id}] = {$timing} msec -->\n"; } } } } gen_time('page_load'); gen_time('init_session'); session_start(); $_SESSION = $_POST; gen_time('init_session'); gen_time('lib_load'); require BASE_DIR_LIB . "interface.Record.php"; require BASE_DIR_LIB . "class.helper.Log.php"; require BASE_DIR_LIB . "class.helper.DB.php"; require BASE_DIR_LIB . "scheme.table.users.php"; require BASE_DIR_LIB . "scheme.table.posts.php"; require BASE_DIR_LIB . "scheme.table.links.php"; require BASE_DIR_LIB . "class.helper.Util.php"; require BASE_DIR_LIB . "class.helper.Paginate.php"; require BASE_DIR_LIB . "class.helper.UrlTranslator.php"; require BASE_DIR_LIB . "class.model.Model_Users.php"; require BASE_DIR_LIB . "class.model.Model_Posts.php"; require BASE_DIR_LIB . "class.model.Model_Links.php"; require BASE_DIR_LIB . "class.model.Model_Registration.php"; require BASE_DIR_LIB . "class.controllers.Control_Users.php"; require BASE_DIR_LIB . "class.controllers.Control_Posts.php"; require BASE_DIR_LIB . "class.controllers.Control_Links.php"; gen_time('lib_load');
public function __destruct() { gen_time('class/UrlTranslator'); parent::__destruct(); }
<?php include_once 'config.php'; try { $http_gets = new UrlTranslator(array('page' => 'int', 'add' => 'alpha', 'edit' => 'int', 'delete' => 'int', 'username' => 'alphanum', 'submit' => 'alpha')); switch ($http_gets->controller()) { case "": case "Users": $Users = new Control_Users($http_gets->args()); break; case "Posts": $Users = new Control_Posts($http_gets->args()); break; case "Links": $Users = new Control_Links($http_gets->args()); break; default: header("Location: /"); } gen_time('page_load'); } catch (PDOException $e) { echo "<h3>PDO Exception</h3><p>" . $e->getMessage() . "</p>"; } catch (Exception $e) { echo "<h3>Exception</h3><p>" . $e->getMessage() . "</p>"; }
public function __destruct() { gen_time('class/Model_Users_Cateory'); parent::__destruct(); }
</div> <?php $adult = " AND adult=0 AND genres NOT LIKE '%Erotic%'"; if (isset($_SESSION['user'])) { $account = mysqli_fetch_assoc($mysqli->query("SELECT adult FROM users WHERE username='******'user'] . "'")); if ($account['adult'] == 1) { $adult = ""; } } $moviesDirectedQuery = "SELECT m.id, m.title, m.year, m.img_link" . ($orderby == "runtime" ? ", m.runtime" : "") . ($orderby == "imdb" ? ", i.imdb_rating" : "") . "\n\t\t\t\t\t\tFROM movies m\n\t\t\t\t\t\t" . ($orderby == "imdb" ? "INNER JOIN imdb i ON i.id=m.id" : "") . " WHERE director = {$id} {$orderQuery}"; if ($movie = $mysqli->query($moviesDirectedQuery)) { while ($mov = mysqli_fetch_assoc($movie)) { $movUrl = "{$mov['id']}/" . rewriteUrl($mov['title']); $movImg = strlen($mov['img_link']) ? "http://image.tmdb.org/t/p/w185{$mov['img_link']}" : "images/no_image_found.png"; echo "<div class='related-mov pop-movie actor-film'><a href='movie/{$movUrl}'>\n\t\t\t\t\t \t\t\t\t<div>\n\t\t\t\t\t \t\t\t\t\t<img alt='{$mov['title']}' src='{$movImg}'>\n\t\t\t\t\t \t\t\t\t\t<div class='legend'>\n\t\t\t\t\t \t\t\t\t\t\t<div class='legend-inner'>" . ($orderby == "imdb" ? "<img alt='IMDb' class='imdb' src='images/imdb_white.png'> <strong>{$mov['imdb_rating']}</strong>" : ($orderby == "runtime" ? "Runtime: <b>" . gen_time($mov['runtime']) . "</b>" : "")) . "</div>\n\t\t\t\t\t \t\t\t\t\t</div>\n\t\t\t\t\t \t\t\t\t\t<div>\n\t\t\t\t\t \t\t\t\t\t\t<strong>{$mov['title']}</strong> <span class='year'>{$mov['year']}</span>\n\t\t\t\t\t \t\t\t\t\t</div>\n\t\t\t\t\t \t\t\t\t</div>\n\t\t\t\t\t \t\t\t</a></div>"; } } ?> </div> <?php } ?> </div> </div> <?php if (!$acted && !$directed) { echo "<br><br> We have no movies with <b>{$name}</b>. Sorry!<br><a class='return-to-search'>Return to search</a>.<br><br>"; }