updater.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. class updater {
  3. static function dbconnect() {
  4. global $config;
  5. $conn = mysql_pconnect($config['db_host'],$config['db_username'],$config['db_password']);
  6. mysql_select_db($config['db_name'],$conn);
  7. return true;
  8. }
  9. static function check() {
  10. $xml = '<?xml version="1.0" encoding="UTF-8"?>';
  11. $res = mysql_query("select * from kreatin_updates where update_status='0';");
  12. if (mysql_num_rows($res)>0) {
  13. while ($row = mysql_fetch_array($res)) {
  14. $xml.= '<file>'
  15. . '<path>'.$row['update_file'].'</path>'
  16. . '<version>'.$row['update_version'].'</version>'
  17. . '</file>';
  18. }
  19. $fname = 'kreatin_core_updates_'.time().".xml";
  20. file_put_contents($fname,$xml);
  21. return 'http://kreatin.kreatio.hu/'.$fname;
  22. }
  23. else {
  24. return 'no updates';
  25. }
  26. }
  27. static function generateUpdateXML() {
  28. }
  29. static function sendXML() {
  30. }
  31. static function serverFiles() {
  32. }
  33. }