function cs_pictures_upload($file, $mod, $fid, $ajaxclean = 1) { if (!empty($_POST['del_picture'])) { cs_pictures_delete($_POST['del_picture']); } if (empty($file['tmp_name'])) { return true; } settype($fid, 'integer'); $types_allowed = array('image/jpeg', 'image/png', 'image/pjpeg', 'image/x-png'); if (!in_array($file['type'], $types_allowed)) { return false; } $exts = array('image/jpeg' => 'jpg', 'image/png' => 'png', 'image/pjpeg' => 'jpg', 'image/x-png' => 'png'); $ext = $exts[$file['type']]; $where = "pictures_fid = '" . $fid . "' AND pictures_mod = '" . $mod . "'"; $already = cs_sql_select(__FILE__, 'pictures', 'pictures_id', $where); $pictures_id = $already['pictures_id']; if (empty($already)) { $vars = array(); $vars['pictures_mod'] = $mod; $vars['pictures_fid'] = $fid; cs_sql_insert(__FILE__, 'pictures', array_keys($vars), array_values($vars)); $pictures_id = cs_sql_insertid(__FILE__); } if (!cs_upload('pictures', 'picture-' . $pictures_id . '.' . $ext, $file['tmp_name'], $ajaxclean)) { cs_sql_delete(__FILE__, 'pictures', $pictures_id); return false; } $cells = array('pictures_file'); $content = array('picture-' . $pictures_id . '.' . $ext); cs_sql_update(__FILE__, 'pictures', $cells, $content, $pictures_id); return true; }
$levels++; } $data['cat']['abcode_smileys'] = cs_abcode_smileys('categories_text'); $data['cat']['abcode_features'] = cs_abcode_features('categories_text'); $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_categories['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_categories['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_categories['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['cat']['picup_clip'] = cs_abcode_clip($matches); echo cs_subtemplate(__FILE__, $data, 'categories', 'create'); } else { $categories_cells = array_keys($cs_categories); $categories_save = array_values($cs_categories); cs_sql_insert(__FILE__, 'categories', $categories_cells, $categories_save); if (!empty($files_gl['picture']['tmp_name'])) { $where = "categories_name = '" . cs_sql_escape($cs_categories['categories_name']) . "'"; $getid = cs_sql_select(__FILE__, 'categories', 'categories_id', $where); $filename = 'picture-' . $getid['categories_id'] . '.' . $extension; cs_upload('categories', $filename, $files_gl['picture']['tmp_name']); $cs_categories2['categories_picture'] = $filename; $categories2_cells = array_keys($cs_categories2); $categories2_save = array_values($cs_categories2); cs_sql_update(__FILE__, 'categories', $categories2_cells, $categories2_save, $getid['categories_id']); } cs_redirect($cs_lang['create_done'], 'categories', 'manage', 'where=' . $cs_categories['categories_mod']); }
if (empty($error)) { switch ($img_size[2]) { case 1: $ext = 'gif'; break; case 2: $ext = 'jpg'; break; case 3: $ext = 'png'; break; } $target = $cs_computers_id . '-' . $computer_next . '.' . $ext; $picture_name = 'picture-' . $target; $thumb_name = 'thumb-' . $target; if (cs_resample($files_gl['picture']['tmp_name'], 'uploads/computers/' . $thumb_name, 150, 300) and cs_upload('computers', $picture_name, $files_gl['picture']['tmp_name'])) { $cells = array('computers_pictures'); $content = empty($computer_string) ? array($target) : array($computer_string . "\n" . $target); cs_sql_update(__FILE__, 'computers', $cells, $content, $cs_computers_id); cs_redirect($cs_lang['success'], 'computers', 'picture', 'id=' . $cs_computers_id); } else { $error .= $cs_lang['up_error']; } } } $data = array(); $data['if']['own'] = $computer['users_id'] == $account['users_id'] ? true : false; if (!empty($error)) { $data['head']['body'] = $error; } elseif (isset($_GET['delete'])) { cs_redirect($cs_lang['remove_done'], 'computers', 'picture', 'id=' . $cs_computers_id);
$data['abcode']['result'] = $cs_abcode['abcode_result']; $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_abcode['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_abcode['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_abcode['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['lang']['clip'] = cs_abcode_clip($matches); $data['abcode']['order'] = $cs_abcode['abcode_order']; echo cs_subtemplate(__FILE__, $data, 'abcode', 'create'); } else { $abcode_cells = array_keys($cs_abcode); $abcode_save = array_values($cs_abcode); cs_sql_insert(__FILE__, 'abcode', $abcode_cells, $abcode_save); if (!empty($files['picture']['tmp_name'])) { $where = "abcode_pattern = '" . cs_sql_escape($cs_abcode['abcode_pattern']) . "'"; $getid = cs_sql_select(__FILE__, 'abcode', 'abcode_id', $where); $filename = 'picture-' . $getid['abcode_id'] . '.' . $extension; cs_upload('abcode', $filename, $files['picture']['tmp_name']); $cs_abcode2['abcode_file'] = $filename; $abcode2_cells = array_keys($cs_abcode2); $abcode2_save = array_values($cs_abcode2); cs_sql_update(__FILE__, 'abcode', $abcode2_cells, $abcode2_save, $getid['abcode_id']); } cs_cache_delete('abcode_smileys'); cs_cache_delete('abcode_content'); cs_redirect($cs_lang['create_done'], 'abcode'); }
break; } $filename = 'picture-' . $clans_id . '.' . $ext; if ($img_size[0] > $op_clans['max_width']) { $errormsg .= $cs_lang['too_wide'] . cs_html_br(1); $error++; } if ($img_size[1] > $op_clans['max_height']) { $errormsg .= $cs_lang['too_high'] . cs_html_br(1); $error++; } if ($files['picture']['size'] > $op_clans['max_size']) { $errormsg .= $cs_lang['too_big'] . cs_html_br(1); $error++; } if (empty($error) and cs_upload('clans', $filename, $files['picture']['tmp_name']) or !empty($error) and extension_loaded('gd') and cs_resample($files['picture']['tmp_name'], 'uploads/clans/' . $filename, $op_clans['max_width'], $op_clans['max_height'])) { $error = 0; $errormsg = ''; if ($cs_clans['clans_picture'] != $filename and !empty($cs_clans['clans_picture'])) { cs_unlink('clans', $cs_clans['clans_picture']); } $cs_clans['clans_picture'] = $filename; } else { $errormsg .= $cs_lang['up_error']; $error++; } } if (empty($cs_clans['clans_name'])) { $error++; $errormsg .= $cs_lang['no_name'] . cs_html_br(1); }
if (empty($error)) { switch ($img_size[2]) { case 1: $ext = 'gif'; break; case 2: $ext = 'jpg'; break; case 3: $ext = 'png'; break; } $target = $cs_files_id . '-' . $file_next . '.' . $ext; $picture_name = 'picture-' . $target; $thumb_name = 'thumb-' . $target; if (cs_resample($files_gl['picture']['tmp_name'], 'uploads/files/' . $thumb_name, 80, 200) and cs_upload('files', $picture_name, $files_gl['picture']['tmp_name'])) { $cells = array('files_previews'); $content = empty($file_string) ? array($target) : array($file_string . "\n" . $target); cs_sql_update(__FILE__, 'files', $cells, $content, $cs_files_id); cs_redirect($cs_lang['success'], 'files', 'picture', 'id=' . $cs_files_id); } else { $message .= $cs_lang['up_error']; $error++; } } } if (!empty($message)) { $data['head']['text'] = $message; } elseif (empty($_GET['delete'])) { $data['head']['text'] = $cs_lang['body_picture']; } else {
$data['banners']['or_img_url'] = $cs_banners['banners_picture']; $data['banners']['alt'] = $cs_banners['banners_alt']; $data['banners']['order'] = $cs_banners['banners_order']; $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_banners['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_banners['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_banners['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['banners']['clip'] = cs_abcode_clip($matches); echo cs_subtemplate(__FILE__, $data, 'banners', 'create'); } else { settype($cs_banners['banners_order'], 'integer'); $banners_cells = array_keys($cs_banners); $banners_save = array_values($cs_banners); cs_sql_insert(__FILE__, 'banners', $banners_cells, $banners_save); if (!empty($files['picture']['tmp_name'])) { $where = "banners_name = '" . cs_sql_escape($cs_banners['banners_name']) . "'"; $getid = cs_sql_select(__FILE__, 'banners', 'banners_id', $where); $filename = 'picture-' . $getid['banners_id'] . '.' . $extension; cs_upload('banners', $filename, $files['picture']['tmp_name']); $cs_banners2['banners_picture'] = 'uploads/banners/' . $filename; $banners2_cells = array_keys($cs_banners2); $banners2_save = array_values($cs_banners2); cs_sql_update(__FILE__, 'banners', $banners2_cells, $banners2_save, $getid['banners_id']); } cs_redirect($cs_lang['create_done'], 'banners'); }
break; } if (empty($extension)) { $error .= cs_html_br(1) . $cs_lang['wrong_ext']; } else { $save['medals_extension'] = $extension; } } } if (!empty($_POST['submit']) && empty($error)) { $cells = array_keys($save); $values = array_values($save); cs_sql_insert(__FILE__, 'medals', $cells, $values); if (!empty($files_gl['medals_picture']['tmp_name'])) { $id = cs_sql_insertid(__FILE__); $filename = 'medal-' . $id . '.' . $extension; cs_upload('medals', $filename, $files_gl['medals_picture']['tmp_name']); } cs_redirect($cs_lang['create_done'], 'medals'); } if (empty($_POST['submit'])) { $data['medals']['medals_name'] = ''; $data['medals']['medals_text'] = ''; } else { $data['medals']['medals_name'] = $save['medals_name']; $data['medals']['medals_text'] = $save['medals_text']; } $data['medals']['message'] = empty($error) ? $cs_lang['errors_here'] : $cs_lang['error_occured'] . $error; $data['form']['abcode'] = cs_abcode_features('medals_text'); $data['form']['dirname'] = $cs_main['php_self']['dirname']; echo cs_subtemplate(__FILE__, $data, 'medals', 'create');
} elseif (!empty($_POST['submit']) && empty($error)) { $cells = array('partner_name', 'categories_id', 'partner_url', 'partner_alt', 'partner_text', 'partner_priority'); $values = array($_POST['partner_name'], $categories_id, $_POST['partner_url'], $_POST['partner_alt'], $_POST['partner_text'], $_POST['partner_priority']); cs_sql_insert(__FILE__, 'partner', $cells, $values); // upload navlist-image $where = "partner_name = '" . cs_sql_escape($data['partner']['partner_name']) . "'"; $getid = cs_sql_select(__FILE__, 'partner', 'partner_id', $where); if (!empty($files['partner_nimg']['tmp_name'])) { $filename_navimg = 'navbanner-' . $getid['partner_id'] . '.' . $extension_nimg; cs_upload('partner', $filename_navimg, $files['partner_nimg']['tmp_name'], 0); $cells_navimg = array('partner_nimg'); $values_navimg = array($filename_navimg); cs_sql_update(__FILE__, 'partner', $cells_navimg, $values_navimg, $getid['partner_id']); } if (!empty($files['partner_limg']['tmp_name'])) { $filename_listimg = 'listbanner-' . $getid['partner_id'] . '.' . $extension_limg; cs_upload('partner', $filename_listimg, $files['partner_limg']['tmp_name'], 0); $cells_listimg = array('partner_limg'); $values_listimg = array($filename_listimg); cs_sql_update(__FILE__, 'partner', $cells_listimg, $values_listimg, $getid['partner_id']); } if (!empty($files['partner_rimg']['tmp_name'])) { $filename_rotimg = 'rotbanner-' . $getid['partner_id'] . '.' . $extension_rimg; cs_upload('partner', $filename_rotimg, $files['partner_rimg']['tmp_name'], 0); $cells_rotimg = array('partner_rimg'); $values_rotimg = array($filename_rotimg); cs_sql_update(__FILE__, 'partner', $cells_rotimg, $values_rotimg, $getid['partner_id']); } cs_ajaxfiles_clear(); cs_redirect($cs_lang['create_done'], 'partner'); }
$extension = $new_ext; } } $img_size = getimagesize($files_gl['symbol']['tmp_name']); if ($img_size[0] > $img_max['width']) { $error .= $cs_lang['too_wide'] . cs_html_br(1); } if ($img_size[1] > $img_max['height']) { $error .= $cs_lang['too_high'] . cs_html_br(1); } if ($files_gl['symbol']['size'] > $img_max['size']) { $error .= $cs_lang['too_big'] . cs_html_br(1); } if (empty($error)) { $cs_linkus['linkus_banner'] = $linkus_id . '.' . $extension; cs_upload('linkus', $cs_linkus['linkus_banner'], $files_gl['symbol']['tmp_name']); } } } if (!isset($_POST['submit'])) { $data['head']['body'] = $cs_lang['body_create']; } elseif (!empty($error)) { $data['head']['body'] = $error; } if (!empty($error) or !isset($_POST['submit'])) { $data['linkus'] = $cs_linkus; $data['linkus']['banner'] = cs_html_img('uploads/linkus/' . $cs_linkus['linkus_banner']); $place = 'uploads/linkus/' . $cs_linkus['linkus_banner']; $mass = getimagesize($place); $data['linkus']['mass'] = cs_secure($mass[0] . ' x ' . $mass[1]); $matches[1] = $cs_lang['pic_infos'];
} if ($img_size[1] > $cs_option['height']) { $error .= $cs_lang['too_high'] . cs_html_br(1); $s_error++; //size_error } if ($files_gl['picture']['size'] > $cs_option['size']) { $size = $files_gl['picture']['size'] - $cs_option['size']; $size = cs_filesize($size); $error .= sprintf($cs_lang['too_big'], $size) . cs_html_br(1); } if (extension_loaded('gd') and !empty($gray)) { require_once 'mods/gallery/gd_2.php'; cs_gray($files_gl['picture']['tmp_name']); } if (empty($s_error) and cs_upload('gallery/pics', $filename, $files_gl['picture']['tmp_name']) or !empty($s_error) and extension_loaded('gd') and cs_resample($files_gl['picture']['tmp_name'], 'uploads/gallery/pics/' . $filename, $cs_option['width'], $cs_option['height'])) { if (extension_loaded('gd') and cs_resample('uploads/gallery/pics/' . $filename, 'uploads/gallery/thumbs/' . 'Thumb_' . $filename, $cs_option['thumbs'], $cs_option['thumbs'])) { $error .= empty($s_error) ? '' : $cs_lang['err_auto_size']; $s_error = 0; $file_up = 1; } else { $error .= $cs_lang['upload_error'] . cs_html_br(1); } } else { $error .= $cs_lang['upload_error'] . cs_html_br(1); } } } } else { $cs_gallery['gallery_titel'] = ''; $cs_gallery['folders_id'] = '';
if (!empty($files['def_picture']['tmp_name'])) { $img_size = getimagesize($files['def_picture']['tmp_name']); if ($files['def_picture']['type'] != 'image/jpeg') { $error .= cs_html_br(1) . $cs_lang['ext_error']; } if ($files['def_picture']['size'] > $_POST['max_size']) { $error .= cs_html_br(1) . $cs_lang['too_big']; } if ($img_size[0] > $_POST['max_width']) { $error .= cs_html_br(1) . $cs_lang['too_wide']; } if ($img_size[1] > $_POST['max_height']) { $error .= cs_html_br(1) . $cs_lang['too_high']; } if (empty($error)) { cs_upload('users', 'nopicture.jpg', $files['def_picture']['tmp_name']); } } if (empty($error)) { cs_redirect($cs_lang['success'], 'options', 'roots'); } } if (!isset($_POST['submit']) || !empty($error)) { if (!empty($error)) { $data['lang']['manage_options'] = $cs_lang['error_occured'] . $error; } $data['dropdown']['def_register'] = cs_html_select(1, 'def_register'); $sel = $data['options']['def_register'] == '0' ? 1 : 0; $data['dropdown']['def_register'] .= cs_html_option($cs_lang['reg_captcha'], 0, $sel); $sel = $data['options']['def_register'] == '1' ? 1 : 0; $data['dropdown']['def_register'] .= cs_html_option($cs_lang['reg_mail'], 1, $sel);
// ClanSphere 2010 - www.clansphere.net // $Id$ if (defined('UPLOAD_PROTECTED') and !empty($_SESSION)) { if (isset($_POST['remove'])) { $file = $_POST['remove']; if (isset($_SESSION['ajaxuploads'][$file]) && file_exists('uploads/cache/' . $_SESSION['ajaxuploads'][$file])) { cs_unlink('cache', $_SESSION['ajaxuploads'][$file]); } unset($_SESSION['ajaxuploads'][$file]); echo $file . ' deleted'; } elseif (isset($_POST['upload_name']) and isset($_FILES['' . $_POST['upload_name'] . '']['tmp_name'])) { $upload_name = $_POST['upload_name']; $file = $_FILES[$upload_name]['tmp_name']; $new_name = 'tmp_' . time() . strrchr($_FILES[$upload_name]['name'], '.'); $error = !cs_upload('cache', $new_name, $_FILES[$upload_name]['tmp_name'], 0); if (!isset($_SESSION['ajaxuploads'])) { $_SESSION['ajaxuploads'] = array(); } $_SESSION['ajaxuploads'][$upload_name] = $new_name; $upload = array(); $upload['name'] = $upload_name; $upload['original_name'] = $_FILES[$upload_name]['name']; $upload['size'] = cs_filesize($_FILES[$upload_name]['size']); if ($error) { $upload['error'] = true; } echo '<script language="javascript" type="text/javascript">'; echo 'window.top.Clansphere.ajax.upload_complete(' . json_encode($upload) . ');'; echo '</script>'; } else {
if ($files_gl['picture']['size'] > $cs_option['size2']) { $size = $files_gl['picture']['size'] - $cs_option['size2']; $size = cs_filesize($size); $error .= sprintf($cs_lang['too_big'], $size) . cs_html_br(1); } $where = 'users_id = "' . $cs_gallery['users_id'] . '"'; $count_user_files = cs_sql_count(__FILE__, 'usersgallery', $where); if ($count_user_files >= $cs_option['max_files']) { $error .= $cs_lang['too_many_f'] . cs_html_br(1); } if (extension_loaded('gd') and !empty($gray)) { require_once 'mods/gallery/gd_2.php'; cs_gray($files_gl['picture']['tmp_name']); } if (empty($error) and cs_upload('usersgallery/pics', $filename, $files_gl['picture']['tmp_name']) or !empty($error) and extension_loaded('gd') and cs_resample($files_gl['picture']['tmp_name'], 'uploads/usersgallery/pics/' . $filename, $cs_option['width'], $cs_option['height'])) { if (empty($error) and !extension_loaded('gd') and cs_upload('usersgallery/thumbs', 'Thumb_' . $filename, $files_gl['picture_thumb']['tmp_name']) or empty($error) and extension_loaded('gd') and cs_resample('uploads/usersgallery/pics/' . $filename, 'uploads/usersgallery/thumbs/' . 'Thumb_' . $filename, $cs_option['thumbs'], $cs_option['thumbs']) or !empty($error) and extension_loaded('gd') and cs_resample('uploads/usersgallery/pics/' . $filename, 'uploads/usersgallery/thumbs/' . 'Thumb_' . $filename, $cs_option['thumbs'], $cs_option['thumbs'])) { } else { $error .= $cs_lang['upload_error'] . cs_html_br(1); } } else { $error .= $cs_lang['upload_error'] . cs_html_br(1); } } } if (!isset($_POST['submit'])) { $data['head']['body'] = $cs_lang['body_picture']; } elseif (!empty($error) or empty($files_gl['picture']['tmp_name'])) { $data['head']['body'] = $error; } if (!isset($_POST['submit']) or !empty($error)) { $data['data'] = $cs_gallery;
foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $option['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $option['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($option['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['data']['info_clip'] = cs_abcode_clip($matches); $checked = 'checked="checked"'; $data['check']['vote'] = empty($adv_vote) ? '' : $checked; $data['check']['close'] = empty($adv_close) ? '' : $checked; $data['check']['dl'] = empty($adv_dl) ? '' : $checked; $data['check']['dlo'] = empty($adv_dlo) ? '' : $checked; $data['data']['folders_name'] = cs_secure($data['data']['folders_name']); $data['data']['folders_url'] = cs_secure($data['data']['folders_url']); $data['data']['folders_text'] = cs_secure($data['data']['folders_text']); echo cs_subtemplate(__FILE__, $data, 'usersgallery', 'folders_create'); } else { $folder_cells = array_keys($folders); $folder_save = array_values($folders); cs_sql_insert(__FILE__, 'folders', $folder_cells, $folder_save); if (!empty($files_gl['picture']['tmp_name'])) { $id = cs_sql_insertid(__FILE__); $filename = 'picture-' . $id . '.' . $extension; cs_upload('folders', $filename, $files_gl['picture']['tmp_name']); $cells = array('folders_picture'); $save = array($filename); cs_sql_update(__FILE__, 'folders', $cells, $save, $id); } cs_redirect($cs_lang['create_done'], 'usersgallery', 'center', 'page=cat'); }
} elseif (!empty($error)) { $data['head']['body'] = $error; } if (!empty($error) or !isset($_POST['submit'])) { $data['linkus'] = $cs_linkus; $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add => $value) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $img_max['width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $img_max['height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($img_max['size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['linkus']['picup_clip'] = cs_abcode_clip($matches); echo cs_subtemplate(__FILE__, $data, 'linkus', 'create'); } else { $linkus_cells = array_keys($cs_linkus); $linkus_save = array_values($cs_linkus); cs_sql_insert(__FILE__, 'linkus', $linkus_cells, $linkus_save); if (!empty($files_gl['symbol']['tmp_name'])) { $where = "linkus_name = '" . cs_sql_escape($cs_linkus['linkus_name']) . "'"; $getid = cs_sql_select(__FILE__, 'linkus', 'linkus_id', $where); $filename = $getid['linkus_id'] . '.' . $extension; cs_upload('linkus', $filename, $files_gl['symbol']['tmp_name']); } $linkus_cells = array('linkus_banner'); $linkus_save = array($filename); cs_sql_update(__FILE__, 'linkus', $linkus_cells, $linkus_save, $getid['linkus_id']); cs_redirect($cs_lang['create_done'], 'linkus'); }
// ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('ajax'); $cs_post = cs_post('ajax_reload'); $files = cs_files(); if (!empty($cs_post['submit'])) { $errors = ''; if (!empty($files['loading']['tmp_name'])) { $ext = strtolower(substr(strrchr($files['loading']['name'], '.'), 1)); if ($ext != 'gif') { $errors .= cs_html_br(1) . '- ' . $cs_lang['ext_only_gif']; } } if (empty($errors)) { if (!empty($files['loading']['tmp_name'])) { cs_upload('ajax', 'loading.gif', $files['loading']['tmp_name']); } if (empty($cs_post['ajax'])) { $cs_post['ajax_reload'] = 0; } require_once 'mods/clansphere/func_options.php'; $save = array(); $save['ajax'] = empty($cs_post['ajax']) ? '0' : (int) $cs_post['for']; $save['ajax_reload'] = $cs_post['ajax_reload']; cs_optionsave('clansphere', $save); # clear cache to not run into trouble on ajax changes cs_cache_clear(); cs_redirect($cs_lang['success'], 'options', 'roots'); } } $data = array();
$data['squads']['secure_clip'] = cs_abcode_clip($matches); $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_squads['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_squads['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_squads['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['squads']['picup_clip'] = cs_abcode_clip($matches); echo cs_subtemplate(__FILE__, $data, 'squads', 'new'); } else { $squads_cells = array_keys($cs_squads); $squads_save = array_values($cs_squads); cs_sql_insert(__FILE__, 'squads', $squads_cells, $squads_save); $where = "squads_name = '" . cs_sql_escape($cs_squads['squads_name']) . "'"; $getid = cs_sql_select(__FILE__, 'squads', 'squads_id', $where); $members_cells = array('users_id', 'squads_id', 'members_task', 'members_order', 'members_admin'); $members_save = array($account['users_id'], $getid['squads_id'], $cs_lang['leader'], 1, 1); cs_sql_insert(__FILE__, 'members', $members_cells, $members_save); if (!empty($files['picture']['tmp_name'])) { $filename = 'picture-' . $getid['squads_id'] . '.' . $extension; cs_upload('squads', $filename, $files['picture']['tmp_name']); $cs_squads2['squads_picture'] = $filename; $squads2_cells = array_keys($cs_squads2); $squads2_save = array_values($cs_squads2); cs_sql_update(__FILE__, 'squads', $squads2_cells, $squads2_save, $getid['squads_id']); } cs_redirect($cs_lang['create_done'], 'squads', 'center'); }
$return_types = ''; foreach ($rep_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_size'] . cs_filesize($rep_max['size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['replays']['upload_clip'] = cs_abcode_clip($matches); $data['replays']['abcode_smileys'] = cs_abcode_smileys('replays_info'); $data['replays']['abcode_features'] = cs_abcode_features('replays_info'); $data['replays']['close_check'] = empty($cs_replays['replays_close']) ? '' : 'checked="checked"'; echo cs_subtemplate(__FILE__, $data, 'replays', 'create'); } else { $cs_replays['users_id'] = $account['users_id']; $cs_replays['replays_since'] = cs_time(); $replays_cells = array_keys($cs_replays); $replays_save = array_values($cs_replays); cs_sql_insert(__FILE__, 'replays', $replays_cells, $replays_save); if (!empty($files_gl['replay']['tmp_name'])) { $where = "replays_team1 = '" . cs_sql_escape($cs_replays['replays_team1']) . "'"; $order = 'replays_since DESC'; $getid = cs_sql_select(__FILE__, 'replays', 'replays_id, replays_mirror_urls', $where, $order); $filename = 'replay-' . $getid['replays_id'] . '-' . cs_time() . '.' . $extension; cs_upload('replays', $filename, $files_gl['replay']['tmp_name']); $replay_file = 'uploads/replays/' . $filename; $cs_replays2['replays_mirror_urls'] = empty($cs_replays2['replays_mirror_urls']) ? $replay_file : $replay_file . "\n" . $cs_replays2['replays_mirror_urls']; $replays2_cells = array_keys($cs_replays2); $replays2_save = array_values($cs_replays2); cs_sql_update(__FILE__, 'replays', $replays2_cells, $replays2_save, $getid['replays_id']); } cs_redirect($cs_lang['create_done'], 'replays'); }
} } if ($check_type != 1) { $error .= $cs_lang['error_filetype'] . cs_html_br(1); $file_error[$num] = '1'; } } if (!empty($files_gl["file_{$num}"]['name']) and empty($file_error[$num])) { $file_name[$num] = $files_gl["file_{$num}"]['name']; $hash = ''; $pattern = "abcdefghijklmnopqrstuvwxyz"; for ($i = 0; $i < 8; $i++) { $hash .= $pattern[rand(0, 25)]; } $file_upload_name[$num] = $hash . '.' . $ext; if (cs_upload('board/files', $file_upload_name[$num], $files_gl["file_{$num}"]['tmp_name'])) { $a++; } else { $error .= $cs_lang['error_fileupload'] . cs_html_br(1); } } if (!empty($_POST["file_name_{$num}"]) and empty($file_error[$num])) { $file_name[$num] = $_POST["file_name_{$num}"]; $file_upload_name[$num] = $_POST["file_upload_name_{$num}"]; if (isset($_POST["remove_file_{$num}"])) { cs_unlink('board', $file_upload_name[$num], 'files'); $file_name[$num] = ''; } else { $file_name[$b] = $file_name[$num]; $file_upload_name[$b] = $file_upload_name[$num]; $a++;
} else { $message .= $cs_lang['too_big'] . cs_html_br(1); $error++; } } if (empty($error)) { $filename = 'avatar-' . $account['users_id'] . '.' . $extension; if (extension_loaded('gd') and !empty($doresize)) { $dest = $cs_main['def_path'] . '/uploads/board/' . $filename; if (cs_resample($files_gl['picture']['tmp_name'], $dest, $img_max['width'], $img_max['height'])) { $fileerror = 0; } else { $fileerror = 1; } } else { if (cs_upload('board', $filename, $files_gl['picture']['tmp_name'])) { $fileerror = 0; } else { $fileerror = 1; } } if (empty($fileerror)) { if ($useravatar != $filename and !empty($useravatar)) { cs_unlink('board', $useravatar); } $cells = array('users_avatar'); $content = array($filename); cs_sql_update(__FILE__, 'users', $cells, $content, $account['users_id']); cs_redirect($cs_lang['success'], 'board', 'avatar'); } else { $message .= $cs_lang['up_error'];
if (!empty($_POST['games_url'])) { $games_url = $_POST['games_url']; } if (!empty($_POST['games_version'])) { $games_version = $_POST['games_version']; } $data['lang']['body'] = !isset($_POST['submit']) ? $cs_lang['body_create'] : $errormsg; if (isset($_POST['submit']) && empty($games_error) && empty($symbol_error)) { $games_cells = array('games_name', 'games_version', 'games_released', 'games_creator', 'categories_id', 'games_url', 'games_usk'); $games_save = array($games_name, $games_version, $games_release, $games_creator, $categories_id, $games_url, $games_usk); cs_sql_insert(__FILE__, 'games', $games_cells, $games_save); $where = "games_name = '" . cs_sql_escape($games_name) . "'"; $getid = cs_sql_select(__FILE__, 'games', 'games_id', $where); if (!empty($files['symbol']['tmp_name']) and $symbol_error == 0) { $filename = $getid['games_id'] . '.' . $extension; cs_upload('games', $filename, $files['symbol']['tmp_name']); } else { copy('uploads/games/0.gif', 'uploads/games/' . (int) $getid['games_id'] . '.gif'); } cs_redirect($cs_lang['create_done'], 'games'); } $data['url']['form'] = cs_url('games', 'create'); $data['games']['name'] = $games_name; $data['games']['version'] = $games_version; $data['games']['genre'] = cs_categories_dropdown('games', $categories_id); $data['games']['release'] = cs_dateselect('datum', 'date', $games_release); $data['games']['creator'] = $games_creator; $data['games']['homepage'] = $games_url; $usknum[0]['games_usk'] = '00'; $usknum[0]['name'] = $cs_lang['usk_00']; $usknum[1]['games_usk'] = '06';
$matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_clans['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_clans['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_clans['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['clans']['clip'] = cs_abcode_clip($matches); echo cs_subtemplate(__FILE__, $data, 'clans', 'create'); } else { $clans_cells = array_keys($cs_clans); $clans_save = array_values($cs_clans); cs_sql_insert(__FILE__, 'clans', $clans_cells, $clans_save); if (!empty($files['picture']['tmp_name'])) { $where = "clans_name = '" . cs_sql_escape($cs_clans['clans_name']) . "'"; $getid = cs_sql_select(__FILE__, 'clans', 'clans_id', $where); $filename = 'picture-' . $getid['clans_id'] . '.' . $extension; cs_upload('clans', $filename, $files['picture']['tmp_name']); $cs_clans2['clans_picture'] = $filename; $clans2_cells = array_keys($cs_clans2); $clans2_save = array_values($cs_clans2); cs_sql_update(__FILE__, 'clans', $clans2_cells, $clans2_save, $getid['clans_id']); } if ($account['access_wizard'] == 5) { cs_redirect($cs_lang['create_done'], 'clans', 'manage'); } else { cs_redirect($cs_lang['create_done'], 'clans'); } }
} else { $cs_maps['games_id'] = (int) $_POST['games_id']; $cs_maps['maps_name'] = $_POST['maps_name']; $cs_maps['server_name'] = $_POST['server_name']; $cs_maps['maps_text'] = $_POST['maps_text']; $maps_id = (int) $_POST['maps_id']; if (empty($_POST['pic_del']) and empty($files_gl['picture']['tmp_name'])) { $cells = array_keys($cs_maps); $values = array_values($cs_maps); cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id); } elseif (isset($_POST['pic_del']) and empty($files_gl['picture']['tmp_name'])) { $select = cs_sql_select(__FILE__, 'maps', 'maps_picture', 'maps_id = \'' . $maps_id . '\''); cs_unlink('maps', $select['maps_picture']); $cs_maps['maps_picture'] = ''; $cells = array_keys($cs_maps); $values = array_values($cs_maps); cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id); } else { $select = cs_sql_select(__FILE__, 'maps', 'maps_picture', 'maps_id = \'' . $maps_id . '\''); $url = 'uploads/maps/' . $select['maps_picture']; cs_unlink('maps', $select['maps_picture']); $filename = 'picture-' . $maps_id . '.' . $extension; cs_upload('maps', $filename, $files_gl['picture']['tmp_name']); $cs_maps['maps_picture'] = $filename; $cells = array_keys($cs_maps); $values = array_values($cs_maps); cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id); } cs_redirect($cs_lang['changes_done'], 'maps'); } }
$cs_replays['replays_close'] = isset($_POST['replays_close']) ? $_POST['replays_close'] : 0; $error = 0; $error = ''; if (!empty($files_gl['replay']['tmp_name'])) { $rep_size = filesize($files_gl['replay']['tmp_name']); $rep_ext = explode('.', $files_gl['replay']['name']); $who_ext = count($rep_ext) < 1 ? 0 : count($rep_ext) - 1; $extension = in_array($rep_ext[$who_ext], $rep_filetypes) ? $rep_ext[$who_ext] : 0; if (empty($extension)) { $error .= $cs_lang['ext_error'] . cs_html_br(1); } if ($files_gl['replay']['size'] > $rep_max['size']) { $error .= $cs_lang['too_big'] . cs_html_br(1); } $filename = 'replay-' . $replays_id . '-' . cs_time() . '.' . $extension; if (empty($error) and cs_upload('replays', $filename, $files_gl['replay']['tmp_name'])) { $replay_file = 'uploads/replays/' . $filename; $cs_replays['replays_mirror_urls'] = empty($cs_replays['replays_mirror_urls']) ? $replay_file : $replay_file . "\n" . $cs_replays['replays_mirror_urls']; } else { $error .= $cs_lang['up_error']; } } if (empty($cs_replays['games_id'])) { $error .= $cs_lang['no_game'] . cs_html_br(1); } if (empty($cs_replays['categories_id'])) { $error .= $cs_lang['no_cat'] . cs_html_br(1); } if (empty($cs_replays['replays_version'])) { $error .= $cs_lang['no_version'] . cs_html_br(1); }