Example #1
0
function block_template($bid)
{
    global $_G;
    $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid];
    $theclass = block_getclass($block['blockclass'], false);
    $thestyle = !empty($block['styleid']) ? block_getstyle($block['styleid']) : dunserialize($block['blockstyle']);
    if (empty($block) || empty($theclass) || empty($thestyle)) {
        return false;
    }
    $template = block_build_template($thestyle['template']);
    if (!empty($block['itemlist'])) {
        if ($thestyle['moreurl']) {
            $template = str_replace('{moreurl}', 'portal.php?mod=block&bid=' . $bid, $template);
        }
        $fields = array('picwidth' => array(), 'picheight' => array(), 'target' => array(), 'currentorder' => array());
        if ($block['hidedisplay']) {
            $fields = array_merge($fields, $theclass['fields']);
        } else {
            $thestyle['fields'] = !empty($thestyle['fields']) && is_array($thestyle['fields']) ? $thestyle['fields'] : block_parse_fields($template);
            foreach ($thestyle['fields'] as $k) {
                if (isset($theclass['fields'][$k])) {
                    $fields[$k] = $theclass['fields'][$k];
                }
            }
        }
        $order = 0;
        $dynamicparts = array();
        foreach ($block['itemlist'] as $position => $blockitem) {
            $itemid = $blockitem['itemid'];
            $order++;
            $rkey = $rpattern = $rvalue = $rtpl = array();
            $rkeyplug = false;
            if (isset($thestyle['template']['index']) && is_array($thestyle['template']['index']) && isset($thestyle['template']['index'][$order])) {
                $rkey[] = 'index_' . $order;
                $rpattern[] = '/\\s*\\[index=' . $order . '\\](.*?)\\[\\/index\\]\\s*/is';
                $rvalue[] = '';
                $rtpl[] = $thestyle['template']['index'][$order];
            }
            if (empty($rkey)) {
                $rkey[] = 'loop';
                $rpattern[] = '/\\s*\\[loop\\](.*?)\\[\\/loop\\]\\s*/is';
                $rvalue[] = isset($dynamicparts['loop']) ? $dynamicparts['loop'][1] : '';
                if (is_array($thestyle['template']['order']) && isset($thestyle['template']['order'][$order])) {
                    $rtpl[] = $thestyle['template']['order'][$order];
                } elseif (is_array($thestyle['template']['order']) && isset($thestyle['template']['order']['odd']) && $order % 2 == 1) {
                    $rtpl[] = $thestyle['template']['order']['odd'];
                } elseif (is_array($thestyle['template']['order']) && isset($thestyle['template']['order']['even']) && $order % 2 == 0) {
                    $rtpl[] = $thestyle['template']['order']['even'];
                } else {
                    $rtpl[] = $thestyle['template']['loop'];
                }
            }
            if (!empty($thestyle['template']['indexplus'])) {
                foreach ($thestyle['template']['indexplus'] as $k => $v) {
                    if (isset($v[$order])) {
                        $rkey[] = 'index' . $k . '=' . $order;
                        $rkeyplug = true;
                        $rpattern[] = '/\\[index' . $k . '=' . $order . '\\](.*?)\\[\\/index' . $k . '\\]/is';
                        $rvalue[] = '';
                        $rtpl[] = $v[$order];
                    }
                }
            }
            if (empty($rkeyplug)) {
                if (!empty($thestyle['template']['loopplus'])) {
                    foreach ($thestyle['template']['loopplus'] as $k => $v) {
                        $rkey[] = 'loop' . $k;
                        $rpattern[] = '/\\s*\\[loop' . $k . '\\](.*?)\\[\\/loop' . $k . '\\]\\s*/is';
                        $rvalue[] = isset($dynamicparts['loop' . $k]) ? $dynamicparts['loop' . $k][1] : '';
                        if (is_array($thestyle['template']['orderplus'][$k]) && isset($thestyle['template']['orderplus'][$k][$order])) {
                            $rtpl[] = $thestyle['template']['orderplus'][$k][$order];
                        } elseif (is_array($thestyle['template']['orderplus'][$k]) && isset($thestyle['template']['orderplus'][$k]['odd']) && $order % 2 == 1) {
                            $rtpl[] = $thestyle['template']['orderplus'][$k]['odd'];
                        } elseif (is_array($thestyle['template']['orderplus'][$k]) && isset($thestyle['template']['orderplus'][$k]['even']) && $order % 2 == 0) {
                            $rtpl[] = $thestyle['template']['orderplus'][$k]['even'];
                        } else {
                            $rtpl[] = $thestyle['template']['loopplus'][$k];
                        }
                    }
                }
            }
            $blockitem['fields'] = !empty($blockitem['fields']) ? $blockitem['fields'] : array();
            $blockitem['fields'] = is_array($blockitem['fields']) ? $blockitem['fields'] : dunserialize($blockitem['fields']);
            if (!empty($blockitem['showstyle'])) {
                $blockitem['fields']['showstyle'] = dunserialize($blockitem['showstyle']);
            }
            isset($blockitem['fields']['lastpost']) && ($block['dateuformat'] = 'u');
            $blockitem = $blockitem['fields'] + $blockitem;
            $blockitem['picwidth'] = !empty($block['picwidth']) ? intval($block['picwidth']) : 'auto';
            $blockitem['picheight'] = !empty($block['picheight']) ? intval($block['picheight']) : 'auto';
            $blockitem['target'] = !empty($block['target']) ? ' target="_' . $block['target'] . '"' : '';
            $blockitem['currentorder'] = $order;
            $blockitem['parity'] = $order % 2;
            $searcharr = $replacearr = array();
            $searcharr[] = '{parity}';
            $replacearr[] = $blockitem['parity'];
            foreach ($fields as $key => $field) {
                $replacevalue = $blockitem[$key];
                $field['datatype'] = !empty($field['datatype']) ? $field['datatype'] : '';
                if ($field['datatype'] == 'int') {
                    // int
                    $replacevalue = intval($replacevalue);
                } elseif ($field['datatype'] == 'string') {
                    $replacevalue = preg_quote($replacevalue);
                } elseif ($field['datatype'] == 'date') {
                    $replacevalue = dgmdate($replacevalue, $block['dateuformat'] ? 'u' : $block['dateformat'], '9999', $block['dateuformat'] ? $block['dateformat'] : '');
                } elseif ($field['datatype'] == 'title') {
                    //title
                    $searcharr[] = '{title-title}';
                    $replacearr[] = preg_quote(!empty($blockitem['fields']['fulltitle']) ? $blockitem['fields']['fulltitle'] : dhtmlspecialchars($replacevalue));
                    $searcharr[] = '{alt-title}';
                    $replacearr[] = preg_quote(!empty($blockitem['fields']['fulltitle']) ? $blockitem['fields']['fulltitle'] : dhtmlspecialchars($replacevalue));
                    $replacevalue = preg_quote($replacevalue);
                    if ($blockitem['showstyle'] && ($style = block_showstyle($blockitem['showstyle'], 'title'))) {
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'summary') {
                    //summary
                    $replacevalue = preg_quote($replacevalue);
                    if ($blockitem['showstyle'] && ($style = block_showstyle($blockitem['showstyle'], 'summary'))) {
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'pic') {
                    if ($blockitem['picflag'] == '1') {
                        $replacevalue = $_G['setting']['attachurl'] . $replacevalue;
                    } elseif ($blockitem['picflag'] == '2') {
                        $replacevalue = $_G['setting']['ftp']['attachurl'] . $replacevalue;
                    }
                    if ($blockitem['picflag'] && $block['picwidth'] && $block['picheight'] && $block['picwidth'] != 'auto' && $block['picheight'] != 'auto') {
                        if ($blockitem['makethumb'] == 1) {
                            if ($blockitem['picflag'] == '1') {
                                $replacevalue = $_G['setting']['attachurl'] . $blockitem['thumbpath'];
                            } elseif ($blockitem['picflag'] == '2') {
                                $replacevalue = $_G['setting']['ftp']['attachurl'] . $blockitem['thumbpath'];
                            }
                        } elseif (!$_G['block_makethumb'] && !$blockitem['makethumb']) {
                            C::t('common_block_item')->update($itemid, array('makethumb' => 2));
                            require_once libfile('class/image');
                            $image = new image();
                            $thumbpath = block_thumbpath($block, $blockitem);
                            if ($_G['setting']['ftp']['on']) {
                                $ftp =& discuz_ftp::instance();
                                $ftp->connect();
                                if ($ftp->connectid && $ftp->ftp_size($thumbpath) > 0 || ($return = $image->Thumb($replacevalue, $thumbpath, $block['picwidth'], $block['picheight'], 2) && $ftp->upload($_G['setting']['attachurl'] . '/' . $thumbpath, $thumbpath))) {
                                    $picflag = 1;
                                    //common_block_pic表中的picflag标识(0本地,1远程)
                                    $_G['block_makethumb'] = true;
                                    @unlink($_G['setting']['attachdir'] . './' . $thumbpath);
                                }
                            } elseif (file_exists($_G['setting']['attachdir'] . $thumbpath) || ($return = $image->Thumb($replacevalue, $thumbpath, $block['picwidth'], $block['picheight'], 2))) {
                                $picflag = 0;
                                //common_block_pic表中的picflag标识(0本地,1远程)
                                $_G['block_makethumb'] = true;
                            }
                            if ($_G['block_makethumb']) {
                                C::t('common_block_item')->update($itemid, array('makethumb' => 1, 'thumbpath' => $thumbpath));
                                C::t('common_block')->clear_cache($block['bid']);
                                $thumbdata = array('bid' => $block['bid'], 'itemid' => $itemid, 'pic' => $thumbpath, 'picflag' => $picflag, 'type' => '0');
                                C::t('common_block_pic')->insert($thumbdata);
                            }
                        }
                    }
                }
                $searcharr[] = '{' . $key . '}';
                $replacearr[] = $replacevalue;
                if ($block['hidedisplay']) {
                    if (strpos($replacevalue, "\\") !== false) {
                        $replacevalue = str_replace(array('\\.', '\\\\', '\\+', '\\*', '\\?', '\\[', '\\^', '\\]', '\\$', '\\(', '\\)', '\\{', '\\}', '\\=', '\\!', '\\<', '\\>', '\\|', '\\:', '\\-'), array('.', '\\', '+', '*', '?', '[', '^', ']', '$', '(', ')', '{', '}', '=', '!', '<', '>', '|', ':', '-'), $replacevalue);
                    }
                    $_G['block_' . $bid][$order - 1][$key] = $replacevalue;
                }
            }
            foreach ($rtpl as $k => $str_template) {
                if ($str_template) {
                    $str_template = preg_replace('/title=[\'"]{title}[\'"]/', 'title="{title-title}"', $str_template);
                    $str_template = preg_replace('/alt=[\'"]{title}[\'"]/', 'alt="{alt-title}"', $str_template);
                    $rvalue[$k] .= str_replace($searcharr, $replacearr, $str_template);
                    $dynamicparts[$rkey[$k]] = array($rpattern[$k], $rvalue[$k]);
                }
            }
        }
        // foreach($block['itemlist'] as $itemid=>$blockitem) {
        foreach ($dynamicparts as $value) {
            $template = preg_replace($value[0], $value[1], $template);
        }
        $template = str_replace('\\', '&#92;', stripslashes($template));
    }
    $template = preg_replace('/\\s*\\[(order\\d*)=\\w+\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    $template = preg_replace('/\\s*\\[(index\\d*)=\\w+\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    $template = preg_replace('/\\s*\\[(loop\\d{0,1})\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    return $template;
}
Example #2
0
function block_template($bid)
{
    global $_G;
    $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid];
    $theclass = block_getclass($block['blockclass'], false);
    $thestyle = !empty($block['styleid']) ? block_getstyle($block['styleid']) : unserialize($block['blockstyle']);
    if (empty($block) || empty($theclass) || empty($thestyle)) {
        return;
    }
    $template = block_build_template($thestyle['template']);
    if (!empty($block['itemlist'])) {
        $fields = array('picwidth' => array(), 'picheight' => array(), 'target' => array(), 'currentorder' => array());
        if ($block['hidedisplay']) {
            $fields = array_merge($fields, $theclass['fields']);
        } else {
            $thestyle['fields'] = !empty($thestyle['fields']) && is_array($thestyle['fields']) ? $thestyle['fields'] : block_parse_fields($template);
            foreach ($thestyle['fields'] as $k) {
                if (isset($theclass['fields'][$k])) {
                    $fields[$k] = $theclass['fields'][$k];
                }
            }
        }
        $order = 0;
        $dynamicparts = array();
        foreach ($block['itemlist'] as $itemid => $blockitem) {
            $order++;
            $rkey = $rpattern = $rvalue = $rtpl = array();
            $rkeyplug = false;
            if (isset($thestyle['template']['index']) && is_array($thestyle['template']['index']) && isset($thestyle['template']['index'][$order])) {
                $rkey[] = 'index_' . $order;
                $rpattern[] = '/\\s*\\[index=' . $order . '\\](.*?)\\[\\/index\\]\\s*/is';
                $rvalue[] = '';
                $rtpl[] = $thestyle['template']['index'][$order];
            }
            if (empty($rkey)) {
                $rkey[] = 'loop';
                $rpattern[] = '/\\s*\\[loop\\](.*?)\\[\\/loop\\]\\s*/is';
                $rvalue[] = isset($dynamicparts['loop']) ? $dynamicparts['loop'][1] : '';
                if (is_array($thestyle['template']['order']) && isset($thestyle['template']['order'][$order])) {
                    $rtpl[] = $thestyle['template']['order'][$order];
                } elseif (is_array($thestyle['template']['order']) && isset($thestyle['template']['order']['odd']) && $order % 2 == 1) {
                    $rtpl[] = $thestyle['template']['order']['odd'];
                } elseif (is_array($thestyle['template']['order']) && isset($thestyle['template']['order']['even']) && $order % 2 == 0) {
                    $rtpl[] = $thestyle['template']['order']['even'];
                } else {
                    $rtpl[] = $thestyle['template']['loop'];
                }
            }
            if (!empty($thestyle['template']['indexplus'])) {
                foreach ($thestyle['template']['indexplus'] as $k => $v) {
                    if (isset($v[$order])) {
                        $rkey[] = 'index' . $k . '=' . $order;
                        $rkeyplug = true;
                        $rpattern[] = '/\\[index' . $k . '=' . $order . '\\](.*?)\\[\\/index' . $k . '\\]/is';
                        $rvalue[] = '';
                        $rtpl[] = $v[$order];
                    }
                }
            }
            if (empty($rkeyplug)) {
                if (!empty($thestyle['template']['loopplus'])) {
                    foreach ($thestyle['template']['loopplus'] as $k => $v) {
                        $rkey[] = 'loop' . $k;
                        $rpattern[] = '/\\s*\\[loop' . $k . '\\](.*?)\\[\\/loop' . $k . '\\]\\s*/is';
                        $rvalue[] = isset($dynamicparts['loop' . $k]) ? $dynamicparts['loop' . $k][1] : '';
                        if (is_array($thestyle['template']['orderplus'][$k]) && isset($thestyle['template']['orderplus'][$k][$order])) {
                            $rtpl[] = $thestyle['template']['orderplus'][$k][$order];
                        } elseif (is_array($thestyle['template']['orderplus'][$k]) && isset($thestyle['template']['orderplus'][$k]['odd']) && $order % 2 == 1) {
                            $rtpl[] = $thestyle['template']['order' . $k]['odd'];
                        } elseif (is_array($thestyle['template']['orderplus'][$k]) && isset($thestyle['template']['orderplus'][$k]['even']) && $order % 2 == 0) {
                            $rtpl[] = $thestyle['template']['orderplus'][$k]['even'];
                        } else {
                            $rtpl[] = $thestyle['template']['loopplus'][$k];
                        }
                    }
                }
            }
            $blockitem['fields'] = !empty($blockitem['fields']) ? $blockitem['fields'] : array();
            $blockitem['fields'] = is_array($blockitem['fields']) ? $blockitem['fields'] : unserialize($blockitem['fields']);
            $blockitem['showstyle'] = !empty($blockitem['showstyle']) ? unserialize($blockitem['showstyle']) : array();
            $blockitem['showstyle'] = !empty($blockitem['showstyle']) ? $blockitem['showstyle'] : (!empty($blockitem['fields']['showstyle']) ? $blockitem['fields']['showstyle'] : array());
            $blockitem['picwidth'] = !empty($block['picwidth']) ? intval($block['picwidth']) : 'auto';
            $blockitem['picheight'] = !empty($block['picheight']) ? intval($block['picheight']) : 'auto';
            $blockitem['target'] = !empty($block['target']) ? ' target="_' . $block['target'] . '"' : '';
            $blockitem['currentorder'] = $order;
            $blockitem['parity'] = $order % 2;
            $searcharr = $replacearr = array();
            $searcharr[] = '{parity}';
            $replacearr[] = $blockitem['parity'];
            foreach ($fields as $key => $field) {
                $replacevalue = isset($blockitem[$key]) ? $blockitem[$key] : (isset($blockitem['fields'][$key]) ? $blockitem['fields'][$key] : '');
                $field['datatype'] = !empty($field['datatype']) ? $field['datatype'] : '';
                if ($field['datatype'] == 'int') {
                    // int
                    $replacevalue = intval($replacevalue);
                } elseif ($field['datatype'] == 'string') {
                    $replacevalue = $replacevalue;
                } elseif ($field['datatype'] == 'date') {
                    $replacevalue = dgmdate($replacevalue, $block['dateuformat'] ? 'u' : $block['dateformat'], '9999', $block['dateuformat'] ? $block['dateformat'] : '');
                } elseif ($field['datatype'] == 'title') {
                    //title
                    $replacevalue = stripslashes($replacevalue);
                    $searcharr[] = '{title-title}';
                    $replacearr[] = !empty($blockitem['fields']['fulltitle']) ? $blockitem['fields']['fulltitle'] : htmlspecialchars($replacevalue);
                    $searcharr[] = '{alt-title}';
                    $replacearr[] = !empty($blockitem['fields']['fulltitle']) ? $blockitem['fields']['fulltitle'] : htmlspecialchars($replacevalue);
                    if ($blockitem['showstyle'] && ($style = block_showstyle($blockitem['showstyle'], 'title'))) {
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'summary') {
                    //summary
                    $replacevalue = stripslashes($replacevalue);
                    if ($blockitem['showstyle'] && ($style = block_showstyle($blockitem['showstyle'], 'summary'))) {
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'pic') {
                    if ($blockitem['picflag'] == '1') {
                        $replacevalue = $_G['setting']['attachurl'] . $replacevalue;
                    } elseif ($blockitem['picflag'] == '2') {
                        $replacevalue = $_G['setting']['ftp']['attachurl'] . $replacevalue;
                    }
                    if ($blockitem['picflag'] && $block['picwidth'] && $block['picheight'] && $block['picwidth'] != 'auto' && $block['picheight'] != 'auto') {
                        if ($blockitem['makethumb'] == 1) {
                            if ($blockitem['picflag'] == '1') {
                                $replacevalue = $_G['setting']['attachurl'] . $blockitem['thumbpath'];
                            } elseif ($blockitem['picflag'] == '2') {
                                $replacevalue = $_G['setting']['ftp']['attachurl'] . $blockitem['thumbpath'];
                            }
                        } elseif (!$_G['block_makethumb'] && !$blockitem['makethumb']) {
                            $where = array('itemid' => $blockitem['itemid']);
                            DB::update('common_block_item', array('makethumb' => 2), $where);
                            require_once libfile('class/image');
                            $image = new image();
                            $thumbpath = block_thumbpath($block, $blockitem);
                            if ($_G['setting']['ftp']['on']) {
                                require_once libfile('class/ftp');
                                $ftp =& discuz_ftp::instance();
                                $ftp->connect();
                                if ($ftp->connectid && $ftp->ftp_size($thumbpath) > 0 || ($return = $image->Thumb($replacevalue, $thumbpath, $block['picwidth'], $block['picheight'], 2) && $ftp->upload($_G['setting']['attachurl'] . '/' . $thumbpath, $thumbpath))) {
                                    /*vot*/
                                    $picflag = 1;
                                    //common_block_pic table: picflag identity (0 = local, 1 = remote)
                                    $_G['block_makethumb'] = true;
                                    @unlink($_G['setting']['attachdir'] . './' . $thumbpath);
                                }
                            } elseif (file_exists($_G['setting']['attachdir'] . $thumbpath) || ($return = $image->Thumb($replacevalue, $thumbpath, $block['picwidth'], $block['picheight'], 2))) {
                                /*vot*/
                                $picflag = 0;
                                //common_block_pic table: picflag identity (0 = local, 1 = remote)
                                $_G['block_makethumb'] = true;
                            }
                            if ($_G['block_makethumb']) {
                                DB::update('common_block_item', array('makethumb' => 1, 'thumbpath' => $thumbpath), $where);
                                $thumbdata = array('bid' => $block['bid'], 'itemid' => $blockitem['itemid'], 'pic' => $thumbpath, 'picflag' => $picflag, 'type' => '0');
                                DB::insert('common_block_pic', $thumbdata);
                            }
                        }
                    }
                }
                $searcharr[] = '{' . $key . '}';
                $replacearr[] = $replacevalue;
                if ($block['hidedisplay']) {
                    $_G['block_' . $bid][$order - 1][$key] = $replacevalue;
                }
            }
            foreach ($rtpl as $k => $str_template) {
                if ($str_template) {
                    $str_template = preg_replace('/title=[\'"]{title}[\'"]/', 'title="{title-title}"', $str_template);
                    $str_template = preg_replace('/alt=[\'"]{title}[\'"]/', 'alt="{alt-title}"', $str_template);
                    $rvalue[$k] .= str_replace($searcharr, $replacearr, $str_template);
                    $dynamicparts[$rkey[$k]] = array($rpattern[$k], $rvalue[$k]);
                }
            }
        }
        // foreach($block['itemlist'] as $itemid=>$blockitem) {
        foreach ($dynamicparts as $value) {
            $template = stripslashes(preg_replace($value[0], preg_quote($value[1]), $template));
        }
    }
    $template = preg_replace('/\\s*\\[(order\\d{0,1})=\\w+\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    $template = preg_replace('/\\s*\\[(index\\d{0,1})=\\w+\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    $template = preg_replace('/\\s*\\[(loop\\d{0,1})\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    return $template;
}
                 $itemfields[$key] = dgmdate($value, 'Y-m-d H:i:s');
                 break;
             case 'int':
                 $itemfields[$key] = intval($value);
                 break;
             case 'string':
                 $itemfields[$key] = dhtmlspecialchars($value);
                 break;
             default:
                 $itemfields[$key] = $value;
         }
     }
 }
 $showfields = array();
 if (empty($thestyle['fields'])) {
     $template = block_build_template($thestyle['template']);
     $thestyle['fields'] = block_parse_fields($template);
     C::t('common_block_style')->update(intval($thestyle['styleid']), array('fields' => serialize($thestyle['fields'])));
 }
 foreach ($thestyle['fields'] as $fieldname) {
     $showfields[$fieldname] = "1";
 }
 if (submitcheck('itemsubmit') || submitcheck('recommendsubmit') || submitcheck('verifydatasubmit') || submitcheck('managedatasubmit')) {
     $item['bid'] = $block['bid'];
     $item['displayorder'] = intval($_POST['displayorder']);
     $item['startdate'] = !empty($_POST['startdate']) ? strtotime($_POST['startdate']) : 0;
     $item['enddate'] = !empty($_POST['enddate']) ? strtotime($_POST['enddate']) : 0;
     $item['itemtype'] = !empty($_POST['locked']) ? '1' : '2';
     $item['title'] = dhtmlspecialchars($_POST['title']);
     $item['url'] = $_POST['url'];
     $block['param']['summarylength'] = empty($block['param']['summarylength']) ? 80 : $block['param']['summarylength'];
Example #4
0
function block_style_conver_to_thread($style, $blockclass) {
	$template = block_build_template($style['template']);
	$search = array('threadurl', 'threadsubject', 'threadsummary', 'filesize', 'downloads');
	$replace = array('url', 'title', 'summary', '');
	$template = str_replace($search, $replace, $template);
	$arr = array(
		'name' => '',
		'blockclass' => $blockclass,
	);
	block_parse_template($template, $arr);
	$arr['fields'] = dunserialize($arr['fields']);
	$arr['template'] = dunserialize($arr['template']);
	$arr = serialize($arr);
	return $arr;
}