Add app/messages
This commit is contained in:
parent
198efe1748
commit
7dae097481
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Messages';
|
||||
$apps[$x]['uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
|
||||
$apps[$x]['category'] = '';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en-us'] = '';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'message_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'message_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'message_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'message_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'message_all';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
//Messages
|
||||
$y = 0;
|
||||
$apps[$x]['db'][$y]['table']['name'] = 'v_messages';
|
||||
$apps[$x]['db'][$y]['table']['parent'] = '';
|
||||
$z = 0;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_users';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'user_uuid';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message type.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_direction';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message direction.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_date';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message date.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_from';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message from.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_to';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message to.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message text.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media type.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_url';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media url.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_content';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media content.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_json';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
|
||||
$z++;
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,580 @@
|
|||
<?php
|
||||
|
||||
//Messages
|
||||
$text['title-messages']['en-us'] = 'Messages';
|
||||
$text['title-messages']['ar-eg'] = '';
|
||||
$text['title-messages']['de-at'] = '';
|
||||
$text['title-messages']['de-ch'] = '';
|
||||
$text['title-messages']['de-de'] = '';
|
||||
$text['title-messages']['es-cl'] = '';
|
||||
$text['title-messages']['es-mx'] = '';
|
||||
$text['title-messages']['fr-ca'] = '';
|
||||
$text['title-messages']['fr-fr'] = '';
|
||||
$text['title-messages']['he-il'] = '';
|
||||
$text['title-messages']['it-it'] = '';
|
||||
$text['title-messages']['nl-nl'] = '';
|
||||
$text['title-messages']['pl-pl'] = '';
|
||||
$text['title-messages']['pt-br'] = '';
|
||||
$text['title-messages']['pt-pt'] = '';
|
||||
$text['title-messages']['ro-ro'] = '';
|
||||
$text['title-messages']['ru-ru'] = '';
|
||||
$text['title-messages']['sv-se'] = '';
|
||||
$text['title-messages']['uk-ua'] = '';
|
||||
|
||||
$text['title-message']['en-us'] = 'Message';
|
||||
$text['title-message']['ar-eg'] = '';
|
||||
$text['title-message']['de-at'] = '';
|
||||
$text['title-message']['de-ch'] = '';
|
||||
$text['title-message']['de-de'] = '';
|
||||
$text['title-message']['es-cl'] = '';
|
||||
$text['title-message']['es-mx'] = '';
|
||||
$text['title-message']['fr-ca'] = '';
|
||||
$text['title-message']['fr-fr'] = '';
|
||||
$text['title-message']['he-il'] = '';
|
||||
$text['title-message']['it-it'] = '';
|
||||
$text['title-message']['nl-nl'] = '';
|
||||
$text['title-message']['pl-pl'] = '';
|
||||
$text['title-message']['pt-br'] = '';
|
||||
$text['title-message']['pt-pt'] = '';
|
||||
$text['title-message']['ro-ro'] = '';
|
||||
$text['title-message']['ru-ru'] = '';
|
||||
$text['title-message']['sv-se'] = '';
|
||||
$text['title-message']['uk-ua'] = '';
|
||||
|
||||
$text['title_description-message']['en-us'] = '';
|
||||
$text['title_description-message']['ar-eg'] = '';
|
||||
$text['title_description-message']['de-at'] = '';
|
||||
$text['title_description-message']['de-ch'] = '';
|
||||
$text['title_description-message']['de-de'] = '';
|
||||
$text['title_description-message']['es-cl'] = '';
|
||||
$text['title_description-message']['es-mx'] = '';
|
||||
$text['title_description-message']['fr-ca'] = '';
|
||||
$text['title_description-message']['fr-fr'] = '';
|
||||
$text['title_description-message']['he-il'] = '';
|
||||
$text['title_description-message']['it-it'] = '';
|
||||
$text['title_description-message']['nl-nl'] = '';
|
||||
$text['title_description-message']['pl-pl'] = '';
|
||||
$text['title_description-message']['pt-br'] = '';
|
||||
$text['title_description-message']['pt-pt'] = '';
|
||||
$text['title_description-message']['ro-ro'] = '';
|
||||
$text['title_description-message']['ru-ru'] = '';
|
||||
$text['title_description-message']['sv-se'] = '';
|
||||
$text['title_description-message']['uk-ua'] = '';
|
||||
|
||||
$text['label-extension_uuid']['en-us'] = 'Extension';
|
||||
$text['label-extension_uuid']['ar-eg'] = '';
|
||||
$text['label-extension_uuid']['de-at'] = '';
|
||||
$text['label-extension_uuid']['de-ch'] = '';
|
||||
$text['label-extension_uuid']['de-de'] = '';
|
||||
$text['label-extension_uuid']['es-cl'] = '';
|
||||
$text['label-extension_uuid']['es-mx'] = '';
|
||||
$text['label-extension_uuid']['fr-ca'] = '';
|
||||
$text['label-extension_uuid']['fr-fr'] = '';
|
||||
$text['label-extension_uuid']['he-il'] = '';
|
||||
$text['label-extension_uuid']['it-it'] = '';
|
||||
$text['label-extension_uuid']['nl-nl'] = '';
|
||||
$text['label-extension_uuid']['pl-pl'] = '';
|
||||
$text['label-extension_uuid']['pt-br'] = '';
|
||||
$text['label-extension_uuid']['pt-pt'] = '';
|
||||
$text['label-extension_uuid']['ro-ro'] = '';
|
||||
$text['label-extension_uuid']['ru-ru'] = '';
|
||||
$text['label-extension_uuid']['sv-se'] = '';
|
||||
$text['label-extension_uuid']['uk-ua'] = '';
|
||||
|
||||
$text['description-extension_uuid']['en-us'] = 'Enter the extension uuid.';
|
||||
$text['description-extension_uuid']['ar-eg'] = '';
|
||||
$text['description-extension_uuid']['de-at'] = '';
|
||||
$text['description-extension_uuid']['de-ch'] = '';
|
||||
$text['description-extension_uuid']['de-de'] = '';
|
||||
$text['description-extension_uuid']['es-cl'] = '';
|
||||
$text['description-extension_uuid']['es-mx'] = '';
|
||||
$text['description-extension_uuid']['fr-ca'] = '';
|
||||
$text['description-extension_uuid']['fr-fr'] = '';
|
||||
$text['description-extension_uuid']['he-il'] = '';
|
||||
$text['description-extension_uuid']['it-it'] = '';
|
||||
$text['description-extension_uuid']['nl-nl'] = '';
|
||||
$text['description-extension_uuid']['pl-pl'] = '';
|
||||
$text['description-extension_uuid']['pt-br'] = '';
|
||||
$text['description-extension_uuid']['pt-pt'] = '';
|
||||
$text['description-extension_uuid']['ro-ro'] = '';
|
||||
$text['description-extension_uuid']['ru-ru'] = '';
|
||||
$text['description-extension_uuid']['sv-se'] = '';
|
||||
$text['description-extension_uuid']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_type']['en-us'] = 'Type';
|
||||
$text['label-message_type']['ar-eg'] = '';
|
||||
$text['label-message_type']['de-at'] = '';
|
||||
$text['label-message_type']['de-ch'] = '';
|
||||
$text['label-message_type']['de-de'] = '';
|
||||
$text['label-message_type']['es-cl'] = '';
|
||||
$text['label-message_type']['es-mx'] = '';
|
||||
$text['label-message_type']['fr-ca'] = '';
|
||||
$text['label-message_type']['fr-fr'] = '';
|
||||
$text['label-message_type']['he-il'] = '';
|
||||
$text['label-message_type']['it-it'] = '';
|
||||
$text['label-message_type']['nl-nl'] = '';
|
||||
$text['label-message_type']['pl-pl'] = '';
|
||||
$text['label-message_type']['pt-br'] = '';
|
||||
$text['label-message_type']['pt-pt'] = '';
|
||||
$text['label-message_type']['ro-ro'] = '';
|
||||
$text['label-message_type']['ru-ru'] = '';
|
||||
$text['label-message_type']['sv-se'] = '';
|
||||
$text['label-message_type']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_type']['en-us'] = 'Enter the message type.';
|
||||
$text['description-message_type']['ar-eg'] = '';
|
||||
$text['description-message_type']['de-at'] = '';
|
||||
$text['description-message_type']['de-ch'] = '';
|
||||
$text['description-message_type']['de-de'] = '';
|
||||
$text['description-message_type']['es-cl'] = '';
|
||||
$text['description-message_type']['es-mx'] = '';
|
||||
$text['description-message_type']['fr-ca'] = '';
|
||||
$text['description-message_type']['fr-fr'] = '';
|
||||
$text['description-message_type']['he-il'] = '';
|
||||
$text['description-message_type']['it-it'] = '';
|
||||
$text['description-message_type']['nl-nl'] = '';
|
||||
$text['description-message_type']['pl-pl'] = '';
|
||||
$text['description-message_type']['pt-br'] = '';
|
||||
$text['description-message_type']['pt-pt'] = '';
|
||||
$text['description-message_type']['ro-ro'] = '';
|
||||
$text['description-message_type']['ru-ru'] = '';
|
||||
$text['description-message_type']['sv-se'] = '';
|
||||
$text['description-message_type']['uk-ua'] = '';
|
||||
|
||||
$text['label-sms']['en-us'] = 'sms';
|
||||
$text['label-sms']['ar-eg'] = '';
|
||||
$text['label-sms']['de-at'] = '';
|
||||
$text['label-sms']['de-ch'] = '';
|
||||
$text['label-sms']['de-de'] = '';
|
||||
$text['label-sms']['es-mx'] = '';
|
||||
$text['label-sms']['fr-ca'] = '';
|
||||
$text['label-sms']['fr-fr'] = '';
|
||||
$text['label-sms']['he-il'] = '';
|
||||
$text['label-sms']['it-it'] = '';
|
||||
$text['label-sms']['nl-nl'] = '';
|
||||
$text['label-sms']['pl-pl'] = '';
|
||||
$text['label-sms']['pt-br'] = '';
|
||||
$text['label-sms']['pt-pt'] = '';
|
||||
$text['label-sms']['ro-ro'] = '';
|
||||
$text['label-sms']['ru-ru'] = '';
|
||||
$text['label-sms']['sv-se'] = '';
|
||||
$text['label-sms']['uk-ua'] = '';
|
||||
|
||||
$text['label-chat']['en-us'] = 'chat';
|
||||
$text['label-chat']['ar-eg'] = '';
|
||||
$text['label-chat']['de-at'] = '';
|
||||
$text['label-chat']['de-ch'] = '';
|
||||
$text['label-chat']['de-de'] = '';
|
||||
$text['label-chat']['es-mx'] = '';
|
||||
$text['label-chat']['fr-ca'] = '';
|
||||
$text['label-chat']['fr-fr'] = '';
|
||||
$text['label-chat']['he-il'] = '';
|
||||
$text['label-chat']['it-it'] = '';
|
||||
$text['label-chat']['nl-nl'] = '';
|
||||
$text['label-chat']['pl-pl'] = '';
|
||||
$text['label-chat']['pt-br'] = '';
|
||||
$text['label-chat']['pt-pt'] = '';
|
||||
$text['label-chat']['ro-ro'] = '';
|
||||
$text['label-chat']['ru-ru'] = '';
|
||||
$text['label-chat']['sv-se'] = '';
|
||||
$text['label-chat']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_direction']['en-us'] = 'Direction';
|
||||
$text['label-message_direction']['ar-eg'] = '';
|
||||
$text['label-message_direction']['de-at'] = '';
|
||||
$text['label-message_direction']['de-ch'] = '';
|
||||
$text['label-message_direction']['de-de'] = '';
|
||||
$text['label-message_direction']['es-cl'] = '';
|
||||
$text['label-message_direction']['es-mx'] = '';
|
||||
$text['label-message_direction']['fr-ca'] = '';
|
||||
$text['label-message_direction']['fr-fr'] = '';
|
||||
$text['label-message_direction']['he-il'] = '';
|
||||
$text['label-message_direction']['it-it'] = '';
|
||||
$text['label-message_direction']['nl-nl'] = '';
|
||||
$text['label-message_direction']['pl-pl'] = '';
|
||||
$text['label-message_direction']['pt-br'] = '';
|
||||
$text['label-message_direction']['pt-pt'] = '';
|
||||
$text['label-message_direction']['ro-ro'] = '';
|
||||
$text['label-message_direction']['ru-ru'] = '';
|
||||
$text['label-message_direction']['sv-se'] = '';
|
||||
$text['label-message_direction']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_direction']['en-us'] = 'Enter the message direction.';
|
||||
$text['description-message_direction']['ar-eg'] = '';
|
||||
$text['description-message_direction']['de-at'] = '';
|
||||
$text['description-message_direction']['de-ch'] = '';
|
||||
$text['description-message_direction']['de-de'] = '';
|
||||
$text['description-message_direction']['es-cl'] = '';
|
||||
$text['description-message_direction']['es-mx'] = '';
|
||||
$text['description-message_direction']['fr-ca'] = '';
|
||||
$text['description-message_direction']['fr-fr'] = '';
|
||||
$text['description-message_direction']['he-il'] = '';
|
||||
$text['description-message_direction']['it-it'] = '';
|
||||
$text['description-message_direction']['nl-nl'] = '';
|
||||
$text['description-message_direction']['pl-pl'] = '';
|
||||
$text['description-message_direction']['pt-br'] = '';
|
||||
$text['description-message_direction']['pt-pt'] = '';
|
||||
$text['description-message_direction']['ro-ro'] = '';
|
||||
$text['description-message_direction']['ru-ru'] = '';
|
||||
$text['description-message_direction']['sv-se'] = '';
|
||||
$text['description-message_direction']['uk-ua'] = '';
|
||||
|
||||
$text['label-inbound']['en-us'] = 'inbound';
|
||||
$text['label-inbound']['ar-eg'] = '';
|
||||
$text['label-inbound']['de-at'] = '';
|
||||
$text['label-inbound']['de-ch'] = '';
|
||||
$text['label-inbound']['de-de'] = '';
|
||||
$text['label-inbound']['es-mx'] = '';
|
||||
$text['label-inbound']['fr-ca'] = '';
|
||||
$text['label-inbound']['fr-fr'] = '';
|
||||
$text['label-inbound']['he-il'] = '';
|
||||
$text['label-inbound']['it-it'] = '';
|
||||
$text['label-inbound']['nl-nl'] = '';
|
||||
$text['label-inbound']['pl-pl'] = '';
|
||||
$text['label-inbound']['pt-br'] = '';
|
||||
$text['label-inbound']['pt-pt'] = '';
|
||||
$text['label-inbound']['ro-ro'] = '';
|
||||
$text['label-inbound']['ru-ru'] = '';
|
||||
$text['label-inbound']['sv-se'] = '';
|
||||
$text['label-inbound']['uk-ua'] = '';
|
||||
|
||||
$text['label-outbound']['en-us'] = 'outbound';
|
||||
$text['label-outbound']['ar-eg'] = '';
|
||||
$text['label-outbound']['de-at'] = '';
|
||||
$text['label-outbound']['de-ch'] = '';
|
||||
$text['label-outbound']['de-de'] = '';
|
||||
$text['label-outbound']['es-mx'] = '';
|
||||
$text['label-outbound']['fr-ca'] = '';
|
||||
$text['label-outbound']['fr-fr'] = '';
|
||||
$text['label-outbound']['he-il'] = '';
|
||||
$text['label-outbound']['it-it'] = '';
|
||||
$text['label-outbound']['nl-nl'] = '';
|
||||
$text['label-outbound']['pl-pl'] = '';
|
||||
$text['label-outbound']['pt-br'] = '';
|
||||
$text['label-outbound']['pt-pt'] = '';
|
||||
$text['label-outbound']['ro-ro'] = '';
|
||||
$text['label-outbound']['ru-ru'] = '';
|
||||
$text['label-outbound']['sv-se'] = '';
|
||||
$text['label-outbound']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_date']['en-us'] = 'Date';
|
||||
$text['label-message_date']['ar-eg'] = '';
|
||||
$text['label-message_date']['de-at'] = '';
|
||||
$text['label-message_date']['de-ch'] = '';
|
||||
$text['label-message_date']['de-de'] = '';
|
||||
$text['label-message_date']['es-cl'] = '';
|
||||
$text['label-message_date']['es-mx'] = '';
|
||||
$text['label-message_date']['fr-ca'] = '';
|
||||
$text['label-message_date']['fr-fr'] = '';
|
||||
$text['label-message_date']['he-il'] = '';
|
||||
$text['label-message_date']['it-it'] = '';
|
||||
$text['label-message_date']['nl-nl'] = '';
|
||||
$text['label-message_date']['pl-pl'] = '';
|
||||
$text['label-message_date']['pt-br'] = '';
|
||||
$text['label-message_date']['pt-pt'] = '';
|
||||
$text['label-message_date']['ro-ro'] = '';
|
||||
$text['label-message_date']['ru-ru'] = '';
|
||||
$text['label-message_date']['sv-se'] = '';
|
||||
$text['label-message_date']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_date']['en-us'] = 'Enter the message date.';
|
||||
$text['description-message_date']['ar-eg'] = '';
|
||||
$text['description-message_date']['de-at'] = '';
|
||||
$text['description-message_date']['de-ch'] = '';
|
||||
$text['description-message_date']['de-de'] = '';
|
||||
$text['description-message_date']['es-cl'] = '';
|
||||
$text['description-message_date']['es-mx'] = '';
|
||||
$text['description-message_date']['fr-ca'] = '';
|
||||
$text['description-message_date']['fr-fr'] = '';
|
||||
$text['description-message_date']['he-il'] = '';
|
||||
$text['description-message_date']['it-it'] = '';
|
||||
$text['description-message_date']['nl-nl'] = '';
|
||||
$text['description-message_date']['pl-pl'] = '';
|
||||
$text['description-message_date']['pt-br'] = '';
|
||||
$text['description-message_date']['pt-pt'] = '';
|
||||
$text['description-message_date']['ro-ro'] = '';
|
||||
$text['description-message_date']['ru-ru'] = '';
|
||||
$text['description-message_date']['sv-se'] = '';
|
||||
$text['description-message_date']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_from']['en-us'] = 'From';
|
||||
$text['label-message_from']['ar-eg'] = '';
|
||||
$text['label-message_from']['de-at'] = '';
|
||||
$text['label-message_from']['de-ch'] = '';
|
||||
$text['label-message_from']['de-de'] = '';
|
||||
$text['label-message_from']['es-cl'] = '';
|
||||
$text['label-message_from']['es-mx'] = '';
|
||||
$text['label-message_from']['fr-ca'] = '';
|
||||
$text['label-message_from']['fr-fr'] = '';
|
||||
$text['label-message_from']['he-il'] = '';
|
||||
$text['label-message_from']['it-it'] = '';
|
||||
$text['label-message_from']['nl-nl'] = '';
|
||||
$text['label-message_from']['pl-pl'] = '';
|
||||
$text['label-message_from']['pt-br'] = '';
|
||||
$text['label-message_from']['pt-pt'] = '';
|
||||
$text['label-message_from']['ro-ro'] = '';
|
||||
$text['label-message_from']['ru-ru'] = '';
|
||||
$text['label-message_from']['sv-se'] = '';
|
||||
$text['label-message_from']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_from']['en-us'] = 'Enter the message from.';
|
||||
$text['description-message_from']['ar-eg'] = '';
|
||||
$text['description-message_from']['de-at'] = '';
|
||||
$text['description-message_from']['de-ch'] = '';
|
||||
$text['description-message_from']['de-de'] = '';
|
||||
$text['description-message_from']['es-cl'] = '';
|
||||
$text['description-message_from']['es-mx'] = '';
|
||||
$text['description-message_from']['fr-ca'] = '';
|
||||
$text['description-message_from']['fr-fr'] = '';
|
||||
$text['description-message_from']['he-il'] = '';
|
||||
$text['description-message_from']['it-it'] = '';
|
||||
$text['description-message_from']['nl-nl'] = '';
|
||||
$text['description-message_from']['pl-pl'] = '';
|
||||
$text['description-message_from']['pt-br'] = '';
|
||||
$text['description-message_from']['pt-pt'] = '';
|
||||
$text['description-message_from']['ro-ro'] = '';
|
||||
$text['description-message_from']['ru-ru'] = '';
|
||||
$text['description-message_from']['sv-se'] = '';
|
||||
$text['description-message_from']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_to']['en-us'] = 'To';
|
||||
$text['label-message_to']['ar-eg'] = '';
|
||||
$text['label-message_to']['de-at'] = '';
|
||||
$text['label-message_to']['de-ch'] = '';
|
||||
$text['label-message_to']['de-de'] = '';
|
||||
$text['label-message_to']['es-cl'] = '';
|
||||
$text['label-message_to']['es-mx'] = '';
|
||||
$text['label-message_to']['fr-ca'] = '';
|
||||
$text['label-message_to']['fr-fr'] = '';
|
||||
$text['label-message_to']['he-il'] = '';
|
||||
$text['label-message_to']['it-it'] = '';
|
||||
$text['label-message_to']['nl-nl'] = '';
|
||||
$text['label-message_to']['pl-pl'] = '';
|
||||
$text['label-message_to']['pt-br'] = '';
|
||||
$text['label-message_to']['pt-pt'] = '';
|
||||
$text['label-message_to']['ro-ro'] = '';
|
||||
$text['label-message_to']['ru-ru'] = '';
|
||||
$text['label-message_to']['sv-se'] = '';
|
||||
$text['label-message_to']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_to']['en-us'] = 'Enter the message to.';
|
||||
$text['description-message_to']['ar-eg'] = '';
|
||||
$text['description-message_to']['de-at'] = '';
|
||||
$text['description-message_to']['de-ch'] = '';
|
||||
$text['description-message_to']['de-de'] = '';
|
||||
$text['description-message_to']['es-cl'] = '';
|
||||
$text['description-message_to']['es-mx'] = '';
|
||||
$text['description-message_to']['fr-ca'] = '';
|
||||
$text['description-message_to']['fr-fr'] = '';
|
||||
$text['description-message_to']['he-il'] = '';
|
||||
$text['description-message_to']['it-it'] = '';
|
||||
$text['description-message_to']['nl-nl'] = '';
|
||||
$text['description-message_to']['pl-pl'] = '';
|
||||
$text['description-message_to']['pt-br'] = '';
|
||||
$text['description-message_to']['pt-pt'] = '';
|
||||
$text['description-message_to']['ro-ro'] = '';
|
||||
$text['description-message_to']['ru-ru'] = '';
|
||||
$text['description-message_to']['sv-se'] = '';
|
||||
$text['description-message_to']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_text']['en-us'] = 'Text';
|
||||
$text['label-message_text']['ar-eg'] = '';
|
||||
$text['label-message_text']['de-at'] = '';
|
||||
$text['label-message_text']['de-ch'] = '';
|
||||
$text['label-message_text']['de-de'] = '';
|
||||
$text['label-message_text']['es-cl'] = '';
|
||||
$text['label-message_text']['es-mx'] = '';
|
||||
$text['label-message_text']['fr-ca'] = '';
|
||||
$text['label-message_text']['fr-fr'] = '';
|
||||
$text['label-message_text']['he-il'] = '';
|
||||
$text['label-message_text']['it-it'] = '';
|
||||
$text['label-message_text']['nl-nl'] = '';
|
||||
$text['label-message_text']['pl-pl'] = '';
|
||||
$text['label-message_text']['pt-br'] = '';
|
||||
$text['label-message_text']['pt-pt'] = '';
|
||||
$text['label-message_text']['ro-ro'] = '';
|
||||
$text['label-message_text']['ru-ru'] = '';
|
||||
$text['label-message_text']['sv-se'] = '';
|
||||
$text['label-message_text']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_text']['en-us'] = 'Enter the message text.';
|
||||
$text['description-message_text']['ar-eg'] = '';
|
||||
$text['description-message_text']['de-at'] = '';
|
||||
$text['description-message_text']['de-ch'] = '';
|
||||
$text['description-message_text']['de-de'] = '';
|
||||
$text['description-message_text']['es-cl'] = '';
|
||||
$text['description-message_text']['es-mx'] = '';
|
||||
$text['description-message_text']['fr-ca'] = '';
|
||||
$text['description-message_text']['fr-fr'] = '';
|
||||
$text['description-message_text']['he-il'] = '';
|
||||
$text['description-message_text']['it-it'] = '';
|
||||
$text['description-message_text']['nl-nl'] = '';
|
||||
$text['description-message_text']['pl-pl'] = '';
|
||||
$text['description-message_text']['pt-br'] = '';
|
||||
$text['description-message_text']['pt-pt'] = '';
|
||||
$text['description-message_text']['ro-ro'] = '';
|
||||
$text['description-message_text']['ru-ru'] = '';
|
||||
$text['description-message_text']['sv-se'] = '';
|
||||
$text['description-message_text']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_media_type']['en-us'] = 'Media Type';
|
||||
$text['label-message_media_type']['ar-eg'] = '';
|
||||
$text['label-message_media_type']['de-at'] = '';
|
||||
$text['label-message_media_type']['de-ch'] = '';
|
||||
$text['label-message_media_type']['de-de'] = '';
|
||||
$text['label-message_media_type']['es-cl'] = '';
|
||||
$text['label-message_media_type']['es-mx'] = '';
|
||||
$text['label-message_media_type']['fr-ca'] = '';
|
||||
$text['label-message_media_type']['fr-fr'] = '';
|
||||
$text['label-message_media_type']['he-il'] = '';
|
||||
$text['label-message_media_type']['it-it'] = '';
|
||||
$text['label-message_media_type']['nl-nl'] = '';
|
||||
$text['label-message_media_type']['pl-pl'] = '';
|
||||
$text['label-message_media_type']['pt-br'] = '';
|
||||
$text['label-message_media_type']['pt-pt'] = '';
|
||||
$text['label-message_media_type']['ro-ro'] = '';
|
||||
$text['label-message_media_type']['ru-ru'] = '';
|
||||
$text['label-message_media_type']['sv-se'] = '';
|
||||
$text['label-message_media_type']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_media_type']['en-us'] = 'Enter the message media type.';
|
||||
$text['description-message_media_type']['ar-eg'] = '';
|
||||
$text['description-message_media_type']['de-at'] = '';
|
||||
$text['description-message_media_type']['de-ch'] = '';
|
||||
$text['description-message_media_type']['de-de'] = '';
|
||||
$text['description-message_media_type']['es-cl'] = '';
|
||||
$text['description-message_media_type']['es-mx'] = '';
|
||||
$text['description-message_media_type']['fr-ca'] = '';
|
||||
$text['description-message_media_type']['fr-fr'] = '';
|
||||
$text['description-message_media_type']['he-il'] = '';
|
||||
$text['description-message_media_type']['it-it'] = '';
|
||||
$text['description-message_media_type']['nl-nl'] = '';
|
||||
$text['description-message_media_type']['pl-pl'] = '';
|
||||
$text['description-message_media_type']['pt-br'] = '';
|
||||
$text['description-message_media_type']['pt-pt'] = '';
|
||||
$text['description-message_media_type']['ro-ro'] = '';
|
||||
$text['description-message_media_type']['ru-ru'] = '';
|
||||
$text['description-message_media_type']['sv-se'] = '';
|
||||
$text['description-message_media_type']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_media_url']['en-us'] = 'Media Url';
|
||||
$text['label-message_media_url']['ar-eg'] = '';
|
||||
$text['label-message_media_url']['de-at'] = '';
|
||||
$text['label-message_media_url']['de-ch'] = '';
|
||||
$text['label-message_media_url']['de-de'] = '';
|
||||
$text['label-message_media_url']['es-cl'] = '';
|
||||
$text['label-message_media_url']['es-mx'] = '';
|
||||
$text['label-message_media_url']['fr-ca'] = '';
|
||||
$text['label-message_media_url']['fr-fr'] = '';
|
||||
$text['label-message_media_url']['he-il'] = '';
|
||||
$text['label-message_media_url']['it-it'] = '';
|
||||
$text['label-message_media_url']['nl-nl'] = '';
|
||||
$text['label-message_media_url']['pl-pl'] = '';
|
||||
$text['label-message_media_url']['pt-br'] = '';
|
||||
$text['label-message_media_url']['pt-pt'] = '';
|
||||
$text['label-message_media_url']['ro-ro'] = '';
|
||||
$text['label-message_media_url']['ru-ru'] = '';
|
||||
$text['label-message_media_url']['sv-se'] = '';
|
||||
$text['label-message_media_url']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_media_url']['en-us'] = 'Enter the message media url.';
|
||||
$text['description-message_media_url']['ar-eg'] = '';
|
||||
$text['description-message_media_url']['de-at'] = '';
|
||||
$text['description-message_media_url']['de-ch'] = '';
|
||||
$text['description-message_media_url']['de-de'] = '';
|
||||
$text['description-message_media_url']['es-cl'] = '';
|
||||
$text['description-message_media_url']['es-mx'] = '';
|
||||
$text['description-message_media_url']['fr-ca'] = '';
|
||||
$text['description-message_media_url']['fr-fr'] = '';
|
||||
$text['description-message_media_url']['he-il'] = '';
|
||||
$text['description-message_media_url']['it-it'] = '';
|
||||
$text['description-message_media_url']['nl-nl'] = '';
|
||||
$text['description-message_media_url']['pl-pl'] = '';
|
||||
$text['description-message_media_url']['pt-br'] = '';
|
||||
$text['description-message_media_url']['pt-pt'] = '';
|
||||
$text['description-message_media_url']['ro-ro'] = '';
|
||||
$text['description-message_media_url']['ru-ru'] = '';
|
||||
$text['description-message_media_url']['sv-se'] = '';
|
||||
$text['description-message_media_url']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_media_content']['en-us'] = 'Message Media Content';
|
||||
$text['label-message_media_content']['ar-eg'] = '';
|
||||
$text['label-message_media_content']['de-at'] = '';
|
||||
$text['label-message_media_content']['de-ch'] = '';
|
||||
$text['label-message_media_content']['de-de'] = '';
|
||||
$text['label-message_media_content']['es-cl'] = '';
|
||||
$text['label-message_media_content']['es-mx'] = '';
|
||||
$text['label-message_media_content']['fr-ca'] = '';
|
||||
$text['label-message_media_content']['fr-fr'] = '';
|
||||
$text['label-message_media_content']['he-il'] = '';
|
||||
$text['label-message_media_content']['it-it'] = '';
|
||||
$text['label-message_media_content']['nl-nl'] = '';
|
||||
$text['label-message_media_content']['pl-pl'] = '';
|
||||
$text['label-message_media_content']['pt-br'] = '';
|
||||
$text['label-message_media_content']['pt-pt'] = '';
|
||||
$text['label-message_media_content']['ro-ro'] = '';
|
||||
$text['label-message_media_content']['ru-ru'] = '';
|
||||
$text['label-message_media_content']['sv-se'] = '';
|
||||
$text['label-message_media_content']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_media_content']['en-us'] = 'Enter the message media content.';
|
||||
$text['description-message_media_content']['ar-eg'] = '';
|
||||
$text['description-message_media_content']['de-at'] = '';
|
||||
$text['description-message_media_content']['de-ch'] = '';
|
||||
$text['description-message_media_content']['de-de'] = '';
|
||||
$text['description-message_media_content']['es-cl'] = '';
|
||||
$text['description-message_media_content']['es-mx'] = '';
|
||||
$text['description-message_media_content']['fr-ca'] = '';
|
||||
$text['description-message_media_content']['fr-fr'] = '';
|
||||
$text['description-message_media_content']['he-il'] = '';
|
||||
$text['description-message_media_content']['it-it'] = '';
|
||||
$text['description-message_media_content']['nl-nl'] = '';
|
||||
$text['description-message_media_content']['pl-pl'] = '';
|
||||
$text['description-message_media_content']['pt-br'] = '';
|
||||
$text['description-message_media_content']['pt-pt'] = '';
|
||||
$text['description-message_media_content']['ro-ro'] = '';
|
||||
$text['description-message_media_content']['ru-ru'] = '';
|
||||
$text['description-message_media_content']['sv-se'] = '';
|
||||
$text['description-message_media_content']['uk-ua'] = '';
|
||||
|
||||
$text['label-message_json']['en-us'] = 'JSON';
|
||||
$text['label-message_json']['ar-eg'] = '';
|
||||
$text['label-message_json']['de-at'] = '';
|
||||
$text['label-message_json']['de-ch'] = '';
|
||||
$text['label-message_json']['de-de'] = '';
|
||||
$text['label-message_json']['es-cl'] = '';
|
||||
$text['label-message_json']['es-mx'] = '';
|
||||
$text['label-message_json']['fr-ca'] = '';
|
||||
$text['label-message_json']['fr-fr'] = '';
|
||||
$text['label-message_json']['he-il'] = '';
|
||||
$text['label-message_json']['it-it'] = '';
|
||||
$text['label-message_json']['nl-nl'] = '';
|
||||
$text['label-message_json']['pl-pl'] = '';
|
||||
$text['label-message_json']['pt-br'] = '';
|
||||
$text['label-message_json']['pt-pt'] = '';
|
||||
$text['label-message_json']['ro-ro'] = '';
|
||||
$text['label-message_json']['ru-ru'] = '';
|
||||
$text['label-message_json']['sv-se'] = '';
|
||||
$text['label-message_json']['uk-ua'] = '';
|
||||
|
||||
$text['description-message_json']['en-us'] = '';
|
||||
$text['description-message_json']['ar-eg'] = '';
|
||||
$text['description-message_json']['de-at'] = '';
|
||||
$text['description-message_json']['de-ch'] = '';
|
||||
$text['description-message_json']['de-de'] = '';
|
||||
$text['description-message_json']['es-cl'] = '';
|
||||
$text['description-message_json']['es-mx'] = '';
|
||||
$text['description-message_json']['fr-ca'] = '';
|
||||
$text['description-message_json']['fr-fr'] = '';
|
||||
$text['description-message_json']['he-il'] = '';
|
||||
$text['description-message_json']['it-it'] = '';
|
||||
$text['description-message_json']['nl-nl'] = '';
|
||||
$text['description-message_json']['pl-pl'] = '';
|
||||
$text['description-message_json']['pt-br'] = '';
|
||||
$text['description-message_json']['pt-pt'] = '';
|
||||
$text['description-message_json']['ro-ro'] = '';
|
||||
$text['description-message_json']['ru-ru'] = '';
|
||||
$text['description-message_json']['sv-se'] = '';
|
||||
$text['description-message_json']['uk-ua'] = '';
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = 'Messages';
|
||||
$apps[$x]['menu'][0]['title']['es-cl'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr-fr'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
|
||||
$apps[$x]['menu'][0]['title']['pl'] = '';
|
||||
$apps[$x]['menu'][0]['title']['sv-se'] = '';
|
||||
$apps[$x]['menu'][0]['title']['uk'] = '';
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = '';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'b2f6a2e0-cf25-4bd5-8079-6385f6871047';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/app/messages/messages.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['menu'][0]['groups'][] = 'admin';
|
||||
//$apps[$x]['menu'][0]['groups'][] = 'user';
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2016-2018
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//get the user settings
|
||||
$sql = "select user_uuid, domain_uuid from v_user_settings ";
|
||||
$sql .= "where user_setting_category = 'message' ";
|
||||
$sql .= "and user_setting_subcategory = 'key' ";
|
||||
$sql .= "and user_setting_value = :key ";
|
||||
$sql .= "and user_setting_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->bindParam(':key', $_GET['key']);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_NAMED);
|
||||
}
|
||||
|
||||
//default authorized to false
|
||||
$authorized = 'false';
|
||||
|
||||
//get the user
|
||||
if (isset($row['user_uuid']) && strlen($row['user_uuid']) > 0) {
|
||||
$domain_uuid = $row['domain_uuid'];
|
||||
$user_uuid = $row['user_uuid'];
|
||||
$authorized = 'true';
|
||||
}
|
||||
|
||||
//authorization failed
|
||||
if ($authorized == 'false') {
|
||||
//log the failed auth attempt to the system, to be available for fail2ban.
|
||||
openlog('FusionPBX', LOG_NDELAY, LOG_AUTH);
|
||||
syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] authentication failed for ".$_GET['key']);
|
||||
closelog();
|
||||
|
||||
//send http 404
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
echo "<html>\n";
|
||||
echo "<head><title>404 Not Found</title></head>\n";
|
||||
echo "<body bgcolor=\"white\">\n";
|
||||
echo "<center><h1>404 Not Found</h1></center>\n";
|
||||
echo "<hr><center>nginx/1.12.1</center>\n";
|
||||
echo "</body>\n";
|
||||
echo "</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
//get the data
|
||||
$json = file_get_contents('php://input');
|
||||
|
||||
//decode the json
|
||||
$message = json_decode($json, true);
|
||||
|
||||
//get a unique id
|
||||
$message_uuid = uuid();
|
||||
|
||||
//get the source phone number
|
||||
$phone_number = $message["from"];
|
||||
$phone_number = preg_replace('{[\D]}', '', $phone_number);
|
||||
|
||||
//get the contact uuid
|
||||
//$sql = "SELECT trim(c.contact_name_given || ' ' || c.contact_name_family || ' (' || c.contact_organization || ')') AS name, p.phone_number AS number ";
|
||||
$sql = "SELECT c.contact_uuid ";
|
||||
$sql .= "FROM v_contacts as c, v_contact_phones as p ";
|
||||
$sql .= "WHERE p.contact_uuid = c.contact_uuid ";
|
||||
//$sql .= "and p.phone_number = :phone_number ";
|
||||
$sql .= "and p.phone_number = '".$phone_number."' ";
|
||||
$sql .= "and c.domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
//$prep_statement->bindParam(':phone_number', $phone_number);
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_NAMED);
|
||||
$contact_uuid = $row['contact_uuid'];
|
||||
|
||||
//build the array
|
||||
$array['messages'][0]["domain_uuid"] = $domain_uuid;
|
||||
$array['messages'][0]["user_uuid"] = $user_uuid;
|
||||
$array['messages'][0]["contact_uuid"] = $contact_uuid;
|
||||
$array['messages'][0]['message_uuid'] = $message_uuid;
|
||||
$array['messages'][0]['message_json'] = $json;
|
||||
$array['messages'][0]['message_direction'] = 'inbound';
|
||||
$array['messages'][0]['message_date'] = 'now()';
|
||||
$array['messages'][0]['message_type'] = 'sms';
|
||||
$array['messages'][0]['message_from'] = $message["from"];
|
||||
$array['messages'][0]['message_to'] = $message["to"];
|
||||
$array['messages'][0]['message_text'] = $message["text"];
|
||||
|
||||
//get the media
|
||||
if (is_array($message["media"])) {
|
||||
foreach($message["media"] as $media) {
|
||||
$media_extension = pathinfo($media, PATHINFO_EXTENSION);
|
||||
if ($media_extension !== "xml") {
|
||||
$array['messages'][0]['message_media_type'] = $media_extension;
|
||||
$array['messages'][0]['message_media_url'] = $media;
|
||||
$array['messages'][0]['message_media_content'] = base64_encode(file_get_contents($media));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//convert the array to json
|
||||
$array_json = json_encode($array);
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p->add("message_add", "temp");
|
||||
|
||||
//save to the data
|
||||
$database = new database;
|
||||
$database->app_name = 'messages';
|
||||
$database->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
|
||||
$database->uuid($message_uuid);
|
||||
$database->save($array);
|
||||
$result = $database->message;
|
||||
|
||||
//remove the temporary permission
|
||||
$p->delete("message_add", "temp");
|
||||
|
||||
//get the list of extensions using the user_uuid
|
||||
//$user_uuid
|
||||
|
||||
//forward the messages over SIP
|
||||
//
|
||||
|
||||
//create the event socket connection
|
||||
//$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
//if ($fp) {
|
||||
//prepare the command
|
||||
// $command = "";
|
||||
//send the command
|
||||
// $response = event_socket_request($fp, "api ".$command);
|
||||
// $response = event_socket_request($fp, "api log notice ".$command);
|
||||
//close the connection
|
||||
// fclose($fp);
|
||||
//}
|
||||
|
||||
|
||||
//set the file
|
||||
//$file = '/tmp/sms.txt';
|
||||
|
||||
//save the file
|
||||
//file_put_contents($file, $json);
|
||||
|
||||
//save the data to the file system
|
||||
//file_put_contents($file, $json."\n");
|
||||
//file_put_contents($file, $array_json."\nfrom: ".$message["from"]." to: ".$message["to"]." text: ".$message["text"]."\n$sql_test\njson: ".$json."\n".$saved_result."\n");
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2016-2018
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//delete the message
|
||||
messages::add($text['message-delete']);
|
||||
|
||||
//delete the data
|
||||
if (isset($_GET["id"]) && is_uuid($_GET["id"]) && permission_exists('message_delete')) {
|
||||
|
||||
//get the id
|
||||
$id = check_str($_GET["id"]);
|
||||
|
||||
//delete message
|
||||
$sql = "delete from v_messages ";
|
||||
$sql .= "where message_uuid = '$id' ";
|
||||
$sql .= "and domain_uuid = '$domain_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//redirect the user
|
||||
header('Location: messages.php');
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,386 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2016-2018
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//check permissions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('message_add') || permission_exists('message_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$message_uuid = check_str($_REQUEST["id"]);
|
||||
$id = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (is_array($_POST)) {
|
||||
$message_uuid = check_str($_POST["message_uuid"]);
|
||||
//$user_uuid = check_str($_POST["user_uuid"]);
|
||||
$message_type = check_str($_POST["message_type"]);
|
||||
$message_direction = check_str($_POST["message_direction"]);
|
||||
$message_date = check_str($_POST["message_date"]);
|
||||
$message_from = check_str($_POST["message_from"]);
|
||||
$message_to = check_str($_POST["message_to"]);
|
||||
$message_text = check_str($_POST["message_text"]);
|
||||
$message_media_type = check_str($_POST["message_media_type"]);
|
||||
$message_media_url = check_str($_POST["message_media_url"]);
|
||||
$message_media_content = check_str($_POST["message_media_content"]);
|
||||
$message_json = check_str($_POST["message_json"]);
|
||||
}
|
||||
|
||||
//process the user data and save it to the database
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//get the uuid from the POST
|
||||
if ($action == "update") {
|
||||
$message_uuid = check_str($_POST["message_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($user_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-user_uuid']."<br>\n"; }
|
||||
if (strlen($message_type) == 0) { $msg .= $text['message-required']." ".$text['label-message_type']."<br>\n"; }
|
||||
if (strlen($message_direction) == 0) { $msg .= $text['message-required']." ".$text['label-message_direction']."<br>\n"; }
|
||||
if (strlen($message_date) == 0) { $msg .= $text['message-required']." ".$text['label-message_date']."<br>\n"; }
|
||||
if (strlen($message_from) == 0) { $msg .= $text['message-required']." ".$text['label-message_from']."<br>\n"; }
|
||||
if (strlen($message_to) == 0) { $msg .= $text['message-required']." ".$text['label-message_to']."<br>\n"; }
|
||||
//if (strlen($message_text) == 0) { $msg .= $text['message-required']." ".$text['label-message_text']."<br>\n"; }
|
||||
//if (strlen($message_media_type) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_type']."<br>\n"; }
|
||||
//if (strlen($message_media_url) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_url']."<br>\n"; }
|
||||
//if (strlen($message_media_content) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_content']."<br>\n"; }
|
||||
//if (strlen($message_json) == 0) { $msg .= $text['message-required']." ".$text['label-message_json']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//set the domain_uuid
|
||||
$_POST["domain_uuid"] = $_SESSION["domain_uuid"];
|
||||
|
||||
//add the message_uuid
|
||||
if (strlen($_POST["message_uuid"]) == 0) {
|
||||
$message_uuid = uuid();
|
||||
$_POST["message_uuid"] = $message_uuid;
|
||||
}
|
||||
|
||||
//prepare the array
|
||||
$array['messages'][0] = $_POST;
|
||||
|
||||
//save to the data
|
||||
$database = new database;
|
||||
$database->app_name = 'messages';
|
||||
$database->app_uuid = null;
|
||||
if (strlen($message_uuid) > 0) {
|
||||
$database->uuid($message_uuid);
|
||||
}
|
||||
$database->save($array);
|
||||
$message = $database->message;
|
||||
|
||||
//debug info
|
||||
//echo "<pre>";
|
||||
//print_r($message);
|
||||
//echo "</pre>";
|
||||
//exit;
|
||||
|
||||
//redirect the user
|
||||
if (isset($action)) {
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
}
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
header('Location: message_edit.php?id='.$message_uuid);
|
||||
return;
|
||||
}
|
||||
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
|
||||
$message_uuid = check_str($_GET["id"]);
|
||||
$sql = "select * from v_messages ";
|
||||
$sql .= "where message_uuid = '$message_uuid' ";
|
||||
//$sql .= "and domain_uuid = '$domain_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$user_uuid = $row["user_uuid"];
|
||||
$message_type = $row["message_type"];
|
||||
$message_direction = $row["message_direction"];
|
||||
$message_date = $row["message_date"];
|
||||
$message_from = $row["message_from"];
|
||||
$message_to = $row["message_to"];
|
||||
$message_text = $row["message_text"];
|
||||
$message_media_type = $row["message_media_type"];
|
||||
$message_media_url = $row["message_media_url"];
|
||||
$message_media_content = $row["message_media_content"];
|
||||
$message_json = $row["message_json"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
|
||||
//get the extensions
|
||||
$sql = "select * from v_users ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and user_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//get the users
|
||||
$sql = "SELECT user_uuid, username FROM v_users ";
|
||||
$sql .= "WHERE domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "ORDER by username asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
|
||||
//show the content
|
||||
echo "<form name='frm' id='frm' method='post' action=''>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-message']."</b><br><br></td>\n";
|
||||
echo "<td width='70%' align='right' valign='top'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='messages.php'\" value='".$text['button-back']."'>";
|
||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-username']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <select class='formfld' name='user_uuid'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($users as $row) {
|
||||
if ($row['user_uuid'] == $user_uuid) { $selected = "selected='selected'"; } else { $selected = ''; }
|
||||
echo " <option value='".escape($row['user_uuid'])."' $selected>".escape($row['username'])."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-username']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <select class='formfld' name='message_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($message_type == "sms") {
|
||||
echo " <option value='sms' selected='selected'>".$text['label-sms']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='sms'>".$text['label-sms']."</option>\n";
|
||||
}
|
||||
if ($message_type == "chat") {
|
||||
echo " <option value='chat' selected='selected'>".$text['label-chat']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='chat'>".$text['label-chat']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_direction']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <select class='formfld' name='message_direction'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($message_direction == "inbound") {
|
||||
echo " <option value='inbound' selected='selected'>".$text['label-inbound']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='inbound'>".$text['label-inbound']."</option>\n";
|
||||
}
|
||||
if ($message_direction == "outbound") {
|
||||
echo " <option value='outbound' selected='selected'>".$text['label-outbound']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='outbound'>".$text['label-outbound']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_direction']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_date']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_date' maxlength='255' value=\"".escape($message_date)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_date']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_from']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_from' maxlength='255' value=\"".escape($message_from)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_from']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_to']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_to' maxlength='255' value=\"".escape($message_to)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_to']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_text']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_text' maxlength='255' value=\"".escape($message_text)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_text']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (strlen($message_media_type) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " \n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
$image_source = 'data: '.mime_content_type($message_media_type).';base64,'.$message_media_content;
|
||||
echo "<img src='".$image_source."' width='100%'>";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
if ($_GET['debug'] == 'true') {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_media_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_media_type' maxlength='255' value=\"".escape($message_media_type)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_media_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_media_url']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_media_url' maxlength='255' value=\"".escape($message_media_url)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_media_url']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_media_content']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_media_content' maxlength='255' value=\"".escape($message_media_content)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_media_content']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-message_json']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='message_json' maxlength='255' value=\"".escape($message_json)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-message_json']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='message_uuid' value='".escape($message_uuid)."'>\n";
|
||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,273 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2016-2018
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('message_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get the action
|
||||
if (is_array($_POST["messages"])) {
|
||||
$messages = $_POST["messages"];
|
||||
foreach($messages as $row) {
|
||||
if ($row['action'] == 'delete') {
|
||||
$action = 'delete';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//delete the messages
|
||||
if (permission_exists('message_delete')) {
|
||||
if ($action == "delete") {
|
||||
//download
|
||||
$obj = new messages;
|
||||
$obj->delete($messages);
|
||||
//delete message
|
||||
messages::add($text['message-delete']);
|
||||
}
|
||||
}
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = check_str($_GET["order_by"]);
|
||||
$order = check_str($_GET["order"]);
|
||||
|
||||
//add the search term
|
||||
$search = strtolower(check_str($_GET["search"]));
|
||||
if (strlen($search) > 0) {
|
||||
$sql_search = " (";
|
||||
$sql_search .= "lower(message_type) like '%".$search."%' ";
|
||||
$sql_search .= "or lower(message_direction) like '%".$search."%' ";
|
||||
$sql_search .= "or lower(message_date) like '%".$search."%' ";
|
||||
$sql_search .= "or lower(message_from) like '%".$search."%' ";
|
||||
$sql_search .= "or lower(message_to) like '%".$search."%' ";
|
||||
$sql_search .= "or lower(message_text) like '%".$search."%' ";
|
||||
$sql_search .= "or lower(message_media_type) like '%".$search."%' ";
|
||||
$sql_search .= ") ";
|
||||
}
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(message_uuid) as num_rows from v_messages ";
|
||||
if ($_GET['show'] == "all" && permission_exists('message_all')) {
|
||||
if (isset($sql_search)) {
|
||||
$sql .= "where ".$sql_search;
|
||||
}
|
||||
} else {
|
||||
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
|
||||
if (isset($sql_search)) {
|
||||
$sql .= "and ".$sql_search;
|
||||
}
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$param = "&search=".$search;
|
||||
if ($_GET['show'] == "all" && permission_exists('message_all')) {
|
||||
$param .= "&show=all";
|
||||
}
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_messages ";
|
||||
if ($_GET['show'] == "all" && permission_exists('message_all')) {
|
||||
if (isset($sql_search)) {
|
||||
$sql .= "where ".$sql_search;
|
||||
}
|
||||
} else {
|
||||
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
|
||||
if (isset($sql_search)) {
|
||||
$sql .= "and ".$sql_search;
|
||||
}
|
||||
}
|
||||
$sql .= "order by message_date desc ";
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$messages = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//alternate the row style
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//define the checkbox_toggle function
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
echo " function checkbox_toggle(item) {\n";
|
||||
echo " var inputs = document.getElementsByTagName(\"input\");\n";
|
||||
echo " for (var i = 0, max = inputs.length; i < max; i++) {\n";
|
||||
echo " if (inputs[i].type === 'checkbox') {\n";
|
||||
echo " if (document.getElementById('checkbox_all').checked == true) {\n";
|
||||
echo " inputs[i].checked = true;\n";
|
||||
echo " }\n";
|
||||
echo " else {\n";
|
||||
echo " inputs[i].checked = false;\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo "</script>\n";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-messages']."</b></td>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
|
||||
|
||||
if (permission_exists('message_all')) {
|
||||
if ($_GET['show'] == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
else {
|
||||
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='messages.php?show=all';\">\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo " <input type='text' class='txt' style='width: 150px; margin-left: 15px;' name='search' id='search' value='".escape($search)."'>\n";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </form>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<form method='post' action=''>\n";
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
if (is_array($messages)) {
|
||||
$x = 0;
|
||||
foreach($messages as $row) {
|
||||
if ($x == 0) {
|
||||
echo " <th style='width:30px;'>\n";
|
||||
echo " <input type='checkbox' name='checkbox_all' id='checkbox_all' value='' onclick=\"checkbox_toggle();\">\n";
|
||||
echo " </th>\n";
|
||||
echo th_order_by('message_type', $text['label-message_type'], $order_by, $order);
|
||||
echo th_order_by('message_direction', $text['label-message_direction'], $order_by, $order);
|
||||
echo th_order_by('message_date', $text['label-message_date'], $order_by, $order);
|
||||
echo th_order_by('message_from', $text['label-message_from'], $order_by, $order);
|
||||
echo th_order_by('message_to', $text['label-message_to'], $order_by, $order);
|
||||
echo th_order_by('message_text', $text['label-message_text'], $order_by, $order);
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('message_add')) {
|
||||
echo " <a href='message_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
}
|
||||
if (permission_exists('message_edit')) {
|
||||
$tr_link = "href='message_edit.php?id=".escape($row['message_uuid'])."'";
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
//echo " <td valign='top' class=''>".escape($row['user_uuid'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='align: center; padding: 3px 3px 0px 8px;'>\n";
|
||||
echo " <input type='checkbox' name=\"messages[$x][checked]\" id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('chk_all_".$x."').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name=\"messages[$x][message_uuid]\" value='".escape($row['message_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' style=''>".escape($row['message_type'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' style=''>".escape($row['message_direction'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' style=''>".escape($row['message_date'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' style=''>".escape($row['message_from'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' style=''>".escape($row['message_to'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' style=''>".escape($row['message_text'])." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['message_media_type'])." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['message_media_url'])." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['message_media_content'])." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['message_json'])." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('message_edit')) {
|
||||
echo "<a href='message_edit.php?id=".escape($row['message_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('message_delete')) {
|
||||
echo "<button type='submit' class='btn btn-default list_control_icon' name=\"messages[$x][action]\" alt='".$text['button-delete']."' value='delete'><span class='glyphicon glyphicon-remove'></span></button>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $messages);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='8' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('message_add')) {
|
||||
echo "<a href='message_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
}
|
||||
else {
|
||||
echo " ";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo "</form>\n";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* call_recordings class
|
||||
*
|
||||
* @method null download
|
||||
*/
|
||||
if (!class_exists('messages')) {
|
||||
class messages {
|
||||
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//connect to the database if not connected
|
||||
if (!$this->db) {
|
||||
require_once "resources/classes/database.php";
|
||||
$database = new database;
|
||||
$database->connect();
|
||||
$this->db = $database->db;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when there are no references to a particular object
|
||||
* unset the variables used in the class
|
||||
*/
|
||||
public function __destruct() {
|
||||
foreach ($this as $key => $value) {
|
||||
unset($this->$key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete messages
|
||||
*/
|
||||
public function delete($messages) {
|
||||
if (permission_exists('message_delete')) {
|
||||
|
||||
//delete multiple messages
|
||||
if (is_array($messages)) {
|
||||
//get the action
|
||||
foreach($messages as $row) {
|
||||
if ($row['action'] == 'delete') {
|
||||
$action = 'delete';
|
||||
break;
|
||||
}
|
||||
}
|
||||
//delete the checked rows
|
||||
if ($action == 'delete') {
|
||||
foreach($messages as $row) {
|
||||
if ($row['action'] == 'delete' or $row['checked'] == 'true') {
|
||||
$sql = "delete from v_messages ";
|
||||
$sql .= "where message_uuid = '".$row['message_uuid']."'; ";
|
||||
$this->db->query($sql);
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
unset($messages);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //end the delete function
|
||||
|
||||
} //end the class
|
||||
}
|
||||
|
||||
/*
|
||||
$obj = new messages;
|
||||
$obj->delete();
|
||||
*/
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
umask(2);
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if (strpos($_ENV["OS"], "Win") !== false) {
|
||||
define("PATH_SEPARATOR", ";");
|
||||
} else {
|
||||
define("PATH_SEPARATOR", ":");
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
|
||||
if(PHP_SAPI == 'cli'){
|
||||
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
|
||||
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
|
||||
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
|
||||
if (file_exists('/project_root.php')) {
|
||||
$path = '/';
|
||||
} else {
|
||||
$i = 1;
|
||||
$path = '';
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = $path;
|
||||
}else{
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
// try to detect if a project path is being used
|
||||
if (!defined('PROJECT_PATH')) {
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
|
||||
define('PROJECT_PATH', '/fusionpbx');
|
||||
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
|
||||
define('PROJECT_PATH', '');
|
||||
} else {
|
||||
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
|
||||
$i = 1;
|
||||
$path = $_SERVER["DOCUMENT_ROOT"];
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if(!file_exists($path. '/project_root.php')){
|
||||
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
|
||||
}
|
||||
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
|
||||
define('PROJECT_PATH', $project_path);
|
||||
}
|
||||
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue