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');
}
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']));
    }
}
示例#3
0
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";
    }
}
示例#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');
    }
}
示例#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']));
    }
}
示例#6
0
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']));
    }
}
示例#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;
        }
    }
}
示例#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']));
    }
}
示例#9
0
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']));
    }
}
示例#10
0
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']));
    }
}
示例#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']));
    }
}
示例#13
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();
    }
}
示例#14
0
function upload_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('upload_thumb', sanitize($_REQUEST['upload_thumb'], 3));
            $sizes = unserialize(get_misc_data('upload_sizes'));
            for ($i = 0; $i < sizeof($sizes); $i++) {
                if (@in_array($sizes[$i], $_POST['delsize'])) {
                    if ($_REQUEST['upload_defsize'] == $sizes[$i]) {
                        $_REQUEST['upload_defsize'] = 'orig';
                    }
                    array_splice($sizes, $i--, 1);
                }
            }
            if (is_numeric($_POST['upload_width']) && $_POST['upload_width'] > 0 && is_numeric($_POST['upload_height']) && $_POST['upload_height'] > 0) {
                $size = sanitize($_POST['upload_width'] . 'x' . $_POST['upload_height'], 3);
                if (!@in_array($size, $sizes)) {
                    $sizes[] = $size;
                    $files = $db->get_results($sql = "SELECT a.* FROM " . table_prefix . "files a\n\t\t\t\t\t\t\t\t    LEFT JOIN " . table_prefix . "files b ON a.file_id=b.file_orig_id AND b.file_size='{$size}'\n\t\t\t\t\t\t\t\t    WHERE a.file_size='orig' AND ISNULL(b.file_id)");
                    if ($files) {
                        misc_data_update('upload_sizes', serialize($sizes));
                        misc_data_update('upload_thumb_format', $_REQUEST['upload_thumb_format']);
                        misc_data_update('upload_quality', $_REQUEST['upload_quality'] <= 100 && $_REQUEST['upload_quality'] >= 1 ? $_REQUEST['upload_quality'] : 80);
                        $settings = get_upload_settings();
                        foreach ($files as $file) {
                            generate_thumbs(strpos($file->file_name, 'http') === 0 ? $file->file_name : mnmpath . sanitize($_REQUEST['upload_directory'], 3) . '/' . $file->file_name, $file->file_link_id, $settings, $file->file_id, $size);
                        }
                    }
                }
            }
            $fields = unserialize(base64_decode(get_misc_data('upload_fields')));
            for ($i = 0; $i < sizeof($fields); $i++) {
                if (in_array($fields[$i], $_POST['delfield'])) {
                    array_splice($fields, $i--, 1);
                }
            }
            if ($_POST['upload_new_field']) {
                $fields[] = sanitize($_POST['upload_new_field'], 3);
            }
            if ($_POST['alternate']) {
                foreach ($_POST['alternate'] as $k => $v) {
                    $alternates[$k] = sanitize($v, 3);
                }
            }
            $mandatory = array();
            if ($_POST['mandatory']) {
                foreach ($_POST['mandatory'] as $k => $v) {
                    $mandatory[$k] = sanitize($v, 3);
                }
            }
            $display = array();
            if ($_POST['display']) {
                foreach ($_POST['display'] as $k => $v) {
                    $display[$k] = sanitize($v, 3);
                }
            }
            misc_data_update('upload_sizes', serialize($sizes));
            misc_data_update('upload_fields', base64_encode(serialize($fields)));
            misc_data_update('upload_alternates', base64_encode(serialize($alternates)));
            misc_data_update('upload_mandatory', serialize($mandatory));
            misc_data_update('upload_display', serialize($display));
            misc_data_update('upload_place', sanitize($_REQUEST['upload_place'], 3));
            misc_data_update('upload_defsize', sanitize($_REQUEST['upload_defsize'], 3));
            misc_data_update('upload_external', sanitize($_REQUEST['upload_external'], 3));
            misc_data_update('upload_format', $_REQUEST['upload_format']);
            misc_data_update('upload_pre_format', $_REQUEST['upload_pre_format']);
            misc_data_update('upload_post_format', $_REQUEST['upload_post_format']);
            misc_data_update('upload_thumb_format', $_REQUEST['upload_thumb_format']);
            misc_data_update('upload_t_pre_format', $_REQUEST['upload_thumb_pre_format']);
            misc_data_update('upload_t_post_format', $_REQUEST['upload_thumb_post_format']);
            misc_data_update('upload_allow_hide', sanitize($_REQUEST['upload_allow_hide'], 3));
            misc_data_update('upload_quality', $_REQUEST['upload_quality'] <= 100 && $_REQUEST['upload_quality'] >= 1 ? $_REQUEST['upload_quality'] : 80);
            misc_data_update('upload_link', sanitize($_REQUEST['upload_link'], 3));
            misc_data_update('upload_directory', sanitize($_REQUEST['upload_directory'], 3));
            misc_data_update('upload_thdirectory', sanitize($_REQUEST['upload_thdirectory'], 3));
            misc_data_update('upload_filesize', sanitize($_REQUEST['upload_filesize'], 3));
            misc_data_update('upload_maxnumber', sanitize($_REQUEST['upload_maxnumber'], 3));
            misc_data_update('upload_extensions', sanitize($_REQUEST['upload_extensions'], 3));
            misc_data_update('upload_fileplace', sanitize($_REQUEST['upload_fileplace'], 3));
            misc_data_update('upload_allow_comment', sanitize($_REQUEST['upload_allow_comment'], 3));
            misc_data_update('upload_commentplace', sanitize($_REQUEST['upload_commentplace'], 3));
            misc_data_update('upload_cfilelist', sanitize($_REQUEST['upload_commentfilelist'], 3));
            header("Location: " . my_pligg_base . "/module.php?module=upload");
            die;
        }
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify Upload";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=upload";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'upload');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifyupload');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', str_replace('"', '&#034;', get_upload_settings()));
        $main_smarty->assign('places', $upload_places);
        $main_smarty->assign('tpl_center', upload_tpl_path . 'upload_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
示例#15
0
function dropbox_backup_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('dropbox_backup_email', sanitize($_REQUEST['dropbox_backup_email'], 3));
            /*
            misc_data_update('dropbox_backup_save', sanitize($_REQUEST['dropbox_backup_save'], 3));
            $dropbox_backup_save=escapeshellcmd(get_misc_data('dropbox_backup_save'));
            if ($dropbox_backup_save == "Yes"){
            	misc_data_update('dropbox_backup_pass', sanitize($_REQUEST['dropbox_backup_pass'], 3));
            } else {
            	misc_data_update('dropbox_backup_pass', '');
            }
            */
            misc_data_update('dropbox_backup_dir', sanitize($_REQUEST['dropbox_backup_dir'], 3));
            $dropbox_pass = sanitize($_REQUEST['dropbox_backup_pass'], 3);
            // Current Directory
            $path = "admin/backup/";
            $db_path = "modules/dropbox_backup/backup/";
            // Check if it is Writable
            $backup_permissions = substr(sprintf('%o', fileperms($db_path)), -4);
            if ($backup_permissions !== '0777') {
                $error = 'The directory /' . $db_path . ' is not writable! Set the CHMOD permissions to 777 and try again.';
            } else {
                $files = array();
                $dir = opendir('admin/backup');
                while (($file = readdir($dir)) !== false) {
                    if ($file !== '.' && $file !== '..' && !is_dir($file) && $file !== 'index.htm') {
                        $files[] = $file;
                    }
                }
                closedir($dir);
                sort($files);
                if (count($files) != '0') {
                    /*
                    Copyright (c) 2011 http://ramui.com. All right reserved.
                    This product is protected by copyright and distributed under licenses restricting copying, distribution. Permission is granted to the public to download and use this script provided that this Notice and any statement of authorship are reproduced in every page on all copies of the script.
                    */
                    class recurseZip
                    {
                        private function recurse_zip($src, &$zip, $path)
                        {
                            $dir = opendir($src);
                            while (false !== ($file = readdir($dir))) {
                                if ($file != '.' && $file != '..') {
                                    if (is_dir($src . '/' . $file)) {
                                        $this->recurse_zip($src . '/' . $file, $zip, $path);
                                    } else {
                                        $zip->addFile($src . '/' . $file, substr($src . '/' . $file, $path));
                                    }
                                }
                            }
                            closedir($dir);
                        }
                        public function compress($src, $dst = '')
                        {
                            if (substr($src, -1) === '/') {
                                $src = substr($src, 0, -1);
                            }
                            if (substr($dst, -1) === '/') {
                                $dst = substr($dst, 0, -1);
                            }
                            $path = strlen(dirname($src) . '/');
                            $rand = substr(md5(microtime()), rand(0, 26), 5);
                            $zipname = 'Pligg' . "_" . date("Y-m-d_H-i-s") . '_' . $rand . '.zip';
                            $dst = empty($dst) ? $zipname : $dst . '/' . $zipname;
                            @unlink($dst);
                            $zip = new ZipArchive();
                            $res = $zip->open($dst, ZipArchive::CREATE);
                            if ($res !== TRUE) {
                                $status = 'error';
                                $message = 'Error: Unable to create zip file';
                            }
                            if (is_file($src)) {
                                $zip->addFile($src, substr($src, $path));
                            } else {
                                if (!is_dir($src)) {
                                    $zip->close();
                                    @unlink($dst);
                                    $status = 'error';
                                    $message = 'Error: File not found';
                                }
                                $this->recurse_zip($src, $zip, $path);
                            }
                            $zip->close();
                            return $dst;
                        }
                    }
                    //Source file or directory to be compressed.
                    $src = 'admin/backup';
                    //Destination folder where we create Zip file.
                    $dst = 'modules/dropbox_backup/backup';
                    $z = new recurseZip();
                    $fullpath = $z->compress($src, $dst);
                    $source = basename($fullpath);
                    if ($status != 'error') {
                        $status = 'success';
                        $message = 'The file has been sent to your Dropbox account.';
                    }
                    // Send to Dropbox
                    $dropbox_email = escapeshellcmd(get_misc_data('dropbox_backup_email'));
                    // Dropbox email address
                    //$dropbox_pass=escapeshellcmd(get_misc_data('dropbox_backup_pass'));   	// Dropbox password
                    //$dropbox_pass_save=escapeshellcmd(get_misc_data('dropbox_backup_save'));// Save password?
                    $dropbox_dir = escapeshellcmd(get_misc_data('dropbox_backup_dir'));
                    // DropBox directory (optional) - Folder on the Dropbox
                    include 'DropboxUploader.php';
                    $uploader = new DropboxUploader($dropbox_email, $dropbox_pass);
                    // $uploader->setCaCertificateFile("modules/dropbox_backup/ca-bundle.crt");
                    $uploader->upload($dst . '/' . $source, $dropbox_dir);
                    // Delete the file
                    $delete_me = $dst . '/' . $source;
                    chmod($delete_me, 0666);
                    unlink($delete_me);
                } else {
                    $status = 'error';
                    $message = '<h3>No backup files were found!</h3><p>Please <a href="admin/admin_backup.php">make a backup from this page</a> before trying to upload to Dropbox.</p>';
                }
            }
        }
        $main_smarty->assign('status', $status);
        $main_smarty->assign('message', $message);
        $main_smarty->assign('error', $error);
        // Breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Dropbox Backup";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=dropbox_backup";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        define('modulename', 'dropbox_backup');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'dropbox_backup_admin');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', str_replace('"', '&#034;', get_dropbox_backup_settings()));
        $main_smarty->assign('tpl_center', dropbox_backup_tpl_path . 'dropbox_backup_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
示例#16
0
function upload_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) {
        // Save settings
        if ($_POST['submit']) {
            misc_data_update('upload_thumb', sanitize($_REQUEST['upload_thumb'], 3));
            $sizes = unserialize(get_misc_data('upload_sizes'));
            for ($i = 0; $i < sizeof($sizes); $i++) {
                if (in_array($sizes[$i], $_POST['delsize'])) {
                    if ($_REQUEST['upload_defsize'] == $sizes[$i]) {
                        $_REQUEST['upload_defsize'] = 'orig';
                    }
                    array_splice($sizes, $i--, 1);
                }
            }
            if (is_numeric($_POST['upload_width']) && $_POST['upload_width'] > 0 && is_numeric($_POST['upload_height']) && $_POST['upload_height'] > 0) {
                $sizes[] = sanitize($_POST['upload_width'] . 'x' . $_POST['upload_height'], 3);
            }
            misc_data_update('upload_sizes', serialize($sizes));
            misc_data_update('upload_place', sanitize($_REQUEST['upload_place'], 3));
            misc_data_update('upload_defsize', sanitize($_REQUEST['upload_defsize'], 3));
            misc_data_update('upload_external', sanitize($_REQUEST['upload_external'], 3));
            misc_data_update('upload_link', sanitize($_REQUEST['upload_link'], 3));
            misc_data_update('upload_directory', sanitize($_REQUEST['upload_directory'], 3));
            misc_data_update('upload_thdirectory', sanitize($_REQUEST['upload_thdirectory'], 3));
            misc_data_update('upload_filesize', sanitize($_REQUEST['upload_filesize'], 3));
            misc_data_update('upload_maxnumber', sanitize($_REQUEST['upload_maxnumber'], 3));
            misc_data_update('upload_extensions', sanitize($_REQUEST['upload_extensions'], 3));
            misc_data_update('upload_fileplace', sanitize($_REQUEST['upload_fileplace'], 3));
            header("Location: " . my_pligg_base . "/module.php?module=upload");
            die;
        }
        // breadcrumbs
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $navwhere['text2'] = "Modify Upload";
        $navwhere['link2'] = my_pligg_base . "/module.php?module=upload";
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'upload');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifyupload');
        $main_smarty->assign('pagename', pagename);
        $main_smarty->assign('settings', get_upload_settings());
        $main_smarty->assign('places', $upload_places);
        $main_smarty->assign('tpl_center', upload_tpl_path . 'upload_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        echo "Access denied";
    }
}
示例#17
0
function status_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']) {
            if ($_REQUEST['status_level']) {
                $level = join(',', $_REQUEST['status_level']);
            }
            if ($_REQUEST['status_profile_level']) {
                $level1 = join(',', $_REQUEST['status_profile_level']);
            }
            $_REQUEST = str_replace('"', "'", $_REQUEST);
            misc_data_update('status_level', mysql_real_escape_string($level));
            misc_data_update('status_profile_level', mysql_real_escape_string($level1));
            misc_data_update('status_switch', mysql_real_escape_string($_REQUEST['status_switch']));
            misc_data_update('status_allowsearch', mysql_real_escape_string($_REQUEST['status_allowsearch']));
            misc_data_update('status_place', mysql_real_escape_string($_REQUEST['status_place']));
            misc_data_update('status_pre_format', mysql_real_escape_string($_REQUEST['status_pre_format']));
            misc_data_update('status_post_format', mysql_real_escape_string($_REQUEST['status_post_format']));
            misc_data_update('status_pre_comment', mysql_real_escape_string($_REQUEST['status_pre_comment']));
            misc_data_update('status_post_comment', mysql_real_escape_string($_REQUEST['status_post_comment']));
            misc_data_update('status_pre_story', mysql_real_escape_string($_REQUEST['status_pre_story']));
            misc_data_update('status_post_story', mysql_real_escape_string($_REQUEST['status_post_story']));
            misc_data_update('status_pre_username', mysql_real_escape_string($_REQUEST['status_pre_username']));
            misc_data_update('status_post_username', mysql_real_escape_string($_REQUEST['status_post_username']));
            misc_data_update('status_pre_search', mysql_real_escape_string($_REQUEST['status_pre_search']));
            misc_data_update('status_post_search', mysql_real_escape_string($_REQUEST['status_post_search']));
            misc_data_update('status_pre_submit', mysql_real_escape_string($_REQUEST['status_pre_submit']));
            misc_data_update('status_post_submit', mysql_real_escape_string($_REQUEST['status_post_submit']));
            misc_data_update('status_email', mysql_real_escape_string($_REQUEST['status_email']));
            misc_data_update('status_clock', mysql_real_escape_string($_REQUEST['status_clock']));
            misc_data_update('status_permalinks', mysql_real_escape_string($_REQUEST['status_permalinks']));
            misc_data_update('status_inputonother', mysql_real_escape_string($_REQUEST['status_inputonother']));
            misc_data_update('status_show_permalin', mysql_real_escape_string($_REQUEST['status_show_permalinks']));
            misc_data_update('status_results', mysql_real_escape_string($_REQUEST['status_results']));
            misc_data_update('status_max_chars', mysql_real_escape_string($_REQUEST['status_max_chars']));
            misc_data_update('status_avatar', mysql_real_escape_string($_REQUEST['status_avatar']));
            misc_data_update('status_groups', mysql_real_escape_string($_REQUEST['status_groups']));
            misc_data_update('status_users', mysql_real_escape_string($_REQUEST['status_users']));
            misc_data_update('status_user_switch', mysql_real_escape_string($_REQUEST['status_user_switch']));
            misc_data_update('status_user_friends', mysql_real_escape_string($_REQUEST['status_user_friends']));
            misc_data_update('status_user_story', mysql_real_escape_string($_REQUEST['status_user_story']));
            misc_data_update('status_user_comment', mysql_real_escape_string($_REQUEST['status_user_comment']));
            misc_data_update('status_user_group', mysql_real_escape_string($_REQUEST['status_user_group']));
            misc_data_update('status_user_email', mysql_real_escape_string($_REQUEST['status_user_email']));
            $db->query("ALTER TABLE " . table_users . " \r\n\t\t\t\t\tCHANGE  `status_switch`  `status_switch` TINYINT(1) DEFAULT '" . ($_REQUEST['status_user_switch'] + 0) . "',\r\n\t\t\t\t\tCHANGE  `status_friends` `status_friends` TINYINT(1) DEFAULT '" . ($_REQUEST['status_user_friends'] + 0) . "',\r\n\t\t\t\t\tCHANGE  `status_story`  `status_story` TINYINT(1) DEFAULT  '" . ($_REQUEST['status_user_story'] + 0) . "',\r\n\t\t\t\t\tCHANGE  `status_comment`  `status_comment` TINYINT(1) DEFAULT  '" . ($_REQUEST['status_user_comment'] + 0) . "',\r\n\t\t\t\t\tCHANGE  `status_group`  `status_group` TINYINT(1) DEFAULT  '" . ($_REQUEST['status_user_group'] + 0) . "',\r\n\t\t\t\t\tCHANGE  `status_email`  `status_email` TINYINT(1) DEFAULT  '" . ($_REQUEST['status_user_email'] + 0) . "'");
            header("Location: " . my_pligg_base . "/module.php?module=status");
            die;
        }
        // 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);
        $main_smarty->assign('settings', get_status_settings());
        $main_smarty->assign('tpl_center', status_tpl_path . 'status_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
示例#18
0
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']));
    }
}
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;
    }
}
示例#20
0
function check_submit_authorization($location)
{
    global $current_user, $db, $main_smarty, $the_template;
    $location = implode($location);
    // if user is ADMIN or GOD then there is no restriction
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    $canIhaveAccess = $canIhaveAccess + checklevel('moderator');
    // default authorization level = 0 => 1 link per day
    $authorization_submit_level = 0;
    if ($canIhaveAccess) {
        $main_smarty->assign('admin_present', true);
        return true;
    } else {
        $sql = "SELECT var_value FROM " . table_config . " WHERE var_name LIKE";
        // get how many links in history is evaluated
        $var = 'links_history_count';
        $links_history_count = $db->get_var($sql . " '" . $var . "'");
        // get how many votes is needed to user get authorization level 1
        $var = 'level_1_votes';
        $level_1_votes = $db->get_var($sql . " '" . $var . "'");
        // get how many votes is needed to user get authorization level 2
        $var = 'level_2_votes';
        $level_2_votes = $db->get_var($sql . " '" . $var . "'");
        // get how many votes is needed to user get authorization level 3
        $var = 'level_3_votes';
        $level_3_votes = $db->get_var($sql . " '" . $var . "'");
        // get how many links can user submit when reach authorization level 1
        $var = 'level_1_submit_links';
        $level_1_submit_links = $db->get_var($sql . " '" . $var . "'");
        // get how many links can user submit when reach authorization level 2
        $var = 'level_2_submit_links';
        $level_2_submit_links = $db->get_var($sql . " '" . $var . "'");
        // get how many links can user submit when reach authorization level 3
        $var = 'level_3_submit_links';
        $level_3_submit_links = $db->get_var($sql . " '" . $var . "'");
        // get how many links user has ever submitted
        $user_ever_submitted_links_count = $db->get_var("SELECT count(link_id) FROM " . table_links . " WHERE link_author=" . $current_user->user_id . " AND\n      link_status not like 'discard'");
        // get actual average votes value
        $sum_vv = $db->get_var("SELECT sum(vote_value) FROM " . table_votes . "\n                                                        JOIN " . table_links . " ON " . table_links . ".link_id=" . table_votes . ".vote_link_id \n                                                         WHERE link_author=" . $current_user->user_id . " AND link_status not like 'discard' \n                                                         ORDER BY link_date LIMIT {$links_history_count}");
        if ($sum_vv) {
            if (!$links_history_count) {
                echo "Links history count in submit antispam addon cannot be set 0";
                die;
            }
            if ($user_ever_submitted_links_count < $links_history_count) {
                $average_votes_value = $sum_vv / ($user_ever_submitted_links_count * 10);
            } else {
                $average_votes_value = $sum_vv / ($links_history_count * 10);
            }
        } else {
            $average_votes_value = 0;
        }
        // get user submitted links in last 24 hours
        $_24hrs = strtotime("-1 day");
        $links_in_24_hrs = $db->get_var("SELECT count(link_id) FROM " . table_links . " WHERE link_author={$current_user->user_id} AND link_date > FROM_UNIXTIME({$_24hrs}) AND link_status not like 'discard'");
        $last_link_date = $db->get_var("SELECT link_date FROM " . table_links . " WHERE link_author={$current_user->user_id}  AND link_status not like 'discard' ORDER BY link_date desc LIMIT 1");
        $last_link_date_plus_24h = date('m/d/Y h:i a', strtotime($last_link_date) + 3600 * 24);
        //what authorization submit level user has
        if ($average_votes_value >= $level_3_votes) {
            $authorization_submit_level = 3;
        } else {
            if ($average_votes_value >= $level_2_votes) {
                $authorization_submit_level = 2;
            } else {
                if ($average_votes_value >= $level_1_votes) {
                    $authorization_submit_level = 1;
                }
            }
        }
        // how many links are in current authorization level
        switch ($authorization_submit_level) {
            case 0:
                $submit_limit = 1;
                break;
            case 1:
                $submit_limit = $level_1_submit_links;
                break;
            case 2:
                $submit_limit = $level_2_submit_links;
                break;
            case 3:
                $submit_limit = $level_3_submit_links;
                break;
        }
        if ($location == "submit_post_authentication") {
            if ($links_in_24_hrs >= $submit_limit) {
                $main_smarty->assign('submit_mode', "link");
                $main_smarty->assign('submitted_in_24h', $links_in_24_hrs);
                $main_smarty->assign('actual_limit', $submit_limit);
                $main_smarty->assign('actual_limit_r', round($submit_limit, 0));
                $main_smarty->assign('current_authorization_level', $authorization_submit_level);
                $main_smarty->assign('authorization_level_0_submit_allowed', 1);
                // for level 0 there is only  1 link per day
                $main_smarty->assign('authorization_level_1_submit_allowed', $level_1_submit_links);
                $main_smarty->assign('authorization_level_2_submit_allowed', $level_2_submit_links);
                $main_smarty->assign('authorization_level_3_submit_allowed', $level_3_submit_links);
                $main_smarty->assign('authorization_level_1_required_votes', $level_1_votes);
                $main_smarty->assign('authorization_level_2_required_votes', $level_2_votes);
                $main_smarty->assign('authorization_level_3_required_votes', $level_3_votes);
                $main_smarty->assign('last_date', $last_link_date);
                $main_smarty->assign('last_date_plus_24h', $last_link_date_plus_24h);
                $main_smarty->assign('average_votes_value', round($average_votes_value, 2));
                $main_smarty->assign('tpl_center', submit_antispam_tpl_path . '/submit_error');
                $main_smarty->display($the_template . '/pligg.tpl');
                die;
            } else {
                $main_smarty->assign('submitted_links_24h', $links_in_24_hrs);
                $main_smarty->assign('links_actual_limit', $submit_limit);
            }
        } else {
            if ($location == "story_insert_comment") {
                //check if comment restriction is in use
                $comment_restriction = $db->get_var("SELECT var_value FROM " . table_config . " WHERE var_name LIKE 'comment_restriction'");
                if ($comment_restriction) {
                    // get how many comments user submitted in 24 hours
                    $comments_in_24_hrs = $db->get_var("SELECT count(comment_id) FROM " . table_comments . " WHERE comment_user_id={$current_user->user_id} AND comment_date > FROM_UNIXTIME({$_24hrs})");
                    // get comment submit multiplier
                    $submit_multiplier = $db->get_var("SELECT var_value FROM " . table_config . " WHERE var_name LIKE 'comment_submit_multiplier'");
                    // average get user comment votes value, please note this value is increased by 1 bc. at the beginning user has no votes
                    // and we need to multiply * 1 (not 0)
                    $average_u_c_v = $db->get_var("SELECT avg(comment_votes) FROM " . table_comments . " WHERE comment_user_id={$current_user->user_id} LIMIT {$links_history_count}");
                    $average_u_c_v++;
                    $comments_limit = $submit_limit * $submit_multiplier * $average_u_c_v;
                    $last_comment_date = $db->get_var("SELECT comment_date FROM " . table_comments . " WHERE comment_user_id={$current_user->user_id} ORDER BY comment_date desc LIMIT 1");
                    $last_comment_date_plus_24h = date('m/d/Y h:i a', strtotime($last_comment_date) + 3600 * 24);
                    if ($comments_limit <= $comments_in_24_hrs) {
                        $main_smarty->assign('submit_mode', "comment");
                        $main_smarty->assign('submitted_in_24h', $comments_in_24_hrs);
                        $main_smarty->assign('actual_limit', round($comments_limit, 2));
                        $main_smarty->assign('actual_limit_r', round($comments_limit, 0));
                        $main_smarty->assign('current_authorization_level', $authorization_submit_level);
                        $main_smarty->assign('authorization_level_0_submit_allowed', 1);
                        // for level 0 there is only  1 link per day
                        $main_smarty->assign('authorization_level_1_submit_allowed', $level_1_submit_links);
                        $main_smarty->assign('authorization_level_2_submit_allowed', $level_2_submit_links);
                        $main_smarty->assign('authorization_level_3_submit_allowed', $level_3_submit_links);
                        $main_smarty->assign('authorization_level_1_required_votes', $level_1_votes);
                        $main_smarty->assign('authorization_level_2_required_votes', $level_2_votes);
                        $main_smarty->assign('authorization_level_3_required_votes', $level_3_votes);
                        $main_smarty->assign('last_date', $last_comment_date);
                        $main_smarty->assign('last_date_plus_24h', $last_comment_date_plus_24h);
                        $main_smarty->assign('average_votes_value', round($average_votes_value, 2));
                        $main_smarty->assign('average_comm_vot_value', round($average_u_c_v, 2));
                        $main_smarty->assign('link_submit_limit', round($submit_limit, 2));
                        $main_smarty->assign('submit_mul', $submit_multiplier);
                        $main_smarty->assign('tpl_center', submit_antispam_tpl_path . '/submit_error');
                        $main_smarty->display($the_template . '/pligg.tpl');
                        die;
                    } else {
                        // do nothing
                    }
                }
            }
        }
    }
}
示例#21
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;
        }
    }
}
示例#22
0
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";
    }
}
示例#23
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']));
    }
}
示例#24
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 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>" . sanitize($_GET["edit"], 1) . "</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") {
                //print_r($_GET);
                //print "New: ".js_urldecode($_GET["newvalue"]);
                $_GET["newvalue"] = js_urldecode($_GET["newvalue"]);
                $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)) . ' = "' . addslashes($_GET["newvalue"]) . '"' . "\n";
                                }
                            }
                        }
                        if (fwrite($handle, $line)) {
                        } else {
                            $outputHtml[] = "<b>Could not write to '{$filename}' file</b>";
                        }
                    }
                    fclose($handle);
                    exit;
                    //					header('Location: admin_modifylanguage.php');
                } else {
                    $outputHtml[] = "<b>Could not open '{$filename}' file for writing</b>";
                }
            }
        } else {
            $outputHtml = array();
            $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><form onsubmit="return false"><fieldset>';
                        $grey = "grey1";
                        $outputHtml[] = "<b>" . $tabA . trim(substr($line, 0, $x));
                        $outputHtml[] = "</b><br />";
                        $outputHtml[] = "" . $tabA . $tabA;
                        $ID = trim(substr($line, 0, $x));
                        $VALUE = htmlspecialchars(trim(substr(stripslashes($line), $x + 1, 10000), " \t\n\r\"\\'"));
                        //						$VALUE = htmlspecialchars(str_replace('"', '', trim(substr($line, $x + 1, 10000))));
                        if (function_exists("iconv") && detect_encoding($VALUE) != 'utf-8') {
                            $VALUE = iconv('', 'UTF-8//IGNORE', $VALUE);
                        }
                        $outputHtml[] = "Value: <span class=\"emptytext\" id=\"editme{$ID}\" onclick=\"show_edit('{$ID}')\">{$VALUE}</span>";
                        $outputHtml[] = "<span id=\"showme{$ID}\" style=\"display:none;\">";
                        $outputHtml[] = "<input type=\"text\" name=\"var_value\" value=\"{$VALUE}\">";
                        $outputHtml[] = "<br><div style='margin:5px 0 0 75px;'><input type=\"submit\" value=\"Save\" onclick=\"save_changes('{$ID}',this.form)\">";
                        $outputHtml[] = "<input type=\"reset\" value=\"Cancel\" onclick=\"hide_edit('{$ID}')\"></span></div><br>";
                        $outputHtml[] = "</fieldset></form>";
                        $outputHtml[] = "</td></tr>";
                    }
                }
            }
        }
        $outputHtml[] = "</table>";
        $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 {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}
示例#26
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 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.";
    }
}
示例#28
0
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";
    }
}
示例#29
0
include_once 'internal/Smarty.class.php';
$main_smarty = new Smarty();
include 'config.php';
include mnminclude . 'html1.php';
include mnminclude . 'link.php';
include mnminclude . 'smartyvariables.php';
/*echo "<pre>";
print_r($_REQUEST);
echo "</pre>";*/
//die;
check_referrer();
// sidebar
$main_smarty = do_sidebar($main_smarty);
// require user to log in
force_authentication();
// restrict access to admins
$canIhaveAccess = 0;
$canIhaveAccess = $canIhaveAccess + checklevel('admin');
if ($canIhaveAccess == 0) {
    //	$main_smarty->assign('tpl_center', '/templates/admin/admin_access_denied');
    //	$main_smarty->display($template_dir . '/admin/admin.tpl');
    header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    die;
}
function dowork()
{
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        if (is_writable('settings.php') == 0) {
示例#30
0
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('admin');
    if ($canIhaveAccess == 1) {
        // Lines from all language files
        $files = new LangFiles();
        // Update a line
        if ($_GET["mode"] == "save") {
            #echo "ankan";
            if ($error = $files->set($_REQUEST['edit'], js_urldecode($_REQUEST['newvalue']), $_REQUEST['file'])) {
                echo "<strong>{$error}</strong>";
            }
            // Display the list of all lines
        } else {
            $lines = array();
            $oldmodule = '';
            // All lines from all files here
            foreach ($files as $lnum => $line) {
                $l = array();
                // Extract filename
                list($file, $pos) = explode('#', $lnum);
                $l['file'] = $file;
                // Add SECTION line for a new module
                if ($files->getName($file) != $oldmodule) {
                    $l['section'] = $oldmodule = $files->getName($file);
                    $lines[] = $l;
                    unset($l['section']);
                }
                // Commented lines (auxiliary info)
                if (substr($line, 0, 2) == "//") {
                    if (preg_match('/<TITLE>(.+)<\\/TITLE>/', $line, $m)) {
                        $l['title'] = $m[1];
                    } elseif (preg_match('/<SECTION>(.+)<\\/SECTION>/', $line, $m)) {
                        $l['section'] = $m[1];
                    } else {
                        continue;
                    }
                } elseif (strlen(trim($line)) > 2) {
                    if (preg_match('/^([^=]+)\\s*=\\s*"?(.+)"?$/', trim($line), $m)) {
                        $l['id'] = trim($m[1]);
                        $l['value'] = htmlspecialchars(str_replace('"', '', trim($m[2])));
                        if (function_exists("iconv") && detect_encoding($l['value']) != 'utf-8') {
                            $l['value'] = iconv('', 'UTF-8//IGNORE', $l['value']);
                        }
                    } else {
                        $l['error'] = "Can't parse {$line}";
                    }
                } else {
                    continue;
                }
                $lines[] = $l;
            }
            $main_smarty->assign('lines', $lines);
            // 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 {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
    }
}