Пример #1
0
 /**
  * Construction
  * Directories initialisation
  * Standard data assignment
  *
  * @param string $dir The template directory
  */
 function __construct($dir = null)
 {
     global $version, $can, $m, $a, $tab, $g, $action, $actionType, $dialog, $ajax, $suppressHeaders, $uistyle;
     $rootDir = CAppUI::conf("root_dir");
     $extraPath = self::$extraPath;
     if (!$dir) {
         $root = $extraPath ? "{$rootDir}/{$extraPath}" : $rootDir;
         $dir = "{$root}/modules/{$m}";
     }
     $this->compile_dir = "{$rootDir}/tmp/templates_c/";
     // Directories initialisation
     $this->template_dir = "{$dir}/templates/";
     // Check if the cache dir is writeable
     if (!is_dir($this->compile_dir)) {
         CMbPath::forceDir($this->compile_dir);
     }
     // Delimiter definition
     $this->left_delimiter = "{{";
     $this->right_delimiter = "}}";
     // Default modifier for security reason
     $this->default_modifiers = array("@cleanField");
     // Register mediboard functions
     $this->register_block("tr", array($this, "tr"));
     $this->register_block("main", array($this, "main"));
     $this->register_function("mb_default", array($this, "mb_default"));
     $this->register_function("mb_ditto", array($this, "mb_ditto"));
     $this->register_function("mb_class", array($this, "mb_class"));
     $this->register_function("mb_value", array($this, "mb_value"));
     $this->register_function("mb_include", array($this, "mb_include"));
     $this->register_function("mb_script", array($this, "mb_script"));
     $this->register_function("thumb", array($this, "thumb"));
     $this->register_function("unique_id", array($this, "unique_id"));
     $this->register_function("mb_didacticiel", array($this, "mb_didacticiel"));
     $this->register_modifier("idex", array($this, "idex"));
     $this->register_modifier("conf", array($this, "conf"));
     $this->register_modifier("pad", array($this, "pad"));
     $this->register_modifier("json", array($this, "json"));
     $this->register_modifier("purify", array($this, "purify"));
     $this->register_modifier("markdown", array($this, "markdown"));
     $this->register_modifier("iso_date", array($this, "iso_date"));
     $this->register_modifier("iso_time", array($this, "iso_time"));
     $this->register_modifier("iso_datetime", array($this, "iso_datetime"));
     $this->register_modifier("rel_datetime", array($this, "rel_datetime"));
     $this->register_modifier("week_number_month", array($this, "week_number_month"));
     $this->register_modifier("const", array($this, "_const"));
     $this->register_modifier("static", array($this, "_static"));
     $this->register_modifier("static_call", array($this, "static_call"));
     $this->register_modifier("cleanField", array($this, "cleanField"));
     $this->register_modifier("stripslashes", array($this, "stripslashes"));
     $this->register_modifier("emphasize", array($this, "emphasize"));
     $this->register_modifier("ireplace", array($this, "ireplace"));
     $this->register_modifier("ternary", array($this, "ternary"));
     $this->register_modifier("trace", array($this, "trace"));
     $this->register_modifier("currency", array($this, "currency"));
     $this->register_modifier("percent", array($this, "percent"));
     $this->register_modifier("spancate", array($this, "spancate"));
     $this->register_modifier("float", array($this, "float"));
     $this->register_modifier("integer", array($this, "integer"));
     $this->register_modifier("decabinary", array($this, "decabinary"));
     $this->register_modifier("decasi", array($this, "decasi"));
     $this->register_modifier("module_installed", array($this, "module_installed"));
     $this->register_modifier("module_active", array($this, "module_active"));
     $this->register_modifier("JSAttribute", array($this, "JSAttribute"));
     $this->register_modifier("nozero", array($this, "nozero"));
     $this->register_modifier("ide", array($this, "ide"));
     $this->register_function("mb_token", array($this, "mb_token"));
     $modules = CModule::getActive();
     foreach ($modules as $mod) {
         $mod->canDo();
     }
     // Standard data assignment
     $this->assign("style", $uistyle);
     $this->assign("app", CAppUI::$instance);
     $this->assign("conf", CAppUI::conf());
     $this->assign("user", CAppUI::$instance->user_id);
     // shouldn't be necessary
     $this->assign("version", $version);
     $this->assign("suppressHeaders", $suppressHeaders);
     $this->assign("can", $can);
     $this->assign("m", $m);
     $this->assign("a", $a);
     $this->assign("tab", $tab);
     $this->assign("action", $action);
     $this->assign("actionType", $actionType);
     $this->assign("g", $g);
     $this->assign("dialog", $dialog);
     $this->assign("ajax", $ajax);
     $this->assign("modules", $modules);
     $this->assign("base_url", CApp::getBaseUrl());
     $this->assign("current_group", CGroups::loadCurrent());
     $this->assign("dnow", CMbDT::date());
     $this->assign("dtnow", CMbDT::dateTime());
     $this->assign("tnow", CMbDT::time());
 }
Пример #2
0
<?php

/**
 * Configure
 *
 * @category Webservices
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
// MB SOAP server
$mb_soap_server = CExchangeSource::get("mb_soap_server", "soap", true, null, false);
if (!$mb_soap_server->_id) {
    $mb_soap_server->host = CApp::getBaseUrl() . "/index.php?login=1&username=%u&password=%p&m=webservices&a=soap_server&wsdl";
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("mb_soap_server", $mb_soap_server);
$smarty->display("configure.tpl");
Пример #3
0
 /**
  * Add service
  *
  * @param string $username  Username
  * @param string $password  Password
  * @param string $module    Module name
  * @param string $tab       Tab name
  * @param string $classname Class name
  *
  * @return void
  */
 function addService($username, $password, $module, $tab, $classname)
 {
     $definitions = $this->documentElement;
     $this->addComment($definitions, "Partie 7 : Service");
     $service = $this->addElement($definitions, "service");
     $this->addAttribute($service, "name", "MediboardService");
     $this->addTexte($service, "documentation", "Documentation du WebService");
     $partie8 = $this->createComment("partie 8 : Port");
     $service->appendChild($partie8);
     $port = $this->addElement($service, "port");
     $this->addAttribute($port, "name", "MediboardPort");
     $this->addAttribute($port, "binding", "typens:MediboardBinding");
     $soapaddress = $this->addElement($port, "soap:address", null, "http://schemas.xmlsoap.org/wsdl/soap/");
     $url = "/?login=1&username={$username}&password={$password}&m={$module}&a={$tab}&class={$classname}&suppressHeaders=1";
     $base_url = CAppUI::conf("webservices wsdl_root_url");
     $this->addAttribute($soapaddress, "location", $base_url ? $base_url . $url : CApp::getBaseUrl() . $url);
 }
Пример #4
0
    // Pour garder en référence les fonctions a decrire
    $wsdlFile->_soap_handler = $class;
    $wsdlFile->addTypes();
    $wsdlFile->addMessage();
    $wsdlFile->addPortType();
    $wsdlFile->addBinding();
    $wsdlFile->addService($username, $password, $m, $a, $classname);
    echo $wsdlFile->saveXML();
} else {
    if (!$classname || !class_exists($classname, true)) {
        throw new SoapFault("1", "Error : classname is not valid");
    }
    // on indique au serveur à quel fichier de description il est lié
    try {
        $base_url = CAppUI::conf("webservices wsdl_root_url");
        $base = $base_url ? $base_url : CApp::getBaseUrl();
        $serverSOAP = new SoapServer($base . "/?login=1&username={$username}&password={$password}&m={$m}&a={$a}&class={$classname}&wsdl");
    } catch (Exception $e) {
        echo $e->getMessage();
    }
    $serverSOAP->setClass($classname);
    // Lance le serveur
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $serverSOAP->handle();
    } else {
        echo '<strong>This Mediboard SOAP server can handle following functions : </strong>';
        echo '<ul>';
        foreach ($serverSOAP->getFunctions() as $_function) {
            echo '<li>', $_function, '</li>';
        }
        echo '</ul>';