Beispiel #1
0
// Categories
if (!isset($categories) || empty($categories)) {
    $categories = array(MWFunctions::get()->default_category_id());
}
// Check publish options
if ($visibility == 'password' && $vis_password == '') {
    return_error(__('You must provide a password for this post or select another visibility option', 'mywords'), true);
    die;
}
$time = explode("-", $schedule);
$schedule = mktime($time[3], $time[4], 0, $time[1], $time[0], $time[2]);
if ($schedule <= time()) {
    $schedule = 0;
}
$author = !isset($author) || $author <= 0 ? $xoopsUser->uid() : $author;
$authorname = !isset($author) || $author <= 0 ? $xoopsUser->uname() : MWFunctions::author_name($author);
// Add Data
$post->setVar('title', $title);
$post->setVar('shortname', $shortname);
$post->setVar('content', $content);
$post->setVar('status', $schedule > time() && $status != 'draft' ? 'scheduled' : $status);
$post->setVar('visibility', $visibility);
$post->setVar('schedule', $schedule);
$post->setVar('password', $vis_password);
$post->setVar('author', $author);
$post->setVar('comstatus', isset($comstatus) ? $comstatus : 0);
$post->setVar('pingstatus', isset($pingstatus) ? $pingstatus : 0);
$post->setVar('authorname', $authorname);
$post->setVar('image', $image);
if ($edit) {
    $post->setVar('modified', time());