public static function putGbbq($file, $data)
 {
     if (empty($data)) {
         return false;
     }
     return parent::putAllData($file, $data);
 }
 /**
  * Override the default method to handle the specific things of the download module and
  * update the database after file was successful uploaded.
  * This method has the same parameters as the default.
  * @param  $uploaded_file
  * @param  $name
  * @param  $size
  * @param  $type
  * @param  $error
  * @param  $index
  * @param  $content_range
  * @return stdClass
  */
 protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
 {
     global $gPreferences, $gL10n, $gDb, $getId, $gCurrentOrganization, $gCurrentUser;
     $file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
     if (!isset($file->error)) {
         try {
             // check filesize against module settings
             if ($file->size > $gPreferences['max_file_upload_size'] * 1024 * 1024) {
                 throw new AdmException('DOW_FILE_TO_LARGE', $gPreferences['max_file_upload_size']);
             }
             // check filename and throw exception if something is wrong
             admStrIsValidFileName($file->name, true);
             // get recordset of current folder from database and throw exception if necessary
             $targetFolder = new TableFolder($gDb);
             $targetFolder->getFolderForDownload($getId);
             // now add new file to database
             $newFile = new TableFile($gDb);
             $newFile->setValue('fil_fol_id', $targetFolder->getValue('fol_id'));
             $newFile->setValue('fil_name', $file->name);
             $newFile->setValue('fil_locked', $targetFolder->getValue('fol_locked'));
             $newFile->setValue('fil_counter', '0');
             $newFile->save();
             // Benachrichtigungs-Email für neue Einträge
             $message = $gL10n->get('DOW_EMAIL_NOTIFICATION_MESSAGE', $gCurrentOrganization->getValue('org_longname'), $file->name, $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'), date($gPreferences['system_date'], time()));
             $notification = new Email();
             $notification->adminNotfication($gL10n->get('DOW_EMAIL_NOTIFICATION_TITLE'), $message, $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'), $gCurrentUser->getValue('EMAIL'));
         } catch (AdmException $e) {
             $file->error = $e->getText();
             unlink($this->options['upload_dir'] . $file->name);
             return $file;
         }
     }
     return $file;
 }
예제 #3
0
 public static function getPurposeList()
 {
     $purpose = array();
     if (($d1 = opendir(TASK_PATH)) == false) {
         return $purpose;
     }
     while (($d2 = readdir($d1)) !== false) {
         if (!is_dir(TASK_PATH . $d2) || $d2 == "." || $d2 == "..") {
             continue;
         }
         $p = TASK_PATH . $d2 . "/";
         $f = $p . "SUMMARY.txt";
         if (!file_exists($f)) {
             continue;
         }
         $sd = TableFile::getAllData($f);
         if (!$sd) {
             continue;
         }
         $l = array();
         foreach ($sd as $d) {
             if ($d['aim'] != self::$aim) {
                 continue;
             }
             $f = $p . 'data/' . $d['table'];
             if (file_exists($f)) {
                 $l[] = array('table' => $d['table'], 'info' => $d['info'], 'url' => Url::getBasePhp('Sheet') . '?task=' . $d2 . '&table=' . $d['table'] . '&info=' . $d['info']);
             }
         }
         if ($l) {
             $f = $p . "README.txt";
             $re = array();
             if (file_exists($f)) {
                 $re = BaseFile::getFileContent($f);
                 $re = explode("\r\n", $re);
             }
             $purpose[ucfirst($d2)] = array('readme' => $re, 'list' => $l);
         }
     }
     return $purpose;
 }
예제 #4
0
파일: rename.php 프로젝트: bash-t/admidio
    //Es muss entweder eine FileID ODER eine FolderId uebergeben werden
    //beides ist auch nicht erlaubt
    $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW'));
}
$gNavigation->addUrl(CURRENT_URL, $headline);
if (isset($_SESSION['download_request'])) {
    $form_values = strStripSlashesDeep($_SESSION['download_request']);
    unset($_SESSION['download_request']);
} else {
    $form_values['new_name'] = null;
    $form_values['new_description'] = null;
}
try {
    if ($getFileId) {
        // get recordset of current file from databse
        $file = new TableFile($gDb);
        $file->getFileForDownload($getFileId);
        $originalName = $file->getValue('fil_name');
        if ($form_values['new_name'] == null) {
            $form_values['new_name'] = admFuncGetFilenameWithoutExtension($originalName);
        }
        if ($form_values['new_description'] == null) {
            $form_values['new_description'] = $file->getValue('fil_description');
        }
    } else {
        // get recordset of current folder from databses
        $folder = new TableFolder($gDb);
        $folder->getFolderForDownload($getFolderId);
        $originalName = $folder->getValue('fol_name');
        if ($form_values['new_name'] == null) {
            $form_values['new_name'] = $originalName;
예제 #5
0
 // nun alle relevanten Downloads finden
 $sql = 'SELECT fil_timestamp, fil_name, fil_usr_id, fol_name, fol_path, fil_id, fil_fol_id
           FROM ' . TBL_FILES . ', ' . TBL_FOLDERS . '
          WHERE fil_fol_id = fol_id
          ORDER BY fil_timestamp DESC';
 $filesStatement = $gDb->query($sql);
 if ($filesStatement->rowCount() > 0) {
     $anzahl = 0;
     while ($plg_row = $filesStatement->fetchObject()) {
         $errorCode = '';
         $html = '';
         $timestampHtml = '';
         echo '<div class="btn-group-vertical" role="group">';
         try {
             // get recordset of current file from databse
             $file = new TableFile($gDb);
             $file->getFileForDownload($plg_row->fil_id);
         } catch (AdmException $e) {
             $errorCode = $e->getMessage();
             if ($errorCode !== 'DOW_FOLDER_NO_RIGHTS') {
                 $e->showText();
             }
         }
         // only show download if user has rights to view folder
         if ($errorCode !== 'DOW_FOLDER_NO_RIGHTS') {
             // Ermittlung der Dateiendung
             $fileExtension = mb_strtolower(substr($plg_row->fil_name, strrpos($plg_row->fil_name, '.') + 1), 'UTF-8');
             // Auszugebendes Icon ermitteln
             $iconFile = 'page_white_question.png';
             if (array_key_exists($fileExtension, $icon_file_extension)) {
                 $iconFile = $icon_file_extension[$fileExtension];
예제 #6
0
파일: get_file.php 프로젝트: bash-t/admidio
require '../../system/common.php';
// Initialize and check the parameters
$getFileId = admFuncVariableIsValid($_GET, 'file_id', 'numeric', array('requireValue' => true));
//pruefen ob das Modul ueberhaupt aktiviert ist
if ($gPreferences['enable_download_module'] != 1) {
    // das Modul ist deaktiviert
    $gMessage->show($gL10n->get('SYS_MODULE_DISABLED'));
}
//nur von eigentlicher OragHompage erreichbar
if ($gCurrentOrganization->getValue('org_shortname') != $g_organization) {
    // das Modul ist deaktiviert
    $gMessage->show($gL10n->get('SYS_MODULE_ACCESS_FROM_HOMEPAGE_ONLY', $g_organization));
}
try {
    // get recordset of current file from databse
    $file = new TableFile($gDb);
    $file->getFileForDownload($getFileId);
} catch (AdmException $e) {
    $e->showHtml();
}
//kompletten Pfad der Datei holen
$completePath = $file->getCompletePathOfFile();
//pruefen ob File ueberhaupt physikalisch existiert
if (!file_exists($completePath)) {
    $gMessage->show($gL10n->get('SYS_FILE_NOT_EXIST'));
}
//Downloadcounter inkrementieren
$file->setValue('fil_counter', $file->getValue('fil_counter') + 1);
$file->save();
//Dateigroese ermitteln
$fileSize = filesize($completePath);
예제 #7
0
    // Es muss entweder eine FileID ODER eine FolderId uebergeben werden
    // beides ist auch nicht erlaubt
    $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW'));
}
$gNavigation->addUrl(CURRENT_URL, $headline);
if (isset($_SESSION['download_request'])) {
    $form_values = strStripSlashesDeep($_SESSION['download_request']);
    unset($_SESSION['download_request']);
} else {
    $form_values['new_name'] = null;
    $form_values['new_description'] = null;
}
try {
    if ($getFileId) {
        // get recordset of current file from database
        $file = new TableFile($gDb);
        $file->getFileForDownload($getFileId);
        $originalName = pathinfo($file->getValue('fil_name'), PATHINFO_FILENAME);
        $fileType = pathinfo($file->getValue('fil_name'), PATHINFO_EXTENSION);
        if ($form_values['new_name'] === null) {
            $form_values['new_name'] = $originalName;
        }
        if ($form_values['new_description'] === null) {
            $form_values['new_description'] = $file->getValue('fil_description');
        }
    } else {
        // get recordset of current folder from databases
        $folder = new TableFolder($gDb);
        $folder->getFolderForDownload($getFolderId);
        $originalName = $folder->getValue('fol_name');
        if ($form_values['new_name'] == null) {
예제 #8
0
 public static function _getRefer($file)
 {
     $refer = array();
     if (!file_exists($file)) {
         return $refer;
     }
     $refer = parent::getAllData($file);
     return $refer;
 }
예제 #9
0
 }
 try {
     // check filename and throw exception if something is wrong
     if (admStrIsValidFileName(urldecode($getName), true)) {
         $getName = urldecode($getName);
         // get recordset of current folder from databse
         $targetFolder = new TableFolder($gDb);
         $targetFolder->getFolderForDownload($getFolderId);
     }
 } catch (AdmException $e) {
     $e->showHtml();
 }
 //Pruefen ob das neue Element eine Datei order ein Ordner ist.
 if (is_file($targetFolder->getCompletePathOfFolder() . '/' . $getName)) {
     //Datei hinzufuegen
     $newFile = new TableFile($gDb);
     $newFile->setValue('fil_fol_id', $targetFolder->getValue('fol_id'));
     $newFile->setValue('fil_name', $getName);
     $newFile->setValue('fil_locked', $targetFolder->getValue('fol_locked'));
     $newFile->setValue('fil_counter', '0');
     $newFile->save();
     //Zurueck zur letzten Seite
     $gNavigation->addUrl(CURRENT_URL);
     $location = 'Location: ' . $g_root_path . '/adm_program/system/back.php';
     header($location);
     exit;
 } elseif (is_dir($targetFolder->getCompletePathOfFolder() . '/' . $getName)) {
     //Ordner der DB hinzufuegen
     $newFolder = new TableFolder($gDb);
     $newFolder->setValue('fol_fol_id_parent', $targetFolder->getValue('fol_id'));
     $newFolder->setValue('fol_type', 'DOWNLOAD');
예제 #10
0
 public static function importOnce()
 {
     $dir = dir('D:\\wamp\\www\\ForeShadowAlpha\\data\\tmp');
     $filelist = array();
     while (($file = $dir->read()) !== false) {
         if (substr($file, 0, 3) == 'ths') {
             //echo "filename: " . $file . "<br />";
             $filelist[] = $file;
         }
     }
     $dir->close();
     sort($filelist);
     //print_r($filelist);
     //echo '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title></title></head><body>';
     //$i = 1;
     foreach ($filelist as $file) {
         //if ( --$i < 0 ) exit(0);
         //echo "filename: " . $file . "<br />";
         $content = DataFile::getFileContent('D:\\wamp\\www\\ForeShadowAlpha\\data\\tmp/' . $file);
         //echo $content;
         $rows = explode("\n\r", $content);
         if (!$file) {
             continue;
         }
         foreach ($rows as $row) {
             if (!$row) {
                 continue;
             }
             $lie = explode('|', $row);
             //get Code
             $r = "/[0-9]{6}/";
             preg_match($r, $lie[0], $code);
             //echo $lie[0] . $code[0];
             $c = $code[0];
             $r = substr($code[0], 0, 1);
             if ($r == '6') {
                 $code = 'sh' . $c;
             } else {
                 if ($r == '0') {
                     $code = 'sz' . $c;
                 } else {
                     if ($r == '3') {
                         $code = 'sz' . $c;
                     }
                 }
             }
             //echo $code . "<br />";
             $thsPath = 'D:\\wamp\\www\\ForeShadowAlpha\\data\\thsdoctor/';
             $thsFile = $thsPath . $code . '.txt';
             echo $thsFile . "<br />";
             $thsRow = array();
             //time
             $r = "/[0-9.]+/";
             preg_match_all($r, $lie[3], $k);
             //if (sizeof($k) < 5 ) continue;
             $t = $k[0][0] . '-' . $k[0][1] . '-' . $k[0][2];
             //echo $t. "<br />";
             //echo $k[0][3]. "<br />";
             $thsRow['time'] = $t;
             $thsRow['hour'] = $k[0][3] . ':' . $k[0][4];
             //total
             $r = "/([0-9.]+)分/";
             preg_match($r, $lie[2], $k);
             //echo $k[0].'--'.$k[1]."<br />";
             $thsRow['total_score'] = $k[1];
             $thsRow['total_text'] = $lie[13];
             //shot_trend
             $thsRow['shot_trend'] = $lie[5];
             //mid_trend
             $thsRow['mid_trend'] = $lie[6];
             //long_trend
             $thsRow['long_trend'] = $lie[7];
             //technical
             $r = "/([0-9.]+)/";
             preg_match($r, $lie[8], $k);
             $thsRow['technical_score'] = $k[0];
             //echo $k[0]."<br />";
             $k = trim($lie[8]);
             $kk = preg_split('/\\s/', $k, -1, PREG_SPLIT_NO_EMPTY);
             $thsRow['technical_text'] = end($kk);
             //funds
             $r = "/([0-9.]+)/";
             preg_match($r, $lie[9], $k);
             $thsRow['funds_score'] = $k[0];
             //echo $k[0]."<br />";
             $k = trim($lie[9]);
             $kk = preg_split('/\\s/', $k, -1, PREG_SPLIT_NO_EMPTY);
             $thsRow['funds_text'] = end($kk);
             //message
             $r = "/([0-9.]+)/";
             preg_match($r, $lie[10], $k);
             $thsRow['message_score'] = $k[0];
             //echo $k[0]."<br />";
             $k = trim($lie[10]);
             $kk = preg_split('/\\s/', $k, -1, PREG_SPLIT_NO_EMPTY);
             $thsRow['message_text'] = end($kk);
             //trade
             $r = "/([0-9.]+)/";
             preg_match($r, $lie[11], $k);
             $thsRow['trade_score'] = $k[0];
             //echo $k[0]."<br />";
             $k = trim($lie[11]);
             $kk = preg_split('/\\s/', $k, -1, PREG_SPLIT_NO_EMPTY);
             $thsRow['trade_text'] = end($kk);
             //basic
             $r = "/([0-9.]+)/";
             preg_match($r, $lie[12], $k);
             $thsRow['basic_score'] = $k[0];
             //echo $k[0]."<br />";
             $k = trim($lie[12]);
             $kk = preg_split('/\\s/', $k, -1, PREG_SPLIT_NO_EMPTY);
             $thsRow['basic_text'] = end($kk);
             //print_r($thsRow);
             //echo "<br />";
             TableFile::putSomeData($thsFile, array($thsRow));
         }
     }
 }
예제 #11
0
 public static function appendTable($file, $data)
 {
     if (file_exists($file)) {
         $l = filemtime($file);
         $l = Date("ymdHis", $l);
         if (substr($file, strlen($file) - 4) == ".txt") {
             $bakF = substr($file, 0, strlen($file) - 3) . $l . ".txt";
         } else {
             $bakF = $file . "." . $l . ".txt";
         }
         rename($file, $bakF);
         copy($bakF, $file);
     }
     return TableFile::putSomeData($file, $data);
 }
 public function _getData($file)
 {
     $this->_innerData = TableFile::getAllData($file);
     return $this->_innerData;
 }