<?php
/* Ulyxex version 1.6.7.8 ***************/
/* code http://ulyxex.logz.org **********/
/* Andre Lozano http://andre-lozano.org */
class Orphans extends Admin {
function __construct(){
$this->h = New Htmlz();
$this->t = New Translate();
}
public function show_orphans(){
$h = $this->h;$t = $this->t;
$data = array();
//~ pages
$query = SELECT.PAGES.".ID,".PAGES.".NAME,".PAGES.".PARENTID,".PAGES.".USERID".FROM.PAGES;
$query = $this->q($query);
while ( $line = $this->fetch($query) ){
$existingParentIds[] = $line['PARENTID'];
$existingPagesIds[] = $line['ID'];
$pageParentId[$line['ID']] = $line['PARENTID'];
$pageName[$line['ID']] = $line['NAME'];
}
$data[] = $h->h2($t->w("Show orphans pages"));
$css = $h->v("style","font-weight: bold;border: 1px solid DarkGray;padding: 2px;");
foreach ($existingPagesIds as $id){
//~ check if parent id exist in pages
if (
$pageParentId[$id] != 0 && !in_array($pageParentId[$id],$existingPagesIds)
)
{
$data[] = $h->p(
$this->dashframe("id".$h->f4d($id))." ".
$h->span($t->wx("modify"),$h->v("style","font-weight:bold;"))." ".
$h->ahref(
"admin.php?action=edit_orphan&page=".$id,
$pageName[$id],
$h->v("class","linkbtn").$h->alt($t->wr("modify").$t->wr("page")."id ".$id)
)." ".
$h->span(
$t->wr("mother not found")."? id:".$h->b($h->color($pageParentId[$id],"red"))
,$css)
);
}
}
$query = SELECT.ARTICLES.".ID,".ARTICLES.".SUBJECT,".ARTICLES.".PAGEID,".ARTICLES.".USERID".FROM.ARTICLES;
$query = $this->q($query);
while ( $line = $this->fetch($query) ){
$existingArticleIds[] = $line['ID'];
$articlePageId[$line['ID']] = $line['PAGEID'];
$articleName[$line['ID']] = $line['SUBJECT'];
}
$data[] = $h->p(SP_);
$data[] = $h->h2($t->w("Show orphans articles"));
foreach ($existingArticleIds as $id){
if ($articlePageId[$id] != 0 && !in_array($articlePageId[$id],$existingPagesIds)) {
$data[] = $h->p(
$this->dashframe("id".$h->f4d($id))." ".
$h->span($t->wx("modify"),$h->v("style","font-weight:bold;"))." ".
$h->ahref(
"admin.php?action=edit_orphan&art=".$id,
$articleName[$id],
$h->v("class","linkbtn").$h->alt($t->wr("modify").$t->wr("article")."id ".$id)
)." ".
$h->span(
$t->wr("page not found")."? id:".$h->b($h->color($articlePageId[$id],"red"))
,$css)
);
}
}
return implode("\n",$data);
}
}
?>
page url