Пример #1
0
     $db->query("INSERT INTO `" . table_config . "` VALUES (NULL, 'Misc', 'Independent_Subcategories', 'false', 'false', 'true / false', 'Show subcategories', 'Top level categories remain independent from subcategory content', 'define', NULL)");
 }
 $result = $db->get_results("select * from `" . table_config . "` where `var_name` = 'Multiple_Categories';");
 if (count($result) == 0) {
     $db->query("INSERT INTO `" . table_config . "` VALUES (NULL, 'Submit', 'Multiple_Categories', 'false', 'false', 'true / false', 'Allow multiple categories', 'User may choose more than one category for each story', 'define', NULL)");
 }
 // out.php alter table
 $fieldexists = checkforfield('link_out', table_links);
 if (!$fieldexists) {
     $sql = "ALTER TABLE `" . table_links . "` ADD `link_out` INT( 11 ) NOT NULL ;";
     $db->query($sql);
 }
 $result = $db->get_results("select * from `" . table_links . "` where (ISNULL(link_title_url) OR link_title_url='') AND link_status='page'");
 if ($results) {
     foreach ($results as $result) {
         $page_url = makeUrlFriendly($db->escape(trim($result->link_title)), true);
         $db->query("UPDATE " . table_links . " SET link_title_url='{$page_url}', link_modified=link_modified WHERE id={$result->link_id}");
     }
 }
 $fieldexists = checkforfield('vote_karma', table_votes);
 if (!$fieldexists) {
     $sql = "ALTER TABLE `" . table_votes . "` ADD  `vote_karma` INT NOT NULL;";
     $db->query($sql);
 }
 // Groups module alter table
 $fieldexists = checkforfield('link_group_id', table_links);
 if (!$fieldexists) {
     $sql = "ALTER TABLE `" . table_links . "` ADD `link_group_id` INT( 20 ) NOT NULL ;";
     $db->query($sql);
 }
 $fieldexists = checkforfield('link_group_status', table_links);
Пример #2
0
                $main_smarty->assign('page_content', $page_results->link_content);
            }
            $main_smarty->assign('link_id', $link_id);
        }
    }
}
// read the mysql database to get the pligg version
$sql = "SELECT data FROM " . table_misc_data . " WHERE name = 'pligg_version'";
$pligg_version = $db->get_var($sql);
$main_smarty->assign('version_number', $pligg_version);
if ($_REQUEST['process'] == 'edit_page') {
    global $current_user, $db;
    if (!$_REQUEST['page_url']) {
        $_REQUEST['page_url'] = $_REQUEST['page_title'];
    }
    $page_url = $db->escape(makeUrlFriendly(trim($_REQUEST['page_url']), true));
    $page_title = $db->escape(trim($_REQUEST['page_title']));
    $page_content = $db->escape(trim($_REQUEST['page_content']));
    $page_randkey = $db->escape(trim($_REQUEST['randkey']));
    $page_keywords = $db->escape(trim($_REQUEST['page_keywords']));
    $page_description = $db->escape(trim($_REQUEST['page_description']));
    if (isset($_REQUEST['link_id'])) {
        if (is_numeric($_REQUEST['link_id'])) {
            $link_id = $_REQUEST['link_id'];
            // Save old SEO URL if changed
            $old_url = $db->get_var("SELECT link_title_url FROM " . table_links . " WHERE link_id={$link_id}");
            if ($old_url && $old_url != $page_url) {
                $db->query("INSERT INTO " . table_old_urls . " SET old_link_id={$link_id}, old_title_url='{$old_url}'");
            }
            $sql = " UPDATE " . table_links . " SET `link_modified` = NOW( ) , `link_title` = '{$page_title}', `link_title_url` = '{$page_url}', `link_content` = '{$page_content}', link_field1='{$page_keywords}', link_field2='{$page_description}' WHERE `link_id` =" . $link_id . " LIMIT 1 ";
            $result = @mysql_query($sql);
Пример #3
0
} elseif (isset($_POST["action"])) {
    $CSRF->check_expired('edit_group');
    if ($CSRF->check_valid(sanitize($_POST['token'], 3), 'edit_group')) {
        if (isset($_POST['group_title'])) {
            $group_title = mysql_real_escape_string(stripslashes(strip_tags(trim($_POST['group_title']))));
        }
        if (isset($_POST['group_description'])) {
            $group_description = mysql_real_escape_string(stripslashes(strip_tags(trim($_POST['group_description']))));
        }
        if ($_POST['group_notify_email'] > 0) {
            $group_notify_email = 1;
        } else {
            $group_notify_email = 0;
        }
        $group_name = $group_title;
        $group_safename = makeUrlFriendly($group_title, true);
        if (isset($_POST['group_privacy'])) {
            $group_privacy = $db->escape(sanitize($_POST['group_privacy'], 3));
        }
        if (!$group_title) {
            $errors = $main_smarty->get_config_vars('PLIGG_Visual_Group_Empty_Title');
        } else {
            $exists = $db->get_var("select COUNT(*) from " . table_groups . " WHERE group_name='{$group_name}' AND group_id != '{$requestID}'");
            if ($exists) {
                $errors = $main_smarty->get_config_vars('PLIGG_Visual_Group_Title_Exists');
            }
        }
        if (!$errors && $db->query("update " . table_groups . " set group_name = '" . $group_title . "', group_safename='{$group_safename}', group_description = '" . $group_description . "', group_privacy = '" . $group_privacy . "', group_vote_to_publish = '" . $group_vote_to_publish . "', group_notify_email={$group_notify_email} where group_id = '" . $requestID . "'")) {
            $errors = $main_smarty->get_config_vars('PLIGG_Visual_Group_Saved_Changes');
        }
        $main_smarty->assign("errors", $errors);
Пример #4
0
function do_submit2()
{
    global $db, $main_smarty, $dblang, $the_template, $linkres, $current_user, $Story_Content_Tags_To_Allow;
    $main_smarty->assign('auto_vote', auto_vote);
    $main_smarty->assign('Submit_Show_URL_Input', Submit_Show_URL_Input);
    $main_smarty->assign('Submit_Require_A_URL', Submit_Require_A_URL);
    $main_smarty->assign('link_id', sanitize($_POST['id'], 3));
    define('pagename', 'submit');
    $main_smarty->assign('pagename', pagename);
    if ($current_user->authenticated != TRUE) {
        $vars = array('username' => $current_user->user_login);
        check_actions('register_check_errors', $vars);
    }
    check_actions('submit2_check_errors', $vars);
    if ($vars['error'] == true) {
        // No action
    }
    $linkres = new Link();
    $linkres->id = sanitize($_POST['id'], 3);
    if ($_SESSION['step'] != 1) {
        die('Wrong step');
    }
    if (!is_numeric($linkres->id)) {
        die;
    }
    if (!$linkres->verify_ownership($current_user->user_id)) {
        die($main_smarty->get_config_vars('PLIGG_Visual_Submit2Errors_NoAccess'));
    }
    $linkres->read(FALSE);
    if ($linkres->votes($current_user->user_id) == 0 && auto_vote == true) {
        $linkres->insert_vote($current_user->user_id, '10');
        $linkres->store_basic();
        $linkres->read(FALSE);
    }
    if (is_array($_POST['category'])) {
        $linkres->category = sanitize($_POST['category'][0], 3);
        $linkres->additional_cats = array_slice($_POST['category'], 1);
    } else {
        $linkres->category = sanitize($_POST['category'], 3);
    }
    $thecat = get_cached_category_data('category_id', $linkres->category);
    $main_smarty->assign('request_category_name', $thecat->category_name);
    $linkres->title = stripslashes(sanitize($_POST['title'], 3));
    $linkres->title_url = makeUrlFriendly($linkres->title, $linkres->id);
    $linkres->tags = tags_normalize_string(stripslashes(sanitize($_POST['tags'], 3)));
    $linkres->content = close_tags(stripslashes(sanitize($_POST['bodytext'], 4, $Story_Content_Tags_To_Allow)));
    //$linkres->content = str_replace("\n", "<br />", $linkres->content);
    if (isset($_POST['link_field1'])) {
        $linkres->link_field1 = sanitize($_POST['link_field1'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field2'])) {
        $linkres->link_field2 = sanitize($_POST['link_field2'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field3'])) {
        $linkres->link_field3 = sanitize($_POST['link_field3'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field4'])) {
        $linkres->link_field4 = sanitize($_POST['link_field4'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field5'])) {
        $linkres->link_field5 = sanitize($_POST['link_field5'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field6'])) {
        $linkres->link_field6 = sanitize($_POST['link_field6'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field7'])) {
        $linkres->link_field7 = sanitize($_POST['link_field7'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field8'])) {
        $linkres->link_field8 = sanitize($_POST['link_field8'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field9'])) {
        $linkres->link_field9 = sanitize($_POST['link_field9'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field10'])) {
        $linkres->link_field10 = sanitize($_POST['link_field10'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field11'])) {
        $linkres->link_field11 = sanitize($_POST['link_field11'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field12'])) {
        $linkres->link_field12 = sanitize($_POST['link_field12'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field13'])) {
        $linkres->link_field13 = sanitize($_POST['link_field13'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field14'])) {
        $linkres->link_field14 = sanitize($_POST['link_field14'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field15'])) {
        $linkres->link_field15 = sanitize($_POST['link_field15'], 4, $Story_Content_Tags_To_Allow);
    }
    if (!isset($_POST['summarytext'])) {
        $linkres->link_summary = utf8_substr(sanitize($_POST['bodytext'], 4, $Story_Content_Tags_To_Allow), 0, StorySummary_ContentTruncate - 1);
        //$linkres->link_summary = close_tags(str_replace("\n", "<br />", $linkres->link_summary));
    } else {
        $linkres->link_summary = sanitize($_POST['summarytext'], 4, $Story_Content_Tags_To_Allow);
        //$linkres->link_summary = close_tags(str_replace("\n", "<br />", $linkres->link_summary));
        if (utf8_strlen($linkres->link_summary) > StorySummary_ContentTruncate) {
            loghack('SubmitAStory-SummaryGreaterThanLimit', 'username: '******'|email: ' . sanitize($_POST["email"], 3), true);
            $linkres->link_summary = utf8_substr($linkres->link_summary, 0, StorySummary_ContentTruncate - 1);
            //$linkres->link_summary = close_tags(str_replace("\n", "<br />", $linkres->link_summary));
        }
    }
    //get link_group_id
    if (isset($_REQUEST['link_group_id']) && $_REQUEST['link_group_id'] != '') {
        $linkres->link_group_id = intval($_REQUEST['link_group_id']);
    } else {
        $linkres->link_group_id = 0;
    }
    $linkres->store();
    if (link_errors($linkres)) {
        return;
    }
    //comment subscription
    if (isset($_POST['comment_subscription'])) {
        $vars = array('link_id' => $linkres->id);
        check_actions('comment_subscription_insert_function', $vars);
    }
    //comment subscription
    if (isset($_POST['timestamp_date_day'])) {
        //open date
        $timestamp_date_day = $_POST['timestamp_date_day'];
        $timestamp_date_month = $_POST['timestamp_date_month'];
        $timestamp_date_year = $_POST['timestamp_date_year'];
        if (!is_numeric($timestamp_date_day) || !is_numeric($timestamp_date_month) || !is_numeric($timestamp_date_year)) {
            $timestamp_date = date("m-d-Y");
        } else {
            $timestamp_date = $timestamp_date_month . "-" . $timestamp_date_day . "-" . $timestamp_date_year;
        }
        $vars = array('link_id' => $linkres->id);
        $vars = array('timestamp_date' => $timestamp_date, 'link_id' => $linkres->id);
        check_actions('comment_subscription_insert_function', $vars);
    }
    $vars = '';
    check_actions('submit_step_3_after_first_store', $vars);
    if ($vars['error'] == true && link_catcha_errors('captcha_error')) {
        return;
    }
    $linkres->read(FALSE);
    $edit = true;
    $link_title = $linkres->title;
    $link_content = $linkres->content;
    $link_title = stripslashes(sanitize($_POST['title'], 3));
    $main_smarty->assign('the_story', $linkres->print_summary('full', true));
    $main_smarty->assign('tags', $linkres->tags);
    if (!empty($linkres->tags)) {
        $tags_words = str_replace(",", ", ", $linkres->tags);
        $tags_url = urlencode($linkres->tags);
        $main_smarty->assign('tags_words', $tags_words);
        $main_smarty->assign('tags_url', $tags_url);
    }
    if (isset($url)) {
        $main_smarty->assign('submit_url', $url);
    } else {
        $main_smarty->assign('submit_url', '');
    }
    $data = parse_url($linkres->url);
    $main_smarty->assign('url_short', $data['host']);
    $main_smarty->assign('submit_url_title', $linkres->url_title);
    $main_smarty->assign('submit_id', $linkres->id);
    $main_smarty->assign('submit_type', $linkres->type());
    $main_smarty->assign('submit_title', str_replace('"', "&#034;", $link_title));
    $main_smarty->assign('submit_content', $link_content);
    if (isset($trackback)) {
        $main_smarty->assign('submit_trackback', $trackback);
    } else {
        $main_smarty->assign('submit_trackback', '');
    }
    $main_smarty->assign('tpl_extra_fields', $the_template . '/submit_extra_fields');
    $main_smarty->assign('tpl_center', $the_template . '/submit_step_3_center');
    $vars = '';
    check_actions('do_submit2', $vars);
    $_SESSION['step'] = 2;
    if (Submit_Complete_Step2) {
        do_submit3();
    } else {
        $main_smarty->display($the_template . '/pligg.tpl');
    }
}
Пример #5
0
$main_smarty = do_sidebar($main_smarty);
$randkey = rand(1000000, 100000000);
$main_smarty->assign('randkey', $randkey);
// pagename
define('pagename', 'submit_page');
$main_smarty->assign('pagename', pagename);
// read the mysql database to get the pligg version
$sql = "SELECT data FROM " . table_misc_data . " WHERE name = 'pligg_version'";
$pligg_version = $db->get_var($sql);
$main_smarty->assign('version_number', $pligg_version);
if ($_REQUEST['process'] == 'new_page') {
    global $current_user, $db;
    if (!$_REQUEST['page_url']) {
        $_REQUEST['page_url'] = $_REQUEST['page_title'];
    }
    $page_url = makeUrlFriendly($db->escape(trim($_REQUEST['page_url'])), true);
    $page_title = $db->escape(trim($_REQUEST['page_title']));
    $page_content = $db->escape(trim($_REQUEST['page_content']));
    $page_keywords = $db->escape(trim($_REQUEST['page_keywords']));
    $page_description = $db->escape(trim($_REQUEST['page_description']));
    $page_randkey = $db->escape(trim($_REQUEST['randkey']));
    $sql = "INSERT IGNORE INTO " . table_links . " (link_author, link_status, link_randkey, link_category, link_date, link_published_date, link_votes, link_karma, link_title, link_title_url, link_content, link_field1, link_field2) \r\n\t\t\t\tVALUES (" . $current_user->user_id . ", 'page', {$page_randkey}, '0', NOW( ), '', 0, 0, '{$page_title}', '{$page_url}', '{$page_content}', '{$page_keywords}', '{$page_description}')";
    $result = @mysql_query($sql);
    if ($result == 1) {
        header('Location: ' . getmyurl("page", $page_url));
        die;
    }
}
// show the template
$main_smarty->assign('tpl_center', $template_dir . '/admin/submit_page');
$main_smarty->display($template_dir . '/admin/admin.tpl');
Пример #6
0
         }
         $headers = 'From: ' . PLIGG_PassEmail_From . "\r\n";
         if (!mail($to, $subject, $body, $headers)) {
             echo '<br /><p class="l-top"><span class="error">' . _(PLIGG_PassEmail_SendFail) . '</span></p>';
             die;
         }
     }
 }
 if ($canIhaveAccess == 1) {
     $url = htmlspecialchars(strip_tags(trim($_POST['url'])));
     $linkres->url = $url;
 }
 $linkres->category = $_POST['category'];
 if ($linkres->title != strip_tags(trim($_POST['title']))) {
     $linkres->title = strip_tags(trim($_POST['title']));
     $linkres->title_url = makeUrlFriendly($linkres->title);
 }
 $linkres->content = strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow);
 $linkres->tags = tags_normalize_string(strip_tags(trim($_POST['tags'])));
 if ($_POST['summarytext'] == "") {
     $linkres->link_summary = utf8_substr(strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow), 0, StorySummary_ContentTruncate - 1);
     $linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
 } else {
     $linkres->link_summary = $db->escape($_POST['summarytext']);
     $linkres->link_summary = strip_tags(trim($linkres->link_summary), Story_Content_Tags_To_Allow);
     $linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
     if (strlen($linkres->link_summary) > StorySummary_ContentTruncate) {
         loghack('SubmitAStory-SummaryGreaterThanLimit', 'username: '******'|email: ' . $_POST["email"], true);
         $linkres->link_summary = utf8_substr($linkres->link_summary, 0, StorySummary_ContentTruncate - 1);
         $linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
     }
function do_the_import_stuff($feed)
{
    global $db, $dblang, $RSSImport;
    $RSSImport = new RSSImport();
    $added_one = false;
    $url = $feed->feed_url;
    $rss = fetch_rss($url);
    if ($_GET['override'] == $feed->feed_id) {
        $canIhaveAccess = 0;
        $canIhaveAccess = $canIhaveAccess + checklevel('god');
        if (!$canIhaveAccess == 1) {
            die('You are not authorized to override.');
        }
    }
    $MyArray = array();
    $Feed_Links = $RSSImport->get_feed_field_links($feed->feed_id);
    if (count($Feed_Links) > 0) {
        foreach ($Feed_Links as $link) {
            if ($link->pligg_field == 'link_title') {
                $MyArray['title'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_content') {
                $MyArray['content'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_url') {
                $MyArray['link_url'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_tags') {
                $MyArray['link_tags'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field1') {
                $MyArray['link_field1'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field2') {
                $MyArray['link_field2'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field3') {
                $MyArray['link_field3'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field4') {
                $MyArray['link_field4'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field5') {
                $MyArray['link_field5'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field6') {
                $MyArray['link_field6'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field7') {
                $MyArray['link_field7'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field8') {
                $MyArray['link_field8'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field9') {
                $MyArray['link_field9'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field10') {
                $MyArray['link_field10'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field11') {
                $MyArray['link_field11'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field12') {
                $MyArray['link_field12'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field13') {
                $MyArray['link_field13'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field14') {
                $MyArray['link_field14'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field15') {
                $MyArray['link_field15'] = $link->feed_field;
            }
        }
        $thecount = 0;
        if ($feed->feed_last_item_first == 0) {
            $the_items = array_reverse($rss->items);
        } else {
            $the_items = $rss->items;
        }
        foreach ($the_items as $item) {
            echo "<strong>Title: " . get_val($item, $MyArray['title']) . "</strong><br/>";
            echo "<strong>Content:</strong> " . strip_tags(substr(get_val($item, $MyArray['content']), 0, 256)) . "...<br>";
            echo "<strong>URL:</strong> " . get_val($item, $MyArray['link_url']) . "<br/>";
            $skipthis = 0;
            $linkres = new Link();
            $linkres->randkey = rand(10000, 10000000);
            $linkres->status = $feed->feed_status;
            $linkres->author = $feed->feed_submitter;
            $linkres->title = get_val($item, $MyArray['title']);
            $linkres->title = strip_tags($linkres->title);
            $linkres->tags = get_val($item, $MyArray['link_tags']);
            // MJE: MOD to include title words as tags ----------------------------
            if (trim($linkres->tags) == '') {
                $temp1 = strtolower($linkres->title);
                $stopwords = file(mnmpath . '/modules/rss_import/templates/stopwords.txt');
                for ($zz = 0; $zz < count($stopwords); $zz++) {
                    $pos = strpos($temp1, $stopwords[$zz] . ' ');
                    if ($pos !== false && $pos == 0) {
                        $temp1 = str_replace(trim($stopwords[$zz]) . ' ', ' ', $temp1);
                    }
                    $temp1 = str_replace(' ' . trim($stopwords[$zz]) . ' ', ' ', $temp1);
                }
                $pos = strpos($temp1, '  ');
                while ($pos !== false) {
                    $temp1 = str_replace('  ', ' ', $temp1);
                    $pos = strpos($temp1, '  ');
                }
                $temp1 = str_replace(' ', ", ", $temp1);
                // $out = ereg_replace("[^[:alpha:]]", "", $in);
                // strip all except letters and spaces and commas
                $linkres->tags = preg_replace('/[^a-z A-Z,]+/i', '', $temp1);
            }
            //----------------------------------------------------------------------
            if (checklevel('god')) {
                $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_God;
            } elseif (checklevel('admin')) {
                $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Admin;
            } else {
                $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Normal;
            }
            $linkres->title_url = makeUrlFriendly($linkres->title);
            $linkres->url = get_val($item, $MyArray['link_url']);
            $linkres->url_title = $linkres->title;
            $linkres->content = get_val($item, $MyArray['content']);
            $linkres->content = strip_tags($linkres->content, $Story_Content_Tags_To_Allow);
            $linkres->content = str_replace("\n", "<br />", $linkres->content);
            $linkres->link_field1 = get_val($item, $MyArray['link_field1']);
            $linkres->link_field2 = get_val($item, $MyArray['link_field2']);
            $linkres->link_field3 = get_val($item, $MyArray['link_field3']);
            $linkres->link_field4 = get_val($item, $MyArray['link_field4']);
            $linkres->link_field5 = get_val($item, $MyArray['link_field5']);
            $linkres->link_field6 = get_val($item, $MyArray['link_field6']);
            $linkres->link_field7 = get_val($item, $MyArray['link_field7']);
            $linkres->link_field8 = get_val($item, $MyArray['link_field8']);
            $linkres->link_field9 = get_val($item, $MyArray['link_field9']);
            $linkres->link_field10 = get_val($item, $MyArray['link_field10']);
            $linkres->link_field11 = get_val($item, $MyArray['link_field11']);
            $linkres->link_field12 = get_val($item, $MyArray['link_field12']);
            $linkres->link_field13 = get_val($item, $MyArray['link_field13']);
            $linkres->link_field14 = get_val($item, $MyArray['link_field14']);
            $linkres->link_field15 = get_val($item, $MyArray['link_field15']);
            $linkres->category = $feed->feed_category;
            //MJE: MOD
            $linkres->link_summary = utf8_substr(strip_tags($linkres->content), 0, StorySummary_ContentTruncate - 1);
            //---------
            if ($thecount >= $feed->feed_item_limit && $skipthis == 0) {
                echo "Reached import limit, skipping<HR>";
                $skipthis = 1;
            }
            if ($feed->feed_title_dupe == 0 && $skipthis == 0) {
                // 0 means don't allow, 1 means allow
                if ($linkres->duplicates_title($linkres->title) > 0) {
                    //echo "Title Match, skipping: " . $linkres->title . "<HR>";
                    echo '<span style="color:#fc0000;">Title Match, skipping</span> <hr>';
                    $skipthis = 1;
                }
            }
            if ($feed->feed_url_dupe == 0 && $linkres->url != "" && $skipthis == 0) {
                // 0 means don't allow, 1 means allow
                if ($linkres->duplicates($linkres->url) > 0) {
                    //echo "URL Match, skipping: " . $linkres->title . "<HR>";
                    echo '<span style="color:#fc0000;">URL Match, skipping</span> <hr>';
                    $skipthis = 1;
                }
            }
            if ($skipthis == 0) {
                echo "Importing <hr>";
                $added_one = true;
                $linkres->store();
                totals_adjust_count($linkres->status, 1);
                tags_insert_string($linkres->id, $dblang, $linkres->tags);
                require_once mnminclude . 'votes.php';
                if ($feed->feed_random_vote_enable == 1) {
                    $feed->feed_votes = rand($feed->feed_random_vote_min, $feed->feed_random_vote_max);
                }
                $votes = 0;
                for ($i = 1; $i <= $feed->feed_votes; $i++) {
                    $value = 1;
                    $vote = new Vote();
                    $vote->type = 'links';
                    $vote->user = 0;
                    $vote->link = $linkres->id;
                    $vote->ip = '0.0.0.' . $i;
                    $vote->value = $value;
                    $vote->insert();
                    $vote = "";
                    $votes += $value;
                    //								$vote = new Vote;
                    //								$vote->type='links';
                    //								$vote->link=$linkres->id;
                }
                $linkres->votes = $votes;
                $linkres->store_basic();
                $linkres->check_should_publish();
                $thecount = $thecount + 1;
            }
        }
        $sql = "UPDATE `" . table_feeds . "` SET `feed_last_check` = FROM_UNIXTIME(" . (time() - 300) . ") WHERE `feed_id` = {$feed->feed_id};";
        //echo $sql;
        $db->query($sql);
    } else {
        echo "Feed not fully setup, skipping <hr>";
    }
    if ($added_one) {
        return true;
    } else {
        return false;
    }
}
Пример #8
0
if ($canIhaveAccess == 0) {
    $main_smarty->assign('tpl_center', $the_template . '/admin_templates/admin_access_denied');
    $main_smarty->display($template_dir . '/admin/admin.tpl');
    die;
}
// misc smarty
$main_smarty->assign('isAdmin', $canIhaveAccess);
// sidebar
$main_smarty = do_sidebar($main_smarty);
$randkey = rand(1000000, 100000000);
$main_smarty->assign('randkey', $randkey);
// pagename
define('pagename', 'submit_page');
$main_smarty->assign('pagename', pagename);
if ($_REQUEST['process'] == 'new_page') {
    global $current_user, $db;
    $page_title = makeUrlFriendly($db->escape(trim($_REQUEST['page_title'])), true);
    $page_content = $db->escape(trim($_REQUEST['page_content']));
    $page_randkey = $db->escape(trim($_REQUEST['randkey']));
    $sql = "INSERT INTO " . table_links . " (link_author, link_status, link_randkey, link_category, link_date, link_published_date, link_votes, link_karma, link_title, link_content) VALUES (" . $current_user->user_id . ", 'page', {$page_randkey}, '0', NOW( ), '', 0, 0, '{$page_title}', '{$page_content}')";
    $result = @mysql_query($sql);
    if ($result == 1) {
        header('Location: ' . getmyurl("page", $page_title));
    }
}
// show the template
$main_smarty->assign('tpl_center', $template_dir . '/admin/submit_page');
$main_smarty->display($template_dir . '/admin/admin.tpl');
?>

Пример #9
0
 function store()
 {
     global $db, $current_user;
     // DB 09/03/08
     if (!is_numeric($this->id)) {
         return false;
     }
     /////
     $this->store_basic();
     $link_url = $db->escape($this->url);
     $link_url_title = $db->escape($this->url_title);
     $link_url_description = $db->escape($this->url_description);
     $link_title = $db->escape($this->title);
     $link_title_url = $db->escape($this->title_url);
     if ($link_title_url == "") {
         $link_title_url = makeUrlFriendly($this->title, $this->id);
     }
     $link_tags = $db->escape($this->tags);
     $link_content = $db->escape($this->content);
     $link_field1 = $db->escape($this->link_field1);
     $link_field2 = $db->escape($this->link_field2);
     $link_field3 = $db->escape($this->link_field3);
     $link_field4 = $db->escape($this->link_field4);
     $link_field5 = $db->escape($this->link_field5);
     $link_field6 = $db->escape($this->link_field6);
     $link_field7 = $db->escape($this->link_field7);
     $link_field8 = $db->escape($this->link_field8);
     $link_field9 = $db->escape($this->link_field9);
     $link_field10 = $db->escape($this->link_field10);
     $link_field11 = $db->escape($this->link_field11);
     $link_field12 = $db->escape($this->link_field12);
     $link_field13 = $db->escape($this->link_field13);
     $link_field14 = $db->escape($this->link_field14);
     $link_field15 = $db->escape($this->link_field15);
     $link_group_id = $db->escape($this->link_group_id);
     $link_summary = $db->escape($this->link_summary);
     // Save old SEO URL if changed
     $old_url = $db->get_var("SELECT link_title_url FROM " . table_links . " WHERE link_id={$this->id}");
     if ($old_url && $old_url != $this->title_url) {
         $db->query("INSERT INTO " . table_old_urls . " SET old_link_id={$this->id}, old_title_url='{$old_url}'");
     }
     $sql = "UPDATE " . table_links . " set link_summary='{$link_summary}', link_title_url='{$link_title_url}', link_url='{$link_url}', link_url_title='{$link_url_title}', link_title='{$link_title}', link_content='{$link_content}', link_tags='{$link_tags}', link_field1='{$link_field1}', link_field2='{$link_field2}', link_field3='{$link_field3}', link_field4='{$link_field4}', link_field5='{$link_field5}', link_field6='{$link_field6}', link_field7='{$link_field7}', link_field8='{$link_field8}', link_field9='{$link_field9}', link_field10='{$link_field10}', link_field11='{$link_field11}', link_field12='{$link_field12}', link_field13='{$link_field13}', link_field14='{$link_field14}', link_field15='{$link_field15}', link_group_id = {$link_group_id} WHERE link_id={$this->id}";
     if ($this->debug == true) {
         echo '<hr>Store:' . $sql . '<hr>';
     }
     //echo "query".$sql;
     $db->query($sql);
     $pos = strrpos($_SERVER["SCRIPT_NAME"], "/");
     $script_name = substr($_SERVER["SCRIPT_NAME"], $pos + 1, 100);
     $script_name = str_replace(".php", "", $script_name);
 }
Пример #10
0
 function store()
 {
     global $db, $current_user;
     $this->store_basic();
     $link_url = $db->escape($this->url);
     $link_url_title = $db->escape($this->url_title);
     $link_title = $db->escape($this->title);
     $link_title_url = $db->escape($this->title_url);
     if ($link_title_url == "") {
         $link_title_url = makeUrlFriendly($this->title);
     }
     $link_tags = $db->escape($this->tags);
     $link_content = $db->escape($this->content);
     $link_field1 = $db->escape($this->link_field1);
     $link_field2 = $db->escape($this->link_field2);
     $link_field3 = $db->escape($this->link_field3);
     $link_field4 = $db->escape($this->link_field4);
     $link_field5 = $db->escape($this->link_field5);
     $link_field6 = $db->escape($this->link_field6);
     $link_field7 = $db->escape($this->link_field7);
     $link_field8 = $db->escape($this->link_field8);
     $link_field9 = $db->escape($this->link_field9);
     $link_field10 = $db->escape($this->link_field10);
     $link_field11 = $db->escape($this->link_field11);
     $link_field12 = $db->escape($this->link_field12);
     $link_field13 = $db->escape($this->link_field13);
     $link_field14 = $db->escape($this->link_field14);
     $link_field15 = $db->escape($this->link_field15);
     $link_summary = $db->escape($this->link_summary);
     $db->query("UPDATE " . table_links . " set link_summary='{$link_summary}', link_title_url='{$link_title_url}', link_url='{$link_url}', link_url_title='{$link_url_title}', link_title='{$link_title}', link_content='{$link_content}', link_tags='{$link_tags}', link_field1='{$link_field1}', link_field2='{$link_field2}', link_field3='{$link_field3}', link_field4='{$link_field4}', link_field5='{$link_field5}', link_field6='{$link_field6}', link_field7='{$link_field7}', link_field8='{$link_field8}', link_field9='{$link_field9}', link_field10='{$link_field10}', link_field11='{$link_field11}', link_field12='{$link_field12}', link_field13='{$link_field13}', link_field14='{$link_field14}', link_field15='{$link_field15}' WHERE link_id={$this->id}");
     $pos = strrpos($_SERVER["SCRIPT_NAME"], "/");
     $script_name = substr($_SERVER["SCRIPT_NAME"], $pos + 1, 100);
     $script_name = str_replace(".php", "", $script_name);
     if ($this->count_all_votes() != 0 && $script_name != 'submit') {
         // clear the cache for that story that was voted on
         include_once 'Smarty.class.php';
         $votesmarty = new Smarty();
         $votesmarty->compile_dir = "templates_c/";
         $votesmarty->template_dir = "templates/";
         $votesmarty->config_dir = "";
         $votesmarty->cache_dir = "templates_c/";
         // enable caching at your own risk. this code is still experimental
         //$votesmarty->cache = true;
         $votesmarty->clear_cache($the_template . '/link_summary.tpl', 'story' . $this->id);
         $votesmarty = "";
     }
 }