1 | <?php
|
---|
2 | if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
|
---|
3 | $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
|
---|
4 |
|
---|
5 | eval( '
|
---|
6 | function b_'.$mydirname.'_comments_show($options){
|
---|
7 | return _b_comments_show($options) ;
|
---|
8 | }
|
---|
9 | function b_'.$mydirname.'_comments_edit($options){
|
---|
10 | return _b_comments_edit($options) ;
|
---|
11 | }
|
---|
12 | ' ) ;
|
---|
13 |
|
---|
14 |
|
---|
15 | if( ! defined( 'XPRESS_COMMENTS_BLOCK_INCLUDED' ) ) {
|
---|
16 | define( 'XPRESS_COMMENTS_BLOCK_INCLUDED' , 1 ) ;
|
---|
17 | function _b_comments_edit($options)
|
---|
18 | {
|
---|
19 | $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
|
---|
20 | $disp_count = empty( $options[1] ) ? '10' : $options[1] ;
|
---|
21 | $disp_length = empty( $options[2] ) ? '30' : $options[2] ;
|
---|
22 | $selected = array_slice($options,5); // get allowed cats
|
---|
23 | $this_template = empty( $options[6] ) ? 'db:'.$mydirname.'_block_comments.html' : trim( $options[4] );
|
---|
24 | $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
|
---|
25 |
|
---|
26 | require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
|
---|
27 |
|
---|
28 | $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
|
---|
29 | $form .= _MB_XPRESS_COUNT .": <input type='text' name='options[1]' value='" . $disp_count . "' /><br />";
|
---|
30 | $form .= _MB_XPRESS_LENGTH .": <input type='text' name='options[2]' value='" . $disp_length . "' />";
|
---|
31 | $form .= "<br /><br />" . _MB_XPRESS_COM_TYPE ;
|
---|
32 | $isAll = (count($selected)==0||empty($selected[0]))?true:false;
|
---|
33 | $form .= "<br /> <select name=\"options[]\" multiple=\"multiple\">";
|
---|
34 | $form .= "<option value=\"0\" ";
|
---|
35 | if ($isAll) $form .= " selected=\"selected\"";
|
---|
36 | $form .= ">"._MB_XPRESS_ALL ."</option>";
|
---|
37 |
|
---|
38 | $form .= "<option value=\"1\" ";
|
---|
39 | if (in_array(1, $selected))
|
---|
40 | $form .= " selected=\"selected\"";
|
---|
41 | $form .= ">"._MB_XPRESS_COMMENT ."</option>";
|
---|
42 |
|
---|
43 | $form .= "<option value=\"2\" ";
|
---|
44 | if (in_array(2, $selected))
|
---|
45 | $form .= " selected=\"selected\"";
|
---|
46 | $form .= ">"._MB_XPRESS_TRUCKBACK ."</option>";
|
---|
47 |
|
---|
48 | $form .= "<option value=\"3\" ";
|
---|
49 | if (in_array(3, $selected))
|
---|
50 | $form .= " selected=\"selected\"";
|
---|
51 | $form .= ">"._MB_XPRESS_PINGBACK ."</option>";
|
---|
52 | $form .= "</select><br />";
|
---|
53 | // $form .="<br /><input type='text' size='60' name='options[5]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
|
---|
54 |
|
---|
55 |
|
---|
56 | return $form;
|
---|
57 | }
|
---|
58 |
|
---|
59 | function _b_comments_show($options)
|
---|
60 | {
|
---|
61 | $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
|
---|
62 | $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
|
---|
63 |
|
---|
64 | global $wpdb;
|
---|
65 |
|
---|
66 | if (!is_null($wpdb)){
|
---|
67 | require_once $mydirpath.'/include/xpress_block_theme.php';
|
---|
68 | xpress_block_css_set($mydirname);
|
---|
69 |
|
---|
70 | $block_theme_file = get_block_file_path($mydirname,'recent_comments_block');
|
---|
71 | require_once $block_theme_file;
|
---|
72 | $block = recent_comments_block($options);
|
---|
73 |
|
---|
74 | require_once $mydirpath.'/include/xoops_block_cache.php';
|
---|
75 | xpress_block_cache_write($mydirname,'recent_comments_block',$block);
|
---|
76 | } else {
|
---|
77 | require_once $mydirpath.'/include/xoops_block_cache.php';
|
---|
78 | $block = xpress_block_cache_read($mydirname,'recent_comments_block');
|
---|
79 | }
|
---|
80 | return $block;
|
---|
81 | }
|
---|
82 | }
|
---|
83 | ?> |
---|