OSI-Certified logo

Source code of file delete.php
from the Content Management module for Phprojekt.

<?php
// Content Management System module for PHProjekt (CMS4P).
// Copyright 2002-2005 by Mario A. Valdez-Ramirez
// http://www.mariovaldez.net/

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, 
// Boston, MA 02111-1307, USA.

// You can contact Mario A. Valdez-Ramirez by email 
// at mario@mariovaldez.org or paper mail at 
// Olmos 809, San Nicolas, NL. 66495, Mexico.

//session_start();
$path_pre="../";
include_once (
$path_pre "cm/cm_anon.inc.php");
$include_path $path_pre "lib/lib.inc.php";
include_once 
$include_path;
include_once (
$path_pre "cm/cm_lib.inc.php");
fcm_load_secdb ($cm_security);
echo 
$cm_html_header;



if (
$cm_path) {
  
$result1 db_query("select cmdb_title, cmdb_directory, cmdb_content, cmdb_type from " CM_DB_PREFIX "content3 where cmdb_directory like '$cm_path' and cmdb_type like '%" CM_HITTYPE_PAGE "%'") or db_die();
  
$row1 db_fetch_row($result1);
  if ((
$cm_path <> "/") && ($row1[1] <> "")) {
    if (
fcm_check_constraints (CM_SEC_DELETE$user_kurz$cm_path)) {
      if (
$confirmdel) {
        if (@
rmdir ($cm_mainroot $cm_path)) {
          
$cm_pppos strrpos ($cm_path"/");
          if (
$cm_pppos == 0) {
            
$cm_parentpath "/";
          }
          else {
            
$cm_parentpath substr ($cm_path0$cm_pppos);
          }
          
$result2 db_query("delete from " CM_DB_PREFIX "content3 where cmdb_directory like '$cm_path'") or db_die();
          
fcm_delete_hitrecord ($cm_pathCM_HITTYPE_PAGE);
          
fcm_delete_rating ($cm_pathCM_HITTYPE_PAGE);
          
fcm_delete_usercomments ($cm_pathCM_HITTYPE_PAGE);
          
fcm_title_nav2 ($cm_parentpathfalsefalsefalsefalsefalsefalsefalse);
          
fcm_message ("{$cm_text["deleteddocin"]} $cm_path."CM_MSGSTYLE_INFORMATION);
          
fcm_add_logentry (""$user_kurzCM_APPLOG_DEL_PAGE"Dir deleted $cm_path.");
        }
        else {
          
$cm_validops fcm_check_validops ($user_kurz$cm_path);
          
fcm_title_nav2 ($cm_path$cm_validops[CM_SEC_CREATE], $cm_validops[CM_SEC_DELETE], $cm_validops[CM_SEC_CHANGE], $cm_validops[CM_SEC_DISPLA], ($cm_validops[CM_SEC_COMMEN] && fcm_can_becommented ($cm_path)), falsefcm_user_is_superuser($user_kurz), ($cm_validops[CM_SEC_COMMEN] && fcm_can_berated ($cm_path)));
          
fcm_message ("{$cm_text["errordeletingdir"]} {$cm_text["checkemptydir"]}"CM_MSGSTYLE_ERROR);
          
fcm_add_logentry (""$user_kurzCM_APPLOG_ERROR"Error when deleting page. Dir is not empty.");
        }
      }
      elseif (
$canceldel) {
          
$cm_validops fcm_check_validops ($user_kurz$cm_path);
          
fcm_title_nav2 ($cm_path$cm_validops[CM_SEC_CREATE], $cm_validops[CM_SEC_DELETE], $cm_validops[CM_SEC_CHANGE], $cm_validops[CM_SEC_DISPLA], ($cm_validops[CM_SEC_COMMEN] && fcm_can_becommented ($cm_path)), falsefcm_user_is_superuser($user_kurz), ($cm_validops[CM_SEC_COMMEN] && fcm_can_berated ($cm_path)));
          
fcm_message ("{$cm_text["canceleddeletionof"]} $cm_path."CM_MSGSTYLE_INFORMATION);
          }
          else {
            
$cm_validops fcm_check_validops ($user_kurz$cm_path);
            
fcm_title_nav2 ($cm_path$cm_validops[CM_SEC_CREATE], $cm_validops[CM_SEC_DELETE], $cm_validops[CM_SEC_CHANGE], $cm_validops[CM_SEC_DISPLA], ($cm_validops[CM_SEC_COMMEN] && fcm_can_becommented ($cm_path)), falsefcm_user_is_superuser($user_kurz), ($cm_validops[CM_SEC_COMMEN] && fcm_can_berated ($cm_path)));
            
fcm_message ("{$cm_text["confirmdeletionof"]} $cm_path."CM_MSGSTYLE_QUESTION);
            echo 
"
            <table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\"><tr><td class=\"delete1body\">\n
            <form class=\"cms\" action=\"delete.php\" method=\"post\">\n
            <input type=\"hidden\" name=\"cm_path\" value=\"
$cm_path\">\n
            <input class=\"cms\" type=\"submit\" name=\"confirmdel\" value=\"
{$cm_text["deletedocdir"]}\">\n
            <input class=\"cms\" type=\"submit\" name=\"canceldel\" value=\"
{$cm_text["dontdelete"]}\">\n
            </form>\n
            </td></tr></table>\n
            "
;
          }
    }
    else {
      
fcm_title_nav2 (""falsefalsefalsefalsefalsefalsefalse);
      
fcm_message ($cm_text["needaccess2delete"], CM_MSGSTYLE_WARNING);
      
fcm_add_logentry (""$user_kurzCM_APPLOG_ERROR"Error when deleting page. Not enough permissions.");
    }
  }
  else {
    
fcm_title_nav2 (""falsefalsefalsefalsefalsefalsefalse);
    
fcm_message ($cm_text["invaliddir"], CM_MSGSTYLE_ERROR);
    
fcm_add_logentry (""$user_kurzCM_APPLOG_ERROR"Error when deleting page. Invalid dir.");
  }
}
else {
  
fcm_title_nav2 (""falsefalsefalsefalsefalsefalsefalse);
  
fcm_message ($cm_text["invaliddir"], CM_MSGSTYLE_ERROR);
  
fcm_add_logentry (""$user_kurzCM_APPLOG_ERROR"Error when deleting page. Invalid dir.");
}

echo 
$cm_html_footer;

?>

 
 
NA fum/lmd: 2004.09.16
Copyright ©1994-2018 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link