Skip to content

Commit

Permalink
Minor Bug Fixes
Browse files Browse the repository at this point in the history
Fixing some minor PHP errors as well as the Vimeo API.
  • Loading branch information
jptksc committed Jul 30, 2014
1 parent 307b435 commit d89ef72
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 30 deletions.
2 changes: 1 addition & 1 deletion ABOUT.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
## Version
- 1.0.3
- 1.0.4
53 changes: 31 additions & 22 deletions cinematico/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ function get_video($type, $template) {
function get_videos($type, $template) {

// Variable setup for pagination.
if (isset($_GET['page'])) {
$page_number = PAGE_NUMBER;
}
$page_increment = GALLERY_ITEMS_NUMBER;

// If we're using YouTube.
if (VIDEO_SERVICE == 'youtube') {

// Variable setup for YouTube pagination.
if ($page_number) {
if (!empty($page_number)) {
$start_index = $page_increment*$page_number+'1';
} else {
$start_index = '1';
Expand All @@ -95,7 +97,7 @@ function get_videos($type, $template) {
} elseif (VIDEO_SERVICE == 'vimeo') {

// Variable setup for Vimeo pagination.
if ($page_number) {
if (!empty($page_number)) {
$start_index = $page_number+'1';
} else {
$start_index = '1';
Expand Down Expand Up @@ -173,7 +175,11 @@ function get_videos($type, $template) {
function get_pagination($page_previous_class, $page_next_class) {

// Variable setup for pagination.
if (isset($_GET['page'])) {
$page_number = PAGE_NUMBER;
} else {
$page_number = '';
}
$page_increment = GALLERY_ITEMS_NUMBER;
$item_count = get_videos('count', '');

Expand Down Expand Up @@ -291,8 +297,12 @@ function is_page($page) {
// Get the current page.
$currentpage = @( $_SERVER['HTTPS'] != 'on' ) ? 'http://'.$_SERVER['SERVER_NAME'] : 'https://'.$_SERVER['SERVER_NAME'];

$page_number = $_GET['page'];
$currentpage .= str_replace(array('?page='.$page_number), '', $_SERVER['REQUEST_URI']);
if (isset($_GET['page'])) {
$page_number = $_GET['page'];
$currentpage .= str_replace(array('?page='.$page_number), '', $_SERVER['REQUEST_URI']);
} else {
$currentpage .= $_SERVER['REQUEST_URI'];
}

// Get the current video ID.
$the_current_video_id = end((explode('/', $currentpage)));
Expand All @@ -304,19 +314,20 @@ function is_page($page) {

// If is home return true.
if ($home_page == $currentpage) {
return true;
}
return true;
}

} elseif ($page == 'single') {
} elseif ($page == 'single') {

// YouTube Video ID Check
if (VIDEO_SERVICE == 'youtube') {

$headers = get_headers('http://gdata.youtube.com/feeds/api/videos/' . $the_current_video_id);
$headers = get_headers('http://gdata.youtube.com/feeds/api/videos/' . $the_current_video_id);
if (strpos($headers[0], '200')) {
return true;
}

// Vimeo Video ID Check
} elseif (VIDEO_SERVICE == 'vimeo') {

$headers = get_headers('http://vimeo.com/api/v2/video/' . $the_current_video_id . '.json');
Expand All @@ -325,16 +336,16 @@ function is_page($page) {
}
}

} elseif ($page == 'about') {
// The about page URL.
$about_page = SITE_URL . '/about';
// If is home return true.
if ($about_page == $currentpage) {
return true;
}
}
} elseif ($page == 'about') {
// The about page URL.
$about_page = SITE_URL . '/about';
// If is home return true.
if ($about_page == $currentpage) {
return true;
}
}
}

/*-----------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -398,9 +409,7 @@ function get_analytics() {
}

function get_cinematico_version() {

$content = file(BASE_DIR . 'ABOUT.md');
$version = str_replace(array("\n", '- '), '', $content[1]);
echo($version);

}
echo($version);
}
17 changes: 10 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
include('config.php');

// Get the base directory.
if ($network_install) {
if (file_exists('network.php')) {
$base_url = $network_url;
$base_dir = $network_dir;
} else {
Expand Down Expand Up @@ -92,8 +92,10 @@
$meta_description = SITE_DESCRIPTION;

// Variable setup for pagination.
$page_number = $_GET['page'];
define('PAGE_NUMBER', $page_number);
if (isset($_GET['page'])) {
$page_number = $_GET['page'];
define('PAGE_NUMBER', $page_number);
}

// Single video pages.
} elseif (is_page('single')) {
Expand All @@ -108,8 +110,10 @@
$meta_description = get_video('description', $the_video_id, '');

// Variable setup for pagination.
$page_number = $_GET['page'];
define('PAGE_NUMBER', $page_number);
if (isset($_GET['page'])) {
$page_number = $_GET['page'];
define('PAGE_NUMBER', $page_number);
}

// About page.
} elseif (is_page('about')) {
Expand All @@ -130,7 +134,7 @@
/* The Page Meta
/*-----------------------------------------------------------------------------------*/

if ($site_image) {
if (isset($site_image)) {
$site_meta_image = $site_image;
} else {
$site_meta_image = $site_url . '/cinematico/assets/images/logo.jpg';
Expand Down Expand Up @@ -178,7 +182,6 @@

// Get the theme index.
include(BASE_DIR . 'themes/' . SITE_THEME . '/index.php');

}

/*-----------------------------------------------------------------------------------*/
Expand Down

0 comments on commit d89ef72

Please sign in to comment.