diff --git a/newznab/controllers/BasePage.php b/newznab/controllers/BasePage.php index 3405ad420..5961ff95d 100644 --- a/newznab/controllers/BasePage.php +++ b/newznab/controllers/BasePage.php @@ -36,7 +36,6 @@ class BasePage public $smarty = ''; public $userdata = array(); public $serverurl = ''; - public $site = ''; public $secure_connection = false; @@ -58,10 +57,6 @@ class BasePage $this->stripSlashes($_COOKIE); } - // set site variable - $s = new Sites(); - $this->site = $s->get(); - // Buffer settings/DB connection. $this->settings = new Settings(); $this->smarty = new Smarty(); @@ -161,7 +156,7 @@ class BasePage } - $this->smarty->assign('site', $this->site); + $this->smarty->assign('site', $this->settings); $this->smarty->assign('page', $this); } diff --git a/www/admin/content-add.php b/www/admin/content-add.php index c8acec1e9..e184bbc29 100644 --- a/www/admin/content-add.php +++ b/www/admin/content-add.php @@ -1,68 +1,59 @@ $page->settings]); +$id = 0; -// set the current action +// Set the current action. $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view'; -switch($action) -{ - case 'add': - $page->title = "Content Add"; - $content = array(); - $content["showinmenu"] = "1"; - $content["status"] = "1"; - $content["contenttype"] = "2"; - $page->smarty->assign('content',$content); - break; +switch ($action) { + case 'add': + $page->title = "Content Add"; + $content = new Content(); + $content->showinmenu = "1"; + $content->status = "1"; + $content->contenttype = "2"; + $page->smarty->assign('content', $content); + break; - case 'submit': - // - // validate and add or update - // - $returnid = 0; - if (!isset($_POST["id"]) || $_POST["id"]=="") - { - $returnid = $contents->add($_POST); - } - else - { - $content = $contents->update($_POST); - $returnid = $_POST["id"]; - } - header("Location:content-add.php?id=".$returnid); + case 'submit': + // Validate and add or update. + $returnid = 0; + if (!isset($_POST["id"]) || $_POST["id"] == "") { + $returnid = $contents->add($_POST); + } else { + $content = $contents->update($_POST); + $returnid = $content->id; + } + header("Location:content-add.php?id=" . $returnid); + break; - break; - case 'view': - default: + case 'view': + default: + if (isset($_GET["id"])) { + $page->title = "Content Edit"; + $id = $_GET["id"]; - if (isset($_GET["id"])) - { - $page->title = "Content Edit"; - $id = $_GET["id"]; - - $content = $contents->getByID($id, Users::ROLE_ADMIN); - $page->smarty->assign('content', $content); - } - - break; + $content = $contents->getByID($id, Users::ROLE_ADMIN); + $page->smarty->assign('content', $content); + } + break; } -$page->smarty->assign('status_ids', array(1,0)); -$page->smarty->assign('status_names', array( 'Enabled', 'Disabled')); +$page->smarty->assign('status_ids', [1, 0]); +$page->smarty->assign('status_names', ['Enabled', 'Disabled']); -$page->smarty->assign('yesno_ids', array(1,0)); -$page->smarty->assign('yesno_names', array( 'Yes', 'No')); +$page->smarty->assign('yesno_ids', [1, 0]); +$page->smarty->assign('yesno_names', ['Yes', 'No']); -$contenttypelist = array("1" => "Useful Link", "2" => "Article", "3" => "Homepage"); +$contenttypelist = ["1" => "Useful Link", "2" => "Article", "3" => "Homepage"]; $page->smarty->assign('contenttypelist', $contenttypelist); -$rolelist = array("0" => "Everyone", "1" => "Logged in Users", "2" => "Admins"); +$rolelist = ["0" => "Everyone", "1" => "Logged in Users", "2" => "Admins"]; $page->smarty->assign('rolelist', $rolelist); $page->content = $page->smarty->fetch('content-add.tpl'); -$page->render(); +$page->render(); \ No newline at end of file diff --git a/www/admin/content-list.php b/www/admin/content-list.php index d9c8656cf..48d230d53 100644 --- a/www/admin/content-list.php +++ b/www/admin/content-list.php @@ -1,15 +1,13 @@ $page->settings]); $contentlist = $contents->getAll(); -$page->smarty->assign('contentlist',$contentlist); +$page->smarty->assign('contentlist', $contentlist); $page->title = "Content List"; $page->content = $page->smarty->fetch('content-list.tpl'); -$page->render(); - +$page->render(); \ No newline at end of file diff --git a/www/templates/nntmux/views/admin/content-add.tpl b/www/templates/nntmux/views/admin/content-add.tpl index 411de1c59..d3e1e7410 100644 --- a/www/templates/nntmux/views/admin/content-add.tpl +++ b/www/templates/nntmux/views/admin/content-add.tpl @@ -1,89 +1,74 @@ -
| ordinal | -id | +ordinal | +id | title | url | type | @@ -15,50 +12,46 @@body | options | |
|---|---|---|---|---|---|---|---|---|---|
| {$content.ordinal} | -{$content.id} | -{$content.title} | -/content/{$content.id}{$content.url} | -- {if $content.contenttype == "1"} - Useful Link - {elseif $content.contenttype == "2"} - Article - {elseif $content.contenttype == "3"} - Homepage - {/if} - | -- {if $content.status == "1"} - Enabled - {else} - Disabled - {/if} - | -- {if $content.role == "0"} - Everyone - {elseif $content.role == "1"} - Users - {elseif $content.role == "2"} - Admins - {/if} - | -- {if $content.showinmenu == "1"} - Yes - {else} - No - {/if} - | -{$content.body|truncate:100|escape:'htmlall'} | -{if $content.contenttype != "3"}delete{/if} | -
| {$content->ordinal} | +{$content->id} | +{$content->title} | +{$content->url}c{$content->id} | ++ {if $content->contenttype == "1"} + Useful Link + {elseif $content->contenttype == "2"} + Article + {elseif $content->contenttype == "3"} + Homepage + {/if} + | ++ {if $content->status == "1"} + Enabled + {else} + Disabled + {/if} + | ++ {if $content->role == "0"} + Everyone + {elseif $content->role == "1"} + Users + {elseif $content->role == "2"} + Admins + {/if} + | ++ {if $content->showinmenu == "1"} + Yes + {else} + No + {/if} + | +{$content->body|truncate:100|escape:'htmlall'} | +{if $content->contenttype != "3"}delete{/if} | +