if (valid_connection($link, $connection_id)) { db_query($link, "DELETE FROM ttirc_servers WHERE\n\t\t\t\tid in ({$ids}) AND connection_id = '{$connection_id}'"); print_servers($link, $connection_id); } break; case "delete-connection": $ids = db_escape_string($_REQUEST["ids"]); db_query($link, "DELETE FROM ttirc_connections WHERE\n\t\t\tid IN ({$ids}) AND status = 0 AND owner_uid = " . $_SESSION["uid"]); print_connections($link); break; case "create-connection": $title = db_escape_string(trim($_REQUEST["title"])); if ($title) { db_query($link, "INSERT INTO ttirc_connections (enabled, title, owner_uid)\n\t\t\t\tVALUES ('false', '{$title}', '" . $_SESSION["uid"] . "')"); } print_connections($link); break; case "fetch-profiles": $login = db_escape_string($_REQUEST["login"]); $password = db_escape_string($_REQUEST["password"]); if (authenticate_user($link, $login, $password)) { $result = db_query($link, "SELECT * FROM ttirc_settings_profiles\n\t\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY title"); print "<select style='width: 100%' name='profile'>"; print "<option value='0'>" . __("Default profile") . "</option>"; while ($line = db_fetch_assoc($result)) { $id = $line["id"]; $title = $line["title"]; print "<option value='{$id}'>{$title}</option>"; } print "</select>"; $_SESSION = array();
function main_prefs($link) { $_SESSION["prefs_cache"] = false; $result = db_query($link, "SELECT * FROM ttirc_users WHERE\n\t\tid = " . $_SESSION["uid"]); $realname = db_fetch_result($result, 0, "realname"); $nick = db_fetch_result($result, 0, "nick"); $email = db_fetch_result($result, 0, "email"); $quit_message = db_fetch_result($result, 0, "quit_message"); $highlight_on = get_pref($link, "HIGHLIGHT_ON"); ?> <div id="infoBoxTitle"><?php echo __("Preferences"); ?> </div> <div class="infoBoxContents"> <form id="prefs_form" onsubmit="return false;"> <div id="mini-notice" style='display : none'> </div> <input type="hidden" name="op" value="prefs-save"/> <div class="dlgSec"><?php echo __('Personal data'); ?> </div> <div class="dlgSecCont"> <label class="fixed"><?php echo __('Real name:'); ?> </label> <input name="realname" size="30" value="<?php echo $realname; ?> "> <br clear='left'/> <label class="fixed"><?php echo __('Nickname:'); ?> </label> <input name="nick" size="30" value="<?php echo $nick; ?> "> <br clear='left'/> <label class="fixed"><?php echo __('E-mail:'); ?> </label> <input name="email" size="30" value="<?php echo $email; ?> "> <br clear='left'/> <label class="fixed"><?php echo __('Quit message:'); ?> </label> <input name="quit_message" size="30" value="<?php echo $quit_message; ?> "> <br clear='left'/> <label class="fixed"><?php echo __('Highlight on:'); ?> </label> <input name="highlight_on" size="30" value="<?php echo $highlight_on; ?> "> <br clear='left'/> <label class="fixed"><?php echo __('Theme:'); ?> </label> <?php print_theme_select($link); ?> <a href="#" onclick="customize_css()"> <?php echo __("Customize"); ?> </a> <br clear='left'/> <label class="fixed"> </label> <a href="#" onclick="configure_notifications()"><?php echo __('Configure desktop notifications'); ?> </a> <?php if (CONSUMER_KEY != '') { ?> <br clear='left'/> <label class="fixed"> </label> <a href="#" onclick="configure_twitter()"><?php echo __('Register with Twitter'); ?> </a> <?php } ?> </div> <div class="dlgSec"><?php echo __('Authentication'); ?> </div> <div class="dlgSecCont"> <label class="fixed"><?php echo __('New password:'******'left'/> <label class="fixed"><?php echo __('Confirm:'); ?> </label> <input name="confirm_password" type="password" size="30" value=""> </div> </form> <div class="dlgSec"><?php echo __('Connections'); ?> </div> <ul class="container" id="connections-list"> <?php print_connections($link); ?> </ul> <div class="dlgButtons"> <div style='float : left'> <button onclick="create_connection()"> <?php echo __('Create connection'); ?> </button> <button onclick="delete_connection()"> <?php echo __('Delete'); ?> </button> </div> <button type="submit" onclick="save_prefs()"> <?php echo __('Save'); ?> </button> <button onclick="close_infobox()"><?php echo __('Close'); ?> </button> </div> </div> <?php }