function multibox_admin_showpage() { global $main_smarty, $the_template, $db; force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); if ($canIhaveAccess == 1) { define('pagename', 'multibox_admin'); $main_smarty->assign('pagename', pagename); define('modulename', 'multibox_admin'); $main_smarty->assign('modulename', modulename); $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'); $navwhere['link1'] = getmyurl('admin', ''); $main_smarty->display(multibox_admin_tpl_path . '/blank.tpl'); $main_smarty = do_sidebar($main_smarty); $sql = "SELECT * FROM " . table_totals; $results = $db->get_results($sql); $main_smarty->assign('results', object_2_array($results)); if (isset($_REQUEST['action'])) { $main_smarty->assign('action', $_REQUEST['action']); totals_regenerate(); $sql = "SELECT * FROM " . table_totals; $results = $db->get_results($sql); $main_smarty->assign('new_results', object_2_array($results)); } $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', multibox_admin_tpl_path . 'multibox_main'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } else { echo "Page Forbidden"; } }
function sendannouncement_showpage() { // Method for identifying modules rather than pagename define('modulename', 'send_announcement'); // $main_smarty->assign('modulename', modulename); force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 0) { header("Location: " . my_base_url . my_pligg_base); die; } global $main_smarty, $the_template; include_once 'config.php'; include_once mnminclude . 'html1.php'; include_once mnminclude . 'link.php'; include_once mnminclude . 'tags.php'; include_once mnminclude . 'smartyvariables.php'; $main_smarty = do_sidebar($main_smarty); // breadcrumbs $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'); $navwhere['link1'] = getmyurl('admin', ''); $navwhere['text2'] = "Send Announcement"; $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('posttitle', "Send Annoucement"); // breadcrumbs $main_smarty->assign('tpl_center', send_announcement_tpl_path . 'sendannouncement'); $main_smarty->display($the_template . '/pligg.tpl'); }
function dowork() { global $db; $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); if ($canIhaveAccess == 1) { if (is_writable('../settings.php') == 0) { die("Error: settings.php is not writeable."); } $action = isset($_REQUEST['action']) && sanitize($_REQUEST['action'], 3) != '' ? sanitize($_REQUEST['action'], 3) : "view"; if ($action == "view") { $config = new pliggconfig(); if (isset($_REQUEST['page'])) { $config->var_page = sanitize($_REQUEST['page'], 3); $config->showpage(); } else { $config->listpages(); } } if ($action == "save") { $config = new pliggconfig(); $config->var_id = substr(sanitize($_REQUEST['var_id'], 3), 6, 10); $config->var_value = $db->escape($_REQUEST['var_value']); $config->store(); } } }
function dowork() { $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 1) { if (is_writable('settings.php') == 0) { die("Error: settings.php is not writeable."); } if (isset($_REQUEST['action'])) { $action = $_REQUEST['action']; } else { $action = "view"; } if ($action == "view") { $config = new pliggconfig(); if (isset($_REQUEST['page'])) { $config->var_page = $_REQUEST['page']; $config->showpage(); } } if ($action == "save") { $config = new pliggconfig(); $config->var_id = substr($_REQUEST['var_id'], 6, 10); $config->var_value = $_REQUEST['var_value']; $config->store(); } } }
function hello_world_showpage() { global $main_smarty, $the_template, $db; force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); if ($canIhaveAccess == 1) { define('pagename', 'hello_world'); $main_smarty->assign('pagename', pagename); // Method for identifying modules rather than pagename define('modulename', 'hello_world'); $main_smarty->assign('modulename', modulename); $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'); $navwhere['link1'] = getmyurl('admin', ''); $main_smarty->display(hello_world_tpl_path . '/blank.tpl'); $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_hello_world_BreadCrumb'); $navwhere['link2'] = URL_hello_world; $navwhere['text3'] = ''; $navwhere['link3'] = ''; $navwhere['text4'] = ''; $navwhere['link4'] = ''; $main_smarty = do_sidebar($main_smarty); $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', hello_world_tpl_path . 'hello_world_main'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } else { header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI'])); } }
function 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'); } }
function karma_showpage() { global $db, $main_smarty, $the_template; include_once 'config.php'; include_once mnminclude . 'html1.php'; include_once mnminclude . 'link.php'; include_once mnminclude . 'tags.php'; include_once mnminclude . 'smartyvariables.php'; $main_smarty = do_sidebar($main_smarty); force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 1) { // Save settings if ($_POST['submit']) { misc_data_update('karma_submit_story', sanitize($_REQUEST['karma_submit_story'], 3)); misc_data_update('karma_submit_comment', sanitize($_REQUEST['karma_submit_comment'], 3)); misc_data_update('karma_story_publish', sanitize($_REQUEST['karma_story_publish'], 3)); misc_data_update('karma_story_vote', sanitize($_REQUEST['karma_story_vote'], 3)); misc_data_update('karma_story_unvote', sanitize($_REQUEST['karma_story_vote_remove'], 3)); misc_data_update('karma_comment_vote', sanitize($_REQUEST['karma_comment_vote'], 3)); misc_data_update('karma_story_discard', sanitize($_REQUEST['karma_story_discard'], 3)); misc_data_update('karma_story_spam', sanitize($_REQUEST['karma_story_spam'], 3)); misc_data_update('karma_comment_delete', sanitize($_REQUEST['karma_comment_delete'], 3)); if ($_REQUEST['karma_username'] && $_REQUEST['karma_value'] != 0) { $db->query($sql = "UPDATE " . table_users . " SET user_karma=user_karma+'" . $db->escape($_REQUEST['karma_value']) . "' WHERE user_login='******'karma_username']) . "'"); if (!$db->rows_affected) { $error = "Wrong username " . sanitize($_REQUEST['karma_username'], 1); } } $main_smarty->assign('error', $error); } // breadcrumbs $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'); $navwhere['link1'] = getmyurl('admin', ''); $navwhere['text2'] = "Modify Karma"; $navwhere['link2'] = my_pligg_base . "/module.php?module=karma"; $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); // breadcrumbs define('modulename', 'karma'); $main_smarty->assign('modulename', modulename); define('pagename', 'admin_modify_karma'); $main_smarty->assign('pagename', pagename); $main_smarty->assign('settings', str_replace('"', '"', get_karma_settings())); $main_smarty->assign('tpl_center', karma_tpl_path . 'karma_main'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } else { header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI'])); } }
function dowork() { global $db, $main_smarty; $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); if ($canIhaveAccess == 1) { if (is_writable('../settings.php') == 0) { die("Error: settings.php is not writeable."); } $action = isset($_REQUEST['action']) && sanitize($_REQUEST['action'], 3) != '' ? sanitize($_REQUEST['action'], 3) : "view"; if ($action == "view") { $config = new pliggconfig(); $config->listpages(); if (isset($_REQUEST['page'])) { $config->var_page = sanitize($_REQUEST['page'], 3); $config->showpage(); # }else{ # $config->listpages(); } } if ($action == "save") { $config = new pliggconfig(); // $config->var_id = substr(sanitize($_REQUEST['var_id'], 3), 6, 10); $config->var_id = sanitize($_REQUEST['var_id'], 3); $config->read(); // Check if template exists if ($config->var_name == '$thetemp' && $config->var_value != js_urldecode($_REQUEST['var_value'])) { if (!file_exists('../templates/' . js_urldecode($_REQUEST['var_value']))) { print "alert('" . $main_smarty->get_config_vars('PLIGG_Visual_AdminPanel_NoTemplate') . "')"; exit; } else { if (file_exists('../templates/' . js_urldecode($_REQUEST['var_value']) . '/template_details.php')) { include '../templates/' . js_urldecode($_REQUEST['var_value']) . '/template_details.php'; } if ($template_info['designed_for_pligg_version'] < pligg_version() && !$_REQUEST['force']) { if (!$template_info['designed_for_pligg_version']) { $template_info['designed_for_pligg_version'] = 'unknown'; } print sprintf("if (confirm('" . $main_smarty->get_config_vars('PLIGG_Visual_AdminPanel_Template_Version') . "')) {XMLHttpRequestObject.open('GET', '?action=save&var_id={$config->var_id}&var_value=" . urlencode($_REQUEST['var_value']) . "&force=1', true); XMLHttpRequestObject.send(null);}", $template_info['designed_for_pligg_version'], pligg_version()); exit; } } } $config->var_value = $db->escape(js_urldecode($_REQUEST['var_value'])); $config->store(false); } } }
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'])); } }
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; } } }
function contactable_showpage() { global $db, $main_smarty, $the_template; include_once 'config.php'; include_once mnminclude . 'html1.php'; include_once mnminclude . 'link.php'; include_once mnminclude . 'tags.php'; include_once mnminclude . 'smartyvariables.php'; $main_smarty = do_sidebar($main_smarty); force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 1) { if ($_POST['submit']) { $_REQUEST = str_replace('"', "'", $_REQUEST); $contactable_input = $_REQUEST['contactable_mail']; $result = filter_var($contactable_input, FILTER_VALIDATE_EMAIL); // Checking if the email is valid. Returns 'false' if not valid. if (!$result) { // Email is not valid $msg = "Error! Your email address does not appear to be valid."; } else { // Add email address to database field misc_data_update('contactable_mail', mysql_real_escape_string($contactable_input)); } } // breadcrumbs $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); define('modulename', 'contactable'); $main_smarty->assign('modulename', modulename); define('pagename', 'admin_contactable'); $main_smarty->assign('pagename', pagename); $main_smarty->assign('msg', $msg); // Error messages $main_smarty->assign('contactable', get_contactable_settings()); $main_smarty->assign('tpl_center', contactable_tpl_path . 'settings'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } else { header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI'])); } }
function 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'])); } }
function pligg_web_toolbar_showpage() { global $main_smarty, $the_template, $db; force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 1) { define('pagename', 'pligg_web_toolbar'); $main_smarty->assign('pagename', pagename); // Method for identifying modules rather than pagename define('modulename', 'pligg_web_toolbar'); $main_smarty->assign('modulename', modulename); $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'); $navwhere['link1'] = getmyurl('admin', ''); $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_pligg_web_toolbar_BreadCrumb'); $navwhere['link2'] = URL_pligg_web_toolbar; $navwhere['text3'] = ''; $navwhere['link3'] = ''; $navwhere['text4'] = ''; $navwhere['link4'] = ''; if (isset($_REQUEST['action'])) { $action = $_REQUEST['action']; } else { $action = ''; } if ($action == 'enable') { enable_pligg_web_toolbar(); } if ($action == 'disable') { disable_pligg_web_toolbar(); } $main_smarty = do_sidebar($main_smarty); $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', pligg_web_toolbar_tpl_path . 'pligg_web_toolbar_main'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } else { header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI'])); } }
function 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 spam_trigger_do_submit3($vars) { global $db, $current_user; if (checklevel('god') || checklevel('admin')) { return; } $linkres = $vars['linkres']; if (!$linkres->id) { return; } $settings = get_spam_trigger_settings(); $str = $linkres->title . "\n" . $linkres->content . "\n" . $linkres->link_summary . "\n" . $linkres->tags; // Killspam user if ($settings['spam_hard'] && !spam_trigger_check($str, $settings['spam_hard'])) { $_SESSION['spam_trigger_story_error'] = 'deleted'; spam_trigger_killspam($current_user->user_id); } elseif ($settings['spam_medium'] && !spam_trigger_check($str, $settings['spam_medium'])) { $_SESSION['spam_trigger_story_error'] = 'discarded'; $linkres->status = 'discard'; } elseif ($settings['spam_light'] && !spam_trigger_check($str, $settings['spam_light'])) { $_SESSION['spam_trigger_story_error'] = 'moderated'; $linkres->status = 'moderated'; } }
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'])); } }
function fill_smarty($smarty, $type = 'full') { static $link_index = 0; global $current_user, $globals, $the_template, $db, $ranklist; if (!$ranklist) { $users = $db->get_results("SELECT user_karma, COUNT(*) FROM " . table_users . " WHERE user_level NOT IN ('Spammer') AND user_karma>0 GROUP BY user_karma ORDER BY user_karma DESC", ARRAY_N); $ranklist = array(); $rank = 1; if ($users) { foreach ($users as $dbuser) { $ranklist[$dbuser[0]] = $rank; $rank += $dbuser[1]; } } } // DB 08/04/08 if (!is_numeric($this->id)) { return false; } ///// $smarty->assign('link_id', $this->id); if (!$this->read) { return $smarty; } $url = str_replace('&', '&', htmlspecialchars($this->url)); $url_short = txt_shorter($url); if ($this->url == "http://" || $this->url == '') { $url_short = "http://"; } else { $parsed = parse_url($this->url); if (isset($parsed['scheme'])) { $url_short = $parsed['scheme'] . "://" . $parsed['host']; } } echo $parsed['scheme']; $title_short = htmlspecialchars(utf8_wordwrap($this->title, 30, " ", 1)); $smarty->assign('viewtype', $type); $smarty->assign('URL_tagcloud', getmyurl("tagcloud")); $smarty->assign('URL_global_statistics', getmyurl("global_statistics")); $smarty->assign('No_URL_Name', No_URL_Name); if (track_outgoing == true && $url_short != "http://") { if (track_outgoing_method == "id") { $smarty->assign('url', getmyurl("out", $this->id)); } if (track_outgoing_method == "title") { $smarty->assign('url', getmyurl("outtitle", urlencode($this->title_url))); } if (track_outgoing_method == "url") { $smarty->assign('url', getmyurl("outurl", $url)); } } else { $smarty->assign('url', $url); } // DB 11/12/08 if ($url_short == "http://" || $url_short == "://") { $smarty->assign('enc_url', urlencode(my_base_url . $this->get_internal_url())); } else { $smarty->assign('enc_url', urlencode($url)); } ///// $smarty->assign('url_short', $url_short); $smarty->assign('title_short', $title_short); //$smarty->assign('title_url', urlencode($this->title_url)); $smarty->assign('enc_title_short', urlencode($title_short)); $smarty->assign('story_url', $this->get_internal_url()); $smarty->assign('story_edit_url', getmyurl("editlink", $this->id)); $smarty->assign('story_admin_url', getmyurl("admin_modify", $this->id)); $smarty->assign('story_comment_count', $this->comments()); $smarty->assign('story_status', $this->status); //$smarty->assign('story_karma', $this->karma); if ($type == "summary") { if ($this->link_summary == "") { $smarty->assign('story_content', $this->truncate_content()); } else { $smarty->assign('story_content', $this->link_summary); } } /* $sql = "SELECT link_id FROM " . table_links . " WHERE link_category='$id'"; $links = $db->get_results($sql); foreach($links as $link) { $db->query('UPDATE '.table_comments." SET comment_status='discard' WHERE comment_link_id={$link->link_id}"); $vars = array('link_id' => $link->link_id); check_actions('story_discard', $vars); $db->query('UPDATE '.table_links." SET link_status='discard' WHERE link_id={$link->link_id}"); } */ if ($type == "full") { $smarty->assign('story_content', $this->content); $smarty->assign('story_id', $this->id); } if ($this->get_author_info == true) { $smarty->assign('link_submitter', $this->username()); $smarty->assign('submitter_profile_url', getmyurl('user', $this->username)); $smarty->assign('submitter_rank', $ranklist[$this->userkarma]); } $smarty->assign('link_submit_time', $this->date); $smarty->assign('link_submit_timeago', txt_time_diff($this->date)); $smarty->assign('link_submit_date', date('F, d Y g:i A', $this->date)); $smarty->assign('link_published_time', $this->published_date); $smarty->assign('link_published_timeago', txt_time_diff($this->published_date)); $smarty->assign('link_category', $this->category_name()); if (Multiple_Categories) { $cats = array(); foreach ($this->additional_cats as $cat) { $url = $this->category_safe_name($cat); if ($this->status == "published") { $url = getmyurl("maincategory", $url); } if ($this->status == "queued") { $url = getmyurl("queuedcategory", $url); } if ($this->status == "discard") { $url = getmyurl("discardedcategory", $url); } $cats[$url] = $this->category_name($cat); } $smarty->assign('link_additional_cats', $cats); } //assign category id to smarty, so we can use it in the templates. Needed for category colors! $smarty->assign('category_id', $this->category); global $URLMethod; $catvar = $this->category_safe_name(); $smarty->assign('Voting_Method', Voting_Method); $this->votecount = $this->countvotes(); if (Voting_Method == 2) { if (!$this->rating) { $this->rating = $this->rating($this->id) / 2; } $smarty->assign('link_rating', $this->rating); $smarty->assign('link_rating_width', $this->rating * 25); $current_user_id = $current_user->user_id; $jsLink = "vote({$current_user_id}, {$this->id}, {$link_index}, '" . md5($current_user_id . $this->randkey) . "', "; for ($stars = 1; $stars <= 5; $stars++) { $smarty->assign("link_shakebox_javascript_vote_{$stars}star", $jsLink . $stars * 2 . ')'); } $smarty->assign('vote_count', $this->votecount); if ($this->votes($current_user_id) > 0) { $smarty->assign('star_class', "-noh"); } else { $smarty->assign('star_class', ""); } } $smarty->assign('get_group_membered', $this->get_group_membered()); if ($this->status == "published") { $smarty->assign('category_url', getmyurl("maincategory", $catvar)); } if ($this->status == "queued") { $smarty->assign('category_url', getmyurl("queuedcategory", $catvar)); } if ($this->status == "discard") { $smarty->assign('category_url', getmyurl("discardedcategory", $catvar)); } $smarty->assign('trackback_url', get_trackback($this->id)); $smarty->assign('user_logged_in', $current_user->user_login); $smarty->assign('randmd5', md5($current_user->user_id . $this->randkey)); $smarty->assign('user_id', $this->author); $smarty->assign('current_user_id', $current_user_id); if (Enable_Extra_Fields) { $main_smarty = $smarty; include mnminclude . 'extra_fields_smarty.php'; $smarty = $main_smarty; $smarty->assign('link_field1', $this->link_field1); $smarty->assign('link_field2', $this->link_field2); $smarty->assign('link_field3', $this->link_field3); $smarty->assign('link_field4', $this->link_field4); $smarty->assign('link_field5', $this->link_field5); $smarty->assign('link_field6', $this->link_field6); $smarty->assign('link_field7', $this->link_field7); $smarty->assign('link_field8', $this->link_field8); $smarty->assign('link_field9', $this->link_field9); $smarty->assign('link_field10', $this->link_field10); $smarty->assign('link_field11', $this->link_field11); $smarty->assign('link_field12', $this->link_field12); $smarty->assign('link_field13', $this->link_field13); $smarty->assign('link_field14', $this->link_field14); $smarty->assign('link_field15', $this->link_field15); } $smarty->assign('link_group_id', $this->link_group_id); $smarty->assign('Enable_Recommend', Enable_Recommend); $smarty->assign('instpath', my_base_url . my_pligg_base . "/"); $smarty->assign('UseAvatars', do_we_use_avatars()); $smarty->assign('Avatar_ImgSrc', get_avatar('large', "", "", "", $this->userid)); $smarty->assign('Avatar_ImgSrcs', get_avatar('small', "", "", "", $this->userid)); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 1) { $smarty->assign('isadmin', 'yes'); } if ($this->check_friends == true) { // For Friends // include_once mnminclude . 'friend.php'; $friend = new Friend(); // make sure we're logged in and we didnt submit the link. if ($current_user->user_id > 0 && $current_user->user_login != $this->username()) { $friend_md5 = friend_MD5($current_user->user_login, $this->username()); $smarty->assign('FriendMD5', $friend_md5); $isfriend = $friend->get_friend_status($this->author); if (!$isfriend) { $friend_text = 'add to'; $friend_url = 'addfriend'; } else { $friend_text = 'remove from'; $friend_url = 'removefriend'; } $smarty->assign('Friend_Text', $friend_text); $smarty->assign('user_add_remove', getmyurl('user_add_remove', $this->username(), $friend_url)); } $smarty->assign('Allow_Friends', Allow_Friends); // --- // } if ($current_user->user_id != '') { $vars = array('author_id' => $this->author, 'link_id' => $this->id); check_actions('friends_activity_function', $vars); if ($vars['value'] == true) { $smarty->assign('friendvoted', 1); } } /* //for friends voting activity include_once(mnminclude.'friend.php'); $friend = new Friend; $sql = 'SELECT ' . table_votes . '.*, ' . table_users . '.user_id FROM ' . table_votes . ' INNER JOIN ' . table_users . ' ON ' . table_votes . '.vote_user_id = ' . table_users . '.user_id WHERE (((' . table_votes . '.vote_value)>0) AND ((' . table_votes . '.vote_link_id)='.$this->id.') AND (' . table_votes . '.vote_type= "links"));'; $voters = $db->get_results($sql); $voters = object_2_array($voters); foreach($voters as $key => $val) { $voteduserid = $val['user_id']; if($voteduserid == $friend->get_friend_status($this->author)) { $friendvoted = 1; } $smarty->assign('friendvoted', $friendvoted); }*/ if ($this->check_saved == true) { global $cached_saved_links; if (isset($cached_saved_links[$this->id])) { $smarty->assign('link_mine', $cached_saved_links[$this->id]); } else { $smarty->assign('link_mine', $db->get_row("SELECT * FROM " . table_saved_links . " WHERE saved_user_id={$current_user->user_id} AND saved_link_id={$this->id} LIMIT 1;")); } } $smarty->assign('user_url_saved', getmyurl('user2', $current_user->user_login, 'saved')); $smarty->assign('user_add_links_private', getmyurl('user_add_links_private', $this->id)); $smarty->assign('user_add_links_public', getmyurl('user_add_links_public', $this->id)); $smarty->assign('group_story_links_publish', getmyurl('group_story_links_publish', $this->id)); $smarty->assign('group_story_links_queued', getmyurl('group_story_links_queued', $this->id)); $smarty->assign('group_story_links_discard', getmyurl('group_story_links_discard', $this->id)); $smarty->assign('user_url_add_links', getmyurl('user_add_links', $this->id)); $smarty->assign('user_url_remove_links', getmyurl('user_remove_links', $this->id)); $smarty->assign('enable_tags', Enable_Tags); $smarty->assign('link_shakebox_index', $link_index); $smarty->assign('link_shakebox_votes', $this->votes); $smarty->assign('link_shakebox_showbury', $this->reports); $this->get_current_user_votes($current_user->user_id); $smarty->assign('link_shakebox_currentuser_votes', $this->current_user_votes); $smarty->assign('link_shakebox_currentuser_reports', $this->current_user_reports); if ($this->reports == -1) { // reporting was added to the svn and some people started using it // so in upgrade if someone already has the reports field, we set it to // -1. Then when we read() we check if -1. if it still is, update the count // from the votes table and store it into the link_reports field so we // don't have to look at the votes table again. $this->reports = $this->count_all_votes("<0"); $this->store_basic(); $smarty->assign('link_shakebox_reports', $this->reports); } $jslink = "vote({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',10)"; $jsreportlink = "vote({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10)"; $smarty->assign('link_shakebox_javascript_vote', $jslink); $jsunvote = "unvote({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',10)"; $smarty->assign('link_shakebox_javascript_unvote', $jsunvote); $smarty->assign('link_shakebox_javascript_report', $jsreportlink); if (!defined('alltagtext')) { // for pages like index, this ->display was being called for each story // which was sometimes 15+ times per page. this way it's just called once $smarty->display('blank.tpl'); //this is just to load the lang file so we can pull from it in php define('alltagtext', $smarty->get_config_vars('PLIGG_Visual_Tags_All_Tags')); } $alltagtext = alltagtext; if (Enable_Tags) { $smarty->assign('tags', $this->tags); if (!empty($this->tags)) { $tags_words = str_replace(", ", ",", $this->tags); $tags_count = substr_count($tags_words, ','); if ($tags_count > 1) { $tags_words = $tags_words; } $tag_array = explode(",", $tags_words); $c = count($tag_array); $tag_array[$c] = $this->tags; $c++; for ($i = 0; $i <= $c; $i++) { if (isset($tag_array[$i])) { if ($URLMethod == 1) { $tags_url_array[$i] = my_pligg_base . "/search.php?search=" . urlencode(trim($tag_array[$i])) . "&tag=true"; } elseif ($URLMethod == 2) { $tags_url_array[$i] = my_pligg_base . "/tag/" . urlencode(trim($tag_array[$i])); } } } $tag_array[$c - 1] = $alltagtext; $smarty->assign('tag_array', $tag_array); $smarty->assign('tags_url_array', $tags_url_array); $tags_url = urlencode($this->tags); $smarty->assign('tags_count', $tags_count); $smarty->assign('tags_words', $tags_words); $smarty->assign('tags_url', $tags_url); } } $smarty->assign('enable_group', enable_group); $smarty->assign('pagename', pagename); $smarty->assign('my_base_url', my_base_url); $smarty->assign('my_pligg_base', my_pligg_base); $smarty->assign('Default_Gravatar_Large', Default_Gravatar_Large); $link_index++; $vars['smarty'] = $smarty; check_actions('lib_link_summary_fill_smarty', $vars); return $smarty; }
function get_comments($fetch = false, $parent = 0, $comment_id = 0, $show_parent = 0) { global $db, $main_smarty, $current_user, $CommentOrder, $link, $cached_comments; //Set comment order to 1 if it's not set in the admin panel if (isset($_GET['comment_sort'])) { setcookie('CommentOrder', $CommentOrder = $_GET['comment_sort'], time() + 60 * 60 * 24 * 180); } elseif (isset($_COOKIE['CommentOrder'])) { $CommentOrder = $_COOKIE['CommentOrder']; } if (!isset($CommentOrder)) { $CommentOrder = 1; } if ($CommentOrder == 1) { $CommentOrderBy = "comment_votes DESC, comment_date DESC"; } if ($CommentOrder == 2) { $CommentOrderBy = "comment_date DESC"; } if ($CommentOrder == 3) { $CommentOrderBy = "comment_votes ASC, comment_date DESC"; } if ($CommentOrder == 4) { $CommentOrderBy = "comment_date ASC"; } $output = ''; if (checklevel('admin') || checklevel('moderator')) { $status_sql = " OR comment_status='moderated'"; } // get all parent comments if ($comment_id != 0) { $comments = $db->get_results("SELECT * \n\t FROM " . table_comments . " \n\t WHERE (comment_status='published' {$status_sql}) AND \n\t comment_link_id={$link->id} AND comment_id = {$comment_id} \n\t ORDER BY " . $CommentOrderBy); } elseif ($show_parent == 1) { $comments = $db->get_results("SELECT * \n\t FROM " . table_comments . " \n\t WHERE (comment_status='published' {$status_sql}) AND \n\t comment_link_id={$link->id} AND comment_id = {$parent} \n\t ORDER BY " . $CommentOrderBy); } else { $comments = $db->get_results("SELECT * \n\t FROM " . table_comments . " \n\t WHERE (comment_status='published' {$status_sql}) AND \n\t comment_link_id={$link->id} AND comment_parent = {$parent} \n\t ORDER BY " . $CommentOrderBy); } if ($comments) { require_once mnminclude . 'comment.php'; $comment = new Comment(); foreach ($comments as $dbcomment) { $comment->id = $dbcomment->comment_id; $cached_comments[$dbcomment->comment_id] = $dbcomment; $comment->read(); $output .= $comment->print_summary($link, true); $output .= "<div class='child-comment'>\n"; if ($comment_id == 0) { $output .= get_comments(true, $dbcomment->comment_id); } $output .= "</div>\n"; } if ($fetch == false) { echo $output; } else { return $output; } } }
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 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'); } } } }
<?php include_once '../internal/Smarty.class.php'; $main_smarty = new Smarty(); include '../config.php'; include mnminclude . 'html1.php'; include mnminclude . 'smartyvariables.php'; check_referrer(); // require user to log in force_authentication(); // restrict access to admins $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 0) { header("Location: " . getmyurl('admin_login', $_SERVER['REQUEST_URI'])); die; } if ($_GET['clear']) { $fp = fopen('../' . LOG_FILE, "a"); ftruncate($fp, 0); fclose($fp); header("Location: admin_log.php"); exit; } // pagename define('pagename', 'admin_log'); $main_smarty->assign('pagename', pagename); // show the template $main_smarty->assign('tpl_center', '/admin/error_log'); $main_smarty->display($template_dir . '/admin/admin.tpl');
// You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include_once '../Smarty.class.php'; $main_smarty = new Smarty(); include '../config.php'; include mnminclude . 'html1.php'; include mnminclude . 'link.php'; include mnminclude . 'smartyvariables.php'; include_once mnminclude . 'dbtree.php'; include mnminclude . 'qeip_0_3.php'; // require user to log in force_authentication(); // restrict access to god only $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); if ($canIhaveAccess == 0) { $main_smarty->assign('tpl_center', '/admin/admin_access_denied'); $main_smarty->display($template_dir . '/admin/admin.tpl'); die; } if (caching == 1) { // this is to clear the cache and reload it for settings_from_db.php clearCatCache(); } // breadcrumbs and page title $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'); $navwhere['link1'] = getmyurl('admin', ''); $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_2'); $navwhere['link2'] = my_pligg_base . "/admin_categories.php"; $main_smarty->assign('navbar_where', $navwhere);
<?php include_once 'Smarty.class.php'; $main_smarty = new Smarty(); include 'config.php'; include mnminclude . 'html1.php'; include mnminclude . 'link.php'; include mnminclude . 'group.php'; include mnminclude . 'smartyvariables.php'; include mnminclude . 'extra_fields_smarty.php'; $from_where = "1"; if (!checklevel('god')) { $from_where .= " AND group_status = 'Enable' "; } elseif ($_REQUEST["approve"] && is_numeric($_REQUEST["approve"])) { $db->query("UPDATE " . table_groups . " SET group_status='Enable' WHERE group_id=" . $db->escape(sanitize($_REQUEST["approve"], 3))); } $keyword = $db->escape(sanitize(trim($_REQUEST['keyword']), 3)); if ($keyword) { $from_where .= " AND (group_name LIKE '%{$keyword}%' OR group_description LIKE '%{$keyword}%')"; $main_smarty->assign('search', $keyword); } if ($_REQUEST["sortby"]) { $sortby = $_REQUEST["sortby"]; if ($sortby == 'newest') { $order_by = "group_date DESC"; } if ($sortby == 'oldest') { $order_by = "group_date ASC"; } if ($sortby == 'members') { $order_by = "group_members DESC";
function group_display($requestID) { global $db, $main_smarty, $the_template; if (!is_numeric($requestID)) { die; } $group = $db->get_row("SELECT * FROM " . table_groups . " WHERE group_id = {$requestID}"); if ($group) { $group_id = $group->group_id; $group_name = $group->group_name; $group_safename = $group->group_safename; $group_description = $group->group_description; $group_creator = $group->group_creator; $group_status = $group->group_status; $group_members = $group->group_members; $group_date = $group->group_date; $group_privacy = $group->group_privacy; $group_avatar = $group->group_avatar; $group_vote_to_publish = $group->group_vote_to_publish; $group_notify_email = $group->group_notify_email; $date = $db->get_var(" SELECT DATE_FORMAT(group_date, '%b, %e %Y') from " . table_groups . " WHERE group_id = {$group->group_id}"); //echo $date; $group_date = $date; //$group_date = date('M j, Y', $group->group_date); //smarty variables $main_smarty->assign('pretitle', "{$group_name} - {$group_description}"); $main_smarty->assign('group_id', $group_id); $main_smarty->assign('group_name', $group_name); $main_smarty->assign('group_safename', $group_safename); $main_smarty->assign('group_description', $group_description); $main_smarty->assign('group_creator', $group_creator); $main_smarty->assign('group_status', $group_status); $main_smarty->assign('group_members', $group_members); $main_smarty->assign('group_privacy', $group_privacy); $main_smarty->assign('group_avatar', $group_avatar); $main_smarty->assign('group_date', $group_date); $main_smarty->assign('group_notify_email', $group_notify_email); $main_smarty->assign('group_vote_to_publish', $group_vote_to_publish); //get group avatar path if ($group_avatar == "uploaded" && file_exists(mnmpath . "avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg")) { $imgsrc = my_base_url . my_pligg_base . "/avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg"; } else { $imgsrc = my_base_url . my_pligg_base . "/templates/" . $the_template . "/img/group_large.gif"; } $main_smarty->assign('imgsrc', $imgsrc); //get group creator and his urls $g_name = get_group_username($group_creator); $main_smarty->assign('group_submitter', $g_name); $main_smarty->assign('submitter_profile_url', getmyurl('user', $g_name)); $main_smarty->assign('group_avatar_url', getmyurl('group_avatar', $group_id)); //check group admin global $current_user; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); $canIhaveAccess = $canIhaveAccess + checklevel('moderator'); if ($current_user->user_id == $group_creator || $canIhaveAccess == 1) { $main_smarty->assign('is_group_admin', 1); } //check member //include_once(mnminclude.'group.php'); $main_smarty->assign('is_group_member', isMember($group_id)); //check isMemberActive $main_smarty->assign('is_member_active', isMemberActive($group_id)); // Joining and unjoining member links // Set the url to an empty string if the user has already joined the maximum // allowable number of groups if (reached_max_joinable_groups($db, $current_user)) { $join_url = ''; } else { $join_url = getmyurl('join_group', $group_id, $group_privacy); } $main_smarty->assign('join_group_url', $join_url); $main_smarty->assign('join_group_privacy_url', $join_url); $main_smarty->assign('unjoin_group_url', getmyurl("unjoin_group", $group_id, $group_privacy)); $main_smarty->assign('join_group_withdraw', getmyurl("join_group_withdraw", $group_id, $current_user->user_id)); //check logged or not $main_smarty->assign('user_logged_in', $current_user->user_login); //sidebar $main_smarty = do_sidebar($main_smarty); //$main_smarty->assign('form_action', $_SERVER["PHP_SELF"]); $group_story_url = getmyurl("group_story_title", $group_safename); $main_smarty->assign('group_story_url', $group_story_url); $main_smarty->assign('form_action', $group_story_url); $main_smarty->assign('edit_form_action', getmyurl("editgroup", $group_id)); $group_array = array($group_name, $group_description, $group_privacy); return $group_array; } }
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 = " "; 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"; } }
include '../config.php'; include mnminclude . 'html1.php'; include mnminclude . 'link.php'; include mnminclude . 'tags.php'; include mnminclude . 'smartyvariables.php'; check_referrer(); // require user to log in force_authentication(); // restrict access to admins and moderators $amIadmin = 0; $amIadmin = $amIadmin + checklevel('admin'); $main_smarty->assign('amIadmin', $amIadmin); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); $canIhaveAccess = $canIhaveAccess + checklevel('moderator'); $is_moderator = checklevel('moderator'); // Moderators have a value of '1' for the variable $is_moderator if ($canIhaveAccess == 0) { header("Location: " . getmyurl('admin_login', $_SERVER['REQUEST_URI'])); die; } // misc smarty $main_smarty->assign('isAdmin', $canIhaveAccess); // sidebar $main_smarty = do_sidebar($main_smarty); // pagename define('pagename', 'admin_group'); $main_smarty->assign('pagename', pagename); // read the mysql database to get the pligg version $sql = "SELECT data FROM " . table_misc_data . " WHERE name = 'pligg_version'"; $pligg_version = $db->get_var($sql);
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include_once 'Smarty.class.php'; $main_smarty = new Smarty(); include 'config.php'; include mnminclude . 'html1.php'; include mnminclude . 'link.php'; include mnminclude . 'tags.php'; include mnminclude . 'user.php'; include mnminclude . 'smartyvariables.php'; if (!$_COOKIE['referrer']) { check_referrer(); } // html tags allowed during submit if (checklevel('god')) { $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_God; } elseif (checklevel('admin')) { $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Admin; } else { $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Normal; } $main_smarty->assign('Story_Content_Tags_To_Allow', htmlspecialchars($Story_Content_Tags_To_Allow)); // breadcrumbs and page titles $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Breadcrumb_Submit'); $navwhere['link1'] = getmyurl('submit', ''); $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('posttitle', $main_smarty->get_config_vars('PLIGG_Visual_Breadcrumb_Submit')); $main_smarty = do_sidebar($main_smarty); //to check anonymous mode activated global $current_user; if ($current_user->authenticated != TRUE) { $vars = '';
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; } }
function fill_smarty($smarty) { global $current_user, $the_template, $comment_counter, $link, $ranklist, $db; if (!$ranklist) { $users = $db->get_results("SELECT user_karma, COUNT(*) FROM " . table_users . " WHERE user_level NOT IN ('Spammer') AND user_karma>0 GROUP BY user_karma ORDER BY user_karma DESC", ARRAY_N); $ranklist = array(); $rank = 1; if ($users) { foreach ($users as $dbuser) { $ranklist[$dbuser[0]] = $rank; $rank += $dbuser[1]; } } } $smarty->assign('comment_counter', $comment_counter); $text = save_text_to_html($this->content); $vars = array('comment_text' => $text, 'comment_id' => $this->id, 'smarty' => $smarty); check_actions('show_comment_content', $vars); $smarty->assign('comment_content', $vars['comment_text']); $vars = array('comment_form_label' => ''); check_actions('comment_form_label', $vars); $smarty->assign('comment_form_label', $vars['comment_form_label']); $smarty->assign('current_userid', $current_user->user_id); $smarty->assign('user_logged_in', $current_user->user_login); $vars = array('comment_username' => $this->username(), 'is_anonymous' => 0, 'comment_id' => $this->id); check_actions('show_comment_username', $vars); $smarty->assign('user_username', $vars['comment_username']); $smarty->assign('user_rank', $ranklist[$this->userkarma]); $smarty->assign('is_anonymous', $vars['is_anonymous']); $smarty->assign('user_extra_fields', $this->extra_field); //$smarty->assign('link_submitter', $link->username()); $smarty->assign('comment_id', $this->id); $smarty->assign('comment_status', $this->status); $smarty->assign('comment_author', $this->author); $smarty->assign('comment_link', $this->link); $smarty->assign('user_view_url', getmyurl('user', $this->username)); $smarty->assign('comment_date_timestamp', $this->date); $smarty->assign('comment_date', date('F, d Y g:i A', $this->date)); $smarty->assign('comment_age', txt_time_diff($this->date)); $smarty->assign('comment_randkey', $this->randkey); $smarty->assign('comment_votes', $this->votes); $smarty->assign('comment_parent', $this->parent); $smarty->assign('hide_comment_edit', $this->hideedit); $this->user_vote_count = $this->votes($current_user->user_id); $smarty->assign('comment_user_vote_count', $this->user_vote_count); $smarty->assign('comment_shakebox_currentuser_votes', $this->votes($current_user->user_id, '>0')); $smarty->assign('comment_shakebox_currentuser_reports', $this->votes($current_user->user_id, '<0')); // if the person logged in is the person viewing the comment, show 'you' instead of the name $smarty->assign('user_userlogin', $this->username); // the url for the edit comment link $smarty->assign('edit_comment_url', getmyurl('editcomment', $this->id, $link->id)); $smarty->assign('delete_comment_url', my_pligg_base . '/delete.php?comment_id=' . $this->id); // avatars $smarty->assign('UseAvatars', do_we_use_avatars()); $smarty->assign('Avatar', $avatars = get_avatar('all', '', $this->username, '')); $smarty->assign('Avatar_ImgSrc', $avatars['large']); $smarty->assign('Avatar_ImgSrc_Small', $avatars['small']); // does the person logged in have admin or moderator status? $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); $canIhaveAccess = $canIhaveAccess + checklevel('moderator'); if ($canIhaveAccess == 1) { $smarty->assign('isadmin', 1); } // the link to upvote the comment $jslinky = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_votey', $jslinky); $jslinky = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_unvotey', $jslinky); // the link to downvote the comment $jslinkn = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_voten', $jslinkn); $jslinkn = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_unvoten', $jslinkn); // misc $smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting); $smarty->assign('my_base_url', my_base_url); $smarty->assign('my_pligg_base', my_pligg_base); $smarty->assign('Default_Gravatar_Small', Default_Gravatar_Small); return $smarty; }
<?php include_once '../internal/Smarty.class.php'; $main_smarty = new Smarty(); include '../config.php'; include mnminclude . 'html1.php'; include mnminclude . 'link.php'; include mnminclude . 'tags.php'; include mnminclude . 'smartyvariables.php'; //check_referrer(); // restrict access to admins and moderators force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); $canIhaveAccess = $canIhaveAccess + checklevel('moderator'); if ($canIhaveAccess == 1) { if (isset($_REQUEST["action"])) { $id = sanitize($_REQUEST["id"], 3); $action = sanitize($_REQUEST["action"], 3); if (!is_numeric($id)) { die; } if ($action == "main") { if ($link = $db->get_row("SELECT * FROM " . table_links . " WHERE link_id = {$id}")) { $author = $db->get_row("Select * from " . table_users . " where user_id = {$link->link_author}"); //misc smarty $main_smarty->assign('link_id', $link->link_id); $main_smarty->assign('link_title', $link->link_title); $main_smarty->assign('link_url', $link->link_url); $main_smarty->assign('link_content', $link->link_content); $main_smarty->assign('link_status', $link->link_status);