source: trunk/include/ws_protocols/php_encoder.php @ 1912

Last change on this file since 1912 was 1912, checked in by rub, 17 years ago

Update svn properties (svn:eol-style and svn:keywords)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
5// +-----------------------------------------------------------------------+
6// | branch        : BSF (Best So Far)
7// | file          : $URL: svn+ssh://rvelices@svn.gna.org/svn/phpwebgallery/trunk/action.php $
8// | last update   : $Date: 2007-03-16 06:30:07 +0000 (Fri, 16 Mar 2007) $
9// | last modifier : $Author: rub $
10// | revision      : $Rev: 1912 $
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27class PwgSerialPhpEncoder extends PwgResponseEncoder
28{
29  function encodeResponse($response)
30  {
31    $respClass = strtolower( get_class($response) );
32    if ($respClass=='pwgerror')
33    {
34      return serialize(
35        array(
36          'stat' => 'fail',
37          'err' => $response->code(),
38          'message' => $response->message(),
39          )
40      );
41    }
42    parent::flattenResponse($response);
43    return serialize(
44        array(
45          'stat' => 'ok',
46          'result' => $response
47      )
48    );
49  }
50
51  function getContentType()
52  {
53    return 'text/plain';
54  }
55}
56
57?>
Note: See TracBrowser for help on using the repository browser.