This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/host/classes/Host/Plugin/Crazydomains.php

54 lines
1.8 KiB
PHP
Raw Permalink Normal View History

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Crazy Domains support
*
* @package Host
* @category Plugins
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Host_Plugin_CrazyDomains extends Host_Plugin {
// Manage UI Login Attributes
protected $login_acnt_field = '';
protected $login_user_field = 'user';
protected $login_pass_field = 'pass';
// Our required abstract classes
public function __get($key) {}
public function admin_update() {}
public function serialize() {
return (string)$this->_object;
}
public function unserialize($s) {
$this->_object = XML::factory(NULL,NULL,$s);
}
public function manage_button(Model_Service_Plugin_Host $spho,$t) {
return $this->render_button($t,$spho->service_id,$spho->username(),substr(md5($spho->password()),0,8));
}
public function admin_manage_button(Model_Host_Server $hso,$t) {
return $this->render_button($t,$hso->id,substr(md5($hso->manage_username),0,8),substr(md5($hso->manage_password),0,8));
}
protected function render_button($t,$sid,$u,$p) {
$debug = FALSE;
$output = '';
$output .= Form::open(
$debug ? 'debug/site' : $this->hso->manage_url,
array('target'=>'w24','method'=>'post','id'=>sprintf('id_%s_%s',$sid,$t))
);
$output .= Form::input($this->login_user_field,$u,array('type'=>'hidden','id'=>sprintf('u_%s_%s',$sid,$t)));
$output .= Form::input($this->login_pass_field,$p,array('type'=>'hidden','id'=>sprintf('p_%s_%s',$sid,$t)));
$output .= Form::hidden('submitted','TRUE');
$output .= Form::close();
$output .= Form::button('submit',_('Login'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$sid,$t),'nocg'=>TRUE));
return $output;
}
}
?>