31 final public function write($data)
33 $this->wfp = fopen($this->name,
"wb");
34 fwrite($this->wfp,$data);
41 final public function read()
43 $this->rfp = fopen($this->name,
"rb");
45 while (!feof($this->rfp))
47 $this->contents .= fread($this->rfp, 8192);
50 return $this->contents;
70 chmod(
"../fw_core/", 0777);
71 chmod(
"../fw_cache/", 0777);
72 chmod(
"../fw_headers/", 0777);
73 chmod(
"../fw_modules/", 0777);
74 chmod(
"../fw_libraries/", 0777);
75 chmod(
"../fw_script/", 0777);
84 chmod(
"../fw_core/", 0700);
85 chmod(
"../fw_cache/", 0700);
86 chmod(
"../fw_headers/", 0700);
87 chmod(
"../fw_modules/", 0700);
88 chmod(
"../fw_libraries/", 0700);
89 chmod(
"../fw_script/", 0700);
117 $this->header[
'doctype-def']=
'<!DOCTYPE html>';
118 $this->header[
'html-def']=
'<html><head>';
119 $this->body=
'</head>';
128 $this->header[
'keywords-def'] =
'<meta name="keywords" content="'.$kw.
'" />';
137 $this->header[
'charset-def'] =
'<meta charset="'.$ec.
'" />';
145 $this->header[
'responsive-def'] =
'<meta name="viewport" content="width=device-width, initial-scale=1">';
156 $t = substr($t,0,66).
'...';
158 $this->header[
'title-def'] =
'<title>'.$t.
'</title>';
159 $this->oginfo[
'title'] = $t;
168 if(strlen($data)>159)
170 $data = substr($data,0,155).
'...';
172 $this->header[
'description-def'] =
'<meta name="description" content="'.$data.
'">';
173 $this->oginfo[
'description'] = $data;
181 $this->header[
'robots-def'] =
'<meta name="ROBOTS" content="NOODP"><meta name="Slurp" content="NOYDIR">';
190 $this->header[
'owner-def'] =
'<meta name="author" content="'.$author.
'">';
198 $this->header[
'generator-def'] =
'<meta name="generator" content="OpenSencillo Framework (www.opensencillo.com)">';
207 $this->header[
'custom'][] = $code;
215 public function script($code)
217 $this->
custom(
'<script type="text/javascript" src="'.$code.
'"></script>');
226 $this->seo = $this->header[
'doctype-def'].PHP_EOL;
227 $this->seo .= (isset($this->header[
'html-def-snippet'])?$this->header[
'html-def-snippet']:$this->header[
'html-def']).PHP_EOL;
228 $this->seo .= $this->header[
'charset-def'].PHP_EOL;
229 $this->seo .= $this->header[
'responsive-def'].PHP_EOL;
230 $this->seo .= $this->header[
'title-def'].PHP_EOL;
231 $this->seo .= $this->header[
'description-def'].PHP_EOL;
234 unset($this->header[
'html-def']);
235 unset($this->header[
'html-def-snippet']);
236 unset($this->header[
'doctype-def']);
237 unset($this->header[
'charset-def']);
238 unset($this->header[
'responsive-def']);
239 unset($this->header[
'title-def']);
240 unset($this->header[
'description-def']);
242 foreach($this->header as $key => $val)
246 $this->seo .= $val.PHP_EOL;
247 $this->info[
'head'][] = $key;
250 foreach($this->header[
'custom'] as $key => $val)
252 $this->seo .= $val.PHP_EOL;
253 $this->info[
'head'][] = $key;
256 $this->seo .= $this->body;
265 public function lang($lang)
267 unset($this->header[
'html-def']);
268 $this->header[
'html-def']=
'<html lang="'.$lang.
'"><head>';
276 $this->header[
'jquery-js']=
'<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>';
277 $this->header[
'jqueryui-js']=
'<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>';
294 $this->
custom(
'<meta property="og:url" content="'.$arr[
'url'].
'" />');
295 $this->
custom(
'<meta property="og:type" content="'.$arr[
'type'].
'" />');
296 $this->
custom(
'<meta property="og:title" content="'.$this->oginfo[
'title'].
'" />');
297 $this->
custom(
'<meta property="og:description" content="'.$this->oginfo[
'description'].
'" />');
298 $this->
custom(
'<meta property="og:image" content="'.$arr[
'image'].
'" />');
302 $this->header[
'html-def-snippet'] =
'<html itemscope itemtype="http://schema.org/Other"><head>';
304 $this->
custom(
'<meta itemprop="name" content="'.$this->oginfo[
'title'].
'">');
305 $this->
custom(
'<meta itemprop="description" content="'.$this->oginfo[
'description'].
'">');
306 $this->
custom(
'<meta itemprop="image" content="'.$arr[
'image'].
'">');
315 $this->header[
'bootstrap-css']=
'<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">';
316 $this->header[
'jquery-js']=
'<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>';
317 $this->header[
'bootstrap-js']=
'<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>';
334 public $original_request;
349 $this->info=array(
'CMS'=>
'OpenSencillo',
350 'NME'=>
'OpenSencillo',
351 'VSN'=>$version.
'.'.$layout.$build,
352 'FWK'=>
'OpenSencillo '.$version.
'.'.$layout.$build,
353 'ARN'=>
'Bc.Peter Horváth, Mastery s.r.o. CEO and FOUNDER',
354 'CPY'=>
'© COPYRIGHT 2011-'.date(
'Y').
' Bc.Peter Horváth',
355 'HPE'=>
'http://www.opensencillo.com',
356 'DTC'=>
'01.'.$build.
'.'.$version.
':00.00:00.'.$layout.$build,
359 if($_GET[
'install']!=
'true')
361 $this->io_validator();
365 public function version_info()
375 public function authorized($domains)
377 if(is_array($domains))
379 $this->authorized=$domains;
380 foreach($this->authorized as $value)
382 if($_SERVER[
'SERVER_NAME']==$value)
384 $this->pid[$value]=
true;
388 $this->pid[$value]=
false;
401 $read =
new fileSystem(
'http://auth.mastery.sk/action.php');
407 $exist= fopen($read->name,
"rb");
410 die($this->info[
'PID']);
414 return $read->read();
423 if(!file_exists(
"key.pid"))
425 $json=json_decode(self::product(
false),
true);
426 $this->authorized($json[
'domains']);
427 if($this->pid[$_SERVER[
'SERVER_NAME']]!==
true)
429 die($this->info[
'PID']);
431 $this->info[
'product']=$json;
432 if(($json[
'sum']!=
'none')&&(!empty($this->info[
'SUM']))&&($json[
'sum']==$this->info[
'SUM']))
435 $json[
'expired']=md5(date(
'Ym'));
436 $write->write(json_encode($json));
441 $json=json_decode(self::product(
true),
true);
442 $this->authorized($json[
'domains']);
443 if(($this->pid[$_SERVER[
'SERVER_NAME']]!==
true)&&($json[
'sum']===$this->info[
'SUM']))
445 die($this->info[
'PID']);
447 $this->info[
'product']=$json;
448 if($this->info[
'product'][
'expired']!=md5(date(
'Ym')))
460 private function io_rw($input)
464 foreach($input as $key=>$val)
468 $arr[$key]=htmlspecialchars($val,ENT_COMPAT | ENT_HTML5);
469 $arr[
'admin_original'][$key]=$val;
481 private function io_validator()
484 'request'=>$this->io_rw($_REQUEST),
485 'get'=>$this->io_rw($_GET),
486 'post'=>$this->io_rw($_POST)
489 $arr[
'get'][
'core_info'] = $this->info;
490 $arr[
'request'][
'core_info']= $this->info;
491 $arr[
'post'][
'core_info'] = $this->info;
492 $arr[
'request'][
'status'] = 200;
493 $arr[
'get'][
'status'] = 200;
494 $arr[
'post'][
'status'] = 200;
497 $_POST = $arr[
'post'];
498 $_REQUEST = $arr[
'request'];
500 $this->
get = $arr[
'get'];
501 $this->post = $arr[
'post'];
502 $this->request = $arr[
'request'];
504 if(($_GET[
'status']==200)&&($_POST[
'status']==200)&&($_REQUEST[
'status']==200))
519 public function upgrade($source=null)
521 $fileList=scandir(
'./fw_core');
523 foreach($fileList as $key=>$val)
527 $md5 = md5_file(
'./fw_core/'.$val);
528 $remote_md5 = md5_file($source.$val.
'.suf');
529 if($md5!=$remote_md5)
533 $write->write($read->read());
539 public function __destruct()
557 public $coreSencillo;
561 public function __construct($sum=
false)
577 $core =
new bootUp(
false);