Code Monkey home page Code Monkey logo

kalkun's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kalkun's Issues

credit system and interface

hey,

is it possible to edit Kalkun's interface?

also, i would like to setup a credit system. Can this be done?

if these can be done, could u tell me how to.

thank you

SMS validity

Hi!

Where can i change the default value for the sms-validity shown in the "compose"-window?

greez

no inbox message

I try this in 3 system (win, debian, ubuntu) . I use kalkun 0.3 and gammu-smsd 1.28 (1.29).
Messages are downloaded by phone in mysql db but they are not show in inbox folder .
Inbox count is correct. I try to move message in a custom folder and happends same thing : no message show.

I try to use old version kalkun and i found something . Using kalkun 0.2 on same database I fix the problem and in the db table user_inbox compare data of message (early empty).

I think there is something that does not fill the table user_inbox

I do my test with apache2.2.11 php5.3 mysql 5.x

Bye

Multiple modems; JSON API

I wants to connect into system a few phones,
did kalkun randomly choose which phone use to send a message?

On each number i have SMS package i want use it evenly.
I have some days 3000 SMS / hour i must use 3-4 GSM modems ( ~3-5 sec per message )

https://github.com/back2arie/Kalkun/wiki/Multiple-Modem
round robin. not yet ready :/

Did something like this work? What strategy name should use ?
if(rand(0,1)===1)
{
$config['multiple_modem'][0]['id'] = 'sierra';
else
{
$config['multiple_modem'][1]['id'] = 'fasttrack';
}

Order By Sent will be cool. Select MODEM in send form will be great! ( with additional option random )

  1. Is there possibility to add in future versions JSON api?
    (SendSMS, GetStatusById, ReadSMS)
    Now i see pure CURL send SMS, but JSON will be nice.
    I need confirmation after SMS was send.
    for example
    00:01 -> send SMS -> response {status:200, id: 17}
    wait 1 minute
    01:01
    -> get SMS {id:17} -> response -> {status:500, msg:'Some Error'} OR response -> {status:200, msg:'Delivered'}

German translation

Hey guys!

I would like to help you translating kalkun to german.

Is this possible? Can you please tell me how to do it?

Just editing "application / language / english / kalkun_lang.php" and send it to back2arie?

I guess there are still some hardcoded language specific values in the source code ...

best regards

Mark as Unread

Hi there,

I was wondering if anyone else had the need to have a mark as unread button. If so where to from here? Any suggestions?

Cheers,

Nash

Round Robin with single messages

Multiple modem round robin works fine only for sending SMS for groups.
When sending multiple sms but one by one, first modem is always used.

I change code, and now msg are send by modem with lowest send sms.

Sent count in DB is updated after message was received by smsd ( fast adding always select the same phone, but in end sms count is similar )

Also i have code to forceful select modem.

Solution:

line 804 controllers\messages.php

case 'round_robin':
                if(isset($_POST['selectModem']) && $_POST['selectModem'] !== false && $_POST['selectModem'] !== '')
                {
                    $id = array_search($_POST['selectModem'], $modem_list);
                    if($id !== false)
                        {
                            return $modem_list[$id];
                        }
                        else
                        {
                            return $modem_list[0];
                        }
                }else
                {
                    $selected_modem = $this->Message_model->get_free_modem();
                }
            break;

line 302 /models/message_model.php

 * Get Free Modem
     *
     * Get Modem ID with lowest send SMS count
     *
     * @access  public           
     * @param   mixed $options 
     * Option: Values
     * --------------
     * 
     * @return  string  
     */ 
    function get_free_modem()
    {

                $this->db->from('phones');
                $this->db->select('ID');
                $this->db->where('Send', 'yes');

                $this->db->order_by('Sent', 'ASC');
                $this->db->limit('1');
                $modemId = $this->db->get();

    return $modemId->row('ID');

    }

ps. in upgrade SQL some ";" are missing when manually executing sql file

Spanish traslation

Hello everyone!,

I would like to send you a spanish traslation of kalkun. To this work, only need to do is:

  1. Make a directory called "spanish" in "application/language/" and create two files called "index.html" and "kalkun_lang.php".
  2. Paste the content below inside the files (separately of course).
  3. Edit the file called "general.php " in "application/views/main/settings/" and replace the code:

$lang = array( 'bahasa' => 'Bahasa Indonesia',
'czech' => 'Česky',
'english' => 'English',
'italian' => 'Italian',
'portuguese' => 'Portuguese',
'russian' => 'Russian',
'turkish' => 'Turkish',
);

to this:

$lang = array( 'bahasa' => 'Bahasa Indonesia',
'czech' => 'Česky',
'english' => 'English',
'italian' => 'Italian',
'portuguese' => 'Portuguese',
'russian' => 'Russian',
'spanish' => 'Español',
'turkish' => 'Turkish',
);

And that's it!.

-- INI - file kalkun_lang.php

contacto(s)?"; $lang['kalkun_valid_example'] = "Ejemplo válido"; // Message $lang['kalkun_message'] = "Mensaje"; $lang['kalkun_send'] = "Enviar"; $lang['kalkun_send_to'] = "Enviar a"; $lang['kalkun_reply'] = "Responder"; $lang['kalkun_reply_to'] = "Responder a"; $lang['kalkun_reply_title'] = "Click para responde este mensaje"; $lang['kalkun_quick_reply'] = "Respuesta rápida"; $lang['kalkun_quick_reply_title'] = "Click para responder este mensaje en forma rápida"; $lang['kalkun_forward'] = "Reenviar"; $lang['kalkun_forward_to'] = "Reenviar a"; $lang['kalkun_forward_title'] = "Click para reenviar este mensaje"; $lang['kalkun_move_to'] = "Mover a"; $lang['kalkun_select_folder'] = "Seleccione directorio"; $lang['kalkun_delete'] = "Eliminar"; $lang['kalkun_delete_message_title'] = "Click para eliminar este mensaje"; $lang['kalkun_delete_folder'] = "Eliminar este directorio"; $lang['kalkun_delete_folder_title'] = "Click para eliminar este directorio"; $lang['kalkun_permanently'] = "Permanentemente"; $lang['kalkun_recover'] = "Recuperar"; $lang['kalkun_send_date'] = "Fecha de envio"; $lang['kalkun_sms_mode'] = "modo SMS"; $lang['kalkun_now'] = "Ahora"; $lang['kalkun_now_note'] = "El mensaje será enviado inmediatamente"; $lang['kalkun_at_date_time'] = "A una fecha y ahora"; $lang['kalkun_after_a_delay'] = "Después de un retraso"; $lang['kalkun_person'] = "Persona"; $lang['kalkun_group'] = "Grupo"; $lang['kalkun_input_manually'] = "Entrada de forma manual"; $lang['kalkun_show_hide_option'] = "Mostrar/ocultar opción"; $lang['kalkun_add_folder'] = "Agregar directorio"; $lang['kalkun_folder_name'] = "Nombre del directorio"; $lang['kalkun_cancel'] = "Cancelar"; $lang['kalkun_save'] = "Guardar"; $lang['kalkun_rename'] = "Renombrar"; $lang['kalkun_rename_folder'] = "Renombrar directorio"; $lang['kalkun_rename_folder_title'] = "Click para renombrar este directorio"; $lang['kalkun_delete_folder_confirmation_header'] = "Confirmación para eliminar directorio"; $lang['kalkun_delete_folder_confirmation'] = "Este directorio y todos sus mensajes serán eliminados permanentemente y no podrán ser recuperados. ¿Está seguro?"; $lang['kalkun_no_message'] = "No hay mensajes en tú "; $lang['kalkun_no_message_in_folder'] = "No hay mensajes en este directorio"; $lang['kalkun_delete_all_confirmation_header'] = "Eliminar todo"; $lang['kalkun_delete_all_confirmation'] = "¿Está seguro?, esto afectará todas las conversaciones."; $lang['kalkun_select_all'] = "Seleccionar todo"; $lang['kalkun_select_all_title'] = "Click para seleccionar todos los mensajes"; $lang['kalkun_clear_all'] = "Limpiar todo"; $lang['kalkun_clear_all_title'] = "Click para limpiar todos los mensajes seleccionados"; $lang['kalkun_refresh'] = "Refrescar"; $lang['kalkun_global_delete_title'] = "Click para eliminar todos los mensajes seleccionados"; $lang['kalkun_report_spam'] = "Reportar Publicidad no deseada"; $lang['kalkun_ham'] = "No es publicidad no deseada"; $lang['kalkun_first'] = "Primero"; $lang['kalkun_last'] = "Último"; $lang['kalkun_smsc'] = "SMSC"; $lang['kalkun_sms_part'] = "Parte"; $lang['kalkun_sms_part_suffix'] = "parte de mensajes"; $lang['kalkun_sms_validity'] = "Validez"; $lang['kalkun_sms_type'] = "Tipo SMS"; $lang['kalkun_sms_type_normal'] = "Normal"; $lang['kalkun_sms_type_flash'] = "Rápido"; $lang['kalkun_sms_type_wap'] = "Empujar enlace WAP"; $lang['kalkun_sms_type_wap_url'] = "URL"; $lang['kalkun_sms_ads_active'] = "Anuncios activos"; $lang['kalkun_sms_ndnc_check'] = "Comprobar NDNC"; $lang['kalkun_insert'] = "Insertar"; $lang['kalkun_canned'] = "Respuestas prediseñadas"; $lang['kalkun_canned_empty'] = "Al parecer no existen respuestas prediseñadas por el momento. ¿Quiere guardar su primera respuesta prediseñada ahora?"; // Others $lang['kalkun_compose_amount'] = "Cantidad"; $lang['kalkun_compose_send_as_flash'] = "Enviar como SMS rápido"; $lang['kalkun_compose_send_as_unicode'] = "Enviar como Unicode"; $lang['kalkun_compose_times'] = "veces"; $lang['kalkun_compose_hour'] = "Hora"; $lang['kalkun_compose_minutes'] = "Minutos"; $lang['kalkun_no_message_search'] = "Oops!, su consulta no concide con ningún registro"; $lang['tni_see_conversation'] = "Ver la conversación"; // Setting $lang['kalkun_setting_passwd_current'] = "Clave actual"; $lang['kalkun_setting_passwd_forgot'] = "¿Olvidó su clave?"; $lang['kalkun_setting_passwd_new'] = "Nueva clave"; $lang['kalkun_setting_passwd_valid_rule'] = "Debe tener al menos 6 caracteres de largo"; $lang['kalkun_setting_passwd_current_enter'] = "Ingrese su clave actual"; $lang['kalkun_setting_passwd_new_enter'] = "Ingrese su nueva clave"; $lang['kalkun_level_admin'] = "Administrador"; $lang['kalkun_level_user'] = "Usuario"; // SMS Content/Member $lang['kalkun_sms_member'] = "Miembro"; $lang['kalkun_sms_total_member'] = "Total de miembros"; $lang['kalkun_sms_no_member'] = "No hay miembros registrados por el momento"; // tni contribution $lang['tni_contact_add'] = "Agregar contacto"; $lang['tni_send_message'] = "Enviar mensaje"; $lang['tni_sending_message'] = "Enviando"; $lang['tni_folders_sms'] = "Directorios SMS"; $lang['tni_name_search'] = "Insertar nombre desde la lista de contactos"; $lang['tni_group_del_title'] = "Confirmación para eliminar Grupo(s)"; $lang['tni_group_delete'] = "¿Eliminar Grupo(s)?
Todos los contactos de este grupo serán eliminados."; $lang['tni_group_del_button'] = "Sí, eliminar grupo(s) seleccionado(s)"; $lang['tni_group_add'] = "Crear Grupo"; $lang['tni_group_name'] = "Nombre del Grupo"; $lang['tni_group_show_contacts'] = "Mostrar los contactos de este grupo"; $lang['tni_group_field_num'] = "Número de campos"; $lang['tni_group_field_string'] = "Valores de campos"; $lang['tni_group_field_title'] = "Valores del campo Grupo SMS"; $lang['tni_groups'] = "Grupos"; $lang['tni_groups_manage'] = "Administrar Grupos"; $lang['tni_group_manage'] = "Administrar Grupo"; $lang['tni_groups_edit_contacts'] = "Administrar contactos"; $lang['tni_group_select'] = "Seleccionar grupo"; $lang['tni_msglist_trash_empty'] = "No hay mensajes en el basurero"; $lang['tni_msg_no_conv_selected'] = "No hay elementos seleccionados"; $lang['tni_pbk_no_contact_selected'] = "No hay contacto seleccionado"; $lang['tni_compose_sms'] = "Escribir SMS"; $lang['tni_contacts'] = "Contactos"; $lang['tni_settings_saved'] = "Tú configuración ha sido guardada..."; $lang['tni_settings_wrong_pword'] = "Haz ingresado una clave incorrecta"; $lang['tni_settings_uname_exists'] = "El nombre de usuario ya existe"; $lang['tni_settings_unamepass_wrong'] = "Nombre de usuario o clave incorrecto(s)"; $lang['tni_back_to'] = "Volver a"; $lang['tni_show_details'] = "Mostrar detalles"; $lang['tni_hide_details'] = "Ocultar detalles"; $lang['tni_search_contacts'] = "Buscar contactos"; $lang['tni_search_sms'] = "Buscar mensajes"; $lang['tni_edit'] = "Editar"; $lang['tni_form_fields_required'] = "Todos los campos son requeridos"; $lang['tni_contact_name'] = "Nombre"; $lang['tni_contact_phonenumber'] = "Número telefónico"; $lang['tni_compose_msgto_outbox'] = "Tú mensaje ha sido movido a la bandeja de salida
y está listo para la entrega."; $lang['tni_email_address'] = "ID del correo"; $lang['tni_email_forward'] = "Habilitar el reenvío de correo"; $lang['tni_compose_searching'] = "Buscando..."; $lang['tni_outbox_sent_time'] = "Menos de un minuto atrás"; $lang['tni_time_remaining'] = "restantes"; $lang['tni_pbk_edit_contact'] = "Editar Contacto"; $lang['tni_pbk_contact_edited'] = "El contacto ha sido editado"; $lang['tni_pbk_contact_added'] = "El contacto ha sido agregado"; $lang['tni_contact_not_found'] = "El usuario no encontrado"; $lang['tni_contact_search_empty'] = "Usuarios está vacio"; $lang['tni_user_add'] = "Agregar/Editar Usuarios"; $lang['tni_user_addp'] = "Agregar usuarios"; $lang['tni_user_edit'] = "Editar/Agregar usuario"; $lang['tni_user_word'] = "Usuario"; $lang['tni_user_wordp'] = "Usuarios"; $lang['tni_user_confirm_delete'] = "Confirmación para eliminar usuarios"; $lang['tni_user_delete_body'] = "¿Desea eliminar el usuario?
Este incluye todos los registros de este usuario (mensaje y contactos)."; $lang['tni_user_not_found'] = "Usuario no encontrado"; $lang['tni_user_search_empty'] = "Usuarios está vacía"; $lang['tni_user_person_name'] = "Nombre"; $lang['tni_user_username'] = "Usuario"; $lang['tni_user_password'] = "Clave"; $lang['tni_user_search'] = "Buscar usuario"; $lang['tni_user_conf_password'] = "Confirmar clave"; $lang['tni_user_updated'] = "El usuario ha sido actualizado"; $lang['tni_user_phone_number'] = "Número telefónico de acceso"; $lang['tni_action_not_allowed'] = "La acción no está permitida"; $lang['tni_error_enter_name'] = "Ingresar nombre"; $lang['tni_error_enter_password'] = "Ingresar clave"; $lang['tni_error_password_nomatch'] = "Las claves no coinciden"; $lang['tni_error_toshort'] = "Demasiado corto"; $lang['tni_error_nouser_sel'] = "NO hay usuario seleccionado"; $lang['tni_level'] = "Nivel"; $lang['tni_delete_folder'] = "Eliminar este directorio"; $lang['tni_loading'] = "Cargando"; $lang['tni_status'] = "Estado"; $lang['tni_connected'] = "Conectado"; $lang['tni_disconnected'] = "Desconectado"; $lang['tni_user_enter_login'] = "Por favor ingrese usuario y clave"; $lang['tni_group_no_group'] = "No se han detectado grupos, agregue uno primero"; $lang['tni_group_no_selected'] = "NO hay grupos seleccionados"; $lang['tni_original_msg_from'] = "De"; $lang['tni_compose_enter_dest'] = "Por favor ingrese destino"; $lang['tni_compose_enter_msg'] = "Por favor ingrese mensaje"; $lang['tni_compose_enter_sendate'] = "Por favor ingrese fecha de envío"; $lang['tni_compose_click_calendar'] = "Click en calendario"; $lang['tni_archived_by'] = "Mostrar por"; $lang['tni_received'] = "Recibido"; $lang['tni_from'] = "Desde"; $lang['tni_to'] = "A"; $lang['tni_inserted'] = "Insertado"; $lang['tni_date'] = "Fecha"; $lang['tni_msg_stat_fail'] = "No se pudo enviar"; $lang['tni_msg_stat_oknr'] = "Envío OK - Sin informes"; $lang['tni_msg_stat_okwr'] = "Envío OK - Esperando informe"; $lang['tni_msg_stat_deliv'] = "Entregado"; $lang['tni_msg_stat_pend'] = "Pendiente"; $lang['tni_msg_stat_unknown'] = "Desconocido"; $lang['tni_set_conv_order_old'] = "Antiguos primero"; $lang['tni_set_conv_order_new'] = "Recientes primero"; $lang['tni_set_conv_sort'] = "Orden de la conversación"; $lang['tni_set_data_pp'] = "Información por página"; $lang['tni_set_data_pp_hint'] = "Se utilizará para la paginación en el mensaje y la agenda"; $lang['tni_set_perm_del'] = "Eliminar permanentemente"; $lang['tni_set_perm_deloff'] = "Deshabilitar eliminar permanentemente"; $lang['tni_set_perm_deloff_hint'] = " - Siempre mover a la papelera primero"; $lang['tni_set_perm_delon'] = "Habilitar eliminar permanentemente"; $lang['tni_set_title'] = "Configuración de usuario"; $lang['tni_set_general'] = "General"; $lang['tni_set_personal'] = "Personal"; $lang['tni_set_appearance'] = "Apariencia"; $lang['tni_signature'] = "Firma"; $lang['tni_signature_off'] = "Deshabilitar Firma"; $lang['tni_signature_on'] = "Habilitar Firma"; $lang['tni_signature_hint'] = "Máximo 50 caracteres"; $lang['tni_signature_hintb'] = "La firma se ubicará al final del mensaje"; $lang['tni_language'] = "Lenguaje"; $lang['tni_settings'] = "Configuración"; $lang['tni_yes'] = "Si"; $lang['tni_no'] = "No"; $lang['tni_default'] = "Predeterminado"; $lang['tni_set_deliv_report'] = "Informes de entrega"; /\* End of file kalkun_lang.php _/ /_ Location: ./application/language/spanish/kalkun_lang.php */ -- END file kalkun_lang.php -- INI file index.html <title>403 Prohibido</title>

El acceso a este directorio está prohibido.

-- END file index.html sorry paste the code here, but i'm new using git, but i hope this will be usefull. Nice piece of code!, best regards!! ## Augusto Gerardo Sotelo Labarca

Modem Monitor Feature

A feature that helps user especially administrator to monitor modem activity.

Information list:

  • Modem name
  • Status
  • Sent
  • Receive
  • Signal
  • Battery
  • To sent (count message that still in outbox)
  • Use since (InsertedIntoDB)

Statistics (all users included)

It would be great to have one combined statistics for phone (or whole installation of Kalkun).
Now it shows statistics for logged in user, but admin should see one combined statistics and/or statistics for every user.

Send to multiple groups

Hi developers!

Hopefully this is the correct place for a feature request.

It would be very nice if it is possible to send messages to multiple groups. If an user is in more than one receiving-group he should get the message only once.

Best Regards
Thomas

Signal messages that could not be sent

Hi,

I'm proposing a new feature - could Kalkun signal in the web interface in a special way (error message, red background, etc.) those SMS messages that could not be sent by Gammu?

Such messages are easily detected in the DB - they represent rows in the 'sentitems' table with these column values:

  • 'StatusError' == -1
  • 'Status' == 'Error' or 'SendingError'

Users could then try re-sending these messages later (perhaps Kalkun can assist them by providing a 'Resend' button when such messages are selected in the web interface).

Thanks! And keep up the good work!

[Request] Plugin E-mailtoSMS On Kalkun

Saya menggunakan Kalkun Version 0.4 (Toba), Gammu 1.31.0.tar.gz dan OS Ubuntu 10.10.

And I want to ask is about one of the features in the Kalkun is plugin "SMS to Mail" which is when there is incoming SMS forwarded directly to the email address that we specify.
What I want to ask is whether we can respond via email and sms is sent to the SMS sender number. So, we reply via email and SMS will be sent according to the number who send an SMS number (Email to SMS).

Regards
Arju

Time and Detection Issue !!!!

Hey,

i am having a few problems, i'm hoping i could get some help with.

so i'm trying to setup kalkun with gammu on a Windows XP system for a few weeks now, and can't seem to get Kalkun to recognize gammu or my modem no matter what i do.

now i have installed and configured Gammu to the point were it recognizes the modem and can send text using the command lines. I was also able to start the gammu service without any errors.

i then proceeded to install kalkun by following the instructions on here. after finish install and launching the dashboard, i realized a few things.

  1. My status is unknown
  2. The OS displays WINNT (I'm using XP)
  3. Gammu version is unknown
  4. IMEI is unkown
  5. Time issues, no matter what time zone i change the index file to, the time always remain the same.

now i have been trying to fix these problems for weeks now and i cant seem to find a solution. i am truly desperate now, the fact that my dead line for this project is getting close. So i would really appreciate if someone could respond to this message ASAP.

Thank you.

Share/ forward message to other users

Normally user want to share/ forward his/ her message to other user.

Alternative schema:

  • Allow user_inbox to have multiple and duplicate id_inbox. Remove UNIQUE index on id_inbox field. Message will remain only have unique ID on inbox table.
  • Copy message record to new record on inbox table, shared message will have different ID.

[Request] Phonebook in external database

Hi,

I'm trying to deploy Kalkun in a way that enables it to read phonebook entries (contacts) from an external database via ODBC. Is this possible?

Practically speaking, I need to move the 'pbk' and 'pbk_groups' tables to a different ODBC database and read them from there. Is there an easy way to do this (via plugin)?

How to upgrade from Kalkun 0.3 to 0.4?

I cannot seem to find how to upgrade from Kalkun 0.3 to 0.4?
I was able to update the database already but don't know how to go about updating the script.

Thanks in advance for any help.

Edit option in phonebook didn't work on Firefox

Hello,

I have an issue with 'edit' option in phonebook item from the menu.
Didn't work when i use Mozilla Firefox v3.6.23 over Windows 7, but over Google Chrome works fine.

I think the problem isn't the browser, because i realize i only had this problem when kalkun is mounted over a linux server (apache2+php5+mysql5), because when i mount it over a Windows 7 system using xammp there isn't any problem with Mozilla Firefox.

Anyone has this problem?

Thanks in advance

[Bug] Add multiple contacts to a group

Hi all!

If i mark 20 (example) phonebook entries in the phonebook and select a group from the action-menu "Add to group", it's the case that sometimes NOT all marked phonebook entries are listed in the group. Sometimes it works great - sometimes not.

Unfortunately i was not able to ascertain the reason of this behaviour.

I'm using a Kalkun 4 release canditade, but not the latest!

Do you know something about this issue?

Regards
Thomas

Plugin_status is being using?

Hello everyone!,

I'm working in a plugin. i don't know if this feature is stable in version 0.4 kalkun from the git repository, but is working fine to me. I made a plugin who add some dynamic options in some views, like "add_user.php" . so i need to check if my plugin is loaded correctly. To do this i was searching for a function and i think i found it in the file "application/models/plugin_model.php".

The issue here is that the function getPluginStatus($name) seems to work correctly but i don't know in what part of the logic when load/active a new plugin the entity "plugin_status" of the DB kalkun schema change/add/update the status of the plugin X. because there isn't any record in that entity.

I feel a little lost here..any help please?

Thanks in advance!

P.D.: Sorry my poor english i'm working on it

Augusto Gerardo Sotelo Labarca

Plugins with new libraries

Hello everyone,

I'm develop a plugin who use a library to handle excel reports, but have a question: ¿I need to make a directory called "library" in my plugin directory?, or ¿I need to include the library files inside the directory "application/library" directly?.

Because i have been searching for an example in the directory "application/plugins" but seems there isn't any plugin using new libraries.

Thanks in advance!

Phonebook Model Fixed - Grouping and send message to Group

I attach all line of code because I forgot wich lines I've changed. There are two files i atached, message_model.php and phonebook_model.php

File : phonebook_model.php

session->userdata('id_user') ; switch($param['option']) { case 'all': $this->db->select('*'); $this->db->select_as('pbk.id_pbk','id_pbk'); $this->db->select_as('pbk_groups.Name', 'GroupName'); $this->db->from('pbk'); $this->db->where('pbk.id_user', $user_id); $this->db->join('user_group', 'user_group.id_pbk=pbk.id_pbk', 'left'); $this->db->join('pbk_groups', 'pbk_groups.ID=user_group.id_pbk_groups', 'left'); $this->db->order_by('pbk.Name'); break; ``` case 'paginate': $this->db->select('*'); $this->db->select_as('pbk.id_pbk', 'id_pbk'); $this->db->from('pbk'); $this->db->where('id_user',$user_id); $this->db->order_by('Name'); $this->db->limit($param['limit'], $param['offset']); break; case 'by_idpbk': $this->db->select('*'); $this->db->select_as('pbk_groups.ID','id_pbk_groups'); $this->db->select_as('pbk.Name', 'Name'); $this->db->select_as('pbk_groups.Name', 'GroupName'); $this->db->from('pbk'); $this->db->where('pbk.id_user', $user_id); $this->db->join('user_group', 'user_group.id_pbk=pbk.id_pbk', 'left'); $this->db->join('pbk_groups', 'pbk_groups.ID=user_group.id_pbk_groups', 'left'); $this->db->where('pbk.id_pbk', $param['id_pbk']); break; case 'group': $this->db->select('*'); $this->db->select_as('Name','GroupName'); $this->db->from('pbk_groups'); $this->db->where('id_user', $user_id); $this->db->order_by('Name'); break; case 'group_paginate': $this->db->select('*'); $this->db->select_as('Name', 'GroupName'); $this->db->from('pbk_groups'); $this->db->where('id_user', $user_id); $this->db->order_by('Name'); $this->db->limit($param['limit'], $param['offset']); break; case 'groupname': $this->db->select_as('Name', 'GroupName'); $this->db->from('pbk_groups'); $this->db->where('ID', $param['id']); $this->db->where('id_user', $user_id); break; case 'bynumber': $this->db->select('*'); $this->db->select_as('id_pbk', 'id_pbk'); $this->db->from('pbk'); $this->db->where('Number', $param['number']); $this->db->where('id_user', $user_id); break; case 'bygroup': $this->db->select('*'); $this->db->from('pbk'); $this->db->select_as('pbk.Name', 'Name'); $this->db->join('user_group', 'user_group.id_pbk=pbk.id_pbk'); $this->db->join('pbk_groups', 'pbk_groups.ID=user_group.id_pbk_groups'); $this->db->where('user_group.id_pbk_groups', $param['group_id']); $this->db->where('pbk.id_user', $user_id); $this->db->order_by("pbk.Name", "asc"); break; case 'search': $this->db->select('*'); $this->db->select_as('id_pbk', 'id_pbk'); $this->db->from('pbk'); $this->db->or_like(array('Name' => $this->input->post('search_name'), 'Number' =>$this->input->post('search_name'))); $this->db->having('id_user', $user_id); $this->db->order_by('Name'); break; ``` } return $this->db->get(); } // -------------------------------------------------------------------- /** - Search Phonebook * - @access public - @param mixed $param - @return object */ function search_phonebook($param) { $this->db->from('pbk'); $this->db->select_as('Number', 'id'); $this->db->select_as('Name', 'name'); $this->db->where('id_user', $param['uid']); $this->db->like('Name', $param['query']); $this->db->order_by('Name'); return $this->db->get(); } // -------------------------------------------------------------------- /** - Add Contact * - @access public - @param mixed $param - @return */ function add_contact($param) { $this->db->set('Name', $param['Name']); $this->db->set('Number', $param['Number']); $this->db->set('id_user', $param['id_user']); // edit mode if(isset($param['id_pbk'])) { $this->db->where('ID', $param['id_pbk']); $this->db->update('pbk'); } else $this->db->insert('pbk'); // optimisation required. if(isset($param['id_pbk'])) { $pbk_id = $param['id_pbk']; } else $pbk_id = $this->db->insert_id(); //delete past groups $this->db->delete('user_group', array('id_pbk' => $pbk_id)); // now insert the lastest //if(isset($param['GroupID'])) if(isset($param['GroupID']) && !empty($param['GroupID'])) { $this->db->set('id_pbk', $pbk_id); $this->db->set('id_pbk_groups', $param['GroupID']); $this->db->set('id_user', $param['id_user']); $this->db->insert('user_group'); } //if(isset($param['Groups'])) if(isset($param['Groups']) && !empty($param['Groups'])){ $groups = array_unique(explode(',',$param['Groups'])); $CI =& get_instance(); foreach($groups as $_grp) { $group_id = $CI->Phonebook_model->group_id($_grp,$param['id_user']); ``` if($group_id != null) { $this->db->set('id_pbk', $pbk_id); $this->db->set('id_pbk_groups', $group_id); $this->db->set('id_user', $param['id_user']); $this->db->insert('user_group'); } } ``` } } function multi_attach_group() { $id_group = $this->input->post('id_group'); $id_pbk = $this->input->post('id_pbk'); if($id_group == 'null' ) die("Invalid Group ID"); //parse group value if(preg_match('/-/',$id_group)) { $mode = 'delete'; $id_group = substr($id_group,1); } else $mode = 'add'; if($mode == 'delete') { $this->db->delete('user_group', array('id_pbk' => $id_pbk , 'id_pbk_groups' => $id_group)); } else // Add Mode { $this->db->from('user_group'); $this->db->where('id_pbk', $id_pbk); $this->db->where('id_pbk_groups', $id_group); ``` if($this->db->get()->num_rows() < 1) { $this->db->set('id_pbk', $id_pbk); $this->db->set('id_pbk_groups', $id_group); $this->db->set('id_user', $this->session->userdata('id_user')); $this->db->insert('user_group'); } ``` } } // -------------------------------------------------------------------- /** - Add Group * - @access public - @param mixed $param - @return */ function add_group() { $this->db->set('Name', trim($this->input->post('group_name'))); $this->db->set('id_user', trim($this->input->post('pbkgroup_id_user'))); ``` // edit mode if($this->input->post('pbkgroup_id')) { $this->db->where('ID', $this->input->post('pbkgroup_id')); $this->db->update('pbk_groups'); } else $this->db->insert('pbk_groups'); ``` } // -------------------------------------------------------------------- /** - Get Groups ID for a Group Name * - @access public - @param text $group_name - @param number $user_id - @return _/ function group_id($group_name, $user_id) { $this->db->select('_'); $this->db->from('pbk_groups'); $this->db->where('Name', $group_name); $this->db->where('id_user', $user_id); return @$this->db->get()->row()->ID; } // -------------------------------------------------------------------- /** - Get Groups for a contact id * - @access public - @param number $pbk_id - @param number $user_id - @return */ function get_groups($pbk_id,$user_id) { $this->db->select_as('user_group.id_pbk_groups', 'GroupID'); $this->db->select_as('pbk_groups.Name', 'GroupName'); $this->db->from('user_group'); $this->db->join('pbk_groups', 'pbk_groups.ID=user_group.id_pbk_groups'); $this->db->where('user_group.id_user', $user_id); $this->db->where('user_group.id_pbk', $pbk_id); $q = $this->db->get(); $GroupID = $GroupName = ''; foreach ($q->result() as $_gp) { $GroupName .= $_gp->GroupName.','; $GroupID .= $_gp->GroupID .','; } $GroupName = substr($GroupName,0, strlen($GroupName)-1); $GroupID = substr($GroupID,0, strlen($GroupID)-1); return (object) array("GroupNames" => $GroupName, "GroupIDs" => $GroupID); } // -------------------------------------------------------------------- /** - Delete Contact * - @access public - @param number $id_contact - @return */ function delete_contact() { $this->db->delete('pbk', array('ID' => $this->input->post('id'))); $this->db->delete('user_group', array('id_pbk' => $this->input->post('id'))); } // -------------------------------------------------------------------- /** - Delete Group * - @access public - @param mixed $id_group - @return */ function delete_group() { $this->db->delete('pbk', array('ID' => $this->input->post('id'))); $this->db->delete('pbk_groups', array('ID' => $this->input->post('id'))); $this->db->delete('user_group', array('id_pbk_groups' => $this->input->post('id'))); } } /\* End of file phonebook_model.php _/ /_ Location: ./application/models/phonebook_model.php */ File : message_model.php config->item('disable_outgoing')) { echo "
Outgoing SMS Disabled
"; return; } if($data['dest']!=NULL && $data['date']!=NULL && $data['message']!=NULL) { // Check message's length $messagelength = strlen($data['message']); ``` // Check coding switch($data['coding']) { case 'default': $standar_length = 160; $data['coding'] = 'Default_No_Compression'; break; case 'unicode': $standar_length = 70; $data['coding'] = 'Unicode_No_Compression'; break; } $UDH_length = 7; $multipart_length = $standar_length - $UDH_length; // Multipart message if($messagelength > $standar_length) { // generate UDH $UDH = "050003"; $UDH .= strtoupper(dechex(mt_rand(0, 255))); $data['UDH'] = $UDH; // split string $tmpmsg = str_split($data['message'], $multipart_length); // count part message $part = count($tmpmsg); if($part < 10) $part = '0'.$part; // insert first part to outbox and get last outbox ID $data['option'] = 'multipart'; $data['message'] = $tmpmsg[0]; $data['part'] = $part; $outboxid = $this->_send_message_route($data); $this->Kalkun_model->add_sms_used($this->session->userdata('id_user')); // insert the rest part to Outbox Multipart for($i=1; $i_send_message_multipart($outboxid, $tmpmsg[$i], $i, $part, $data['coding'], $data['class'], $UDH); $this->Kalkun_model->add_sms_used($this->session->userdata('id_user')); } } else { $data['option'] = 'single'; $this->_send_message_route($data); $this->Kalkun_model->add_sms_used($this->session->userdata('id_user')); } ``` } else { echo 'Parameter invalid'; } } // -------------------------------------------------------------------- /** - Send Message Route * - @access private - @param mixed - - @return */ function _send_message_route($tmp_data) { //print_r($tmp_data); $data = array ( 'InsertIntoDB' => date('Y-m-d H:i:s'), 'SendingDateTime' => $tmp_data['date'], 'DestinationNumber' => $tmp_data['dest'], 'Coding' => $tmp_data['coding'], 'Class' => $tmp_data['class'], 'CreatorID' => $tmp_data['CreatorID'], 'SenderID' => $tmp_data['SenderID'], 'TextDecoded' => $tmp_data['message'], 'RelativeValidity' => $tmp_data['validity'], 'DeliveryReport' => $tmp_data['delivery_report'] ); if($tmp_data['option']=='multipart') { $data['MultiPart'] = 'true'; $data['UDH'] = $tmp_data['UDH'].$tmp_data['part'].'01'; } $this->db->insert('outbox', $data); $last_outbox_id = $this->db->insert_id(); //$message_outbox = $this->get_messages(array('type'=>'outbox','ID'=>$last_outbox_id)); $user = array( 'id_outbox' => $last_outbox_id, 'id_user' => $tmp_data['uid'], 'id_folder' => $tmp_data['id_folder'] ); $this->db->insert('user_outbox', $user); ``` /*Insert Folder Message Sent*/ $folder_message_sent = array( 'OutboxInsertIntoDB'=>$data['InsertIntoDB'], 'DestinationNumber'=>$data['DestinationNumber'], 'replayed_inbox_id'=>$tmp_data['id_inbox'], 'id_folder'=>$tmp_data['id_folder'] ); ``` $this->db->insert('folder_message_sent', $folder_message_sent); if($tmp_data['option']=='multipart') return $last_outbox_id; } // -------------------------------------------------------------------- /** - Send Message Multipart * - @access private - @param mixed - - @return */ function _send_message_multipart($outboxid, $message, $pos, $part, $coding, $class, $UDH) { $code = $pos+1; if($code < 10) $code = '0'.$code; $data = array ( 'ID' => $outboxid, 'UDH' => $UDH.$part.''.$code, 'SequencePosition' => $pos+1, 'Coding' => $coding, 'Class' => $class, 'TextDecoded' => $message, ); $this->db->insert('outbox_multipart',$data); } // -------------------------------------------------------------------- function search_messages($options = array()) { if(!isset($options['number'])) if(!isset($options['search_string'])) die("No String to Search For"); ``` $this->db->from('inbox'); $tmp_number = 'SenderNumber'; $tmp_order = 'ReceivingDateTime'; $udh_where = "(".$this->_protect_identifiers("UDH")." = '' OR ".$this->_protect_identifiers("UDH")." LIKE '%1')"; $this->db->where($udh_where, NULL, FALSE); if(isset($options['search_string'])) $this->db->like('TextDecoded', $options['search_string']); // if phone number is set if(isset($options['number'])) $this->db->where($tmp_number, $options['number']); //remove already trashed if(!isset($options['trash'])) $this->db->where('id_folder !=', '5'); // join user table if(isset($options['uid'])) { $this->db->join($user_folder, $user_folder.'.id_'.$options['type'].'='.$options['type'].'.ID'); $this->db->where($user_folder.'.id_user',$options['uid']); } $result = $this->db->get(); $inbox = $result->result_array(); // add global date for sorting foreach($inbox as $key=>$tmp): $inbox[$key]['globaldate'] = $inbox[$key]['ReceivingDateTime']; $inbox[$key]['source'] = 'inbox'; endforeach; $this->db->from('sentitems'); $tmp_number = 'DestinationNumber'; $tmp_order = 'SendingDateTime'; $this->db->where('SequencePosition', '1'); ``` if(isset($options['search_string'])) $this->db->like('TextDecoded', $options['search_string']); ``` // if phone number is set if(isset($options['number'])) $this->db->where($tmp_number, $options['number']); //remove already trashed if(!isset($options['trash'])) $this->db->where('id_folder !=', '5'); // join user table if(isset($options['uid'])) { $this->db->join($user_folder, $user_folder.'.id_'.$options['type'].'='.$options['type'].'.ID'); $this->db->where($user_folder.'.id_user',$options['uid']); } $result = $this->db->get(); $sentitems = $result->result_array(); // add global date for sorting foreach($sentitems as $key=>$tmp): $sentitems[$key]['globaldate'] = $sentitems[$key]['SendingDateTime']; $sentitems[$key]['source'] = 'sentitems'; endforeach; $data['messages'] = $inbox; // merge inbox and sentitems foreach($sentitems as $tmp): $data['messages'][] = $tmp; endforeach; // sort data $sort_option = $this->Kalkun_model->get_setting()->row('conversation_sort'); usort($data['messages'], "compare_date_".$sort_option); $return_data= array(); $return_data['total_rows'] = count($data['messages']); $return_data['messages'] = array(); //paginate if(isset($options['offset'] ) && isset($options['limit'])) { for($i = $options['offset'] ; $i < min( ($options['offset']+ $options['limit']), $return_data['total_rows']) ; $i++) { $return_data['messages'][] = $data['messages'][$i]; } } else { $return_data['messages'] = $data['messages']; } return (object) $return_data; ``` } // -------------------------------------------------------------------- /** - Get Messages * - Get messages from inbox, outbox, sentitems * - @access public - @param mixed $options - Option: Values - -------------- - type inbox, outbox, sentitems - id_folder int - id_message int - number string - processed bool - readed bool - uid int - @return object */ function get_messages($options = array()) { // default values $options = $this->_default(array('type' => 'inbox'), $options); // register valid type $valid_type = array('inbox', 'outbox', 'sentitems'); // check if it's valid type if(!in_array($options['type'], $valid_type)) die('Invalid type request on class '.get_class($this).' function '.**FUNCTION**); $user_folder = "user_".$options['type']; $this->db->from($options['type']); // set valid field name if($options['type']=='inbox') { $tmp_number = 'SenderNumber'; $tmp_order = 'ReceivingDateTime'; ``` $udh_where = "(".$this->_protect_identifiers("UDH")." = '' OR ".$this->_protect_identifiers("UDH")." LIKE '%1')"; $this->db->where($udh_where, NULL, FALSE); ``` } else { $tmp_number = 'DestinationNumber'; $tmp_order = 'SendingDateTime'; if($options['type']=='sentitems') $this->db->where('SequencePosition', '1'); } // if id message is set if(isset($options['id_message'])) $this->db->where('ID', $options['id_message']); else { // if id folder is set, else use default value (inbox = 1, sentitems = 3) if(isset($options['id_folder'])) $this->db->where('id_folder', $options['id_folder']); else { if($options['type']!='outbox') $this->db->where('id_folder', array_search($options['type'], $valid_type)+1); } } //if search string is set if(isset($options['search_string'])) $this->db->like('TextDecoded', $options['search_string']); // if phone number is set if(isset($options['number'])) $this->db->where($tmp_number, $options['number']); // if readed is set if(isset($options['readed']) && is_bool($options['readed'])) { // valid only for inbox if($options['type']=='inbox') { $readed = ($options['readed']) ? 'true' : 'false'; $this->db->where('readed', $readed); } } // if processed is set if(isset($options['processed']) && is_bool($options['processed'])) { // valid only for inbox if($options['type']=='inbox') { $processed = ($options['processed']) ? 'true' : 'false'; $this->db->where('Processed', $processed); } } // join user table if(isset($options['uid'])) { $this->db->join($user_folder, $user_folder.'.id_'.$options['type'].'='.$options['type'].'.ID'); $this->db->where($user_folder.'.id_user',$options['uid']); ``` // if trash is set if(isset($options['trash']) && is_bool($options['trash'])) $this->db->where($user_folder.'.trash', $options['trash']); ``` } if(isset($options['order_by'])) $this->db->order_by($options['order_by'], isset($options['order_by_type'])?$options['order_by_type']:'DESC'); if(isset($options['limit']) && isset($options['offset'])) { $this->db->limit($options['limit'], $options['offset']); } $result = $this->db->get(); return $result; } // -------------------------------------------------------------------- /** - _protect_identifiers * - Ugly hack to add backticks to database field * - @param string $identifier - @return string */ function _protect_identifiers($identifier=NULL) { $escape_char; $escaped_identifer=""; // get database engine $db_engine = $this->db->platform(); $escape_char = get_database_property($db_engine); $escape_char = $escape_char['escape_char']; $sub = explode(".", $identifier); $sub_count = count($sub); foreach($sub as $key => $tmp) { $escaped_identifer.=$escape_char.$tmp.$escape_char; ``` // if this is not the last if($key!=$sub_count-1) { $escaped_identifer.="."; } ``` } return $escaped_identifer; } // -------------------------------------------------------------------- /** - _default method combines the options array with a set of defaults - giving the values in the options array priority. * - @param array $defaults - @param array $options - @return array */ function _default($defaults, $options) { return array_merge($defaults, $options); } // -------------------------------------------------------------------- /** - Get Conversation * - Get list of conversation * - @access public - @param mixed $options - Option: Values - -------------- - type inbox, outbox, sentitems - id_folder int - limit int - offset int - trash bool * - @return object */ function get_conversation($options = array()) { // default values $options = $this->_default(array('type' => 'inbox'), $options); // register valid type $valid_type = array('inbox', 'outbox', 'sentitems'); // check if it's valid type if(!in_array($options['type'], $valid_type)) die('Invalid type request on class '.get_class($this).' function '.**FUNCTION**); $user_id = $this->session->userdata('id_user'); // if id folder is set, else use default value (inbox = 1, outbox = 2, sentitems = 3) if(isset($options['id_folder'])) $tmp_id_folder = $options['id_folder']; else $tmp_id_folder = array_search($options['type'], $valid_type)+1; if(isset($options['id_folder']) && $options['id_folder']=='5') $tmp_trash='1'; else $tmp_trash='0'; switch($options['type']) { case 'inbox': $this->db->from('inbox'); $this->db->select_max($this->_protect_identifiers('ReceivingDateTime'), $this->_protect_identifiers('maxdate'), FALSE); $this->db->join('user_inbox','user_inbox.id_inbox=inbox.ID'); $this->db->where('id_user', $user_id); $this->db->where('id_folder', $tmp_id_folder); $this->db->group_by('SenderNumber'); ``` $sub_sql = $this->db->_compile_select(); $this->db->_reset_select(); $this->db->distinct(); $this->db->from("($sub_sql) as ".$this->_protect_identifiers('maxresult').",inbox"); $this->db->join('user_inbox','user_inbox.id_inbox=inbox.ID'); $this->db->where('id_user', $user_id); $this->db->where('id_folder', $tmp_id_folder); $this->db->where('trash', $tmp_trash); $this->db->where($this->_protect_identifiers('ReceivingDateTime'), $this->_protect_identifiers('maxresult.maxdate'), FALSE); //$this->db->group_by('SenderNumber'); $this->db->order_by('ReceivingDateTime', 'DESC'); break; case 'outbox': $this->db->from('outbox'); $this->db->select_max($this->_protect_identifiers('SendingDateTime'), $this->_protect_identifiers('maxdate'), FALSE); $this->db->join('user_outbox','outbox.ID=user_outbox.id_outbox'); $this->db->where('id_user', $user_id); $this->db->group_by('DestinationNumber'); $sub_sql = $this->db->_compile_select(); $this->db->_reset_select(); $this->db->distinct(); $this->db->from("($sub_sql) as ".$this->_protect_identifiers('maxresult').",outbox"); $this->db->join('user_outbox','outbox.ID=user_outbox.id_outbox'); $this->db->where('id_user', $user_id); $this->db->where($this->_protect_identifiers('SendingDateTime'), $this->_protect_identifiers('maxresult.maxdate'), FALSE); //$this->db->group_by('DestinationNumber'); $this->db->order_by('SendingDateTime', 'DESC'); break; case 'sentitems': $this->db->from('sentitems'); $this->db->select_max($this->_protect_identifiers('SendingDateTime'), $this->_protect_identifiers('maxdate'), FALSE); $this->db->join('user_sentitems','sentitems.ID=user_sentitems.id_sentitems'); $this->db->where('id_user', $user_id); $this->db->where('id_folder', $tmp_id_folder); $this->db->where('SequencePosition', '1'); $this->db->group_by('DestinationNumber'); $sub_sql = $this->db->_compile_select(); $this->db->_reset_select(); $this->db->distinct(); $this->db->from("($sub_sql) as ".$this->_protect_identifiers('maxresult').",sentitems"); $this->db->join('user_sentitems','sentitems.ID=user_sentitems.id_sentitems'); $this->db->where('id_user', $user_id); $this->db->where('id_folder', $tmp_id_folder); $this->db->where('SequencePosition', '1'); $this->db->where('trash', $tmp_trash); $this->db->where($this->_protect_identifiers('SendingDateTime'), $this->_protect_identifiers('maxresult.maxdate'), FALSE); //$this->db->group_by('DestinationNumber'); $this->db->order_by('SendingDateTime', 'DESC'); break; ``` } if(isset($options['limit']) && isset($options['offset'])) { $this->db->limit($options['limit'], $options['offset']); } return $this->db->get(); } // -------------------------------------------------------------------- /** - Move Messages * - Move messages from a folder to another folder * - @access public - @param mixed $options - Option: Values - -------------- - type conversation, single - current_folder int, source folder, use with conversation type - id_folder int, destination folder, use with conversation and single type - number string, use with conversation type - folder inbox, sentitems, use with single type - id_message, use with single type - trash, bool - - @return object */ function move_messages($options = array()) { // default values $options = $this->_default(array('trash' => FALSE), $options); $trash = ($options['trash']) ? '1':'0'; switch($options['type']) { case 'conversation': $id_folder = $options['id_folder']; $number = $options['number']; ``` if($options['current_folder']=='') { $inbox_folder=1; $sentitems_folder=3; } else { $inbox_folder=$sentitems_folder=$options['current_folder']; } // proccess inbox $this->db->set('i.id_folder', $id_folder); $this->db->set('ui.trash', $trash); $this->db->where('i.id_folder', $inbox_folder); $this->db->where('i.SenderNumber', $number); $this->db->where($this->_protect_identifiers('i.ID'), $this->_protect_identifiers('ui.id_inbox'), FALSE); $update_inbox = $this->_protect_identifiers('inbox'); $update_inbox_alias = $this->_protect_identifiers('i'); $update_user_inbox = $this->_protect_identifiers('user_inbox'); $update_user_inbox_alias = $this->_protect_identifiers('ui'); $this->db->update($update_inbox.' as '.$update_inbox_alias.', '.$update_user_inbox.' as '.$update_user_inbox_alias); // proccess sentitems $this->db->set('si.id_folder', $id_folder); $this->db->set('usi.trash', $trash); $this->db->where('si.id_folder', $sentitems_folder); $this->db->where('si.DestinationNumber', $number); $this->db->where($this->_protect_identifiers('si.ID'), $this->_protect_identifiers('usi.id_sentitems'), FALSE); $update_sentitems = $this->_protect_identifiers('sentitems'); $update_sentitems_alias = $this->_protect_identifiers('si'); $update_user_sentitems = $this->_protect_identifiers('user_sentitems'); $update_user_sentitems_alias = $this->_protect_identifiers('usi'); $this->db->update($update_sentitems.' as '.$update_sentitems_alias.', '.$update_user_sentitems.' as '.$update_user_sentitems_alias); break; case 'single': $folder = $options['folder']; $id_folder = $options['id_folder']; $id_message = $options['id_message']; $user_folder = "user_".$folder; // add user prefix $id_folder_field = "id_".$folder; // add id prefix foreach($id_message as $tmp): $this->db->set('a.id_folder', $id_folder); $this->db->set('b.trash', $trash); $this->db->where('a.ID', $tmp); $update_id_folder_field = 'b.'.$id_folder_field; $this->db->where($this->_protect_identifiers('a.ID'), $this->_protect_identifiers($update_id_folder_field), FALSE); $update_folder = $this->_protect_identifiers($folder); $update_folder_alias = $this->_protect_identifiers('a'); $update_user_folder = $this->_protect_identifiers($user_folder); $update_user_folder_alias = $this->_protect_identifiers('b'); $this->db->update($update_folder.' as '.$update_folder_alias.', '.$update_user_folder.' as '.$update_user_folder_alias); endforeach; break; ``` } } // -------------------------------------------------------------------- /** - Delete Messages * - Delete messages, permanent or temporary. * - @access public - @param mixed $options - Option: Values - -------------- - type conversation, single - option permanent, temporary, outbox - current_folder int, source folder, use with conversation type - number string - source inbox, outbox, sentitems - id int, use with single type - - @return object */ function delete_messages($options = array()) { $user_id = $this->session->userdata('id_user'); $type = $options['type']; $source = $options['source']; $option = $options['option']; if(isset($options['id'])) $tmp_id = $options['id']; if(isset($options['number'])) $number = $options['number']; if(isset($options['current_folder'])) $current_folder = $options['current_folder']; $user_source = "user_".$source; $id_source = "id_".$source; switch($type) { case 'conversation': if(!isset($options['current_folder'])) { $inbox_folder=1; $sentitems_folder=3; } else $inbox_folder=$sentitems_folder=$current_folder; ``` $trash = FALSE; switch($option) { case 'permanent': // if it's coming from trash if(isset($current_folder) && $current_folder=='5') $trash = TRUE; // get inbox $param = array('id_folder' => $inbox_folder, 'number' => $number, 'trash' => $trash, 'uid' => $user_id); $inbox = $this->get_messages($param); foreach($inbox->result() as $tmp) { $this->db->where('ID', $tmp->id_inbox); $this->db->delete('inbox'); $this->db->where('id_inbox', $tmp->id_inbox); $this->db->delete('user_inbox'); } // deprecated // inbox /*$inbox = "DELETE i, ui FROM inbox AS i LEFT JOIN user_inbox AS ui ON ui.id_inbox = i.ID WHERE i.SenderNumber = '".$number."' AND ui.trash='1'"; $this->db->query($inbox);*/ // get sentitems $param = array('id_folder' => $sentitems_folder, 'type' => 'sentitems', 'number' => $number, 'trash' => $trash, 'uid' => $user_id); $sentitems = $this->get_messages($param); foreach($sentitems->result() as $tmp) { $this->db->where('ID', $tmp->id_sentitems); $this->db->delete('sentitems'); $this->db->where('id_sentitems', $tmp->id_sentitems); $this->db->delete('user_sentitems'); } // sentitems /*$sentitems = "DELETE s, us FROM sentitems AS s LEFT JOIN user_sentitems AS us ON us.id_sentitems = s.ID WHERE s.DestinationNumber = '".$number."' AND us.trash='1'"; $this->db->query($sentitems);*/ break; case 'temp': // use move_messages function $param['type'] = 'conversation'; $param['number'] = $number; $param['current_folder'] = $options['current_folder']; $param['id_folder'] = '5'; $param['trash'] = TRUE; $this->move_messages($param); break; case 'outbox': $tmp_sql = $this->get_messages(array('type' => 'outbox', 'number' => $number))->result_array(); // looping all message foreach($tmp_sql as $tmp): //check multipart message $multipart = array('type' => 'outbox', 'option' => 'check', 'id_message' => $tmp['ID']); if($this->get_multipart($multipart)=='true') $this->db->delete('outbox_multipart', array('ID' => $tmp['ID'])); $this->db->delete('outbox', array('ID' => $tmp['ID'])); endforeach; break; } break; case 'single': switch($option) { case 'permanent': foreach($tmp_id as $tmp): $this->db->delete("user_".$source, array('id_'.$source => $tmp)); $this->db->delete($source, array('ID' => $tmp)); endforeach; break; case 'temp': // use move_messages function $param['type'] = 'single'; $param['id_message'] = $tmp_id; $param['folder'] = $source; $param['id_folder'] = '5'; $param['trash'] = TRUE; $this->move_messages($param); break; case 'outbox': //check multipart message $multipart = array('type' => 'outbox', 'option' => 'check', 'id_message' => $tmp_id[0]); if($this->get_multipart($multipart)=='true') $this->db->delete('outbox_multipart', array('ID' => $tmp_id[0])); $this->db->delete('outbox', array('ID' => $tmp_id[0])); break; } break; ``` } } // -------------------------------------------------------------------- /** - Get Multipart * - Get and check for multipart messages * - @access public - @param mixed - - @return object */ function get_multipart($param) { // default values $param = $this->_default(array('type' => 'inbox'), $param); switch($param['option']) { case 'check': if($param['type']=='outbox') { $this->db->select('MultiPart'); $this->db->where('ID', $param['id_message']); return $this->db->get('outbox')->row('MultiPart'); } else if($param['type']=='inbox') { $this->db->where('ID', $param['id_message']); return $this->db->get('inbox'); } else if($param['type']=='sentitems') { $this->db->where('ID', $param['id_message']); $this->db->where('SequencePosition >', 1); return $this->db->get('sentitems')->num_rows(); } break; ``` case 'all': if($param['type']=='outbox') { $this->db->where('ID', $param['id_message']); $this->db->order_by('SequencePosition'); return $this->db->get('outbox_multipart'); } else if($param['type']=='inbox') { $this->db->where('SenderNumber', $param['phone_number']); $this->db->like('UDH', $param['udh'], 'after'); $this->db->not_like('UDH', '1', 'before'); $this->db->order_by('UDH'); return $this->db->get('inbox'); } else if($param['type']=='sentitems') { $this->db->where('ID', $param['id_message']); $this->db->where('SequencePosition >', 1); $this->db->order_by('SequencePosition'); return $this->db->get('sentitems'); } break; ``` } } // -------------------------------------------------------------------- /** - Update readed inbox * - @access public - @param mixed - - @return */ function update_read($id) { $data = array ('readed' => 'true'); $this->db->where('ID', $id); $this->db->update('inbox', $data); } // -------------------------------------------------------------------- /** - Utility function used by the daemon and base controller * - @access public - @param mixed - - @return _/ function insert_user_sentitems($id_message, $user_id) { $this->db->set('id_user', $user_id); $this->db->set('id_sentitems', $id_message); $this->db->insert('user_sentitems'); //update folder message sent -- additional /_ $sentitem = $this->get_messages(array('type'=>'sentitems','ID'=>$id_message)); $this->db->select("ID"); $this->db->from('folder_message_sent'); $this->db->where('id_sentitems', -1); $this->db->where('OutboxInsertIntoDB', $sentitem['InsertIntoDB']); $this->db->where('DestinationNumber', $sentitem['DestinationNumber']); $row = $this->db->get()->row('folder_message_sent'); if($row>0){ $result = $this->db->get(); $this->db->set('id_sentitems',$id_message); $this->db->where('ID',$result['ID']); $this->db->update('folder_message_sent'); } */ } function get_user_outbox($user_id) { $this->db->where('id_user', $user_id); return $this->db->get("user_outbox"); } function delete_user_outbox($id_message) { $this->db->where('id_outbox', $id_message); $this->db->delete("user_outbox"); } // Update processed inbox function update_processed($id) { foreach($id as $tmp): $data = array ('Processed' => 'true'); $this->db->where('ID', $tmp); $this->db->update('inbox', $data); endforeach; } // Update ownership function update_owner($msg_id, $user_id) { $data = array ('id_user' => $user_id, 'id_inbox' => $msg_id); $this->db->insert('user_inbox', $data); } //Save Canned Response function canned_response($name,$message, $action) { if($action == 'list') { return $this->db->get_where('user_templates', array( 'id_user'=> $this->session->userdata('id_user') )); } else if($action == 'get') { $message = $this->db->get_where('user_templates', array('Name' => $name), 1, 0)->row('Message'); echo $message; } else if($action == 'save') { $record = array('Name'=>$name, 'Message'=>$message, 'id_user'=> $this->session->userdata('id_user')); ``` $query = $this->db->get_where('user_templates', array('Name'=> $name, 'id_user'=> $this->session->userdata('id_user')), 1, 0); if ($query->num_rows() == 0) { // A record does not exist, insert one. $query = $this->db->insert('user_templates', $record); } else { // A record does exist, update it. $query = $this->db->update('user_templates', $record, array('id_template'=>$query->row('id_template'))); } } else if($action == 'delete') { $this->db->delete('user_templates', array('Name' => $name)); } else die("Invalid Option"); ``` } /* - Reply message in folder sent -- Additional function */ function update_folder_message_sent($id_sentitems){ //$sentitem = $this->Message_model->get_messages(array('id_message' => $id_sentitems, 'type' => 'sentitems'))->result_array(); //print_r($sentitem); ``` // get sentitems $param = array('id_message' => $id_sentitems, 'type' => 'sentitems'); $sentitems = $this->get_messages($param); foreach($sentitems->result() as $tmp){ $this->db->select('ID'); $this->db->select('id_folder'); $this->db->from('folder_message_sent'); $this->db->where('OutboxInsertIntoDB',$tmp->InsertIntoDB); $this->db->where('DestinationNumber',$tmp->DestinationNumber); //$row = $this->db->get('folder_message_sent')->num_rows(); //$folder_message_sent = $this->db->get('folder_message_sent'); $result = $this->db->get(); $row = $result->row(); $folder_message_sents = $result->result_array(); if($row>0){ $this->db->set('id_sentitems',$id_sentitems); $this->db->where('OutboxInsertIntoDB',$tmp->InsertIntoDB); $this->db->where('DestinationNumber',$tmp->DestinationNumber); $this->db->update('folder_message_sent'); foreach($folder_message_sents as $key=>$val){ $this->db->set('id_folder',$folder_message_sents[$key]['id_folder']); $this->db->where('ID',$id_sentitems); $this->db->update('sentitems'); } } } ``` } } /\* End of file messages_model.php _/ /_ Location: ./application/models/messages_model.php */

Special characters - German Umlauts

Hi!

I've seen that you wanna fix the issue with special characters. They should count as two, if unicode is not used [0]. I'm from Germany and actually i'm using Kalkun 0.3. Charactes like the german umlauts "ä ö ü ß Ä Ö Ü" [1] are also affected from this problem. They should count as two, too.

Is it designated to inclue these german umlauts in your solution "Kalkun 0.4"?

Second question: When comes the release for Kalkun 0.4?

Thanks a lot!
Thomas

[0] 6c0e8c2
[1] http://www.disknet.com/indiana_biolab/ger004.htm

Plugin "Server Alert" Database Error

Hi *!

I've installed the "server alert" plugin and i created the table "plugin_sever_alert" with "plugins/server_alert/media/mysql_server_alert.sql".

When clicking on the "Server Alert" link on the plugins-page in kalkun, i get the error:

A Database Error Occurred

Error Number: 1146

Table 'kalkun.plugin' doesn't exist

SELECT plugin_status FROM (plugin) WHERE plugin_name = 'server_alert'

I think the problem comes with the FROM-clause in the sql statement. Correct table-name should be "plugins" ...

Best Regards

PS: i'm using kalkun 0.4.

benefits of making kalkun like twitter with user page

Last year i had suggested that we should have twitter like facility on kalkun where user sends sms to kalkun number and his sms is displayed on kalkuns public page made for user.

we can also add oauth support to it and users update can be posted to twitter (if needed by user)..

there are advantages in this case.

  1. by opening up user profile page, you can add multiple ads on it and get your costs covered, those users who want to share content with public will find it convenient.
  2. Twitter has special number for sending/receiving sms updates that varies across countries..users need to pay extra for this facility. once users get registered on kalkun, they should be able to send sms on kalkuns number, ie local number thus saving some amount of talktim

Message couldn't be delivered

Hi!

I've another question to you: I've sent a group message to 80 mobile phones (me included). Some people called me because of this SMS -> so i know that they could receive the message. What could be the reason that I could NOT receive the message. Everything seems to be O.K. The message is in the "sent items" folder, the database-entry says "SendingOKNoReport" and StatusError "-1". Gammu-Log file shows no irregularities too.

15 minutes later I tried to send exactly the same SMS to my mobile phone again. It worked. database-entries and gammu-log entries are the same as before.

What could be the problem? Actually i don't know how many of the 80 contacts could receive my message ...

Best Regards
oachkatzlschwaf

Billink excellent !!!

Excellente the Tools. Do not speak English, sorry.
It is a good idea to implement the fare with sms credits, is the suggestion
Hugs to all and congratulations

DB Change Field type for version 0.4

What are the field type of these changes in version 0.4 database?

DB change:

Added field is_public on pbk and pbk_groups table
Added field in_sms_count and rename field sms_count to out_sms_count on sms_used table
Added table b8_wordlist (token, count)
Added table plugins (plugin_id, plugin_system_name, plugin_name, plugin_uri, plugin_version, plugin_description, plugin_author, plugin_author_uri, plugin_data)

[Request] multi-user routing based on phone numbers

The current routing of message by including @username into the replied message is very difficult to implement because it is very unlikely for the people to respond with the @username.

My suggestion is to route the message based on the last 7 to 10 digits (user or system configurable) of the responding phone number. If this can be found in the phone book of a particular user, then it will be routed to that user. If there are multiple users who happen to have this same number on their phone book, then all these users will all get the message. If the number cannot be found on any phone book, then it will be routed to the master user.

I believe that this will be a more usable routing algorithm. Hope it gets implemented. :)

Thanks & keep up the good work!

HowTo Run External Script

Hi *!

How can i run an external script? I don't know what i'm doing wrong.

My steps:

  • Install plugin "external script" via kalkun

  • edit /application/plugins/external_script/external_script.php:

    $config['ext_script_path'] = '/bin/bash';

    $config['ext_script'][0]['name'] = '/var/www/check_system.bash';
    $config['ext_script'][0]['key'] = 'content';
    $config['ext_script'][0]['type'] = 'match';
    $config['ext_script'][0]['value'] = 'check';
    $config['ext_script'][0]['parameter'] = '';

When i send a message with content'check' to the "kalkun-system" nothing happens. the script has 777 permissions and works fine if i start i manually.

I'm using ubuntu server 11.10.

thanks in advance
best regards
thomas

PS: I'm using Kalkun 0.4

Cannot display messages if senderNumber starts with plus sign

Hi,

I'm using Kalkun 0.3 running on IIS 7 (Windows 2008 R2) with PHP 5.3.6, MySQL 5.514 and Gammu 1.29.93. When I receive an SMS sent from a number beginning with a plus sign (e.g. +420111111), it gets saved correctly to the database (into table 'inbox'), but when I try to view the conversation, Kalkun tries to open this URL:

http://server/kalkun/index.php/messages/conversation/folder/inbox/+420111111/

But instead of the conversation, I get a 404 Not Found error. When I manually remove the plus sign from the 'senderNumber' column in the 'Inbox' table, the following URL works without problems:

http://server/kalkun/index.php/messages/conversation/folder/inbox/+421111111/

This bug happens in all folders (sent messages, trash, etc.).

Language translation

Hi!

How can i change (propose a change) for newly added language entries?

I always get a 404 when i try propose a change.

Regards
oachkatzlschwaf

API return status

I'm using the API to send sms, is there a status code returned by the API call to indicate whether the SMS was sent successfully or failed? I need to get this return code in my API call to determine the next course of action.

Thanks,
Hendra

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.