Beispiel #1
0
     if (valid_connection($link, $connection_id)) {
         if ($server && $port) {
             db_query($link, "INSERT INTO ttirc_servers (server, port, connection_id)\n\t\t\t\t\tVALUES ('{$server}', '{$port}', '{$connection_id}')");
             print_servers($link, $connection_id);
         } else {
             $error = T_sprintf("Couldn't add server (%s:%d): Invalid syntax.", $server, $port);
             print json_encode(array("error" => $error));
         }
     }
     break;
 case "delete-server":
     $ids = db_escape_string($_REQUEST["ids"]);
     $connection_id = (int) db_escape_string($_REQUEST["connection_id"]);
     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":
Beispiel #2
0
function connection_editor($link, $id)
{
    $result = db_query($link, "SELECT * FROM ttirc_connections\n\t\t\tWHERE id = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
    $line = db_fetch_assoc($result);
    if (sql_bool_to_bool($line['auto_connect'])) {
        $auto_connect_checked = 'checked';
    } else {
        $auto_connect_checked = '';
    }
    if (sql_bool_to_bool($line['visible'])) {
        $visible_checked = 'checked';
    } else {
        $visible_checked = '';
    }
    if (sql_bool_to_bool($line['permanent'])) {
        $permanent_checked = 'checked';
    } else {
        $permanent_checked = '';
    }
    ?>
	<div id="infoBoxTitle"><?php 
    echo __("Edit Connection");
    ?>
</div>
	<div class="infoBoxContents">
		<div id="mini-notice" style='display : none'>&nbsp;</div>

		<div class="dlgSec"><?php 
    echo __('Connection');
    ?>
</div>

		<form id="prefs_conn_form" onsubmit="return false;">

		<input type="hidden" name="connection_id" value="<?php 
    echo $id;
    ?>
"/>
		<input type="hidden" name="op" value="prefs-conn-save"/>

		<div class="dlgSecCont">
			<label class='fixed'><?php 
    echo __('Title:');
    ?>
</label>
			<input name="title" size="30" value="<?php 
    echo $line['title'];
    ?>
">
			<br clear='left'/>

			<label class="fixed"><?php 
    echo __('Nickname:');
    ?>
</label>
			<input name="nick" size="30" value="<?php 
    echo $line['nick'];
    ?>
">
			<br clear='left'/>

			<label class='fixed'><?php 
    echo __('Favorite channels:');
    ?>
</label>
			<input name="autojoin" size="30" value="<?php 
    echo $line['autojoin'];
    ?>
">
			<br clear='left'/>

			<label class='fixed'><?php 
    echo __('Connect command:');
    ?>
</label>
			<input name="connect_cmd" size="30" value="<?php 
    echo $line['connect_cmd'];
    ?>
">
			<br clear='left'/>

			<label class='fixed'><?php 
    echo __('Character set:');
    ?>
</label>

			<?php 
    print_select('encoding', $line['encoding'], get_iconv_encodings());
    ?>

			<br clear='left'/>

		</div>

		<div class="dlgSec">Options</div>

		<div class="dlgSecCont">
			<input name="visible" <?php 
    echo $visible_checked;
    ?>
 
				id="pr_visible" type="checkbox" value="1">
				<label for="pr_visible"><?php 
    echo __('Enable connection');
    ?>
					</label>
			<br clear='left'/>

			<input name="auto_connect" <?php 
    echo $auto_connect_checked;
    ?>
 
				id="pr_auto_connect" type="checkbox" value="1">
				<label for="pr_auto_connect"><?php 
    echo __('Automatically connect');
    ?>
					</label>
			<br clear='left'/>

			<input name="permanent" <?php 
    echo $permanent_checked;
    ?>
				id="pr_permanent" type="checkbox" value="1">
				<label for="pr_permanent"><?php 
    echo __('Stay connected permanently');
    ?>
					</label>
			<br clear='left'/>

		</div>

		<button type="submit" style="display : none" onclick="save_conn()"></button>

		</form>

		<div class="dlgSec"><?php 
    echo __('Servers');
    ?>
</div>

		<ul class="container" id="servers-list">
			<?php 
    print_servers($link, $id);
    ?>
		</ul>

		<div class="dlgButtons">
			<div style='float : left'>
			<button onclick="create_server()"><?php 
    echo __('Add server');
    ?>
</button>
			<button onclick="delete_server()"><?php 
    echo __('Delete');
    ?>
</button>
			</div>
			<button type="submit" onclick="save_conn()"><?php 
    echo __('Save');
    ?>
</button>
			<button type="submit" onclick="show_prefs()"><?php 
    echo __('Go back');
    ?>
</button></div>
		</div>
	</div>

	<?php 
}