Ejemplo n.º 1
0
$gBitSmarty->assign('words', $_REQUEST["words"]);
$results = $searchlib->find($_REQUEST);
if ($_REQUEST['cant'] != 1) {
    $where2 .= "s";
}
$gBitSmarty->assign('where2', tra($where2));
$gBitSmarty->assign('content_type_guid', $_REQUEST["content_type_guid"]);
$stubContent = new LibertyContent();
if ($_REQUEST['cant'] > 0) {
    foreach (array_keys($results) as $k) {
        if (empty($results[$k]['title'])) {
            $date_format = $gBitSystem->get_long_date_format();
            if ($gBitSystem->mServerTimestamp->get_display_offset()) {
                $date_format = preg_replace("/ ?%Z/", "", $date_format);
            } else {
                $date_format = preg_replace("/%Z/", "UTC", $date_format);
            }
            $date_string = $gBitSystem->mServerTimestamp->getDisplayDateFromUTC($results[$k]['created']);
            $results[$k]['title'] = $gBitSystem->mServerTimestamp->strftime($date_format, $date_string, true);
        }
        if (!empty($results[$k]['data'])) {
            $results[$k]['parsed'] = $stubContent->parseData($results[$k]);
        }
    }
}
LibertyContent::postGetList($_REQUEST);
$gBitSmarty->assignByRef('listInfo', $_REQUEST['listInfo']);
// Find search results (build array)
$gBitSmarty->assignByRef('results', $results);
// Display the template
$gBitSystem->display('bitpackage:search/search.tpl', 'Search Results for: ' . strip_tags($_REQUEST["highlight"]), array('display_mode' => 'display'));
Ejemplo n.º 2
0
$rss->description = $gBitSystem->getConfig('liberty_rss_description', $gBitSystem->getConfig('site_title') . ' - ' . tra('RSS Feed'));
// check if we want to use the cache file
$cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . LIBERTY_PKG_NAME . '/' . $cacheFileTail;
$rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time'));
$liberty = new LibertyContent();
$listHash = array('max_records' => $gBitSystem->getConfig('liberty_rss_max_records', 10), 'sort_mode' => 'last_modified_desc', 'include_data' => TRUE);
$feeds = $liberty->getContentList($listHash);
// set the rss link
$rss->link = 'http://' . $_SERVER['HTTP_HOST'] . LIBERTY_PKG_DIR . '/list_content.php';
// get all the data ready for the feed creator
foreach ($feeds as $feed) {
    $item = new FeedItem();
    $item->title = $feed['title'];
    $item->link = BIT_BASE_URI . $liberty->getDisplayUrl($feed['title'], $feed);
    // create a page header that we know what type of data we're looking at
    $description = tra('Package') . ': ' . ucfirst($gLibertySystem->mContentTypes[$feed['content_type_guid']]['handler_package']) . '<br />' . tra('Content Type') . ': ' . $gLibertySystem->getContentTypeName($feed['content_type_guid']) . '<br />';
    // add the parsed data, if there is any
    if (!empty($feed['data'])) {
        $description .= '<br /><hr /><br />' . tra('Content') . ':<br />' . $liberty->parseData($feed) . '<br /><hr />';
    }
    $item->description = $description;
    $item->date = (int) $feed['last_modified'];
    $item->source = 'http://' . $_SERVER['HTTP_HOST'] . LIBERTY_PKG_URL . '/list_content.php';
    $item->author = $gBitUser->getDisplayName(FALSE, array('real_name' => $feed['modifier_real_name'], 'login' => $feed['modifier_user']));
    $item->descriptionTruncSize = $gBitSystem->getConfig('rssfeed_truncate', 5000);
    $item->descriptionHtmlSyndicated = FALSE;
    // pass the item on to the rss feed creator
    $rss->addItem($item);
}
// finally we are ready to serve the data
echo $rss->saveFeed($rss_version_name, $cacheFile);
Ejemplo n.º 3
0
 function getMessage($pUserId, $msg_id)
 {
     if (!$this->isSystemMessage($msg_id)) {
         $bindvars = array($pUserId, (int) $msg_id);
         $query = "select * from `" . BIT_DB_PREFIX . "messages` WHERE `to_user_id`=? and `msg_id`=?";
         $result = $this->mDb->query($query, $bindvars);
         $res = $result->fetchRow();
     } else {
         $bindvars = array($pUserId, (int) $msg_id);
         $query = "SELECT msm.*, ug.`group_name`, mm.`from_user_id`, mm.`msg_id` as `msg_id_foo`, mm.`msg_to`, mm.`msg_cc`, mm.`msg_bcc`, mm.`subject`, mm.`body`, mm.`hash`, mm.`msg_date`\n\t\t\t\t\t  FROM `" . BIT_DB_PREFIX . "messages` mm\n\t\t\t\t\t    INNER JOIN `" . BIT_DB_PREFIX . "users_groups` ug ON (ug.`group_id` = mm.`group_id`)\n\t\t\t\t\t    LEFT OUTER JOIN `" . BIT_DB_PREFIX . "messages_system_map` msm ON (mm.`msg_id` = msm.`msg_id` AND msm.`to_user_id` = ?)\n\t\t\t\t\t  WHERE mm.`msg_id` = ?";
         $result = $this->mDb->query($query, $bindvars);
         $res = $result->fetchRow();
         $res['is_broadcast_message'] = TRUE;
     }
     $content = new LibertyContent();
     global $gBitSystem;
     $res['parsed'] = $content->parseData($res['body'], $gBitSystem->getConfig('default_format'));
     if (empty($res['subject'])) {
         $res['subject'] = tra('NONE');
     }
     return $res;
 }
Ejemplo n.º 4
0
| colspan="2" | error
|- class="warning"
| colspan="2" | warning
|- class="info"
| colspan="2" | info
|}'), 'Example 4' => array('data' => '{| class="table" style="background:yellow;color:green"
|+ Table with many colours
|-
| abc
| colspan="2" style="text-align:center;background:lightblue;" | defghi
|- style="background:red;color:white"
| jkl
| mno
| pqr
|-
| style="font-weight:bold" | stu
| style="background:silver" | vwx
| yz
|}'));
    // parse tables
    foreach ($mediawiki as $title => $example) {
        if (empty($example['result'])) {
            $example['format_guid'] = 'tikiwiki';
            $mediawiki[$title]['result'] = LibertyContent::parseData($example);
        }
    }
    $examples['tikiwiki'] = $tikiwiki;
    $examples['mediawiki'] = $mediawiki;
    $cache->writeCacheFile($cacheFile, serialize($examples));
}
$gBitSmarty->assign('examples', $examples);