示例#1
0
uses("attachment", "album");
check_permission("album");
$attachment_controller = new Attachment('pic');
$attachment = new Attachments();
$album = new Albums();
$tpl_file = "album";
$page = new Pages();
if (empty($companyinfo)) {
    flash("pls_complete_company_info", "company.php", 0);
}
if (isset($_POST['do'])) {
    pb_submit_check('album');
    $vals = $_POST['album'];
    $vals['title'] = $title = trim($vals['title']);
    $vals['description'] = $description = trim($vals['description']);
    $now_album_amount = $attachment->findCount(null, "created>" . $today_start . " AND member_id=" . $_SESSION['MemberID']);
    if (!empty($_FILES['pic']['name'])) {
        $type_id = 1;
        $attach_id = empty($id) ? "album-" . $_SESSION['MemberID'] . "-" . ($album->getMaxId() + 1) : "album-" . $_SESSION['MemberID'] . "-" . $id;
        $attachment_controller->title = $title;
        $attachment_controller->description = $description;
        $attachment_controller->rename_file = $attach_id;
        $attachment_controller->upload_process($type_id);
    }
    if (!empty($id)) {
        if (empty($attachment_controller->id)) {
            $attachment_id = $pdb->GetOne("SELECT attachment_id FROM {$tb_prefix}albums WHERE id=" . $id);
        } else {
            $attachment_id = $attachment_controller->id;
        }
        $sql = "UPDATE {$tb_prefix}attachments a,{$tb_prefix}albums ab SET a.title='" . $title . "',a.description='" . $description . "',ab.attachment_id={$attachment_id},type_id='" . $vals['type_id'] . "' WHERE ab.id={$id} AND a.id=" . $attachment_id;
示例#2
0
uses("attachment", "album");
check_permission("album");
$attachment_controller = new Attachment('pic');
$attachment = new Attachments();
$album = new Albums();
$tpl_file = "album";
$page = new Pages();
if (!$company->Validate($companyinfo)) {
    flash("pls_complete_company_info", "company.php", 0);
}
if (isset($_POST['do'])) {
    pb_submit_check('album');
    $vals = $_POST['album'];
    $vals['title'] = $title = trim($vals['title']);
    $vals['description'] = $description = trim($vals['description']);
    $now_album_amount = $attachment->findCount(null, "created>" . $today_start . " AND member_id=" . $the_memberid);
    $id = intval($_POST['id']);
    if (!empty($_FILES['pic']['name'])) {
        $type_id = 1;
        $attach_id = empty($id) ? "album-" . $the_memberid . "-" . ($album->getMaxId() + 1) : "album-" . $the_memberid . "-" . $id;
        $attachment_controller->title = $title;
        $attachment_controller->description = $description;
        $attachment_controller->rename_file = $attach_id;
        $attachment_controller->upload_process($type_id);
    }
    if (!empty($id)) {
        if (empty($attachment_controller->id)) {
            $attachment_id = $pdb->GetOne("SELECT attachment_id FROM {$tb_prefix}albums WHERE id=" . $id);
        } else {
            $attachment_id = $attachment_controller->id;
        }