コード例 #1
0
function get_max_upload_bytes()
{
    $max_upload_size = min(let_to_num(ini_get('post_max_size')), let_to_num(ini_get('upload_max_filesize')));
    return $max_upload_size;
}
コード例 #2
0
ファイル: config.php プロジェクト: digideskio/oscmax2
$datetimeFormat = $lang["datetime format"];
// 24 hours, AM/PM, etc...
$dec_seperator = $lang["decimal seperator"];
// character in front of the decimals
$thousands_separator = $lang["thousands separator"];
// character between every group of thousands
// Check post_max_size (http://us3.php.net/manual/en/features.file-upload.php#73762)
function let_to_num($v)
{
    //This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case)
    $l = substr($v, -1);
    $ret = substr($v, 0, -1);
    switch (strtoupper($l)) {
        case 'P':
            $ret *= 1024;
        case 'T':
            $ret *= 1024;
        case 'G':
            $ret *= 1024;
        case 'M':
            $ret *= 1024;
        case 'K':
            $ret *= 1024;
            break;
    }
    return $ret;
}
$max_upload_size = min(let_to_num(ini_get('post_max_size')), let_to_num(ini_get('upload_max_filesize')));
if ($max_file_size_in_bytes > $max_upload_size) {
    $max_file_size_in_bytes = $max_upload_size;
}
コード例 #3
0
 static function GetMaxUpload($post = true, $upload_max = true)
 {
     if (!function_exists('let_to_num')) {
         function let_to_num($v)
         {
             //This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case)
             $l = substr($v, -1);
             $ret = substr($v, 0, -1);
             switch (strtoupper($l)) {
                 case 'P':
                     $ret *= 1024;
                 case 'T':
                     $ret *= 1024;
                 case 'G':
                     $ret *= 1024;
                 case 'M':
                     $ret *= 1024;
                 case 'K':
                     $ret *= 1024;
                     break;
             }
             return $ret;
         }
     }
     if ($post) {
         $post = let_to_num(ini_get('post_max_size'));
     } else {
         $post = NULL;
     }
     if ($upload_max) {
         $upload_max = let_to_num(ini_get('upload_max_filesize'));
     } else {
         $upload_max = NULL;
     }
     return min($post, $upload_max);
 }
コード例 #4
0
ファイル: config.php プロジェクト: lucascudo/comunique
// === só mexa daqui pra baixo se tiver certeza do que está fazendo ====
define('TRETAIMGUPLOAD_DIR_ROOT', @$_SERVER['DOCUMENT_ROOT'] && file_exists(@$_SERVER['DOCUMENT_ROOT'] . $_SERVER['PHP_SELF']) ? $_SERVER['DOCUMENT_ROOT'] : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace('\\', '/', realpath('.'))));
/**
* let_to_num
* transforma notação do estilo php.ini ('2M') em (2*1024*1024 em cada caso)
* @param string a notação 2m
* @return int a notação em bites 2097152
*/
function let_to_num($v)
{
    $l = substr($v, -1);
    $ret = substr($v, 0, -1);
    switch (strtoupper($l)) {
        case 'P':
            $ret *= 1024;
        case 'T':
            $ret *= 1024;
        case 'G':
            $ret *= 1024;
        case 'M':
            $ret *= 1024;
        case 'K':
            $ret *= 1024;
            break;
    }
    return $ret;
}
$ini_max_upload_size = min(let_to_num(ini_get('post_max_size')), let_to_num(ini_get('upload_max_filesize')));
$config['_tamanho'] = let_to_num($config['tamanho']) > $ini_max_upload_size ? $ini_max_upload_size : let_to_num($config['tamanho']);
$config['diretorio'] = TRETAIMGUPLOAD_DIR_ROOT . $config['dir'];
$config['http_code'] = array(302 => 'O servidor informou que o arquivo %file% foi movido permanentemente', 303 => 'O servidor informou que o arquivo %file% foi movido temporáriamente', 403 => 'Acesso restrito ao arquivo %file%', 404 => 'O arquivo %file% não foi encontrado no servidor', 500 => 'O servidor retornou um erro interno');
コード例 #5
0
/**
 * JobRoller Application Process
 * Processes a job application sent via the form in a post.
 *
 *
 * @version 1.0
 * @author AppThemes
 * @package JobRoller
 * @copyright 2010 all rights reserved
 *
 */
function jr_process_application_form()
{
    global $post, $app_form_results;
    $apply_form_class = "";
    $posted = array();
    $errors = new WP_Error();
    if (isset($_POST['apply_to_job'])) {
        $apply_form_class = 'open';
        $linked_resume = '';
        // Get (and clean) data
        $fields = array('your_name', 'your_email', 'your_message', 'antispam_answer', 'your_online_cv');
        foreach ($fields as $field) {
            if (isset($_POST[$field])) {
                $posted[$field] = stripslashes(trim($_POST[$field]));
            } else {
                $posted[$field] = '';
            }
        }
        // Check required fields
        $required = array('your_name' => __('Name', 'appthemes'), 'your_message' => __('Message', 'appthemes'));
        foreach ($required as $field => $name) {
            if (empty($posted[$field])) {
                $errors->add('submit_error', __('<strong>ERROR</strong>: &ldquo;', 'appthemes') . $name . __('&rdquo; is a required field.', 'appthemes'));
            }
        }
        // Check AntiSpam Field
        if (!is_user_logged_in()) {
            $ans = strtolower(trim(get_option('jr_antispam_answer')));
            if (strtolower(trim($posted['antispam_answer'])) !== $ans) {
                $errors->add('submit_error', __('<strong>ERROR</strong>: Incorrect anti-spam answer. The correct answer is ', 'appthemes') . '"' . $ans . '".');
            }
        }
        // Check the e-mail address
        if ($posted['your_email'] == '') {
            $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'appthemes'));
        } elseif (!is_email($posted['your_email'])) {
            $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'appthemes'));
            $posted['your_email'] = '';
        }
        // Check linked CV
        if ($posted['your_online_cv'] && $posted['your_online_cv'] > 0) {
            $posted['your_online_cv'] = (int) $posted['your_online_cv'];
            $linked_resume = get_post($posted['your_online_cv']);
            if (!is_wp_error($linked_resume) && $linked_resume->post_author == get_current_user_id() && $linked_resume->post_status == 'publish') {
                // Resume is okay :)
            } else {
                $errors->add('invalid_resume', __('<strong>ERROR</strong>: Invalid resume.', 'appthemes'));
            }
        }
        // Check file extensions
        $allowed = array('pdf', 'doc', 'docx', 'zip', 'txt', 'rtf');
        if (isset($_FILES['your_cv']) && !empty($_FILES['your_cv']['name'])) {
            //$extension = strtolower(pathinfo($_FILES['your_cv']['name'], PATHINFO_EXTENSION));
            $extension = strtolower(substr(strrchr($_FILES['your_cv']['name'], "."), 1));
            if (!in_array($extension, $allowed)) {
                $errors->add('submit_error', __('<strong>ERROR</strong>: Only pdf, zip, doc, txt and rtf files are allowed.', 'appthemes'));
            }
        }
        if (isset($_FILES['your_coverletter']) && !empty($_FILES['your_coverletter']['name'])) {
            //$extension = strtolower(pathinfo($_FILES['your_coverletter']['name'], PATHINFO_EXTENSION));
            $extension = strtolower(substr(strrchr($_FILES['your_coverletter']['name'], "."), 1));
            if (!in_array($extension, $allowed)) {
                $errors->add('submit_error', __('<strong>ERROR</strong>: Only pdf, zip, doc, txt and rtf files are allowed.', 'appthemes'));
            }
        }
        if ($errors && sizeof($errors) > 0 && $errors->get_error_code()) {
            // There are errors!
        } else {
            $attachments = array();
            $attachment_urls = array();
            // Continue, upload files
            if (isset($_FILES['your_cv']) && !empty($_FILES['your_cv']['name']) || isset($_FILES['your_coverletter']) && !empty($_FILES['your_coverletter']['name'])) {
                // Find max filesize in bytes - we say 10mb becasue the file will be attached to an email, also checks system variables in case they are lower
                $max_sizes = array('10485760');
                if (ini_get('post_max_size')) {
                    $max_sizes[] = let_to_num(ini_get('post_max_size'));
                }
                if (ini_get('upload_max_filesize')) {
                    $max_sizes[] = let_to_num(ini_get('upload_max_filesize'));
                }
                if (WP_MEMORY_LIMIT) {
                    $max_sizes[] = let_to_num(WP_MEMORY_LIMIT);
                }
                $max_filesize = min($max_sizes);
                if ($_FILES["your_cv"]["size"] + $_FILES["your_coverletter"]["size"] > $max_filesize) {
                    $errors->add('submit_error', __('<strong>ERROR</strong>: ', 'appthemes') . 'Attachments too large. Maximum file size for all attachments is ' . $max_filesize / (1024 * 1024) . 'MB');
                } else {
                    /** WordPress Administration File API */
                    include_once ABSPATH . 'wp-admin/includes/file.php';
                    /** WordPress Media Administration API */
                    include_once ABSPATH . 'wp-admin/includes/media.php';
                    add_filter('upload_dir', 'cv_upload_dir');
                    $time = current_time('mysql');
                    $overrides = array('test_form' => false);
                    if (isset($_FILES['your_cv']) && !empty($_FILES['your_cv']['name'])) {
                        $file = wp_handle_upload($_FILES['your_cv'], $overrides, $time);
                        if (!isset($file['error'])) {
                            $attachments[] = $file['file'];
                            $attachment_urls[] = $file['url'];
                        } else {
                            $errors->add('submit_error', __('<strong>ERROR</strong>: ', 'appthemes') . $file['error'] . '');
                        }
                    }
                    if (isset($_FILES['your_coverletter']) && !empty($_FILES['your_coverletter']['name'])) {
                        $file = wp_handle_upload($_FILES['your_coverletter'], $overrides, $time);
                        if (!isset($file['error'])) {
                            $attachments[] = $file['file'];
                            $attachment_urls[] = $file['url'];
                        } else {
                            $errors->add('submit_error', __('<strong>ERROR</strong>: ', 'appthemes') . $file['error'] . '');
                        }
                    }
                }
                remove_filter('upload_dir', 'company_logo_upload_dir');
            }
            if ($errors && sizeof($errors) > 0 && $errors->get_error_code()) {
            } else {
                $headers = __('From: ', 'appthemes') . $posted['your_name'] . ' <' . $posted['your_email'] . '>' . "\r\n\\";
                $message = __("Applicant Name: ", 'appthemes') . $posted['your_name'] . "\n" . __("Applicant Email: ", 'appthemes') . $posted['your_email'];
                if ($posted['your_online_cv'] && $linked_resume) {
                    // Load or generate a key so that the recipient can view the resume without being logged in
                    $view_key = get_post_meta($linked_resume->ID, '_view_key', true);
                    if (!$view_key) {
                        $view_key = uniqid();
                        update_post_meta($linked_resume->ID, '_view_key', $view_key);
                    }
                    $link = add_query_arg('key', $view_key, get_permalink($linked_resume->ID));
                    $title = $linked_resume->post_title;
                    $message .= "\n" . __("Applicant's online resume: ", 'appthemes') . $title . ' - ' . $link;
                }
                $message .= "\n\n" . $posted['your_message'];
                wp_mail(get_the_author_meta('user_email'), __('Application for job "', 'appthemes') . $post->post_title . '"', $message, $headers, $attachments);
                // CC
                wp_mail($posted['your_email'], __('[copy] Application for job "', 'appthemes') . $post->post_title . '"', $message, '', $attachments);
                // CC Admin
                if (get_option('jr_bcc_apply_emails') == 'yes') {
                    wp_mail(get_option('admin_email'), __('[copy] Application for job "', 'appthemes') . $post->post_title . '"', $message, '', $attachments);
                }
                if (sizeof($attachments) > 0) {
                    foreach ($attachments as $attach) {
                        @unlink($attach);
                    }
                }
                ?>
				<p class="success" id="apply_form_result"><?php 
                _e('Your application has been sent successfully.', 'appthemes');
                ?>
</p>
				<?php 
                $apply_form_class = "";
                $posted = array();
            }
        }
    }
    $app_form_results = array('class' => $apply_form_class, 'errors' => $errors, 'posted' => $posted);
}
コード例 #6
0
ファイル: config.php プロジェクト: vertigobr/filesender
    public function loadConfig()
    {
        $config = array();
        // Start of configurable settings
        // For more information about these settings please see the
        // Administrator Reference Manual in the documentation section
        // at www.filesender.org
        // General settings
        $config['admin'] = '';
        // UID's (from $config['saml_uid_attribute']) that have Administrator permissions
        $config['adminEmail'] = '${ADMINEMAIL}';
        // Email address(es, separated by ,) to receive administrative messages (low disk space warning)
        $config['Default_TimeZone'] = '${TIMEZONE}';
        $config['site_defaultlanguage'] = 'en_AU';
        // for available languages see the ./language directory
        $config['site_name'] = 'FileSender';
        // Friendly name used for your FileSender instance
        // UI Settings
        $config['datedisplayformat'] = "d-m-Y";
        // Format for displaying date/time, use PHP date() format string syntax
        $config["versionNumber"] = true;
        // Show version number (true/false)
        $config['site_showStats'] = false;
        // Show site upload/download stats (true/false)
        $config['displayUserName'] = true;
        // Show 'Welcome user' (true/false)
        // debug settings
        $config["debug"] = false;
        // Debug logging on/off (true/false)
        $config["displayerrors"] = false;
        // Display debug errors on screen (true/false)
        $config['dnslookup'] = true;
        // log includes DNS lookup (true/false)
        $config["client_specific_logging"] = false;
        // client logging (true/false)
        $config["client_specific_logging_uids"] = "";
        // "" is log all clients, or log for specific userid's or voucheruid's seperated by comma 'xxxx,zzzzz'
        // saml settings
        $config['saml_email_attribute'] = 'mail';
        // Attribute used for email address
        $config['saml_name_attribute'] = 'cn';
        // Attribute used to get the user's name
        $config['saml_uid_attribute'] = 'eduPersonTargetedID';
        // Attribute to uniquely identify the user
        // AuP settings
        $config["AuP_default"] = false;
        //AuP value is already ticked
        $config["AuP"] = true;
        // AuP is displayed
        // Server settings
        $config['default_daysvalid'] = 20;
        // Maximum number of days before file/voucher is expired
        $config['ban_extension'] = 'exe,bat';
        // Possibly dangerous file extensions that are disallowed
        $config["max_email_recipients"] = 100;
        // maximum email addresses allowed to send at once for voucher or file sending, a value of 0 allows unlimited emails.
        $config['max_flash_upload_size'] = '2147483648';
        // 2GB
        $config['max_html5_upload_size'] = '107374182400';
        // 100  GB
        $config["upload_chunk_size"] = '2000000';
        //
        // update max_flash_upload_size if php.ini post_max_size and upload_max_filesize is set lower
        $config['max_flash_upload_size'] = min(let_to_num(ini_get('post_max_size')) - 2048, let_to_num(ini_get('upload_max_filesize')), $config['max_flash_upload_size']);
        $config["server_drivespace_warning"] = 20;
        // as a percentage 20 = 20% space left on the storage drive
        // Advanced server settings, do not change unless you have a very good reason.
        $config['db_dateformat'] = "Y-m-d H:i:sP";
        // Date/Time format for PostgreSQL, use PHP date format specifier syntax
        $config["crlf"] = "\n";
        // for email CRLF can be changed to \r\n if required
        $config['voucherRegEx'] = "'[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}'";
        $config['voucherUIDLength'] = 36;
        $config['emailRegEx'] = "[a-z0-9!#\$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";
        // site URL settings
        //if ( isset($_SERVER['SERVER_NAME']) ) {
        //$prot =  isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
        //$config['site_url'] = $prot . $_SERVER['SERVER_NAME'] . '/filesender/'; // URL to Filesender
        //$config['site_simplesamlurl'] =  $prot . $_SERVER['SERVER_NAME'] . '/simplesamlphp/';
        //$config['site_authenticationSource'] ="default-sp";
        //$config['site_logouturl'] = $config['site_url'] . 'logout.php';
        //$config['site_downloadurl'] = $config['site_url'] . 'files/'; // * Deprecated *
        //}
        // VERTIGO DOCKER CONFIG (ex: SERVERPORT = 192.168.59.103:8443)
        $config['site_url'] = 'https://${SERVERPORT}/filesender/';
        $config['site_simplesamlurl'] = 'https://${SERVERPORT}/simplesamlphp/';
        $config['site_authenticationSource'] = "default-sp";
        $config['site_logouturl'] = $config['site_url'] . 'logout.php';
        $config['site_downloadurl'] = $config['site_url'] . 'files/';
        // * Deprecated *
        $config['forceSSL'] = true;
        // Always use SSL (true/false)
        // Support links
        $config['aboutURL'] = "";
        $config['helpURL'] = "";
        // (absolute) file locations
        $config['site_filestore'] = '/usr/share/filesender/files/';
        $config['site_temp_filestore'] = '/usr/share/filesender/tmp/';
        $config['site_simplesamllocation'] = '/usr/share/simplesamlphp/';
        $config['log_location'] = '/usr/share/filesender/log/';
        $config["db_type"] = "pgsql";
        // pgsql or mysql
        $config['db_host'] = '${DBHOST}';
        $config['db_database'] = 'filesender';
        $config['db_port'] = '${DBPORT}';
        // database username and password
        $config['db_username'] = '******';
        $config['db_password'] = '******';
        //Optional DSN format overides db_ settings
        //$config['dsn'] = "pgsql:host=${DBHOST};dbname=filesender";
        //$config['dsn'] = 'pgsql:host=${DBHOST};dbname=filesender';
        //$config['dsn'] = 'sqlite:/usr/share/filesender/db/filesender.sqlite';
        //$config['dsn_driver_options'] = array();
        // dsn requires username and password in $config['db_username'] and $config['db_password']
        // cron settings
        $config['cron_exclude prefix'] = '_';
        // exclude deletion of files with the prefix character listed (can use multiple characters eg '._' will ignore .xxxx and _xxxx
        $config['cron_shred'] = false;
        // instead of simply unlinking, overwrite expired files so they are hard to recover
        $config['cron_shred_command'] = '/usr/bin/shred -f -u -n 1 -z';
        // overwrite once (-n 1) with random data, once with zeros (-z), then remove (-u)
        // email templates section
        $config['default_emailsubject'] = "{siteName}: {filename}";
        $config['filedownloadedemailbody'] = '{CRLF}--simple_mime_boundary{CRLF}Content-type:text/plain; charset={charset}{CRLF}{CRLF}
Dear Sir, Madam,

The file below has been downloaded from {siteName} by {filefrom}.

Filename: {fileoriginalname}
Filesize: {filesize}
Download link: {serverURL}?vid={filevoucheruid}

The file is available until {fileexpirydate} after which it will be automatically deleted.

Best regards,

{siteName}{CRLF}{CRLF}--simple_mime_boundary{CRLF}Content-type:text/html; charset={charset}{CRLF}{CRLF}
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html;charset={charset}">
</HEAD>
<BODY>
<P>Dear Sir, Madam,</P>
<P>The file below has been downloaded from {siteName} by {filefrom}.</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
	<COL WIDTH=600>
	<COL WIDTH=80>
	<COL WIDTH=800>
	<COL WIDTH=70>
	<TR>
		<TD WIDTH=600 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Filename</B></P>
		</TD>
		<TD WIDTH=80 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Filesize</B></P>
		</TD>
		<TD WIDTH=600 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Download link</B></P>
		</TD>
		<TD WIDTH=70 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Valid until</B></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=600 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{htmlfileoriginalname}</P>
		</TD>
		<TD WIDTH=80 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{filesize}</P>
		</TD>
		<TD WIDTH=800 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER><A HREF="{serverURL}?vid={filevoucheruid}">{serverURL}?vid={filevoucheruid}</A></P>
		</TD>
		<TD WIDTH=70 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{fileexpirydate}</P>
		</TD>
	</TR>
</TABLE>
<P>Best regards,</P>
<P>{siteName}</P>
</BODY>
</HTML>{CRLF}{CRLF}--simple_mime_boundary--';
        $config['fileuploadedemailbody'] = '{CRLF}--simple_mime_boundary{CRLF}Content-type:text/plain; charset={charset}{CRLF}{CRLF}
Dear Sir, Madam,

The file below has been uploaded to {siteName} by {filefrom} and you have been granted permission to download this file.

Filename: {fileoriginalname}
Filesize: {filesize}
Download link: {serverURL}?vid={filevoucheruid}

The file is available until {fileexpirydate} after which it will be automatically deleted.

{filemessage_start}Personal message from {filefrom}: {filemessage}{filemessage_end}

Best regards,

{siteName}{CRLF}{CRLF}--simple_mime_boundary{CRLF}Content-type:text/html; charset={charset}{CRLF}{CRLF}
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html;charset={charset}">
</HEAD>
<BODY>
<P>Dear Sir, Madam,</P>
<P>The file below has been uploaded to {siteName} by {filefrom} and you have been granted permission to download this file.</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
	<COL WIDTH=600>
	<COL WIDTH=80>
	<COL WIDTH=800>
	<COL WIDTH=70>
	<TR>
		<TD WIDTH=600 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Filename</B></P>
		</TD>
		<TD WIDTH=80 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Filesize</B></P>
		</TD>
		<TD WIDTH=600 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Download link</B></P>
		</TD>
		<TD WIDTH=70 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Valid until</B></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=600 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{htmlfileoriginalname}</P>
		</TD>
		<TD WIDTH=80 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{filesize}</P>
		</TD>
		<TD WIDTH=800 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER><A HREF="{serverURL}?vid={filevoucheruid}">{serverURL}?vid={filevoucheruid}</A></P>
		</TD>
		<TD WIDTH=70 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{fileexpirydate}</P>
		</TD>
	</TR>
</TABLE>
<P></P>
{filemessage_start}<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
	<COL WIDTH=100%>
	<TR>
		<TD WIDTH=100% BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Personal message from {filefrom}:</B></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=100% BGCOLOR="#e6e6e6">
			<P><I>{htmlfilemessage}</I></P>
		</TD>
	</TR>
</TABLE>{filemessage_end}
<P>Best regards,</P>
<P>{siteName}</P>
</BODY>
</HTML>{CRLF}{CRLF}--simple_mime_boundary--';
        $config['voucherissuedemailbody'] = '{CRLF}--simple_mime_boundary{CRLF}Content-type:text/plain; charset={charset}{CRLF}{CRLF}
Dear Sir, Madam,

Please, find below a voucher which grants access to {siteName}.
With this voucher you can upload once one file and make it available for download to a group of people.

Issuer: {filefrom}
Voucher link: {serverURL}?vid={filevoucheruid}

The voucher is available until {fileexpirydate} after which it will be automatically deleted.

Best regards,

{siteName}{CRLF}{CRLF}--simple_mime_boundary{CRLF}Content-type:text/html; charset={charset}{CRLF}{CRLF}
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html;charset={charset}">
</HEAD>
<BODY>
<P>Dear Sir, Madam,</P>
<P>Please, find below a voucher which grants access to {siteName}.</P>
<P>With this voucher you can upload once one file and make it available for download to a group of people.</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
	<COL WIDTH=75>
	<COL WIDTH=800>
	<COL WIDTH=70>
	<TR>
		<TD WIDTH=75 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Issuer</B></P>
		</TD>
		<TD WIDTH=800 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Voucher link</B></P>
		</TD>
		<TD WIDTH=70 BGCOLOR="#b3b3b3">
			<P ALIGN=CENTER><B>Valid until</B></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=75 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{filefrom}</P>
		</TD>
		<TD WIDTH=800 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER><A HREF="{serverURL}?vid={filevoucheruid}">{serverURL}?vid={filevoucheruid}</A></P>
		</TD>
		<TD WIDTH=70 BGCOLOR="#e6e6e6">
			<P ALIGN=CENTER>{fileexpirydate}</P>
		</TD>
	</TR>
</TABLE>
<P></P>
<P>Best regards,</P>
<P>{siteName}</P>
</BODY>
</HTML>{CRLF}{CRLF}--simple_mime_boundary--';
        $config['defaultvouchercancelled'] = "{CRLF}--simple_mime_boundary{CRLF}Content-type:text/plain; charset={charset}{CRLF}{CRLF}\nDear Sir, Madam,\n\nA voucher from {filefrom} has been cancelled.\n\nBest regards,\n\n{siteName}{CRLF}{CRLF}--simple_mime_boundary{CRLF}Content-type:text/html; charset={charset}{CRLF}{CRLF}\n<HTML>\n<HEAD>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset={charset}\">\n</HEAD>\n<BODY>\nDear Sir, Madam,<BR><BR>A voucher from {filefrom} has been cancelled.<BR><BR>\n\t<P>Best regards,</P>\n<P>{siteName}</P>\n</BODY>\n</HTML>{CRLF}{CRLF}--simple_mime_boundary--";
        $config['defaultfilecancelled'] = "{CRLF}--simple_mime_boundary{CRLF}Content-type:text/plain; charset={charset}{CRLF}{CRLF}\nDear Sir, Madam,\n\nThe file '{fileoriginalname}' from {filefrom} has been deleted and is no longer available to download.\n\nBest regards,\n\n{siteName}{CRLF}{CRLF}--simple_mime_boundary{CRLF}Content-type:text/html; charset={charset}{CRLF}{CRLF}\n<HTML>\n<BODY>\nDear Sir, Madam,<BR><BR>The file '{htmlfileoriginalname}' from {filefrom} has been deleted and is no longer available to download.<BR><BR>\n\t<P>Best regards,</P>\n<P>{siteName}</P>\n</BODY>\n</HTML>{CRLF}{CRLF}--simple_mime_boundary--";
        // End of email templates section
        // End of configurable settings
        return $config;
    }
コード例 #7
0
ファイル: admin-options.php プロジェクト: besimhu/legacy
function jr_system_info()
{
    global $system_info, $wpdb, $app_version;
    ?>

    <div class="wrap jobroller">
        <div class="icon32" id="icon-options-general"><br/></div>
        <h2><?php 
    _e('System Info', 'appthemes');
    ?>
</h2>

        <?php 
    // jr_admin_info_box();
    ?>

        <?php 
    // delete all the db tables if the button has been pressed.
    if (isset($_POST['deletetables'])) {
        jr_delete_db_tables();
    }
    // delete all the config options from the wp_options table if the button has been pressed.
    if (isset($_POST['deleteoptions'])) {
        jr_delete_all_options();
    }
    ?>
		<script type="text/javascript">
		jQuery(function() {
		    jQuery("#tabs-wrap").tabs({
		        fx: {
		            opacity: 'toggle',
		            duration: 200
		        }
		    });
		});
		</script>
        <div id="tabs-wrap">
            <ul>
            	<li><a href="#tab1"><?php 
    _e('Debug Info', 'appthemes');
    ?>
</a></li>
            	<li><a href="#tab2"><?php 
    _e('Cron Jobs', 'appthemes');
    ?>
</a></li>
            	<li><a href="#tab3"><?php 
    _e('Uninstall', 'appthemes');
    ?>
</a></li>
            </ul>
			<div id="tab1">
                <table class="widefat fixed" style="width:850px;">

                    <thead>
                        <tr>
                            <th scope="col" width="200px"><?php 
    _e('Debug Info', 'appthemes');
    ?>
</th>
                            <th scope="col">&nbsp;</th>
                        </tr>
                    </thead>

                    <tbody>
                        <tr>
                            <td class="titledesc"><?php 
    _e('JobRoller Version', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    echo $app_version;
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('WordPress Version', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (appthemes_is_wpmu()) {
        echo 'WPMU';
    } else {
        echo 'WP';
    }
    ?>
 <?php 
    if (function_exists('bloginfo')) {
        echo bloginfo('version');
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('PHP Version', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('phpversion')) {
        echo phpversion();
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('Server Software', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    echo $_SERVER['SERVER_SOFTWARE'];
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('UPLOAD_MAX_FILESIZE', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('phpversion')) {
        //echo ini_get('upload_max_filesize');
        echo let_to_num(ini_get('upload_max_filesize')) / (1024 * 1024) . "MB";
    }
    ?>
</td>
                        </tr>
                        
                        <tr>
                            <td class="titledesc"><?php 
    _e('POST_MAX_SIZE', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('phpversion')) {
        //echo ini_get('upload_max_filesize');
        echo let_to_num(ini_get('post_max_size')) / (1024 * 1024) . "MB";
    }
    ?>
</td>
                        </tr>
                        
                         <tr>
                            <td class="titledesc"><?php 
    _e('WordPress Memory Limit', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    echo let_to_num(WP_MEMORY_LIMIT) / (1024 * 1024) . "MB";
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('DISPLAY_ERRORS', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('phpversion')) {
        echo ini_get('display_errors');
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('FSOCKOPEN Check', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('fsockopen')) {
        echo '<span style="color:green">' . __('Your server has fsockopen enabled which is needed for PayPal IPN to work.', 'appthemes') . '</span>';
    } else {
        echo '<span style="color:red">' . __('Your server does not have fsockopen enabled so PayPal IPN will not work. Contact your host provider to have it enabled.', 'appthemes') . '</span>';
    }
    ?>
</td>
                        </tr>

						<tr>
                            <td class="titledesc"><?php 
    _e('OPENSSL Check', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('openssl_open')) {
        echo '<span style="color:green">' . __('Your server has Open SSL enabled which is needed for PayPal IPN to work. Also make sure port 443 is open on the firewall.', 'appthemes') . '</span>';
    } else {
        echo '<span style="color:red">' . __('Your server does not have Open SSL enabled so PayPal IPN will not work. Contact your host provider to have it enabled.', 'appthemes') . '</span>';
    }
    ?>
</td>
                        </tr>
                        
                        <tr>
                            <td class="titledesc"><?php 
    _e('WP Remote Post Check', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    $paypal_adr = 'https://www.paypal.com/cgi-bin/webscr';
    $params = array('timeout' => 30);
    $response = wp_remote_post($paypal_adr, $params);
    // Retry
    if (is_wp_error($response)) {
        $params['sslverify'] = false;
        $response = wp_remote_post($paypal_adr, $params);
    }
    if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
        echo '<span style="color:green">' . __('wp_remote_post() was successful so PayPal IPN should work fine for you!', 'appthemes') . '</span>';
    } else {
        echo '<span style="color:red">' . __('wp_remote_post() failed. Sorry, PayPal IPN won\'t work with your server.', 'appthemes') . '</span>';
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('Log File Check', 'appthemes');
    ?>
</td>
                            <td class="forminp">
                            	<?php 
    $logging_enabled = get_option('jr_enable_log');
    if ($logging_enabled == 'yes') {
        $fp = fopen(TEMPLATEPATH . '/log/jobroller_log.txt', 'a');
        if ($fp) {
            echo '<span style="color:green">' . __('Log file is writable.', 'appthemes') . '</span>';
        } else {
            echo '<span style="color:red">' . __('Log file is not writable. Edit file permissions (jobroller/log/jobroller_log.txt)', 'appthemes') . '</span>';
        }
        fclose($fp);
    } else {
        echo 'Logging is disabled - <a href="admin.php?page=settings">' . __('(change this)', 'appthemes') . '</a>';
    }
    ?>
                            </td>
                        </tr>

                        

                        <tr>
                            <td class="titledesc"><?php 
    _e('Theme Path', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('bloginfo')) {
        echo bloginfo('template_url');
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('Image Upload Path', 'appthemes');
    ?>
</td>
                            <td class="forminp"><?php 
    if (!esc_attr(get_option('upload_path'))) {
        echo 'wp-content/uploads';
    } else {
        echo esc_attr(get_option('upload_path'));
    }
    printf(' - <a href="%s">' . __('(change this)', 'appthemes') . '</a>', 'options-media.php');
    ?>
</td>                        </tr>

                </tbody>

                </table>
            </div>
            <div id="tab2">
				<table class="widefat fixed" style="width:850px;">
					<thead>
						<tr>
							<th scope="col"><?php 
    _e('Next Run Date', 'appthemes');
    ?>
</th>
							<th scope="col"><?php 
    _e('Frequency', 'appthemes');
    ?>
</th>
							<th scope="col"><?php 
    _e('Hook Name', 'appthemes');
    ?>
</th>
						</tr>
					</thead>
					<tbody>
						<?php 
    $cron = _get_cron_array();
    $schedules = wp_get_schedules();
    $date_format = _x('M j, Y @ G:i', 'appthemes');
    foreach ($cron as $timestamp => $cronhooks) {
        foreach ((array) $cronhooks as $hook => $events) {
            foreach ((array) $events as $key => $event) {
                $cron[$timestamp][$hook][$key]['date'] = date_i18n($date_format, $timestamp);
            }
        }
    }
    ?>
						<?php 
    foreach ($cron as $timestamp => $cronhooks) {
        ?>
							<?php 
        foreach ((array) $cronhooks as $hook => $events) {
            ?>
								<?php 
            foreach ((array) $events as $event) {
                ?>
									<tr>
										<th scope="row"><?php 
                echo $event['date'];
                ?>
</th>
										<td>
											<?php 
                if ($event['schedule']) {
                    echo $schedules[$event['schedule']]['display'];
                } else {
                    ?>
<em><?php 
                    _e('One-off event', 'appthemes');
                    ?>
</em><?php 
                }
                ?>
										</td>
										<td><?php 
                echo $hook;
                ?>
</td>
									</tr>
								<?php 
            }
            ?>
							<?php 
        }
        ?>
						<?php 
    }
    ?>
					</tbody>
				</table>
            </div>
            <div id="tab3">
                <table class="widefat fixed" style="width:850px;">

                     <thead>
                        <tr>
                            <th scope="col" width="200px"><?php 
    _e('Uninstall JobRoller', 'appthemes');
    ?>
</th>
                            <th scope="col">&nbsp;</th>
                        </tr>
                    </thead>

                <form method="post" id="mainform" action="">
                    <tr>
                        <td class="titledesc"><?php 
    _e('Delete Database Tables', 'appthemes');
    ?>
</td>
                        <td class="forminp">
                            <p class="submit"><input onclick="return confirmBeforeDeleteTbls();" name="save" type="submit" value="<?php 
    _e('Delete JobRoller Database Tables', 'appthemes');
    ?>
" /><br />
                        <?php 
    _e('Do you wish to completely delete all JobRoller database tables? Once you do this you will lose any transaction data you have stored.', 'appthemes');
    ?>
                            </p>
                            <input name="deletetables" type="hidden" value="yes" />
                        </td>
                    </tr>
                </form>

                <form method="post" id="mainform" action="">
                    <tr>
                        <td class="titledesc"><?php 
    _e('Delete Config Options', 'appthemes');
    ?>
</td>
                        <td class="forminp">
                            <p class="submit"><input onclick="return confirmBeforeDeleteOptions();" name="save" type="submit" value="<?php 
    _e('Delete JobRoller Config Options', 'appthemes');
    ?>
" /><br />
                        <?php 
    _e('Do you wish to completely delete all JobRoller configuration options? This will delete all values saved on the settings, pricing, gateways, etc admin pages from the wp_options database table.', 'appthemes');
    ?>
                            </p>
                            <input name="deleteoptions" type="hidden" value="yes" />
                        </td>
                    </tr>
                </form>

                </table>
            </div>
		</div>

    </div>

    <script type="text/javascript">
    /* <![CDATA[ */
        function confirmBeforeDeleteTbls() { return confirm("<?php 
    _e('WARNING: You are about to completely delete all JobRoller database tables. Are you sure you want to proceed? (This cannot be undone)', 'appthemes');
    ?>
"); }
        function confirmBeforeDeleteOptions() { return confirm("<?php 
    _e('WARNING: You are about to completely delete all JobRoller configuration options from the wp_options database table. Are you sure you want to proceed? (This cannot be undone)', 'appthemes');
    ?>
"); }
    /* ]]> */
    </script>


<?php 
}