Exemplo n.º 1
0
function settings_page($args)
{
    if ($args[1] == 'save') {
        $settings['browser'] = $_POST['browser'];
        $settings['gwt'] = $_POST['gwt'];
        $settings['colours'] = $_POST['colours'];
        $settings['reverse'] = $_POST['reverse'];
        setcookie_year('settings', base64_encode(serialize($settings)));
        twitter_refresh('');
    }
    $modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch');
    $gwt = array('off' => 'direct', 'on' => 'via GWT');
    $colour_schemes = array();
    foreach ($GLOBALS['colour_schemes'] as $id => $info) {
        list($name, $colours) = explode('|', $info);
        $colour_schemes[$id] = $name;
    }
    $content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">';
    $content .= theme('options', $colour_schemes, setting_fetch('colours', 1));
    $content .= '</select></p><p>Mode:<br /><select name="browser">';
    $content .= theme('options', $modes, $GLOBALS['current_theme']);
    $content .= '</select></p><p>External links go:<br /><select name="gwt">';
    $content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off'));
    $content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>';
    $content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>';
    $content .= '<p><input type="submit" value="Save" /></p></form>';
    $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
    return theme('page', 'Settings', $content);
}
Exemplo n.º 2
0
function settings_page($args)
{
    if ($args[1] == 'save') {
        $settings['browser'] = $_POST['browser'];
        $settings['gwt'] = $_POST['gwt'];
        $settings['colours'] = $_POST['colours'];
        $settings['reverse'] = $_POST['reverse'];
        $settings['timestamp'] = $_POST['timestamp'];
        $settings['hide_inline'] = $_POST['hide_inline'];
        $settings['utc_offset'] = (double) $_POST['utc_offset'];
        // Save a user's oauth details to a MySQL table
        if (MYSQL_USERS == 'ON' && ($newpass = $_POST['newpassword'])) {
            user_is_authenticated();
            list($key, $secret) = explode('|', $GLOBALS['user']['password']);
            $sql = sprintf("REPLACE INTO user (username, oauth_key, oauth_secret, password) VALUES ('%s', '%s', '%s', MD5('%s'))", mysql_escape_string(user_current_username()), mysql_escape_string($key), mysql_escape_string($secret), mysql_escape_string($newpass));
            mysql_query($sql);
        }
        setcookie_year('settings', base64_encode(serialize($settings)));
        twitter_refresh('');
    }
    $modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch');
    $gwt = array('off' => 'direct', 'on' => 'via GWT');
    $colour_schemes = array();
    foreach ($GLOBALS['colour_schemes'] as $id => $info) {
        list($name, $colours) = explode('|', $info);
        $colour_schemes[$id] = $name;
    }
    $utc_offset = setting_fetch('utc_offset', 0);
    /* returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???)	
    	if (!$utc_offset) {
    		$user = twitter_user_info();
    		$utc_offset = $user->utc_offset;
    	}
    */
    if ($utc_offset > 0) {
        $utc_offset = '+' . $utc_offset;
    }
    $content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">';
    $content .= theme('options', $colour_schemes, setting_fetch('colours', 1));
    $content .= '</select></p><p>Mode:<br /><select name="browser">';
    $content .= theme('options', $modes, $GLOBALS['current_theme']);
    $content .= '</select></p><p>External links go:<br /><select name="gwt">';
    $content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off'));
    $content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>';
    $content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>';
    $content .= '<p><label><input type="checkbox" name="timestamp" value="yes" ' . (setting_fetch('timestamp') == 'yes' ? ' checked="checked" ' : '') . ' /> Show the timestamp ' . twitter_date('H:i') . ' instead of 25 sec ago</label></p>';
    $content .= '<p><label><input type="checkbox" name="hide_inline" value="yes" ' . (setting_fetch('hide_inline') == 'yes' ? ' checked="checked" ' : '') . ' /> Hide inline media (eg TwitPic thumbnails)</label></p>';
    $content .= '<p><label>The time in UTC is currently ' . gmdate('H:i') . ', by using an offset of <input type="text" name="utc_offset" value="' . $utc_offset . '" size="3" /> we display the time as ' . twitter_date('H:i') . '.<br />It is worth adjusting this value if the time appears to be wrong.</label></p>';
    // Allow users to choose a Dabr password if accounts are enabled
    if (MYSQL_USERS == 'ON' && user_is_authenticated()) {
        $content .= '<fieldset><legend>Dabr account</legend><small>If you want to sign in to Dabr without going via Twitter.com in the future, create a password and we\'ll remember you.</small></p><p>Change Dabr password<br /><input type="password" name="newpassword" /><br /><small>Leave blank if you don\'t want to change it</small></fieldset>';
    }
    $content .= '<p><input type="submit" value="Save" /></p></form>';
    $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
    return theme('page', 'Settings', $content);
}
Exemplo n.º 3
0
function twitter_update()
{
    twitter_ensure_post_action();
    $status = twitter_url_shorten(stripslashes(trim($_POST['status'])));
    if ($status) {
        $request = API_URL . 'statuses/update.json';
        $post_data = array('source' => 'dabr', 'status' => $status);
        $in_reply_to_id = (string) $_POST['in_reply_to_id'];
        if (is_numeric($in_reply_to_id)) {
            $post_data['in_reply_to_status_id'] = $in_reply_to_id;
        }
        // Geolocation parameters
        list($lat, $long) = explode(',', $_POST['location']);
        $geo = 'N';
        if (is_numeric($lat) && is_numeric($long)) {
            $geo = 'Y';
            $post_data['lat'] = $lat;
            $post_data['long'] = $long;
            // $post_data['display_coordinates'] = 'false';
        }
        setcookie_year('geo', $geo);
        $b = twitter_process($request, $post_data);
    }
    twitter_refresh($_POST['from'] ? $_POST['from'] : '');
}
Exemplo n.º 4
0
function settings_page($args)
{
    if ($args[1] == 'save') {
        $settings['perPage'] = $_POST['perPage'];
        $settings['gwt'] = $_POST['gwt'];
        $settings['colours'] = $_POST['colours'];
        $settings['reverse'] = $_POST['reverse'];
        $settings['timestamp'] = $_POST['timestamp'];
        $settings['hide_inline'] = $_POST['hide_inline'];
        $settings['show_oembed'] = $_POST['show_oembed'];
        $settings['hide_avatars'] = $_POST['hide_avatars'];
        $settings['menu_icons'] = $_POST['menu_icons'];
        $settings['image_size'] = $_POST['image_size'];
        $settings['utc_offset'] = (double) $_POST['utc_offset'];
        setcookie_year('settings', base64_encode(serialize($settings)));
        twitter_refresh('');
    }
    $perPage = array('5' => '5 Tweets Per Page', '10' => '10 Tweets Per Page', '20' => '20 Tweets Per Page', '30' => '30 Tweets Per Page', '40' => '40 Tweets Per Page', '50' => '50 Tweets Per Page', '100' => '100 Tweets Per Page (Slow)', '150' => '150 Tweets Per Page (Very Slow)', '200' => '200 Tweets Per Page (Extremely Slow)');
    $image_size = array('thumb' => 'Thumbnail (150*150)', 'small' => 'Small (340*340)', 'medium' => 'Medium (600*600)', 'large' => 'Large (1024*1024)', 'orig' => 'Original (8000*8000)');
    $colour_schemes = array();
    foreach ($GLOBALS['colour_schemes'] as $id => $info) {
        list($name) = explode('|', $info);
        $colour_schemes[$id] = $name;
    }
    $utc_offset = setting_fetch('utc_offset', 0);
    /* returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???)	
    	if (!$utc_offset) {
    		$user = twitter_user_info();
    		$utc_offset = $user->utc_offset;
    	}
    */
    if ($utc_offset > 0) {
        $utc_offset = '+' . $utc_offset;
    }
    $content = '';
    $content .= '<form action="settings/save" method="post">
	                <p>Colour scheme:
	                    <br />
	                    <select name="colours">';
    $content .= theme('options', $colour_schemes, setting_fetch('colours', 0));
    $content .= '</select>
	                </p>';
    $content .= '<p>Tweets Per Page:
                        <br />
                        <select name="perPage">';
    $content .= theme('options', $perPage, setting_fetch('perPage', 20));
    $content .= '</select>
	                    <br/>
	                </p>';
    $content .= '<p>Image size:
                        <br />
                        <select name="image_size">';
    $content .= theme('options', $image_size, setting_fetch('image_size', "medium"));
    $content .= '</select>
	                    <br/>
	                </p>';
    $content .= '<p>
	                <label>
	                    <input type="checkbox" name="gwt" value="on" ' . (setting_fetch('gwt') == 'on' ? ' checked="checked" ' : '') . ' /> 
	                    Use Google Web Transcoder (GWT) for external links. Suitable for older phones and people with less bandwidth.
	                </label>
	            </p>';
    $content .= '<p>
	                <label>
	                    <input type="checkbox" name="timestamp" value="yes" ' . (setting_fetch('timestamp') == 'yes' ? ' checked="checked" ' : '') . ' /> 
	                    Show the timestamp ' . twitter_date('H:i') . ' instead of 25 sec ago
	                </label>
	            </p>';
    $content .= '<p>
	                <label>
	                    <input type="checkbox" name="hide_inline" value="yes" ' . (setting_fetch('hide_inline') == 'yes' ? ' checked="checked" ' : '') . ' /> 
	                    Hide Twitter photos.
	                </label>
	            </p>';
    //	Hide oembeds by default. Keep things fast & save API calls.
    $content .= '<p>
	                <label>
	                    <input type="checkbox" name="show_oembed" value="yes" ' . (setting_fetch('show_oembed') == yes ? ' checked="checked" ' : '') . ' /> 
	                    Show link previews (YouTube, Instagram, Blogs, etc).
	                </label>
	            </p>';
    $content .= '<p>
	                <label>
	                    <input type="checkbox" name="hide_avatars" value="yes" ' . (setting_fetch('hide_avatars') == 'yes' ? ' checked="checked" ' : '') . ' /> 
	                    Hide users\' profile images.
	                </label>
	            </p>';
    $content .= '<p>
	                <label>
	                    <input type="checkbox" name="menu_icons" value="yes" ' . (setting_fetch('menu_icons') == 'yes' ? ' checked="checked" ' : '') . ' /> 
	                    Show Menu icons like <span class="icons">�⌖</span>.
	                </label>
	            </p>';
    $content .= '<p><label>The time in UTC is currently ' . gmdate('H:i') . ', by using an offset of <input type="text" name="utc_offset" value="' . $utc_offset . '" size="3" /> we display the time as ' . twitter_date('H:i') . '.<br />It is worth adjusting this value if the time appears to be wrong.</label></p>';
    $content .= '<p><input type="submit" value="Save" /></p></form>';
    $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
    return theme('page', 'Settings', $content);
}
Exemplo n.º 5
0
function settings_page($args)
{
    if ($args[1] == 'save') {
        $settings['dabr_perPage'] = $_POST['dabr_perPage'];
        $settings['dabr_gwt'] = $_POST['dabr_gwt'];
        $settings['dabr_colours'] = $_POST['dabr_colours'];
        $settings['dabr_timestamp'] = $_POST['dabr_timestamp'];
        $settings['dabr_show_inline'] = $_POST['dabr_show_inline'];
        $settings['dabr_show_oembed'] = $_POST['dabr_show_oembed'];
        $settings['dabr_show_avatars'] = $_POST['dabr_show_avatars'];
        $settings['dabr_show_icons'] = $_POST['dabr_show_icons'];
        $settings['dabr_float_menu'] = $_POST['dabr_float_menu'];
        $settings['dabr_image_size'] = $_POST['dabr_image_size'];
        $settings['dabr_utc_offset'] = (double) $_POST['dabr_utc_offset'];
        $settings['dabr_font_size'] = $_POST['dabr_font_size'];
        $settings['dabr_fonts'] = $_POST['dabr_fonts'];
        setcookie_year('settings', base64_encode(serialize($settings)));
        twitter_refresh('');
    }
    $perPage = array('5' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 5), '10' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 10), '20' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 20), '30' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 30), '40' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 40), '50' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 50), '100' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 100) . " " . _(SETTINGS_SLOW_1), '150' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 150) . " " . _(SETTINGS_SLOW_2), '200' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 200) . " " . _(SETTINGS_SLOW_3));
    $image_size = array('thumb' => _(SETTINGS_IMAGE_THUMB), 'small' => _(SETTINGS_IMAGE_SMALL), 'medium' => _(SETTINGS_IMAGE_MEDIUM), 'large' => _(SETTINGS_IMAGE_LARGE), 'orig' => _(SETTINGS_IMAGE_ORIGINAL));
    $colour_schemes = array();
    foreach ($GLOBALS['colour_schemes'] as $id => $info) {
        list($name) = explode('|', $info);
        $colour_schemes[$id] = $name;
    }
    $font_size = array('0.5' => _(FONT_SMALLEST), '0.75' => _(FONT_SMALL), '0.9' => _(FONT_MEDIUM), '1' => _(FONT_NORMAL), '1.25' => _(FONT_BIG), '1.5' => _(FONT_LARGE), '2' => _(FONT_HUGE));
    // $fonts = array( //ID => Value
    // 					'Schoolbell'	=> 'Schoolbell',
    // 					'Raleway'	=> 'Raleway',
    // 					'Ubuntu+Mono'	=> 'Ubuntu Mono',
    // 					'Karma'			=> 'Karma',
    // 					'Open+Sans'=> 'Open Sans',
    // 					'aaaaa'			=> 'bbbb',
    // 				);
    $utc_offset = setting_fetch('dabr_utc_offset', 0);
    //	returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???)
    // if (!$utc_offset) {
    // 	$user = twitter_user_info(user_current_username());
    // 	$utc_offset = $user->utc_offset;
    // 	echo "THE UTC IS $utc_offset";
    // }
    if ($utc_offset > 0) {
        $utc_offset = '+' . $utc_offset;
    }
    $content = '';
    $content .= '<form action="settings/save" method="post">';
    $content .= theme('options', $colour_schemes, setting_fetch('dabr_colours', 0), _(SETTINGS_COLOUR), "dabr_colours");
    $content .= theme('options', $perPage, setting_fetch('dabr_perPage', 20), _(SETTINGS_PER_PAGE), "dabr_perPage");
    $content .= theme('options', $image_size, setting_fetch('dabr_image_size', "medium"), _(SETTINGS_IMAGE_SIZE), "dabr_image_size");
    global $fonts;
    $content .= "<fieldset><legend>" . _(SETTINGS_FONT) . "</legend>";
    $content .= theme('radio', array_combine($fonts, $fonts), "dabr_fonts", urldecode(substr(setting_fetch("dabr_fonts", "Raleway"), 0, -4)));
    $content .= "</fieldset>";
    $content .= "<fieldset><legend>" . _(SETTINGS_FONT_SIZE) . "</legend>";
    $content .= theme('radio', $font_size, "dabr_font_size", setting_fetch("dabr_font_size", "1"));
    $content .= "</fieldset>";
    $content .= '<p>
	               <label>
	                  <input type="checkbox" name="dabr_timestamp" value="yes" ' . (setting_fetch('dabr_timestamp', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . sprintf(_(SETTINGS_TIMESTAMP), twitter_date('H:i')) . '</label>
	            </p>';
    $content .= '<p>
	               <label>
	                  <input type="checkbox" name="dabr_show_inline" value="yes" ' . (setting_fetch('dabr_show_inline', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_SHOW_INLINE) . '</label>
	            </p>';
    $content .= '<p>
	               <label>
	                  <input type="checkbox" name="dabr_show_oembed" value="yes" ' . (setting_fetch('dabr_show_oembed', 'yes') == yes ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_SHOW_PREVIEW) . '</label>
	            </p>';
    $content .= '<p>
	               <label>
	                  <input type="checkbox" name="dabr_show_avatars" value="yes" ' . (setting_fetch('dabr_show_avatars', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_SHOW_AVATARS) . '</label>
	            </p>';
    $content .= '<p>
	               <label>
	                  <input type="checkbox" name="dabr_show_icons" value="yes" ' . (setting_fetch('dabr_show_icons', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_MENU_ICONS) . '</label>
	            </p>';
    $content .= '<p>
	               <label>
	                  <input type="checkbox" name="dabr_float_menu" value="yes" ' . (setting_fetch('dabr_float_menu', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_FLOAT_MENU) . '</label>
	            </p>';
    $content .= '<p>
						<label>' . sprintf(_(SETTINGS_TIMESTAMP_IS), gmdate('H:i')) . '<br>' . sprintf(_(SETTINGS_TIMESTAMP_DISPLAY), "<input type=\"text\" name=\"dabr_utc_offset\" value=\"{$utc_offset}\" size=\"3\" />", twitter_date('H:i')) . '<br />' . _(SETTINGS_TIMESTAMP_ADJUST) . '
						</label>
					</p>';
    $content .= '<p>
						<label>
							<input type="checkbox" name="dabr_gwt" value="on" ' . (setting_fetch('dabr_gwt') == 'on' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_GWT_DETAIL) . '</label>
					</p>';
    $content .= '<p><input type="submit" value="' . _(SETTINGS_SAVE_BUTTON) . '" /></p></form>';
    $content .= '<hr /><p>' . _(SETTINGS_RESET) . '</p>';
    return theme('page', _(SETTINGS_TITLE), $content);
}
Exemplo n.º 6
0
function twitter_update()
{
    twitter_ensure_post_action();
    $status = stripslashes(trim($_POST['status']));
    if ($status) {
        $request = API_NEW . 'statuses/update.json';
        $post_data = array('source' => 'dabr', 'status' => $status);
        $in_reply_to_id = (string) $_POST['in_reply_to_id'];
        if (is_numeric($in_reply_to_id)) {
            $post_data['in_reply_to_status_id'] = $in_reply_to_id;
        }
        // Geolocation parameters
        list($lat, $long) = explode(',', $_POST['location']);
        $geo = 'N';
        if (is_numeric($lat) && is_numeric($long)) {
            $geo = 'Y';
            $post_data['lat'] = $lat;
            $post_data['long'] = $long;
            // $post_data['display_coordinates'] = 'false';
            // Turns out, we don't need to manually send a place ID
            /*	  		$place_id = twitter_get_place($lat, $long);
            	  		if ($place_id) {
            	  		
            	  			// $post_data['place_id'] = $place_id;
            	  		}
            */
        }
        setcookie_year('geo', $geo);
        $b = twitter_process($request, $post_data);
    }
    twitter_refresh($_POST['from'] ? $_POST['from'] : '');
}
Exemplo n.º 7
0
function twitter_update()
{
    twitter_ensure_post_action();
    $status = stripslashes(trim($_POST['status']));
    $statusArr = array();
    if ($status) {
        $status = line_united($status);
        $length = function_exists('mb_strlen') ? mb_strlen($status, 'utf-8') : strlen(utf8_decode($status));
        if ($length > 140) {
            switch (setting_fetch('longtext', 'r')) {
                case 'a':
                    $statusArr[] = sysSubStr($status, 140, true);
                    break;
                case 'd':
                    $num = ceil($length / 100);
                    for ($i = 0; $i < $num; $i++) {
                        $cnum = $i + 1;
                        $cstart = 100 * $i;
                        $cend = 100 * ($i + 1);
                        $statusArr[] = "({$cnum}/{$num}) " . mb_substr($status, $cstart, $cend, 'utf-8');
                    }
                    arsort($statusArr);
                    break;
                case 'r':
                    $statusArr[] = $status;
                    break;
            }
        } else {
            $statusArr[] = $status;
        }
        $request = API_URL . 'statuses/update.json';
        foreach ($statusArr as $status) {
            $post_data = array('source' => 'dabr', 'status' => $status);
            $in_reply_to_id = (string) $_POST['in_reply_to_id'];
            if (is_numeric($in_reply_to_id)) {
                $post_data['in_reply_to_status_id'] = $in_reply_to_id;
            }
            if (setting_fetch('buttongeo') == 'yes') {
                // Geolocation parameters
                list($lat, $long) = explode(',', $_POST['location']);
                $geo = 'N';
                if (is_numeric($lat) && is_numeric($long)) {
                    $geo = 'Y';
                    $post_data['lat'] = $lat;
                    $post_data['long'] = $long;
                    // $post_data['display_coordinates'] = 'false';
                    // Turns out, we don't need to manually send a place ID
                    /*                      $place_id = twitter_get_place($lat, $long);
                                            if ($place_id) {
                                                // $post_data['place_id'] = $place_id;
                                            }
                    */
                }
                setcookie_year('geo', $geo);
            }
            $b = twitter_process($request, $post_data);
        }
    }
    twitter_refresh($_POST['from'] ? $_POST['from'] : '');
}
Exemplo n.º 8
0
function settings_page($args)
{
    if ($args[1] == 'save') {
        $settings['browser'] = $_POST['browser'];
        $settings['gwt'] = $_POST['gwt'];
        $settings['colours'] = $_POST['colours'];
        $settings['reverse'] = $_POST['reverse'];
        $settings['tpp'] = $_POST['tpp'];
        $settings['ltpp'] = $_POST['ltpp'];
        $settings['topuser'] = $_POST['topuser'];
        $settings['tophome'] = $_POST['tophome'];
        $settings['topreplies'] = $_POST['topreplies'];
        $settings['topretweets'] = $_POST['topretweets'];
        $settings['topretweeted'] = $_POST['topretweeted'];
        $settings['topdirects'] = $_POST['topdirects'];
        $settings['toppicture'] = $_POST['toppicture'];
        $settings['topsearch'] = $_POST['topsearch'];
        $settings['replies'] = $_POST['replies'];
        $settings['retweets'] = $_POST['retweets'];
        $settings['retweeted'] = $_POST['retweeted'];
        $settings['directs'] = $_POST['directs'];
        $settings['search'] = $_POST['search'];
        $settings['favourites'] = $_POST['favourites'];
        $settings['lists'] = $_POST['lists'];
        $settings['followers'] = $_POST['followers'];
        $settings['friends'] = $_POST['friends'];
        /*$settings['blockings'] = $_POST['blockings'];*/
        $settings['trends'] = $_POST['trends'];
        $settings['picture'] = $_POST['picture'];
        $settings['about'] = $_POST['about'];
        $settings['ssettings'] = $_POST['ssettings'];
        $settings['slogout'] = $_POST['slogout'];
        $settings['srefresh'] = $_POST['srefresh'];
        $settings['linktrans'] = $_POST['linktrans'];
        $settings['avataro'] = $_POST['avataro'];
        $settings['buttonrl'] = $_POST['buttonrl'];
        $settings['buttonre'] = $_POST['buttonre'];
        $settings['buttonreall'] = $_POST['buttonreall'];
        $settings['buttondm'] = $_POST['buttondm'];
        $settings['buttonfav'] = $_POST['buttonfav'];
        $settings['buttonrt'] = $_POST['buttonrt'];
        $settings['buttondel'] = $_POST['buttondel'];
        $settings['buttonmap'] = $_POST['buttonmap'];
        $settings['buttongeo'] = $_POST['buttongeo'];
        $settings['buttonot'] = $_POST['buttonot'];
        $settings['buttonsearch'] = $_POST['buttonsearch'];
        $settings['buttontime'] = $_POST['buttontime'];
        $settings['buttonfrom'] = $_POST['buttonfrom'];
        $settings['buttonend'] = $_POST['buttonend'];
        $settings['longurl'] = $_POST['longurl'];
        //$settings['showthumbs'] = $_POST['showthumbs'];
        $settings['fixedtagspre'] = $_POST['fixedtagspre'];
        $settings['fixedtagspreo'] = $_POST['fixedtagspreo'];
        $settings['fixedtagspost'] = $_POST['fixedtagspost'];
        $settings['fixedtagsposto'] = $_POST['fixedtagsposto'];
        $settings['rtsyntax'] = $_POST['rtsyntax'];
        $settings['timestamp'] = $_POST['timestamp'];
        $settings['hide_inline'] = $_POST['hide_inline'];
        $settings['utc_offset'] = (double) $_POST['utc_offset'];
        $settings['rl_user'] = $_POST['rl_user'];
        $settings['rl_pass'] = $_POST['rl_pass'];
        $settings['longtext'] = $_POST['longtext'];
        $settings['filtero'] = $_POST['filtero'];
        $settings['filterc'] = $_POST['filterc'];
        // Save a user's oauth details to a MySQL table
        if (ACCESS_USERS == 'MYSQL') {
            if ($newpass = $_POST['newpassword'] || ($delpass = $_POST['delpass'])) {
                user_is_authenticated();
                $username = strtolower(user_current_username());
                $con = @mysql_connect(MYSQL_URL, MYSQL_USER, MYSQL_PASSWORD) || theme('error', '<p>Error failed to connect your MySQL Database.</p>');
                @mysql_select_db(MYSQL_DB) || theme('error', '<p>Error failed to select your MySQL Database.</p>');
                if ($newpass = $_POST['newpassword']) {
                    list($key, $secret) = explode('|', $GLOBALS['user']['password']);
                    $sql = sprintf("REPLACE INTO user (username, oauth_key, oauth_secret, password) VALUES (%s, %s, %s, MD5(%s))", check_input($username), check_input($key), check_input($secret), check_input($newpass));
                    @mysql_query($sql) || theme('error', '<p>Error failed to save your OAuth Information into your MySQL Database.</p><p>Please check your MySQL Database.</p>');
                }
                if ($delpass = $_POST['delpass']) {
                    user_is_authenticated();
                    $del = "DELETE FROM user WHERE username = "******"settings/save" method="post">';
    $content .= '<p><label>Colour scheme:<br /><select name="colours">' . theme('options', $colour_schemes, setting_fetch('colours', 1)) . '</select></label></p><hr />';
    $content .= '<p><label>Mode:<br /><select name="browser">' . theme('options', $modes, $GLOBALS['current_theme']) . '</select></label></p><hr />';
    $content .= '<p>Configure Menu Items<br />';
    $content .= '<span class="texts">Choose what you want to display on the Top Bar.</span><br />';
    $content .= '<label><input type="checkbox" name="topuser" value="yes" ' . (setting_fetch('topuser') == 'yes' ? ' checked="checked" ' : '') . ' /> User</label><br />';
    $content .= '<label><input type="checkbox" name="tophome" value="yes" ' . (setting_fetch('tophome', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Home</label><br />';
    $content .= '<label><input type="checkbox" name="topreplies" value="yes" ' . (setting_fetch('topreplies', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Replies</label><br />';
    $content .= '<label><input type="checkbox" name="topretweets" value="yes" ' . (setting_fetch('topretweets', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweets</label><br />';
    $content .= '<label><input type="checkbox" name="topretweeted" value="yes" ' . (setting_fetch('topretweeted') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweeted</label><br />';
    $content .= '<label><input type="checkbox" name="topdirects" value="yes" ' . (setting_fetch('topdirects', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Directs</label><br />';
    $content .= '<label><input type="checkbox" name="topsearch" value="yes" ' . (setting_fetch('topsearch') == 'yes' ? ' checked="checked" ' : '') . ' /> Search</label><br />';
    $content .= '<label><input type="checkbox" name="toppicture" value="yes" ' . (setting_fetch('toppicture') == 'yes' ? ' checked="checked" ' : '') . ' /> Picture</label><br />';
    $content .= '<span class="texts">And Choose what you want to display on the Bottom Bar.</span><br />';
    $content .= '<label><input type="checkbox" name="replies" value="yes" ' . (setting_fetch('replies') == 'yes' ? ' checked="checked" ' : '') . ' /> Replies</label><br />';
    $content .= '<label><input type="checkbox" name="retweets" value="yes" ' . (setting_fetch('retweets') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweets</label><br />';
    $content .= '<label><input type="checkbox" name="retweeted" value="yes" ' . (setting_fetch('retweeted') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweeted</label><br />';
    $content .= '<label><input type="checkbox" name="directs" value="yes" ' . (setting_fetch('directs') == 'yes' ? ' checked="checked" ' : '') . ' /> Directs</label><br />';
    $content .= '<label><input type="checkbox" name="search" value="yes" ' . (setting_fetch('search') == 'yes' ? ' checked="checked" ' : '') . ' /> Search</label><br />';
    $content .= '<label><input type="checkbox" name="picture" value="yes" ' . (setting_fetch('pictue') == 'yes' ? ' checked="checked" ' : '') . ' /> Picture</label><br />';
    $content .= '<label><input type="checkbox" name="favourites" value="yes" ' . (setting_fetch('favourites') == 'yes' ? ' checked="checked" ' : '') . ' /> Favourites</label><br />';
    $content .= '<label><input type="checkbox" name="lists" value="yes" ' . (setting_fetch('lists') == 'yes' ? ' checked="checked" ' : '') . ' /> Lists</label><br />';
    $content .= '<label><input type="checkbox" name="followers" value="yes" ' . (setting_fetch('followers') == 'yes' ? ' checked="checked" ' : '') . ' /> Followers</label><br />';
    $content .= '<label><input type="checkbox" name="friends" value="yes" ' . (setting_fetch('friends') == 'yes' ? ' checked="checked" ' : '') . ' /> Friends</label><br />';
    /*$content .= '<label><input type="checkbox" name="blockings" value="yes" '. (setting_fetch('blockings') == 'yes' ? ' checked="checked" ' : '') .' /> Blockings</label><br />';*/
    $content .= '<label><input type="checkbox" name="trends" value="yes" ' . (setting_fetch('trends') == 'yes' ? ' checked="checked" ' : '') . ' /> Trends</label><br />';
    $content .= '<label><input type="checkbox" name="about" value="yes" ' . (setting_fetch('about') == 'yes' ? ' checked="checked" ' : '') . ' /> About</label><br />';
    $content .= '<label><input type="checkbox" name="ssettings" value="yes" ' . (setting_fetch('ssettings', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Settings</label><br />';
    $content .= '<label><input type="checkbox" name="slogout" value="yes" ' . (setting_fetch('slogout', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Logout</label><br />';
    $content .= '<label><input type="checkbox" name="srefresh" value="yes" ' . (setting_fetch('srefresh') == 'yes' ? ' checked="checked" ' : '') . ' /> Refresh</label></p><hr />';
    $content .= '<p><span class="texts">And Choose What you Want to Display On each Status.</span><br />';
    $content .= '<label><input type="checkbox" name="buttonrl" value="yes" ' . (setting_fetch('buttonrl', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> RL [Read It Later]</label>';
    $content .= '<label><input type="checkbox" name="buttonre" value="yes" ' . (setting_fetch('buttonre', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> AT [@]</label>';
    $content .= '<label><input type="checkbox" name="buttonreall" value="yes" ' . (setting_fetch('buttonreall', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> RE [Reply All]</label>';
    $content .= '<label><input type="checkbox" name="buttondm" value="yes" ' . (setting_fetch('buttondm') == 'yes' ? ' checked="checked" ' : '') . ' /> DM [Direct Messages]</label>';
    $content .= '<label><input type="checkbox" name="buttonfav" value="yes" ' . (setting_fetch('buttonfav', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> FAV [Favourite]</label>';
    $content .= '<label><input type="checkbox" name="buttonrt" value="yes" ' . (setting_fetch('buttonrt', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> RT [Retweet]</label>';
    $content .= '<label><input type="checkbox" name="buttondel" value="yes" ' . (setting_fetch('buttondel', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> DEL [Delete]</label><br />';
    $content .= '<label><input type="checkbox" name="buttonmap" value="yes" ' . (setting_fetch('buttonmap', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> MAP [Google Map]</label>';
    $content .= '<label><input type="checkbox" name="buttonot" value="yes" ' . (setting_fetch('buttonot', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> OT [Original Tweet]</label>';
    $content .= '<label><input type="checkbox" name="buttonsearch" value="yes" ' . (setting_fetch('buttonsearch', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> ? [Search for @ to a user]</label>';
    $content .= '<label><input type="checkbox" name="buttongeo" value="yes" ' . (setting_fetch('buttongeo') == 'yes' ? ' checked="checked" ' : '') . ' /> GEO [Geolocation]</label><br />';
    $content .= '<label><input type="checkbox" name="buttontime" value="yes" ' . (setting_fetch('buttontime', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Status Times</label>';
    $content .= '<label><input type="checkbox" name="buttonfrom" value="yes" ' . (setting_fetch('buttonfrom', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Status From</label></p><hr />';
    $content .= '<p><label><input type="checkbox" name="avataro" value="yes" ' . (setting_fetch('avataro', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Disable Avatar</label></p><hr />';
    $content .= '<p><label>Tweets per page (20-200): <input type="text" id="tpp" name="tpp" value="' . setting_fetch('tpp', 20) . '" size="3" maxlength="3" class="minput" /></label></p><hr />';
    $content .= '<p><label>List tweets per page (20-200): <input type="text" id="ltpp" name="ltpp" value="' . setting_fetch('ltpp', 20) . '" size="3" maxlength="3" class="minput" /></label></p><hr />';
    $content .= '<p><label>External links go:<br /><select name="gwt">';
    $content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off'));
    $content .= '</select></label><span class="texts"><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</span></p>';
    $content .= '<p><label>Showing URL:<br /><select name="linktrans">' . theme('options', $linktrans, setting_fetch('linktrans', 'd')) . '</select></label><br /><span class="texts">Note: Domain Only means change https://twitter.com/JaHIY to [twitter.com]</span></p><hr />';
    $content .= '<p><label>Use Read It Later<br />Email address or username: <input type="text" name="rl_user" value="' . setting_fetch('rl_user', '') . '" size="25" class="linput" /></label><br />';
    $content .= '<label>Password, if you have one.: <input type="password" name="rl_pass" value="' . setting_fetch('rl_pass', '') . '" size="25" class="linput" /></label></p><hr />';
    if (LONG_URL == 'ON') {
        $content .= '<p><label><input type="checkbox" name="longurl" value="yes" ' . (setting_fetch('longurl') == 'yes' ? ' checked="checked" ' : '') . ' /> Show Long URL</label></p><hr />';
    }
    //$content .= '<p><label><input type="checkbox" name="showthumbs" value="yes" '. (setting_fetch('showthumbs', 'yes') == 'yes' ? ' checked="checked" ' : '') .' /> Preview Photos In Timelines</label></p><hr />';
    $content .= '<p><label><input type="checkbox" name="fixedtagsposto" value="yes" ' . (setting_fetch('fixedtagsposto', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Tweet Content [At the beginning of your tweets]:</label> <input type="text" id="fixedtagspost" name="fixedtagspost" value="' . setting_fetch('fixedtagspost') . '" maxlength="70" size="6" class="sinput" /><br />';
    $content .= '<label><input type="checkbox" name="fixedtagspreo" value="yes" ' . (setting_fetch('fixedtagspreo', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Fixed Tags [At the end of your tweets]:</label> <input type="text" id="fixedtagspre" name="fixedtagspre" value="' . setting_fetch('fixedtagspre') . '" maxlength="70" size="6" class="sinput" /><br /><span class="texts">Intro: Add Tags in Your Tweets</span></p><hr />';
    $content .= '<p><label>RT Syntax:<br /><input type="text" id="rtsyntax" name="rtsyntax" value="' . setting_fetch('rtsyntax', 'RT [User]: [Content]') . '" maxlength="140" size="25" class="linput" /></label><br /><span class="texts">Default RT Syntax: RT [User]: [Content]</span></p><hr />';
    $content .= '<p><label>When posting a 140+ chars tweet:<br /><select name="longtext">' . theme('options', $longtext, setting_fetch('longtext', 'r')) . '</select></label></p><hr />';
    $content .= '<p><label><input type="checkbox" name="filtero" value="yes" ' . (setting_fetch('filtero', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Keyword Filter:</label> <input type="text" id="filterc" name="filterc" value="' . setting_fetch('filterc') . '" maxlength="140" size="25" class="linput" /><br /><span class="texts">Note: Separate keywords with space</span></p><hr />';
    $content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>';
    $content .= '<p><label><input type="checkbox" name="timestamp" value="yes" ' . (setting_fetch('timestamp') == 'yes' ? ' checked="checked" ' : '') . ' /> Show the timestamp ' . twitter_date('H:i') . ' instead of 25 sec ago</label></p>';
    $content .= '<p><label><input type="checkbox" name="hide_inline" value="yes" ' . (setting_fetch('hide_inline') == 'yes' ? ' checked="checked" ' : '') . ' /> Hide inline media (eg TwitPic thumbnails)</label></p>';
    $content .= '<p><label>The time in UTC is currently ' . gmdate('H:i') . ', by using an offset of <input type="text" name="utc_offset" value="' . $utc_offset . '" size="3" maxlength="3" class="minput" /> we display the time as ' . twitter_date('H:i') . '.<br />It is worth adjusting this value if the time appears to be wrong.</label></p>';
    // Allow users to choose a Dabr password if accounts are enabled
    if ((ACCESS_USERS == 'MYSQL' || ACCESS_USERS == 'FILE') && user_is_authenticated()) {
        $content .= '<fieldset><legend>Dabr account</legend><span class="texts">If you want to sign in to Dabr without going via Twitter.com in the future, create a password and we\'ll remember you.</span><p><label>Change Dabr password<br /><input type="password" name="newpassword" maxlength="40" size="25" class="linput" /></label><br /><span class="texts">Leave blank if you don\'t want to change it</span><br /><label><input type="checkbox" name="delpass" value="yes" /> Delete my Dabr account, please.</label></p></fieldset>';
    }
    $content .= '<p><button type="submit">Save</button></p></form>';
    $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
    return theme('page', 'Settings', $content);
}