OSDN Git Service

embr
[embrj/master.git] / setting.php
index 6f4daa3..1f35604 100644 (file)
-<?php\r
-       include ('lib/twitese.php');\r
-       $title = "Settings";\r
-       include ('inc/header.php');     \r
-       if (!loginStatus()) header('location: login.php');      \r
-?>\r
-<script type="text/javascript" src="js/colorpicker.js"></script>\r
-<script type="text/javascript" src="js/setting.js?ver=20100206"></script>\r
-<link rel="stylesheet" href="css/colorpicker.css" type="text/css" />\r
-<div id="statuses" class="column round-left">\r
-       <div id="setting">\r
-<?php \r
-       if (isset($_POST['name'])) {\r
-               $t = getTwitter();\r
-               $args = array();\r
-               $args['name'] = $_POST['name'];\r
-               $args['url'] = $_POST['url'];\r
-               $args['location'] = $_POST['location'];\r
-               $args['description'] = $_POST['description'];\r
-               $result = $t->updateProfile($args);\r
-               if ($result) echo "<div id=\"otherTip\">Your profile has been updated!</div>";\r
-               else echo "<div id=\"otherTip\">Update failed. Please try again.</div>";\r
-       }\r
-\r
-       if (isset($_GET['t'])){\r
-               $settingType = $_GET['t'];\r
-       }\r
-?>\r
-<div id="setting_nav">\r
-<?php\r
-       switch($settingType){\r
-               case 'profile':\r
-?>\r
-                       <span class="subnavLink"><a href="setting.php">Customize</a></span><span class="subnavNormal">Edit Profile</span><span class="subnavLink"><a href="setting.php?t=advanced">Advanced</a></span>\r
-<?php                  \r
-                       break;\r
-               case 'advanced':\r
-?>\r
-                       <span class="subnavLink"><a href="setting.php">Customize</a></span><span class="subnavLink"><a href="setting.php?t=profile">Edit Profile</a></span><span class="subnavNormal">Advanced</span>\r
-<?php          \r
-                       break;\r
-               default:\r
-?>\r
-                       <span class="subnavNormal">Customize</span><span class="subnavLink"><a href="setting.php?t=profile">Edit Profile</a></span><span class="subnavLink"><a href="setting.php?t=advanced">Advanced</a></span>\r
-<?php  \r
-       } // end switch\r
-?>\r
-</div>\r
-<?php\r
-       switch($settingType){\r
-               case 'profile':\r
-                       $user = getTwitter()->veverify();\r
-?>\r
-                       <form id="setting_form" action="setting.php?t=profile" method="post">\r
-                               <table id="setting_table">\r
-                               <tr>\r
-                               <td class="setting_title">Name:</td>\r
-                               <td><input class="setting_input" type="text" name="name" value="<?php echo isset($user->name) ? $user->name : ''?>" /></td>\r
-                               </tr>\r
-                               <tr>\r
-                               <td class="setting_title">URL:</td>\r
-                               <td><input class="setting_input" type="text" name="url" value="<?php echo isset($user->url) ? $user->url : '' ?>" /></td>\r
-                               </tr>\r
-                               <tr>\r
-                               <td class="setting_title">Location:</td>\r
-                               <td><input class="setting_input" type="text" name="location" value="<?php echo isset($user->location) ? $user->location : '' ?>" /></td>\r
-                               </tr>\r
-                               <tr>\r
-                               <td class="setting_title">Bio:</td>\r
-                               <td><textarea id="setting_text" name="description"><?php echo isset($user->description) ? $user->description : '' ?></textarea><small style="margin-left:5px;vertical-align: top;">*Max 160 chars</small></td>\r
-                               </tr>\r
-                               <tr>\r
-                               <td colspan="2"><input type="submit" class="btn" style="margin-left:62px !important" id="save_button" value="Save"></input></td>\r
-                               </tr>\r
-                               </table>\r
-                               </form>\r
-<?php\r
-                       break;\r
-               case 'advanced':\r
-?>\r
-               <div id="otherTip">More features coming soon!</div>\r
-<?php\r
-                       break;\r
-               default:\r
-                       if ( isset($_POST['myCSS']) ) {\r
-                               try {\r
-                                       saveStyle($_POST['myCSS'], $_POST['fontsize'], $_POST['ad_display'], $_POST['bodyBg']);\r
-                                       echo "<div id=\"otherTip\">Your style has been updated!</div>";\r
-                                       $arr;\r
-                                       preg_match('/\(([\w\/\.\-_\&\#\$\%\:]+)\)/i', $_POST['myCSS'], $arr);\r
-                                       echo '<script>var styles = "/'.$arr[1].'";\r
-                                       var newSS=document.createElement("link");\r
-                                       newSS.rel="stylesheet";\r
-                                       newSS.type="text/css";\r
-                                       newSS.href=escape(styles);\r
-                                       document.getElementsByTagName("head")[0].appendChild(newSS);</script>';\r
-                               } catch (Exception $e) {\r
-                                       echo "<div id=\"otherTip\">Update failed. Please try again.</div>";\r
-                               }\r
-                       }\r
-                       if ( isset($_GET['reset']) ) {\r
-                               resetStyle();\r
-                               echo "<div id=\"otherTip\">Styles have been reseted!</div>";\r
-                       }\r
-                       if(isset($_POST['updatesInterval'])){\r
-                               setcookie('updatesInterval', $_POST['updatesInterval'], time()+3600*24*365, '/');\r
-                               setcookie('intervalChanged', 'true', time()+3600*24*365, '/');\r
-                       }\r
-                       if(isset($_POST['homeInterval'])){\r
-                               setcookie('homeInterval', $_POST['updatesInterval'], time()+3600*24*365, '/');\r
-                               setcookie('intervalChanged', 'true', time()+3600*24*365, '/');\r
-                       }\r
-?>\r
-               <form id="style_form" action="setting.php" method="post">\r
-\r
-                       <fieldset class="settings">\r
-\r
-                       <legend>Enhancements</legend>\r
-\r
-                       <input id="show_pic" type="checkbox" checked="checked" />\r
-                       <label>Enable Auto Images Preview</label>\r
-                       <small>(Supports mainstream image hostings)</small>\r
-\r
-                       <br /><br />\r
-\r
-                       <input id="mediaPreSelect" type="checkbox" />\r
-                       <label>Enable Auto Medias Preview</label>\r
-                       <small>(Supports Xiami and Tudou)</small><br />\r
-\r
-                       </fieldset>\r
-\r
-                       <fieldset class="settings">\r
-\r
-                       <legend>Auto Refresh Interval</legend>\r
-\r
-                       <label>Home Page</label>\r
-                       <select id="homeInterval" name="homeInterval" value="<?php echo getCookie('homeInterval')?>">\r
-                               <option value="0.5">30 sec</option>\r
-                               <option value="1" selected="selected">1 min(Default)</option>\r
-                               <option value="3">3 min</option>\r
-                               <option value="5">5 min</option>\r
-                               <option value="10">10 min</option>\r
-                               <option value="0">Never</option>\r
-                       </select>\r
-                       <small>(https://rabr.in/index.php)</small>\r
-\r
-                       <br /><br />\r
-\r
-                       <label>Updates Page</label>\r
-                       <select id="updatesInterval" name="updatesInterval" value="<?php echo getCookie('updatesInterval')?>">\r
-                               <option value="0.5">30 sec</option>\r
-                               <option value="1">1 min</option>\r
-                               <option value="3" selected="selected">3 min(Default)</option>\r
-                               <option value="5">5 min</option>\r
-                               <option value="10">10 min</option>\r
-                               <option value="0">Never</option>\r
-                       </select>\r
-                       <small>(https://rabr.in/all.php)</small>\r
-\r
-                       </fieldset>\r
-\r
-                       <fieldset class="settings">\r
-\r
-                       <legend>UI Preferences</legend>\r
-\r
-                       <label>Custom Themes</label>\r
-                       <select id="styleSelect"><option value="n/a">Choose one...</option></select>\r
-                       <small>(We have awesome themes for you!)</small>\r
-\r
-                       <br /><br />\r
-\r
-                       <label>Background Color</label>\r
-                       <input class="bg_input" type="text" id="bodyBg" name="bodyBg" value="<?php echo getColor("bodyBg","") ?>" />\r
-                       <small>(Choose your favorite color here)</small>\r
-\r
-                       <br /><br />\r
-\r
-                       <label>Font Size</label>\r
-                       <select id="fontsize" name="fontsize" value="<?php echo getCookie('fontsize')?>">\r
-                               <option value="12px">Small</option>\r
-                               <option value="13px" selected="selected">Middle(Default)</option>\r
-                               <option value="14px">Large</option>\r
-                               <option value="15px">Extra Large</option>\r
-                       </select>\r
-                       <small>(Set the font size)</small>\r
-\r
-                       <br /><br />\r
-                       \r
-                       <label>Support Rabr</label>\r
-                       <select id="ad_display" name="ad_display" value="<?php echo getCookie('ad_display')?>">\r
-                               <option value="block" selected="selected">Count me in!</option>\r
-                               <option value="none">Nah, not me...</option>\r
-                       </select>\r
-                       <small>(Sidebar AD display management)</small>\r
-\r
-                       <br /><br />                    \r
-\r
-                       <label>Customize CSS</label>\r
-                       <small>(You can put your own CSS hack here, or your Twitter style code)</small>\r
-                       <br />\r
-                       <textarea type="text" id="myCSS" name="myCSS" value="" /><?php echo getColor("myCSS","") ?></textarea>\r
-\r
-                       </fieldset>\r
-\r
-                       <table>\r
-                       <tr>\r
-                       <td colspan="2">\r
-                       <input type="submit" class="btn" id="save_button" value="Save" />\r
-                       <a id="reset_link" href="setting.php?reset=true" title="You will lose all customized settings!">Reset to default</a>\r
-                       </td>\r
-                       </tr>\r
-                       </table>\r
-\r
-               </form>\r
-<?php\r
-       } // end switch\r
-?>\r
-\r
-       </div>\r
-</div>\r
-\r
-<?php \r
-       include ('inc/sidebar.php');\r
-?>\r
-\r
-<?php \r
-       include ('inc/footer.php');\r
-?>\r
+<?php
+       include ('lib/twitese.php');
+       $title = "Settings";
+       include ('inc/header.php');     
+       if (!loginStatus()) header('location: login.php');      
+?>
+<script src="js/colorpicker.js"></script>
+<script src="js/setting.js"></script>
+<link rel="stylesheet" href="css/colorpicker.css" />
+<div id="statuses" class="column round-left">
+       <div id="setting">
+<div id="setting_nav">
+<?php
+       $settingType = isset($_GET['t'])? $_GET['t'] : 1;
+       switch($settingType){
+               case 'profile':
+?>
+                       <span class="subnavLink"><a href="setting.php">Customize</a></span><span class="subnavNormal">Profile</span>
+<?php                  
+                       break;
+               default:
+?>
+                       <span class="subnavNormal">Customize</span><span class="subnavLink"><a href="setting.php?t=profile">Profile</a></span>
+<?php  
+       }
+?>
+</div>
+<?php
+       switch($settingType){
+               case 'profile':
+                       $user = getTwitter()->veverify(true);
+?>
+                       <form id="setting_form" action="ajax/uploadImage.php?do=profile" method="post" enctype="multipart/form-data">
+                               <fieldset class="settings">
+                               <legend>Avatar</legend>
+                               <ol>
+                               <li style="display:inline-block"><img src="<?php echo isset($_COOKIE['imgurl']) ? $_COOKIE['imgurl'] : getAvatar($user->profile_image_url)?>"></img></li>
+                               <ol style="margin-left:29px">
+                                       <li><input type="file" name="image" id="profile_image"/></li>
+                                       <li><input type="submit" id="AvatarUpload" class="btn" value="Upload"/><small style="margin-left:10px;vertical-align: middle;">BMP,JPG or PNG accepted, less than 800K.</small></li>
+                               </ol></ol>
+                               </fieldset>
+                       </form>
+                       <form id="setting_form" action="ajax/updateProfile.php" method="post">
+                               <fieldset class="settings">
+                               <legend>Literature</legend>
+                               <table id="setting_table">
+                               <tr>
+                               <td class="setting_title">Name:</td>
+                               <td><input class="setting_input" type="text" name="name" value="<?php echo isset($user->name) ? $user->name : ''?>" /></td>
+                               </tr>
+                               <tr>
+                               <td class="setting_title">URL:</td>
+                               <td><input class="setting_input" type="text" name="url" value="<?php echo isset($user->url) ? $user->url : '' ?>" /></td>
+                               </tr>
+                               <tr>
+                               <td class="setting_title">Location:</td>
+                               <td><input class="setting_input" type="text" name="location" value="<?php echo isset($user->location) ? $user->location : '' ?>" /></td>
+                               </tr>
+                               <tr>
+                               <td class="setting_title">Bio:</td><td><small style="margin-left:5px;vertical-align: top;">*Max 160 chars</small></td>
+                               </tr><tr>
+                               <td></td>
+                               <td><textarea id="setting_text" name="description"><?php echo isset($user->description) ? $user->description : '' ?></textarea></td>
+                               </tr>
+                               </table>
+                               <input type="submit" id="saveProfile" class="btn" value="Save" />
+                               </fieldset>
+<?php
+                       break;
+               default:
+?>
+               <form id="style_form" action="setting.php" method="post">
+                       
+                       <fieldset class="settings">
+
+                       <legend>Utility</legend>
+
+                       <input id="proxifyAvatar" type="checkbox" />
+                       <label>Proxify the Avatar</label>
+                       
+                       <br /><br />                    
+                       <input id="autoscroll" type="checkbox" />
+                       <label>Timeline Autopaging</label>
+                       
+                       <br /><br />                    
+                       <input id="sidebarscroll" type="checkbox" />
+                       <label>Fixed Sidebar</label>
+                       
+                       </fieldset>
+                       
+                       <fieldset class="settings">
+
+                       <legend>Media Preview</legend>
+
+                       <input id="showpic" type="checkbox" checked="checked" />
+                       <label>Enable Images Preview</label>
+                       <small>(Supports common image hostings)</small>
+
+                       <br /><br />
+
+                       <input id="mediaPreSelect" type="checkbox" checked="checked" />
+                       <label>Enable Videos Preview</label>
+                       <small>(Supports Xiami and Tudou)</small><br />
+
+                       </fieldset>
+
+                       <fieldset class="settings">
+
+                       <legend>Auto Refresh Interval</legend>
+
+                       <label>Home Page</label>
+                       <select id="homeInterval" name="homeInterval" value="<?php echo getCookie('homeInterval')?>">
+                               <option value="0.5">30 sec</option>
+                               <option value="1" selected="selected">1 min(Default)</option>
+                               <option value="3">3 min</option>
+                               <option value="5">5 min</option>
+                               <option value="10">10 min</option>
+                               <option value="0">Never</option>
+                       </select>
+                       <label>Updates Page</label>
+                       <select id="updatesInterval" name="updatesInterval" value="<?php echo getCookie('updatesInterval')?>">
+                               <option value="0.5">30 sec</option>
+                               <option value="1">1 min</option>
+                               <option value="3" selected="selected">3 min(Default)</option>
+                               <option value="5">5 min</option>
+                               <option value="10">10 min</option>
+                               <option value="0">Never</option>
+                       </select>
+
+                       </fieldset>
+
+                       <fieldset class="settings">
+
+                       <legend>UI Preferences</legend>
+                       <input id="twitterbg" type="checkbox" />
+                       <label>Use twitter account background</label>
+                       
+                       <br /><br />
+                       
+                       <label>Custom Themes</label>
+                       <select id="styleSelect"></select>
+                       <small>(We have awesome themes for you!)</small>
+
+                       <br /><br />
+
+                       <label>Background Color</label>
+                       <input class="bg_input" type="text" id="bodyBg" name="bodyBg" value="<?php echo getDefCookie("Bgcolor","") ?>" />
+                       <small>(Choose your favorite color here)</small>
+
+                       <br /><br />
+
+                       <label>Font Size</label>
+                       <select id="fontsize" name="fontsize" value="<?php echo getCookie('fontsize')?>">
+                               <option value="12px">Small</option>
+                               <option value="13px" selected="selected">Middle(Default)</option>
+                               <option value="14px">Large</option>
+                               <option value="15px">Extra Large</option>
+                       </select>
+                       <small>(Set the font size)</small>
+
+                       <br /><br />            
+
+                       <label>Customize CSS</label>
+                       <small>(You can put your own CSS hack here, or your Twitter style code)</small>
+                       <br />
+                       <label>Tips:</label>
+                       <small>You must use <a href="http://i.zou.lu/csstidy/" target="_blank" title="Powered by Showfom">CSSTidy</a> to compress your stylesheet.</small>
+                       <br />
+                       <textarea type="text" id="myCSS" name="myCSS" value="" /><?php echo getDefCookie("myCSS","") ?></textarea>
+                       </fieldset>
+
+<?php
+       }
+?>
+       <a id="reset_link" href="#" title="You will lose all customized settings!">Reset to default</a>
+
+</form>
+       </div>
+</div>
+
+<?php 
+       include ('inc/sidebar.php');
+       include ('inc/footer.php');
+?>