zerobin.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <?php
  2. /**
  3. * ZeroBin
  4. *
  5. * a zero-knowledge paste bin
  6. *
  7. * @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
  8. * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
  9. * @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
  10. * @version 0.21
  11. */
  12. /**
  13. * zerobin
  14. *
  15. * Controller, puts it all together.
  16. */
  17. class zerobin
  18. {
  19. /**
  20. * version
  21. *
  22. * @const string
  23. */
  24. const VERSION = '0.21';
  25. /**
  26. * show the same error message if the paste expired or does not exist
  27. *
  28. * @const string
  29. */
  30. const GENERIC_ERROR = 'Paste does not exist, has expired or has been deleted.';
  31. /**
  32. * configuration array
  33. *
  34. * @access private
  35. * @var array
  36. */
  37. private $_conf = array(
  38. 'model' => 'zerobin_data',
  39. );
  40. /**
  41. * data
  42. *
  43. * @access private
  44. * @var string
  45. */
  46. private $_data = '';
  47. /**
  48. * formatter
  49. *
  50. * @access private
  51. * @var string
  52. */
  53. private $_formatter = 'plaintext';
  54. /**
  55. * error message
  56. *
  57. * @access private
  58. * @var string
  59. */
  60. private $_error = '';
  61. /**
  62. * status message
  63. *
  64. * @access private
  65. * @var string
  66. */
  67. private $_status = '';
  68. /**
  69. * JSON message
  70. *
  71. * @access private
  72. * @var string
  73. */
  74. private $_json = '';
  75. /**
  76. * data storage model
  77. *
  78. * @access private
  79. * @var zerobin_abstract
  80. */
  81. private $_model;
  82. /**
  83. * constructor
  84. *
  85. * initializes and runs ZeroBin
  86. *
  87. * @access public
  88. * @return void
  89. */
  90. public function __construct()
  91. {
  92. if (version_compare(PHP_VERSION, '5.2.6') < 0)
  93. {
  94. throw new Exception(i18n::_('ZeroBin requires php 5.2.6 or above to work. Sorry.'), 1);
  95. }
  96. // in case stupid admin has left magic_quotes enabled in php.ini
  97. if (get_magic_quotes_gpc())
  98. {
  99. $_POST = array_map('filter::stripslashes_deep', $_POST);
  100. $_GET = array_map('filter::stripslashes_deep', $_GET);
  101. $_COOKIE = array_map('filter::stripslashes_deep', $_COOKIE);
  102. }
  103. // load config from ini file
  104. $this->_init();
  105. // create new paste or comment
  106. if (
  107. (array_key_exists('data', $_POST) && !empty($_POST['data'])) ||
  108. (array_key_exists('attachment', $_POST) && !empty($_POST['attachment']))
  109. )
  110. {
  111. $this->_create();
  112. }
  113. // delete an existing paste
  114. elseif (!empty($_GET['deletetoken']) && !empty($_GET['pasteid']))
  115. {
  116. $this->_delete($_GET['pasteid'], $_GET['deletetoken']);
  117. }
  118. // display an existing paste
  119. elseif (!empty($_SERVER['QUERY_STRING']))
  120. {
  121. $this->_read($_SERVER['QUERY_STRING']);
  122. }
  123. // output JSON or HTML
  124. if (strlen($this->_json))
  125. {
  126. header('Content-type: application/json');
  127. echo $this->_json;
  128. }
  129. else
  130. {
  131. $this->_view();
  132. }
  133. }
  134. /**
  135. * initialize zerobin
  136. *
  137. * @access private
  138. * @return void
  139. */
  140. private function _init()
  141. {
  142. foreach (array('cfg', 'lib') as $dir)
  143. {
  144. if (!is_file(PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess')) file_put_contents(
  145. PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess',
  146. 'Allow from none' . PHP_EOL .
  147. 'Deny from all'. PHP_EOL,
  148. LOCK_EX
  149. );
  150. }
  151. $this->_conf = parse_ini_file(PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini', true);
  152. foreach (array('main', 'model') as $section) {
  153. if (!array_key_exists($section, $this->_conf)) {
  154. throw new Exception(i18n::_('ZeroBin requires configuration section [%s] to be present in configuration file.', $section), 2);
  155. }
  156. }
  157. $this->_model = $this->_conf['model']['class'];
  158. }
  159. /**
  160. * get the model, create one if needed
  161. *
  162. * @access private
  163. * @return zerobin_abstract
  164. */
  165. private function _model()
  166. {
  167. // if needed, initialize the model
  168. if(is_string($this->_model)) {
  169. $this->_model = forward_static_call(
  170. array($this->_model, 'getInstance'),
  171. $this->_conf['model_options']
  172. );
  173. }
  174. return $this->_model;
  175. }
  176. /**
  177. * Store new paste or comment
  178. *
  179. * POST contains one or both:
  180. * data = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct)
  181. * attachment = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct)
  182. *
  183. * All optional data will go to meta information:
  184. * expire (optional) = expiration delay (never,5min,10min,1hour,1day,1week,1month,1year,burn) (default:never)
  185. * formatter (optional) = format to display the paste as (plaintext,syntaxhighlighting,markdown) (default:syntaxhighlighting)
  186. * burnafterreading (optional) = if this paste may only viewed once ? (0/1) (default:0)
  187. * opendiscusssion (optional) = is the discussion allowed on this paste ? (0/1) (default:0)
  188. * attachmentname = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct)
  189. * nickname (optional) = in discussion, encoded SJCL encrypted text nickname of author of comment (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct)
  190. * parentid (optional) = in discussion, which comment this comment replies to.
  191. * pasteid (optional) = in discussion, which paste this comment belongs to.
  192. *
  193. * @access private
  194. * @return string
  195. */
  196. private function _create()
  197. {
  198. $error = false;
  199. $has_attachment = array_key_exists('attachment', $_POST);
  200. $has_attachmentname = $has_attachment && array_key_exists('attachmentname', $_POST) && !empty($_POST['attachmentname']);
  201. $data = array_key_exists('data', $_POST) ? $_POST['data'] : '';
  202. $attachment = $has_attachment ? $_POST['attachment'] : '';
  203. $attachmentname = $has_attachmentname ? $_POST['attachmentname'] : '';
  204. // Make sure last paste from the IP address was more than X seconds ago.
  205. trafficlimiter::setLimit($this->_conf['traffic']['limit']);
  206. trafficlimiter::setPath($this->_conf['traffic']['dir']);
  207. $ipKey = 'REMOTE_ADDR';
  208. if (array_key_exists('header', $this->_conf['traffic']))
  209. {
  210. $header = 'HTTP_' . $this->_conf['traffic']['header'];
  211. if (array_key_exists($header, $_SERVER) && !empty($_SERVER[$header]))
  212. {
  213. $ipKey = $header;
  214. }
  215. }
  216. if (!trafficlimiter::canPass($_SERVER[$ipKey])) return $this->_return_message(
  217. 1,
  218. i18n::_(
  219. 'Please wait %d seconds between each post.',
  220. $this->_conf['traffic']['limit']
  221. )
  222. );
  223. // Make sure content is not too big.
  224. $sizelimit = (int) $this->_getMainConfig('sizelimit', 2097152);
  225. if (
  226. strlen($data) + strlen($attachment) + strlen($attachmentname) > $sizelimit
  227. ) return $this->_return_message(
  228. 1,
  229. i18n::_(
  230. 'Paste is limited to %s of encrypted data.',
  231. filter::size_humanreadable($sizelimit)
  232. )
  233. );
  234. // Make sure format is correct.
  235. if (!sjcl::isValid($data)) return $this->_return_message(1, 'Invalid data.');
  236. // Make sure attachments are enabled and format is correct.
  237. if($has_attachment)
  238. {
  239. if (
  240. !$this->_getMainConfig('fileupload', false) ||
  241. !sjcl::isValid($attachment) ||
  242. !($has_attachmentname && sjcl::isValid($attachmentname))
  243. ) return $this->_return_message(1, 'Invalid attachment.');
  244. }
  245. // Read additional meta-information.
  246. $meta = array();
  247. // Read expiration date
  248. if (array_key_exists('expire', $_POST) && !empty($_POST['expire']))
  249. {
  250. $selected_expire = (string) $_POST['expire'];
  251. if (array_key_exists($selected_expire, $this->_conf['expire_options']))
  252. {
  253. $expire = $this->_conf['expire_options'][$selected_expire];
  254. }
  255. else
  256. {
  257. $expire = $this->_conf['expire_options'][$this->_conf['expire']['default']];
  258. }
  259. if ($expire > 0) $meta['expire_date'] = time() + $expire;
  260. }
  261. // Destroy the paste when it is read.
  262. if (array_key_exists('burnafterreading', $_POST) && !empty($_POST['burnafterreading']))
  263. {
  264. $burnafterreading = $_POST['burnafterreading'];
  265. if ($burnafterreading !== '0')
  266. {
  267. if ($burnafterreading !== '1') $error = true;
  268. $meta['burnafterreading'] = true;
  269. }
  270. }
  271. // Read open discussion flag.
  272. if (
  273. $this->_getMainConfig('discussion', true) &&
  274. array_key_exists('opendiscussion', $_POST) &&
  275. !empty($_POST['opendiscussion'])
  276. )
  277. {
  278. $opendiscussion = $_POST['opendiscussion'];
  279. if ($opendiscussion !== '0')
  280. {
  281. if ($opendiscussion !== '1') $error = true;
  282. $meta['opendiscussion'] = true;
  283. }
  284. }
  285. // Read formatter flag.
  286. if (array_key_exists('formatter', $_POST) && !empty($_POST['formatter']))
  287. {
  288. $formatter = $_POST['formatter'];
  289. if (!array_key_exists($formatter, $this->_conf['formatter_options']))
  290. {
  291. $formatter = $this->_getMainConfig('defaultformatter', 'plaintext');
  292. }
  293. $meta['formatter'] = $formatter;
  294. }
  295. // You can't have an open discussion on a "Burn after reading" paste:
  296. if (isset($meta['burnafterreading'])) unset($meta['opendiscussion']);
  297. // Optional nickname for comments
  298. if (!empty($_POST['nickname']))
  299. {
  300. // Generation of the anonymous avatar (Vizhash):
  301. // If a nickname is provided, we generate a Vizhash.
  302. // (We assume that if the user did not enter a nickname, he/she wants
  303. // to be anonymous and we will not generate the vizhash.)
  304. $nick = $_POST['nickname'];
  305. if (!sjcl::isValid($nick))
  306. {
  307. $error = true;
  308. }
  309. else
  310. {
  311. $meta['nickname'] = $nick;
  312. $vz = new vizhash16x16();
  313. $pngdata = $vz->generate($_SERVER['REMOTE_ADDR']);
  314. if ($pngdata != '')
  315. {
  316. $meta['vizhash'] = 'data:image/png;base64,' . base64_encode($pngdata);
  317. }
  318. // Once the avatar is generated, we do not keep the IP address, nor its hash.
  319. }
  320. }
  321. if ($error) return $this->_return_message(1, 'Invalid data.');
  322. // Add post date to meta.
  323. $meta['postdate'] = time();
  324. // We just want a small hash to avoid collisions:
  325. // Half-MD5 (64 bits) will do the trick
  326. $dataid = substr(hash('md5', $data), 0, 16);
  327. $storage = array('data' => $data);
  328. // Add meta-information only if necessary.
  329. if (count($meta)) $storage['meta'] = $meta;
  330. // The user posts a comment.
  331. if (
  332. !empty($_POST['parentid']) &&
  333. !empty($_POST['pasteid'])
  334. )
  335. {
  336. $pasteid = (string) $_POST['pasteid'];
  337. $parentid = (string) $_POST['parentid'];
  338. if (
  339. !filter::is_valid_paste_id($pasteid) ||
  340. !filter::is_valid_paste_id($parentid)
  341. ) return $this->_return_message(1, 'Invalid data.');
  342. // Comments do not expire (it's the paste that expires)
  343. unset($storage['expire_date']);
  344. unset($storage['opendiscussion']);
  345. // Make sure paste exists.
  346. if (
  347. !$this->_model()->exists($pasteid)
  348. ) return $this->_return_message(1, 'Invalid data.');
  349. // Make sure the discussion is opened in this paste.
  350. $paste = $this->_model()->read($pasteid);
  351. if (
  352. !$paste->meta->opendiscussion
  353. ) return $this->_return_message(1, 'Invalid data.');
  354. // Check for improbable collision.
  355. if (
  356. $this->_model()->existsComment($pasteid, $parentid, $dataid)
  357. ) return $this->_return_message(1, 'You are unlucky. Try again.');
  358. // New comment
  359. if (
  360. $this->_model()->createComment($pasteid, $parentid, $dataid, $storage) === false
  361. ) return $this->_return_message(1, 'Error saving comment. Sorry.');
  362. // 0 = no error
  363. return $this->_return_message(0, $dataid);
  364. }
  365. // The user posts a standard paste.
  366. else
  367. {
  368. // Check for improbable collision.
  369. if (
  370. $this->_model()->exists($dataid)
  371. ) return $this->_return_message(1, 'You are unlucky. Try again.');
  372. // Add attachment and its name, if one was sent
  373. if ($has_attachment) $storage['attachment'] = $attachment;
  374. if ($has_attachmentname) $storage['attachmentname'] = $attachmentname;
  375. // New paste
  376. if (
  377. $this->_model()->create($dataid, $storage) === false
  378. ) return $this->_return_message(1, 'Error saving paste. Sorry.');
  379. // Generate the "delete" token.
  380. // The token is the hmac of the pasteid signed with the server salt.
  381. // The paste can be delete by calling http://example.com/zerobin/?pasteid=<pasteid>&deletetoken=<deletetoken>
  382. $deletetoken = hash_hmac('sha1', $dataid, serversalt::get());
  383. // 0 = no error
  384. return $this->_return_message(0, $dataid, array('deletetoken' => $deletetoken));
  385. }
  386. }
  387. /**
  388. * Delete an existing paste
  389. *
  390. * @access private
  391. * @param string $dataid
  392. * @param string $deletetoken
  393. * @return void
  394. */
  395. private function _delete($dataid, $deletetoken)
  396. {
  397. // Is this a valid paste identifier?
  398. if (!filter::is_valid_paste_id($dataid))
  399. {
  400. $this->_error = 'Invalid paste ID.';
  401. return;
  402. }
  403. // Check that paste exists.
  404. if (!$this->_model()->exists($dataid))
  405. {
  406. $this->_error = self::GENERIC_ERROR;
  407. return;
  408. }
  409. // Get the paste itself.
  410. $paste = $this->_model()->read($dataid);
  411. // See if paste has expired.
  412. if (
  413. isset($paste->meta->expire_date) &&
  414. $paste->meta->expire_date < time()
  415. )
  416. {
  417. // Delete the paste
  418. $this->_model()->delete($dataid);
  419. $this->_error = self::GENERIC_ERROR;
  420. return;
  421. }
  422. if ($deletetoken == 'burnafterreading') {
  423. if (
  424. isset($paste->meta->burnafterreading) &&
  425. $paste->meta->burnafterreading
  426. )
  427. {
  428. // Delete the paste
  429. $this->_model()->delete($dataid);
  430. $this->_return_message(0, $dataid);
  431. }
  432. else
  433. {
  434. $this->_return_message(1, 'Paste is not of burn-after-reading type.');
  435. }
  436. return;
  437. }
  438. // Make sure token is valid.
  439. serversalt::setPath($this->_conf['traffic']['dir']);
  440. if (!filter::slow_equals($deletetoken, hash_hmac('sha1', $dataid, serversalt::get())))
  441. {
  442. $this->_error = 'Wrong deletion token. Paste was not deleted.';
  443. return;
  444. }
  445. // Paste exists and deletion token is valid: Delete the paste.
  446. $this->_model()->delete($dataid);
  447. $this->_status = 'Paste was properly deleted.';
  448. }
  449. /**
  450. * Read an existing paste or comment
  451. *
  452. * @access private
  453. * @param string $dataid
  454. * @return void
  455. */
  456. private function _read($dataid)
  457. {
  458. $isJson = false;
  459. if (($pos = strpos($dataid, '&json')) !== false) {
  460. $isJson = true;
  461. $dataid = substr($dataid, 0, $pos);
  462. }
  463. // Is this a valid paste identifier?
  464. if (!filter::is_valid_paste_id($dataid))
  465. {
  466. $this->_error = 'Invalid paste ID.';
  467. return;
  468. }
  469. // Check that paste exists.
  470. if ($this->_model()->exists($dataid))
  471. {
  472. // Get the paste itself.
  473. $paste = $this->_model()->read($dataid);
  474. // See if paste has expired.
  475. if (
  476. isset($paste->meta->expire_date) &&
  477. $paste->meta->expire_date < time()
  478. )
  479. {
  480. // Delete the paste
  481. $this->_model()->delete($dataid);
  482. $this->_error = self::GENERIC_ERROR;
  483. }
  484. // If no error, return the paste.
  485. else
  486. {
  487. // We kindly provide the remaining time before expiration (in seconds)
  488. if (
  489. property_exists($paste->meta, 'expire_date')
  490. ) $paste->meta->remaining_time = $paste->meta->expire_date - time();
  491. // The paste itself is the first in the list of encrypted messages.
  492. $messages = array($paste);
  493. // If it's a discussion, get all comments.
  494. if (
  495. property_exists($paste->meta, 'opendiscussion') &&
  496. $paste->meta->opendiscussion
  497. )
  498. {
  499. $messages = array_merge(
  500. $messages,
  501. $this->_model()->readComments($dataid)
  502. );
  503. }
  504. // set formatter for for the view.
  505. if (!property_exists($paste->meta, 'formatter'))
  506. {
  507. // support < 0.21 syntax highlighting
  508. if (property_exists($paste->meta, 'syntaxcoloring') && $paste->meta->syntaxcoloring === true)
  509. {
  510. $paste->meta->formatter = 'syntaxhighlighting';
  511. }
  512. else
  513. {
  514. $paste->meta->formatter = $this->_getMainConfig('defaultformatter', 'plaintext');
  515. }
  516. }
  517. $this->_data = json_encode($messages);
  518. }
  519. }
  520. else
  521. {
  522. $this->_error = self::GENERIC_ERROR;
  523. }
  524. if ($isJson)
  525. {
  526. if (strlen($this->_error))
  527. {
  528. $this->_return_message(1, $this->_error);
  529. }
  530. else
  531. {
  532. $this->_return_message(0, $dataid, array('messages' => $messages));
  533. }
  534. }
  535. }
  536. /**
  537. * Display ZeroBin frontend.
  538. *
  539. * @access private
  540. * @return void
  541. */
  542. private function _view()
  543. {
  544. // set headers to disable caching
  545. $time = gmdate('D, d M Y H:i:s \G\M\T');
  546. header('Cache-Control: no-store, no-cache, must-revalidate');
  547. header('Pragma: no-cache');
  548. header('Expires: ' . $time);
  549. header('Last-Modified: ' . $time);
  550. header('Vary: Accept');
  551. // label all the expiration options
  552. $expire = array();
  553. foreach ($this->_conf['expire_options'] as $time => $seconds)
  554. {
  555. $expire[$time] = ($seconds == 0) ? i18n::_(ucfirst($time)): filter::time_humanreadable($time);
  556. }
  557. // translate all the formatter options
  558. $formatters = array_map(array('i18n', 'translate'), $this->_conf['formatter_options']);
  559. // set language cookie if that functionality was enabled
  560. $languageselection = '';
  561. if ($this->_getMainConfig('languageselection', false))
  562. {
  563. $languageselection = i18n::getLanguage();
  564. setcookie('lang', $languageselection);
  565. }
  566. $page = new RainTPL;
  567. $page::$path_replace = false;
  568. // we escape it here because ENT_NOQUOTES can't be used in RainTPL templates
  569. $page->assign('CIPHERDATA', htmlspecialchars($this->_data, ENT_NOQUOTES));
  570. $page->assign('ERROR', i18n::_($this->_error));
  571. $page->assign('STATUS', i18n::_($this->_status));
  572. $page->assign('VERSION', self::VERSION);
  573. $page->assign('DISCUSSION', $this->_getMainConfig('discussion', true));
  574. $page->assign('OPENDISCUSSION', $this->_getMainConfig('opendiscussion', true));
  575. $page->assign('MARKDOWN', array_key_exists('markdown', $formatters));
  576. $page->assign('SYNTAXHIGHLIGHTING', array_key_exists('syntaxhighlighting', $formatters));
  577. $page->assign('SYNTAXHIGHLIGHTINGTHEME', $this->_getMainConfig('syntaxhighlightingtheme', ''));
  578. $page->assign('FORMATTER', $formatters);
  579. $page->assign('FORMATTERDEFAULT', $this->_getMainConfig('defaultformatter', 'plaintext'));
  580. $page->assign('NOTICE', i18n::_($this->_getMainConfig('notice', '')));
  581. $page->assign('BURNAFTERREADINGSELECTED', $this->_getMainConfig('burnafterreadingselected', false));
  582. $page->assign('PASSWORD', $this->_getMainConfig('password', true));
  583. $page->assign('FILEUPLOAD', $this->_getMainConfig('fileupload', false));
  584. $page->assign('BASE64JSVERSION', $this->_getMainConfig('base64version', '2.1.9'));
  585. $page->assign('LANGUAGESELECTION', $languageselection);
  586. $page->assign('LANGUAGES', i18n::getLanguageLabels(i18n::getAvailableLanguages()));
  587. $page->assign('EXPIRE', $expire);
  588. $page->assign('EXPIREDEFAULT', $this->_conf['expire']['default']);
  589. $page->draw($this->_getMainConfig('template', 'page'));
  590. }
  591. /**
  592. * get configuration option from [main] section, optionally set a default
  593. *
  594. * @access private
  595. * @param string $option
  596. * @param mixed $default (optional)
  597. * @return mixed
  598. */
  599. private function _getMainConfig($option, $default = false)
  600. {
  601. return array_key_exists($option, $this->_conf['main']) ?
  602. $this->_conf['main'][$option] :
  603. $default;
  604. }
  605. /**
  606. * return JSON encoded message and exit
  607. *
  608. * @access private
  609. * @param bool $status
  610. * @param string $message
  611. * @param array $other
  612. * @return void
  613. */
  614. private function _return_message($status, $message, $other = array())
  615. {
  616. $result = array('status' => $status);
  617. if ($status)
  618. {
  619. $result['message'] = i18n::_($message);
  620. }
  621. else
  622. {
  623. $result['id'] = $message;
  624. }
  625. $result += $other;
  626. $this->_json = json_encode($result);
  627. }
  628. }