Location: PHPKode > projects > WebAddressBook > webaddressbook/extensions/mailing_lists/uninstall.inc.php
<?php

if(isset($_SESSION['admin']))
{
    include('dbconfig.inc.php');
    $sql = "ALTER TABLE " . $table_user . "
                        DROP `sender`,
                        DROP `email`";
    include('db_functions.inc.php');
    $query_array = array();
    array_push($query_array, $sql);
    $ok = execute_sql($query_array);

    if($ok) {
        $dir = opendir($ext_path."/templates");
        $files = array();
        while ($file = readdir($dir)) {
            if($file != "." && $file != ".." && !is_dir($file)) {
                if( (strpos($file,".tpl") + 0) == (strlen($file) - 4) ) {
                    array_push($files,$file);
                }
            }
        }
        closedir($dir);
        $ok = true;
        foreach($files as $file) {
            if(file_exists("./templates/source/".$file)) {
                $success = unlink("./templates/source/".$file);
                if(!$success) {
                    $ok .= "Couldn't remove file ./templates/source/".$file;
                }
            }
        }   
    }
    
    if(is_bool($ok) && $ok == true) {
        $file = fopen ($ext_path."/installed.inc.php", "w");
                
        if( is_bool($file) ) {
            $ok = "Couldn't open file";
        } else {
            $eol = "\n";
            fputs($file, '<?'.$eol);
            fputs($file, '$ext_installed = false;'.$eol);
            fputs($file, '?>');
        
            $ok = fclose($file);
        }
    }
}
else
{
    include('unauthorized.inc.php');   
}


?>
Return current item: WebAddressBook