Revize 420
Přidáno uživatelem Roman Ševčík před asi 15 roky(ů)
freenetis/trunk/kohana/application/controllers/settings.php | ||
---|---|---|
|
||
// page title
|
||
$this->form->input('voip_number_interval')->label(url_lang::lang('texts.Number interval').':')->rules('length[19,19]|required')->value($this->setting->voip_number_interval)->callback(array($this,'valid_voip_number_interval'));
|
||
$this->form->input('voip_sip_server')->label(url_lang::lang('texts.SIP Server').':')->rules('length[1,30]|required')->value($this->setting->voip_sip_server);
|
||
|
||
// // self-registration
|
||
// $this->form->radio('self_registration')->label(url_lang::lang('texts.Self-registration').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default($this->setting->self_registration);
|
freenetis/trunk/kohana/application/controllers/voip.php | ||
---|---|---|
if ($voip->count() == 0)
|
||
Controller::error(4);
|
||
|
||
$config = new Config_Model();
|
||
$config->get_value_from_name('voip_sip_server');
|
||
$sip_server = $config->get_value_from_name('voip_sip_server');
|
||
|
||
|
||
$voip = $voip_sip->get_record_by_user($user_id);
|
||
|
||
$voip = $voip->current();
|
||
//echo Str_Replace(
|
||
|
||
// Array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú","ů","ý ","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž") ,
|
||
|
||
// Array("a","c","d","e","e","i","l","n","o","r","s","t","u","u","y ","z","A","C","D","E","E","I","L","N","O","R","S","T","U","U","Y","Z") ,
|
||
|
||
/// 'ěščřžýáíé');
|
||
/// $voip->regseconds 'ěščřžýáíé');
|
||
|
||
//$text = "příliš žluťoučký kůň úpěl ďábelské ódy"
|
||
//echo(StrTr($text, "ÁÄČÇĎÉĚËÍŇÓÖŘŠŤÚŮÜÝŽáäčçďéěëíňóöřšťúůüýž", "AACCDEEEINOORSTUUUYZaaccdeeeinoorstuuuyz"));
|
||
|
||
if(valid::ip($voip->current()->ipaddr) == true)
|
||
$link_status = '<b style="color:green;">'.url_lang::lang('texts.Registered').'</b>';
|
||
if(( $voip->regseconds - time()) > 1)
|
||
$link_status = true;
|
||
else
|
||
$link_status = '<b style="color:red;">'.url_lang::lang('texts.Not registered').'</b>';
|
||
$link_status = false;
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header = new View('base/header');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Show VoIP');
|
||
$view->content = new View('voip/show');
|
||
$view->header->title = url_lang::lang('texts.Show VoIP');
|
||
$view->content = new View('voip/show');
|
||
$view->content->headline = url_lang::lang('texts.Show VoIP');
|
||
$view->content->voip = $voip->current();
|
||
$view->content->voip = $voip;
|
||
$view->content->sip_server = $sip_server;
|
||
$view->content->link_status = $link_status;
|
||
$view->content->ipaddr = $voip->ipaddr;
|
||
$view->content->port = $voip->port;
|
||
$view->content->regseconds = $voip->regseconds - time();
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
|
||
}
|
||
|
||
|
||
function change_password($user_id = NULL)
|
||
{
|
||
if (!isset($user_id))
|
||
Controller::warning(1);
|
||
|
||
$voip_sip = new Voip_sip_Model();
|
||
$voip = $voip_sip->get_record_by_user_limited($user_id);
|
||
|
||
if ($voip->count() == 0)
|
||
Controller::error(4);
|
||
|
||
$voip = $voip_sip->get_record_by_user($user_id);
|
||
|
||
$voip = $voip->current();
|
||
|
||
$this->user_id = $user_id;
|
||
$form = new Forge(url_lang::base()."voip/change_password/".$user_id, '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->password('password')->label(url_lang::lang('texts.New password').':')->rules('required|length[6,20]');
|
||
$form->password('confirm_password')->label(url_lang::lang('texts.Confirm new password').':')->rules('required|length[6,20]')->matches($form->password);
|
||
$form->submit('submit')->value(url_lang::lang('texts.Change'));
|
||
|
||
if($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
|
||
$voip_sip = new Voip_sip_Model();
|
||
$voip = $voip_sip->find_by_user_id($user_id);
|
||
|
||
$voip->secret = $form_data['password'];
|
||
|
||
if ($voip->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Password has been successfully changed.'));
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - cant change password.'));
|
||
}
|
||
|
||
url::redirect(url_lang::base().'voip/change_password/'.$user_id);
|
||
|
||
}
|
||
else
|
||
{
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('voip/change_password');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Change application password');
|
||
$view->content->form = $form->html();
|
||
$view->content->user_id = $user_id;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->content->password = $voip->secret;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
function edit($user_id = NULL)
|
||
{
|
||
if (!isset($user_id))
|
freenetis/trunk/kohana/application/views/voip/show.php | ||
---|---|---|
<?php
|
||
|
||
$links[] = html::anchor(url_lang::base().'users/show/'.$voip->user_id, url_lang::lang('texts.Back to the user'));
|
||
$links[] = html::anchor(url_lang::base().'voip/edit/'.$voip->user_id, url_lang::lang('texts.Edit'));
|
||
//$links[] = html::anchor(url_lang::base().'voip/edit/'.$voip->user_id, url_lang::lang('texts.Edit'));
|
||
|
||
|
||
echo implode (' | ', $links);?>
|
||
... | ... | |
<th colspan="2"><?php echo url_lang::lang('texts.Login information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.usename') ?></th>
|
||
<th><?php echo url_lang::lang('texts.username') ?></th>
|
||
<td><?php echo $voip->name ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.password') ?></th>
|
||
<td><?php echo '<b>********</b>'.' '.html::anchor(url_lang::base().'voip/change_passord/'.$voip->user_id, url_lang::lang('texts.Change')); ?></td>
|
||
<td><?php echo '<b>********</b>'.' '.html::anchor(url_lang::base().'voip/change_password/'.$voip->user_id, url_lang::lang('texts.Change')); ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Display name') ?></th>
|
||
... | ... | |
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Domain') ?></th>
|
||
<td><?php echo 'sip.slfree.net' ?></td>
|
||
<td><?php echo $sip_server ?></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<table class="extended" cellspacing="0" style="float:left; margin-left:10px; width:360px;">
|
||
<tr>
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Link status') ?></th>
|
||
</tr>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Status') ?></th>
|
||
<td><?php echo $link_status; ?></td>
|
||
</tr>
|
||
<td><?php echo $link_status?'<b style="color:green;">'.url_lang::lang('texts.Registered').'</b>':'<b style="color:red;">'.url_lang::lang('texts.Not registered').'</b>'; ?></td>
|
||
|
||
</tr>
|
||
<?php if ($link_status == true ){?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.IP address') ?></th>
|
||
<td><?php echo $voip->ipaddr ?></td>
|
||
</tr>
|
||
<td><?php echo $ipaddr ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Port') ?></th>
|
||
<td><?php echo $voip->port ?></td>
|
||
</tr>
|
||
<td><?php echo $port ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Registration expires') ?></th>
|
||
<td><?php echo $voip->regseconds ?></td>
|
||
<td><?php echo $regseconds.' s' ?></td>
|
||
</tr>
|
||
<?php }?>
|
||
</table>
|
||
|
||
<br />
|
||
<br />
|
||
<table class="extended" style="float:left; width:360px;">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Voicemail information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.username') ?></th>
|
||
<td><?php echo $voip->name ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.password') ?></th>
|
||
<td><?php echo '<b>********</b>'.' '.html::anchor(url_lang::base().'voip/change_password/'.$voip->user_id, url_lang::lang('texts.Change')); ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Display name') ?></th>
|
||
<td><?php echo $voip->callerid ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Domain') ?></th>
|
||
<td><?php echo $sip_server ?></td>
|
||
</tr>
|
||
</table>
|
freenetis/trunk/kohana/application/views/voip/change_password.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Change VoIP password') ?></h2><br />
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<?php
|
||
$links = array();
|
||
|
||
$links[] = html::anchor(url_lang::base().'voip/show/'.$user_id, url_lang::lang('texts.Back to VoIP account'));
|
||
|
||
echo implode (' | ', $links)
|
||
?>
|
||
<br /><br />
|
||
|
||
<?php echo url_lang::lang('texts.Current VoIP password is') ?> <b><?php echo $password ?></b>
|
||
<br /><br />
|
||
|
||
|
||
<?php echo $form?>
|
||
|
Také k dispozici: Unified diff
Integrave asterisku do freentisu - nějaké drobnosti.