织梦5.7的一些小修改

1.会员文章收藏后打不开删不了的问题

在plus\stow.php的$addtime = time();下面加上:$type=empty($type)? 'sys' : trim($type);即可。

如果已经收藏过文章,到数据库update xx_member_stow set type='sys' where isNULL(type);(xx是自己设定的前缀)

修改原因参见member\mystow.php,archives_do.php,type=''都被换成了sys,对null和‘’根本不能正常操作,所以入库前type设为sys就好了

另外在plus\stow.php的

if(!is_array($row)){
  $dsql->ExecuteNoneQuery(" INSERT INTO `#@__member_stow`(mid,aid,title,addtime,type) VALUES ('".$ml->M_ID."','$aid','$title','$addtime','$type'); ");
  }

后面加上

else{
 ShowMsg('已收藏过此文章!','javascript:window.close();');
 exit();
  }

可以在重复收藏同意文章时作出提示

2.采集文章导出栏目的显示

在系统目录(默认dede)下的inc\inc_catalog_options.php中两个方法最后加入代码,如下方红色部分,可以使选择栏目时所有栏目全部显示,不可导出的栏目背景显示为黄色(颜色可以自己改,改style='background:yellow'就可以了)

function GetOptionList($selid=0, $userCatalog=0, $channeltype=0)
{
    global $OptionArrayList, $channels, $dsql, $cfg_admin_channel, $admin_catalogs;

    $dsql->SetQuery("SELECT id,typename FROM `#@__channeltype` ");
    $dsql->Execute('dd');
    $channels = Array();
    while($row = $dsql->GetObject('dd')) $channels[$row->id] = $row->typename;

    $OptionArrayList = '';

    //当前选中的栏目
    if($selid > 0)
    {
        $row = $dsql->GetOne("SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE id='$selid'");
        if($row['ispart']==1) $OptionArrayList .= "<option value='".$row['id']."' class='option1' selected='selected'>".$row['typename']."(封面频道)</option>\r\n";
        else $OptionArrayList .= "<option value='".$row['id']."' selected='selected'>".$row['typename']."</option>\r\n";
    }

    //是否限定用户管理的栏目
    if( $cfg_admin_channel=='array' )
    { 
        if(count($admin_catalogs)==0)
        {
            $query = "SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE 1=2 ";
        }
        else
        {
            $admin_catalog = join(',', $admin_catalogs);
            $dsql->SetQuery("SELECT reid FROM `#@__arctype` WHERE id IN($admin_catalog) GROUP BY reid ");
            $dsql->Execute('qq');
            $topidstr = '';
            while($row = $dsql->GetObject('qq'))
            {
                if($row->reid==0) continue;
                $topidstr .= ($topidstr=='' ? $row->reid : ','.$row->reid);
            }
            $admin_catalog .= ','.$topidstr;
            $admin_catalogs = explode(',', $admin_catalog);
            $admin_catalogs = array_unique($admin_catalogs);
            $admin_catalog = join(',', $admin_catalogs);
            $admin_catalog = preg_replace("#,$#", '', $admin_catalog);
            $query = "SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE id IN($admin_catalog) AND reid=0 AND ispart<>2 ";
        }
    }
    else
    {
        $query = "SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE ispart<>2 AND reid=0 ORDER BY sortrank ASC ";
    }

    $dsql->SetQuery($query);
    $dsql->Execute('cc');

    while($row=$dsql->GetObject('cc'))
    {
        $sonCats = '';
        LogicGetOptionArray($row->id, '─', $channeltype, $dsql, $sonCats);
        if($sonCats != '')
        {
            if($row->ispart==1) $OptionArrayList .= "<option value='".$row->id."' class='option1'>".$row->typename."(封面频道)</option>\r\n";
            else if($row->ispart==2) $OptionArrayList .= '';
            else if( empty($channeltype) && $row->ispart != 0 ) $OptionArrayList .= "<option value='".$row->id."' class='option2'>".$row->typename."(".$channels[$row->channeltype].")</option>\r\n";
            else $OptionArrayList .= "<option value='".$row->id."' class='option3'>".$row->typename."</option>\r\n";
            $OptionArrayList .= $sonCats;
        }
        else
        {
            if($row->ispart==0 && (!empty($channeltype) && $row->channeltype == $channeltype) )
            {
                $OptionArrayList .= "<option value='".$row->id."' class='option3'>".$row->typename."</option>\r\n";
            } else if($row->ispart==0 && empty($channeltype) )
            { 
                // 专题 
                $OptionArrayList .= "<option value='".$row->id."' class='option3'>".$row->typename."</option>\r\n";
            }else if($row->ispart==0 && (!empty($channeltype)&& $row->channeltype != $channeltype) )
	    {
		$OptionArrayList .= "<option value='".$row->id."' class='option3' style='background:yellow'>".$row->typename."</option>\r\n";
	    }
        }
    }
    return $OptionArrayList;
}

function LogicGetOptionArray($id,$step,$channeltype,&$dsql, &$sonCats)
{
    global $OptionArrayList, $channels, $cfg_admin_channel, $admin_catalogs;
    $dsql->SetQuery("Select id,typename,ispart,channeltype From `#@__arctype` where reid='".$id."' And ispart<>2 order by sortrank asc");
    $dsql->Execute($id);
    while($row=$dsql->GetObject($id))
    {
        if($cfg_admin_channel != 'all' && !in_array($row->id, $admin_catalogs))
        {
            continue;
        }
        if($row->channeltype==$channeltype && $row->ispart==1)
        {
            $sonCats .= "<option value='".$row->id."' class='option1'>$step".$row->typename."</option>\r\n";
        }
        else if( ($row->channeltype==$channeltype && $row->ispart==0) || empty($channeltype) )
        {
            $sonCats .= "<option value='".$row->id."' class='option3'>$step".$row->typename."</option>\r\n";
        }else if($row->channeltype!=$channeltype && $row->ispart==0 )
        {
	    $sonCats .= "<option value='".$row->id."' class='option3' style='background:yellow'>".$row->typename."</option>\r\n";
	}
        LogicGetOptionArray($row->id,$step.'─',$channeltype,$dsql, $sonCats);
    }
}


猜你喜欢

转载自blog.csdn.net/GrassEva/article/details/78782200
今日推荐