Пример #1
0
        }
        // Is this a valid image?
        $strExtension = $CMS->GetExtensionFromPath($FU->GetDBFilePath());
        if (strtoupper($strExtension) != "JPG" && strtoupper($strExtension) != "PNG") {
            $blnSubmitForm = false;
            $strFileError = $CMS->Err_MWarn(M_ERR_UPLOAD_NOT_IMAGE, $FU->GetDBFilePath());
        }
    }
    if ($blnSubmitForm) {
        // Upload file
        $FU->Submit($_FILES['txtFile']['tmp_name']);
        if ($FU->IsError()) {
            $CMS->Err_MFail($FU->GetErrorDesc(), $FU->GetErrorInfo());
        }
        // Make thumbnails
        $FU->DoThumbs("");
        $strWarnings = $FU->GetWarnings();
        // Write to DB
        $dteCreated = $CMS->SYS->GetCurrentDateAndTime();
        $intFileID = $CMS->FL->Create($FU->GetDBAvatarThumb(), $intUserID, $dteCreated, "Avatar", "", "Y", "N", "", "");
        // Set avatar
        $CMS->Query("UPDATE {IFW_TBL_USERS} SET avatar_id = {$intFileID} WHERE id = {$intUserID}", basename(__FILE__), __LINE__);
        $CMS->SYS->CreateAccessLog("Set avatar (File ID: {$intFileID})", AL_TAG_AVATAR_SET, $intUserID);
        // Confirmation page
        $strHTML = "<h1>{$strPageTitle}</h1>\n\n<p>The file was uploaded and set as your avatar. <a href=\"{FN_ADM_MANAGE_AVATARS}\">Manage Avatars</a></p>";
        $CMS->AP->SetTitle($strPageTitle .= " - Results");
        $CMS->AP->Display($strHTML);
    }
}
// NO POST //
$strSubmitButton = $CMS->AC->Submit(M_BTN_UPLOAD_AVATAR);
Пример #2
0
 // Process file attachment
 if ($blnHasAttachment) {
     // If there's an existing attachment and a new one is being uploaded, delete previous version
     if ($blnExistingAttachment && $_FILES['txtFile']['name']) {
         $strWarnings = $CMS->FL->UnlinkAll($intFileID);
     }
     // Upload file
     if ($FU->IsFileUpload()) {
         $FU->Submit($_FILES['txtFile']['tmp_name']);
         if ($FU->IsError()) {
             $CMS->Err_MFail($FU->GetErrorDesc(), $FU->GetErrorInfo());
         }
     }
     // Make thumbnails
     if ($blnExistingAttachment) {
         $FU->DoThumbs($intFileID);
     } else {
         $FU->DoThumbs("");
     }
     $strWarnings .= $FU->GetWarnings();
 }
 // Prepare content for database
 $CMS->AP->SetTitle($strPageTitle . " - Results");
 $strReadMoreEditor = $CMS->AddSlashesIFW($CMS->AC->ReadMoreEditor());
 $strReadMorePublic = $CMS->AddSlashesIFW($CMS->AC->ReadMorePublic());
 if (strpos($strContBody, $strReadMoreEditor) !== false) {
     $strReadMorePublic = str_replace("<", "{" . ZZZ_TEMP, $strReadMorePublic);
     $strReadMorePublic = str_replace(">", ZZZ_TEMP . "}", $strReadMorePublic);
     $strContBody = str_replace($strReadMoreEditor, $strReadMorePublic, $strContBody);
 }
 $strContBody = strip_tags($strContBody, C_ARTICLE_TAGS);