Exemplo n.º 1
0
    // add back link to module menu
    $profilePhotoMenu = $page->getMenu();
    $profilePhotoMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
    // show form
    $form = new HtmlForm('upload_files_form', $g_root_path . '/adm_program/modules/inventory/item_photo_edit.php?mode=upload&inv_id=' . $getItemId, $page, array('enableFileUpload' => true));
    $form->addCustomContent($gL10n->get('PRO_CURRENT_PICTURE'), '<img class="imageFrame" src="item_photo_show.php?inv_id=' . $getItemId . '" alt="' . $gL10n->get('PRO_CURRENT_PICTURE') . '" />');
    $form->addFileUpload('userfile', $gL10n->get('PRO_CHOOSE_PHOTO'), array('helpTextIdLabel' => 'profile_photo_up_help'));
    $form->addSubmitButton('btn_upload', $gL10n->get('PRO_UPLOAD_PHOTO'), array('icon' => THEME_PATH . '/icons/photo_upload.png', 'class' => ' col-sm-offset-3'));
    // add form to html page and show page
    $page->addHtml($form->show(false));
    $page->show();
} elseif ($getMode == 'upload') {
    /*****************************Foto zwischenspeichern bestaetigen***********************************/
    //Dateigroesse
    if ($_FILES['userfile']['error'][0] == 1) {
        $gMessage->show($gL10n->get('PRO_PHOTO_FILE_TO_LARGE', round(admFuncMaxUploadSize() / pow(1024, 2))));
    }
    //Kontrolle ob Fotos ausgewaehlt wurden
    if (file_exists($_FILES['userfile']['tmp_name'][0]) == false) {
        $gMessage->show($gL10n->get('PRO_PHOTO_NOT_CHOOSEN'));
    }
    //Dateiendung
    $image_properties = getimagesize($_FILES['userfile']['tmp_name'][0]);
    if ($image_properties['mime'] != 'image/jpeg' && $image_properties['mime'] != 'image/png') {
        $gMessage->show($gL10n->get('PRO_PHOTO_FORMAT_INVALID'));
    }
    //Auflösungskontrolle
    $image_dimensions = $image_properties[0] * $image_properties[1];
    if ($image_dimensions > admFuncProcessableImageSize()) {
        $gMessage->show($gL10n->get('PRO_PHOTO_RESOLUTION_TO_LARGE', round(admFuncProcessableImageSize() / 1000000, 2)));
    }
Exemplo n.º 2
0
 public static function getMaxAttachementSize($size_unit = 'kb')
 {
     global $gPreferences;
     if (round(admFuncMaxUploadSize() / pow(1024, 1), 1) < $gPreferences['max_email_attachment_size']) {
         $attachment_size = round(admFuncMaxUploadSize() / pow(1024, 1), 2);
     } else {
         $attachment_size = $gPreferences['max_email_attachment_size'];
     }
     if ($size_unit == 'mb') {
         $attachment_size = $attachment_size / 1024;
     } elseif ($size_unit == 'b') {
         $attachment_size = $attachment_size * 1024;
     }
     return round($attachment_size, 2);
 }
Exemplo n.º 3
0
 /**
  * Returns the maximum size of an attachment
  * @param  string $sizeUnit 'b' = byte, 'kib' = kilobyte, 'mib' = megabyte, 'gib' = gigabyte, 'tib' = terabyte
  * @return float  The maximum attachment size in the given size-unit
  */
 public static function getMaxAttachementSize($sizeUnit = 'mib')
 {
     global $gPreferences;
     $maxUploadSize = admFuncMaxUploadSize();
     $currentAttachmentSize = $gPreferences['max_email_attachment_size'] * pow(1024, 2);
     if ($maxUploadSize < $currentAttachmentSize) {
         $attachmentSize = $maxUploadSize;
     } else {
         $attachmentSize = $currentAttachmentSize;
     }
     switch ($sizeUnit) {
         case 'tib':
             $attachmentSize /= 1024;
         case 'gib':
             $attachmentSize /= 1024;
         case 'mib':
             $attachmentSize /= 1024;
         case 'kib':
             $attachmentSize /= 1024;
         default:
     }
     return round($attachmentSize, 1);
 }
Exemplo n.º 4
0
                     <td><b>' . $gL10n->get('SYS_COUNTRY_EG') . '</b></td>
                     <td>' . $gL10n->get('LST_COUNTRY_ISO') . '</td>
                 </tr>
             </tbody>
         </table>';
     break;
     // Profil
 // Profil
 case 'profile_photo_up_help':
     echo '
         <h3>' . $gL10n->get('SYS_RESTRICTIONS') . '</h3>
         <ul>
             <li>' . $gL10n->get('PRO_RESTRICTIONS_HELP_1') . '</li>
             <li>' . $gL10n->get('PRO_RESTRICTIONS_HELP_2') . '</li>
             <li>' . $gL10n->get('PRO_RESTRICTIONS_HELP_3', round(admFuncProcessableImageSize() / 1000000, 2)) . '</li>
             <li>' . $gL10n->get('PRO_RESTRICTIONS_HELP_4', round(admFuncMaxUploadSize() / pow(1024, 2), 2)) . '</li>
         </ul>';
     break;
 default:
     // im Standardfall wird mit der ID der Text aus der Sprachdatei gelesen
     // falls die Textvariable gefuellt ist, pruefen ob dies auch eine ID aus der Sprachdatei ist
     $msg_var1 = '';
     if ($getMessageVar1 !== '') {
         if (strpos($getMessageVar1, '_') === 3) {
             $msg_var1 = $gL10n->get($getMessageVar1);
         } else {
             $msg_var1 = $getMessageVar1;
         }
     }
     echo $gL10n->get(strtoupper($getMessageId), $msg_var1);
     break;