Exemplo n.º 1
0
function cs_pictures_delete($var, $mod = 0)
{
    if (!empty($mod)) {
        $where = "pictures_fid = '" . $var . "' AND pictures_mod = '" . $mod . "'";
        $pic = cs_sql_select(__FILE__, 'pictures', 'pictures_id, pictures_file', $where);
        if (empty($pic)) {
            return true;
        }
        $file = $pic['pictures_file'];
        $pictures_id = $pic['pictures_id'];
    } else {
        $pictures_id = (int) substr($var, 8);
        $file = $var;
    }
    cs_sql_delete(__FILE__, 'pictures', $pictures_id);
    cs_unlink('pictures' . $file);
    return true;
}
Exemplo n.º 2
0
    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['hidden']['folders_picture'] = $folders['folders_picture'];
    $data['hidden']['folders_id'] = $folders_id;
    echo cs_subtemplate(__FILE__, $data, 'gallery', 'folders_edit');
} else {
    if (isset($_POST['delete']) == 1 and !empty($folders['folders_picture'])) {
        cs_unlink('folders', $folders['folders_picture'], 'pictures');
        $folders['folders_picture'] = '';
    }
    if (!empty($files_gl['picture']['tmp_name'])) {
        $filename = 'picture-' . $folders_id . '.' . $extension;
        cs_upload('folders', $filename, $files_gl['picture']['tmp_name']);
        $folders['folders_picture'] = $filename;
    }
    $folder_cells = array_keys($folders);
    $folder_save = array_values($folders);
    cs_sql_update(__FILE__, 'folders', $folder_cells, $folder_save, $folders_id);
    cs_redirect($cs_lang['changes_done'], 'gallery', 'folders_manage');
}
Exemplo n.º 3
0
         $img_w_h = $img_width / $img_height;
         $img_new_height = 40;
         $img_new_width = $img_new_height * $img_w_h;
         $data['pictures'][$run]['img'] = cs_html_img('mods/gallery/image.php?picname=' . $pic);
         $data['pictures'][$run]['size'] = $img_width . 'x' . $img_height;
         $data['pictures'][$run]['filesize'] = cs_filesize($img_filesize);
         $run++;
     }
 } elseif (empty($checkDiff) and !empty($_POST['read']) or empty($checkDiff) and $zip_file == 1) {
     $data['if']['nopic'] = TRUE;
 }
 if (!empty($checkDiff2) and !empty($_POST['del'])) {
     $data['if']['thumb'] = TRUE;
     $run = 0;
     foreach ($diff2 as $thumb) {
         if (cs_unlink('gallery', 'Thumb_' . $thumb, 'thumbs') == true) {
             $where = "gallery_name = '" . $thumb . "'";
             $search = cs_sql_count(__FILE__, 'gallery', $where);
             if (!empty($search)) {
                 $query = "DELETE FROM {pre}_gallery WHERE gallery_name='{$thumb}'";
                 cs_sql_query(__FILE__, $query);
             }
             $msg = $cs_lang['deltrue'];
         } else {
             $msg = $cs_lang['delfalse'];
         }
         $data['thumbs'][$run]['msg'] = $msg;
         $data['thumbs'][$run]['name'] = 'Thumb_' . $thumb;
         $run++;
     }
 } elseif (!empty($_POST['del'])) {
Exemplo n.º 4
0
$files_gl = cs_files();
$data = array();
$img_max['width'] = $cs_option['max_width'];
$img_max['height'] = $cs_option['max_height'];
$img_max['size'] = $cs_option['max_size'];
$img_filetypes = array('gif', 'jpg', 'png');
$file = cs_sql_select(__FILE__, 'files', 'files_previews', "files_id = '" . $cs_files_id . "'");
$file_string = $file['files_previews'];
$file_pics = empty($file_string) ? array() : explode("\n", $file_string);
$file_next = count($file_pics) + 1;
$error = 0;
$message = '';
if (!empty($_GET['delete'])) {
    $target = $_GET['delete'] - 1;
    cs_unlink('files', 'picture-' . $file_pics[$target]);
    cs_unlink('files', 'thumb-' . $file_pics[$target]);
    $file_pics[$target] = FALSE;
    $file_pics = array_filter($file_pics);
    $file_string = implode("\n", $file_pics);
    $cells = array('files_previews');
    $content = array($file_string);
    cs_sql_update(__FILE__, 'files', $cells, $content, $cs_files_id);
} elseif (!empty($_POST['submit'])) {
    $img_size = getimagesize($files_gl['picture']['tmp_name']);
    if (empty($img_size) or $img_size[2] > 3) {
        $message .= $cs_lang['ext_error'] . cs_html_br(1);
        $error++;
    }
    if ($img_size[0] > $img_max['width']) {
        $message .= $cs_lang['too_wide'] . cs_html_br(1);
        $error++;
Exemplo n.º 5
0
        $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++;
            $b++;
        }
    }
}
$run_loop_files = $a;
if (isset($_POST['files+'])) {
    $run_loop_files++;
}
$data['if']['error'] = FALSE;
if (!empty($error)) {
Exemplo n.º 6
0
$clans_form = 1;
$cs_get = cs_get('id');
$cs_post = cs_post('id');
$clans_id = empty($cs_get['id']) ? $cs_post['id'] : $cs_get['id'];
if (isset($_GET['agree']) and $clans_id != 1) {
    $clans_form = 0;
    $where = "clans_id = '" . $clans_id . "'";
    $where .= $account['access_clansphere'] == 5 ? '' : "AND users_id = '" . $account['users_id'] . "'";
    $search = cs_sql_count(__FILE__, 'clans', $where);
    if (empty($search)) {
        $msg = $cs_lang['not_own'];
    } else {
        $where = "clans_id = '" . $clans_id . "'";
        $getpic = cs_sql_select(__FILE__, 'clans', 'clans_picture', $where);
        if (!empty($getpic['clans_picture'])) {
            cs_unlink('clans', $getpic['clans_picture']);
        }
        $where = "clans_id = '" . $clans_id . "'";
        $cs_squads = cs_sql_select(__FILE__, 'squads', 'squads_id', $where, 0, 0, 0);
        if (is_array($cs_squads)) {
            foreach ($cs_squads as $key => $squads_id) {
                cs_sql_delete(__FILE__, 'members', $squads_id, 'squads_id');
            }
        }
        cs_sql_delete(__FILE__, 'squads', $clans_id, 'clans_id');
        cs_sql_delete(__FILE__, 'clans', $clans_id);
        $msg = sprintf($cs_lang['del_true_clan'], $cs_lang[$op_clans['label']]);
    }
    cs_redirect($msg, 'clans', $center);
}
if (isset($_GET['cancel']) or $clans_id == 1) {
Exemplo n.º 7
0
                break;
        }
        $filename = 'picture-' . $users_id . '.' . $ext;
        if ($img_size[0] > $op_users['max_width']) {
            $error .= $cs_lang['too_wide'] . cs_html_br(1);
        }
        if ($img_size[1] > $op_users['max_height']) {
            $error .= $cs_lang['too_high'] . cs_html_br(1);
        }
        if ($files['picture']['size'] > $op_users['max_size']) {
            $error .= $cs_lang['too_big'] . cs_html_br(1);
        }
        if (empty($error) and cs_upload('users', $filename, $files['picture']['tmp_name']) or !empty($error) and extension_loaded('gd') and cs_resample($files['picture']['tmp_name'], 'uploads/users/' . $filename, $op_users['max_width'], $op_users['max_height'])) {
            $error = '';
            if ($userpic != $filename and !empty($userpic)) {
                cs_unlink('users', $userpic);
            }
            $cells = array('users_picture');
            $content = array($filename);
            cs_sql_update(__FILE__, 'users', $cells, $content, $users_id);
            cs_redirect('', 'users', 'manage');
        } else {
            $error .= $cs_lang['up_error'];
        }
    }
}
if (empty($error)) {
    $data['head']['body'] = $cs_lang['picture_manage'];
} else {
    $data['head']['body'] = $error;
}
Exemplo n.º 8
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('links');
$cs_get = cs_get('id,agree,cancel');
$links_id = empty($cs_get['id']) ? 0 : $cs_get['id'];
if (isset($cs_get['agree'])) {
    $banner = cs_sql_select(__FILE__, 'links', 'links_banner', "links_id = '" . $links_id . "'");
    if (!empty($banner['links_banner'])) {
        cs_unlink('links', $banner['links_banner']);
    }
    cs_sql_delete(__FILE__, 'links', $links_id);
    cs_redirect($cs_lang['del_true'], 'links');
}
if (isset($cs_get['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'links');
}
$links = cs_sql_select(__FILE__, 'links', 'links_name', 'links_id = ' . $links_id, 0, 0, 1);
if (!empty($links)) {
    $data = array();
    $data['head']['body'] = sprintf($cs_lang['remove_entry'], $cs_lang['mod_name'], $links['links_name']);
    $data['url']['agree'] = cs_url('links', 'remove', 'id=' . $links_id . '&amp;agree');
    $data['url']['cancel'] = cs_url('links', 'remove', 'id=' . $links_id . '&amp;cancel');
    echo cs_subtemplate(__FILE__, $data, 'links', 'remove');
} else {
    cs_redirect('', 'links');
}
Exemplo n.º 9
0
    $cs_news_id = $cs_post['id'];
}
$op_news = cs_sql_option(__FILE__, 'news');
$img_filetypes = array('gif', 'jpg', 'png');
$news = cs_sql_select(__FILE__, 'news', 'news_pictures', "news_id = '" . $cs_news_id . "'");
$news_string = $news['news_pictures'];
$news_pics = empty($news_string) ? array() : explode("\n", $news_string);
$count_pics = count($news_pics);
$next = empty($count_pics) ? '' : explode('-', current(explode(".", $news_pics[$count_pics - 1])));
$news_next = empty($count_pics) ? 1 : $next[1] + 1;
$error = 0;
$message = '';
if (!empty($_GET['delete'])) {
    $target = $_GET['delete'] - 1;
    cs_unlink('news', 'picture-' . $news_pics[$target]);
    cs_unlink('news', 'thumb-' . $news_pics[$target]);
    $news_pics[$target] = FALSE;
    $news_pics = array_filter($news_pics);
    $news_string = implode("\n", $news_pics);
    $cells = array('news_pictures');
    $content = array($news_string);
    cs_sql_update(__FILE__, 'news', $cells, $content, $cs_news_id);
} elseif (!empty($_POST['submit'])) {
    $img_size = getimagesize($files['picture']['tmp_name']);
    if (empty($img_size) or $img_size[2] > 3) {
        $message .= $cs_lang['ext_error'] . cs_html_br(1);
        $error++;
    }
    if ($img_size[0] > $op_news['max_width']) {
        $message .= $cs_lang['too_wide'] . cs_html_br(1);
        $error++;
Exemplo n.º 10
0
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('board');
$att_form = 1;
$att_id = $_REQUEST['id'];
settype($att_id, 'integer');
if (isset($_POST['agree'])) {
    $att_form = 0;
    $select = 'users_id, boardfiles_name';
    $computer = cs_sql_select(__FILE__, 'boardfiles', $select, 'boardfiles_id = ' . $att_id);
    if ($computer['users_id'] == $account['users_id'] or $account['access_board'] >= 5) {
        $file = $computer['boardfiles_name'];
        $extension = strlen(strrchr($file, "."));
        $name = strlen($file);
        $ext = substr($file, $name - $extension + 1, $name);
        cs_unlink('board', $att_id . '.' . $ext, 'files');
        cs_sql_delete(__FILE__, 'boardfiles', $att_id);
    }
    cs_redirect($cs_lang['delatt_done'], 'board', 'attachments');
}
if (isset($_POST['cancel'])) {
    $att_form = 0;
    cs_redirect($cs_lang['delatt_done'], 'board', 'attachments');
}
if (!empty($att_form)) {
    $search_user = cs_sql_select(__FILE__, 'boardfiles', 'users_id', 'boardfiles_id = ' . $att_id);
    if ($search_user['users_id'] == $account['users_id'] or $account['access_board'] >= 5) {
        $data['if']['not_account'] = false;
        $data['if']['account'] = true;
        $data['lang']['body'] = sprintf($cs_lang['del_rly'], $att_id);
        $data['action']['form'] = cs_url('board', 'delatt');
Exemplo n.º 11
0
 } elseif (!empty($files['picture']['tmp_name'])) {
     $ext = $img_filetypes[$img_size[2]];
     $filename = 'picture-' . $abcode_id . '.' . $ext;
     if ($img_size[0] > $op_abcode['max_width']) {
         $error .= $cs_lang['too_wide'] . cs_html_br(1);
     }
     if ($img_size[1] > $op_abcode['max_height']) {
         $error .= $cs_lang['too_high'] . cs_html_br(1);
     }
     if ($files['picture']['size'] > $op_abcode['max_size']) {
         $error .= $cs_lang['too_big'] . cs_html_br(1);
     }
     if (empty($error) and cs_upload('abcode', $filename, $files['picture']['tmp_name']) or !empty($error) and extension_loaded('gd') and cs_resample($files['picture']['tmp_name'], 'uploads/abcodes/' . $filename, $op_abcode['max_width'], $op_abcode['max_height'])) {
         $error = '';
         if ($cs_abcode['abcode_file'] != $filename and !empty($cs_abcode['abcode_file'])) {
             cs_unlink('abcode', $cs_abcode['abcode_file']);
         }
         $cs_abcode['abcode_file'] = $filename;
     } else {
         $error .= $cs_lang['up_error'];
     }
 }
 if (empty($cs_abcode['abcode_func'])) {
     $error .= $cs_lang['no_func'] . cs_html_br(1);
 }
 if (empty($cs_abcode['abcode_pattern'])) {
     $error .= $cs_lang['no_pattern'] . cs_html_br(1);
 }
 if ($cs_abcode['abcode_func'] == 'str' && empty($cs_abcode['abcode_result'])) {
     $error .= $cs_lang['no_result'] . cs_html_br(1);
 }
Exemplo n.º 12
0
            $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'];
            $error++;
        }
    }
}
$data['lang']['getmsg'] = cs_getmsg();
if (!empty($error) or empty($_POST['submit'])) {
    if (!empty($message)) {
        $data['if']['error'] = 1;
Exemplo n.º 13
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('news');
$cs_get = cs_get('id,agree,cancel');
if (isset($cs_get['agree'])) {
    $news = cs_sql_select(__FILE__, 'news', 'news_pictures', "news_id = '" . $cs_get['id'] . "'");
    $news_string = $news['news_pictures'];
    $news_pics = empty($news_string) ? array() : explode("\n", $news_string);
    foreach ($news_pics as $pics) {
        cs_unlink('news', 'picture-' . $pics);
        cs_unlink('news', 'thumb-' . $pics);
    }
    cs_sql_delete(__FILE__, 'news', $cs_get['id']);
    $query = "DELETE FROM {pre}_comments WHERE comments_mod='news' AND ";
    $query .= "comments_fid='" . $cs_get['id'] . "'";
    cs_sql_query(__FILE__, $query);
    include_once 'mods/news/rss.php';
    cs_redirect($cs_lang['del_true'], 'news');
}
if (isset($cs_get['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'news');
}
$cs_news = cs_sql_select(__FILE__, 'news', 'news_headline', 'news_id = ' . $cs_get['id'], 0, 0, 1);
if (!empty($cs_news)) {
    $data = array();
    $data['head']['topline'] = sprintf($cs_lang['remove_news'], $cs_news['news_headline']);
    $data['news']['content'] = cs_link($cs_lang['confirm'], 'news', 'remove', 'id=' . $cs_get['id'] . '&amp;agree');
    $data['news']['content'] .= ' - ';
    $data['news']['content'] .= cs_link($cs_lang['cancel'], 'news', 'remove', 'id=' . $cs_get['id'] . '&amp;cancel');
Exemplo n.º 14
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('maps');
$cs_get = cs_get('id');
$cs_post = cs_post('id');
$maps_id = empty($cs_get['id']) ? $cs_post['id'] : $cs_get['id'];
if (isset($cs_post['agree'])) {
    $maps = cs_sql_select(__FILE__, 'maps', 'maps_picture', "maps_id = '" . $maps_id . "'");
    if (!empty($maps['maps_picture'])) {
        cs_unlink('maps', $maps['maps_picture']);
    }
    cs_sql_delete(__FILE__, 'maps', $maps_id);
    cs_redirect($cs_lang['del_true'], 'maps');
}
if (isset($cs_post['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'maps');
}
$map = cs_sql_select(__FILE__, 'maps', 'maps_name', 'maps_id = ' . $maps_id, 0, 0, 1);
if (!empty($map)) {
    $data = array();
    $data['maps']['action'] = cs_url('maps', 'remove');
    $data['maps']['maps_id'] = $maps_id;
    $data['maps']['message'] = sprintf($cs_lang['remove_entry'], $cs_lang['mod_name'], $map['maps_name']);
    echo cs_subtemplate(__FILE__, $data, 'maps', 'remove');
} else {
    cs_redirect('', 'maps');
}
Exemplo n.º 15
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('files');
$cs_get = cs_get('id');
$cs_post = cs_post('id');
$files_id = empty($cs_get['id']) ? $cs_post['id'] : $cs_get['id'];
if (isset($cs_post['agree'])) {
    $previews = cs_sql_select(__FILE__, 'files', 'files_previews', "files_id = '" . $files_id . "'");
    $file_string = $previews['files_previews'];
    $file_pics = empty($file_string) ? array() : explode("\n", $file_string);
    foreach ($file_pics as $pics) {
        cs_unlink('files', 'picture-' . $pics);
        cs_unlink('files', 'thumb-' . $pics);
    }
    cs_sql_delete(__FILE__, 'files', $files_id);
    $query = "DELETE FROM {pre}_comments WHERE comments_mod='files' AND ";
    $query .= "comments_fid='" . $files_id . "'";
    cs_sql_query(__FILE__, $query);
    $query = "DELETE FROM {pre}_voted WHERE voted_mod='files' AND ";
    $query .= "voted_fid='" . $files_id . "'";
    cs_sql_query(__FILE__, $query);
    cs_redirect($cs_lang['del_true'], 'files');
}
if (isset($cs_post['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'files');
}
$file = cs_sql_select(__FILE__, 'files', 'files_name', 'files_id = ' . $files_id);
if (!empty($file)) {
    $data = array();
Exemplo n.º 16
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('abcode');
$cs_get = cs_get('id');
$cs_post = cs_post('id');
$abcode_id = empty($cs_get['id']) ? $cs_post['id'] : $cs_get['id'];
if (isset($cs_post['agree'])) {
    $where = 'abcode_id = ' . $abcode_id;
    $getpic = cs_sql_select(__FILE__, 'abcode', 'abcode_file', $where);
    if (!empty($getpic['abcode_file'])) {
        cs_unlink('abcode', $getpic['abcode_file']);
    }
    cs_sql_delete(__FILE__, 'abcode', $abcode_id);
    cs_cache_delete('abcode_smileys');
    cs_cache_delete('abcode_content');
    cs_redirect($cs_lang['del_true'], 'abcode');
}
if (isset($cs_post['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'abcode');
}
$abcode = cs_sql_select(__FILE__, 'abcode', 'abcode_func, abcode_pattern', 'abcode_id = ' . $abcode_id, 0, 0, 1);
if (!empty($abcode)) {
    $data['lang']['body'] = sprintf($cs_lang['remove_entry'], $cs_lang['mod_name'], $abcode['abcode_pattern']);
    $data['action']['form'] = cs_url('abcode', 'remove');
    $data['abcode']['id'] = $abcode_id;
    echo cs_subtemplate(__FILE__, $data, 'abcode', 'remove');
} else {
    cs_redirect('', 'abcode');
}
Exemplo n.º 17
0
$imp_form = 1;
$imprint = '';
$content = file_exists($filename) ? file_get_contents($filename) : '';
if (!empty($_POST['imprint'])) {
    $imprint = empty($cs_main['rte_html']) ? $_POST['imprint'] : cs_abcode_inhtml($_POST['imprint'], 'add');
}
if (!isset($_POST['submit']) and file_exists($filename)) {
    $imprint = explode("{laststandbreak}", $content);
}
if (isset($_POST['submit'])) {
    $imp_form = 0;
    $data['if']['done'] = TRUE;
    $data['if']['form'] = FALSE;
    $data['if']['wizzard'] = FALSE;
    if (file_exists($filename)) {
        cs_unlink('imprint', 'imprint.txt');
    }
    $fp = fopen($filename, "w");
    chmod($filename, 0777);
    $imp_time = cs_time();
    $content = $imp_time;
    $content .= '{laststandbreak}';
    $content .= $imprint;
    # set stream encoding if possible to avoid converting issues
    if (function_exists('stream_encoding')) {
        stream_encoding($fp, $cs_main['charset']);
    }
    fwrite($fp, $content);
    chmod($filename, 0755);
    fclose($fp);
    if ($account['access_wizard'] == 5) {
Exemplo n.º 18
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('games');
$cs_get = cs_get('id,agree,cancel');
if (isset($cs_get['agree'])) {
    cs_sql_delete(__FILE__, 'games', $cs_get['id']);
    if (file_exists('uploads/games/' . $cs_get['id'] . '.gif')) {
        cs_unlink('games', $cs_get['id'] . '.gif');
    }
    cs_redirect($cs_lang['del_true'], 'games');
}
if (isset($cs_get['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'games');
}
$game = cs_sql_select(__FILE__, 'games', 'games_name', 'games_id = ' . $cs_get['id'], 0, 0, 1);
if (!empty($game)) {
    $data = array();
    $data['lang']['body'] = sprintf($cs_lang['remove_entry'], $cs_lang['mod_remove'], $game['games_name']);
    $data['lang']['content'] = cs_link($cs_lang['confirm'], 'games', 'remove', 'id=' . $cs_get['id'] . '&amp;agree');
    $data['lang']['content'] .= ' - ';
    $data['lang']['content'] .= cs_link($cs_lang['cancel'], 'games', 'remove', 'id=' . $cs_get['id'] . '&amp;cancel');
    echo cs_subtemplate(__FILE__, $data, 'games', 'remove');
} else {
    cs_redirect('', 'games');
}
Exemplo n.º 19
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('replays');
$cs_get = cs_get('id');
if (isset($cs_get['agree'])) {
    $replays = cs_sql_select(__FILE__, 'replays', 'replays_mirror_urls', "replays_id = '" . $cs_get['id'] . "'");
    $replays_string = $replays['replays_mirror_urls'];
    $replays_pics = empty($replays_string) ? array() : explode("\n", $replays_string);
    foreach ($replays_pics as $pics) {
        cs_unlink('replays', $pics);
    }
    cs_sql_delete(__FILE__, 'replays', $cs_get['id']);
    cs_redirect($cs_lang['del_true'], 'replays');
}
if (isset($cs_get['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'replays');
}
$replay = cs_sql_select(__FILE__, 'replays', 'replays_id', 'replays_id = ' . $cs_get['id'], 0, 0, 1);
if (!empty($replay)) {
    $data = array();
    $data['head']['topline'] = sprintf($cs_lang['del_rly'], $cs_get['id']);
    $data['replays']['content'] = cs_link($cs_lang['confirm'], 'replays', 'remove', 'id=' . $cs_get['id'] . '&amp;agree');
    $data['replays']['content'] .= ' - ';
    $data['replays']['content'] .= cs_link($cs_lang['cancel'], 'replays', 'remove', 'id=' . $cs_get['id'] . '&amp;cancel');
    echo cs_subtemplate(__FILE__, $data, 'replays', 'remove');
} else {
    cs_redirect('', 'replays');
}
Exemplo n.º 20
0
$cs_computers_id = empty($cs_get['id']) ? 0 : $cs_get['id'];
if (!empty($cs_post['id'])) {
    $cs_computers_id = $cs_post['id'];
}
$op_computers = cs_sql_option(__FILE__, 'computers');
$img_filetypes = array('gif', 'jpg', 'png');
$select = 'computers_pictures, users_id';
$computer = cs_sql_select(__FILE__, 'computers', $select, "computers_id = '" . $cs_computers_id . "'");
$computer_string = $computer['computers_pictures'];
$computer_pics = empty($computer_string) ? array() : explode("\n", $computer_string);
$computer_next = count($computer_pics) + 1;
$error = '';
if (!empty($_GET['delete'])) {
    $target = $_GET['delete'] - 1;
    cs_unlink('computers', 'picture-' . $computer_pics[$target]);
    cs_unlink('computers', 'thumb-' . $computer_pics[$target]);
    $computer_pics[$target] = FALSE;
    $computer_pics = array_filter($computer_pics);
    $computer_string = implode("\n", $computer_pics);
    $cells = array('computers_pictures');
    $content = array($computer_string);
    cs_sql_update(__FILE__, 'computers', $cells, $content, $cs_computers_id);
} elseif (!empty($_POST['submit'])) {
    if ($computer['users_id'] != $account['users_id'] and $account['access_computers'] < 4) {
        $error .= $cs_lang['not_own'] . cs_html_br(1);
    }
    $img_size = getimagesize($files_gl['picture']['tmp_name']);
    if (empty($img_size) or $img_size[2] > 3) {
        $error .= $cs_lang['ext_error'] . cs_html_br(1);
    }
    if ($img_size[0] > $op_computers['max_width']) {
Exemplo n.º 21
0
    }
} elseif (!empty($check_sq)) {
    $allowed = 1;
} elseif (empty($allowed) or empty($check_pw)) {
    return errorPage('thread_remove', $cs_lang);
}
//Sicherheitsabfrage Ende
if (isset($_POST['agree'])) {
    for ($run = 0; $run < $cs_boardfiles_loop; $run++) {
        $file = $cs_boardfiles[$run]['boardfiles_name'];
        $extension = strlen(strrchr($file, "."));
        $name = strlen($file);
        $ext = substr($file, $name - $extension + 1, $name);
        //$file = cs_secure($cs_boardfiles[$run]['boardfiles_name']);
        //echo 'uploads/board/files/' . $cs_boardfiles[$run]['boardfiles_id'] . '.' . $ext . cs_html_br(1);
        cs_unlink('board', $cs_boardfiles[$run]['boardfiles_id'] . '.' . $ext, 'files');
    }
    cs_sql_delete(__FILE__, 'threads', $thread_id);
    $query = "DELETE FROM {pre}_comments WHERE comments_mod='board' AND ";
    $query .= "comments_fid=" . (int) $thread_id;
    cs_sql_query(__FILE__, $query);
    $query = "DELETE FROM {pre}_abonements WHERE threads_id=" . (int) $thread_id;
    cs_sql_query(__FILE__, $query);
    $query = "DELETE FROM {pre}_boardfiles WHERE threads_id=" . (int) $thread_id;
    cs_sql_query(__FILE__, $query);
    $query = "DELETE FROM {pre}_boardvotes WHERE threads_id=" . (int) $thread_id;
    cs_sql_query(__FILE__, $query);
    $query = "DELETE FROM {pre}_voted WHERE voted_mod='board' AND ";
    $query .= "voted_fid=" . (int) $thread_id;
    cs_sql_query(__FILE__, $query);
    // Delete Ghostlinks
Exemplo n.º 22
0
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('categories');
$cs_get = cs_get('id,agree,cancel');
$categories_id = empty($cs_get['id']) ? 0 : $cs_get['id'];
$data = array();
$data['if']['allow_agree'] = TRUE;
$select = 'categories_picture, categories_mod';
$where = "categories_id = '" . $categories_id . "'";
$cs_category = cs_sql_select(__FILE__, 'categories', $select, $where, 0, 0, 1);
if (empty($cs_category)) {
    cs_redirect('', 'categories');
}
if (isset($cs_get['agree'])) {
    if (!empty($cs_category['categories_picture'])) {
        cs_unlink('categories', $cs_category['categories_picture']);
    }
    cs_sql_delete(__FILE__, 'categories', $categories_id);
    cs_redirect($cs_lang['del_true'], 'categories', 'manage', 'where=' . $cs_category['categories_mod']);
}
if (isset($cs_get['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'categories', 'manage', 'where=' . $cs_category['categories_mod']);
}
$count_use = cs_sql_count(__FILE__, $cs_category['categories_mod'], $where);
if (empty($count_use)) {
    $categorie = cs_sql_select(__FILE__, 'categories', 'categories_name', 'categories_id = ' . $categories_id, 0, 0, 1);
    if (!empty($categorie)) {
        $data['head']['body'] = sprintf($cs_lang['remove_entry'], $cs_lang['mod_remove'], $categorie['categories_name']);
        $data['url']['agree'] = cs_url('categories', 'remove', 'id=' . $categories_id . '&amp;agree');
    } else {
        cs_redirect('', 'categories');
Exemplo n.º 23
0
             break;
     }
     $filename = 'picture-' . $squads_id . '.' . $ext;
     if ($img_size[0] > $op_squads['max_width']) {
         $error .= $cs_lang['too_wide'] . cs_html_br(1);
     }
     if ($img_size[1] > $op_squads['max_height']) {
         $error .= $cs_lang['too_high'] . cs_html_br(1);
     }
     if ($files['picture']['size'] > $op_squads['max_size']) {
         $error .= $cs_lang['too_big'] . cs_html_br(1);
     }
     if (empty($error) and cs_upload('squads', $filename, $files['picture']['tmp_name']) or !empty($error) and extension_loaded('gd') and cs_resample($files['picture']['tmp_name'], 'uploads/squads/' . $filename, $op_squads['max_width'], $op_squads['max_height'])) {
         $error = '';
         if ($cs_squads['squads_picture'] != $filename and !empty($cs_squads['squads_picture'])) {
             cs_unlink('squads', $cs_squads['squads_picture']);
         }
         $cs_squads['squads_picture'] = $filename;
     } else {
         $error .= $cs_lang['up_error'];
     }
 }
 if (empty($cs_squads['clans_id'])) {
     $error .= $cs_lang['no_clan'] . cs_html_br(1);
 }
 if (empty($cs_squads['squads_name'])) {
     $error .= $cs_lang['no_name'] . cs_html_br(1);
 }
 $where = "squads_name = '" . cs_sql_escape($cs_squads['squads_name']) . "'";
 $where .= " AND squads_id != '" . $squads_id . "'";
 $search = cs_sql_count(__FILE__, 'squads', $where);
Exemplo n.º 24
0
 }
 if (!empty($cs_thread['comments_edit'])) {
     $comments_edits_now = explode('/', $cs_thread['comments_edit']);
 } else {
     $comments_edits_now[3] = 0;
 }
 $new_count = 1 + $comments_edits_now[3];
 $comments_edit = $account['users_id'] . '/' . $account['users_nick'] . '/' . cs_time() . '/' . $new_count;
 $com_cells = array('comments_text', 'comments_edit');
 $com_save = array($cs_comments['comments_text'], $comments_edit);
 cs_sql_update(__FILE__, 'comments', $com_cells, $com_save, $comments_id);
 for ($run = 0; $run < $run_loop_files; $run++) {
     if ($cs_boardfiles[$run]['boardfiles_del'] == 1) {
         $ext = substr($cs_boardfiles[$run]['boardfiles_name'], strlen($cs_boardfiles[$run]['boardfiles_name']) + 1 - strlen(strrchr($cs_boardfiles[$run]['boardfiles_name'], '.')));
         $del_file_x = $cs_boardfiles[$run]['boardfiles_id'] . '.' . $ext;
         cs_unlink('board', $del_file_x, 'files');
         $sql_id = $cs_boardfiles[$run]['boardfiles_id'];
         cs_sql_delete(__FILE__, 'boardfiles', $sql_id);
     }
     if ($cs_boardfiles[$run]['boardfiles_id'] == '') {
         $files_cells = array('users_id', 'threads_id', 'comments_id', 'boardfiles_time', 'boardfiles_name');
         $files_save = array($cs_boardfiles[$run]['users_id'], $cs_thread['threads_id'], $comments_id, cs_time(), $cs_boardfiles[$run]['boardfiles_name']);
         cs_sql_insert(__FILE__, 'boardfiles', $files_cells, $files_save);
         $files_select_new_id = cs_sql_insertid(__FILE__);
         $ext = substr($cs_boardfiles[$run]['boardfiles_name'], strlen($cs_boardfiles[$run]['boardfiles_name']) + 1 - strlen(strrchr($cs_boardfiles[$run]['boardfiles_name'], '.')));
         $path = $cs_main['def_path'] . '/uploads/board/files/';
         $target = $path . $file_upload_name[$run];
         $target2 = $path . $files_select_new_id . '.' . $ext;
         $fileHand = fopen($target, 'r');
         fclose($fileHand);
         rename($target, $target2);
Exemplo n.º 25
0
         // cs_sql_query(__FILE__,$query);
         cs_sql_delete(__FILE__, 'comments', $thread_id, 'comments_mod = \'board\' AND comments_fid');
         // $query = 'DELETE FROM {pre}_abonements WHERE threads_id=' . $thread_id;
         // cs_sql_query(__FILE__,$query);
         cs_sql_delete(__FILE__, 'abonements', $thread_id, 'threads_id');
         $files_select = 'boardfiles_id, threads_id, boardfiles_name';
         $files_where = 'threads_id = ' . $thread_id;
         $files_id = cs_sql_select(__FILE__, 'boardfiles', $files_select, $files_where, 0, 0, 0);
         $files_loop = count($files_id);
         for ($run2 = 0; $run2 < $files_loop; $run2++) {
             $file = $files_id[$run2]['boardfiles_name'];
             $extension = strlen(strrchr($file, "."));
             $name = strlen($file);
             $ext = substr($file, $name - $extension + 1, $name);
             echo 'uploads/board/files/' . $files_id[$run2]['boardfiles_id'] . '.' . $ext . cs_html_br(1);
             cs_unlink('board', $files_id[$run2]['boardfiles_id'] . '.' . $ext, 'files');
         }
         // $query = 'DELETE FROM {pre}_boardfiles WHERE threads_id= ' . $thread_id;
         // cs_sql_query(__FILE__,$query);
         cs_sql_delete(__FILE__, 'boardfiles', $thread_id, 'threads_id');
     }
 } else {
     $cs_board_id = $cs_board['board_id'];
     // $query = "UPDATE {pre}_threads SET board_id='$cs_board_id' ";
     // $query .= "WHERE board_id = '$board_id'";
     // cs_sql_query(__FILE__,$query);
     cs_sql_update(__FILE__, 'threads', array('board_id'), array($cs_board_id), 0, 'board_id = ' . $board_id);
     # Update board entry to get correct threads and comments count
     include_once 'mods/board/repair.php';
     cs_board_threads($cs_board_id);
     cs_board_last($cs_board_id);
Exemplo n.º 26
0
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('contact');
$data = array();
$filename = 'uploads/imprint/mailsig.txt';
$sig_form = 1;
$mailsig = file_exists($filename) ? file_get_contents($filename) : '';
if (!empty($_POST['mailsig'])) {
    $mailsig = $_POST['mailsig'];
}
if (isset($_POST['submit'])) {
    $sig_form = 0;
    $data['if']['done'] = TRUE;
    $data['if']['form'] = FALSE;
    if (file_exists($filename)) {
        cs_unlink('imprint', 'mailsig.txt');
    }
    $fp = fopen($filename, "w");
    chmod($filename, 0777);
    # set stream encoding if possible to avoid converting issues
    if (function_exists('stream_encoding')) {
        stream_encoding($fp, $cs_main['charset']);
    }
    fwrite($fp, $mailsig);
    chmod($filename, 0755);
    fclose($fp);
}
if (!empty($sig_form)) {
    $data = array();
    $data['mailsig']['content'] = $mailsig;
    $data['if']['done'] = FALSE;
Exemplo n.º 27
0
         $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($cs_clans['clans_short'])) {
     $error++;
     $errormsg .= $cs_lang['no_short'] . cs_html_br(1);
 }
Exemplo n.º 28
0
$data = array();
$cs_wars_id = empty($cs_get['id']) ? 0 : $cs_get['id'];
if (!empty($cs_post['id'])) {
    $cs_wars_id = $cs_post['id'];
}
$op_wars = cs_sql_option(__FILE__, 'wars');
$img_filetypes = array('gif', 'jpg', 'png');
$war = cs_sql_select(__FILE__, 'wars', 'wars_pictures', "wars_id = '" . $cs_wars_id . "'");
$war_string = $war['wars_pictures'];
$war_pics = empty($war_string) ? array() : explode("\n", $war_string);
$war_next = count($war_pics) + 1;
$error = '';
if (!empty($_GET['delete'])) {
    $target = $_GET['delete'] - 1;
    cs_unlink('wars', 'picture-' . $war_pics[$target]);
    cs_unlink('wars', 'thumb-' . $war_pics[$target]);
    $war_pics[$target] = FALSE;
    $war_pics = array_filter($war_pics);
    $war_string = implode("\n", $war_pics);
    $cells = array('wars_pictures');
    $content = array($war_string);
    cs_sql_update(__FILE__, 'wars', $cells, $content, $cs_wars_id);
    cs_redirect($cs_lang['remove_done'], 'wars', 'picture', 'id=' . $cs_wars_id);
} elseif (isset($_POST['submit'])) {
    $img_size = getimagesize($files['picture']['tmp_name']);
    if (empty($img_size) or $img_size[2] > 3) {
        $error .= $cs_lang['ext_error'] . cs_html_br(1);
    }
    if ($img_size[0] > $op_wars['max_width']) {
        $error .= $cs_lang['too_wide'] . cs_html_br(1);
    }
Exemplo n.º 29
0
    } 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');
    }
}
Exemplo n.º 30
0
<?php

// 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>';