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

📄 append.php

📁 下在管理系统2.0
💻 PHP
字号:
<?
class CModule extends CUserApp
{
  function execute()
  {
    $this->checkLogin();
    switch($this->input[action])
	{
	  case "showMove":
	    $this->showMove();
		break;
	  case "doMove":
	    $this->doMove();
		break;
	  case "syncCount":
	    $this->syncCount();
		break;
	  case "showOptions":
	    $this->showOptions();
		break;
 	  case "postOptions":
	    $this->postOptions();
		break;
	  case "showBatch":
	    $this->showBatch();
		break;
	 case "postBatch":
	   $this->postBatch();
	   break;
	  default:
	    break;
	}
  }

  function showBatch()
  {
    $header = $this->Header("批量修改");
    $banner = $this->printBanner($this->input[categoryid], $this->input[classid], "admin.php?modules=main");
	$adminMenu = $this->getAdminMenu();
    eval("\$this->output(\"".$this->getTemplate("adminBatch")."\");");    
  }

  function postBatch()
  {
     if($this->input[sourUrl] == "" || $this->input[destUrl] == "") $this->showMsg("对不起,原连接或目标连接都不可为空!");
	 $aSoft = new CSoft;
	 $aSoft->open();
	 $flag = $aSoft->moveFirst();
	 while($flag)
	 {
	   $aSoft->down1 = str_replace  ($this->input[sourUrl], $this->input[destUrl], $aSoft->down1);
	   $aSoft->down2 = str_replace  ($this->input[sourUrl], $this->input[destUrl], $aSoft->down2);
	   $aSoft->down3 = str_replace  ($this->input[sourUrl], $this->input[destUrl], $aSoft->down3);
	   $aSoft->down4 = str_replace  ($this->input[sourUrl], $this->input[destUrl], $aSoft->down4);
	   $aSoft->down5 = str_replace  ($this->input[sourUrl], $this->input[destUrl], $aSoft->down5);
	   $aSoft->update();
	   $flag = $aSoft->moveNext();
	 }
	 $aSoft->close();
	 $this->showMsg("恭喜,系统已按要求进行了全部替换!", "admin.php");
  }

  function getOptionTpl()
  {
    $dh=opendir($this->set[tplRoot]);
    while ($tpldir=readdir($dh)) 
	{
         if (($tpldir != ".") && ($tpldir != "..") && ($tpldir != "")) 
		   if($tpldir == $this->set[tplMode]) $result .= "<option value={$tpldir} selected>$tpldir</option>\n";
		   else $result .= "<option value={$tpldir}>$tpldir</option>\n";
    }
    closedir($dh);
	return $result;
 }

  function showOptions()
  {
    $header = $this->Header("参数设置");
    $banner = $this->printBanner($this->input[categoryid], $this->input[classid], "admin.php?modules=main");
	$adminMenu = $this->getAdminMenu();
	$optionTpl = $this->getOptionTpl();
    eval("\$this->output(\"".$this->getTemplate("adminOptions")."\");");
  }

  function showMove()
  {
    $header = $this->Header("批量转移");
    $banner = $this->printBanner($this->input[categoryid], $this->input[classid], "admin.php?modules=main");
	$adminMenu = $this->getAdminMenu();
	$optionSourClass = $this->getOptionClass();
	$optionDestClass = $optionSourClass;
    eval("\$this->output(\"".$this->getTemplate("adminMove")."\");");
  }

  function doMove()
  {
    if($this->input[sourClass] == "" || $this->input[destClass] == "") $this->showMsg("对不起,您未选择原属分类或目标分类!", "");
	if($this->input[sourClass] == $this->input[destClass]) $this->showMsg("对不起,您选择的原属分类与目标分类相同,无法转移!", "");

	$aSoft = new CSoft;
    $aSoft->open();
    $aClass = new CClass;
    $aClass->open();
	$aCategory = new CCategory;
	$aCategory->open();
    $flag = $aSoft->moveFirst();
	$count = 0;
    while($flag)
    {
	  if(!$aClass->find($this->input[destClass])) $this->showMsg("对不起,目标小类ID非法,系统将无法更新数量!", "");
      if($aSoft->class_id == $this->input[sourClass])
      {
        $aSoft->class_id = $this->input[destClass];
		$aSoft->category_id = $aClass->class_category_id;
	    $aSoft->update();
		$count ++;
      }
      $flag = $aSoft->moveNext();
    }
   $aSoft->close();
   //修改分类软件数量
   if($count > 0) 
   {
     if(!$aClass->find($this->input[sourClass])) $this->showMsg("对不起,源属小类ID非法,系统将无法更新数量!", "");
     $aClass->class_total = $aClass->class_total - $count;
     $aClass->update();
	 if(!$aCategory->find($aClass->class_category_id)) $this->showMsg("对不起,源属大类ID非法,系统将无法更新数量!", "");
	 $aCategory->category_total = $aCategory->category_total - $count;
	 $aCategory->update();

     if(!$aClass->find($this->input[destClass])) $this->showMsg("对不起,目标小类ID非法,系统将无法更新数量!", "");
     $aClass->class_total = $aClass->class_total + $count;
     $aClass->update();
	 if(!$aCategory->find($aClass->class_category_id)) $this->showMsg("对不起,源属大类ID非法,系统将无法更新数量!", "");
	 $aCategory->category_total = $aCategory->category_total + $count;
	 $aCategory->update();
    }
    $aClass->close();
	$aCategory->close();
	$this->showMsg("恭喜,您已功能的进行了批量转移!", "admin.php?modules=append&action=showMove");
  }

  function syncCount()
  {
    $aSoft = new CSoft;
	$aSoft->open();
	//同步大类数量
	$aCategory = new CCategory;
	$aCategory->open();
	$flag1 = $aCategory->moveFirst();
	while($flag1)
	{
	  $flag2 = $aSoft->moveFirst();
      $count = 0;
	  while($flag2)
	  {
	    if($aSoft->category_id == $aCategory->getAbsolutePosition()) $count++;
		$flag2 = $aSoft->moveNext();
	  }
	  $aCategory->category_total = $count;
	  $aCategory->update();
	  $flag1 = $aCategory->moveNext();
	}
	//同步小类数量
	$aClass = new CClass;
	$aClass->open();
	$flag1 = $aClass->moveFirst();
	while($flag1)
	{
	  $flag2 = $aSoft->moveFirst();
      $count = 0;
	  while($flag2)
	  {
	    if($aSoft->class_id == $aClass->getAbsolutePosition()) $count++;
		$flag2 = $aSoft->moveNext();
	  }
	  $aClass->class_total = $count;
	  $aClass->update();
	  $flag1 = $aClass->moveNext();
	}
	$aClass->close();
	$aCategory->close();
	$aSoft->close();
	$this->showMsg("恭喜,您的数量同步已成功完成!", "admin.php");
  }

  function postOptions()
  {
         $file_content = "<?php
		//一般属性
		\$set[sysTitle] = \"{$this->input[sysTitle]}\";  //系统应用名
		\$set[sysPath] = \"{$this->input[sysPath]}\";  //安装目录
		\$set[mgrEmail] = \"{$this->input[mgrEmail]}\"; //管理员信箱
		\$set[Announcement] = \"{$this->input[Announcement]}\";//最新通告

		//数据文件路径
		\$set[dataPath] = \"{$this->input[dataPath]}\"; //数据存储路径,已加密,请勿外泄, 一定一定!!

		//模板文件路径
		\$set[tplMode] = \"{$this->input[tplMode]}\";  //模版路径
		\$set[tplRoot] = \"{$this->input[tplRoot]}\";  //模版文件夹

		//网站属性
		\$set[webPath] = \"{$this->input[webPath]}\";  //您网站的URL
		\$set[webName] = \"{$this->input[webName]}\"; //网站名称

		//显示属性
		\$set[listnumNew] = \"{$this->input[listnumNew]}\";  //最新显示数量
		\$set[listnumDownTop] = \"{$this->input[listnumDownTop]}\";  //排显示数量
		\$set[listnumComment] = \"{$this->input[listnumComment]}\";  //最新推荐显示数量
		\$set[listnumBriefChar] = \"{$this->input[listnumBriefChar]}\";  //列表中显示软件介绍的字符长度
		\$set[listnumClassObject] = \"{$this->input[listnumClassObject]}\"; //显示大类时第个小类显示最新文章数
		\$set[listnumNameLen] =  \"{$this->input[listnumNameLen]}\"; //最新、排行等显示字符长度

		//分页显示属性
		\$set[listnumPage] = \"{$this->input[listnumPage]}\"; //每页显示的主题数量 
		\$set[listnumSegment] = \"{$this->input[listnumSegment]}\"; //主题分页显示每段显示页数
		\$set[listnumUser] = \"{$this->input[listnumUser]}\";  //列表中每页显示用户的数量
		\$set[pagenumReview] = \"{$this->input[pagenumReview]}\";  //评论每页显示数量

		//其它属性
		\$set[dateformat] = \"{$this->input[dateformat]}\"; //日期格式
?".">";
    $fp=fopen("./include/config.inc.php","w");
    fwrite($fp, $file_content);
    fclose($fp);
	$this->showMsg("恭喜,您的设置已保存成功!", "admin.php");
  }

}//end class

?>

⌨️ 快捷键说明

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