Esempio n. 1
0
?>
 class='ufo-formvalue ufo-customform-fieldform-fieldset-cb' onchange='this.value=(this.checked)?"on":"off";'/></div><div><label for='AttachToNotification'><?php 
echo EasyContactFormsT::get('CF_AttachToNotification');
?>
<span id='AttachToNotificationHin' class='ufo-settingsform-label-hint ufo-label-hint ufo-id-link'>[<a>?</a>]</span></label><input type='hidden' id='AttachToNotificationHint' value='<?php 
echo EasyContactFormsT::get('CF_Hint_AttachToNotification');
?>
' class='ufo-id-link'/><input type='checkbox' id='AttachToNotification' value='<?php 
echo isset($AttachToNotification) && $AttachToNotification == 'on' ? 'on' : 'off';
?>
' <?php 
echo isset($AttachToNotification) && $AttachToNotification == 'on' ? 'checked' : '';
?>
 class='ufo-formvalue ufo-customform-fieldform-fieldset-cb' onchange='this.value=(this.checked)?"on":"off";'/></div><?php 
if (!is_dir(EASYCONTACTFORMS__fileUploadDir)) {
    EasyContactFormsUtils::createFolder(EASYCONTACTFORMS__fileUploadDir);
    $as = EasyContactFormsApplicationSettings::getInstance();
    $as->showMessages();
}
?>
</div></div><div id='ufo-customform-settings-showlabel-fieldset' class='ufo-customform-fieldform-fieldset ufo-id-link'><div class='ufo-customform-fieldform-fieldset-legend'><span id='ufo-customform-settings-showlabel-expander' class='ufo-customform-fieldform-fieldset-expander ufo-id-link' onclick='ufoCf.expanderClick(this.id, "ufo-customform-settings-showlabel");'>&nbsp;</span><input type='hidden' id='ShowLabelHint' value='<?php 
echo EasyContactFormsT::get('CF_Hint_ShowLabel');
?>
' class='ufo-id-link'/><div><input type='checkbox' id='ShowLabel' value='<?php 
echo isset($ShowLabel) && $ShowLabel == 'on' ? 'on' : 'off';
?>
' <?php 
echo isset($ShowLabel) && $ShowLabel == 'on' ? 'checked' : '';
?>
 class='ufo-formvalue ufo-customform-fieldform-fieldset-cb' onchange='this.value=(this.checked)?"on":"off";'/><label for='ShowLabel' style='width:auto;font-family:Arial;clear:none;display:inline;margin:0;float:none;font-size:12px;padding:0;line-height:16px'><?php 
echo EasyContactFormsT::get('CF_ShowLabel');
 /**
  * 	webdirUpload
  *
  * 	takes a file from a temporary folder, registers it in the file
  * 	manager
  * 	places the file to a web directory for direct download and makes a
  * 	thumbnail
  * 	copy if it is necessary
  *
  * @param array $_uldmap
  * 	request data
  */
 function webdirUpload($_uldmap)
 {
     $filerequestid = $_uldmap['t'] . '_' . $_uldmap['fld'] . '_' . $_uldmap['oid'];
     if ($_FILES[$filerequestid]['error'] != UPLOAD_ERR_OK) {
         return FALSE;
     }
     $oowner = $_uldmap['easycontactusr']->id;
     $filename = $_FILES[$filerequestid]['name'];
     $tmpname = $_FILES[$filerequestid]['tmp_name'];
     $filesize = $_FILES[$filerequestid]['size'];
     $filetype = mysql_real_escape_string($_FILES[$filerequestid]['type']);
     $id = intval($_uldmap['oid']);
     $Type = mysql_real_escape_string($_uldmap['t']);
     $fieldname = mysql_real_escape_string($_uldmap['fld']);
     $filename = mysql_real_escape_string($filename);
     $ds = DIRECTORY_SEPARATOR;
     $targdir = EASYCONTACTFORMS__fileUploadDir . $ds . $Type . $ds . $id . $ds . $fieldname;
     $query = "SELECT Name FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='{$fieldname}'";
     $name = EasyContactFormsDB::getValue($query);
     $filepath = $targdir . $ds . $name;
     if (is_file($filepath)) {
         unlink($filepath);
     }
     $filepath = $targdir . $ds . $filename;
     $query = "DELETE FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='{$fieldname}'";
     EasyContactFormsDB::query($query);
     $valuemap = array();
     $valuemap['Count'] = '0';
     $valuemap['Docfield'] = $fieldname;
     $valuemap['Doctype'] = $Type;
     $valuemap['Docid'] = $id;
     $valuemap['Name'] = $filename;
     $valuemap['Size'] = $filesize;
     $valuemap['Type'] = $filetype;
     $valuemap['Protected'] = 0;
     $valuemap['Webdir'] = 1;
     $valuemap['Storagename'] = $filename;
     $valuemap['ObjectOwner'] = $oowner;
     $isid = EasyContactFormsDB::insert($valuemap, 'Files');
     if ($Type == 'Files') {
         $valuemap = array();
         $valuemap['Docid'] = $isid;
         EasyContactFormsDB::update($valuemap, 'Files', $isid);
     }
     if (!is_dir($targdir)) {
         EasyContactFormsUtils::createFolder($targdir);
     }
     move_uploaded_file($tmpname, $filepath);
     if (isset($_uldmap['thumbnailx']) && intval($_uldmap['thumbnailx']) != 0) {
         $newfieldname = 'thumb' . $fieldname;
         $newfilename = 'thumb' . $filename;
         $newtargdir = EASYCONTACTFORMS__fileUploadDir . $ds . $Type . $ds . $id . $ds . $newfieldname;
         $query = "SELECT Name FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='thumb{$fieldname}'";
         $name = EasyContactFormsDB::getValue($query);
         if (is_file($newtargdir . $ds . $name)) {
             unlink($newtargdir . $ds . $name);
         }
         EasyContactFormsUtils::createFolder($newtargdir);
         EasyContactFormsFiles::imgResize($filepath, $newtargdir . $ds . $newfilename, $_uldmap['thumbnailx'], $_uldmap['thumbnaily'], 0xffffff, 80);
         $query = "DELETE FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='{$newfieldname}'";
         EasyContactFormsDB::query($query);
         $valuemap = array();
         $valuemap['Count'] = '0';
         $valuemap['Docfield'] = $newfieldname;
         $valuemap['Doctype'] = $Type;
         $valuemap['Docid'] = $id;
         $valuemap['Name'] = $newfilename;
         $valuemap['Size'] = filesize($newtargdir . $ds . $newfilename);
         $valuemap['Type'] = $filetype;
         $valuemap['Protected'] = 0;
         $valuemap['Webdir'] = 1;
         $valuemap['Storagename'] = $newfilename;
         $valuemap['ObjectOwner'] = $oowner;
         EasyContactFormsDB::insert($valuemap, 'Files');
     }
     if (isset($_uldmap['resizex']) && intval($_uldmap['resizex']) != 0) {
         EasyContactFormsFiles::imgResize($filepath, $filepath, $_uldmap['resizex'], $_uldmap['resizey'], 0xffffff, 80);
         $valuemap = array();
         $valuemap['Size'] = filesize($filepath);
         EasyContactFormsDB::update($valuemap, 'Files', $isid);
     }
     echo json_encode(array('success' => 'TRUE'));
     return TRUE;
 }