You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

603 lines
28 KiB

  1. <?php
  2. /**
  3. * @file Utils.php
  4. * This file is part of PROJECT.
  5. *
  6. * @brief Description
  7. *
  8. * @author Etenil <etenil@etenilsrealm.nl>
  9. *
  10. * @version 1.0
  11. * @date 20 February 2011
  12. *
  13. * Copyright (C)2011 Etenil
  14. *
  15. * All rights reserved.
  16. */
  17. use Monolog\Logger;
  18. use Monolog\Handler\SyslogHandler;
  19. use Monolog\Handler\StreamHandler;
  20. /**
  21. * Return the list of gender
  22. */
  23. function getGender() {
  24. return array('N' => __('gender.none'),
  25. 'M' => __('gender.male'),
  26. 'F' => __('gender.female'),
  27. 'O' => __('gender.other')
  28. );
  29. }
  30. /**
  31. * Return the list of client types
  32. */
  33. function getClientTypes() {
  34. return array(
  35. 'bot' => __('client.bot'),
  36. 'pc' => __('client.desktop'),
  37. 'phone' => __('client.phone'),
  38. 'handheld' => __('client.phone'),
  39. 'web' => __('client.web'),
  40. 'registered' => __('client.registered')
  41. );
  42. }
  43. /**
  44. * Return a XEP to namespace association
  45. */
  46. function getXepNamespace() {
  47. return array(
  48. '0004' => array('name' => 'Data Forms', 'category' => 'client', 'ns' => 'jabber:x:data'),
  49. '0012' => array('name' => 'Last Activity', 'category' => 'chat', 'ns' => 'jabber:iq:last'),
  50. '0030' => array('name' => 'Service Discovery', 'category' => 'client', 'ns' => 'http://jabber.org/protocol/disco#info'),
  51. '0045' => array('name' => 'Multi-User Chat', 'category' => 'chat', 'ns' => 'http://jabber.org/protocol/muc'),
  52. '0050' => array('name' => 'Ad-Hoc Commands', 'category' => 'client', 'ns' => 'http://jabber.org/protocol/commands'),
  53. '0054' => array('name' => 'vcard-temp', 'category' => 'client', 'ns' => 'vcard-temp'),
  54. '0071' => array('name' => 'XHTML-IM', 'category' => 'chat', 'ns' => 'http://jabber.org/protocol/xhtml-im'),
  55. '0080' => array('name' => 'User Location', 'category' => 'profile', 'ns' => 'http://jabber.org/protocol/geoloc'),
  56. '0084' => array('name' => 'User Avatar', 'category' => 'profile', 'ns' => 'urn:xmpp:avatar:data'),
  57. '0085' => array('name' => 'Chat State Notifications', 'category' => 'chat', 'ns' => 'http://jabber.org/protocol/chatstates'),
  58. '0092' => array('name' => 'Software Version', 'category' => 'client', 'ns' => 'jabber:iq:version'),
  59. '0107' => array('name' => 'User Mood', 'category' => 'profile', 'ns' => 'http://jabber.org/protocol/mood'),
  60. '0108' => array('name' => 'User Activity', 'category' => 'profile', 'ns' => 'http://jabber.org/protocol/activity'),
  61. '0115' => array('name' => 'Entity Capabilities', 'category' => 'client', 'ns' => 'http://jabber.org/protocol/caps'),
  62. '0118' => array('name' => 'User Tune', 'category' => 'profile', 'ns' => 'http://jabber.org/protocol/tune'),
  63. '0124' => array('name' => 'Bidirectional-streams Over Synchronous HTTP (BOSH)', 'category' => 'client', 'ns' => 'http://jabber.org/protocol/httpbind'),
  64. '0152' => array('name' => 'Reachability Addresses', 'category' => 'client', 'ns' => 'urn:xmpp:reach:0'),
  65. '0166' => array('name' => 'Jingle', 'category' => 'jingle', 'ns' => 'urn:xmpp:jingle:1'),
  66. '0167' => array('name' => 'Jingle RTP Sessions', 'category' => 'jingle', 'ns' => 'urn:xmpp:jingle:apps:rtp:1'),
  67. '0172' => array('name' => 'User Nickname', 'category' => 'profile', 'ns' => 'http://jabber.org/protocol/nick'),
  68. '0176' => array('name' => 'Jingle ICE-UDP Transport Method', 'category' => 'jingle', 'ns' => 'urn:xmpp:jingle:transports:ice-udp:1'),
  69. '0177' => array('name' => 'Jingle Raw UDP Transport Method', 'category' => 'jingle', 'ns' => 'urn:xmpp:jingle:transports:raw-udp:1'),
  70. '0184' => array('name' => 'Message Delivery Receipts', 'category' => 'chat', 'ns' => 'urn:xmpp:receipts'),
  71. '0186' => array('name' => 'Invisible Command', 'category' => 'chat', 'ns' => 'urn:xmpp:invisible:0'),
  72. '0199' => array('name' => 'XMPP Ping', 'category' => 'client', 'ns' => 'urn:xmpp:ping'),
  73. '0202' => array('name' => 'Entity Time', 'category' => 'client', 'ns' => 'urn:xmpp:time'),
  74. '0224' => array('name' => 'Attention', 'category' => 'chat', 'ns' => 'urn:xmpp:attention:0'),
  75. '0231' => array('name' => 'Bits of Binary', 'category' => 'chat', 'ns' => 'urn:xmpp:bob'),
  76. '0234' => array('name' => 'Jingle File Transfer', 'category' => 'jingle', 'ns' => 'urn:xmpp:jingle:apps:file-transfer:4'),
  77. '0249' => array('name' => 'Direct MUC Invitations', 'category' => 'chat', 'ns' => 'jabber:x:conference'),
  78. '0277' => array('name' => 'Microblogging over XMPP','category' => 'social', 'ns' => 'urn:xmpp:microblog:0'),
  79. '0280' => array('name' => 'Message Carbons', 'category' => 'chat', 'ns' => 'urn:xmpp:carbons:2'),
  80. '0292' => array('name' => 'vCard4 Over XMPP', 'category' => 'profile', 'ns' => 'urn:xmpp:vcard4'),
  81. '0301' => array('name' => 'In-Band Real Time Text', 'category' => 'chat', 'ns' => 'urn:xmpp:rtt:0'),
  82. '0308' => array('name' => 'Last Message Correction', 'category' => 'chat', 'ns' => 'urn:xmpp:message-correct:0'),
  83. '0313' => array('name' => 'Message Archive Management', 'category' => 'chat', 'ns' => 'urn:xmpp:mam:0'),
  84. '0320' => array('name' => 'Use of DTLS-SRTP in Jingle Sessions', 'category' => 'jingle', 'ns' => 'urn:xmpp:jingle:apps:dtls:0'),
  85. '0323' => array('name' => 'Internet of Things - Sensor Data', 'category' => 'iot', 'ns' => 'urn:xmpp:iot:sensordata'),
  86. '0324' => array('name' => 'Internet of Things - Provisioning', 'category' => 'iot', 'ns' => 'urn:xmpp:iot:provisioning'),
  87. '0325' => array('name' => 'Internet of Things - Control', 'category' => 'iot', 'ns' => 'urn:xmpp:iot:control'),
  88. '0326' => array('name' => 'Internet of Things - Concentrators', 'category' => 'iot', 'ns' => 'urn:xmpp:iot:concentrators'),
  89. '0327' => array('name' => 'Rayo', 'category' => 'rayo', 'ns' => 'urn:xmpp:rayo:0'),
  90. '0330' => array('name' => 'Pubsub Subscription', 'category' => 'social', 'ns' => 'urn:xmpp:pubsub:subscription'),
  91. '0332' => array('name' => 'HTTP over XMPP transport', 'category' => 'client', 'ns' => 'urn:xmpp:http'),
  92. '0337' => array('name' => 'Event Logging over XMPP', 'category' => 'client', 'ns' => 'urn:xmpp:eventlog'),
  93. '0338' => array('name' => 'Jingle Grouping Framework', 'category' => 'jingle', 'ns' => 'urn:ietf:rfc:5888'),
  94. '0339' => array('name' => 'Source-Specific Media Attributes in Jingle', 'category' => 'jingle', 'ns' => 'urn:ietf:rfc:5576'),
  95. '0340' => array('name' => 'COnferences with LIghtweight BRIdging (COLIBRI)', 'category' => 'jingle', 'ns' => 'http://jitsi.org/protocol/colibri'),
  96. '0341' => array('name' => 'Rayo CPA', 'category' => 'rayo', 'ns' => 'urn:xmpp:rayo:cpa:0'),
  97. '0342' => array('name' => 'Rayo Fax', 'category' => 'rayo', 'ns' => 'urn:xmpp:rayo:fax:1'),
  98. '0347' => array('name' => 'Internet of Things - Discovery', 'category' => 'iot', 'ns' => 'urn:xmpp:iot:discovery'),
  99. '0348' => array('name' => 'Signing Forms', 'category' => 'client', 'ns' => 'urn:xmpp:xdata:signature:oauth1'),
  100. );
  101. }
  102. /**
  103. * Return a list of all the country
  104. */
  105. function getCountries() {
  106. return array(
  107. 'AF' => 'Afghanistan',
  108. 'AX' => 'Aland Islands',
  109. 'AL' => 'Albania',
  110. 'DZ' => 'Algeria',
  111. 'AS' => 'American Samoa',
  112. 'AD' => 'Andorra',
  113. 'AO' => 'Angola',
  114. 'AI' => 'Anguilla',
  115. 'AQ' => 'Antarctica',
  116. 'AG' => 'Antigua and Barbuda',
  117. 'AR' => 'Argentina',
  118. 'AM' => 'Armenia',
  119. 'AW' => 'Aruba',
  120. 'AU' => 'Australia',
  121. 'AT' => 'Austria',
  122. 'AZ' => 'Azerbaijan',
  123. 'BS' => 'Bahamas The',
  124. 'BH' => 'Bahrain',
  125. 'BD' => 'Bangladesh',
  126. 'BB' => 'Barbados',
  127. 'BY' => 'Belarus',
  128. 'BE' => 'Belgium',
  129. 'BZ' => 'Belize',
  130. 'BJ' => 'Benin',
  131. 'BM' => 'Bermuda',
  132. 'BT' => 'Bhutan',
  133. 'BO' => 'Bolivia',
  134. 'BA' => 'Bosnia and Herzegovina',
  135. 'BW' => 'Botswana',
  136. 'BV' => 'Bouvet Island (Bouvetoya)',
  137. 'BR' => 'Brazil',
  138. 'IO' => 'British Indian Ocean Territory (Chagos Archipelago)',
  139. 'VG' => 'British Virgin Islands',
  140. 'BN' => 'Brunei Darussalam',
  141. 'BG' => 'Bulgaria',
  142. 'BF' => 'Burkina Faso',
  143. 'BI' => 'Burundi',
  144. 'KH' => 'Cambodia',
  145. 'CM' => 'Cameroon',
  146. 'CA' => 'Canada',
  147. 'CV' => 'Cape Verde',
  148. 'KY' => 'Cayman Islands',
  149. 'CF' => 'Central African Republic',
  150. 'TD' => 'Chad',
  151. 'CL' => 'Chile',
  152. 'CN' => 'China',
  153. 'CX' => 'Christmas Island',
  154. 'CC' => 'Cocos (Keeling) Islands',
  155. 'CO' => 'Colombia',
  156. 'KM' => 'Comoros The',
  157. 'CD' => 'Congo',
  158. 'CG' => 'Congo The',
  159. 'CK' => 'Cook Islands',
  160. 'CR' => 'Costa Rica',
  161. 'CI' => 'Cote d\'Ivoire',
  162. 'HR' => 'Croatia',
  163. 'CU' => 'Cuba',
  164. 'CY' => 'Cyprus',
  165. 'CZ' => 'Czech Republic',
  166. 'DK' => 'Denmark',
  167. 'DJ' => 'Djibouti',
  168. 'DM' => 'Dominica',
  169. 'DO' => 'Dominican Republic',
  170. 'EC' => 'Ecuador',
  171. 'EG' => 'Egypt',
  172. 'SV' => 'El Salvador',
  173. 'GQ' => 'Equatorial Guinea',
  174. 'ER' => 'Eritrea',
  175. 'EE' => 'Estonia',
  176. 'ET' => 'Ethiopia',
  177. 'FO' => 'Faroe Islands',
  178. 'FK' => 'Falkland Islands (Malvinas)',
  179. 'FJ' => 'Fiji The Fiji Islands',
  180. 'FI' => 'Finland',
  181. 'FR' => 'France, French Republic',
  182. 'GF' => 'French Guiana',
  183. 'PF' => 'French Polynesia',
  184. 'TF' => 'French Southern Territories',
  185. 'GA' => 'Gabon',
  186. 'GM' => 'Gambia The',
  187. 'GE' => 'Georgia',
  188. 'DE' => 'Germany',
  189. 'GH' => 'Ghana',
  190. 'GI' => 'Gibraltar',
  191. 'GR' => 'Greece',
  192. 'GL' => 'Greenland',
  193. 'GD' => 'Grenada',
  194. 'GP' => 'Guadeloupe',
  195. 'GU' => 'Guam',
  196. 'GT' => 'Guatemala',
  197. 'GG' => 'Guernsey',
  198. 'GN' => 'Guinea',
  199. 'GW' => 'Guinea-Bissau',
  200. 'GY' => 'Guyana',
  201. 'HT' => 'Haiti',
  202. 'HM' => 'Heard Island and McDonald Islands',
  203. 'VA' => 'Holy See (Vatican City State)',
  204. 'HN' => 'Honduras',
  205. 'HK' => 'Hong Kong',
  206. 'HU' => 'Hungary',
  207. 'IS' => 'Iceland',
  208. 'IN' => 'India',
  209. 'ID' => 'Indonesia',
  210. 'IR' => 'Iran',
  211. 'IQ' => 'Iraq',
  212. 'IE' => 'Ireland',
  213. 'IM' => 'Isle of Man',
  214. 'IL' => 'Israel',
  215. 'IT' => 'Italy',
  216. 'JM' => 'Jamaica',
  217. 'JP' => 'Japan',
  218. 'JE' => 'Jersey',
  219. 'JO' => 'Jordan',
  220. 'KZ' => 'Kazakhstan',
  221. 'KE' => 'Kenya',
  222. 'KI' => 'Kiribati',
  223. 'KP' => 'Korea',
  224. 'KR' => 'Korea',
  225. 'KW' => 'Kuwait',
  226. 'KG' => 'Kyrgyz Republic',
  227. 'LA' => 'Lao',
  228. 'LV' => 'Latvia',
  229. 'LB' => 'Lebanon',
  230. 'LS' => 'Lesotho',
  231. 'LR' => 'Liberia',
  232. 'LY' => 'Libyan Arab Jamahiriya',
  233. 'LI' => 'Liechtenstein',
  234. 'LT' => 'Lithuania',
  235. 'LU' => 'Luxembourg',
  236. 'MO' => 'Macao',
  237. 'MK' => 'Macedonia',
  238. 'MG' => 'Madagascar',
  239. 'MW' => 'Malawi',
  240. 'MY' => 'Malaysia',
  241. 'MV' => 'Maldives',
  242. 'ML' => 'Mali',
  243. 'MT' => 'Malta',
  244. 'MH' => 'Marshall Islands',
  245. 'MQ' => 'Martinique',
  246. 'MR' => 'Mauritania',
  247. 'MU' => 'Mauritius',
  248. 'YT' => 'Mayotte',
  249. 'MX' => 'Mexico',
  250. 'FM' => 'Micronesia',
  251. 'MD' => 'Moldova',
  252. 'MC' => 'Monaco',
  253. 'MN' => 'Mongolia',
  254. 'ME' => 'Montenegro',
  255. 'MS' => 'Montserrat',
  256. 'MA' => 'Morocco',
  257. 'MZ' => 'Mozambique',
  258. 'MM' => 'Myanmar',
  259. 'NA' => 'Namibia',
  260. 'NR' => 'Nauru',
  261. 'NP' => 'Nepal',
  262. 'AN' => 'Netherlands Antilles',
  263. 'NL' => 'Netherlands The',
  264. 'NC' => 'New Caledonia',
  265. 'NZ' => 'New Zealand',
  266. 'NI' => 'Nicaragua',
  267. 'NE' => 'Niger',
  268. 'NG' => 'Nigeria',
  269. 'NU' => 'Niue',
  270. 'NF' => 'Norfolk Island',
  271. 'MP' => 'Northern Mariana Islands',
  272. 'NO' => 'Norway',
  273. 'OM' => 'Oman',
  274. 'PK' => 'Pakistan',
  275. 'PW' => 'Palau',
  276. 'PS' => 'Palestinian Territory',
  277. 'PA' => 'Panama',
  278. 'PG' => 'Papua New Guinea',
  279. 'PY' => 'Paraguay',
  280. 'PE' => 'Peru',
  281. 'PH' => 'Philippines',
  282. 'PN' => 'Pitcairn Islands',
  283. 'PL' => 'Poland',
  284. 'PT' => 'Portugal, Portuguese Republic',
  285. 'PR' => 'Puerto Rico',
  286. 'QA' => 'Qatar',
  287. 'RE' => 'Reunion',
  288. 'RO' => 'Romania',
  289. 'RU' => 'Russian Federation',
  290. 'RW' => 'Rwanda',
  291. 'BL' => 'Saint Barthelemy',
  292. 'SH' => 'Saint Helena',
  293. 'KN' => 'Saint Kitts and Nevis',
  294. 'LC' => 'Saint Lucia',
  295. 'MF' => 'Saint Martin',
  296. 'PM' => 'Saint Pierre and Miquelon',
  297. 'VC' => 'Saint Vincent and The Grenadines',
  298. 'WS' => 'Samoa',
  299. 'SM' => 'San Marino',
  300. 'ST' => 'Sao Tome and Principe',
  301. 'SA' => 'Saudi Arabia',
  302. 'SN' => 'Senegal',
  303. 'RS' => 'Serbia',
  304. 'SC' => 'Seychelles',
  305. 'SL' => 'Sierra Leone',
  306. 'SG' => 'Singapore',
  307. 'SK' => 'Slovakia (Slovak Republic)',
  308. 'SI' => 'Slovenia',
  309. 'SB' => 'Solomon Islands',
  310. 'SO' => 'Somalia, Somali Republic',
  311. 'ZA' => 'South Africa',
  312. 'GS' => 'South Georgia and The South Sandwich Islands',
  313. 'ES' => 'Spain',
  314. 'LK' => 'Sri Lanka',
  315. 'SD' => 'Sudan',
  316. 'SR' => 'Suriname',
  317. 'SJ' => 'Svalbard & Jan Mayen Islands',
  318. 'SZ' => 'Swaziland',
  319. 'SE' => 'Sweden',
  320. 'CH' => 'Switzerland, Swiss Confederation',
  321. 'SY' => 'Syrian Arab Republic',
  322. 'TW' => 'Taiwan',
  323. 'TJ' => 'Tajikistan',
  324. 'TZ' => 'Tanzania',
  325. 'TH' => 'Thailand',
  326. 'TL' => 'Timor-Leste',
  327. 'TG' => 'Togo',
  328. 'TK' => 'Tokelau',
  329. 'TO' => 'Tonga',
  330. 'TT' => 'Trinidad and Tobago',
  331. 'TN' => 'Tunisia',
  332. 'TR' => 'Turkey',
  333. 'TM' => 'Turkmenistan',
  334. 'TC' => 'Turks and Caicos Islands',
  335. 'TV' => 'Tuvalu',
  336. 'UG' => 'Uganda',
  337. 'UA' => 'Ukraine',
  338. 'AE' => 'United Arab Emirates',
  339. 'GB' => 'United Kingdom',
  340. 'US' => 'United States of America',
  341. 'UM' => 'United States Minor Outlying Islands',
  342. 'VI' => 'United States Virgin Islands',
  343. 'UY' => 'Uruguay, Eastern Republic of',
  344. 'UZ' => 'Uzbekistan',
  345. 'VU' => 'Vanuatu',
  346. 'VE' => 'Venezuela',
  347. 'VN' => 'Vietnam',
  348. 'WF' => 'Wallis and Futuna',
  349. 'EH' => 'Western Sahara',
  350. 'YE' => 'Yemen',
  351. 'ZM' => 'Zambia',
  352. 'ZW' => 'Zimbabwe'
  353. );
  354. }
  355. /**
  356. * Return the list of marital status
  357. */
  358. function getMarital() {
  359. return array(
  360. 'none' => __('marital.none'),
  361. 'single' => __('marital.single'),
  362. 'relationship' => __('marital.relationship'),
  363. 'married' => __('marital.married'),
  364. 'divorced' => __('marital.divorced'),
  365. 'widowed' => __('marital.widowed'),
  366. 'cohabiting' => __('marital.cohabiting'),
  367. 'union' => __('marital.union')
  368. );
  369. }
  370. function getPresences() {
  371. return array(
  372. 1 => __('presence.online'),
  373. 2 => __('presence.away'),
  374. 3 => __('presence.dnd'),
  375. 4 => __('presence.xa'),
  376. 5 => __('presence.offline'),
  377. 6 => __('presence.error')
  378. );
  379. }
  380. function getPresencesTxt() {
  381. return array(
  382. 1 => 'online',
  383. 2 => 'away',
  384. 3 => 'dnd',
  385. 4 => 'xa',
  386. 5 => 'offline',
  387. 6 => 'server_error'
  388. );
  389. }
  390. function getMood() {
  391. return array(
  392. 'afraid' => __('mood.afraid'), // Impressed with fear or apprehension; in fear; apprehensive.
  393. 'amazed' => __('mood.amazed'), // Astonished; confounded with fear, surprise or wonder.
  394. 'amorous' => __('mood.amorous'), // Inclined to love; having a propensity to love, or to sexual enjoyment; loving, fond, affectionate, passionate, lustful, sexual, etc.
  395. 'angry' => __('mood.angry'), // Displaying or feeling anger, i.e., a strong feeling of displeasure, hostility or antagonism towards someone or something, usually combined with an urge to harm.
  396. 'annoyed' => __('mood.annoyed'), // To be disturbed or irritated, especially by continued or repeated acts.
  397. 'anxious' => __('mood.anxious'), // Full of anxiety or disquietude; greatly concerned or solicitous, esp. respecting something future or unknown; being in painful suspense.
  398. 'aroused' => __('mood.aroused'), // To be stimulated in one's feelings, especially to be sexually stimulated.
  399. 'ashamed' => __('mood.ashamed'), // Feeling shame or guilt.
  400. 'bored' => __('mood.bored'), // Suffering from boredom; uninterested, without attention.
  401. 'brave' => __('mood.brave'), // Strong in the face of fear; courageous.
  402. 'calm' => __('mood.calm'), // Peaceful, quiet.
  403. 'cautious' => __('mood.cautious'), // Taking care or caution; tentative.
  404. 'cold' => __('mood.cold'), // Feeling the sensation of coldness, especially to the point of discomfort.
  405. 'confident' => __('mood.confident'), // Feeling very sure of or positive about something, especially about one's own capabilities.
  406. 'confused' => __('mood.confused'), // Chaotic, jumbled or muddled.
  407. 'contemplative' => __('mood.contemplative'), // Feeling introspective or thoughtful.
  408. 'contented' => __('mood.contented'), // Pleased at the satisfaction of a want or desire; satisfied.
  409. 'cranky' => __('mood.cranky'), // Grouchy, irritable; easily upset.
  410. 'crazy' => __('mood.crazy'), // Feeling out of control; feeling overly excited or enthusiastic.
  411. 'creative' => __('mood.creative'), // Feeling original, expressive, or imaginative.
  412. 'curious' => __('mood.curious'), // Inquisitive; tending to ask questions, investigate, or explore.
  413. 'dejected' => __('mood.dejected'), // Feeling sad and dispirited.
  414. 'depressed' => __('mood.depressed'), // Severely despondent and unhappy.
  415. 'disappointed' => __('mood.disappointed'), // Defeated of expectation or hope; let down.
  416. 'disgusted' => __('mood.disgusted'), // Filled with disgust; irritated and out of patience.
  417. 'dismayed' => __('mood.dismayed'), // Feeling a sudden or complete loss of courage in the face of trouble or danger.
  418. 'distracted' => __('mood.distracted'), // Having one's attention diverted; preoccupied.
  419. 'embarrassed' => __('mood.embarrassed'), // Having a feeling of shameful discomfort.
  420. 'envious' => __('mood.envious'), // Feeling pain by the excellence or good fortune of another.
  421. 'excited' => __('mood.excited'), // Having great enthusiasm.
  422. 'flirtatious' => __('mood.flirtatious'), // In the mood for flirting.
  423. 'frustated' => __('mood.frustrated'), // Suffering from frustration; dissatisfied, agitated, or discontented because one is unable to perform an action or fulfill a desire.
  424. 'grateful' => __('mood.grateful'), // Feeling appreciation or thanks.
  425. 'grieving' => __('mood.grieving'), // Feeling very sad about something, especially something lost; mournful; sorrowful.
  426. 'grumpy' => __('mood.grumpy'), // Unhappy and irritable.
  427. 'guilty' => __('mood.guilty'), // Feeling responsible for wrongdoing; feeling blameworthy.
  428. 'happy' => __('mood.happy'), // Experiencing the effect of favourable fortune; having the feeling arising from the consciousness of well-being or of enjoyment; enjoying good of any kind, as peace, tranquillity, comfort; contented; joyous.
  429. 'hopeful' => __('mood.hopeful'), // Having a positive feeling, belief, or expectation that something wished for can or will happen.
  430. 'hot' => __('mood.hot'), // Feeling the sensation of heat, especially to the point of discomfort.
  431. 'humbled' => __('mood.humbled'), // Having or showing a modest or low estimate of one's own importance; feeling lowered in dignity or importance.
  432. 'humiliated' => __('mood.humiliated'), // Feeling deprived of dignity or self-respect.
  433. 'hungry' => __('mood.hungry'), // Having a physical need for food.
  434. 'hurt' => __('mood.hurt'), // Wounded, injured, or pained, whether physically or emotionally.
  435. 'impressed' => __('mood.impressed'), // Favourably affected by something or someone.
  436. 'in_awe' => __('mood.in_awe'), // Feeling amazement at something or someone; or feeling a combination of fear and reverence.
  437. 'in_love' => __('mood.in_love'), // Feeling strong affection, care, liking, or attraction..
  438. 'indignant' => __('mood.indignant'), // Showing anger or indignation, especially at something unjust or wrong.
  439. 'interested' => __('mood.interested'), // Showing great attention to something or someone; having or showing interest.
  440. 'intoxicated' => __('mood.intoxicated'), // Under the influence of alcohol; drunk.
  441. 'invincible' => __('mood.invincible'), // Feeling as if one cannot be defeated, overcome or denied.
  442. 'jealous' => __('mood.jealous'), // Fearful of being replaced in position or affection.
  443. 'lonely' => __('mood.lonely'), // Feeling isolated, empty, or abandoned.
  444. 'lost' => __('mood.lost'), // Unable to find one's way, either physically or emotionally.
  445. 'lucky' => __('mood.lucky'), // Feeling as if one will be favored by luck.
  446. 'mean' => __('mood.mean'), // Causing or intending to cause intentional harm; bearing ill will towards another; cruel; malicious.
  447. 'moody' => __('mood.moody'), // Given to sudden or frequent changes of mind or feeling; temperamental.
  448. 'nervous' => __('mood.nervous'), // Easily agitated or alarmed; apprehensive or anxious.
  449. 'neutral' => __('mood.neutral'), // Not having a strong mood or emotional state.
  450. 'offended' => __('mood.offended'), // Feeling emotionally hurt, displeased, or insulted.
  451. 'outraged' => __('mood.outraged'), // Feeling resentful anger caused by an extremely violent or vicious attack, or by an offensive, immoral, or indecent act.
  452. 'playful' => __('mood.playful'), // Interested in play; fun, recreational, unserious, lighthearted; joking, silly.
  453. 'proud' => __('mood.proud'), // Feeling a sense of one's own worth or accomplishment.
  454. 'relaxed' => __('mood.relaxed'), // Having an easy-going mood; not stressed; calm.
  455. 'relieved' => __('mood.relieved'), // Feeling uplifted because of the removal of stress or discomfort.
  456. 'remorseful' => __('mood.remorseful'), // Feeling regret or sadness for doing something wrong.
  457. 'restless' => __('mood.restless'), // Without rest; unable to be still or quiet; uneasy; continually moving.
  458. 'sad' => __('mood.sad'), // Feeling sorrow; sorrowful, mournful.
  459. 'sarcastic' => __('mood.sarcastic'), // Mocking and ironical.
  460. 'satisfied' => __('mood.satisfied'), // Pleased at the fulfillment of a need or desire.
  461. 'serious' => __('mood.serious'), // Without humor or expression of happiness; grave in manner or disposition; earnest; thoughtful; solemn.
  462. 'shocked' => __('mood.shocked'), // Surprised, startled, confused, or taken aback.
  463. 'shy' => __('mood.shy'), // Feeling easily frightened or scared; timid; reserved or coy.
  464. 'sick' => __('mood.sick'), // Feeling in poor health; ill.
  465. 'sleepy' => __('mood.sleepy'), // Feeling the need for sleep.
  466. 'spontaneous' => __('mood.spontaneous'), // Acting without planning; natural; impulsive.
  467. 'stressed' => __('mood.stressed'), // Suffering emotional pressure.
  468. 'strong' => __('mood.strong'), // Capable of producing great physical force; or, emotionally forceful, able, determined, unyielding.
  469. 'surprised' => __('mood.surprised'), // Experiencing a feeling caused by something unexpected.
  470. 'thankful' => __('mood.thankful'), // Showing appreciation or gratitude.
  471. 'thirsty' => __('mood.thirsty'), // Feeling the need to drink.
  472. 'tired' => __('mood.tired'), // In need of rest or sleep.
  473. 'undefined' => __('mood.undefined'), // [Feeling any emotion not defined here.]
  474. 'weak' => __('mood.weak'), // Lacking in force or ability, either physical or emotional.
  475. 'worried' => __('mood.worried') // Thinking about unpleasant things that have happened or that might happen; feeling afraid and unhappy.
  476. );
  477. }
  478. /*
  479. * Generate a standard UUID
  480. */
  481. function generateUUID($string = false) {
  482. if($string != false)
  483. $data = $string;
  484. else
  485. $data = openssl_random_pseudo_bytes(16);
  486. $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0010
  487. $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
  488. return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
  489. }
  490. function movim_log($logs) {
  491. $log = new Logger('movim');
  492. $log->pushHandler(new SyslogHandler('movim'));
  493. $log->pushHandler(new StreamHandler(LOG_PATH.'/logger.log', Logger::DEBUG));
  494. if(is_array($logs))
  495. $log->addInfo('', $logs);
  496. else
  497. $log->addInfo($logs);
  498. }
  499. /**
  500. * @desc Return a small help to recognize flag color
  501. * */
  502. function getFlagTitle($color){
  503. $title = '';
  504. switch($color){
  505. case 'white':
  506. $title = __('flag.white');
  507. break;
  508. case 'green':
  509. $title = __('flag.green');
  510. break;
  511. case 'orange':
  512. $title = __('flag.orange');
  513. break;
  514. case 'red':
  515. $title = __('flag.red');
  516. break;
  517. case 'black':
  518. $title = __('flag.black');
  519. break;
  520. default:
  521. break;
  522. }
  523. return $title;
  524. }
  525. /*
  526. * @desc Generate a simple random key
  527. * @params The size of the key
  528. */
  529. function generateKey($size) {
  530. // Generating the session cookie's hash.
  531. $hash_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  532. $hash = "";
  533. for($i = 0; $i < $size; $i++) {
  534. $r = mt_rand(0, strlen($hash_chars) - 1);
  535. $hash.= $hash_chars[$r];
  536. }
  537. return $hash;
  538. }
  539. /*
  540. * @desc Request a simple url
  541. */
  542. function requestURL($url, $timeout = 10, $post = false) {
  543. $ch = curl_init($url);
  544. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  545. curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
  546. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  547. curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  548. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  549. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0');
  550. if(is_array($post)) {
  551. $params = '';
  552. foreach($post as $key => $value) {
  553. $params .= $key . '=' . $value .'&';
  554. }
  555. curl_setopt ($ch, CURLOPT_POST, 1);
  556. curl_setopt ($ch, CURLOPT_POSTFIELDS, $params);
  557. }
  558. $rs = array();
  559. $content = curl_exec($ch);
  560. $rs['content'] = $content;
  561. $rs['errno'] = curl_errno($ch);
  562. $rs['errmsg'] = curl_error($ch);
  563. $rs['header'] = curl_getinfo($ch);
  564. if($rs['errno'] == 0) {
  565. return $rs['content'];
  566. } else {
  567. return false;
  568. }
  569. }
  570. ?>