}
         }
     }
     $result = dbquery("DELETE FROM " . DB_POSTS . " WHERE thread_id IN (" . $thread_ids . ") AND forum_id='" . $_GET['forum_id'] . "'");
     $deleted_posts = mysql_affected_rows();
     $result = dbquery("DELETE FROM " . DB_THREADS . " WHERE thread_id IN (" . $thread_ids . ") AND forum_id='" . $_GET['forum_id'] . "'");
     $deleted_threads = mysql_affected_rows();
     $result = dbquery("DELETE FROM " . DB_THREAD_NOTIFY . " WHERE thread_id IN (" . $thread_ids . ")");
     $result = dbquery("DELETE FROM " . DB_FORUM_ATTACHMENTS . " WHERE thread_id IN (" . $thread_ids . ")");
     $result = dbquery("DELETE FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id IN (" . $thread_ids . ")");
     $result = dbquery("DELETE FROM " . DB_FORUM_POLL_VOTERS . " WHERE thread_id IN (" . $thread_ids . ")");
     $result = dbquery("DELETE FROM " . DB_FORUM_POLLS . " WHERE thread_id IN (" . $thread_ids . ")");
     if ($settings['enable_tags']) {
         // Pimped: tag
         require_once INCLUDES . "tag_include.php";
         delete_tags($thread_ids, "F");
     }
     $result = dbquery("SELECT post_datestamp, post_author FROM " . DB_POSTS . "\r\n\t\tWHERE forum_id='" . $_GET['forum_id'] . "' ORDER BY post_datestamp DESC LIMIT 1");
     if (dbrows($result)) {
         $ldata = dbarray($result);
         $forum_lastpost = "forum_lastpost='" . $ldata['post_datestamp'] . "', forum_lastuser='******'post_author'] . "'";
     } else {
         $forum_lastpost = "forum_lastpost='0', forum_lastuser='******'";
     }
     $result = dbquery("UPDATE " . DB_FORUMS . " SET " . $forum_lastpost . ", forum_postcount=forum_postcount-" . $deleted_posts . ", forum_threadcount=forum_threadcount-" . $deleted_threads . " WHERE forum_id='" . $_GET['forum_id'] . "'");
 }
 $rows_left = dbcount("(thread_id)", DB_THREADS, "forum_id='" . $_GET['forum_id'] . "'") - 3;
 if ($rows_left <= $rowstart && $rowstart > 0) {
     $rowstart = (ceil($rows_left / $settings['threads_per_page']) - 1) * $settings['threads_per_page'];
 }
 redirect($rowstart == 0 ? make_url(FORUM . FUSION_SELF . "?forum_id=" . $_GET['forum_id'], BASEDIR . "forum-" . $_GET['forum_id'] . "-", $fdata['forum_name'], ".html") : make_url(FORUM . FUSION_SELF . "?forum_id=" . $_GET['forum_id'] . "&amp;page=" . $_GET['page'], BASEDIR . "forum-" . $_GET['forum_id'] . "-page-" . $_GET['page'] . "-", $fdata['forum_name'], ".html"));
Example #2
0
function save_person_salsa($s)
{
    global $db;
    global $DIA;
    #parse types
    if ($s['type']) {
        foreach ($s['type'] as $item) {
            $s[$item] = 1;
        }
    }
    $tags = array();
    #parse tag types
    if ($s['activist_skills']) {
        foreach ($s['activist_skills'] as $i) {
            $tags[] = $i;
        }
    }
    if ($s['activist_interests']) {
        foreach ($s['activist_interests'] as $i) {
            $tags[] = $i;
        }
    }
    if ($s['issues']) {
        foreach ($s['issues'] as $i) {
            $tags[] = $i;
        }
    }
    $s['tag'] = $tags;
    #parse group types
    if ($s['email_lists']) {
        $s['group_KEYS'] = $s['email_lists'];
    }
    #parse trigger types
    if ($s['email_triggers']) {
        $email_triggers = person_parse_triggers($s['email_triggers']);
        $s = array_merge($s, $email_triggers);
    }
    if ($s['supporter_KEY']) {
        $s['key'] = $s['supporter_KEY'];
        #if update remove the tags from the supporter
        delete_tags($s['supporter_KEY'], 'Skill');
        delete_tags($s['supporter_KEY'], 'Volunteer');
        delete_tags($s['supporter_KEY'], 'Issue');
        unset($s['supporter_KEY']);
    }
    # make sure that corps dont get on the email list
    if ($s['corporate'] == 1 or $s['celeberit'] == 1) {
        $s['Receive_Email'] = '-99';
    }
    if ($s['Email']) {
        $supporter = check_supporter($s['Email']);
        if ($supporter['supporter_KEY']) {
            if ($supporter['Receive_Email']) {
                unset($s['Receive_Email']);
            }
        }
    }
    #print_r($s); die();
    $supporter_KEY = $DIA->save('supporter', $s);
    return $supporter_KEY;
}
Example #3
0
     if (dbrows($result)) {
         $data = dbarray($result);
         if (!empty($data['news_image']) && file_exists(IMAGES_N . $data['news_image'])) {
             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']);
         }
         $result = dbquery("DELETE FROM " . DB_NEWS . " WHERE news_id='" . $_POST['news_id'] . "'");
         $result = dbquery("DELETE FROM " . DB_COMMENTS . "  WHERE comment_item_id='" . $_POST['news_id'] . "' and comment_type='N'");
         $result = dbquery("DELETE FROM " . DB_RATINGS . " WHERE rating_item_id='" . $_POST['news_id'] . "' and rating_type='N'");
         if ($settings['enable_tags']) {
             delete_tags($_POST['news_id'], "N");
         }
         log_admin_action("admin-1", "admin_news_deleted", "", "", $data['news_subject'] . " (ID: " . $_POST['news_id'] . ")");
         redirect(FUSION_SELF . $aidlink . "&status=del");
     } else {
         redirect(FUSION_SELF . $aidlink);
     }
 } else {
     if (isset($_POST['preview'])) {
         $news_subject = stripinput($_POST['news_subject']);
         $news_cat = isnum($_POST['news_cat']) ? $_POST['news_cat'] : "0";
         $body = phpentities(stripslash($_POST['body']));
         $bodypreview = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, stripslash($_POST['body']));
         if ($_POST['body2']) {
             $body2 = phpentities(stripslash($_POST['body2']));
             $body2preview = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, stripslash($_POST['body2']));
Example #4
0
/**
 * Deletes all tags linked to no photo
 */
function delete_orphan_tags()
{
    $orphan_tags = get_orphan_tags();
    if (count($orphan_tags) > 0) {
        $orphan_tag_ids = array();
        foreach ($orphan_tags as $tag) {
            $orphan_tag_ids[] = $tag['id'];
        }
        delete_tags($orphan_tag_ids);
    }
}
        } else {
            redirect(FUSION_SELF . $aidlink . "&status=sn&pid=" . $page_id, true);
        }
    } else {
        redirect(FUSION_SELF . $aidlink . "&status=pw");
    }
} else {
    if (isset($_POST['delete']) && (isset($_POST['page_id']) && isnum($_POST['page_id']))) {
        $result = dbquery("SELECT page_title FROM " . DB_CUSTOM_PAGES . " WHERE page_id='" . $_POST['page_id'] . "'");
        if (dbrows($result)) {
            $data = dbarray($result);
        }
        $result = dbquery("DELETE FROM " . DB_CUSTOM_PAGES . " WHERE page_id='" . $_POST['page_id'] . "'");
        $result = dbquery("DELETE FROM " . DB_SITE_LINKS . " WHERE link_url='viewpage.php?page_id=" . $_POST['page_id'] . "'");
        if ($settings['enable_tags']) {
            delete_tags($_POST['page_id'], "C");
        }
        // Pimped: tag
        log_admin_action("admin-1", "admin_custompage_deleted", "", "", $data['page_title'] . " (ID: " . $_POST['page_id'] . ")");
        redirect(FUSION_SELF . $aidlink . "&status=del");
    } else {
        if (isset($_POST['preview'])) {
            $addlink = isset($_POST['add_link']) ? " checked='checked'" : "";
            $page_title = stripinput($_POST['page_title']);
            $page_access = $_POST['page_access'];
            $page_content = stripslash($_POST['page_content']);
            $page_keywords = $_POST['page_keywords'];
            // meta
            $comments = isset($_POST['page_comments']) ? " checked='checked'" : "";
            $ratings = isset($_POST['page_ratings']) ? " checked='checked'" : "";
            if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
Example #6
0
            }
            $page['infos'][] = l10n('Tags <em>%s</em> merged into tag <em>%s</em>', implode(', ', $tags_deleted), $name_of_tag[$destination_tag_id]);
        }
    }
}
// +-----------------------------------------------------------------------+
// |                               delete tags                             |
// +-----------------------------------------------------------------------+
if (isset($_POST['delete']) and isset($_POST['tags'])) {
    $query = '
SELECT name
  FROM ' . TAGS_TABLE . '
  WHERE id IN (' . implode(',', $_POST['tags']) . ')
;';
    $tag_names = array_from_query($query, 'name');
    delete_tags($_POST['tags']);
    $page['infos'][] = l10n_dec('The following tag was deleted', 'The %d following tags were deleted', count($tag_names)) . ' : ' . implode(', ', $tag_names);
}
// +-----------------------------------------------------------------------+
// |                           delete orphan tags                          |
// +-----------------------------------------------------------------------+
if (isset($_GET['action']) and 'delete_orphans' == $_GET['action']) {
    check_pwg_token();
    delete_orphan_tags();
    $_SESSION['page_infos'] = array(l10n('Orphan tags deleted'));
    redirect(get_root_url() . 'admin.php?page=tags');
}
// +-----------------------------------------------------------------------+
// |                               add a tag                               |
// +-----------------------------------------------------------------------+
if (isset($_POST['add']) and !empty($_POST['add_tag'])) {
 $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_postcount=forum_postcount-1 WHERE forum_id = '" . $_GET['forum_id'] . "'");
 $result = dbquery("SELECT attach_name FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . $_GET['post_id'] . "'");
 if (dbrows($result)) {
     // Pimped: Multi-Upload
     while ($attach = dbarray($result)) {
         unlink(FORUM_ATT . $attach['attach_name']);
     }
     $result2 = dbquery("DELETE FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . $_GET['post_id'] . "'");
 }
 $posts = dbcount("(post_id)", DB_POSTS, "thread_id='" . $_GET['thread_id'] . "'");
 if (!$posts) {
     $result = dbquery("DELETE FROM " . DB_THREADS . " WHERE thread_id='" . $_GET['thread_id'] . "' AND forum_id='" . $_GET['forum_id'] . "'");
     $result = dbquery("DELETE FROM " . DB_THREAD_NOTIFY . " WHERE thread_id='" . $_GET['thread_id'] . "'");
     $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_threadcount=forum_threadcount-1 WHERE forum_id = '" . $_GET['forum_id'] . "'");
     if ($settings['enable_tags']) {
         delete_tags((int) $_GET['thread_id'], "F");
     }
     // Pimped: tag
 }
 $result = dbquery("SELECT * FROM " . DB_FORUMS . " WHERE forum_id='" . $_GET['forum_id'] . "' AND forum_lastuser='******'post_author'] . "' AND forum_lastpost='" . $pdata['post_datestamp'] . "'");
 if (dbrows($result)) {
     $result = dbquery("SELECT forum_id,post_author,post_datestamp FROM " . DB_POSTS . " WHERE forum_id='" . $_GET['forum_id'] . "' ORDER BY post_datestamp DESC LIMIT 1");
     if (dbrows($result)) {
         $pdata2 = dbarray($result);
         $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . $pdata2['post_datestamp'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $_GET['forum_id'] . "'");
     } else {
         $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='0', forum_lastuser='******' WHERE forum_id='" . $_GET['forum_id'] . "'");
     }
 }
 if ($posts) {
     $result = dbcount("(thread_id)", DB_THREADS, "thread_id='" . $_GET['thread_id'] . "' AND thread_lastpost='" . $pdata['post_datestamp'] . "' AND thread_lastuser='******'post_author'] . "'");
             $result = dbquery("UPDATE " . DB_FORUM_ATTACHMENTS . " SET thread_id='" . $_POST['new_thread_id'] . "' WHERE post_id IN(" . $move_posts_add . ")");
             $new_thread = dbarray(dbquery("\r\n\t\t\t\t\t\t\tSELECT forum_id, thread_id, post_id, post_author, post_datestamp \r\n\t\t\t\t\t\t\tFROM " . DB_POSTS . " \r\n\t\t\t\t\t\t\tWHERE thread_id='" . $_POST['new_thread_id'] . "' \r\n\t\t\t\t\t\t\tORDER BY post_datestamp DESC \r\n\t\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t\t"));
             $result = dbquery("UPDATE " . DB_THREADS . " SET thread_lastpost='" . $new_thread['post_datestamp'] . "', thread_lastpostid='" . $new_thread['post_id'] . "', thread_postcount=thread_postcount+" . $num_posts . ", thread_lastuser='******'post_author'] . "' WHERE thread_id='" . $_POST['new_thread_id'] . "'");
             $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . $new_thread['post_datestamp'] . "', forum_postcount=forum_postcount+" . $num_posts . ", forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $_POST['new_forum_id'] . "'");
             $old_thread = dbarray(dbquery("\r\n\t\t\t\t\t\t\tSELECT forum_id, thread_id, post_id, post_author, post_datestamp \r\n\t\t\t\t\t\t\tFROM " . DB_POSTS . " \r\n\t\t\t\t\t\t\tWHERE thread_id='" . $pdata['thread_id'] . "' \r\n\t\t\t\t\t\t\tORDER BY post_datestamp DESC \r\n\t\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t\t"));
             if (!dbcount("(post_id)", DB_POSTS, "thread_id='" . $pdata['thread_id'] . "'")) {
                 $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . $old_thread['post_datestamp'] . "', forum_postcount=forum_postcount-" . $num_posts . ", forum_threadcount=forum_threadcount-1, forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $pdata['forum_id'] . "'");
                 $result = dbquery("DELETE FROM " . DB_THREADS . " WHERE thread_id='" . $pdata['thread_id'] . "'");
                 $result = dbquery("DELETE FROM " . DB_THREAD_NOTIFY . " WHERE thread_id='" . $pdata['thread_id'] . "'");
                 $result = dbquery("DELETE FROM " . DB_FORUM_POLL_VOTERS . " WHERE thread_id='" . $pdata['thread_id'] . "'");
                 $result = dbquery("DELETE FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $pdata['thread_id'] . "'");
                 $result = dbquery("DELETE FROM " . DB_FORUM_POLLS . " WHERE thread_id='" . $pdata['thread_id'] . "'");
                 if ($settings['enable_tags']) {
                     // Pimped: tag
                     require_once INCLUDES . "tag_include.php";
                     delete_tags((int) $pdata['thread_id'], "F");
                 }
             } else {
                 $result = dbquery("UPDATE " . DB_THREADS . " SET thread_lastpost='" . $old_thread['post_datestamp'] . "', thread_lastpostid='" . $old_thread['post_id'] . "', thread_postcount=thread_postcount-" . $num_posts . ", thread_lastuser='******'post_author'] . "' WHERE thread_id='" . $pdata['thread_id'] . "'");
                 $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . $old_thread['post_datestamp'] . "', forum_postcount=forum_postcount-" . $num_posts . ", forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $pdata['forum_id'] . "'");
             }
             $pid = count($array_post) - 1;
             redirect(FORUM . "viewthread.php?thread_id=" . $_POST['new_thread_id'] . "&amp;pid=" . $array_post[$pid] . "#post_" . $array_post[$pid]);
         } else {
             redirect(FORUM . "viewthread.php?thread_id=" . $fdata['thread_id'] . "&amp;rowstart=" . $_GET['rowstart'] . "&amp;error=2");
         }
     } else {
         redirect(FORUM . "viewthread.php?thread_id=" . $fdata['thread_id'] . "&amp;rowstart=" . $_GET['rowstart'] . "&amp;error=3");
     }
 } else {
     redirect(FORUM . "index.php");
             // 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");
     }
 } elseif (isset($_POST['delete']) && (isset($_POST['article_id']) && isnum($_POST['article_id']))) {
     $result = dbquery("SELECT article_subject FROM " . DB_ARTICLES . " WHERE article_id=" . $_POST['article_id']);
     if (dbrows($result)) {
         $data = dbarray($result);
         $result = dbquery("DELETE FROM " . DB_ARTICLES . " WHERE article_id='" . $_POST['article_id'] . "'");
         $result = dbquery("DELETE FROM " . DB_COMMENTS . " WHERE comment_item_id='" . $_POST['article_id'] . "' and comment_type='A'");
         $result = dbquery("DELETE FROM " . DB_RATINGS . " WHERE rating_item_id='" . $_POST['article_id'] . "' and rating_type='A'");
         if ($settings['enable_tags']) {
             delete_tags($_POST['article_id'], "A");
         }
         // Pimped: tag
         log_admin_action("admin-1", "admin_article_deleted", "", "", $data['article_subject']);
         redirect(FUSION_SELF . $aidlink . "&status=del");
     } else {
         redirect(FUSION_SELF . $aidlink . "&status=deln");
     }
 } else {
     if (isset($_POST['preview'])) {
         $article_cat = $_POST['article_cat'];
         $subject = stripinput($_POST['subject']);
         $body = phpentities(stripslash($_POST['body']));
         $body2 = phpentities(stripslash($_POST['body2']));
         $bodypreview = str_replace("src='" . str_replace("../", "", IMAGES_A), "src='" . IMAGES_A, stripslash($_POST['body']));
         $body2preview = str_replace("src='" . str_replace("../", "", IMAGES_A), "src='" . IMAGES_A, stripslash($_POST['body2']));