コード例 #1
0
ファイル: ajax.php プロジェクト: speed47/plugin-blogtng
 function handle_ajax_call(&$event, $param)
 {
     global $auth;
     if ($event->data != 'blogtng__comment_preview') {
         return;
     }
     $event->preventDefault();
     $event->stopPropagation();
     @(require_once DOKU_PLUGIN . 'blogtng/helper/comments.php');
     $comment = new blogtng_comment();
     $comment->data['text'] = $_REQUEST['text'];
     $comment->data['name'] = $_REQUEST['name'];
     $comment->data['mail'] = $_REQUEST['mail'];
     $comment->data['web'] = isset($_REQUEST['web']) ? $_REQUEST['web'] : '';
     $comment->data['cid'] = 'preview';
     $comment->data['created'] = time();
     $comment->data['status'] = 'visible';
     if (!$comment->data['name'] && $_SERVER['REMOTE_USER']) {
         if ($auth) {
             $info = $auth->getUserData($_SERVER['REMOTE_USER']);
             $comment->data['name'] = $info['name'];
             $comment->data['mail'] = $info['mail'];
         }
         // FIXME ???
         $comment->data['name'] = $_SERVER['REMOTE_USER'];
     }
     // FIXME this has to be the template of the used blog
     $comment->output('default');
 }
コード例 #2
0
ファイル: ajax.php プロジェクト: stupid-beard/plugin-blogtng
 /**
  * @param Doku_Event $event  event object by reference
  * @param array      $param  empty array as passed to register_hook()
  */
 function handle_ajax_call(Doku_Event $event, $param)
 {
     /** @var DokuWiki_Auth_Plugin $auth */
     global $auth;
     if ($event->data != 'blogtng__comment_preview') {
         return;
     }
     $event->preventDefault();
     $event->stopPropagation();
     require_once DOKU_PLUGIN . 'blogtng/helper/comments.php';
     $comment = new blogtng_comment();
     $comment->data['text'] = $_REQUEST['text'];
     $comment->data['name'] = $_REQUEST['name'];
     $comment->data['mail'] = $_REQUEST['mail'];
     $comment->data['web'] = isset($_REQUEST['web']) ? $_REQUEST['web'] : '';
     $comment->data['cid'] = 'preview';
     $comment->data['created'] = time();
     $comment->data['status'] = 'visible';
     if (!$comment->data['name'] && $_SERVER['REMOTE_USER']) {
         if ($auth and $info = $auth->getUserData($_SERVER['REMOTE_USER'])) {
             $comment->data['name'] = $info['name'];
             $comment->data['mail'] = $info['mail'];
         }
     }
     $comment->output($_REQUEST['tplname']);
 }
コード例 #3
0
ファイル: admin.php プロジェクト: speed47/plugin-blogtng
 function xhtml_comment_preview($data)
 {
     global $lang;
     // FIXME
     ptln('<div id="blogtng__comment_preview">');
     ptln(p_locale_xhtml('preview'));
     ptln('<br />');
     $comment = new blogtng_comment();
     $comment->init($data);
     $comment->output('default');
     ptln('</div>');
 }
コード例 #4
0
ファイル: comments.php プロジェクト: Narrator/plugin-blogtng
 /**
  * Print the comemnts
  */
 function tpl_comments($name, $types = null)
 {
     $pid = $this->pid;
     if (!$pid) {
         return false;
     }
     $sql = 'SELECT *
               FROM comments
              WHERE pid = ?';
     $args = array();
     $args[] = $pid;
     if (is_array($types)) {
         $qs = array();
         foreach ($types as $type) {
             $args[] = $type;
             $qs[] = '?';
         }
         $sql .= ' AND type IN (' . join(',', $qs) . ')';
     }
     $sql .= ' ORDER BY created ASC';
     $res = $this->sqlitehelper->query($sql, $args);
     $res = $this->sqlitehelper->res2arr($res);
     $comment = new blogtng_comment();
     foreach ($res as $row) {
         $comment->init($row);
         $comment->output($name);
     }
 }
コード例 #5
0
ファイル: admin.php プロジェクト: stupid-beard/plugin-blogtng
 /**
  * Displays a preview of the comment
  *
  * @param array $data submitted comment properties
  */
 private function xhtml_comment_preview($data)
 {
     $this->entryhelper->load_by_pid($data['pid']);
     $blogname = $this->entryhelper->get_blog();
     ptln('<div id="blogtng__comment_preview">');
     ptln(p_locale_xhtml('preview'));
     ptln('<br />');
     $comment = new blogtng_comment();
     $comment->init($data);
     $comment->output($blogname);
     ptln('</div>');
 }