function hello_world_showpage()
{
    global $main_smarty, $the_template, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        define('pagename', 'hello_world');
        $main_smarty->assign('pagename', pagename);
        // Method for identifying modules rather than pagename
        define('modulename', 'hello_world');
        $main_smarty->assign('modulename', modulename);
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $main_smarty->display(hello_world_tpl_path . '/blank.tpl');
        $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_hello_world_BreadCrumb');
        $navwhere['link2'] = URL_hello_world;
        $navwhere['text3'] = '';
        $navwhere['link3'] = '';
        $navwhere['text4'] = '';
        $navwhere['link4'] = '';
        $main_smarty = do_sidebar($main_smarty);
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        $main_smarty->assign('tpl_center', hello_world_tpl_path . 'hello_world_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
function multibox_admin_showpage()
{
    global $main_smarty, $the_template, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        define('pagename', 'multibox_admin');
        $main_smarty->assign('pagename', pagename);
        define('modulename', 'multibox_admin');
        $main_smarty->assign('modulename', modulename);
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $main_smarty->display(multibox_admin_tpl_path . '/blank.tpl');
        $main_smarty = do_sidebar($main_smarty);
        $sql = "SELECT * FROM " . table_totals;
        $results = $db->get_results($sql);
        $main_smarty->assign('results', object_2_array($results));
        if (isset($_REQUEST['action'])) {
            $main_smarty->assign('action', $_REQUEST['action']);
            totals_regenerate();
            $sql = "SELECT * FROM " . table_totals;
            $results = $db->get_results($sql);
            $main_smarty->assign('new_results', object_2_array($results));
        }
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        $main_smarty->assign('tpl_center', multibox_admin_tpl_path . 'multibox_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        echo "Page Forbidden";
    }
}
function sendannouncement_showpage()
{
    // Method for identifying modules rather than pagename
    define('modulename', 'send_announcement');
    // $main_smarty->assign('modulename', modulename);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 0) {
        header("Location: " . my_base_url . my_pligg_base);
        die;
    }
    global $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    // breadcrumbs
    $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
    $navwhere['link1'] = getmyurl('admin', '');
    $navwhere['text2'] = "Send Announcement";
    $main_smarty->assign('navbar_where', $navwhere);
    $main_smarty->assign('posttitle', "Send Annoucement");
    // breadcrumbs
    $main_smarty->assign('tpl_center', send_announcement_tpl_path . 'sendannouncement');
    $main_smarty->display($the_template . '/pligg.tpl');
}
Beispiel #4
0
function captcha_showpage()
{
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        global $main_smarty, $the_template;
        $navwhere['text1'] = 'Captcha';
        $navwhere['link1'] = URL_captcha;
        define('pagename', 'captcha');
        $main_smarty->assign('pagename', pagename);
        // New method for identifying modules rather than pagename
        define('modulename', 'captcha');
        $main_smarty->assign('modulename', modulename);
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        if (isset($_REQUEST['action'])) {
            $action = $_REQUEST['action'];
        } else {
            $action = '';
        }
        if ($action == 'enable') {
            if (isset($_REQUEST['captcha'])) {
                $captcha = $_REQUEST['captcha'];
            } else {
                $captcha = '';
            }
            enable_captcha($captcha);
        }
        if ($action == 'configure') {
            if (isset($_REQUEST['captcha'])) {
                $captcha = $_REQUEST['captcha'];
            } else {
                $captcha = '';
            }
            include_once captcha_captchas_path . '/' . $captcha . '/main.php';
            captcha_configure();
            $main_smarty->assign('tpl_center', captcha_tpl_path . '../captchas/' . $captcha . '/captcha_configure');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
            die;
        }
        if ($action == 'EnableReg') {
            $value = isset($_REQUEST['value']) ? $_REQUEST['value'] : '';
            if ($value != '') {
                misc_data_update('captcha_reg_en', $value);
            }
            header('Location: ' . URL_captcha);
        }
        $captcha = get_misc_data('captcha_method');
        if ($captcha == '') {
            $captcha = 'recaptcha';
        }
        $main_smarty->assign('captcha_method', $captcha);
        $main_smarty->assign('tpl_center', captcha_tpl_path . '/captcha_home');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    }
}
Beispiel #5
0
function karma_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        // Save settings
        if ($_POST['submit']) {
            misc_data_update('karma_submit_story', sanitize($_REQUEST['karma_submit_story'], 3));
            misc_data_update('karma_submit_comment', sanitize($_REQUEST['karma_submit_comment'], 3));
            misc_data_update('karma_story_publish', sanitize($_REQUEST['karma_story_publish'], 3));
            misc_data_update('karma_story_vote', sanitize($_REQUEST['karma_story_vote'], 3));
            misc_data_update('karma_story_unvote', sanitize($_REQUEST['karma_story_vote_remove'], 3));
            misc_data_update('karma_comment_vote', sanitize($_REQUEST['karma_comment_vote'], 3));
            misc_data_update('karma_story_discard', sanitize($_REQUEST['karma_story_discard'], 3));
            misc_data_update('karma_story_spam', sanitize($_REQUEST['karma_story_spam'], 3));
            misc_data_update('karma_comment_delete', sanitize($_REQUEST['karma_comment_delete'], 3));
            if ($_REQUEST['karma_username'] && $_REQUEST['karma_value'] != 0) {
                $db->query($sql = "UPDATE " . table_users . " SET user_karma=user_karma+'" . $db->escape($_REQUEST['karma_value']) . "' WHERE user_login='******'karma_username']) . "'");
                if (!$db->rows_affected) {
                    $error = "Wrong username " . sanitize($_REQUEST['karma_username'], 1);
                }
            }
            $main_smarty->assign('error', $error);
        }
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify Karma";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=karma";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'karma');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modify_karma');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', str_replace('"', '"', get_karma_settings()));
        $main_smarty->assign('tpl_center', karma_tpl_path . 'karma_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
function close_comments_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        if ($_POST['submit']) {
            $_REQUEST = str_replace('"', "'", $_REQUEST);
            $close_comment_method = trim($_REQUEST['close_comment_method']);
            $close_comment_time = trim($_REQUEST['close_comment_time']);
            if ($close_comment_method == 'time') {
                misc_data_update('close_comment_method', mysql_real_escape_string($close_comment_method));
            } elseif ($close_comment_method == 'manual') {
                misc_data_update('close_comment_method', mysql_real_escape_string($close_comment_method));
            } elseif ($close_comment_method == 'both') {
                misc_data_update('close_comment_method', mysql_real_escape_string($close_comment_method));
            } else {
                $main_smarty->assign('module_error', "Method POST data did not contain an expected value");
            }
            if (is_numeric($close_comment_time)) {
                misc_data_update('close_comment_time', mysql_real_escape_string($close_comment_time));
            } else {
                $main_smarty->assign('module_error', "Time POST data did not contain a numerical value. Please give the second field a value of 0 or higher.");
            }
        }
        // breadcrumbs
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'close_comments');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'close_comments_settings');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', get_close_comments_settings());
        $main_smarty->assign('tpl_center', close_comments_tpl_path . 'close_comments_settings');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
Beispiel #7
0
function zip_install_preview_admin()
{
    global $main_smarty, $the_template, $db, $my_pligg_base;
    force_authentication();
    $amIgod = 0;
    $amIgod = $amIgod + checklevel('admin');
    if ($amIgod == 1) {
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $main_smarty->display(zip_install_tpl_path . '/blank.tpl');
        $navwhere['text2'] = 'ZIP Install';
        $navwhere['link2'] = my_pligg_base . '/module.php?module=zip_install';
        $navwhere['text3'] = '';
        $navwhere['link3'] = '';
        $navwhere['text4'] = '';
        $navwhere['link4'] = '';
        $main_smarty = do_sidebar($main_smarty);
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        $action = $_REQUEST['action'];
        switch ($action) {
            case "modules":
                $main_smarty->assign('tpl_center', zip_install_tpl_path . 'zip_install_modules');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
                break;
            case "templates":
                $main_smarty->assign('tpl_center', zip_install_tpl_path . 'zip_install_templates');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
                break;
            case "filemod":
                if (uploadFile(zip_install_absolute_path, $_FILES, "modules")) {
                    redirect(my_pligg_base . '/admin/admin_modules.php?status=uninstalled');
                }
                break;
            case "filetem":
                if (uploadFile(zip_install_absolute_path, $_FILES, "templates")) {
                    redirect(my_pligg_base . '/admin/admin_config.php?page=Template');
                }
                break;
            default:
                $main_smarty->assign('tpl_center', zip_install_tpl_path . 'zip_install');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
                break;
        }
    }
}
Beispiel #8
0
function contactable_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        if ($_POST['submit']) {
            $_REQUEST = str_replace('"', "'", $_REQUEST);
            $contactable_input = $_REQUEST['contactable_mail'];
            $result = filter_var($contactable_input, FILTER_VALIDATE_EMAIL);
            // Checking if the email is valid. Returns 'false' if not valid.
            if (!$result) {
                // Email is not valid
                $msg = "Error! Your email address does not appear to be valid.";
            } else {
                // Add email address to database field
                misc_data_update('contactable_mail', mysql_real_escape_string($contactable_input));
            }
        }
        // breadcrumbs
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        define('modulename', 'contactable');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_contactable');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('msg', $msg);
        // Error messages
        $main_smarty->assign('contactable', get_contactable_settings());
        $main_smarty->assign('tpl_center', contactable_tpl_path . 'settings');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
function pligg_web_toolbar_showpage()
{
    global $main_smarty, $the_template, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        define('pagename', 'pligg_web_toolbar');
        $main_smarty->assign('pagename', pagename);
        // Method for identifying modules rather than pagename
        define('modulename', 'pligg_web_toolbar');
        $main_smarty->assign('modulename', modulename);
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_pligg_web_toolbar_BreadCrumb');
        $navwhere['link2'] = URL_pligg_web_toolbar;
        $navwhere['text3'] = '';
        $navwhere['link3'] = '';
        $navwhere['text4'] = '';
        $navwhere['link4'] = '';
        if (isset($_REQUEST['action'])) {
            $action = $_REQUEST['action'];
        } else {
            $action = '';
        }
        if ($action == 'enable') {
            enable_pligg_web_toolbar();
        }
        if ($action == 'disable') {
            disable_pligg_web_toolbar();
        }
        $main_smarty = do_sidebar($main_smarty);
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        $main_smarty->assign('tpl_center', pligg_web_toolbar_tpl_path . 'pligg_web_toolbar_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
function spam_trigger_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        // Save settings
        if ($_POST['submit']) {
            misc_data_update('spam_trigger_light', sanitize($_REQUEST['spam_light'], 3));
            misc_data_update('spam_trigger_medium', sanitize($_REQUEST['spam_medium'], 3));
            misc_data_update('spam_trigger_hard', sanitize($_REQUEST['spam_hard'], 3));
            header("Location: " . my_pligg_base . "/module.php?module=spam_trigger");
            die;
        }
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify spam_trigger";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=spam_trigger";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        define('modulename', 'spam_trigger');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifyspam_trigger');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', str_replace('"', '"', get_spam_trigger_settings()));
        $main_smarty->assign('places', $spam_trigger_places);
        $main_smarty->assign('tpl_center', spam_trigger_tpl_path . 'spam_trigger_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
Beispiel #11
0
function analytics_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        if ($_POST['submit']) {
            $_REQUEST = str_replace('"', "'", $_REQUEST);
            $analytics_input = substr($_REQUEST['analytics_id'], 0, 14);
            // Shorten input to 14 characters (max length of Analytics IDs)
            if (strlen($analytics_input) > '14') {
                $msg = "Error! The value entered was more than 14 characters in length. Please try again.";
            }
            misc_data_update('analytics_id', mysql_real_escape_string($analytics_input));
        }
        // breadcrumbs
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        define('modulename', 'analytics');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_analytics');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('msg', $msg);
        // Error messages
        $main_smarty->assign('settings', get_analytics_settings());
        $main_smarty->assign('tpl_center', analytics_tpl_path . 'settings');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
function links_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        if ($_POST['submit']) {
            misc_data_update('links_comments', sanitize($_REQUEST['links_comments'], 3));
            misc_data_update('links_stories', sanitize($_REQUEST['links_stories'], 3));
            misc_data_update('links_nofollow', sanitize($_REQUEST['links_nofollow'], 3));
            misc_data_update('links_host', sanitize($_REQUEST['links_host'], 3));
            header("Location: " . my_pligg_base . "/module.php?module=links");
            die;
        }
        // breadcrumbs
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'links');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifylinks');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', links_settings());
        $main_smarty->assign('tpl_center', links_tpl_path . 'links_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
Beispiel #13
0
function group_print_summary($requestID)
{
    global $db, $main_smarty, $the_template;
    if (!is_numeric($requestID)) {
        die;
    }
    $index = 0;
    $group = $db->get_row("SELECT group_id,group_creator, group_status, group_members, group_date, group_name, group_safename, group_description, group_privacy, group_avatar FROM " . table_groups . " WHERE group_id = {$requestID}");
    if ($group) {
        $group_id = $group->group_id;
        $group_name = $group->group_name;
        $group_safename = $group->group_safename;
        $group_description = $group->group_description;
        $group_creator = $group->group_creator;
        $group_status = $group->group_status;
        $group_members = $group->group_members;
        $group_date = $group->group_date;
        $group_privacy = $group->group_privacy;
        $group_avatar = $group->group_avatar;
        //$group_date = date('M j, Y', $group->group_date);
        $date = $db->get_var(" SELECT DATE_FORMAT(group_date, '%b, %e %Y') from " . table_groups . " WHERE group_id = {$group->group_id}");
        //echo $date;
        $group_date = $date;
        //smarty variables
        $main_smarty->assign('group_id', $group_id);
        $main_smarty->assign('group_name', $group_name);
        $main_smarty->assign('group_safename', $group_safename);
        $main_smarty->assign('group_description', $group_description);
        $main_smarty->assign('group_creator', $group_creator);
        $main_smarty->assign('group_status', $group_status);
        $main_smarty->assign('group_members', $group_members);
        $main_smarty->assign('group_privacy', $group_privacy);
        $main_smarty->assign('group_avatar', $group_avatar);
        $main_smarty->assign('group_date', $group_date);
        //get group avatar path
        if ($group_avatar == "uploaded" && file_exists(mnmpath . "avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg")) {
            $imgsrc = my_base_url . my_pligg_base . "/avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg";
        } else {
            $imgsrc = my_base_url . my_pligg_base . "/templates/" . $the_template . "/img/group_large.gif";
        }
        $main_smarty->assign('imgsrc', $imgsrc);
        //get group creator and his url
        $g_name = get_group_username($group_creator);
        $main_smarty->assign('group_submitter', $g_name);
        $submitter_profile_url = getmyurl('user', $g_name);
        $main_smarty->assign('submitter_profile_url', $submitter_profile_url);
        $main_smarty->assign('group_avatar_url', getmyurl('group_avatar', $group_id));
        //check group admin
        global $current_user;
        if ($current_user->user_id == $group_creator) {
            $main_smarty->assign('is_group_admin', 1);
        }
        //language
        $lang_Created_By = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_By");
        $lang_Created_On = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_On");
        $lang_Member = $main_smarty->get_config_vars("PLIGG_Visual_Group_Member");
        //check member
        //include_once(mnminclude.'group.php');
        $main_smarty->assign('is_group_member', isMember($group_id));
        // Joining and unjoining member links
        // Set the url to an empty string if the user has already joined the maximum
        // allowable number of groups
        if (reached_max_joinable_groups($db, $current_user)) {
            $join_url = '';
        } else {
            $join_url = getmyurl("join_group", $group_id);
        }
        $main_smarty->assign('join_group_url', $join_url);
        $main_smarty->assign('unjoin_group_url', getmyurl("unjoin_group", $group_id));
        //check logged or not
        $main_smarty->assign('user_logged_in', $current_user->user_login);
        //sidebar
        $main_smarty = do_sidebar($main_smarty);
        //$main_smarty->assign('form_action', $_SERVER["PHP_SELF"]);
        $group_story_url = getmyurl("group_story_title", $group_safename);
        $main_smarty->assign('group_story_url', $group_story_url);
        $group_edit_url = getmyurl("editgroup", $group_id);
        $group_delete_url = getmyurl("deletegroup", $group_id);
        $group_output .= $main_smarty->fetch(The_Template . '/group_summary.tpl');
        $index++;
    }
    return $group_output;
}
Beispiel #14
0
function featured_showpage()
{
    global $db, $main_smarty, $the_template;
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        // breadcrumbs
        define('modulename', 'featured');
        $main_smarty->assign('modulename', modulename);
        $action = $_REQUEST['action'];
        switch ($action) {
            case "addfeatured":
                if ($_POST['submit'] != null) {
                    $title_safe = addslashes($_POST['featured_link_title']);
                    $description_safe = addslashes($_POST['featured_description']);
                    $info['featured_link_id'] = $_POST['featured_link_id'];
                    $info['featured_link_title'] = $title_safe;
                    $info['featured_description'] = $description_safe;
                    $info['featured_enabled'] = $_POST['status'];
                    if ($_FILES['image']['type'] != null) {
                        $image_type = explode("/", $_FILES['image']['type']);
                    }
                    $image_name = $_FILES['image']['name'];
                    $image_tmp = $_FILES['image']['tmp_name'];
                    // Checking featured ID Exists Or Not
                    if (is_numeric($info['featured_link_id']) == true) {
                        $featured_check = "SELECT featured_link_id FROM " . table_prefix . "featured WHERE featured_link_id=" . $info['featured_link_id'] . "";
                        $result = $db->query($featured_check);
                        $featured_check2 = "SELECT link_id FROM " . table_prefix . "links WHERE link_id=" . $info['featured_link_id'];
                        $result2 = $db->query($featured_check2);
                    }
                    if ($info['featured_link_id'] == null) {
                        $err = "Featured ID must not be left blank!";
                    } else {
                        if (is_numeric($info['featured_link_id']) == false) {
                            $err = "Featured ID must be an integer.";
                        } else {
                            if ($result != null) {
                                $err = "The Featured ID you entered aleady exists in the database.";
                            } else {
                                if ($result2 == null) {
                                    $err = "The Featured ID you entered doesn't match any existing news in the database.";
                                } else {
                                    if ($info['featured_link_title'] == null) {
                                        $err = "Featured Title must not be left blank!";
                                    } else {
                                        if ($info['featured_description'] == null) {
                                            $err = "Featured Description must not be left blank!";
                                        } else {
                                            if ($image_name == null) {
                                                $err = "You must upload an image file to go along with your featured news item!";
                                            } else {
                                                if ($image_type['0'] != 'image') {
                                                    $err = "You must upload an <strong>image file</strong> for the featured image.";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if ($err) {
                        $main_smarty->assign('err', $err);
                    } else {
                        $handle = fopen($image_tmp, "r");
                        $contents = fread($handle, filesize($image_tmp));
                        $info['featured_image'] = addslashes($contents);
                        $featured_insert = "INSERT INTO " . table_prefix . "featured SET ";
                        foreach ($info as $key => $value) {
                            $featured_insert .= $key . "=" . "'" . $value . "'" . ",";
                        }
                        $featured_insert = substr($featured_insert, 0, strlen($featured_insert) - 1);
                        $db->query($featured_insert);
                        $main_smarty->assign('msg', 'Featured News successfully added!');
                    }
                }
                $main_smarty->assign('tpl_center', featured_tpl_path . 'featured_add');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
                break;
            case "editfeatured":
                $featured_id = $_REQUEST['id'];
                $featured_sql = "SELECT * FROM " . table_prefix . "featured WHERE featured_id=" . $featured_id . "";
                $featured_news = $db->get_results($featured_sql);
                $featured_news = object_2_array($featured_news);
                if ($_POST['submit'] != null) {
                    $title_safe = addslashes($_POST['featured_link_title']);
                    $description_safe = addslashes($_POST['featured_description']);
                    $info['featured_link_id'] = $_POST['featured_link_id'];
                    $info['featured_link_title'] = $title_safe;
                    $info['featured_description'] = $description_safe;
                    $info['featured_enabled'] = $_POST['status'];
                    if ($_FILES['image']['type'] != null) {
                        $image_type = explode("/", $_FILES['image']['type']);
                    }
                    $image_name = $_FILES['image']['name'];
                    $image_tmp = $_FILES['image']['tmp_name'];
                    // Checking featured ID Exists Or Not
                    if (is_numeric($info['featured_link_id']) == true && $info['featured_link_id'] != $featured_news['0']['featured_link_id']) {
                        $featured_check = "SELECT * FROM " . table_prefix . "featured WHERE featured_link_id=" . $info['featured_link_id'] . "";
                        $result = $db->query($featured_check);
                    }
                    if (is_numeric($info['featured_link_id']) == true) {
                        $featured_check2 = "SELECT link_id FROM " . table_prefix . "links WHERE link_id=" . $info['featured_link_id'];
                        $result2 = $db->query($featured_check2);
                    }
                    if ($info['featured_link_id'] == null) {
                        $err = "Featured ID must not be left blank!";
                    } else {
                        if (is_numeric($info['featured_link_id']) == false) {
                            $err = "You must enter an integer for the Featured ID.";
                        } else {
                            if ($info['featured_link_title'] == null) {
                                $err = "Featured Title must not be left blank!";
                            } else {
                                if ($info['featured_description'] == null) {
                                    $err = "Featured Description must not be left blank!";
                                } else {
                                    if ($result2 == null) {
                                        $err = "The Featured ID you entered doesn't match any existing news in the database.";
                                    } else {
                                        if ($image_name != null) {
                                            if ($image_type['0'] != 'image') {
                                                $err = "You must upload an <strong>image file</strong> as the featured image.";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if ($err) {
                        $main_smarty->assign('err', $err);
                    } else {
                        if ($image_name != null) {
                            $handle = fopen($image_tmp, "r");
                            $contents = fread($handle, filesize($image_tmp));
                            $info['featured_image'] = addslashes($contents);
                        }
                        $featured_edit = "UPDATE " . table_prefix . "featured SET ";
                        foreach ($info as $key => $value) {
                            $featured_edit .= $key . "=" . "'" . $value . "'" . ",";
                        }
                        $featured_edit = substr($featured_edit, 0, strlen($featured_edit) - 1);
                        $featured_edit .= " WHERE featured_id=" . $featured_id . "";
                        $db->query($featured_edit);
                        $main_smarty->assign('msg', 'Featured news successfully edited.');
                    }
                }
                $query_edit = "SELECT * FROM " . table_prefix . "featured WHERE featured_id=" . $featured_id;
                $news = $db->get_results($query_edit);
                $news = object_2_array($news);
                $main_smarty->assign('news', $news);
                $main_smarty->assign('tpl_center', featured_tpl_path . 'featured_edit');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
                break;
            case "manage_news":
                if ($_GET['delete'] != null) {
                    $id = $_GET['id'];
                    $del_query = "DELETE FROM " . table_prefix . "featured WHERE featured_id=" . $id . "";
                    $db->query($del_query);
                    $main_smarty->assign('msg', 'Featured news successfully deleted.');
                }
                $sql = "SELECT * FROM " . table_prefix . "featured ORDER BY featured_id DESC";
                $news = $db->get_results($sql);
                $news = object_2_array($news);
                $main_smarty->assign('news', $news);
                $main_smarty->assign('tpl_center', featured_tpl_path . 'featured_admin');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
                break;
            case "view_image":
                $id = $_REQUEST['id'];
                $sql = "SELECT featured_image FROM " . table_prefix . "featured WHERE featured_id=" . $id . "";
                $news = $db->get_results($sql);
                $news = object_2_array($news);
                ob_end_clean();
                ob_start();
                header("Content-type: image/jpeg");
                echo $news[0]['featured_image'];
                exit;
                break;
            default:
                $sql = "SELECT * FROM " . table_prefix . "featured ORDER BY featured_id DESC";
                $news = $db->get_results($sql);
                $news = object_2_array($news);
                $main_smarty->assign('news', $news);
                $main_smarty->assign('tpl_center', featured_tpl_path . 'featured_admin');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
                break;
        }
    } else {
        $action = $_REQUEST['action'];
        switch ($action) {
            case "view_image":
                $id = $_REQUEST['id'];
                $sql = "SELECT featured_image FROM " . table_prefix . "featured WHERE featured_id=" . $id . "";
                $news = $db->get_results($sql);
                $news = object_2_array($news);
                ob_end_clean();
                ob_start();
                header("Content-type: image/jpeg");
                echo $news[0]['featured_image'];
                ob_end_flush();
                exit;
                break;
        }
    }
}
$navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
$navwhere['link1'] = getmyurl('admin', '');
$navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_2');
$navwhere['link2'] = my_pligg_base . "/admin_categories.php";
$main_smarty->assign('navbar_where', $navwhere);
$main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
// breadcrumbs
$canIhaveAccess = 0;
$canIhaveAccess = $canIhaveAccess + checklevel('god');
if ($canIhaveAccess == 1) {
    // clear the category sidebar module from the cache so it can regenerate in case we make changes
    $main_smarty->cache = 2;
    $main_smarty->cache_dir = "cache";
    $main_smarty->clear_cache();
    $main_smarty->cache = false;
    $smarty = do_sidebar($smarty);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_name', 'key' => 'category__auto_id');
    // a unique identifier for the row
    $smarty->assign('qeip_CatName', $QEIPA);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_parent', 'key' => 'category__auto_id');
    // a unique identifier for the row
    $smarty->assign('qeip_CatParent', $QEIPA);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_order', 'key' => 'category__auto_id');
    // a unique identifier for the row
    $smarty->assign('qeip_CatOrder', $QEIPA);
    $QEIP = new QuickEIP();
    rebuild_the_tree();
    ordernew();
    //display_the_tree_table();
    // put the category tree into an array for use in the qeip dropdown
    if (isset($_REQUEST['action'])) {
function auto_update_showpage()
{
    global $db, $main_smarty, $the_template, $template_dir;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    include_once "archive.php";
    // Create mysql backup
    if ($_GET['download'] == 'mysql') {
        set_time_limit(0);
        require "auto_update_backup.php";
        $b = new MysqlBackup($_GET['type'] == 'zip' ? '' : $_GET['type']);
        $tmpfname = $b->backup();
        header('Content-Description: File Transfer');
        header('Pragma: no-cache');
        header('Content-Type: application/force-download');
        header('Cache-Control: no-cache, must-revalidate');
        header("Content-Disposition: attachment; filename=pligg_db_backup_" . date("Y_m_d") . ".sql" . ($_GET['type'] == 'gzip' ? '.gz' : ($_GET['type'] == 'zip' ? '.zip' : '')));
        if ($_GET['type'] == 'zip') {
            $test = new zip_file(tempnam('/tmp', ''));
            $test->set_options(array('inmemory' => 1, 'storepaths' => 0));
            $test->add_files(array($tmpfname));
            $test->create_archive();
            print $test->archive;
        } else {
            readfile($tmpfname);
            unlink($tmpfname);
        }
        exit;
    } elseif ($_GET['download'] == 'files') {
        set_time_limit(0);
        $tmpfname = tempnam('/tmp', '');
        if ($_GET['type'] == 'gzip') {
            $test = new gzip_file($tmpfname);
            $test->set_options(array('inmemory' => 1, 'basedir' => "./", 'overwrite' => 1, 'level' => 1));
        } else {
            $test = new zip_file($tmpfname);
            $test->set_options(array('inmemory' => 1, 'recurse' => 1, 'storepaths' => 1));
        }
        $test->add_files("*");
        $test->exclude_files("./cache/*");
        $test->create_archive();
        // Check for errors (you can check for errors at any point)
        if (count($test->errors) > 0) {
            print "Errors occurred.";
        }
        // Process errors here
        header('Content-Description: File Transfer');
        header('Pragma: no-cache');
        header('Content-Type: application/force-download');
        header('Cache-Control: no-cache, must-revalidate');
        header("Content-Disposition: attachment; filename=pligg_backup_" . date("Y_m_d") . ($_GET['type'] == 'gzip' ? '.tar.gz' : '.zip'));
        // Send archive to user for download
        print $test->archive;
        exit;
    }
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        // breadcrumbs
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'status');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifystatus');
        $main_smarty->assign('pagename', pagename);
        if ($_GET['step'] == 2) {
            $main_smarty->assign('gzip', function_exists('gzopen'));
            $main_smarty->assign('zip', class_exists('ZipArchive', FALSE));
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step2');
        } elseif ($_GET['step'] == 3) {
            $_SESSION['upload_files'] = array();
            $main_smarty->assign('exists', !file_exists(mnmpath . "latest.zip") ? 'disabled' : '');
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step3');
        } elseif ($_GET['step'] == 4) {
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step4');
        } elseif ($_GET['step'] == 5) {
            $main_smarty->assign('upgrade_exists', file_exists('install/upgrade.php'));
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step5');
        } elseif ($_GET['step'] == 6) {
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step6');
        } else {
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_main');
        }
        list($yourversion, $latestversion) = auto_update_detect_version();
        $main_smarty->assign('yourversion', $yourversion);
        $main_smarty->assign('latestversion', $latestversion);
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
        die;
    }
}
Beispiel #17
0
function phpbb_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        if ($_POST['submit']) {
            misc_data_update('phpbb_db', sanitize($_REQUEST['phpbb_db'], 3));
            misc_data_update('phpbb_user', sanitize($_REQUEST['phpbb_user'], 3));
            misc_data_update('phpbb_pass', sanitize($_REQUEST['phpbb_pass'], 3));
            misc_data_update('phpbb_host', sanitize($_REQUEST['phpbb_host'], 3));
            misc_data_update('phpbb_group', sanitize($_REQUEST['phpbb_group'], 3));
            misc_data_update('phpbb_cookie_name', sanitize($_REQUEST['cookie_name'], 3));
            misc_data_update('phpbb_cookie_path', sanitize($_REQUEST['cookie_path'], 3));
            misc_data_update('phpbb_cookie_domain', sanitize($_REQUEST['cookie_domain'], 3));
            misc_data_update('phpbb_cookie_secure', sanitize($_REQUEST['cookie_secure'], 3));
            header("Location: " . my_pligg_base . "/module.php?module=phpbb");
            die;
        }
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify Snippet";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=phpbb";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'phpbb');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifyphpbb');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', get_settings());
        $main_smarty->assign('tpl_center', phpbb_tpl_path . 'phpbb_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
function template_management_showpage()
{
    // Method for identifying modules
    define('modulename', 'template_management');
    global $main_smarty, $the_template, $db;
    $main_smarty->assign('modulename', modulename);
    include_once mnminclude . 'admin_config.php';
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        if (isset($_REQUEST['action'])) {
            $action = sanitize($_REQUEST['action'], 3);
        } else {
            $action = '';
        }
        if (isset($_REQUEST['template'])) {
            $template = sanitize($_REQUEST['template'], 3);
        } else {
            $template = '';
        }
        if (isset($_REQUEST['version'])) {
            $version = sanitize($_REQUEST['version'], 3);
        } else {
            $version = '';
        }
        if (isset($_REQUEST['path'])) {
            $download_path = sanitize($_REQUEST['path'], 3);
        } else {
            $download_path = '';
        }
        if (is_writable('./templates')) {
            $can_write = true;
        } else {
            $can_write = false;
        }
        $main_smarty->assign('can_write_to_template_folder', $can_write);
        if ($action == "down_and_ext") {
            $url = "http://www.pligg.com/PackedTemplates/download.php?template=" . $template;
            $r = new HTTPRequest($url);
            $new_url = $r->DownloadToString();
            $msg = template_management_download($new_url);
            $x = explode('/', str_replace('.tar', '', $new_url));
            $filename = '/' . $x[count($x) - 2] . '_template.tar';
            $msg = template_management_unpack($filename);
        }
        if ($action == "viewonline") {
            $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
            $navwhere['link1'] = getmyurl('admin', '');
            $main_smarty->display(template_management_tpl_path . '/blank.tpl');
            $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Template_Management_BreadCrumb');
            $navwhere['link2'] = URL_template_management;
            define('pagename', 'template_management');
            $main_smarty->assign('pagename', pagename);
            $main_smarty->assign('navbar_where', $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty = do_sidebar($main_smarty);
            $main_smarty->assign('tpl_center', template_management_tpl_path . 'template_management_viewonline');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($action == "setDefault") {
            $config = new pliggconfig();
            $config->var_id = 52;
            $config->var_value = $template;
            $config->store(false);
            header('Location: module.php?module=template_management');
        }
        if ($action == "pack") {
            if (is_dir('./templates/' . $template)) {
                $msg = template_management_pack($template, $version);
            } else {
                $msg = 'Error, invalid template.';
            }
        }
        if ($action == "unpack") {
            $msg = template_management_unpack($template);
        }
        if ($action == "download") {
            $msg = template_management_download($download_path);
        }
        if ($action == "delete") {
            $msg = template_management_delete($template);
        }
        if ($action == "deletePacked") {
            $msg = template_management_delete_packed($template);
        }
        if (!isset($msg)) {
            $msg = '';
        }
        $main_smarty->assign('msg', $msg);
        // find out what template is currently installed
        $config = new pliggconfig();
        $config->var_id = 52;
        $config->read();
        $current_template = $config->var_value;
        $main_smarty->assign('current_template', $current_template);
        // find out what templates are available
        $template_folders = array();
        $default_template_details = array();
        // the default template
        $available_template_details = array();
        // templates installed and available for use
        $incompatible_template_details = array();
        // templates that are not marked as compatible
        $extracted_templates = array();
        // packed templates that are found to be already extracted
        $packed_templates = array();
        // packed templates, havn't checked to see if extracted or not
        if ($handle = opendir('./templates')) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != ".." && $file != ".svn") {
                    if (!is_dir('./templates/' . $file)) {
                        if (strpos($file, 'template.tar') > 0) {
                            $packed_templates[$file] = $file;
                        }
                    }
                }
            }
            closedir($handle);
        }
        if ($handle = opendir('./templates')) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != ".." && $file != ".svn") {
                    if (is_dir('./templates/' . $file)) {
                        if (file_exists('./templates/' . $file . '/template_details.php')) {
                            $template_folders[] = $file;
                            $details = template_management_read_details($file);
                            $details['folder'] = $file;
                            $details['can_install'] = true;
                            $details['URL_pack'] = 'module.php?module=template_management&action=pack&template=' . $details['folder'] . '&version=' . $details['version'];
                            // if this is the default yget template, don't allow it to be packed or unpacked
                            // we don't want to break the default template in any way.
                            if ($file == 'yget') {
                                $details['allow_pack_and_unpack'] = false;
                            } else {
                                $details['allow_pack_and_unpack'] = true;
                            }
                            $tmp_file = '/templates/' . $details['folder'] . '_template.tar';
                            if (file_exists('.' . $tmp_file)) {
                                $details['is_packed'] = my_pligg_base . $tmp_file;
                                $extracted_templates[$file] = $tmp_file;
                                $f = $details['folder'] . '_template.tar';
                                if (isset($packed_templates[$f])) {
                                    unset($packed_templates[$f]);
                                }
                            } else {
                                $details['is_packed'] = 0;
                            }
                            if ($current_template == $file) {
                                $default_template_details[$file] = $details;
                            } else {
                                if ($details['designed_for_pligg_version'] != pligg_version()) {
                                    $details['can_install'] = false;
                                    $incompatible_template_details[$file] = $details;
                                } else {
                                    $available_template_details[$file] = $details;
                                }
                            }
                        }
                    }
                }
            }
            closedir($handle);
        }
        $main_smarty->assign('template_folders', $template_folders);
        $main_smarty->assign('default_template_details', $default_template_details);
        $main_smarty->assign('available_template_details', $available_template_details);
        $main_smarty->assign('incompatible_template_details', $incompatible_template_details);
        $main_smarty->assign('packed_templates', $packed_templates);
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $main_smarty->display(template_management_tpl_path . '/blank.tpl');
        $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Template_Management_BreadCrumb');
        $navwhere['link2'] = URL_template_management;
        define('pagename', 'template_management');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        $main_smarty = do_sidebar($main_smarty);
        $main_smarty->assign('tpl_center', template_management_tpl_path . 'template_management_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        echo "not for you.";
    }
}
function simple_messaging_showpage()
{
    global $main_smarty, $the_template, $current_user, $db;
    // Method for identifying modules rather than pagename
    define('modulename', 'simple_messaging');
    $main_smarty->assign('modulename', modulename);
    if (isset($_REQUEST['view'])) {
        $view = sanitize($_REQUEST['view'], 3);
    } else {
        $view = '';
    }
    $navwhere['text1'] = 'Messaging';
    $navwhere['link1'] = URL_simple_messaging_inbox;
    if ($view == 'inbox') {
        define('modulename_sm', 'simple_messaging_inbox');
        $main_smarty->assign('modulename_sm', modulename_sm);
        $message = new KMessaging(true);
        $array = $message->GetAllMessages(5, $current_user->user_id);
        if (is_array($array)) {
            $message_count = count($array);
            $main_smarty->assign('messages', $message_count);
            foreach ($array as $key => $val) {
                $user = new User();
                $user->id = $array[$key]['sender'];
                if (!$user->read()) {
                    echo "Message Error 2";
                    die;
                }
                $array[$key]['sender_name'] = $user->username;
                $user = "";
            }
            $main_smarty->assign('msg_array', $array);
            if ($_GET['action'] == "bulkmod") {
                if (isset($_POST['submit'])) {
                    $message = array();
                    foreach ($_POST["message"] as $k => $v) {
                        $message[intval($k)] = $v;
                    }
                    $m = new KMessaging(true);
                    foreach ($message as $key => $value) {
                        if ($value == "delete") {
                            $result = $m->DeleteMessage($key, 2);
                            //							$db->query('DELETE FROM `' . table_messages . '` WHERE `idMsg` = "'.$key.'"');
                        }
                    }
                    header("Location: " . my_pligg_base . "/module.php?module=simple_messaging&view=inbox");
                    die;
                }
            }
        }
        $main_smarty->assign('user_url_friends', getmyurl('user_friends', $login, 'following'));
        $main_smarty->assign('user_url_friends2', getmyurl('user_friends', $login, 'followers'));
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        $main_smarty->assign('posttitle', "Inbox");
        define('modulepage', 'simple_messaging_inbox');
        $main_smarty->assign('modulepage', modulepage);
        $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'inbox');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == 'sent') {
        define('modulename_sm', 'simple_messaging_sent');
        $main_smarty->assign('modulename_sm', modulename_sm);
        define('modulepage', 'simple_messaging_sent');
        $message = new KMessaging(true);
        $array = $message->GetAllMessages(5, '', $current_user->user_id);
        if (is_array($array)) {
            $message_count = count($array);
            $main_smarty->assign('messages', $message_count);
            foreach ($array as $key => $val) {
                $user = new User();
                $user->id = $array[$key]['receiver'];
                if (!$user->read()) {
                    echo "Message Error 3";
                    die;
                }
                $array[$key]['sender_name'] = $user->username;
                $user = "";
            }
        } else {
            $array = '';
        }
        $main_smarty->assign('msg_array', $array);
        if ($_GET['action'] == "bulkmod") {
            if (isset($_POST['submit'])) {
                $message = array();
                foreach ($_POST["message"] as $k => $v) {
                    $message[intval($k)] = $v;
                }
                $m = new KMessaging(true);
                foreach ($message as $key => $value) {
                    if ($value == "delete") {
                        $result = $m->DeleteMessage($key, 1);
                    }
                }
                header("Location: " . my_pligg_base . "/module.php?module=simple_messaging&view=sent");
                die;
            }
        }
        $main_smarty->assign('user_url_friends', getmyurl('user_friends', $login, 'following'));
        $main_smarty->assign('user_url_friends2', getmyurl('user_friends', $login, 'followers'));
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        $main_smarty->assign('posttitle', "Inbox");
        define('modulepage', 'simple_messaging_sentbox');
        $main_smarty->assign('modulepage', modulepage);
        $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'sent');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == 'compose') {
        define('modulename_sm', 'simple_messaging_compose');
        $main_smarty->assign('modulename_sm', modulename_sm);
        if (isset($_REQUEST['return'])) {
            $return = sanitize($_REQUEST['return'], 3);
        } else {
            $return = '';
        }
        $main_smarty->assign('return', $return);
        if (isset($_REQUEST['to'])) {
            $msgToName = sanitize($_REQUEST['to'], 3);
        } else {
            $msgToName = '';
        }
        $main_smarty->assign('msgToName', $msgToName);
        if ($msgToName == '') {
            die('error, invalid to');
        }
        $main_smarty->assign('user_url_friends', getmyurl('user_friends', $login, 'following'));
        $main_smarty->assign('user_url_friends2', getmyurl('user_friends', $login, 'followers'));
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        $main_smarty->assign('posttitle', "Inbox");
        define('modulepage', 'simple_messaging_compose');
        $main_smarty->assign('modulepage', modulepage);
        $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'compose');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == 'send') {
        define('modulename_sm', 'simple_messaging_send');
        $main_smarty->assign('modulename_sm', modulename_sm);
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        $main_smarty->assign('posttitle', "Inbox");
        define('modulepage', 'simple_messaging_error');
        $main_smarty->assign('modulepage', modulepage);
        if (isset($_REQUEST['return'])) {
            $return = html_entity_decode(urldecode(sanitize($_REQUEST['return'], 3)));
        } else {
            $return = '';
        }
        if (isset($_REQUEST['msg_subject'])) {
            $msg_subject = sanitize($_REQUEST['msg_subject'], 3);
        } else {
            $msg_subject = '';
        }
        if (isset($_REQUEST['msg_body'])) {
            $msg_body = sanitize($_REQUEST['msg_body'], 3);
        } else {
            $msg_body = '';
        }
        if (isset($_REQUEST['msg_to'])) {
            $msg_to = sanitize($_REQUEST['msg_to'], 3);
        } else {
            $msg_to = '';
        }
        $user_to = new User();
        $user_to->username = $msg_to;
        if (!$user_to->read()) {
            $main_smarty->assign('message', 'The person you are trying to send a message to does not exist!');
            $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'error');
            $main_smarty->display($the_template . '/pligg.tpl');
            die;
        }
        $msg_to_ID = $user_to->id;
        $msg_from_ID = $current_user->user_id;
        $message = new KMessaging(true);
        $msg_result = $message->SendMessage($msg_subject, $msg_body, $msg_from_ID, $msg_to_ID, 0);
        if ($msg_result != 0) {
            $main_smarty->config_load(simple_messaging_lang_conf);
            //print 'PLIGG_MESSAGING_Error_'.$msg_result;
            //print $main_smarty->get_config_vars('PLIGG_MESSAGING_Error_'.$msg_result);
            $main_smarty->assign('message', $main_smarty->get_config_vars('PLIGG_MESSAGING_Error_' . $msg_result));
            $main_smarty->config_load(simple_messaging_pligg_lang_conf);
            $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'error');
            $main_smarty->display($the_template . '/pligg.tpl');
            die;
        } else {
            // The message has been put in the database successfully, so let's alert the recipient by email:
            $email_to = $db->get_var("SELECT user_email FROM `" . table_users . "` WHERE `user_id` = '{$user_to->id}';");
            $email_from = $db->get_var("SELECT user_login FROM `" . table_users . "` WHERE `user_id` = '{$current_user->user_id}';");
            $email_subject = "You've got a message in your " . $main_smarty->get_config_vars("PLIGG_Visual_Name") . " inbox";
            $email_message = "Hi " . $user_to->username . ",\r\n\r\nYou've been sent a private message from " . $email_from . ". \r\n\r\nTo see the message, go to your " . $main_smarty->get_config_vars("PLIGG_Visual_Name") . " inbox here: " . my_base_url . URL_simple_messaging_inbox . "\r\n\r\nThank you, \r\n" . $main_smarty->get_config_vars("PLIGG_Visual_Name") . " Admin";
            $email_headers = "From: " . Send_From_Email . "\r\nReply-To: " . Send_From_Email . "\r\n";
            @mail($email_to, $email_subject, $email_message, $email_headers);
            // show 'message sent', click to continue or wait 5..4..3..2..1.. then redirect
            header('Location: ' . $return);
            die;
        }
    }
    if ($view == "viewmsg") {
        define('modulename_sm', 'simple_messaging_viewmsg');
        $main_smarty->assign('modulename_sm', modulename_sm);
        if (isset($_REQUEST['msg_id'])) {
            $msg_id = sanitize($_REQUEST['msg_id'], 3);
        } else {
            $msg_id = '';
        }
        $main_smarty->assign('msg_id', $msg_id);
        $array = messaging_get_message_details($msg_id);
        $main_smarty->assign('msg_array', $array);
        $main_smarty->assign('js_reply', "lightbox_do_on_activate('view_message~!~action=reply~!~replyID=" . $array['id'] . "~!~view=small_msg_compose~!~login="******"');");
        $main_smarty->assign('js_delete', "lightbox_do_on_activate('view_message~!~view=small_msg_confirm_delete~!~msgid=" . $array['id'] . "');");
        $main_smarty->assign('user_url_friends', getmyurl('user_friends', $login, 'following'));
        $main_smarty->assign('user_url_friends2', getmyurl('user_friends', $login, 'followers'));
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        $main_smarty->assign('posttitle', "Inbox");
        define('modulepage', 'viewmsg');
        $main_smarty->assign('modulepage', modulepage);
        $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'show_message');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == "viewsentmsg") {
        define('modulename_sm', 'simple_messaging_viewsentmsg');
        $main_smarty->assign('modulename_sm', modulename_sm);
        if (isset($_REQUEST['msg_id'])) {
            $msg_id = sanitize($_REQUEST['msg_id'], 3);
        } else {
            $msg_id = '';
        }
        $main_smarty->assign('msg_id', $msg_id);
        $array = messaging_get_message_details($msg_id);
        $main_smarty->assign('msg_array', $array);
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        $main_smarty->assign('posttitle', "Inbox");
        define('modulepage', 'viewsentmsg');
        $main_smarty->assign('modulepage', modulepage);
        $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'show_sent_message');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == "delmsg") {
        define('modulename_sm', 'simple_messaging_delmsg');
        $main_smarty->assign('modulename_sm', modulename_sm);
        if (isset($_REQUEST['msg_id'])) {
            $msg_id = sanitize($_REQUEST['msg_id'], 3);
        } else {
            $msg_id = '';
        }
        $array = messaging_get_message_details($msg_id);
        $message = new KMessaging(true);
        $result = $message->DeleteMessage($msg_id);
        header('Location: ' . URL_simple_messaging_inbox);
        die;
    }
    if ($view == "reply") {
        define('modulename_sm', 'simple_messaging_reply');
        $main_smarty->assign('modulename_sm', modulename_sm);
        if (isset($_REQUEST['msg_id'])) {
            $msg_id = sanitize($_REQUEST['msg_id'], 3);
        } else {
            $msg_id = '';
        }
        $main_smarty->assign('msg_id', $msg_id);
        $array = messaging_get_message_details($msg_id);
        $main_smarty->assign('msgToName', $array['sender_name']);
        $main_smarty->assign('msg_subject', 're: ' . $array['title']);
        $main_smarty->assign('return', URL_simple_messaging_viewmsg . $msg_id);
        $main_smarty->assign('user_url_friends', getmyurl('user_friends', $login, 'following'));
        $main_smarty->assign('user_url_friends2', getmyurl('user_friends', $login, 'followers'));
        $main_smarty = do_sidebar($main_smarty, $navwhere);
        $main_smarty->assign('posttitle', "Inbox");
        define('modulepage', 'reply');
        $main_smarty->assign('modulepage', modulepage);
        $main_smarty->assign('tpl_center', simple_messaging_tpl_path . 'compose');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
}
function admin_snippet_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify Snippet";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=admin_snippet";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        //Method for identifying modules rather than pagename
        define('modulename', 'admin_snippet');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifysnippet');
        $main_smarty->assign('pagename', pagename);
        // Add new snippet
        if ($_REQUEST['mode'] == 'new') {
            if ($_POST['submit']) {
                // Check some data
                if (!$_POST['snippet_name']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Name");
                } elseif (!$_POST['snippet_content']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Content");
                } else {
                    $snippet_name = $db->escape(sanitize($_POST['snippet_name'], 4));
                    $snippet_location = $db->escape(sanitize($_POST['snippet_location'], 4));
                    $snippet_content = $db->escape($_POST['snippet_content']);
                    $db->query("INSERT INTO " . table_prefix . "snippets (snippet_name,snippet_location,snippet_updated,snippet_order,snippet_content) \r\n\t\t\t\t\t\t   VALUES ('{$snippet_name}','{$snippet_location}',NOW(),'1','{$snippet_content}')");
                    header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                    die;
                }
            }
            $main_smarty->assign('tpl_center', admin_snippet_tpl_path . 'admin_snippet_edit');
            // Edit snippet
        } elseif ($_REQUEST['mode'] == 'edit') {
            if ($_POST['submit']) {
                // Check some data
                if (!$_POST['snippet_name']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Name");
                } elseif (!$_POST['snippet_content']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Content");
                } elseif (!is_numeric($_POST['snippet_id'])) {
                    $main_smarty->assign('snippet_error', "Wrong ID");
                } else {
                    $snippet_id = $_POST['snippet_id'];
                    $snippet_name = $db->escape(sanitize($_POST['snippet_name'], 4));
                    $snippet_location = $db->escape(sanitize($_POST['snippet_location'], 4));
                    $snippet_content = $db->escape($_POST['snippet_content']);
                    $db->query("UPDATE " . table_prefix . "snippets SET snippet_name='{$snippet_name}', snippet_location='{$snippet_location}', snippet_content='{$snippet_content}', snippet_updated=NOW() WHERE snippet_id='{$snippet_id}'");
                    header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                    die;
                }
            }
            // Check ID
            if (!is_numeric($_GET['id'])) {
                header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                die;
            } else {
                $snippet = $db->get_row("SELECT * FROM " . table_prefix . "snippets WHERE snippet_id={$_GET['id']}");
                if (!$snippet->snippet_id) {
                    header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                    die;
                }
                $main_smarty->assign("snippet", (array) $snippet);
            }
            $main_smarty->assign('tpl_center', admin_snippet_tpl_path . 'admin_snippet_edit');
            // Delete selected
        } elseif (isset($_POST['delete'])) {
            if (sizeof($_POST["snippet_delete"])) {
                $db->query("DELETE FROM " . table_prefix . "snippets WHERE snippet_id IN(" . join(",", array_keys($_POST["snippet_delete"])) . ")");
            }
            header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
            die;
            // Update orders
        } elseif (isset($_POST['update'])) {
            if (sizeof($_POST["snippet_order"])) {
                foreach ($_POST["snippet_order"] as $k => $v) {
                    if (is_numeric($k) && is_numeric($v)) {
                        $db->query("UPDATE " . table_prefix . "snippets SET snippet_order='{$v}' WHERE snippet_id='{$k}'");
                    }
                }
            }
            header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
            die;
            // Display the list
        } else {
            $filtered = $db->get_results("SELECT * FROM " . table_prefix . "snippets ORDER BY snippet_location, snippet_order");
            if ($filtered) {
                foreach ($filtered as $dbfiltered) {
                    $template_snippets[] = (array) $dbfiltered;
                }
                $main_smarty->assign('template_snippets', $template_snippets);
            }
            $main_smarty->assign('tpl_center', admin_snippet_tpl_path . 'admin_snippet_main');
        }
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        echo "Access denied";
    }
}
Beispiel #21
0
if ($link->status != 'published') {
    $globals['do_vote_queue'] = true;
}
if (!empty($link->tags)) {
    $globals['tags'] = $link->tags;
}
do_header($link->title, 'post');
// Show the error if the comment couldn't be inserted
if (!empty($new_comment_error)) {
    echo '<script type="text/javascript">';
    echo '$(function(){alert(\'' . _('comentario no insertado') . ":  {$new_comment_error}" . '\')});';
    echo '</script>';
}
do_banner_top();
echo '<div id="container">' . "\n";
do_sidebar(false);
echo '<div id="contents">';
do_tabs("main", _('noticia'), true);
$link->print_summary();
switch ($tab_option) {
    case 1:
    case 2:
        echo '<div class="comments">';
        // AdSense
        do_banner_story();
        // Print tabs
        print_story_tabs($tab_option);
        // If option is "normal comments", show also last trackbakcs and pingbacks
        if ($tab_option == 1) {
            $trackbacks = $db->get_col("SELECT trackback_id FROM trackbacks WHERE trackback_link_id={$link->id} AND trackback_type='in' and trackback_status = 'ok' ORDER BY trackback_date DESC limit 10");
            if ($trackbacks) {
Beispiel #22
0
function rss_import_showpage()
{
    global $main_smarty, $the_template, $db;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    require_once 'class.rssimport.php';
    require_once 'modules/rss_import/magpierss/rss_fetch.inc';
    define('MAGPIE_CACHE_DIR', 'cache/templates_c/');
    define('rss_import_export_version', '0.4');
    $smarty = $main_smarty;
    include_once mnminclude . 'qeip_0_3.php';
    force_authentication();
    $amIgod = 0;
    $amIgod = $amIgod + checklevel('god');
    // pagename
    define('modulename', 'rss_import');
    $main_smarty->assign('modulename', modulename);
    // breadcrumbs and page title
    $navwhere['text1'] = $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
    $navwhere['link1'] = getmyurl('admin', '');
    $navwhere['text2'] = $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_RSSImport');
    $smarty->assign('navbar_where', $navwhere);
    $smarty->assign('posttitle', ' / ' . $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_RSSImport'));
    // sidebar
    $main_smarty = do_sidebar($main_smarty);
    if ($amIgod == 1) {
        $tableexists = checkfortable(table_prefix . 'feeds');
        if (!$tableexists) {
            echo "Creating Tables<hr />";
            include_once 'create_feed_tables.php';
            die("<hr />If there are no errors then refresh this page to continue");
        }
        $filename = 'create_feed_tables.php';
        if (file_exists($filename)) {
            // die("Please delete or rename the file create_feed_tables.php, then refresh this page");
        }
        $smarty->register_function('feedsListFeeds', 'smarty_function_feedsListFeeds');
        $smarty->register_function('feedsListFeedLinks', 'smarty_function_feedsListFeedLinks');
        $smarty->register_function('feedsListFeedFields', 'smarty_function_feedsListFeedFields');
        $smarty->register_function('feedsListPliggLinkFields', 'smarty_function_feedsListPliggLinkFields');
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_name', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedName', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_url', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedURL', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_category', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedCategory', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_freq_hours', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedFreqHours', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_votes', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedVotes', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_item_limit', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedItemLimit', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_url_dupe', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedURLDupe', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_title_dupe', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedTitleDupe', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_submitter', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedSubmitter', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'feed_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
        // the type of EIP field to show
        $smarty->assign('qeip_FeedLink_FeedField', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'pligg_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
        // the type of EIP field to show
        $smarty->assign('qeip_FeedLink_PliggField', $QEIPA);
        // feed oldest first
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_last_item_first', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedLastItemFirst', $QEIPA);
        // feed random vote
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_enable', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedRandomVoteEnable', $QEIPA);
        // feed random vote min
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_min', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedRandomVotesMin', $QEIPA);
        // feed random vote max
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_max', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedRandomVotesMax', $QEIPA);
        $QEIP = new QuickEIP();
        if (!isset($_REQUEST['action'])) {
            $smarty->assign('tpl_center', rss_import_tpl_path . 'admin_rss_center');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
            echo $QEIP->ShowOnloadJS();
        } else {
            if ($_REQUEST['action'] == "addnewfieldlink") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
                $RSSImport->new_field_link();
                redirect('module.php?module=rss_import&action=editfeed&feed_id=' . $_REQUEST['FeedLinkId']);
            }
            if ($_REQUEST['action'] == "dropfieldlink") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
                $RSSImport->drop_field_link();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "addnewfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedName = "New Feed";
                $RSSImport->new_feed();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "dropfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $RSSImport->drop_feed();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "save") {
                echo $QEIP->save_field($smarty);
            }
            if ($_REQUEST['action'] == "examinefeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $RSSImport->read_feed();
                $rss = fetch_rss($RSSImport->FeedURL);
                $z = $rss->items[0];
                if ($z) {
                    echo 'First item in the feed.<hr />';
                    print_r_html($z);
                    echo '<hr />Feed dump.<hr />';
                    print_r_html($rss);
                } else {
                    echo '<hr />There are no items in this feed<hr />';
                }
            }
            if ($_REQUEST['action'] == "editfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $smarty->assign('tpl_center', rss_import_tpl_path . 'admin_rss_center2');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
            }
            if ($_REQUEST['action'] == "exportfeed") {
                echo 'copy all the text in the box<br />';
                echo '<textarea rows=10 cols=70>' . serialize_feed($_REQUEST['feed_id']) . '</textarea>';
                echo '<br /><br /><a href = "module.php?module=rss_import">return to the rss importer</a>';
            }
            if ($_REQUEST['action'] == "importprebuiltfeed_go") {
                $feed = stripslashes($_REQUEST['prebuiltfeed']);
                if (strpos($feed, '://') < 10) {
                    $r = new HTTPRequest($feed);
                    $feed = $r->DownloadToString();
                }
                if (import_prebuilt($feed)) {
                    redirect(my_pligg_base . '/module.php?module=rss_import');
                } else {
                    // what do we do if error?
                }
            }
        }
        //echo $QEIP->ShowOnloadJS();
    }
}
Beispiel #23
0
function group_print_summary($requestID)
{
    global $db, $main_smarty, $the_template;
    if (!is_numeric($requestID)) {
        die;
    }
    $index = 0;
    $group = $db->get_row("SELECT group_id,group_creator, group_status, group_members, group_date, group_name, group_safename, group_description, group_privacy, group_avatar FROM " . table_groups . " WHERE group_id = {$requestID}");
    if ($group) {
        $group_id = $group->group_id;
        $group_name = $group->group_name;
        $group_safename = $group->group_safename;
        $group_description = $group->group_description;
        $group_creator = $group->group_creator;
        $group_status = $group->group_status;
        $group_members = $group->group_members;
        $group_date = $group->group_date;
        $group_privacy = $group->group_privacy;
        $group_avatar = $group->group_avatar;
        //$group_date = date('M j, Y', $group->group_date);
        $date = $db->get_var(" SELECT DATE_FORMAT(group_date, '%b, %e %Y') from " . table_groups . " WHERE group_id = {$group->group_id}");
        //echo $date;
        $group_date = $date;
        //smarty variables
        $main_smarty->assign('group_id', $group_id);
        $main_smarty->assign('group_name', $group_name);
        $main_smarty->assign('group_safename', $group_safename);
        $main_smarty->assign('group_description', $group_description);
        $main_smarty->assign('group_creator', $group_creator);
        $main_smarty->assign('group_status', $group_status);
        $main_smarty->assign('group_privacy', $group_privacy);
        $main_smarty->assign('group_avatar', $group_avatar);
        $main_smarty->assign('group_date', $group_date);
        //get group avatar path
        if ($group_avatar == "uploaded") {
            $imgsrc = my_base_url . my_pligg_base . "/avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg";
        } else {
            $imgsrc = my_base_url . my_pligg_base . "/templates/" . $the_template . "/images/group_large.gif";
        }
        $main_smarty->assign('imgsrc', $imgsrc);
        //get group creator and his url
        $g_name = get_group_username($group_creator);
        $main_smarty->assign('group_submitter', $g_name);
        //$main_smarty->assign('submitter_profile_url', getmyurl('user', $g_name));
        $submitter_profile_url = getmyurl('user', $g_name);
        $main_smarty->assign('group_avatar_url', getmyurl('group_avatar', $group_id));
        //check group admin
        global $current_user;
        if ($current_user->user_id == $group_creator) {
            $main_smarty->assign('is_group_admin', 1);
        }
        //language
        $lang_Created_By = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_By");
        $lang_Created_On = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_On");
        $lang_Member = $main_smarty->get_config_vars("PLIGG_Visual_Group_Member");
        //check member
        //include_once(mnminclude.'group.php');
        $main_smarty->assign('is_group_member', isMember($group_id));
        //joinig unjoining member link
        $main_smarty->assign('join_group_url', getmyurl("join_group", $group_id));
        $main_smarty->assign('unjoin_group_url', getmyurl("unjoin_group", $group_id));
        //check logged or not
        $main_smarty->assign('user_logged_in', $current_user->user_login);
        //sidebar
        $main_smarty = do_sidebar($main_smarty);
        //$main_smarty->assign('form_action', $_SERVER["PHP_SELF"]);
        $group_story_url = getmyurl("group_story_title", $group_safename);
        $group_edit_url = getmyurl("editgroup", $group_id);
        $group_delete_url = getmyurl("deletegroup", $group_id);
        $group_output .= '<div class ="group_container">
			<div class ="group_left">
				<span>
					<img src="' . $imgsrc . '" alt="group_avatar" />
				</span>
			</div>
			<div class ="group_right">
				<div class="toptitle"><a href="' . $group_story_url . '">' . $group_name . '</a></div>
				<span class ="ls_created_by">' . $lang_Created_By . ' </span>
				<a href="' . $submitter_profile_url . '">' . $g_name . '</a> ' . $lang_Created_On . ' ' . $group_date . '<br/>
				' . $group_description . '<br/>
				' . $lang_Member . ' : ' . $group_members . ($group_status == 'disable' ? "<br><button onclick='document.location=\"?approve={$group_id}\"'>Approve</button>" : "") . '
			</div>
		</div>';
        $index++;
    }
    return $group_output;
}
function admin_snippet_showpage()
{
    global $db, $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify Snippet";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=admin_snippet";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " | " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        //Method for identifying modules rather than pagename
        define('modulename', 'admin_snippet');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifysnippet');
        $main_smarty->assign('pagename', pagename);
        // Add new snippet
        if ($_REQUEST['mode'] == 'new') {
            if ($_POST['submit']) {
                // Check some data
                if (!$_POST['snippet_name']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Name");
                } elseif (!$_POST['snippet_content']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Content");
                } else {
                    $snippet_name = $db->escape(sanitize($_POST['snippet_name'], 4));
                    $snippet_location = $db->escape(sanitize($_POST['snippet_location'], 4));
                    $snippet_content = $db->escape($_POST['snippet_content']);
                    $db->query("INSERT INTO " . table_prefix . "snippets (snippet_name,snippet_location,snippet_updated,snippet_order,snippet_content) \r\n\t\t\t\t\t\t   VALUES ('{$snippet_name}','{$snippet_location}',NOW(),'1','{$snippet_content}')");
                    header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                    die;
                }
            }
            $main_smarty->assign('tpl_center', admin_snippet_tpl_path . 'admin_snippet_edit');
            // Edit snippet
        } elseif ($_REQUEST['mode'] == 'edit') {
            if ($_POST['submit']) {
                // Check some data
                if (!$_POST['snippet_name']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Name");
                } elseif (!$_POST['snippet_content']) {
                    $main_smarty->assign('snippet_error', "Please specify Snippet Content");
                } elseif (!is_numeric($_POST['snippet_id'])) {
                    $main_smarty->assign('snippet_error', "Wrong ID");
                } else {
                    $snippet_id = $_POST['snippet_id'];
                    $snippet_name = $db->escape(sanitize($_POST['snippet_name'], 4));
                    $snippet_location = $db->escape(sanitize($_POST['snippet_location'], 4));
                    $snippet_content = $db->escape($_POST['snippet_content']);
                    $db->query("UPDATE " . table_prefix . "snippets SET snippet_name='{$snippet_name}', snippet_location='{$snippet_location}', snippet_content='{$snippet_content}', snippet_updated=NOW() WHERE snippet_id='{$snippet_id}'");
                    header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                    die;
                }
            }
            // Check ID
            if (!is_numeric($_GET['id'])) {
                header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                die;
            } else {
                $snippet = $db->get_row("SELECT * FROM " . table_prefix . "snippets WHERE snippet_id={$_GET['id']}");
                if (!$snippet->snippet_id) {
                    header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                    die;
                }
                $main_smarty->assign("snippet", (array) $snippet);
            }
            $main_smarty->assign('tpl_center', admin_snippet_tpl_path . 'admin_snippet_edit');
            // Export selected
        } elseif (isset($_POST['export'])) {
            if (sizeof($_POST["snippet_delete"])) {
                header('Content-Description: File Transfer');
                header('Pragma: no-cache');
                header('Cache-Control: no-cache, must-revalidate');
                header("Content-Disposition: attachment; filename=admin_snippet.xml");
                header("Content-type: text/xml; charset=utf-8");
                echo "<?xml version=\"1.0\"?>\r\n";
                echo "<data>\r\n";
                $snippets = $db->get_results("SELECT * FROM " . table_prefix . "snippets WHERE snippet_id IN(" . join(",", array_keys($_POST["snippet_delete"])) . ")", ARRAY_A);
                foreach ($snippets as $snippet) {
                    echo "\t<snippet>\r\n";
                    echo "\t\t<name><![CDATA[" . htmlspecialchars($snippet['snippet_name'], ENT_QUOTES, 'UTF-8') . "]]></name>\r\n";
                    echo "\t\t<location>{$snippet['snippet_location']}</location>\r\n";
                    echo "\t\t<content><![CDATA[" . htmlspecialchars($snippet['snippet_content'], ENT_QUOTES, 'UTF-8') . "]]></content>\r\n";
                    echo "\t</snippet>\r\n";
                }
                echo "</data>\r\n";
                die;
            }
            header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
            die;
            // Delete selected
        } elseif (isset($_POST['delete'])) {
            if (sizeof($_POST["snippet_delete"])) {
                $db->query("DELETE FROM " . table_prefix . "snippets WHERE snippet_id IN(" . join(",", array_keys($_POST["snippet_delete"])) . ")");
            }
            header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
            die;
            // Update orders
        } elseif (isset($_POST['update'])) {
            if (sizeof($_POST["snippet_order"])) {
                foreach ($_POST["snippet_order"] as $k => $v) {
                    if (is_numeric($k) && is_numeric($v)) {
                        $db->query("UPDATE " . table_prefix . "snippets SET snippet_order='{$v}' WHERE snippet_id='{$k}'");
                    }
                }
            }
            header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
            die;
            // Display the list
        } else {
            // Import snippets
            if ($_REQUEST['import']) {
                if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {
                    $xml = file_get_contents($_FILES["file"]["tmp_name"]);
                    if (preg_match_all('/<snippet>(.+?)<\\/snippet>/is', $xml, $m)) {
                        $array = $m[1];
                        if (sizeof($array)) {
                            foreach ($array as $snippet) {
                                if (preg_match('/<name>(<!\\[CDATA\\[)?(.+?)(\\]\\]>)?<\\/name>/is', $snippet, $m)) {
                                    $snippet_name = $db->escape($m[2]);
                                }
                                if (preg_match('/<location>(.+?)<\\/location>/is', $snippet, $m)) {
                                    $snippet_location = $db->escape($m[1]);
                                }
                                if (preg_match('/<content>(<!\\[CDATA\\[)?(.+?)(\\]\\]>)?<\\/content>/is', $snippet, $m)) {
                                    $snippet_content = $db->escape($m[2]);
                                }
                                $db->query("INSERT INTO " . table_prefix . "snippets (snippet_name,snippet_location,snippet_updated,snippet_order,snippet_content) \r\n\t\t\t\t\t\t\t   VALUES ('{$snippet_name}','{$snippet_location}',NOW(),'1','{$snippet_content}')");
                            }
                            header("Location: " . my_pligg_base . "/module.php?module=admin_snippet");
                            die;
                        } else {
                            $error = "No snippets found in XML file";
                        }
                    } else {
                        $error = 'Wrong XML format';
                    }
                } else {
                    $error = 'Error uploading file';
                }
                $main_smarty->assign('snippet_error', $error);
            }
            $filtered = $db->get_results("SELECT * FROM " . table_prefix . "snippets ORDER BY snippet_location, snippet_order");
            if ($filtered) {
                foreach ($filtered as $dbfiltered) {
                    $template_snippets[] = (array) $dbfiltered;
                }
                $main_smarty->assign('template_snippets', $template_snippets);
            }
            $main_smarty->assign('tpl_center', admin_snippet_tpl_path . 'admin_snippet_main');
        }
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
Beispiel #25
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 simple_messaging_showpage()
{
    global $main_smarty, $the_template, $current_user;
    // Method for identifying modules rather than pagename
    define('modulename_sm', 'simple_messaging');
    $main_smarty->assign('modulename_sm', modulename_sm);
    if (isset($_REQUEST['view'])) {
        $view = sanitize($_REQUEST['view'], 3);
    } else {
        $view = '';
    }
    $navwhere['text1'] = 'Messaging';
    $navwhere['link1'] = URL_simple_messaging_inbox;
    define('pagename', 'simple_messaging-inbox');
    $main_smarty->assign('pagename', pagename);
    if ($view == 'inbox') {
        $message = new KMessaging(true);
        $array = $message->GetAllMesseges(5, $current_user->user_id);
        if (is_array($array)) {
            $message_count = count($array);
            $main_smarty->assign('messages', $message_count);
            foreach ($array as $key => $val) {
                $user = new User();
                $user->id = $array[$key]['sender'];
                if (!$user->read()) {
                    echo "error 2";
                    die;
                }
                $array[$key]['sender_name'] = $user->username;
                $user = "";
            }
            $main_smarty->assign('msg_array', $array);
        }
        $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', simple_messaging_tpl_path . 'inbox');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == 'compose') {
        if (isset($_REQUEST['return'])) {
            $return = sanitize($_REQUEST['return'], 3);
        } else {
            $return = '';
        }
        $main_smarty->assign('return', $return);
        if (isset($_REQUEST['to'])) {
            $msgToName = sanitize($_REQUEST['to'], 3);
        } else {
            $msgToName = '';
        }
        $main_smarty->assign('msgToName', $msgToName);
        if ($msgToName == '') {
            die('error, invalid to');
        }
        $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', simple_messaging_tpl_path . 'compose');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == 'send') {
        if (isset($_REQUEST['return'])) {
            $return = html_entity_decode(urldecode(sanitize($_REQUEST['return'], 3)));
        } else {
            $return = '';
        }
        if (isset($_REQUEST['msg_subject'])) {
            $msg_subject = sanitize($_REQUEST['msg_subject'], 3);
        } else {
            $msg_subject = '';
        }
        if (isset($_REQUEST['msg_body'])) {
            $msg_body = sanitize($_REQUEST['msg_body'], 3);
        } else {
            $msg_body = '';
        }
        if (isset($_REQUEST['msg_to'])) {
            $msg_to = sanitize($_REQUEST['msg_to'], 3);
        } else {
            $msg_to = '';
        }
        $user_to = new User();
        $user_to->username = $msg_to;
        if (!$user_to->read()) {
            $main_smarty->assign('message', 'The person you are trying to send a message to does not exist!');
            $main_smarty->display(simple_messaging_tpl_path . 'error.tpl');
            die;
        }
        $msg_to_ID = $user_to->id;
        $msg_from_ID = $current_user->user_id;
        $message = new KMessaging(true);
        $msg_result = $message->SendMessege($msg_subject, $msg_body, $msg_from_ID, $msg_to_ID, 0);
        if ($msg_result != 0) {
            $main_smarty->assign('message', "There was an error. error number " . $msg_result);
            $main_smarty->display(simple_messaging_tpl_path . 'error.tpl');
            die;
        } else {
            // show 'message sent', click to continue or wait 5..4..3..2..1.. then redirect
            header('Location: ' . $return);
        }
    }
    if ($view == "viewmsg") {
        if (isset($_REQUEST['msg_id'])) {
            $msg_id = sanitize($_REQUEST['msg_id'], 3);
        } else {
            $msg_id = '';
        }
        $main_smarty->assign('msg_id', $msg_id);
        $array = messaging_get_message_details($msg_id);
        $main_smarty->assign('msg_array', $array);
        $main_smarty->assign('js_reply', "lightbox_do_on_activate('view_message~!~action=reply~!~replyID=" . $array['id'] . "~!~view=small_msg_compose~!~login="******"');");
        $main_smarty->assign('js_delete', "lightbox_do_on_activate('view_message~!~view=small_msg_confirm_delete~!~msgid=" . $array['id'] . "');");
        $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', simple_messaging_tpl_path . 'show_message');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
    if ($view == "delmsg") {
        if (isset($_REQUEST['msg_id'])) {
            $msg_id = sanitize($_REQUEST['msg_id'], 3);
        } else {
            $msg_id = '';
        }
        $array = messaging_get_message_details($msg_id);
        $message = new KMessaging(true);
        $result = $message->DeleteMessege($msg_id);
        header('Location: ' . URL_simple_messaging_inbox);
    }
    if ($view == "reply") {
        if (isset($_REQUEST['msg_id'])) {
            $msg_id = sanitize($_REQUEST['msg_id'], 3);
        } else {
            $msg_id = '';
        }
        $main_smarty->assign('msg_id', $msg_id);
        $array = messaging_get_message_details($msg_id);
        $main_smarty->assign('msgToName', $array['sender_name']);
        $main_smarty->assign('msg_subject', 're: ' . $array['title']);
        $main_smarty->assign('return', URL_simple_messaging_viewmsg . $msg_id);
        $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', simple_messaging_tpl_path . 'compose');
        $main_smarty->display($the_template . '/pligg.tpl');
    }
}
Beispiel #27
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');
            }
        }
    }
}
function admin_language_showpage()
{
    global $main_smarty, $the_template;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        if ($_REQUEST['var_id'] != "") {
            $lines = file('./languages/lang_' . pligg_language . '.conf');
            $filename = './languages/lang_' . pligg_language . '.conf';
            if ($handle = fopen($filename, 'w')) {
                foreach ($lines as $line_num => $line) {
                    if (substr($line, 0, 2) != "//") {
                        if (strlen(trim($line)) > 2) {
                            $x = strpos($line, "=");
                            if (trim(substr($line, 0, $x)) == str_replace('emptytext_', '', $_REQUEST["var_id"])) {
                                $y = trim(substr($line, $x + 1, 10000));
                                $y = str_replace('"', '', $y);
                                $line = trim(substr($line, 0, $x)) . ' = "' . $_REQUEST["var_value"] . '"' . "\n";
                                $returnVal = $_REQUEST["var_value"];
                            }
                        }
                    }
                    if (fwrite($handle, $line)) {
                    } else {
                        echo "<b>Could not write to '{$filename}' file</b>";
                    }
                }
                fclose($handle);
                //header('Location: admin_modifylanguage.php');
            } else {
                echo "<b>Could not open '{$filename}' file for writing</b>";
            }
            echo $returnVal;
            die;
        }
        $canContinue = 1;
        $canContinue = isWriteable($canContinue, './languages/lang_' . pligg_language . '.conf', 0777, './languages/lang_' . pligg_language . '.conf');
        if (!$canContinue) {
            echo 'File is not writeable. Please CHMOD /languages/lang_' . pligg_language . '.conf to 777 and refresh this page.<br /><br /><br />';
            die;
        }
        $lines = file('./languages/lang_' . pligg_language . '.conf');
        $section = "x";
        $lastsection = "";
        $tabA = "&nbsp;&nbsp;&nbsp;&nbsp;";
        if (isset($_GET["mode"])) {
            if ($_GET["mode"] == "edit") {
                $outputHtml[] = "<form>";
                $outputHtml[] = "<table class='listing'>";
                $outputHtml[] = "Editing <b>" . $_GET["edit"] . "</b><br /><br />";
                foreach ($lines as $line_num => $line) {
                    if (substr($line, 0, 2) != "//") {
                        if (strlen(trim($line)) > 2) {
                            $x = strpos($line, "=");
                            if (trim(substr($line, 0, $x)) == $_GET["edit"]) {
                                $y = trim(substr($line, $x + 1, 10000));
                                $y = str_replace('"', "", $y);
                                $outputHtml[] = "Current Value: " . $y . "<br />";
                                $outputHtml[] = '<input type = "hidden" name = "edit" value = "' . $_GET["edit"] . '">';
                                $outputHtml[] = '<input type = "hidden" name = "mode" value = "save">';
                                $outputHtml[] = '<input name = "newvalue" value = "' . $y . '" size=75><br />';
                                $outputHtml[] = '<input type = "submit" name = "save" value = "save" class = "log2">';
                            }
                        }
                    }
                }
            }
            if ($_GET["mode"] == "save") {
                $outputHtml[] = "saving <b>" . $_GET["edit"] . "</b><br />";
                $filename = './languages/lang_' . pligg_language . '.conf';
                if ($handle = fopen($filename, 'w')) {
                    foreach ($lines as $line_num => $line) {
                        if (substr($line, 0, 2) != "//") {
                            if (strlen(trim($line)) > 2) {
                                $x = strpos($line, "=");
                                if (trim(substr($line, 0, $x)) == $_GET["edit"]) {
                                    $y = trim(substr($line, $x + 1, 10000));
                                    $y = str_replace('"', '', $y);
                                    $line = trim(substr($line, 0, $x)) . ' = "' . $_GET["newvalue"] . '"' . "\n";
                                }
                            }
                        }
                        if (fwrite($handle, $line)) {
                        } else {
                            $outputHtml[] = "<b>Could not write to '{$filename}' file</b>";
                        }
                    }
                    fclose($handle);
                    header('Location: admin_modifylanguage.php');
                } else {
                    $outputHtml[] = "<b>Could not open '{$filename}' file for writing</b>";
                }
            }
        } else {
            $outputHtml = array();
            $outputHtml[] = "<form>";
            $outputHtml[] = '<table id="mytable" class="listing">';
            foreach ($lines as $line_num => $line) {
                if (substr($line, 0, 2) == "//") {
                    $x = strpos($line, "<LANG>");
                    if ($x === false) {
                    } else {
                        $y = strpos($line, "</LANG>");
                        $lang = substr($line, $x + 6, $y);
                    }
                    $x = strpos($line, "<TITLE>");
                    if ($x === false) {
                    } else {
                        $y = strpos($line, "</TITLE>");
                        $outputHtml[] = "<tr><td bgcolor = BFBFBF><b>Title:</b>" . substr($line, $x + 7, $y) . "</td></tr>";
                    }
                    $x = strpos($line, "<SECTION>");
                    if ($x > 0) {
                        $y = strpos($line, '</SECTION>');
                        $section = substr($line, $x + 9, $y - $x);
                        if ($section != $lastsection) {
                            $lastsection = $section;
                            $outputHtml[] = '<tr id="row_ASDFGHJK"><td></td></tr>';
                            $outputHtml[] = '<tr id="row_ASDFGHJK"><td></td></tr>';
                            $outputHtml[] = '<tr id="row_ASDFGHJK"><td></td></tr>';
                            $outputHtml[] = '<tr id="row_ASDFGHJK"><th><b>Section</b>: ' . $section . '</th></tr>';
                        }
                    }
                    $x = strpos($line, "<VERSION>");
                    if ($x === false) {
                    } else {
                        $y = strpos($line, "</VERSION>");
                        $version = substr($line, $x + 9, $y);
                    }
                    $x = strpos($line, "<ADDED>");
                    if ($x === false) {
                    } else {
                        $y = strpos($line, "</ADDED>");
                        $added = substr($line, $x + 7, $y) * 1;
                    }
                } else {
                    if (strlen(trim($line)) > 2) {
                        $x = strpos($line, "=");
                        $outputHtml[] = '<tr id = "row_' . str_replace('"', '', trim(substr($line, $x + 1, 10000))) . '"><td><br />';
                        $grey = "grey1";
                        $outputHtml[] = "<b>" . $tabA . trim(substr($line, 0, $x));
                        $outputHtml[] = "</b><br />";
                        $outputHtml[] = "" . $tabA . $tabA;
                        $outputHtml[] = 'Value: <span class="emptytext" id="emptytext_' . trim(substr($line, 0, $x)) . '">' . str_replace('"', '', trim(substr($line, $x + 1, 10000))) . '</span>';
                        $outputHtml[] = "</td></tr>";
                        $editinplace_init[] = "EditInPlaceAL.makeEditable({ id: 'emptytext_" . trim(substr($line, 0, $x)) . "', on_blur: 'cancel'});";
                    }
                }
            }
        }
        $outputHtml[] = "</table>";
        $outputHtml[] = "</form>";
        $main_smarty->assign('outputHtml', $outputHtml);
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify Language";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=admin_language";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " | " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        //Method for identifying modules rather than pagename
        define('modulename', 'admin_language');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifylanguage');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('editinplace_init', $editinplace_init);
        $main_smarty->assign('tpl_center', admin_language_tpl_path . 'admin_language_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        echo "Access denied";
    }
}
Beispiel #29
0
 // for show who voted
 $main_smarty->assign('user_url', getmyurl('userblank', ""));
 $main_smarty->assign('voter', who_voted($id, 'large', '>0'));
 $main_smarty->assign('downvoter', who_voted($id, 'large', '<0'));
 // misc smarty
 $main_smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting);
 $main_smarty->assign('enable_show_last_visit', enable_show_last_visit);
 $main_smarty->assign('UseAvatars', do_we_use_avatars());
 $main_smarty->assign('related_title_url', getmyurl('storytitle', ""));
 $main_smarty->assign('related_story', related_stories($id, $link->tags, $link->category));
 // meta tags
 $meta_description = preg_replace(array('/\\r/', '/\\n/'), '', $link->truncate_content());
 $main_smarty->assign('meta_description', strip_tags($meta_description));
 $main_smarty->assign('meta_keywords', $link->tags);
 //sidebar
 $main_smarty = do_sidebar($main_smarty);
 // pagename
 define('pagename', 'story');
 $main_smarty->assign('pagename', pagename);
 if ($current_user->authenticated != TRUE) {
     $vars = '';
     check_actions('register_showform', $vars);
 }
 $story_url = getmyurl("storyURL", $link->category_safe_names(), urlencode($link->title_url), $link->id);
 $main_smarty->assign('story_url', $story_url);
 $main_smarty->assign('the_story', $link->print_summary('full', true));
 $parent_comment_id = sanitize($_GET['comment_id'], 3);
 if (isset($_GET['reply']) && !empty($parent_comment_id)) {
     $main_smarty->assign('the_comments', get_comments(true, 0, $_GET['comment_id']));
     $main_smarty->assign('parrent_comment_id', $parent_comment_id);
 } elseif (!empty($parent_comment_id)) {
Beispiel #30
0
        $order_by = " ORDER BY link_date DESC ";
        if ($globals['meta_current'] > 0) {
            $from_time = '"' . date("Y-m-d H:00:00", $globals['now'] - $globals['time_enabled_votes']) . '"';
            $from_where = "FROM links WHERE link_status='queued' and link_date > {$from_time} and link_category in (" . $globals['meta_categories'] . ") ";
            $tab = false;
        } else {
            //$from_where = "FROM links WHERE link_date > $from_time and link_status='queued'";
            $from_where = "FROM links WHERE link_status='queued'";
            $tab = 1;
        }
        break;
}
do_header(_('noticias pendientes') . ' // men&eacute;ame');
do_banner_top();
echo '<div id="container">' . "\n";
do_sidebar();
echo '<div id="contents">' . "\n";
do_tabs("main", "shakeit");
print_shakeit_tabs($tab);
do_mnu_categories_horizontal($_REQUEST['category']);
// fora en posar dropdown echo '</div>';  // Left margin
// end of tabs
if ($cat) {
    $from_where .= " AND link_category={$cat} ";
}
$link = new Link();
$rows = $db->get_var("SELECT count(*) {$from_where}");
$links = $db->get_col("SELECT link_id {$from_where} {$order_by} LIMIT {$offset},{$page_size}");
if ($links) {
    foreach ($links as $link_id) {
        $link->id = $link_id;