Changeset 768335
- Timestamp:
- 09/07/2013 05:54:01 PM (12 years ago)
- Location:
- rivercraft/trunk
- Files:
-
- 2 added
- 6 edited
-
JSONAPI.php (modified) (3 diffs)
-
css/img/back_office (added)
-
css/img/back_office/settings.png (added)
-
css/style.css (modified) (1 diff)
-
panel.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
rivercraft.php (modified) (1 diff)
-
widget.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rivercraft/trunk/JSONAPI.php
r653693 r768335 15 15 public $host; 16 16 public $port; 17 public $salt;18 17 public $username; 19 18 public $password; … … 26 25 * Creates a new JSONAPI instance. 27 26 */ 28 public function __construct ($host, $port, $uname, $pword , $salt) {27 public function __construct ($host, $port, $uname, $pword) { 29 28 $this->host = $host; 30 29 $this->port = $port; 31 30 $this->username = $uname; 32 31 $this->password = $pword; 33 $this->salt = $salt;34 32 35 33 if(!extension_loaded("cURL")) { … … 48 46 $method = json_encode($method); 49 47 } 50 return hash('sha256', $this->username . $method . $this->password . $this->salt);48 return hash('sha256', $this->username . $method . $this->password); 51 49 } 52 50 -
rivercraft/trunk/css/style.css
r659313 r768335 27 27 28 28 .rcstatus h4, .rconplayer h4{ 29 font-weight: bolder; 29 30 text-decoration: underline; 30 31 display: inline; -
rivercraft/trunk/panel.php
r653693 r768335 1 1 <?php 2 3 /** 4 *@package Rivercraft 5 *@version 1.3 6 */ 7 8 //////////////////////////////////////////////////////////////// 9 // Add rivercraft panel for settings // 10 //////////////////////////////////////////////////////////////// 2 11 3 12 add_action('admin_menu', 'panel'); 4 13 5 14 function panel(){ 6 add_menu_page( 'RiverCraft - Configuration', 'RiverCraft', 'activate_plugins', 'rivercraft-panel', 'r ender_panel', null, 63);15 add_menu_page( 'RiverCraft - Configuration', 'RiverCraft', 'activate_plugins', 'rivercraft-panel', 'rc_panel', plugins_url('Rivercraft/css/img/back_office/settings.png'), '99.1' ); 7 16 } 8 17 9 function render_panel(){ 18 $salt = get_option('saltrc', ''); 19 if (isset($salt)) { 20 delete_option('saltrc'); 21 } 22 23 function rc_panel(){ 10 24 if (isset($_POST['panel_update'])) { 11 25 foreach ($_POST['options'] as $name => $value) { … … 64 78 </td> 65 79 </tr> 66 <tr>67 <th scope="row">68 <label for="saltrc">Salt</label>69 </th>70 <td>71 <input type="text" placeholder="Votre salt de JSONAPI" id="saltrc" name="options[saltrc]" value="<?php print(get_option( 'saltrc', '' )); ?>" size="100">72 </td>73 </tr>74 80 </tbody> 75 81 </table> -
rivercraft/trunk/readme.txt
r661266 r768335 5 5 Tags: jsonapi, minecraft, bukkit 6 6 Requires at least: 3.0 7 Tested up to: 3. 58 Stable tag: 1. 2.17 Tested up to: 3.6 8 Stable tag: 1.3 9 9 License: GPLv2 or later 10 10 … … 17 17 18 18 == Installation == 19 20 19 <ul> 21 <li> 22 Vous devez tout d'abord installer le plugin <a href="http://dev.bukkit.org/server-mods/jsonapi/">JSONAPI</a> dans le dossier Plugin du serveur CraftBukkit. 23 </li> 24 <li> 25 Ensuite réactulaiser ou redémarrer votre serveur. 26 Un nouveau dossier au nom de JSONAPI devrai apparaître dans le dossier Plugin. 27 </li> 28 <li> 29 Ouvrez le fichier config.yml qui s'y trouve. 30 Vous devriez voir : <br> 31 <ul> 32 <li style="list-style-type:none;"> 33 <code> 34 method-whitelist: <br> 35 - getPlayerLimit <br> 36 - dynmap.getPort <br> 37 logins: <br> 38 usernameGoesHere: passwordGoesHere <br> 39 options: <br> 40 startup-delay: 2000 <br> 41 port: 20059 <br> 42 ip-whitelist: [] <br> 43 log-to-console: true <br> 44 log-to-file: 'false' <br> 45 salt: 'salt goes here' <br> 46 anyone-can-use-calladmin: true <br> 47 server-name: 'default' <br> 48 </code> 49 </li> 50 </ul> 20 <li>Vous devez tout d'abord installer le plugin <a href="http://dev.bukkit.org/server-mods/jsonapi/">JSONAPI</a> dans le dossier Plugin de votre serveur CraftBukkit.</li> 21 <li>Ensuite réactulaiser ou redémarrer votre serveur. <br> 22 Un nouveau dossier au nom de JSONAPI devrai apparaître dans le dossier Plugin. </li> 23 <li>Ouvrez le fichier config.yml qui s'y trouve. Vous devriez voir : </li> 24 <pre> 25 method-whitelist: 26 - getPlayerLimit 27 - dynmap.getPort 28 options: 29 stream_pusher: 30 max_queue_age: 30 31 max_queue_length: 500 32 startup-delay: 2000 33 port: 20059 34 ip-whitelist: [] 35 log-to-console: true 36 log-to-file: 'false 37 anyone-can-use-calladmin: true 38 use-new-api: false 39 </pre> 40 41 <li>Modifiez "20059" avec le port demandé au préalable à votre hébergeur.</li> 51 42 52 <br><ul> 53 <li>Modifiez "usernameGoeshere" avec un nom d'utilisateur.</li> 54 <li>Modifiez "passwordGoesHere" avec un mot de passe.</li> 55 <li>Modifiez "20059" avec le port demandé au préalable à votre hébergeur.</li> 56 <li>Modifiez "salt goes here" avec un second mot de passe.</li> 57 <li>Exemple de configuration: <br> 58 <code> 59 method-whitelist: <br> 60 - getPlayerLimit <br> 61 - dynmap.getPort <br> 62 logins: <br> 63 root: root <br> 64 options: <br> 65 startup-delay: 2000 <br> 66 port: 25600 <br> 67 ip-whitelist: [] <br> 68 log-to-console: true <br> 69 log-to-file: 'false' <br> 70 salt: salt <br> 71 anyone-can-use-calladmin: true <br> 72 server-name: 'default' <br> 73 </code> 74 </li> 75 </ul> 43 <li>Ouvrez le fichier user.yml qui s'y trouve.Vous devriez voir :</li> 44 <pre> 45 users: 46 users1: 47 username: usernameGoeshere 48 password: passwordGoesHere 49 groups: 50 - full_control 51 </pre> 76 52 77 78 < /li>53 <li>Modifiez "usernameGoeshere" avec un nom d'utilisateur.</li> 54 <li>Modifiez "passwordGoesHere" avec un mot de passe.</li> 79 55 80 <li> 81 Installez RiverCraft, si ce n'est pas déjà fait sur votre site/blog Wordpress. 82 </li> 56 <li>Installez RiverCraft, si ce n'est pas déjà fait sur votre site/blog Wordpress. </li> 83 57 <li>Allez dans le nouveau menu Rivecraft qui se trouve dans votre BackOffice.</li> 84 58 <li>Insérez les informations demandés</li> 85 <li>Allez dans le Apparence>Widgets et activez le widget. Normalement les champs sont déjà remplis. Vous pouvez éventuellement modifier ces champs pour afficher un autre serveur.</li> 86 87 </ul> 88 59 <li>Allez dans le Apparence>Widgets et activez le widget. Les champs sont déjà remplis. Vous pouvez éventuellement modifier ces champs pour afficher un autre serveur.</li> 60 </ul> 61 89 62 == Screenshots == 90 91 1. Exemple d'un serveur en ligne 92 2. Exemple d'un serveur hors ligne 93 63 / 94 64 == Frequently Asked Questions == 95 96 <center>/</center> 97 65 / 98 66 == Upgrade Notice == 99 100 <center>/</center> 101 67 / 102 68 == Changelog == 103 69 104 = Version 1. 2.1 (30/01/2013) =70 = Version 1.3 (07/09/2013) = 105 71 106 - Correctif 72 - MàJ OBLIGATOIRE 73 - MàJ de la gestion des informations permettant la connexion au serveur 107 74 108 75 = Version 1.2 (25/01/2013) = -
rivercraft/trunk/rivercraft.php
r661266 r768335 3 3 /** 4 4 *@package Rivercraft 5 *@version 1. 2.15 *@version 1.3 6 6 */ 7 7 /* 8 Plugin Name: Rivercraft 8 Plugin Name: Rivercraft_ 9 9 Description: Rivercraft permet d'unir Wordpress et Minecraft avec JSONAPI. 10 Version: 1. 2.110 Version: 1.3 11 11 Author: Heithem DRIDI ( RiverNight ) 12 12 License: GPLv2 or later 13 13 */ 14 14 15 require "JSONAPI.php";16 require "panel.php";17 require "widget.php";18 15 19 wp_enqueue_style('Rivercraft', '/wp-content/plugins/Rivercraft/css/style.css'); 16 //////////////////////////////////////////////////////////////// 17 // Include page/file // 18 //////////////////////////////////////////////////////////////// 19 20 21 22 23 //Require file 24 require "JSONAPI.php"; // JSONAPI Class 25 require "panel.php"; // Add a panel in Back-Office 26 require "widget.php"; // Server statut widget 27 28 29 //Include CSS files in the header 30 wp_enqueue_style('Rivercraft', '/wp-content/plugins/RC/css/style.css'); 31 20 32 21 33 ?> -
rivercraft/trunk/widget.php
r661266 r768335 1 1 <?php 2 2 3 /** 4 *@package Rivercraft 5 *@version 1.3 6 */ 7 8 //////////////////////////////////////////////////////////////// 9 // Widget function // 10 //////////////////////////////////////////////////////////////// 11 12 3 13 function rcou_widget(){ 4 5 register_widget("rcou_widget"); 6 7 } 14 register_widget("rcou_widget");} 8 15 9 16 add_action("widgets_init", "rcou_widget"); 10 17 11 18 class rcou_widget extends wp_widget{ 12 13 19 function rcou_widget(){ 14 15 20 $options = array( 16 21 "classname" => "rcou-widget", 17 "description" => "Afficher sur votre site l'état de votre serveur Minecraft." 18 ); 19 20 $this->WP_widget("rcou-widget", "RiverCraft - Online User", $options); 21 22 } 22 "description" => "Afficher sur votre site l'état de votre serveur Minecraft."); 23 $this->WP_widget("rcou-widget", "RiverCraft - Online User", $options);} 23 24 24 25 function widget($arguments, $data){ 25 26 26 $defaut = array( 27 27 "title" => "", … … 29 29 "portrc" => "print(get_option( 'portrc', '' ));", 30 30 "userrc" => "print(get_option( 'userrc', '' ));", 31 "pwdrc" => "print(get_option( 'pwdrc', '' ));", 32 "saltrc" => "print(get_option( 'saltrc', '' ));", 33 ); 31 "pwdrc" => "print(get_option( 'pwdrc', '' ));",); 34 32 35 33 $ip = $data['iprc']; … … 37 35 $user = $data['userrc']; 38 36 $pwd = $data['pwdrc']; 39 $salt = $data['saltrc'];40 37 $api = new JSONAPI($ip, $port, $user, $pwd, $salt); 41 38 $Server = $api->call("getServer"); … … 45 42 $Version = $api->call("getBukkitVersion"); 46 43 47 48 44 $data = wp_parse_args($data, $defaut); 49 45 50 46 global $wpdb; 51 47 $table_prefix = $wpdb->prefix; … … 54 50 55 51 echo $before_widget; 56 echo $before_title . $data['title'] 57 58 . $after_title; 52 echo $before_title . $data['title'] . $after_title; 53 59 54 if ($Server["success"] == '') { 60 55 ?> … … 65 60 </div> 66 61 </div> 67 <?php 68 } 69 else { 62 <?php 63 }else { 70 64 ?> 71 65 <div class="rcwidget"> … … 77 71 <div class="rconplayer"> 78 72 <h4>Joueur en ligne:</h4> 79 <p><?php print_r($PlayerCount["success"]) ?><strong> /<?php print_r($PlayerLimit["success"]) ?></strong></ p>73 <p><?php print_r($PlayerCount["success"]) ?><strong> /<?php print_r($PlayerLimit["success"]) ?></strong></div> 80 74 <div><?php 81 if ($PlayerNames["success"] == '') { 82 echo ""; 83 } 84 else { 85 foreach ($PlayerNames["success"] as $key => $value) { 86 echo"<img src=\"https://minotar.net/avatar/$value/32\" alt=\"$value\" title=\"$value\"> "; 87 } 75 foreach ($PlayerNames["success"] as $key => $value) { 76 echo"<img src=\"https://minotar.net/avatar/$value/32\" alt=\"$value\" title=\"$value\"> "; 88 77 } 89 78 ?> 90 79 </div> 91 80 </div> 92 </div>93 81 <?php 94 82 } 95 83 echo $after_widget; 96 97 84 } 98 85 … … 104 91 $content_new['userrc'] = esc_attr($content_new['userrc']); 105 92 $content_new['pwdrc'] = esc_attr($content_new['pwdrc']); 106 $content_new['saltrc'] = esc_attr($content_new['saltrc']);107 93 return $content_new; 108 94 … … 117 103 "userrc" => "print(get_option( 'userrc', '' ));", 118 104 "pwdrc" => "print(get_option( 'pwdrc', '' ));", 119 "saltrc" => "print(get_option( 'saltrc', '' ));",120 105 ); 121 106 … … 155 140 <input value="<?php print(get_option( 'pwdrc', '' )); ?>" name="<?php echo $this->get_field_name('pwdrc'); ?>" id="<?php echo $this->get_field_id('pwdrc'); ?>" type="password" /> 156 141 </p> 157 <p>158 <!-- JSONAPI's Salt -->159 <label for="<?php echo $this->get_field_id('saltrc'); ?>">Votre salt</label><br />160 <input value="<?php print(get_option( 'saltrc', '' )); ?>" name="<?php echo $this->get_field_name('saltrc'); ?>" id="<?php echo $this->get_field_id('saltrc'); ?>" type="text" />161 </p>162 142 <?php 163 143
Note: See TracChangeset
for help on using the changeset viewer.