Changed variables.
This commit is contained in:
+10
-10
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$data = array_merge($data, [
|
||||
$ctx->withData([
|
||||
'title' => 'Novaconium Edit Page',
|
||||
'pageclass' => 'novaconium',
|
||||
'pageid' => 'controlPanel',
|
||||
@@ -8,14 +8,14 @@ $data = array_merge($data, [
|
||||
]);
|
||||
|
||||
// Check if logged in
|
||||
if (empty($session->get('username'))) {
|
||||
$messages->error('You are not logged in');
|
||||
$redirect->url('/novaconium/login');
|
||||
if (empty($ctx->session->get('username'))) {
|
||||
$ctx->messages->error('You are not logged in');
|
||||
$ctx->redirect->url('/novaconium/login');
|
||||
makeitso();
|
||||
}
|
||||
|
||||
// Get page ID from router parameters
|
||||
$pageid = $router->parameters['id'] ?? null;
|
||||
$pageid = $ctx->router->parameters['id'] ?? null;
|
||||
|
||||
if (!empty($pageid)) {
|
||||
// Existing page: fetch from database
|
||||
@@ -51,23 +51,23 @@ WHERE p.id = ?
|
||||
GROUP BY p.id;
|
||||
EOSQL;
|
||||
|
||||
$data['rows'] = $db->getRow($query, [$pageid]);
|
||||
$ctx->data['rows'] = $ctx->db->getRow($query, [$pageid]);
|
||||
|
||||
// If no row is found, treat as new page
|
||||
if (!$data['rows']) {
|
||||
if (!$ctx->data['rows']) {
|
||||
$pageid = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($pageid)) {
|
||||
// New page: set default values for all fields
|
||||
$data['rows'] = [
|
||||
$ctx->data['rows'] = [
|
||||
'id' => 'newpage',
|
||||
'title' => '',
|
||||
'heading' => '',
|
||||
'description' => '',
|
||||
'keywords' => '',
|
||||
'author' => $session->get('username') ?? '',
|
||||
'author' => $ctx->session->get('username') ?? '',
|
||||
'slug' => '',
|
||||
'path' => '',
|
||||
'intro' => '',
|
||||
@@ -82,4 +82,4 @@ if (empty($pageid)) {
|
||||
}
|
||||
|
||||
// Render the edit page view
|
||||
view('@novacore/editpage/index', $data);
|
||||
view('@novacore/editpage/index', $ctx->data);
|
||||
|
||||
Reference in New Issue
Block a user