Exemplo n.º 1
0
    } elseif (!empty($_POST['require_membertype'])) {
        $vals['require_membertype'] = 0;
    }
    $vals['tag_ids'] = $tag->setTagId($_POST['data']['tag']);
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        if (!empty($_FILES['pic']['name'])) {
            $attachment->rename_file = "news-" . $id;
            $attachment->insert_new = false;
            $attachment->upload_process();
            $vals['picture'] = $attachment->file_full_url;
        }
        $result = $news->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        if (!empty($_FILES['pic']['name'])) {
            $attachment->rename_file = "news-" . ($news->getMaxId() + 1);
            $attachment->upload_process();
            $vals['picture'] = $attachment->file_full_url;
        }
        $result = $news->save($vals);
    }
    if (!$result) {
        flash();
    }
}
$amount = $news->findCount(null, $conditions);
$page->setPagenav($amount);
setvar("Items", $news->findAll("*", null, $conditions, "id DESC ", $page->firstcount, $page->displaypg));
uaAssign(array("ByPages" => $page->pagenav, "Newstypes" => $newstype->getCacheTypes()));
template($tpl_file);
Exemplo n.º 2
0
            $attachment->upload_process();
            $vals['picture'] = $attachment->file_full_url;
        }
        $result = $news->save($vals);
        $last_insert_key = "{$tb_prefix}newses_id";
        $id = $news->{$last_insert_key};
    }
    //seo info
    $meta->save('news', $id, $_POST['data']['meta']);
    if (!$result) {
        flash();
    }
}
$amount = $news->findCount(null, $conditions);
$page->setPagenav($amount);
$result = $news->findAll("*", null, $conditions, "id DESC ", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $t1 = intval(str_replace("-", "", $result[$i]['start_time']));
        $t2 = intval(str_replace("-", "", $result[$i]['end_time']));
        if ($t1 == 0) {
            $result[$i]['start_time'] = L("effective_now", "tpl");
        }
        if ($t2 == 0) {
            $result[$i]['end_time'] = L("permanent_effective", "tpl");
        }
    }
}
setvar("Items", $result);
uaAssign(array("ByPages" => $page->pagenav, "Newstypes" => $newstype->getCacheTypes()));
template($tpl_file);