Пример #1
0
function sp_client_upload_options_vendors()
{
    global $wpdb;
    if ($_POST['submit-vendor'] != "") {
        $v_array['name'] = $_POST['name'];
        $v_array['email'] = $_POST['email'];
        $insert['option_value'] = serialize($v_array);
        $insert['option_name'] = 'sp_client_upload_vendors_' . $v_array['name'] . '';
        $wpdb->insert("" . $wpdb->prefix . "options", $insert);
    }
    if ($_GET['delete-vendor'] != "") {
        $wpdb->query("\r\r\n\tDELETE FROM " . $wpdb->prefix . "options WHERE option_id = " . $_GET['delete-vendor'] . "\r\r\n\t");
    }
    $vendors = $wpdb->get_results("SELECT *  FROM " . $wpdb->prefix . "options   where option_name  LIKE 'sp_client_upload_vendors%'  order by option_name", ARRAY_A);
    echo '
 <h2>' . __("Vendors", "sp-cdm") . '</h2>' . sp_client_upload_nav_menu() . '
 <p>' . __("You can use this section to route downloads to a certain vendor in the users section, when you click on a user there will be checkboxes next to the file. Check the checkboxes you would like to send then scroll down, choose a vencor and click send. This works well for sending files to department members or different vendors", "sp-cdm") . '</p>


<form action="admin.php?page=sp-client-document-manager-vendors" method="post" style="margin:15px">
' . __("Name:", "sp-cdm") . ' <input type="text" name="name">  ' . __("Email:", "sp-cdm") . ' <input type="text" name="email"> <input type="submit" name="submit-vendor" value="Add new vendor">
</form>
<table class="wp-list-table widefat fixed posts" cellspacing="0">
	<thead>
	<tr>
<th>' . __("Name", "sp-cdm") . '</th>
<th>' . __("Email", "sp-cdm") . '</th>
<th>' . __("Delete", "sp-cdm") . '</th>
</tr>
	</thead>';
    for ($i = 0; $i < count($vendors); $i++) {
        $vendor_info[$i] = unserialize($vendors[$i]['option_value']);
        echo '	<tr>
<td>' . $vendor_info[$i]['name'] . '</td>
<td>' . $vendor_info[$i]['email'] . '</td>
<td><a href="admin.php?page=sp-client-document-manager-vendors&delete-vendor=' . $vendors[$i]['option_id'] . '">' . __("Delete", "sp-cdm") . '</a></td>
</tr>';
    }
    echo '</table>';
}
Пример #2
0
    function view()
    {
        global $wpdb;
        echo '<h2>' . __("User Files", "sp-cdm") . '</h2>' . sp_client_upload_nav_menu() . '' . __("Choose a user below to view their files", "sp-cdm") . '<p>
	<div style="margin-top:20px;margin-bottom:20px">
	<script type="text/javascript">
	jQuery(document).ready(function() {
	
	jQuery("#user_uid").change(function() {
		jQuery.cookie("pid", 0, { expires: 7 , path:"/" });
	window.location = "admin.php?page=sp-client-document-manager-fileview&id=" + jQuery("#user_uid").val();
	
	
	})
	});
	</script>
	<form>';
        wp_dropdown_users(array('name' => 'user_uid', 'show_option_none' => 'Choose a user', 'selected' => $_GET['id']));
        echo '</form></div>';
        if ($_GET['id'] != '') {
            echo do_shortcode('[sp-client-document-manager uid="' . $_GET['id'] . '"]');
        }
    }
Пример #3
0
        function sp_client_upload_help()
        {
            echo '' . sp_client_upload_nav_menu() . '


 <table class="wp-list-table widefat fixed posts" cellspacing="0">

 <tr>
<td>
	<h1>Smarty Pants Client Document Manager</h1>
<ol>
  <li>Upload the plugin to your plugins folder</li>
  <li>Activate the plugin</li>
  <li>Create a new page and enter the shortcode [sp-client-document-manager]</li>
  <li>Go to the plugin admin page and click settings to configure the plugin (VERY IMPORTANT!)</li>
  <li>If you\'re using the premium version please upload the zip archive in the settings area.</li>
</ol>
<h2>Short Codes</h2>
<p>x = configurable area</p>
<h3>Main shortcode</h3>
<div class="updated"><strong>[sp-client-document-manager]</strong></div>
<h3>Link to a file</h3>
<div class="updated"><strong>[cdm-link file="x" date="1" real="1"]</strong></div>
<ul>
  <li>file = required, this is the file id. You can find the file id in admin under files or by clicking on a file. The ID is listed next to the date.</li>
  <li>date = (set to 1) optional, show the date of a file</li>
  <li>real = (set to 1) optional, generate the real url for the file, the link tags are not generated and only the url is returned. This is good for custom links and image url\'s</li>
</ul>
<h4>examples</h4>
<ul>
  <li>[cdm-link file="53" date="1"]</li>
  <li>Will generate a link with the file name and date</li>
</ul>
<p>\'&lt; img src="[cdm-link file="53" real="1"]" width="100"&gt;</p>
<p>Will generate a full url for use in an image</p>
<h3>Link to a project</h3>
<div class="updated"><strong>[cdm-project project="x" date="1" order="x" direction="x" limit="x" ]</strong></div>
<p>This shortlink will display a unordered list of files, it is a basic html ul so you can use css to display it however you want.</p>
<ul>
  <li>project = required, this is the project id which you can get in admin under the projects tab.</li>
  <li>date = optional, put\'s the date of the file next to the file name</li>
  <li>order = (name,date,id,file) optional, use one of the fields to order the list by</li>
  <li>direction = (asc,desc) optional, Only to be used with order, use asc for ascending order or desc for decending order</li>
  <li>limit = optional, use to limit the amount of results shown.</li>
</ul>
<h4>examples</h4>
<ul>
  <li>[cdm-project project="1" date="1" ]</li>
  <li>[cdm-project project="1" date="1" order="name" direction="asc" limit="10" ]</li>
  </ul>
<h3>Public view (premium only)</h3>
<div class="updated"><strong>[cdm_public_view]</strong></div>
</h3>
<p>This is a shortcode for premium members only, it displays the file list to the public. This shortcode lists all the files from all users.
<h2>User Role Capabilities</h2>
<p>If you use "User Role Editor" plugin and want to assign CDM capabilities to another role then please use the following custom captabilities. All are automatically set for administrator</p>
<ul>
  <li>sp_cdm = You need this role to view the plugin, this is a very minimal role. You can view files, edit and delete.</li>
  <li>sp_cdm_settings = Show Settings tab</li>
  <li>sp_cdm_vendors = Show vendors tab</li>
  <li>sp_cdm_projects = Show projects tab</li>
  <li>sp_cdm_uploader = Use the uploader (add files) </li>
  <li>sp_cdm_categories = Show the categories tab (premium only)</li>
  <li>sp_cdm_forms = Show the forms tab (premium only)</li>
  <li>sp_cdm_help = Show the help tab and display branding (premium only)</li>
  <li>sp_cdm_logs = Show the user logs (premium only)</li>
  <li>sp_cdm_show_folders_as_nav = Show the folders as its own nav (premium only)</li>
  <li>sp_cdm_top_menu = Show or hide the top menu (premium only)</li>
  <li>sp_cdm_uploader = Show the uploader tab (premium only)</li>
</ul>
<p><strong></p>
<h3>Premium Users</h3>
<p>*Premium users must have free + premium version installed. The premium extends the free version.</p>
</td></tr></table>
';
        }
Пример #4
0
    function view()
    {
        echo '<h2>' . __("Technical Information", "sp-cdm") . '</h2>' . sp_client_upload_nav_menu() . '';
        ?>
        
   <div class="sp-cdm-status-report">     
<div class="updated Client Document Manager-message">
	<p><?php 
        _e('Please copy and paste this information in your ticket when contacting support:', "sp-cdm");
        ?>
 </p>
	<p class="submit"><a href="#" class="button-primary debug-report"><?php 
        _e('Get System Report', "sp-cdm");
        ?>
</a>
</p>
	<div id="debug-report" style="display:none">
		<textarea readonly style="width:100%;height:400px"></textarea>
		<p class="submit"><button id="copy-for-support" class="button-primary" href="#" data-tip="<?php 
        _e('Copied!', "sp-cdm");
        ?>
"><?php 
        _e('Copy for Support', "sp-cdm");
        ?>
</button></p>
	</div>
</div>
<br/>
<table class="wc_status_table widefat" cellspacing="0" id="status">
	<thead>
		<tr>
			<th colspan="3" data-export-label="WordPress Environment"><?php 
        _e('WordPress Environment', "sp-cdm");
        ?>
</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td data-export-label="Home URL"><?php 
        _e('Home URL', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The URL of your site\'s homepage.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        form_option('home');
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Site URL"><?php 
        _e('Site URL', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The root URL of your site.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        form_option('siteurl');
        ?>
</td>
		</tr>
        		<tr>
			<td data-export-label="WP Version"><?php 
        _e('WP Version', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The version of WordPress installed on your site.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        bloginfo('version');
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="CDM Version"><?php 
        _e('CDM Version', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The version of Client Document Manager installed on your site.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo esc_html(get_option('sp_client_upload'));
        ?>
</td>
		</tr>
        <?php 
        if (get_option('sp_client_upload_premium') != false) {
            ?>
        <tr>
			<td data-export-label="CDM Premium Version"><?php 
            _e('CDM Premium Version', "sp-cdm");
            ?>
:</td>
			<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The version of Client Document Manager that the database is formatted for. This should be the same as your Client Document Manager Version.', "sp-cdm") . '"></a>';
            ?>
</td>
			<td><?php 
            echo esc_html(get_option('sp_client_upload_premium'));
            ?>
</td>
		</tr>
        <?php 
        }
        ?>
		
		<tr>
			<td data-export-label="Uploads Folder Writeable?"><?php 
        _e('Uploads Folder Writeable?', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('If your folder is not writable files will never make it to the server.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        if (@fopen(SP_CDM_UPLOADS_DIR . 'test-log.log', 'a')) {
            echo '<mark class="yes">' . 'Yes <code>' . SP_CDM_UPLOADS_DIR . ' is Writable!</code></mark> ';
        } else {
            printf('<mark class="error">' . '&#10005; ' . __('To upload properly, make <code>%s</code> writable or define a custom <code>SP_CDM_UPLOADS_DIR</code>.', "sp-cdm") . '</mark>', SP_CDM_UPLOADS_DIR);
        }
        ?>
</td>
		</tr>

		<tr>
			<td data-export-label="WP Multisite"><?php 
        _e('WP Multisite', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('Whether or not you have WordPress Multisite enabled.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        if (is_multisite()) {
            echo 'Yes';
        } else {
            echo 'No';
        }
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="WP Memory Limit"><?php 
        _e('WP Memory Limit', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The maximum amount of memory (RAM) that your site can use at one time.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        $memory = $this->let_to_num(WP_MEMORY_LIMIT);
        if ($memory < 67108864) {
            echo '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: <a href="%s" target="_blank">Increasing memory allocated to PHP</a>', "sp-cdm"), size_format($memory), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</mark>';
        } else {
            echo '<mark class="yes">' . size_format($memory) . '</mark>';
        }
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="WP Debug Mode"><?php 
        _e('WP Debug Mode', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('Displays whether or not WordPress is in Debug Mode.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        if (defined('WP_DEBUG') && WP_DEBUG) {
            echo '<mark class="yes">' . 'Yes' . '</mark>';
        } else {
            echo '<mark class="no">' . 'No' . '</mark>';
        }
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Language"><?php 
        _e('Language', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The current language used by WordPress. Default = English', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo get_locale();
        ?>
</td>
		</tr>
	</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0" id="status">
	<thead>
		<tr>
			<th colspan="3" data-export-label="Server Environment"><?php 
        _e('Server Environment', "sp-cdm");
        ?>
</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td data-export-label="Server Info"><?php 
        _e('Server Info', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('Information about the web server that is currently hosting your site.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo esc_html($_SERVER['SERVER_SOFTWARE']);
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="PHP Version"><?php 
        _e('PHP Version', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The version of PHP installed on your hosting server.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        // Check if phpversion function exists
        if (function_exists('phpversion')) {
            $php_version = phpversion();
            if (version_compare($php_version, '5.4', '<')) {
                echo '<mark class="error">' . sprintf(__('%s - We recommend a minimum PHP version of 5.4. See: <a href="%s" target="_blank">How to update your PHP version</a>', "sp-cdm"), esc_html($php_version), 'http://docs.woothemes.com/document/how-to-update-your-php-version/') . '</mark>';
            } else {
                echo '<mark class="yes">' . esc_html($php_version) . '</mark>';
            }
        } else {
            _e("Couldn't determine PHP version because phpversion() doesn't exist.", "sp-cdm");
        }
        ?>
</td>
		</tr>
		<?php 
        if (function_exists('ini_get')) {
            ?>
			<tr>
				<td data-export-label="PHP Post Max Size"><?php 
            _e('PHP Post Max Size', "sp-cdm");
            ?>
:</td>
				<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The largest filesize that can be contained in one post.', "sp-cdm") . '"></a>';
            ?>
</td>
				<td><?php 
            echo size_format($this->let_to_num(ini_get('post_max_size')));
            ?>
</td>
			</tr>
			<tr>
				<td data-export-label="PHP Time Limit"><?php 
            _e('PHP Time Limit', "sp-cdm");
            ?>
:</td>
				<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups)', "sp-cdm") . '"></a>';
            ?>
</td>
				<td><?php 
            echo ini_get('max_execution_time');
            ?>
</td>
			</tr>
			<tr>
				<td data-export-label="PHP Max Input Vars"><?php 
            _e('PHP Max Input Vars', "sp-cdm");
            ?>
:</td>
				<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The maximum number of variables your server can use for a single function to avoid overloads.', "sp-cdm") . '"></a>';
            ?>
</td>
				<td><?php 
            echo ini_get('max_input_vars');
            ?>
</td>
			</tr>
			<tr>
				<td data-export-label="SUHOSIN Installed"><?php 
            _e('SUHOSIN Installed', "sp-cdm");
            ?>
:</td>
				<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', "sp-cdm") . '"></a>';
            ?>
</td>
				<td><?php 
            echo extension_loaded('suhosin') ? 'Yes' : 'No';
            ?>
</td>
			</tr>
		<?php 
        }
        ?>
		<tr>
			<td data-export-label="MySQL Version"><?php 
        _e('MySQL Version', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The version of MySQL installed on your hosting server.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td>
				<?php 
        /** @global wpdb $wpdb */
        global $wpdb;
        echo $wpdb->db_version();
        ?>
			</td>
		</tr>
		<tr>
			<td data-export-label="Max Upload Size"><?php 
        _e('Max Upload Size', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The largest filesize that can be uploaded to your WordPress installation.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo size_format(wp_max_upload_size());
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Default Timezone is UTC"><?php 
        _e('Default Timezone is UTC', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The default timezone for your server.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        $default_timezone = date_default_timezone_get();
        if ('UTC' !== $default_timezone) {
            echo '<mark class="error">' . '&#10005; ' . sprintf(__('Default timezone is %s - it should be UTC', "sp-cdm"), $default_timezone) . '</mark>';
        } else {
            echo '<mark class="yes">' . 'Yes' . '</mark>';
        }
        ?>
			</td>
		</tr>
		<?php 
        $posting = array();
        // fsockopen/cURL
        $posting['fsockopen_curl']['name'] = 'fsockopen/cURL';
        $posting['fsockopen_curl']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', "sp-cdm") . '"></a>';
        if (function_exists('fsockopen') || function_exists('curl_init')) {
            $posting['fsockopen_curl']['success'] = true;
        } else {
            $posting['fsockopen_curl']['success'] = false;
            $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', "sp-cdm") . '</mark>';
        }
        // SOAP
        $posting['soap_client']['name'] = 'SoapClient';
        $posting['soap_client']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', "sp-cdm") . '"></a>';
        if (class_exists('SoapClient')) {
            $posting['soap_client']['success'] = true;
        } else {
            $posting['soap_client']['success'] = false;
            $posting['soap_client']['note'] = sprintf(__('Your server does not have the <a href="%s">SOAP Client</a> class enabled - some gateway plugins which use SOAP may not work as expected.', "sp-cdm"), 'http://php.net/manual/en/class.soapclient.php') . '</mark>';
        }
        // DOMDocument
        $posting['dom_document']['name'] = 'DOMDocument';
        $posting['dom_document']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', "sp-cdm") . '"></a>';
        if (class_exists('DOMDocument')) {
            $posting['dom_document']['success'] = true;
        } else {
            $posting['dom_document']['success'] = false;
            $posting['dom_document']['note'] = sprintf(__('Your server does not have the <a href="%s">DOMDocument</a> class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', "sp-cdm"), 'http://php.net/manual/en/class.domdocument.php') . '</mark>';
        }
        // GZIP
        $posting['gzip']['name'] = 'GZip';
        $posting['gzip']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__('GZip (gzopen) is used to open the GEOIP database from MaxMind.', "sp-cdm") . '"></a>';
        if (is_callable('gzopen')) {
            $posting['gzip']['success'] = true;
        } else {
            $posting['gzip']['success'] = false;
            $posting['gzip']['note'] = sprintf(__('Your server does not support the <a href="%s">gzopen</a> function - this is required to use the GeoIP database from MaxMind. The API fallback will be used instead for geolocation.', "sp-cdm"), 'http://php.net/manual/en/zlib.installation.php') . '</mark>';
        }
        // WP Remote Post Check
        $posting['wp_remote_post']['name'] = __('Remote Post', "sp-cdm");
        $posting['wp_remote_post']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__('PayPal uses this method of communicating when sending back transaction information.', "sp-cdm") . '"></a>';
        $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array('timeout' => 60, 'user-agent' => 'Client Document Manager/', 'body' => array('cmd' => '_notify-validate')));
        if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
            $posting['wp_remote_post']['success'] = true;
        } else {
            $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', "sp-cdm");
            if (is_wp_error($response)) {
                $posting['wp_remote_post']['note'] .= ' ' . sprintf(__('Error: %s', "sp-cdm"), wc_clean($response->get_error_message()));
            } else {
                $posting['wp_remote_post']['note'] .= ' ' . sprintf(__('Status code: %s', "sp-cdm"), wc_clean($response['response']['code']));
            }
            $posting['wp_remote_post']['success'] = false;
        }
        // WP Remote Get Check
        $posting['wp_remote_get']['name'] = __('Remote Get', "sp-cdm");
        $posting['wp_remote_get']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__('Client Document Manager plugins may use this method of communication when checking for plugin updates.', "sp-cdm") . '"></a>';
        $response = wp_safe_remote_get('http://www.woothemes.com/wc-api/product-key-api?request=ping&network=' . (is_multisite() ? '1' : '0'));
        if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
            $posting['wp_remote_get']['success'] = true;
        } else {
            $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The Client Document Manager plugin updater won\'t work with your server. Contact your hosting provider.', "sp-cdm");
            if (is_wp_error($response)) {
                $posting['wp_remote_get']['note'] .= ' ' . sprintf(__('Error: %s', "sp-cdm"), wc_clean($response->get_error_message()));
            } else {
                $posting['wp_remote_get']['note'] .= ' ' . sprintf(__('Status code: %s', "sp-cdm"), wc_clean($response['response']['code']));
            }
            $posting['wp_remote_get']['success'] = false;
        }
        $posting = apply_filters('Client Document Manager_debug_posting', $posting);
        foreach ($posting as $post) {
            $mark = !empty($post['success']) ? 'yes' : 'error';
            ?>
				<tr>
					<td data-export-label="<?php 
            echo esc_html($post['name']);
            ?>
"><?php 
            echo esc_html($post['name']);
            ?>
:</td>
					<td class="help"><?php 
            echo isset($post['help']) ? $post['help'] : '';
            ?>
</td>
					<td>
						<mark class="<?php 
            echo $mark;
            ?>
">
							<?php 
            echo !empty($post['success']) ? 'Yes' : 'No';
            ?>
							<?php 
            echo !empty($post['note']) ? wp_kses_data($post['note']) : '';
            ?>
						</mark>
					</td>
				</tr>
				<?php 
        }
        ?>
	</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0" id="status">
	<thead>
		<tr>
			<th colspan="3" data-export-label="Active Plugins (<?php 
        echo count((array) get_option('active_plugins'));
        ?>
)"><?php 
        _e('Active Plugins', "sp-cdm");
        ?>
 (<?php 
        echo count((array) get_option('active_plugins'));
        ?>
)</th>
		</tr>
	</thead>
	<tbody>
		<?php 
        $active_plugins = (array) get_option('active_plugins', array());
        if (is_multisite()) {
            $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
        }
        foreach ($active_plugins as $plugin) {
            $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
            $dirname = dirname($plugin);
            $version_string = '';
            $network_string = '';
            if (!empty($plugin_data['Name'])) {
                // link the plugin name to the plugin url if available
                $plugin_name = esc_html($plugin_data['Name']);
                if (!empty($plugin_data['PluginURI'])) {
                    $plugin_name = '<a href="' . esc_url($plugin_data['PluginURI']) . '" title="' . __('Visit plugin homepage', "sp-cdm") . '" target="_blank">' . $plugin_name . '</a>';
                }
                if (strstr($dirname, 'Client Document Manager-')) {
                    if (false === ($version_data = get_transient(md5($plugin) . '_version_data'))) {
                        $changelog = wp_safe_remote_get('http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $dirname . '/changelog.txt');
                        $cl_lines = explode("\n", wp_remote_retrieve_body($changelog));
                        if (!empty($cl_lines)) {
                            foreach ($cl_lines as $line_num => $cl_line) {
                                if (preg_match('/^[0-9]/', $cl_line)) {
                                    $date = str_replace('.', '-', trim(substr($cl_line, 0, strpos($cl_line, '-'))));
                                    $version = preg_replace('~[^0-9,.]~', '', stristr($cl_line, "version"));
                                    $update = trim(str_replace("*", "", $cl_lines[$line_num + 1]));
                                    $version_data = array('date' => $date, 'version' => $version, 'update' => $update, 'changelog' => $changelog);
                                    set_transient(md5($plugin) . '_version_data', $version_data, DAY_IN_SECONDS);
                                    break;
                                }
                            }
                        }
                    }
                    if (!empty($version_data['version']) && version_compare($version_data['version'], $plugin_data['Version'], '>')) {
                        $version_string = ' No <strong style="color:red;">' . esc_html(sprintf(_x('%s is available', 'Version info', "sp-cdm"), $version_data['version'])) . '</strong>';
                    }
                    if ($plugin_data['Network'] != false) {
                        $network_string = ' No <strong style="color:black;">' . __('Network enabled', "sp-cdm") . '</strong>';
                    }
                }
                ?>
				<tr>
					<td><?php 
                echo $plugin_name;
                ?>
</td>
					<td class="help">&nbsp;</td>
					<td><?php 
                echo sprintf(_x('by %s', 'by author', "sp-cdm"), $plugin_data['Author']) . ' No ' . esc_html($plugin_data['Version']) . $version_string . $network_string;
                ?>
</td>
				</tr>
				<?php 
            }
        }
        ?>
	</tbody>
</table>

<table class="wc_status_table widefat" cellspacing="0" id="status">
	<thead>
		<tr>
			<th colspan="3" data-export-label="Theme"><?php 
        _e('Theme', "sp-cdm");
        ?>
</th>
		</tr>
	</thead>
		<?php 
        $active_theme = wp_get_theme();
        if ($active_theme->{'Author URI'} == 'http://www.woothemes.com') {
            $theme_dir = substr(strtolower(str_replace(' ', '', $active_theme->Name)), 0, 45);
            if (false === ($theme_version_data = get_transient($theme_dir . '_version_data'))) {
                $theme_changelog = wp_safe_remote_get('http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $theme_dir . '/changelog.txt');
                $cl_lines = explode("\n", wp_remote_retrieve_body($theme_changelog));
                if (!empty($cl_lines)) {
                    foreach ($cl_lines as $line_num => $cl_line) {
                        if (preg_match('/^[0-9]/', $cl_line)) {
                            $theme_date = str_replace('.', '-', trim(substr($cl_line, 0, strpos($cl_line, '-'))));
                            $theme_version = preg_replace('~[^0-9,.]~', '', stristr($cl_line, "version"));
                            $theme_update = trim(str_replace("*", "", $cl_lines[$line_num + 1]));
                            $theme_version_data = array('date' => $theme_date, 'version' => $theme_version, 'update' => $theme_update, 'changelog' => $theme_changelog);
                            set_transient($theme_dir . '_version_data', $theme_version_data, DAY_IN_SECONDS);
                            break;
                        }
                    }
                }
            }
        }
        ?>
	<tbody>
		<tr>
			<td data-export-label="Name"><?php 
        _e('Name', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The name of the current active theme.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo $active_theme->Name;
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Version"><?php 
        _e('Version', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The installed version of the current active theme.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo $active_theme->Version;
        if (!empty($theme_version_data['version']) && version_compare($theme_version_data['version'], $active_theme->Version, '!=')) {
            echo ' No <strong style="color:red;">' . $theme_version_data['version'] . ' ' . __('is available', "sp-cdm") . '</strong>';
        }
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Author URL"><?php 
        _e('Author URL', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The theme developers URL.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo $active_theme->{'Author URI'};
        ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Child Theme"><?php 
        _e('Child Theme', "sp-cdm");
        ?>
:</td>
			<td class="help"><?php 
        echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('Displays whether or not the current theme is a child theme.', "sp-cdm") . '"></a>';
        ?>
</td>
			<td><?php 
        echo is_child_theme() ? '<mark class="yes">' . 'Yes' . '</mark>' : '&#10005; No ' . sprintf(__('If you\'re modifying Client Document Manager or a parent theme you didn\'t build personally we recommend using a child theme. See: <a href="%s" target="_blank">How to create a child theme</a>', "sp-cdm"), 'http://codex.wordpress.org/Child_Themes');
        ?>
</td>
		</tr>
		<?php 
        if (is_child_theme()) {
            $parent_theme = wp_get_theme($active_theme->Template);
            ?>
		<tr>
			<td data-export-label="Parent Theme Name"><?php 
            _e('Parent Theme Name', "sp-cdm");
            ?>
:</td>
			<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The name of the parent theme.', "sp-cdm") . '"></a>';
            ?>
</td>
			<td><?php 
            echo $parent_theme->Name;
            ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Parent Theme Version"><?php 
            _e('Parent Theme Version', "sp-cdm");
            ?>
:</td>
			<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The installed version of the parent theme.', "sp-cdm") . '"></a>';
            ?>
</td>
			<td><?php 
            echo $parent_theme->Version;
            ?>
</td>
		</tr>
		<tr>
			<td data-export-label="Parent Theme Author URL"><?php 
            _e('Parent Theme Author URL', "sp-cdm");
            ?>
:</td>
			<td class="help"><?php 
            echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The parent theme developers URL.', "sp-cdm") . '"></a>';
            ?>
</td>
			<td><?php 
            echo $parent_theme->{'Author URI'};
            ?>
</td>
		</tr>
		<?php 
        }
        ?>
		
	</tbody>
</table>
<?php 
        do_action('Client Document Manager_system_status_report');
        ?>

<script type="text/javascript">

	jQuery( 'a.help_tip' ).click( function() {
		return false;
	});

	jQuery( 'a.debug-report' ).click( function() {

		var report = '';

		jQuery( '#status thead, #status tbody' ).each(function(){

			if ( jQuery( this ).is('thead') ) {

				var label = jQuery( this ).find( 'th:eq(0)' ).data( 'export-label' ) || jQuery( this ).text();
				report = report + "\n### " + jQuery.trim( label ) + " ###\n\n";

			} else {

				jQuery('tr', jQuery( this ) ).each(function(){

					var label       = jQuery( this ).find( 'td:eq(0)' ).data( 'export-label' ) || jQuery( this ).find( 'td:eq(0)' ).text();
					var the_name    = jQuery.trim( label ).replace( /(<([^>]+)>)/ig, '' ); // Remove HTML
					var the_value   = jQuery.trim( jQuery( this ).find( 'td:eq(2)' ).text() );
					var value_array = the_value.split( ', ' );

					if ( value_array.length > 1 ) {

						// If value have a list of plugins ','
						// Split to add new line
						var output = '';
						var temp_line ='';
						jQuery.each( value_array, function( key, line ){
							temp_line = temp_line + line + '\n';
						});

						the_value = temp_line;
					}

					report = report + '' + the_name + ': ' + the_value + "\n";
				});

			}
		});

			jQuery( "#debug-report" ).slideDown();
			jQuery( "#debug-report textarea" ).val( report ).focus().select();
			jQuery( this ).fadeOut();
			return false;

		return false;
	});

	jQuery( document ).ready( function ( $ ) {
		$( '#copy-for-support' ).tipTip({
			'attribute':  'data-tip',
			'activation': 'click',
			'fadeIn':     50,
			'fadeOut':    50,
			'delay':      0
		});

		$( 'body' ).on( 'copy', '#copy-for-support', function ( e ) {
			e.clipboardData.clearData();
			e.clipboardData.setData( 'text/plain', $( '#debug-report textarea' ).val() );
			e.preventDefault();
		});

	});

</script>
</div>
        
        <?php 
    }
Пример #5
0
function sp_client_upload_options()
{
    global $wpdb;
    if (@$_POST['sp-client-document-manager-submit'] != "") {
        update_option('sp_client_upload_page', $_POST['sp_client_upload_page']);
        echo '<p style="color:green">' . __("Updated Settings!", "sp-cdm") . '</p>';
    }
    echo '<h2>' . __("Latest uploads", "sp-cdm") . '</h2>' . sp_client_upload_nav_menu() . '
				' . sp_client_upload_admin() . '';
}
Пример #6
0
function sp_client_upload_settings()
{
    global $wpdb;
    if (@$_POST['save_options'] != '') {
        foreach ($_POST as $key => $value) {
            update_option($key, $value);
        }
        $sp_cdm_disable_features = $_POST['sp_cdm_disable_features'];
        if (count($sp_cdm_disable_features) > 0) {
            foreach ($sp_cdm_disable_features as $feature) {
                if (count($feature) > 0) {
                    foreach ($feature as $setting) {
                        if (@$sp_cdm_disable_features[$feature][$setting] == 1) {
                            @($sp_cdm_disable_features[$feature][$setting] = 1);
                        } else {
                            @($sp_cdm_disable_features[$feature][$setting] = 0);
                        }
                    }
                }
            }
        }
        update_option('sp_cdm_disable_features', $sp_cdm_disable_features);
        if ($_POST['sp_cu_user_projects'] == "1") {
            update_option('sp_cu_user_projects', '1');
        } else {
            update_option('sp_cu_user_projects', '0');
        }
        if ($_POST['sp_cu_user_projects_required'] == "1") {
            update_option('sp_cu_user_projects_required', '1');
        } else {
            update_option('sp_cu_user_projects_required', '0');
        }
        if ($_POST['sp_cu_js_redirect'] == "1") {
            update_option('sp_cu_js_redirect', '1');
        } else {
            update_option('sp_cu_js_redirect', '0');
        }
        if ($_POST['sp_cu_user_uploads_disable'] == "1") {
            update_option('sp_cu_user_uploads_disable', '1');
        } else {
            update_option('sp_cu_user_uploads_disable', '0');
        }
        if ($_POST['sp_cu_user_delete_disable'] == "1") {
            update_option('sp_cu_user_delete_disable', '1');
        } else {
            update_option('sp_cu_user_delete_disable', '0');
        }
        if ($_POST['sp_cu_hide_project'] == "1") {
            update_option('sp_cu_hide_project', '1');
        } else {
            update_option('sp_cu_hide_project', '0');
        }
        if ($_POST['sp_cu_user_require_login_download'] == "1") {
            update_option('sp_cu_user_require_login_download', '1');
        } else {
            update_option('sp_cu_user_require_login_download', '0');
        }
        if ($_POST['sp_cu_user_projects_modify'] == "1") {
            update_option('sp_cu_user_projects_modify', '1');
        } else {
            update_option('sp_cu_user_projects_modify', '0');
        }
        if ($_POST['sp_cu_user_disable_search'] == "1") {
            update_option('sp_cu_user_disable_search', '1');
        } else {
            update_option('sp_cu_user_disable_search', '0');
        }
    }
    if (get_option('sp_cu_user_disable_search') == 1) {
        $sp_cu_user_disable_search = ' checked="checked" ';
    } else {
        $sp_cu_user_disable_search = '  ';
    }
    if (get_option('sp_cu_user_projects_required') == 1) {
        $sp_cu_user_projects_required = ' checked="checked" ';
    } else {
        $sp_cu_user_projects_required = '  ';
    }
    if (get_option('sp_cu_user_projects') == 1) {
        $sp_cu_user_projects = ' checked="checked" ';
    } else {
        $sp_cu_user_projects = '  ';
    }
    if (get_option('sp_cu_js_redirect') == 1) {
        $sp_cu_js_redirect = ' checked="checked" ';
    } else {
        $sp_cu_js_redirect = '  ';
    }
    if (get_option('sp_cu_user_uploads_disable') == 1) {
        $sp_cu_user_uploads_disable = ' checked="checked" ';
    } else {
        $sp_cu_user_uploads_disable = '  ';
    }
    if (get_option('sp_cu_user_delete_disable') == 1) {
        $sp_cu_user_delete_disable = ' checked="checked" ';
    } else {
        $sp_cu_user_delete_disable = '  ';
    }
    if (get_option('sp_cu_hide_project') == 1) {
        $sp_cu_hide_project = ' checked="checked" ';
    } else {
        $sp_cu_hide_project = '  ';
    }
    if (get_option('sp_cu_user_require_login_download') == 1) {
        $sp_cu_user_require_login_download = ' checked="checked" ';
    } else {
        $sp_cu_user_require_login_download = '  ';
    }
    if (get_option('sp_cu_user_projects_modify') == 1) {
        $sp_cu_user_projects_modify = ' checked="checked" ';
    } else {
        $sp_cu_user_projects_modify = '  ';
    }
    echo '' . sp_client_upload_nav_menu() . '';
    if (current_user_can('sp_cdm_help')) {
        echo '

<div class="updated">';
        if (@CU_PREMIUM != 1) {
            echo '<h3>Upgrade to premium!</h3>

<p>If you would like to see the extra features and upgrade to premium please purchase the addon package by <a href="http://smartypantsplugins.com/sp-client-document-manager/" target="_blank">clicking here</a>. Once purchased you will receive a file, upload that file to your plugins directory or go to plugins > add new > upload and upload the zip file. Once you upload activate the plugin and let the fun begin!</p>';
        } else {
        }
        echo '





</div>';
    }
    echo "<script type=\"text/javascript\">\r\n\t\t \r\n jQuery(document).ready(function(\$){\r\n\tvar _custom_media = true,\r\n\t_orig_send_attachment = wp.media.editor.send.attachment;\r\n \r\n\t\$('.wpfh-metabox-table .button').click(function(e) {\r\n\t\tvar container = \$(this).parent();\r\n\t\tvar preview_image = \$(this).next('.preview-image');\r\n\t\tvar send_attachment_bkp = wp.media.editor.send.attachment;\r\n\t\tvar button = \$(this);\r\n\t\tvar id = button.attr('id').replace('_button', '');\r\n\t\t_custom_media = true;\r\n\t\twp.media.editor.send.attachment = function(props, attachment){\r\n\t\t\tif ( _custom_media ) {\r\n\t\t\t\t\$(\"#\"+id).val(attachment.url);\r\n\t\t\t\t\$(preview_image).html('<img src=\"'+ attachment.url + '\"  height=\"150\">')\r\n\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\treturn _orig_send_attachment.apply( this, [props, attachment] );\r\n\t\t\t};\r\n\t\t}\r\n \r\n\t\twp.media.editor.open(button);\r\n\t\treturn false;\r\n\t});\r\n \r\n\t\$('.add_media').on('click', function(){\r\n\t\t_custom_media = false;\r\n\t});\r\n});\r\n\t\t</script>";
    echo '

<script type="text/javascript">
jQuery(function($) {
	$(".cdm-admin-settings-tabs").responsiveTabs({
	 startCollapsed: false
	});
});
</script>



<style type="text/css">
strong{font-weight:800}
</style>

	<form action="admin.php?page=sp-client-document-manager-settings&save_options=1" method="post" novalidate>
	<div class="cdm-admin-settings-tabs">
  <ul>
    <li><a href="#cdm-tab-settings">' . __('Main Settings', 'sp-cdm') . '</a></li>
    <li><a href="#cdm-tab-mail">' . __('Mail Settings', 'sp-cdm') . '</a></li>
     <li><a href="#cdm-tab-premium">' . __('Premium Settings', 'sp-cdm') . '</a></li>
	 <li><a href="#cdm-tab-advanced">' . __('Advanced Settings', 'sp-cdm') . '</a></li>
	  <li><a href="#cdm-tab-disable-features">' . __('Disable Features', 'sp-cdm') . '</a></li>';
    do_action('sp_cdm_settings_add_tab');
    echo '
  
  </ul>
  <div id="cdm-tab-settings">
 ';
    if ($_REQUEST['force_upgrades'] == 1) {
        echo '

<div class="updated">
Database verified, you should be good to go!</a>
</div>';
    } else {
        echo '

<div class="update-nag">
Having problems? <a href="admin.php?page=sp-client-document-manager-settings&force_upgrade=1&force_upgrades=1">Click here to make sure your database structure is correct</a>
</div>';
    }
    echo '
	 <table class="wp-list-table widefat fixed posts" cellspacing="0">

    <tr>

    <td width="300"><strong>Company Name</strong><br><em>This could be your name or your company name which will go in the "from" area in the vendor email.</em></td>

    <td><input type="text" name="sp_cu_company_name"  value="' . get_option('sp_cu_company_name') . '"  size=80"> </td>

  </tr>

		 <tr>

    <td width="300"><strong>Filename Format</strong><br><em>Use the below codes to determine the file format, whatever you put in the box will show up before the actual file name.If you keep this blank then you leave the risk to existing files. Please see the example to the right.</em><br><br>

	%y =  Year: yyyy<br> 

	%d =  Day:  dd<br>

	%m =  Month: mm<br>

	%h =  Hour: 24 hour format<br>

	%min = Minute<br>

	%u = Username<br>

	%uid = User ID<br>

	%t = Timstamp<br>

	%r = Random #<br>

	

	</td>

    <td><input type="text" name="sp_cu_filename_format"  value="' . get_option('sp_cu_filename_format') . '"  size=80"><br><div style="margin:5px;padding:5px;"> Example:<br><br>

	If the user uploads a file called example.pdf and you put<strong>  %y-%m-%d-</strong> the final file name  will be: <strong>' . date("Y") . '-' . date("m") . '-' . date("d") . '-example.pdf</strong></div></td>

  </tr>

      <tr>

    <td width="300"><strong>Thank you message</strong><br><em>This is the thank you text the user sees after they upload.</em></td>

    <td><input type="text" name="sp_cu_thankyou"  value="' . get_option('sp_cu_thankyou') . '"  size=80"> </td>

  </tr>

       <tr>

    <td width="300"><strong>Delete Message</strong><br><em>The confirmation screen asking the user if they want to delete the file.</em></td>

    <td><input type="text" name="sp_cu_delete"  value="' . get_option('sp_cu_delete') . '"  size=80"> </td>

  </tr>



      <tr>

    <td width="300"><strong>Disable User Uploads?</strong><br><em>Check this box to disable user uploads.</em></td>

    <td><input type="checkbox" name="sp_cu_user_uploads_disable"   value="1" ' . $sp_cu_user_uploads_disable . '> </td>

  </tr>

     <tr>

	   <tr>

    <td width="300"><strong>Disable User Deleting?</strong><br><em>Check this box to not allow user to delete file.</em></td>

    <td><input type="checkbox" name="sp_cu_user_delete_disable"   value="1" ' . $sp_cu_user_delete_disable . '> </td>

  </tr>

    
    <tr>

    <td width="300"><strong>Folders Name</strong><br><em>We call folders what they are "Folders", if you want to call them something else specify that here. Please give both the singular and plural word for the replacement.</em></td>

    <td>Singular: <input type="text" name="sp_cu_folder_name_single"   value="' . stripslashes(get_option('sp_cu_folder_name_single')) . '"> Plural:  <input type="text" name="sp_cu_folder_name_plural"   value="' . stripslashes(get_option('sp_cu_folder_name_plural')) . '"></td>

  </tr>
    <tr>

    <td width="300"><strong>Hide project if empty?</strong><br><em>Hide a project if there are no files on it.</em></td>

    <td><input type="checkbox" name="sp_cu_hide_project"   value="1" ' . $sp_cu_hide_project . '> </td>

  </tr>

    <tr>

    <td width="300"><strong>Allow users to create projects?</strong><br><em>If you want to allow the user to create projects check this box.</em></td>

    <td><input type="checkbox" name="sp_cu_user_projects"   value="1" ' . $sp_cu_user_projects . '> </td>

  </tr>
    <tr>

    <td width="300"><strong>Do not allow user to delete or edit projects</strong><br><em>Check this box if you do not want the users to edit or delete projects.</em></td>

    <td><input type="checkbox" name="sp_cu_user_projects_modify"   value="1" ' . $sp_cu_user_projects_modify . '> </td>

  </tr>


    <tr>

    <td width="300"><strong>Form Instructions</strong><br><em>Just a short statement that will go above the upload form, you can use html!</em></td>

    <td><textarea  name="sp_cu_form_instructions"  style="width:100%;height:60px" >' . stripslashes(get_option('sp_cu_form_instructions')) . '</textarea> </td>

  </tr>

  



   

  

  

  ';
    if (class_exists('cdmProductivityGoogle')) {
        echo '   <tr>

    <td width="300"><strong>Google API Key</strong><br><em>This is your google API if you are using the google shortlink addon in the productivity suite, this also may be used for future google services integration.</em></td>

    <td><input type="text" name="sp_cu_google_api_key"  value="' . get_option('sp_cu_google_api_key') . '"  size=80"> </td>

  </tr>';
    }
    echo '

    <tr>

    <td>&nbsp;</td>

    <td><input type="submit" name="save_options" value="Save Options"></td>

  </tr>

</table>

</div>


  <div id="cdm-tab-mail">


<h2>Admin Email</h2>
 <table class="wp-list-table widefat fixed posts" cellspacing="0">

 

   <tr>

    <td width="300"><strong></strong><br><em>If you have additional people that need to get a copy of the admin when a user uploads a file then list them here seperated by a comma. You can also specify a wordpress role that would receive the email, so for instance if you have a custom role called "Customer Service" the email would be sent to everyone in the "Customer Service" Role. Roles should be lower case.</em></td>

    <td><input style="width:100%" type="text" name="sp_cu_additional_admin_emails" value="' . stripslashes(get_option('sp_cu_additional_admin_emails')) . '" ></td>

  </tr>

     <tr>

    <td width="300"><strong>Admin Email</strong><br><em>This is the email that is dispatched to admin.</em><br><br>Template Tags:<br><br>

	

	[file] = Link to File<br>
	
	[file_name] = Actual File Name<br>
	[file_shortlink] = Shortlink URL<br>
	[file_real_path] = Real Path URL to the file<br>
	[file_in_document_area] = Link to the file in document area<br>
	

	[notes] = Notes or extra fields<br>

	[user] = users name<br>
	
	[uid] = User ID<br>

	[project] = project<br>

	[category] = category<br>

	[user_profile] = Link to user profile<br>

	[client_documents] = Link to the client document manager

	</td>

    <td>Subject: <input style="width:100%" type="text" name="sp_cu_admin_email_subject" value="' . get_option('sp_cu_admin_email_subject') . '"><br>Body:<br>
		';
    echo wp_editor(stripslashes(get_option('sp_cu_admin_email')), 'sp_cu_admin_email');
    echo '
	
 </td>

  </tr>';
    do_action('sp_cu_email_extra', 'sp_cu_admin_email');
    echo '</table>
  
  
  
<h2>User Email</h2>
<table class="wp-list-table widefat fixed posts" cellspacing="0">
      <tr>

    <td width="300"><strong>Additional User Emails</strong><br><em>If you have additional people that need to get a copy of the email when a user uploads a file then list them here seperated by a comma.  You can also specify a wordpress role that would receive the email, so for instance if you have a custom role called "Customer Service" the email would be sent to everyone in the "Customer Service" Role. Roles should be lower case.</em></td>

    <td><input style="width:100%" type="text" name="sp_cu_additional_user_emails" value="' . stripslashes(get_option('sp_cu_additional_user_emails')) . '" ></td>

  </tr>

    <tr>

    <td width="300"><strong>User Email</strong><br><em>This is the email that is dispatched to user.</em><br><br>Template Tags:<br><br>

	

	[file] = Link to File<br>
	[file_name] = Actual File Name<br>
	[file_shortlink] = Shortlink URL<br>
	[file_real_path] = Real Path URL to the file<br>
	[file_in_document_area] = Link to the file in document area<br>
	[notes] = Notes or extra fields<br>

	[user] = users name<br>
	
	[uid] = User ID<br>
	[project] = project<br>

	[category] = category<br>

	[user_profile] = Link to user profile<br>

	[client_documents] = Link to the client document manager</td>

    <td>Subject: <input style="width:100%" type="text" name="sp_cu_user_email_subject" value="' . get_option('sp_cu_user_email_subject') . '"><br>Body:<br>
	';
    echo wp_editor(stripslashes(get_option('sp_cu_user_email')), 'sp_cu_user_email');
    echo ' </td>

  </tr>';
    do_action('sp_cu_email_extra', 'sp_cu_user_email');
    echo '</table>';
    echo '
  
  
  
<h2>Admin Upload to User Email</h2>
<table class="wp-list-table widefat fixed posts" cellspacing="0">



    <tr>

    <td width="300"><strong>Admin to user email</strong><br><em>This email is dispatched when an admin adds a file in the administration area to a user.</em><br><br>Template Tags:<br><br>

	

	[file] = Link to File<br>
	[file_in_document_area] = Link to the file in document area<br>
	[file_shortlink] = Shortlink URL<br>
	[notes] = Notes or extra fields<br>

	[user] = users name<br>

	[project] = project<br>

	[category] = category<br>

	[user_profile] = Link to user profile<br>

	[client_documents] = Link to the client document manager</td>

    <td>Subject: <input style="width:100%" type="text" name="sp_cu_admin_user_email_subject" value="' . get_option('sp_cu_admin_user_email_subject') . '"><br>Body:<br>
		';
    echo wp_editor(stripslashes(get_option('sp_cu_admin_user_email')), 'sp_cu_admin_user_email');
    echo '
	
	 </td>

  </tr>';
    do_action('sp_cu_email_extra', 'sp_cu_admin_user_email');
    echo '

 </table>

<h2>Vendor Email</h2>
<table class="wp-list-table widefat fixed posts" cellspacing="0">



    <tr>

    <td width="300"><strong>Vendor Email</strong><br><em>This email is dispatched when a user sends a file to a vendor.</em><br><br>Template Tags:<br><br>

	

	[file] = Link to File<br>

	[notes] = Notes<br></td>

    <td>Subject: <input style="width:100%" type="text" name="sp_cu_vendor_email_subject" value="' . get_option('sp_cu_vendor_email_subject') . '"><br>
	CC: <input style="width:100%" type="text" name="sp_cu_vendor_email_cc" value="' . get_option('sp_cu_vendor_email_cc') . '"><br>
	Body:<br>
	';
    echo wp_editor(stripslashes(get_option('sp_cu_vendor_email')), 'sp_cu_vendor_email');
    echo '
	
	 </td>

  </tr>';
    echo do_action('sp_cu_email_extra', 'sp_cu_vendor_email');
    echo '

 </table>';
    do_action('sp_cdm_settings_email');
    echo '
 <table class="wp-list-table widefat fixed posts" cellspacing="0">

<tr>

    <td width="300">&nbsp;</td>

    <td><input type="submit" name="save_options" value="Save Email Settings" style="padding:10px;font-size:1.5em"></td>

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

  <div id="cdm-tab-advanced">





 <table class="wp-list-table widefat fixed posts" cellspacing="0">

 <tr>

    <td width="300"><strong>Alternate Uploads Folder</strong><br><em>If you would to store your uploads in another folder please enter the full path to the uploads with a trailing slash!. Please update the URL as well. Could be absolute or relative, if you fail to update the URL then your files will not be accessible. If you are using a path that is not web accessible then do not bother putting in the path URL. The script will strictly use fread() to serve the file and will not offer up the full URL. This is a complete secure solution so nobody can access your files. Also be sure to enable "Require login to download" if you want to stop remote linking to your files. Also remember thumbnails will not work wh<br><br> 

	This feature will not move your uploads folder, If you need to change your uploads folder and you already have existing files you must move the folder from its default path in /wp-content/uploads/.

	

	</td>';
    if (get_option('sp_cu_overide_upload_path') != "" && !is_dir(get_option('sp_cu_overide_upload_path'))) {
        $does_not_exist = '<span style="color:red">Uploads Directory does not exist, please remove the custom upload path or create the folder!';
    }
    echo '

    <td><span style="width:120px">System Path:</span> <input type="text" name="sp_cu_overide_upload_path"  value="' . stripslashes(get_option('sp_cu_overide_upload_path')) . '"  size=80"><br>

	<em><strong>Example: </strong><br>linux: /home/mysite/public_html/uploads/ <br>windows: C:\\websites\\mysite\\uploads\\</em><br><br><br>

	   <span style="width:120px"> Direct URL:</span> <input type="text" name="sp_cu_overide_upload_url"  value="' . stripslashes(get_option('sp_cu_overide_upload_url')) . '"  size=80"><br>

	   	<em><strong>Example:</strong><br> http://mywebsites/uploads/</em>

	   

	    </td>

  </tr> 

  

  

    <tr>

    <td width="300"><strong>Require Login to Download?</strong><br><em>Check this option to require the user to login to download a file, this can only be used securely if you are not using the javascript downloads</em></td>

    <td><input type="checkbox" name="sp_cu_user_require_login_download"   value="1" ' . $sp_cu_user_require_login_download . '> </td>

  </tr>
    <tr>

    <td width="300"><strong>Disable Searching?</strong><br><em>Checking this will disable the search box on the front end.</em></td>

    <td><input type="checkbox" name="sp_cu_user_disable_search"   value="1" ' . $sp_cu_user_disable_search . '> </td>

  </tr>
  <tr>

  

    <td width="300"><strong>Javascript Redirect?</strong><br><em>If your on a windows system you need to use javascript redirection as FastCGI does not allow force download files.</em></td>

    <td><input type="checkbox" name="sp_cu_js_redirect"   value="1" ' . $sp_cu_js_redirect . '> </td>

  </tr>

      <tr>

    <td width="300"><strong>Mandatory ' . sp_cdm_folder_name(1) . '?</strong><br><em>If you want to require that a user select a project then check this box.</em></td>

    <td><input type="checkbox" name="sp_cu_user_projects_required"   value="1" ' . $sp_cu_user_projects_required . '> </td>

  </tr>   <tr>

    <td width="300"><strong>WP Folder</strong><br><em>Use this option only if your wp installation is in a sub folder of your url. For instance if your site is www.example.com/blog/ then put /blog/ in the field. This helps find the uploads directory.</em></td>

    <td><input type="text" name="sp_cu_wp_folder"  value="' . stripslashes(get_option('sp_cu_wp_folder')) . '"  size=80"> </td>

  </tr>  <tr>

  

 

    <tr>

    <td>&nbsp;</td>

    <td><input type="submit" name="save_options" value="Save Options"></td>

  </tr></table>
  </div>';
    $disable_features = get_option('sp_cdm_disable_features');
    echo '<div id="cdm-tab-disable-features">
  
  

 <table class="wp-list-table widefat fixed posts" cellspacing="0">
<thead>
<tr>
<th  style="width:200px">Feature</th>
<th>Disable</th>
</tr>
</thead>
 <tr>
 <td colspan="2"><h3>Base Features</h3></td>
 </tr>
 <tr>
 <td >Disable Folders</td><td>
 <input type="checkbox" name="sp_cdm_disable_features[base][disable_folders]"   value="1" ' . sp_client_upload_settings_checkbox($disable_features, 'base', 'disable_folders') . '></td>
 </tr>
  <tr>
 <td >Disable Logout Button</td><td>
 <input type="checkbox" name="sp_cdm_disable_features[base][disable_logout]"   value="1" ' . sp_client_upload_settings_checkbox($disable_features, 'base', 'disable_logout') . '></td>
 </tr>
 ';
    do_action('sp_cdm_disable_features', $disable_features);
    echo '<tr>

    <td >&nbsp;</td>

    <td><input type="submit" name="save_options" value="Save Options"></td>

  </tr></table>
  </div>
  
  ';
    if (@CU_PREMIUM == 1) {
        echo ' <div id="cdm-tab-premium">  ';
        do_action('cdm_premium_settings');
        echo '</div>';
        do_action('sp_cdm_settings_add_tab_content');
    }
    echo '</div>





</form>

	

	';
    echo $content;
}
Пример #7
0
        function view()
        {
            global $wpdb;
            echo '<h2>' . sp_cdm_folder_name(1) . '</h2>' . sp_client_upload_nav_menu() . '';
            if ($_POST['save-project'] != "") {
                $old_project_details = $wpdb->get_results($wpdb->prepare("SELECT *  FROM " . $wpdb->prefix . "sp_cu_project   where id = %d", $_POST['id']), ARRAY_A);
                $insert['name'] = $_POST['project-name'];
                $insert['uid'] = $_POST['uid'];
                if ($_POST['parent'] != '') {
                    $insert['parent'] = $_POST['parent'];
                }
                if ($_POST['id'] != "") {
                    $where['id'] = $_POST['id'];
                    $wpdb->update("" . $wpdb->prefix . "sp_cu_project", $insert, $where);
                    #move files if ID is different
                    if ($old_project_details[0]['uid'] != $_POST['uid']) {
                        #make folder if it doesnt exist
                        $dir = '' . SP_CDM_UPLOADS_DIR . '' . $_POST['uid'] . '/';
                        if (!is_dir($dir)) {
                            mkdir($dir, 0777);
                        }
                        #get all files in this folder and move them
                        $r = $wpdb->get_results($wpdb->prepare("SELECT *  FROM " . $wpdb->prefix . "sp_cu   where pid = %d", $_POST['id']), ARRAY_A);
                        if ($r != false) {
                            for ($i = 0; $i < count($r); $i++) {
                                if (file_exists('' . SP_CDM_UPLOADS_DIR . '' . $r[$i]['uid'] . '/' . $r[$i]['file'] . '')) {
                                    rename('' . SP_CDM_UPLOADS_DIR . '' . $r[$i]['uid'] . '/' . $r[$i]['file'] . '', '' . SP_CDM_UPLOADS_DIR . '' . $_POST['uid'] . '/' . $r[$i]['file'] . '');
                                }
                            }
                        }
                        #update the user id for files in this folder
                        $update['uid'] = $_POST['uid'];
                        $where_project['pid'] = $_POST['id'];
                        $wpdb->update("" . $wpdb->prefix . "sp_cu", $update, $where_project);
                        #move all sub folders
                        $this->move_sub_folders($_POST['id'], $_POST['uid']);
                    }
                    $insert_id = $_POST['id'];
                    do_action('sp_cdm_edit_project_update', $insert_id);
                } else {
                    $wpdb->insert("" . $wpdb->prefix . "sp_cu_project", $insert);
                    $insert_id = $wpdb->insert_id;
                    do_action('sp_cdm_edit_project_add', $insert_id);
                }
                do_action('sp_cdm_edit_project_save', $insert_id);
            }
            //$_POST['save-project'] != ""
            if ($_GET['function'] == 'add' or $_GET['function'] == 'edit') {
                $this->add();
            } elseif ($_GET['function'] == 'delete') {
                $wpdb->query("DELETE FROM " . $wpdb->prefix . "sp_cu_project WHERE id = " . $_GET['id'] . "\t");
                $r = $wpdb->get_results("SELECT *  FROM " . $wpdb->prefix . "sp_cu   where pid = '" . $_GET['id'] . "'", ARRAY_A);
                $num = 0;
                if (count($r) > 0) {
                    $last = count($r) - 1;
                    $array .= 'var myArray = [';
                    for ($i = 0; $i < count($r); $i++) {
                        if ($i != $last) {
                            $comma = ',';
                        } else {
                            $comma = '';
                        }
                        $array .= '' . $r[$i]['id'] . '' . $comma . ' ';
                    }
                    $array .= '];';
                } else {
                    echo '<script type="text/javascript">
				window.location = "admin.php?page=sp-client-document-manager-projects";
				</script>';
                    exit;
                }
                echo '<script type="text/javascript">
				
		' . $array . '

jQuery.each(myArray, function(index, value){

		jQuery.ajax({
		
					   type: "POST",
		
					   url: "' . SP_CDM_PLUGIN_URL . 'ajax.php?function=delete-file&dlg-delete-file="+ value ,			  
		
					   success: function(msg){
						  
					 if (index === ' . count($r) . ' - 1) {
						window.location = "admin.php?page=sp-client-document-manager-projects"
					   }
						
					   }
		
		
		});
});

</script>';
            } else {
                $r = $wpdb->get_results("SELECT " . $wpdb->prefix . "sp_cu_project.name as projectName,\r\n\r\n\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.uid,\r\n\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.parent,\r\n\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.id AS projectID,\r\n\t\t\t\t\t\t\t\t\t" . $wpdb->base_prefix . "users.ID,\r\n\t\t\t\t\t\t\t\t\t" . $wpdb->base_prefix . "users.user_nicename\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tFROM " . $wpdb->prefix . "sp_cu_project\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . $wpdb->base_prefix . "users ON " . $wpdb->prefix . "sp_cu_project.uid = " . $wpdb->base_prefix . "users.ID\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t WHERE " . $wpdb->prefix . "sp_cu_project.parent = 0 \r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t order by " . $wpdb->prefix . "sp_cu_project.name", ARRAY_A);
                echo '

								

									 

									 

									 <div style="margin:10px">

									 <a href="admin.php?page=sp-client-document-manager-projects&function=add" class="button">' . __("Add", "sp-cdm") . ' ' . sp_cdm_folder_name() . '</a>

									 </div>

									 <table class="wp-list-table widefat fixed posts" cellspacing="0">

	<thead>

	<tr>

<th style="width:40px"><strong>' . __("ID", "sp-cdm") . '</strong></th>

<th><strong>' . __("Name", "sp-cdm") . '</strong></th>

<th><strong>' . __("User", "sp-cdm") . '</strong></th>

<th><strong>' . __("Action", "sp-cdm") . '</strong></th>

</tr>

	</thead>';
                for ($i = 0; $i < count($r); $i++) {
                    $vendor_info[$i] = unserialize($vendors[$i]['option_value']);
                    echo '	<tr>

<td style="font-weight:bold;background-color:#EFEFEF">' . $r[$i]['projectID'] . '</td>				

<td style="font-weight:bold;background-color:#EFEFEF">' . stripslashes($r[$i]['projectName']) . '</td>

<td style="font-weight:bold;background-color:#EFEFEF">' . $r[$i]['user_nicename'] . '</td>

<td style="font-weight:bold;background-color:#EFEFEF">

<a href="' . SP_CDM_PLUGIN_URL . 'ajax.php?function=download-project&id=' . $r[$i]['projectID'] . '" style="margin-right:15px" >' . __("Download Archive", "sp-cdm") . '</a>  ';
                    if ($r[$i]['parent'] == 0 or class_exists('spdm_sub_projects')) {
                        echo '<a href="admin.php?page=sp-client-document-manager-projects&function=add&parent=' . $r[$i]['projectID'] . '" style="margin-right:15px" >' . __("Add Sub Folder", "sp-cdm") . '</a> ';
                    }
                    echo '<a href="admin.php?page=sp-client-document-manager-projects&function=delete&id=' . $r[$i]['projectID'] . '" style="margin-right:15px" >' . __("Delete", "sp-cdm") . '</a> 

<a href="admin.php?page=sp-client-document-manager-projects&function=edit&id=' . $r[$i]['projectID'] . '" >' . __("Modify", "sp-cdm") . '</a></td>

</tr><tr><td colspan="4">' . $this->getChildren($r[$i]['projectID']) . '</td></tr>';
                }
                //$i = 0; $i < count($r); $i++
                echo '</table>';
            }
        }
Пример #8
0
 function view()
 {
     echo '<h2>' . __("User Log", "sp-cdm") . '</h2>' . sp_client_upload_nav_menu() . '';
     echo get_option('sp_cdm_user_log');
 }