Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1266

Přidáno uživatelem Ondřej Fibich před asi 13 roky(ů)

Novinky:

- evidence telefonnich operatoru a jejich predcisli
- filtr telefonnich cisel pro posilani SMS zprav pomoci nove evidence operatoru

Opravy:

- oprava chyby prekladu anglictiny pri vlozeni argumentu pro retezec

Zobrazit rozdíly:

freenetis/branches/testing/application/i18n/cs_CZ/texts.php
$lang = array
(
'%d prefix already in database' => '%d předčíslí se již nachází v databázi',
'%s days ago' => 'před %s dny',
'%s hours ago' => 'před %s hodinama',
'%s minutes ago' => 'před %s minutama',
......
'add new key' => 'Přidat nový klíč',
'add new member' => 'Přidat nového člena',
'add new message' => 'Přidat novou zprávu',
'add new phone operator' => 'Přidat nového telefonního operátora',
'add new port' => 'Přidat nový port',
'add new project account' => 'Přidat nový projektový účet',
'add new redirection message' => 'Přidat novou zprávu přesměrování',
......
'approval type has been successfully updated' => 'Hlasovací typ byl úspěšně aktualizován.',
'approval types' => 'Hlasovací typy',
'approved' => 'Schváleno',
'approved phone operators and prefixes' => 'Povolení telefonní operátoři a předčíslí',
'approved work reports' => 'Schválené prácovní výkazy',
'approved works' => 'Schválené práce',
'april' => 'Duben',
......
'edit member' => 'Upravit člena',
'edit member limit' => 'Upravit limit člena',
'edit message' => 'Upravit zprávu',
'edit phone operator' => 'Upravit telefonního operátora',
'edit port' => 'Úprava portu',
'edit private phone number contact' => 'Upravit soukromý telefonní kontakt',
'edit redirection message' => 'Úprava zprávy přesměrování',
......
'error - cannot add bank transfer' => 'Chyba - nelze přidat bankovní převod.',
'error - cannot add cloud' => 'Chyba - nelze přidat oblast',
'error - cannot add message' => 'Chyba - nelze přidat zprávu.',
'error - cannot add phone operator' => 'Chyba - nelze přidat telefonního operátora',
'error - cannot assign transfer' => 'Chyba - nelze přiřadit převod.',
'error - cannot complete registration' => 'Chyba - Nelze dokončit registraci',
'error - cannot delete bank statement' => 'Chyba - nelze smazat bankovní výpis.',
......
'error - cant delete private phone contacts' => 'Chyba - nelze smazat soukromý telefonní kontakt.',
'error - cant delete subnet' => 'Chyba - nelze smazat podsíť.',
'error - cant delete town' => 'Chyba - nelze smazat město.',
'error - cant delete this phone operator' => 'Chyba - nelze smazat tohoto telefonního operátora',
'error - cant delete user' => 'Chyba - nelze smazat uživatele.',
'error - cant delete vlan interface' => 'Chyba - nelze smazat VLAN rozhraní.',
'error - cant delete wireless setting' => 'Chyba - nelze smazat bezdrátové nastavení.',
......
'error - can\'t delete translation' => 'Chyba - nelze smazat překlad.',
'error - cant do the transfer' => 'Chyba - nelze provést transakci.',
'error - cant edit fee' => 'Chyba - nelze upravit poplatek.',
'error - cant edit phone operator' => 'Chyba - nelze editovat telefonního operátora',
'error - cant edit work report' => 'Chyba - nelze editovat pracovní výkaz',
'error - cant end membership' => 'Chyba - nelze ukončit členství.',
'error - cant change password' => 'Chyba - nelze změnit heslo.',
......
'list of all member calls' => 'Výpis všech hovorů člena',
'list of all pending work reports' => 'Seznam všech nerozhodnutých pracovních výkazů',
'list of all pending works' => 'Seznam všech nerozhodnutých prací',
'list of all phone operators' => 'Seznam všech telefonních operátorů',
'list of all redirected records' => 'Seznam všech přesměrovaných záznamů',
'list of all redirection messages' => 'Seznam všech zpráv přesměrování',
'list of all rejected work reports' => 'Seznam všech zamítnutých pracovních výkazů',
......
'november' => 'Listopad',
'number' => 'Číslo',
'number of the recipient' => 'Číslo příjemce',
'phone number of the sim card' => 'Telefonní číslo SIM karty',
'phone invoice has been' => 'Faktura byla',
'phone invoice' => 'Telefonní faktura',
'number of the sender' => 'Číslo odesilatele',
'numbers' => 'Čísla',
'number interval' => 'Rozsah čísel',
'number length' => 'Délka čísla',
'number of months' => 'Počet měsíců',
'number of the hours' => 'počet hodin',
'numbers' => 'Čísla',
'o' => 'V',
'object' => 'Objekt',
'october' => 'Říjen',
......
'phone already exists in database' => 'Telefon je již v databázi',
'phone invoice has been deleted' => 'Fktura za telefon byla smazána.',
'phone number' => 'Telefonní číslo',
'phone operator of number is not enabled for sending sms' => 'Telefoní operátor, jemuž patří toto číslo, není povolen pro zasílání SMS.',
'phone number of the sim card' => 'Telefonní číslo SIM karty',
'phone number user' => 'Telefonní číslo uživatele',
'phone registration status' => 'Stav registrace telefonu',
'phone invoice has been' => 'Faktura byla',
'phone invoice' => 'Telefonní faktura',
'phone invoice for number %s in period from %s to %s' => 'Telefonní faktura za číslo %s v období od %s do %s',
'phone invoices' => 'Telefonní faktury',
'phone invoices of user' => 'Telefonní faktury uživatele',
'phone number length' => 'Délka telefonního čísla',
'phone operator has been successfully added' => 'Telefonní operátor byl úspěšně přidán.',
'phone operator has been successfully editet' => 'Telefonní operátor byl úspěšně editován.',
'phone operator has been successfully deleted' => 'Telefonní operátor byl úspěšně smazán.',
'phone operators' => 'Telefonní operátoři',
'phone prefixes' => 'Telefonní předčíslí',
'phone registration status' => 'Stav registrace telefonu',
'phones' => 'Telefony',
'phones in invoice' => 'Telefonní čísla ve faktuře',
'php curl modul not installed' => 'PHP CURL modul není nainstalován',
......
'pppoe' => 'pppoe',
'pre title' => 'Tituly před jménem',
'pre-installation check' => 'Předinstalační kontrola',
'prefixes' => 'Předčíslí',
'prefixes separated by semicolon' => 'Předčíslí oddělené středníkem',
'preview' => 'Náhled',
'previous' => 'Předchozí',
'previous rejected work' => 'Předchozí odmítnutá práce',
......
'sms message recieved' => 'SMS zpráva přijata',
'sms message send' => 'SMS zpráva odeslána',
'sms messages' => 'SMS zprávy',
'sms messages enabled' => 'SMS zprávy povoleny',
'sms message has been successfully added' => 'SMS zpráva byla úspěšně přidána.',
'sms settings' => 'SMS nastavení',
'some phones wasn\'t founded' => 'Některé telefony nebyly nalezeny',
......
'whitelist setting has been successfully set' => 'Bílá listina byla úspěšně nastavena.',
'whole d' => 'Celé z.',
'without change' => 'Beze změny',
'without prefixes' => 'Bez prefixů',
'without street' => 'Bez ulice',
'wireless' => 'bezdrátové',
'wireless interfaces' => 'Bezdrátová rozhraní',
freenetis/branches/testing/application/i18n/cs_CZ/help.php
'self_cancel_url' => 'Je to adresa na centrální bráně, na které běží lighthttpd web server. Pravidla firewallu na centrální bráně takto poznají uživatelův úmysl ukončit přesměrování. Stránka tedy může obsahovat stručnou informaci pro uživatele o ukončení přesměrování a případný rozcestník.',
'service' => 'Je-li pro tuto IP adresu zapnuta služba, pak je tato IP adresa využívána pro Radius. Typicky jde o IP adresy aktivních síťových prvků, na které je se možné pomocí Radiusu přihlásit.',
'set_whitelist_to_member' => 'Trvalá bílá listina je seznam takových IP adres, pro které neplatí přesměrování. Jde například o důležitou partnerskou instituci zapojenou do sítě, například městský úřad apod. Všechna systémová přesměrování tedy nemohou ve výchozím stavu obtěžovat počítače s IP adresou na bílé listině. Lze ovšem vytvořit takové zprávy, které budou ignorovat tuto listinu, např. informování o nadcházejícím výpadku. Pro dočasnou bílou listinu platí to samé, ale IP adresy v ní jsou po určeném čase z této listiny mazány. Např. uživatel byl přesměrován kvůli neplacení a chceme mu umožnit krátkodobý přístup na internet do internetového bankovnictví.',
'sms_enabled' => 'Určuje zda-li zasílání SMS zpráv ze systému do sítě tohoto operátora je povoleno.',
'subnet_owner' => 'IP adresy, jenž nejsou v systému, patřící do podsítě budou přiřazeni k tomuto členovi-vlastníkovi. Na tyto podsítě se tedy nevztahuje přesměrování Neznámé zařízení - neznámé IP adresy jsou přiřazeni k členovi.',
'subnet_used_ips' => 'Jedná se procentuální vyjádření využití IP adres v podsíti. Červené zbarvení značí docházející IP adresy, zelené pak nevyužitou podsít (zbytečně velká?).',
'total_traffic' => 'Jedná se o celkový provoz člena od spuštění ulogd.',
freenetis/branches/testing/application/i18n/en_US/help.php
'self_cancel_url' => 'It addresses the central gate, which runs lighthttpd web server. Firewall rules on the central gate thus identify the user\'s intention to terminate redirection. Page therefore may contain brief information for the user to terminate any links and redirects.',
'service' => 'If the IP address for this service is enabled, then this IP address used for the Radius. Typically, these IP addresses of active network elements on which it is possible to log on via Radius.',
'set_whitelist_to_member' => 'Permanent white list is a list of such IP addresses for which it does not redirect. This is such an important partner institution involved in the network, such as municipal authorities, etc. Any diversion system is not in default bother computer with an IP address on the white list. But you can create a message that will ignore this list, such as informing of impending failure. For temporary whitelist does the same, but IP addresses in it after a specified time from the instrument clean. Eg. user was redirected due to non-payment and we want him to allow short-term Internet access to internet banking.',
'sms_enabled' => 'Specifies whether to send SMS messages from the system into a network of this operator is allowed.',
'subnet_owner' => 'IP addresses, which are not in the system, belonging to a subnet will be assigned to the member-owner. These are therefore not subnet redirects Unknown device - unknown IP addresses are assigned to the member.',
'subnet_used_ips' => 'This percentage of use of IP addresses in the subnet. Red coloration indicates incoming IP addresses, then the unused green subnet (too large?).',
'total_traffic' => 'It is total traffic of member since running ulogd.',
freenetis/branches/testing/application/vendors/unit_tester/unit_testing_config.xml
</values>
</method>
</controller>
<controller name="phone_operators">
<method name="index" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="show_all" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="add" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="edit" autogenerate="on">
<attributes>
<attribute name="phone_operator_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="delete" autogenerate="on">
<attributes>
<attribute name="phone_operator_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="valid_prefix" autogenerate="on">
<attributes>
<attribute name="input" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
</controller>
<controller name="ports">
<method name="index" autogenerate="on">
<attributes></attributes>
......
</input>
</values>
</method>
<method name="find_phone_country" autogenerate="off">
<attributes>
<attribute name="phone_number" default_value=""/>
</attributes>
<values>
<input>
<param value=""/>
</input>
<input>
<param value="788456312"/>
</input>
<input>
<param value="#$#'$we"/>
</input>
</values>
</method>
<method name="find_phone_country_code" autogenerate="off">
<attributes>
<attribute name="phone_number" default_value=""/>
</attributes>
<values>
<input>
<param value=""/>
</input>
<input>
<param value="420788456312"/>
</input>
<input>
<param value="#$#'$we"/>
</input>
</values>
</method>
<method name="get_phone_prefix" autogenerate="on">
<attributes></attributes>
<values>
......
</input>
</values>
</method>
<method name="find_phone_country" autogenerate="on">
<attributes>
<attribute name="phone_number" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="find_phone_country_id" autogenerate="on">
<attributes>
<attribute name="phone_number" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="find_phone_country_code" autogenerate="on">
<attributes>
<attribute name="phone_number" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
</model>
<model name="device">
<method name="count_all_devices" autogenerate="on">
......
</values>
</method>
</model>
<model name="phone_operator">
<method name="is_sms_enabled_for" autogenerate="on">
<attributes>
<attribute name="phone_number" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="get_all" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="get_grouped_prefixes" autogenerate="on">
<attributes>
<attribute name="phone_operator_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
</model>
<model name="phone_operator_prefix">
<method name="find_phone_operator_prefix" autogenerate="on">
<attributes>
<attribute name="phone_number" default_value="" />
<attribute name="country_id" default_value="" />
</attributes>
<values>
<input>
<param value="" />
<param value="" />
</input>
</values>
</method>
</model>
<model name="phone_pay">
<method name="get_pays_from" autogenerate="off">
<attributes>
freenetis/branches/testing/application/models/phone_invoice_user.php
*/
public function get_user_id($phone_number)
{
static $contact = NULL;
static $country = NULL;
if ($contact == NULL)
if ($country == NULL)
{
$contact = new Contact_Model();
$country = new Country_Model();
}
$country_code = $contact->find_phone_country_code($phone_number);
$country_code = $country->find_phone_country_code($phone_number);
$query = $this->db->query("
SELECT u.user_id FROM users_contacts u
freenetis/branches/testing/application/models/phone_operator.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Phone operator is operator base on defined country with many phone prefixes.
*
* @author Ondřej Fibich
* @package Model
* @property integer $country_id
* @property Country_Model $country
* @property string $name
* @property integer $phone_number_length
* @property boolean $sms_enabled
* @property ORM_Iterator $phone_operator_prefixes
*/
class Phone_operator_Model extends ORM
{
protected $belongs_to = array('country');
protected $has_many = array('phone_operator_prefixes');
/**
* Check if SMS are enavled for given phone number
*
* @staticvar Country_Model $country_m
* @staticvar Phone_operator_prefix_Model $prefix_m
* @staticvar Phone_operator_Model $operator_m
* @param string $phone_number Phone number with all prefixes
* @return boolean
*/
public static function is_sms_enabled_for($phone_number)
{
// static vars and loading
static $country_m, $prefix_m, $operator_m;
if (empty($country_m))
{
$country_m = new Country_Model();
$prefix_m = new Phone_operator_prefix_Model();
$operator_m = new Phone_operator_Model();
}
// trim number
$number = trim($phone_number);
// find country
if (($country = $country_m->find_phone_country($number)) == FALSE)
{
return FALSE;
}
// get number without country prefix
$number = substr($number, mb_strlen($country->country_code));
// search prefix
if (($prefix = $prefix_m->find_phone_operator_prefix($number, $country->id)) == FALSE)
{
return FALSE;
}
// load operator
$operator_m->find($prefix->phone_operator_id);
// get number without operator prefix
$number = substr($number, mb_strlen($prefix->prefix));
// same length of number as supposed to be?
return (mb_strlen($number) == $operator_m->phone_number_length);
}
/**
* Gets all records
*
* @return ORM_Iterator
*/
public function get_all()
{
return $this->db->query("
SELECT o.*, c.country_name AS country,
GROUP_CONCAT(p.prefix ORDER BY prefix SEPARATOR ', ') AS prefixes
FROM phone_operators o
LEFT JOIN countries c ON c.id = o.country_id
LEFT JOIN phone_operator_prefixes p ON p.phone_operator_id = o.id
GROUP BY o.id
ORDER BY o.name
");
}
/**
* Gets grouped prefixes of phone operators
*
* @param integer $phone_operator_id
* @return string
*/
public function get_grouped_prefixes($phone_operator_id = NULL)
{
if (empty($phone_operator_id) && $this->id)
{
$phone_operator_id = $this->id;
}
return $this->db->query("
SELECT GROUP_CONCAT(prefix ORDER BY prefix SEPARATOR ';') AS prefixes
FROM phone_operator_prefixes
WHERE phone_operator_id = ?
", $phone_operator_id)->current()->prefixes;
}
}
freenetis/branches/testing/application/models/contact.php
*/
/**
* Contanct are user for user contacts, private contacts.
* Each contact has it's type and value.
* Phone contacts are connected to countries by pivo table.
*
* @author Ondrej Fibich
* @package Model
*
* @property int $id
* @property int $type
* @property string $value
* @property unknown_type $countries
* @property unknown_type $users_contacts
* @property unknown_type $private_users_contacts
* @property ORM_Iterator $countries
* @property ORM_Iterator $users_contacts
* @property ORM_Iterator $private_users_contacts
*/
class Contact_Model extends ORM
{
......
const TYPE_MSN = 23;
const TYPE_WEB = 25;
protected $has_many = array('users' => 'private_users_contacts');
protected $has_and_belongs_to_many = array('users_contacts' => 'users', 'countries');
protected $has_many = array
(
'users' => 'private_users_contacts'
);
protected $has_and_belongs_to_many = array
(
'users_contacts' => 'users', 'countries'
);
/**
* Check if user own this contact
......
SELECT COUNT(contact_id) AS count
FROM users_contacts
WHERE contact_id = ? AND user_id = ?
", array($this->id, $user_id))->current()->count;
", $this->id, $user_id)->current()->count;
}
/**
......
SELECT COUNT(contact_id) AS count
FROM users_contacts
WHERE contact_id = ?
", array($this->id, $this->id))->current()->count;
", $this->id, $this->id)->current()->count;
}
/**
......
WHERE contact_id = ?
)
) AS count
", array($this->id, $this->id))->current()->count;
", $this->id, $this->id)->current()->count;
}
/**
......
LEFT JOIN users_contacts u ON u.contact_id = c.id
WHERE u.user_id = ?" . ($type ? " AND c.type = ?" : "") . "
ORDER BY c.type
", array($user_id, $type))->current()->count;
", $user_id, $type)->current()->count;
}
/**
......
*
* @param int $user_id
* @param int $type Contacts type
* @return unknow_type
* @return ORM_Iterator
*/
public function find_all_users_contacts($user_id, $type = NULL)
{
......
LEFT JOIN countries n ON n.id = o.country_id
WHERE u.user_id = ?" . ($type ? " AND c.type = ?" : "") . "
ORDER BY c.type
", array($user_id, $type));
", $user_id, $type);
}
/**
* Returns all private users contacts (id is from table private_users_contacts)
*
* @param int $user_id
* @return unknow_type
* @return ORM_Iterator
*/
public function find_all_private_users_contacts($user_id)
{
......
LEFT JOIN contacts_countries o ON o.contact_id = c.id
LEFT JOIN countries n ON n.id = o.country_id
WHERE p.user_id = ? ORDER BY p.description
", array($user_id));
", $user_id);
}
/**
......
public function find_contact_id($type, $value)
{
$query = $this->db->query("
SELECT c.id FROM contacts c
SELECT c.id
FROM contacts c
WHERE c.type = ? AND c.value = ?
", array($type, $value));
", $type, $value);
return ($query->count() > 0) ? $query->current()->id : FALSE;
}
/**
* Search for phone prefix in country table.
*
* @author Ondřej Fibich
* @param string $phone_number Telephone number with prefix
* @return integer ID of country or zero
*/
public function find_phone_country($phone_number)
{
$query = $this->db->query("
SELECT id FROM `countries`
WHERE country_code != '' AND ? LIKE CONCAT( country_code, '%' ) LIMIT 1
", array($phone_number));
return ($query->count() == 1) ? $query->current()->id : 0;
}
/**
* Search for phone prefix in country table.
*
* @author Ondřej Fibich
* @param string $phone_number Telephone number with prefix
* @return integer country code or zero
*/
public function find_phone_country_code($phone_number)
{
$query = $this->db->query("
SELECT country_code FROM `countries`
WHERE country_code != '' AND ? LIKE CONCAT( country_code, '%' ) LIMIT 1
", array($phone_number));
return ($query->count() == 1) ? $query->current()->country_code : '';
}
/**
* Gets prefix of phone country code
*
* @author Ondřej Fibich
* @return prefix or empty string
* @return string Prefix or empty string
*/
public function get_phone_prefix()
{
freenetis/branches/testing/application/models/phone_operator_prefix.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Phone operator prefix is phone number prefix for operator.
*
* @author Ondřej Fibich
* @package Model
* @property integer $phone_operator_id
* @property Phone_operator_Model $phone_operator
* @property string $prefix
*/
class Phone_operator_prefix_Model extends ORM
{
protected $belongs_to = array('phone_operator');
/**
* Search for phone prefix in phone number without country prefix.
*
* @author Ondřej Fibich
* @param string $phone_number Telephone number with operator prefix
* @param integer $country_id Country ID of prefix
* @return mixed Country ID or FALSE
*/
public function find_phone_operator_prefix($phone_number, $country_id)
{
$query = $this->db->query("
SELECT *
FROM phone_operator_prefixes p
LEFT JOIN phone_operators o ON o.id = p.phone_operator_id
WHERE p.prefix != '' AND
? LIKE CONCAT(p.prefix, '%') AND
o.country_id = ?
LIMIT 1
", $phone_number, $country_id);
return ($query->count() == 1) ? $query->current() : '';
}
}
freenetis/branches/testing/application/models/country.php
* @property string $country_code
* @property ORM_Iterator $contacts
* @property ORM_Iterator $address_points
* @property ORM_Iterator $phone_operators
*/
class Country_Model extends ORM
{
protected $has_many = array('address_points');
protected $has_many = array('address_points', 'phone_operators');
protected $has_and_belongs_to_many = array('contacts');
/**
......
return ($result && $result->count()) ? $result->current() : NULL;
}
/**
* Search for phone prefix in country table.
*
* @author Ondřej Fibich
* @param string $phone_number Telephone number with prefix
* @return mixed Country or FALSE
*/
public function find_phone_country($phone_number)
{
$query = $this->db->query("
SELECT *
FROM countries
WHERE country_code != '' AND ? LIKE CONCAT( country_code, '%' ) LIMIT 1
", $phone_number);
return ($query->count() == 1) ? $query->current() : '';
}
/**
* Search for phone prefix in country table.
*
* @author Ondřej Fibich
* @param string $phone_number Telephone number with prefix
* @return mixed Country ID or FALSE
*/
public function find_phone_country_id($phone_number)
{
$query = $this->db->query("
SELECT id
FROM countries
WHERE country_code != '' AND ? LIKE CONCAT( country_code, '%' ) LIMIT 1
", $phone_number);
return ($query->count() == 1) ? $query->current()->id : '';
}
/**
* Search for phone prefix in country table.
*
* @author Ondřej Fibich
* @param string $phone_number Telephone number with prefix
* @return integer Country code or zero
*/
public function find_phone_country_code($phone_number)
{
$query = $this->db->query("
SELECT country_code
FROM `countries`
WHERE country_code != '' AND ? LIKE CONCAT( country_code, '%' ) LIMIT 1
", $phone_number);
return ($query->count() == 1) ? $query->current()->country_code : '';
}
}
freenetis/branches/testing/application/models/private_users_contact.php
*/
public function get_contact_id($user_id, $phone_number)
{
static $contact = NULL;
static $country = NULL;
if ($contact == NULL)
$contact = new Contact_Model();
if ($country == NULL)
$country = new Country_Model();
$country_code = $contact->find_phone_country_code($phone_number);
$country_code = $country->find_phone_country_code($phone_number);
$query = $this->db->query("
SELECT p.id FROM private_users_contacts p
freenetis/branches/testing/application/controllers/private_phone_contacts.php
$im_constacts = @$_POST['im_contact'];
if (!is_array($im_names) || !is_array($im_namels) ||
!is_array($im_namefs) || !is_array($im_phones))
!is_array($im_namefs) || !is_array($im_phones))
{
echo json_encode($error['error_args']);
return;
......
$output = array();
$private_user_contact = new Private_users_contact_Model();
$country_model = new Country_Model();
// start trasaction
$user->transaction_start();
// we have got right data
......
$contact = new Contact_Model();
$country = NULL;
// gets number without country prefix
$country_id = $contact->find_phone_country($number);
$country_id = $country_model->find_phone_country_id($number);
$number_short = $number;
if ($country_id > 0)
{
$country = new Country_Model($country_id);
......
if ($form->validate())
{
$contact = new Contact_Model();
$country = NULL;
$country = new Country_Model();
// gets number without country prefix
$country_id = $contact->find_phone_country($number);
$country_id = $country->find_phone_country_id($number);
if ($country_id > 0)
{
$country = new Country_Model($country_id);
$country = $country->find($country_id);
$number = substr($number, strlen($country->country_code));
}
// is contact already in database?
$contact_id = $contact->find_contact_id(Contact_Model::TYPE_PHONE, $number);
if ($contact_id == 0)
{
$contact->type = Contact_Model::TYPE_PHONE;
freenetis/branches/testing/application/controllers/scheduler.php
}
}
//send quened SMS
self::send_quened_sms();
// SMS
if (Sms::enabled())
{
//send quened SMS
self::send_quened_sms();
//receive SMS
self::receive_sms();
//receive SMS
self::receive_sms();
}
// update ulogd
......
// send all SMS
foreach ($unsent_messages as $m)
{
// enabled operator?
if (!Phone_operator_Model::is_sms_enabled_for($m->receiver))
{
$m->state = Sms_message_Model::SENT_FAILED;
$m->message = 'Phone operator of number is not enabled for sending SMS';
$m->save();
continue;
}
// init driver if not initialized before
if (!array_key_exists($m->driver, $sms_drivers))
{
freenetis/branches/testing/application/controllers/voip_calls.php
public static function parse_number($number, $area = '')
{
// uses static variables to save memory
static $contact_model, $country_model;
static $country_model;
if (!$contact_model)
$contact_model = new Contact_Model();
if (!$country_model)
$country_model = new Country_Model();
......
else
{
// try to find country by number
$country_id = $contact_model->find_phone_country($number);
$country_id = $country_model->find_phone_country_id($number);
// number is without country code, add default
if ($country_id == '')
......
public static function number($number, $user_id, $private_users = array())
{
// uses static variables to save memory
static $user_model, $contact_model, $voip_sip_model, $private_users_contact_model;
static $user_model, $country_model, $voip_sip_model, $private_users_contact_model;
if (!$user_model)
$user_model = new User_Model();
if (!$contact_model)
$contact_model = new Contact_Model();
if (!$country_model)
$country_model = new Country_Model();
if (!$voip_sip_model)
$voip_sip_model = new Voip_sip_Model();
......
$private_users_contact_model = new Private_users_contact_Model();
// finds country code
$country_code = $contact_model->find_phone_country_code($number);
$country_code = $country_model->find_phone_country_code($number);
// and removes it from number
$number = substr(
freenetis/branches/testing/application/controllers/settings.php
->rules('required')
->options($drivers)
->selected(Settings::get('sms_driver'));
$this->form->input('sms_permit_extensions')
->label(__('Permit extensions') . ':')
->rules('required')
->value(Settings::get('sms_permit_extensions'));
/* Forms for all drivers */
......
url::redirect('settings/sms');
}
// description
$description = html::anchor('phone_operators', __(
'Approved phone operators and prefixes'
)) . ' ' . help::hint('sms_enabled');
// create view for this template
$view = new View('main');
......
$view->content->current = 'sms';
$view->content->content = $this->form->html();
$view->content->headline = __('SMS');
$view->content->description = $description;
$view->content->link_back = $this->links;
$view->content->additional_info = $aditional_info;
$view->render(TRUE);
freenetis/branches/testing/application/controllers/work_reports.php
$grid_concepts->field('id')
->label('ID');
$grid_concepts->order_link_field('user_id')
$grid_concepts->link_field('user_id')
->link('users/show', 'uname')
->label('Worker');
......
$grid_pending->field('id')
->label('ID');
$grid_pending->order_link_field('user_id')
$grid_pending->link_field('user_id')
->link('users/show', 'uname')
->label('Worker');
......
$grid_approved->field('id')
->label('ID');
$grid_approved->order_link_field('user_id')
$grid_approved->link_field('user_id')
->link('users/show', 'uname')
->label('Worker');
......
$grid_rejected->field('id')
->label('ID');
$grid_rejected->order_link_field('user_id')
$grid_rejected->link_field('user_id')
->link('users/show', 'uname')
->label('Worker');
freenetis/branches/testing/application/controllers/sms.php
* SMS controller.
*
* @author Lubomir Buben, Roman Sevcik, Ondrej Fibich
*
* @TODO correct functionality not confirmed - candidate for removal? (jsvitak)
* @TODO access rights missing (dzolo)
*/
class Sms_Controller extends Controller
{
......
$limit_results = 100, $order_by = 'id',
$order_by_direction = 'desc', $page_word = null, $page = 1)
{
// access
if (!$this->acl_check_view('Settings_Controller', 'system'))
{
Controller::error(ACCESS);
}
// get new selector
if (is_numeric($this->input->get('record_per_page')))
{
......
$limit_results = 100, $order_by = 'id',
$order_by_direction = 'desc', $page_word = null, $page = 1)
{
// access
if (!$this->acl_check_view('Settings_Controller', 'system'))
{
Controller::error(ACCESS);
}
// get new selector
if (is_numeric($this->input->get('record_per_page')))
{
......
*/
public function show($sms_id = null)
{
// access
if (!$this->acl_check_view('Settings_Controller', 'system'))
{
Controller::error(ACCESS);
}
if (!isset($sms_id))
{
Controller::warning(PARAMETER);
......
}
// find phone prefix
$code = ORM::factory('contact')->find_phone_country_code($sms->receiver);
$code = ORM::factory('country')->find_phone_country_code($sms->receiver);
$number = substr($sms->receiver, strlen($code));
// try to find owner of number
......
*/
public function send($phone = null, $sms_id = null, $selected_subnet = null)
{
// access
if (!$this->acl_check_view('Settings_Controller', 'system'))
{
Controller::error(ACCESS);
}
$drivers = Sms::get_active_drivers();
if (!count($drivers))
......
if (!is_numeric($phone))
{
$phone = null;
$cid = Settings::get('default_country');
$phone = ORM::factory('country', $cid)->country_code;
}
if (!is_numeric($sms_id))
......
}
}
if (strlen($phone) == 12)
$phone = $phone;
elseif (strlen($phone) == 9)
$phone = '420' . $phone;
else
$phone = '';
$sn = $this->settings->get('sms_sender_number');
$sender_number[$sn] = $sn;
......
$form->input('receiver_number')
->label(__('Number of the recipient') . ':')
->rules('length[12,12]required|valid_phone')
->rules('length[9,13]|required|valid_phone')
->callback(array($this, 'valid_phone_number'))
->value($phone);
$form->dateselect('stamp')
......
{
$phone = $row->phone;
if (strlen($phone) == 12)
$phone = $phone;
elseif (strlen($phone) == 9)
$phone = '420' . $phone;
else
continue;
$sms->clear();
$sms->user_id = $this->session->get('user_id');
$sms->sms_message_id = $form_data['s_id'];
......
$sms->transaction_commit();
status::success('SMS message has been successfully added.');
url::redirect('sms/send');
url::redirect('sms/show/' . $sms->id);
}
catch (Exception $e)
{
......
}
}
/**
* Checks validity of phone number.
* Checks validity of phone number and check if it is enabled operator
* for sending SMS.
*
* @param object$input phone number
* @param object $input phone number
*/
public static function callback_valid_phone($input = NULL)
public static function valid_phone_number($input = NULL)
{
if (empty($input) || !is_object($input))
{
self::error(PAGE);
}
$value = trim($input->value);
$number = trim($input->value);
if (!preg_match('/^[0-9]{9,9}$/', $value))
if (!Phone_operator_Model::is_sms_enabled_for($number))
{
$input->add_error('required', __('Bad phone format.'));
$input->add_error('required', __(
'Phone operator of number is not enabled for sending SMS.'
));
}
}
freenetis/branches/testing/application/controllers/phone_operators.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Controller performs actions over phone operators and their prefixes.
*
* @package Controller
* @author Ondřej Fibich
*/
class Phone_operators_Controller extends Controller
{
/**
* Index redirects to show all
*/
public function index()
{
url::redirect('phone_operators/show_all');
}
/**
* Shows all clouds
*/
public function show_all()
{
// access check
if (!$this->acl_check_view('Settings_Controller', 'system'))
{
Controller::error(ACCESS);
}
// model
$phone_operator_model = new Phone_operator_Model();
// gets data
$query = $phone_operator_model->get_all();
// grid
$grid = new Grid('clouds', null, array
(
'use_paginator' => false,
'use_selector' => false
));
if ($this->acl_check_new('Settings_Controller', 'system'))
{
$grid->add_new_button('phone_operators/add', __('Add new phone operator'));
}
$grid->field('id')
->label('ID');
$grid->field('country');
$grid->field('name');
$grid->field('phone_number_length')
->label('Number length');
$grid->field('prefixes');
$grid->callback_field('sms_enabled')
->label('SMS')
->help(help::hint('sms_enabled'))
->callback('callback::boolean');
$actions = $grid->grouped_action_field();
if ($this->acl_check_edit('Settings_Controller', 'system'))
{
$actions->add_action()
->icon_action('edit')
->url('phone_operators/edit');
}
if ($this->acl_check_delete('Settings_Controller', 'system'))
{
$actions->add_action()
->icon_action('delete')
->url('phone_operators/delete')
->class('delete_link');
}
// load datasource
$grid->datasource($query);
// bread crumbs
$breadcrumbs = breadcrumbs::add()
->text('Phone operators')
->html();
// main view
$view = new View('main');
$view->title = __('List of all phone operators');
$view->content = new View('show_all');
$view->breadcrumbs = $breadcrumbs;
$view->content->headline = __('List of all phone operators');
$view->content->table = $grid;
$view->render(TRUE);
}
/**
* Adds phone operator
*/
public function add()
{
// check access
if (!$this->acl_check_new('Settings_Controller', 'system'))
{
Controller::error(ACCESS);
}
// gets all countries to dropdown
$countries = ORM::factory('country')->select_list('id', 'country_name');
// form
$form = new Forge('phone_operators/add');
$form->group('Basic information');
$form->dropdown('country_id')
->rules('required')
->label(__('Country') . ':')
->options($countries)
->selected(Settings::get('default_country'));
$form->input('name')
->rules('required');
$form->input('phone_number_length')
->help(__('Without prefixes'))
->rules('required|valid_numeric')
->value(6);
$form->input('prefixes')
->label(__('Phone prefixes') . ':')
->help(__('Prefixes separated by semicolon'))
->callback(array($this, 'valid_prefix'));
$form->checkbox('sms_enabled')
->label(__('SMS messages enabled'))
->help(help::hint('sms_enabled'))
->value('1');
$form->submit('Add');
special::required_forge_style($form, ' *', 'required');
// validate form and save data
if ($form->validate())
{
try
{
// model
$phone_operator_model = new Phone_operator_Model();
$prefix_model = new Phone_operator_prefix_Model();
// start transaction
$phone_operator_model->transaction_start();
// load data
$form_data = $form->as_array();
// save phone operator
$phone_operator_model->country_id = $form_data['country_id'];
$phone_operator_model->name = htmlspecialchars($form_data['name']);
$phone_operator_model->phone_number_length = $form_data['phone_number_length'];
$phone_operator_model->sms_enabled = $form_data['sms_enabled'];
$phone_operator_model->save_throwable();
// save prefixes
$prefixes = array_map('intval', explode(';', $form_data['prefixes']));
foreach ($prefixes as $prefix)
{
if ($prefix > 0)
{
$prefix_model->clear();
$prefix_model->phone_operator_id = $phone_operator_model->id;
$prefix_model->prefix = $prefix;
$prefix_model->save();
}
}
// commit transaction
$phone_operator_model->transaction_commit();
// message
status::success('Phone operator has been successfully added.');
// redirection
url::redirect('phone_operators/show_all');
}
catch (Exception $e)
{
// roolback transaction
$phone_operator_model->transaction_rollback();
// message
status::error('Error - cannot add phone operator');
}
}
// headline
$headline = __('Add new phone operator');
// bread crumbs
$breadcrumbs = breadcrumbs::add()
->link('phone_operators/show_all', 'Phone operators')
->disable_translation()
->text($headline)
->html();
// view
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->breadcrumbs = $breadcrumbs;
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->render(TRUE);
}
/**
* Edits phone operator
*
* @param integer $phone_operator_id
*/
public function edit($phone_operator_id = NULL)
{
// check param
if (!$phone_operator_id || !is_numeric($phone_operator_id))
{
Controller::warning(PARAMETER);
}
// check access
if (!$this->acl_check_delete('Settings_Controller', 'system'))
{
Controller::error(ACCESS);
}
// load model
$phone_operator_model = new Phone_operator_Model($phone_operator_id);
// check exists
if (!$phone_operator_model->id)
{
Controller::error(RECORD);
}
// property for validator
$this->_phone_operator_id = $phone_operator_model->id;
// gets all countries to dropdown
$countries = ORM::factory('country')->select_list('id', 'country_name');
// form
$form = new Forge('phone_operators/edit/' . $phone_operator_id);
$form->group('Basic information');
$form->dropdown('country_id')
->rules('required')
->label(__('Country') . ':')
->options($countries)
->selected($phone_operator_model->country_id);
$form->input('name')
->rules('required')
->value($phone_operator_model->name);
$form->input('phone_number_length')
->help(__('Without prefixes'))
->rules('required|valid_numeric')
->value($phone_operator_model->phone_number_length);
$form->input('prefixes')
->label(__('Phone prefixes') . ':')
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff