<?php require_once './header.php'; logged_in_only(); $delete = set_post_string_var('delete'); $create = set_post_string_var('create'); $new_username = set_post_string_var('new_username'); $new_password = set_post_string_var('new_password'); $new_admin = set_post_bool_var('new_admin', false); $existing_user = set_post_string_var('existing_user'); $noconfirm = set_get_noconfirm(); $message1 = ''; $message2 = ''; ?> <h1 id="caption">Admin Page</h1> <!-- Wrapper starts here. --> <div style="min-width: <?php echo 230 + $settings['column_width_folder']; ?> px;"> <!-- Menu starts here. --> <div id="menu"> <h2 class="nav">Bookmarks</h2> <ul class="nav"> <li><a href="./index.php">My Bookmarks</a></li> <li><a href="./shared.php">Shared Bookmarks</a></li> </ul> <h2 class="nav">Tools</h2>
<?php require_once "./header.php"; $secret = "dDWUc72sCcs20cXskcw"; $reg_register = set_post_bool_var('reg_register', false); $reg_username = set_post_string_var('reg_username'); $reg_email = set_post_string_var('reg_email'); $confirm = set_get_string_var('confirm'); if ($reg_register) { if ($reg_username != "") { if (check_username($reg_username)) { echo '<div style="color:red;">$username is an already registered user. Choose another one.</div>' . "\n"; $username = false; } else { $username = $reg_username; } } else { echo '<div style="color:red;">Please enter a Username.</div>' . "\n"; $username = false; } if (isset($_POST['reg_password1']) && $_POST['reg_password1'] != "" && isset($_POST['reg_password2']) && $_POST['reg_password2'] != "") { if (md5($_POST['reg_password1']) != md5($_POST['reg_password2'])) { echo '<div style="color:red;">Passwords do not match.</div>' . "\n"; $password = false; } else { $password = md5($_POST['reg_password1']); } } else { echo '<div style="color:red;">Please fill out both password fields.</div>' . "\n"; $password = false; }
<?php require_once "./header.php"; logged_in_only(); $bmlist = set_get_num_list('bmlist'); $post_title = set_post_title(); $post_url = set_post_url(); $post_description = set_post_description(); $post_icon = set_post_bool_var('favicon', false); $post_childof = set_post_childof(); $post_public = set_post_bool_var("public", false); if (count($bmlist) > 1) { # if there is more than one bookmark to edit, we just care about the # public/private field. if (!isset($_POST['public'])) { $qbmlist = implode(",", $bmlist); $query = sprintf("SELECT title, id, public, favicon FROM bookmark WHERE id IN (%s) AND user='******' ORDER BY title", $mysql->escape($qbmlist), $mysql->escape($username)); if ($mysql->query($query)) { require_once ABSOLUTE_PATH . "bookmarks.php"; $query_string = "?bmlist=" . implode("_", $bmlist); ?> <h2 class="title">Change public state:</h2> <div style="width:100%; height:330px; overflow:auto;"> <?php $bookmarks = array(); while ($row = mysql_fetch_assoc($mysql->result)) { array_push($bookmarks, $row); } list_bookmarks($bookmarks, false, false, $settings['show_bookmark_icon'], false, false, false, false, false, false, true, false);
function import() { global $username, $parentfolder, $mysql; # open the importfile $this->fp = fopen($_FILES['importfile']['tmp_name'], "r"); if ($this->fp == null) { message("Failed to open file"); } $this->charset = set_post_charset(); $this->public = set_post_bool_var("public", false); $this->count_folders = 0; $this->count_bookmarks = 0; $this->username = $username; $this->parent_folder = $parentfolder; $this->current_folder = $this->parent_folder; $this->folder_depth = array(); $this->mysql = $mysql; }
<?php require_once "./header.php"; logged_in_only(); $message = ''; if (isset($_POST['settings_apply'])) { $settings = array('root_folder_name' => set_post_foldername("settings_root_folder_name"), 'column_width_folder' => check_num_var("settings_column_width_folder"), 'column_width_bookmark' => check_num_var("settings_column_width_bookmark"), 'table_height' => check_num_var("settings_table_height"), 'confirm_delete' => set_post_bool_var("settings_confirm_delete", false), 'open_new_window' => set_post_bool_var("settings_open_new_window", false), 'show_bookmark_description' => set_post_bool_var("settings_show_bookmark_description", false), 'show_bookmark_icon' => set_post_bool_var("settings_show_bookmark_icon", false), 'show_column_date' => set_post_bool_var("settings_show_column_date", false), 'date_format' => check_date_format(), 'show_column_edit' => set_post_bool_var("settings_show_column_edit", false), 'show_column_move' => set_post_bool_var("settings_show_column_move", false), 'show_column_delete' => set_post_bool_var("settings_show_column_delete", false), 'fast_folder_minus' => set_post_bool_var("settings_fast_folder_minus", false), 'fast_folder_plus' => set_post_bool_var("settings_fast_folder_plus", false), 'fast_symbol' => set_post_bool_var("settings_fast_symbol", false), 'simple_tree_mode' => set_post_bool_var("settings_simple_tree_mode", false), 'show_public' => set_post_bool_var("settings_show_public", false), 'theme' => set_post_string_var("settings_theme", '')); $query = sprintf("UPDATE user SET\n\t\troot_folder_name\t\t\t='%s',\n\t\tcolumn_width_folder\t\t\t='%d',\n\t\tcolumn_width_bookmark\t\t='%d',\n\t\ttable_height\t\t\t\t='%d',\n\t\tconfirm_delete\t\t\t\t='%d',\n\t\topen_new_window\t\t\t\t='%d',\n\t\tshow_bookmark_description\t='%d',\n\t\tshow_bookmark_icon\t\t\t='%d',\n\t\tshow_column_date\t\t\t='%d',\n\t\tdate_format\t\t\t\t\t='%s',\n\t\tshow_column_edit\t\t\t='%d',\n\t\tshow_column_move\t\t\t='%d',\n\t\tshow_column_delete\t\t\t='%d',\n\t\tfast_folder_minus\t\t\t='%d',\n\t\tfast_folder_plus\t\t\t='%d',\n\t\tfast_symbol\t\t\t\t\t='%d',\n\t\tsimple_tree_mode\t\t\t='%d',\n\t\tshow_public\t\t\t\t\t='%d',\n\t\ttheme\t\t\t\t\t\t='%s'\n\t\tWHERE username='******'", $mysql->escape($settings['root_folder_name']), $settings['column_width_folder'], $settings['column_width_bookmark'], $settings['table_height'], $settings['confirm_delete'], $settings['open_new_window'], $settings['show_bookmark_description'], $settings['show_bookmark_icon'], $settings['show_column_date'], $mysql->escape($settings['date_format']), $settings['show_column_edit'], $settings['show_column_move'], $settings['show_column_delete'], $settings['fast_folder_minus'], $settings['fast_folder_plus'], $settings['fast_symbol'], $settings['simple_tree_mode'], $settings['show_public'], $mysql->escape($settings['theme']), $mysql->escape($username)); if ($mysql->query($query)) { $message = "Settings applied."; } else { message($mysql->error); } } # I really don't feel like putting these very specific function into lib.php... function check_num_var($varname) { if (!is_numeric($_POST[$varname])) { return 280; } else { if ($_POST[$varname] == 0 && $varname == "settings_column_width_bookmark") { return 0; } else { if ($_POST[$varname] < 0) { return 0; } else { if ($_POST[$varname] > 800) { return 800; } else { return $_POST[$varname]; }
<body> <?php $mysql_hostname = set_post_string_var('mysql_hostname', 'localhost'); $mysql_db_name = set_post_string_var('mysql_db_name', 'bookmarks'); $mysql_db_username = set_post_string_var('mysql_db_username', 'bookmarkmgr'); $mysql_db_password = set_post_string_var('mysql_db_password'); $mysql_db_create = set_post_bool_var('mysql_db_create', false); $mysql_db_su_username = set_post_string_var('mysql_db_su_username', 'root'); $mysql_db_su_password = set_post_string_var('mysql_db_su_password'); $cookie_name = set_post_string_var('cookie_name', 'ob_cookie'); $cookie_domain = set_post_string_var('cookie_domain', ''); $cookie_path = set_post_string_var('cookie_path', '/'); $cookie_seed = set_post_string_var('cookie_seed', random_string()); $cookie_expire = set_post_string_var('cookie_expire', '31536000'); $submit = set_post_bool_var('submit', false); $admin_message = ''; if (intval(str_replace('.', '', phpversion())) < 430) { print_msg('You are running PHP version ' . PHP_VERSION . '. Online-Bookmarks requires at least PHP 4.3.0 to run properly. You must upgrade your PHP installation before you can continue.', "error"); } ############## database control ############## function create_table_bookmark() { $query = "CREATE TABLE bookmark (\n\t\t\tuser char(20) NOT NULL default '',\n\t\t\ttitle char(70) NOT NULL default '',\n\t\t\turl char(200) NOT NULL default '',\n\t\t\tdescription mediumtext default NULL,\n\t\t\tprivate enum('0','1') default NULL,\n\t\t\tdate timestamp NOT NULL,\n\t\t\tchildof int(11) NOT NULL default '0',\n\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\tdeleted enum('0','1') NOT NULL default '0',\n\t\t\tfavicon varchar(200),\n\t\t\tpublic enum('0','1') NOT NULL default '0',\n\t\t\tPRIMARY KEY (id),\n\t\t\tFULLTEXT KEY title (title,url,description)\n\t\t) ENGINE=MyISAM"; if (mysql_query($query)) { return true; } else { return false; } } function create_table_folder()
<?php require_once "./header.php"; logged_in_only(); $foldername = set_post_foldername(); $public = set_post_bool_var("public", false); $inherit = set_post_bool_var("inherit", false); if ($folderid == "" || $folderid == "0") { message("No Folder selected"); } else { if ($foldername == "") { $query = sprintf("SELECT name, public FROM folder WHERE id='%d' AND user='******' AND deleted!='1'", $mysql->escape($folderid), $mysql->escape($username)); if ($mysql->query($query)) { if (mysql_num_rows($mysql->result) == 1) { $row = mysql_fetch_object($mysql->result); } else { message("No Folder to edit."); } } else { message($mysql->error); } ?> <h2 class="title">Edit Folder</h2> <form action="<?php echo $_SERVER['SCRIPT_NAME'] . "?folderid=" . $folderid; ?> " id="fedit" method="POST"> <p><input type=text name="foldername" size="50" value="<?php echo $row->name; ?>