Example #1
0
         }
     } elseif (isset($_GET['run'])) {
         $return = cron::run($_GET['file'], $_GET['run']);
         cron::aset($_GET['run'], array('lastdo' => time(), 'log' => $return));
     } elseif (isset($_GET['xorder'])) {
         foreach ($_POST['order'] as $key => $value) {
             cron::aset($key, array('orde' => $value));
         }
     }
     doAction('cron_setting_2');
     Redirect('index.php?mod=admin:cron&ok');
     break;
 case 'admin:update:back':
     if (isset($_GET['del'])) {
         if (file_exists(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['del'])) {
             DeleteFile(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['del']);
         }
         Redirect('index.php?mod=admin:update:back&ok');
     }
     if (isset($_GET['dir'])) {
         if (file_exists(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['dir'] . '/__backup.ini')) {
             if (CopyAll(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['dir'], SYSTEM_ROOT) !== true) {
                 msg('版本回滚失败');
             }
             unlink(SYSTEM_ROOT . '/__backup.ini');
             msg('版本回滚成功', 'index.php');
         } else {
             msg('版本回滚失败:该备份不存在或不正确');
         }
     }
     break;
Example #2
0
<body>

  <?php 
require_once './php/Common/DBConnect.php';
// DB接続用
require_once './php/Del/DelControl.php';
require_once './php/Del/DelModel.php';
echo '<br><br><br>';
// DBエラーの場合は終了させる。
if ($DelPhoto->getError != null) {
    echo $DelPhoto->getError;
    require_once './php/Common/ExitCode.html';
    exit;
}
$DelPhoto = new DelPhoto();
// データ削除系クラス
$Judge = false;
// 遷移先判定
// 削除系 ////////////////////////////////
// DBデータ削除
DeleteDB($DelPhoto->getSetDB(), $DelPhoto->getDelSql(), $DelPhoto->getPhotoNum());
// 画像データ削除
DeleteFile($DelPhoto->getPhotoPath());
// ディレクトリに画像がなければディレクトリも削除
DeleteDir($DelPhoto->getSetDB(), $DelPhoto->getSelSql(), $DelPhoto->getPhotoPath());
?>

  <script type="text/javascript" src="./js/Del/MainBack.js"></script>
</body>
</html>
Example #3
0
    $data = SortFiles($data);
    echo json_encode($data);
}
if ($action == 'path') {
    $directory = base64_decode($_GET['directory']);
    $base = base64_decode($_GET['base']);
    $data = GetPath($base, $directory);
    echo json_encode($data);
}
if ($action == 'download') {
    $file = base64_decode($_GET['file']);
    DownloadFile($file);
}
if ($action == 'delete') {
    $file = base64_decode($_GET['file']);
    echo DeleteFile($file);
}
if ($action == 'newdir') {
    $curdir = base64_decode($_GET['curdir']);
    $name = base64_decode($_GET['name']);
    echo NewDir($curdir, $name);
}
if ($action == 'rename') {
    $oldname = base64_decode($_GET['old']);
    $newname = base64_decode($_GET['new']);
    echo RenameFile($oldname, $newname);
}
if ($action == 'upload') {
    $curdir = base64_decode($_GET['curdir']);
    echo UploadFile($curdir);
}
/**
 * 删除文件或目录
 */
function DeleteFile($file)
{
    if (!file_exists($file)) {
        return false;
    }
    if (empty($file)) {
        return false;
    }
    if (@is_file($file)) {
        return @unlink($file);
    }
    $ret = true;
    if ($handle = @opendir($file)) {
        while ($filename = @readdir($handle)) {
            if ($filename == '.' || $filename == '..') {
                continue;
            }
            if (!DeleteFile($file . '/' . $filename)) {
                $ret = false;
            }
        }
    } else {
        $ret = false;
    }
    @closedir($handle);
    if (file_exists($file) && !rmdir($file)) {
        $ret = false;
    }
    return $ret;
}
Example #5
0
 /**
  *  Функции для создания thumbnails для полей типа файл
  *
  *
  * @global  object $nc_core
  * @param   int $classID - идентифиактор класса (компонента)
  * @param   int $message - номер объекты
  * @param   int $field_src_id - идентификатор поля источника
  * @param   int $field_dst_id - идентификатор поля приемника
  * @param   int $width    Ширина нового изображения
  * @param   int $height   Высота нового изображения
  * @param   int $mode     [optional] Режим уменьшения: 0 - пропорционально уменьшает; 1 - вписывает в указанные размеры, обрезая края
  * @param   string $format  [optional] Формат создаваемого изображения (jpg, gif, png, bmp)
  * @param   int $quality  [optional] Качество сжатия изображения (0-100) при $format=='jpg'
  * @param   string $field_name_src
  * @return  bool true в случае удачи, false - в случае ошибки.
  * @access  public
  * @static
  */
 public static function createThumb_byID($classID, $message, $field_src_id, $field_dst_id, $width, $height, $mode = 0, $format = NULL, $quality = 90, $field_name_src = '', $is_sys = false)
 {
     global $nc_core;
     // проверка аргументов
     $message += 0;
     $field_src_id += 0;
     $field_dst_id += 0;
     $classID += 0;
     if (!$message || !$field_src_id || !$field_dst_id || !$classID) {
         return false;
     }
     # поиск исходного файла
     // латинское имя поля
     if (!$field_name_src) {
         $field_name_src = $nc_core->db->get_var("SELECT `Field_Name` FROM `Field` WHERE `Field_ID` = '" . $field_src_id . "'");
     }
     if (!$field_name_src) {
         return 0;
     }
     // Значение поля в таблице объектов
     $message_field = $is_sys ? $nc_core->db->get_row("SELECT * FROM `User` WHERE `User_ID` = '" . $message . "'", ARRAY_A) : $nc_core->db->get_row("SELECT * FROM `Message" . $classID . "` WHERE `Message_ID` = '" . $message . "'", ARRAY_A);
     $file_data = explode(':', $message_field[$field_name_src]);
     $file_name = $file_data[0];
     $file_type = $file_data[1];
     $file_size = $file_data[2];
     $ext = substr($file_name, strrpos($file_name, "."));
     // расширение файла
     $file_name = substr($file_name, 0, strrpos($file_name, "."));
     // имя файла без расширения.
     // если ли файл в Filetable ?
     $filetable = $nc_core->db->get_row("SELECT * FROM `Filetable`\n                                            WHERE `Message_ID` = '" . intval($message) . "' AND `Field_ID` = '" . intval($field_src_id) . "'", ARRAY_A);
     // определения полного пути к файлу
     if ($filetable) {
         // исходный файл в protected
         $path_src = rtrim($nc_core->FILES_FOLDER, '/') . $filetable['File_Path'] . $filetable['Virt_Name'];
     } else {
         if ($file_data[3]) {
             // orignal
             $path_src = $nc_core->FILES_FOLDER . $file_data[3];
         } else {
             // simple
             $path_src = $nc_core->FILES_FOLDER . $field_src_id . "_" . $message . $ext;
         }
     }
     $img_size = getimagesize($path_src);
     if (!$format) {
         $format = strtolower(substr($img_size['mime'], strpos($img_size['mime'], '/') + 1));
     }
     // получение информации о поле-приемника
     $field_info_desc = $nc_core->db->get_row("SELECT `Field_Name`, `Format` FROM `Field` WHERE `Field_ID` = '" . $field_dst_id . "'", ARRAY_A);
     if (!$field_info_desc) {
         return false;
     }
     //удаление старого файла
     require_once $nc_core->INCLUDE_FOLDER . "s_files.inc.php";
     DeleteFile($field_dst_id, $field_info_desc['Field_Name'], $classID, 0, $message);
     // определение типа фс применика
     $fs = nc_field_parse_format($field_info_desc['Format'], NC_FIELDTYPE_FILE);
     $fs = $fs['fs'];
     $file_name .= "_thumb" . ++self::$_thumbPostfix;
     // определние имени файла на диске и диретории
     switch ($fs) {
         case NC_FS_PROTECTED:
             $path_dsc = $is_sys ? 'u/' : $message_field['Subdivision_ID'] . '/' . $message_field['Sub_Class_ID'] . '/';
             $name_dsc = md5($file_name . date("H:i:s d.m.Y") . uniqid("netcat"));
             break;
         case NC_FS_ORIGINAL:
             $path_dsc = $message_field['Subdivision_ID'] . '/' . $message_field['Sub_Class_ID'] . '/';
             $name_dsc = nc_get_filename_for_original_fs($file_name . ($format ? ".{$format}" : ''), $nc_core->FILES_FOLDER . $path_dsc);
             break;
         case NC_FS_SIMPLE:
             $path_dsc = '';
             $name_dsc = $field_dst_id . "_" . $message . ($format ? ".{$format}" : '');
             break;
     }
     // копирование файла
     //copy($path_src, $nc_core->FILES_FOLDER.$path_dsc.$name_dsc);
     // создание thumb
     $path_dest = $is_sys ? $nc_core->FILES_FOLDER . '/u/' . $name_dsc : $nc_core->FILES_FOLDER . $path_dsc . $name_dsc;
     self::imgResize($path_src, $path_dest, $width, $height, $mode, $format, $quality);
     switch ($fs) {
         case NC_FS_PROTECTED:
             $img_size = getimagesize($path_dest);
             if ($img_size === false) {
                 if (file_exists($path_dest)) {
                     unlink($path_dest);
                 }
                 return false;
             }
             $dst_File_Type = $img_size['mime'];
             $dst_File_Size = filesize($path_dest);
             $insert_filetable_sql = "INSERT INTO `Filetable`(Real_Name, Virt_Name, File_Path, File_Type, File_Size, Message_ID, Field_ID)\n                               VALUES('" . $nc_core->db->escape($file_name) . "." . $format . "', '" . $nc_core->db->escape($name_dsc) . "', '/" . $nc_core->db->escape($path_dsc) . "','" . $dst_File_Type . "', '" . $dst_File_Size . "', '" . $message . "', '" . $field_dst_id . "')";
             $nc_core->db->query($insert_filetable_sql);
             $in_db = $file_name . ":" . $dst_File_Type . ":" . $dst_File_Size;
             // то, что запишится в БД
             break;
         case NC_FS_ORIGINAL:
             $in_db = $file_name . "." . $format . ":" . $format . ":" . $file_size;
             // то, что запишится в БД
             $in_db .= ":" . ($is_sys ? 'u/' . $name_dsc : $path_dsc . $name_dsc);
             break;
         default:
             $in_db = $file_name . "." . $format . ":" . $format . ":" . $file_size;
             // то, что запишится в БД
             break;
     }
     $is_sys ? $nc_core->db->query("UPDATE `User` SET `" . $field_info_desc['Field_Name'] . "` = '" . $nc_core->db->escape($in_db) . "' WHERE `User_ID` = '" . $message . "'") : $nc_core->db->query("UPDATE `Message" . $classID . "` SET `" . $field_info_desc['Field_Name'] . "` = '" . $nc_core->db->escape($in_db) . "' WHERE `Message_ID` = '" . $message . "'");
     return true;
 }
Example #6
0
function DelOldRsc($rid)
{
    global $rsc_dir, $prev_dir;
    $aid = $param['rid'];
    list($db) = Getdb();
    $tbl = GetTable('recursos');
    $col = GetCols('recursos');
    $sql = "Select * from {$tbl} WHERE {$col['rid']}={$rid}";
    $resultado = $db->Execute($sql);
    if ($db->ErrorNo() != 0) {
        $mensaje = "Ha ocurrido un error al leer un viejo registro";
        print_r($mensaje);
        die;
    }
    $datos = $resultado->FetchRow();
    $datos = fromdbtocms($datos, 'recursos');
    $type = returnMedia($datos['archivo']);
    if ($type['preview'] == true) {
        if ($type['extension'] == ".jpg" || $type['extension'] == ".png") {
            $datos['archivo'] = basename($datos['archivo'], '.jpg');
            $datos['archivo'] = basename($datos['archivo'], '.png');
        }
        DeleteFile($prev_dir . $datos['did'] . "/" . $datos['archivo'] . ".jpg");
    }
    DeleteFile($rsc_dir . $datos['did'] . "/" . $datos['archivo']);
}
Example #7
0
                mkdir(SYSTEM_ROOT . '/setup/update_cache' . $dir, 0777, true);
                mkdir($backup . $dir, 0777, true);
            }
        }
        mkdir($backup, 0777, true);
        //创建更新备份
        file_put_contents($backup . '/__backup.ini', '[info]' . "\r\n" . '
name=' . SYSTEM_NAME . "\r\n" . '
ver=' . SYSTEM_VER . "\r\n" . '
time=' . date('Y-m-d H:m:s') . "\r\n");
        foreach ($_POST['file'] as $file) {
            $c = new wcurl($server . $file);
            $data = $c->exec();
            $c->close();
            if (empty($data)) {
                DeleteFile(SYSTEM_ROOT . '/setup/update_cache');
                msg('错误:更新失败:<br/><br/>与更新服务器的连接中断:无法下载数据' . $server . $file);
            }
            file_put_contents(SYSTEM_ROOT . '/setup/update_cache' . $file, $data);
            copy(SYSTEM_ROOT . $file, $backup . $file);
        }
        ReDirect('ajax.php?mod=admin:update:install&updfile=' . $_POST['updatefile']);
        break;
        /*
        	case 'admin:update': 
        $c    = new wcurl(SUPPORT_URL . 'get.php?ver=' . SYSTEM_VER);
        $data = json_decode($c->exec());
        $c->close();
        $d    = '';
        if(!empty($data)){
        	$t = '';
Example #8
0
            }
        }
    } while ($multiple_changes);
    # проверка изображения на картинке
    if (!$AUTH_USER_ID && $action == "add" && $current_cc["UseCaptcha"] && $MODULE_VARS["captcha"] && function_exists("imagegif")) {
        if (!nc_captcha_verify_code($nc_captcha_code)) {
            $warnText = NETCAT_MODULE_CAPTCHA_WRONG_CODE;
            $posting = 0;
        }
    }
    // обертка для вывода ошибки в админке
    if ($warnText && ($nc_core->inside_admin || $isNaked)) {
        ob_start();
        nc_print_status($warnText, 'error');
        $warnText = ob_get_clean();
    }
    // в случае ошибки нужно сохранить предыдущие значения полей типа файл
    if (!$posting && !empty($old_file_values)) {
        foreach ($old_file_values as $k => $v) {
            $fldValue[$k] = $v;
        }
    }
    // ошибок при заполнении формы нет - можно удалть файлы
    if ($posting && !empty($file_to_delete)) {
        foreach ($file_to_delete as $v) {
            DeleteFile($fldID[$v], $fld[$v], $classID, $systemTableName, $message);
        }
    }
    unset($old_file_values);
    unset($file_to_delete);
}
function AutoDelete()
{
    global $del_files, $config, $lang, $out;
    //Files einlesen
    $dh = opendir($config['paths']['backup']);
    $dbbackups = array();
    while (false !== ($filename = readdir($dh))) {
        if ($filename != "." && $filename != ".." && !is_dir($config['paths']['backup'] . $filename)) {
            //statuszeile auslesen
            if (substr($filename, -2) == "gz") {
                $fp = gzopen($config['paths']['backup'] . $filename, "r");
                $sline = gzgets($fp, 40960);
                gzclose($fp);
            } else {
                $fp = fopen($config['paths']['backup'] . $filename, "r");
                $sline = fgets($fp, 500);
                fclose($fp);
            }
            $statusline = ReadStatusline($sline);
            $tabellenanzahl = $statusline["tables"] == -1 ? "" : $statusline["tables"];
            $eintraege = $statusline["records"] == -1 ? "" : $statusline["records"];
            $part = $statusline["part"] == "MP_0" ? 0 : substr($statusline["part"], 3);
            $databases['db_actual'] = $statusline["dbname"];
            $datum = substr($filename, strlen($databases['db_actual']) + 1);
            $datum = substr($datum, 0, 16);
            if (isset($dbbackups[$databases['db_actual']])) {
                $dbbackups[$databases['db_actual']]++;
            } else {
                $dbbackups[$databases['db_actual']] = 1;
            }
            $files[] = "{$datum}|" . $databases['db_actual'] . "|{$part}|{$filename}";
        }
    }
    @rsort($files);
    // Mehr Dateien vorhanden, als es laut config.php sein d�rften? Dann weg damit :-)
    if ($config['del_files_after_days'] > 0) {
        $nowtime = strtotime("-" . ($config['del_files_after_days'] + 1) . " day");
        for ($i = 0; $i < sizeof($files); $i++) {
            $delfile = explode("|", $files[$i]);
            $ts = substr($delfile[0], 0, 4) . "-" . substr($delfile[0], 5, 2) . "-" . substr($delfile[0], 8, 2);
            if (strtotime($ts) < $nowtime) {
                $out .= DeleteFile($files[$i], "days");
                unset($files[$i]);
            }
        }
    }
    @rsort($files);
    if ($config['max_backup_files'] > 0) {
        if (sizeof($files) > $config['max_backup_files']) {
            if ($config['max_backup_files_each'] == 1) {
                //gilt es nur f�r jede Datenbank
                for ($i = sizeof($files) - 1; $i >= 0; $i--) {
                    $delfile = explode("|", $files[$i]);
                    if ($dbbackups[$delfile[1]] > $config['max_backup_files']) {
                        $out .= DeleteFile($files[$i], "max");
                        unset($files[$i]);
                        $dbbackups[$delfile[1]]--;
                    }
                }
            } else {
                //oder gilt es f�r alle Backups
                for ($i = sizeof($files) - 1; $i >= $config['max_backup_files']; $i--) {
                    $delfile = implode("|", $files);
                    $out .= DeleteFile($files[$i], "max");
                    unset($files[$i]);
                }
            }
        }
    }
    return $out;
}
Example #10
0
 /**
  *
  * @param string|int $class_id - ID компонента или название системной таблицы(User|Catalogue|Subdivision|Template)
  * @param string|int $field - название или ID поля в которое сохранять
  * @param int $message_id - ID объекта|пользователя|сайта|раздела|макета
  * @param array $file - массив с данными о файле из $_FILES либо
  *      path          — путь к файлу(/netcat/tmp/foto.jpg) или ссылка(http://example.com/foto.jpg)
  *      type          — mime-тип, попытается определить автоматически если не задан, по умолчанию image/jpeg
  *      name          — имя файла, возьмется из ссылки если не задано
  *      folder        — нестандартная папка в которую сохранить файл, только для стандартной ФС
  * @param bool $no еdit           - игнорировать настройки поля изменяющие файл
  * @param bool $message_put - режим работы внутри системы
  * @return array
  *      download_path — ссылка для скачивания под оригинальным именем (ссылка с "h_")
  *      url           — путь к файлу от корня сайта
  *      preview_url   — путь к превью файла от корня сайта
  *      name          — изначальное имя файла
  *      size          — размер
  *      type          — mime-тип
  */
 public function field_save_file($class_id, $field, $message_id, $file, $noеdit = false, $message_put = false)
 {
     $DOCUMENT_ROOT = nc_core('DOCUMENT_ROOT');
     $FILES_FOLDER = nc_core('FILES_FOLDER');
     $files_http_path = nc_core('SUB_FOLDER') . nc_core('HTTP_FILES_PATH');
     $db = nc_core('db');
     $message_id = intval($message_id);
     $component = new nc_Component($class_id);
     $systemTableID = $component->get_system_table_id();
     $systemTableName = $systemTableID ? $class_id : '';
     $fields = $component->get_fields(NC_FIELDTYPE_FILE);
     if (!empty($fields)) {
         foreach ($fields as $v) {
             if ($v['id'] == $field || $v['name'] == $field) {
                 $rawformat = $v['format'];
                 $field_id = $v['id'];
                 $field_name = $v['name'];
             }
         }
     } else {
         return null;
         //wrong class or field
     }
     if (!$systemTableID) {
         $msg = $db->get_row("SELECT `Sub_Class_ID`, `Subdivision_ID` FROM `Message{$class_id}` WHERE `Message_ID` = '{$message_id}'", ARRAY_A);
     } else {
         $msg = $db->get_row("SELECT COUNT(*) FROM `{$systemTableName}` WHERE `{$systemTableName}_ID` = {$message_id}", ARRAY_A);
     }
     if (empty($msg)) {
         return null;
         //wrong message
     }
     $result = array();
     #delete old file
     require_once $this->core->INCLUDE_FOLDER . "s_files.inc.php";
     DeleteFile($field_id, $field_name, $class_id, $systemTableName, $message_id);
     $format = nc_field_parse_format($rawformat, NC_FIELDTYPE_FILE);
     $fileurl = $file['path'];
     $filesrc = $file['tmp_name'];
     if (!$fileurl && !$filesrc) {
         return null;
         //no file to save
     }
     if (!$filesrc && $fileurl && !(preg_match("~^[^=]+://~", $fileurl) && ($buf = @file_get_contents($fileurl))) && !file_exists($DOCUMENT_ROOT . $fileurl)) {
         //и по внутренней нет
         return null;
     }
     $filename = $file['name'] ? $file['name'] : substr($fileurl, strrpos($fileurl, '/') + 1);
     $filename = str_replace(array('<', '>'), '_', $filename);
     $filetype = $file['type'];
     $filesize = $file['size'];
     $folder = trim($file['folder'], '/');
     // расширение файла
     $ext = substr($filename, strrpos($filename, "."));
     if (!$systemTableID) {
         $File_Path = $msg['Subdivision_ID'] . "/" . $msg['Sub_Class_ID'] . "/";
     } elseif ($systemTableID == 1) {
         $File_Path = "c/";
     } elseif ($systemTableID == 3) {
         $File_Path = "u/";
     } elseif ($systemTableID == 4) {
         $File_Path = "t/";
     } else {
         $File_Path = $message_id ? $message_id . "/" : "";
         //sic! why eval?
         $File_PathNew = "\$message/";
     }
     // будущее имя файла на диске + путь
     switch ($format['fs']) {
         case NC_FS_PROTECTED:
             // hash
             // имя файла
             $put_file_name = md5($filename . date("H:i:s d.m.Y") . uniqid("netcat"));
             break;
         case NC_FS_ORIGINAL:
             // пользователь сам указал папку
             if ($folder && preg_match("/^[a-z][a-z0-9\\/]+\$/is", $folder)) {
                 $File_Path = $folder . "/";
             }
             // сгенерировать имя файла
             $put_file_name = nc_get_filename_for_original_fs($filename, $FILES_FOLDER . $File_Path);
             $db_string_path = ":" . ($File_PathNew ? $File_PathNew : $File_Path) . $put_file_name;
             break;
         case NC_FS_SIMPLE:
             // FieldID_MessageID.ext
             $File_Path = '';
             // в папку netcat_files
             //sic! why eval?
             $put_file_name = $field_id . ($message_put ? '_$message' : "_" . $message_id) . $ext;
             break;
     }
     $this->create_dir($FILES_FOLDER . $File_Path);
     //для простой ФС нужно скопировать временный файл
     //он будет обрабатываться и после добавления объекта переименован в FieldID_MessageID.ext
     //при добавлении объекта или раздела пока неизвестен путь, поэтому файл попадет в папку netcat_files и потом перенесен
     $save_mame = $format['fs'] == NC_FS_SIMPLE && $message_put ? $filesrc : $put_file_name;
     $save_path = $FILES_FOLDER . $File_Path . $save_mame;
     $save_path_preview = $FILES_FOLDER . $File_Path . 'preview_' . $save_mame;
     if ($filesrc) {
         @move_uploaded_file($filesrc, $save_path);
     } else {
         if ($buf) {
             @file_put_contents($save_path, $buf);
         } else {
             @copy($DOCUMENT_ROOT . $fileurl, $save_path);
         }
     }
     $resize_format = nc_field_parse_resize_options($rawformat);
     require_once $this->core->INCLUDE_FOLDER . "classes/nc_imagetransform.class.php";
     if (!$noеdit) {
         if ($resize_format['use_preview']) {
             @nc_ImageTransform::imgResize($save_path, $save_path_preview, $resize_format['preview_width'], $resize_format['preview_height']);
         }
         if ($resize_format['use_resize']) {
             @nc_ImageTransform::imgResize($save_path, $save_path, $resize_format['resize_width'], $resize_format['resize_height']);
             $filesize = filesize($save_path);
         }
         if ($resize_format['use_crop']) {
             @nc_ImageTransform::imgCrop($save_path, $save_path, $resize_format['crop_x0'], $resize_format['crop_y0'], $resize_format['crop_x1'], $resize_format['crop_y1'], NULL, 90, 0, 0, $resize_format['crop_ignore'] ? $resize_format['crop_ignore_width'] : 0, $resize_format['crop_ignore'] ? $resize_format['crop_ignore_height'] : 0);
             $filesize = filesize($save_path);
         }
     }
     $filesize = $filesize ? $filesize : filesize($save_path);
     $filetype = $filetype ? $filetype : ($filetype = $this->_guess_content_type($save_path) ? $filetype : "image/jpeg");
     // для защищенной надо записать файл в базу
     if ($format['fs'] == NC_FS_PROTECTED) {
         $query = $db->query("INSERT INTO `Filetable`\n                            (`Real_Name`, `File_Path`, `Virt_Name`, `File_Type`, `File_Size`, `Field_ID`, `Content_Disposition`, `Message_ID`)\n                     VALUES ('" . $db->escape($filename) . "', '/" . $db->escape($File_Path) . "', '" . $db->escape($put_file_name) . "', '" . $db->escape($filetype) . "',\n                            '" . intval($filesize) . "', '" . intval($field_id) . "', '" . intval($format['disposition']) . "', '" . $message_id . "')");
         if ($query) {
             $filetable_lastid = $db->insert_id;
             $result['download_path'] = $files_http_path . $File_Path . 'h_' . $put_file_name;
         }
     }
     $db_string = $filename . ":" . $filetype . ":" . $filesize . $db_string_path;
     $result['url'] = $files_http_path . $File_Path . $put_file_name;
     $result['preview_url'] = $resize_format['use_preview'] ? $files_http_path . $File_Path . 'preview_' . $put_file_name : "";
     $result['name'] = $filename;
     $result['size'] = $filesize;
     $result['type'] = $filetype;
     if (!$message_put) {
         //запишем в объект сущности
         $query = $db->query("UPDATE `" . ($systemTableID ? $systemTableName : "Message" . $class_id) . "`\n                                    SET `{$field_name}` = '" . $db->escape($db_string) . "'\n                                        WHERE `" . ($systemTableID ? $systemTableName : "Message") . "_ID` = {$message_id}");
     } else {
         //данные для использования в скриптах добавления/изменения после message_put.php
         $result['FileFS'] = $format['fs'];
         $result['tmpNewFile'] = $put_file_name;
         $result['File_Path'] = $File_Path;
         $result['File_PathNew'] = $File_PathNew;
         $result['filetable_lastid'] = $filetable_lastid;
         $result['fldValue'] = $db_string;
     }
     return $result;
 }
Example #11
0
	require "functions.php";
	require "includes.php";
	require "menu.php";
	
	/* ----- setup variables ----- */
	$action = GetVariable("action");
	$seriesid = GetVariable("seriesid");
	$modality = GetVariable("modality");
	$datatype = GetVariable("datatype");
	$filename = GetVariable("filename");
	
	//$datadir = GetDataDir($seriesid, $modality, $datatype);
	
	/* determine action */
	if ($action == "delete") {
		DeleteFile($seriesid, $modality, $datatype, $filename);
		DisplayFileList($seriesid, $modality, $datatype);
	}
	elseif ($action == "rename") {
		RenameFile($seriesid, $modality, $datatype, $filename, $newfilename);
		DisplayFileList($seriesid, $modality, $datatype);
	}
//	elseif ($action == "download") {
//		Download($seriesid, $modality, $datatype, $filename);
//	}
	else {
		DisplayFileList($seriesid, $modality, $datatype);
	}
	
	
	/* ------------------------------------ functions ------------------------------------ */
Example #12
0
/**
 * Функция копирует один файл из первого поля во второй
 * в пределах одного объекта
 * новый файл будет в ФС, которая задана в формате поле-приемника
 *
 * @param int message - id объекта
 * @param int field_src - id поля источника
 * @param int field_dst - id поля приемниеп
 * @param int classID (оппоционально) id компонента
 *
 * @todo Реализовать копирование файлов системных таблиц
 * @todo Реализовать копирование файлов различных объектов (возможно, из разных компонентов)
 * @return bool
 */
function nc_copy_filefield($message, $field_src, $field_dst, $classID = 0)
{
    global $nc_core;
    // Если не задан класс, то вытащим его из базы
    if (!$classID) {
        $classID = $nc_core->db->get_var("SELECT `Class_ID` FROM `Field` WHERE  `Field_ID` = '" . intval($field_src) . "'");
    }
    // проверка аргументов
    $message += 0;
    $field_src += 0;
    $field_dst += 0;
    $classID += 0;
    if (!$message || !$field_src || !$field_dst || !$classID) {
        return 0;
    }
    # поиск исходного файла
    // латинское имя поля
    $field_name_src = $nc_core->db->get_var("SELECT `Field_Name` FROM `Field` WHERE `Field_ID` = '" . $field_src . "'");
    if (!$field_name_src) {
        return 0;
    }
    // Значение поля в таблице объектов
    $message_field = $nc_core->db->get_row("SELECT * FROM `Message" . $classID . "` WHERE  `Message_ID` = '" . $message . "'", ARRAY_A);
    $file_data = explode(':', $message_field[$field_name_src]);
    $file_name = $file_data[0];
    $file_type = $file_data[1];
    $file_size = $file_data[2];
    $ext = substr($file_name, strrpos($file_name, "."));
    // расширение файла
    // если ли файл в Filetable ?
    $filetable = $nc_core->db->get_row("SELECT * FROM `Filetable`\n                                          WHERE `Message_ID` = '" . intval($message) . "' AND `Field_ID` = '" . intval($field_src) . "'", ARRAY_A);
    // определения полного пути к файлу
    if ($filetable) {
        // исходный файл в protected
        $path_src = rtrim($nc_core->FILES_FOLDER, '/') . $filetable['File_Path'] . $filetable['Virt_Name'];
    } else {
        if ($file_data[3]) {
            // orignal
            $path_src = $nc_core->FILES_FOLDER . $file_data[3];
        } else {
            // simple
            $path_src = $nc_core->FILES_FOLDER . $field_src . "_" . $message . $ext;
        }
    }
    # копирование
    // получение информации о поле-приемника
    $field_info_desc = $nc_core->db->get_row("SELECT `Field_Name`, `Format` FROM `Field` WHERE `Field_ID` = '" . $field_dst . "'", ARRAY_A);
    if (!$field_info_desc) {
        return 0;
    }
    //удаление старого файла
    require_once $nc_core->INCLUDE_FOLDER . "s_files.inc.php";
    DeleteFile($field_dst, $field_info_desc['Field_Name'], $classID, 0, $message);
    // определение типа фс применика
    $fs = nc_field_parse_format($field_info_desc['Format'], NC_FIELDTYPE_FILE);
    $fs = $fs['fs'];
    // определние имени файла на диске и диретории
    $in_db = $file_name . ":" . $file_type . ":" . $file_size;
    // то, что запишится в БД
    switch ($fs) {
        case NC_FS_PROTECTED:
            $path_dsc = $message_field['Subdivision_ID'] . '/' . $message_field['Sub_Class_ID'] . '/';
            $name_dsc = md5($file_name . date("H:i:s d.m.Y") . uniqid("netcat"));
            $nc_core->db->query("INSERT INTO `Filetable`(Real_Name, Virt_Name, File_Path, File_Type, File_Size, Message_ID, Field_ID)\n                           VALUES('" . $file_name . "', '" . $name_dsc . "', '/" . $path_dsc . "','" . $file_type . "', '" . $file_size . "', '" . $message . "', '" . $field_dst . "')");
            break;
        case NC_FS_ORIGINAL:
            $path_dsc = $message_field['Subdivision_ID'] . '/' . $message_field['Sub_Class_ID'] . '/';
            $name_dsc = nc_get_filename_for_original_fs($file_name, $nc_core->FILES_FOLDER . $path_dsc);
            $in_db .= ":" . $path_dsc . $name_dsc;
            break;
        case NC_FS_SIMPLE:
            $path_dsc = '';
            $name_dsc = $field_dst . "_" . $message . $ext;
            break;
    }
    // обновление инфы в БД
    $nc_core->db->query("UPDATE `Message" . $classID . "` SET `" . $field_info_desc['Field_Name'] . "` = '" . $in_db . "' WHERE `Message_ID` = '" . $message . "'");
    print $nc_core->FILES_FOLDER . $path_dsc . $name_dsc;
    // копирование файла
    copy($path_src, $nc_core->FILES_FOLDER . $path_dsc . $name_dsc);
    return 1;
}
}
// Check the current folder syntax (must begin and start with a slash).
if (substr($sCurrentFolder, -1) !== '/') {
    $sCurrentFolder .= '/';
}
if (substr($sCurrentFolder, 0, 1) !== '/') {
    $sCurrentFolder = '/' . $sCurrentFolder;
}
// Execute the required command.
switch ($sCommand) {
    case 'FileUpload':
        FileUpload($sCurrentFolder);
        break;
    case 'DeleteFile':
        CreateXmlHeader('DeleteFile', $sCurrentFolder);
        DeleteFile($sCurrentFolder, $sType);
        CreateXmlFooter();
        break;
    case 'GetFoldersAndFiles':
        CreateXmlHeader('GetFoldersAndFiles', $sCurrentFolder);
        GetFoldersAndFiles($sCurrentFolder, $sType);
        CreateXmlFooter();
        break;
    case 'CreateFolder':
        CreateXmlHeader('CreateFolder', $sCurrentFolder);
        CreateFolder($sCurrentFolder, $sType);
        CreateXmlFooter();
        break;
    default:
    case 'GetFolders':
        CreateXmlHeader('GetFolders', $sCurrentFolder);
Example #14
0
function delTemplateFile($dir, $fileName)
{
    $filePath = '';
    handlePower('删除模板文件');
    //管理权限处理
    $filePath = $dir . '/' . $fileName;
    DeleteFile($filePath);
    aspEcho('删除文件', $filePath);
}
Example #15
0
/**
 * 卸载插件
 * 如果存在,系统会调用 插件名_callback.php 的 callback_remove()
 */
function uninstallPlugin($plugin)
{
    global $m;
    inactivePlugin($plugin);
    $callback_file = SYSTEM_ROOT . '/plugins/' . $plugin . '/' . $plugin . '_callback.php';
    if (file_exists($callback_file)) {
        require_once $callback_file;
        if (function_exists('callback_remove')) {
            callback_remove();
        }
    }
    $m->query("DELETE FROM `" . DB_PREFIX . "plugins` WHERE `name` = '{$plugin}';");
    $isapp = option::get('isapp');
    if (empty($isapp)) {
        DeleteFile(SYSTEM_ROOT . '/plugins/' . $plugin);
    }
}
<?php

/**
 * Created by PhpStorm.
 * User: Ujjwal
 * Date: 9/2/2016
 * Time: 1:28 PM
 */
include "Download.php";
if (isset($_POST['filename']) && $_POST['filename'] != null && $_POST['filename'] != '') {
    $filename = "downloads_data/" . $_POST['filename'];
    download($filename);
    DeleteFile($filename);
    exit;
}
function DeleteFile($filename)
{
    if (is_file($filename)) {
        chmod($filename, 0777);
        unlink($filename);
    }
}
Example #17
0
function clearCache()
{
    DeleteFile($GLOBALS['WEB_CACHEFile']);
    deleteFolder('./../cache/html');
    CreateFolder('./../cache/html');
    Rw(getMsg1(setL('清除缓冲完成,正在进入后台界面...'), '?act=displayAdminLogin'));
}
Example #18
0
}
?>
<!DOCTYPE html>
<html lang="fr">
    <head>
        <meta charset="utf-8" />
        <link rel="shortcut icon" type="image/x-icon" href="./Images/favicon.ico" />
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <title>Supervision server room</title>    

        <script type="text/javascript">
            //Confirmation pour delete le bateau
            function DelComment(fichier) {
                if (confirm("Voulez vous vraiment supprimer ce fichier?")) {
<?php 
DeleteFile($fichier);
?>
                }
            }

        </script>


        <style>   
            body {
                background-color: white;
            }

            canvas{
                border:black solid 1px;
            }
Example #19
0
/**
 * Удаление файлов шаблона в разделе $cc с идентификатором шаблона $classID
 * @param int $cc идентификатор шаблона в разделе
 * @param int $classID идентификатор шаблона
 * @return bool
 */
function DeleteSubClassFiles($cc, $classID)
{
    global $db;
    $cc += 0;
    $classID += 0;
    $res = $db->get_results("SELECT `Field_ID`, `Field_Name`\n    FROM `Field`\n    WHERE `Class_ID` = '" . $classID . "'\n    AND `System_Table_ID` = 0\n    AND `TypeOfData_ID` = 6", ARRAY_A);
    if ($res) {
        foreach ($res as $field) {
            $messages = $db->get_col("SELECT `Message_ID`, `" . $field['Field_Name'] . "` FROM `Message" . $classID . "` WHERE `Sub_Class_ID` = '" . $cc . "'");
            if ($messages) {
                foreach ($messages as $message_id) {
                    DeleteFile($field['Field_ID'], $field['Field_Name'], $classID, "", $message_id);
                }
            }
        }
    }
    // delete dir
    DeleteSubClassDir($cc);
    return true;
}
Example #20
0
function copyHtmlToWeb()
{
    $webDir = '';
    $toWebDir = '';
    $toFilePath = '';
    $filePath = '';
    $fileName = '';
    $fileList = '';
    $splStr = '';
    $content = '';
    $s = '';
    $s1 = '';
    $c = '';
    $webImages = '';
    $webCss = '';
    $webJs = '';
    $splJs = '';
    $webFolderName = '';
    $jsFileList = '';
    $setFileCode = '';
    $nErrLevel = '';
    $jsFilePath = '';
    $url = '';
    $setFileCode = @$_REQUEST['setcode'];
    //设置文件保存编码
    handlePower('复制生成HTML页面');
    //管理权限处理
    writeSystemLog('', '复制生成HTML页面');
    //系统日志
    $webFolderName = $GLOBALS['cfg_webTemplate'];
    if (left($webFolderName, 1) == '/') {
        $webFolderName = mid($webFolderName, 2, -1);
    }
    if (right($webFolderName, 1) == '/') {
        $webFolderName = mid($webFolderName, 1, len($webFolderName) - 1);
    }
    if (inStr($webFolderName, '/') > 0) {
        $webFolderName = mid($webFolderName, inStr($webFolderName, '/') + 1, -1);
    }
    $webDir = '/htmladmin/' . $webFolderName . '/';
    $toWebDir = '/htmlw' . 'eb/viewweb/';
    CreateDirFolder($toWebDir);
    $toWebDir = $toWebDir . pinYin2($webFolderName) . '/';
    deleteFolder($toWebDir);
    //删除
    CreateFolder('/htmlweb/web');
    //创建文件夹 防止web文件夹不存在20160504
    deleteFolder($webDir);
    CreateDirFolder($webDir);
    $webImages = $webDir . 'Images/';
    $webCss = $webDir . 'Css/';
    $webJs = $webDir . 'Js/';
    copyFolder($GLOBALS['cfg_webImages'], $webImages);
    copyFolder($GLOBALS['cfg_webCss'], $webCss);
    CreateFolder($webJs);
    //创建Js文件夹
    //处理Js文件夹
    $splJs = aspSplit(getDirJsList($webJs), vbCrlf());
    foreach ($splJs as $key => $filePath) {
        if ($filePath != '') {
            $toFilePath = $webJs . getFileName($filePath);
            aspEcho('js', $filePath);
            moveFile($filePath, $toFilePath);
        }
    }
    //处理Css文件夹
    $splStr = aspSplit(getDirCssList($webCss), vbCrlf());
    foreach ($splStr as $key => $filePath) {
        if ($filePath != '') {
            $content = getFText($filePath);
            $content = replace($content, $GLOBALS['cfg_webImages'], '../images/');
            $content = deleteCssNote($content);
            $content = PHPTrim($content);
            //设置为utf-8编码 20160527
            if (lCase($setFileCode) == 'utf-8') {
                $content = replace($content, 'gb2312', 'utf-8');
            }
            WriteToFile($filePath, $content, $setFileCode);
            aspEcho('css', $GLOBALS['cfg_webImages']);
        }
    }
    //复制栏目HTML
    $GLOBALS['isMakeHtml'] = true;
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_filePath'] = replace(getColumnUrl($rss['columnname'], 'name'), $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('导航', $GLOBALS['glb_filePath']);
        }
    }
    //复制文章HTML
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/detail/detail' . $rss['id']);
        $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('文章' . $rss['title'], $GLOBALS['glb_filePath']);
        }
    }
    //复制单面HTML
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/page/page' . $rss['id']);
        $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('单页' . $rss['title'], $GLOBALS['glb_filePath']);
        }
    }
    //批量处理html文件列表
    //call echo(cfg_webSiteUrl,cfg_webTemplate)
    //call rwend(fileList)
    $sourceUrl = '';
    $replaceUrl = '';
    $splStr = aspSplit($fileList, vbCrlf());
    foreach ($splStr as $key => $filePath) {
        if ($filePath != '') {
            $filePath = $webDir . replace($filePath, '/', '_');
            aspEcho('filePath', $filePath);
            $content = getFText($filePath);
            foreach ($splStr as $key => $s) {
                $s1 = $s;
                if (right($s1, 11) == '/index.html') {
                    $s1 = left($s1, len($s1) - 11) . '/';
                }
                $sourceUrl = $GLOBALS['cfg_webSiteUrl'] . $s1;
                $replaceUrl = $GLOBALS['cfg_webSiteUrl'] . replace($s, '/', '_');
                //Call echo(sourceUrl, replaceUrl) 							'屏蔽  否则大量显示20160613
                $content = replace($content, $sourceUrl, $replaceUrl);
            }
            $content = replace($content, $GLOBALS['cfg_webSiteUrl'], '');
            //删除网址
            $content = replace($content, $GLOBALS['cfg_webTemplate'] . '/', '');
            //删除模板路径 记
            //content=nullLinkAddDefaultName(content)
            foreach ($splJs as $key => $s) {
                if ($s != '') {
                    $fileName = getFileName($s);
                    $content = replace($content, 'Images/' . $fileName, 'js/' . $fileName);
                }
            }
            if (inStr($content, '/Jquery/Jquery.Min.js') > 0) {
                $content = replace($content, '/Jquery/Jquery.Min.js', 'js/Jquery.Min.js');
                copyFile('/Jquery/Jquery.Min.js', $webJs . '/Jquery.Min.js');
            }
            $content = replace($content, '<a href="" ', '<a href="index.html" ');
            //让首页加index.html
            createFileGBK($filePath, $content);
        }
    }
    //把复制网站夹下的images/文件夹下的js移到js/文件夹下  20160315
    $htmlFileList = '';
    $splHtmlFile = '';
    $splJsFile = '';
    $htmlFilePath = '';
    $jsFileName = '';
    $jsFileList = getDirJsNameList($webImages);
    $htmlFileList = getDirHtmlList($webDir);
    $splHtmlFile = aspSplit($htmlFileList, vbCrlf());
    $splJsFile = aspSplit($jsFileList, vbCrlf());
    foreach ($splHtmlFile as $key => $htmlFilePath) {
        $content = getFText($htmlFilePath);
        foreach ($splJsFile as $key => $jsFileName) {
            $content = regExp_Replace($content, 'Images/' . $jsFileName, 'js/' . $jsFileName);
        }
        $nErrLevel = 0;
        $content = handleHtmlFormatting($content, false, $nErrLevel, '|删除空行|');
        //|删除空行|
        $content = handleCloseHtml($content, true, '');
        //闭合标签
        $nErrLevel = checkHtmlFormatting($content);
        if (checkHtmlFormatting($content) == false) {
            echoRed($htmlFilePath . '(格式化错误)', $nErrLevel);
            //注意
        }
        //设置为utf-8编码
        if (lCase($setFileCode) == 'utf-8') {
            $content = replace($content, '<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
        }
        $content = PHPTrim($content);
        WriteToFile($htmlFilePath, $content, $setFileCode);
    }
    //images下js移动到js下
    foreach ($splJsFile as $key => $jsFileName) {
        $jsFilePath = $webImages . $jsFileName;
        $content = getFText($jsFilePath);
        $content = PHPTrim($content);
        WriteToFile($webJs . $jsFileName, $content, $setFileCode);
        DeleteFile($jsFilePath);
    }
    copyFolder($webDir, $toWebDir);
    //使htmlWeb文件夹用php压缩
    if (@$_REQUEST['isMakeZip'] == '1') {
        makeHtmlWebToZip($webDir);
    }
    //使网站用xml打包20160612
    if (@$_REQUEST['isMakeXml'] == '1') {
        makeHtmlWebToXmlZip('/htmladmin/', $webFolderName);
    }
    //浏览地址
    $url = 'http://10.10.10.57/' . $toWebDir;
    aspEcho('浏览', '<a href=\'' . $url . '\' target=\'_blank\'>' . $url . '</a>');
}
function DeleteOldFilesIfAny()
{
    $paths = array('downloads_data/');
    foreach ($paths as $path) {
        if ($handle = opendir($path)) {
            while (false !== ($file = readdir($handle))) {
                if (time() - filemtime($path . $file) > 3600) {
                    DeleteFile($path . $file);
                }
            }
        }
    }
}
Example #22
0
function deleteAllMakeHtml()
{
    $filePath = '';
    //栏目
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn order by sortrank asc');
    while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
        if ($rsx['nofollow'] == false) {
            $filePath = getRsUrl($rsx['filename'], $rsx['customaurl'], '/nav' . $rsx['id']);
            if (right($filePath, 1) == '/') {
                $filePath = $filePath . 'index.html';
            }
            aspEcho('栏目filePath', '<a href=\'' . $filePath . '\' target=\'_blank\'>' . $filePath . '</a>');
            DeleteFile($filePath);
        }
    }
    //文章
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail order by sortrank asc');
    while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
        if ($rsx['nofollow'] == false) {
            $filePath = getRsUrl($rsx['filename'], $rsx['customaurl'], '/detail/detail' . $rsx['id']);
            if (right($filePath, 1) == '/') {
                $filePath = $filePath . 'index.html';
            }
            aspEcho('文章filePath', '<a href=\'' . $filePath . '\' target=\'_blank\'>' . $filePath . '</a>');
            DeleteFile($filePath);
        }
    }
    //单页
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage order by sortrank asc');
    while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
        if ($rsx['nofollow'] == false) {
            $filePath = getRsUrl($rsx['filename'], $rsx['customaurl'], '/page/detail' . $rsx['id']);
            if (right($filePath, 1) == '/') {
                $filePath = $filePath . 'index.html';
            }
            aspEcho('单页filePath', '<a href=\'' . $filePath . '\' target=\'_blank\'>' . $filePath . '</a>');
            DeleteFile($filePath);
        }
    }
}
Example #23
0
     //删除配置文件
     if (file_exists($floderName . '/config.php')) {
         unlink($floderName . '/config.php');
     }
     if (file_exists($floderName . '/app.conf')) {
         unlink($floderName . '/app.conf');
     }
     if (file_exists($floderName . '/config.yaml')) {
         unlink($floderName . '/config.yaml');
     }
     //覆盖文件
     if (CopyAll($floderName, SYSTEM_ROOT) !== true) {
         DeleteFile(UPDATE_CACHE);
         msg('错误 - 更新失败:<br/><br/>无法更新文件');
     }
     DeleteFile(UPDATE_CACHE);
     //获取最新的版本号
     $c = new wcurl('http://kenvix.oschina.io/tieba-cloud-sign/');
     $data = json_decode($c->exec(), true);
     $c->close();
     //修改版本号
     option::set('vid', $data['vid']);
     //暂不支持更新脚本
     msg('恭喜您,更新成功!', SYSTEM_URL . 'index.php?mod=admin:update&ok');
     break;
 case 'admin:update:changeServer':
     if (isset($_GET['server'])) {
         option::set('update_server', $_GET['server']);
     }
     break;
 case 'baiduid:getverify':
Example #24
0
<?php

include_once "../common.php";
if (!$user->Check()) {
    exit;
}
include_once ROOT_PATH . "/mod/files.php";
if (!isset($_GET['id'])) {
    exit;
}
$id = (int) $_GET['id'];
if (!@$id) {
    exit;
}
echo '<hr color="#dddddd" size="1">';
if (DeleteFile($id) == 1) {
    echo "<font class='ok'>Ok, file deleted!</font>";
} else {
    echo "<font class='error'>Can't delete file</font>";
}