JTBC(CMS)

开源与免费的跨平台网站内容管理系统解决方案

腾讯交流群: 2254994
技术支持群: 27032719
首页 » 在线论坛 » PHP版本 
帖子内容
1 楼
sishenfeifei
注册会员
积分 304
注册 2008-12-05
     
关于老PHP版本标题顺序的问题。
原版的PHP的标题顺序是JTB-首页-
而改过后的版本标题有利于优化。是 首页-JTBC-
之前从猪那得到一份改标题顺的文件,他用是正常的,可用在我的网站上就有点小问题。
原版的PHP版本common/incfiles/common.inc.php代码是以下

<?php
//****************************************************
//Jetiben CMS Power by Jetiben.com
//Email: jetiben@hotmail.com
//Web: http://www.jetiben.com/
//****************************************************
require('const.inc.php');
require('class.inc.php');
require('function.inc.php');
function mm_cndatabase($genre, $strers = '')
{
  global $variable;
  if (ii_isnull($strers)) return $variable[$genre . '.ndatabase'];
  else return $variable[$genre . '.ndatabase_' . $strers];
}
function mm_cnidfield($genre, $strers = '')
{
  global $variable;
  if (ii_isnull($strers)) return $variable[$genre . '.nidfield'];
  else return $variable[$genre . '.nidfield_' . $strers];
}
function mm_cnfpre($genre, $strers = '')
{
  global $variable;
  if (ii_isnull($strers)) return $variable[$genre . '.nfpre'];
  else return $variable[$genre . '.nfpre_' . $strers];
}
function mm_cntitle($strers)
{
  global $ntitle;
  if (ii_isnull($ntitle)) $ntitle = ii_htmlencode($strers);
  else $ntitle .= SP_STR . ii_htmlencode($strers);
}
function mm_cnurl()
{
  global $nurl, $cnurl;
  if (ii_isnull($cnurl)) return $nurl;
  else return $cnurl;
}
function mm_ctype($types, $type = 0)
{
  if ($type == 0)
  {
    global $ctype;
    if (ii_isnull($ctype)) return $types;
    else return $ctype;
  }
  elseif ($type == 1)
  {
    global $cmtype;
    if (ii_isnull($cmtype)) return $types;
    else return $cmtype;
  }
}
function mm_client_alert($alert, $type)
{
  ob_end_clean();
  if (is_numeric($type)) $tdispose = 'history.go(' . $type . ')';
  else $tdispose = 'location.href=\'' . $type . '\'';
  $tstr = ii_ireplace('global.tpl_common.client_alert', 'tpl');
  $tstr = str_replace('{$alert}', $alert, $tstr);
  $tstr = str_replace('{$dispose}', $tdispose, $tstr);
  echo $tstr;
  exit();
}
function mm_client_redirect($url)
{
  ob_end_clean();
  $tstr = ii_ireplace('global.tpl_common.client_redirect', 'tpl');
  $tstr = str_replace('{$url}', $url, $tstr);
  echo $tstr;
  exit();
}
function mm_clear_show($msg, $type = 0)
{
  ob_end_clean();
  $thead = ii_ireplace('global.tpl_public.clear_head', 'tpl');
  if ($type == 1) $tbody = '<h1>' . SYS_NAME . '.' . $msg . '</h1>';
  else $tbody = $msg;
  $tfoot = ii_ireplace('global.tpl_public.clear_foot', 'tpl');
  $tstr = $thead . $tbody . $tfoot;
  echo $tstr;
  exit();
}
function mm_ck_valcode()
{
  global $nvalidate;
  if ($nvalidate != 0)
  {
    if (strtolower($_POST['valcode']) != strtolower($_SESSION['valcode'])) return false;
    else return true;
  }
  else return true;
}
function mm_check_valcode($strers)
{
  if (!mm_ck_valcode()) mm_client_alert(ii_itake('global.lng_error.valcode', 'lng'), $strers);
}
function mm_cvalhtml($template, $vals, $recurrence)
{
  $tmpstr = ii_ctemplate($template, $recurrence);
  if (ii_get_num($vals) == 0) $tmpstr = '';
  $tmpstr = str_replace(JTBC_CINFO, $tmpstr, $template);
  return $tmpstr;
}
function mm_cutepage_content($strers, $vars)
{
  if (ii_isnull($strers)) return;
  $tcp_note = ii_get_num(ii_get_strvalue($vars, 'cp_note'));
  if ($tcp_note == 0)
  {
    return $strers;
  }
  else
  {
    $tcp_mode = ii_get_num(ii_get_strvalue($vars, 'cp_mode'));
    $tcp_type = ii_get_num(ii_get_strvalue($vars, 'cp_type'));
    $tcp_num = ii_get_num(ii_get_strvalue($vars, 'cp_num'));
    $tcp_page = ii_get_num(ii_get_strvalue($vars, 'cp_page'));
    if ($tcp_page < 1) $tcp_page = 1;
    if ($tcp_mode == 0)
    {
      $tary = explode('[NextPage]', $strers);
      $tarycount = count($tary) - 1;
      $tcp_page -= 1;
      if ($tcp_page < 0) $tcp_page = 0;
      if ($tcp_page > $tarycount) $tcp_page = $tarycount;
      return $tary[$tcp_page];
    }
    else
    {
      if ($tcp_type == 0)
      {
        $tary = explode(CRLF, $strers);
        $tarycount = count($tary) - 1;
        $tcp_page = $tcp_page * $tcp_num;
        if ($tcp_page > $tarycount)
        {
          $tcp_page = $tarycount;
          $ti = floor($tcp_page/$tcp_num) * $tcp_num;
        }
        else
        {
          $ti = $tcp_page - $tcp_num;
          $tcp_page = $tcp_page - 1;
        }
        $tmpstr = '';
        for ($i = $ti; $i <= $tcp_page; $i ++)
        {
          $tmpstr .= $tary[$i] . CRLF;
        }
        return $tmpstr;
      }
      else
      {
        $tstrlen = strlen($strers);
        $tcp_page = $tcp_page * $tcp_num;
        if ($tcp_page > $tstrlen)
        {
          $tcp_page = $tstrlen;
          $ti = floor($tcp_page/$tcp_num) * $tcp_num;
          $tcp_page -= $ti;
        }
        else
        {
          $ti = $tcp_page - $tcp_num;
          $tcp_page = $tcp_num;
        }
        if ($ti < $tstrlen) return substr($strers, $ti, $tcp_page);
      }
    }
  }
}
function mm_cutepage_content_page($strers, $vars)
{
  $tcp_note = ii_get_num(ii_get_strvalue($vars, 'cp_note'));
  if ($tcp_note == 0)
  {
    return 0;
  }
  else
  {
    $tcp_mode = ii_get_num(ii_get_strvalue($vars, 'cp_mode'));
    $tcp_type = ii_get_num(ii_get_strvalue($vars, 'cp_type'));
    $tcp_num = ii_get_num(ii_get_strvalue($vars, 'cp_num'));
    if ($tcp_mode == 0)
    {
      $tary = explode('[NextPage]', $strers);
      return count($tary);
    }
    else
    {
      if ($tcp_num == 0) $tcp_num = 1000;
      if ($tcp_type == 0)
      {
        $tary = explode(CRLF, $strers);
        return ceil(count($tary) / $tcp_num);
      }
      else
      {
        $tstrlen = strlen($strers);
        return ceil($tstrlen / $tcp_num);
      }
    }
  }
}
function mm_cutepage_content_page_sel($strers, $vars, $ct_strers)
{
  global $nurltype;
  $tcp_note = ii_get_num(ii_get_strvalue($vars, 'cp_note'));
  $tcp_mode = ii_get_num(ii_get_strvalue($vars, 'cp_mode'));
  $tcp_type = ii_get_num(ii_get_strvalue($vars, 'cp_type'));
  $tcp_num = ii_get_num(ii_get_strvalue($vars, 'cp_num'));
  $tpagenum = mm_cutepage_content_page($strers, 'cp_note=' . $tcp_note . ';cp_mode=' . $tcp_mode . ';cp_type=' . $tcp_type . ';cp_num=' . $tcp_num);
  if ($tpagenum != 0)
  {
    $tpagelng = ii_itake('global.lng_cutepage.npage', 'lng');
    $ttpl_a_href_self = ii_itake('global.tpl_config.a_href_self', 'tpl');
    if ($tpagenum < 1) $tpagenum = 1;
    $tmpstr = '';
    for ($i = 1; $i <= $tpagenum; $i ++)
    {
      $tmpstr .= $ttpl_a_href_self;
      $tmpstr = str_replace('{$explain}', str_replace('[]', $i, $tpagelng), $tmpstr);
      $tmpstr = str_replace('{$value}', ii_iurl('cutepage', $i, $nurltype, $ct_strers), $tmpstr);
      if ($i != $tpagenum) $tmpstr .= ' ';
    }
    return $tmpstr;
  }
}
function mm_dbase_delete($table, $id, $idary, $osql = '')
{
  if (!(ii_isnull($table) || ii_isnull($id) || ii_isnull($idary)))
  {
    if (ii_cidary($idary))
    {
      global $conn;
      $tsqlstr = "delete from $table where $id in ($idary)";
      $tsqlstr .= $osql;
      return ii_conn_query($tsqlstr, $conn);
    }
  }
}
function mm_dbase_switch($table, $field, $id, $idary, $osql = '')
{
  if (!(ii_isnull($table) || ii_isnull($field) || ii_isnull($id) || ii_isnull($idary)))
  {
    if (ii_cidary($idary))
    {
      global $conn;
      $tsqlstr = "update $table set $field=abs($field-1) where $id in ($idary)";
      $tsqlstr .= $osql;
      return ii_conn_query($tsqlstr, $conn);
    }
  }
}
function mm_dbase_update($table, $field, $fieldValue, $id, $idary, $type = 0, $osql = '')
{
  if (!(ii_isnull($table) || ii_isnull($field) || ii_isnull($id) || ii_isnull($idary)))
  {
    if (ii_cidary($idary))
    {
      global $conn;
      if ($type == 0) $tsqlstr = "update $table set $field=$fieldValue where $id in ($idary)";
      else $tsqlstr = "update $table set $field='$fieldValue' where $id in ($idary)";
      $tsqlstr .= $osql;
      return ii_conn_query($tsqlstr, $conn);
    }
  }
}
function mm_echo_error()
{
  global $Err;
  $terrstr = '';
  if (is_array($Err))
  {
    foreach ($Err as $key => $val)
    {
      $terrstr .= $val . '\n';
    }
    $tmpstr = ii_itake('global.tpl_common.echo_error', 'tpl');
    $tmpstr = str_replace('{$message}', $terrstr, $tmpstr);
    return $tmpstr;
  }
}
function mm_exec_delete($table, $query)
{
  if (!ii_isnull($table))
  {
    global $conn;
    $tsqlstr = "delete from $table";
    if (!ii_isnull($query)) $tsqlstr .= $query;
    return ii_conn_query($tsqlstr, $conn);
  }
}
function mm_em_bar($strers)
{
  $tmpstr = ii_ireplace('global.tpl_common.em', 'tpl');
  $tmpstr = str_replace('{$content}', $strers, $tmpstr);
  return $tmpstr;
}
function mm_encode_content($content, $cttype, $ubbstate = 1)
{
  $tcttype = ii_get_num($cttype);
  $tubbstate = ii_get_num($ubbstate, 0);
  switch ($tcttype)
  {
    case 0:
      return ii_encode_text($content);
      break;
    case 1:
      ret
2010-03-25 21:23:40 http://www.sffdm.cn/ jtbc做的网站,越学越有味!
2 楼
new
银牌会员
积分 806
注册 2009-06-30
     
回复: 关于老PHP版本标题顺序的问题。
好长,没研究。只要把你要的效果贴出来就行了哇
2010-03-26 14:04:32