function extendword3(&$ra_word, $str) { $ra = subString_UTF8($str, 0, 100); $lenth = count($ra); //$str=mb_convert_encoding($str, "utf-8", "gb2312"); $i = 0; while ($i + 2 <= $lenth) { //$substr=mb_convert_encoding($substr,"gb2312", "utf-8"); $ra_word[] = $ra[$i] . $ra[$i + 1]; $i += 1; } $i = 0; while ($i + 3 <= $lenth) { //$substr=mb_convert_encoding($substr,"gb2312", "utf-8"); $ra_word[] = $ra[$i] . $ra[$i + 1] . $ra[$i + 2]; $i += 1; } $i = 0; while ($i + 4 <= $lenth) { //$substr=mb_convert_encoding($substr,"gb2312", "utf-8"); $ra_word[] = $ra[$i] . $ra[$i + 1] . $ra[$i + 2] . $ra[$i + 3]; $i += 1; } }
function page_soundmanager_list() { global $smarty; global $rpcpbx; global $friconf; //磁盘使用 $rpcres = sendrequest($rpcpbx->voicefiles_diskfree('sound'), 0); $smarty->assign("diskfree_gigabyte", round($rpcres['diskfree'] / 1024 / 1024 / 1024, 4)); $diskfree_percent = round($rpcres['diskfree'] / $rpcres['disktotal'] * 100); $smarty->assign("diskfree_percent", $diskfree_percent); $smarty->assign("diskused_percent", 100 - $diskfree_percent); //分页显示计算 $limit_from = 0; if (!$_REQUEST['cols_in_page'] || $_REQUEST['cols_in_page'] == 'frist' || $_REQUEST['cols_in_page'] < $friconf['cols_in_page']) { $limit_from = 0; $smarty->assign("pre_cols", 0); $smarty->assign("next_cols", $friconf['cols_in_page']); } else { $limit_from = $_REQUEST['cols_in_page']; $smarty->assign("pre_cols", $_REQUEST['cols_in_page'] - $friconf['cols_in_page']); $smarty->assign("next_cols", $_REQUEST['cols_in_page'] + $friconf['cols_in_page']); } $smarty->assign("from_cols", $limit_from + 1); $smarty->assign("to_cols", $limit_from + $friconf['cols_in_page']); //取出所有数据 $rpcres = sendrequest($rpcpbx->voicefiles_list('sound', $limit_from, $friconf['cols_in_page']), 0); //根据分页显示进行取得数据显示 foreach ($rpcres['resdata'] as $key => $value) { $description_short = join('', subString_UTF8($value['description'], 0, 18)); if (strlen($description_short) < strlen($value['description'])) { $description_short = $description_short . '...'; } $rpcres['resdata'][$key]['description_short'] = $description_short; $rpcres['resdata'][$key]['filesize'] = round($value['filesize'] / 1024); } $smarty->assign("soundmusic_array", $rpcres['resdata']); $smarty->assign("maxcount", count($rpcres['resdata'])); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_soundmanager_list.tpl'); exit; }