예제 #1
0
function migratepost($id)
{
    global $data;
    $data->loadfile('posts' . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR . 'index');
    $post = tpost::instance();
    foreach ($data->data as $name => $value) {
        if (isset($post->data[$name])) {
            $post->data[$name] = $value;
        }
    }
    $post->posted = $data->date;
    $post->idurl = litepublisher::$urlmap->add($post->url, get_class($post), (int) $post->id);
    return $post;
}
예제 #2
0
 public function CreateFirstPost()
 {
     $html = THtmlResource::instance();
     $html->section = 'installation';
     $lang = tlocal::instance();
     $theme = ttheme::instance();
     $post = tpost::instance(0);
     $post->title = $lang->posttitle;
     $post->catnames = $lang->postcategories;
     $post->tagnames = $lang->posttags;
     $post->content = $theme->parse($lang->postcontent);
     $posts = tposts::instance();
     $posts->add($post);
     $icons = ticons::instance();
     $cats = tcategories::instance();
     $cats->setvalue($post->categories[0], 'icon', $icons->getid('news'));
     $comusers = tcomusers::instance($post->id);
     $userid = $comusers->add($lang->author, $lang->email, $lang->homeurl);
     echo "new comuser id = ";
     var_dump($userid);
     echo "<br>";
     litepublisher::$classes->commentmanager->addcomment($post->id, $userid, $lang->postcomment);
     $plugins = tplugins::instance();
     $plugins->lock();
     //$plugins->add('oldestposts');
     //$plugins->add('adminlinks');
     //$plugins->add('nicedit');
     $plugins->unlock();
 }