-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoauth.php
executable file
·103 lines (95 loc) · 3.7 KB
/
oauth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
*
* Archivo de configuración del OAuth de Twitter
*
* Agrega y actualiza los datos de la aplicación de Twitter
*
* @package TrackYourPenguin
* @author Zerquix18 <http://zerquxi18.com/>
* @since 0.1
*
**/
require_once( dirname(__FILE__) . '/typ-load.php');
comprobar( false );
if( ! es_admin() )
typ_die( __("Cheatin', uh?!") );
construir('cabecera', __('Set up OAuth'), true);
$o = obt_oauth();
$datos = array(
"consumer_key" => (isset($o->consumer_key)) ? $o->consumer_key : "",
"consumer_secret" => (isset($o->consumer_secret ) ) ? $o->consumer_secret : "",
"access_token" => (isset($o->access_token) ) ? $o->access_token : "",
"access_token_secret" => (isset($o->access_token_secret)) ? $o->access_token_secret : ""
);
?>
<h3><?php _e("Set up Twitter OAuth") ?></h3>
<?php
if( "POST" == $_SERVER['REQUEST_METHOD']) {
$consumer_key = @$zerdb->real_escape( $_POST['consumer_key'] );
$consumer_secret = @$zerdb->real_escape( $_POST['consumer_secret'] );
$access_token = @$zerdb->real_escape( $_POST['access_token'] );
$access_token_secret = @$zerdb->real_escape( $_POST['access_token_secret'] );
$args = ! comprobar_args( @$_POST['consumer_key'], @$_POST['consumer_secret'], @$_POST['access_token'], @$_POST['access_token_secret']);
$args2 = vacios(@$_POST['consumer_key'], @$_POST['consumer_secret'], @$_POST['access_token'], @$_POST['access_token_secret']);
if( $args ) {
typ_die( __("Cheatin', uh?!") );
}elseif( $args2 ) {
agregar_error( __("You can't leave empty fields.") );
}else{
if( ! oauth_configurado() )
$zerdb->insert($zerdb->twitter, array($consumer_key, $consumer_secret, $access_token, $access_token_secret ) );
else
$zerdb->update($zerdb->twitter, array(
"consumer_key" => $consumer_key,
"consumer_secret" => $consumer_secret,
"access_token" => $access_token,
"access_token_secret" => $access_token_secret
)
)->execute();
agregar_info( __("Twitter data connection updated") );
echo redireccion( url( true ), 2);
}
}
?>
<form method="POST" action="<?php echo url() . 'oauth.php' ?>" class="form-horizontal">
<div class="control-group">
<label class="control-label">
<?php _e("Consumer Key") ?>
</label>
<div class="controls">
<input type="text" name="consumer_key" value="<?php echo $datos['consumer_key'] ?>" required="required">
<span class="help-block"><small><code>consumer_key</code> <?php _e("of your Twitter app") ?></small></span>
</div>
</div>
<div class="control-group">
<label class="control-label">
<?php _e("Consumer Secret") ?>
</label>
<div class="controls">
<input type="text" name="consumer_secret" value="<?php echo $datos['consumer_secret'] ?>" required="required">
<span class="help-block"><small><code>consumer_secret</code> <?php _e("of your Twitter app") ?></small></span>
</div>
</div>
<div class="control-group">
<label class="control-label">
<?php _e("Access Token") ?>
</label>
<div class="controls">
<input type="text" name="access_token" value="<?php echo $datos['access_token'] ?>" required="required">
<span class="help-block"><small><code>access_token</code> <?php _e("of your Twitter app") ?></small></span>
</div>
</div>
<div class="control-group">
<label class="control-label">
<?php _e("Access Token Secret") ?>
</label>
<div class="controls">
<input type="text" name="access_token_secret" value="<?php echo $datos['access_token_secret'] ?>" required="required">
<span class="help-block"><small><code>access_token_secret</code> <?php _e("of your Twitter app") ?></small></span>
</div>
</div>
<center><input type="submit" class="text-center btn btn-primary" value="<?php _e("Update") ?>" name="enviar" id="enviar"></center>
</form>
<?php
construir('pies');