├── mesiboconfig.php
├── httpheaders.php
├── index.php
├── json.php
├── README.md
├── errorhandler.php
├── COPYRIGHT.md
├── mesibohelper.php
├── api_functions.php
└── mesiboapi.php
/mesiboconfig.php:
--------------------------------------------------------------------------------
1 | = 0) {
5 | $encoded = @json_encode($value, JSON_PRETTY_PRINT);
6 | } else {
7 | $encoded = @json_encode($value);
8 | }
9 | switch (json_last_error()) {
10 | case JSON_ERROR_NONE:
11 | return $encoded;
12 | case JSON_ERROR_DEPTH:
13 | return 'Maximum stack depth exceeded'; // or trigger_error() or throw new Exception()
14 | case JSON_ERROR_STATE_MISMATCH:
15 | return 'Underflow or the modes mismatch'; // or trigger_error() or throw new Exception()
16 | case JSON_ERROR_CTRL_CHAR:
17 | return 'Unexpected control character found';
18 | case JSON_ERROR_SYNTAX:
19 | return 'Syntax error, malformed JSON'; // or trigger_error() or throw new Exception()
20 | case JSON_ERROR_UTF8:
21 | $clean = utf8ize($value);
22 | return safe_json_encode($clean);
23 | default:
24 | return 'Unknown error'; // or trigger_error() or throw new Exception()
25 |
26 | }
27 | }
28 |
29 | function utf8ize($mixed) {
30 | if (is_array($mixed)) {
31 | foreach ($mixed as $key => $value) {
32 | $mixed[$key] = utf8ize($value);
33 | }
34 | } else if (is_string ($mixed)) {
35 | return utf8_encode($mixed);
36 | }
37 | return $mixed;
38 | }
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This repository contains the backend source code for the Mesibo Messenger.
2 |
3 | Mesibo Messenger is an open-source app with real-time messaging, voice and video call features. We have released the entire source code of Mesibo Android and iOS Apps on GitHub, where it can be continuously updated. You can download entire source code, and customize it to suit your needs.
4 |
5 | ### Features
6 | - One-on-one messaging and Group chat
7 | - High quality voice and video calling
8 | - Rich messaging (text, picture, video, audio, other files)
9 | - Encryption
10 | - Location sharing
11 | - Message status and typing indicators
12 | - Online status (presence) and real-time profile update
13 | - Push notifications
14 |
15 | ### Mesibo Android App Source Code
16 | [https://github.com/mesibo/messenger-app-android/](https://github.com/mesibo/messenger-app-android/).
17 |
18 | ### Mesibo iOS App Source Code
19 |
20 | [https://github.com/mesibo/messenger-app-ios/](https://github.com/mesibo/messenger-app-ios/).
21 |
22 | ### Contributing
23 | Contributing to the Mesibo source code can be a rewarding experience. When you
24 | offer feedback, questions, edits, or new content, you help us, the projects you
25 | work on, and the larger Mesibo community.
26 |
27 | We will definitely provide due credits your contribution in source code.
28 |
29 | We also welcome your participation to help make the documentation better!
30 |
31 | There are many ways to contribute:
32 |
33 | - File a code or documentation issue on GitHub at
34 | [https://github.com/mesibo/samples/issues](https://github.com/mesibo/samples/issues).
35 |
36 | - Fork the repository, make changes or add new content on your local
37 | branch, and submit a pull request (PR) to the master branch for the samples.
38 |
39 |
40 |
--------------------------------------------------------------------------------
/errorhandler.php:
--------------------------------------------------------------------------------
1 |
| $type: $message in $file on line $line |
");
29 | }
30 |
31 |
32 | function translateErrorReportingConstant2String()
33 | {
34 | $current = error_reporting();
35 | $out = "";
36 |
37 | if (($current & E_ERROR ) == E_ERROR ){ $out .=" E_ERROR | "; }
38 | if (($current & E_WARNING ) == E_WARNING ){ $out .=" E_WARNING | "; }
39 | if (($current & E_PARSE ) == E_PARSE ){ $out .=" E_PARSE | "; }
40 | if (($current & E_NOTICE ) == E_NOTICE ){ $out .=" E_NOTICE | "; }
41 | if (($current & E_CORE_ERROR ) == E_CORE_ERROR ){ $out .=" E_CORE_ERROR | "; }
42 | if (($current & E_CORE_WARNING ) == E_CORE_WARNING ){ $out .=" E_CORE_WARNING | "; }
43 | if (($current & E_COMPILE_ERROR ) == E_COMPILE_ERROR ){ $out .=" E_COMPILE_ERROR | "; }
44 | if (($current & E_COMPILE_WARNING) == E_COMPILE_WARNING){ $out .=" E_COMPILE_WARNING | "; }
45 | if (($current & E_USER_ERROR ) == E_USER_ERROR ){ $out .=" E_USER_ERROR | "; }
46 | if (($current & E_USER_WARNING ) == E_USER_WARNING ){ $out .=" E_USER_WARNING | "; }
47 | if (($current & E_USER_NOTICE ) == E_USER_NOTICE ){ $out .=" E_USER_NOTICE | "; }
48 | if (($current & E_ALL ) == E_ALL ){ $out .=" E_ALL | "; }
49 | return $out;
50 | }
51 |
--------------------------------------------------------------------------------
/COPYRIGHT.md:
--------------------------------------------------------------------------------
1 | **Copyright (c) 2019 Mesibo
2 | https://mesibo.com
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification,
6 | are permitted provided that the terms and condition mentioned on https://mesibo.com
7 | as well as following conditions are met:
8 |
9 | - Redistributions of source code must retain the above copyright notice, this list
10 | of conditions, the following disclaimer and links to documentation and source code
11 | repository.
12 |
13 | - Redistributions in binary form must reproduce the above copyright notice, this
14 | list of conditions and the following disclaimer in the documentation and/or other
15 | materials provided with the distribution.
16 |
17 | - Neither the name of Mesibo nor the names of its contributors may be used to endorse
18 | or promote products derived from this software without specific prior written
19 | permission.
20 |
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 | IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 |
33 | Documentation
34 | https://mesibo.com/documentation/
35 |
36 | Source Code Repository
37 | https://github.com/mesibo/messenger-app-backend
38 |
39 | Android App Source code Repository
40 | https://github.com/mesibo/messenger-app-android
41 |
42 | iOS App Source code Repository
43 | https://github.com/mesibo/messenger-app-ios
44 |
45 |
46 |
--------------------------------------------------------------------------------
/mesibohelper.php:
--------------------------------------------------------------------------------
1 | array(
69 | 'method'=>"GET",
70 | 'header'=>"Accept-language: en\r\n" .
71 | "Cookie: foo=bar\r\n"
72 | )
73 | );
74 |
75 | $context = stream_context_create($opts);
76 | $response = 'FAILED';
77 | $sock=fopen($url, 'r', false, $context);
78 | if ($sock) {
79 | $response='';
80 | while (!feof($sock))
81 | $response.=fgets($sock, 4096);
82 |
83 | fclose($sock);
84 | }
85 | return $response;
86 | }
87 |
88 | /********************************************************************************
89 | Descripton: Creates the request URL for the API being invoked with all the parameters and signature
90 | appended to the URL as required.
91 |
92 | Parameters: $params_array - Parameters
93 | $privatekey - The private key.
94 |
95 | Return Values: The URL that is constructed.
96 | *********************************************************************************/
97 | function CreateAPIURL($params_array) {
98 | global $mesibobaseurl;
99 |
100 | $uri = $mesibobaseurl;
101 | if (isset($params_array['apiurl']))
102 | $uri = $params_array['apiurl'];
103 |
104 | foreach($params_array as $key=>$val) {
105 | $uri .= "$key=" . urlencode($val) . '&';
106 | }
107 |
108 | $uri .= "sig=none";
109 | return $uri;
110 | }
111 |
112 |
--------------------------------------------------------------------------------