Changeset 20301 for extensions/oAuth/include/public_events.inc.php
- Timestamp:
- Jan 20, 2013, 9:41:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/oAuth/include/public_events.inc.php
r20293 r20301 7 7 function oauth_begin_identification() 8 8 { 9 global $template, $conf, $page, $hybridauth_conf; 10 11 if (isset($_GET['redirect'])) 12 { 13 pwg_set_session_var('oauth_redirect', $_GET['redirect']); 14 } 15 else 16 { 17 pwg_unset_session_var('oauth_redirect'); 18 } 9 global $template; 19 10 20 11 // template icons … … 22 13 { 23 14 $template->assign(array( 24 'OAUTH_URL' => get_root_url() .OAUTH_PATH.'auth.php?provider=',15 'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=', 25 16 'OAUTH_PATH' => OAUTH_PATH, 26 'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) .'/',17 'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/', 27 18 'PROVIDERS' => get_activated_providers(), 28 19 )); … … 52 43 list($oauth_id) = pwg_db_fetch_row($result); 53 44 list($provider) = explode('---', $oauth_id); 54 $_SESSION['page_errors'][] = 'You registered with a '.ucfirst($provider).' account, please login with the same account.';45 $_SESSION['page_errors'][] = sprintf(l10n('You registered with a %s account, please sign in with the same account.'), $provider); 55 46 56 47 $redirect_to = get_root_url().'identification.php'; … … 68 59 { 69 60 global $conf, $template, $hybridauth_conf; 70 71 if (!$conf['oauth']['display_register'])72 {73 return;74 }75 61 76 62 // comming from identification page … … 135 121 $template->set_prefilter('register', 'oauth_remove_password_fields_prefilter'); 136 122 } 137 catch ( Exception $e ){138 die($e->getMessage());123 catch (Exception $e) { 124 array_push($page['errors'], sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode())); 139 125 } 140 126 } 141 else 127 // display login buttons 128 else if ($conf['oauth']['display_register']) 142 129 { 143 130 // template icons … … 145 132 { 146 133 $template->assign(array( 147 'OAUTH_URL' => get_root_url() .OAUTH_PATH.'auth.php?provider=',134 'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=', 148 135 'OAUTH_PATH' => OAUTH_PATH, 149 'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) .'/',136 'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/', 150 137 'PROVIDERS' => get_activated_providers(), 151 138 )); … … 189 176 190 177 $template->assign(array( 191 'OAUTH_PROVIDER' => ucfirst($provider),178 'OAUTH_PROVIDER' => $provider, 192 179 'OAUTH_USERNAME' => $remote_user->displayName, 193 180 'OAUTH_URL' => $remote_user->profileURL, … … 197 184 198 185 $template->set_prefilter('profile_content', 'oauth_add_profile_prefilter'); 199 } 200 catch( Exception $e ){ 201 die($e->getMessage()); 202 } 203 204 205 $template->set_prefilter('profile_content', 'oauth_remove_password_fields_prefilter'); 186 $template->set_prefilter('profile_content', 'oauth_remove_password_fields_prefilter'); 187 } 188 catch (Exception $e) { 189 array_push($page['errors'], sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode())); 190 } 206 191 } 207 192 … … 236 221 $adapter->logout(); 237 222 } 238 catch ( Exception $e ){239 die($e->getMessage());223 catch (Exception $e) { 224 $_SESSION['page_errors'][] = sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode()); 240 225 } 241 226 } … … 249 234 global $template, $conf; 250 235 251 if (!$conf['oauth']['display_menubar']) 236 $menu = &$menu_ref_arr[0]; 237 238 if ( !$conf['oauth']['display_menubar'] or $menu->get_block('mbIdentification') == null ) 252 239 { 253 240 return; 254 241 } 255 242 256 $menu = &$menu_ref_arr[0];257 258 if ($menu->get_block('mbIdentification') == null)259 {260 return;261 }262 263 243 if ($template->get_template_vars('OAUTH_URL') == null) 264 244 { 265 245 $template->assign(array( 266 'OAUTH_URL' => get_root_url() .OAUTH_PATH.'auth.php?provider=',246 'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=', 267 247 'OAUTH_PATH' => OAUTH_PATH, 268 'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) .'/',248 'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/', 269 249 'PROVIDERS' => get_activated_providers(), 270 250 )); … … 283 263 { 284 264 $search = '</form>'; 285 $add = file_get_contents(OAUTH_PATH .'template/identification_page.tpl');265 $add = file_get_contents(OAUTH_PATH . 'template/identification_page.tpl'); 286 266 return str_replace($search, $search.$add, $content); 287 267 } … … 310 290 { 311 291 $search = '{include file=$block->template|@get_extent:$id }'; 312 $add = file_get_contents(OAUTH_PATH .'template/identification_menubar.tpl');292 $add = file_get_contents(OAUTH_PATH . 'template/identification_menubar.tpl'); 313 293 return str_replace($search, $search.$add, $content); 314 294 }
Note: See TracChangeset
for help on using the changeset viewer.