rem git pull
echo pull latest code
git.exe pull
echo Code downloaded

rem Set permissions
CACLS *.* /e /p everyone:f
echo Permissions Updated

@ECHO OFF
rem Import KNews
findstr "http://knews.cf" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo KNews Already Updated
	 goto END
	:ONE
     echo ^<?php >>config.php
	 echo $knews = "http://knews.cf"; >> config.php
	 echo ^?^> >> config.php
     echo KNews Added
	 goto END
   :END
   
rem Import KLoud
findstr "https://k-loud.tk" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo Kloud.tk Already Updated
	 goto END
	:ONE
	findstr "https://k-loud.cf" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
   cscript replace.vbs "config.php" "https://k-loud.cf" "https://k-loud.tk"
    echo Kloud Updated 
	goto END
	:ONE
	 echo ^<?php >>config.php
	 echo $kloud = "https://k-loud.tk"; >> config.php
	 echo ^?^> >> config.php
     echo Kloud Added
	 goto END
	:END
   
   rem Import Konvos
findstr "http://konvos.cf" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo Konvos Already Updated
	 goto END
	:ONE
     echo ^<?php >>config.php
	 echo $konvos = "http://konvos.cf"; >> config.php
	 echo ^?^> >> config.php
     echo Konvos Added
	 goto END
   :END
   
   rem Import Konvos enable
findstr "konvosvisible" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo Konvos Enabled Already Updated
	 goto END
	:ONE
     echo ^<?php >>config.php
	 echo $konvosvisible = "1"; >> config.php
	 echo ^?^> >> config.php
     echo Konvos Enabled Added
	 goto END
   :END

rem Update WebClip URL to Klips
findstr "http://webclip.ml" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     cscript replace.vbs "config.php" "http://webclip.ml" "http://klips.cf"
     echo WebClip Updated
	 goto END
   :ONE
     echo Klips Already Updated
	 goto END
   :END
   
   rem Update Kris URL
findstr "smifftser.youdontcare.com" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     cscript replace.vbs "config.php" "smifftser.youdontcare.com" "smiffster.ddns.net"
     echo Kris URL Updated
   :ONE
     echo Kris URL Already Updated
	 goto END
   :END

   rem Add KodiVisible
findstr "kodivisible" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo KodiVisible Already Updated
	 goto END
   :ONE
     echo ^<?php >>config.php
	 echo $kodivisible = "1"; >> config.php
	 echo ^?^> >> config.php
     echo KodiVisible Updated
	 goto END
   :END
   
      rem Add KonvosChat
findstr "konvoschat" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo KonvosChat Already Updated
	 goto END
   :ONE
     echo ^<?php >>config.php
	 echo $konvoschat = "1"; >> config.php
	 echo ^?^> >> config.php
     echo KonvosChat Updated
	 goto END
   :END
   
        rem Add custombackground
findstr "custombackground" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo custombackground Already Updated
	 goto END
   :ONE
     echo ^<?php >>config.php
	 echo $custombackground = ""; >> config.php
	 echo ^?^> >> config.php
     echo custombackground Updated
	 goto END
   :END
   
    rem Add version
findstr "localversion" config.php >nul 2>&1
   if errorlevel 1 goto ONE
   if errorlevel 0 goto ZERO
   goto END
   :ZERO
     echo localversion Already Updated
	 goto END
   :ONE
     echo ^<?php >>config.php
	 echo $localversion = "1.1"; >> config.php
	 echo ^?^> >> config.php
     echo localversion Updated
	 goto END
   :END
   
PAUSE