/**
 * update_tag
 * 
 * 
 * 
 * 
 * 
 * 
 */
function update_tag($tag_id)
{
    if (empty($tag_id)) {
        return false;
    }
    $check = validate_new_tag($_POST['title']);
    if ($check !== true) {
        return $check;
    }
    $conn = author_connect();
    // convert csv to array
    $title = clean_input($_POST['title']);
    $url = create_url_title($title);
    $summary = !empty($_POST['summary']) ? clean_input($_POST['summary']) : '';
    $query = "UPDATE tags SET\n\t\t\t\t\ttitle = '" . $conn->real_escape_string($title) . "',\n\t\t\t\t\turl = '" . $conn->real_escape_string($url) . "',\n\t\t\t\t\tsummary = '" . $conn->real_escape_string($summary) . "'\n\t\t\t\t\tWHERE id = " . (int) $tag_id;
    $result = $conn->query($query);
    if (!$result) {
        return $conn->error;
    } else {
        clear_cache();
        return true;
    }
}
Beispiel #2
0
<?php

// page title - if undefined the site title is displayed by default
$page_title = 'Files';
// create a folder
if (isset($_POST['create_folder'])) {
    if (!empty($_POST['new_folder'])) {
        $new_folder = create_url_title($_POST['new_folder']);
    }
    $new_folder = WW_ROOT . '/ww_files/' . $new_folder;
    mkdir($new_folder, 0755);
}
// upload file to custom folder
if (isset($_POST['upload_file'])) {
    $file = $_FILES['new_file'];
    $location = WW_ROOT . '/ww_files/' . $_POST['folder'];
    $uploaded = upload_file($file, $location);
    if (is_array($uploaded)) {
        header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=files&folder=' . $folder);
    } else {
        $error = $uploaded;
    }
}
// delete file
if (isset($_POST['confirm_delete_file']) && $_POST['confirm_delete_file'] == 'Yes') {
    $location = WW_ROOT . '/ww_files/' . $_POST['folder'] . '/' . $_POST['filename'];
    if (file_exists($location)) {
        unlink($location);
        header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=files&folder=' . $_POST['folder']);
    }
}