Exemplo n.º 1
0
function cs_installerror($old_query = '')
{
    global $cs_db, $cs_lang, $account;
    $cs_lang = cs_translate('install');
    $error = empty($cs_db['last_error']) ? 'Unknown' : $cs_db['last_error'];
    $msg = 'Error: ' . $error . cs_html_br(2) . 'Query: ' . $old_query . cs_html_br(4);
    $msg .= cs_link($cs_lang['remove_and_again'], 'install', 'sql', 'lang=' . $account['users_lang'] . '&uninstall=1');
    die(cs_error_internal('sql', $msg));
}
Exemplo n.º 2
0
function cs_gray($imgfile)
{
    $info = getimagesize($imgfile);
    switch ($info[2]) {
        case 1:
            $cs_lang = cs_translate('gallery');
            $message = $cs_lang['gray_error'] . cs_html_br(1);
            $g_error = 1;
            break;
        case 2:
            $sourceImage = imagecreatefromjpeg($imgfile);
            break;
        case 3:
            $sourceImage = imagecreatefrompng($imgfile);
            break;
    }
    if (empty($g_error)) {
        $img_width = imagesx($sourceImage);
        $img_height = imagesy($sourceImage);
        for ($y = 0; $y < $img_height; $y++) {
            for ($x = 0; $x < $img_width; $x++) {
                $rgb = imagecolorat($sourceImage, $x, $y);
                $red = $rgb >> 16 & 0xff;
                $green = $rgb >> 8 & 0xff;
                $blue = $rgb & 0xff;
                $gray = round(0.299 * $red + 0.587 * $green + 0.114 * $blue);
                $grayR = $gray << 16;
                // R: red
                $grayG = $gray << 8;
                // G: green
                $grayB = $gray;
                // B: blue
                $grayColor = $grayR | $grayG | $grayB;
                imagesetpixel($sourceImage, $x, $y, $grayColor);
                imagecolorallocate($sourceImage, $gray, $gray, $gray);
            }
        }
        $destinationImage = imagecreatetruecolor($img_width, $img_height);
        imagecopy($destinationImage, $sourceImage, 0, 0, 0, 0, $img_width, $img_height);
        switch ($info[2]) {
            case 2:
                return imagejpeg($destinationImage, $imgfile);
                break;
            case 3:
                return imagepng($destinationImage, $imgfile);
                break;
        }
        imagedestroy($destinationImage);
        imagedestroy($sourceImage);
    }
}
Exemplo n.º 3
0
if (isset($_POST['submit'])) {
    $cs_members['members_task'] = $_POST['members_task'];
    $cs_members['members_since'] = cs_datepost('since', 'date');
    $cs_members['members_order'] = empty($_POST['members_order']) ? 1 : $_POST['members_order'];
    $cs_members['members_admin'] = empty($_POST['members_admin']) ? 0 : $_POST['members_admin'];
    $error = 0;
    $errormsg = '';
    if (empty($cs_members['members_task'])) {
        $error++;
        $errormsg .= $cs_lang['no_task'] . cs_html_br(1);
    }
    $where = "squads_id = '" . $cs_members['squads_id'] . "' AND users_id = '" . $account['users_id'] . "'";
    $search_admin = cs_sql_select(__FILE__, 'members', 'members_admin', $where);
    if (empty($search_admin['members_admin'])) {
        $error++;
        $errormsg .= $cs_lang['no_admin'] . cs_html_br(1);
    }
}
if (!isset($_POST['submit'])) {
    $data['lang']['body'] = $cs_lang['errors_here'];
} elseif (!empty($error)) {
    $data['lang']['body'] = $errormsg;
}
if (!empty($error) or !isset($_POST['submit'])) {
    $data['url']['form'] = cs_url('members', 'change');
    $squad_match = "squads_id = '" . $cs_members['squads_id'] . "'";
    $squad_infos = cs_sql_select(__FILE__, 'squads', 'squads_name,squads_id', $squad_match);
    $squad_name = cs_secure($squad_infos['squads_name']);
    $data['members']['squad'] = cs_link($squad_name, 'squads', 'view', 'id=' . $squad_infos['squads_id']);
    $users_match = "users_id = '" . $cs_members['users_id'] . "'";
    $users_infos = cs_sql_select(__FILE__, 'users', 'users_nick,users_id,users_active,users_delete', $users_match);
Exemplo n.º 4
0
        $error++;
        $errormsg .= $cs_lang['email_false'] . cs_html_br(1);
    }
    include_once 'mods/contact/trashmail.php';
    if (cs_trashmail($cs_user['users_email'])) {
        $error++;
        $errormsg .= $cs_lang['email_false'] . cs_html_br(1);
    }
    if (!empty($cs_user['users_sex'])) {
        $cs_user['users_sex'] = $cs_user['users_sex'] == 'male' ? 'male' : 'female';
    }
    $country = $cs_user['users_country'];
    $cs_user['users_country'] = isset($cs_country[$country]) ? $cs_user['users_country'] : 'fam';
    if ((int) $_POST['age_year'] . $_POST['age_month'] . $_POST['age_day'] > (int) cs_datereal('Ymd')) {
        $error++;
        $errormsg .= $cs_lang['age_false'] . cs_html_br(1);
    }
} else {
    $cells = 'users_nick, users_name, users_surname, users_sex, users_age, users_height, users_country, users_postalcode, users_place, users_adress, users_icq, users_jabber, users_skype, users_email, users_url, users_phone, users_mobile, users_info, users_hidden';
    $cs_user = cs_sql_select(__FILE__, 'users', $cells, "users_id = '" . $account['users_id'] . "'");
    $hidden = explode(',', $cs_user['users_hidden']);
}
if (!isset($_POST['submit'])) {
    $data['users']['body'] = $cs_lang['errors_here'];
} elseif (!empty($error)) {
    $data['users']['body'] = $errormsg;
} else {
    $data['users']['body'] = $cs_lang['changes_done'];
}
if (!empty($error) or !isset($_POST['submit'])) {
    $hidden = array_flip($hidden);
Exemplo n.º 5
0
    $edit['usersgallery_vote'] = isset($_POST['gallery_vote']) ? $_POST['gallery_vote'] : 0;
    if (!empty($_POST['new_time'])) {
        $edit['usersgallery_time'] = cs_time();
    }
    if (!empty($_POST['gallery_count_reset'])) {
        $edit['usersgallery_count'] = 0;
    }
    $error = '';
    if ($edit['users_id'] != $account['users_id'] and $account['access_usersgallery'] < 4) {
        $error .= $cs_lang['not_own'] . cs_html_br(1);
    }
    if (empty($edit['usersgallery_titel'])) {
        $error .= $cs_lang['no_titel'] . cs_html_br(1);
    }
    if (empty($edit['folders_id'])) {
        $error .= $cs_lang['no_cat'] . cs_html_br(1);
    }
}
if (!isset($_POST['submit'])) {
    $data['head']['body'] = $cs_lang['body_picture'];
} elseif (!empty($error)) {
    $data['head']['body'] = $error;
}
if (!empty($error) or !isset($_POST['submit'])) {
    $data['data'] = $edit;
    $data['current']['img'] = cs_html_img('mods/gallery/image.php?usersthumb=' . $edit['usersgallery_id']);
    $data['folders']['select'] = make_folders_select('folders_id', $edit['folders_id'], $account['users_id'], 'usersgallery');
    $data['access']['options'] = '';
    $levels = 0;
    while ($levels < 6) {
        $edit['usersgallery_access'] == $levels ? $sel = 1 : ($sel = 0);
Exemplo n.º 6
0
 if ($account['access_cups'] < 4) {
     echo cs_redirect($cs_lang['no_access'], 'cups', 'match', 'id=' . $cupmatches_id);
 } else {
     $cupmatches_id = (int) $_POST['cupmatches_id'];
     if (!empty($_POST['admin_submit'])) {
         $cup_match = cs_sql_select(__FILE__, 'cupmatches', '*', 'cupmatches_id = ' . $cupmatches_id);
         $cs_match = array();
         $cs_match['cupmatches_score1'] = (int) $_POST['cupmatches_score1'];
         $cs_match['cupmatches_score2'] = (int) $_POST['cupmatches_score2'];
         if ($_POST['cupmatches_score1'] > $_POST['cupmatches_score2']) {
             $cs_match['cupmatches_winner'] = $cup_match['squad1_id'];
         } else {
             if ($_POST['cupmatches_score2'] > $_POST['cupmatches_score1']) {
                 $cs_match['cupmatches_winner'] = $cup_match['squad2_id'];
             } else {
                 $error = cs_html_br(1) . $cs_lang['no_winner'];
                 cs_redirect($cs_lang['error_occured'] . $error, 'cups', 'match', 'id=' . $cupmatches_id);
             }
         }
         $cs_match['cupmatches_accepted1'] = empty($_POST['cupmatches_accepted1']) ? 0 : 1;
         $cs_match['cupmatches_accepted2'] = empty($_POST['cupmatches_accepted2']) ? 0 : 1;
         $cells = array_keys($cs_match);
         $values = array_values($cs_match);
         cs_sql_update(__FILE__, 'cupmatches', $cells, $values, $cupmatches_id);
         // Check for new round
         if (!empty($cs_match['cupmatches_accepted1']) && !empty($cs_match['cupmatches_accepted2'])) {
             $cs_match = cs_sql_select(__FILE__, 'cupmatches', '*', 'cupmatches_id = ' . $cupmatches_id, 0, 0, 1);
             $loser = $cs_match['cupmatches_winner'] == $cup_match['squad1_id'] ? $cup_match['squad2_id'] : $cup_match['squad1_id'];
             if ($cs_match['cupmatches_nextmatch'] != CS_CUPS_NO_NEXTMATCH) {
                 /* add winner team to next match */
                 cs_cups_addteam2match($cs_match['cups_id'], $cs_match['cupmatches_winner'], $cs_match['cupmatches_match'], $cs_match['cupmatches_round'], $cs_match['cupmatches_loserbracket'], $cs_match['cupmatches_nextmatch'], true);
Exemplo n.º 7
0
                $wars['status']['players_id'] = $select['players_id'];
                $wars['status']['wars_id'] = $wars_id;
                $wars['lang']['submit'] = empty($in_list) ? $cs_lang['confirm'] : $cs_lang['edit'];
            } else {
                $players_id = (int) $_POST['players_id'];
                $wars_id = (int) $_POST['wars_id'];
                $status = $_POST['players_status'];
                $time = cs_time();
                if (empty($in_list)) {
                    $cells = array('wars_id', 'users_id', 'players_status', 'players_time');
                    $values = array($wars_id, $account['users_id'], $status, $time);
                    cs_sql_insert(__FILE__, 'players', $cells, $values);
                } else {
                    $cells = array('players_status', 'players_time');
                    $values = array($status, $time);
                    cs_sql_update(__FILE__, 'players', $cells, $values, $players_id);
                }
                cs_redirect($cs_lang['success'], 'wars', 'view', 'id=' . $wars_id);
            }
        }
    }
}
echo cs_subtemplate(__FILE__, $wars, 'wars', 'view');
$where_com = "comments_mod = 'wars' AND comments_fid = '" . $wars_id . "'";
$count_com = cs_sql_count(__FILE__, 'comments', $where_com);
include_once 'mods/comments/functions.php';
if (!empty($count_com)) {
    echo cs_html_br(1);
    echo cs_comments_view($wars_id, 'wars', 'view', $count_com);
}
echo cs_comments_add($wars_id, 'wars', $cs_wars['wars_close']);
Exemplo n.º 8
0
} elseif (empty($_GET['delete'])) {
    $data['head']['text'] = $cs_lang['body_picture'];
} else {
    $data['head']['text'] = $cs_lang['remove_done'];
}
$data['head']['message'] = cs_getmsg();
$data['file']['id'] = $cs_files_id;
if (!empty($error) or empty($_POST['submit'])) {
    $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'] . $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['upload']['clip'] = cs_abcode_clip($matches);
    $data['pictures'] = array();
    if (empty($file_string)) {
        $data['if']['nopics'] = true;
    } else {
        $data['if']['nopics'] = false;
        $run = 1;
        $i = 0;
        foreach ($file_pics as $pic) {
            $data['pictures'][$i]['sad'] = $data['pictures'][$i]['thumbpath'] = 'uploads/files/thumb-' . $pic;
            $data['pictures'][$i]['picpath'] = 'uploads/files/picture-' . $pic;
            $data['pictures'][$i]['id'] = $run;
            $run++;
            $i++;
Exemplo n.º 9
0
            $title = $cs_lang['mail_titel'];
            $message = $cs_lang['mail_text'] . $cs_messages[$run]['users_nick'];
            $message .= $cs_lang['mail_text_2'] . $cs_main['def_title'] . $cs_lang['mail_text_3'];
            $message .= $cs_contact['def_org'] . $cs_lang['mail_text_4'];
            cs_mail($email, $title, $message);
            if (!empty($lang_save)) {
                $cs_lang = $cs_lang_save;
                $account['users_lang'] = $lang_save;
            }
        }
    }
    cs_redirect($cs_lang['msg_create_done'], 'messages', 'center');
}
$data = array();
$data['if']['preview'] = false;
$data['lang']['body_create'] = empty($messages_error) ? nl2br($cs_lang['body_create']) : $cs_lang['error_occured'] . cs_html_br(1) . $errormsg;
if (isset($_POST['preview']) && empty($messages_error)) {
    $data['if']['preview'] = true;
    $data['var']['subject'] = cs_secure($_POST['messages_subject']);
    $data['var']['date'] = cs_date('unix', $time, 1);
    $data['to'] = $cs_messages;
    $data['var']['text'] = cs_secure($_POST['messages_text'], 1, 1);
}
$data['msg']['to'] = cs_secure($messages_to);
$data['msg']['subject'] = cs_secure($messages_subject);
$data['msg']['smileys'] = cs_abcode_smileys('messages_text');
$data['msg']['abcode'] = cs_abcode_features('messages_text');
$data['msg']['text'] = cs_secure($messages_text);
$data['checked']['show_sender'] = empty($messages_show_sender) ? '' : ' checked="checked"';
$data['var']['reply_id'] = $reply_id;
echo cs_subtemplate(__FILE__, $data, 'messages', 'create');
Exemplo n.º 10
0
    }
    if (!empty($files_gl['medals_picture']['tmp_name'])) {
        $img_size = getimagesize($files_gl['medals_picture']['tmp_name']);
        switch ($img_size[2]) {
            case 1:
                $extension = 'gif';
                break;
            case 2:
                $extension = 'jpg';
                break;
            case 3:
                $extension = 'png';
                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');
Exemplo n.º 11
0
     $no_cat['lang']['no_cat'] = $cs_lang['list_no_cat'];
 }
 $data['tmp']['no_cat'] = empty($no_cat) ? '' : cs_subtemplate(__FILE__, $no_cat, 'usersgallery', 'users_error_1');
 if (!empty($folders_loop)) {
     $run = 0;
     foreach ($folders as $a) {
         if ($a['sub_id'] == '0') {
             if (empty($a['folders_picture'])) {
                 $cs_lap = cs_html_img('symbols/gallery/image.gif');
             } else {
                 $cs_lap = cs_html_img("uploads/folders/" . $a['folders_picture']);
             }
             $cat[$run]['img'] = cs_link($cs_lap, 'usersgallery', 'users', 'id=' . $id . '&amp;cat_id=' . $a['folders_id']);
             $more = 'id=' . $id . '&amp;cat_id=' . $a['folders_id'];
             $cat[$run]['folders_name'] = cs_link(cs_secure($a['folders_name']), 'usersgallery', 'users', $more);
             $cat[$run]['folders_text'] = !empty($a['folders_text']) ? cs_secure($a['folders_text'], 1, 1) : cs_html_br(1);
             $cat_id_a = $a['folders_id'];
             $pic_loop = '0';
             $last_update = '0';
             for ($run_2 = 0; $run_2 < $gallery_loop; $run_2++) {
                 $gal_cat_id = $cs_gallery[$run_2]['folders_id'];
                 if ($cat_id_a == $gal_cat_id) {
                     $pic_loop++;
                     if ($last_update <= $cs_gallery[$run_2]['usersgallery_time']) {
                         $last_update = $cs_gallery[$run_2]['usersgallery_time'];
                     }
                 }
             }
             if ($pic_loop == 1) {
                 $cat[$run]['pic_count'] = sprintf($cs_lang['pic_1'], $pic_loop);
                 if (!empty($last_update)) {
Exemplo n.º 12
0
    $sel = 0;
    while ($levels < 6) {
        $cs_categories['categories_access'] == $levels ? $sel = 1 : ($sel = 0);
        $data['access'][$levels]['sel'] = cs_html_option($levels . ' - ' . $cs_lang['lev_' . $levels], $levels, $sel);
        $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);
Exemplo n.º 13
0
     }
 }
 if (isset($_POST['preview']) and empty($error)) {
     $cs_static['static_title'] = $_POST['static_title'];
     $cs_static['static_text'] = $_POST['static_text'];
     $cs_static['static_table'] = isset($_POST['static_table']) ? 1 : 0;
     $cs_static['static_comments'] = isset($_POST['static_comments']) ? 1 : 0;
     $cs_static['static_access'] = $_POST['static_access'];
     $cs_static['static_admins'] = isset($_POST['static_admins']) ? 1 : 0;
     $cs_view_static['static']['title'] = $cs_static['static_title'];
     $cs_view_static['static']['content'] = cs_secure($cs_static['static_text'], 1, 1, 1, 1, $cs_option['php_eval']);
     if (empty($cs_static['static_table'])) {
         echo cs_subtemplate(__FILE__, $cs_view_static, 'static', 'view');
     } else {
         echo cs_subtemplate(__FILE__, $cs_view_static, 'static', 'view_table');
         echo cs_html_br(3);
     }
 }
 if (!isset($_POST['submit']) or !empty($error)) {
     $static_access = $cs_static['static_access'];
     while ($levels < 6) {
         $static_access == $levels ? $sel = 'selected="selected"' : ($sel = '');
         $cs_static_tpl['access'][$levels]['level_id'] = $levels;
         $cs_static_tpl['access'][$levels]['level_name'] = $cs_lang['lev_' . $levels];
         $cs_static_tpl['access'][$levels]['selected'] = $sel;
         $levels++;
     }
     if (!empty($error)) {
         $cs_action_head['head']['body'] = $errormsg;
         $more = 'id=' . $static_id;
     } else {
Exemplo n.º 14
0
    $print_form_height[4] = '421';
    $print_form_width[4] = '298';
    $print_form_height[5] = '842';
    $print_form_width[5] = '595';
    $print_form_height[6] = '1684';
    $print_form_width[6] = '1191';
    $print_form_height[7] = $print_height;
    $print_form_width[7] = $print_width;
    $height = $print_form_height[$print];
    $width = $print_form_width[$print];
    $error = '';
    if (empty($print)) {
        $error .= $cs_lang['error_print'] . cs_html_br(1);
    }
    if (empty($picture_id)) {
        $error .= $cs_lang['error_pic'] . cs_html_br(1);
    }
}
if (!isset($_POST['preview']) or isset($_POST['preview'])) {
    $data['head']['body'] = $cs_lang['body_print'];
} elseif (!empty($error)) {
    $data['head']['body'] = $error;
}
if (isset($_POST['preview']) and empty($error)) {
    $data['if']['preview'] = TRUE;
    if (extension_loaded('gd')) {
        $data['print']['img'] = cs_html_img("mods/gallery/image.php?pic=" . $picture_id . "&amp;size=" . $width);
        $host = $cs_main['php_self']['website'] . $cs_main['php_self']['dirname'];
        $data['print']['url'] = $host . "mods/gallery/print_now.php?pic=" . $picture_id . "&amp;size=" . $width;
        $data['if']['extension'] = TRUE;
    } else {
Exemplo n.º 15
0
function cs_log_format($part, $addslashes = 0)
{
    global $cs_logs, $cs_main;
    $log = '';
    if (is_array($cs_logs[$part])) {
        foreach ($cs_logs[$part] as $file => $content) {
            if (!empty($addslashes)) {
                $file = str_replace('\\', '\\\\', $file);
            }
            $log .= cs_html_big(1) . $file . cs_html_big(0) . cs_html_br(1);
            $log .= nl2br(htmlentities($content, ENT_QUOTES, $cs_main['charset']));
        }
        return $log;
    } else {
        return '';
    }
}
Exemplo n.º 16
0
 $data['if']['file'] = TRUE;
 require_once 'mods/clansphere/filetype.php';
 for ($run = 0; $run < $run_loop_files; $run++) {
     $num = $run + 1;
     $cs_files["text_{$num}"] = isset($_POST["text_{$num}"]) ? $_POST["text_{$num}"] : '';
     $data['files'][$run]['num'] = $num;
     $data['files'][$run]['if']['empty_file'] = FALSE;
     $data['files'][$run]['if']['file_exists'] = FALSE;
     if (empty($file_name[$num])) {
         $data['files'][$run]['if']['empty_file'] = TRUE;
         $matches[1] = $cs_lang['infos'];
         $return_types = '';
         foreach ($filetypes as $add) {
             $return_types .= empty($return_types) ? $add : ', ' . $add;
         }
         $matches[2] = $cs_lang['max_size'] . cs_filesize($max_size) . cs_html_br(1);
         $matches[2] .= $cs_lang['filetypes'] . ': ' . $return_types;
         $data['files'][$run]['clip'] = cs_abcode_clip($matches);
     } else {
         $data['files'][$run]['if']['file_exists'] = TRUE;
         $data['files'][$run]['name'] = $file_name[$num];
         $data['files'][$run]['up_name'] = $file_upload_name[$num];
         $file = $file_name[$num];
         $extension = strlen(strrchr($file, "."));
         $name = strlen($file);
         $ext = substr($file, $name - $extension + 1, $name);
         $ext_lower = strtolower($ext);
         $data['files'][$run]['ext'] = cs_filetype($ext_lower);
         $data['files'][$run]['if']['file_is_picture'] = FALSE;
         $data['files'][$run]['if']['file_is_other'] = FALSE;
         #check if file is picture
Exemplo n.º 17
0
         // $query .= "AND comments_mod = 'board'";
         // 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);
Exemplo n.º 18
0
    }
    if (empty($cs_awards['awards_event'])) {
        $error++;
        $errormsg .= $cs_lang['no_event'] . cs_html_br(1);
    }
    if (empty($cs_awards['awards_event_url'])) {
        $error++;
        $errormsg .= $cs_lang['no_event_url'] . cs_html_br(1);
    }
    if (empty($cs_awards['games_id']) and empty($cs_games['games_name'])) {
        $error++;
        $errormsg .= $cs_lang['no_game'] . cs_html_br(1);
    }
    if (empty($cs_awards['awards_rank'])) {
        $error++;
        $errormsg .= $cs_lang['no_rank'] . cs_html_br(1);
    }
}
if (!isset($_POST['submit']) or isset($_POST['submit']) and !empty($error)) {
    $data = array();
    $data['head']['body_create'] = !isset($_POST['submit']) ? $cs_lang['body_create'] : $errormsg;
    $data['awards']['awards_event_url'] = $cs_awards['awards_event_url'];
    $data['awards']['awards_event'] = $cs_awards['awards_event'];
    $data['awards']['awards_rank'] = $cs_awards['awards_rank'];
    $games = cs_sql_select(__FILE__, 'games', 'games_name, games_id', 0, 1, 1, 0);
    $data['select']['game'] = cs_dropdown('games_id', 'games_name', $games, $cs_awards['games_id']);
    $data_squads = cs_sql_select(__FILE__, 'squads', 'squads_name,squads_id', 0, 'squads_name', 0, 0);
    $data['squads'] = cs_dropdownsel($data_squads, $cs_awards['squads_id'], 'squads_id');
    $data['select']['date'] = cs_dateselect('datum', 'date', $cs_awards['awards_time']);
    echo cs_subtemplate(__FILE__, $data, 'awards', 'create');
}
Exemplo n.º 19
0
    $cs_computers['computers_sounds'] = $_POST['computers_sounds'];
    $cs_computers['computers_harddisks'] = $_POST['computers_harddisks'];
    $cs_computers['computers_drives'] = $_POST['computers_drives'];
    $cs_computers['computers_screens'] = $_POST['computers_screens'];
    $cs_computers['computers_interfaces'] = $_POST['computers_interfaces'];
    $cs_computers['computers_networks'] = $_POST['computers_networks'];
    $cs_computers['computers_more'] = $_POST['computers_more'];
    $error = '';
    if (empty($cs_computers['computers_name'])) {
        $error .= $cs_lang['no_name'] . cs_html_br(1);
    }
    if (empty($cs_computers['computers_software'])) {
        $error .= $cs_lang['no_software'] . cs_html_br(1);
    }
    if (empty($cs_computers['computers_mainboard'])) {
        $error .= $cs_lang['no_mainboard'] . cs_html_br(1);
    }
} else {
    $cs_computers['computers_name'] = '';
    $cs_computers['computers_software'] = '';
    $cs_computers['computers_mainboard'] = '';
    $cs_computers['computers_memory'] = '';
    $cs_computers['computers_processors'] = '';
    $cs_computers['computers_graphics'] = '';
    $cs_computers['computers_sounds'] = '';
    $cs_computers['computers_harddisks'] = '';
    $cs_computers['computers_drives'] = '';
    $cs_computers['computers_screens'] = '';
    $cs_computers['computers_interfaces'] = '';
    $cs_computers['computers_networks'] = '';
    $cs_computers['computers_more'] = '';
Exemplo n.º 20
0
}
if ($account['access_board'] < $cs_thread['board_access'] and empty($check_sq) or empty($check_pw)) {
    return errorPage('report', $cs_lang);
}
$report = isset($_POST['report']) ? $_POST['report'] : '';
if (isset($_POST['submit'])) {
    $error = 0;
    $errormsg = '';
    if (empty($report)) {
        $error++;
        $errormsg .= $cs_lang['no_text'] . cs_html_br(1);
    }
    $exists = cs_sql_count(__FILE__, 'boardreport', "threads_id = " . (int) $tid . " AND comments_id = " . (int) $cid);
    if (!empty($exists)) {
        $error++;
        $errormsg .= $cs_lang['report_exists'] . cs_html_br(1);
    }
}
if (!empty($error)) {
    $data['lang']['body'] = $errormsg;
} elseif (!isset($_POST['submit'])) {
    $data['lang']['body'] = $cs_lang['fill_out_all_fields'];
} else {
    $data['lang']['body'] = $cs_lang['report_success'];
}
if (!empty($error) or !isset($_POST['submit'])) {
    $data['action']['form'] = cs_url('board', 'report');
    $data['report']['tid'] = $tid;
    $data['report']['cid'] = $cid;
} else {
    $report_cells = array('threads_id', 'comments_id', 'users_id', 'boardreport_time', 'boardreport_text');
Exemplo n.º 21
0
 $errormsg = '';
 if (empty($cs_db['hash'])) {
     $error++;
     $errormsg .= $cs_lang['no_hash'] . cs_html_br(1);
 }
 if (empty($cs_db['type'])) {
     $error++;
     $errormsg .= $cs_lang['no_type'] . cs_html_br(1);
 }
 if (empty($cs_db['name'])) {
     $error++;
     $errormsg .= $cs_lang['no_name'] . cs_html_br(1);
 }
 if (!preg_match("=^[a-z0-9]+\$=i", $cs_db['prefix'])) {
     $error++;
     $errormsg .= $cs_lang['prefix_err'] . cs_html_br(1);
 }
 if (empty($error)) {
     if (isset($sql_files['' . $cs_db['type'] . '.php'])) {
         include_once 'system/database/' . $cs_db['type'] . '.php';
         $dberr = cs_sql_connect($cs_db, 1);
     } else {
         $dberr = 'Extension could not be found';
     }
 }
 if (!empty($dberr)) {
     $error++;
     $errormsg = $cs_lang['db_err'] . ' ' . nl2br($dberr);
 }
 if (empty($error)) {
     $setup_php = "<?php\n\n\$cs_db['hash'] = '" . $cs_db['hash'] . "'; # don't change!\n";
Exemplo n.º 22
0
    for ($run = 0; $run < count($_POST['file']); $run++) {
        if (!empty($_POST['pattern'][$run])) {
            if (!empty($smileys)) {
                for ($runb = 0; $runb < count($smileys); $runb++) {
                    if ($_POST['pattern'][$run] == $smileys[$runb]['abcode_pattern']) {
                        $error++;
                        $errormsg .= sprintf($cs_lang['error_pattern_sql'], $_POST['file'][$run]) . cs_html_br(1);
                        $data['file'][$run]['run'] = '';
                    } else {
                        $data['file'][$run]['run'] = $_POST['pattern'][$run];
                    }
                }
            }
        } else {
            $error++;
            $errormsg .= sprintf($cs_lang['error_pattern'], $_POST['file'][$run]) . cs_html_br(1);
            $data['file'][$run]['run'] = isset($_POST['pattern'][$run]) ? $_POST['pattern'][$run] : '';
        }
        $data['file'][$run]['name'] = $_POST['file'][$run];
        $data['file'][$run]['preview'] = cs_html_img('uploads/abcode/' . $_POST['file'][$run]);
        $data['file'][$run]['order'] = empty($_POST['order_' . $counter]) ? 0 : (int) $_POST['order_' . $counter];
        $data['file'][$run]['counter'] = $counter;
        $counter++;
    }
}
if (!empty($error)) {
    $data['head']['msg'] = $errormsg;
} else {
    $data['head']['msg'] = $cs_lang['new_import'];
}
if (!isset($_POST['submit']) or !empty($error)) {
Exemplo n.º 23
0
}
if (!isset($_POST['submit']) and !isset($_POST['preview'])) {
    $data['head']['body'] = $cs_lang['head_body'];
} elseif (!empty($error)) {
    $data['head']['body'] = $error;
} elseif (isset($_POST['preview'])) {
    $data['head']['body'] = $cs_lang['preview'];
}
if (isset($_POST['preview']) and empty($error)) {
    $run = $_POST['run_loop'];
    $data['news']['news_time'] = cs_date('unix', cs_time(), 1);
    $data['news']['preview_news_text'] = cs_secure($cs_news['news_text'], $abcode[0], $abcode[1], $abcode[2], $abcode[3], $abcode[4]);
    $data['if']['readmore'] = false;
    if (!empty($cs_news['news_readmore'])) {
        $data['if']['readmore'] = true;
        $data['news']['preview_news_readmore'] = cs_secure($cs_news['news_readmore'], $abcode[0], $abcode[1], $abcode[2], $abcode[3], $abcode[4]) . cs_html_br(2);
    }
    $search = 'users_id = ' . $cs_news['users_id'];
    $cs_news_user = cs_sql_select(__FILE__, 'users', 'users_nick, users_active', $search);
    $data['news']['users_link'] = cs_user($cs_news['users_id'], $cs_news_user['users_nick'], $cs_news_user['users_active']);
    $data['if']['catimg'] = false;
    $cat_search = "categories_id = '" . $cs_news['categories_id'] . "'";
    $cs_cat = cs_sql_select(__FILE__, 'categories', 'categories_picture', $cat_search);
    if (!empty($cs_cat['categories_picture'])) {
        $data['if']['catimg'] = true;
        $data['news']['url_catimg'] = 'uploads/categories/' . $cs_cat['categories_picture'];
    }
    $data['if']['show'] = false;
    if (!empty($cs_news['news_mirror'])) {
        $data['if']['show'] = true;
        if (isset($_POST['mirror'])) {
Exemplo n.º 24
0
        $langinfocontent .= '// File created by mod modules' . "\r\n\r\n";
        $langinfocontent .= '$cs_lang[\'mod\'] = \'' . $_POST['modname'] . "';\r\n";
        $langinfocontent .= '$cs_lang[\'mod_info\'] = \'' . $_POST['description'] . "';\r\n\r\n";
        $langinfocontent .= '?>';
        if (!($langinfofile = fopen($cs_main['def_path'] . '/lang/' . $account['users_lang'] . '/' . $_POST['moddir'] . '.php', 'w'))) {
            $error .= cs_html_br(1) . $cs_lang['modinfolang_create_failed'];
        } elseif (!fwrite($langinfofile, $langinfocontent)) {
            $error .= cs_html_br(1) . $cs_lang['modinfolang_write_failed'];
        } else {
            fclose($langinfofile);
        }
        // SQL
        $query = 'ALTER TABLE {pre}_access ADD access_' . cs_sql_escape($_POST['moddir']) . ' int(2) NOT NULL default \'0\';';
        $query = cs_sql_replace($query);
        if (!cs_sql_query(__FILE__, $query)) {
            $error .= cs_html_br(1) . $cs_lang['sqlaccess_failed'];
        }
    }
}
if (empty($_POST['submit']) || !empty($error)) {
    $data['message']['lang'] = empty($error) ? nl2br($cs_lang['need_chmod']) : $cs_lang['error_occured'] . $error;
    // SQL Tables
    $_POST['tablescount'] = empty($_POST['tablescount']) ? 1 : (int) $_POST['tablescount'];
    $tablescount = empty($_POST['addtable']) ? $_POST['tablescount'] : $_POST['tablescount'] + 1;
    for ($run = 0; $run < $tablescount; $run++) {
        $data['tables'][$run]['run'] = $run;
        $data['tables'][$run]['value'] = empty($_POST['table_' . $run]) ? '' : $_POST['table_' . $run];
    }
    $data['value']['tablescount'] = $tablescount;
    // Show
    $_POST['showcount'] = empty($_POST['showcount']) ? 1 : (int) $_POST['showcount'];
Exemplo n.º 25
0
            $data['threads'][$run]['important'] = '';
        }
        $headline = cs_secure($thread['threads_headline']);
        $data['threads'][$run]['headline'] = cs_link($headline, 'board', 'thread', 'where=' . $thread['threads_id']);
        if ($thread['threads_comments'] > $account['users_limit']) {
            $data['threads'][$run]['pages'] = cs_html_br(1);
            $data['threads'][$run]['pages'] .= $cs_lang['page'] . ' ';
            $data['threads'][$run]['pages'] .= cs_pages('board', 'thread', $thread['threads_comments'], 0, $thread['threads_id'], 0, 0, 1);
        } else {
            $data['threads'][$run]['pages'] = '';
        }
        $data['threads'][$run]['comments'] = $thread['threads_comments'];
        $data['threads'][$run]['view'] = $thread['threads_view'];
        if (!empty($thread['threads_last_time'])) {
            $date = cs_date('unix', $thread['threads_last_time'], 1);
            $comments = $thread['threads_comments'] == 0 ? 0 : $thread['threads_comments'] - 1;
            $goto = floor($comments / $account['users_limit']) * $account['users_limit'];
            $goto .= '#com' . $thread['threads_comments'];
            $data['threads'][$run]['last'] = cs_link($date, 'board', 'thread', 'where=' . $thread['threads_id'] . '&amp;start=' . $goto);
            if (!empty($thread['users_id'])) {
                $data['threads'][$run]['last_user'] = cs_html_br(1);
                $data['threads'][$run]['last_user'] .= $cs_lang['from'] . ' ';
                $data['threads'][$run]['last_user'] .= cs_user($thread['users_id'], $thread['users_nick'], $thread['users_active']);
            } else {
                $data['threads'][$run]['last_user'] = '';
            }
        }
        $run++;
    }
}
echo cs_subtemplate(__FILE__, $data, 'board', 'active');
Exemplo n.º 26
0
if (!empty($error) or !isset($_POST['submit'])) {
    $data['action']['form'] = cs_url('banners', 'create');
    $data['banners']['name'] = $cs_banners['banners_name'];
    $data['banners']['category'] = cs_categories_dropdown('banners', $cs_banners['categories_id']);
    $data['banners']['url'] = $cs_banners['banners_url'];
    $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);
Exemplo n.º 27
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('history');
$data = array();
$data['if']['preview'] = FALSE;
if (isset($_POST['submit']) or isset($_POST['preview'])) {
    $history['history_text'] = empty($cs_main['rte_html']) ? $_POST['history_text'] : cs_abcode_inhtml($_POST['history_text'], 'add');
    $history['history_time'] = cs_time();
    $history['users_id'] = $account['users_id'];
    $error = '';
    if (empty($history['history_text'])) {
        $error .= $cs_lang['no_text'] . cs_html_br(1);
    }
} else {
    $history['history_text'] = '';
    $history['history_time'] = '';
    $history['users_id'] = 0;
}
if (!isset($_POST['submit']) and !isset($_POST['preview'])) {
    $data['head']['body'] = $cs_lang['body'];
} elseif (!empty($error)) {
    $data['head']['body'] = $error;
} elseif (isset($_POST['preview'])) {
    $data['head']['body'] = $cs_lang['preview'];
}
if (isset($_POST['preview']) and empty($error)) {
    $data['if']['preview'] = TRUE;
    $data['preview']['date'] = cs_date('unix', $history['history_time'], 1);
    $cs_user = cs_sql_select(__FILE__, 'users', 'users_nick, users_active', "users_id = '" . $history['users_id'] . "'");
Exemplo n.º 28
0
    }
    if (empty($data['create']['games_id'])) {
        $servers_error++;
        $errormsg .= $cs_lang['no_game'] . cs_html_br(1);
    }
    if (empty($data['create']['servers_type'])) {
        $servers_error++;
        $errormsg .= $cs_lang['no_type'] . cs_html_br(1);
    }
    if (empty($data['create']['servers_class'])) {
        $servers_error++;
        $errormsg .= $cs_lang['no_class'] . cs_html_br(1);
    }
    if (empty($data['create']['servers_query'])) {
        $servers_error++;
        $errormsg .= $cs_lang['no_query'] . cs_html_br(1);
    }
    // Create new Entry
} else {
    $data['servers']['id'] = empty($_GET['id']) ? 0 : $_GET['id'];
    $select = 'servers_name, servers_ip, servers_port, games_id, servers_info, servers_slots, servers_stats';
    $select .= ', servers_type, servers_class, servers_query, servers_order';
    $where = 'servers_id = \'' . $data['servers']['id'] . '\'';
    $data['create'] = cs_sql_select(__FILE__, 'servers', $select, $where, 0, 0, 1);
}
if (!isset($_POST['submit'])) {
    $data['body']['create'] = $cs_lang['body_create'];
} elseif (!empty($servers_error)) {
    $data['body']['create'] = $errormsg;
}
if (!empty($servers_error) or !isset($_POST['submit'])) {
Exemplo n.º 29
0
     $data['maps']['maps_name'] = empty($_POST['maps_name']) ? $data['maps']['maps_name'] : $_POST['maps_name'];
     $data['maps']['maps_text'] = empty($_POST['maps_text']) ? $data['maps']['maps_text'] : $_POST['maps_text'];
     $data['abcode']['smileys'] = cs_abcode_smileys('maps_text');
     $data['abcode']['features'] = cs_abcode_features('maps_text');
     $data['maps']['action'] = cs_url('maps', 'edit');
     $data['games'] = cs_sql_select(__FILE__, 'games', 'games_name,games_id', 0, 'games_name', 0, 0);
     $data['games'] = cs_dropdownsel($data['games'], $data['maps']['games_id'], 'games_id');
     $data['maps']['picture'] = empty($data['maps']['maps_picture']) ? '-' : cs_html_img('uploads/maps/' . $data['maps']['maps_picture']);
     $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'] . $options['max_width'] . ' px' . cs_html_br(1);
     $matches[2] .= $cs_lang['max_height'] . $options['max_height'] . ' px' . cs_html_br(1);
     $matches[2] .= $cs_lang['max_size'] . cs_filesize($options['max_size']) . cs_html_br(1);
     $matches[2] .= $cs_lang['filetypes'] . $return_types;
     $data['maps']['matches'] = cs_abcode_clip($matches);
     $data['if']['picture_remove'] = !empty($data['maps']['maps_picture']) ? TRUE : FALSE;
     echo cs_subtemplate(__FILE__, $data, 'maps', 'edit');
 } 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'])) {
Exemplo n.º 30
0
        $where = "wars_id = '" . $wars_id . "' AND rounds_order = '" . $new_order . "'";
        $round_old = cs_sql_select(__FILE__, 'rounds', 'rounds_id', $where);
    }
    $values = array($round['rounds_order']);
    cs_sql_update(__FILE__, 'rounds', $cells, $values, $round_old['rounds_id']);
    $values = array($new_order);
    cs_sql_update(__FILE__, 'rounds', $cells, $values, $roundid);
}
if (isset($_POST['submit'])) {
    $cs_rounds['maps_id'] = (int) $_POST['maps_id'];
    $new_map = $_POST['new_map'];
    $cs_rounds['rounds_score1'] = (int) $_POST['rounds_score1'];
    $cs_rounds['rounds_score2'] = (int) $_POST['rounds_score2'];
    $cs_rounds['rounds_description'] = $_POST['rounds_description'];
    if (empty($_POST['maps_id']) and empty($_POST['new_map'])) {
        $error .= $cs_lang['no_map'] . cs_html_br(1);
    }
}
if (!isset($_POST['submit'])) {
    $data['head']['body'] = $cs_lang['rounds_management'];
} elseif (!empty($error)) {
    $data['head']['body'] = $error;
}
if (!empty($error) or empty($_POST['submit'])) {
    $data['wars'] = $cs_rounds;
    $cs_wars = cs_sql_select(__FILE__, 'wars', 'games_id', "wars_id = '" . $wars_id . "'");
    $cs_maps = cs_sql_select(__FILE__, 'maps', 'maps_name, maps_id', "games_id = '" . $cs_wars['games_id'] . "'", 'maps_name', 0, 0);
    $i = 0;
    if (!empty($cs_maps)) {
        foreach ($cs_maps as $map) {
            $sel = $map['maps_id'] == $cs_rounds['maps_id'] ? 1 : 0;