⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 content.php

📁 SSCMS网站管理系统 飞狐源码站 SSCMS可以将网站内容全部生成静态HTML文件,这样可以极大地节约主机资源
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
include DIR_INCLUDES . 'cms_function.inc.php';
class CPage extends Page {
    function CPage(&$app)
    {
        $this->Page($app);
        $this->userid = userid;
        $this->user_username = username;
        $this->Varsarray = array('data_act', 'data_module', 'data_TableID', 'data_Content_ImgAutoLocalize', 'data_SelfTemplate', 'data_SelfPublishFileName', 'data_SelfPSN', 'data_SelfPSNURL', 'data_Sort', 'data_Top');
        $this->Varsarrays = array('data_Sort', 'data_Top', 'data_SelfTemplate', 'data_SelfPublishFileName', 'data_SelfPSN', 'data_SelfPSNURL');
    } 

    function page_load()
    {
        if (empty($this->in['act'])) $this->onList();
    } 

    function onInsert()
    {
        $this->in['CateID'] == ''?$CateID = '1':$CateID = $this->in['CateID'];
		if ($this->in[_POST][act] != '')$CateID=$this->in[data_CateID];
        include DIR_CACHE . 'cache_Cate.inc.php';
        include DIR_CACHE . 'cache_contentmodel.inc.php';
        $TableID = $Cate[$CateID]['TableID'];
        $Model = $Cate[$CateID][ContentModel];
        $arguments = $content_model_info[$Model][Model];
        if ($Model == '1') {
            $arguments[] = array(FieldName => 'Content_ImgAutoLocalize',
                FieldTitle => $this->app->getSysMsg('Content_ImgAutoLocalize'),
                FieldInput => 'checkbox');
            $value[Content_ImgAutoLocalize] = '1';
        } 
        $arguments[] = array(FieldName => 'TableID',
            FieldInput => 'hidden');
        $arguments[] = array(FieldName => 'CateID',
            FieldInput => 'hidden');
        $arguments[] = array(FieldName => 'module',
            IN => '1',
            FieldInput => 'hidden');
        $arguments[] = array(FieldName => 'act',
            IN => '1',
            FieldInput => 'hidden');
        $arguments[] = array(FieldName => 'Sort',
            FieldTitle => $this->app->getSysMsg('SelfSort'),
            FieldInput => 'text');
        $arguments[] = array(FieldName => 'Top',
            FieldTitle => $this->app->getSysMsg('SelfTop'),
            FieldInput => 'text');
        $arguments[] = array(FieldName => 'SelfTemplate',
            FieldTitle => $this->app->getSysMsg('SelfTemplate'),
            FieldInputPicker => 'tpl',
            FieldInput => 'picker');
        $arguments[] = array(FieldName => 'SelfPublishFileName',
            FieldTitle => $this->app->getSysMsg('SelfPublishFileName'),
            FieldInput => 'text');
        $arguments[] = array(FieldName => 'SelfPSN',
            FieldName1 => 'SelfPSNURL',
            FieldTitle => $this->app->getSysMsg('SelfPSN'),
            FieldTitle1 => $this->app->getSysMsg('SelfPSNURL'),
            FieldInputPicker => 'psn',
            FieldInput => 'psn');
        $value[act] = 'insert';
        $value[module] = 'content';
        $value[TableID] = $TableID;
        $value[CateID] = $this->in[CateID]; 
        // print_r($this->Varsarray);
        $this->form->formname = 'content';
        if ($this->in[_POST][act] != '') {
			$CateID=$this->in[data_CateID];
            foreach($arguments as $key => $name) {
                $var = 'data_' . $name['FieldName'];
                if (is_array($this->in['_POST'][$var]) && !in_array($var, $this->Varsarray)) {
                    $Data[$name['FieldName']] = serialize($this->in['_POST'][$var]);
                } elseif (!in_array($var, $this->Varsarray)&&$name['FieldInput'] != 'RichEditor') {
                    $Data[$name['FieldName']] = addslashes($this->in['_POST'][$var]);
                }elseif($name['FieldInput'] = 'RichEditor'&& !in_array($var, $this->Varsarray)){
                $Data[$name['FieldName']] = addslashes($this->in['_POST'][$var]);
              }
                if ($this->in['_POST']['data_Content_ImgAutoLocalize']) {
                    if ($name['FieldInput'] == 'RichEditor') {
                        preg_match_all("/\ssrc=[\"]?[\']?(http:\/\/[-a-z0-9\/:._]*[\/]?[a-z0-9-_]+\.(jpg|gif|jpeg|bmp|png))[^\'\"\s]?/i", $this->in['_POST'][$var], $images);
                        //print_r($images);
                    } 
                } 
            } 
            $Data['CreationDate'] = time();
            $Data['CreationUserID'] = $_SESSION[$this->userid];
            $IndexData[ContentID] = $ContentID = $this->objDataSet->insert($Data, $this-> {
                    'content_' . $this->in['_POST']['data_TableID']} 
                );
            $IndexData[CateID] = $this->in['_POST'][data_CateID];
            $IndexData[PublishDate] = $Data['CreationDate'];
            $IndexData[Type] = '1';
            foreach($this->Varsarray as $k => $vars) {
                if (in_array($vars, $this->Varsarrays)) {
                    $varss = str_replace('data_', '', $vars);
                    $IndexData[$varss] = addslashes($this->in['_POST'][$vars]);
                } 
            } 
            $IndexData[State] = '0';
            $this->objDataSet->insert($IndexData, $this->content_index);
            $this->page_err();
            header("location:index.php?module=category&action=list&CateID=" . $CateID);
        } 
        $this->form->CreatTable($arguments, $value);
    } 

    function onList()
    {
        include_once DIR_CACHE . 'cache_Cate.inc.php';
        include_once DIR_CACHE . 'cache_contentmodel.inc.php';
        empty($this->in['_GET']['CateID'])?$CateID = '1':$CateID = intval(trim($this->in['_GET']['CateID']));
        empty($this->in['_GET']['TableID'])?$TableID = $Cate[$CateID]['TableID']:$TableID = intval(trim($this->in['_GET']['TableID']));
        $ContentModel = $Cate[$CateID]['ContentModel'];
        $Clist = '<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#999999">
    <tr valign="bottom"> 
      <td width="2%" align="center" bgcolor="#efefef"><span onclick="box_checkall(row_select_id)" style="cursor:hand">?</span></td>
      <td align="center" bgcolor="#efefef"><a href="index.php?orderfield=CateID&ordermode=asc&module=category&act=list">' . $this->getColumnStr($this->app->getSysMsg('id'), "ContentID", (!$in['ordermode'] ? "?" : "")) . '</a></td><td align="center" bgcolor="#efefef"><a href="index.php?orderfield=CateID&ordermode=asc&module=category&act=list">' . $this->getColumnStr($this->app->getSysMsg('cateid'), "CateID", (!$in['ordermode'] ? "?" : "")) . '</a></td>';
        $i = 6;
        foreach($content_model_info[$ContentModel][Model] as $model) {
            if ($model[FieldListDisplay] == '1') {
                $FieldList .= 'c.' . $model[FieldName] . ',';
                $column = $this->getColumnStr($this->app->getSysMsg($model[FieldName]), $model[FieldName], (!$in['ordermode'] ? "?" : "")) ;
                $Clist .= '<td width="10%" align="center" bgcolor="#efefef">' . $column . '<strong></strong></td>' . "\n";
                $i++;
            } 
        } 
        $Clist .= '<td width="12%" align="center" bgcolor="#efefef">' . $this->getColumnStr($this->app->getSysMsg('CreationDate'), "CreationDate", (!$in['ordermode'] ? "?" : "")) . '</td>
      <td width="10%" align="center" bgcolor="#efefef">' . $this->getColumnStr($this->app->getSysMsg('CreationUser'), "$this->user_username", (!$in['ordermode'] ? "?" : "")) . '</td>' . "\n" . '       
      <td width="10%" align="center" bgcolor="#efefef">' . $this->app->getSysMsg('action') . '</td></tr>';
        $where = ' CateID=' . $CateID;
        $orderfield = $this->in['orderfield'] ? $this->in['orderfield'] : "ContentID";
        $ordermode = $this->in['ordermode'] ? $this->in['ordermode'] : "desc";
        $loop_data = $this->objDataSet->getList("select c.ContentID,c.CateID, $FieldList c.CreationDate,u.$this->user_username from " . $this-> {
                'content_' . $TableID} 
            . " as c left join " . $this->user . " as u on c.CreationUserID=u.$this->userid where $where  order by $orderfield $ordermode", 20);
        $this->tpl->assign("total", $loop_data->total());
        $this->tpl->assign("fromto", $loop_data->fromto());
        $loop_data->navchar = array($this->app->getSysMsg('firstpage'), '[<]', '[>]', $this->app->getSysMsg('endpage'));
        $this->tpl->assign("navbar", $loop_data->navbar(10));
        if (is_array($loop_data->field)) {
            foreach($loop_data->field as $data) {
                $list .= '<tr><td align="center" bgcolor="#FFFFFF"> <input name="row_select[]" type="checkbox" id="row_select_id" value="' . $data[ContentID] . '"></td>';
                $list .= '<td align="center" bgcolor="#FFFFFF">' . $data[ContentID] . '</td>';
                $list .= '<td align="center" bgcolor="#FFFFFF">' . $Cate[$data[CateID]][Title] . '</td>';
                foreach($content_model_info[$ContentModel][Model] as $sModel) {
                    if ($sModel[FieldListDisplay] == '1') {
						if($sModel[IsTitleField]){
							$list .= '<td align="center" bgcolor="#FFFFFF"><a href="'.parseUrl($data).'" title="'.$data[$sModel[FieldName]].'">' . $data[$sModel[FieldName]] . '</a></td>';
						}else $list .= '<td align="center" bgcolor="#FFFFFF">' . $data[$sModel[FieldName]] . '</td>';
                    } 
                } 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -