Index: trunk/extensions/Push/Push.php |
— | — | @@ -110,3 +110,4 @@ |
111 | 111 | } |
112 | 112 | |
113 | 113 | require_once 'Push_Settings.php'; |
| 114 | + |
Index: trunk/extensions/Push/includes/Push_Functions.php |
— | — | @@ -105,6 +105,35 @@ |
106 | 106 | } |
107 | 107 | |
108 | 108 | return $pageSet; |
109 | | - } |
| 109 | + } |
110 | 110 | |
| 111 | + /** |
| 112 | + * Function to change the keys of $egPushLoginUsers and $egPushLoginPasswords |
| 113 | + * from target url to target name using the $egPushTargets array. |
| 114 | + * |
| 115 | + * @since 0.5 |
| 116 | + * |
| 117 | + * @param array $arr |
| 118 | + * @param string $id Some string to indentify the array and keep track of it having been flipped. |
| 119 | + */ |
| 120 | + public static function flipKeys( array &$arr, $id ) { |
| 121 | + static $handledArrays = array(); |
| 122 | + |
| 123 | + if ( !in_array( $id, $handledArrays ) ) { |
| 124 | + $handledArrays[] = $id; |
| 125 | + |
| 126 | + global $egPushTargets; |
| 127 | + |
| 128 | + $flipped = array(); |
| 129 | + |
| 130 | + foreach ( $arr as $key => $value ) { |
| 131 | + if ( array_key_exists( $key, $egPushTargets ) ) { |
| 132 | + $flipped[$egPushTargets[$key]] = $value; |
| 133 | + } |
| 134 | + } |
| 135 | + |
| 136 | + $arr = $flipped; |
| 137 | + } |
| 138 | + } |
| 139 | + |
111 | 140 | } |
\ No newline at end of file |
Index: trunk/extensions/Push/api/ApiPush.php |
— | — | @@ -41,6 +41,9 @@ |
42 | 42 | $this->dieUsageMsg( array( 'missingparam', 'targets' ) ); |
43 | 43 | } |
44 | 44 | |
| 45 | + PushFunctions::flipKeys( $egPushLoginUsers, 'users' ); |
| 46 | + PushFunctions::flipKeys( $egPushLoginPasswords, 'passwds' ); |
| 47 | + |
45 | 48 | foreach ( $params['targets'] as &$target ) { |
46 | 49 | $user = false; |
47 | 50 | $pass = false; |
Index: trunk/extensions/Push/api/ApiPushImages.php |
— | — | @@ -39,6 +39,9 @@ |
40 | 40 | $this->dieUsageMsg( array( 'missingparam', 'targets' ) ); |
41 | 41 | } |
42 | 42 | |
| 43 | + PushFunctions::flipKeys( $egPushLoginUsers, 'users' ); |
| 44 | + PushFunctions::flipKeys( $egPushLoginPasswords, 'passwds' ); |
| 45 | + |
43 | 46 | foreach ( $params['targets'] as &$target ) { |
44 | 47 | $user = false; |
45 | 48 | $pass = false; |