function rcl_message_upload() { global $user_ID, $wpdb, $rcl_options; $adressat_mess = intval($_POST['talker']); $online = intval($_POST['online']); //print_r($_POST); //print_r($_FILES); exit; if (!$user_ID) { exit; } if ($rcl_options['file_limit']) { $file_num = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM " . RCL_PREF . "private_message WHERE author_mess = '%d' AND status_mess = '4'", $user_ID)); if ($file_num > $rcl_options['file_limit']) { $log['recall'] = 150; echo json_encode($log); exit; } } rcl_update_timeaction_user(); $time = current_time('mysql'); $mime = explode('/', $_FILES['filedata']['type']); $name = explode('/', str_replace('\\', '/', untrailingslashit($_FILES['filedata']['tmp_name']))); $cnt = count($name); $t_name = $name[--$cnt]; $file_name = $_FILES['filedata']['name']; $type = substr($file_name, -4); if (false !== strpos($type, '.')) { $type = substr($file_name, -3); } $upload_dir = wp_upload_dir(); $path_temp = $upload_dir['basedir'] . '/temp-files/'; if (!is_dir($path_temp)) { mkdir($path_temp); chmod($path_temp, 0755); } $file_path = $path_temp . $t_name . '.' . $type; //echo $file_path;exit; if ($mime[0] != 'video' && $mime[0] != 'image' && $mime[0] != 'audio') { $archive_name = $t_name . '.zip'; $arhive_path = $path_temp . $archive_name; $file_url = rcl_path_to_url($arhive_path); $zip = new ZipArchive(); if ($zip->open($arhive_path, ZipArchive::CREATE) === TRUE) { $zip->addFile($_FILES['filedata']['tmp_name'], $file_name); $zip->close(); } else { print_r($_FILES); exit; } } else { if ($type == 'php' || $type == 'html') { exit; } move_uploaded_file($_FILES['filedata']['tmp_name'], $file_path); $file_url = rcl_path_to_url($file_path); } $wpdb->insert(RCL_PREF . 'private_message', array('author_mess' => $user_ID, 'content_mess' => $file_url, 'adressat_mess' => $adressat_mess, 'time_mess' => $time, 'status_mess' => 4)); $result = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . RCL_PREF . "private_message WHERE author_mess = '%d' AND content_mess = '%s'", $user_ID, $file_url)); if ($result) { $file_url = wp_nonce_url(get_bloginfo('wpurl') . '/?rcl-download-id=' . base64_encode($result), 'user-' . $user_ID); $log['recall'] = 100; $log['time'] = $time; } else { $log['recall'] = 120; } echo json_encode($log); exit; }
function rcl_frontend_scripts() { global $rcl_options, $user_LK, $user_ID, $post; if (!isset($rcl_options['font_icons'])) { $rcl_options['font_icons'] = 1; } if ($user_LK) { rcl_dialog_scripts(); } if ($user_ID) { if ($user_ID == $user_LK || $post && isset($rcl_options['public_form_page_rcl']) && $post->ID == $rcl_options['public_form_page_rcl']) { rcl_crop_scripts(); rcl_webcam_scripts(); } rcl_fileupload_scripts(); } if (wp_style_is('font-awesome')) { wp_deregister_style('font-awesome'); } wp_enqueue_style('font-awesome', RCL_URL . 'css/font-awesome/css/font-awesome.min.css', array(), '4.5.0'); if (isset($rcl_options['minify_css']) && $rcl_options['minify_css'] == 1) { if ($rcl_options['custom_scc_file_recall'] != '') { wp_enqueue_style('style_custom_rcl', $rcl_options['custom_scc_file_recall']); } else { wp_enqueue_style('rcl-style', RCL_UPLOAD_URL . 'css/minify.css'); } } else { $css_ar = array('lk', 'recbar', 'regform', 'slider', 'users', 'style'); foreach ($css_ar as $name) { wp_enqueue_style('style_' . $name, RCL_URL . 'css/' . $name . '.css'); } } if ($rcl_options['color_theme']) { $dirs = array(RCL_PATH . 'css/themes', RCL_TAKEPATH . 'themes'); foreach ($dirs as $dir) { if (!file_exists($dir . '/' . $rcl_options['color_theme'] . '.css')) { continue; } wp_enqueue_style('rcl-theme', rcl_path_to_url($dir . '/' . $rcl_options['color_theme'] . '.css')); break; } } if ($user_ID) { wp_enqueue_script('rangyinputs', RCL_URL . 'js/rangyinputs.js'); } wp_enqueue_script('rcl-primary-scripts', RCL_URL . 'js/recall.js', array(), VER_RCL); if (!file_exists(RCL_UPLOAD_PATH . 'scripts/header-scripts.js')) { $rcl_addons = new rcl_addons(); $rcl_addons->get_update_scripts_file_rcl(); } wp_enqueue_script('rcl-header-scripts', RCL_UPLOAD_URL . 'scripts/header-scripts.js', array('rcl-primary-scripts'), VER_RCL); }
function rcl_url_theme() { $dirs = array(RCL_TAKEPATH . 'themes', RCL_PATH . 'css/themes'); foreach ($dirs as $dir) { if (!file_exists($dir . '/' . $rcl_options['color_theme'] . '.css')) { continue; } wp_enqueue_theme_rcl(rcl_path_to_url($dir . '/' . $rcl_options['color_theme'] . '.css')); break; } }