function getPingBodies() { $tpl = new XoopsTpl(); $tpl->assign(array('site_name' => d3pipes_common_convert_encoding_ietoutf8($this->mydirname, $GLOBALS['xoopsConfig']['sitename']), 'site_url' => XOOPS_URL . '/', 'page_url' => XOOPS_URL . '/modules/' . $this->mydirname . '/index.php?page=eachpipe&pipe_id=' . $this->pipe_id, 'rss_url' => XOOPS_URL . '/modules/' . $this->mydirname . '/index.php?page=xml&style=rss20&pipe_id=' . $this->pipe_id)); $ping_body = $tpl->fetch('db:' . $this->mydirname . '_main_xmlrpc2ping.html'); $extended_ping_body = $tpl->fetch('db:' . $this->mydirname . '_main_xmlrpc2extendedping.html'); return array($ping_body, $extended_ping_body); }
function b_pico_content_edit($options) { // options $mytrustdirname = basename(dirname(dirname(__FILE__))); $mydirname = empty($options[0]) ? $mytrustdirname : $options[0]; $content_id = intval(@$options[1]); $this_template = empty($options[2]) ? 'db:' . $mydirname . '_block_content.html' : trim($options[2]); $process_body = empty($options[3]) ? false : true; // mydirname check if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } // get content_title $db =& Database::getInstance(); $myts =& MyTextSanitizer::getInstance(); $contents = array(0 => '--'); $result = $db->query("SELECT content_id,subject,c.cat_depth_in_tree FROM " . $db->prefix($mydirname . "_contents") . " o LEFT JOIN " . $db->prefix($mydirname . "_categories") . " c ON o.cat_id=c.cat_id ORDER BY c.cat_order_in_tree,o.weight"); while (list($id, $sbj, $depth) = $db->fetchRow($result)) { $contents[$id] = sprintf('%06d', $id) . ': ' . str_repeat('--', $depth) . $myts->makeTboxData4Show($sbj, 1, 1); } require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign(array('mydirname' => $mydirname, 'contents' => $contents, 'content_id' => $content_id, 'this_template' => $this_template, 'process_body' => $process_body)); return $tpl->fetch('db:' . $mydirname . '_blockedit_content.html'); }
function b_d3downloads_list_edit( $options ) { require_once dirname( dirname(__FILE__) ).'/include/common_functions.php' ; $mydirname = empty( $options[0] ) ? 'd3downloads' : $options[0] ; $categories = trim( @$options[1] ) === '' ? array() : array_map( 'intval' , explode( ',' , $options[1] ) ) ; $selected_order = empty( $options[2] ) || ! in_array( $options[2] , d3download_list_order() ) ? 'd.date DESC' : $options[2] ; $max_entry = empty( $options[3] ) ? 10 : intval( $options[3] ) ; $date_format = empty( $options[4] ) ? 'Y/m/d' : htmlspecialchars ( $options[4] , ENT_QUOTES ) ; $show_body = empty( $options[5] ) ? false : true ; $this_template = empty( $options[6] ) ? 'db:'.$mydirname.'_block_list.html' : trim( $options[6] ) ; $intree = empty( $options[7] ) ? 0 : 1 ; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; // getcategories_list $categories_list = array() ; $categories_list = d3download_get_categories_list( $mydirname ) ; require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( array( 'mydirname' => $mydirname , 'categories' => implode( ',' , $categories ) , 'order_options' => d3download_list_order() , 'selected_order' => $selected_order , 'max_entry' => $max_entry , 'date_format' => $date_format , 'show_body' => $show_body , 'intree' => $intree , 'categories_list' => $categories_list , 'this_template' => $this_template , ) ) ; return $tpl->fetch( 'db:'.$mydirname.'_blockedit_list.html' ) ; }
function b_d3dside_entry_show($options) { $mydirname = empty($options[0]) ? 'd3diary' : $options[0]; $max_entry = empty($options[1]) ? 10 : (int) $options[1]; $now_order = empty($options[2]) ? 'time' : trim($options[2]); $this_template = empty($options[3]) ? 'db:' . $mydirname . '_block_side_entry.html' : trim($options[3]); $limit_self = empty($options[4]) ? 0 : (int) $options[4]; $show_category = empty($options[5]) ? false : true; if (!get_magic_quotes_gpc()) { $params['categories'] = empty($options[6]) ? array() : explode(',', addslashes($options[6])); $params['tags'] = empty($options[7]) ? array() : explode(',', addslashes($options[7])); } else { $params['categories'] = empty($options[6]) ? array() : explode(',', $options[6]); $params['tags'] = empty($options[7]) ? array() : explode(',', $options[7]); } if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require_once dirname(dirname(__FILE__)) . '/class/d3diaryConf.class.php'; $d3dConf = D3diaryConf::getInstance($mydirname, 0, "b_side_entry"); $func =& $d3dConf->func; $mod_config =& $d3dConf->mod_config; $uid = $d3dConf->uid; $req_uid = $d3dConf->req_uid; // overrided by d3dConf if ($limit_self == 1) { // always show diarylist page $req_uid = 0; } elseif ($limit_self == 2 && $req_uid > 0) { // not show for personal page return; } elseif ($limit_self == 3 && $req_uid == 0) { // not show except for personal page return; } $entry = $func->get_blist($req_uid, $uid, $max_entry, true, $params); $lang = array(); $constpref = "_MB_" . strtoupper($mydirname); $lang['more'] = constant($constpref . '_MORE'); $block = ""; $block['yd_list'] = $entry; $block['yd_uid'] = $req_uid; $block['show_category'] = $show_category; $block['categories'] = implode(',', $params['categories']); $block['tags'] = implode(',', $params['tags']); $block['lang'] = $lang; $block['mydirname'] = $mydirname; $block['mod_config'] = $mod_config; $d3dConf->debug_appendtime('b_side_entry'); if (empty($options['disable_renderer'])) { require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign('block', $block); $ret['content'] = $tpl->fetch($this_template); return $ret; } else { return $block; } }
function b_gnavi_menu_show($options) { global $xoopsDB; $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0]; $cat_limit = empty($options[1]) ? 0 : 1; $this_template = 'db:' . $mydirname . '_block_menu.html'; if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require dirname(dirname(__FILE__)) . '/include/read_configs.php'; $myts =& MyTextSanitizer::getInstance(); $result = $xoopsDB->query("SELECT c1.cid ,c1.title,c1.imgurl ,c2.cid AS ccid, c2.title AS ctitle, c2.imgurl AS cimgurl FROM {$table_cat} c1 LEFT JOIN {$table_cat} c2 ON c1.cid=c2.pid WHERE c1.pid=0 ORDER BY c1.weight,c2.weight "); if (preg_match('/' . '\\/modules\\/' . $mydirname . '/', htmlspecialchars(getenv('REQUEST_URI')))) { $gcid = empty($_GET['cid']) ? 0 : intval($_GET['cid']); $glid = empty($_GET['lid']) ? 0 : intval($_GET['lid']); $ocid = $gcid; if ($gcid) { if (!($result2 = $xoopsDB->query("SELECT pid FROM {$table_cat} WHERE cid={$gcid}"))) { echo $xoopsDB->logger->dumpQueries(); exit; } list($gpid) = $xoopsDB->fetchRow($result2); $gcid = $gpid > 0 ? $gpid : $gcid; } } else { $gcid = 0; $glid = 0; $ocid = 0; } $blk = array(); while ($content_row = $xoopsDB->fetchArray($result)) { $cat_id = intval($content_row['cid']); $blk[$cat_id]['cid'] = intval($content_row['cid']); $blk[$cat_id]['title'] = $myts->makeTboxData4Show($content_row['title']); $blk[$cat_id]['imgurl'] = $content_row['imgurl']; $blk[$cat_id]['active'] = intval($content_row['cid']) == $ocid && $glid == 0 ? 1 : 0; if ((!$cat_limit || $gcid == $cat_id) && intval($content_row['ccid']) > 0) { $blk[$cat_id]['contents'][] = array('cid' => intval($content_row['ccid']), 'title' => $myts->makeTboxData4Show($content_row['ctitle']), 'imgurl' => $content_row['cimgurl'], 'active' => intval($content_row['ccid']) == $ocid && $glid == 0 ? 1 : 0); } } $block = array(); $block['categories'] = $blk; if (preg_match('/page=map/', htmlspecialchars(getenv('REQUEST_URI')))) { $block['mod_url'] = XOOPS_URL . '/modules/' . $mydirname . "/index.php?page=map&"; } elseif (preg_match('/page=category/', htmlspecialchars(getenv('REQUEST_URI')))) { $block['mod_url'] = XOOPS_URL . '/modules/' . $mydirname . "/index.php?page=category&"; } else { $block['mod_url'] = XOOPS_URL . '/modules/' . $mydirname . "/index.php?"; } if (empty($options['disable_renderer'])) { require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign('block', $block); $ret['content'] = $tpl->fetch($this_template); return $ret; } else { return $block; } }
function b_bulletin_bigstory_edit($options) { $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0]; if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign(array('mydirname' => $mydirname, 'options' => $options)); return $tpl->fetch('db:' . $mydirname . '_blockedit_bigstory.html'); }
function b_pico_mywaitings_edit($options) { $mydirname = empty($options[0]) ? 'pico' : $options[0]; $this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_mywaitings.html' : trim($options[1]); if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign(array('mydirname' => $mydirname, 'this_template' => $this_template)); return $tpl->fetch('db:' . $mydirname . '_blockedit_mywaitings.html'); }
function b_d3dside_comment_show( $options ){ $mydirname = empty( $options[0] ) ? 'd3diary' : $options[0] ; $max_entry = empty( $options[1] ) ? 10 : intval( $options[1] ) ; $now_order = empty( $options[2] ) ? 'time' : trim( $options[2] ) ; $this_template = empty( $options[3] ) ? 'db:'.$mydirname.'_block_side_comment.html' : trim( $options[3] ) ; $limit_self = empty( $options[4] ) ? 0 : (int)$options[4] ; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; require_once dirname( dirname(__FILE__) ).'/class/d3diaryConf.class.php'; $d3dConf = D3diaryConf::getInstance($mydirname, 0, "b_side_comment"); $func =& $d3dConf->func ; $mod_config =& $d3dConf->mod_config ; $uid = $d3dConf->uid; $req_uid = $d3dConf->req_uid; // overrided by d3dConf if( $limit_self == 1 ) { // always show diarylist page $req_uid = 0 ; } elseif( $limit_self == 2 && $req_uid > 0 ) { // not show for personal page return ; } elseif( $limit_self == 3 && $req_uid == 0 ) { // not show except for personal page return ; } list( $yd_comment, $yd_com_key ) = $func->get_commentlist ($req_uid,$uid,$max_entry,false); $lang = array(); $constpref = "_MB_" . strtoupper( $mydirname ) ; $lang['more'] = constant($constpref.'_COMMENT_LIST'); $block=""; $block['yd_comment'] = $yd_comment; $block['yd_com_key'] = $yd_com_key; $block['yd_uid'] = $req_uid; $block['lang'] = $lang; $block['mydirname'] = $mydirname; $block['mod_config'] = $mod_config ; $d3dConf->debug_appendtime('b_side_comment'); if( empty( $options['disable_renderer'] ) ) { require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( 'block' , $block ) ; $ret['content'] = $tpl->fetch( $this_template ) ; return $ret ; } else { return $block ; } }
function b_d3diary_bloggerlist_show( $options ){ global $xoopsUser,$xoopsDB; $mydirname = empty( $options[0] ) ? 'd3diary' : $options[0] ; $max_entry = empty( $options[1] ) ? 10 : intval( $options[1] ) ; $params['order'] = $now_order = empty( $options[2] ) ? 'time' : trim( $options[2] ) ; $this_template = empty( $options[3] ) ? 'db:'.$mydirname.'_block_bloggerlist.html' : trim( $options[3] ) ; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; $constpref = '_MB_' . strtoupper( $mydirname ) ; require_once dirname( dirname(__FILE__) ).'/class/d3diaryConf.class.php'; $d3dConf = D3diaryConf::getInstance($mydirname, 0, "b_bloggerlist"); $func =& $d3dConf->func ; $mod_config =& $d3dConf->mod_config ; $uid = $d3dConf->uid; $req_uid = $d3dConf->req_uid; // overrided by d3dConf $params['ofst_key'] = "bgbofst" ; $_offset_ = $func->getpost_param($params['ofst_key']); $offset = isset($_offset_) ?(int)$_offset_ : 0; list( $blogger, $blogger2, $bloggernavi ) = $func->get_bloggerlist ( $req_uid, $uid, $max_entry, $offset, $params ); $block=""; $block['blogger'] = $blogger; $block['blogger2'] = $blogger2; $block['bloggernavi'] = $bloggernavi; $block['mydirname'] = $mydirname; $block['mod_config'] = $mod_config; $block['lang']['other'] = constant($constpref.'_OTHER'); $block['lang']['more'] = constant($constpref.'_MORE'); $block['lang']['newdiary'] = constant($constpref.'_NEWDIARY'); $block['lang']['newphoto'] = constant($constpref.'_NEWPHOTO'); $d3dConf->debug_appendtime('b_bloggerlist'); if( empty( $options['disable_renderer'] ) ) { require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( 'block' , $block ) ; $ret['content'] = $tpl->fetch( $this_template ) ; return $ret ; } else { return $block ; } }
function b_pico_subcategories_edit($options) { $mydirname = empty($options[0]) ? 'pico' : $options[0]; $categories = trim(@$options[1]) === '' ? array() : array_map('intval', explode(',', $options[1])); $this_template = empty($options[2]) ? 'db:' . $mydirname . '_block_subcategories.html' : trim($options[2]); if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign(array('mydirname' => $mydirname, 'categories' => $categories, 'categories_imploded' => implode(',', $categories), 'order_options' => b_pico_list_allowed_order(), 'this_template' => $this_template)); return $tpl->fetch('db:' . $mydirname . '_blockedit_subcategories.html'); }
function fetch($tplfile, $cache_id = null, $compile_id = null, $display = false) { $filename = $this->mEnvironment->findFile($tplfile, '/templates'); if (empty($filename)) { $this->template_dir = NBFRAME_BASE_DIR . '/templates'; } else { $this->template_dir = dirname($filename); $tplfile = basename($filename); } if (!$compile_id) { $compile_id = $this->mDirName . '_admin_'; } return parent::fetch($tplfile, $cache_id, $compile_id, $display); }
function b_d3dside_friends_show( $options ){ $mydirname = empty( $options[0] ) ? 'd3diary' : $options[0] ; $max_entry = empty( $options[1] ) ? 10 : intval( $options[1] ) ; $now_order = empty( $options[2] ) ? 'time' : trim( $options[2] ) ; $this_template = empty( $options[3] ) ? 'db:'.$mydirname.'_block_side_friends.html' : trim( $options[3] ) ; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; require_once dirname( dirname(__FILE__) ).'/class/d3diaryConf.class.php'; $d3dConf = D3diaryConf::getInstance($mydirname, 0, "b_side_fiends"); $func =& $d3dConf->func ; $mPerm =& $d3dConf->mPerm ; $uid = $d3dConf->uid; $req_uid = $d3dConf->req_uid; // overrided by d3dConf //if( $req_uid > 0 || $uid > 0 ) { if( $req_uid > 0 ) { $block=""; if ( $mPerm->d3d_conf['use_friend'] === true ) { list( $yd_friends, $yd_friendsnavi ) = $func->get_friends ($mPerm->req_friends); $lang = array(); $constpref = "_MB_" . strtoupper( $mydirname ) ; $lang['more'] = constant($constpref.'_DIARY_FRIENDSVIEW'); $block['yd_friends'] = $yd_friends; $block['yd_friendsnavi'] = $yd_friendsnavi; $block['yd_uid'] = $req_uid; $block['lang'] = $lang; $block['mydirname'] = $mydirname; } $d3dConf->debug_appendtime('b_side_friends'); if( empty( $options['disable_renderer'] ) ) { require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( 'block' , $block ) ; $ret['content'] = $tpl->fetch( $this_template ) ; return $ret ; } else { return $block ; } } }
function CreateLetter($model_id = null) { $model_handler = xoops_getmodulehandler('model', 'newsletter'); $newsletter_handler = xoops_getmodulehandler('content', 'newsletter'); $model_obj = $model_handler->get($model_id); if (!empty($model_id) && is_object($model_obj)) { include_once XOOPS_ROOT_PATH . "/modules/newsletter/include/functions.render.php"; include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->assign('letter_title', $model_obj->getVar('model_title')); $xoopsTpl->assign('header_img', $model_obj->getVar('header_img')); $xoopsTpl->assign('header_desc', $model_obj->getVar('header_desc')); $xoopsTpl->assign('footer_desc', $model_obj->getVar('footer_desc')); $tplName = newsletter_getTemplate($model_obj->getVar('model_type'), $model_obj->getVar('tpl_name')); $tplName = XOOPS_ROOT_PATH . "/modules/newsletter/templates/" . $tplName; $letter_content = $xoopsTpl->fetch($tplName); //create letter $newsletter_obj = $newsletter_handler->create(); $newsletter_obj->setVar('model_id', $model_obj->getVar('model_id')); $newsletter_obj->setVar('letter_title', $model_obj->getVar('model_title')); $newsletter_obj->setVar('letter_content', $letter_content); $newsletter_obj->setVar('create_time', time()); $newsletter_obj->setVar('is_users', 0); $newsletter_obj->setVar('is_sent', 0); $letter_id = $newsletter_handler->insert($newsletter_obj); //update model field in "last_create_time" $next_create_time = 0; switch ($model_obj->getVar('peried')) { case 'day': $next_create_time = $model_obj->getVar('next_create_time') + 24 * 3600; break; case 'week': $next_create_time = $model_obj->getVar('next_create_time') + 7 * 24 * 3600; break; case 'date': $next_create_time = $model_obj->getVar('next_create_time') + date('t') * 24 * 3600; break; case 'manual': $next_create_time = time(); break; } $model_obj->setVar('next_create_time', $next_create_time); $model_obj->setVar('last_create_time', time()); $model_handler->insert($model_obj); return $letter_id; } }
function b_gnavi_archive_show( $options ) { global $xoopsDB ; $mydirname = empty( $options[0] ) ? basename( dirname( dirname( __FILE__ ) ) ) : $options[0] ; $this_template = 'db:'.$mydirname.'_block_archive.html'; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; require dirname(dirname(__FILE__)).'/include/read_configs.php' ; $block = array() ; $constpref = '_MB_' . strtoupper( $mydirname ) ; $myts =& MyTextSanitizer::getInstance() ; $result = $xoopsDB->query( "SELECT date FROM $table_photos WHERE status>0 ORDER BY date DESC" ) ; $count = 1 ; while( $photo = $xoopsDB->fetchArray( $result ) ) { $photo['link'] = date ("Ym",$photo["date"]) ; //$photo['text'] = date ("Y? m??",$photo["date"]) ; $_year = date("Y",$photo["date"]); $_month = date("m",$photo["date"]); $photo['text'] = sprintf( constant( $constpref.'_ARCH_POSTMONTH'), $_year, $_month ) ; if($count>1){ if($block['archive'][$count-1]['link']!=$photo['link']){ $block['archive'][$count++] = $photo ; } }else{ $block['archive'][$count++] = $photo ; } } $block['mod_url'] = $mod_url ; if( empty( $options['disable_renderer'] ) ) { require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( 'block' , $block ) ; $ret['content'] = $tpl->fetch( $this_template ) ; return $ret ; } else { return $block ; } }
function b_pico_tags_edit($options) { global $pico_blocks_tags_order_options; // options $mytrustdirname = basename(dirname(dirname(__FILE__))); $mydirname = empty($options[0]) ? $mytrustdirname : $options[0]; $limit = empty($options[1]) ? 10 : intval($options[1]); $listorder = in_array(@$options[2], $pico_blocks_tags_order_options) ? $options[2] : 'count DESC'; $sqlorder = in_array(@$options[3], $pico_blocks_tags_order_options) ? $options[3] : 'count DESC'; $this_template = empty($options[4]) ? 'db:' . $mydirname . '_block_tags.html' : trim($options[4]); if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign(array('mydirname' => $mydirname, 'limit' => $limit, 'listorder' => $listorder, 'sqlorder' => $sqlorder, 'order_options' => $pico_blocks_tags_order_options, 'this_template' => $this_template)); return $tpl->fetch('db:' . $mydirname . '_blockedit_tags.html'); }
function b_pico_list_edit($options) { // options $mytrustdirname = basename(dirname(dirname(__FILE__))); $mydirname = empty($options[0]) ? $mytrustdirname : $options[0]; $categories = trim(@$options[1]) === '' ? array() : array_map('intval', explode(',', $options[1])); $selected_order = empty($options[2]) || !in_array($options[2], b_pico_list_allowed_order()) ? 'o.created_time DESC' : $options[2]; $limit_offset = empty($options[3]) ? '10' : preg_replace('/[^0-9,]/', '', $options[3]); $this_template = empty($options[4]) ? 'db:' . $mydirname . '_block_list.html' : trim($options[4]); $display_body = empty($options[5]) ? false : true; if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign(array('mydirname' => $mydirname, 'categories' => $categories, 'categories_imploded' => implode(',', $categories), 'order_options' => b_pico_list_allowed_order(), 'selected_order' => $selected_order, 'contents_num' => $limit_offset, 'this_template' => $this_template, 'display_body' => $display_body)); return $tpl->fetch('db:' . $mydirname . '_blockedit_list.html'); }
function b_d3downloads_category_edit( $options ) { $mydirname = empty( $options[0] ) ? 'd3downloads' : $options[0] ; $intree = empty( $options[1] ) ? 0 : 1 ; $cols= empty( $options[2] ) ? 1 : intval( $options[2] ) ; $this_template = empty( $options[3] ) ? 'db:'.$mydirname.'_block_category.html' : trim( $options[3] ) ; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( array( 'mydirname' => $mydirname , 'intree' => $intree , 'cols' => $cols , 'this_template' => $this_template , ) ) ; return $tpl->fetch( 'db:'.$mydirname.'_blockedit_category.html' ) ; }
function pico_xoopstpl($mydirname, $text, $content4assign) { global $xoopsTpl; $tpl = new XoopsTpl(); //$tpl->plugins_dir[] = dirname(dirname(__FILE__)).'/smarty_plugins' ; array_unshift($tpl->plugins_dir, dirname(dirname(__FILE__)) . '/smarty_plugins'); // pico plugin has the first priority if (is_object(@$xoopsTpl)) { $tpl->assign($xoopsTpl->get_template_vars()); if (defined('XOOPS_CUBE_LEGACY')) { $root =& XCube_Root::getSingleton(); $context =& $root->getContext(); $themeName = $context->getThemeName(); $tpl->assign('xoops_theme', $themeName); $tpl->assign('xoops_imageurl', XOOPS_THEME_URL . "/{$themeName}/"); $tpl->assign('xoops_themecss', xoops_getcss($themeName)); } } $tpl->assign('mydirname', $mydirname); $tpl->assign('mod_url', XOOPS_URL . '/modules/' . $mydirname); $tpl->assign('content', $content4assign); // assign special session $session_prefix = $mydirname . '_' . @$content4assign['id'] . '_'; $session4assign = array(); foreach (array_keys(@$_SESSION) as $index) { if (strncmp($index, $session_prefix, strlen($session_prefix)) === 0) { $session4assign[substr($index, strlen($session_prefix))] = $_SESSION[$index]; } } $tpl->assign('session', $session4assign); $temp_file = XOOPS_COMPILE_PATH . '/' . substr(md5(XOOPS_DB_PREFIX . @$content4assign['id']), 16) . $mydirname . '_temp_resource'; if (!$text || $text != @file_get_contents($temp_file)) { $fw = fopen($temp_file, 'wb'); fwrite($fw, $text); fclose($fw); $tpl->clear_compiled_tpl('file:' . $temp_file); } $text = $tpl->fetch('file:' . $temp_file); // unlink( $temp_file ) ; return $text; }
function fetch($tplfile, $cache_id = null, $compile_id = null, $display = false) { if ($this->tplbase == 'base') { $tpldir = wp_base() . '/templates'; } else { if ($this->tplbase == 'theme') { $tplpath = get_custom_path('templates/' . $tplfile); $tpldir = dirname($tplpath); $tplfile = basename($tplpath); } else { $tpldir = wp_base() . '/' . $this->tplbase . '/templates'; } } $this->template_dir = $tpldir; if (!$compile_id) { if ($this->tplbase == 'theme') { $compile_id = wp_prefix() . $GLOBALS['xoopsConfig']['theme_set'] . '_'; } else { $compile_id = wp_prefix() . $this->tplbase . '_'; } } return parent::fetch($tplfile, $cache_id, $compile_id, $display); }
// Mise en template include_once XOOPS_ROOT_PATH . '/class/template.php'; $template = new XoopsTpl(); $vat = null; $vat = $handlers->h_oledrion_vat->get($vat_id); $productPriceTTC = oledrion_utils::getAmountWithVat($productPrice, $vat_id); $oledrion_Currency = oledrion_Currency::getInstance(); $templateProduct = $product->toArray(); $templateProduct['product_final_price_ht_formated_long'] = $oledrion_Currency->amountForDisplay($productPrice, 'l'); $templateProduct['product_final_price_ttc_formated_long'] = $oledrion_Currency->amountForDisplay($productPriceTTC, 'l'); if (is_object($vat)) { $templateProduct['product_vat_rate'] = $vat->toArray(); } $templateProduct['product_vat_amount_formated_long'] = $oledrion_Currency->amountForDisplay($productPriceTTC - $productPrice, 'l'); $template->assign('product', $templateProduct); $return = $template->fetch('db:oledrion_product_price.tpl'); } break; // ajax search // ajax search case 'search': // ajax search $key = $_GET['part']; if (isset($key) && $key != '') { // Set captul $i = 1; // Query 1 $query = "SELECT `product_id` AS `id` , `product_cid` AS `cid`, `product_title` AS `title`, `product_thumb_url` AS `image`, `product_price` AS `price` FROM `" . $xoopsDB->prefix('oledrion_products') . "` WHERE (`product_online` = 1) AND (`product_title` LIKE '%" . $key . "%' OR `product_title` LIKE '%" . ucfirst($key) . "%') LIMIT 0, 10"; $result = $xoopsDB->query($query); while ($row = $xoopsDB->fetchArray($result)) { $items[$i]['title'] = $row['title'];
/** * function to update compiled template file in templates_c folder * * @param string $tpl_id * @param boolean $clear_old * @return boolean **/ function xoops_template_touch($tpl_id, $clear_old = true) { $tpl = new XoopsTpl(); $tpl->force_compile = true; $tplfile_handler =& xoops_gethandler('tplfile'); $tplfile =& $tplfile_handler->get($tpl_id); if (is_object($tplfile)) { $file = $tplfile->getVar('tpl_file'); if ($clear_old) { $tpl->clear_cache('db:' . $file); $tpl->clear_compiled_tpl('db:' . $file); } $tpl->fetch('db:' . $file); return true; } return false; }
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ use Xoops\Core\Request; /** * @copyright XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @author trabis <*****@*****.**> * @version $Id$ */ include dirname(dirname(__DIR__)) . '/mainfile.php'; $xoops = Xoops::getInstance(); if (Request::getBool('pdf', false)) { $content = \Xoops\Utils::dumpVar($xoops->getConfigs(), false); $tpl = new XoopsTpl(); $tpl->assign('dummy_content', $content); $content2 = $tpl->fetch('module:system/system_dummy.tpl'); if ($xoops->service('htmltopdf')->isAvailable()) { $xoops->service('htmltopdf')->addHtml($content2); $xoops->service('htmltopdf')->outputPdfInline('codex_example.pdf'); } else { $xoops->header(); echo 'Please install an HtmlToPdf provider!'; \Xoops\Utils::dumpFile(__FILE__); $xoops->footer(); } } else { $xoops->header(); echo '<a href="?pdf=1">Make Pdf</a>'; \Xoops\Utils::dumpFile(__FILE__); $xoops->footer(); }
$bcachetime = $block_arr[$i]->getVar('bcachetime'); if (empty($bcachetime)) { $xoopsTpl->xoops_setCaching(0); } else { $xoopsTpl->xoops_setCaching(2); $xoopsTpl->xoops_setCacheTime($bcachetime); } $btpl = $block_arr[$i]->getVar('template') != '' ? $block_arr[$i]->getVar('template') : "system_block_dummy.html"; if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'))) { $xoopsLogger->addBlock($block_arr[$i]->getVar('name')); $bresult =& $block_arr[$i]->buildBlock(); if (!$bresult) { continue; } $xoopsTpl->assign_by_ref('block', $bresult); $bcontent =& $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid')); $xoopsTpl->clear_assign('block'); } else { $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); $bcontent =& $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid')); } switch ($block_arr[$i]->getVar('side')) { case XOOPS_SIDEBLOCK_LEFT: if (!isset($show_lblock)) { $xoopsTpl->assign('xoops_showlblock', 1); $show_lblock = 1; } $xoopsTpl->append('xoops_lblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent)); break; case XOOPS_CENTERBLOCK_LEFT: if (!isset($show_cblock)) {
function plugin_xoopsblock_convert() { if ($this->root->module['platform'] !== "xoops") { return ''; } static $css_show = FALSE; list($tgt, $option1, $option2) = array_pad(func_get_args(), 3, ""); $tgt_bids = array(); if (!$tgt || $tgt === "?") { $tgt = "?"; } else { foreach (explode(",", $tgt) as $_bid) { if (preg_match("/^\\d+\$/", $_bid) && $_bid > 0) { $tgt_bids[] = $_bid; } } } $align = "left"; $around = false; $width = ""; $arg = array(); if (preg_match("/^(left|center|right)\$/i", $option2, $arg)) { $align = $arg[1]; } if (preg_match("/^(left|center|right)\$/i", $option1, $arg)) { $align = $arg[1]; } if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option2, $arg)) { if ($arg[1]) { $around = true; } $width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3]; $width = "width:" . $width . ";"; } if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option1, $arg)) { if ($arg[1]) { $around = true; } $width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3]; $width = "width:" . $width . ";"; } if ($align === 'center') { if (!$width) { $width = 'width:auto;'; } $style = ' style="margin-left:auto;margin-right:auto;' . $width . '"'; $around = false; } else { $style = ' style="float:' . $align . ';' . $width . '"'; } $clear = $around ? '' : '<div style="clear:both;"></div>'; global $xoopsUser; $xoopsblock = new XoopsBlock(); $xoopsgroup = new XoopsGroup(); $arr = array(); $side = null; if ($this->root->userinfo['admin']) { $arr = $xoopsblock->getAllBlocks(); } else { if ($xoopsUser) { $arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->groups()); } else { $arr = $xoopsblock->getAllBlocksByGroup($this->plugin_xoopsblock_getByType("Anonymous")); } } $ret = ""; if ($tgt == "?") { foreach ($arr as $myblock) { $block = array(); $block_type = @$myblock->getVar("type") ? $myblock->getVar("type") : $myblock->getVar("block_type"); $name = @$myblock->getVar("title") ? $myblock->getVar("title") : $myblock->getVar("name"); $bid = $myblock->getVar('bid'); $ret .= "<li>(" . $bid . ")" . $name . "</li>"; } } else { global $xoopsTpl; require_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); if (is_object($xoopsUser)) { $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUser->isAdmin())); } $xoopsTpl->assign('xoops_requesturi', htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES)); foreach ($tgt_bids as $bid) { $myblock = new XoopsBlock($bid); $_bid = $myblock->getVar('bid'); if (!empty($_bid)) { $bcachetime = $myblock->getVar('bcachetime'); // Only a guest enable cache. by nao-pon //if (empty($bcachetime)) { if ($bcachetime % 10 == 1) { $bcachetime_guest = TRUE; $bcachetime = $bcachetime - 1; } else { $bcachetime_guest = FALSE; } if (empty($bcachetime) || is_object($xoopsUser) && $bcachetime_guest) { //if (empty($bcachetime)) { $xoopsTpl->xoops_setCaching(0); } else { $xoopsTpl->xoops_setCaching(2); $xoopsTpl->xoops_setCacheTime($bcachetime); } $btpl = $myblock->getVar('template'); if ($btpl != '') { if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $myblock->getVar('bid'))) { //$xoopsLogger->addBlock($myblock->getVar('name')); $bresult = $myblock->buildBlock(); if (!$bresult) { continue; } $xoopsTpl->assign_by_ref('block', $bresult); $bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid')); $xoopsTpl->clear_assign('block'); } else { //$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime); $bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid')); } } else { //$bid = $myblock->getVar('bid'); if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) { //$xoopsLogger->addBlock($myblock->getVar('name')); $bresult = $myblock->buildBlock(); if (!$bresult) { continue; } $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']); $bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid); $xoopsTpl->clear_assign('block'); } else { //$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime); $bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid); } } $btitle = $myblock->getVar('title'); } else { $btitle = "Block({$bid})"; $bcontent = "Block({$bid}) is not found."; } if ($bcontent) { $ret .= "<h5>" . $btitle . "</h5>\n"; $ret .= $bcontent; foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_block_header')) as $str) { $this->root->head_tags[] = rtrim($str); } foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_module_header')) as $str) { $this->root->head_tags[] = rtrim($str); } $this->root->head_tags = array_unique($this->root->head_tags); } } unset($myblock); } if (!$css_show) { $css_show = true; $this->root->head_pre_tags[] = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . XOOPS_URL . "/xoops.css\" />"; } if ($tgt == "?") { $ret = "<ul>{$ret}</ul>"; } unset($xoopsblock, $xoopsgroup); return "<div{$style}>{$ret}</div>{$clear}"; }
<?php include_once 'header.php'; header("Content-Type:text/html; charset=" . _CHARSET); $letter_id = isset($_REQUEST['letter_id']) ? intval($_REQUEST['letter_id']) : ''; $newsletter_handler = xoops_getmodulehandler('content', 'newsletter'); $letter_obj = $newsletter_handler->get($letter_id); if (empty($letter_id) || !is_object($letter_obj)) { redirect_header('index.php', 3, '您所訪問的電子報不存在!'); } $letter = $letter_obj->getValues(); $letter['create_time'] = formatTimestamp($letter['create_time'], 'Y-m-d'); $tplName = dirname(__FILE__) . "/templates/newsletter_newsletter.html"; include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->assign('letter', $letter); $xoopsTpl->assign('is_subscribe', $is_subscribe); echo $xoopsTpl->fetch($tplName);
function menus_mainmenu_show() { $block = array(); $xoops = Xoops::getInstance(); $helper = Xoops::getModuleHelper('menus'); $module_handler = $xoops->getHandlerModule(); $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); $criteria->add(new Criteria('isactive', 1)); $criteria->add(new Criteria('weight', 0, '>')); $modules = $module_handler->getObjectsArray($criteria, true); $moduleperm_handler = $xoops->getHandlerGroupPermission(); $groups = $xoops->getUserGroups(); $read_allowed = $moduleperm_handler->getItemIds('module_read', $groups); $menus = array(); $menu = $helper->getHandlerMenu()->create(); $menu->setVar('id', 1); $menu->setVar('pid', 0); $menu->setVar('alt_title', _MB_MENUS_HOME); $menu->setVar('title', _MB_MENUS_HOME); $menu->setVar('link', \XoopsBaseConfig::get('url')); $menu->setVar('image', 'icon-home'); $menus[] = $menu->getValues(); foreach (array_keys($modules) as $i) { if (in_array($i, $read_allowed)) { /* @var $plugin MenusPluginInterface */ $menu = $helper->getHandlerMenu()->create(); $menu->setVar('id', $i); $menu->setVar('pid', 0); $menu->setVar('title', $modules[$i]->getVar('name')); $menu->setVar('alt_title', $modules[$i]->getVar('name')); $menu->setVar('link', \XoopsBaseConfig::get('url') . '/modules/' . $modules[$i]->getVar('dirname')); $menu->setVar('image', 'icon-tags'); $menus[] = $menu->getValues(); if ($xoops->isModule() && $xoops->module->getVar('dirname') == $modules[$i]->getVar('dirname') && ($plugin = \Xoops\Module\Plugin::getPlugin($modules[$i]->getVar('dirname'), 'menus'))) { $sublinks = $plugin->subMenus(); $j = -1; foreach ($sublinks as $sublink) { $menu = $helper->getHandlerMenu()->create(); $menu->setVar('id', $j); $menu->setVar('pid', $i); $menu->setVar('title', $sublink['name']); $menu->setVar('alt_title', $sublink['name']); $menu->setVar('link', \XoopsBaseConfig::get('url') . '/modules/' . $modules[$i]->getVar('dirname') . '/' . $sublink['url']); $menus[] = $menu->getValues(); $j--; } } } } $builder = new MenusBuilder($menus); $block = $builder->render(); $skin_info = $helper->getSkinInfo('mainmenu', false); $blockTpl = new XoopsTpl(); $blockTpl->assign('block', $block); $blockTpl->assign('config', $skin_info['config']); $blockTpl->assign('skinurl', $skin_info['url']); $blockTpl->assign('skinpath', $skin_info['path']); $block['content'] = $blockTpl->fetch($skin_info['template']); return $block; }
function b_d3dside_category_show( $options ){ $mydirname = empty( $options[0] ) ? 'd3diary' : $options[0] ; $max_entry = empty( $options[1] ) ? 10 : intval( $options[1] ) ; $now_order = empty( $options[2] ) ? 'time' : trim( $options[2] ) ; $this_template = empty( $options[3] ) ? 'db:'.$mydirname.'_block_side_category.html' : trim( $options[3] ) ; $limit_self = empty( $options[4] ) ? 0 : (int)$options[4] ; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; require_once dirname( dirname(__FILE__) ).'/class/d3diaryConf.class.php'; $d3dConf = D3diaryConf::getInstance($mydirname, 0, "b_side_category"); $func =& $d3dConf->func ; $uid = $d3dConf->uid; $req_uid = $d3dConf->req_uid; // overrided by d3dConf if( $limit_self == 1 ) { // always show diarylist page $req_uid = 0 ; } elseif( $limit_self == 2 && $req_uid > 0 ) { // not show for personal page return ; } elseif( $limit_self == 3 && $req_uid == 0 ) { // not show except for personal page return ; } // create base url //$page = $d3dConf->page ; //$q_tag = $d3dConf->q_tag ; //$q_year = $d3dConf->q_year ; //$q_month = $d3dConf->q_month ; //$q_day = $d3dConf->q_day ; $q_fr = $d3dConf->q_fr ; if( $req_uid > 0 ) { $base_url = $d3dConf->urluppr.$d3dConf->urlbase.$d3dConf->url4ex_cat."&"; } elseif( strcmp( $d3dConf->page, "photolist" ) == 0 ) { $base_url = $d3dConf->urluppr."page=photolist".$d3dConf->url4ex_cat."&"; } else { $base_url = $d3dConf->urluppr.$d3dConf->urlbase_dlst.$d3dConf->url4ex_cat."&"; } $catopt = $func->get_categories($req_uid,$uid,true); $tag_name = rawurlencode(rawurldecode($d3dConf->getpost_param('tag_name'))) ; //$tag_name = $d3dConf->getpost_param('tag_name') ; $lang = array(); $constpref = '_MB_' . strtoupper( $mydirname ) ; $lang['edit'] = constant($constpref.'_CATEGORY_EDIT'); $block=""; $block['catopt'] = $catopt; $block['yd_uid'] = $req_uid; $block['lang'] = $lang; $block['mydirname'] = $mydirname; $block['base_url'] = $base_url; $block['tag_name'] = $tag_name ; $block['fr'] = $q_fr ; $d3dConf->debug_appendtime('b_side_category'); if( empty( $options['disable_renderer'] ) ) { require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( 'block' , $block ) ; $ret['content'] = $tpl->fetch( $this_template ) ; return $ret ; } else { return $block ; } }
function xpress_block_render($mydirname, $block_function_name, $options) { global $wpdb, $xoops_config, $xoopsUserIsAdmin; $func_file = $block_function_name; $call_theme_function_name = str_replace(".php", "", $block_function_name); $inc_theme_file_name = $call_theme_function_name . '_theme.php'; $cache_title = str_replace(".php", "", $block_function_name); $blockID = get_block_id($mydirname, $func_file, $options); $this_block_url = '/' . $mydirname . '/'; $call_url = $_SERVER['REQUEST_URI']; $block['err_message'] = ''; if (strstr($call_url, $this_block_url) !== false && strstr($call_url, $this_block_url . 'admin/') === false) { $block_theme_file = get_block_file_path($mydirname, $inc_theme_file_name); require_once $block_theme_file['file_path']; $block = $call_theme_function_name($options); //The block name and the called function name should be assumed to be the same name. if (!empty($block_theme_file['error'])) { $block['err_message'] .= $block_theme_file['error']; } } else { if (xpress_block_cache_found($mydirname, $cache_title . $blockID)) { $xml = xpress_block_cache_read($mydirname, $cache_title . $blockID); $block = $xml['block']; } else { $block['err_message'] .= sprintf(_MB_XP2_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname . '</a>'); } } if (!cache_is_writable()) { $block['err_message'] = '<span style="color:#ff0000">'; $block['err_message'] .= _MB_XP2_CACHE_NOT_WRITABLE; if ($xoopsUserIsAdmin) { $block['err_message'] .= " ({$cache_dir})"; $block['err_message'] .= '</span>'; } } xpress_block_header_set($mydirname); $block['request_uri'] = $_SERVER['REQUEST_URI']; $temp_option = @explode(':', $options[1]); if (isset($temp_option[1])) { $templates_file = $options[1]; } else { $templates_file = 'db:' . $mydirname . '_' . str_replace(".php", ".html", $block_function_name); } $tpl = new XoopsTpl(); $tpl->template_dir = $xoops_config->module_path . '/templates'; if (!$tpl->template_exists($templates_file)) { $src_file_path = $xoops_config->module_path . '/templates/' . $mydirname . '_' . str_replace(".php", ".html", $block_function_name); $templates_file = add_xpress_tpl($mydirname, $templates_file, $src_file_path); } $tpl->assign('block', $block); $ret['content'] = $tpl->fetch($templates_file); if (preg_match('/\\S/', $ret['content'])) { return $ret; } else { return null; } }
$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')); $xoopsTpl->assign('block', $block->buildBlock()); } $dummytpl = '_dummytpl_' . time() . '.html'; $fp = fopen(XOOPS_CACHE_PATH . '/' . $dummytpl, 'w'); fwrite($fp, $html); fclose($fp); $xoopsTpl->assign('content', $xoopsTpl->fetch('file:' . XOOPS_CACHE_PATH . '/' . $dummytpl)); $xoopsTpl->clear_compiled_tpl('file:' . XOOPS_CACHE_PATH . '/' . $dummytpl); unlink(XOOPS_CACHE_PATH . '/' . $dummytpl); $dummyfile = '_dummy_' . time() . '.html'; $fp = fopen(XOOPS_CACHE_PATH . '/' . $dummyfile, 'w'); fwrite($fp, $dummylayout); fclose($fp); $tplset = $tplfile->getVar('tpl_tplset'); $tform = array('tpl_tplset' => $tplset, 'tpl_id' => $id, 'tpl_file' => $tplfile->getVar('tpl_file'), 'tpl_desc' => $tplfile->getVar('tpl_desc'), 'tpl_lastmodified' => $tplfile->getVar('tpl_lastmodified'), 'tpl_source' => htmlspecialchars($html, ENT_QUOTES), 'tpl_module' => $moddir); include_once XOOPS_ROOT_PATH . '/modules/system/admin/tplsets/tplform.php'; xoops_cp_header(); echo '<a href="admin.php?fct=tplsets">' . _MD_TPLMAIN . '</a> <span style="font-weight:bold;">»»</span> <a href="./admin.php?fct=tplsets&op=listtpl&moddir=' . $moddir . '&tplset=' . $tplset . '">' . $tplset . '</a> <span style="font-weight:bold;">»»</span> ' . _MD_EDITTEMPLATE . '<br /><br />'; $form->display(); xoops_cp_footer(); echo '<script type="text/javascript"> <!--//
function xnpbookGetMetadata($prefix, $item_id) { $mydirpath = dirname(dirname(__FILE__)); $mydirname = basename($mydirpath); if (!in_array($prefix, array('oai_dc', 'junii2'))) { return false; } // detail information $detail_handler =& xoonips_getormhandler($mydirname, 'item_detail'); $author_handler =& xoonips_getormhandler($mydirname, 'author'); $detail_obj =& $detail_handler->get($item_id); if (empty($detail_obj)) { return false; } $detail = $detail_obj->getArray(); $criteria = new Criteria('book_id', $item_id); $criteria->setSort('author_order'); $author_objs =& $author_handler->getObjects($criteria); $detail['authors'] = array(); foreach ($author_objs as $author_obj) { $detail['authors'][] = $author_obj->get('author'); } // basic information $basic = xnpGetBasicInformationArray($item_id); $basic['publication_date_iso8601'] = xnpISO8601($basic['publication_year'], $basic['publication_month'], $basic['publication_mday']); // indexes $indexes = array(); if (xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $xids) == RES_OK) { foreach ($xids as $xid) { if (xnp_get_index($_SESSION['XNPSID'], $xid, $index) == RES_OK) { $indexes[] = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid); } } } // files $files = array(); $mimetypes = array(); if ($detail['attachment_dl_limit'] == 0) { $file_handler =& xoonips_gethandler('xoonips', 'file'); $files = $file_handler->getFilesInfo($item_id, 'book_pdf'); foreach ($files as $file) { if (!in_array($file['mime_type'], $mimetypes)) { $mimetypes[] = $file['mime_type']; } } } // related to $related_to_handler =& xoonips_getormhandler('xoonips', 'related_to'); $related_to_ids = $related_to_handler->getChildItemIds($item_id); $related_tos = array(); foreach ($related_to_ids as $related_to_id) { $related_tos[] = array('item_id' => $related_to_id, 'item_url' => XOOPS_URL . '/modules/xoonips/detail.php?item_id=' . $related_to_id); } // repository configs $xconfig_handler =& xoonips_getormhandler('xoonips', 'config'); $myxoopsConfigMetaFooter =& xoonips_get_xoops_configs(XOOPS_CONF_METAFOOTER); $repository = array('download_file_compression' => $xconfig_handler->getValue('download_file_compression'), 'nijc_code' => $xconfig_handler->getValue('repository_nijc_code'), 'publisher' => $xconfig_handler->getValue('repository_publisher'), 'institution' => $xconfig_handler->getValue('repository_institution'), 'meta_author' => $myxoopsConfigMetaFooter['meta_author']); // assign template global $xoopsTpl; $tpl = new XoopsTpl(); $tpl->plugins_dir[] = XOONIPS_PATH . '/class/smarty/plugins'; $tpl->assign($xoopsTpl->get_template_vars()); $tpl->assign('basic', $basic); $tpl->assign('detail', $detail); $tpl->assign('indexes', $indexes); $tpl->assign('files', $files); $tpl->assign('mimetypes', $mimetypes); $tpl->assign('related_tos', $related_tos); $tpl->assign('repository', $repository); $xml = $tpl->fetch('db:' . $mydirname . '_oaipmh_' . $prefix . '.xml'); return $xml; }