Esempio n. 1
0
function update_data($post)
{
    $id = $post["id"];
    $title = $post["image_title"];
    $date = $post["image_date"];
    $category = $post["image_category"];
    $gear = $post["image_gear"];
    $description = $post["image_description"];
    $host = "localhost";
    $user = "******";
    $pass = "";
    $db = "gallery";
    $table = "gallery_photos";
    $query = 'UPDATE ' . $table . ' 
   			      	   SET 
  				  	   TITLE="' . $title . '",
  				  	   DATE="' . $date . '",
  				  	   CATEGORY="' . $category . '",
  				  	   DESCRIPTION="' . $description . '",
  				  	   GEAR="' . $gear . '"
  				  	   WHERE ID="' . $id . '"';
    $mysqli = new mysqli($host, $user, $pass, $db);
    if ($mysqli->connect_errno) {
        printf("Connect failed: %s\n", $mysqli->connect_error);
        exit;
    }
    if ($mysqli->query($query)) {
        foreach ($post["keys"] as &$val) {
            update_tags($id, $val);
        }
        return true;
    }
}
Esempio n. 2
0
<?php

// Update the tags for a thread
include 'init.php';
$thread_id = (int) $_POST['thread_id'];
$thread = get_thread($thread_id);
if (!$thread) {
    die('Thread not found.');
}
$tags = $_POST['tags'];
update_tags($thread_id, $tags);
header('Location: thread.php?updated=tags&t=' . $thread_id);
Esempio n. 3
0
                 unlink(IMAGES_N . $data['news_image']);
             }
             if (!empty($data['news_image_t1']) && file_exists(IMAGES_N_T . $data['news_image_t1'])) {
                 unlink(IMAGES_N_T . $data['news_image_t1']);
             }
             if (!empty($data['news_image_t2']) && file_exists(IMAGES_N_T . $data['news_image_t2'])) {
                 unlink(IMAGES_N_T . $data['news_image_t2']);
             }
             $news_image = "";
             $news_image_t1 = "";
             $news_image_t2 = "";
         }
         $result = dbquery("UPDATE " . DB_NEWS . " SET news_subject='{$news_subject}', news_cat='{$news_cat}', news_end='{$news_end_date}', news_image='{$news_image}', news_news='{$body}', news_extended='{$body2}', news_breaks='{$news_breaks}'," . ($news_start_date != 0 ? " news_datestamp='{$news_start_date}'," : "") . " news_start='{$news_start_date}', news_image_t1='{$news_image_t1}', news_image_t2='{$news_image_t2}', news_visibility='{$news_visibility}', news_draft='{$news_draft}', news_sticky='{$news_sticky}', news_keywords='{$news_keywords}', news_allow_comments='{$news_comments}', news_allow_ratings='{$news_ratings}' WHERE news_id='" . $_POST['news_id'] . "'");
         // Pimped: key
         if ($settings['enable_tags']) {
             update_tags($_POST['news_id'], "N", $tag_name);
         }
         log_admin_action("admin-1", "admin_news_edited", "", "", $news_subject . " (ID: " . $_POST['news_id'] . ")");
         redirect(FUSION_SELF . $aidlink . "&status=su" . ($error ? "&error={$error}" : ""));
     } else {
         redirect(FUSION_SELF . $aidlink);
     }
 } else {
     if ($news_sticky == "1") {
         $result = dbquery("UPDATE " . DB_NEWS . " SET news_sticky='0' WHERE news_sticky='1'");
     }
     $result = dbquery("INSERT INTO " . DB_NEWS . " (news_subject, news_cat, news_news, news_extended, news_breaks, news_name, news_datestamp, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_reads, news_keywords, news_allow_comments, news_allow_ratings) VALUES ('{$news_subject}', '{$news_cat}', '{$body}', '{$body2}', '{$news_breaks}', '" . $userdata['user_id'] . "', '" . ($news_start_date != 0 ? $news_start_date : time()) . "', '{$news_start_date}', '{$news_end_date}', '{$news_image}', '{$news_image_t1}', '{$news_image_t2}', '{$news_visibility}', '{$news_draft}', '{$news_sticky}', '0', '{$news_keywords}', '{$news_comments}', '{$news_ratings}')");
     $id = mysql_insert_id();
     if ($settings['enable_tags']) {
         insert_tags($id, "N", $tag_name);
     }
}
if (isset($_POST['save'])) {
    $page_title = stripinput($_POST['page_title']);
    $page_access = isnum($_POST['page_access']) ? $_POST['page_access'] : "0";
    $page_content = addslash($_POST['page_content']);
    $tag_name = isset($_POST['tag_name']) ? stripinput($_POST['tag_name']) : "";
    // Pimped: tag
    $page_keywords = stripinput($_POST['page_keywords']);
    // meta
    $comments = isset($_POST['page_comments']) ? "1" : "0";
    $ratings = isset($_POST['page_ratings']) ? "1" : "0";
    if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
        if (isset($_POST['page_id']) && isnum($_POST['page_id'])) {
            $result = dbquery("UPDATE " . DB_CUSTOM_PAGES . " SET page_title='{$page_title}', page_access='{$page_access}', page_content='{$page_content}', page_keywords='{$page_keywords}', page_allow_comments='{$comments}', page_allow_ratings='{$ratings}' WHERE page_id='" . $_POST['page_id'] . "'");
            if ($settings['enable_tags']) {
                update_tags($_POST['page_id'], "C", $tag_name);
            }
            // Pimped: tag
            log_admin_action("admin-1", "admin_custompage_edited", "", "", $page_title . " (ID: " . $_POST['page_id'] . ")");
        } else {
            $result = dbquery("INSERT INTO " . DB_CUSTOM_PAGES . " (page_title, page_access, page_content, page_keywords, page_allow_comments, page_allow_ratings) VALUES ('{$page_title}', '{$page_access}', '{$page_content}', '{$page_keywords}', '{$comments}', '{$ratings}')");
            $page_id = mysql_insert_id();
            log_admin_action("admin-1", "admin_custompage_added", "", "", $page_title . " (ID: " . $page_id . ")");
            if (isset($_POST['add_link'])) {
                $data = dbarray(dbquery("SELECT link_order FROM " . DB_SITE_LINKS . " ORDER BY link_order DESC LIMIT 1"));
                $link_order = $data['link_order'] + 1;
                $result = dbquery("INSERT INTO " . DB_SITE_LINKS . " (link_name, link_url, link_seo_url,link_visibility, link_position, link_window, link_order) VALUES ('{$page_title}', 'viewpage.php?page_id={$page_id}', 'page-" . $page_id . "-" . clean_subject_urlrewrite($page_title) . ".html', '{$page_access}', '1', '0', '{$link_order}')");
                // Pimped SEO Url added
                if ($settings['enable_tags']) {
                    $id = mysql_insert_id();
                    // Pimped: tag
Esempio n. 5
0
if (isset($_POST['tag'])) {
    $tag = $_POST['tag'];
}
if (isset($_POST['tagType'])) {
    $tagType = $_POST['tagType'];
}
//+++++++++++++++++++++++++++++++++++++++++++++++++
//Insert tags for a given user
//+++++++++++++++++++++++++++++++++++++++++++++++++
function update_tags($tag, $userID, $tagType)
{
    $servername = "127.0.0.1";
    $username = "******";
    $password = "******";
    $dbname = "who_what";
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $sql = "INSERT into tbl_tags (tag,tagType,userID) VALUES ('" . $tag . "','" . $tagType . "','" . $userID . "')";
    $result = $conn->query($sql);
    $conn->close();
}
//Check for mandatory tag fields and insert.
//Once inserted, echo the new tag set
if (isset($_POST['tag']) && isset($_POST['userID'])) {
    update_tags($tag, $userID, $tagType);
    echo get_tags($userID);
}
     $sql = "";
 } else {
     $sql = ", post_edituser='******'user_id'] . "', post_edittime='" . time() . "'";
 }
 $result = dbquery("UPDATE " . DB_POSTS . " SET post_message='" . $message . "', post_smileys='{$smileys}'" . $sql . " WHERE post_id='" . $_GET['post_id'] . "'");
 if ($pdata['first_post'] == $_GET['post_id']) {
     // Pimped
     if ($subject != "") {
         $result = dbquery("UPDATE " . DB_THREADS . " SET thread_subject='{$subject}' WHERE thread_id='" . (int) $_GET['thread_id'] . "'");
     }
     if ($settings['forum_thread_description'] && isset($_POST['description'])) {
         $result = dbquery("UPDATE " . DB_THREADS . " SET thread_description='{$description}' WHERE thread_id='" . (int) $_GET['thread_id'] . "'");
     }
 }
 if ($settings['enable_tags'] && (iMOD || iMEMBER && $tdata['thread_author'] == $userdata['user_id'])) {
     update_tags((int) $_GET['thread_id'], "F", $tag_name);
     // Pimped: tag
 }
 if (isset($_POST['delete_attach']) && is_array($_POST['delete_attach'])) {
     $aresult = dbquery("SELECT attach_id, attach_name FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . $_GET['post_id'] . "'");
     if (dbrows($aresult)) {
         while ($adata = dbarray($aresult)) {
             // Pimped: Multi-Upload
             if (in_array($adata['attach_id'], $_POST['delete_attach'])) {
                 unlink(FORUM_ATT . $adata['attach_name']);
                 $result = dbquery("DELETE FROM " . DB_FORUM_ATTACHMENTS . " WHERE attach_id='" . $adata['attach_id'] . "'");
                 $result = dbquery("UPDATE " . DB_POSTS . " SET post_attachments=post_attachments-1 WHERE post_id='" . $_GET['post_id'] . "'");
             }
         }
     }
 }
 $tag_name = isset($_POST['tag_name']) ? stripinput($_POST['tag_name']) : "";
 // Pimped: tag
 $article_keywords = stripinput($_POST['article_keywords']);
 // meta
 $draft = isset($_POST['article_draft']) ? "1" : "0";
 if (!isset($_COOKIE['articles_wysiwyg_editor']) || !$_COOKIE['articles_wysiwyg_editor'] || !$settings['wysiwyg_enabled']) {
     $breaks = isset($_POST['line_breaks']) ? "y" : "n";
 } else {
     $breaks = "n";
 }
 $comments = isset($_POST['article_comments']) ? "1" : "0";
 $ratings = isset($_POST['article_ratings']) ? "1" : "0";
 if (isset($_POST['article_id']) && isnum($_POST['article_id'])) {
     $result = dbquery("UPDATE " . DB_ARTICLES . " SET article_cat='" . intval($_POST['article_cat']) . "', article_subject='{$subject}', article_snippet='{$body}', article_article='{$body2}', article_draft='{$draft}', article_breaks='{$breaks}', article_keywords='{$article_keywords}', article_allow_comments='{$comments}', article_allow_ratings='{$ratings}' WHERE article_id='" . $_POST['article_id'] . "'");
     if ($settings['enable_tags']) {
         update_tags($_POST['article_id'], "A", $tag_name);
     }
     // Pimped: tag
     log_admin_action("admin-1", "admin_article_edited", "", "", $subject);
     redirect(FUSION_SELF . $aidlink . "&status=su");
 } else {
     $result = dbquery("INSERT INTO " . DB_ARTICLES . " (article_cat, article_subject, article_snippet, article_article, article_draft, article_breaks, article_name, article_datestamp, article_reads, article_keywords, article_allow_comments, article_allow_ratings) VALUES ('" . intval($_POST['article_cat']) . "', '{$subject}', '{$body}', '{$body2}', '{$draft}', '{$breaks}', '" . $userdata['user_id'] . "', '" . time() . "', '0', '{$article_keywords}', '{$comments}', '{$ratings}')");
     if ($settings['enable_tags']) {
         $id = mysql_insert_id();
         // Pimped: tag
         insert_tags($id, "A", $tag_name);
         // Pimped: tag
     }
     log_admin_action("admin-1", "admin_article_added", "", "", $subject);
     redirect(FUSION_SELF . $aidlink . "&status=sn");
 }