function upload_1()
{
    global $upload_dir, $db, $current_user;
    //save upload file
    if ($_FILES['upload_file']['error'] > 0) {
        $error = "ERROR: " . get_file_err($_FILES['upload_file']['error']) . "</br>";
        $_SESSION['upload_file'] = array('error' => $error);
    } else {
        // the file name that should be uploaded
        $file_tmp = $_FILES['upload_file']['tmp_name'];
        $file_name = $_FILES['upload_file']['name'];
        $unique_file_name = $current_user->user_login . "_" . $file_name;
        $upload_dir = get_misc_data('raw_data_directory');
        $upload_path = mnmpath . $upload_dir . $unique_file_name;
        if (file_exists($upload_path)) {
            $error = "ERROR: Already exits.</br>";
            $_SESSION['upload_file'] = array('error' => $error);
        } else {
            $upload = move_uploaded_file($file_tmp, $upload_path);
            echo $upload;
            // check upload status
            if (!$upload) {
                $error = "ERROR:failed to save. </br>";
                $_SESSION['upload_file'] = array('error' => $error);
            } else {
                $sql = "INSERT INTO " . table_prefix . "files \r\n\t\t\t\t\t\t\t\tSET file_user_id={$current_user->user_id},\r\n\t\t\t\t\t\t\t    file_real_size='{$_FILES['upload_file']['size']}',\r\n\t\t\t\t\t\t    \tfile_name='" . $db->escape("{$upload_path}") . "'";
                $db->query($sql);
                $loc_msg = my_base_url . my_pligg_base . $upload_dir . $unique_file_name;
                $_SESSION['upload_file'] = array('loc' => $loc_msg);
            }
        }
    }
}
Exemple #2
0
function captcha_configure()
{
    global $main_smarty, $the_template;
    $q_1_low = isset($_REQUEST['q_1_low']) ? $_REQUEST['q_1_low'] : '';
    $q_1_high = isset($_REQUEST['q_1_high']) ? $_REQUEST['q_1_high'] : '';
    $q_2_low = isset($_REQUEST['q_2_low']) ? $_REQUEST['q_2_low'] : '';
    $q_2_high = isset($_REQUEST['q_2_high']) ? $_REQUEST['q_2_high'] : '';
    if ($q_1_low != '') {
        misc_data_update('captcha_math_q1low', $q_1_low);
    } else {
        $q_1_low = get_misc_data('captcha_math_q1low') == '' ? 1 : get_misc_data('captcha_math_q1low');
    }
    if ($q_1_high != '') {
        misc_data_update('captcha_math_q1high', $q_1_high);
    } else {
        $q_1_high = get_misc_data('captcha_math_q1high') == '' ? 5 : get_misc_data('captcha_math_q1high');
    }
    if ($q_2_low != '') {
        misc_data_update('captcha_math_q2low', $q_2_low);
    } else {
        $q_2_low = get_misc_data('captcha_math_q2low') == '' ? 1 : get_misc_data('captcha_math_q2low');
    }
    if ($q_2_high != '') {
        misc_data_update('captcha_math_q2high', $q_2_high);
    } else {
        $q_2_high = get_misc_data('captcha_math_q2high') == '' ? 5 : get_misc_data('captcha_math_q2high');
    }
    $main_smarty->assign('q_1_low', sanitize($q_1_low, 2));
    $main_smarty->assign('q_1_high', sanitize($q_1_high, 2));
    $main_smarty->assign('q_2_low', sanitize($q_2_low, 2));
    $main_smarty->assign('q_2_high', sanitize($q_2_high, 2));
}
Exemple #3
0
function hc_register(&$vars)
{
    global $main_smarty, $the_template, $hc_registered;
    if ($hc_registered) {
        return;
    }
    $hc_registered = true;
    if (!isset($_SESSION)) {
        session_start();
    }
    $_SESSION['hc_math_answer'] == '';
    $q_1_low = get_misc_data('hc_math_q1low') == '' ? 1 : get_misc_data('hc_math_q1low');
    $q_1_high = get_misc_data('hc_math_q1high') == '' ? 5 : get_misc_data('hc_math_q1high');
    $q_2_low = get_misc_data('hc_math_q2low') == '' ? 1 : get_misc_data('hc_math_q2low');
    $q_2_high = get_misc_data('hc_math_q2high') == '' ? 5 : get_misc_data('hc_math_q2high');
    $number1 = md5(mt_rand($q_1_low, $q_1_high));
    do {
        $number2 = md5(mt_rand($q_2_low, $q_2_high));
    } while ($number2 == $number1);
    $number3 = md5(mt_rand($q_2_low, $q_2_high));
    $_SESSION['titlename'] = $number1;
    $_SESSION['bodyname'] = $number2;
    $_SESSION['commentname'] = $number3;
    $main_smarty->assign('name', $_SESSION['hc_math_answer_name']);
    // smarty prefilter
    $main_smarty->register_prefilter('add_header_comment');
}
Exemple #4
0
function captcha_can_we_use()
{
    global $main_smarty;
    $pubkey = get_misc_data('reCaptcha_pubkey');
    $prikey = get_misc_data('reCaptcha_prikey');
    if ($pubkey == '' || $prikey == '') {
        $main_smarty->assign('msg', 'reCaptcha needs to be configured before it can be used.');
        return false;
    } else {
        return true;
    }
}
Exemple #5
0
function captcha_register_check_errors(&$vars)
{
    if (captcha_reg_enabled == true) {
        global $main_smarty, $the_template;
        $captcha = get_misc_data('captcha_method');
        if ($captcha == '') {
            $captcha = 'recaptcha';
        }
        $username = $vars['username'];
        $email = $vars['email'];
        $password = $vars['password'];
        $main_smarty->assign('username', $username);
        $main_smarty->assign('email', $email);
        $main_smarty->assign('password', $password);
        include_once captcha_captchas_path . '/' . $captcha . '/main.php';
        if (captcha_check($vars, 2)) {
        } else {
            $vars['error'] = true;
        }
    }
}
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_switch` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_friends` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_story` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_comment` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_email` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_group` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_all_friends` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_friend_list` TEXT";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD  `status_excludes` TEXT";
// Set default values
$module_info['db_sql'][] = "UPDATE " . table_users . " SET status_switch=1, status_friends=1, status_story=1, status_comment=1, status_email=1, status_all_friends=1";
// Add new table
$module_info['db_add_table'][] = array('name' => table_prefix . "updates", 'sql' => "CREATE TABLE `" . table_prefix . "updates` (\n\t  `update_id` int(11) NOT NULL auto_increment,\n\t  `update_time` int(11) default NULL,\n\t  `update_type` char(1) NOT NULL,\n\t  `update_link_id` int(11) NOT NULL,\n\t  `update_user_id` int(11) NOT NULL,\n\t  `update_group_id` int(11) NOT NULL,\n\t  `update_likes` int(11) NOT NULL,\n\t  `update_level` varchar(25),\n\t  `update_text` text NOT NULL,\n\t  PRIMARY KEY  (`update_id`),\n\t  FULLTEXT KEY `update_text` (`update_text`)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
$module_info['db_add_table'][] = array('name' => table_prefix . "likes", 'sql' => "CREATE TABLE `" . table_prefix . "likes` (\n\t  `like_update_id` int(11) NOT NULL,\n\t  `like_user_id` int(11) NOT NULL,\n\t  PRIMARY KEY  (`like_update_id`, `like_user_id`)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
// Set default module settings
if (get_misc_data('status_switch') == '') {
    misc_data_update('status_switch', '0');
    misc_data_update('status_show_permalin', '1');
    misc_data_update('status_permalinks', '1');
    misc_data_update('status_inputonother', '1');
    misc_data_update('status_place', 'tpl_pligg_profile_tab_insert');
    misc_data_update('status_clock', '12');
    misc_data_update('status_results', '10');
    misc_data_update('status_max_chars', '1200');
    misc_data_update('status_avatar', 'small');
    misc_data_update('status_profile_level', 'admin,moderator,normal');
    misc_data_update('status_level', 'admin,moderator,normal');
    misc_data_update('status_user_email', '1');
    misc_data_update('status_user_comment', '1');
    misc_data_update('status_user_story', '1');
    misc_data_update('status_user_friends', '1');
function get_spam_trigger_settings()
{
    return array('spam_light' => get_misc_data('spam_trigger_light'), 'spam_medium' => get_misc_data('spam_trigger_medium'), 'spam_hard' => get_misc_data('spam_trigger_hard'));
}
Exemple #8
0
 if (!$fieldexists) {
     // DB 04/13/09
     $categories = $db->get_results("SELECT category_id FROM `" . table_categories . "` WHERE category_id>0", ARRAY_A);
     $cats = array();
     if ($categories) {
         foreach ($categories as $cat) {
             $cats[] = $cat['category_id'];
         }
     }
     $sql = "ALTER TABLE `" . table_users . "` ADD `user_categories` VARCHAR(255) NOT NULL default '' AFTER `user_occupation`;";
     $db->query($sql);
     /////
 } else {
     $sql = "CHANGE  `user_categories`  `user_categories` VARCHAR( 255 ) DEFAULT  ''";
     $db->query($sql);
     if (get_misc_data('user_cat') == '' && $db->get_var("SELECT user_categories FROM " . table_users . " WHERE user_level='admin' LIMIT 1")) {
         $sqlGetiCategory = "SELECT category__auto_id from " . table_categories . " where category__auto_id!= 0;";
         $sqlGetiCategoryQ = mysql_query($sqlGetiCategory);
         $arr = array();
         while ($row = mysql_fetch_array($sqlGetiCategoryQ, MYSQL_NUM)) {
             $arr[] = $row[0];
         }
         $result = mysql_query("SELECT * FROM " . table_users);
         while ($row = mysql_fetch_array($result)) {
             $cats = split(',', $row['user_categories']);
             $diff = array_diff($arr, $cats);
             mysql_query($sql = "UPDATE " . table_users . " SET user_categories='" . join(',', $diff) . "' WHERE user_id='{$row['user_id']}'");
         }
         misc_data_update('user_cat', 'changed');
     }
 }
<?php

$widget['widget_title'] = "Akismet Anti-Spam";
$widget['widget_has_settings'] = 1;
$widget['widget_shrink_icon'] = 1;
$widget['widget_uninstall_icon'] = 0;
$widget['name'] = 'Akismet';
$widget['desc'] = 'Akismet Anti-Spam Module';
$widget['version'] = 0.1;
$wordpress_key = get_misc_data('wordpress_key');
if ($_REQUEST['widget'] == 'akismet') {
    if (isset($_REQUEST['key'])) {
        $wordpress_key = sanitize($_REQUEST['key'], 3);
    } else {
        $wordpress_key = '';
    }
    misc_data_update('wordpress_key', $wordpress_key);
}
if ($main_smarty) {
    $main_smarty->assign('wordpress_key', $wordpress_key);
    if (function_exists('akismet_get_link_count')) {
        $count1 = akismet_get_link_count();
        $count2 = akismet_get_comment_count();
        $main_smarty->assign('spam_links_count', $count1);
        $main_smarty->assign('spam_comments_count', $count2);
        if ($count1 == 0 && $count2 == 0) {
            $widget['column'] = '';
        }
    } else {
        $widget['column'] = '';
    }
Exemple #10
0
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include_once 'Smarty.class.php';
$main_smarty = new Smarty();
include 'config.php';
include mnminclude . 'html1.php';
include mnminclude . 'link.php';
include mnminclude . 'tags.php';
include mnminclude . 'search.php';
include mnminclude . 'smartyvariables.php';
$spam_links = get_misc_data('spam_links');
if ($spam_links != '') {
    $spam_links = unserialize(get_misc_data('spam_links'));
} else {
    $spam_links = array();
}
//print_r($spam_links);
if (count($spam_links) > 0) {
    foreach ($spam_links as $link_id) {
        $link = new Link();
        $link->id = $link_id;
        $link->read(FALSE);
        $link->status = 'discard';
        $link->store();
        echo 'Discarding link_id: ' . $link_id . '<br />';
    }
}
Exemple #11
0
function get_settings()
{
    return array('group_id' => get_misc_data('phpbb_group'), 'db' => get_misc_data('phpbb_db'), 'user' => get_misc_data('phpbb_user'), 'pass' => get_misc_data('phpbb_pass'), 'host' => get_misc_data('phpbb_host'), 'cookie_name' => get_misc_data('phpbb_cookie_name'), 'cookie_path' => get_misc_data('phpbb_cookie_path'), 'cookie_domain' => get_misc_data('phpbb_cookie_domain'), 'cookie_secure' => get_misc_data('phpbb_cookie_secure'));
}
Exemple #12
0
<?php

global $db, $main_smarty, $the_template;
include_once '../../config.php';
$contactable_mail = get_misc_data('contactable_mail');
// Assign contact email
// Assign contact info
$name = stripcslashes($_POST['name']);
$emailAddr = stripcslashes($_POST['email']);
$issue = stripcslashes($_POST['issue']);
$comment = stripcslashes($_POST['message']);
$subject = stripcslashes($_POST['subject']);
// Set headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Format message
$contactMessage = "<div>\n\t<p><strong>Name:</strong> {$name} <br />\n\t<strong>E-mail:</strong> {$emailAddr} <br />\n\t<strong>Issue:</strong> {$issue} </p>\n\n\t<p><strong>Message:</strong> {$comment} </p>\n\n\t<p><strong>Sending IP:</strong> {$_SERVER['REMOTE_ADDR']}<br />\n\t<strong>Sent via:</strong> {$_SERVER['HTTP_HOST']}</p>\n\t</div>";
// Send and check the message status
$response = mail($contactable_mail, $subject, $contactMessage, $headers) ? "success" : "failure";
$output = json_encode(array("response" => $response));
header('content-type: application/json; charset=utf-8');
echo $output;
Exemple #13
0
if ($sw_comments == '') {
    $sw_comments = '1';
}
$sw_newuser = get_misc_data('sw_newuser');
if ($sw_newuser == '') {
    $sw_newuser = '******';
}
$phpver = get_misc_data('phpver');
if ($phpver == '') {
    $phpver = '1';
}
$mysqlver = get_misc_data('mysqlver');
if ($mysqlver == '') {
    $mysqlver = '1';
}
$sw_dbsize = get_misc_data('sw_dbsize');
if ($sw_dbsize == '') {
    $sw_dbsize = '1';
}
if ($_REQUEST['widget'] == 'statistics') {
    if (isset($_REQUEST['version'])) {
        $sw_version = sanitize($_REQUEST['version'], 3);
    }
    misc_data_update('sw_version', $sw_version);
    if (isset($_REQUEST['members'])) {
        $sw_members = sanitize($_REQUEST['members'], 3);
    }
    misc_data_update('sw_members', $sw_members);
    if (isset($_REQUEST['groups'])) {
        $sw_groups = sanitize($_REQUEST['groups'], 3);
    }
         // pagename
         define('pagename', 'admin_users');
         $main_smarty->assign('pagename', pagename);
         // show the template
         $main_smarty->assign('tpl_center', '/admin/user_listall_center');
         $main_smarty->display($template_dir . '/admin/admin.tpl');
     }
 } else {
     // No options are selected, so show the list of users.
     $CSRF->create('admin_users_list', true, true);
     global $offset, $top_users_size;
     // Items per page drop-down
     if (isset($_GET["pagesize"]) && is_numeric($_GET["pagesize"])) {
         misc_data_update('pagesize', $_GET["pagesize"]);
     }
     $pagesize = get_misc_data('pagesize');
     if ($pagesize <= 0) {
         $pagesize = 30;
     }
     $main_smarty->assign('pagesize', $pagesize);
     if ($_GET["filter"]) {
         $filter_sql = "WHERE user_level='" . sanitize($_GET["filter"], 3) . "'";
     } else {
         $filter_sql = "WHERE user_level!='Spammer'";
     }
     // figure out what "page" of the results we're on
     $offset = (get_current_page() - 1) * $pagesize;
     $users = mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM " . table_users . " {$filter_sql} ORDER BY `user_date` LIMIT {$offset},{$pagesize}");
     $rows = $db->get_var("SELECT FOUND_ROWS()");
     $userlist = array();
     while ($row = mysql_fetch_array($users, MYSQL_ASSOC)) {
function pligg_hash()
{
    // returns the version of Pligg that's installed
    $hash = get_misc_data('hash');
    return $hash;
}
Exemple #16
0
// the path to the modules libraries. the probably shouldn't be changed unless you rename the hc folder(s)
define('hc_lib_path', './modules/hc/libs/');
// the path to the hcs. the probably shouldn't be changed unless you rename the hc folder(s)
define('hc_hcs_path', './modules/hc/');
// the path to the images. the probably shouldn't be changed unless you rename the hc folder(s)
define('hc_img_path', my_pligg_base . '/modules/hc/images/');
$hc_single_step = get_misc_data('reg_single_step') == '' ? false : get_misc_data('reg_single_step');
$hc_single_step = $hc_single_step == 'true' ? true : false;
define('hc_single_step', $hc_single_step);
$hc_reg_enabled = get_misc_data('hc_reg_en') == '' ? true : get_misc_data('hc_reg_en');
$hc_reg_enabled = $hc_reg_enabled == 'true' ? true : false;
define('hc_reg_enabled', $hc_reg_enabled);
$hc_story_enabled = get_misc_data('hc_story_en') == '' ? true : get_misc_data('hc_story_en');
$hc_story_enabled = $hc_story_enabled == 'true' ? true : false;
define('hc_story_enabled', $hc_story_enabled);
$hc_comment_enabled = get_misc_data('hc_comment_en') == '' ? true : get_misc_data('hc_comment_en');
$hc_comment_enabled = $hc_comment_enabled == 'true' ? true : false;
define('hc_comment_enabled', $hc_comment_enabled);
define('URL_hc', './module.php?module=hc');
$hc_registered = false;
$hc_checked = false;
// don't touch anything past this line.
if (isset($main_smarty) && is_object($main_smarty)) {
    $main_smarty->assign('hc_path', hc_path);
    $main_smarty->assign('hc_pligg_lang_conf', hc_pligg_lang_conf);
    $main_smarty->assign('hc_lang_conf', hc_lang_conf);
    $main_smarty->assign('hc_tpl_path', hc_tpl_path);
    $main_smarty->assign('hc_lib_path', hc_lib_path);
    $main_smarty->assign('hc_img_path', hc_img_path);
    $main_smarty->assign('hc_hcs_path', hc_hcs_path);
    $main_smarty->assign('hc_single_step_reg', hc_single_step);
Exemple #17
0
$module_info['name'] = 'Upload';
$module_info['desc'] = 'Attach images and files to an article';
$module_info['version'] = 2.0;
$module_info['update_url'] = 'http://pligg.com/downloads/module/upload-module/version/';
$module_info['homepage_url'] = 'http://pligg.com/downloads/module/upload-module/';
$module_info['settings_url'] = '../module.php?module=upload';
// this is where you set the modules "name" and "version" that is required
// if more that one module is required then just make a copy of that line
$module_info['db_add_table'][] = array('name' => table_prefix . "files", 'sql' => "CREATE TABLE `" . table_prefix . "files` (\n\t  `file_id` int(11) NOT NULL auto_increment,\n\t  `file_name` varchar(255) default NULL,\n\t  `file_size` varchar(20) default NULL,\n\t  `file_user_id` int(11) NOT NULL,\n\t  `file_link_id` int(11) NOT NULL,\n\t  `file_orig_id` int(11) NOT NULL,\n\t  `file_real_size` int(11) NOT NULL,\n\t  `file_number` tinyint(4) NOT NULL,\n\t  `file_ispicture` tinyint(4) NOT NULL,\n\t  PRIMARY KEY  (`file_id`)\n\t) ENGINE=MyISAM ");
// these are seperate because most people will have the tables already
// created from a previous install
$module_info['db_add_field'][] = array(table_prefix . 'files', 'file_fields', 'TEXT', '', '', 0, '');
$module_info['db_add_field'][] = array(table_prefix . 'files', 'file_hide_thumb', 'TINYINT', 1, "UNSIGNED", 0, '0');
$module_info['db_add_field'][] = array(table_prefix . 'files', 'file_hide_file', 'TINYINT', 1, "UNSIGNED", 0, '0');
$module_info['db_add_field'][] = array(table_prefix . 'files', 'file_comment_id', 'INT', 11, '', 0, '0');
if (get_misc_data('upload_thumb') == '') {
    misc_data_update('upload_thumb', '1');
    misc_data_update('upload_sizes', 'a:1:{i:0;s:7:"200x200";}');
    misc_data_update('upload_display', 'a:1:{s:7:"150x150";s:1:"1";}');
    misc_data_update('upload_fields', 'YTowOnt9');
    misc_data_update('upload_alternates', 'YToxOntpOjE7czowOiIiO30=');
    misc_data_update('upload_mandatory', 'a:0:{}');
    misc_data_update('upload_place', 'tpl_link_summary_pre_story_content');
    misc_data_update('upload_external', 'file,url');
    misc_data_update('upload_link', 'orig');
    misc_data_update('upload_quality', '80');
    misc_data_update('upload_directory', '/modules/upload/attachments');
    misc_data_update('upload_thdirectory', '/modules/upload/attachments/thumbs');
    misc_data_update('upload_filesize', '200');
    misc_data_update('upload_maxnumber', '1');
    misc_data_update('upload_extensions', 'jpg jpeg png gif');
<?php

/* V2.10 Template Lite 4 January 2007  (c) 2005-2007 Mark Dickenson. All rights reserved. Released LGPL. 2009-08-09 07:12:32 CDT */
?>

<?php 
$this->config_load(upload_lang_conf, null, null);
?>

<?php 
global $db;
$this->_vars['upload_directory'] = $upload_directory = get_misc_data('upload_directory');
$sql = "SELECT * FROM " . table_prefix . "files where file_link_id='{$this->_vars['link_id']}' AND file_size='orig'";
$images = $db->get_results($sql, ARRAY_A);
if ($images) {
    $this->_vars['images'] = $images;
}
?>
                                                          

<?php 
if (sizeof($this->_vars['images'])) {
    ?>
<h3><?php 
    echo $this->_confs['PLIGG_Upload_Attached'];
    ?>
</h3><?php 
}
if (count((array) $this->_vars['images'])) {
    foreach ((array) $this->_vars['images'] as $this->_vars['image']) {
        ?>
function generate()
{
    global $upload_dir, $db, $current_user, $main_smarty, $the_template;
    // the file name that should be uploaded
    $file_tmp = $_FILES['upload_file']['tmp_name'];
    $file_name = $_FILES['upload_file']['name'];
    $unique_file_name = "tingtest1.ktr";
    $upload_dir = get_misc_data('upload_directory');
    $upload_path = mnmpath . $upload_dir . $unique_file_name;
    $upload = move_uploaded_file($file_tmp, $upload_path);
    /*create new ktr file*/
    $tmpDir = 'excel-to-target_schema.ktr';
    $newDir = '0.ktr';
    copy($tmpDir, $newDir);
    $a1 = $_POST["sheet"];
    $b1 = $_POST["row"];
    $c1 = $_POST["col"];
    $a = array($a1, "", "");
    $b = array($b1, "", "");
    $c = array($c1, "", "");
    $sheets = array($a, $b, $c);
    $spd = $_POST["spd"];
    $drd = $_POST["drd"];
    $start = $_POST["start"];
    $end = $_POST["end"];
    $start2 = $_POST["start2"];
    $end2 = $_POST["end2"];
    $location = $_POST["location"];
    $aggrtype = $_POST["aggrtype"];
    $location2 = $_POST["location2"];
    $aggrtype2 = $_POST["aggrtype2"];
    $process = new Process_excel();
    $arr_Sheet_name = $process->getSheetName('census.xls');
    $arr_Header = $process->getHeader('dataverse_census.xls', 0, 11, 'A');
    //print_r ($process->getHeader('tradestatistics.xls', 1, 23, 'A'));
    echo $start;
    /* adding url*/
    add_url(0, 'http://colfusion.exp.sis.pitt.edu/colfusion/upload_raw_data/irule_dataverse_census.xls');
    echo "hello";
    //add_sheets(0, $sheets);
    addSheets(0, "Table HH-1", 10, 0);
    addConstants('Spd', $spd, 'Date', 'yyyyMMdd');
    addConstants('Drd', $drd, 'Date', 'yyyyMMdd');
    add_excel_input_fields($arr_Header);
    add_sample_target();
    //$arr_Header - $array_no_need_normalize
    $no_need_Array = array($start, $end, $location, $aggrtype);
    //print_r ($no_need_Array);
    //print_r($arr_Header);
    $result = array_diff($arr_Header, $no_need_Array);
    //	print_r($result);
    /*--------------------the second $result are from user , the first $result need to use AJAX to present to user------*/
    add_normalizer($result, $result);
    //for variable of star
    if ($start != "") {
        //$start from excel
        update_target('Start', $start);
    } else {
        //$start from user input
        addConstants('Start_from_input', $start2, 'Date', 'yyyyMMdd');
        update_target('Start', 'Start_from_input');
    }
    //for variable of end
    if ($end != "") {
        //$start from excel
        update_target('End', $end);
    } else {
        //$start from user input
        addConstants('End_from_input', $end2, 'Date', 'yyyyMMdd');
        update_target('End', 'End_from_input');
    }
    //for variable of location
    if ($location != "") {
        echo $location;
        //$start from excel
        update_target('Location', $location);
    } else {
        //$start from user input
        echo $location2;
        addConstants('Location_from_input', $location2, 'String', '');
        update_target('Location', 'Location_from_input');
    }
    //for variable of aggrType
    if ($aggrtype != "") {
        //$start from excel
        update_target('AggrType', $aggrtype);
    } else {
        //$start from user input
        addConstants('AggrType_from_input', $aggrtype2, 'String', '');
        update_target('AggrType', 'AggrType_from_input');
    }
    //add_normalize($ArrayKey,$ArrayValue);
    echo $start;
    echo "........1<br/>";
    echo $start2;
    echo ".......2<br/>";
    echo $end;
    echo "..........3<br/>";
    echo $end2;
    echo "...........4<br/>";
    echo $location;
    echo "............5<br/>";
    echo $location2;
    echo "..........6<br/>";
    echo $aggrtype;
    echo "..........7<br/>";
    echo $aggrtype2;
    echo "............8<br/>";
    echo $spd;
    echo ".........9<br/>";
    echo $drd;
    echo "..........10<br/>";
}
function links_settings()
{
    return array('comments' => get_misc_data('links_comments'), 'stories' => get_misc_data('links_stories'), 'nofollow' => get_misc_data('links_nofollow'));
}
function get_close_comments_settings()
{
    return array('method' => get_misc_data('close_comment_method'), 'time' => get_misc_data('close_comment_time'));
}
Exemple #22
0
function akismet_showpage()
{
    global $main_smarty, $the_template, $current_user, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        if (phpnum() >= 5) {
            include_once akismet_lib_path . 'Akismet.class_5.php';
        } else {
            include_once akismet_lib_path . 'Akismet.class_4.php';
        }
        $navwhere['text1'] = 'Akismet';
        $navwhere['link1'] = URL_akismet;
        define('pagename', 'akismet');
        $main_smarty->assign('pagename', pagename);
        define('modulename', 'akismet');
        $main_smarty->assign('modulename', modulename);
        if (isset($_REQUEST['view'])) {
            $view = sanitize($_REQUEST['view'], 3);
        } else {
            $view = '';
        }
        if ($view == '') {
            $wordpress_key = get_misc_data('wordpress_key');
            if ($wordpress_key == '') {
                header('Location: ' . URL_akismet . '&view=manageKey');
            }
            $spam_links = get_misc_data('spam_links');
            if ($spam_links != '') {
                $spam_links = unserialize(get_misc_data('spam_links'));
            } else {
                $spam_links = array();
            }
            $main_smarty->assign('spam_links', $spam_links);
            $main_smarty->assign('spam_links_count', count($spam_links));
            $spam_comments = get_misc_data('spam_comments');
            if ($spam_comments != '') {
                $spam_comments = unserialize(get_misc_data('spam_comments'));
            } else {
                $spam_comments = array();
            }
            $main_smarty->assign('spam_comments', $spam_comments);
            $main_smarty->assign('spam_comments_count', count($spam_comments));
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'main');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageKey') {
            $wordpress_key = get_misc_data('wordpress_key');
            $main_smarty->assign('wordpress_key', $wordpress_key);
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageKey');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'updateKey') {
            if (isset($_REQUEST['key'])) {
                $wordpress_key = sanitize($_REQUEST['key'], 3);
            } else {
                $wordpress_key = '';
            }
            misc_data_update('wordpress_key', $wordpress_key);
            header('Location: ' . URL_akismet);
        }
        if ($view == 'manageSpam') {
            $spam_links = get_misc_data('spam_links');
            if ($spam_links != '') {
                $spam_links = unserialize(get_misc_data('spam_links'));
            } else {
                $spam_links = array();
            }
            if (count($spam_links) > 0) {
                $sql = "SELECT " . table_links . ".* FROM " . table_links . " WHERE ";
                $sql .= 'link_id IN (' . implode(',', $spam_links) . ')';
                $link_data = $db->get_results($sql);
                $main_smarty->assign('link_data', object_2_array($link_data));
            } else {
                header('Location: ' . URL_akismet);
            }
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpam');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSettings') {
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSettings');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        /*
        if($view == 'isSpam'){
        	if(isset($_REQUEST['link_id'])){$link_id = sanitize($_REQUEST['link_id'], 3);}else{$link_id='';}
        
        	$spam_links = get_misc_data('spam_links');
        	$spam_links = unserialize(get_misc_data('spam_links'));
        
        	unset($spam_links[$link_id]);
        	misc_data_update('spam_links', serialize($spam_links));
        
        	$link = new Link;
        	$link->id = $link_id;
        	$link->read(FALSE);
        	$link->status = 'discard';
        	$link->store();
        
        	header('Location: ' . URL_akismet . '&view=manageSpam');
        }
        
        if($view == 'isNotSpam'){
        	if(isset($_REQUEST['link_id'])){$link_id = sanitize($_REQUEST['link_id'], 3);}else{$link_id='';}
        
        	$spam_links = get_misc_data('spam_links');
        	$spam_links = unserialize(get_misc_data('spam_links'));
        
        	unset($spam_links[$link_id]);
        	misc_data_update('spam_links', serialize($spam_links));
        
        	$link = new Link;
        	$link->id = $link_id;
        	$link->read(FALSE);
        	$link->status = 'queued';
        	$link->store();
        
        	header('Location: ' . URL_akismet . '&view=manageSpam');
        }
        
        if($view == 'addSpam'){
        
        	$spam_links[1] = 1;
        	misc_data_update('spam_links', serialize($spam_links));
        	header('Location: ' . URL_akismet . '&view=manageSpam');
        
        }
        */
        if ($view == 'manageSpamcomments') {
            $spam_comments = get_misc_data('spam_comments');
            if ($spam_comments != '') {
                $spam_comments = unserialize(get_misc_data('spam_comments'));
            } else {
                $spam_comments = array();
            }
            if (count($spam_comments) > 0) {
                $sql = "SELECT * FROM " . table_prefix . "spam_comments WHERE ";
                $sql .= 'linkid IN (' . implode(',', $spam_comments) . ')';
                $link_data = $db->get_results($sql);
                $user_cmt = new User();
                $user_cmt_link = new Link();
                $spam_output .= ' <form name="bulk_moderate" action="' . URL_akismet_isSpamcomment . '&action=bulkmod" method="post">';
                $spam_output .= "<table>";
                $spam_output .= "<tr><th>Author</th><th>Body</th><th>this is spam</th><th>this is NOT spam</th></tr>";
                if ($link_data) {
                    foreach ($link_data as $spam_cmts) {
                        $user_cmt->id = $spam_cmts->userid;
                        $user_cmt->read();
                        $user_name = $user_cmt->username;
                        $user_cmt_link->id = $spam_cmts->linkid;
                        $user_cmt_link->read();
                        $spam_output .= "<tr>";
                        $spam_output .= "<td>" . $user_name . "</td>";
                        $spam_output .= "<td>" . save_text_to_html($spam_cmts->cmt_content) . "</td>";
                        $spam_output .= '<td><center><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="spamcomment"></center></td>';
                        $spam_output .= '<td><center><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="notspamcomment"></center></td>';
                        $spam_output .= "</tr>";
                    }
                }
                $spam_output .= "</table>";
                $spam_output .= '<p align="right"><input type="submit" name="submit" value="Change Status" class="log2" /></p>';
                $spam_output .= "</form>";
                $main_smarty->assign('spam_output', $spam_output);
                $main_smarty->assign('link_data', object_2_array($link_data));
            } else {
                header('Location: ' . URL_akismet);
            }
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpamcomments');
            $main_smarty->display($the_template . '/pligg.tpl');
        }
        if ($view == 'isSpam') {
            if ($_GET['action'] == "bulkmod") {
                if (isset($_POST['submit'])) {
                    $spam = array();
                    foreach ($_POST["spam"] as $k => $v) {
                        $spam[intval($k)] = $v;
                    }
                    foreach ($spam as $key => $value) {
                        if ($value == "spam") {
                            if (isset($key)) {
                                $link_id = sanitize($key, 3);
                            } else {
                                $link_id = '';
                            }
                            $spam_links = get_misc_data('spam_links');
                            $spam_links = unserialize(get_misc_data('spam_links'));
                            $key = array_search($link_id, $spam_links);
                            unset($spam_links[$key]);
                            misc_data_update('spam_links', serialize($spam_links));
                            $link = new Link();
                            $link->id = $link_id;
                            $link->read();
                            $link->status = 'discard';
                            $link->store();
                            $user = new User();
                            $user->id = $link->author;
                            $user->read();
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($link->content);
                            $akismet->setPermalink(getmyurl('story', $link->id));
                            $akismet->submitSpam();
                        } elseif ($value == "notspam") {
                            if (isset($key)) {
                                $link_id = sanitize($key, 3);
                            } else {
                                $link_id = '';
                            }
                            $spam_links = get_misc_data('spam_links');
                            $spam_links = unserialize(get_misc_data('spam_links'));
                            $key = array_search($link_id, $spam_links);
                            unset($spam_links[$key]);
                            misc_data_update('spam_links', serialize($spam_links));
                            $link = new Link();
                            $link->id = $link_id;
                            $link->read(FALSE);
                            $link->status = 'queued';
                            $link->store();
                            $user = new User();
                            $user->id = $link->author;
                            $user->read();
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($link->content);
                            $akismet->setPermalink(getmyurl('story', $link->id));
                            $akismet->submitHam();
                        }
                    }
                }
            }
            header('Location: ' . URL_akismet . '&view=manageSpam');
        }
        if ($view == 'isSpamcomment') {
            if ($_GET['action'] == "bulkmod") {
                if (isset($_POST['submit'])) {
                    $spamcomment = array();
                    foreach ($_POST["spamcomment"] as $k => $v) {
                        $spamcomment[intval($k)] = $v;
                    }
                    foreach ($spamcomment as $key => $value) {
                        if ($value == "spamcomment") {
                            if (isset($key)) {
                                $link_id = sanitize($key, 3);
                            } else {
                                $link_id = '';
                            }
                            global $db;
                            $spam_comments = get_misc_data('spam_comments');
                            $spam_comments = unserialize(get_misc_data('spam_comments'));
                            $key = array_search($link_id, $spam_comments);
                            unset($spam_comments[$key]);
                            $sql_result = "Select * from " . table_prefix . "spam_comments where auto_id=" . $link_id;
                            $result_arr = $db->get_results($sql_result);
                            if ($result_arr) {
                                foreach ($result_arr as $result_arr_comments) {
                                    $link = new Link();
                                    $link->id = $result_arr_comments->linkid;
                                    $link->read();
                                    $user = new User();
                                    $user->id = $result_arr_comments->userid;
                                    $user->read();
                                    $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                                    $akismet->setCommentAuthor($user->username);
                                    $akismet->setCommentAuthorEmail($user->email);
                                    $akismet->setCommentAuthorURL($link->url);
                                    $akismet->setCommentContent($result_arr_comments->cmt_content);
                                    $akismet->setPermalink(getmyurl('story', $link->id));
                                    $akismet->submitSpam();
                                }
                            }
                            misc_data_update('spam_comments', serialize($spam_comments));
                            $db->query(' Delete from ' . table_prefix . 'spam_comments where auto_id=' . $link_id);
                        } elseif ($value == "notspamcomment") {
                            if (isset($key)) {
                                $link_id = sanitize($key, 3);
                            } else {
                                $link_id = '';
                            }
                            global $db;
                            $spam_comments = get_misc_data('spam_comments');
                            $spam_comments = unserialize(get_misc_data('spam_comments'));
                            $key = array_search($link_id, $spam_comments);
                            unset($spam_comments[$key]);
                            $sql_result = " Select * from " . table_prefix . "spam_comments where auto_id={$link_id}";
                            $result_arr = $db->get_results($sql_result);
                            if ($result_arr) {
                                foreach ($result_arr as $result_arr_comments) {
                                    $link = new Link();
                                    $link->id = $result_arr_comments->linkid;
                                    $link->read();
                                    $user = new User();
                                    $user->id = $result_arr_comments->userid;
                                    $user->read();
                                    $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                                    $akismet->setCommentAuthor($user->username);
                                    $akismet->setCommentAuthorEmail($user->email);
                                    $akismet->setCommentAuthorURL($link->url);
                                    $akismet->setCommentContent($result_arr_comments->cmt_content);
                                    $akismet->setPermalink(getmyurl('story', $link->id));
                                    $akismet->submitHam();
                                    $sql = "INSERT INTO " . table_comments . " (comment_parent, comment_user_id, comment_link_id , comment_date, comment_randkey, comment_content) VALUES ({$result_arr_comments->cmt_parent}, {$result_arr_comments->userid}, {$result_arr_comments->linkid}, now(), '{$result_arr_comments->cmt_rand}', '{$result_arr_comments->cmt_content}')";
                                    $db->query($sql);
                                }
                            }
                            misc_data_update('spam_comments', serialize($spam_comments));
                            $sql_delete = ' Delete from ' . table_prefix . 'spam_comments where auto_id=' . $link_id;
                            $db->query($sql_delete);
                            $link->adjust_comment(1);
                            $link->store();
                        }
                    }
                }
                header('Location: ' . URL_akismet . '&view=manageSpamcomments');
            }
        }
    }
}
Exemple #23
0
function akismet_showpage()
{
    global $main_smarty, $the_template, $current_user, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        $navwhere['text1'] = 'Akismet';
        $navwhere['link1'] = URL_akismet;
        define('pagename', 'akismet');
        $main_smarty->assign('pagename', pagename);
        define('modulename', 'akismet');
        $main_smarty->assign('modulename', modulename);
        if (isset($_REQUEST['view'])) {
            $view = sanitize($_REQUEST['view'], 3);
        } else {
            $view = '';
        }
        if ($view == '') {
            $wordpress_key = get_misc_data('wordpress_key');
            if ($wordpress_key == '') {
                header('Location: ' . URL_akismet . '&view=manageKey');
                die;
            }
            $main_smarty->assign('spam_links_count', akismet_get_link_count());
            $main_smarty->assign('spam_comments_count', akismet_get_comment_count());
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'main');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'updateKey') {
            if ($_REQUEST['key']) {
                $wordpress_key = sanitize($_REQUEST['key'], 3);
                // Verify key before save
                if (phpnum() >= 5) {
                    include akismet_lib_path . 'Akismet.class_5.php';
                    $akismet = new Akismet(my_base_url . my_pligg_base, $wordpress_key);
                    if (!$akismet->isKeyValid()) {
                        $main_smarty->assign('error', 1);
                    } else {
                        misc_data_update('wordpress_key', $wordpress_key);
                    }
                } else {
                    include akismet_lib_path . 'Akismet.class_4.php';
                    $akismet = new Akismet(my_base_url . my_pligg_base, $wordpress_key);
                    if (!$akismet->_isValidApiKey($wordpress_key)) {
                        $main_smarty->assign('error', 1);
                    } else {
                        misc_data_update('wordpress_key', $wordpress_key);
                    }
                }
            } else {
                $wordpress_key = '';
                misc_data_update('wordpress_key', $wordpress_key);
            }
            $view = 'manageKey';
        }
        if ($view == 'manageKey') {
            $wordpress_key = get_misc_data('wordpress_key');
            $main_smarty->assign('wordpress_key', $wordpress_key);
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageKey');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSpam') {
            $sql = "SELECT " . table_links . ".*, " . table_users . ".user_login FROM " . table_links . " \r\n\t\t\t\t\tLEFT JOIN " . table_users . " ON link_author=user_id \r\n\t\t\t\t\tLEFT JOIN " . table_prefix . "spam_links ON linkid=link_id\r\n\t\t\t\t\tWHERE !ISNULL(linkid)";
            $link_data = $db->get_results($sql);
            if (sizeof($link_data)) {
                $main_smarty->assign('link_data', object_2_array($link_data));
            } else {
                header("Location: " . my_pligg_base . "/admin/admin_index.php");
                //				header('Location: ' . URL_akismet);
                die;
            }
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpam');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSettings') {
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSettings');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSpamcomments') {
            $sql = "SELECT * FROM " . table_prefix . "spam_comments ";
            $link_data = $db->get_results($sql);
            if (sizeof($link_data)) {
                $user_cmt = new User();
                $user_cmt_link = new Link();
                $spam_output .= ' <form name="bulk_moderate" action="' . URL_akismet_isSpamcomment . '&action=bulkmod" method="post">';
                $spam_output .= '<table class="table table-bordered table-striped">';
                $spam_output .= "<thead>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th>Author</th>\r\n\t\t\t\t\t\t\t\t\t\t<th>Content</th>\r\n\t\t\t\t\t\t\t\t\t\t<th style='width:65px;text-align:center;'><input type='checkbox' name='all1' onclick='mark_all_spam();' style='display:none;'><a onclick='mark_all_spam();' style='cursor:pointer;text-decoration:none;'>Spam</a></th>\r\n\t\t\t\t\t\t\t\t\t\t<th style='width:80px;text-align:center;'><input type='checkbox' name='all2' onclick='mark_all_notspam();' style='display:none;'><a onclick='mark_all_notspam();' style='cursor:pointer;text-decoration:none;'>Not Spam</a></th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tbody>";
                foreach ($link_data as $spam_cmts) {
                    $user_cmt->id = $spam_cmts->userid;
                    $user_cmt->read();
                    $user_name = $user_cmt->username;
                    $user_cmt_link->id = $spam_cmts->linkid;
                    $user_cmt_link->read();
                    $spam_output .= "<tr>";
                    $spam_output .= "\t<td>" . $user_name . "</td>";
                    $spam_output .= "\t<td><a href='story.php?id=" . ($user_cmt_link->id = $spam_cmts->linkid . "'>" . save_text_to_html($spam_cmts->cmt_content) . "</a></td>");
                    $spam_output .= '	<td style="text-align:center;"><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="spamcomment"></td>';
                    $spam_output .= '	<td style="text-align:center;"><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="notspamcomment"></td>';
                    $spam_output .= "</tr>";
                }
                $spam_output .= "</tbody></table>";
                $spam_output .= '<p align="right" style="margin-top:10px;"><input type="submit" name="submit" value="Apply Changes" class="btn btn-default" /></p>';
                $spam_output .= "</form>";
                $main_smarty->assign('spam_output', $spam_output);
                $main_smarty->assign('link_data', object_2_array($link_data));
            } else {
                header("Location: " . my_pligg_base . "/admin/admin_index.php");
                //				header('Location: ' . URL_akismet);
                die;
            }
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpamcomments');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if (phpnum() >= 5) {
            include_once akismet_lib_path . 'Akismet.class_5.php';
        } else {
            include_once akismet_lib_path . 'Akismet.class_4.php';
        }
        if ($view == 'isSpam') {
            if ($_GET['action'] == "bulkmod") {
                if (isset($_POST['submit'])) {
                    $spam = array();
                    foreach ($_POST["spam"] as $k => $v) {
                        $spam[intval($k)] = $v;
                    }
                    foreach ($spam as $key => $value) {
                        if (isset($key)) {
                            $link_id = sanitize($key, 3);
                        } else {
                            continue;
                        }
                        $link = new Link();
                        $link->id = $link_id;
                        $link->read();
                        $user = new User();
                        $user->id = $link->author;
                        $user->read();
                        if (phpnum() < 5) {
                            $comment = array('author' => $user->username, 'email' => $user->email, 'website' => $link->url, 'body' => $link->content, 'permalink' => my_base_url . getmyurl('story', $link->id));
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'), $comment);
                        } else {
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($link->content);
                            $akismet->setPermalink(my_base_url . getmyurl('story', $link->id));
                        }
                        if ($value == "spam") {
                            $link->status = 'spam';
                            $link->store();
                            killspam($user->id);
                            $akismet->submitSpam();
                        } elseif ($value == "notspam") {
                            $link->status = 'new';
                            $link->store();
                            $akismet->submitHam();
                        }
                        $db->query("DELETE FROM " . table_prefix . "spam_links WHERE linkid={$link_id}");
                    }
                }
            }
            header('Location: ' . URL_akismet . '&view=manageSpam');
            die;
        }
        if ($view == 'isSpamcomment') {
            if ($_GET['action'] == "bulkmod") {
                if (isset($_POST['submit'])) {
                    $spamcomment = array();
                    foreach ($_POST["spamcomment"] as $k => $v) {
                        $spamcomment[intval($k)] = $v;
                    }
                    foreach ($spamcomment as $key => $value) {
                        if (isset($key)) {
                            $link_id = sanitize($key, 3);
                        } else {
                            continue;
                        }
                        $sql_result = "Select * from " . table_prefix . "spam_comments where auto_id=" . $link_id;
                        $result = $db->get_row($sql_result);
                        #print_r($result);
                        $link = new Link();
                        $link->id = $result->linkid;
                        $link->read();
                        $user = new User();
                        $user->id = $result->userid;
                        $user->read();
                        #print_r($user);
                        if (phpnum() < 5) {
                            $comment = array('author' => $user->username, 'email' => $user->email, 'website' => $link->url, 'body' => $result->cmt_content, 'permalink' => my_base_url . getmyurl('story', $link->id));
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'), $comment);
                        } else {
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($result->cmt_content);
                            $akismet->setPermalink(my_base_url . getmyurl('story', $link->id));
                        }
                        if ($value == "spamcomment") {
                            $akismet->submitSpam();
                        } elseif ($value == "notspamcomment") {
                            $akismet->submitHam();
                            $sql = "INSERT INTO " . table_comments . " (comment_parent, comment_user_id, comment_link_id , comment_date, comment_randkey, comment_content) VALUES ('{$result->cmt_parent}', '{$result->userid}', '{$result->linkid}', now(), '{$result->cmt_rand}', '{$result->cmt_content}')";
                            $db->query($sql);
                            #print $sql;
                        }
                        $link->adjust_comment(1);
                        $link->store();
                        $db->query(' Delete from ' . table_prefix . 'spam_comments where auto_id=' . $link_id);
                    }
                }
                header('Location: ' . URL_akismet . '&view=manageSpamcomments');
                die;
            }
        }
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
        die;
    }
}
function get_sidebar_tweets_settings()
{
    return array('sidebar_tweets_id' => get_misc_data('sidebar_tweets_id'), 'sidebar_tweets_num' => get_misc_data('sidebar_tweets_num'));
}
Exemple #25
0
function get_karma_settings()
{
    return array('submit_story' => get_misc_data('karma_submit_story'), 'submit_comment' => get_misc_data('karma_submit_comment'), 'story_publish' => get_misc_data('karma_story_publish'), 'story_vote' => get_misc_data('karma_story_vote'), 'story_vote_remove' => get_misc_data('karma_story_unvote'), 'comment_vote' => get_misc_data('karma_comment_vote'), 'story_discard' => get_misc_data('karma_story_discard'), 'story_spam' => get_misc_data('karma_story_spam'), 'comment_delete' => get_misc_data('karma_comment_delete'));
}
Exemple #26
0
<?php

$widget['widget_title'] = "Pligg News";
$widget['widget_has_settings'] = 1;
$widget['widget_shrink_icon'] = 1;
$widget['widget_uninstall_icon'] = 0;
$widget['name'] = 'Pligg News';
$widget['desc'] = 'The Pligg News widget displays the latest news items from the <a href="http://www.pligg.com/blog/" target="_blank">Pligg CMS Blog</a>.';
$widget['version'] = 0.1;
$news_count = get_misc_data('news_count');
if ($news_count <= 0) {
    $news_count = '3';
}
if ($_REQUEST['widget'] == 'pligg_news') {
    if (isset($_REQUEST['stories'])) {
        $news_count = sanitize($_REQUEST['stories'], 3);
    }
    misc_data_update('news_count', $news_count);
}
if ($main_smarty) {
    $main_smarty->assign('news_count', $news_count);
}
 $do_not_include_in_pages = array();
 $include_in_pages = array('module');
 if (do_we_load_module()) {
     $moduleName = $_REQUEST['module'];
     if ($moduleName == 'upload') {
         module_add_action('module_page', 'upload_showpage', '');
         include_once mnmmodules . 'upload/upload_main.php';
     }
 }
 $include_in_pages = array('all');
 if (do_we_load_module()) {
     include_once mnmmodules . 'upload/upload_main.php';
     module_add_action('lib_link_summary_fill_smarty', 'upload_track', '');
     module_add_action('admin_story_delete', 'upload_delete', '');
     $place = get_misc_data('upload_place');
     $fileplace = get_misc_data('upload_fileplace');
     module_add_action_tpl($place, upload_tpl_path . '/upload_thumb.tpl');
     module_add_action_tpl($fileplace, upload_tpl_path . '/upload_links.tpl');
     module_add_action_tpl('tpl_header_admin_main_links', upload_tpl_path . 'upload_admin_main_link.tpl');
 }
 $include_in_pages = array('submit', 'story');
 if (do_we_load_module()) {
     //		module_add_action('do_submit2', 'upload_do_submit2','');
     include_once mnmmodules . 'upload/upload_main.php';
     module_add_action_tpl('tpl_pligg_submit_step2_start', upload_tpl_path . '/upload_files.tpl');
     //        	module_add_action_tpl('submit_step_2_pre_extrafields', upload_tpl_path . '/upload_files.tpl');
 }
 $include_in_pages = array('editlink');
 if (do_we_load_module()) {
     module_add_action('edit_link_hook', 'upload_edit_link', '');
     include_once mnmmodules . 'upload/upload_main.php';
    $pos = strrpos($_SERVER["SCRIPT_NAME"], "/");
    $path = substr($_SERVER["SCRIPT_NAME"], 0, $pos);
    if ($path == "/") {
        $path = "";
    }
    if ($path != my_pligg_base) {
        define('lang_loc', '..');
    } else {
        define('lang_loc', '.');
    }
}
define('pligg_web_toolbar_lang_conf', lang_loc . '/modules/pligg_web_toolbar/lang.conf');
define('pligg_web_toolbar_pligg_lang_conf', lang_loc . "/languages/lang_" . pligg_language . ".conf");
// Path of folders used by module
define('pligg_web_toolbar_path', my_pligg_base . '/modules/pligg_web_toolbar/');
define('pligg_web_toolbar_tpl_path', '../modules/pligg_web_toolbar/templates/');
define('pligg_web_toolbar_img_path', my_pligg_base . '/modules/pligg_web_toolbar/images/');
define('URL_pligg_web_toolbar', 'module.php?module=pligg_web_toolbar');
$pligg_web_toolbar_enabled = get_misc_data('pligg_web_toolbar') == '' ? true : get_misc_data('pligg_web_toolbar');
$pligg_web_toolbar_enabled = $pligg_web_toolbar_enabled == 'enabled' ? true : false;
define('pligg_web_toolbar_enabled', $pligg_web_toolbar_enabled);
// don't touch anything past this line.
if (is_object($main_smarty)) {
    $main_smarty->assign('pligg_web_toolbar_path', pligg_web_toolbar_path);
    $main_smarty->assign('pligg_web_toolbar_lang_conf', pligg_web_toolbar_lang_conf);
    $main_smarty->assign('pligg_web_toolbar_pligg_lang_conf', pligg_web_toolbar_pligg_lang_conf);
    $main_smarty->assign('pligg_web_toolbar_tpl_path', pligg_web_toolbar_tpl_path);
    $main_smarty->assign('pligg_web_toolbar_img_path', pligg_web_toolbar_img_path);
    $main_smarty->assign('pligg_web_toolbar_enabled', pligg_web_toolbar_enabled);
    $main_smarty->assign('URL_pligg_web_toolbar', URL_pligg_web_toolbar);
}
 function store()
 {
     global $db, $current_user;
     // DB 09/03/08
     if (!is_numeric($this->id)) {
         return false;
     }
     /////
     $this->tags = stripslashes(sanitize($_POST['tags'], 4));
     $linkres->content = close_tags(stripslashes(sanitize($_POST['bodytext'], 4, $Story_Content_Tags_To_Allow)));
     $linkres->content = str_replace("\n", "<br />", $linkres->content);
     //$this->content = stripslashes(sanitize($_POST['bodytext'], 4, $Story_Content_Tags_To_Allow));
     $this->title = stripslashes(sanitize($_POST['title'], 4, $Story_Content_Tags_To_Allow));
     $this->category = $_POST['category'];
     //get link_group_id
     if (isset($_REQUEST['link_group_id']) && $_REQUEST['link_group_id'] != '') {
         $this->link_group_id = intval($_REQUEST['link_group_id']);
     } else {
         $this->link_group_id = 0;
     }
     $this->id = $_POST['sid'];
     $this->title_url = $this->id;
     $link_category = $this->category;
     $link_group_id = $db->escape($this->link_group_id);
     $link_author = $current_user->user_id;
     //	$EntryDate=$_SESSION['EntryDate'];
     //	$link_url_title = $db->escape($this->url_title);
     $link_title = $db->escape($this->title);
     $link_title_url = $db->escape($this->title_url);
     $link_tags = $db->escape($this->tags);
     $link_content = $linkres->content;
     $link_summary = $link_content;
     $Sid = $this->id;
     $wrapper_dir = get_misc_data('wrapper_directory');
     $htmlPath = $wrapper_dir . "{$Sid}.ktr";
     $link_url = $db->escape($this->url);
     $EntryDate = $datetime = date("Y-m-d H:i:s", mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')));
     $sql = "UPDATE " . table_prefix . "sourceinfo set Path='{$htmlPath}',Status='queued', Title='{$link_title}' WHERE Sid='{$Sid}';";
     $rs = $db->query($sql);
     //move temp file to uploads file
     if ($rs) {
         echo "success";
         $tmpDir = mnmpath . get_misc_data('temp_directory') . "{$Sid}.ktr";
         $newDir = mnmpath . get_misc_data('wrapper_directory') . "{$Sid}.ktr";
         rename($tmpDir, $newDir);
         if ($link_group_id > 0) {
             //$sql = "INSERT INTO " .table_prefix."links set newSid='$Sid',link_date='$EntryDate', link_summary='$link_summary', link_status='queued', link_category ='$link_category', link_content='$link_content', link_title='$link_title', link_tags='$link_tags', link_title_url='$link_title_url', link_url='$htmlPath';";
             $sql = "INSERT INTO " . table_prefix . "links (link_id,link_author,link_date, link_summary, link_status, link_category, link_content, link_title, link_tags, link_title_url, link_url, link_group_id) VALUES ('{$Sid}','{$link_author}','{$EntryDate}','{$link_summary}','private','{$link_category}','{$link_content}','{$link_title}','{$link_tags}','{$link_title_url}', '{$htmlPath}', '{$link_group_id}');";
             echo $sql;
             $r = $db->query($sql);
             if ($r) {
                 echo 'private success';
             }
         } else {
             //$sql = "INSERT INTO " .table_prefix."links set newSid='$Sid',link_date='$EntryDate', link_summary='$link_summary', link_status='queued', link_category ='$link_category', link_content='$link_content', link_title='$link_title', link_tags='$link_tags', link_title_url='$link_title_url', link_url='$htmlPath';";
             $sql = "INSERT INTO " . table_prefix . "links (link_id,link_author,link_date, link_summary, link_status, link_category, link_content, link_title, link_tags, link_title_url, link_url, link_group_id) VALUES ('{$Sid}','{$link_author}','{$EntryDate}','{$link_summary}','queued','{$link_category}','{$link_content}','{$link_title}','{$link_tags}','{$link_title_url}', '{$htmlPath}', '{$link_group_id}');";
             echo $sql;
             $r = $db->query($sql);
             if ($r) {
                 echo 'public success';
             } else {
                 echo 'failed';
             }
         }
     }
 }
<?php

$widget['widget_title'] = "New Products";
$widget['widget_has_settings'] = 1;
$widget['widget_shrink_icon'] = 0;
$widget['widget_uninstall_icon'] = 0;
$widget['name'] = 'New Products';
$widget['desc'] = 'This widget displays the latest products available in the Pligg Pro Shop';
$widget['version'] = 0.1;
$product_count = get_misc_data('product_count');
if ($product_count <= 0) {
    $product_count = '3';
}
if ($_REQUEST['widget'] == 'pligg_products') {
    if (isset($_REQUEST['products'])) {
        $product_count = sanitize($_REQUEST['products'], 3);
    }
    misc_data_update('product_count', $product_count);
}
if ($main_smarty) {
    $main_smarty->assign('product_count', $product_count);
}