Beispiel #1
0
 static function scriptAlert()
 {
     p::setMaxage(0);
     if (p::$catchMeta) {
         p::$metaInfo[1] = array('private');
     }
     if ('-' === strtr(self::$requestMode, '-tpax', '#----')) {
         $a = '';
         $cache = p::getContextualCachePath('agentArgs/' . p::$agentClass, 'txt');
         if (file_exists($cache)) {
             $h = fopen($cache, 'r+b');
             if (!($a = fread($h, 1))) {
                 rewind($h);
                 fwrite($h, $a = '1');
                 p::touch('public/templates/js');
                 p::updateAppId();
             }
             fclose($h);
         }
         throw new e\PrivateResource($a);
     }
     user_error('Potential JavaScript-Hijacking. Stopping !');
     p::disable(true);
 }
 protected static function quickReset()
 {
     p::touch('debugSync');
     file_exists($f = PATCHWORK_PROJECT_PATH . '.patchwork.paths.db') && unlink($f);
 }
 static function syncCache($file, $depth)
 {
     if (0 === strpos($file, 'public/')) {
         p::touch('public');
         p::updateAppId();
     } else {
         if (0 === strpos($file, 'class/Patchwork/')) {
             self::resetCache();
         } else {
             if (0 === strpos($file, 'class/')) {
                 $file = p\Superloader::file2cache(substr($file, 6), $depth);
                 @unlink($file);
             }
         }
         p\Debugger::purgeZcache();
     }
 }
Beispiel #4
0
 protected function fileUpload($o)
 {
     $o->number = 0;
     $o->filename = '';
     if (isset($_FILES['NewFile']) && !is_null($_FILES['NewFile']['tmp_name'])) {
         $file = $_FILES['NewFile'];
         $path = $this->path . $o->resourceType . $o->currentFolder;
         file_exists($path) || mkdir($path, 0700, true);
         $o->filename = $file['name'];
         $extension = strtolower(pathinfo($o->filename, PATHINFO_EXTENSION));
         $filename = $extension ? substr($o->filename, 0, -strlen($extension) - 1) : $o->filename;
         $allow = $this->{'allow_' . $o->resourceType};
         $deny = $this->{'deny_' . $o->resourceType};
         if ((!$allow || in_array($extension, $allow)) && (!$deny || !in_array($extension, $deny))) {
             $i = 0;
             for (;;) {
                 $filepath = $path . $o->filename;
                 if (is_file($filepath)) {
                     $o->filename = $filename . '(' . ++$i . ').' . $extension;
                     $o->number = 201;
                 } else {
                     move_uploaded_file($file['tmp_name'], $filepath);
                     p::touch($this->watch);
                     break;
                 }
             }
         } else {
             $o->number = 202;
         }
     } else {
         $o->number = 202;
     }
     return $o;
 }