Esempio n. 1
0
if ($edit) {
    $post->setVar('modified', time());
}
if ($post->isNew()) {
    $post->setVar('created', time());
}
if ($status != 'draft') {
    if ($schedule <= time() && !$edit) {
        $post->setVar('pubdate', time());
    } elseif ($schedule <= time() && $edit) {
        $post->setVar('pubdate', $post->getVar('pubdate') == 0 ? time() : $post->getVar('pubdate'));
    } else {
        $post->setVar('pubdate', 0);
    }
}
if (MWFunctions::post_exists($post)) {
    return_error(__('There is already another post with same title for same date', 'mywords'), $xoopsSecurity->createToken());
    die;
}
// Add categories
$post->add_categories($categories, true);
// Add tags
$post->add_tags($tags);
$post->clear_metas();
foreach ($meta as $data) {
    $post->add_meta($data['key'], $data['value']);
}
// before to save post
RMEvents::get()->run_event('mywords.saving.post', $post);
// Add trackbacks uris
$toping = array();