@@ -7,7 +7,7 @@ |
||
7 | 7 | ); |
8 | 8 | } |
9 | 9 | |
10 | -declare(ticks=1); |
|
10 | +declare(ticks = 1); |
|
11 | 11 | require('.do_not_run/require.php'); |
12 | 12 | |
13 | 13 | use \nntmux\libraries\Forking; |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | |
14 | 14 | function handleError($errno, $errstr, $errfile, $errline, array $errcontext) |
15 | 15 | { |
16 | - // error was suppressed with the @-operator |
|
17 | - if (0 === error_reporting()) { |
|
18 | - return false; |
|
19 | - } |
|
16 | + // error was suppressed with the @-operator |
|
17 | + if (0 === error_reporting()) { |
|
18 | + return false; |
|
19 | + } |
|
20 | 20 | |
21 | - throw new ErrorException($errstr, 0, $errno, $errfile, $errline); |
|
21 | + throw new ErrorException($errstr, 0, $errno, $errfile, $errline); |
|
22 | 22 | } |
23 | 23 | set_error_handler('handleError'); |
24 | 24 | |
25 | 25 | $regs = array( |
26 | - "empty" => "", |
|
27 | - "illformed" => "[](9()))))))))) [34543/34]", |
|
28 | - "simple" => '"data.mp3', |
|
26 | + "empty" => "", |
|
27 | + "illformed" => "[](9()))))))))) [34543/34]", |
|
28 | + "simple" => '"data.mp3', |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | $releases = new Releases(); |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | foreach ($res as $regexrow) |
41 | 41 | { |
42 | 42 | foreach ($regs as $regex){ |
43 | - try { |
|
44 | - $res=preg_match($regexrow["regex"], $regex); |
|
45 | - }catch(Exception $e){ |
|
46 | - $errcnt++; |
|
47 | - $strerr=str_pad((int) $errcnt,2," ",STR_PAD_LEFT); |
|
48 | - echo "$strerr. id=".$regexrow["id"]. |
|
49 | - ", group=".$regexrow["groupname"]."\n"; |
|
50 | - echo " regex='".$regexrow["regex"]."'\n"; |
|
51 | - echo " error=".$e->getMessage()."\n\n"; |
|
52 | - break; |
|
53 | - } |
|
43 | + try { |
|
44 | + $res=preg_match($regexrow["regex"], $regex); |
|
45 | + }catch(Exception $e){ |
|
46 | + $errcnt++; |
|
47 | + $strerr=str_pad((int) $errcnt,2," ",STR_PAD_LEFT); |
|
48 | + echo "$strerr. id=".$regexrow["id"]. |
|
49 | + ", group=".$regexrow["groupname"]."\n"; |
|
50 | + echo " regex='".$regexrow["regex"]."'\n"; |
|
51 | + echo " error=".$e->getMessage()."\n\n"; |
|
52 | + break; |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | echo "Scanned $total record(s), $errcnt error(s) found.\n"; |
@@ -33,25 +33,25 @@ |
||
33 | 33 | # fetch enabled regular expression |
34 | 34 | $catsql = "select ID,groupname,regex from releaseregex where status = 1"; |
35 | 35 | $res = $db->query($catsql); |
36 | -$total=count($res); |
|
37 | -$errcnt=0; |
|
36 | +$total = count($res); |
|
37 | +$errcnt = 0; |
|
38 | 38 | |
39 | 39 | echo "\n"; |
40 | 40 | foreach ($res as $regexrow) |
41 | 41 | { |
42 | - foreach ($regs as $regex){ |
|
42 | + foreach ($regs as $regex) { |
|
43 | 43 | try { |
44 | - $res=preg_match($regexrow["regex"], $regex); |
|
45 | - }catch(Exception $e){ |
|
44 | + $res = preg_match($regexrow["regex"], $regex); |
|
45 | + } catch (Exception $e) { |
|
46 | 46 | $errcnt++; |
47 | - $strerr=str_pad((int) $errcnt,2," ",STR_PAD_LEFT); |
|
48 | - echo "$strerr. id=".$regexrow["id"]. |
|
49 | - ", group=".$regexrow["groupname"]."\n"; |
|
50 | - echo " regex='".$regexrow["regex"]."'\n"; |
|
51 | - echo " error=".$e->getMessage()."\n\n"; |
|
47 | + $strerr = str_pad((int)$errcnt, 2, " ", STR_PAD_LEFT); |
|
48 | + echo "$strerr. id=" . $regexrow["id"] . |
|
49 | + ", group=" . $regexrow["groupname"] . "\n"; |
|
50 | + echo " regex='" . $regexrow["regex"] . "'\n"; |
|
51 | + echo " error=" . $e->getMessage() . "\n\n"; |
|
52 | 52 | break; |
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | 56 | echo "Scanned $total record(s), $errcnt error(s) found.\n"; |
57 | -exit(($errcnt>0)?1:0); |
|
57 | +exit(($errcnt > 0) ? 1 : 0); |
@@ -37,12 +37,11 @@ |
||
37 | 37 | $errcnt=0; |
38 | 38 | |
39 | 39 | echo "\n"; |
40 | -foreach ($res as $regexrow) |
|
41 | -{ |
|
42 | - foreach ($regs as $regex){ |
|
40 | +foreach ($res as $regexrow) { |
|
41 | + foreach ($regs as $regex) { |
|
43 | 42 | try { |
44 | 43 | $res=preg_match($regexrow["regex"], $regex); |
45 | - }catch(Exception $e){ |
|
44 | + } catch(Exception $e) { |
|
46 | 45 | $errcnt++; |
47 | 46 | $strerr=str_pad((int) $errcnt,2," ",STR_PAD_LEFT); |
48 | 47 | echo "$strerr. id=".$regexrow["id"]. |
@@ -53,5 +53,5 @@ |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | -echo "Scanned $total record(s), $errcnt error(s) found.\n"; |
|
56 | +echo "scanned $total record(s), $errcnt error(s) found.\n"; |
|
57 | 57 | exit(($errcnt>0)?1:0); |
@@ -26,14 +26,11 @@ |
||
26 | 26 | $page->meta_description = ""; |
27 | 27 | $page->smarty->registerPlugin('modifier', 'ss', 'stripslashes'); |
28 | 28 | |
29 | - if (isset($_GET['modal'])) |
|
30 | - { |
|
29 | + if (isset($_GET['modal'])) { |
|
31 | 30 | $page->content = $page->smarty->fetch('viewxxx.tpl'); |
32 | 31 | $page->smarty->assign('modal', true); |
33 | 32 | echo $page->content; |
34 | - } |
|
35 | - else |
|
36 | - { |
|
33 | + } else { |
|
37 | 34 | $page->content = $page->smarty->fetch('viewxxxfull.tpl'); |
38 | 35 | $page->render(); |
39 | 36 | } |
@@ -6,14 +6,14 @@ |
||
6 | 6 | |
7 | 7 | $page = new AdminPage(); |
8 | 8 | |
9 | -if (isset($_GET['id'])) |
|
10 | -{ |
|
9 | +if (isset($_GET['id'])) { |
|
11 | 10 | $forum = new Forum(); |
12 | 11 | $forum->deletePost($_GET['id']); |
13 | 12 | } |
14 | 13 | |
15 | -if (isset($_GET['from'])) |
|
14 | +if (isset($_GET['from'])) { |
|
16 | 15 | $referrer = $_GET['from']; |
17 | -else |
|
16 | +} else { |
|
18 | 17 | $referrer = $_SERVER['HTTP_REFERER']; |
18 | +} |
|
19 | 19 | header("Location: " . $referrer); |
@@ -6,8 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $page = new AdminPage(); |
8 | 8 | |
9 | -if (isset($_GET['id'])) |
|
10 | -{ |
|
9 | +if (isset($_GET['id'])) { |
|
11 | 10 | $users = new Users(); |
12 | 11 | $users->deleteRole($_GET['id']); |
13 | 12 | } |
@@ -6,8 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $page = new AdminPage(); |
8 | 8 | |
9 | -if (isset($_GET['id'])) |
|
10 | -{ |
|
9 | +if (isset($_GET['id'])) { |
|
11 | 10 | $users = new Users(); |
12 | 11 | $users->deleteRole($_GET['id']); |
13 | 12 | } |
@@ -6,8 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $page = new AdminPage(); |
8 | 8 | |
9 | -if (isset($_GET['id'])) |
|
10 | -{ |
|
9 | +if (isset($_GET['id'])) { |
|
11 | 10 | $users = new Users(); |
12 | 11 | $users->deleteRole($_GET['id']); |
13 | 12 | } |
@@ -6,8 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $page = new AdminPage(); |
8 | 8 | |
9 | -if (isset($_GET['id'])) |
|
10 | -{ |
|
9 | +if (isset($_GET['id'])) { |
|
11 | 10 | $users = new Users(); |
12 | 11 | $users->deleteRole($_GET['id']); |
13 | 12 | } |
@@ -14,46 +14,46 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
17 | - case 'add': |
|
18 | - $page->title = "User Roles Add"; |
|
19 | - $role = [ |
|
20 | - 'id' => '', |
|
21 | - 'name' => '', |
|
22 | - 'apirequests' => '', |
|
23 | - 'downloadrequests' => '', |
|
24 | - 'defaultinvites' => '', |
|
25 | - 'canpreview' => 0, |
|
26 | - 'hideads' => 0 |
|
27 | - ]; |
|
28 | - $page->smarty->assign('role', $role); |
|
29 | - break; |
|
17 | + case 'add': |
|
18 | + $page->title = "User Roles Add"; |
|
19 | + $role = [ |
|
20 | + 'id' => '', |
|
21 | + 'name' => '', |
|
22 | + 'apirequests' => '', |
|
23 | + 'downloadrequests' => '', |
|
24 | + 'defaultinvites' => '', |
|
25 | + 'canpreview' => 0, |
|
26 | + 'hideads' => 0 |
|
27 | + ]; |
|
28 | + $page->smarty->assign('role', $role); |
|
29 | + break; |
|
30 | 30 | |
31 | - case 'submit': |
|
32 | - if ($_POST["id"] == "") { |
|
33 | - $ret = $page->users->addRole($_POST['name'], $_POST['apirequests'], $_POST['downloadrequests'], |
|
34 | - $_POST['defaultinvites'], $_POST['canpreview'], $_POST['hideads'] |
|
35 | - ); |
|
36 | - header("Location:" . WWW_TOP . "/role-list.php"); |
|
37 | - } else { |
|
38 | - $ret = $page->users->updateRole($_POST['id'], $_POST['name'], $_POST['apirequests'], |
|
39 | - $_POST['downloadrequests'], $_POST['defaultinvites'], $_POST['isdefault'], $_POST['canpreview'], $_POST['hideads'] |
|
40 | - ); |
|
41 | - header("Location:" . WWW_TOP . "/role-list.php"); |
|
31 | + case 'submit': |
|
32 | + if ($_POST["id"] == "") { |
|
33 | + $ret = $page->users->addRole($_POST['name'], $_POST['apirequests'], $_POST['downloadrequests'], |
|
34 | + $_POST['defaultinvites'], $_POST['canpreview'], $_POST['hideads'] |
|
35 | + ); |
|
36 | + header("Location:" . WWW_TOP . "/role-list.php"); |
|
37 | + } else { |
|
38 | + $ret = $page->users->updateRole($_POST['id'], $_POST['name'], $_POST['apirequests'], |
|
39 | + $_POST['downloadrequests'], $_POST['defaultinvites'], $_POST['isdefault'], $_POST['canpreview'], $_POST['hideads'] |
|
40 | + ); |
|
41 | + header("Location:" . WWW_TOP . "/role-list.php"); |
|
42 | 42 | |
43 | - $_POST['exccat'] = (!isset($_POST['exccat']) || !is_array($_POST['exccat'])) ? [] : $_POST['exccat']; |
|
44 | - $page->users->addRoleCategoryExclusions($_POST['id'], $_POST['exccat']); |
|
45 | - } |
|
46 | - break; |
|
43 | + $_POST['exccat'] = (!isset($_POST['exccat']) || !is_array($_POST['exccat'])) ? [] : $_POST['exccat']; |
|
44 | + $page->users->addRoleCategoryExclusions($_POST['id'], $_POST['exccat']); |
|
45 | + } |
|
46 | + break; |
|
47 | 47 | |
48 | - case 'view': |
|
49 | - default: |
|
50 | - if (isset($_GET["id"])) { |
|
51 | - $page->title = "User Roles Edit"; |
|
52 | - $role = $page->users->getRoleById($_GET["id"]); |
|
53 | - $page->smarty->assign('role', $role); |
|
54 | - $page->smarty->assign('roleexccat', $page->users->getRoleCategoryExclusion($_GET["id"])); |
|
55 | - } |
|
56 | - break; |
|
48 | + case 'view': |
|
49 | + default: |
|
50 | + if (isset($_GET["id"])) { |
|
51 | + $page->title = "User Roles Edit"; |
|
52 | + $role = $page->users->getRoleById($_GET["id"]); |
|
53 | + $page->smarty->assign('role', $role); |
|
54 | + $page->smarty->assign('roleexccat', $page->users->getRoleCategoryExclusion($_GET["id"])); |
|
55 | + } |
|
56 | + break; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $page->smarty->assign('yesno_ids', [1, 0]); |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
17 | - case 'add': |
|
18 | - $page->title = "User Roles Add"; |
|
17 | + case 'add' : $page->title = "User Roles Add"; |
|
19 | 18 | $role = [ |
20 | 19 | 'id' => '', |
21 | 20 | 'name' => '', |
@@ -58,7 +57,7 @@ discard block |
||
58 | 57 | |
59 | 58 | $page->smarty->assign('yesno_ids', [1, 0]); |
60 | 59 | $page->smarty->assign('yesno_names', ['Yes', 'No']); |
61 | -$page->smarty->assign('catlist',$category->getForSelect(false)); |
|
60 | +$page->smarty->assign('catlist', $category->getForSelect(false)); |
|
62 | 61 | |
63 | 62 | $page->content = $page->smarty->fetch('role-edit.tpl'); |
64 | 63 | $page->render(); |