예제 #1
0
파일: Mark.php 프로젝트: oduvanio/catalog
 private function __construct($mark)
 {
     $this->warrantytime = 60 * 60 * 24 * 60;
     //60 дней
     $mark = preg_replace("/:(.+)::\\./U", ":\$1::\$1.", $mark);
     $r = explode($this->sym, $mark);
     $this->mark = array_shift($r);
     if ($this->mark != '') {
         $data = infra_mem_get($this->prefix . $this->mark);
         if (!$data || !is_array($data['data'])) {
             $this->mark = '';
         } else {
             if (!$data['time']) {
                 $data['time'] = time();
             }
             $this->isold = true;
             $this->isoutdate = time() > $data['time'] + $this->warrantytime;
             $this->old = $data['data'];
         }
     }
     $this->data = $this->old;
     $add = implode($this->sym, $r);
     if ($add !== '') {
         $r = explode($this->sym, $add);
         $l = sizeof($r);
         if ($l % 2) {
             $l++;
             $r[] = '';
         }
         for ($i = 0; $i < $l; $i = $i + 2) {
             if (!$r[$i]) {
                 continue;
             }
             infra_seq_set($this->data, infra_seq_right($r[$i]), $r[$i + 1]);
         }
     }
 }
예제 #2
0
파일: Mark.php 프로젝트: akiyatkin/catalog
 private function __construct($mark)
 {
     $this->warrantytime = 60 * 60 * 24 * 60;
     //60 дней
     $mark = preg_replace("/:(.+)::\\./U", ":\$1::\$1.", $mark);
     $r = explode($this->sym, $mark);
     $this->mark = array_shift($r);
     if ($this->mark != '') {
         $src = infra_theme('~.marks/' . $this->prefix . $this->mark . '.json');
         if ($src) {
             $data = file_get_contents($src);
             $data = infra_json_decode($data);
         } else {
             $data = false;
         }
         //$data=infra_mem_get($this->prefix.$this->mark);
         if (!$data || !is_array($data['data'])) {
             $this->mark = '';
         } else {
             if (!$data['time']) {
                 $data['time'] = time();
             }
             $this->isold = true;
             $this->isoutdate = time() > $data['time'] + $this->warrantytime;
             $this->old = $data['data'];
         }
     }
     $this->data = $this->old;
     $add = implode($this->sym, $r);
     if ($add !== '') {
         $r = explode($this->sym, $add);
         $l = sizeof($r);
         if ($this->sym == $this->symeq) {
             if ($l % 2) {
                 $l++;
                 $r[] = '';
             }
             for ($i = 0; $i < $l; $i = $i + 2) {
                 if (!$r[$i]) {
                     continue;
                 }
                 infra_seq_set($this->data, infra_seq_right($r[$i]), $r[$i + 1]);
             }
         } else {
             for ($i = 0; $i < $l; $i = $i + 1) {
                 if (!$r[$i]) {
                     continue;
                 }
                 $rr = explode($this->symeq, $r[$i], 2);
                 if (!$rr[0]) {
                     continue;
                 }
                 infra_seq_set($this->data, infra_seq_right($rr[0]), $rr[1]);
             }
         }
     }
 }