public function viewSettingsAdmin() { global $aidlink; pageAccess('F'); $forum_settings = $this->get_forum_settings(); add_breadcrumb(array('link' => ADMIN . 'settings_forum.php' . $aidlink, 'title' => self::$locale['forum_settings'])); if (isset($_POST['recount_user_post'])) { $result = dbquery("SELECT post_author, COUNT(post_id) as num_posts FROM " . DB_FORUM_POSTS . " GROUP BY post_author"); if (dbrows($result)) { while ($data = dbarray($result)) { $result2 = dbquery("UPDATE " . DB_USERS . " SET user_posts='" . $data['num_posts'] . "' WHERE user_id='" . $data['post_author'] . "'"); } addNotice('success', self::$locale['forum_061']); } } if (isset($_POST['savesettings'])) { $numofthreads = form_sanitizer($_POST['numofthreads'], 20, 'numofthreads'); $threads_num = form_sanitizer($_POST['threads_per_page'], 20, 'threads_per_page'); $posts_num = form_sanitizer($_POST['posts_per_page'], 20, 'posts_per_page'); $forum_ips = form_sanitizer($_POST['forum_ips'], -103, 'forum_ips'); $attachmax = form_sanitizer($_POST['calc_b'], 1, 'calc_b') * form_sanitizer($_POST['calc_c'], 1000000, 'calc_c'); $attachmax_count = form_sanitizer($_POST['forum_attachmax_count'], 5, 'forum_attachmax_count'); $attachtypes = form_sanitizer($_POST['forum_attachtypes'], '.pdf,.gif,.jpg,.png,.zip,.rar,.tar,.bz2,.7z', 'forum_attachtypes'); $thread_notify = form_sanitizer($_POST['thread_notify'], '0', 'thread_notify'); $forum_ranks = form_sanitizer($_POST['forum_ranks'], '0', 'forum_ranks'); $forum_rank_style = form_sanitizer($_POST['forum_rank_style'], '0', 'forum_rank_style'); $forum_edit_lock = form_sanitizer($_POST['forum_edit_lock'], '0', 'forum_edit_lock'); $forum_edit_timelimit = form_sanitizer($_POST['forum_edit_timelimit'], '0', 'forum_edit_timelimit'); $popular_threads_timeframe = form_sanitizer($_POST['popular_threads_timeframe'], '604800', 'popular_threads_timeframe'); $forum_last_posts_reply = form_sanitizer($_POST['forum_last_posts_reply'], '0', 'forum_last_posts_reply'); $forum_last_post_avatar = form_sanitizer($_POST['forum_last_post_avatar'], '0', 'forum_last_post_avatar'); $forum_editpost_to_lastpost = form_sanitizer($_POST['forum_editpost_to_lastpost'], '0', 'forum_editpost_to_lastpost'); if (\defender::safe()) { dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$numofthreads}' WHERE settings_name='numofthreads' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$threads_num}' WHERE settings_name='threads_per_page' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$posts_num}' WHERE settings_name='posts_per_page' AND settings_inf='forum'"); //".(isnum($_POST['forum_ips']) ? $_POST['forum_ips'] : "103")." dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ips}' WHERE settings_name='forum_ips' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax}' WHERE settings_name='forum_attachmax' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax_count}' WHERE settings_name='forum_attachmax_count' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachtypes}' WHERE settings_name='forum_attachtypes' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$thread_notify}' WHERE settings_name='thread_notify' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ranks}' WHERE settings_name='forum_ranks' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_rank_style}' WHERE settings_name='forum_rank_style' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_lock}' WHERE settings_name='forum_edit_lock' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_timelimit}' WHERE settings_name='forum_edit_timelimit' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$popular_threads_timeframe}' WHERE settings_name='popular_threads_timeframe' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_posts_reply}' WHERE settings_name='forum_last_posts_reply' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_post_avatar}' WHERE settings_name='forum_last_post_avatar' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_editpost_to_lastpost}' WHERE settings_name='forum_editpost_to_lastpost' AND settings_inf='forum'"); addNotice('success', self::$locale['900']); redirect(FUSION_SELF . $aidlink . '§ion=fs'); } } $yes_no_array = array('1' => self::$locale['yes'], '0' => self::$locale['no']); echo "<div class='well'>" . self::$locale['forum_description'] . "</div>"; echo openform('forum_settings_form', 'post', FUSION_REQUEST, array('class' => 'm-t-20')); echo "<div class='row'>\n"; echo "<div class='col-xs-12 col-sm-8'>\n"; openside(''); echo "<span class='small pull-right'>* " . self::$locale['506'] . "</span><br/>\n"; echo form_text('numofthreads', self::$locale['505'], $forum_settings['numofthreads'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number')); closeside(); openside(''); echo form_text('threads_per_page', self::$locale['forum_080'], $forum_settings['threads_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number')); echo form_text('posts_per_page', self::$locale['forum_081'], $forum_settings['posts_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number')); closeside(); openside(''); echo form_select('thread_notify', self::$locale['512'], $forum_settings['thread_notify'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); closeside(); openside(''); echo "<span class='pull-right position-absolute small' style='right:30px;'>" . self::$locale['537'] . "</span>\n"; echo form_select('forum_edit_timelimit', self::$locale['536'], $forum_settings['forum_edit_timelimit'], array('options' => array('0', '10', '30', '45', '60'), 'max_length' => 2, 'width' => '100px', 'required' => 1, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_ips', self::$locale['507'], $forum_settings['forum_ips'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_ranks', self::$locale['520'], $forum_settings['forum_ranks'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_rank_style', self::$locale['forum_064'], $forum_settings['forum_rank_style'], array('options' => array(self::$locale['forum_063'], self::$locale['forum_062']), 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_last_post_avatar', self::$locale['539'], $forum_settings['forum_last_post_avatar'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_edit_lock', self::$locale['521'], $forum_settings['forum_edit_lock'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_editpost_to_lastpost', self::$locale['538'], $forum_settings['forum_editpost_to_lastpost'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); closeside(); echo "</div>\n"; echo "<div class='col-xs-12 col-sm-4'>\n"; openside(''); $calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)'); $calc_c = self::calculate_byte($forum_settings['forum_attachmax']); $calc_b = $forum_settings['forum_attachmax'] / $calc_c; require_once INCLUDES . "mimetypes_include.php"; $mime = mimeTypes(); $mime_opts = array(); foreach ($mime as $m => $Mime) { $ext = ".{$m}"; $mime_opts[$ext] = $ext; } sort($mime_opts); echo "<div class='clearfix'>\n"; echo "<span class='pull-right small'>" . self::$locale['509'] . "</span>"; echo "<label for='calc_c'>" . self::$locale['508'] . "</label><br />\n"; echo form_text('calc_b', '', $calc_b, array('required' => 1, 'number' => 1, 'error_text' => self::$locale['error_rate'], 'width' => '100px', 'max_length' => '3', 'class' => 'm-r-10 pull-left')); echo form_select('calc_c', '', $calc_c, array('options' => $calc_opts, 'placeholder' => self::$locale['choose'], 'class' => 'pull-left', 'width' => '100%')); echo "</div>\n"; echo "<div class='clearfix'>\n"; echo "<span class='small pull-right'>" . self::$locale['535'] . "</span>\n"; echo "<label for='attachmax_count'>" . self::$locale['534'] . "</label>\n"; echo form_select('forum_attachmax_count', '', $forum_settings['forum_attachmax_count'], array('options' => range(1, 10), 'error_text' => self::$locale['error_value'], 'width' => '100%')); echo "</div>\n"; echo "<div class='clearfix'>\n"; echo "<span class='small pull-right'>" . self::$locale['511'] . "</span>\n"; echo form_select('forum_attachtypes', self::$locale['510'], $forum_settings['forum_attachtypes'], array('options' => $mime_opts, 'width' => '100%', 'error_text' => self::$locale['error_type'], 'tags' => 1, 'multiple' => 1, 'placeholder' => self::$locale['choose'])); echo "</div>\n"; closeside(); openside(''); $timeframe_opts = array('604800' => self::$locale['527'], '2419200' => self::$locale['528'], '31557600' => self::$locale['529'], '0' => self::$locale['530']); $lastpost_opts = array('0' => self::$locale['519'], '1' => self::$locale['533']); for ($i = 2; $i <= 20; $i++) { $array_opts[$i] = sprintf(self::$locale['532'], $i); } if (isset($_GET['action']) && $_GET['action'] == "count_posts") { echo alert(self::$locale['524'], '', array('class' => 'warning')); } echo "<div class='clearfix'>\n"; echo form_select('popular_threads_timeframe', self::$locale['525'], $forum_settings['popular_threads_timeframe'], array('options' => $timeframe_opts, 'error_text' => self::$locale['error_value'], 'width' => '100%')); echo "</div>\n"; echo "<div class='clearfix'>\n"; echo form_select('forum_last_posts_reply', self::$locale['531'], $forum_settings['forum_last_posts_reply'], array('options' => $lastpost_opts, 'error_text' => self::$locale['error_value'], 'width' => '100%')); echo "</div>\n"; echo form_button('recount_user_post', self::$locale['523'], '1', array('class' => 'btn-primary btn-block')); closeside(); echo "</div>\n"; echo "</div>\n"; echo form_button('savesettings', self::$locale['750'], self::$locale['750'], array('class' => 'btn-success')); echo closeform(); }
$algo = fusion_get_settings('password_algorithm'); $key = $userdata['user_id'] . $token_time . iAUTH . SECRET_KEY; $salt = md5($userdata['user_admin_salt'] . SECRET_KEY_SALT); $_SESSION['aid'] = $userdata['user_id'] . "." . $token_time . "." . hash_hmac($algo, $key, $salt); } // PHP-Fusion user cookie functions if (!isset($_COOKIE[COOKIE_PREFIX . 'visited'])) { $result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value=settings_value+1 WHERE settings_name='counter'"); setcookie(COOKIE_PREFIX . "visited", "yes", time() + 31536000, "/", "", "0"); } $lastvisited = Authenticate::setLastVisitCookie(); // Check file types of the uploaded file with known mime types list to prevent uploading unwanted files if enabled if ($settings['mime_check'] == "1") { if (isset($_FILES) && count($_FILES)) { require_once INCLUDES . "mimetypes_include.php"; $mime_types = mimeTypes(); foreach ($_FILES as $each) { if (isset($each['name']) && strlen($each['tmp_name'])) { $file_info = pathinfo($each['name']); $extension = $file_info['extension']; if (array_key_exists($extension, $mime_types)) { if (is_array($mime_types[$extension])) { $valid_mimetype = FALSE; foreach ($mime_types[$extension] as $each_mimetype) { if ($each_mimetype == $each['type']) { $valid_mimetype = TRUE; break; } } if (!$valid_mimetype) { die('Prevented an unwanted file upload attempt!');
/** The master form for Adding or Editing Dynamic Fields */ private function quantum_dynamics_form() { global $aidlink, $defender; $config = array(); $config_1 = array(); $config_2 = array('field_thumbnail' => 0, 'field_thumbnail_2' => 0); $form_action = FUSION_SELF . $aidlink; if (isset($_GET['action']) && $_GET['action'] == 'field_edit' && isset($_GET['field_id']) && self::validate_field($_GET['field_id'])) { $form_action .= "&action=" . $_GET['action'] . "&field_id=" . $_GET['field_id']; $result = dbquery("SELECT * FROM " . $this->field_db . " WHERE field_id='" . intval($_GET['field_id']) . "'"); if (dbrows($result) > 0) { $this->field_data = dbarray($result); if ($this->field_data['field_type'] == 'upload') { $this->field_data += unserialize($this->field_data['config']); // uncompress serialized extended information. if ($this->debug) { print_p($this->field_data); } } } else { if (!$this->debug) { redirect(FUSION_SELF . $aidlink); } } } $this->field_data['field_type'] = isset($_POST['add_field']) ? form_sanitizer($_POST['add_field'], '') : $this->field_data['field_type']; if (isset($_POST['save_field'])) { $this->field_data = array('field_type' => isset($_POST['add_field']) ? form_sanitizer($_POST['add_field'], '') : $this->field_data['field_type'], 'field_id' => form_sanitizer($_POST['field_id'], '0', 'field_id'), 'field_title' => form_sanitizer($_POST['field_title'], '', 'field_title', 1), 'field_name' => form_sanitizer($_POST['field_name'], '', 'field_name'), 'field_cat' => form_sanitizer($_POST['field_cat'], '0', 'field_cat'), 'field_options' => isset($_POST['field_options']) ? form_sanitizer($_POST['field_options'], '', 'field_options') : $this->field_data['field_options'], 'field_default' => isset($_POST['field_default']) ? form_sanitizer($_POST['field_default'], '', 'field_default') : $this->field_data['field_default'], 'field_error' => form_sanitizer($_POST['field_error'], '', 'field_error'), 'field_required' => isset($_POST['field_required']) ? 1 : 0, 'field_log' => isset($_POST['field_log']) ? 1 : 0, 'field_registration' => isset($_POST['field_registration']) ? 1 : 0, 'field_order' => form_sanitizer($_POST['field_order'], '0', 'field_order')); $this->field_data['field_name'] = str_replace(' ', '_', $this->field_data['field_name']); // make sure no space. if ($this->field_data['field_type'] == 'upload') { $max_b = isset($_POST['field_max_b']) ? form_sanitizer($_POST['field_max_b'], '', 'field_max_b') : 150000; $calc = isset($_POST['field_calc']) ? form_sanitizer($_POST['field_calc'], '', 'field_calc') : 1; $config = array('field_max_b' => isset($_POST['field_max_b']) && isset($_POST['field_calc']) ? $max_b * $calc : $this->field_data['field_max_b'], 'field_upload_type' => isset($_POST['field_upload_type']) ? form_sanitizer($_POST['field_upload_type'], '', 'field_upload_type') : $this->field_data['field_upload_type'], 'field_upload_path' => isset($_POST['field_upload_path']) ? form_sanitizer($_POST['field_upload_path'], '', 'field_upload_path') : $this->field_data['field_upload_path']); $config_1['field_valid_file_ext'] = isset($_POST['field_valid_file_ext']) && $config['field_upload_type'] == 'file' ? form_sanitizer($_POST['field_valid_file_ext'], '', 'field_valid_file_ext') : $this->field_data['field_valid_file_ext']; $config_2 = array('field_valid_image_ext' => isset($_POST['field_valid_image_ext']) && $config['field_upload_type'] == 'image' ? form_sanitizer($_POST['field_valid_image_ext'], '', 'field_valid_image_ext') : $this->field_data['field_valid_image_ext'], 'field_image_max_w' => isset($_POST['field_image_max_w']) && $config['field_upload_type'] == 'image' ? form_sanitizer($_POST['field_image_max_w'], '', 'field_image_max_w') : $this->field_data['field_image_max_w'], 'field_image_max_h' => isset($_POST['field_image_max_h']) && $config['field_upload_type'] == 'image' ? form_sanitizer($_POST['field_image_max_h'], '', 'field_image_max_h') : $this->field_data['field_image_max_h'], 'field_thumbnail' => isset($_POST['field_thumbnail']) ? form_sanitizer($_POST['field_thumbnail'], 0, 'field_thumbnail') : $this->field_data['field_thumbnail'], 'field_thumb_upload_path' => isset($_POST['field_thumb_upload_path']) && $config['field_upload_type'] == 'image' && $config_2['field_thumbnail'] ? form_sanitizer($_POST['field_thumb_upload_path'], '', 'field_thumb_upload_path') : $this->field_data['field_thumb_upload_path'], 'field_thumb_w' => isset($_POST['field_thumb_w']) && $config['field_upload_type'] == 'image' && $config_2['field_thumbnail'] ? form_sanitizer($_POST['field_thumb_w'], '', 'field_thumb_w') : $this->field_data['field_thumb_w'], 'field_thumb_h' => isset($_POST['field_thumb_h']) && $config['field_upload_type'] == 'image' && $config_2['field_thumbnail'] ? form_sanitizer($_POST['field_thumb_h'], '', 'field_thumb_h') : $this->field_data['field_thumb_h'], 'field_thumbnail_2' => isset($_POST['field_thumbnail_2']) ? 1 : isset($_POST['field_id']) ? 0 : $this->field_data['field_thumbnail_2'], 'field_thumb2_upload_path' => isset($_POST['field_thumb2_upload_path']) && $config['field_upload_type'] == 'image' && $config_2['field_thumbnail_2'] ? form_sanitizer($_POST['field_thumb2_upload_path'], '', 'field_thumb2_upload_path') : $this->field_data['field_thumb2_upload_path'], 'field_thumb2_w' => isset($_POST['field_thumb2_w']) && $config['field_upload_type'] == 'image' && $config_2['field_thumbnail_2'] ? form_sanitizer($_POST['field_thumb2_w'], '', 'field_thumb2_w') : $this->field_data['field_thumb2_w'], 'field_thumb2_h' => isset($_POST['field_thumb2_h']) && $config['field_upload_type'] == 'image' && $config_2['field_thumbnail_2'] ? form_sanitizer($_POST['field_thumb2_h'], '', 'field_thumb2_h') : $this->field_data['field_thumb2_h'], 'field_delete_original' => isset($_POST['field_delete_original']) && $config['field_upload_type'] == 'image' ? 1 : isset($_POST['field_id']) ? 0 : $this->field_data['field_delete_original']); if ($config['field_upload_type'] == 'file') { $config = array_merge($config, $config_1); } elseif ($config['field_upload_type'] == 'image') { // upload path must be required. $config = array_merge($config, $config_2); } else { \defender::stop(); addNotice('danger', $this->locale['fields_0108']); } if (\defender::safe()) { $this->field_data['config'] = serialize($config); } } $this->create_fields($this->field_data, 'dynamics'); } echo "<div class='m-t-20'>\n"; echo openform('fieldform', 'post', $form_action, array('max_tokens' => 1)); echo form_button('save_field', $this->locale['fields_0488'], 'save', array('input_id' => "save_field2", 'class' => 'btn-primary m-b-20')); $disable_opts = array(); foreach ($this->page_list as $index => $v) { $disable_opts[] = $index; } // ok the value generated needs to be parsed by quantum echo form_select_tree('field_cat', $this->locale['fields_0450'], $this->field_data['field_cat'], array('no_root' => 1, 'width' => '100%', 'disable_opts' => $disable_opts), $this->category_db, 'field_cat_name', 'field_cat_id', 'field_parent'); echo self::quantum_multilocale_fields('field_title', $this->locale['fields_0451'], $this->field_data['field_title'], array('required' => 1)); echo form_text('field_name', $this->locale['fields_0453'], $this->field_data['field_name'], array('placeholder' => $this->locale['fields_0454'], 'required' => 1)); if ($this->field_data['field_type'] == 'select') { echo form_select('field_options', $this->locale['fields_0455'], $this->field_data['field_options'], array('required' => 1, 'tags' => 1, 'multiple' => 1)); } if ($this->field_data['field_type'] == 'upload') { require_once INCLUDES . 'mimetypes_include.php'; $file_type_list = array(); $file_image_list = array(); foreach (mimeTypes() as $file_ext => $occ) { if (!in_array($file_ext, array_flip(img_mimeTypes()))) { $file_type_list[] = '.' . $file_ext; } } foreach (img_mimeTypes() as $file_ext => $occ) { $file_image_list[] = '.' . $file_ext; } function calculate_byte($download_max_b) { $calc_opts = array(1 => $this->locale['fields_0490'], 1000 => $this->locale['fields_0491'], 1000000 => $this->locale['fields_0492']); foreach ($calc_opts as $byte => $val) { if ($download_max_b / $byte <= 999) { return $byte; } } return 1000000; } $calc_opts = array(1 => $this->locale['fields_0490'], 1000 => $this->locale['fields_0491'], 1000000 => $this->locale['fields_0492']); $calc_c = calculate_byte($config['field_max_b']); $calc_b = $config['field_max_b'] / $calc_c; $file_upload_type = array('file' => $this->locale['fields_0456'], 'image' => 'Image Only'); echo form_select('field_upload_type', $this->locale['fields_0457'], $config['field_upload_type'], array("options" => $file_upload_type)); echo form_text('field_upload_path', $this->locale['fields_0458'], $config['field_upload_path'], array('placeholder' => $this->locale['fields_0459'], 'required' => 1)); echo "<label for='field_max_b'>" . $this->locale['fields_0460'] . "</label>\n<br/>"; echo "<div class='row'>\n"; echo "<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'>\n"; echo form_text('field_max_b', '', $calc_b, array('class' => 'm-b-0', 'number' => 1, 'required' => 1)); echo "</div><div class='col-xs-6 col-sm-6 col-md-6 col-lg-6 p-l-0'>\n"; echo form_select('field_calc', '', $calc_c, array('options' => $calc_opts, 'width' => '100%')); echo "</div>\n</div>\n"; // File Type echo "<div id='file_type'>\n"; echo form_select('field_valid_file_ext', $this->locale['fields_0461'], $config_1['field_valid_file_ext'], array('options' => $file_type_list, 'multiple' => TRUE, 'tags' => TRUE, 'required' => TRUE)); echo "</div>\n"; // Image Type echo "<div id='image_type'>\n"; echo form_select('field_valid_image_ext', $this->locale['fields_0462'], $config_2['field_valid_image_ext'], array('options' => $file_image_list, 'multiple' => TRUE, 'tags' => TRUE, 'required' => TRUE)); echo "<label>" . $this->locale['fields_0463'] . "</label>\n<br/>"; echo "<div class='row'>\n"; echo "<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'>\n"; echo form_text('field_image_max_w', $this->locale['fields_0464'], $config_2['field_image_max_w'], array('number' => 1, 'placeholder' => $this->locale['fields_0466'], 'required' => 1)); echo "</div><div class='col-xs-6 col-sm-6 col-md-6 col-lg-6 p-l-0'>\n"; echo form_text('field_image_max_h', $this->locale['fields_0465'], $config_2['field_image_max_h'], array('number' => 1, 'placeholder' => $this->locale['fields_0466'], 'required' => 1)); echo "</div>\n</div>\n"; echo form_checkbox('field_thumbnail', $this->locale['fields_0467'], $config_2['field_thumbnail']); echo "<div id='field_t1'>\n"; echo form_text('field_thumb_upload_path', $this->locale['fields_0468'], $config_2['field_thumb_upload_path'], array('placeholder' => $this->locale['fields_0469'], 'required' => 1)); echo "<label>" . $this->locale['fields_0470'] . "</label>\n<br/>"; echo "<div class='row'>\n"; echo "<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'>\n"; echo form_text('field_thumb_w', $this->locale['fields_0471'], $config_2['field_thumb_w'], array('number' => 1, 'placeholder' => $this->locale['fields_0466'], 'required' => 1)); echo "</div><div class='col-xs-6 col-sm-6 col-md-6 col-lg-6 p-l-0'>\n"; echo form_text('field_thumb_h', $this->locale['fields_0472'], $config_2['field_thumb_h'], array('number' => 1, 'placeholder' => $this->locale['fields_0466'], 'required' => 1)); echo "</div>\n</div>\n"; echo "</div>\n"; echo form_checkbox('field_thumbnail_2', $this->locale['fields_0473'], $config_2['field_thumbnail_2']); echo "<div id='field_t2'>\n"; echo form_text('field_thumb2_upload_path', $this->locale['fields_0474'], $config_2['field_thumb2_upload_path'], array('placeholder' => $this->locale['fields_0469'], 'required' => 1)); echo "<label>" . $this->locale['fields_0475'] . "</label>\n<br/>"; echo "<div class='row'>\n"; echo "<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'>\n"; echo form_text('field_thumb2_w', $this->locale['fields_0476'], $config_2['field_thumb2_h'], array('number' => 1, 'placeholder' => $this->locale['fields_0466'], 'required' => 1)); echo "</div><div class='col-xs-6 col-sm-6 col-md-6 col-lg-6 p-l-0'>\n"; echo form_text('field_thumb2_h', $this->locale['fields_0477'], $config_2['field_thumb2_h'], array('number' => 1, 'placeholder' => $this->locale['fields_0466'], 'required' => 1)); echo "</div>\n</div>\n"; echo "</div>\n"; echo form_checkbox('field_delete_original', $this->locale['fields_0478'], $config_2['field_delete_original']); echo "</div>\n"; add_to_jquery("\n\t\t\tif (\$('#field_upload_type').select2().val() == 'image') {\n\t\t\t\t\$('#image_type').show();\n\t\t\t\t\$('#file_type').hide();\n\t\t\t} else {\n\t\t\t\t\$('#image_type').hide();\n\t\t\t\t\$('#file_type').show();\n\t\t\t}\n\t\t\t\$('#field_upload_type').bind('change', function() {\n\t\t\t\tif (\$(this).select2().val() == 'image') {\n\t\t\t\t\$('#image_type').show();\n\t\t\t\t\$('#file_type').hide();\n\t\t\t\t} else {\n\t\t\t\t\$('#image_type').hide();\n\t\t\t\t\$('#file_type').show();\n\t\t\t\t}\n\t\t\t});\n\t\t\t// thumbnail\n\t\t\t\$('#field_thumbnail').is(':checked') ? \$('#field_t1').show() : \$('#field_t1').hide();\n\t\t\t\$('#field_thumbnail').bind('click', function() {\n\t\t\t\t\$(this).is(':checked') ? \$('#field_t1').show() : \$('#field_t1').hide();\n\t\t\t});\n\t\t\t// thumbnail 2\n\t\t\t\$('#field_thumbnail_2').is(':checked') ? \$('#field_t2').show() : \$('#field_t2').hide();\n\t\t\t\$('#field_thumbnail_2').bind('click', function() {\n\t\t\t\t\$(this).is(':checked') ? \$('#field_t2').show() : \$('#field_t2').hide();\n\t\t\t});\n\t\t\t"); } else { // @todo add config for textarea if ($this->field_data['field_type'] !== 'textarea') { echo form_text('field_default', $this->locale['fields_0480'], $this->field_data['field_default']); } echo form_text('field_error', $this->locale['fields_0481'], $this->field_data['field_error']); } echo form_checkbox('field_required', $this->locale['fields_0482'], $this->field_data['field_required']); echo form_checkbox('field_log', $this->locale['fields_0483'], $this->field_data['field_log']); echo form_text('field_order', $this->locale['fields_0484'], $this->field_data['field_order'], array('number' => 1)); echo form_checkbox('field_registration', $this->locale['fields_0485'], $this->field_data['field_registration']); echo form_hidden('add_field', '', $this->field_data['field_type']); echo form_hidden('field_id', '', $this->field_data['field_id']); echo form_button('save_field', $this->locale['fields_0488'], 'save', array('class' => 'btn-sm btn-primary')); echo closeform(); echo "</div>\n"; }
echo form_select('forum_edit_timelimit', $locale['536'], $forum_settings['forum_edit_timelimit'], array('options' => array('0', '10', '30', '45', '60'), 'max_length' => 2, 'width' => '100px', 'required' => 1, 'error_text' => $locale['error_value'], 'inline' => 1)); echo form_select('forum_ips', $locale['507'], $forum_settings['forum_ips'], array('options' => $yes_no_array, 'error_text' => $locale['error_value'], 'inline' => 1)); echo form_select('forum_ranks', $locale['520'], $forum_settings['forum_ranks'], array('options' => $yes_no_array, 'error_text' => $locale['error_value'], 'inline' => 1)); echo form_select('forum_rank_style', $locale['forum_064'], $forum_settings['forum_rank_style'], array('options' => array($locale['forum_063'], $locale['forum_062']), 'error_text' => $locale['error_value'], 'inline' => 1)); echo form_select('forum_last_post_avatar', $locale['539'], $forum_settings['forum_last_post_avatar'], array('options' => $yes_no_array, 'error_text' => $locale['error_value'], 'inline' => 1)); echo form_select('forum_edit_lock', $locale['521'], $forum_settings['forum_edit_lock'], array('options' => $yes_no_array, 'error_text' => $locale['error_value'], 'inline' => 1)); echo form_select('forum_editpost_to_lastpost', $locale['538'], $forum_settings['forum_editpost_to_lastpost'], array('options' => $yes_no_array, 'error_text' => $locale['error_value'], 'inline' => 1)); closeside(); echo "</div>\n"; echo "<div class='col-xs-12 col-sm-4'>\n"; openside(''); $calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)'); $calc_c = calculate_byte($forum_settings['forum_attachmax']); $calc_b = $forum_settings['forum_attachmax'] / $calc_c; require_once INCLUDES . "mimetypes_include.php"; $mime = mimeTypes(); $mime_opts = array(); foreach ($mime as $m => $Mime) { $ext = ".{$m}"; $mime_opts[$ext] = $ext; } echo "<div class='clearfix'>\n"; echo "<span class='pull-right small'>" . $locale['509'] . "</span>"; echo "<label for='calc_c'>" . $locale['508'] . "</label><br />\n"; echo form_text('calc_b', '', $calc_b, array('required' => 1, 'number' => 1, 'error_text' => $locale['error_rate'], 'width' => '100px', 'max_length' => '3', 'class' => 'm-r-10 pull-left')); echo form_select('calc_c', '', $calc_c, array('options' => $calc_opts, 'placeholder' => $locale['choose'], 'class' => 'pull-left', 'width' => '100%')); echo "</div>\n"; echo "<div class='clearfix'>\n"; echo "<span class='small pull-right'>" . $locale['535'] . "</span>\n"; echo "<label for='attachmax_count'>" . $locale['534'] . "</label>\n"; echo form_select('forum_attachmax_count', '', $forum_settings['forum_attachmax_count'], array('options' => range(1, 10), 'error_text' => $locale['error_value'], 'width' => '100%'));
private function validate_file($value, $type, $path, $maxsize, $default, $name, $id, $required = FALSE, $safemode = FALSE, $error_text = FALSE) { global $settings; if ($required && $value['name']) { if (isset($value['name'])) { require_once BASEDIR . 'includes/mimetypes_include.php'; if ($type == 'image') { $mimetypes = array('jpg' => 'image/jpg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'tiff' => 'image/tiff', 'tif' => 'image/tif', 'bmp' => 'image/x-ms-bmp', 'ico' => 'image/x-icon'); // all } elseif ($type == 'file') { $mimetypes = mimeTypes(); // all } $acceptable = explode(',', $settings['attachtypes']); //jpg. foreach ($acceptable as $types_of_files_mime) { $files_ext = $mimetypes[ltrim($types_of_files_mime, '.')]; if ($files_ext) { $acceptable_files[] = $files_ext; } } $errors = array(); $maxsize = $settings['attachmax']; $file_max_size = parsebytesize($maxsize); if ($value['size'] >= $maxsize || $value['size'] == 0) { $errors[] = 1; $error_text = "File too large. File must be less than " . $file_max_size . "."; $this->stop(); $this->addError($id); $this->addHelperText($id, $error_text); $this->addNotice("<b>{$name}</b> is not a valid file type."); } if (!in_array($value['type'], $acceptable_files) && !empty($value['type'])) { $errors[] = 1; $error_text = "Invalid file type. Only " . implode(", ", $acceptable) . " is allowed."; $this->stop(); $this->addError($id); $this->addHelperText($id, $error_text); $this->addNotice("<b>{$name}</b> is not a valid file type."); } if (count($errors) === 0) { $ext = strrchr($value['name'], "."); $secret_rand = rand(1000000, 9999999); $hash = substr(md5($secret_rand), 8, 8); $return_value = isset($value['name']) && $value['name'] !== "" ? $location . $hash . $ext : $default; if (!defined('FUSION_NULL')) { if (is_uploaded_file($value['tmp_name'])) { if (verify_image($value['tmp_name'])) { //if (!file_exists($location)) { // mkdir($location, 0644, true); //} move_uploaded_file($value['tmp_name'], $location . $hash . $ext); } else { $this->addNotice("<b>{$name}</b> is failed verification check."); } } else { $this->addNotice("<b>{$name}</b> is not uploaded."); } } return $return_value; } return $default; } else { $this->stop(); $this->addError($id); $this->addHelperText($id, $error_text); $this->addNotice("<b>{$name}</b> is not a valid file."); } } else { return $default; } }