diff --git a/admin/ajax_link.php b/admin/ajax_link.php index 7a8c5e0..863ee85 100644 --- a/admin/ajax_link.php +++ b/admin/ajax_link.php @@ -19,13 +19,6 @@ switch($submit) { $DB->query($sql); } break; - case 'pwd_link': - //链接加密 - foreach($_POST['links'] as $lk=> $lv) { - $sql = "UPDATE `lylme_links` SET `link_pwd` = '".$_POST['pwd_id']."' WHERE `lylme_links`.`id` = ".$lv.";"; - $DB->query($sql); - } - break; case 'on': //链接启用 foreach($_POST['links'] as $lk=> $lv) { @@ -78,6 +71,57 @@ switch($submit) { header('Content-Type:application/json'); exit('{"title": "'.$head['title'].'", "icon": "'.$head['icon'].'","charset": "'.$head['charset'].'"}'); break; + //检测更新 + case 'update': + function zipExtract ($src, $dest) { + $zip = new ZipArchive(); + if ($zip->open($src)===true) { + $zip->extractTo($dest); + $zip->close(); + return true; + } + return false; + } + function deldir($dir) { + if(!is_dir($dir))return false; + $dh=opendir($dir); + while ($file=readdir($dh)) { + if($file!="." && $file!="..") { + $fullpath=$dir."/".$file; + if(!is_dir($fullpath)) { + unlink($fullpath); + } else { + deldir($fullpath); + } + } + } + closedir($dh); + if(rmdir($dir)) { + return true; + } else { + return false; + } + } + $scriptpath=str_replace('\\','/',$_SERVER['SCRIPT_NAME']); + $scriptpath = substr($scriptpath, 0, strrpos($scriptpath, '/')); + $admin_path = substr($scriptpath, strrpos($scriptpath, '/')+1); + $RemoteFile = $_POST['file']; + $ZipFile = "lylme_spage-update.zip"; + copy($RemoteFile,$ZipFile) or die("无从更新服务器下载更新包文件!"); + if (zipExtract($ZipFile,ROOT)) { + if($admin_path!='admin' && is_dir(ROOT.'admin')) { + //修改后台地址 + deldir(ROOT.$admin_path); + rename(ROOT.'admin',ROOT.$admin_path); + } + unlink($ZipFile); + exit ('success'); + } + else { + unlink($ZipFile); + exit('无法解压文件!请手动下载更新包解压'); + } + break; default: exit('error'); break; diff --git a/admin/index.php b/admin/index.php index 2f226bb..834e903 100644 --- a/admin/index.php +++ b/admin/index.php @@ -163,7 +163,7 @@ if($applyrows>0) { 最新版本: 查看更新说明
  • - 项目作者:六零 + 项目作者:六零 捐赠作者
  • 项目地址:https://github.com/LyLme/lylme_spage diff --git a/admin/update.php b/admin/update.php index fd6ec91..0c02917 100644 --- a/admin/update.php +++ b/admin/update.php @@ -9,15 +9,11 @@ $update = update();
    getver($conf['version']) && !empty($update['version']) ) { - echo ' '; - echo ' + + echo '

    更新说明

      '.$update['update_log'].' -
    • '; +
    • '; } else if(!empty($update['version'])) { echo '

      版本更新

        @@ -27,68 +23,62 @@ window.onload=function() { echo '

        版本更新

        • 当前版本:'.$conf['version'].'
        • -
        • 最新版本:Unknown
        • -
        • 手动更新:点击这里或前往码云下载update.zip后缀的更新包解压到网站根目即可
        • '; +
        • 手动更新:请前往码云下载最新版本lylme_spage_update.zip后缀的更新包上传到网站根目录解压即可,程序会自动更新数据库
        • '; } ?>
      -
    -open($src)===true) { - $zip->extractTo($dest); - $zip->close(); - return true; - } - return false; - } - function deldir($dir) { - if(!is_dir($dir))return false; - $dh=opendir($dir); - while ($file=readdir($dh)) { - if($file!="." && $file!="..") { - $fullpath=$dir."/".$file; - if(!is_dir($fullpath)) { - unlink($fullpath); - } else { - deldir($fullpath); - } - } - } - closedir($dh); - if(rmdir($dir)) { - return true; - } else { - return false; - } - } - $scriptpath=str_replace('\\','/',$_SERVER['SCRIPT_NAME']); - $scriptpath = substr($scriptpath, 0, strrpos($scriptpath, '/')); - $admin_path = substr($scriptpath, strrpos($scriptpath, '/')+1); - $RemoteFile = $update['file']; - $ZipFile = "lylme_spage_update.zip"; - copy($RemoteFile,$ZipFile) or die("无法下载更新包文件!".'返回上级'); - if (zipExtract($ZipFile,ROOT)) { - if($admin_path!='admin' && is_dir(ROOT.'admin')) { - //修改后台地址 - deldir(ROOT.$admin_path); - rename(ROOT.'admin',ROOT.$admin_path); - } - if(function_exists("opcache_reset"))@opcache_reset(); - $upsql=true; - unlink($ZipFile); - } else { - unlink($ZipFile); - echo(''); - } -} - + \ No newline at end of file +?> + + + + + + \ No newline at end of file