1 | <?php |
---|
2 | // config and whatnot |
---|
3 | $config = dirname(__FILE__) . '/../../hybridauth/config.php'; |
---|
4 | require_once( "../../hybridauth/Hybrid/Auth.php" ); |
---|
5 | |
---|
6 | // initialise hybridauth |
---|
7 | $hybridauth = new Hybrid_Auth( $config ); |
---|
8 | |
---|
9 | // selected provider name |
---|
10 | $provider = @ trim( strip_tags( $_GET["provider"] ) ); |
---|
11 | |
---|
12 | // check if the user is currently connected to the selected provider |
---|
13 | if( ! $hybridauth->isConnectedWith( $provider ) ){ |
---|
14 | // redirect him back to login page |
---|
15 | header( "Location: login.php?error=Your are not connected to $provider or your session has expired" ); |
---|
16 | } |
---|
17 | ?> |
---|
18 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
19 | <html lang="en"> |
---|
20 | <head> |
---|
21 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
22 | <link rel="stylesheet" href="public/css.css" type="text/css"> |
---|
23 | </head> |
---|
24 | <body> |
---|
25 | <table width="90%" border="0" cellpadding="2" cellspacing="2"> |
---|
26 | <tr> |
---|
27 | <td valign="top"> |
---|
28 | <?php |
---|
29 | include "includes/menu.php"; |
---|
30 | ?> |
---|
31 | <fieldset> |
---|
32 | <legend>Update your status</legend> |
---|
33 | <b>Important</b>: |
---|
34 | <br /> |
---|
35 | 1- Currently only <b>Facebook, MySpace, Twitter and LinkedIn</b> do support this feature! Please refer to the user guide to know more about each adapters capabilities. <a href='http://hybridauth.sourceforge.net/userguide.html'>http://hybridauth.sourceforge.net/userguide.html</a> |
---|
36 | <br /> |
---|
37 | 2- Also, some providers will truncate the status. for example, the text of the status update must be 140 characters max with twitter. |
---|
38 | <hr /> |
---|
39 | <br /> |
---|
40 | <center> |
---|
41 | <form action="" method="post"> |
---|
42 | <table width="650" border="0"> |
---|
43 | <tr> |
---|
44 | <td> |
---|
45 | Wazzaup? |
---|
46 | <textarea name="status" style="width:650px;height:120px;"></textarea> |
---|
47 | </td> |
---|
48 | </tr> |
---|
49 | <tr> |
---|
50 | <td align="right"><input type="submit" style="width:200px;height:32px;" value="Update" /></td> |
---|
51 | </tr> |
---|
52 | <tr> |
---|
53 | <td align="left"> |
---|
54 | <?php |
---|
55 | try{ |
---|
56 | // if form submitted |
---|
57 | if( isset( $_POST["status"] ) ){ |
---|
58 | $status = trim( $_POST["status"] ); |
---|
59 | |
---|
60 | // is status not empty |
---|
61 | if( empty( $status ) ){ |
---|
62 | echo "<b style='color:red'>Write somthing on the textarea. please.</b>"; |
---|
63 | } |
---|
64 | else{ |
---|
65 | // call back the requested provider adapter instance |
---|
66 | $adapter = $hybridauth->getAdapter( $provider ); |
---|
67 | |
---|
68 | // update user staus |
---|
69 | $adapter->setUserStatus( $status ); |
---|
70 | |
---|
71 | echo "<b style='color:green'>Status updated. You should be able to check it on 'My activity stream' section or by refering to you profile page on $provider</b>"; |
---|
72 | } |
---|
73 | } |
---|
74 | } |
---|
75 | catch( Exception $e ){ |
---|
76 | // if code 8 => Provider does not support this feature |
---|
77 | if( $e->getCode() == 8 ){ |
---|
78 | echo "<b style='color:red'>Error: Provider does not support this feature.</b> Currently only <b>Facebook, MySpace, Twitter, Identica and LinkedIn</b> do support this! |
---|
79 | <br />Please refer to the user guide to know more about each adapters capabilities. <a href='http://hybridauth.sourceforge.net/userguide.html'>http://hybridauth.sourceforge.net/userguide.html</a>"; |
---|
80 | } |
---|
81 | else{ |
---|
82 | echo "<b style='color:red'>Well, got an error:</b> " . $e->getMessage(); |
---|
83 | } |
---|
84 | } |
---|
85 | ?> |
---|
86 | </td> |
---|
87 | </tr> |
---|
88 | </table> |
---|
89 | </form> |
---|
90 | </center> |
---|
91 | </fieldset> |
---|
92 | </td> |
---|
93 | <td valign="top" width="250" align="left"> |
---|
94 | <?php |
---|
95 | include "includes/sidebar.php"; |
---|
96 | ?> |
---|
97 | </td> |
---|
98 | </tr> |
---|
99 | </table> |
---|
100 | </body> |
---|
101 | </html> |
---|