本文整理汇总了PHP中cs_unlink函数的典型用法代码示例。如果您正苦于以下问题:PHP cs_unlink函数的具体用法?PHP cs_unlink怎么用?PHP cs_unlink使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cs_unlink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cs_pictures_delete
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;
}
示例2: foreach
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');
}
示例3: cs_html_img
$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'])) {
示例4: cs_files
$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++;
示例5: cs_html_br
$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)) {
示例6: cs_get
$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) {
示例7: cs_html_br
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;
}
示例8: cs_translate
<?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 . '&agree');
$data['url']['cancel'] = cs_url('links', 'remove', 'id=' . $links_id . '&cancel');
echo cs_subtemplate(__FILE__, $data, 'links', 'remove');
} else {
cs_redirect('', 'links');
}
示例9: cs_sql_option
$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++;
示例10: cs_translate
// 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');
示例11: elseif
} 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);
}
示例12: cs_unlink
$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;
示例13: file_exists
$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) {
示例14: empty
$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']) {
示例15: elseif
}
} 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