function add_folder() { global $current_user; $add_project = '<div class="remodal" data-remodal-id="folder">'; if ($_GET['page'] == 'sp-client-document-manager-fileview') { $add_project .= '<input type="hidden" id="sub_category_uid" name="uid" value="' . $_GET['id'] . '">'; } else { $add_project .= '<input type="hidden" id="sub_category_uid" name="uid" value="' . $current_user->ID . '">'; } if (@CU_PREMIUM == 1) { $add_project .= ' <input type="hidden" class="cdm_premium_pid_field" name="parent" value="0">'; } $add_project .= ' ' . sp_cdm_folder_name() . ' ' . __("Name", "sp-cdm") . ' <input id="sub_category_name" type="text" name="project-name" style="width:200px !important"> <input type="submit" value="' . __("Add", "sp-cdm") . ' ' . sp_cdm_folder_name() . '" name="add-project" onclick="sp_cu_add_project()"> </div>'; //$add_project = apply_filters('sp_cdm_add_project_form', $add_project); return $add_project; }
function sp_client_upload_nav_menu($nav = NULL) { global $wpdb, $current_user; $content = ''; global $cu_ver, $sp_client_upload, $sp_cdm_ver; if (current_user_can('sp_cdm_top_menu')) { $content .= ' <script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#menu1").ptMenu(); }); </script> <ul id="menu1" style="margin-top:20px;margin-bottom:10px;">'; if (current_user_can('sp_cdm')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager" >Home</a></li>'; } if (current_user_can('sp_cdm_settings')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager-settings" >' . __("Settings", "sp-cdm") . '</a><ul>'; $content .= '<li><a href="admin.php?page=sp-client-document-manager-settings" >' . __("Global Settings", "sp-cdm") . '</a></li>'; if (current_user_can('sp_cdm_vendors')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager-vendors" >' . __("Vendors", "sp-cdm") . '</a></li>'; } if (current_user_can('sp_cdm_projects')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager-projects" >' . sp_cdm_folder_name(1) . '</a></li>'; } if (@CU_PREMIUM == 1) { if (current_user_can('sp_cdm_groups')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager-groups" >' . __("Share Spaces", "sp-cdm") . '</a></li>'; } if (current_user_can('sp_cdm_forms')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager-forms">' . __("Forms", "sp-cdm") . '</a></li>'; } if (current_user_can('sp_cdm_categories')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager-categories" >' . __("Categories", "sp-cdm") . '</a></li>'; } } $extra_menus = ''; $extra_menus .= apply_filters('sp_client_upload_nav_menu', $extra_menus); $content .= '' . $extra_menus . '</ul></li>'; } if (current_user_can('sp_cdm_uploader')) { $content .= '<li><a href="admin.php?page=sp-client-document-manager-fileview" >' . __("User Files / Uploader", "sp-cdm") . '</a></li> '; } if (current_user_can('sp_cdm_help')) { $content .= ' <li><a href="admin.php?page=sp-client-document-manager-help" >' . __("Instructions", "sp-cdm") . '</a></li>'; } $extra_top_menus = ''; $extra_top_menus .= apply_filters('sp_client_upload_top_menu', $extra_top_menus); $content .= '' . $extra_top_menus . ' </ul>'; } if (current_user_can('sp_cdm_help')) { if (@CU_PREMIUM == 1) { $ver = $sp_cdm_ver; } else { $ver = $sp_client_upload; } $content .= '<div style="text-align:right"><strong style="margin-right:10px">Version:</strong> ' . get_option('sp_client_upload') . ''; if (@CU_PREMIUM == 1) { $content .= ' <strong style="margin-left:50px;margin-right:10px;">Premium Version:</strong> ' . get_option('sp_client_upload_premium') . ''; } $content .= '</div>'; } if (@$_GET['sphidemessage'] == 1) { $content .= ' <script type="text/javascript"> jQuery(document).ready( function() { sp_cu_dialog("#sp_cdm_ignore",400,200); }); </script> <div style="display:none"> <div id="sp_cdm_ignore"> <h2>It\'s OK!</h2> <p>Hey no hard feelings, we hate nag messages too! If you change your mind and want to give us some love checkout the settings page for a link to the our website!</p> </div> </div>'; update_option("sp_cdm_ignore", 1); } if (@$_GET['sphidemessage'] == '2') { update_option("sp_cdm_ignore", 0); } if (@CU_PREMIUM != 1 && get_option("sp_cdm_ignore") != 1) { $content .= ' <div class="updated"> <p><strong>Upgrade to the premium version today to get enhanced features and support. Features include: File versioning system, Categories for files, Thumbnails for files, auto generation of thumbnails from PDF and PSD, Additional fields form builder, Support and many more enhanced settings!</strong> <br /> <br /> <a href="http://smartypantsplugins.com/sp-client-document-manager/" target="_blank" class="button">Click here to upgrade! </a> <a style="margin-left:10px" href="http://www.youtube.com/watch?feature=player_embedded&v=m6szdA3r-1Q" target="_blank" class="button">View the youtube video</a> <a style="margin-left:10px" href="http://smartypantsplugins.com/donate/" target="_blank" class="button">Click here to donate</a> <a href="admin.php?page=sp-client-document-manager&sphidemessage=1" class="button" style="margin-left:10px">Click here to ignore us!</a></p> </div>'; } $r = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "posts where post_content LIKE '%[sp-client-document-manager]%' and post_type = 'page'", ARRAY_A); if (@$_GET['ignore'] == 'shortcode') { add_option('cdm_ignore_shortcode', 1); } if ($r[0]['ID'] == "" && get_option('cdm_ignore_shortcode') != 1) { $content .= '<div class="sp_cdm_error" style="margin-bottom:20px">It looks like you do not have a page with the shortcode <strong>[sp-client-document-manager]</strong> on it. Please create one or use the form below and we will create one for you!'; if ($_POST['page-name-cdm'] != '') { // Create post object $my_post = array('post_title' => $_POST['page-name-cdm'], 'post_content' => '[sp-client-document-manager]', 'post_type' => 'page', 'post_status' => 'publish', 'post_author' => $current_user->ID); $post = wp_insert_post($my_post); $content .= '<div style="margin:10px;font-size:1.3em" class="sp_cdm_success"><strong>' . $_POST['page-name-cdm'] . '</strong> Page Created! <a href="' . get_page_link($post) . '" target="_blank">Click here to preview the page</a></div>'; } else { $content .= '<form action="admin.php?page=sp-client-document-manager" method="post"> Page Name: <input type="text" name="page-name-cdm" value=""> <input type="submit" name="add-shortcode-page" value="Add"> </form> <div style="text-align:right"> <a href="admin.php?page=sp-client-document-manager-settings&ignore=shortcode" class="button">click here to ignore this message</a> </div> '; } $content .= '</div>'; } if (@$_GET['ignore'] == 'tml') { add_option('cdm_ignore_tml', 1); } if (!function_exists('theme_my_login') && get_option('cdm_ignore_tml') != 1) { $content .= '<div class="sp_cdm_error">This plugin works great with the "Theme My Login" plugin which allows you to use your own template for login and registration. <strong>Please remember to turn on registration in your wordpress settings if you need to have users registering</strong>.<div style="padding:10px"> <a href="plugin-install.php?tab=search&s=theme+my+login&plugin-search-input=Search+Plugins" class="button">Click here to get theme my login.</a> <div style="text-align:right"><a href="admin.php?page=sp-client-document-manager-settings&ignore=tml" class="button">click here to ignore this message</a></div></div></div>'; } echo $content; do_action('sp_cdm_errors'); }
function sp_client_upload_menu() { $projects = new cdmProjects(); $sp_cdm_fileview = new sp_cdm_fileview(); add_menu_page('Documents', 'Documents', 'sp_cdm', 'sp-client-document-manager', 'sp_client_upload_options', 'dashicons-media-default'); add_submenu_page('sp-client-document-manager', sp_cdm_folder_name(1), sp_cdm_folder_name(1), 'sp_cdm_projects', 'sp-client-document-manager-projects', array($projects, 'view')); add_submenu_page('sp-client-document-manager', 'Vendors', 'Vendors', 'sp_cdm_vendors', 'sp-client-document-manager-vendors', 'sp_client_upload_options_vendors'); add_submenu_page('sp-client-document-manager', 'Help', 'Help', 'sp_cdm_help', 'sp-client-document-manager-help', 'sp_client_upload_help'); add_submenu_page('sp-client-document-manager', 'Settings', 'Settings', 'sp_cdm_settings', 'sp-client-document-manager-settings', 'sp_client_upload_settings'); add_submenu_page('sp-client-document-manager', 'User Files', 'User Files', 'sp_cdm_uploader', 'sp-client-document-manager-fileview', array($sp_cdm_fileview, 'view')); do_action('sp_cu_admin_menu'); if (current_user_can('sp_cdm_show_folders_as_nav')) { add_menu_page('Folders', 'Folders', 'sp_cdm_show_folders_as_nav', 'sp-client-document-manager-projects', array($projects, 'view'), 'dashicons-portfolio'); } }
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> </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"> </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> </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 > </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; }
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>'; } }
function sp_cdm_display_projects_select_by_id($uid, $name, $class = 'pid_select') { global $wpdb; if (@CU_PREMIUM == 1) { $find_groups = cdmFindGroups($uid, '_project'); } else { $find_groups = ''; } $r_projects_query = "SELECT *\r\n\r\n\t\r\n\r\n\t\t\t\t\t\t\t\t\t FROM " . $wpdb->prefix . "sp_cu_project\r\n\r\n\t\t\t\t\t\t\t\t\tWHERE ( uid = '" . $uid . "' " . $find_groups . ") \r\n\r\n\t\t\t\t\t\t\t\t\t "; $r_projects_query = apply_filters('sp_cdm_projects_query_dropdown', $r_projects_query, $uid); $r_projects_query .= "\r\n\r\n\t\t\t\t\t\t\t\t\t\tORDER by name"; $projects = $wpdb->get_results($r_projects_query, ARRAY_A); if (count($projects) > 0 or get_option('sp_cu_user_projects') == 1) { $select_dropdown .= ' <select name="' . $name . '" class="' . $class . '">'; if (get_option('sp_cu_user_projects_required') == 0) { $select_dropdown .= '<option name="" selected="selected">' . __("No", "sp-cdm") . ' ' . sp_cdm_folder_name() . '</option>'; } for ($i = 0; $i < count($projects); $i++) { if ($current_user->last_project == $projects[$i]['id']) { $required = ' selected="selected" '; } else { $required = ''; } if ($projects[$i]['name'] != '') { $select_dropdown .= '<option value="' . $projects[$i]['id'] . '" ' . $required . '>' . stripslashes($projects[$i]['name']) . '</option>'; } } $select_dropdown .= '</select>'; $select_dropdown = apply_filters('wpfh_sub_projects', $select_dropdown); $html .= $select_dropdown; } return $html; }
function thumbnails() { global $wpdb, $current_user; if (!is_user_logged_in()) { exit; } $back_image = '' . SP_CDM_PLUGIN_URL . 'images/my_projects_folder.png'; $back_image = apply_filters('spcdm/files/images/back_button', $back_image); $folder_image = '' . SP_CDM_PLUGIN_URL . 'images/my_projects_folder.png'; $folder_image = apply_filters('spcdm/files/images/folder_button', $folder_image); if (function_exists('cdmFindGroups')) { $find_groups = cdmFindGroups($_GET['uid'], 1); } $current_user_projects = sp_cdm_get_user_projects($_GET['uid']); if ($_REQUEST['search'] != "") { $search_project .= " AND " . $wpdb->prefix . "sp_cu_project.name LIKE '%" . $_REQUEST['search'] . "%' "; } else { if ($_GET['pid'] == '' or $_GET['pid'] == 'undefined') { $search_project .= " AND " . $wpdb->prefix . "sp_cu_project.parent = '0' "; } else { $search_project .= " AND " . $wpdb->prefix . "sp_cu_project.parent = '" . $_GET['pid'] . "' "; } } if (get_option('sp_cu_hide_project') == 1) { $r_projects_query = "SELECT " . $wpdb->prefix . "sp_cu.name,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu.id,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu.pid ,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu.uid,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu.parent,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu_project.name AS project_name,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu_project.parent\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t \r\n\r\n\t\t\t\t\t\t\t\t\t\tFROM " . $wpdb->prefix . "sp_cu \r\n\r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . $wpdb->prefix . "sp_cu_project ON " . $wpdb->prefix . "sp_cu.pid = " . $wpdb->prefix . "sp_cu_project.id\r\n\r\n\t\t\t\t\t\t\t\t\t\tWHERE (" . $wpdb->prefix . "sp_cu.uid = '" . $_GET['uid'] . "' " . $find_groups . ")\r\n\r\n\t\t\t\t\t\t\t\t\t\tAND pid != 0\r\n\r\n\t\t\t\t\t\t\t\t\t\tAND " . $wpdb->prefix . "sp_cu.parent = 0 \r\n\r\n\t\t\t\t\t\t\t\t\t\t" . $sub_projects . ""; if ($_GET['pid'] == 0 or $_GET['pid'] == '') { $r_projects_query = apply_filters('sp_cdm_projects_query', $r_projects_query, $_GET['uid']); } $r_projects_query .= "\t" . $search_project . "\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tGROUP BY pid\r\n\r\n\t\t\t\t\t\t\t\t\t\tORDER by date desc"; if (get_option('sp_cu_release_the_kraken') == 1) { unset($r_projects_query); $r_projects_query = "SELECT \t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.id,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.id AS pid,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.uid,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu_project.name AS project_name,\r\n\r\n\t\t\t\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\tFROM " . $wpdb->prefix . "sp_cu_project\r\n\t\t\t\t\t\t\t\t\t\tWHERE id != ''\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t" . $search_project . " ORDER by name\r\n"; } $r_projects = $wpdb->get_results($r_projects_query, ARRAY_A); } else { $r_projects_groups_addon = apply_filters('sp_cdm_projects_query', $r_projects_groups_addon, $_GET['uid']); $search_project = apply_filters('sp_cdm_search_project_query', $search_project); //echo $r_projects_groups_addon ; if ($_GET['pid'] == 0 or $_GET['pid'] == '') { $user_query = " AND " . $wpdb->prefix . "sp_cu_project.uid = '" . $_GET['uid'] . "' "; } $r_projects_query = "SELECT \r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.id,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.id AS pid,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.uid,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu_project.name AS project_name,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu_project.parent\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t \r\n\r\n\t\t\t\t\t\t\t\t\t\tFROM " . $wpdb->prefix . "sp_cu_project\r\n\r\n\t\t\t\t\t\t\t\t\t WHERE (" . $wpdb->prefix . "sp_cu_project.id != '' " . $user_query . " " . $find_groups . " " . $r_projects_groups_addon . ")\t\t\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t\t\t" . $search_project . "\r\n\r\n\t\t\t\t\t\t\t\t\t\t"; $r_projects_query .= "\r\n\r\n\t\t\t\t\t\t\t\t\t\tORDER by name"; $r_projects_query = apply_filters('sp_cdm_project_query_final', $r_projects_query); if (get_option('sp_cu_release_the_kraken') == 1) { unset($r_projects_query); $r_projects_query = "SELECT \t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.id,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.id AS pid,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t" . $wpdb->prefix . "sp_cu_project.uid,\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t " . $wpdb->prefix . "sp_cu_project.name AS project_name,\r\n\r\n\t\t\t\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\tFROM " . $wpdb->prefix . "sp_cu_project\r\n\t\t\t\t\t\t\t\t\t\tWHERE id != ''\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t" . $search_project . " ORDER by name\r\n"; } $r_projects = $wpdb->get_results($r_projects_query, ARRAY_A); } if ($_GET['pid'] == 'drafts') { unset($r_projects); } echo ' <script type="text/javascript"> jQuery( document ).ready(function() { jQuery(".cdm-hover-thumb").hover(function() { jQuery(this).before("<div class=cdm-preview-image><img src=" + jQuery(this).attr("rel") + " ></div>"); }, function () { jQuery(".cdm-preview-image").remove(); }); }); </script> <div id="dlg_cdm_thumbnails">'; if ($_GET['pid'] == '') { $jscriptpid = "''"; } else { $jscriptpid = "'" . $_GET['pid'] . "'"; } echo '<div class="sp-cdm-r-head">'; do_action('spdm_file_list_column_before_sort'); echo ' <div style="float:right">' . __("Sort by", "sp-cdm") . ': <a href="javascript:sp_cdm_sort(\'name\',' . $_GET['pid'] . ')">' . __("Name", "sp-cdm") . '</a> <a href="javascript:sp_cdm_sort(\'date\',' . $_GET['pid'] . ')">' . __("Date", "sp-cdm") . '</a></div> '; echo ' </div> '; if ($_GET['pid'] != "0" && $_GET['pid'] != '' && (get_option('sp_cu_user_projects') == 1 and get_option('sp_cu_user_projects_modify') != 1 or current_user_can('manage_options'))) { $r_project_info = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "sp_cu_project where id = " . $_GET['pid'] . "", ARRAY_A); if ($r_project_info[0]['uid'] == $_GET['uid'] && get_option('sp_cu_user_delete_folders') != 1) { echo '<div style="padding-right:10px">'; echo '<a href="javascript:sp_cu_dialog(\'#edit_category_' . $_GET['pid'] . '\',550,130)"><img src="' . SP_CDM_PLUGIN_URL . 'images/application_edit.png"> ' . __("Edit Folder Name", "sp-cdm") . '</a>'; echo '<a href="javascript:sp_cu_remove_project()" style="margin-left:20px"> <img src="' . SP_CDM_PLUGIN_URL . 'images/delete_small.png"> ' . __("Remove Folder", "sp-cdm") . ' </a>'; do_action('cdm/ajax/folder/navigation', $_GET['pid']); echo '<div style="display:none"> <script type="text/javascript"> function sp_cu_edit_project(){ if(jQuery("#edit_project_name_' . $_GET['pid'] . '").val() == ""){ alert("Please enter a project name"); }else{ jQuery.ajax({ type: "POST", url: "' . SP_CDM_PLUGIN_URL . 'ajax.php?function=save-category", data: "name=" + jQuery("#edit_project_name_' . $_GET['pid'] . '").val() + "&id=" + jQuery("#edit_project_id_' . $_GET['pid'] . '").val(), success: function(msg){ jQuery("#cmd_file_thumbs").load("' . SP_CDM_PLUGIN_URL . 'ajax.php?function=file-list&uid=' . $_GET['uid'] . '&pid=' . $_GET['pid'] . '"); jQuery("#edit_category").dialog("close"); alert(msg); } }); } } function sp_cu_remove_project(){ jQuery( "#delete_category_' . $_GET['pid'] . '" ).dialog({ resizable: false, height:240, width:440, modal: true, buttons: { "Delete all items": function() { jQuery.ajax({ type: "POST", url: "' . SP_CDM_PLUGIN_URL . 'ajax.php?function=remove-category", data: "id=' . $_GET['pid'] . '" , success: function(msg){ jQuery.removeCookie("pid"); cdm_ajax_search(); } }); jQuery( this ).dialog( "close" ); }, Cancel: function() { jQuery( this ).dialog( "close" ); } } }); } </script> <div id="delete_category_' . $_GET['pid'] . '" title="' . __("Delete Category?", "sp-cdm") . '"> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>' . __("Are you sure you would like to delete this category? Doing so will remove all files related to this category.", "sp-cdm") . '</p> </div> <div id="edit_category_' . $_GET['pid'] . '"> <input type="hidden" name="edit_project_id" id="edit_project_id_' . $_GET['pid'] . '" value="' . $_GET['pid'] . '"> ' . sp_cdm_folder_name() . ' ' . __("Name", "sp-cdm") . ': <input value="' . stripslashes($r_project_info[0]['name']) . '" id="edit_project_name_' . $_GET['pid'] . '" type="text" name="name" style="width:200px !important"> <input type="submit" value="' . __("Save", "sp-cdm") . ' ' . sp_cdm_folder_name() . '" onclick="sp_cu_edit_project()"> </div> </div> '; } } echo ' <div class="sp_isotope_filter">'; do_action('spdm_file_responsive_top', $_GET['pid']); if ($_GET['pid'] != 0) { $query_project = $wpdb->get_results("SELECT *\r\n\r\n\t\r\n\r\n\t\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t\t FROM " . $wpdb->prefix . "sp_cu_project\r\n\r\n\t\t\t\t\t\t\t\t\tWHERE id = '" . $_GET['pid'] . "'\r\n\r\n\t\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t\t ", ARRAY_A); do_action('spdm_file_list_column_before_folder_back'); echo ' <div class="dlg_cdm_thumbnail_folder"> <a href="javascript:sp_cdm_load_project(' . $query_project[0]['parent'] . ')"><img src="' . $back_image . '"> <div class="dlg_cdm_thumb_title"> « ' . __("Go Back", "sp-cdm") . ' </div> </a> </div> '; } $r_projects = apply_filters('sp_cdm_project_array_filter', $r_projects); if (count($r_projects) > 0) { for ($i = 0; $i < count($r_projects); $i++) { if ($r_projects[$i]['project_name'] != "" && in_array($r_projects[$i]['pid'], $current_user_projects) or get_option('sp_cu_release_the_kraken') == 1) { echo ' <div class="dlg_cdm_thumbnail_folder"> <a href="javascript:sp_cdm_load_project(' . $r_projects[$i]['pid'] . ')"><img src="' . $folder_image . '"> <div class="dlg_cdm_thumb_title"> ' . stripslashes($r_projects[$i]['project_name']) . ' </div> </a>'; do_action('spdm_file_thumbs_column_before_folder', $r_projects[$i]['pid']); echo ' </div> '; } } } if ($_GET['sort'] == '') { $sort = spdm_ajax::order_by(); } else { $sort = $_GET['sort']; } if ($_GET['pid'] == "" or $_GET['pid'] == "0" or $_GET['pid'] == "undefined" or $_GET['pid'] == "null") { if ($_REQUEST['search'] != "") { $search_file .= " AND (name LIKE '%" . $_REQUEST['search'] . "%' or tags LIKE '%" . $_REQUEST['search'] . "%') "; $r_projects_groups_addon_search = str_replace("wp_sp_cu_project.id", "pid", $r_projects_groups_addon); } else { $search_file .= " AND pid = 0 AND parent = 0 "; } $search_file = apply_filters("sp_cdm_file_search_query", $search_file, $_GET['pid']); $query = "SELECT * FROM " . $wpdb->prefix . "sp_cu where (uid = '" . $_GET['uid'] . "' " . $r_projects_groups_addon_search . ") \t " . $search_file . " order by " . $sort . " "; $query = apply_filters('sp_cdm_query_string', $query); $r = $wpdb->get_results($query, ARRAY_A); } else { $search_file .= " where (pid = '" . $_GET['pid'] . "')"; if ($_REQUEST['search'] != "") { $search_file .= " AND (name LIKE '%" . $_REQUEST['search'] . "%' or tags LIKE '%" . $_REQUEST['search'] . "%') "; } else { $search_file .= " AND parent = 0 "; } $search_file = apply_filters("sp_cdm_file_search_query", $search_file, $_GET['pid']); $query = "SELECT * FROM " . $wpdb->prefix . "sp_cu " . $search_file . " order by " . $sort . " "; $query = apply_filters("sp_cdm_file_main_responsive_query", $query, $_GET['pid']); $r = $wpdb->get_results($query, ARRAY_A); } if (get_option('sp_cu_release_the_kraken') == 1) { unset($r); unset($search_file); if ($_GET['pid'] == '') { $_GET['pid'] = 0; } if ($_GET['pid'] == "" or $_GET['pid'] == "0" or $_GET['pid'] == "undefined" or $_GET['pid'] == "null") { $search_file .= " AND (pid = '0') "; } else { $search_file .= " AND (pid = '" . $_GET['pid'] . "') "; } $search_file = apply_filters("sp_cdm_file_search_query", $search_file, $_GET['pid']); if ($_REQUEST['search'] != "") { unset($search_file); $search_file .= " AND (name LIKE '%" . $_REQUEST['search'] . "%' or tags LIKE '%" . $_REQUEST['search'] . "%') "; } $query = "SELECT * FROM " . $wpdb->prefix . "sp_cu where id != '' " . $search_file . " order by " . $sort . " "; $r = $wpdb->get_results($query, ARRAY_A); } if ($_REQUEST['search'] == "") { $r = apply_filters('sp_cdm_file_loop_array', $r, $_GET['pid']); } for ($i = 0; $i < count($r); $i++) { $ext = preg_replace('/^.*\\./', '', $r[$i]['file']); $images_arr = array("jpg", "png", "jpeg", "gif", "bmp"); if (get_option('sp_cu_user_projects_thumbs_pdf') == 1 && class_exists('imagick')) { $info = new Imagick(); $formats = $info->queryFormats(); } else { $formats = array(); } if (in_array(strtolower($ext), $images_arr)) { if (get_option('sp_cu_overide_upload_path') != '' && get_option('sp_cu_overide_upload_url') == '') { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/package_labled.png">'; } else { $img = '<img src="' . sp_cdm_thumbnail('' . SP_CDM_UPLOADS_DIR_URL . '' . $r[$i]['uid'] . '/' . $r[$i]['file'] . '', NULL, 70) . '">'; } } elseif (in_array($ext, array('mp4', 'ogg', 'webm', 'avi', 'mpg', 'mpeg', 'mkv'))) { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/video.png" >'; } elseif ($ext == 'xls' or $ext == 'xlsx') { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/microsoft_office_excel.png">'; } elseif ($ext == 'doc' or $ext == 'docx') { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/microsoft_office_word.png">'; } elseif ($ext == 'pub' or $ext == 'pubx') { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/microsoft_office_publisher.png">'; } elseif ($ext == 'ppt' or $ext == 'pptx') { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/microsoft_office_powerpoint.png">'; } elseif ($ext == 'adb' or $ext == 'accdb') { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/microsoft_office_access.png">'; } elseif (in_array(strtoupper($ext), $formats)) { if (file_exists('' . SP_CDM_UPLOADS_DIR . '' . $r[$i]['uid'] . '/' . $r[$i]['file'] . '_small.png')) { $img = '<img src="' . sp_cdm_thumbnail('' . SP_CDM_UPLOADS_DIR_URL . '' . $r[$i]['uid'] . '/' . $r[$i]['file'] . '_small.png', NULL, 70) . '">'; } else { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/adobe.png">'; } } elseif ($ext == 'pdf') { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/adobe.png">'; } else { $img = '<img src="' . SP_CDM_PLUGIN_URL . 'images/package_labled.png">'; } if ($_REQUEST['search'] != "" && sp_cdm_get_project_name($r[$i]['pid']) != false) { $project_name = ' <br><em>(' . sp_cdm_folder_name() . ': ' . sp_cdm_get_project_name($r[$i]['pid']) . ')</em> '; } else { $project_name = ''; } $img = apply_filters('sp_cdm_viewfile_image', $img, $r[$i]); $ext = preg_replace('/^.*\\./', '', $r[$i]['file']); $r_cat = $wpdb->get_results("SELECT name FROM " . $wpdb->prefix . "sp_cu_cats where id = '" . $r[$i]['cid'] . "' ", ARRAY_A); if ($r_cat[0]['name'] == '') { $cat = stripslashes($r_cat[0]['name']); } else { $cat = ''; } if ($_REQUEST['search'] != "" && sp_cdm_get_project_name($r[$i]['pid']) != false) { $project_name = ' <em>(' . sp_cdm_folder_name() . ': ' . sp_cdm_get_project_name($r[$i]['pid']) . ')</em> '; } else { $project_name = ''; } if (get_option('sp_cu_file_direct_access') == 1) { $file_link = 'window.open(\'' . SP_CDM_PLUGIN_URL . 'download.php?fid=' . base64_encode($r[$i]['id'] . '|' . $r[$i]['date'] . '|' . $r[$i]['file']) . '\'); void(0)'; } else { $file_link = 'cdmViewFile(' . $r[$i]['id'] . ')'; } if (in_array($r[$i]['pid'], $current_user_projects) or $r[$i]['pid'] == 0 or get_option('sp_cu_release_the_kraken') == 1) { $file_link = apply_filters('spcdm/file_list/link', $file_link, $r[$i]); echo '<div class="dlg_cdm_thumbnail_folder"> <div class="dlg_cdm_thumbnail_image"> <a href="javascript:' . $file_link . '" ><div class="cdm_img_container">' . $img . '</div> <div class="dlg_cdm_thumb_title"> ' . stripslashes($r[$i]['name']) . '' . $project_name . ' </div> </a> </div>'; do_action('spdm_file_thumbs_column_before_file', $r[$i]['id']); echo ' </div>'; } } echo '<div style="clear:both"></div></div></div>'; }
<div id="edit_category_' . $_GET['pid'] . '"> <input type="hidden" name="edit_project_id" id="edit_project_id_' . $_GET['pid'] . '" value="' . $_GET['pid'] . '"> ' . sp_cdm_folder_name() . ' ' . __("Name", "sp-cdm") . ': <input value="' . stripslashes($r_project_info[0]['name']) . '" id="edit_project_name_' . $_GET['pid'] . '" type="text" name="name" style="width:200px !important"> <input type="submit" value="' . __("Save", "sp-cdm") . ' ' . sp_cdm_folder_name() . '" onclick="sp_cu_edit_project()"> </div> </div>