Open Sencillo  2014.008
 All Data Structures Files Functions Variables Pages
core_functions.php
Go to the documentation of this file.
1 <?php
2 /*~ core_functions.php
3 .---------------------------------------------------------------------------.
4 | Software: Sencillo Core |
5 | Version: 2014.008 |
6 | Contact: ph@mastery.sk |
7 | ------------------------------------------------------------------------- |
8 | Author: Bc. Peter Horváth (original founder) |
9 | Copyright (c) 2014, Bc. Peter Horváth. All Rights Reserved. |
10 | ------------------------------------------------------------------------- |
11 | License: Distributed under the General Public License (GPL) |
12 | http://www.gnu.org/copyleft/gpl.html |
13 | This program is distributed in the hope that it will be useful - WITHOUT |
14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
15 | FITNESS FOR A PARTICULAR PURPOSE. |
16 '---------------------------------------------------------------------------'
17 ~*/
28 {
29  public $name;
30 
31  private $rfp;
32  private $wfp;
33  private $contents;
34 
39  public function __construct($name)
40  {
41  $this->name = $name;
42  }
47  final public function write($data)
48  {
49  $this->wfp = fopen($this->name,"wb");
50  fwrite($this->wfp,$data);
51  fclose($this->wfp);
52  }
57  final public function read()
58  {
59  $this->rfp = fopen($this->name,"rb");
60  $this->contents = '';
61  while (!feof($this->rfp))
62  {
63  $this->contents .= fread($this->rfp, 8192);
64  }
65  fclose($this->rfp);
66  return $this->contents;
67  }
68 }
78 class file extends fileSystem
79 {
84  public function __construct($name)
85  {
86  chmod("../fw_core/", 0777);
87  chmod("../fw_cache/", 0777);
88  chmod("../fw_headers/", 0777);
89  chmod("../fw_modules/", 0777);
90  chmod("../fw_libraries/", 0777);
91  chmod("../fw_script/", 0777);
92  chmod("../", 0777);
93  }
98  public function __destruct()
99  {
100  chmod("../fw_core/", 0700);
101  chmod("../fw_cache/", 0700);
102  chmod("../fw_headers/", 0700);
103  chmod("../fw_modules/", 0700);
104  chmod("../fw_libraries/", 0700);
105  chmod("../fw_script/", 0700);
106  chmod("../", 0700);
107  }
108 }
119 {
120  public $seo;
121 
122  private $header;
123  private $body;
124 
128  public function __construct()
129  {
130  $this->header='<!DOCTYPE html><head>';
131  $this->body='</head>';
132  }
133 
138  public function keywords($kw)
139  {
140  $this->header .= '<meta name="keywords" content="'.$kw.'" />';
141  }
142 
147  public function encode($ec='UTF-8')
148  {
149  $this->header .= '<meta http-equiv="content-type" content="text/html; charset='.$ec.'" />';
150  }
151 
156  public function title($t)
157  {
158  if(strlen($t)>69)
159  {
160  $t = substr($t,0,66).'...';
161  }
162  $this->header .= '<title>'.$t.'</title>';
163  }
164 
169  public function description($data)
170  {
171  if(strlen($data)>159)
172  {
173  $data = substr($data,0,155).'...';
174  }
175  $this->header .= '<meta name="description" content="'.$data.'">';
176  }
177 
181  public function robots()
182  {
183  $this->header .= '<meta name="ROBOTS" content="NOODP"><meta name="Slurp" content="NOYDIR">';
184  }
185 
190  public function owner($author)
191  {
192  $this->header .= '<meta name="author" content="'.$author.'"><meta name="generator" content="Sencillo Framework">';
193  }
194 
199  public function custom($code)
200  {
201  $this->header .= $code;
202  }
203 
208  public function save()
209  {
210  $this->seo = $this->header.$this->body;
211  return $this->seo;
212  }
213 }
214 
225 {
226  public $info;
227  private $authorized;
228  private $pid;
229 
233  public function __construct()
234  {
235  $this->info=array('CMS'=>'Sencillo',
236  'FWK'=>'Sencillo v14.008',
237  'ARN'=>'Bc.Peter Horváth, Mastery s.r.o. CEO and FOUNDER',
238  'CPY'=>'(c)COPYRIGHT 2011-'.date('Y').' Bc.Peter Horváth',
239  'DTC'=>'01.08.2014:00.00:14.008',
240  'PID'=>'ILLEGAL LICENCE! PLEASE CONTACT ph@mastery.sk');
241  }
242 
246  public function __destruct()
247  {
248  $this->authorized=array();
249  $this->authorized[0]=md5($_SERVER['SERVER_NAME']);
250  $this->authorized[1]=md5(""); // md5('www.example.com') - site name with www
251  $this->authorized[2]=md5(""); // md5('example.com') - site name without www
252  if(($this->authorized[0]==$this->authorized[1])||($this->authorized[0]==$this->authorized[2]))
253  {
254  $this->pid=1;
255  }
256  else
257  {
258  $this->pid=0;
259  die($this->info['PID']);
260  }
261  }
262 }
263 $i=0;
264 $afterBootUp=array();
266 /* AFTER BOOTUP CODE
267  * *****************/
268 
269 //TODO
270 
271 /* KILL ALL EXIST "AFTER BOOTUP" OBJECTS
272  * *************************************/
273 unset($afterBootUp);
274 ?>
encode($ec='UTF-8')
__construct($name)
owner($author)
description($data)
$afterBootUp
__destruct()
__construct($name)