Location: PHPKode > projects > Community Learning Network > cln/modules/phpDigSearch/admin/update_frame.php
<?php
/*
----------------------------------------------------------------------------------
PhpDig Version 1.8.x - See the config file for the full version number.
This program is provided WITHOUT warranty under the GNU/GPL license.
See the LICENSE file for more information about the GNU/GPL license.
Contributors are listed in the CREDITS and CHANGELOG files in this package.
Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
Developer from PhpDig v.1.6.3 to and including current version: Charter
Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
Contributors hold Copyright (C) to their code submissions.
Do NOT edit or remove this copyright or licence information upon redistribution.
If you modify code and redistribute, you may ADD your copyright to this notice.
----------------------------------------------------------------------------------
*/

$relative_script_path = '..';
$no_connect = 0;
include "$relative_script_path/includes/config.php";
include "$relative_script_path/libs/auth.php";
include "$relative_script_path/admin/robot_functions.php";

// extract vars
extract( phpdigHttpVars(
     array('delete'=>'string',
           'site_id'=>'integer',
           'site_ids'=>'array'
           )
     ),EXTR_SKIP);

if ($delete) {
    $message = '';
    foreach($site_ids as $site_id) {
      $verify = phpdigMySelect($id_connect,'SELECT locked FROM '.PHPDIG_DB_PREFIX.'sites WHERE site_id='.(int)$site_id);
      if (is_array($verify) && !$verify[0]['locked']) {
        // locks site (prevents any operation before erase)
        $query = "UPDATE ".PHPDIG_DB_PREFIX."sites SET locked=1 WHERE site_id=$site_id";
        $result_id = mysql_query($query,$id_connect);

        $query = "SELECT spider_id FROM ".PHPDIG_DB_PREFIX."spider WHERE site_id=$site_id";
        $result_id = mysql_query($query,$id_connect);

        if (mysql_num_rows($result_id) > 0)
            {
            $in = "IN (0";
            $ftp_id = phpdigFtpConnect();
            while (list($spider_id) = mysql_fetch_row($result_id))
                   {
                   phpdigDelText($relative_script_path,$spider_id,$ftp_id);
                   $in .= ",$spider_id";
                   }
            phpdigFtpClose($ftp_id);
            $in .= ")";
            $query = "DELETE FROM ".PHPDIG_DB_PREFIX."engine WHERE spider_id $in";
            $result_id = mysql_query($query,$id_connect);
            }
        $query = "DELETE FROM ".PHPDIG_DB_PREFIX."spider WHERE site_id=$site_id";
        $result_id = mysql_query($query,$id_connect);

        $query = "DELETE FROM ".PHPDIG_DB_PREFIX."tempspider WHERE site_id=$site_id";
        $result_id = mysql_query($query,$id_connect);

        $query = "DELETE FROM ".PHPDIG_DB_PREFIX."excludes WHERE ex_site_id=$site_id";
        $result_id = mysql_query($query,$id_connect);

        $query = "DELETE FROM ".PHPDIG_DB_PREFIX."sites WHERE site_id=$site_id";
        $result_id = mysql_query($query,$id_connect);

        $query = "DELETE FROM ".PHPDIG_DB_PREFIX."site_page WHERE site_id=$site_id";
        $result_id = mysql_query($query,$id_connect);
      }
      else if (is_array($verify) && $verify[0]['locked'] == 1) {
        $message = '?message=onelock';
      }
      else {
        $query = "DELETE FROM ".PHPDIG_DB_PREFIX."tempspider";
        $result_id = mysql_query($query,$id_connect);
        // $message = '?message=no_site';
      }
    }
    header ("location:index.php".$message);
    exit();
}
else if (isset($site_ids[0]) && (int)$site_ids[0]) {
      $site_id = $site_ids[0];
}

if (!(int)$site_id) {
   header ("location:index.php");
   exit();
}

print '<?xml version="1.0" encoding="'.PHPDIG_ENCODING.'"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php include $relative_script_path.'/libs/htmlmetas.php' ?>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<frameset cols="50%,50%">
<frame src="update.php?site_id=<?php print $site_id ?>" name="tree" frameborder="0" noresize="noresize" />
<frame src="files.php" frameborder="0" name="files" />
<noframes><body></body></noframes>
</frameset>
</html>
Return current item: Community Learning Network