本文整理汇总了PHP中xoops_substr函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_substr函数的具体用法?PHP xoops_substr怎么用?PHP xoops_substr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoops_substr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showcaseComponentsShow
function showcaseComponentsShow($options)
{
include XOOPS_ROOT_PATH . "/modules/spotlight/components/showcase/config.php";
$sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
$page_handler =& xoops_getmodulehandler('page', 'spotlight');
// spotlight object
$sp_obj = $sp_handler->get($options[0]);
if (!is_object($sp_obj) || empty($options[0])) {
trigger_error("spotlight is not object ", E_USER_WARNING);
} else {
//spotlight name
$block['sp_name'] = $sp_obj->getVar('sp_name');
// page list
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('sp_id', $options[0]));
$criteria->setLimit($config['limit']);
$criteria->setSort($config['sort']);
$criteria->setOrder('ASC');
$pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc', 'published'), false);
$myts = MyTextSanitizer::getInstance();
foreach ($pages as $k => $v) {
$block['news'][$k] = $v;
$block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
$block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
$page_desc = strip_tags($myts->undoHtmlSpecialChars(strip_tags($v['page_desc'])));
$block['news'][$k]['page_desc'] = xoops_substr($page_desc, '', $config['page_desc_substr']);
$block['news'][$k]['page_title'] = xoops_substr($v['page_title'], '', $config['page_title_substr']);
$block['news'][$k]['published'] = formatTimestamp($v['published'], $config['timeformat']);
}
// component name
$block['component'] = $sp_obj->getVar('component_name');
return $block;
}
}
示例2: fetchSummary
function fetchSummary($external_link_id)
{
// include_once dirname(dirname(__FILE__)).'/include/common_functions.php' ;
global $forum_id;
$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());
$post_id = intval($external_link_id);
$mydirname = $this->mydirname;
if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
die('Invalid mydirname');
}
$xpress_prefix = preg_replace('/wordpress/', 'wp', $mydirname);
$blog_info = $this->get_comment_blog_info($forum_id);
// query
$post_row = $db->fetchArray($db->query("SELECT * FROM " . $blog_info['mb_table_prefix'] . "posts WHERE ID={$post_id}"));
if (empty($post_row)) {
return '';
}
// dare to convert it irregularly
$summary = str_replace('&', '&', htmlspecialchars(xoops_substr(strip_tags($post_row['post_content']), 0, 255), ENT_QUOTES));
$uri = preg_replace('/\\/$/', '', $blog_info['home']);
$uri .= '/?p=' . $post_row['ID'];
return array('dirname' => $mydirname . $blog_info['sub_dir'], 'module_name' => $blog_info['blogname'], 'subject' => $post_row['post_title'], 'uri' => $uri, 'summary' => $summary);
}
示例3: fetchSummary
function fetchSummary( $external_link_id )
{
require_once dirname( dirname(__FILE__) ).'/class/d3downloads.textsanitizer.php' ;
$db =& Database::getInstance() ;
$myts =& d3downloadsTextSanitizer::getInstance() ;
$module_handler =& xoops_gethandler( 'module' ) ;
$module =& $module_handler->getByDirname( $this->mydirname ) ;
$lid = intval( $external_link_id ) ;
$mydirname = $this->mydirname ;
if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
$sql = "SELECT lid, cid, title, description, filters FROM ".$db->prefix( $mydirname."_downloads" )." WHERE lid='".$lid."'" ;
$myrow = $db->fetchArray( $db->query( $sql ) ) ;
if( empty( $myrow ) ) return '' ;
$cid = intval( $myrow['cid'] ) ;
$uri = XOOPS_URL.'/modules/'.$mydirname.'/index.php?page=singlefile&cid='.$cid.'&lid='.$lid ;
$filters = $myts->makeTboxData4Show( $myrow['filters'] ) ;
$str = strip_tags( $myts->displayTarea( strip_tags( $myrow['description'] ), 0, 1, 1, 1, 1, $filters ) ) ;
$summary = xoops_substr( $str , 0 , 255 ) ;
return array(
'dirname' => $mydirname ,
'module_name' => $module->getVar( 'name' ) ,
'subject' => $myts->makeTboxData4Show( $myrow['title'] ) ,
'uri' => $uri ,
'summary' => $summary ,
) ;
}
示例4: fetchSummary
function fetchSummary( $external_link_id )
{
$db =& Database::getInstance() ;
$myts =& MyTextSanitizer::getInstance();
$module_handler =& xoops_gethandler( 'module' ) ;
$module =& $module_handler->getByDirname( $this->mydirname ) ;
$entryID = intval( $external_link_id ) ;
$mydirname = $this->mydirname ;
if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
$content_row = $db->fetchArray( $db->query( "SELECT * FROM ".$db->prefix($mydirname."_ent")." WHERE entryID =$entryID" ) ) ;
if( empty( $content_row ) ) return '' ;
$categoryID = $content_row['categoryID'];
$definition = $content_row['definition'];
$_html = $content_row['html'];
$_smiley = $content_row['smiley'];
$_xcodes = $content_row['xcodes'];
$_breaks = $content_row['breaks'];
$str = strip_tags($myts->displayTarea($content_row['definition'],$_html,$_smiley,$_xcodes,$_breaks));
$summary = xoops_substr( $str , 0 , 255 );
$uri = XOOPS_URL.'/modules/'.$mydirname.'/entry.php?&entryID='.$entryID.'&categoryID='.$categoryID;
return array(
'dirname' => $mydirname ,
'module_name' => $module->getVar( 'name' ) ,
'subject' => $myts->makeTboxData4Show( $content_row['term'] ) ,
'uri' => $uri,
'summary' => $summary,
) ;
}
示例5: createUploadName
function createUploadName($folder, $filename, $trimname = false)
{
$workingfolder = $folder;
if (xoops_substr($workingfolder, strlen($workingfolder) - 1, 1) != '/') {
$workingfolder .= '/';
}
$ext = basename($filename);
$ext = explode('.', $ext);
$ext = '.' . $ext[count($ext) - 1];
$true = true;
while ($true) {
$ipbits = explode(".", $_SERVER["REMOTE_ADDR"]);
list($usec, $sec) = explode(" ", microtime());
$usec = (int) ($usec * 65536);
$sec = (int) $sec & 0xffff;
if ($trimname) {
$uid = sprintf("%06x%04x%04x", $ipbits[0] << 24 | $ipbits[1] << 16 | $ipbits[2] << 8 | $ipbits[3], $sec, $usec);
} else {
$uid = sprintf("%08x-%04x-%04x", $ipbits[0] << 24 | $ipbits[1] << 16 | $ipbits[2] << 8 | $ipbits[3], $sec, $usec);
}
if (!file_exists($workingfolder . $uid . $ext)) {
$true = false;
}
}
return $uid . $ext;
}
示例6: fetchSummary
function fetchSummary($external_link_id)
{
global $xoopsDB, $xoopsConfig, $xoopsUser;
$myts =& MyTextSanitizer::getInstance();
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname($this->mydirname);
$eventcomment_id = intval($external_link_id);
$mydirname = $this->mydirname;
if (!preg_match('/^(\\D+)(\\d*)$/', $mydirname, $regs)) {
die('Invalid mydirname');
}
$mydirnumber = $regs[2] === '' ? '' : intval($regs[2]);
$table_event = $xoopsDB->prefix("pical{$mydirnumber}_event");
$MOD_PATH = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
if (!class_exists('piCal_xoops')) {
require_once $MOD_PATH . '/class/piCal.php';
require_once $MOD_PATH . '/class/piCal_xoops.php';
}
$cal = new piCal_xoops('', $xoopsConfig['language'], true);
include $MOD_PATH . '/include/read_configs.php';
$whr_categories = $cal->get_where_about_categories();
$whr_class = $cal->get_where_about_class();
$content_row = $xoopsDB->fetchArray($xoopsDB->query("SELECT id, summary, description FROM {$table_event} WHERE id={$eventcomment_id} AND ({$whr_categories}) AND ({$whr_class})"));
if (empty($content_row)) {
redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM);
exit;
}
$subject = $myts->makeTboxData4Show($content_row['summary']);
//HACK by domifara
// $uri = XOOPS_URL.'/modules/'.$mydirname.'/index.php?action=View&event_id='.$eventcomment_id;
$uri = XOOPS_URL . '/modules/' . $mydirname . '/index.php?action=View&event_id=' . $eventcomment_id;
$str = strip_tags($myts->displayTarea(strip_tags($content_row['description'])));
$summary = xoops_substr($str, 0, 255);
return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $subject, 'uri' => $uri, 'summary' => $summary);
}
示例7: get_set4sql
function get_set4sql($value, $col)
{
switch ($col['type']) {
case 'text':
case 'blob':
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$length = empty($col['length']) ? 65535 : intval($col['length']);
return "`{$col['name']}`='" . addslashes(xoops_substr($value, 0, $length)) . "'";
case 'char':
case 'varchar':
case 'string':
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$length = empty($col['length']) ? 255 : intval($col['length']);
return "`{$col['name']}`='" . addslashes(xoops_substr($value, 0, $length)) . "'";
case 'int':
case 'integer':
$value = intval($value);
if (!empty($col['max'])) {
$value = min($value, intval($col['max']));
}
if (!empty($col['min'])) {
$value = max($value, intval($col['min']));
}
return "`{$col['name']}`={$value}";
}
}
示例8: fetchSummary
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);
}
示例9: plzxoo_block_answers_show
function plzxoo_block_answers_show($options)
{
$max_rows = empty($options[1]) ? 5 : intval($options[1]);
// 表示件数
$longest_subject = empty($options[2]) ? 50 : intval($options[2]);
// 質問名の最大長
$single_answer_per_question = empty($options[3]) ? false : true;
// 締め切った質問も表示するか
$category_limit = preg_match('/^[0-9, ]+$/', @$options[4]) ? $options[4] : 0;
// category limit
$order_by_modified = empty($options[5]) ? false : true;
// order by input_date(0) or modified_date(1)
$db =& Database::getInstance();
if ($single_answer_per_question) {
$grp_single = 'GROUP BY a.qid';
$select_input_date = 'MAX(a.input_date) AS max_input_date';
$select_modified_date = 'MAX(a.modified_date) AS max_modified_date';
$odr_1st = $order_by_modified ? 'max_modified_date DESC' : 'max_input_date DESC';
} else {
$grp_single = '';
$select_input_date = 'a.input_date';
$select_modified_date = 'a.modified_date';
$odr_1st = $order_by_modified ? 'a.modified_date DESC' : 'a.input_date DESC';
}
$whr_category = $category_limit ? 'q.cid IN (' . $category_limit . ')' : '1';
$result = $db->query("SELECT q.subject,q.qid,q.cid,c.name,q.uid,u.uname,q.size,a.uid,{$select_input_date},{$select_modified_date},a.body FROM " . $db->prefix("plzxoo_answer") . " a LEFT JOIN " . $db->prefix("plzxoo_question") . " q ON q.qid=a.qid LEFT JOIN " . $db->prefix("plzxoo_category") . " c ON q.cid=c.cid LEFT JOIN " . $db->prefix("users") . " u ON a.uid=u.uid WHERE ({$whr_category}) AND q.status IN (1,2) {$grp_single} ORDER BY {$odr_1st} LIMIT {$max_rows}");
$ret = array('dummy' => true);
while (list($question_subject, $qid, $cid, $category_name, $question_uid, $answer_uname, $answer_num, $answer_uid, $input_date, $modified_date, $answer_body) = $db->fetchRow($result)) {
$ret['answers'][] = array('question_subject' => htmlspecialchars(xoops_substr($question_subject, 0, $longest_subject), ENT_QUOTES), 'qid' => intval($qid), 'cid' => intval($cid), 'input_date' => intval($input_date), 'input_date_formatted' => formatTimestamp($input_date, 'm'), 'input_date_utime' => xoops_getUserTimestamp($input_date), 'modified_date' => intval($modified_date), 'modified_date_formatted' => formatTimestamp($modified_date, 'm'), 'modified_date_utime' => xoops_getUserTimestamp($modified_date), 'category_name' => htmlspecialchars($category_name, ENT_QUOTES), 'question_uid' => intval($question_uid), 'answer_uname' => htmlspecialchars($answer_uname, ENT_QUOTES), 'answer_num' => intval($answer_num), 'answer_uid' => intval($answer_uid), 'answer_body' => intval($answer_body));
}
return $ret;
}
示例10: assignVar
function assignVar($key, $value)
{
$vars =& $this->mVars[$key];
if (!isset($vars)) {
return;
}
switch ($vars['data_type']) {
case XOBJ_DTYPE_BOOL:
$vars['value'] = $value ? 1 : 0;
return;
case XOBJ_DTYPE_INT:
$vars['value'] = $value !== null ? (int) $value : null;
return;
case XOBJ_DTYPE_FLOAT:
$vars['value'] = $value !== null ? (double) $value : null;
return;
case XOBJ_DTYPE_STRING:
$len = $vars['maxlength'];
$vars['value'] = $len !== null && strlen($value) > $len ? xoops_substr($value, 0, $len, null) : $value;
return;
case XOBJ_DTYPE_TEXT:
$vars['value'] = $value;
return;
}
}
示例11: fetchSummary
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);
}
示例12: publisher_search
/**
* @param $queryarray
* @param $andor
* @param $limit
* @param $offset
* @param $userid
* @param array $categories
* @param int $sortby
* @param string $searchin
* @param string $extra
*
* @return array
*/
function publisher_search($queryarray, $andor, $limit, $offset, $userid, $categories = array(), $sortby = 0, $searchin = '', $extra = '')
{
$publisher =& PublisherPublisher::getInstance();
$ret = array();
if ($queryarray == '' || count($queryarray) == 0) {
$hightlightKey = '';
} else {
$keywords = implode('+', $queryarray);
$hightlightKey = '&keywords=' . $keywords;
}
$itemsObjs =& $publisher->getHandler('item')->getItemsFromSearch($queryarray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra);
$withCategoryPath = $publisher->getConfig('search_cat_path');
//xoops_load("xoopslocal");
$usersIds = array();
foreach ($itemsObjs as $obj) {
$item['image'] = 'assets/images/item_icon.gif';
$item['link'] = $obj->getItemUrl();
$item['link'] .= !empty($hightlightKey) && strpos($item['link'], '.php?') === false ? '?' . ltrim($hightlightKey, '&') : $hightlightKey;
if ($withCategoryPath) {
$item['title'] = $obj->getCategoryPath(false) . ' > ' . $obj->getTitle();
} else {
$item['title'] = $obj->getTitle();
}
$item['time'] = $obj->getVar('datesub');
//must go has unix timestamp
$item['uid'] = $obj->uid();
//"Fulltext search/highlight
$text = $obj->getBody();
$sanitizedText = '';
$textLower = strtolower($text);
$queryarray = is_array($queryarray) ? $queryarray : array($queryarray);
if ($queryarray[0] != '' && count($queryarray) > 0) {
foreach ($queryarray as $query) {
$pos = strpos($textLower, strtolower($query));
//xoops_local("strpos", $textLower, strtolower($query));
$start = max($pos - 100, 0);
$length = strlen($query) + 200;
//xoops_local("strlen", $query) + 200;
$context = $obj->highlight(xoops_substr($text, $start, $length, ' [...]'), $query);
$sanitizedText .= '<p>[...] ' . $context . '</p>';
}
}
//End of highlight
$item['text'] = $sanitizedText;
$item['author'] = $obj->author_alias();
$item['datesub'] = $obj->getDatesub($publisher->getConfig('format_date'));
$usersIds[$obj->uid()] = $obj->uid();
$ret[] = $item;
unset($item, $sanitizedText);
}
xoops_load('XoopsUserUtility');
$usersNames = XoopsUserUtility::getUnameFromIds($usersIds, $publisher->getConfig('format_realname'), true);
foreach ($ret as $key => $item) {
if ($item['author'] == '') {
$ret[$key]['author'] = isset($usersNames[$item['uid']]) ? $usersNames[$item['uid']] : '';
}
}
unset($usersNames, $usersIds);
return $ret;
}
示例13: assignVar
function assignVar($key, $value)
{
$vars =& $this->mVars[$key];
if (!isset($vars)) {
return;
}
switch ($vars['data_type']) {
case XOBJ_DTYPE_BOOL:
$vars['value'] = $value ? 1 : 0;
break;
case XOBJ_DTYPE_INT:
$vars['value'] = $value !== null ? intval($value) : null;
break;
case XOBJ_DTYPE_FLOAT:
$vars['value'] = $value !== null ? floatval($value) : null;
break;
case XOBJ_DTYPE_STRING:
if ($vars['maxlength'] !== null && strlen($value) > $vars['maxlength']) {
$vars['value'] = xoops_substr($value, 0, $vars['maxlength'], null);
} else {
$vars['value'] = $value;
}
break;
case XOBJ_DTYPE_TEXT:
$vars['value'] = $value;
break;
}
}
示例14: fetchSummary
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 ) ,
) ;*/
}
示例15: b_gnavi_d3pipes_joints
function b_gnavi_d3pipes_joints($options)
{
global $xoopsDB;
$mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
die('Invalid mydirname');
}
require dirname(dirname(__FILE__)) . '/include/read_configs.php';
$cat_limitation = empty($options[1]) ? 0 : 1;
$photos_num = empty($options[2]) ? 10 : intval($options[2]);
$show_desc = empty($options[3]) ? 0 : 1;
$query = "ORDER BY unixtime DESC";
$title_max_length = 255;
// Category limitation
if ($cat_limitation) {
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
$cattree = new XoopsTree($table_cat, "cid", "pid");
$children = $cattree->getAllChildId($cat_limitation);
$whr_cat = "l.cid IN (";
foreach ($children as $child) {
$whr_cat .= "{$child},";
}
$whr_cat .= "{$cat_limitation})";
for ($i = 1; $i <= 4; $i++) {
$whr_cat .= " OR l.cid{$i} IN (";
foreach ($children as $child) {
$whr_cat .= "{$child},";
}
$whr_cat .= "{$cat_limitation})";
}
$whr_cat = "(" . $whr_cat . ")";
} else {
$whr_cat = '1';
}
$block = array();
$myts =& MyTextSanitizer::getInstance();
if ($show_desc) {
$result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title ,t.description ,t.arrowhtml FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid LEFT JOIN {$table_text} t ON l.lid=t.lid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
} else {
$result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
}
$count = 1;
while ($photo = $xoopsDB->fetchArray($result)) {
$photo['title'] = xoops_substr($myts->makeTboxData4Show($photo['title']), 0, $title_max_length + 3);
$photo['cat_title'] = $myts->makeTboxData4Show($photo['cat_title']);
$photo['date'] = formatTimestamp($photo['unixtime'], 's');
if ($show_desc) {
$photo['body'] = xoops_substr(strip_tags($myts->displayTarea($photo['description'], $photo['arrowhtml'], 1, 1, 1, 1, 1)), 0, 512);
} else {
$photo['body'] = '';
}
$photo['date'] = formatTimestamp($photo['unixtime'], 's');
$block['photo'][$count++] = $photo;
}
$block['mod_url'] = $mod_url;
return $block;
}