Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page_rest_resource_oauth_session_edit_fns.inc
1 <?php
17 require_once SQ_PACKAGES_PATH.'/web_services/rest/page_templates/page_rest_resource/page_rest_resource_edit_fns.inc';
18 
31 {
36  function __construct()
37  {
38  parent::__construct();
39  $this->static_screens['details']['force_unlock'] = FALSE;
40 
41  }//end constructor
42 
43 
54  function paintAccessToken(&$asset, &$o, $prefix)
55  {
56  $type = 'stored';
57  $access_token = $asset->attr('access_token');
58  $access_token_secret = $asset->attr('access_token_secret');
59  if(empty($access_token) ){
60  if(isset($_SESSION['oauth'][$asset->id]['access_token'] ) && isset($_SESSION['oauth'][$asset->id]['access_token_secret'])) {
61  $type = 'session';
62  $access_token = $_SESSION['oauth'][$asset->id]['access_token'];
63  $access_token_secret = $_SESSION['oauth'][$asset->id]['access_token_secret'];
64  }
65  else {
66  $type = '';
67  $access_token = 'none';
68  $access_token_secret = 'none';
69  }
70  }
71 
72  ?>
73  <table border="0" class="sq-backend-table">
74  <tr>
75  <th width="20%"><?php echo translate('oauth_access_token_type', $type); ?></th>
76  <td>
77  <?php
78  echo htmlspecialchars($type);
79  ?>
80  </td>
81  </tr>
82  <tr>
83  <th width="20%"><?php echo translate('oauth_access_token'); ?></th>
84  <td>
85  <?php
86  echo htmlspecialchars($access_token);
87  ?>
88  </td>
89  </tr>
90  <tr>
91  <th width="20%"><?php echo translate('oauth_access_token_secret'); ?></th>
92  <td>
93  <?php
94  echo htmlspecialchars($access_token_secret);
95  ?>
96  </td>
97  </tr>
98  </table>
99  <?php
100 
101 
102  }//end paintAccessToken()
103 
104 
115  function processAccessToken(&$asset, &$o, $prefix)
116  {
117  if ($asset->writeAccess('attributes')) {
118  $store_token = $asset->attr('store_token');
119  if(!$store_token) {
120  $asset->setAttrValue('access_token', '');
121  $asset->setAttrValue('access_token_secret', '');
122  }
123  else if(isset($_SESSION['oauth'][$asset->id]['access_token'] ) && isset($_SESSION['oauth'][$asset->id]['access_token_secret'])) {
124  $asset->setAttrValue('access_token', $_SESSION['oauth'][$asset->id]['access_token']);
125  $asset->setAttrValue('access_token_secret', $_SESSION['oauth'][$asset->id]['access_token_secret']);
126  }
127  }
128 
129  }//end processAccessToken()
130 
131 }//end class
132 ?>