} else { SaveSettings(); redirect('index.php'); } $selfurl = $Paths['pivot_url'] . 'selfreg.php'; if (isset($_GET['w']) && !empty($_GET['w'])) { $selfurl .= '?w=' . $_GET['w']; } // Printing out the form - not using the StartForm function // since we need this file as the action URL. echo "<h2>" . lang('userinfo', 'selfreg') . "</h2>\n"; echo '<form method="post" action="' . $selfurl . '" class="nopadding">' . "\n"; GenSetting('step', '', '', 7, $setupstepn); StartTable($caption); DisplaySettings(${$var}); EndForm($next, 1); $form = ob_get_contents(); ob_end_clean(); $db = new db(); // Use the extra template for the current weblog if (isset($Weblogs[$Current_weblog]['extra_template']) && $Weblogs[$Current_weblog]['extra_template'] != "") { $template_html = load_template($Weblogs[$Current_weblog]['extra_template']); } else { $template_html = load_template($Weblogs[$Current_weblog]['archive_template']); } // Match and replace the [[weblog]] tags for the form output if (preg_match_all('/\\[\\[(sub)?weblog:(.*)?(:[0-9]*)?\\]\\]/siU', $template_html, $match)) { if (count($match[1]) == 1) { $template_html = str_replace($match[0][0], $form, $template_html); } else { $template_html = preg_replace("/\\[\\[(sub)?weblog:standard(:[0-9]*)?\\]\\]/siU", $form, $template_html);
/** * The screen to edit a weblog, screen 3 */ function main_blogs_edit3() { global $Pivot_Vars, $blog_settings, $Weblogs; PageHeader(lang('weblog_config', 'create_3')); PageAnkeiler(lang('userbar', 'admin') . ' » ' . lang('weblog_config', 'create_3')); if (isset($Pivot_Vars['orig_name']) && strlen($Pivot_Vars['orig_name']) > 1) { $blog_settings = $Weblogs[$Pivot_Vars['orig_name']]; $orig_name = $Pivot_Vars['orig_name']; MidHeading(sprintf(lang('weblog_config', 'edit_weblog') . ' \'%s\'', $Weblogs[$Pivot_Vars['orig_name']]['name'])); } else { $blog_settings = get_tempweblog(); $orig_name = ""; MidHeading(lang('weblog_config', 'create_new')); } $temp_subweblogs = $Pivot_Vars['sub_weblog']; foreach ($temp_subweblogs as $subweblog => $dummy) { // fix the subweblogs' categories.. if (count($temp_subweblogs[$subweblog]['categories']) > 0) { foreach ($temp_subweblogs[$subweblog]['categories'] as $cat => $dummy) { unset($temp_subweblogs[$subweblog]['categories'][$cat]); $temp_subweblogs[$subweblog]['categories'][] = $cat; } } else { // you are an idiot if you did not select any categories.. $temp_subweblogs[$subweblog]['categories'] = array(); } } // unserialize the parsed temp_weblog.. $temp_weblog = unserialize(urldecode($Pivot_Vars['temp_weblog'])); // merge temp_weblog with temp_subweblogs $temp_weblog['sub_weblog'] = $temp_subweblogs; StartForm('blog_save', 1); StartTable(); EndForm(lang('weblog_config', 'create'), 2); $settings = get_weblog_config3(); $settings[] = array('orig_name', 'originalname', '', 7, $orig_name); $settings[] = array('temp_weblog', 'tempweblog', '', 7, urlencode(serialize($temp_weblog))); DisplaySettings($settings, 'blog_settings'); EndForm(lang('weblog_config', 'create'), 1); PageFooter(); }
/** * Displays the screen to edit and delete trackbacks. * * @param string $msg * @see submit_trackback() */ function edit_trackbacks($msg = "") { global $Cfg, $Pivot_Vars, $Users; PageHeader(lang('userbar', 'trackbacks'), 1); PageAnkeiler(lang('userbar', 'trackbacks') . ' » ' . lang('userbar', 'trackbacks_title')); $id = $Pivot_Vars['id']; $db = new db(); // read entry if it's not in memory yet. $db->read_entry($id, true); printf("<p><strong>%s</strong>: %s<br />", lang('entries', 'title'), $db->entry['title']); printf("<strong>%s</strong>: %s<br />", lang('entries', 'author'), $db->entry['user']); printf("<strong>%s</strong>: %s</p><br />", lang('entries', 'date'), $db->entry['date']); if ($Pivot_Vars['user'] == $db->entry['user']) { // allowed to edit own trackbacks MinLevel(2); } else { // allowed to edit trackbacks on other people's entries MinLevel(3); } if (!$db->entry['trackbacks'] || count($db->entry['trackbacks']) < 1) { // print if there are no trackbacks echo "<p><B>" . lang('notice', 'trackback_none') . "</b><br /><br /></p>"; } else { // print the trackbacks.. // perhaps delete a trackback. if (isset($Pivot_Vars['del'])) { $del_track = $db->entry['trackbacks'][$Pivot_Vars['del']]; //remove the trackback from last_trackbacks if it's in there.. if (file_exists("db/ser_lasttrack.php")) { $last_tracks = load_serialize("db/ser_lasttrack.php", true, true); } else { $last_tracks = array(); } if ($last_tracks !== false && count($last_tracks) > 0) { foreach ($last_tracks as $key => $last_track) { if ($last_track['code'] == $db->entry['code'] && $last_track['name'] == $del_track['name'] && $last_track['date'] == $del_track['date']) { unset($last_tracks[$key]); save_serialize("db/ser_lasttrack.php", $last_tracks); } } } // *argh* evil hack to directly delete trackbacks.. I should write a // proper wrapper unset($db->entry['trackbacks'][$Pivot_Vars['del']]); unset($db->db_lowlevel->entry['trackbacks'][$Pivot_Vars['del']]); $db->save_entry(); $msg = lang('notice', 'trackback_deleted'); } // perhaps add an ip-block for single ip. if (isset($Pivot_Vars['blocksingle'])) { $msg = "Added block for IP " . $Pivot_Vars['blocksingle']; add_block($Pivot_Vars['blocksingle']); } // perhaps add an ip-block for single ip. if (isset($Pivot_Vars['blockrange'])) { $iprange = make_mask($Pivot_Vars['blockrange']); $msg = "Added block for IP-range " . $iprange; add_block($iprange); } // perhaps remove an ip-block for single ip. if (isset($Pivot_Vars['unblocksingle'])) { $msg = "Removed block for IP " . $Pivot_Vars['unblocksingle']; rem_block($Pivot_Vars['unblocksingle']); } // perhaps remove an ip-block for single ip. if (isset($Pivot_Vars['unblockrange'])) { $iprange = make_mask($Pivot_Vars['unblockrange']); $msg = "Removed block for IP-range " . $iprange; rem_block($iprange); } // print a message, if there is one. if ($msg != "") { echo "<p><B>{$msg}</b><br /><br /></p>"; } // show the edit form, to edit a trackback.. if (isset($Pivot_Vars['edit'])) { StartForm('submittrackback', 0); StartTable(); $mytrack = $db->entry['trackbacks'][$Pivot_Vars['edit']]; $settings = array(); $settings[] = array('heading', lang('weblog_config', 'shortentry_template'), '', 8, '', 2, ''); $settings[] = array('id', '', '', 7, $id, '', ''); $settings[] = array('count', '', '', 7, $Pivot_Vars['edit'], '', ''); $settings[] = array('name', lang('weblog_text', 'blog_name'), '', 0, unentify($mytrack['name']), 60, ''); $settings[] = array('title', lang('weblog_text', 'title'), '', 0, unentify($mytrack['title']), 60, ''); $settings[] = array('excerpt', lang('weblog_text', 'excerpt'), '', 5, unentify($mytrack['excerpt']), '60', 'rows=5'); $settings[] = array('url', lang('weblog_text', 'url'), '', 0, $mytrack['url'], 60, ''); $settings[] = array('ip', lang('weblog_text', 'ip'), '', 0, $mytrack['ip'], 30, ''); $settings[] = array('date', lang('weblog_text', 'date'), '', 0, $mytrack['date'], 30, ''); DisplaySettings($settings, 'blog_settings'); EndForm(lang('weblog_config', 'save_trackback'), 1); } // print out all the trackbacks.. foreach ($db->entry['trackbacks'] as $key => $trackback) { $myblock = block_type($trackback['ip']); if ($myblock == "single" || $myblock == "range") { $strike = "style='text-decoration: line-through;'"; } else { $strike = ""; } // strip stuff from lamers' trackbacks.. $trackback['url'] = strip_tags($trackback['url']); printf("<table border=0 cellpadding=2 cellspacing=2 width='95%%' style='border-bottom:" . " 2px solid #999;'><tr><td width='40%%' valign='top'>" . lang('weblog_text', 'title') . ": <b %s>%s</b><br />", $strike, stripslashes($trackback['title'])); printf(lang('weblog_text', 'blog_name') . ": %s<br />", $trackback['name']); printf(lang('weblog_text', 'url') . ": %s<br />", $trackback['url']); printf(lang('weblog_text', 'ip') . ": %s<br />", $trackback['ip']); printf(lang('weblog_text', 'date') . ": %s<br />", $trackback['date']); printf("<td valign='top'><span %s>%s</span></td>", $strike, nl2br(htmlspecialchars($trackback['excerpt']))); // only show the option to edit and delete links if the user is an advanced user. if ($Users[$Pivot_Vars['user']]['userlevel'] >= 2) { $link = sprintf("index.php?session=%s&menu=entries&func=edittrackbacks&", $Pivot_Vars['session']); $editlink = sprintf("%sid=%s&edit=%s", $link, $db->entry['code'], $key); $dellink = sprintf("%sid=%s&del=%s", $link, $db->entry['code'], $key); $reportpopup = sprintf("openReportTrackback('%s', '%s','%s','%s');", $Pivot_Vars['session'], $db->entry['code'], $key, $dellink); printf("</tr><tr class='tabular_line_odd'><td><a href='%s'>%s</a> /", $editlink, lang('entries', 'edit_trackback')); printf(" <a href='%s'>%s</a> / ", $dellink, lang('entries', 'delete_trackback')); // only ping. // printf(" <a href='#' onclick=\"%s\">%s</a> ", $reportpopup, lang('entries', 'report_trackback') ); // ping and delete printf(" <a href='#' onclick=\"%s\">%s</a> ", $reportpopup, lang('entries', 'report_trackback')); } else { printf("<td> </td>"); } // only show the option to add or remove ip-blocks if the user is an administrator. if ($Users[$Pivot_Vars['user']]['userlevel'] >= 3) { if ($myblock == "none") { $blocktext1 = str_replace("%s", $trackback['ip'], lang('entries', 'block_single')); $blocklink1 = sprintf("%sid=%s&blocksingle=%s", $link, $db->entry['code'], $trackback['ip']); $blocktext2 = str_replace("%s", make_mask($trackback['ip']), lang('entries', 'block_range')); $blocklink2 = sprintf("%sid=%s&blockrange=%s", $link, $db->entry['code'], $trackback['ip']); printf("<td><a href='%s'>%s</a> / ", $blocklink1, $blocktext1); printf("<a href='%s'>%s</a></td>", $blocklink2, $blocktext2); } else { if ($myblock == "single") { $blocktext1 = str_replace("%s", $trackback['ip'], lang('entries', 'unblock_single')); $blocklink1 = sprintf("%sid=%s&unblocksingle=%s", $link, $db->entry['code'], $trackback['ip']); printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1); } else { $blocktext1 = str_replace("%s", make_mask($trackback['ip']), lang('entries', 'unblock_range')); $blocklink1 = sprintf("%sid=%s&unblockrange=%s", $link, $db->entry['code'], $trackback['ip']); printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1); } } } else { printf("<td> </td>"); } printf("</td></tr></table><br />"); } // end of printing trackbacks } // Table for editing the entry / trackbacks (this will be replaced after 1.30, // When we put the form-builder in place. echo '<table width="95%" border="0" cellpadding="5" cellspacing="0">'; $link = sprintf("index.php?session=%s&menu=entries&func=modify&id=%s", $Pivot_Vars['session'], $db->entry['code']); printf('<!-- edit entry --><tr><td width="32" valign="top">'); print_icon('overview', 'new_entry', "<a href=\"" . $link . "\">"); printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_entry'), lang('entries', 'edit_entry_desc')); $link = sprintf("index.php?session=%s&menu=entries&func=editcomments&id=%s", $Pivot_Vars['session'], $db->entry['code']); printf('<!-- edit comments --><tr><td width="32" valign="top">'); print_icon('entry', 'edit_comments', "<a href=\"" . $link . "\">"); printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_comments'), lang('entries', 'edit_comments_desc')); $link = sprintf("index.php?session=%s&menu=entries&doaction=1&action=delete&check[%s]=1", $Pivot_Vars['session'], $db->entry['code']); printf('<!-- delete entry --><tr><td width="32" valign="top">'); print_icon('entry', 'del_entry', "<a href=\"" . $link . "\">"); printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'delete_entry'), lang('entries', 'delete_entry_desc')); echo "</table>"; // End of table for editing the entry / trackbacks PageFooter(); echo "<br /><br /><br /><br />"; }
/** * Creates the form to change the user settings. * * @param int $admin * @param int $erred * @param array $newdata */ function libchange_user($admin = 0, $erred = 0, $newdata = '') { global $Pivot_Vars, $Users, $ThisUser, $Cfg; if ($erred == 0) { $userfields = get_userfields($admin); } else { $userfields = $newdata; } if ($admin == 1) { $theuser = $Pivot_Vars['edituser']; $ThisUser = $Users[$theuser]; } else { $theuser = $Pivot_Vars['user']; } MinLevel($Users[$theuser]['userlevel']); StartForm('save_user', $admin); GenSetting('username', '', '', 7, $theuser, '', ''); StartTable(); // so the user can't change his name.. $userfields[0][4] = $theuser; $userfields[0][6] = "disabled='disabled'"; // make sure superadmin doesn't demote himself. if ($admin == 1 && $Users[$theuser]['userlevel'] > 3) { foreach ($userfields as $key => $userfield) { // this loop makes sure we don't set the wrong field.. if ($userfield[0] == "userlevel") { $userfields[$key][4] = array('0' => lang('userlevels', 4 - $Users[$theuser]['userlevel']), '1' => $Users[$theuser]['userlevel']); } } } if ($erred == 0) { $ufields = GetUserFields(); foreach ($ufields as $keyname => $arrg) { // Skipping fields that we aren't allowed to change if ($admin != 1 && $Users[$theuser]['userlevel'] < $ufields[$keyname]['minlevel']) { continue; } $type = 0; if (is_int($ufields[$keyname]['maxlen'])) { $maxl = 'maxlength=\\"' . $ufields[$keyname]['maxlen'] . '\\"'; } else { $maxl = ''; } array_push($userfields, array($keyname, $ufields[$keyname]['disp'], '', $ufields[$keyname]['type'], $Users[$theuser][$keyname], $ufields[$keyname]['size'], $maxl)); } } // checkboxes for allowed categories if ($Users[$Pivot_Vars['user']]['userlevel'] > 2) { $userfields[] = array('heading', lang('config', 'allowed_cats'), '', 8, '', 2); foreach (explode("|", $Cfg['cats']) as $cat) { if ($cat != "") { $label = sprintf(' ' . $cat); $allowed_users = explode("|", $Cfg['cat-' . $cat]); $cat_encoded = urlencode($cat); if (in_array($theuser, $allowed_users)) { $userfields[] = array('allowed[' . $cat_encoded . ']', $label, '', 2, 1, '', ''); } else { $userfields[] = array('allowed[' . $cat_encoded . ']', $label, '', 2, 0, '', ''); } } } $userfields[count($userfields) - 1][2] = lang('config', 'allowed_cats_desc'); } DisplaySettings($userfields, 'ThisUser'); if ($Pivot_Vars['func'] == 'admin' && ($Pivot_Vars['do'] == 'edituser' || $Pivot_Vars['do'] == 'save_user') && $Users[$Pivot_Vars['user']]['userlevel'] > $Users[$theuser]['userlevel']) { GenSetting('heading', lang('general', 'delete'), '', 8); GenSetting('delete_user', lang('config', 'delete_user'), lang('config', 'delete_user_desc'), 3, 'yn'); } EndForm(lang('userinfo', 'edituser_button'), 1); }