function init_user_lk() { global $wpdb, $user_LK, $rcl_userlk_action, $rcl_options, $user_ID; $user_LK = false; $userLK = false; $get = 'user'; if (isset($rcl_options['link_user_lk_rcl']) && $rcl_options['link_user_lk_rcl'] != '') { $get = $rcl_options['link_user_lk_rcl']; } if (isset($_GET[$get])) { $userLK = $_GET[$get]; } if (!$userLK) { if ($rcl_options['view_user_lk_rcl'] == 1) { $post_id = url_to_postid($_SERVER['REQUEST_URI']); if ($rcl_options['lk_page_rcl'] == $post_id) { $user_LK = $user_ID; } } else { if (isset($_GET['author'])) { $user_LK = $_GET['author']; } else { $url = isset($_SERVER['SCRIPT_URL']) ? $_SERVER['SCRIPT_URL'] : $_SERVER['REQUEST_URI']; $url = preg_replace('/\\?.*/', '', $url); $url_ar = explode('/', $url); foreach ($url_ar as $key => $u) { if ($u != 'author') { continue; } $nicename = $url_ar[$key + 1]; break; } if (!$nicename) { return false; } $user_LK = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . $wpdb->prefix . "users WHERE user_nicename='%s'", $nicename)); } } } else { $user_LK = $userLK; } if ($user_LK) { $rcl_userlk_action = $wpdb->get_var($wpdb->prepare("SELECT time_action FROM " . RCL_PREF . "user_action WHERE user='******'", $user_LK)); rcl_fileapi_scripts(); } }
function __construct($atts) { global $editpost, $group_id, $rcl_options, $user_ID, $formData; $editpost = false; $this->can_edit = true; extract(shortcode_atts(array('cats' => false, 'id' => 1, 'id_upload' => 'upload-public-form', 'accept' => 'image/*', 'post_type' => 'post', 'type_editor' => null, 'wp_editor' => null, 'group_id' => $group_id), $atts)); $this->post_type = $post_type; $this->id_upload = $id_upload; $this->terms = $cats; $this->form_id = $id; $this->accept = $accept; if (!isset($wp_editor)) { if (isset($rcl_options['wp_editor'])) { $cnt = count($rcl_options['wp_editor']); if ($cnt == 1) { $type = $rcl_options['wp_editor'][0]; } else { $type = 3; } } $this->wp_editor = isset($type) ? $type : 0; } else { $this->wp_editor = $wp_editor; } $this->type_editor = $type_editor; if (!isset($this->type_editor)) { $this->type_editor = isset($rcl_options['type_editor-' . $this->post_type]) ? $rcl_options['type_editor-' . $this->post_type] : $rcl_options['type_text_editor']; } if (isset($_GET['rcl-post-edit'])) { $this->post_id = $_GET['rcl-post-edit']; $editpost = get_post($this->post_id); $this->post_type = $editpost->post_type; if ($this->post_type == 'post-group') { if (!rcl_can_user_edit_post_group($this->post_id) && !current_user_can('edit_post', $this->post_id)) { $this->can_edit = false; } $group_id = rcl_get_group_id_by_post($this->post_id); $widget_options = rcl_get_group_option($group_id, 'widgets_options'); if (isset($widget_options['group-public-form-widget'])) { $this->type_editor = $widget_options['group-public-form-widget']['type_form']; } } else { if (!current_user_can('edit_post', $this->post_id)) { $this->can_edit = false; } } $form_id = get_post_meta($this->post_id, 'publicform-id', 1); if ($form_id) { $this->form_id = $form_id; } } $taxs = array(); $taxs = apply_filters('taxonomy_public_form_rcl', $taxs); if (isset($rcl_options['accept-' . $this->post_type])) { $this->accept = $rcl_options['accept-' . $this->post_type]; } $formData = (object) array('form_id' => $this->form_id, 'post_id' => $this->post_id, 'post_type' => $this->post_type, 'id_upload' => $this->id_upload, 'terms' => $this->terms, 'accept' => $this->accept, 'type_editor' => $this->type_editor, 'wp_editor' => $this->wp_editor, 'taxonomy' => $taxs); if ($this->user_can()) { rcl_fileapi_scripts(); rcl_fileupload_scripts(); } if ($this->post_id) { add_filter('after_public_form_rcl', array(&$this, 'delete_button'), 10, 2); } }