コード例 #1
0
ファイル: tablephotos.php プロジェクト: bash-t/admidio
 public function createFolder()
 {
     $error = array('code' => '0', 'text' => '');
     // Pfad in adm_my_files pruefen und ggf. anlegen
     $myFilesPhotos = new MyFiles('PHOTOS');
     if ($myFilesPhotos->checkSettings() == false) {
         $error['text'] = $myFilesPhotos->errorText;
         $error['path'] = $myFilesPhotos->errorPath;
         return $error;
     }
     // nun den Ordner fuer die Veranstaltung anlegen
     $folderName = $this->getValue('pho_begin', 'Y-m-d') . '_' . $this->getValue('pho_id');
     if ($myFilesPhotos->createFolder($folderName, true) == false) {
         $error['text'] = 'SYS_FOLDER_NOT_CREATED';
         $error['path'] = 'adm_my_files/photos/' . $folderName;
     }
     return $error;
 }
コード例 #2
0
ファイル: item_photo_edit.php プロジェクト: bash-t/admidio
// in ajax mode only return simple text on error
if ($getMode == 'delete') {
    $gMessage->showHtmlTextOnly(true);
}
// checks if the server settings for file_upload are set to ON
if (ini_get('file_uploads') != '1') {
    $gMessage->show($gL10n->get('SYS_SERVER_NO_UPLOAD'));
}
// read user data and show error if user doesn't exists
$gInventoryFields = new InventoryFields($gDb, $gCurrentOrganization->getValue('org_id'));
$inventory = new Inventory($gDb, $gInventoryFields, $getItemId);
// bei Ordnerspeicherung pruefen ob der Unterordner in adm_my_files mit entsprechenden Rechten existiert
if ($gPreferences['profile_photo_storage'] == 1) {
    // ggf. Ordner für Userfotos in adm_my_files anlegen
    $myFilesProfilePhotos = new MyFiles('USER_PROFILE_PHOTOS');
    if ($myFilesProfilePhotos->checkSettings() == false) {
        $gMessage->show($gL10n->get($myFilesProfilePhotos->errorText, $myFilesProfilePhotos->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>'));
    }
}
if ($inventory->getValue('inv_id') == 0) {
    $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW'));
}
if ($getMode == 'save') {
    /*****************************Foto speichern*************************************/
    if ($gPreferences['profile_photo_storage'] == 1) {
        // Foto im Dateisystem speichern
        //Nachsehen ob fuer den User ein Photo gespeichert war
        if (file_exists(SERVER_PATH . '/adm_my_files/item_photos/' . $getItemId . '_new.jpg')) {
            if (file_exists(SERVER_PATH . '/adm_my_files/item_photos/' . $getItemId . '.jpg')) {
                unlink(SERVER_PATH . '/adm_my_files/item_photos/' . $getItemId . '.jpg');
            }
コード例 #3
0
         break;
         //ptabaden change plugins
     //ptabaden change plugins
     case 'hist_description':
         $folderName = 'history';
         break;
     case 'support_description':
         $folderName = 'support';
         break;
     case 'sts_description':
         $folderName = 'sts';
         break;
 }
 // set path to module folder in adm_my_files
 $myFilesProfilePhotos = new MyFiles($folderName);
 if ($myFilesProfilePhotos->checkSettings()) {
     // upload photo to images folder of module folder
     if ($myFilesProfilePhotos->setSubFolder('images')) {
         // create a filename with the unix timestamp,
         // so we have a scheme for the filenames and the risk of duplicates is low
         $localFile = time() . substr($_FILES['upload']['name'], strrpos($_FILES['upload']['name'], '.'));
         $serverUrl = $myFilesProfilePhotos->getServerPath() . '/' . $localFile;
         if (file_exists($serverUrl)) {
             // if file exists than create a random number and append it to the filename
             $serverUrl = $myFilesProfilePhotos->getServerPath() . '/' . substr($localFile, 0, strrpos($localFile, '.')) . '_' . rand() . substr($localFile, strrpos($localFile, '.'));
         }
         $htmlUrl = $g_root_path . '/adm_program/system/show_image.php?module=' . $folderName . '&file=' . $localFile;
         move_uploaded_file($_FILES['upload']['tmp_name'], $serverUrl);
     } else {
         $message = strStripTags($gL10n->get($myFilesProfilePhotos->errorText, $myFilesProfilePhotos->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>'));
     }
コード例 #4
0
ファイル: backup.php プロジェクト: martinbrylski/admidio
 *****************************************************************************/
require_once '../../system/common.php';
require_once 'backup.functions.php';
// Initialize and check the parameters
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('defaultValue' => 'show_list', 'validValues' => array('show_list', 'create_backup')));
// only webmaster are allowed to start backup
if (!$gCurrentUser->isWebmaster()) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// module not available for other databases except MySQL
if ($gDbType !== 'mysql') {
    $gMessage->show($gL10n->get('BAC_ONLY_MYSQL'));
}
// check backup path in adm_my_files and create it if necessary
$myFilesBackup = new MyFiles('BACKUP');
if (!$myFilesBackup->checkSettings()) {
    $gMessage->show($gL10n->get($myFilesBackup->errorText, $myFilesBackup->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>'));
}
$headline = $gL10n->get('BAC_DATABASE_BACKUP');
// create html page object
$page = new HtmlPage($headline);
$page->enableModal();
$backupabsolutepath = $myFilesBackup->getFolder() . '/';
// make sure to include trailing slash
if ($getMode === 'show_list') {
    $existingBackupFiles = array();
    // start navigation of this module here
    $gNavigation->addStartUrl(CURRENT_URL, $headline);
    // create a list with all valid files in the backup folder
    if ($handle = opendir($backupabsolutepath)) {
        while (false !== ($file = readdir($handle))) {
コード例 #5
0
ファイル: download_function.php プロジェクト: bash-t/admidio
    // das Modul ist deaktiviert
    $gMessage->show($gL10n->get('SYS_MODULE_DISABLED'));
}
// erst pruefen, ob der User auch die entsprechenden Rechte hat
if (!$gCurrentUser->editDownloadRight()) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// Initialize and check the parameters
$getMode = admFuncVariableIsValid($_GET, 'mode', 'numeric', array('requireValue' => true));
$getFolderId = admFuncVariableIsValid($_GET, 'folder_id', 'numeric');
$getFileId = admFuncVariableIsValid($_GET, 'file_id', 'numeric');
$getName = admFuncVariableIsValid($_GET, 'name', 'string');
$_SESSION['download_request'] = $_POST;
// Pfad in adm_my_files pruefen und ggf. anlegen
$myFilesDownload = new MyFiles('DOWNLOAD');
if ($myFilesDownload->checkSettings() == false) {
    $gMessage->show($gL10n->get($myFilesDownload->errorText, $myFilesDownload->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>'));
}
// upload files
if ($getMode == 1) {
    if ($getFolderId == 0) {
        //FolderId ist zum hochladen erforderlich
        $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW'));
    }
    try {
        // get recordset of current folder from database and throw exception if necessary
        $targetFolder = new TableFolder($gDb);
        $targetFolder->getFolderForDownload($getFolderId);
        if (strlen($_FILES['userfile']['name'][0]) == 0) {
            $gMessage->show($gL10n->get('DOW_UPLOAD_POST_EMPTY', ini_get('upload_max_filesize')));
        }
コード例 #6
0
    // das Modul ist deaktiviert
    $gMessage->show($gL10n->get('SYS_MODULE_DISABLED'));
}
// erst pruefen, ob der User auch die entsprechenden Rechte hat
if (!$gCurrentUser->editDownloadRight()) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// Initialize and check the parameters
$getMode = admFuncVariableIsValid($_GET, 'mode', 'numeric', array('requireValue' => true));
$getFolderId = admFuncVariableIsValid($_GET, 'folder_id', 'numeric');
$getFileId = admFuncVariableIsValid($_GET, 'file_id', 'numeric');
$getName = admFuncVariableIsValid($_GET, 'name', 'file');
$_SESSION['download_request'] = $_POST;
// Pfad in adm_my_files pruefen und ggf. anlegen
$myFilesDownload = new MyFiles('DOWNLOAD');
if (!$myFilesDownload->checkSettings()) {
    $gMessage->show($gL10n->get($myFilesDownload->errorText, $myFilesDownload->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>'));
}
// Delete file
if ($getMode === 2) {
    if ($getFileId > 0) {
        try {
            // get recordset of current file from databse
            $file = new TableFile($gDb);
            $file->getFileForDownload($getFileId);
        } catch (AdmException $e) {
            $e->showText();
        }
        if ($file->delete()) {
            // Loeschen erfolgreich -> Rueckgabe fuer XMLHttpRequest
            echo 'done';
コード例 #7
0
ファイル: backup.php プロジェクト: bash-t/admidio
 *****************************************************************************/
require_once '../../system/common.php';
require_once 'backup.functions.php';
// Initialize and check the parameters
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('defaultValue' => 'show_list', 'validValues' => array('show_list', 'create_backup')));
// only webmaster are allowed to start backup
if ($gCurrentUser->isWebmaster() == false) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// module not available for other databases except MySQL
if ($gDbType != 'mysql') {
    $gMessage->show($gL10n->get('BAC_ONLY_MYSQL'));
}
// check backup path in adm_my_files and create it if necessary
$myFilesBackup = new MyFiles('BACKUP');
if ($myFilesBackup->checkSettings() == false) {
    $gMessage->show($gL10n->get($myFilesBackup->errorText, $myFilesBackup->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>'));
}
$headline = $gL10n->get('BAC_DATABASE_BACKUP');
// create html page object
$page = new HtmlPage($headline);
$backupabsolutepath = $myFilesBackup->getFolder() . '/';
// make sure to include trailing slash
if ($getMode == 'show_list') {
    $existingBackupFiles = array();
    // start navigation of this module here
    $gNavigation->addStartUrl(CURRENT_URL, $headline);
    // create a list with all valid files in the backup folder
    if ($handle = opendir($backupabsolutepath)) {
        while (false !== ($file = readdir($handle))) {
            try {