示例#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'];
        $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);
}
示例#2
0
文件: worksafe.php 项目: berkes/dabr
function worksafe_theme_status_time_link($status, $is_link = true)
{
    $time = strtotime($status->created_at);
    if ($time > 0) {
        if (twitter_date('dmy') == twitter_date('dmy', $time)) {
            $out = format_interval(time() - $time, 1) . ' ago';
        } else {
            $out = twitter_date('H:i', $time);
        }
    } else {
        $out = $status->created_at;
    }
    if ($is_link) {
        $out = "<a href='status/{$status->id}'>{$out}</a>";
    }
    return $out;
}
示例#3
0
文件: theme.php 项目: NaiRobley/Dabr
function theme_users_list($feed, $hide_pagination = false)
{
    if (isset($feed->users)) {
        $users = $feed->users;
    } else {
        $users = $feed;
    }
    $rows = array();
    if (count($users) == 0 || $users == '[]') {
        return '<p>No users to display.</p>';
    }
    foreach ($users as $user) {
        $content = "";
        if ($user->user) {
            $user = $user->user;
        }
        $name = theme('full_name', $user);
        $tweets_per_day = twitter_tweets_per_day($user);
        $last_tweet = strtotime($user->status->created_at);
        // $vicon = ($user->verified) ? theme('action_icon', "", '✔', 'verified') : '';
        $content = "{$name}<br />";
        //" <span class=\"actionicons\">{$vicon}</span>";
        $content .= "<span class='about'>";
        if ($user->description != "") {
            $content .= "Bio: " . twitter_parse_tags($user->description, $user->entities->description) . "<br />";
        }
        if ($user->location != "") {
            $content .= theme('action_icon', "https://maps.google.com/maps?q=" . urlencode($user->location), "<span class='icons'>⌖</span> {$user->location}", 'Location');
            $content .= "<br />";
        }
        $content .= "Info: ";
        $content .= pluralise('tweet', $user->statuses_count, true) . ", ";
        $content .= pluralise('friend', $user->friends_count, true) . ", ";
        $content .= pluralise('follower', $user->followers_count, true) . ", ";
        $content .= "~" . pluralise('tweet', $tweets_per_day, true) . " per day<br />";
        if ($user->status->created_at) {
            $content .= "Last tweet: ";
            if ($user->protected == 'true' && $last_tweet == 0) {
                $content .= "Private";
            } else {
                if ($last_tweet == 0) {
                    $content .= "Never tweeted";
                } else {
                    $content .= twitter_date('l jS F Y', $last_tweet);
                }
            }
        }
        $content .= "</span>";
        $rows[] = array('data' => array(array('data' => theme('avatar', theme_get_avatar($user)), 'class' => 'avatar'), array('data' => $content, 'class' => 'status shift')), 'class' => 'tweet');
    }
    $content = theme('table', array(), $rows, array('class' => 'followers'));
    if (!$hide_pagination) {
        #$content .= theme('pagination');
        $content .= theme('list_pagination', $feed);
    }
    return $content;
}
示例#4
0
function theme_followers($feed, $hide_pagination = false)
{
    $rows = array();
    if (count($feed) == 0 || $feed == '[]') {
        return '<p>No users to display.</p>';
    }
    foreach ($feed->users->user as $user) {
        $name = theme('full_name', $user);
        $tweets_per_day = twitter_tweets_per_day($user);
        $last_tweet = strtotime($user->status->created_at);
        $content = "{$name}<br /><span class='about'>";
        if ($user->description != "") {
            $content .= "Bio: {$user->description}<br />";
        }
        if ($user->location != "") {
            $content .= "Location: {$user->location}<br />";
        }
        $content .= "Info: ";
        $content .= pluralise('tweet', $user->statuses_count, true) . ", ";
        $content .= pluralise('friend', $user->friends_count, true) . ", ";
        $content .= pluralise('follower', $user->followers_count, true) . ", ";
        $content .= "~" . pluralise('tweet', $tweets_per_day, true) . " per day<br />";
        $content .= "Last tweet: ";
        if ($user->protected == 'true' && $last_tweet == 0) {
            $content .= "Private";
        } else {
            if ($last_tweet == 0) {
                $content .= "Never tweeted";
            } else {
                $content .= twitter_date('l jS F Y', $last_tweet);
            }
        }
        $content .= "</span>";
        $rows[] = array('data' => array(array('data' => theme('avatar', $user->profile_image_url), 'class' => 'avatar'), array('data' => $content, 'class' => 'status shift')), 'class' => 'tweet');
    }
    $content = theme('table', array(), $rows, array('class' => 'followers'));
    if (!$hide_pagination) {
        $content .= theme('list_pagination', $feed);
    }
    return $content;
}
示例#5
0
function theme_timeline($feed)
{
    if (count($feed) == 0) {
        return theme('no_tweets');
    }
    $rows = array();
    $page = menu_current_page();
    $date_heading = false;
    $first = 0;
    foreach ($feed as $status) {
        if ($first == 0) {
            $since_id = $status->id;
            $first++;
        } else {
            $max_id = $status->id;
            if ($status->original_id) {
                $max_id = $status->original_id;
            }
        }
        $time = strtotime($status->created_at);
        if ($time > 0) {
            $date = twitter_date('l jS F Y', strtotime($status->created_at));
            if ($date_heading !== $date) {
                $date_heading = $date;
                $rows[] = array(array('data' => "<small><b>{$date}</b></small>", 'colspan' => 2));
            }
        } else {
            $date = $status->created_at;
        }
        $text = twitter_parse_tags($status->text);
        $link = theme('status_time_link', $status, !$status->is_direct);
        $actions = theme('action_icons', $status);
        $avatar = theme('avatar', $status->from->profile_image_url);
        $source = $status->source ? " via {$status->source}" : '';
        if ($status->in_reply_to_status_id) {
            $source .= " <a href='status/{$status->in_reply_to_status_id}'>in reply to {$status->in_reply_to_screen_name}</a>";
        }
        $html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> {$actions} {$link}<br />{$text} <small>{$source}</small>";
        if ($status->retweeted_by) {
            $retweeted_by = $status->retweeted_by->user->screen_name;
            $html .= "<br /><small>retweeted to you by <a href='user/{$retweeted_by}'>{$retweeted_by}</a></small>";
        }
        $row = array($html);
        if ($page != 'user' && $avatar) {
            array_unshift($row, $avatar);
        }
        if ($page != 'replies' && twitter_is_reply($status)) {
            $row = array('class' => 'reply', 'data' => $row);
        }
        $rows[] = $row;
    }
    $content = theme('table', array(), $rows, array('class' => 'timeline'));
    //$content .= theme('pagination');
    if ($page != '') {
        $content .= theme('pagination');
    } else {
        //Doesn't work. since_id returns the most recent tweets up to since_id, not since. Grrr
        //$links[] = "<a href='{$_GET['q']}?since_id=$since_id'>Newer</a>";
        $links[] = "<a href='{$_GET['q']}?max_id={$max_id}'>Older</a>";
        $content .= '<p>' . implode(' | ', $links) . '</p>';
    }
    return $content;
}
示例#6
0
文件: settings.php 项目: icheyne/Dabr
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);
}
示例#7
0
文件: twitter.php 项目: xctcc/npt
function theme_timeline($feed)
{
    if (count($feed) == 0) {
        return theme('no_tweets');
    }
    $hide_pagination = count($feed) < 5 ? true : false;
    $rows = array();
    $page = menu_current_page();
    $date_heading = false;
    $max_id = false;
    foreach ($feed as &$status) {
        $max_id = isset($status->retweeted_by) ? $status->retweeted_by->id_str : $status->id_str;
        $status->text = twitter_parse_tags($status->text, $status->entities, $status->id_str, strip_tags($status->source));
    }
    unset($status);
    // Only embed images in suitable browsers
    if (EMBEDLY_KEY !== '' && setting_fetch('showthumbs', 'yes') == 'yes') {
        embedly_embed_thumbnails($feed);
    }
    foreach ($feed as $status) {
        $time = strtotime($status->created_at);
        if ($time > 0) {
            $date = twitter_date('l jS F Y', strtotime($status->created_at));
            if ($date_heading !== $date) {
                $date_heading = $date;
                $rows[] = array('data' => array("{$date}"), 'class' => 'date');
            }
        } else {
            $date = $status->created_at;
        }
        $link = theme('status_time_link', $status, !$status->is_direct);
        $actions = theme('action_icons', $status);
        $avatar = theme('avatar', img_proxy_url(theme_get_avatar($status->from)));
        if (substr($_GET['q'], 0, 4) == 'user' || setting_fetch('browser') == 'touch' || setting_fetch('browser', 'desktop') == 'desktop') {
            $source = $status->source ? " " . __("via") . " {$status->source}" : '';
        } else {
            $source = $status->source ? " " . __("via") . " " . strip_tags($status->source) . "" : '';
        }
        if ($status->in_reply_to_status_id_str) {
            $replyto = "<a href='" . BASE_URL . "status/{$status->in_reply_to_status_id_str}'>>></a>";
        } else {
            $replyto = null;
        }
        if (setting_fetch('dispnick') == 'yes') {
            $showname = $status->from->name;
        } else {
            $showname = $status->from->screen_name;
        }
        $html = "<b class='suser'><a href='" . BASE_URL . "user/{$status->from->screen_name}'>{$showname}</a></b> ";
        if (setting_fetch('buttonend') == 'yes') {
            $html .= "<span class='stext'>{$status->text}</span><br /><small class='sbutton'>{$actions} {$link} ";
        } else {
            $html .= "<small class='sbutton'>{$actions}</small><br /><span class='stext'>{$status->text}</span><br /><small class='sbutton'>{$link}";
        }
        $html .= " {$source} {$replyto}</small>";
        if ($status->retweeted_by) {
            if (setting_fetch('dispnick') == 'yes') {
                $showrtname = $status->retweeted_by->user->name;
            } else {
                $showrtname = $status->retweeted_by->user->screen_name;
            }
            $retweeted_by = $status->retweeted_by->user->screen_name;
            $retweeted_times = $status->retweet_count;
            $retweeted_times_minus = is_numeric($retweeted_times) ? $retweeted_times - 1 : $retweeted_times;
            $retweeted_times_str = $retweeted_times && $retweeted_times_minus ? "+{$retweeted_times_minus}" : "";
            $html .= " <small class='sretweet'>" . __("retweeted by") . " <a href='" . BASE_URL . "user/{$retweeted_by}'>{$showrtname}</a>{$retweeted_times_str} " . __("<span style='display:none;'>zhuanfa</span>") . "</small>";
        }
        unset($row);
        $class = 'status';
        if ($page != 'user' && $avatar) {
            $row[] = array('data' => $avatar, 'class' => 'avatar');
            $class .= ' shift';
        }
        $row[] = array('data' => $html, 'class' => $class);
        $class = 'tweet';
        if ($page != 'replies' && twitter_is_reply($status)) {
            $class .= ' reply';
        }
        $row = array('data' => $row, 'class' => $class);
        $rows[] = $row;
    }
    $content = theme('table', array(), $rows, array('class' => 'timeline'));
    if ($max_id) {
        if (function_exists('bcsub')) {
            $max_id = bcsub($max_id, '1');
        }
        if (setting_fetch('browser') != 'blackberry' && !$hide_pagination) {
            $content .= theme('pagination', $max_id);
        } else {
            global $blackberry_pagination;
            $blackberry_pagination = theme('pagination', $max_id);
        }
    }
    return $content;
}
示例#8
0
文件: settings.php 项目: vinazol/Dabr
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);
}
示例#9
0
function theme_followers($feed, $nextPageURL)
{
    $rows = array();
    if (count($feed) == 0 || $feed == '[]') {
        return '<p>No users to display.</p>';
    }
    foreach ($feed as $user) {
        $name = theme('full_name', $user);
        $tweets_per_day = twitter_tweets_per_day($user);
        $last_tweet = strtotime($user->status->created_at);
        $content = "{$name}<br /><span class='about'>";
        if ($user->description != "") {
            $content .= "Bio: " . twitter_parse_tags($user->description) . "<br />";
        }
        if ($user->location != "") {
            $content .= "Location: {$user->location}<br />";
        }
        $content .= "Info: ";
        $content .= pluralise('tweet', (int) $user->statuses_count, true) . ", ";
        $content .= pluralise('friend', (int) $user->friends_count, true) . ", ";
        $content .= pluralise('follower', (int) $user->followers_count, true) . ", ";
        $content .= "~" . pluralise('tweet', $tweets_per_day, true) . " per day<br />";
        $content .= "Last tweet: ";
        if ($user->protected == 'true' && $last_tweet == 0) {
            $content .= "Private";
        } else {
            if ($last_tweet == 0) {
                $content .= "Never tweeted";
            } else {
                $content .= twitter_date('l jS F Y', $last_tweet);
            }
        }
        $content .= "</span>";
        if (setting_fetch('avataro', 'yes') !== 'yes') {
            $rows[] = array('data' => array(array('data' => theme('avatar', theme_get_avatar($user), htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8')), 'class' => 'avatar'), array('data' => $content, 'class' => 'status shift')), 'class' => 'tweet');
        } else {
            $rows[] = array('data' => array(array('data' => $content, 'class' => 'status shift')), 'class' => 'tweet');
        }
    }
    $content = theme('table', array(), $rows, array('class' => 'followers'));
    if ($nextPageURL) {
        $content .= "<a href='{$nextPageURL}'>Next</a>";
    }
    return $content;
}
示例#10
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);
}
示例#11
0
文件: twitter.php 项目: berkes/dabr
function theme_timeline($feed)
{
    if (count($feed) == 0) {
        return theme('no_tweets');
    }
    $rows = array();
    $page = menu_current_page();
    $date_heading = false;
    foreach ($feed as $status) {
        $time = strtotime($status->created_at);
        if ($time > 0) {
            $date = twitter_date('l jS F Y', strtotime($status->created_at));
            if ($date_heading !== $date) {
                $date_heading = $date;
                $rows[] = array(array('data' => "<small><b>{$date}</b></small>", 'colspan' => 2));
            }
        } else {
            $date = $status->created_at;
        }
        $text = twitter_parse_tags($status->text);
        $link = theme('status_time_link', $status, !$status->is_direct);
        $actions = theme('action_icons', $status);
        $avatar = theme('avatar', $status->from->profile_image_url);
        $source = $status->source ? " via {$status->source}" : '';
        if ($status->in_reply_to_status_id) {
            $source .= " <a href='status/{$status->in_reply_to_status_id}'>in reply to {$status->in_reply_to_screen_name}</a>";
        }
        $html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> {$actions} {$link}<br />{$text} <small>{$source}</small>";
        if ($status->retweeted_by) {
            $retweeted_by = $status->retweeted_by->user->screen_name;
            $html .= "<br /><small>retweeted to you by <a href='user/{$retweeted_by}'>{$retweeted_by}</a></small>";
        }
        $row = array($html);
        if ($page != 'user' && $avatar) {
            array_unshift($row, $avatar);
        }
        if ($page != 'replies' && twitter_is_reply($status)) {
            $row = array('class' => 'reply', 'data' => $row);
        }
        $rows[] = $row;
    }
    $content = theme('table', array(), $rows, array('class' => 'timeline'));
    if (count($feed) >= 15) {
        $content .= theme('pagination');
    }
    return $content;
}
示例#12
0
文件: theme.php 项目: vinazol/Dabr
function theme_users_list($feed, $hide_pagination = false)
{
    if (isset($feed->users)) {
        $users = $feed->users;
    } else {
        $users = $feed;
    }
    $rows = array();
    if (count($users) == 0 || $users == '[]') {
        return '<p>' . _(NO_USERS_FOUND) . '</p>';
    }
    foreach ($users as $user) {
        $content = "";
        if ($user->user) {
            $user = $user->user;
        }
        $name = theme('full_name', $user);
        $tweets_per_day = twitter_tweets_per_day($user);
        $last_tweet = strtotime($user->status->created_at);
        $content = "{$name}<br />";
        $content .= "<span class='about'>";
        if ($user->description != "") {
            $content .= _(PROFILE_BIO) . ": " . twitter_parse_tags($user->description, $user->entities->description) . "<br />";
        }
        if ($user->location != "") {
            $content .= theme('action_icon', "https://maps.google.com/maps?q=" . urlencode($user->location), "<span class='icons'>⌖</span> {$user->location}", _(PROFILE_LOCATION));
            $content .= "<br />";
        }
        $content .= theme_user_info($user);
        if ($user->status->created_at) {
            $content .= " " . _(LAST_TWEET) . ": ";
            if ($user->protected == 'true' && $last_tweet == 0) {
                $content .= _(LAST_TWEET_PRIVATE);
            } else {
                if ($last_tweet == 0) {
                    $content .= _(LAST_TWEET_NEVER);
                } else {
                    $content .= twitter_date('l jS F Y', $last_tweet);
                }
            }
        }
        $content .= "</span>";
        $rows[] = array('data' => array(array('data' => theme('avatar', theme_get_avatar($user)), 'class' => 'avatar'), array('data' => $content, 'class' => 'status shift')), 'class' => 'tweet');
    }
    $content = theme('table', array(), $rows, array('class' => 'followers'));
    if (!$hide_pagination) {
        #$content .= theme('pagination');
        $content .= theme('list_pagination', $feed);
    }
    return $content;
}