| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/aprendizajeodisea/system/lib/ |
Upload File : |
<?php
class mdAdmin{
var $prefix = DB_PREFIX;
public function __construct($registry) {
$this->db = $registry->get('db');
}
//GLOBAL
public function changePublished($id,$published,$table){
$query = $this->db->query
("UPDATE ".$this->prefix.$table." SET published = $published WHERE id = $id");
}
//POSTS
public function postList() {
$query = $this->db->query("
SELECT post_title,id,published
FROM ".$this->prefix."posts
ORDER BY positionindex
");
return $query;
}
public function postContent($id){
$query = $this->db->query
("SELECT post_title,id,published,post_content,post_date,positionindex,category_id
FROM ".$this->prefix."posts
WHERE id = $id
");
return $query;
}
public function postCategories(){
$query = $this->db->query
("SELECT category_id,name
FROM ".$this->prefix."posts_category
WHERE status = 1
");
return $query;
}
function addPost($array){
$published = $array['published'];
$post_title = $this->db->escape($array['post_title']);
$post_content = $this->db->escape($array['bodyContent']);
$category_id = $array['category_id'];
$positionindex = $this->db->escape($array['menuindex']);
$post_date = $array['date'];
$query = $this->db->query
("INSERT INTO ".$this->prefix."posts
(post_title,published,post_content,post_date,positionindex,category_id)
VALUES(
'$post_title',$published,'$post_content','$post_date','$positionindex',
'$category_id'
)
");
}
function updatePost($array){
$id = $this->db->escape($array['id']);
$published = $array['published'];
$post_title = $this->db->escape($array['post_title']);
$post_content = $this->db->escape($array['bodyContent']);
$category_id = $array['category_id'];
$positionindex = $this->db->escape($array['menuindex']);
$post_date = $array['date'];
$timestamp = time();
$query = $this->db->query
("UPDATE ".$this->prefix."posts
SET post_title = '$post_title',id = $id,published = $published ,
post_content = '$post_content',post_date = '$post_date',
positionindex = '$positionindex',category_id ='$category_id',timestamp = '$timestamp'
WHERE id = $id
");
}
function deletePost($id){
$this->db->query
("DELETE FROM ".$this->prefix."posts WHERE id = $id");
}
//PAGES
public function page($q) {
$query = $this->db->query("SELECT module_id,module,static_file
FROM ".$this->prefix."admin_modules
WHERE alias='$q'");
return $query->row;
}
public function pageList() {
$query = $this->db->query("
SELECT pagetitle,id,alias,isfolder ,menutitle,published
FROM ".$this->prefix."site_content
ORDER BY menuindex
");
return $query;
}
public function getTemplates(){
$query = $this->db->query
("SELECT id,templatename,static_file FROM ".$this->prefix."site_templates");
return $query;
}
public function getParents(){
$query = $this->db->query
("SELECT id,pagetitle,parent FROM ".$this->prefix."site_content WHERE parent = 0");
return $query;
}
public function pageContent($id){
$query = $this->db->query("
SELECT pagetitle,id,alias,isfolder,published,template,menuindex,parent ,menutitle,content,m.keywords,m.description
FROM ".$this->prefix."site_content c
LEFT JOIN ".$this->prefix."site_meta m
ON c.id = m.content_id
WHERE id = $id
");
return $query;
}
public function addPage($array){
$title = $this->db->escape($array['pagetitle']);
$menutitle = $this->db->escape($array['menutitle']);
$description = $this->db->escape($array['description']);
$keywords = $this->db->escape($array['keywords']);
$content = $array['bodyContent'];
$template = $array['template'];
$published = $array['published'];
$parent = $array['parent'];
$alias = $array['alias'];
$menuindex = $this->db->escape($array['menuindex']);
//INSERT NEW PAGE
$query = $this->db->query
("INSERT INTO ".$this->prefix."site_content
(pagetitle,alias,content,menutitle,template,menuindex, published,parent)
VALUES('$title','$alias','$content','$menutitle',$template,$menuindex,$published,'$parent')
");
//CHECK LAST content_id
$query_id = $this->db->query("SELECT MAX(id)as id FROM ".$this->prefix."site_content");
$content_id = $query_id->row['id'];
//INSERT NEW PAGE META
$this->db->query
("INSERT INTO ".$this->prefix."site_meta
(content_id,description,keywords) VALUES($content_id,'$description','$keywords')
");
}
public function updatePage($array){
$id = $array['id'];
$title = $this->db->escape($array['pagetitle']);
$menutitle = $this->db->escape($array['menutitle']);
$description = $this->db->escape($array['description']);
$keywords = $this->db->escape($array['keywords']);
$content = $array['bodyContent'];
$template = $array['template'];
$published = $array['published'];
$parent = $array['parent'];
$alias = $array['alias'];
$menuindex = $this->db->escape($array['menuindex']);
$query = $this->db->query
("UPDATE ".$this->prefix."site_content
SET pagetitle = '$title',alias = '$alias',content = '$content',menutitle = '$menutitle',template = $template,
menuindex = $menuindex, published = $published, parent = '$parent'
WHERE id = $id
");
$check = $this->db->query("SELECT meta_id FROM ".$this->prefix."site_meta WHERE content_id = $id");
if($check->num_rows > 0){
$this->db->query
("UPDATE ".$this->prefix."site_meta
SET description = '$description', keywords = '$keywords' where content_id = $id
");
}
else{
$this->db->query
("INSERT INTO ".$this->prefix."site_meta
(content_id,description,keywords)
VALUES
('$id','$description','$keywords')
");
}
return $query;
}
function deletePage($id){
$this->db->query
("DELETE FROM ".$this->prefix."site_content WHERE id = $id");
$this->db->query
("DELETE FROM ".$this->prefix."site_meta WHERE content_id = $id");
}
//TESTIMONIOS
public function testimoniosList() {
$query = $this->db->query("
SELECT author,id,published
FROM ".$this->prefix."ao_testimonios
ORDER BY positionindex
");
return $query;
}
//SOLUCINES
public function solucionesList(){
$query = $this->db->query("
SELECT servicio_id,nombre,introtext,descripcion,content,imagen,published
FROM ".$this->prefix."ao_servicios
ORDER BY positionindex
");
return $query;
}
public function deleteSolucion($id){
}
}