コード例 #1
0
ファイル: sitemap.php プロジェクト: norain2050/hkgbf
 function ror_f()
 {
     //设置语言包
     $this->cate_m->set_langid($_SESSION["sys_lang_id"]);
     $this->cate_m->get_catelist(0, "c.if_hidden='0' AND (m.if_list='1' OR m.if_msg='1') ");
     $catelist = $this->cate_m->catelist;
     $cate_count = count($catelist);
     $rslist = array();
     if ($this->sys_config['site_type'] != "html") {
         $myurl_pre = $this->sys_config["siteurl"];
     } else {
         $myurl_pre = $this->sys_config["sitehtml"] ? $this->sys_config["sitehtml"] : $this->sys_config["siteurl"] . "html/" . $_SESSION["sys_lang_id"] . "/";
     }
     if ($catelist && is_array($catelist) && $cate_count > 0) {
         foreach ($catelist as $key => $value) {
             $myurl = list_url($value);
             $chke_url = strtolower(substr($myurl, 0, 7));
             if ($chke_url != "http://" && $chke_url != "https:/") {
                 $myurl = $myurl_pre . $myurl;
             }
             $rslist[] = array("title" => $value["cate_name"], "note" => $value["note"], "keywords" => $value["keywords"], "url" => $myurl, "datetime" => $this->system_time, "updatePeriod" => "weekly", "sortOrder" => "0");
         }
     }
     $max = 49999 - $cate_count;
     //取得主题列表
     $this->list_m->langid($_SESSION["sys_lang_id"]);
     $sublist = $this->list_m->getlist_for_sitemap($max);
     if ($sublist && is_array($sublist) && count($sublist) > 0) {
         foreach ($sublist as $key => $value) {
             $myurl = msg_url($value);
             $chke_url = strtolower(substr($myurl, 0, 7));
             if ($chke_url != "http://" && $chke_url != "https:/") {
                 $myurl = $myurl_pre . $myurl;
             }
             $rslist[] = array("title" => $value["title"], "note" => $value["note"], "keywords" => $value["keywords"], "url" => $myurl, "datetime" => $value["post_date"], "updatePeriod" => "weekly", "sortOrder" => "0");
         }
     }
     $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     $xml .= '<rss version="2.0" xmlns:ror="http://rorweb.com/0.1/" >' . "\n";
     $xml .= '<channel>' . "\n";
     $xml .= "  <title>" . $this->sys_config["sitename"] . "</title>\n";
     $xml .= "  <link>" . $this->sys_config["siteurl"] . "</link>\n";
     $xml .= "  <description>" . $this->sys_config["seotitle"] . "</description>\n";
     $xml .= "  <item>\n";
     $xml .= "\t<title>" . $this->sys_config["siteurl"] . "</title>\n";
     $xml .= "\t<link>" . $this->sys_config["siteurl"] . "</link>\n";
     $xml .= "\t<ror:about>sitemap</ror:about>\n";
     $xml .= "\t<ror:type>SiteMap</ror:type>\n";
     $xml .= "  </item>\n\n";
     foreach ($rslist as $key => $value) {
         $xml .= "<item>\n";
         $xml .= "\t <link>" . $value["url"] . "</link>\n";
         $xml .= "\t <title>" . $value["title"] . "</title>\n";
         $xml .= "\t <pubDate>" . date('Y-m-d H:i:s', $value['datetime']) . "</pubDate>\n";
         $xml .= "\t <description><![CDATA[";
         if ($value["note"]) {
             $xml .= sys_cutstring($value["note"], 500) . "...";
             if ($value["keywords"]) {
                 $xml .= "<br/><br/>关键词: " . $value["keywords"] . "<br/>";
             }
         }
         $xml .= "]]></description>\n";
         $xml .= "\t <ror:updatePeriod>" . $value["updatePeriod"] . "</ror:updatePeriod>\n";
         $xml .= "\t <ror:sortOrder>" . $value["sortOrder"] . "</ror:sortOrder>\n";
         $xml .= "\t <ror:resourceOf>sitemap</ror:resourceOf>\n";
         $xml .= "</item>\n";
     }
     $xml .= "</channel>\n";
     $xml .= "</rss>";
     exit($xml);
 }
コード例 #2
0
ファイル: collection.php プロジェクト: ahmatjan/yida
 function post_f()
 {
     $id = $this->trans_lib->safe("id");
     $tid = $this->trans_lib->safe("tid");
     if (!$id && !$tid) {
         error("没有指定要发布有采集项目!", $this->url("collection"));
     }
     $id = sys_id_string($id, ",", "intval");
     //返回上一级
     $goback = $tid ? $this->url("collection,list", "id=" . $id) : $this->url("collection");
     if (!$tid) {
         $rs = $this->collection_m->get_id_nostatus($id);
         if (!$rs) {
             error("信息已发布完成,或没有可以发布的信息!", $goback);
         }
         $nexturl = $this->url("collection,post", "id=" . rawurlencode($id));
     } else {
         $startid = $this->trans_lib->int("startid");
         $newlist = sys_id_list($tid, "intval", ",");
         if (!$newlist[$startid]) {
             error("信息已发布完成,或没有可以发布的信息!", $goback);
         }
         $rs = $this->collection_m->get_one_list($newlist[$startid]);
         $nexturl = $this->url("collection,post", "id=" . rawurlencode($id) . "&tid=" . rawurlencode($tid) . "&startid=" . ($startid + 1));
     }
     if (!$rs["status"] || $rs["status"] == 2) {
         if (!$rs["status"]) {
             error("主题:<span class='red'>" . $rs["title"] . "</span> 尚未采集……", $nexturl);
         } else {
             error("主题:<span class='darkblue'>" . $rs["title"] . "</span> 已经发布过,不允许再发布!", $nexturl);
         }
     }
     //取得标签列表
     $tags_tmp_list = $this->collection_m->get_all_tags($rs["cid"]);
     $tagslist = array();
     foreach ($tags_tmp_list as $key => $value) {
         $tagslist[$value["identifier"]] = $value;
     }
     unset($tags_tmp_list);
     $msglist = $this->collection_m->get_content_list($rs["id"]);
     if (!$msglist["title"]) {
         $msglist["title"] = $rs["title"];
     }
     $format_idlist = $this->collection_m->get_sub_idlist();
     $tagslist = $this->collection_m->get_all_tags($rs["cid"]);
     $array_sys = $array_biz = $array_ext = $array_c = array();
     $cm_rs = $this->collection_m->get_one_cate_module($rs["cid"]);
     $array_sys["module_id"] = $cm_rs["module_id"];
     $array_sys["cate_id"] = $cm_rs["cateid"];
     $this->load_model("list");
     foreach ($tagslist as $k => $v) {
         if ($v["tags_type"] == "string") {
             $msglist[$v["identifier"]] = $v["rules"];
             $msglist[$v["identifier"]] = str_replace("{session.admin_name}", $_SESSION["admin_name"], $msglist[$v["identifier"]]);
             $msglist[$v["identifier"]] = str_replace("{ip}", sys_ip(), $msglist[$v["identifier"]]);
             $msglist[$v["identifier"]] = str_replace("{post_date}", $this->system_time, $msglist[$v["identifier"]]);
         } else {
             //判断目标存储格式
             $pformat = $v["post_save"];
             if ($pformat == "safe") {
                 $msglist[$v["identifier"]] = $this->trans_lib->st_safe($msglist[$v["identifier"]]);
             } elseif ($pformat == "int") {
                 $msglist[$v["identifier"]] = intval($msglist[$v["identifier"]]);
             } elseif ($pformat == "float") {
                 $msglist[$v["identifier"]] = floatval($msglist[$v["identifier"]]);
             } elseif ($pformat == "datetime") {
                 $msglist[$v["identifier"]] = strtotime($msglist[$v["identifier"]]);
             } elseif ($pformat == "img") {
                 $subject_id = $format_idlist[$v["identifier"]];
                 $srclist = $this->collection_m->get_all_files_id($subject_id);
                 if ($srclist) {
                     $return_array = $this->get_img_array($msglist[$v["identifier"]], $v["identifier"], $srclist);
                     if ($return_array) {
                         $msglist[$v["identifier"]] = $return_array[$v["identifier"]];
                         $array_sys["thumb_id"] = $return_array["thumb_id"];
                         //补充缩略图
                     } else {
                         $msglist[$v["identifier"]] = "";
                     }
                 } else {
                     $msglist[$v["identifier"]] = "";
                 }
             } elseif ($pformat == "html") {
                 $subject_id = $format_idlist[$v["identifier"]];
                 $srclist = $this->collection_m->get_all_files_id($subject_id);
                 if ($srclist) {
                     $return_array = $this->format_html($msglist[$v["identifier"]], $v["identifier"], $srclist);
                     if ($return_array && is_array($return_array)) {
                         if (!$array_sys["thumb_id"] && $return_array["thumb_id"]) {
                             $array_sys["thumb_id"] = $return_array["thumb_id"];
                             //补充缩略图
                         }
                         $msglist[$v["identifier"]] = $return_array[$v["identifier"]];
                     } else {
                         $msglist[$v["identifier"]] = $return_array;
                     }
                 }
             }
         }
         if ($v["ifsystem"] == "list") {
             $array_sys[$v["identifier"]] = sys_cutstring($msglist[$v["identifier"]], 240);
         } elseif ($v["ifsystem"] == "ext") {
             $array_ext[$v["identifier"]] = sys_cutstring($msglist[$v["identifier"]], 240);
         } else {
             $array_c[$v["identifier"]] = $msglist[$v["identifier"]];
         }
     }
     //exit;
     //存储核心数据
     $insert_id = $this->list_m->save_sys($array_sys);
     //存储数据
     if (!$insert_id) {
         error("异常:<span class='red'>" . $rs["title"] . "</span>", $nexturl);
     }
     //存储分类
     $ext_catelist = sys_id_list($cm_rs["cateid"], "intval");
     $this->list_m->save_catelist($insert_id, $ext_catelist);
     //存储扩展数据
     foreach ($array_ext as $k => $v) {
         $tmp_array = array();
         $tmp_array["id"] = $insert_id;
         $tmp_array["field"] = $k;
         $tmp_array["val"] = $v;
         $this->list_m->save_ext($tmp_array, "ext");
     }
     foreach ($array_c as $k => $v) {
         $tmp_array = array();
         $tmp_array["id"] = $insert_id;
         $tmp_array["field"] = $k;
         $tmp_array["val"] = $v;
         //存储图片
         $this->list_m->save_ext($tmp_array, "c");
     }
     //更新主题状态
     $update_array = array();
     $update_array["status"] = 2;
     $this->collection_m->save_list($update_array, $rs["id"]);
     error("入库:<span class='red'>" . $rs["title"] . "</span> 完成!", $nexturl);
 }
コード例 #3
0
ファイル: 1index.php プロジェクト: norain2050/hkgbf
" href="<?php 
    echo msg_url($value);
    ?>
" target="_blank"><img src="<?php 
    echo $value[picture];
    ?>
"></a>
      <div class="news_main">
         <div class="ititle"><A title="<?php 
    echo $value[title];
    ?>
" href="<?php 
    echo msg_url($value);
    ?>
" target="_blank"><?php 
    echo sys_cutstring($value[title], 39, '..');
    ?>
</A></div>
         <div class="news_txt">
           <?php 
    echo $value[note];
    ?>
         </div>
         <div class="i_more"><A title="<?php 
    echo $value[title];
    ?>
" href="<?php 
    echo msg_url($value);
    ?>
" target="_blank" style="color:#376db7">了解更多>></a></div>
      </div>