Exemple #1
0
        $album_info = $pdb->GetRow("SELECT * FROM {$tb_prefix}albums ab WHERE ab.member_id=" . $the_memberid . " AND ab.id={$id}");
        $attachment->del($album_info['attachment_id'], "member_id=" . $the_memberid);
        $result = $album->del(intval($id), "member_id=" . $the_memberid);
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $album_info = $pdb->GetRow("SELECT a.title,a.description,ab.id,a.attachment,ab.type_id FROM {$tb_prefix}attachments a  LEFT JOIN {$tb_prefix}albums ab ON a.id=ab.attachment_id WHERE a.member_id=" . $the_memberid . " AND a.id={$id}");
            if (!empty($album_info['attachment'])) {
                $album_info['image'] = pb_get_attachmenturl($album_info['attachment'], "../");
            }
            setvar("item", $album_info);
        }
        $tpl_file = "album_edit";
        template($tpl_file);
        exit;
    }
}
$joins[] = "LEFT JOIN {$tb_prefix}attachments Attachment ON Album.attachment_id=Attachment.id";
$conditions[] = "Attachment.member_id=" . $the_memberid . " AND Attachment.attachmenttype_id=1";
$amount = $album->findCount($joins, $conditions, "Album.id");
$page->setPagenav($amount);
$res = $pdb->GetAll("SELECT * from {$tb_prefix}albums");
$result = $album->findAll("Album.attachment_id,Attachment.title,Attachment.description,Attachment.attachment,Album.id", $joins, $conditions, "Album.id DESC", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['image'] = pb_get_attachmenturl($result[$i]['attachment'], '../', "small");
    }
    setvar("Items", $result);
    setvar("ByPages", $page->pagenav);
}
template($tpl_file);