Esempio n. 1
0
function matchPinyin($keyword)
{
    global $dsql;
    $sql = "select kindname as matchname from #@__destinations where isopen=1";
    $res = $dsql->getAll($sql);
    $str = '';
    foreach ($res as $row) {
        if (strlen($keyword) == 1) {
            $pinyin = GetPinyin($row['matchname']);
            // 获取拼音
            if (strpos($pinyin, $keyword) !== false) {
                if (substr($pinyin, 0, 1) == $keyword) {
                    $str .= $row['matchname'] . ",";
                }
            }
        } else {
            $pinyin = GetPinyin($row['matchname'], 1);
            // 获取拼音
            if (strpos($pinyin, $keyword) !== false) {
                $str .= $row['matchname'] . ",";
            }
        }
    }
    $str = substr($str, 0, strlen($str) - 1);
    return $str;
}
Esempio n. 2
0
 public static function normalize($slug, $hashtag = false)
 {
     $slug = GetPinyin($slug);
     $slug = preg_replace('@/+@', '/', $slug);
     $slug = trim($slug, '/');
     $slug = phutil_utf8_strtolower($slug);
     $ban = "\\x00-\\x19" . "#%&+=?" . " " . "\\\\" . "<>{}\\[\\]" . "'" . '"';
     // In hashtag mode (used for Project hashtags), ban additional characters
     // which cause parsing problems.
     if ($hashtag) {
         $ban .= '`~!@$^*,:;(|)';
     }
     $slug = preg_replace('([' . $ban . ']+)', '_', $slug);
     $slug = preg_replace('@_+@', '_', $slug);
     $parts = explode('/', $slug);
     // Remove leading and trailing underscores from each component, if the
     // component has not been reduced to a single underscore. For example, "a?"
     // converts to "a", but "??" converts to "_".
     foreach ($parts as $key => $part) {
         if ($part != '_') {
             $parts[$key] = trim($part, '_');
         }
     }
     $slug = implode('/', $parts);
     // Specifically rewrite these slugs. It's OK to have a slug like "a..b",
     // but not a slug which is only "..".
     // NOTE: These are explicitly not pht()'d, because they should be stable
     // across languages.
     $replace = array('.' => 'dot', '..' => 'dotdot');
     foreach ($replace as $pattern => $replacement) {
         $pattern = preg_quote($pattern, '@');
         $slug = preg_replace('@(^|/)' . $pattern . '(\\z|/)@', '\\1' . $replacement . '\\2', $slug);
     }
     return $slug . '/';
 }
 public static function normalize($slug)
 {
     $slug = GetPinyin($slug);
     $slug = preg_replace('@/+@', '/', $slug);
     $slug = trim($slug, '/');
     $slug = phutil_utf8_strtolower($slug);
     $slug = preg_replace("@[\\x00-\\x19#%&+=\\\\?<> ]+@", '_', $slug);
     $slug = preg_replace('@_+@', '_', $slug);
     // Remove leading and trailing underscores from each component, if the
     // component has not been reduced to a single underscore. For example, "a?"
     // converts to "a", but "??" converts to "_".
     $parts = explode('/', $slug);
     foreach ($parts as $key => $part) {
         if ($part != '_') {
             $parts[$key] = trim($part, '_');
         }
     }
     $slug = implode('/', $parts);
     // Specifically rewrite these slugs. It's OK to have a slug like "a..b",
     // but not a slug which is only "..".
     // NOTE: These are explicitly not pht()'d, because they should be stable
     // across languages.
     $replace = array('.' => 'dot', '..' => 'dotdot');
     foreach ($replace as $pattern => $replacement) {
         $pattern = preg_quote($pattern, '@');
         $slug = preg_replace('@(^|/)' . $pattern . '(\\z|/)@', '\\1' . $replacement . '\\2', $slug);
     }
     return $slug . '/';
 }
Esempio n. 4
0
 public function header_city()
 {
     //echo C('DB_PREFIX');//__PREFIX__
     $city1 = new \Think\Model();
     $prefix = C('DB_PREFIX');
     $sql = "select r.* from {$prefix}store_shipping_region as ssr left join {$prefix}region as r on ssr.city=r.region_id where ssr.city>0 group by ssr.city";
     $row_region = $city1->query($sql);
     foreach ($row_region as $v) {
         $zimu = GetPinyin($v['region_name'], 1);
         //var_dump($zimu);
         $zimu = strtoupper(substr($zimu, 0, 1));
         $zimu_city[$zimu][] = array('region_id' => $v['region_id'], 'region_name' => $v['region_name']);
     }
     return $zimu_city;
     //var_dump($zimu_city);
 }
Esempio n. 5
0
 public static function normalize($slug)
 {
     $slug = GetPinyin($slug);
     $slug = preg_replace('@/+@', '/', $slug);
     $slug = trim($slug, '/');
     $slug = phutil_utf8_strtolower($slug);
     $slug = preg_replace("@[\\x00-\\x19#%&+=\\\\?<> ]+@", '_', $slug);
     $slug = preg_replace('@_+@', '_', $slug);
     $slug = trim($slug, '_');
     // Specifically rewrite these slugs. It's OK to have a slug like "a..b",
     // but not a slug which is only "..".
     // NOTE: These are explicitly not pht()'d, because they should be stable
     // across languages.
     $replace = array('.' => 'dot', '..' => 'dotdot');
     foreach ($replace as $pattern => $replacement) {
         $pattern = preg_quote($pattern, '@');
         $slug = preg_replace('@(^|/)' . $pattern . '(\\z|/)@', '\\1' . $replacement . '\\2', $slug);
     }
     return $slug . '/';
 }
Esempio n. 6
0
         //将作者插入文档关键词中
         $zuozheurl = $zuozhedir . ".html";
         if ($co_autokeytype == 1 || ($co_autokeytype = 3)) {
             $row = $dsql->GetOne("SELECT `keyword` FROM `#@__keywords` WHERE `keyword`='{$zuozhe}'");
             if (!$row && strlen($zuozhe) > 2) {
                 $keyword_in_query = "insert into `#@__keywords` (`keyword`, `rank`, `sta`, `rpurl`) values('{$zuozhe}','30','1','{$zuozheurl}')";
                 $dsql->ExecuteNoneQuery($keyword_in_query);
             }
         }
     }
 }
 //如果新增的栏目隶属于作品集,插入文档关键词中
 if ($reid == '45') {
     //变更作者URL格式
     if ($zuozherule != '' && $zuozherule != "[拼音]") {
         $pydir = GetPinyin(stripslashes($title), 1);
         $typepinyin = substr($typedir, 1);
         $typedir = str_replace('[拼音首字母]', $pydir, str_replace('[ID]', $bookid, str_replace('[拼音]', $typepinyin, $zuozherule)));
         $typedir = preg_replace("#\\/{1,}#", "/", $typedir);
         //检查是否有重名的小说目录,如果有则目录拼音后自动添加数字区别
         $typedirrow = $dsql->GetOne("SELECT `typedir` FROM `#@__arctype` WHERE `typedir`='/{$typedir}'");
         if ($typedirrow) {
             for ($ti = 1; $ti < 100; $ti++) {
                 $typedirsql = "SELECT `typedir` FROM `#@__arctype` WHERE `typedir`='/" . $typedir . $ti . "'";
                 $typedirrow = $dsql->GetOne($typedirsql);
                 if (!$typedirrow) {
                     $typedir = $typedir . $ti;
                     break;
                 }
             }
         }
Esempio n. 7
0
 /**
  * 导入数据 已废弃
  */
 function import()
 {
     exit;
     $names = array('顺丰', '圆通', '中通', '申通', '汇通', '韵达', '天天', '宅急送', 'EMS');
     $model = M(CONTROLLER_NAME);
     foreach ($names as $name) {
         $data['name'] = $name;
         $data['code'] = GetPinyin($name);
         $model->add($data);
     }
     echo 'ok';
 }
Esempio n. 8
0
File: pinyin.php Progetto: u0mo5/app
<?php

//示例
echo GetPinyin("魍魉");
/**
 * 汉字转拼音
 * @param string $str 待转换的字符串
 * @param string $charset 字符串编码
 * @param bool $ishead 是否只提取首字母
 * @return string 返回结果
 */
function GetPinyin($str, $charset = "utf-8", $ishead = 0)
{
    $restr = '';
    $str = trim($str);
    if ($charset == "utf-8") {
        $str = iconv("utf-8", "gb2312", $str);
    }
    $slen = strlen($str);
    $pinyins = array();
    if ($slen < 2) {
        return $str;
    }
    $fp = fopen('pinyin.dat', 'r');
    while (!feof($fp)) {
        $line = trim(fgets($fp));
        $pinyins[$line[0] . $line[1]] = substr($line, 3, strlen($line) - 3);
    }
    fclose($fp);
    for ($i = 0; $i < $slen; $i++) {
        if (ord($str[$i]) > 0x80) {
Esempio n. 9
0
function insert_mycity($arr)
{
    global $ecs, $db, $smarty;
    $need_cache = $smarty->caching;
    $need_compile = $smarty->force_compile;
    //$sqlr="select * from ". $GLOBALS['ecs']->table('region') ." where region_type =2";
    $sql = "select r.* from " . $ecs->table('store_shipping_region') . " as ssr left join " . $ecs->table('region') . " as r on ssr.city=r.region_id where ssr.city>0 group by ssr.city";
    $res_region = $db->query($sql);
    $zimu_city = array();
    while ($row_region = $db->fetchRow($res_region)) {
        $zimu = GetPinyin($row_region['region_name'], 1);
        $zimu = strtoupper(substr($zimu, 0, 1));
        $zimu_city[$zimu][$row_region['region_id']] = array('region_id' => $row_region['region_id'], 'region_name' => $row_region['region_name'], 'level' => 2);
    }
    $smarty->assign('zimu_city', $zimu_city);
    $smarty->assign('nowcityname', $db->getOne("select region_name from " . $ecs->table("region") . " where region_id=" . $_REQUEST['city']));
    $val = $smarty->fetch('library/header_city.lbi');
    $smarty->caching = $need_cache;
    $smarty->force_compile = $need_compile;
    return $val;
}
Esempio n. 10
0
/**
 *  获得图书的URL
 *
 * @param     string  $bid  书籍ID
 * @param     string  $title  标题
 * @param     string  $gdir
 * @return    string
 */
function GetBookUrl($bid, $title, $gdir = 0)
{
    global $cfg_cmspath;
    $bookurl = $gdir == 1 ? "{$cfg_cmspath}/book/" . DedeID2Dir($bid) : "{$cfg_cmspath}/book/" . DedeID2Dir($bid) . '/' . GetPinyin($title) . '-' . $bid . '.html';
    return $bookurl;
}
Esempio n. 11
0
     foreach ($bianjiqifieldsarr as $key => $val) {
         $field = $val['field'];
         $dataother[$field] = $_POST[$field];
     }
 }
 //查询此模型编辑器的字段 end
 if ($_POST['self'] && is_array($_POST['self'])) {
     foreach ($_POST['self'] as $field => $val) {
         ${$field} = save($val);
         $dataother[$field] = ${$field};
     }
 }
 //zhaoyanmin 其他表 end
 $remote && remote($body);
 !$remote && $autopic && remote($body, true);
 empty($customlink) && ($customlink = GetPinyin($title));
 if (empty($aid)) {
     $userid = $admin->uid;
     $hits = $digg = $comments = 0;
     $filename = "";
     //$DreamCMS->db->get_var("SELECT `id` FROM `#DC@__article` where `customlink` ='$customlink'") && alert('该自定链接已经存在!请另选一个');
     //$DreamCMS->db->get_var("SELECT `id` FROM `#DC@__article` where `title` = '$title'") && alert('该标题的文章已经存在!请检查是否重复');
     $DreamCMS->db->insert('article', compact('cid', 'title', 'customlink', 'url', 'filename', 'source', 'author', 'userid', 'postype', 'keywords', 'tags', 'description', 'pic', 'pubdate', 'hits', 'digg', 'comments', 'type', 'visible'));
     $aid = $DreamCMS->db->insert_id;
     //zhaoyanmin start
     //添加其他表 start
     if ($model['table']) {
         $dataother['aid'] = $aid;
         $DreamCMS->db->insert($model['table'], $dataother);
     }
     //添加其他表 end
Esempio n. 12
0
/**
 * ECSHOP 首页文件
 * ============================================================================
 * * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.ecshop.com;
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: liubo $
 * $Id: index.php 17217 2011-01-19 06:29:08Z liubo $
*/
define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
if ((DEBUG_MODE & 2) != 2) {
    $smarty->caching = true;
}
$sql = "select r.* from " . $ecs->table('store_shipping_region') . " as ssr left join " . $ecs->table('region') . " as r on ssr.city=r.region_id where ssr.city>0 group by ssr.city";
$res_region = $db->query($sql);
$zimu_city = array();
while ($row_region = $db->fetchRow($res_region)) {
    $zimu = GetPinyin($row_region['region_name'], 1);
    $zimu = strtoupper(substr($zimu, 0, 1));
    $zimu_city[$zimu][] = array('region_id' => $row_region['region_id'], 'region_name' => $row_region['region_name']);
}
$zimu_info = array_keys($zimu_city);
sort($zimu_info);
$smarty->assign('zimu_info', $zimu_info);
ksort($zimu_city);
$smarty->assign('zimu_city', $zimu_city);
$smarty->display('city.dwt');
Esempio n. 13
0
/**
 * 调用酒店数据标签
 *
 * @version        $Id: gethotellist.lib.php netman
 * @package        Stourweb.Taglib
 * @copyright      Copyright (c) 2007 - 2011, Stourweb, Inc.
 * @link           http://www.stourweb.com
 */
function lib_gethotellist(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|8,flag|,type|top,sonid|,limit|0";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnertext());
    $revalue = '';
    $basefield = 'a.id,a.sellpoint,a.aid,a.kindlist,a.title,a.address,a.litpic,a.ishidden,a.hotelrankid,a.webid,a.hotelrankid as hotelrankids,a.shownum,a.iconlist';
    if ($type == 'top' && empty($flag)) {
        return '';
    }
    //如果调用二级栏目则必须在显示类里指定sonid
    $limit = !empty($limit) ? $limit : 0;
    //加目的地页面显示条件
    $destwhere = isset($refObj->Fields['kindid']) ? "and FIND_IN_SET({$refObj->Fields['kindid']},a.kindlist) " : '';
    //用于聚合页面
    if ($type == 'mdd') {
        $sonid = $refObj->Fields['kindid'];
        if ($GLOBALS['sys_child_webid'] != 0) {
            $dest_id = $GLOBALS['sys_child_webid'];
            //当前级目的地id.
        }
        $sonid = $sonid ? $sonid : $dest_id;
        if (!isset($sonid)) {
            return '';
        }
        if ($flag == 'hot') {
            $orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc';
        } else {
            if ($flag == 'recommend') {
                $orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc';
            } else {
                if ($flag == 'specical') {
                    $orderby = 'case when b.displayorder is null then 9999 end,b.displayorder asc';
                } else {
                    $orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc';
                }
            }
        }
        $orderby .= ",a.modtime desc,a.addtime desc";
        $where = "FIND_IN_SET({$sonid},a.kindlist)";
        $sql = "select {$basefield},b.isding,b.isjian,b.istejia from #@__hotel a left join #@__kindorderlist as b on (a.id=b.aid and b.classid='{$sonid}' and b.typeid='2') where " . $where . " and (a.ishidden='0' or a.ishidden is null){$orderby} limit {$limit},{$row}";
    } else {
        if ($type == 'rank') {
            if (isset($refObj->Fields['sonid'])) {
                $sonid = $refObj->Fields['sonid'];
                $sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on a.hotelrankid=b.aid  where a.webid=0 and a.hotelrankid={$sonid}   and a.ishidden='0' order by a.modtime desc,a.addtime desc limit {$limit},{$row}";
            } else {
                return '';
            }
        } else {
            if ($type == 'rankhot') {
                $sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on a.hotelrankid=b.aid where a.ishidden='0' order by a.shownum desc limit {$limit},{$row}";
            } else {
                if ($type == 'theme') {
                    $themeid = $refObj->Fields['themeid'];
                    if (empty($themeid)) {
                        return '';
                    }
                    $sql = "select a.*,b.hotelrank,a.price as price from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid)  where a.ishidden='0' and FIND_IN_SET({$themeid},a.themelist)  order by a.modtime desc,a.addtime desc,a.shownum desc limit {$limit},{$row}";
                } else {
                    if ($type == 'top') {
                        if ($flag == 'recommend') {
                            $sql = "select {$basefield},b.displayorder,b.isding,b.isjian,b.istejia,a.ishidden,a.price from #@__hotel a left join #@__allorderlist b on(a.id=b.aid and b.typeid=2)  where a.ishidden='0' order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc  limit {$limit},{$row}";
                        } else {
                            if ($flag == 'special') {
                                $sql = "select {$basefield},b.displayorder,b.isding,b.isjian,b.istejia as istehui,a.ishidden from #@__hotel a left join #@__allorderlist b on(a.id=b.aid and b.typeid=2)  order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
                            } else {
                                if ($flag == 'hot') {
                                    $sql = "select a.*,b.hotelrank,a.price as price from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid)  where a.ishidden='0'   group by a.title order by a.shownum desc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
                                } else {
                                    if ($flag == 'relative') {
                                        $kindlist = $refObj->Fields['kindlist'];
                                        $maxkindid = array_remove_value($kindlist);
                                        //最后一级.
                                        $maxkindid = empty($maxkindid) ? $GLOBALS['dest_id'] : $maxkindid;
                                        $maxkindid = empty($maxkindid) ? 0 : $maxkindid;
                                        $where = " FIND_IN_SET({$maxkindid},a.kindlist) ";
                                        //排序顺序:置顶+tag关联》排序+ tag关联》最新更新+tag关联
                                        $sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid)  where  a.ishidden='0'  and {$where} order by a.modtime desc,a.addtime desc limit {$limit},{$row} ";
                                    } else {
                                        return '';
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    $dsql->SetQuery($sql);
    $dsql->Execute();
    $ctp = new STTagParse();
    $ctp->SetNameSpace("field", "[", "]");
    $ctp->LoadSource($innertext);
    $GLOBALS['autoindex'] = 0;
    while ($row = $dsql->GetArray()) {
        $GLOBALS['autoindex']++;
        $urlname = GetPinyin($row['kindname']);
        $flag != "channel" ? $webroot = GetWebURLByWebid($row['webid']) : "";
        $row['url'] = GetWebURLByWebid($row['webid']) . "/hotels/show_{$row['aid']}.html";
        $row['title'] = $row['title'];
        //$row['price']=empty($row['price'])?GetHotelMinPrice($row['webid'],$row['aid']):$row['price'];
        $row['kindname'] = getHotelKindCity2($row['kindlist']);
        $row['commentnum'] = Helper_Archive::getCommentNum($row['id'], 2);
        //评论次数
        $row['sellnum'] = Helper_Archive::getSellNum($row['id'], 2) + $row['bookcount'];
        //销售数量
        $row['satisfyscore'] = Helper_Archive::getSatisfyScore($row['id'], 2);
        //满意度
        $row['listingprice'] = getHotelSellPrice2($row['id']);
        //挂牌价
        $row['price'] = Helper_Archive::getHotelMinPrice($row['id']);
        $row['sellprice'] = empty($row['price']) ? '0' : $row['price'];
        $row['price2'] = empty($row['price']) ? '电询' : '&yen;' . $row['price'] . '起';
        //样式2
        $row['price3'] = empty($row['price']) ? '电询' : '<strong>&yen;' . $row['price'] . '</strong><span>起</span>';
        $row['price4'] = empty($row['price']) ? '电询' : '<span>&yen;</span><strong>' . $row['price'] . '</strong><i>起</i>';
        //目的地页面用
        $row['price'] = empty($row['price']) ? '<span class="rmb_1">电询</span>' : "<span class='rmb_1'>&yen;</span>" . $row['price'] . "<span>起</span>";
        $litpic = getUploadFileUrl($row['litpic']);
        $row['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $row['litpic']));
        $row['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $row['litpic']));
        $row['litpic'] = $litpic;
        $row['typeurl'] = $GLOBALS['cfg_cmsurl'] . "/hotels/{$urlname}_{$row['id']}.html";
        foreach ($ctp->CTags as $tagid => $ctag) {
            if ($ctag->GetName() == 'array') {
                $ctp->Assign($tagid, $row);
            } else {
                if (!empty($row[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $row[$ctag->GetName()]);
                } else {
                    $ctp->Assign($tagid, '');
                }
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
Esempio n. 14
0
                 if (!$typedirrow) {
                     $typedir = $typedir . $ti;
                     break;
                 }
             }
         }
         $typedir = "/" . $typedir;
         $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET `typedir`='{$typedir}' WHERE id='{$iddir}' ");
     }
 }
 if ($oldzuozherule != $newzuozherule && $czuozheurl == 'Y') {
     $dsql->SetQuery("SELECT * FROM `#@__arctype` where reid=45");
     $dsql->Execute();
     while ($row = $dsql->GetArray()) {
         $pinyindir = GetPinyin(stripslashes($row['typename']));
         $pydir = GetPinyin(stripslashes($row['typename']), 1);
         $iddir = $row['id'];
         $typedir = str_replace('[拼音首字母]', $pydir, str_replace('[ID]', $iddir, str_replace('[拼音]', $pinyindir, $newzuozherule)));
         $typedir = preg_replace("#\\/{1,}#", "/", $typedir);
         //检查是否有重名的小说目录,如果有则目录拼音后自动添加数字区别
         $typedirrow = $dsql->GetOne("SELECT `typedir` FROM `#@__arctype` WHERE `typedir`='/{$typedir}'");
         if ($typedirrow) {
             for ($ti = 1; $ti < 100; $ti++) {
                 $typedirsql = "SELECT `typedir` FROM `#@__arctype` WHERE `typedir`='/" . $typedir . $ti . "'";
                 $typedirrow = $dsql->GetOne($typedirsql);
                 if (!$typedirrow) {
                     $typedir = $typedir . $ti;
                     break;
                 }
             }
         }
Esempio n. 15
0
 switch ($attrib) {
     case "list":
         $tpl['list'] ? $tpl_list = $tpl['list'] : alert("请选择栏目模板");
         $tpl['content'] ? $tpl_contents = $tpl['content'] : alert("请选择内容模板");
         break;
     case "channel":
         $tpl['channel'] ? $tpl_index = $tpl['channel'] : alert("请选择频道封面模板");
         break;
     case "page":
         $tpl['page'] ? $tpl_index = $tpl['page'] : alert("请选择栏目模板");
         empty($dir) && ($dir = GetPinyin($name));
         break;
     default:
         alert("怪事!你怎么跑这里来了!!\n你想干嘛??");
 }
 $pinyin == 1 && ($dir = GetPinyin($name));
 $attrib == 'page' && ($issend = '0');
 //zhaoyanmin 栏目目录 start
 $mulusql = empty($cid) ? '' : "  AND `id` !='{$cid}' ";
 $mulutong = $DreamCMS->db->get_var("SELECT `dir` FROM `#DC@__catalog` where `dir` ='{$dir}' " . $mulusql);
 if ($mulutong) {
     //查询上级栏目
     $precatalog = $DreamCMS->db->get_row("SELECT `dir` FROM `#DC@__catalog` where `id` ='{$rootid}'", ARRAY_A);
     $dir = $precatalog['dir'] . $dir;
 }
 //zhaoyanmin 栏目目录 end
 if (empty($cid)) {
     $topid = intval($topid);
     //zhaoyanmin
     //	$DreamCMS->db->insert('catalog', compact('rootid','order','name','password','keywords','description','dir','url','icon','tpl_index','tpl_list','tpl_contents','attrib','isexamine','ishidden','issend'));
     //$DreamCMS->db->get_var("SELECT `dir` FROM `#DC@__catalog` where `dir` ='$dir'") && alert('该栏目别名/目录已经存在!请另选一个');
Esempio n. 16
0
function get_city_list()
{
    $sql = "select r.* from " . $GLOBALS['ecs']->table('virtual_goods_district') . " as ssr left join " . $GLOBALS['ecs']->table('region') . " as r on ssr.city=r.region_id where ssr.city>0 group by ssr.city";
    $res_region = $GLOBALS['db']->query($sql);
    $zimu_city = array();
    while ($row_region = $GLOBALS['db']->fetchRow($res_region)) {
        $zimu = GetPinyin($row_region['region_name'], 1);
        $zimu = strtoupper(substr($zimu, 0, 1));
        $zimu_city[$zimu][] = array('region_id' => $row_region['region_id'], 'region_name' => $row_region['region_name']);
    }
    return $zimu_city;
}
Esempio n. 17
0
 $title = htmlspecialchars($_POST['title']);
 $cid = intval($_POST['catalog']);
 $source = htmlspecialchars($_POST['source']);
 $author = htmlspecialchars($_POST['author']);
 $description = htmlspecialchars($_POST['description']);
 $keywords = htmlspecialchars($_POST['keywords']);
 $tags = htmlspecialchars($_POST['tag']);
 $body = $_POST['content'];
 empty($title) && alert($DreamCMS->language('post:checktitlempty'));
 empty($cid) && alert($DreamCMS->language('post:checkcid'));
 empty($body) && alert($DreamCMS->language('post:checkbody'));
 isset($_POST['keywordToTag']) && ($tags = str_replace(',', ' ', $keywords));
 empty($description) && ($description = csubstr(HtmToText($body), $DreamCMS->config['descLen']));
 $_pic = uploadfile("pic", $title);
 $pic = $_pic['FilePath'];
 $customlink = GetPinyin($title);
 $visible = $_catalog[$cid]['isexamine'] == "1" ? "0" : "1";
 $postype = "-1";
 $pubdate = time();
 $userid = $type = $hits = $digg = $comments = "0";
 $filename = $url = "";
 $data = compact('cid', 'title', 'customlink', 'url', 'filename', 'source', 'author', 'userid', 'postype', 'keywords', 'tags', 'description', 'filename', 'pic', 'pubdate', 'hits', 'digg', 'comments', 'type', 'visible');
 $DreamCMS->db->get_var("SELECT `id` FROM `#DC@__article` where `title` = '{$title}'") && alert($DreamCMS->language('post:checktitle'));
 $DreamCMS->db->insert('article', $data);
 $aid = $DreamCMS->db->insert_id;
 $DreamCMS->db->insert('articledata', compact('aid', 'subtitle', 'body'));
 tag($tags);
 MakeArticleHtm($DreamCMS->db->insert_id);
 $DreamCMS->db->query("UPDATE `#DC@__catalog` SET `count` = count+1 WHERE `id` ='{$cid}' LIMIT 1 ");
 if ($_catalog[$cid]['isexamine'] == "1") {
     alert($DreamCMS->language('post:examine'), "url:{$DreamCMS->dir}");
Esempio n. 18
0
     for ($ti = 1; $ti < 100; $ti++) {
         $tsql = "SELECT `typedir` FROM `#@__arctype` WHERE `typedir`='" . $zuozhedir . $ti . "'";
         $row = $dsql->GetOne($tsql);
         if (!$row) {
             $zuozhedir = $zuozhedir . $ti;
             break;
         }
     }
 }
 $zuozhe_in_query = "insert into `#@__arctype` (`reid`, `topid`, `sortrank`, `typename`, `typedir`, `isdefault`, `defaultname`, `issend`, `channeltype`, `maxpage`, `ispart`, `corank`, `tempindex`, `templist`, `temparticle`, `namerule`, `namerule2`, `modname`, `description`, `keywords`, `seotitle`, `moresite`, `sitepath`, `siteurl`, `ishidden`, `cross`, `crossid`, `content`, `smalltypes`, `bookclick`, `typeimg`, `zuozhe`, `startdate`, `overdate`, `booksize`, `downloadurl`) values('45','45','50','{$writer}','{$zuozhedir}','-1','index.html','0','1','-1','1','0','{style}/catalog45.htm','{style}/page45.htm','{style}/article.htm','{typedir}/{Y}/{M}{D}/{aid}.html','/html{typedir}.html','default','您现在浏览的是" . $writer . "的小说作品集,如果在阅读的过冲中发现我们的转载有问题,请及时与我们联系!特别提醒的是:小说作品一般都是根据作者写作当时的思考方式虚拟出来的,其情节虚构的成份比较多,切勿模仿!','','','0','/zuopinji','','1','0','','您现在浏览的是" . $writer . "的小说作品集,如果在阅读的过冲中发现我们的转载有问题,请及时与我们联系!特别提醒的是:小说作品一般都是根据作者写作当时的思考方式虚拟出来的,其情节虚构的成份比较多,切勿模仿!','','0','/images/jipin-default.jpg','','','0','0','')";
 $dsql->ExecuteNoneQuery($zuozhe_in_query);
 $zuozheid = $dsql->GetLastID();
 //变更作者URL格式
 if ($zuozherule != '' && $zuozherule != "[拼音]") {
     $pinyindir = substr($zuozhedir, 1);
     $pydir = GetPinyin(stripslashes($writer), 1);
     $zuozhedir = str_replace('[拼音首字母]', $pydir, str_replace('[ID]', $zuozheid, str_replace('[拼音]', $pinyindir, $zuozherule)));
     $zuozhedir = preg_replace("#\\/{1,}#", "/", $zuozhedir);
     //检查是否有重名的目录,如果有就在最后自动添加数字区别
     $typedirrow = $dsql->GetOne("SELECT `typedir` FROM `#@__arctype` WHERE `typedir`='/{$zuozhedir}'");
     if ($typedirrow) {
         for ($ti = 1; $ti < 100; $ti++) {
             $typedirsql = "SELECT `typedir` FROM `#@__arctype` WHERE `typedir`='/" . $zuozhedir . $ti . "'";
             $typedirrow = $dsql->GetOne($typedirsql);
             if (!$typedirrow) {
                 $zuozhedir = $zuozhedir . $ti;
                 break;
             }
         }
     }
     $zuozhedir = "/" . $zuozhedir;
Esempio n. 19
0
 if ($ispart != 0) {
     $cross = 0;
 }
 $description = Html2Text($description, 1);
 $keywords = Html2Text($keywords, 1);
 if ($ispart != 2) {
     //栏目的参照目录
     if ($referpath == 'cmspath') {
         $nextdir = '{cmspath}';
     }
     if ($referpath == 'basepath') {
         $nextdir = '';
     }
     //用拼音命名
     if ($upinyin == 1 || $typedir == '') {
         $typedir = GetPinyin(stripslashes($typename));
     }
     $typedir = $nextdir . '/' . $typedir;
     $typedir = preg_replace("#\\/{1,}#", "/", $typedir);
 }
 //开启多站点时的设置(仅针对顶级栏目)
 if ($reid == 0 && $moresite == 1) {
     $sitepath = $typedir;
     //检测二级网址
     if ($siteurl != '') {
         $siteurl = preg_replace("#\\/\$#", "", $siteurl);
         if (!preg_match("#http:\\/\\/#i", $siteurl)) {
             ShowMsg("你绑定的二级域名无效,请用(http://host)的形式!", "-1");
             exit;
         }
         if (preg_match("#" . $cfg_basehost . "#i", $siteurl)) {
Esempio n. 20
0
 /**
  * Populate the nametoken table, which used to fetch typeahead results. When
  * a user types "linc", we want to match "Abraham Lincoln" from on-demand
  * typeahead sources. To do this, we need a separate table of name fragments.
  */
 public function updateNameTokens()
 {
     $table = self::NAMETOKEN_TABLE;
     $conn_w = $this->establishConnection('w');
     $tokens = PhabricatorTypeaheadDatasource::tokenizeString($this->getUserName() . ' ' . $this->getRealName() . ' ' . GetPinyin($this->getRealName()));
     $sql = array();
     foreach ($tokens as $token) {
         $sql[] = qsprintf($conn_w, '(%d, %s)', $this->getID(), $token);
     }
     queryfx($conn_w, 'DELETE FROM %T WHERE userID = %d', $table, $this->getID());
     if ($sql) {
         queryfx($conn_w, 'INSERT INTO %T (userID, token) VALUES %Q', $table, implode(', ', $sql));
     }
 }
Esempio n. 21
0
     exit();
   }

 if($ispart!=3) //非跳转网址处理栏目目录
 {
   //栏目的参照目录
   if($reID==0 && $moresite==1) $nextdir = '/';
   else{
     if($referpath=='cmspath') $nextdir = '{cmspath}';
     else if($referpath=='basepath') $nextdir = '';
     else $nextdir = $nextdir;
   }
   //用拼音命名
   if( $upinyin==1 || ( $typedir=='' && $sitepath=='' ) || ( $typedir=='' && $moresite==1 && $reID>0 ) )
   {
     	 $typedir = GetPinyin($typename);
   }

   $typedir = $nextdir."/".$typedir;

   $typedir = ereg_replace("/{1,}","/",$typedir);

   if($referpath=='basepath' && $siteurl!='') $typedir = '';

   //检测二级网址
   if($siteurl!="")
   {
      $siteurl = ereg_replace("/$","",$siteurl);
      if(!eregi("http://",$siteurl)){
      	$dsql->Close();
   	    ShowMsg("你绑定的二级域名无效,请用(http://域名)的形式!","-1");
Esempio n. 22
0
     $brands[$temp_key]['brand_id_68ecshop'] = $val['brand_id'];
     $brands[$temp_key]['brand_logo'] = $val['brand_logo'];
     if ($val['brand_logo']) {
         $brand_have_logo = 1;
     }
     /* 判断品牌是否被选中 */
     if ($brand == $brands[$key]['brand_id']) {
         $brands[$temp_key]['selected'] = 1;
     } else {
         $brands[$temp_key]['selected'] = 0;
     }
 }
 $condition = array();
 $brand_zimu = array();
 foreach ($brands as $bkey => $bval) {
     $brands[$bkey]['pinyin'] = GetPinyin($bval['brand_name']);
     $brands[$bkey]['shouzimu'] = substr($brands[$bkey]['pinyin'], 0, 1);
     if (preg_match("/[a-zA-Z]/i", $brands[$bkey]['shouzimu'])) {
         $brands[$bkey]['shouzimu'] = strtoupper($brands[$bkey]['shouzimu']);
         $brand_zimu[$brands[$bkey]['shouzimu']] = $brands[$bkey]['shouzimu'];
     } else {
         $brand_zimu['其他'] = '其它';
         $brands[$bkey]['shouzimu'] = '其它';
     }
 }
 ksort($brand_zimu);
 if ($brand) {
     $condition[] = array('cond_type' => "品牌", 'cond_name' => $brand_name, 'cond_url' => build_uri('category', array('cid' => $cat_id, 'bid' => 0, 'price_min' => $price_min, 'price_max' => $price_max, 'filter_attr' => $filter_attr_str, 'filter' => $filter), $cat['cat_name']));
 }
 if ($price_min || $price_max) {
     $condition[] = array('cond_type' => '价格', 'cond_name' => $price_min . "-" . $price_max, 'cond_url' => build_uri('category', array('cid' => $cat_id, 'bid' => $brand, 'price_min' => 0, 'price_max' => 0, 'filter_attr' => $filter_attr_str, 'filter' => $filter), $cat['cat_name']));
<?php 
require_once(dirname(__FILE__)."/config.php");
CheckPurview('c_New');
if(empty($isdel1)) $isdel1 = 0;
if(empty($isdel2)) $isdel2 = 0;
//检查输入
//----------------------------
if(ereg("[^0-9-]",$ID)||$ID==""){
	ShowMsg("<font color=red>'频道ID'</font>必须为数字!","-1");
	exit();
}
if(eregi("[^a-z0-9_-]",$nid)||$nid==""){
	$nid = GetPinyin($typename);
}
if($addtable==""){
	ShowMsg("附加表不能为空!","-1");
	exit();
}
$dsql = new DedeSql(false);
$trueTable1 = str_replace("#@__",$cfg_dbprefix,$maintable);
$trueTable2 = str_replace("#@__",$cfg_dbprefix,$addtable);
//检查ID是否重复
//--------------------------
$row = $dsql->GetOne("Select * from #@__channeltype where ID='$ID' Or nid like '$nid' Or typename like '$typename' ");
if(is_array($row)){
	$dsql->Close();
	ShowMsg("可能‘频道ID’、‘频道名称/标识’在数据库已存在,不能重复使用!","-1");
	exit();
}
$mysql_version = $dsql->GetVersion();
$mysql_versions = explode(".",trim($mysql_version));