| 1 |
lars |
1 |
<?php
|
|
|
2 |
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +----------------------------------------------------------------------+
|
|
|
4 |
// | PHP Version 4 |
|
|
|
5 |
// +----------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (c) 1997-2003 The PHP Group |
|
|
|
7 |
// +----------------------------------------------------------------------+
|
|
|
8 |
// | This source file is subject to version 2.02 of the PHP license, |
|
|
|
9 |
// | that is bundled with this package in the file LICENSE, and is |
|
|
|
10 |
// | available at through the world-wide-web at |
|
|
|
11 |
// | http://www.php.net/license/2_02.txt. |
|
|
|
12 |
// | If you did not receive a copy of the PHP license and are unable to |
|
|
|
13 |
// | obtain it through the world-wide-web, please send a note to |
|
|
|
14 |
// | license@php.net so we can mail you a copy immediately. |
|
|
|
15 |
// +----------------------------------------------------------------------+
|
|
|
16 |
// | Authors: Wolfram Kriesing <wolfram@kriesing.de> |
|
|
|
17 |
// +----------------------------------------------------------------------+
|
|
|
18 |
//
|
|
|
19 |
// $Id: Error.php,v 1.8.2.3 2009/03/12 17:19:52 dufuz Exp $
|
|
|
20 |
require_once 'PEAR.php';
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Errors constants definitions
|
|
|
24 |
*/
|
|
|
25 |
define('TREE_ERROR_NOT_IMPLEMENTED', -1);
|
|
|
26 |
define('TREE_ERROR_ELEMENT_NOT_FOUND', -2);
|
|
|
27 |
define('TREE_ERROR_INVALID_NODE_NAME', -3);
|
|
|
28 |
define('TREE_ERROR_MOVE_TO_CHILDREN', -4);
|
|
|
29 |
define('TREE_ERROR_PARENT_ID_MISSED', -5);
|
|
|
30 |
define('TREE_ERROR_INVALID_PARENT', -6);
|
|
|
31 |
define('TREE_ERROR_EMPTY_PATH', -7);
|
|
|
32 |
define('TREE_ERROR_INVALID_PATH', -8);
|
|
|
33 |
define('TREE_ERROR_DB_ERROR', -9);
|
|
|
34 |
define('TREE_ERROR_PATH_SEPARATOR_EMPTY',-10);
|
|
|
35 |
define('TREE_ERROR_CANNOT_CREATE_FOLDER',-11);
|
|
|
36 |
define('TREE_ERROR_UNKNOW_ERROR', -99);
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
*
|
|
|
40 |
*
|
|
|
41 |
* @author Wolfram Kriesing <wolfram@kriesing.de>
|
|
|
42 |
* @package Tree
|
|
|
43 |
*/
|
|
|
44 |
class Tree_Error extends PEAR_Error
|
|
|
45 |
{
|
|
|
46 |
/**
|
|
|
47 |
* @var string prefix for error messages.
|
|
|
48 |
*/
|
|
|
49 |
var $error_message_prefix = "Tree Error: ";
|
|
|
50 |
|
|
|
51 |
// {{{ Tree_Error()
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
* @access public
|
|
|
55 |
* @version 2002/03/03
|
|
|
56 |
* @author Wolfram Kriesing <wolfram@kriesing.de>
|
|
|
57 |
*/
|
|
|
58 |
function Tree_Error($msg, $line, $file,
|
|
|
59 |
$mode = null, $userinfo = 'no userinfo')
|
|
|
60 |
{
|
|
|
61 |
$this->PEAR_Error(sprintf("%s <br/>in %s [%d].", $msg, $file, $line),
|
|
|
62 |
null , $mode , null, $userinfo );
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
// }}}
|
|
|
66 |
// {{{ getMessage()
|
|
|
67 |
|
|
|
68 |
function getMessage($id)
|
|
|
69 |
{
|
|
|
70 |
$messages = array(
|
|
|
71 |
TREE_ERROR_NOT_IMPLEMENTED => '',
|
|
|
72 |
TREE_ERROR_INVALID_PATH => '',
|
|
|
73 |
TREE_ERROR_DB_ERROR => '',
|
|
|
74 |
TREE_ERROR_PARENT_ID_MISSED => '',
|
|
|
75 |
TREE_ERROR_MOVE_TO_CHILDREN => '',
|
|
|
76 |
TREE_ERROR_ELEMENT_NOT_FOUND => '',
|
|
|
77 |
TREE_ERROR_PATH_SEPARATOR_EMPTY => '',
|
|
|
78 |
TREE_ERROR_INVALID_NODE_NAME => '',
|
|
|
79 |
TREE_ERROR_UNKNOW_ERROR => ''
|
|
|
80 |
);
|
|
|
81 |
return isset($messages[$id])?$messages[$id]:
|
|
|
82 |
$messages[TREE_ERROR_UNKNOW_ERROR];
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
// }}}
|
|
|
86 |
}
|