Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. <?php
  2. class Config{
  3. var $base;
  4. var $password;
  5. var $user;
  6. var $host;
  7. var $charset;
  8. var $collation;
  9. var $cache;
  10. var $template;
  11. var $script_url;
  12. var $lic_key;
  13. var $domain;
  14. var $update_info;
  15. var $timezone;
  16. var $timezone_2;
  17. var $general_dir;
  18. var $add;
  19.  
  20.  
  21.  
  22. function __construct() {
  23. $this->db_config();
  24. $this->template_config();
  25. $this->general();
  26. $this->update_info();
  27. }
  28.  
  29.  
  30. function general(){
  31. $this->general_dir='/var/www/www-root/data/www/';
  32. $this->add='http://domain_here/';
  33. if(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=='on'){
  34. $url='https://'.$_SERVER["SERVER_NAME"];
  35. }else{
  36. $url='http://'.$_SERVER["SERVER_NAME"];
  37. }
  38. $url .= ( $_SERVER["SERVER_PORT"] != 80 ) ? ":".$_SERVER["SERVER_PORT"] : "";
  39. $url .= $_SERVER["REQUEST_URI"];
  40. $domain=$_SERVER["SERVER_NAME"];
  41. if(file_exists('configuration/key.cpatools')){
  42. $lic_key = file_get_contents($this->general_dir.'configuration/key.cpatools');
  43. }else{
  44. $lic_key = 'err:106';
  45. }
  46. $script_url=explode('?', $url);
  47. $script_url=$script_url[0];
  48.  
  49. $this->script_url=$script_url;
  50. $this->lic_key=$lic_key;
  51. $this->domain=$domain;
  52. $this->domain=$domain;
  53. $this->timezone=3*3600;
  54. $this->timezone_2='+3';
  55. }
  56.  
  57. function db_config(){
  58. $this->base='BASE_NAME';
  59. $this->password='PASS';
  60. $this->user='root';
  61. $this->host='localhost';
  62. $this->charset='UTF8';
  63. $this->collation='utf8_general_ci';
  64. $this->cache='0';
  65. }
  66.  
  67. function template_config(){
  68. $this->template='standart';
  69. }
  70.  
  71. function update_info(){
  72. if(file_exists('configuration/info.xml')){
  73. $info = file_get_contents($this->general_dir.'configuration/info.xml');
  74. }
  75. if(isset($info)){
  76. $update_info = new SimpleXMLElement($info);
  77. $arr['name']=$update_info->info->name.' '.$update_info->info->version.' ('.$update_info->info->date.')';
  78. $arr['version_name']=$update_info->info->version;
  79. $arr['version']=$update_info->update->version;
  80. $arr['date_update']=$update_info->update->date_update;
  81. }
  82. if(isset($arr)){
  83. $this->update_info = $arr;
  84. }
  85. }
  86. }
  87. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement