@@ -18,26 +18,26 @@ |
||
18 | 18 | */ |
19 | 19 | function smarty_make_timestamp($string) |
20 | 20 | { |
21 | - if (empty($string)) { |
|
22 | - // use "now": |
|
23 | - return time(); |
|
24 | - } elseif ($string instanceof DateTime || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)) { |
|
25 | - return (int) $string->format('U'); // PHP 5.2 BC |
|
26 | - } elseif (strlen($string) == 14 && ctype_digit($string)) { |
|
27 | - // it is mysql timestamp format of YYYYMMDDHHMMSS? |
|
28 | - return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), |
|
29 | - substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4)); |
|
30 | - } elseif (is_numeric($string)) { |
|
31 | - // it is a numeric string, we handle it as timestamp |
|
32 | - return (int) $string; |
|
33 | - } else { |
|
34 | - // strtotime should handle it |
|
35 | - $time = strtotime($string); |
|
36 | - if ($time == - 1 || $time === false) { |
|
37 | - // strtotime() was not able to parse $string, use "now": |
|
38 | - return time(); |
|
39 | - } |
|
21 | + if (empty($string)) { |
|
22 | + // use "now": |
|
23 | + return time(); |
|
24 | + } elseif ($string instanceof DateTime || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)) { |
|
25 | + return (int) $string->format('U'); // PHP 5.2 BC |
|
26 | + } elseif (strlen($string) == 14 && ctype_digit($string)) { |
|
27 | + // it is mysql timestamp format of YYYYMMDDHHMMSS? |
|
28 | + return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), |
|
29 | + substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4)); |
|
30 | + } elseif (is_numeric($string)) { |
|
31 | + // it is a numeric string, we handle it as timestamp |
|
32 | + return (int) $string; |
|
33 | + } else { |
|
34 | + // strtotime should handle it |
|
35 | + $time = strtotime($string); |
|
36 | + if ($time == - 1 || $time === false) { |
|
37 | + // strtotime() was not able to parse $string, use "now": |
|
38 | + return time(); |
|
39 | + } |
|
40 | 40 | |
41 | - return $time; |
|
42 | - } |
|
41 | + return $time; |
|
42 | + } |
|
43 | 43 | } |
@@ -22,14 +22,14 @@ |
||
22 | 22 | // use "now": |
23 | 23 | return time(); |
24 | 24 | } elseif ($string instanceof DateTime || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)) { |
25 | - return (int) $string->format('U'); // PHP 5.2 BC |
|
25 | + return (int)$string->format('U'); // PHP 5.2 BC |
|
26 | 26 | } elseif (strlen($string) == 14 && ctype_digit($string)) { |
27 | 27 | // it is mysql timestamp format of YYYYMMDDHHMMSS? |
28 | 28 | return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), |
29 | 29 | substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4)); |
30 | 30 | } elseif (is_numeric($string)) { |
31 | 31 | // it is a numeric string, we handle it as timestamp |
32 | - return (int) $string; |
|
32 | + return (int)$string; |
|
33 | 33 | } else { |
34 | 34 | // strtotime should handle it |
35 | 35 | $time = strtotime($string); |
@@ -13,37 +13,37 @@ |
||
13 | 13 | * @param string |
14 | 14 | * @return string |
15 | 15 | */ |
16 | -function smarty_modifier_timeAgo( $date) |
|
16 | +function smarty_modifier_timeAgo($date) |
|
17 | 17 | { |
18 | 18 | if ($date == "") |
19 | 19 | return "n/a"; |
20 | - $timeStrings = array( 'now', // 0 |
|
21 | - 'Sec', 'Secs', // 1,1 |
|
22 | - 'Min','Mins', // 3,3 |
|
23 | - 'Hour', 'Hrs', // 5,5 |
|
20 | + $timeStrings = array('now', // 0 |
|
21 | + 'Sec', 'Secs', // 1,1 |
|
22 | + 'Min', 'Mins', // 3,3 |
|
23 | + 'Hour', 'Hrs', // 5,5 |
|
24 | 24 | 'Day', 'Days'); |
25 | - $sec = time() - (( !is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
|
26 | - if ( $sec <= 0) return $timeStrings[0]; |
|
27 | - if ( $sec < 2) return $sec." ".$timeStrings[1]; |
|
28 | - if ( $sec < 60) return $sec." ".$timeStrings[2]; |
|
25 | + $sec = time() - ((!is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
|
26 | + if ($sec <= 0) return $timeStrings[0]; |
|
27 | + if ($sec < 2) return $sec . " " . $timeStrings[1]; |
|
28 | + if ($sec < 60) return $sec . " " . $timeStrings[2]; |
|
29 | 29 | $min = $sec / 60; |
30 | - if ( floor($min+0.5) < 2) return floor($min+0.5)." ".$timeStrings[3]; |
|
31 | - if ( $min < 60) return floor($min+0.5)." ".$timeStrings[4]; |
|
30 | + if (floor($min + 0.5) < 2) return floor($min + 0.5) . " " . $timeStrings[3]; |
|
31 | + if ($min < 60) return floor($min + 0.5) . " " . $timeStrings[4]; |
|
32 | 32 | $hrs = $min / 60; |
33 | - if ( floor($hrs+0.5) < 2) return floor($hrs+0.5)." ".$timeStrings[5]; |
|
34 | - if ( $hrs < 24) return floor($hrs+0.5)." ".$timeStrings[6]; |
|
35 | - $days = $sec/60/60/24; |
|
33 | + if (floor($hrs + 0.5) < 2) return floor($hrs + 0.5) . " " . $timeStrings[5]; |
|
34 | + if ($hrs < 24) return floor($hrs + 0.5) . " " . $timeStrings[6]; |
|
35 | + $days = $sec / 60 / 60 / 24; |
|
36 | 36 | if ($days > 365) |
37 | 37 | { |
38 | - return round(($days/365), 1).' Yrs'; |
|
38 | + return round(($days / 365), 1) . ' Yrs'; |
|
39 | 39 | } |
40 | 40 | else if ($days > 90) |
41 | 41 | { |
42 | - return round($days/7).' Wks'; |
|
42 | + return round($days / 7) . ' Wks'; |
|
43 | 43 | } |
44 | 44 | else |
45 | 45 | { |
46 | - return round($days, 1).'d'; |
|
46 | + return round($days, 1) . 'd'; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | ?> |
50 | 50 | \ No newline at end of file |
@@ -15,34 +15,44 @@ |
||
15 | 15 | */ |
16 | 16 | function smarty_modifier_timeAgo( $date) |
17 | 17 | { |
18 | - if ($date == "") |
|
19 | - return "n/a"; |
|
18 | + if ($date == "") { |
|
19 | + return "n/a"; |
|
20 | + } |
|
20 | 21 | $timeStrings = array( 'now', // 0 |
21 | 22 | 'Sec', 'Secs', // 1,1 |
22 | 23 | 'Min','Mins', // 3,3 |
23 | 24 | 'Hour', 'Hrs', // 5,5 |
24 | 25 | 'Day', 'Days'); |
25 | 26 | $sec = time() - (( !is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
26 | - if ( $sec <= 0) return $timeStrings[0]; |
|
27 | - if ( $sec < 2) return $sec." ".$timeStrings[1]; |
|
28 | - if ( $sec < 60) return $sec." ".$timeStrings[2]; |
|
27 | + if ( $sec <= 0) { |
|
28 | + return $timeStrings[0]; |
|
29 | + } |
|
30 | + if ( $sec < 2) { |
|
31 | + return $sec." ".$timeStrings[1]; |
|
32 | + } |
|
33 | + if ( $sec < 60) { |
|
34 | + return $sec." ".$timeStrings[2]; |
|
35 | + } |
|
29 | 36 | $min = $sec / 60; |
30 | - if ( floor($min+0.5) < 2) return floor($min+0.5)." ".$timeStrings[3]; |
|
31 | - if ( $min < 60) return floor($min+0.5)." ".$timeStrings[4]; |
|
37 | + if ( floor($min+0.5) < 2) { |
|
38 | + return floor($min+0.5)." ".$timeStrings[3]; |
|
39 | + } |
|
40 | + if ( $min < 60) { |
|
41 | + return floor($min+0.5)." ".$timeStrings[4]; |
|
42 | + } |
|
32 | 43 | $hrs = $min / 60; |
33 | - if ( floor($hrs+0.5) < 2) return floor($hrs+0.5)." ".$timeStrings[5]; |
|
34 | - if ( $hrs < 24) return floor($hrs+0.5)." ".$timeStrings[6]; |
|
44 | + if ( floor($hrs+0.5) < 2) { |
|
45 | + return floor($hrs+0.5)." ".$timeStrings[5]; |
|
46 | + } |
|
47 | + if ( $hrs < 24) { |
|
48 | + return floor($hrs+0.5)." ".$timeStrings[6]; |
|
49 | + } |
|
35 | 50 | $days = $sec/60/60/24; |
36 | - if ($days > 365) |
|
37 | - { |
|
51 | + if ($days > 365) { |
|
38 | 52 | return round(($days/365), 1).' Yrs'; |
39 | - } |
|
40 | - else if ($days > 90) |
|
41 | - { |
|
53 | + } else if ($days > 90) { |
|
42 | 54 | return round($days/7).' Wks'; |
43 | - } |
|
44 | - else |
|
45 | - { |
|
55 | + } else { |
|
46 | 56 | return round($days, 1).'d'; |
47 | 57 | } |
48 | 58 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * @param string |
15 | 15 | * @return string |
16 | 16 | */ |
17 | -function smarty_modifier_magicurl($str, $dereferrer="") { |
|
18 | - return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="'.$dereferrer.'$1://$2" target="_blank">$1://$2</a>', $str); |
|
17 | +function smarty_modifier_magicurl($str, $dereferrer = "") { |
|
18 | + return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="' . $dereferrer . '$1://$2" target="_blank">$1://$2</a>', $str); |
|
19 | 19 | } |
20 | 20 | ?> |
21 | 21 | \ No newline at end of file |
@@ -14,7 +14,8 @@ |
||
14 | 14 | * @param string |
15 | 15 | * @return string |
16 | 16 | */ |
17 | -function smarty_modifier_magicurl($str, $dereferrer="") { |
|
17 | +function smarty_modifier_magicurl($str, $dereferrer="") |
|
18 | +{ |
|
18 | 19 | return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="'.$dereferrer.'$1://$2" target="_blank">$1://$2</a>', $str); |
19 | 20 | } |
20 | 21 | ?> |
21 | 22 | \ No newline at end of file |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | -function smarty_modifier_parray ($string,$explode,$limit=NULL) |
|
2 | +function smarty_modifier_parray($string, $explode, $limit = NULL) |
|
3 | 3 | { |
4 | - if($limit == NULL) |
|
5 | - return explode( $explode , $string ); |
|
4 | + if ($limit == NULL) |
|
5 | + return explode($explode, $string); |
|
6 | 6 | else |
7 | - return explode( $explode , $string , $limit); |
|
7 | + return explode($explode, $string, $limit); |
|
8 | 8 | } |
9 | 9 | ?> |
10 | 10 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | function smarty_modifier_parray ($string,$explode,$limit=NULL) |
3 | 3 | { |
4 | - if($limit == NULL) |
|
5 | - return explode( $explode , $string ); |
|
6 | - else |
|
7 | - return explode( $explode , $string , $limit); |
|
8 | -} |
|
4 | + if($limit == NULL) { |
|
5 | + return explode( $explode , $string ); |
|
6 | + } else { |
|
7 | + return explode( $explode , $string , $limit); |
|
8 | + } |
|
9 | + } |
|
9 | 10 | ?> |
10 | 11 | \ No newline at end of file |
@@ -29,28 +29,28 @@ |
||
29 | 29 | * 2003-02-21 Version 0.1 - initial release |
30 | 30 | * ------------------------------------------------------------- |
31 | 31 | */ |
32 | -function smarty_modifier_fsize_format($size,$format = '',$precision = 2, $dec_point = ".", $thousands_sep = ",") |
|
32 | +function smarty_modifier_fsize_format($size, $format = '', $precision = 2, $dec_point = ".", $thousands_sep = ",") |
|
33 | 33 | { |
34 | 34 | $format = strtoupper($format); |
35 | 35 | static $sizes = array(); |
36 | - if(!count($sizes)) { |
|
36 | + if (!count($sizes)) { |
|
37 | 37 | $b = 1024; |
38 | - $sizes["B"] = 1; |
|
39 | - $sizes["KB"] = $sizes["B"] * $b; |
|
40 | - $sizes["MB"] = $sizes["KB"] * $b; |
|
41 | - $sizes["GB"] = $sizes["MB"] * $b; |
|
42 | - $sizes["TB"] = $sizes["GB"] * $b; |
|
43 | - $sizes["PB"] = $sizes["TB"] * $b; |
|
44 | - $sizes["EB"] = $sizes["PB"] * $b; |
|
45 | - $sizes["ZB"] = $sizes["EB"] * $b; |
|
46 | - $sizes["YB"] = $sizes["ZB"] * $b; |
|
47 | - $sizes = array_reverse($sizes,true); |
|
38 | + $sizes["B"] = 1; |
|
39 | + $sizes["KB"] = $sizes["B"] * $b; |
|
40 | + $sizes["MB"] = $sizes["KB"] * $b; |
|
41 | + $sizes["GB"] = $sizes["MB"] * $b; |
|
42 | + $sizes["TB"] = $sizes["GB"] * $b; |
|
43 | + $sizes["PB"] = $sizes["TB"] * $b; |
|
44 | + $sizes["EB"] = $sizes["PB"] * $b; |
|
45 | + $sizes["ZB"] = $sizes["EB"] * $b; |
|
46 | + $sizes["YB"] = $sizes["ZB"] * $b; |
|
47 | + $sizes = array_reverse($sizes, true); |
|
48 | 48 | } |
49 | 49 | //~ get "human" filesize |
50 | - foreach($sizes AS $unit => $bytes) { |
|
51 | - if($size > $bytes || $unit == $format) { |
|
50 | + foreach ($sizes AS $unit => $bytes) { |
|
51 | + if ($size > $bytes || $unit == $format) { |
|
52 | 52 | //~ return formatted size |
53 | - return number_format($size / $bytes,$precision,$dec_point,$thousands_sep)." ".$unit; |
|
53 | + return number_format($size / $bytes, $precision, $dec_point, $thousands_sep) . " " . $unit; |
|
54 | 54 | } //~ end if |
55 | 55 | } //~ end foreach |
56 | 56 | } //~ end function |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $sizes = array_reverse($sizes,true); |
48 | 48 | } |
49 | 49 | //~ get "human" filesize |
50 | - foreach($sizes AS $unit => $bytes) { |
|
50 | + foreach($sizes as $unit => $bytes) { |
|
51 | 51 | if($size > $bytes || $unit == $format) { |
52 | 52 | //~ return formatted size |
53 | 53 | return number_format($size / $bytes,$precision,$dec_point,$thousands_sep)." ".$unit; |
@@ -34,15 +34,15 @@ discard block |
||
34 | 34 | $content = new Contents(['Settings' => $this->settings]); |
35 | 35 | $f = new Forum(); |
36 | 36 | $menu = new Menu($this->settings); |
37 | - $this->smarty->assign('menulist',$menu->get($role, $this->serverurl)); |
|
37 | + $this->smarty->assign('menulist', $menu->get($role, $this->serverurl)); |
|
38 | 38 | $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role)); |
39 | 39 | $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role)); |
40 | 40 | if ($this->userdata != null) |
41 | - $this->smarty->assign('recentforumpostslist',$f->getPosts($this->settings->getSetting('showrecentforumposts'))); |
|
41 | + $this->smarty->assign('recentforumpostslist', $f->getPosts($this->settings->getSetting('showrecentforumposts'))); |
|
42 | 42 | |
43 | - $this->smarty->assign('main_menu',$this->smarty->fetch('mainmenu.tpl')); |
|
44 | - $this->smarty->assign('useful_menu',$this->smarty->fetch('usefullinksmenu.tpl')); |
|
45 | - $this->smarty->assign('article_menu',$this->smarty->fetch('articlesmenu.tpl')); |
|
43 | + $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl')); |
|
44 | + $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl')); |
|
45 | + $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl')); |
|
46 | 46 | |
47 | 47 | $category = new Category(['Settings' => $content->pdo]); |
48 | 48 | if ($this->userdata != null) |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | else |
51 | 51 | $parentcatlist = $category->getForMenu(); |
52 | 52 | |
53 | - $this->smarty->assign('parentcatlist',$parentcatlist); |
|
53 | + $this->smarty->assign('parentcatlist', $parentcatlist); |
|
54 | 54 | $this->smarty->assign('catClass', $category); |
55 | 55 | $searchStr = ''; |
56 | 56 | if ($this->page == 'search' && isset($_REQUEST["id"])) |
57 | - $searchStr = (string) $_REQUEST["id"]; |
|
58 | - $this->smarty->assign('header_menu_search',$searchStr); |
|
57 | + $searchStr = (string)$_REQUEST["id"]; |
|
58 | + $this->smarty->assign('header_menu_search', $searchStr); |
|
59 | 59 | |
60 | 60 | if (isset($_REQUEST["t"])) { |
61 | 61 | $this->smarty->assign('header_menu_cat', $_REQUEST["t"]); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->smarty->assign('header_menu_cat', ''); |
64 | 64 | } |
65 | 65 | $header_menu = $this->smarty->fetch('headermenu.tpl'); |
66 | - $this->smarty->assign('header_menu',$header_menu); |
|
66 | + $this->smarty->assign('header_menu', $header_menu); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function render() |
73 | 73 | { |
74 | - $this->smarty->assign('page',$this); |
|
74 | + $this->smarty->assign('page', $this); |
|
75 | 75 | $this->page_template = "basepage.tpl"; |
76 | 76 | |
77 | 77 | parent::render(); |
@@ -28,8 +28,9 @@ discard block |
||
28 | 28 | ); |
29 | 29 | |
30 | 30 | $role = Users::ROLE_GUEST; |
31 | - if ($this->userdata != null) |
|
32 | - $role = $this->userdata["role"]; |
|
31 | + if ($this->userdata != null) { |
|
32 | + $role = $this->userdata["role"]; |
|
33 | + } |
|
33 | 34 | |
34 | 35 | $content = new Contents(['Settings' => $this->settings]); |
35 | 36 | $f = new Forum(); |
@@ -37,24 +38,27 @@ discard block |
||
37 | 38 | $this->smarty->assign('menulist',$menu->get($role, $this->serverurl)); |
38 | 39 | $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role)); |
39 | 40 | $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role)); |
40 | - if ($this->userdata != null) |
|
41 | - $this->smarty->assign('recentforumpostslist',$f->getPosts($this->settings->getSetting('showrecentforumposts'))); |
|
41 | + if ($this->userdata != null) { |
|
42 | + $this->smarty->assign('recentforumpostslist',$f->getPosts($this->settings->getSetting('showrecentforumposts'))); |
|
43 | + } |
|
42 | 44 | |
43 | 45 | $this->smarty->assign('main_menu',$this->smarty->fetch('mainmenu.tpl')); |
44 | 46 | $this->smarty->assign('useful_menu',$this->smarty->fetch('usefullinksmenu.tpl')); |
45 | 47 | $this->smarty->assign('article_menu',$this->smarty->fetch('articlesmenu.tpl')); |
46 | 48 | |
47 | 49 | $category = new Category(['Settings' => $content->pdo]); |
48 | - if ($this->userdata != null) |
|
49 | - $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]); |
|
50 | - else |
|
51 | - $parentcatlist = $category->getForMenu(); |
|
50 | + if ($this->userdata != null) { |
|
51 | + $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]); |
|
52 | + } else { |
|
53 | + $parentcatlist = $category->getForMenu(); |
|
54 | + } |
|
52 | 55 | |
53 | 56 | $this->smarty->assign('parentcatlist',$parentcatlist); |
54 | 57 | $this->smarty->assign('catClass', $category); |
55 | 58 | $searchStr = ''; |
56 | - if ($this->page == 'search' && isset($_REQUEST["id"])) |
|
57 | - $searchStr = (string) $_REQUEST["id"]; |
|
59 | + if ($this->page == 'search' && isset($_REQUEST["id"])) { |
|
60 | + $searchStr = (string) $_REQUEST["id"]; |
|
61 | + } |
|
58 | 62 | $this->smarty->assign('header_menu_search',$searchStr); |
59 | 63 | |
60 | 64 | if (isset($_REQUEST["t"])) { |
@@ -22,173 +22,173 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | switch ($action) { |
25 | - case 'delete': |
|
26 | - $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
27 | - if (isset($_REQUEST['from'])) { |
|
28 | - header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
29 | - } else { |
|
30 | - header("Location:" . WWW_TOP . "/mymovies"); |
|
31 | - } |
|
32 | - if (!$movie) { |
|
33 | - $page->show404('Not subscribed'); |
|
34 | - } else { |
|
35 | - $um->delMovie($page->users->currentUserId(), $imdbid); |
|
36 | - } |
|
37 | - |
|
38 | - break; |
|
39 | - case 'add': |
|
40 | - case 'doadd': |
|
41 | - $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
42 | - if ($movie) { |
|
43 | - $page->show404('Already subscribed'); |
|
44 | - } else { |
|
45 | - $movie = $mv->getMovieInfo($imdbid); |
|
46 | - if (!$movie) { |
|
47 | - $page->show404('No matching movie.'); |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - if ($action == 'doadd') { |
|
52 | - $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
53 | - $um->addMovie($page->users->currentUserId(), $imdbid, $category); |
|
25 | + case 'delete': |
|
26 | + $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
54 | 27 | if (isset($_REQUEST['from'])) { |
55 | 28 | header("Location:" . WWW_TOP . $_REQUEST['from']); |
56 | 29 | } else { |
57 | 30 | header("Location:" . WWW_TOP . "/mymovies"); |
58 | 31 | } |
59 | - } else { |
|
60 | - $cat = new Category(['Settings' => $page->settings]); |
|
61 | - $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
62 | - $categories = []; |
|
63 | - foreach ($tmpcats as $c) { |
|
64 | - // If MOVIE WEB-DL categorization is disabled, don't include it as an option |
|
65 | - if ($page->settings->getSetting('catwebdl') == 0 && $c['id'] == Category::MOVIE_WEBDL) { |
|
66 | - continue; |
|
32 | + if (!$movie) { |
|
33 | + $page->show404('Not subscribed'); |
|
34 | + } else { |
|
35 | + $um->delMovie($page->users->currentUserId(), $imdbid); |
|
36 | + } |
|
37 | + |
|
38 | + break; |
|
39 | + case 'add': |
|
40 | + case 'doadd': |
|
41 | + $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
42 | + if ($movie) { |
|
43 | + $page->show404('Already subscribed'); |
|
44 | + } else { |
|
45 | + $movie = $mv->getMovieInfo($imdbid); |
|
46 | + if (!$movie) { |
|
47 | + $page->show404('No matching movie.'); |
|
67 | 48 | } |
68 | - $categories[$c['id']] = $c['title']; |
|
69 | 49 | } |
70 | - $page->smarty->assign('type', 'add'); |
|
71 | - $page->smarty->assign('cat_ids', array_keys($categories)); |
|
72 | - $page->smarty->assign('cat_names', $categories); |
|
73 | - $page->smarty->assign('cat_selected', []); |
|
74 | - $page->smarty->assign('imdbid', $imdbid); |
|
75 | - $page->smarty->assign('movie', $movie); |
|
76 | - $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
77 | - $page->render(); |
|
78 | - } |
|
79 | - break; |
|
80 | - case 'edit': |
|
81 | - case 'doedit': |
|
82 | - $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
83 | - |
|
84 | - if (!$movie) { |
|
85 | - $page->show404(); |
|
86 | - } |
|
87 | - |
|
88 | - if ($action == 'doedit') { |
|
89 | - $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
90 | - $um->updateMovie($page->users->currentUserId(), $imdbid, $category); |
|
91 | - if (isset($_REQUEST['from'])) { |
|
92 | - header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
50 | + |
|
51 | + if ($action == 'doadd') { |
|
52 | + $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
53 | + $um->addMovie($page->users->currentUserId(), $imdbid, $category); |
|
54 | + if (isset($_REQUEST['from'])) { |
|
55 | + header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
56 | + } else { |
|
57 | + header("Location:" . WWW_TOP . "/mymovies"); |
|
58 | + } |
|
93 | 59 | } else { |
94 | - header("Location:" . WWW_TOP . "/mymovies"); |
|
60 | + $cat = new Category(['Settings' => $page->settings]); |
|
61 | + $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
62 | + $categories = []; |
|
63 | + foreach ($tmpcats as $c) { |
|
64 | + // If MOVIE WEB-DL categorization is disabled, don't include it as an option |
|
65 | + if ($page->settings->getSetting('catwebdl') == 0 && $c['id'] == Category::MOVIE_WEBDL) { |
|
66 | + continue; |
|
67 | + } |
|
68 | + $categories[$c['id']] = $c['title']; |
|
69 | + } |
|
70 | + $page->smarty->assign('type', 'add'); |
|
71 | + $page->smarty->assign('cat_ids', array_keys($categories)); |
|
72 | + $page->smarty->assign('cat_names', $categories); |
|
73 | + $page->smarty->assign('cat_selected', []); |
|
74 | + $page->smarty->assign('imdbid', $imdbid); |
|
75 | + $page->smarty->assign('movie', $movie); |
|
76 | + $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
77 | + $page->render(); |
|
78 | + } |
|
79 | + break; |
|
80 | + case 'edit': |
|
81 | + case 'doedit': |
|
82 | + $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
83 | + |
|
84 | + if (!$movie) { |
|
85 | + $page->show404(); |
|
95 | 86 | } |
96 | - } else { |
|
97 | - $cat = new Category(['Settings' => $page->settings]); |
|
98 | 87 | |
88 | + if ($action == 'doedit') { |
|
89 | + $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
90 | + $um->updateMovie($page->users->currentUserId(), $imdbid, $category); |
|
91 | + if (isset($_REQUEST['from'])) { |
|
92 | + header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
93 | + } else { |
|
94 | + header("Location:" . WWW_TOP . "/mymovies"); |
|
95 | + } |
|
96 | + } else { |
|
97 | + $cat = new Category(['Settings' => $page->settings]); |
|
98 | + |
|
99 | + $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
100 | + $categories = []; |
|
101 | + foreach ($tmpcats as $c) { |
|
102 | + $categories[$c['id']] = $c['title']; |
|
103 | + } |
|
104 | + |
|
105 | + $page->smarty->assign('type', 'edit'); |
|
106 | + $page->smarty->assign('cat_ids', array_keys($categories)); |
|
107 | + $page->smarty->assign('cat_names', $categories); |
|
108 | + $page->smarty->assign('cat_selected', explode('|', $movie['categories'])); |
|
109 | + $page->smarty->assign('imdbid', $imdbid); |
|
110 | + $page->smarty->assign('movie', $movie); |
|
111 | + $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
112 | + $page->render(); |
|
113 | + } |
|
114 | + break; |
|
115 | + case 'browse': |
|
116 | + |
|
117 | + $page->title = "Browse My Shows"; |
|
118 | + $page->meta_title = "My Shows"; |
|
119 | + $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
120 | + $page->meta_description = "Browse Your Shows"; |
|
121 | + |
|
122 | + $movies = $um->getMovies($page->users->currentUserId()); |
|
123 | + |
|
124 | + $releases = new Releases(['Settings' => $page->settings]); |
|
125 | + $browsecount = $releases->getMovieCount($movies, -1, $page->userdata["categoryexclusions"]); |
|
126 | + |
|
127 | + $offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0; |
|
128 | + $ordering = $releases->getBrowseOrdering(); |
|
129 | + $orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; |
|
130 | + |
|
131 | + $results = []; |
|
132 | + $results = $mv->getMovieRange($movies, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); |
|
133 | + |
|
134 | + $page->smarty->assign('pagertotalitems', $browsecount); |
|
135 | + $page->smarty->assign('pageroffset', $offset); |
|
136 | + $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); |
|
137 | + $page->smarty->assign('pagerquerybase', WWW_TOP . "/mymovies/browse?ob=" . $orderby . "&offset="); |
|
138 | + $page->smarty->assign('pagerquerysuffix', "#results"); |
|
139 | + $page->smarty->assign('covgroup', ''); |
|
140 | + |
|
141 | + $pager = $page->smarty->fetch("pager.tpl"); |
|
142 | + $page->smarty->assign('pager', $pager); |
|
143 | + |
|
144 | + foreach ($ordering as $ordertype) { |
|
145 | + $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/mymovies/browse?ob=" . $ordertype . "&offset=0"); |
|
146 | + } |
|
147 | + |
|
148 | + $page->smarty->assign('lastvisit', $page->userdata['lastlogin']); |
|
149 | + |
|
150 | + $page->smarty->assign('results', $results); |
|
151 | + |
|
152 | + $page->smarty->assign('movies', true); |
|
153 | + |
|
154 | + $page->content = $page->smarty->fetch('browse.tpl'); |
|
155 | + $page->render(); |
|
156 | + break; |
|
157 | + default: |
|
158 | + |
|
159 | + $page->title = "My Movies"; |
|
160 | + $page->meta_title = "My Movies"; |
|
161 | + $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
162 | + $page->meta_description = "Manage Your Movies"; |
|
163 | + |
|
164 | + $cat = new Category(['Settings' => $page->settings]); |
|
99 | 165 | $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
100 | 166 | $categories = []; |
101 | 167 | foreach ($tmpcats as $c) { |
102 | 168 | $categories[$c['id']] = $c['title']; |
103 | 169 | } |
104 | 170 | |
105 | - $page->smarty->assign('type', 'edit'); |
|
106 | - $page->smarty->assign('cat_ids', array_keys($categories)); |
|
107 | - $page->smarty->assign('cat_names', $categories); |
|
108 | - $page->smarty->assign('cat_selected', explode('|', $movie['categories'])); |
|
109 | - $page->smarty->assign('imdbid', $imdbid); |
|
110 | - $page->smarty->assign('movie', $movie); |
|
111 | - $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
112 | - $page->render(); |
|
113 | - } |
|
114 | - break; |
|
115 | - case 'browse': |
|
116 | - |
|
117 | - $page->title = "Browse My Shows"; |
|
118 | - $page->meta_title = "My Shows"; |
|
119 | - $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
120 | - $page->meta_description = "Browse Your Shows"; |
|
121 | - |
|
122 | - $movies = $um->getMovies($page->users->currentUserId()); |
|
123 | - |
|
124 | - $releases = new Releases(['Settings' => $page->settings]); |
|
125 | - $browsecount = $releases->getMovieCount($movies, -1, $page->userdata["categoryexclusions"]); |
|
126 | - |
|
127 | - $offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0; |
|
128 | - $ordering = $releases->getBrowseOrdering(); |
|
129 | - $orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; |
|
130 | - |
|
131 | - $results = []; |
|
132 | - $results = $mv->getMovieRange($movies, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); |
|
133 | - |
|
134 | - $page->smarty->assign('pagertotalitems', $browsecount); |
|
135 | - $page->smarty->assign('pageroffset', $offset); |
|
136 | - $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); |
|
137 | - $page->smarty->assign('pagerquerybase', WWW_TOP . "/mymovies/browse?ob=" . $orderby . "&offset="); |
|
138 | - $page->smarty->assign('pagerquerysuffix', "#results"); |
|
139 | - $page->smarty->assign('covgroup', ''); |
|
140 | - |
|
141 | - $pager = $page->smarty->fetch("pager.tpl"); |
|
142 | - $page->smarty->assign('pager', $pager); |
|
143 | - |
|
144 | - foreach ($ordering as $ordertype) { |
|
145 | - $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/mymovies/browse?ob=" . $ordertype . "&offset=0"); |
|
146 | - } |
|
147 | - |
|
148 | - $page->smarty->assign('lastvisit', $page->userdata['lastlogin']); |
|
149 | - |
|
150 | - $page->smarty->assign('results', $results); |
|
151 | - |
|
152 | - $page->smarty->assign('movies', true); |
|
153 | - |
|
154 | - $page->content = $page->smarty->fetch('browse.tpl'); |
|
155 | - $page->render(); |
|
156 | - break; |
|
157 | - default: |
|
158 | - |
|
159 | - $page->title = "My Movies"; |
|
160 | - $page->meta_title = "My Movies"; |
|
161 | - $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
162 | - $page->meta_description = "Manage Your Movies"; |
|
163 | - |
|
164 | - $cat = new Category(['Settings' => $page->settings]); |
|
165 | - $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
166 | - $categories = []; |
|
167 | - foreach ($tmpcats as $c) { |
|
168 | - $categories[$c['id']] = $c['title']; |
|
169 | - } |
|
170 | - |
|
171 | - $movies = $um->getMovies($page->users->currentUserId()); |
|
172 | - $results = []; |
|
173 | - foreach ($movies as $moviek => $movie) { |
|
174 | - $showcats = explode('|', $movie['categories']); |
|
175 | - if (is_array($showcats) && sizeof($showcats) > 0) { |
|
176 | - $catarr = []; |
|
177 | - foreach ($showcats as $scat) { |
|
178 | - if (!empty($scat)) { |
|
179 | - $catarr[] = $categories[$scat]; |
|
171 | + $movies = $um->getMovies($page->users->currentUserId()); |
|
172 | + $results = []; |
|
173 | + foreach ($movies as $moviek => $movie) { |
|
174 | + $showcats = explode('|', $movie['categories']); |
|
175 | + if (is_array($showcats) && sizeof($showcats) > 0) { |
|
176 | + $catarr = []; |
|
177 | + foreach ($showcats as $scat) { |
|
178 | + if (!empty($scat)) { |
|
179 | + $catarr[] = $categories[$scat]; |
|
180 | + } |
|
180 | 181 | } |
182 | + $movie['categoryNames'] = implode(', ', $catarr); |
|
183 | + } else { |
|
184 | + $movie['categoryNames'] = ''; |
|
181 | 185 | } |
182 | - $movie['categoryNames'] = implode(', ', $catarr); |
|
183 | - } else { |
|
184 | - $movie['categoryNames'] = ''; |
|
185 | - } |
|
186 | 186 | |
187 | - $results[$moviek] = $movie; |
|
188 | - } |
|
189 | - $page->smarty->assign('movies', $results); |
|
187 | + $results[$moviek] = $movie; |
|
188 | + } |
|
189 | + $page->smarty->assign('movies', $results); |
|
190 | 190 | |
191 | - $page->content = $page->smarty->fetch('mymovies.tpl'); |
|
192 | - $page->render(); |
|
193 | - break; |
|
191 | + $page->content = $page->smarty->fetch('mymovies.tpl'); |
|
192 | + $page->render(); |
|
193 | + break; |
|
194 | 194 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use nntmux\CouchPotato; |
4 | 4 | |
5 | -if (!$page->users->isLoggedIn()){ |
|
5 | +if (!$page->users->isLoggedIn()) { |
|
6 | 6 | $page->show403(); |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use nntmux\CouchPotato; |
4 | 4 | |
5 | -if (!$page->users->isLoggedIn()){ |
|
5 | +if (!$page->users->isLoggedIn()) { |
|
6 | 6 | $page->show403(); |
7 | 7 | } |
8 | 8 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | if (!$ret) |
11 | 11 | print "Invite not sent."; |
12 | 12 | else |
13 | - print "Invite sent. Alternatively paste them following link to register - ".$ret; |
|
13 | + print "Invite sent. Alternatively paste them following link to register - " . $ret; |
|
14 | 14 | } |
15 | 15 | else |
16 | 16 | { |
@@ -1,18 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!$page->users->isLoggedIn()) |
|
3 | +if (!$page->users->isLoggedIn()) { |
|
4 | 4 | $page->show403(); |
5 | +} |
|
5 | 6 | |
6 | -if (isset($_GET['action']) && $_GET['action'] == "1" && isset($_GET['emailto'])) |
|
7 | -{ |
|
7 | +if (isset($_GET['action']) && $_GET['action'] == "1" && isset($_GET['emailto'])) { |
|
8 | 8 | $emailto = $_GET['emailto']; |
9 | 9 | $ret = $page->users->sendInvite($page->settings->getSetting('title'), $page->settings->getSetting('email'), $page->serverurl, $page->users->currentUserId(), $emailto); |
10 | - if (!$ret) |
|
11 | - print "Invite not sent."; |
|
12 | - else |
|
13 | - print "Invite sent. Alternatively paste them following link to register - ".$ret; |
|
14 | -} |
|
15 | -else |
|
16 | -{ |
|
10 | + if (!$ret) { |
|
11 | + print "Invite not sent."; |
|
12 | + } else { |
|
13 | + print "Invite sent. Alternatively paste them following link to register - ".$ret; |
|
14 | + } |
|
15 | + } else { |
|
17 | 16 | print "Invite not sent."; |
18 | 17 | } |