1<?php 2/** 3 * Plugin XCOM" 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Myron Turner <turnermm02@shaw.ca> 7 */ 8 9 10/** 11 * All DokuWiki plugins to extend the admin function 12 * need to inherit from this class 13 */ 14if(!defined('DOKU_INC')) die(); 15 16class admin_plugin_xcom extends DokuWiki_Admin_Plugin { 17 private $local_user; 18 function __construct() { 19 global $INFO; 20 $this->local_user = $INFO['client']; 21 22 } 23 24 function forAdminOnly(){ 25 return false; 26 } 27 28 /** 29 * handle user request 30 */ 31 function handle() { 32 33 } 34 35 /** 36 * output appropriate html 37 */ 38 function html() { 39 /** 40 info panels 41 */ 42 43 /** 44 Instructions 45 */ 46 ptln('<div id="xcom_howto" style="display:none;border:1px black solid;padding:12px 12px 12px 8px;height:400px;overflow:auto;">' ); 47 ptln('<button style = "float:right;" onclick="xcom_toggle(\'#xcom_howto\')">' . $this->getLang('close'). '</button> ' . $this->locale_xhtml('howto')); 48 ptln('<button style = "float:right" onclick="xcom_toggle(\'#xcom_howto\')">' . $this->getLang('close'). '</button> <br /><br /></div>'); 49 50 /** 51 Functions 52 */ 53 ptln('<div id="xcom_functions" style="display:none;border:1px black solid;padding:12px 12px 12px 8px;height:400px;overflow:auto;">' ); 54 ptln('<b>' . $this->getLang('xmlrpc_fns') . ': </b><a href="https:/dokuwiki.org/xmlrpc">https://dokuwiki.org/devel:xmlrpc</a>'); 55 ptln(' ' .$this->getLang('xmlrpc_fns_qualifier')); 56 ptln('<button style = "float:right;" onclick="xcom_toggle(\'#xcom_functions\')">' . $this->getLang('close'). '</button> ' . $this->locale_xhtml('functions')); 57 ptln('<button style = "float:right" onclick="xcom_toggle(\'#xcom_functions\')">' . $this->getLang('close'). '</button> <br /><br /></div>'); 58 /** 59 Toggles and function buttons 60*/ 61 ptln('<div style="margin-bottom:8px;">'); 62 ptln('<button onclick=" xcom_toggle(\'#xcom_functions\')">'. $this->getLang('functions') .'</button> '); 63 ptln('<button onclick=" xcom_toggle(\'#xcom_howto\')">'. $this->getLang('howto') .'</button> '); 64 ptln('<button class="xcom_send_but" onclick="xmlrpc()">' . $this->getLang('send') .'</button>'); 65 66 ptln('<button style="float:right;margin-left:8px;" title="' . $this->getLang('results_tip'). '" onclick="xcom_show(\'xcom_results\');">' . $this->getLang('results'). '</button>'); 67 ptln('<button style="float:right;margin-left:8px;" onclick="xcom_toggle(\'#xcom_editable\');">' . $this->getLang('editable'). '</button>'); 68 ptln('<button style="float:right;margin-left:8px;" onclick="xcom_toggle(\'#xcom_htm\');">' . $this->getLang('html'). '</button>'); 69 ptln('<button style="float:right;margin-left:8px;" onclick="xcom_toggle(\'#xcom_pre\');">' . $this->getLang('pre'). '</button>'); 70 ptln('<button style="float:right;margin-left:8px;" onclick="xcom_toggle(\'#xcom_action\');">' . $this->getLang('action'). '</button>'); 71 ptln('<button style="float:right;margin-left:8px;" title="' . $this->getLang('results_tip'). '" onclick="xcom_hide_all_views();">' . $this->getLang('hideallviews'). '</button>'); 72 ptln('</div>'); 73 74 ptln('<form action="'.wl($ID).'" method="post" name ="xcom_post">'); 75 ptln(' <input type="hidden" name="do" value="admin" />'); 76 ptln(' <input type="hidden" name="page" value="'.$this->getPluginName().'" />'); 77 formSecurityToken(); 78 /** 79 credentials 80 */ 81 // Remote Credentials 82 $textboxsize = $this->getConf('textbox_size'); 83 ptln( $this->getLang('url').': <input type="text" size = "' . $textboxsize .'" name="xcom_url" id = "xcom_url"> '); 84 ptln( $this->getLang('user').': <input type="text" size = "12" name="xcom_user" id = "xcom_user"> '); 85 ptln( $this->getLang('pwd').': <input type="password" size = "9" name="xcom_pwd" id = "xcom_pwd">'); 86 ptln(' <img src="' . DOKU_REL . 'lib/plugins/xcom/images/eye_blk.png" title="'. $this->getLang('pwdview') . '" name="xcom_eye" id ="xcom_eye" />'); 87 ptln('</form>'); 88 89 /** 90 Selection inputs and locals 91 */ 92 ptln ('<div style = "padding-top: 8px;">'); 93 ptln('<form action = "javascript:void 0;">'); 94 95 ptln('<select id = "xcom_sel"><option value="none">' . $this->getLang('select') .'</option></select> ' ); 96 ptln('<span title="'. $this->getLang('pageid_title') .'">' . $this->getLang('pageid').': <input type="text" name="xcom_pageid" value="" id = "xcom_pageid"> </span>'); 97 ptln('<span title="'. $this->getLang('options_title') .'">' . $this->getLang('options').': <input type="text" name="xcom_opts" size="' . $textboxsize .'" id = "xcom_opts"></span>'); 98 99 ptln('<div class="xcom_sites">'); 100 ptln('<select id = "xcom_selsites" onchange="xcom_select(this);"><option value="none">' . $this->getLang('sel_sites') .'</option></select> ' ); 101 ptln(' ' . $this->getLang('debug') . ' <input type = "checkbox" name = "xcom_debug" id = "xcom_debug">'); 102 // Local User and Password 103 ptln ('<div class="local_side"> '); 104 ptln( '<button onclick="xcom_localSave(this.form.xcom_pageid.value);" title="' . $this->getLang('locsave_title') . '">'. $this->getLang('locsave') . '</button> '); 105 ptln( $this->getLang('locuser').': <input type="text" size = "12" value="' . $this->local_user . '" name="xcom_locuser" id = "xcom_locuser"> '); 106 ptln($this->getLang('localpwd'). ': <input type="password" size = "9" name="xcom_localpwd" id = "xcom_localpwd">'); 107 ptln(' <img src="' . DOKU_REL . 'lib/plugins/xcom/images/eye_blk.png" title="'. $this->getLang('pwdview') . '" name="xcom_loceye" id ="xcom_loceye" />'); 108 ptln(' </div>') ; // end local_side 109 110 ptln('</div>'); //end xcom_sites 111 ptln('</form>'); 112 ptln( '</div>'); // end Selection inputs and locals 113 114 /** 115 Output 116 */ 117 ptln('<div>'); 118 // ptln ('<div class="xcom_view_status" id="xcom_view"></div>'); 119 ptln('<div id = "xcom_results" style ="display:none;border: 1px solid #ddd;" >'); //start results 120 ptln('<div id = "xcom_action_title" style ="display:none;">' . $this->getLang('action_result') . '</div><div id = "xcom_action" style ="display:none;" ></div>'); 121 ptln('<div id = "xcom_editable_title" style ="display:none;">' . $this->getLang('editable') . '</div><div class="xcom_editdiv"><form><textarea style ="display:none;margin:auto;" name="xcom_editable" cols="120" rows="16" id = "xcom_editable" style="margin-bottom:8px;"></textarea></form></div>'); 122 ptln('<div id = "xcom_pre_title" style ="display:none;">' . $this->getLang('pre') . '</div><div id = "xcom_pre" style ="display:none;white-space:pre;" ></div>'); 123 ptln('<div id = "xcom_htm_title" style ="display:none;">' . $this->getLang('html') . '</div><div id = "xcom_htm" style ="display:none;" ></div>'); 124 ptln('<br /><button onclick="xcom_hide(\'xcom_results\');">' . $this->getLang('close'). '</button> </div>'); //close/end results 125 ptln( '</div>'); 126 127 /** 128 Status Bar 129 */ 130 ptln('<div id = "xcom_status">'); 131 ptln($this->getLang('clear') . ': '); 132 ptln('<a href="javascript:xcom_clear(\'xcom_pre\');void 0;">[' . $this->getLang('pre') . ']</a> '); 133 ptln('<a href="javascript:xcom_clear(\'xcom_htm\');void 0;">[' . $this->getLang('html') . ']</a> '); 134 ptln('<a href="javascript:xcom_clear(\'xcom_editable\');void 0;">[' . $this->getLang('editable') . ']</a> '); 135 ptln('<a href="javascript:xcom_clear(\'xcom_action\');void 0;">[' . $this->getLang('action') . ']</a> '); 136 ptln(' <span class="xcom_qslabel" id="xcom_qslabel">' . $this->getLang('query') . ':</span>'); 137 ptln(' <span class="xcom_qstatus" id="xcom_qstatus"></span>'); 138 // ptln('<a href="javascript:xmlrpc();void 0;"><span class="xcom_send_link" onmouseover="xcom_rollover(this,1);" //onmouseout="xcom_rollover(this,0);">[' . $this->getLang('send') .']</span></a> '); 139 ptln( '</div>'); 140 141 } 142}