Пример #1
0
 function fetchSummary($external_link_id)
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $storyid = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     $mytrustdirpath = dirname(dirname(__FILE__));
     require_once dirname(dirname(__FILE__)) . '/class/bulletin.php';
     if (Bulletin::isPublishedExists($mydirname, $storyid)) {
         $article = new Bulletin($mydirname, $storyid);
         $subject4assign = $article->getVar('title');
         $summary = $article->getVar('hometext');
         if (function_exists('easiestml')) {
             $summary = easiestml($summary);
         }
         $summary4assign = htmlspecialchars(xoops_substr($this->unhtmlspecialchars(strip_tags($summary)), 0, 255), ENT_QUOTES);
     } else {
         $subject4assign = '';
         $summary4assign = '';
     }
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $subject4assign, 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=article&storyid=' . $storyid, 'summary' => $summary4assign);
 }
 function fetchSummary($external_link_id)
 {
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $config_handler =& xoops_gethandler('config');
     $configs = $config_handler->getConfigList($module->mid());
     // external_link_id means $content_id
     $content_id = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     // get categoryObject and contentObject
     list($categoryObj, $contentObj) = pico_common_get_objects_from_content_id($mydirname, $content_id);
     // existence check
     if (!is_object($categoryObj) || !is_object($contentObj)) {
         return '';
     }
     // permission check
     $content_data = $contentObj->getData();
     if (empty($content_data['can_read'])) {
         return '';
     }
     // dare to convert it irregularly
     $summary = str_replace('&', '&', htmlspecialchars(xoops_substr(strip_tags($content_data['body_cached']), 0, 255), ENT_QUOTES));
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $myts->makeTboxData4Show($content_data['subject_raw'], 1, 1), 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/' . pico_common_make_content_link4html($configs, $content_data), 'summary' => $summary);
 }
 function fetchSummary($external_link_id)
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $aid = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     // language constants
     @(include XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . @$GLOBALS['xoopsConfig']['language'] . '/main.php');
     if (!defined('_MD_PLZXOO_LANG_QUESTION')) {
         @(include XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/english/main.php');
     }
     // query
     $myrow = $db->fetchArray($db->query("SELECT a.uid AS answer_uid,a.body AS answer_body,a.comment,q.subject,q.uid AS question_uid,q.body AS question_body,q.qid FROM " . $db->prefix("plzxoo_answer") . " a LEFT JOIN " . $db->prefix("plzxoo_question") . " q ON a.qid=q.qid WHERE aid={$aid}"));
     $comment = array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'question' => array('id' => intval($myrow['qid']), 'uid' => intval($myrow['question_uid']), 'subject' => $myts->makeTboxData4Show($myrow['subject']), 'body' => htmlspecialchars(xoops_substr(strip_tags($myrow['question_body']), 0, 255), ENT_QUOTES)), 'answer' => array('id' => $aid, 'uid' => intval($myrow['answer_uid']), 'body' => htmlspecialchars(xoops_substr(strip_tags($myrow['answer_body']), 0, 255), ENT_QUOTES), 'comment' => htmlspecialchars(xoops_substr(strip_tags($myrow['comment']), 0, 255), ENT_QUOTES)));
     include_once XOOPS_ROOT_PATH . '/class/template.php';
     $tpl =& new XoopsTpl();
     $tpl->assign('comment', $comment);
     $ret = $tpl->fetch('db:plzxoo_d3comment_reference.html');
     return $ret;
     /*	return array(
     		'dirname' => $mydirname ,
     		'module_name' => $module->getVar( 'name' ) ,
     		'subject' => $myts->makeTboxData4Show( $myrow['subject'] ) ,
     		'uri' => XOOPS_URL.'/modules/'.$mydirname.'/index.php?action=detail&qid='.intval($myrow['qid']) ,
     		'summary' => htmlspecialchars( xoops_substr( strip_tags( $myrow['body'] ) , 0 , 255 ) , ENT_QUOTES ) ,
     	) ;*/
 }
Пример #4
0
 protected function _createTagArr()
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $wh = $this->_mWhere ? " WHERE " . $this->_mWhere : "";
     $sql = "SELECT tag_name AS tag, COUNT(tag_id) AS quantity\r\n\t\t  FROM " . $db->prefix($this->_mDirname . "_tag") . $wh . "\r\n\t\t  GROUP BY tag_name\r\n\t\t  ORDER BY tag_name ASC";
     $result = $db->query($sql);
     //echo $sql;var_dump($result);die();
     // here we loop through the results and put them into a simple array:
     // $tag['thing1'] = 12;
     // $tag['thing2'] = 25;
     // etc. so we can use all the nifty array functions
     // to calculate the font-size of each tag
     while ($row = $db->fetchRow($result)) {
         $this->mTagArr[$myts->makeTboxData4Show($row['0'])] = $row[1];
     }
 }
 function fetchSummary($external_link_id)
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($mydirname);
     $config_handler =& xoops_gethandler('config');
     $configs = $config_handler->getConfigList($module->mid());
     $clipping_id = intval($external_link_id);
     $clipping = d3pipes_common_get_clipping($mydirname, $clipping_id);
     if ($clipping === false) {
         return array();
     }
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $myts->makeTboxData4Show($clipping['headline']), 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=clipping&clipping_id=' . $clipping_id, 'summary' => htmlspecialchars(@$clipping['link'], ENT_QUOTES));
 }
Пример #6
0
 function fetchSummary($external_link_id)
 {
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $content_id = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     // query
     $content_row = $db->fetchArray($db->query("SELECT l.title AS title , c.description AS description FROM " . $db->prefix($mydirname . "_photos") . " l LEFT JOIN " . $db->prefix($mydirname . "_text") . " c ON l.lid = c.lid WHERE l.lid={$content_id} AND l.status > 0 "));
     if (empty($content_row)) {
         return '';
     }
     // dare to convert it irregularly
     $summary = str_replace('&', '&', htmlspecialchars(xoops_substr(strip_tags($content_row['description']), 0, 255), ENT_QUOTES));
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $myts->makeTboxData4Show($content_row['title']), 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?lid=' . $content_id, 'summary' => $summary);
 }
Пример #7
0
 function fetchSummary($pgid)
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $pgid = intval($pgid);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     // query
     $data = $db->fetchArray($db->query("SELECT `name`, `title`, `editedtime` FROM " . $db->prefix($mydirname . "_pginfo") . " WHERE `pgid`={$pgid} LIMIT 1"));
     // get body
     $uri = $body = '';
     if ($data['name'] !== '') {
         if (strpos(@$_SERVER['REQUEST_URI'], '/modules/' . $mydirname) === FALSE) {
             include_once dirname(dirname(__FILE__)) . "/include.php";
             $page =& XpWiki::getSingleton($mydirname);
             if ($data['editedtime']) {
                 $page->init($data['name']);
                 $page->execute();
                 $body = $page->body;
             } else {
                 $body = _MD_D3FORUM_ERR_READPOST . " \n" . '"' . $data['name'] . '" is deleted.';
             }
             $uri = $page->func->get_page_uri($data['name'], true);
         }
     } else {
         $body = _MD_D3FORUM_ERR_READPOST;
     }
     // make subject
     $subject = $data['name'];
     if ($subject !== $data['title']) {
         $subject .= ' [ ' . $data['title'] . ' ]';
     }
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $myts->makeTboxData4Show($subject), 'uri' => $uri, 'summary' => xoops_substr(strip_tags($body), 0, 255));
 }
Пример #8
0
 function d3forum_global_search_base($mydirname, $keywords, $andor, $limit, $offset, $userid)
 {
     $myts =& MyTextsanitizer::getInstance();
     $db =& Database::getInstance();
     $andor = strtoupper($andor);
     $userid = intval($userid);
     // XOOPS Search module
     $showcontext = empty($_GET['showcontext']) ? 0 : 1;
     $select4con = $showcontext ? "p.post_text" : "'' AS post_text";
     require_once dirname(__FILE__) . '/include/common_functions.php';
     $whr_forum = "t.forum_id IN (" . implode(",", d3forum_get_forums_can_read($mydirname)) . ")";
     $whr_uid = $userid > 0 ? "p.uid={$userid}" : "1";
     $whr_query = $andor == 'OR' ? '0' : '1';
     if (is_array($keywords)) {
         foreach ($keywords as $word) {
             // I know this is not a right escaping, but I can't believe $keywords :-)
             $word4sql = addslashes(stripslashes($word));
             $whr_query .= $andor == 'EXACT' ? ' AND' : ' ' . $andor;
             $whr_query .= " (p.subject LIKE '%{$word4sql}%' OR p.post_text LIKE '%{$word4sql}%')";
         }
     }
     $sql = "SELECT p.post_id,p.topic_id,p.post_time,p.uid,p.subject,p.html,p.smiley,p.xcode,p.br,{$select4con} FROM " . $db->prefix($mydirname . "_posts") . " p LEFT JOIN " . $db->prefix($mydirname . "_topics") . " t ON t.topic_id=p.topic_id WHERE ({$whr_forum}) AND ({$whr_uid}) AND ({$whr_query}) AND ! topic_invisible ORDER BY p.post_time DESC";
     $result = $db->query($sql, $limit, $offset);
     $ret = array();
     $context = '';
     while (list($post_id, $topic_id, $post_time, $uid, $subject, $html, $smiley, $xcode, $br, $text) = $db->fetchRow($result)) {
         // get context for module "search"
         if (function_exists('search_make_context') && $showcontext) {
             if (function_exists('easiestml')) {
                 $text = easiestml($text);
             }
             $full_context = strip_tags($myts->displayTarea($text, $html, $smiley, $xcode, 1, $br));
             $context = search_make_context($full_context, $keywords);
         }
         $ret[] = array('link' => "index.php?post_id={$post_id}", 'title' => $subject, 'time' => $post_time, 'uid' => $uid, "context" => $context);
     }
     return $ret;
 }
Пример #9
0
/**
 * See the enclosed file license.txt for licensing information.
 * If you did not receive this file, get it at http://www.fsf.org/copyleft/gpl.html
 *
 * @copyright   The XOOPS project http://www.xoops.org/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL)
 * @package     installer
 * @since       2.3.0
 * @author      Haruki Setoyama  <*****@*****.**>
 * @author      Kazumi Ono <*****@*****.**>
 * @author      Skalpa Keo <*****@*****.**>
 * @author      Taiwen Jiang <*****@*****.**>
 * @author      DuGris (aka L. JEN) <*****@*****.**>
 * @version     $Id: functions.php 1429 2008-04-02 12:27:19Z phppp $
 */
function install_acceptUser($hash = '')
{
    $GLOBALS['xoopsUser'] = null;
    $hash_data = @explode("-", $_COOKIE['xo_install_user'], 2);
    list($uname, $hash_login) = array($hash_data[0], strval(@$hash_data[1]));
    if (empty($uname) || empty($hash_login)) {
        return false;
    }
    $memebr_handler =& xoops_gethandler('member');
    $user = array_pop($memebr_handler->getUsers(new Criteria('uname', $uname)));
    if ($hash_login != md5($user->getVar('pass') . XOOPS_DB_NAME . XOOPS_DB_PASS . XOOPS_DB_PREFIX)) {
        return false;
    }
    $myts =& MyTextsanitizer::getInstance();
    if (is_object($GLOBALS['xoops']) && method_exists($GLOBALS['xoops'], 'acceptUser')) {
        $res = $GLOBALS['xoops']->acceptUser($uname, true, $msg);
        return $res;
    }
    $GLOBALS['xoopsUser'] = $user;
    $_SESSION['xoopsUserId'] = $GLOBALS['xoopsUser']->getVar('uid');
    $_SESSION['xoopsUserGroups'] = $GLOBALS['xoopsUser']->getGroups();
    return true;
}
Пример #10
0
                 }
             }
         }
     } else {
         $err = implode('<br />', $uploader->getErrors(false));
         echo $err;
     }
     echo '</code><br /><a href="admin.php?fct=tplsets">' . _MD_AM_BTOTADMIN . '</a>';
     xoops_cp_footer();
     break;
 case 'previewtpl':
     if (!$GLOBALS['xoopsSecurity']->check()) {
         redirect_header('admin.php?fct=tplsets', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
     }
     require_once XOOPS_ROOT_PATH . '/class/template.php';
     $myts =& MyTextsanitizer::getInstance();
     $html = $myts->stripSlashesGPC($html);
     $tpltpl_handler =& xoops_gethandler('tplfile');
     $tplfile =& $tpltpl_handler->get($id, true);
     $xoopsTpl = new XoopsTpl();
     if (is_object($tplfile)) {
         $dummylayout = '<html><head><meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '" /><meta http-equiv="content-language" content="' . _LANGCODE . '" /><title>' . $xoopsConfig['sitename'] . '</title><style type="text/css" media="all">';
         $css =& $tpltpl_handler->find($xoopsConfig['template_set'], 'css', 0, null, null, true);
         $csscount = count($css);
         for ($i = 0; $i < $csscount; $i++) {
             $dummylayout .= "\n" . $css[$i]->getVar('tpl_source');
         }
         $dummylayout .= "\n" . '</style></head><body><{$content}></body></html>';
         if ($tplfile->getVar('tpl_type') == 'block') {
             include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
             $block = new XoopsBlock($tplfile->getVar('tpl_refid'));
Пример #11
0
function xnppresentationGetEditBlock($item_id)
{
    global $xoopsDB;
    $myts =& MyTextsanitizer::getInstance();
    $formdata =& xoonips_getutility('formdata');
    // get DetailInformation
    $result = $xoopsDB->query('select * from ' . $xoopsDB->prefix('xnppresentation_item_detail') . " where presentation_id={$item_id}");
    foreach ($model = $xoopsDB->fetchArray($result) as $k => $v) {
        ${$k} = $v;
    }
    // overwrite DetailInformation with POST/GET variables
    foreach (array('presentation_type', 'creator', 'readme', 'rights') as $k) {
        if (array_key_exists($k, $_GET)) {
            ${$k} = $myts->stripSlashesGPC($_GET[$k]);
        } else {
            if (array_key_exists($k, $_POST)) {
                ${$k} = $myts->stripSlashesGPC($_POST[$k]);
            }
        }
    }
    // retrieve blocks of BasicInformation / Preview / index block
    $basic = xnpGetBasicInformationEditBlock($item_id);
    $preview = xnpGetPreviewEditBlock($item_id);
    $index = xnpGetIndexEditBlock($item_id);
    $presentation_file = xnpGetAttachmentEditBlock($item_id, 'presentation_file');
    // retrieve detail information
    if (!is_null($formdata->getValue('get', 'post_id', 's', false))) {
        $myts =& MyTextSanitizer::getInstance();
        $detail = array('presentation_type' => $formdata->getValue('post', 'presentation_type', 's', true), 'readme' => '', 'rights' => '', 'use_cc' => '', 'cc_commercial_use' => '', 'cc_modification' => '');
    } else {
        if (!empty($item_id)) {
            $detail = xnppresentationGetDetailInformation($item_id);
        } else {
            $detail = array();
        }
    }
    $readme = xnpGetTextFileEditBlock($item_id, 'readme', isset($detail['readme']) ? $detail['readme'] : '');
    $rights = xnpGetRightsEditBlock($item_id, $detail['use_cc'], $detail['rights'], $detail['cc_commercial_use'], $detail['cc_modification']);
    // assign to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    $tpl->assign($xoopsTpl->get_template_vars());
    // variables assigned to xoopsTpl are copied to tpl
    $tpl->assign('basic', $basic);
    $tpl->assign('preview', $preview);
    $tpl->assign('index', $index);
    $tpl->assign('presentation_file', $presentation_file);
    $tpl->assign('attachment_dl_limit', xnpGetDownloadLimitationOptionEditBlock('xnppresentation', xnppresentationGetAttachmentDownloadLimitOption($item_id)));
    $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionEditBlock('xnppresentation', xnppresentationGetAttachmentDownloadNotifyOption($item_id)));
    $tpl->assign('detail', $detail);
    $tpl->assign('readme', $readme);
    $tpl->assign('rights', $rights);
    $tpl->assign('presentation_type', xnppresentationGetTypes());
    $tpl->assign('presentation_type_selected', $detail['presentation_type']);
    if (!$formdata->getValue('get', 'post_id', 's', false)) {
        $detail_handler =& xoonips_getormhandler('xnppresentation', 'item_detail');
        $detail_orm =& $detail_handler->get($item_id);
        $tpl->assign('xnppresentation_creator', xoonips_get_multiple_field_template_vars($detail_orm->getCreators(), 'xnppresentation', 'creator'));
    } else {
        $tpl->assign('xnppresentation_creator', xoonips_get_multiple_field_template_vars(xoonips_get_orm_from_post('xnppresentation', 'creator'), 'xnppresentation', 'creator'));
    }
    // return HTML content
    return $tpl->fetch('db:xnppresentation_register_block.html');
}
Пример #12
0
 function d3forum_global_search_base($mydirname, $keywords, $andor, $limit, $offset, $userid)
 {
     $myts =& MyTextsanitizer::getInstance();
     $db =& Database::getInstance();
     $andor = strtoupper($andor);
     $userid = intval($userid);
     // naao from
     require_once dirname(__FILE__) . '/include/main_functions.php';
     // get all forums
     $sql = "SELECT forum_id, forum_external_link_format FROM " . $db->prefix($mydirname . "_forums");
     $frs = $db->query($sql);
     $d3com = array();
     while ($forum_row = $db->fetchArray($frs)) {
         // d3comment object
         $temp_forum_id = intval($forum_row['forum_id']);
         if (!empty($forum_row['forum_external_link_format'])) {
             $d3com[$temp_forum_id] =& d3forum_main_get_comment_object($mydirname, $forum_row['forum_external_link_format']);
         } else {
             $d3com[$temp_forum_id] = false;
         }
     }
     // naao to
     $charset = strtoupper(_CHARSET);
     // XOOPS Search module
     $showcontext = empty($_GET['showcontext']) ? 0 : 1;
     $select4con = $showcontext ? "p.post_text" : "'' AS post_text";
     require_once dirname(__FILE__) . '/include/common_functions.php';
     $whr_forum = "t.forum_id IN (" . implode(",", d3forum_get_forums_can_read($mydirname)) . ")";
     $whr_uid = $userid > 0 ? "p.uid={$userid}" : "1";
     $whr_query = $andor == 'OR' ? '0' : '1';
     if (is_array($keywords)) {
         // I know this is not a right escaping, but I can't believe $keywords :-)
         $keywords = array_map('stripslashes', $keywords);
         foreach ($keywords as $word) {
             $word4sql = addslashes($word);
             $word_or = array('p.subject LIKE \'%' . $word4sql . '%\' OR p.post_text LIKE \'%' . $word4sql . '%\'');
             if (($charset === 'UTF-8' || $charset === 'EUC-JP') && function_exists('mb_convert_kana')) {
                 foreach (array('a', 'A', 'k', 'KV', 'h', 'HV', 'c', 'C') as $_op) {
                     $_word = mb_convert_kana($word, $_op, $charset);
                     if ($_word !== $word) {
                         $word4sql = addslashes($_word);
                         $word_or[] = 'p.subject LIKE \'%' . $word4sql . '%\' OR p.post_text LIKE \'%' . $word4sql . '%\'';
                     }
                 }
             }
             $word4sql = join(' OR ', $word_or);
             $whr_query .= $andor == 'EXACT' ? ' AND' : ' ' . $andor;
             $whr_query .= ' (' . $word4sql . ')';
         }
     }
     //$sql = "SELECT p.post_id,p.topic_id,p.post_time,p.uid,p.subject,p.html,p.smiley,p.xcode,p.br,$select4con FROM ".$db->prefix($mydirname."_posts")." p LEFT JOIN ".$db->prefix($mydirname."_topics")." t ON t.topic_id=p.topic_id WHERE ($whr_forum) AND ($whr_uid) AND ($whr_query) AND ! topic_invisible ORDER BY p.post_time DESC" ;
     //naao
     $sql = "SELECT p.post_id,p.topic_id,p.post_time,p.uid,p.subject,p.html,p.smiley,p.xcode,p.br,{$select4con},t.topic_external_link_id,f.forum_id FROM " . $db->prefix($mydirname . "_posts") . " p LEFT JOIN " . $db->prefix($mydirname . "_topics") . " t ON t.topic_id=p.topic_id  LEFT JOIN " . $db->prefix($mydirname . "_forums") . " f ON t.forum_id = f.forum_id WHERE ({$whr_forum}) AND ({$whr_uid}) AND ({$whr_query}) AND ! topic_invisible ORDER BY p.post_time DESC";
     $result = $db->query($sql, $limit, $offset);
     $ret = array();
     $context = '';
     // nao-pon
     $make_context_func = function_exists('xoops_make_context') ? 'xoops_make_context' : (function_exists('search_make_context') ? 'search_make_context' : '');
     while (list($post_id, $topic_id, $post_time, $uid, $subject, $html, $smiley, $xcode, $br, $text, $external_link_id, $forum_id) = $db->fetchRow($result)) {
         // naao from
         $can_display = true;
         //default
         if (is_object($d3com[intval($forum_id)])) {
             $d3com_obj = $d3com[intval($forum_id)];
             if (($external_link_id = $d3com_obj->validate_id($external_link_id)) === false) {
                 $can_display = false;
             }
         }
         if ($can_display == true) {
             // naao to
             // get context for module "search"
             // nao-pon
             //if( function_exists('search_make_context') && $showcontext ) {
             if ($make_context_func && $showcontext) {
                 if (function_exists('easiestml')) {
                     $text = easiestml($text);
                 }
                 $full_context = strip_tags($myts->displayTarea($text, $html, $smiley, $xcode, 1, $br));
                 // nao-pon
                 //$context = search_make_context( $full_context , $keywords ) ;
                 $context = $make_context_func($full_context, $keywords);
             }
             $ret[] = array('link' => "index.php?post_id={$post_id}", 'title' => htmlspecialchars($subject, ENT_QUOTES), 'time' => $post_time, 'uid' => $uid, 'context' => $context);
         }
         // naao
     }
     // for xoops search module
     $GLOBALS['md_search_flg_zenhan_support'] = true;
     return $ret;
 }
Пример #13
0
 function processCommentNotifications($mode, $link_id, $forum_id, $topic_id, $post_id)
 {
     $blog_info = $this->get_comment_blog_info($forum_id);
     $wp_full_prefix = $blog_info['mb_table_prefix'];
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $config_handler =& xoops_gethandler('config');
     $configs = $config_handler->getConfigList($module->mid());
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     $xpress_prefix = preg_replace('/wordpress/', 'wp', $mydirname);
     $table_term_relationships = $wp_full_prefix . "term_relationships";
     $table_term_taxonomy = $wp_full_prefix . "term_taxonomy";
     $table_terms = $wp_full_prefix . "terms";
     $table_categories = $db->prefix($xpress_prefix . "_categories");
     $table_post2cat = $db->prefix($xpress_prefix . "_post2cat");
     $wp_post = $wp_full_prefix . "posts";
     $wp_options = $wp_full_prefix . "options";
     $wp_users = $db->prefix($xpress_prefix . "_users");
     $sql = "SELECT option_value  FROM {$wp_options} WHERE option_name ='blogname'";
     $blog_row = $db->fetchArray($db->query($sql));
     if (empty($blog_row)) {
         return false;
     }
     $blog_name = $blog_row['option_value'];
     // query
     $sql = "SELECT * FROM " . $wp_post . " WHERE ID={$link_id} ";
     $post_row = $db->fetchArray($db->query($sql));
     if (empty($post_row)) {
         return false;
     }
     $post_title = $post_row['post_title'];
     $post_author = $post_row['post_author'];
     $sql = "SELECT display_name  FROM {$wp_users} WHERE ID ='{$post_author}'";
     $blog_row = $db->fetchArray($db->query($sql));
     if (empty($blog_row)) {
         return false;
     }
     $user_name = $blog_row['display_name'];
     require_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
     // non-module integration returns false quickly
     if (!is_object($this->module)) {
         return false;
     }
     $not_module =& $this->module;
     $not_modid = $this->module->getVar('mid');
     $comment_tags = array('XPRESS_AUTH_NAME' => $user_name, 'XPRESS_BLOG_NAME' => $blog_name, 'XPRESS_POST_TITLE' => $post_title, 'XPRESS_POST_URL' => XOOPS_URL . '/modules/' . $this->d3forum_dirname . '/index.php?post_id=' . intval($post_id));
     $notification_handler =& xoops_gethandler('notification');
     $notification_handler->triggerEvent('global', 0, 'comment', $comment_tags, false, $not_modid);
     $notification_handler->triggerEvent('author', $post_author, 'comment', $comment_tags, false, $not_modid);
     $notification_handler->triggerEvent('post', $link_id, 'comment', $comment_tags, false, $not_modid);
     $post_row = $db->fetchArray($db->query("SELECT * FROM " . $db->prefix($this->d3forum_dirname . "_posts") . " WHERE post_id={$post_id}"));
     if (!empty($post_row)) {
         if ($post_row['approval'] == 0) {
             $notification_handler->triggerEvent('global', 0, 'waiting', $comment_tags, false, $not_modid);
         }
     }
     // categorie notification
     include XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/wp-includes/version.php';
     if ($wp_db_version < 6124) {
         $sql2 = "SELECT c.cat_ID, c.cat_name FROM " . $table_categories . " c, " . $table_post2cat . " p2c WHERE c.cat_ID = p2c.category_id AND p2c.post_id=" . $link_id;
     } else {
         $sql2 = "SELECT {$table_term_relationships}.object_id, {$table_terms}.term_id AS cat_ID, {$table_terms}.name AS cat_name ";
         $sql2 .= "FROM {$table_term_relationships} INNER JOIN ({$table_term_taxonomy} INNER JOIN {$table_terms} ON {$table_term_taxonomy}.term_id = {$table_terms}.term_id) ON {$table_term_relationships}.term_taxonomy_id = {$table_term_taxonomy}.term_taxonomy_id ";
         $sql2 .= "WHERE ({$table_term_relationships}.object_id =" . $link_id . ") AND ({$table_term_taxonomy}.taxonomy='category')";
     }
     $res2 = $db->query($sql2);
     while ($row2 = $db->fetchArray($res2)) {
         $cat_id = $row2['cat_ID'];
         $cat_name = $row2['cat_name'];
         $comment_tags = array('XPRESS_AUTH_NAME' => $user_name, 'XPRESS_BLOG_NAME' => $blog_name, 'XPRESS_CAT_TITLE' => $cat_name, 'XPRESS_POST_TITLE' => $post_title, 'XPRESS_POST_URL' => XOOPS_URL . '/modules/' . $this->d3forum_dirname . '/index.php?post_id=' . intval($post_id));
         $notification_handler->triggerEvent('category', $cat_id, 'comment', $comment_tags, false, $not_modid);
     }
 }