Example #1
0
 public static function Start()
 {
     // Setup log file
     self::$LOG = DATA_DIR . '/' . basename(self::$LOG);
     if (!file_exists(self::$LOG)) {
         File::Create(self::$LOG);
     }
     // Make sure not marked to stop
     Cache_MySQL::Cache(self::$CACHE_STOP, 0);
     // Start it up, if not already running
     if (!self::IsRunning()) {
         $si = ServerInfo::GetCached();
         $script = dirname(realpath(__FILE__)) . '/' . self::$SCRIPT;
         File::Create(self::$LOG);
         shell_exec($si->binaries[ServerInfo::BIN_PHP] . ' -q ' . $script . ' ' . self::ARGUMENT . ' >>' . escapeshellarg(self::$LOG) . ' 2>&1 &');
     }
 }
Example #2
0
        DBinit('action_download');
        break;
    default:
        exit;
        break;
}
switch ($method) {
    case 'upload':
        // TODO Список последних добавленых файлов
        if (empty($user) or $user->lvl() < 15) {
            break;
        }
        $file = new File(false, 'other/');
        $id_rewrite = Filter::input('nf_delete', 'post', 'bool');
        $id_word = Filter::input('nf_id_word', 'post', 'string', true);
        $result = $file->Create('new_file', $user->id(), $id_word, $id_rewrite);
        $error = '';
        switch ($result) {
            case 1:
                $error = lng('UPLOAD_FAIL') . '. ( ' . lng('UPLOAD_FORMATS') . ' - jpg, png, zip, rar, exe, jar, pdf, doc, txt )';
                break;
            case 3:
                $error = lng('INCORRECT') . '. (' . lng('TXT_ID') . ')';
                break;
            case 4:
                $error = lng('TXT_ID_EXIST');
                break;
            case 2:
            case 5:
                $error = lng('UPLOAD_FAIL');
                break;
Example #3
0
         $imgdst = imagecreatetruecolor(39, 39);
         $ratio = min($srcw / $dstw, $srch / $dsth);
         $smside = min($srcw, $srch);
         $srcx = ($srcw - $smside) / 2;
         $srcy = ($srch - $smside) / 2;
         imagecopyresampled($imgdst, $imgsrc, 0, 0, $srcx, $srcy, $dstw, $dsth, $smside, $smside);
         imagepng($imgsrc, "{$ROOT}/{$fullname}");
         imagepng($imgdst, $tmpname);
         imagedestroy($imgsrc);
         imagedestroy($imgdst);
     }
     if (!file_exists("{$ROOT}/{$upload_dir}")) {
         mkdir("{$ROOT}/{$upload_dir}");
     }
     $fileCfg = array('name' => $params['name'], 'path' => $upload_path, 'owner' => $id, 'roles' => 'admin', 'type' => $ext, 'context' => $params['type'], 'comment' => $params['comment']);
     $res = File::Create($fileCfg, $tmpname);
     if ($res && User::SetAttrib($id, 'file', $res)) {
         if ($params['type'] == 1) {
             Error::generate('notice', 'File was successfully uploaded, and is pending approval by an administrator.');
         } else {
             Error::generate('notice', 'Your avatar has been updated.');
         }
     } else {
         Error::generate('notice', 'Could not upload file.', Error::$FLAGS['single']);
     }
     if (isset($_SESSION) && $_SESSION['last_rendered_page']) {
         redirect_raw($_SESSION['last_rendered_page']);
     } else {
         redirect();
     }
 }
Example #4
0
 public static function SetLogFile($filename)
 {
     self::$logfile = $filename;
     File::Create(self::$logfile);
 }