Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1124

Přidáno uživatelem Jiří Sviták před asi 13 roky(ů)

mazani starych veci, unit testing, opravy chyb

Zobrazit rozdíly:

freenetis/branches/testing/application/vendors/unit_tester/unit_testing_config.xml
</input>
</values>
</method>
<method name="show" autogenerate="on">
<method name="add" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="preview" autogenerate="on">
<attributes>
<attribute name="message_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="add" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="edit" autogenerate="on">
<attributes>
<attribute name="message_id" default_value="" />
......
</input>
</values>
</method>
<method name="update" autogenerate="on">
<method name="activate" autogenerate="on">
<attributes>
<attribute name="message_id" default_value="" />
</attributes>
......
<input></input>
</values>
</method>
<method name="add" autogenerate="on">
<method name="activate_to_ip_address" autogenerate="on">
<attributes>
<attribute name="ip_address_id" default_value="" />
</attributes>
......
</input>
</values>
</method>
<method name="add_to_member" autogenerate="on">
<method name="activate_to_member" autogenerate="on">
<attributes>
<attribute name="member_id" default_value="" />
</attributes>
......
<method name="set_whitelist" autogenerate="on">
<attributes>
<attribute name="member_id" default_value="" />
<attribute name="whitelist" default_value="" />
</attributes>
<values>
<input>
<param value="" />
<param value="" />
</input>
</values>
</method>
<method name="index" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="test" autogenerate="on">
<attributes>
<attribute name="redir" default_value="0" />
</attributes>
<values>
<input></input>
<input>
<param value="0" />
</input>
</values>
</method>
<method name="test_ip" autogenerate="on">
<attributes>
<attribute name="ip" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="test_member" autogenerate="on">
<attributes>
<attribute name="member_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="info" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="cancel" autogenerate="on">
<method name="show_whitelisted_members" autogenerate="on">
<attributes>
<attribute name="redir" default_value="0" />
</attributes>
<values>
<input></input>
<input>
<param value="0" />
</input>
</values>
</method>
<method name="ipset" autogenerate="on">
<attributes>
<attribute name="type" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="member" autogenerate="on">
<attributes>
<attribute name="member_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="members" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="subnet" autogenerate="on">
<attributes>
<attribute name="subnet_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
</controller>
<controller name="redirection">
<method name="index" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="addip" autogenerate="on">
<attributes>
<attribute name="ip_address_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="addrange" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="addsubnet" autogenerate="on">
<attributes>
<attribute name="subnet_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="adduser" autogenerate="on">
<attributes>
<attribute name="member_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="show_all" autogenerate="on">
<attributes>
<attribute name="limit_results" default_value="20" />
<attribute name="limit_results" default_value="100" />
<attribute name="order_by" default_value="id" />
<attribute name="order_by_direction" default_value="ASC" />
<attribute name="page_word" default_value="" />
......
<values>
<input></input>
<input>
<param value="20" />
<param value="100" />
</input>
<input>
<param value="20" />
<param value="100" />
<param value="id" />
</input>
<input>
<param value="20" />
<param value="100" />
<param value="id" />
<param value="ASC" />
</input>
<input>
<param value="20" />
<param value="100" />
<param value="id" />
<param value="ASC" />
<param value="" />
</input>
<input>
<param value="20" />
<param value="100" />
<param value="id" />
<param value="ASC" />
<param value="" />
......
</input>
</values>
</method>
<method name="show" autogenerate="on">
<attributes>
<attribute name="redirection_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="edit" autogenerate="on">
<attributes>
<attribute name="redirection_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="delete" autogenerate="on">
<attributes>
<attribute name="redirection_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="delete_list" autogenerate="on">
<attributes>
<attribute name="limit_results" default_value="20" />
<attribute name="ip_address" default_value="0" />
<attribute name="admin" default_value="0" />
<attribute name="duration" default_value="0" />
<attribute name="destination" default_value="0" />
</attributes>
<values>
<input></input>
<input>
<param value="20" />
</input>
<input>
<param value="20" />
<param value="0" />
</input>
<input>
<param value="20" />
<param value="0" />
<param value="0" />
</input>
<input>
<param value="20" />
<param value="0" />
<param value="0" />
<param value="0" />
</input>
<input>
<param value="20" />
<param value="0" />
<param value="0" />
<param value="0" />
<param value="0" />
</input>
</values>
</method>
<method name="callback_valid_ip" autogenerate="on">
<attributes>
<attribute name="input" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="callback_valid_ip2" autogenerate="on">
<attributes>
<attribute name="input" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="callback_valid_mask" autogenerate="on">
<attributes>
<attribute name="input" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="administration" autogenerate="on">
<attributes>
<attribute name="limit_results" default_value="20" />
<attribute name="order_by" default_value="id" />
<attribute name="order_by_direction" default_value="ASC" />
<attribute name="page_word" default_value="" />
<attribute name="page" default_value="1" />
</attributes>
<values>
<input></input>
<input>
<param value="20" />
</input>
<input>
<param value="20" />
<param value="id" />
</input>
<input>
<param value="20" />
<param value="id" />
<param value="ASC" />
</input>
<input>
<param value="20" />
<param value="id" />
<param value="ASC" />
<param value="" />
</input>
<input>
<param value="20" />
<param value="id" />
<param value="ASC" />
<param value="" />
<param value="1" />
</input>
</values>
</method>
<method name="add_message" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="show_message" autogenerate="on">
<attributes>
<attribute name="message_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="edit_message" autogenerate="on">
<attributes>
<attribute name="message_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="delete_message" autogenerate="on">
<attributes>
<attribute name="message_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="activate_message" autogenerate="on">
<attributes>
<attribute name="message_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="autoadmins" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="addadmin" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="deleteadmin" autogenerate="on">
<attributes>
<attribute name="admin_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="log" autogenerate="on">
<attributes>
<attribute name="limit_results" default_value="50" />
<attribute name="order_by" default_value="id" />
<attribute name="order_by_direction" default_value="DESC" />
<attribute name="page_word" default_value="" />
<attribute name="page" default_value="1" />
</attributes>
<values>
<input></input>
<input>
<param value="50" />
</input>
<input>
<param value="50" />
<param value="id" />
</input>
<input>
<param value="50" />
<param value="id" />
<param value="DESC" />
</input>
<input>
<param value="50" />
<param value="id" />
<param value="DESC" />
<param value="" />
</input>
<input>
<param value="50" />
<param value="id" />
<param value="DESC" />
<param value="" />
<param value="1" />
</input>
</values>
</method>
<method name="cron_hourly" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="cron_daily" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="cron_monthly" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</controller>
<controller name="registration">
<method name="index" autogenerate="on">
......
<input></input>
</values>
</method>
<method name="whitelist" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="redirected_ranges" autogenerate="on">
<attributes></attributes>
<values>
......
<input></input>
</values>
</method>
<method name="self_cancelable_ip_addresses" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="synchronized" autogenerate="on">
<attributes>
<attribute name="synchronized" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="synchronized" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="already_seen" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="redirect_content" autogenerate="on">
<attributes>
<attribute name="ip_address" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="callback" autogenerate="on">
<attributes>
<attribute name="user" default_value="" />
......
</values>
</method>
</model>
<model name="account_balance"></model>
<model name="acl">
<method name="get_acl" autogenerate="on">
<attributes></attributes>
......
</input>
</values>
</method>
<method name="get_whitelist_info_of_member" autogenerate="off">
<attributes>
<attribute name="member_id" default_value=""/>
</attributes>
<values>
<input>
<param value=""/>
</input>
<input>
<param value="1"/>
</input>
<input>
<param value="sef'š$@"/>
</input>
</values>
</method>
<method name="get_ip_addresses_of_device" autogenerate="off">
<attributes>
<attribute name="device_id" default_value=""/>
......
</input>
</values>
</method>
<method name="find_ip_address" autogenerate="off">
<method name="get_ip_addresses_of_almostdebtors" autogenerate="on">
<attributes>
<attribute name="ip_address" default_value=""/>
<attribute name="payment_notice_boundary" default_value="" />
<attribute name="debtor_boundary" default_value="" />
</attributes>
<values>
<input>
<param value=""/>
<param value="" />
<param value="" />
</input>
<input>
<param value="192.168.1.2"/>
</input>
<input>
<param value="sef'š$@"/>
</input>
</values>
</method>
<method name="find_redirect_by_ip_address" autogenerate="off">
<method name="get_ips_and_redirections_of_member" autogenerate="on">
<attributes>
<attribute name="ip_address" default_value=""/>
<attribute name="member_id" default_value="" />
</attributes>
<values>
<input>
<param value=""/>
<param value="" />
</input>
<input>
<param value="192.168.1.2"/>
</input>
<input>
<param value="sef'š$@"/>
</input>
</values>
</method>
<method name="get_all_ip_addresses_with_owner" autogenerate="off">
......
</input>
</values>
</method>
<method name="clean_temporary_whitelist" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</model>
<model name="ip_addresses_traffic">
<method name="count_all_ip_addresses_traffics" autogenerate="on">
......
</input>
</values>
</method>
<method name="update_payment_notice" autogenerate="off">
<attributes>
<attribute name="low_amount" default_value=""/>
<attribute name="high_amount" default_value=""/>
</attributes>
<values>
<input>
<param value=""/>
<param value=""/>
</input>
<input>
<param value="1000"/>
<param value="10000"/>
</input>
<input>
<param value="se'sef"/>
<param value="sef'se"/>
</input>
</values>
</method>
<method name="update_debtors" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="update_membership_interrupts" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="update_optional_message" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="cancel_redirection" autogenerate="off">
<attributes>
<attribute name="number" default_value=""/>
</attributes>
<values>
<input>
<param value=""/>
</input>
<input>
<param value="1"/>
</input>
<input>
<param value="1'+1"/>
</input>
</values>
</method>
<method name="update_lock_status" autogenerate="on">
<attributes></attributes>
<values>
......
</input>
</values>
</method>
<method name="get_whitelisted_members" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="count_whitelisted_members" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</model>
<model name="members_domicile"></model>
<model name="members_fee">
......
</method>
</model>
<model name="messages_ip_addresses">
<method name="get_redirections_of_member" autogenerate="off">
<attributes>
<attribute name="member_id" default_value=""/>
</attributes>
<values>
<input>
<param value=""/>
</input>
<input>
<param value="1"/>
</input>
<input>
<param value="1'+1"/>
</input>
</values>
</method>
<method name="get_redirections_of_ip_address" autogenerate="off">
<attributes>
<attribute name="ip_address_id" default_value=""/>
......
</input>
</values>
</method></model>
<model name="redirection">
<method name="get_all_redirections" autogenerate="on">
<attributes>
<attribute name="limit_from" default_value="0" />
<attribute name="limit_results" default_value="20" />
<attribute name="order_by" default_value="id" />
<attribute name="order_by_direction" default_value="ASC" />
<attribute name="user_id" default_value="" />
<attribute name="filters" default_value="array()" />
</attributes>
<values>
<input></input>
<input>
<param value="0" />
</input>
<input>
<param value="0" />
<param value="20" />
</input>
<input>
<param value="0" />
<param value="20" />
<param value="id" />
</input>
<input>
<param value="0" />
<param value="20" />
<param value="id" />
<param value="ASC" />
</input>
<input>
<param value="0" />
<param value="20" />
<param value="id" />
<param value="ASC" />
<param value="" />
</input>
<input>
<param value="0" />
<param value="20" />
<param value="id" />
<param value="ASC" />
<param value="" />
<param value="array()" />
</input>
</values>
</method>
<method name="get_redirection" autogenerate="on">
<attributes>
<attribute name="redirection_id" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="delete_redirections" autogenerate="off">
<attributes>
<attribute name="total_redirections" default_value=""/>
<attribute name="limit_results" default_value="20"/>
<attribute name="filters" default_value="array()"/>
<attribute name="login" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="count_all_records" autogenerate="off">
<attributes>
<attribute name="filter_values" default_value="array()"/>
</attributes>
<values>
<input>
<param value=""/>
</input>
<input>
<param value="array()"/>
</input>
</values>
</method>
<method name="count_deleted_records" autogenerate="on">
<attributes>
<attribute name="filters" default_value="array()" />
</attributes>
<values>
<input></input>
<input>
<param value="array()" />
</input>
</values>
</method>
<method name="get_all_logs" autogenerate="on">
<attributes>
<attribute name="limit_from" default_value="0" />
<attribute name="limit_results" default_value="50" />
<attribute name="order_by" default_value="id" />
<attribute name="order_by_direction" default_value="DESC" />
<attribute name="user_id" default_value="" />
<attribute name="filters" default_value="array()" />
</attributes>
<values>
<input></input>
<input>
<param value="0" />
</input>
<input>
<param value="0" />
<param value="50" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
<param value="DESC" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
<param value="DESC" />
<param value="" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
<param value="DESC" />
<param value="" />
<param value="array()" />
</input>
</values>
</method>
<method name="count_all_logs" autogenerate="on">
<attributes>
<attribute name="filter_values" default_value="array()" />
</attributes>
<values>
<input></input>
<input>
<param value="array()" />
</input>
</values>
</method>
<method name="count_member_ips" autogenerate="on">
<attributes>
<attribute name="user_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="select_member_ips" autogenerate="on">
<attributes>
<attribute name="user_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="select_hourly" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="select_daily" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="select_monthly" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</model>
<model name="redirection_duration">
<method name="get_values" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="get_select_list" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</model>
<model name="redirection_log">
<method name="get_all_logs" autogenerate="on">
<attributes>
<attribute name="limit_from" default_value="0" />
<attribute name="limit_results" default_value="50" />
<attribute name="order_by" default_value="id" />
<attribute name="order_by_direction" default_value="DESC" />
<attribute name="user_id" default_value="" />
<attribute name="filters" default_value="array()" />
</attributes>
<values>
<input></input>
<input>
<param value="0" />
</input>
<input>
<param value="0" />
<param value="50" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
<param value="DESC" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
<param value="DESC" />
<param value="" />
</input>
<input>
<param value="0" />
<param value="50" />
<param value="id" />
<param value="DESC" />
<param value="" />
<param value="array()" />
</input>
</values>
</method>
<method name="count_all_logs" autogenerate="on">
<attributes>
<attribute name="filter_values" default_value="array()" />
</attributes>
<values>
<input></input>
<input>
<param value="array()" />
</input>
</values>
</method>
</model>
<model name="search">
<method name="member_name" autogenerate="off">
<attributes>
......
<values>
</values>
</method>
<method name="redirection_preview_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="cancel_redirection_of_member" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
......
<values>
</values>
</method>
<method name="whitelisted_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="message_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="message_type_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="message_activate_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="message_delete_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="message_preview_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="phone_invoice_private_field_locked" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
freenetis/branches/testing/application/models/redirection_log.php
<?php
/**
* @author Lubomir Buben
* @todo WAITING TO BE REMOVED!
*/
class Redirection_log_Model extends ORM {
//protected $belongs_to = array('user','confirmed_by' => 'user');
public $arr_sql = array('id' => 'l.id', 'ip_address' => 'l.ip_address', 'action' => 'l.action', 'admin'=>'l.admin', 'time'=>'l.time');
public function get_all_logs($limit_from = 0, $limit_results = 50, $order_by = 'id', $order_by_direction = 'DESC', $user_id = null, $filters = array())
{
if (in_array($order_by, $this->arr_sql))
$order_by = $this->arr_sql[$order_by];
$where = '';
if(count($filters) > 0)
$where .= 'WHERE ';
foreach($filters as $key => $value)
{
if($key!='submit')
{
if($where!='WHERE ')
$where .= ' AND ';
//$where .= ($key!='device_type' AND $key!='member_id') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
$where .= $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci';
}
}
return $this->db->query("SELECT
l.id, l.ip_address_id, l.admin, l.time, ip.ip_address,
IFNULL(fact.translated_term, eact.value) AS action
FROM redirection_logs l
LEFT JOIN ip_addresses ip ON l.ip_address_id = ip.id
LEFT JOIN enum_types eact on l.action = eact.id
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::get('lang')."') fact ON eact.value = fact.original_term
$where
ORDER BY $order_by $order_by_direction
LIMIT $limit_from, $limit_results"
);
}
public function count_all_logs($filter_values = array())
{
$where = '';
if (count($filter_values) > 0)
$where .= 'WHERE ';
foreach($filter_values as $key => $value)
{
if($key!='submit')
{
if($where!='WHERE ')
$where .= ' AND ';
//$where .= ($key!='action') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
$where .= $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci';
}
}
$redirections = $this->db->query("SELECT
l.id, l.action
FROM redirection_logs l
$where"
);
return count($redirections);
}
}
?>
freenetis/branches/testing/application/models/redirection_duration.php
<?php
/**
* @author Lubomir Buben
* @todo WAITING TO BE REMOVED!
*/
class Redirection_duration_Model extends ORM {
/**
* @author Lubomir Buben
* Function gets all duration types
* @return unknown_type
*/
public function get_values(){
return $this->db->query("SELECT
rdur.id, rdur.duration, rdur.translation
FROM redirection_durations rdur"
);
}
/**
* @author Lubomir Buben
* Function gets duration types suitable for select list
* @return unknown_type
*/
public function get_select_list(){
return $this->db->query("SELECT
rdur.id, rdur.duration, rdur.translation
FROM redirection_durations rdur
WHERE id>3"
);
}
}
?>
freenetis/branches/testing/application/models/account_balance.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is release 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/
*
*/
/**
* @package Model
*/
class Account_balance_Model extends ORM
{
protected $belongs_to = array('member');
}
freenetis/branches/testing/application/models/redirection.php
<?php
/**
* @author Lubomir Buben
* @todo WAITING TO BE REMOVED!
*/
class Redirection_Model extends ORM {
//protected $belongs_to = array('user','confirmed_by' => 'user');
public $arr_sql = array('id' => 'r.id', 'ip_address' => 'ip.ip_address', 'duration' => 'r.duration', 'destination' => 'r.destination', 'admin'=>'r.admin', 'message' => 'r.message', 'note' => 'r.note', 'locksign' => 'r.locksign');
public function get_all_redirections($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'ASC', $user_id = null, $filters = array())
{
if (in_array($order_by, $this->arr_sql))
$order_by = $this->arr_sql[$order_by];
$where = '';
if(count($filters) > 0)
$where .= 'WHERE ';
foreach($filters as $key => $value)
{
if($key!='submit')
{
if($where!='WHERE ')
$where .= ' AND ';
$where .= ($key!='duration' AND $key!='member_id') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
}
}
return $this->db->query("SELECT
r.id, r.duration, r.destination, r.ip_address_id, ip.ip_address,
rdur.translation AS dur,
IFNULL(fdest.translated_term, edest.value) AS dest,
IF(strcmp(r.message,'null'),'●','-') AS message,
IF(strcmp(r.note,'null'),'●','-') AS note,
IF(strcmp(r.locksign,0),'●','-') AS locksign,
r.admin, r.selfaccess
FROM redirections r
LEFT JOIN ip_addresses ip ON r.ip_address_id = ip.id
LEFT JOIN enum_types edest on r.destination = edest.id
LEFT JOIN redirection_durations rdur on r.duration = rdur.id
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::get('lang')."') fdest ON edest.value = fdest.original_term
$where
ORDER BY $order_by $order_by_direction
LIMIT $limit_from, $limit_results"
);
}
public function get_redirection($redirection_id){
return $this->db->query("SELECT
r.id, r.duration, r. destination, r.ip_address_id, ip.ip_address,
rdur.translation AS dur,
IFNULL(fdest.translated_term, edest.value) AS dest,
r.message, r.note, r.locksign, r.admin, r.selfaccess
FROM redirections r
LEFT JOIN ip_addresses ip ON r.ip_address_id = ip.id
LEFT JOIN enum_types edest ON r.destination = edest.id
LEFT JOIN redirection_durations rdur on r.duration = rdur.id
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::get('lang')."') fdest ON edest.value = fdest.original_term
WHERE
r.id = ?
", $redirection_id
);
}
public function delete_redirections($total_redirections, $limit_results = 20, $filters=array(), $login = null){
$where = 'WHERE ';
$ip=$filters[0];
$admin=$filters[1];
$dur=$filters[2];
$dest=$filters[3];
$and = 0;
if($ip!=0){
$where .= 'ip_address_id LIKE \'%'.$ip.'%\' ';
$and = 1;
}
if($admin!=0){
if ($and) $where.= 'AND ';
$where .= 'admin = \''.$admin.'\'';
$and = 1;
}
if($dur!=0){
if ($and) $where.= 'AND ';
$where .= 'duration = \''.$dur.'\'';
$and = 1;
}
if($dest!=0){
if ($and) $where.= 'AND ';
$where .= 'destination = \''.$dest.'\'';
}
if($total_redirections<$limit_results)
$limit = $total_redirections;
else
$limit = $limit_results;
$result = $this->db->query("SELECT id,ip_address_id,admin,locksign FROM redirections $where LIMIT 0, $limit");
foreach ($result as $row){
if(!($row->locksign && ($row->admin != $login))){
redirection_log::log($login, 78, $row->ip_address_id);
$this->db->query("DELETE FROM redirections WHERE id=$row->id");
}
}
return;
}
public function count_all_records($filter_values = array()){
$where = '';
if (count($filter_values) > 0)
$where .= 'WHERE ';
foreach($filter_values as $key => $value){
if($key!='submit'){
if($where!='WHERE ')
$where .= ' AND ';
//$where .= ($key!='device_type' AND $key!='member_id') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
$where .= $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci';
}
}
$redirections = $this->db->query("SELECT
r.id
FROM redirections r
LEFT JOIN ip_addresses ip ON r.ip_address_id = ip.id
$where"
);
return count($redirections);
}
public function count_deleted_records($filters=array()){
$where = 'WHERE ';
$ip=$filters[0];
$admin=$filters[1];
$dur=$filters[2];
$dest=$filters[3];
$and = 0;
if($ip!=0){
$where .= 'ip_address_id LIKE \'%'.$ip.'%\' ';
$and = 1;
}
if($admin!=0){
if ($and) $where.= 'AND ';
$where .= 'admin = \''.$admin.'\'';
$and = 1;
}
if($dur!=0){
if ($and) $where.= 'AND ';
$where .= 'duration = \''.$dur.'\'';
$and = 1;
}
if($dest!=0){
if ($and) $where.= 'AND ';
$where .= 'destination = \''.$dest.'\'';
}
$redirections = $this->db->query("SELECT id FROM redirections $where"
);
return count($redirections);
}
public function get_all_logs($limit_from = 0, $limit_results = 50, $order_by = 'id', $order_by_direction = 'DESC', $user_id = null, $filters = array()){
if (in_array($order_by, $this->arr_sql))
$order_by = $this->arr_sql[$order_by];
$where = '';
if(count($filters) > 0)
$where .= 'WHERE ';
foreach($filters as $key => $value)
{
if($key!='submit')
{
if($where!='WHERE ')
$where .= ' AND ';
$where .= ($key!='duration' AND $key!='member_id') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
}
}
return $this->db->query("SELECT
l.id, l.admin, l.ip_address_id, l.action
FROM redirection_logs l
$where
ORDER BY $order_by $order_by_direction
LIMIT $limit_from, $limit_results"
);
}
public function count_all_logs($filter_values = array()){
$where = '';
if (count($filter_values) > 0)
$where .= 'WHERE ';
foreach($filter_values as $key => $value)
{
if($key!='submit')
{
if($where!='WHERE ')
$where .= ' AND ';
//$where .= ($key!='device_type' AND $key!='member_id') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
$where .= $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci';
}
}
$redirections = $this->db->query("SELECT
l.id
FROM redirection_logs l
$where"
);
return count($redirections);
}
public function count_member_ips($user_id = null){
$ip_addresses = $this->db->query("SELECT
ip.id
FROM users u
LEFT JOIN devices d ON u.id = d.user_id
LEFT JOIN ifaces i ON d.id = i.device_id
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
WHERE u.member_id = $user_id
");
return count($ip_addresses);
}
public function select_member_ips($user_id = null){
$ip_addresses = $this->db->query("SELECT
ip.id
FROM users u
LEFT JOIN devices d ON u.id = d.user_id
LEFT JOIN ifaces i ON d.id = i.device_id
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
WHERE u.member_id = $user_id
");
return $ip_addresses;
}
/**
* @author Lubomir Buben
* Function being called every hour by cron, maintaining redirection records
* @return unknown_type
*/
public function select_hourly(){
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff