From f4bca04edcff9a7e3189601424173a67e2e4dc13 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Tue, 24 Jan 2012 17:26:45 -0500
Subject: [PATCH 01/29] CC-3270: Update "airtime-update-db-settings.py" fails
-fixed. We no longer need to run phing.
---
utils/airtime-update-db-settings.py | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/utils/airtime-update-db-settings.py b/utils/airtime-update-db-settings.py
index ff292a460..d28322fb1 100644
--- a/utils/airtime-update-db-settings.py
+++ b/utils/airtime-update-db-settings.py
@@ -2,7 +2,7 @@
The purpose of this script is to consolidate into one location where
we need to update database host, dbname, username and password.
-This script reads from airtime.conf.
+This script reads from /etc/airtime/airtime.conf.
"""
import os
import sys
@@ -14,9 +14,11 @@ if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
+airtime_conf = '/etc/airtime/airtime.conf'
+
#Read the universal values
parser = ConfigParser.SafeConfigParser()
-parser.read('/etc/airtime/airtime.conf')
+parser.read(airtime_conf)
host = 'resources.db.params.host'
dbname = 'resources.db.params.dbname'
@@ -24,7 +26,11 @@ username = 'resources.db.params.username'
password = 'resources.db.params.password'
airtime_dir = parser.get('general', 'airtime_dir')
-print 'Airtime root folder found at %s' % airtime_dir
+if os.path.exists(airtime_dir):
+ print 'Airtime root folder found at %s' % airtime_dir
+else:
+ print 'Could not find Airtime root folder specified by "airtime_dir" in %s' % airtime_conf
+ sys.exit(1)
print ("Updating %s/application/configs/application.ini" % airtime_dir)
f = file('%s/application/configs/application.ini' % airtime_dir,'r')
@@ -47,7 +53,7 @@ f.writelines(file_lines)
f.close()
-print ("Updating %s/build.properties" % airtime_dir)
+print ("Updating %s/build/build.properties" % airtime_dir)
f = file('%s/build/build.properties' % airtime_dir, 'r')
file_lines = []
@@ -66,7 +72,7 @@ f = file('%s/build/build.properties' % airtime_dir, 'w')
f.writelines(file_lines)
f.close()
-print ("Updating %s/runtime-conf.xml" % airtime_dir)
+print ("Updating %s/build/runtime-conf.xml" % airtime_dir)
doc = xml.dom.minidom.parse('%s/build/runtime-conf.xml' % airtime_dir)
@@ -78,6 +84,4 @@ xml_file = open('%s/build/runtime-conf.xml' % airtime_dir, "w")
xml_file.writelines(doc.toxml('utf-8'))
xml_file.close()
-print 'Regenerating propel-config.php'
-os.system('cd %s/build && %s/library/propel/generator/bin/propel-gen' % (airtime_dir, airtime_dir))
-
+print "Success!"
From c0e71dc58d3171dc310d076579c78450a7d91059 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Wed, 25 Jan 2012 02:26:46 -0500
Subject: [PATCH 02/29] -Some user-friendly changes to upgrade script
---
.../airtime-2.0.0/airtime-upgrade.php | 30 +++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
index 48f9a6b58..8ca0fc63e 100644
--- a/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
+++ b/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
@@ -32,8 +32,10 @@ class AirtimeDatabaseUpgrade{
public static function start(){
self::doDbMigration();
- self::SetDefaultTimezone();
self::setPhpDefaultTimeZoneToSystemTimezone();
+ self::SetDefaultTimezone();
+
+ echo "* Converting database to store all schedule times in UTC. This may take a a while...".PHP_EOL;
self::convert_cc_playlist();
self::convert_cc_schedule();
self::convert_cc_show_days();
@@ -69,6 +71,7 @@ class AirtimeDatabaseUpgrade{
}
private static function convert_cc_playlist(){
+ echo " * Converting playlists to UTC".PHP_EOL;
/* cc_playlist has a field that keeps track of when the playlist was last modified. */
$playlists = CcPlaylistQuery::create()->find();
@@ -78,10 +81,14 @@ class AirtimeDatabaseUpgrade{
$pl->setDbMtime($dt);
$pl->save();
+ echo ".";
}
+
+ echo PHP_EOL;
}
private static function convert_cc_schedule(){
+ echo " * Converting schedule to UTC".PHP_EOL;
/* cc_schedule has start and end fields that need to be changed to UTC. */
$schedules = CcScheduleQuery::create()->find();
@@ -95,10 +102,15 @@ class AirtimeDatabaseUpgrade{
$s->setDbEnds($dt);
$s->save();
+ echo ".";
}
+
+ echo PHP_EOL;
}
private static function convert_cc_show_days(){
+ echo " * Converting show days to UTC".PHP_EOL;
+
/* cc_show_days has first_show, last_show and start_time fields that need to be changed to UTC. */
$showDays = CcShowDaysQuery::create()->find();
@@ -118,11 +130,15 @@ class AirtimeDatabaseUpgrade{
$sd->setDbTimezone(date_default_timezone_get())->save();
-
+ echo ".";
}
+
+ echo PHP_EOL;
}
private static function convert_cc_show_instances(){
+ echo " * Converting show instances to UTC".PHP_EOL;
+
/* convert_cc_show_instances has starts and ends fields that need to be changed to UTC. */
$showInstances = CcShowInstancesQuery::create()->find();
@@ -136,7 +152,11 @@ class AirtimeDatabaseUpgrade{
$si->setDbEnds($dt);
$si->save();
+
+ echo ".";
}
+
+ echo PHP_EOL;
}
private static function doDbMigration(){
@@ -356,9 +376,15 @@ class AirtimeMiscUpgrade{
}
}
+echo "Pausing Pypo".PHP_EOL;
+exec("/etc/init.d/airtime-playout stop");
+
UpgradeCommon::connectToDatabase();
AirtimeDatabaseUpgrade::start();
AirtimeStorWatchedDirsUpgrade::start();
AirtimeConfigFileUpgrade::start();
AirtimeMiscUpgrade::start();
+
+echo "Resuming Pypo".PHP_EOL;
+exec("/etc/init.d/airtime-playout start");
From 6215eb0dba6e7b631cd42d11f0c52a1f130d38c6 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Wed, 25 Jan 2012 03:28:20 -0500
Subject: [PATCH 03/29] -fix upgrade for large result sets.
---
.../upgrades/airtime-2.0.0/UpgradeCommon.php | 12 ++
.../airtime-2.0.0/airtime-upgrade.php | 129 ++++++++++++++----
python_apps/pypo/install/pypo-initialize.py | 6 +-
3 files changed, 115 insertions(+), 32 deletions(-)
diff --git a/install_minimal/upgrades/airtime-2.0.0/UpgradeCommon.php b/install_minimal/upgrades/airtime-2.0.0/UpgradeCommon.php
index 13836d6cd..ee638adfa 100644
--- a/install_minimal/upgrades/airtime-2.0.0/UpgradeCommon.php
+++ b/install_minimal/upgrades/airtime-2.0.0/UpgradeCommon.php
@@ -234,4 +234,16 @@ class UpgradeCommon{
}
fclose($fp);
}
+
+ public static function queryDb($p_sql){
+ global $CC_DBC;
+
+ $result = $CC_DBC->query($p_sql);
+ if (PEAR::isError($result)) {
+ echo "Error executing $sql. Exiting.";
+ exit(1);
+ }
+
+ return $result;
+ }
}
diff --git a/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
index 8ca0fc63e..69c35175a 100644
--- a/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
+++ b/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
@@ -72,7 +72,28 @@ class AirtimeDatabaseUpgrade{
private static function convert_cc_playlist(){
echo " * Converting playlists to UTC".PHP_EOL;
- /* cc_playlist has a field that keeps track of when the playlist was last modified. */
+
+ $sql = "SELECT * FROM cc_playlist";
+ $result = UpgradeCommon::queryDb($sql);
+
+ while ($result->fetchInto($row, DB_FETCHMODE_ASSOC)){
+ $dt = new DateTime($row['mtime'], new DateTimeZone(date_default_timezone_get()));
+ $dt->setTimezone(new DateTimeZone("UTC"));
+
+ $id = $row['id'];
+ $mtime = $dt->format("Y-m-d H:i:s");
+
+ $sql = "UPDATE cc_playlist SET mtime = '$mtime' WHERE id = $id";
+ UpgradeCommon::queryDb($sql);
+ //echo ".";
+ //flush();
+ //usleep(100000);
+ }
+
+
+ /*
+ echo " * Converting playlists to UTC".PHP_EOL;
+ // cc_playlist has a field that keeps track of when the playlist was last modified.
$playlists = CcPlaylistQuery::create()->find();
foreach ($playlists as $pl){
@@ -81,15 +102,39 @@ class AirtimeDatabaseUpgrade{
$pl->setDbMtime($dt);
$pl->save();
- echo ".";
+
}
-
- echo PHP_EOL;
+ */
}
private static function convert_cc_schedule(){
+
echo " * Converting schedule to UTC".PHP_EOL;
- /* cc_schedule has start and end fields that need to be changed to UTC. */
+
+ $sql = "SELECT * FROM cc_schedule";
+ $result = UpgradeCommon::queryDb($sql);
+
+ while ($result->fetchInto($row, DB_FETCHMODE_ASSOC)){
+ $dtStarts = new DateTime($row['starts'], new DateTimeZone(date_default_timezone_get()));
+ $dtStarts->setTimezone(new DateTimeZone("UTC"));
+
+ $dtEnds = new DateTime($row['ends'], new DateTimeZone(date_default_timezone_get()));
+ $dtEnds->setTimezone(new DateTimeZone("UTC"));
+
+ $id = $row['id'];
+ $starts = $dtStarts->format("Y-m-d H:i:s");
+ $ends = $dtEnds->format("Y-m-d H:i:s");
+
+ $sql = "UPDATE cc_schedule SET starts = '$starts', ends = '$ends' WHERE id = $id";
+ UpgradeCommon::queryDb($sql);
+ //echo ".";
+ //flush();
+ //usleep(100000);
+ }
+ /*
+
+ echo " * Converting schedule to UTC".PHP_EOL;
+ //cc_schedule has start and end fields that need to be changed to UTC.
$schedules = CcScheduleQuery::create()->find();
foreach ($schedules as $s){
@@ -104,42 +149,67 @@ class AirtimeDatabaseUpgrade{
$s->save();
echo ".";
}
-
- echo PHP_EOL;
+ * */
}
private static function convert_cc_show_days(){
+
echo " * Converting show days to UTC".PHP_EOL;
- /* cc_show_days has first_show, last_show and start_time fields that need to be changed to UTC. */
+ $sql = "SELECT * FROM cc_show_days";
+ $result = UpgradeCommon::queryDb($sql);
+
+ while ($result->fetchInto($row, DB_FETCHMODE_ASSOC)){
+
+ $id = $row['id'];
+ $timezone = date_default_timezone_get();
+
+ $sql = "UPDATE cc_show_days SET timezone = '$timezone' WHERE id = $id";
+ UpgradeCommon::queryDb($sql);
+ //echo ".";
+ //flush();
+ //usleep(100000);
+ }
+
+ /*
+ // cc_show_days has first_show, last_show and start_time fields that need to be changed to UTC.
$showDays = CcShowDaysQuery::create()->find();
- foreach ($showDays as $sd){
- /*
- $dt = new DateTime($sd->getDbFirstShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
- $dt->setTimezone(new DateTimeZone("UTC"));
- $sd->setDbFirstShow($dt->format("Y-m-d"));
- $sd->setDbStartTime($dt->format("H:i:s"));
-
- $dt = new DateTime($sd->getDbLastShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
- $dt->setTimezone(new DateTimeZone("UTC"));
- $sd->setDbLastShow($dt->format("Y-m-d"));
-
- $sd->save();
- * */
-
+ foreach ($showDays as $sd){
$sd->setDbTimezone(date_default_timezone_get())->save();
echo ".";
}
-
- echo PHP_EOL;
+ */
}
private static function convert_cc_show_instances(){
echo " * Converting show instances to UTC".PHP_EOL;
- /* convert_cc_show_instances has starts and ends fields that need to be changed to UTC. */
+ // convert_cc_show_instances has starts and ends fields that need to be changed to UTC.
+
+ $sql = "SELECT * FROM cc_show_instances";
+ $result = UpgradeCommon::queryDb($sql);
+
+ while ($result->fetchInto($row, DB_FETCHMODE_ASSOC)){
+ $dtStarts = new DateTime($row['starts'], new DateTimeZone(date_default_timezone_get()));
+ $dtStarts->setTimezone(new DateTimeZone("UTC"));
+
+ $dtEnds = new DateTime($row['ends'], new DateTimeZone(date_default_timezone_get()));
+ $dtEnds->setTimezone(new DateTimeZone("UTC"));
+
+ $id = $row['id'];
+ $starts = $dtStarts->format("Y-m-d H:i:s");
+ $ends = $dtEnds->format("Y-m-d H:i:s");
+
+ $sql = "UPDATE cc_show_instances SET starts = '$starts', ends = '$ends' WHERE id = $id";
+ UpgradeCommon::queryDb($sql);
+ //echo ".";
+ //flush();
+ //usleep(100000);
+ }
+
+ /*
$showInstances = CcShowInstancesQuery::create()->find();
foreach ($showInstances as $si){
@@ -155,8 +225,7 @@ class AirtimeDatabaseUpgrade{
echo ".";
}
-
- echo PHP_EOL;
+ * */
}
private static function doDbMigration(){
@@ -379,6 +448,8 @@ class AirtimeMiscUpgrade{
echo "Pausing Pypo".PHP_EOL;
exec("/etc/init.d/airtime-playout stop");
+while (@ob_end_flush());
+
UpgradeCommon::connectToDatabase();
AirtimeDatabaseUpgrade::start();
@@ -386,5 +457,5 @@ AirtimeStorWatchedDirsUpgrade::start();
AirtimeConfigFileUpgrade::start();
AirtimeMiscUpgrade::start();
-echo "Resuming Pypo".PHP_EOL;
-exec("/etc/init.d/airtime-playout start");
+//echo "Resuming Pypo".PHP_EOL;
+//exec("/etc/init.d/airtime-playout start");
diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py
index 9df8245aa..4fce8f81c 100644
--- a/python_apps/pypo/install/pypo-initialize.py
+++ b/python_apps/pypo/install/pypo-initialize.py
@@ -106,13 +106,13 @@ try:
print "* Waiting for pypo processes to start..."
if os.environ["liquidsoap_keep_alive"] == "f":
print " * Restarting any previous Liquidsoap instances"
- p = Popen("/etc/init.d/airtime-playout stop", shell=True)
+ p = Popen("/etc/init.d/airtime-playout stop > /dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
else:
print " * Keeping any previous Liquidsoap instances running"
- p = Popen("/etc/init.d/airtime-playout pypo-stop", shell=True)
+ p = Popen("/etc/init.d/airtime-playout pypo-stop > /dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
- p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
+ p = Popen("/etc/init.d/airtime-playout start-no-monit > /dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
except Exception, e:
From 9cf8bdcad8ec6c53d4ccb8ee09741212f1d0ff86 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Wed, 25 Jan 2012 09:16:39 -0500
Subject: [PATCH 04/29] set max bitrate to 320 on airtime-upgrade
---
install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
index 69c35175a..ddc3d9646 100644
--- a/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
+++ b/install_minimal/upgrades/airtime-2.0.0/airtime-upgrade.php
@@ -247,7 +247,7 @@ class AirtimeDatabaseUpgrade{
$sql = "INSERT INTO cc_pref(keystr, valstr) VALUES('stream_type', 'ogg, mp3');
INSERT INTO cc_pref(keystr, valstr) VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
INSERT INTO cc_pref(keystr, valstr) VALUES('num_of_streams', '3');
- INSERT INTO cc_pref(keystr, valstr) VALUES('max_bitrate', '128');
+ INSERT INTO cc_pref(keystr, valstr) VALUES('max_bitrate', '320');
INSERT INTO cc_pref(keystr, valstr) VALUES('plan_level', 'disabled');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean');
From 2027db3609753364fa469709e9b9d3f55f4b7ba9 Mon Sep 17 00:00:00 2001
From: James
Date: Wed, 25 Jan 2012 14:12:19 -0500
Subject: [PATCH 05/29] SAAS-178: Demo instance should prevent changing of
admin password
- Error msg is returned when try to update admin account
---
airtime_mvc/application/controllers/UserController.php | 7 ++++++-
airtime_mvc/public/css/styles.css | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php
index 37404931c..3c8b993f2 100644
--- a/airtime_mvc/application/controllers/UserController.php
+++ b/airtime_mvc/application/controllers/UserController.php
@@ -19,6 +19,8 @@ class UserController extends Zend_Controller_Action
public function addUserAction()
{
+ global $CC_CONFIG;
+
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
@@ -33,7 +35,10 @@ class UserController extends Zend_Controller_Action
if ($form->isValid($request->getPost())) {
$formdata = $form->getValues();
- if ($form->validateLogin($formdata)){
+ if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 && $formdata['login'] == 'admin' && $formdata['user_id'] != 0){
+ $this->view->successMessage = "Specific action is not allowed in demo version!
";
+ }
+ else if ($form->validateLogin($formdata)){
$user = new Application_Model_User($formdata['user_id']);
$user->setFirstName($formdata['first_name']);
$user->setLastName($formdata['last_name']);
diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css
index 7b95307f7..56129f751 100644
--- a/airtime_mvc/public/css/styles.css
+++ b/airtime_mvc/public/css/styles.css
@@ -1338,6 +1338,15 @@ div.success{
border:1px solid #488214;
}
+div.errors{
+ color:#902d2d;
+ font-size:11px;
+ padding:2px 4px;
+ background:#c6b4b4;
+ margin-bottom:2px;
+ border:1px solid #c83f3f;
+}
+
.collapsible-header, .collapsible-header-disabled {
border: 1px solid #8f8f8f;
background-color: #cccccc;
From 9f2d0fc8d534a5f4f1751a90e379f9d86ae84adc Mon Sep 17 00:00:00 2001
From: james
Date: Fri, 27 Jan 2012 15:30:44 -0500
Subject: [PATCH 06/29] CC-3284: Version the javascript directories so that
upgrades work correctly for clients.
- appended timestamp of last modified time on all js and css file import
---
airtime_mvc/application/Bootstrap.php | 30 +++++++++---------
.../controllers/DashboardController.php | 4 ++-
.../controllers/LibraryController.php | 17 +++++-----
.../controllers/LoginController.php | 3 +-
.../controllers/NowplayingController.php | 18 ++++++-----
.../controllers/PlaylistController.php | 5 +--
.../controllers/PluploadController.php | 9 +++---
.../controllers/PreferenceController.php | 16 ++++++----
.../controllers/ScheduleController.php | 31 ++++++++++---------
.../controllers/SystemstatusController.php | 5 +--
.../controllers/UserController.php | 8 +++--
11 files changed, 82 insertions(+), 64 deletions(-)
diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 60a9c9a64..09433a9c8 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -52,37 +52,39 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
$view = $this->getResource('view');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css');
- $view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css');
- $view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css');
- $view->headLink()->appendStylesheet($baseUrl.'/css/styles.css');
+ $view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css?'.filemtime($baseDir.'/css/redmond/jquery-ui-1.8.8.custom.css'));
+ $view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css?'.filemtime($baseDir.'/css/pro_dropdown_3.css'));
+ $view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css?'.filemtime($baseDir.'/css/qtip/jquery.qtip.min.css'));
+ $view->headLink()->appendStylesheet($baseUrl.'/css/styles.css?'.filemtime($baseDir.'/css/styles.css'));
}
protected function _initHeadScript()
{
$view = $this->getResource('view');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.5.2.min.js','text/javascript');
- $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.11.custom.min.js','text/javascript');
- $view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js','text/javascript');
- $view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip2.min.js','text/javascript');
- $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js');
+ $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.5.2.min.js?'.filemtime($baseDir.'/js/libs/jquery-1.5.2.min.js'),'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.11.custom.min.js?'.filemtime($baseDir.'/js/libs/jquery-ui-1.8.11.custom.min.js'),'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js?'.filemtime($baseDir.'/js/libs/jquery.stickyPanel.js'),'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip2.min.js?'.filemtime($baseDir.'/js/qtip/jquery.qtip2.min.js'),'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.filemtime($baseDir.'/js/jplayer/jquery.jplayer.min.js'));
$view->headScript()->appendScript("var baseUrl='$baseUrl/'");
//scripts for now playing bar
- $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript');
- $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js','text/javascript');
- $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js','text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js?'.filemtime($baseDir.'/js/airtime/dashboard/helperfunctions.js'),'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js?'.filemtime($baseDir.'/js/airtime/dashboard/playlist.js'),'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js?'.filemtime($baseDir.'/js/airtime/dashboard/versiontooltip.js'),'text/javascript');
- $view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js','text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.filemtime($baseDir.'/js/airtime/common/common.js'),'text/javascript');
if (Application_Model_Preference::GetPlanLevel() != "disabled"
&& $_SERVER['REQUEST_URI'] != '/Dashboard/stream-player') {
$client_id = Application_Model_Preference::GetClientId();
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
- $view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js', 'text/javascript');
+ $view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.filemtime($baseDir.'/js/airtime/common/livechat.js'), 'text/javascript');
}
}
diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php
index afdb26f33..b2a1e80a9 100644
--- a/airtime_mvc/application/controllers/DashboardController.php
+++ b/airtime_mvc/application/controllers/DashboardController.php
@@ -17,7 +17,9 @@ class DashboardController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
- $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css');
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
+
+ $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css?'.filemtime($baseDir.'/js/jplayer/skin/jplayer.blue.monday.css'));
$this->_helper->layout->setLayout('bare');
$logo = Application_Model_Preference::GetStationLogo();
diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php
index f0b72099d..25813af73 100644
--- a/airtime_mvc/application/controllers/LibraryController.php
+++ b/airtime_mvc/application/controllers/LibraryController.php
@@ -26,16 +26,17 @@ class LibraryController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js?'.filemtime($baseDir.'/js/contextmenu/jjmenu.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.pluginAPI.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.filemtime($baseDir.'/js/airtime/library/library.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js?'.filemtime($baseDir.'/js/airtime/library/advancedsearch.js'),'text/javascript');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.filemtime($baseDir.'/css/media_library.css'));
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css?'.filemtime($baseDir.'/css/contextmenu.css'));
$this->_helper->layout->setLayout('library');
diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php
index b8c786be9..565b76f85 100644
--- a/airtime_mvc/application/controllers/LoginController.php
+++ b/airtime_mvc/application/controllers/LoginController.php
@@ -23,8 +23,9 @@ class LoginController extends Zend_Controller_Action
$error = false;
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js?'.filemtime($baseDir.'/js/airtime/login/login.js'),'text/javascript');
$form = new Application_Form_Login();
diff --git a/airtime_mvc/application/controllers/NowplayingController.php b/airtime_mvc/application/controllers/NowplayingController.php
index 39841ab78..8c0e6c046 100644
--- a/airtime_mvc/application/controllers/NowplayingController.php
+++ b/airtime_mvc/application/controllers/NowplayingController.php
@@ -16,14 +16,15 @@ class NowplayingController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.min.js'),'text/javascript');
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.filemtime($baseDir.'/js/airtime/nowplaying/nowplayingdatagrid.js'),'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js?'.filemtime($baseDir.'/js/airtime/nowplaying/nowview.js'),'text/javascript');
$refer_sses = new Zend_Session_Namespace('referrer');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
@@ -67,7 +68,7 @@ class NowplayingController extends Zend_Controller_Action
$this->view->logoImg = $logo;
}
$this->view->dialog = $form;
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.filemtime($baseDir.'/js/airtime/nowplaying/register.js'),'text/javascript');
}
}else{
//popup if previous page was login
@@ -82,7 +83,7 @@ class NowplayingController extends Zend_Controller_Action
$this->view->logoImg = $logo;
}
$this->view->dialog = $form;
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.filemtime($baseDir.'/js/airtime/nowplaying/register.js'),'text/javascript');
}
}
}
@@ -106,14 +107,15 @@ class NowplayingController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.min.js'),'text/javascript');
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.filemtime($baseDir.'/js/airtime/nowplaying/nowplayingdatagrid.js'),'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js?'.filemtime($baseDir.'/js/airtime/nowplaying/dayview.js'),'text/javascript');
}
public function remindmeAction()
diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php
index 9c3bc11ec..5f78bdd2d 100644
--- a/airtime_mvc/application/controllers/PlaylistController.php
+++ b/airtime_mvc/application/controllers/PlaylistController.php
@@ -79,9 +79,10 @@ class PlaylistController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js','text/javascript');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.filemtime($baseDir.'/js/airtime/library/spl.js'),'text/javascript');
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.filemtime($baseDir.'/css/playlist_builder.css'));
$this->_helper->viewRenderer->setResponseSegment('spl');
$pl = $this->getPlaylist();
diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php
index df893ce0e..0a650498a 100644
--- a/airtime_mvc/application/controllers/PluploadController.php
+++ b/airtime_mvc/application/controllers/PluploadController.php
@@ -15,12 +15,13 @@ class PluploadController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/plupload.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js?'.filemtime($baseDir.'/js/plupload/plupload.full.min.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js?'.filemtime($baseDir.'/js/plupload/jquery.plupload.queue.min.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/plupload.js?'.filemtime($baseDir.'/js/airtime/library/plupload.js'),'text/javascript');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/plupload.queue.css');
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/plupload.queue.css?'.filemtime($baseDir.'/css/plupload.queue.css'));
}
public function uploadAction()
diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php
index 03ddd677b..62b9343b4 100644
--- a/airtime_mvc/application/controllers/PreferenceController.php
+++ b/airtime_mvc/application/controllers/PreferenceController.php
@@ -21,8 +21,9 @@ class PreferenceController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js?'.filemtime($baseDir.'/js/airtime/preferences/preferences.js'),'text/javascript');
$this->view->statusMsg = "";
$form = new Application_Form_Preferences();
@@ -58,8 +59,9 @@ class PreferenceController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.filemtime($baseDir.'/js/airtime/preferences/support-setting.js'),'text/javascript');
$this->view->statusMsg = "";
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
@@ -117,9 +119,10 @@ class PreferenceController extends Zend_Controller_Action
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js?'.filemtime($baseDir.'/js/serverbrowse/serverbrowser.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js?'.filemtime($baseDir.'/js/airtime/preferences/musicdirs.js'),'text/javascript');
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
@@ -131,9 +134,10 @@ class PreferenceController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.filemtime($baseDir.'/js/airtime/preferences/streamsetting.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js?'.filemtime($baseDir.'/js/meioMask/jquery.meio.mask.js'),'text/javascript');
// get current settings
$temp = Application_Model_StreamSetting::getStreamSetting();
diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index 0110ea335..82d7214f0 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -39,27 +39,28 @@ class ScheduleController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js?'.filemtime($baseDir.'/js/contextmenu/jjmenu.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.pluginAPI.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js?'.filemtime($baseDir.'/js/fullcalendar/fullcalendar.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js?'.filemtime($baseDir.'/js/timepicker/jquery.ui.timepicker-0.0.6.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js?'.filemtime($baseDir.'/js/colorpicker/js/colorpicker.js'),'text/javascript');
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js?'.filemtime($baseDir.'/js/airtime/schedule/full-calendar-functions.js'),'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js?'.filemtime($baseDir.'/js/airtime/schedule/add-show.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js?'.filemtime($baseDir.'/js/airtime/schedule/schedule.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js?'.filemtime($baseDir.'/js/meioMask/jquery.meio.mask.js'),'text/javascript');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
- $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css?'.filemtime($baseDir.'/css/jquery-ui-timepicker.css'));
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css?'.filemtime($baseDir.'/css/fullcalendar.css'));
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css?'.filemtime($baseDir.'/css/colorpicker/css/colorpicker.css'));
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css?'.filemtime($baseDir.'/css/add-show.css'));
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css?'.filemtime($baseDir.'/css/contextmenu.css'));
Application_Model_Schedule::createNewFormSections($this->view);
diff --git a/airtime_mvc/application/controllers/SystemstatusController.php b/airtime_mvc/application/controllers/SystemstatusController.php
index 3ed5e2508..35feec893 100644
--- a/airtime_mvc/application/controllers/SystemstatusController.php
+++ b/airtime_mvc/application/controllers/SystemstatusController.php
@@ -6,9 +6,10 @@ class SystemstatusController extends Zend_Controller_Action
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js','text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js?'.filemtime($baseDir.'/js/airtime/status/status.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.filemtime($baseDir.'/js/sprintf/sprintf-0.7-beta1.js'),'text/javascript');
}
public function indexAction()
diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php
index 3c8b993f2..30e39cfcd 100644
--- a/airtime_mvc/application/controllers/UserController.php
+++ b/airtime_mvc/application/controllers/UserController.php
@@ -23,9 +23,11 @@ class UserController extends Zend_Controller_Action
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/user/user.js','text/javascript');
+ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
+
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.pluginAPI.js'),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/user/user.js?'.filemtime($baseDir.'/js/airtime/user/user.js'),'text/javascript');
$form = new Application_Form_AddUser();
From c5f3e40397b0933232b5fda2b9e4c1642657f17f Mon Sep 17 00:00:00 2001
From: James
Date: Mon, 30 Jan 2012 16:28:27 -0500
Subject: [PATCH 07/29] SAAS-174: Ability to add Google Analytics to the demo
instance
- done
---
airtime_mvc/application/Bootstrap.php | 19 +++++++++++++++++++
.../application/layouts/scripts/bare.phtml | 1 +
.../application/layouts/scripts/layout.phtml | 1 +
.../application/layouts/scripts/library.phtml | 1 +
.../application/layouts/scripts/login.phtml | 1 +
.../application/layouts/scripts/search.phtml | 1 +
6 files changed, 24 insertions(+)
diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 09433a9c8..69269b3b4 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -62,6 +62,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initHeadScript()
{
+ global $CC_CONFIG;
+
$view = $this->getResource('view');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
@@ -86,6 +88,23 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
$view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.filemtime($baseDir.'/js/airtime/common/livechat.js'), 'text/javascript');
}
+ if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1){
+ // since we need to append google analytic code right before we can't use appendFile function
+ // we will just store raw html into some variable
+ $view->google_analytics = "";
+ }
}
protected function _initViewHelpers()
diff --git a/airtime_mvc/application/layouts/scripts/bare.phtml b/airtime_mvc/application/layouts/scripts/bare.phtml
index 43c42463c..b89443505 100644
--- a/airtime_mvc/application/layouts/scripts/bare.phtml
+++ b/airtime_mvc/application/layouts/scripts/bare.phtml
@@ -5,6 +5,7 @@
Live stream
headScript() ?>
headLink() ?>
+ google_analytics)?$this->google_analytics:"" ?>
layout()->content ?>
diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml
index 53ff557d1..10e6a5ec9 100644
--- a/airtime_mvc/application/layouts/scripts/layout.phtml
+++ b/airtime_mvc/application/layouts/scripts/layout.phtml
@@ -5,6 +5,7 @@
headTitle() ?>
headScript() ?>
headLink() ?>
+ google_analytics)?$this->google_analytics:"" ?>
diff --git a/airtime_mvc/application/layouts/scripts/library.phtml b/airtime_mvc/application/layouts/scripts/library.phtml
index 1241dfb50..b2982c1f4 100644
--- a/airtime_mvc/application/layouts/scripts/library.phtml
+++ b/airtime_mvc/application/layouts/scripts/library.phtml
@@ -5,6 +5,7 @@
headTitle() ?>
headScript() ?>
headLink() ?>
+ google_analytics)?$this->google_analytics:"" ?>
diff --git a/airtime_mvc/application/layouts/scripts/login.phtml b/airtime_mvc/application/layouts/scripts/login.phtml
index 88328f2c5..e91b735ee 100644
--- a/airtime_mvc/application/layouts/scripts/login.phtml
+++ b/airtime_mvc/application/layouts/scripts/login.phtml
@@ -5,6 +5,7 @@
headTitle() ?>
headScript() ?>
headLink() ?>
+ google_analytics)?$this->google_analytics:"" ?>
diff --git a/airtime_mvc/application/layouts/scripts/search.phtml b/airtime_mvc/application/layouts/scripts/search.phtml
index 8cedbe21b..c3195b101 100644
--- a/airtime_mvc/application/layouts/scripts/search.phtml
+++ b/airtime_mvc/application/layouts/scripts/search.phtml
@@ -5,6 +5,7 @@
headTitle() ?>
headScript() ?>
headLink() ?>
+ google_analytics)?$this->google_analytics:"" ?>
partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
From 733b23e7fc94bab39590f0c37e7c7ebfe96876fb Mon Sep 17 00:00:00 2001
From: James
Date: Tue, 31 Jan 2012 11:22:30 -0500
Subject: [PATCH 08/29] CC-3286: Shows not recorded after upgrade to 2.0.0 from
1.8.2
- The issue was that the recorder wasn't pulling any schedule from
Airtime. It should pull it when real timeout(every 1 hr) happens
---
python_apps/show-recorder/recorder.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py
index 80bc4ada8..1cd4425a1 100644
--- a/python_apps/show-recorder/recorder.py
+++ b/python_apps/show-recorder/recorder.py
@@ -180,6 +180,7 @@ class CommandListener():
self.current_schedule = {}
self.shows_to_record = {}
self.time_till_next_show = 3600
+ self.real_timeout = True
self.logger.info("RecorderFetch: init complete")
self.server_timezone = '';
@@ -240,11 +241,13 @@ class CommandListener():
next_show = getDateTimeObj(start_time)
delta = next_show - tnow
+ self.real_timeout = False
out = delta.seconds
self.logger.debug("Next show %s", next_show)
self.logger.debug("Now %s", tnow)
else:
+ self.real_timeout = True
out = 3600
return out
@@ -306,6 +309,8 @@ class CommandListener():
self.logger.error(e)
loops = 1
+ recording = False
+
while True:
self.logger.info("Loop #%s", loops)
try:
@@ -315,10 +320,19 @@ class CommandListener():
self.logger.info(s)
# start recording
self.start_record()
+
+ # if real timeout happended get show schedule from airtime
+ if self.real_timeout :
+ temp = self.api_client.get_shows_to_record()
+ if temp is not None:
+ shows = temp['shows']
+ self.server_timezone = temp['server_timezone']
+ self.parse_shows(shows)
+ self.logger.info("Real Timeout: the schedule has updated")
+
except Exception, e:
self.logger.info(e)
time.sleep(3)
-
loops += 1
if __name__ == '__main__':
From 4874eb4f34801c5e08cead5c28564cb3529b51bc Mon Sep 17 00:00:00 2001
From: James
Date: Tue, 31 Jan 2012 11:37:12 -0500
Subject: [PATCH 09/29] CC-3286: Shows not recorded after upgrade to 2.0.0 from
1.8.2
- bug fix
---
python_apps/show-recorder/recorder.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py
index 1cd4425a1..7ac18b046 100644
--- a/python_apps/show-recorder/recorder.py
+++ b/python_apps/show-recorder/recorder.py
@@ -275,8 +275,9 @@ class CommandListener():
self.sr.start()
#remove show from shows to record.
del self.shows_to_record[start_time]
- time_till_next_show = self.get_time_till_next_show()
- self.time_till_next_show = time_till_next_show
+ self.time_till_next_show = self.get_time_till_next_show()
+ # set real_timtout to false no matter what
+ self.real_timeout = False
except Exception,e :
import traceback
top = traceback.format_exc()
From 3b64da7f4ebd2313fe085aa37b16bb314f1f4e04 Mon Sep 17 00:00:00 2001
From: James
Date: Tue, 31 Jan 2012 15:28:57 -0500
Subject: [PATCH 10/29] CC-3286: Shows not recorded after upgrade to 2.0.0 from
1.8.2
- fixed a bug.
- extra fix: handle cancel recording event gracefully
- better log
---
python_apps/show-recorder/recorder.cfg | 1 +
python_apps/show-recorder/recorder.py | 27 +++++++++++++++-----------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/python_apps/show-recorder/recorder.cfg b/python_apps/show-recorder/recorder.cfg
index c010a8645..d817a32b2 100644
--- a/python_apps/show-recorder/recorder.cfg
+++ b/python_apps/show-recorder/recorder.cfg
@@ -24,6 +24,7 @@ record_bitrate = 256
record_samplerate = 44100
record_channels = 2
record_sample_size = 16
+record_timeout = 3600
#can be either ogg|mp3, mp3 recording requires installation of the package "lame"
record_file_type = 'ogg'
diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py
index 7ac18b046..3ec1caf39 100644
--- a/python_apps/show-recorder/recorder.py
+++ b/python_apps/show-recorder/recorder.py
@@ -179,8 +179,7 @@ class CommandListener():
self.sr = None
self.current_schedule = {}
self.shows_to_record = {}
- self.time_till_next_show = 3600
- self.real_timeout = True
+ self.time_till_next_show = config["record_timeout"]
self.logger.info("RecorderFetch: init complete")
self.server_timezone = '';
@@ -214,7 +213,7 @@ class CommandListener():
self.parse_shows(temp)
self.server_timezone = m['server_timezone']
elif(command == 'cancel_recording'):
- if self.sr.is_recording():
+ if self.sr is not None and self.sr.is_recording():
self.sr.cancel_recording()
def parse_shows(self, shows):
@@ -241,14 +240,12 @@ class CommandListener():
next_show = getDateTimeObj(start_time)
delta = next_show - tnow
- self.real_timeout = False
out = delta.seconds
self.logger.debug("Next show %s", next_show)
self.logger.debug("Now %s", tnow)
else:
- self.real_timeout = True
- out = 3600
+ out = config["record_timeout"]
return out
def start_record(self):
@@ -276,8 +273,6 @@ class CommandListener():
#remove show from shows to record.
del self.shows_to_record[start_time]
self.time_till_next_show = self.get_time_till_next_show()
- # set real_timtout to false no matter what
- self.real_timeout = False
except Exception,e :
import traceback
top = traceback.format_exc()
@@ -316,14 +311,21 @@ class CommandListener():
self.logger.info("Loop #%s", loops)
try:
# block until 5 seconds before the next show start
- self.connection.drain_events(timeout=self.time_till_next_show)
+ self.connection.drain_events(timeout=int(self.time_till_next_show))
except socket.timeout, s:
self.logger.info(s)
+
+ # start_record set time_till_next_show to config["record_timeout"] so we should check before
+ # if timeout amount was 1 hr..
+ update_schedule = False
+ if int(self.time_till_next_show) == int(config["record_timeout"]) :
+ update_schedule = True
+
# start recording
self.start_record()
# if real timeout happended get show schedule from airtime
- if self.real_timeout :
+ if update_schedule :
temp = self.api_client.get_shows_to_record()
if temp is not None:
shows = temp['shows']
@@ -332,7 +334,10 @@ class CommandListener():
self.logger.info("Real Timeout: the schedule has updated")
except Exception, e:
- self.logger.info(e)
+ import traceback
+ top = traceback.format_exc()
+ self.logger.error('Exception: %s', e)
+ self.logger.error("traceback: %s", top)
time.sleep(3)
loops += 1
From 7ee17ba07eb5a2b60f100ef9bb3234e0e5ad1860 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Tue, 31 Jan 2012 21:24:01 -0500
Subject: [PATCH 11/29] CC-3291: Airtime is missing Australia and Arctic
timezones
-fixed
---
airtime_mvc/application/forms/GeneralPreferences.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php
index 1514e1460..7bbb1784f 100644
--- a/airtime_mvc/application/forms/GeneralPreferences.php
+++ b/airtime_mvc/application/forms/GeneralPreferences.php
@@ -71,8 +71,10 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
+ 'Arctic' => DateTimeZone::ARCTIC,
'Asia' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
+ 'Australia' => DateTimeZone::AUSTRALIA,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
From 47acb16e20b96c3ba07dcc30ec23c94e1cb54b6a Mon Sep 17 00:00:00 2001
From: James
Date: Tue, 31 Jan 2012 11:22:30 -0500
Subject: [PATCH 12/29] CC-3286: Shows not recorded after upgrade to 2.0.0 from
1.8.2
- The issue was that the recorder wasn't pulling any schedule from
Airtime. It should pull it when real timeout(every 1 hr) happens
---
python_apps/show-recorder/recorder.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py
index 80bc4ada8..1cd4425a1 100644
--- a/python_apps/show-recorder/recorder.py
+++ b/python_apps/show-recorder/recorder.py
@@ -180,6 +180,7 @@ class CommandListener():
self.current_schedule = {}
self.shows_to_record = {}
self.time_till_next_show = 3600
+ self.real_timeout = True
self.logger.info("RecorderFetch: init complete")
self.server_timezone = '';
@@ -240,11 +241,13 @@ class CommandListener():
next_show = getDateTimeObj(start_time)
delta = next_show - tnow
+ self.real_timeout = False
out = delta.seconds
self.logger.debug("Next show %s", next_show)
self.logger.debug("Now %s", tnow)
else:
+ self.real_timeout = True
out = 3600
return out
@@ -306,6 +309,8 @@ class CommandListener():
self.logger.error(e)
loops = 1
+ recording = False
+
while True:
self.logger.info("Loop #%s", loops)
try:
@@ -315,10 +320,19 @@ class CommandListener():
self.logger.info(s)
# start recording
self.start_record()
+
+ # if real timeout happended get show schedule from airtime
+ if self.real_timeout :
+ temp = self.api_client.get_shows_to_record()
+ if temp is not None:
+ shows = temp['shows']
+ self.server_timezone = temp['server_timezone']
+ self.parse_shows(shows)
+ self.logger.info("Real Timeout: the schedule has updated")
+
except Exception, e:
self.logger.info(e)
time.sleep(3)
-
loops += 1
if __name__ == '__main__':
From da89b9fa745e8a9a3827128acaf4e7fe2aa50bc9 Mon Sep 17 00:00:00 2001
From: James
Date: Tue, 31 Jan 2012 11:37:12 -0500
Subject: [PATCH 13/29] CC-3286: Shows not recorded after upgrade to 2.0.0 from
1.8.2
- bug fix
---
python_apps/show-recorder/recorder.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py
index 1cd4425a1..7ac18b046 100644
--- a/python_apps/show-recorder/recorder.py
+++ b/python_apps/show-recorder/recorder.py
@@ -275,8 +275,9 @@ class CommandListener():
self.sr.start()
#remove show from shows to record.
del self.shows_to_record[start_time]
- time_till_next_show = self.get_time_till_next_show()
- self.time_till_next_show = time_till_next_show
+ self.time_till_next_show = self.get_time_till_next_show()
+ # set real_timtout to false no matter what
+ self.real_timeout = False
except Exception,e :
import traceback
top = traceback.format_exc()
From 47eacd1165d0f827b8c243fc5ccff31056e06b46 Mon Sep 17 00:00:00 2001
From: James
Date: Tue, 31 Jan 2012 15:28:57 -0500
Subject: [PATCH 14/29] CC-3286: Shows not recorded after upgrade to 2.0.0 from
1.8.2
- fixed a bug.
- extra fix: handle cancel recording event gracefully
- better log
---
python_apps/show-recorder/recorder.cfg | 1 +
python_apps/show-recorder/recorder.py | 27 +++++++++++++++-----------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/python_apps/show-recorder/recorder.cfg b/python_apps/show-recorder/recorder.cfg
index c010a8645..d817a32b2 100644
--- a/python_apps/show-recorder/recorder.cfg
+++ b/python_apps/show-recorder/recorder.cfg
@@ -24,6 +24,7 @@ record_bitrate = 256
record_samplerate = 44100
record_channels = 2
record_sample_size = 16
+record_timeout = 3600
#can be either ogg|mp3, mp3 recording requires installation of the package "lame"
record_file_type = 'ogg'
diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py
index 7ac18b046..3ec1caf39 100644
--- a/python_apps/show-recorder/recorder.py
+++ b/python_apps/show-recorder/recorder.py
@@ -179,8 +179,7 @@ class CommandListener():
self.sr = None
self.current_schedule = {}
self.shows_to_record = {}
- self.time_till_next_show = 3600
- self.real_timeout = True
+ self.time_till_next_show = config["record_timeout"]
self.logger.info("RecorderFetch: init complete")
self.server_timezone = '';
@@ -214,7 +213,7 @@ class CommandListener():
self.parse_shows(temp)
self.server_timezone = m['server_timezone']
elif(command == 'cancel_recording'):
- if self.sr.is_recording():
+ if self.sr is not None and self.sr.is_recording():
self.sr.cancel_recording()
def parse_shows(self, shows):
@@ -241,14 +240,12 @@ class CommandListener():
next_show = getDateTimeObj(start_time)
delta = next_show - tnow
- self.real_timeout = False
out = delta.seconds
self.logger.debug("Next show %s", next_show)
self.logger.debug("Now %s", tnow)
else:
- self.real_timeout = True
- out = 3600
+ out = config["record_timeout"]
return out
def start_record(self):
@@ -276,8 +273,6 @@ class CommandListener():
#remove show from shows to record.
del self.shows_to_record[start_time]
self.time_till_next_show = self.get_time_till_next_show()
- # set real_timtout to false no matter what
- self.real_timeout = False
except Exception,e :
import traceback
top = traceback.format_exc()
@@ -316,14 +311,21 @@ class CommandListener():
self.logger.info("Loop #%s", loops)
try:
# block until 5 seconds before the next show start
- self.connection.drain_events(timeout=self.time_till_next_show)
+ self.connection.drain_events(timeout=int(self.time_till_next_show))
except socket.timeout, s:
self.logger.info(s)
+
+ # start_record set time_till_next_show to config["record_timeout"] so we should check before
+ # if timeout amount was 1 hr..
+ update_schedule = False
+ if int(self.time_till_next_show) == int(config["record_timeout"]) :
+ update_schedule = True
+
# start recording
self.start_record()
# if real timeout happended get show schedule from airtime
- if self.real_timeout :
+ if update_schedule :
temp = self.api_client.get_shows_to_record()
if temp is not None:
shows = temp['shows']
@@ -332,7 +334,10 @@ class CommandListener():
self.logger.info("Real Timeout: the schedule has updated")
except Exception, e:
- self.logger.info(e)
+ import traceback
+ top = traceback.format_exc()
+ self.logger.error('Exception: %s', e)
+ self.logger.error("traceback: %s", top)
time.sleep(3)
loops += 1
From 8e40c95e9ab9b4999407d4d9c73befc21ed3073b Mon Sep 17 00:00:00 2001
From: James
Date: Wed, 1 Feb 2012 10:57:38 -0500
Subject: [PATCH 15/29] SAAS-174: Ability to add Google Analytics to the demo
instance
- done
---
airtime_mvc/application/Bootstrap.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 09433a9c8..beeccf1a5 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -62,6 +62,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initHeadScript()
{
+ global $CC_CONFIG;
+
$view = $this->getResource('view');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
@@ -86,6 +88,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
$view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.filemtime($baseDir.'/js/airtime/common/livechat.js'), 'text/javascript');
}
+ if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1){
+ $view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.filemtime($baseDir.'/js/libs/google-analytics.js'),'text/javascript');
+ }
}
protected function _initViewHelpers()
From 81d24b7825b166a14360cca37906dc8082a71fc1 Mon Sep 17 00:00:00 2001
From: James
Date: Wed, 1 Feb 2012 11:48:29 -0500
Subject: [PATCH 16/29] SAAS-174: Ability to add Google Analytics to the demo
instance
- adding google-analytics.js
---
airtime_mvc/public/js/libs/google-analytics.js | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 airtime_mvc/public/js/libs/google-analytics.js
diff --git a/airtime_mvc/public/js/libs/google-analytics.js b/airtime_mvc/public/js/libs/google-analytics.js
new file mode 100644
index 000000000..5a9352270
--- /dev/null
+++ b/airtime_mvc/public/js/libs/google-analytics.js
@@ -0,0 +1,9 @@
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-28765064-1']);
+_gaq.push(['_trackPageview']);
+
+(function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
From 026bdebaccfa5b6c2fe621d943c22300dfe024d4 Mon Sep 17 00:00:00 2001
From: James
Date: Wed, 1 Feb 2012 12:09:59 -0500
Subject: [PATCH 17/29] CC-3293: Stream settings page does not remember the
stream metadata format
- fixed
---
airtime_mvc/application/controllers/PreferenceController.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php
index 62b9343b4..2053a947e 100644
--- a/airtime_mvc/application/controllers/PreferenceController.php
+++ b/airtime_mvc/application/controllers/PreferenceController.php
@@ -205,6 +205,7 @@ class PreferenceController extends Zend_Controller_Action
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
+ $values['streamFormat'] = $form->getValue('streamFormat');
}
if(!$error){
@@ -214,6 +215,8 @@ class PreferenceController extends Zend_Controller_Action
for($i=1;$i<=$num_of_stream;$i++){
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
}
+ // this goes into cc_pref table
+ Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
// store stream update timestamp
Application_Model_Preference::SetStreamUpdateTimestamp();
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
From d0de29c10a7d5fcc3511395d574c62e908f93e55 Mon Sep 17 00:00:00 2001
From: James
Date: Wed, 1 Feb 2012 14:52:17 -0500
Subject: [PATCH 18/29] CC-3286: Shows not recorded after upgrade to 2.0.0 from
1.8.2
- missing a line from cfg in upgrade folder
---
install_minimal/upgrades/airtime-2.0.0/recorder.cfg.200 | 1 +
1 file changed, 1 insertion(+)
diff --git a/install_minimal/upgrades/airtime-2.0.0/recorder.cfg.200 b/install_minimal/upgrades/airtime-2.0.0/recorder.cfg.200
index 2765f9781..9ac92ce44 100644
--- a/install_minimal/upgrades/airtime-2.0.0/recorder.cfg.200
+++ b/install_minimal/upgrades/airtime-2.0.0/recorder.cfg.200
@@ -24,6 +24,7 @@ record_bitrate = 256
record_samplerate = 44100
record_channels = 2
record_sample_size = 16
+record_timeout = 3600
#can be either ogg|mp3, mp3 recording requires installation of the package "lame"
record_file_type = 'ogg'
\ No newline at end of file
From 11e0f3ead809ec0b083e2bc775b3ad8213270b80 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Thu, 2 Feb 2012 14:11:03 -0500
Subject: [PATCH 19/29] CC-3296: Sometimes the Current Playing Item on the top
Panel in the UI incorrectly shows "Nothing Scheduled"
---
airtime_mvc/application/models/ShowInstance.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php
index b5dbfb55b..7a70f73e2 100644
--- a/airtime_mvc/application/models/ShowInstance.php
+++ b/airtime_mvc/application/models/ShowInstance.php
@@ -784,6 +784,7 @@ class Application_Model_ShowInstance {
$sql = "SELECT si.id"
." FROM $CC_CONFIG[showInstances] si"
." WHERE si.ends < TIMESTAMP '$p_timeNow'"
+ ." AND si.modified_instance = 'f'"
." ORDER BY si.ends DESC"
." LIMIT 1";
@@ -798,10 +799,18 @@ class Application_Model_ShowInstance {
public static function GetCurrentShowInstance($p_timeNow){
global $CC_CONFIG, $CC_DBC;
+ /* Orderby si.starts descending, because in some cases
+ * we can have multiple shows overlapping each other. In
+ * this case, the show that started later is the one that
+ * is actually playing, and so this is the one we want.
+ */
+
$sql = "SELECT si.id"
." FROM $CC_CONFIG[showInstances] si"
." WHERE si.starts <= TIMESTAMP '$p_timeNow'"
." AND si.ends > TIMESTAMP '$p_timeNow'"
+ ." AND si.modified_instance = 'f'"
+ ." ORDER BY si.starts DESC"
." LIMIT 1";
$id = $CC_DBC->GetOne($sql);
@@ -818,6 +827,7 @@ class Application_Model_ShowInstance {
$sql = "SELECT si.id"
." FROM $CC_CONFIG[showInstances] si"
." WHERE si.starts > TIMESTAMP '$p_timeNow'"
+ ." AND si.modified_instance = 'f'"
." ORDER BY si.starts"
." LIMIT 1";
From 214c6e85ccb6178e3044d126cd6b6e387f6a0d48 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Thu, 2 Feb 2012 16:14:13 -0500
Subject: [PATCH 20/29] -remove unneeded check of "if file_info is not None:"
-remove undefined variable fomr phone_home_stat.php
---
.../airtimefilemonitor/airtimemetadata.py | 30 ++++++++++---------
utils/phone_home_stat.php | 4 +--
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py
index 17c97259e..dd9b481af 100644
--- a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py
+++ b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py
@@ -161,22 +161,24 @@ class AirtimeMetadata:
self.logger.error("Exception %s", e)
return None
+ #check if file has any metadata
if file_info is None:
return None
- #check if file has any metadata
- if file_info is not None:
- for key in file_info.keys() :
- if key in self.mutagen2airtime and len(file_info[key]) > 0:
- info = file_info[key][0]
- while True:
- temp = re.search(u"[\x80-\x9f]", info)
- if temp is not None:
- s = temp.group(0)
- replace = self.cp1252toUnicode.get(s)
- info = re.sub(s, replace, info)
- else:
- break
- md[self.mutagen2airtime[key]] = info
+
+ for key in file_info.keys() :
+ if key in self.mutagen2airtime and len(file_info[key]) > 0:
+ info = file_info[key][0]
+ while True:
+ temp = re.search(u"[\x80-\x9f]", info)
+ if temp is not None:
+ s = temp.group(0)
+ replace = self.cp1252toUnicode.get(s)
+ info = re.sub(s, replace, info)
+ else:
+ break
+ md[self.mutagen2airtime[key]] = info
+
+
if 'MDATA_KEY_TITLE' not in md:
#get rid of file extention from original name, name might have more than 1 '.' in it.
#filepath = to_unicode(filepath)
diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php
index c7738a6b4..fa6848bea 100644
--- a/utils/phone_home_stat.php
+++ b/utils/phone_home_stat.php
@@ -48,9 +48,7 @@ if (PEAR::isError($CC_DBC)) {
echo "Database connection problem.".PHP_EOL;
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
" with corresponding permissions.".PHP_EOL;*/
- if ($p_exitOnError) {
- exit(1);
- }
+ exit(1);
} else {
//echo "* Connected to database".PHP_EOL;
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
From 084214b6c825940d773f4cac2d827f7ec1c188c2 Mon Sep 17 00:00:00 2001
From: James
Date: Mon, 6 Feb 2012 12:26:20 -0500
Subject: [PATCH 21/29] CC-3299: Media monitor changes the owner of watched
files?
- media monitor now tries to set the permission to www-data if the file/dir
cannot be read by www-data
---
.../airtimefilemonitor/mediamonitorcommon.py | 27 ++++++++++---------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
index dc7e81768..c98e2e21e 100644
--- a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
+++ b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
@@ -46,9 +46,13 @@ class MediaMonitorCommon:
return False
#check if file is readable by "nobody"
- def has_correct_permissions(self, filepath):
+ def has_correct_permissions(self, filepath, euid='nobody', egid='nogroup'):
+ uid = pwd.getpwnam(euid)[2]
+ gid = grp.getgrnam(egid)[2]
+
#drop root permissions and become "nobody"
- os.seteuid(65534)
+ os.seteuid(uid)
+ os.setegid(gid)
try:
open(filepath)
@@ -65,19 +69,18 @@ class MediaMonitorCommon:
return readable
+ # the function only changes the permission if its not readable by www-data
def set_needed_file_permissions(self, item, is_dir):
try:
omask = os.umask(0)
-
- uid = pwd.getpwnam('www-data')[2]
- gid = grp.getgrnam('www-data')[2]
-
- os.chown(item, uid, gid)
-
- if is_dir is True:
- os.chmod(item, 02777)
- else:
- os.chmod(item, 0666)
+
+ if not has_correct_permissions(item, 'www-data', 'www-data'):
+ os.chown(item, uid, gid)
+
+ if is_dir is True:
+ os.chmod(item, 02777)
+ else:
+ os.chmod(item, 0666)
except Exception, e:
self.logger.error("Failed to change file's owner/group/permissions. %s", e)
From e8afd086bd8cdb262cdfc4cabe379c36f43f22e5 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Mon, 6 Feb 2012 12:28:39 -0500
Subject: [PATCH 22/29] -fix annoying issue where media-monitor refuses to
start if tmp directory /var/tmp/airtime does not exist. Just create it.
---
.../media-monitor/airtimefilemonitor/mediamonitorcommon.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
index dc7e81768..7f6e4e582 100644
--- a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
+++ b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
@@ -245,6 +245,9 @@ class MediaMonitorCommon:
return stdout.splitlines()
def touch_index_file(self):
+ dirname = os.path.dirname(self.timestamp_file)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
open(self.timestamp_file, "w")
def organize_new_file(self, pathname):
From 4b7272a173cb1358981347d54fb9ef6042557e6e Mon Sep 17 00:00:00 2001
From: James
Date: Mon, 6 Feb 2012 12:32:21 -0500
Subject: [PATCH 23/29] CC-3299: Media monitor changes the owner of watched
files?
- bug fixed
---
.../media-monitor/airtimefilemonitor/mediamonitorcommon.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
index c98e2e21e..838cb7937 100644
--- a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
+++ b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py
@@ -75,6 +75,9 @@ class MediaMonitorCommon:
omask = os.umask(0)
if not has_correct_permissions(item, 'www-data', 'www-data'):
+ uid = pwd.getpwnam('www-data')[2]
+ gid = grp.getgrnam('www-data')[2]
+
os.chown(item, uid, gid)
if is_dir is True:
From 58b4576ae1975dbd26c5ba1be9a8eee74aaa38c6 Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Mon, 6 Feb 2012 14:18:03 -0500
Subject: [PATCH 24/29] CC-3297: Depend on zendframework and php-pear as
external packages
-DB dependency should now be externalized
---
airtime_mvc/application/models/tests/AllTests.php | 1 -
install_full/ubuntu/airtime-full-install | 2 +-
install_full/ubuntu/airtime-full-install-nginx | 2 +-
install_minimal/include/AirtimeInstall.php | 4 +---
install_minimal/include/airtime-upgrade.php | 3 ---
install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php | 1 -
install_minimal/upgrades/airtime-2.0.0/UpgradeCommon.php | 1 -
install_minimal/upgrades/upgrade-template/UpgradeCommon.php | 1 -
python_apps/pypo/test/airtime-schedule-insert.php | 3 ---
utils/phone_home_stat.php | 2 --
utils/soundcloud-uploader.php | 2 --
11 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/airtime_mvc/application/models/tests/AllTests.php b/airtime_mvc/application/models/tests/AllTests.php
index 7ff5a8d9f..2d5620935 100644
--- a/airtime_mvc/application/models/tests/AllTests.php
+++ b/airtime_mvc/application/models/tests/AllTests.php
@@ -1,5 +1,4 @@
Date: Mon, 6 Feb 2012 15:10:03 -0500
Subject: [PATCH 25/29] CC-3297: Depend on zendframework and php-pear as
external packages
-DB dependency should now be externalized
---
airtime_mvc/application/configs/conf.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php
index 3eb436520..2e0d56536 100644
--- a/airtime_mvc/application/configs/conf.php
+++ b/airtime_mvc/application/configs/conf.php
@@ -52,9 +52,9 @@ $CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
// Add libs to the PHP path
$old_include_path = get_include_path();
-set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath']
- .PATH_SEPARATOR.$CC_CONFIG['zendPath']
- .PATH_SEPARATOR.$old_include_path);
+set_include_path('.'
+ .PATH_SEPARATOR.$CC_CONFIG['zendPath']
+ .PATH_SEPARATOR.$old_include_path);
class Config {
public static function loadConfig($p_path) {
From 51e181b4456307860ff5d22ede7b7651cb4b4d3c Mon Sep 17 00:00:00 2001
From: Martin Konecny
Date: Mon, 6 Feb 2012 15:16:57 -0500
Subject: [PATCH 26/29] CC-3297: Depend on zendframework and php-pear as
external packages
-removed pear files
---
airtime_mvc/application/configs/conf.php | 1 -
airtime_mvc/library/pear/Archive/Tar.php | 1909 -------------
.../library/pear/Calendar/Calendar.php | 780 ------
airtime_mvc/library/pear/Calendar/Day.php | 232 --
.../library/pear/Calendar/Decorator.php | 650 -----
.../pear/Calendar/Decorator/Textual.php | 208 --
.../library/pear/Calendar/Decorator/Uri.php | 183 --
.../pear/Calendar/Decorator/Weekday.php | 195 --
.../pear/Calendar/Decorator/Wrapper.php | 115 -
.../pear/Calendar/Engine/Interface.php | 377 ---
.../library/pear/Calendar/Engine/PearDate.php | 509 ----
.../library/pear/Calendar/Engine/UnixTS.php | 463 ----
airtime_mvc/library/pear/Calendar/Factory.php | 168 --
airtime_mvc/library/pear/Calendar/Hour.php | 137 -
airtime_mvc/library/pear/Calendar/Minute.php | 138 -
airtime_mvc/library/pear/Calendar/Month.php | 138 -
.../library/pear/Calendar/Month/Weekdays.php | 215 --
.../library/pear/Calendar/Month/Weeks.php | 166 --
airtime_mvc/library/pear/Calendar/Second.php | 122 -
.../library/pear/Calendar/Table/Helper.php | 316 ---
.../library/pear/Calendar/Util/Textual.php | 304 ---
.../library/pear/Calendar/Util/Uri.php | 204 --
.../library/pear/Calendar/Validator.php | 377 ---
airtime_mvc/library/pear/Calendar/Week.php | 470 ----
airtime_mvc/library/pear/Calendar/Year.php | 140 -
airtime_mvc/library/pear/Calendar/docs/Readme | 3 -
.../library/pear/Calendar/docs/examples/1.php | 92 -
.../pear/Calendar/docs/examples/1.phps | 92 -
.../pear/Calendar/docs/examples/10.php | 93 -
.../pear/Calendar/docs/examples/10.phps | 93 -
.../pear/Calendar/docs/examples/11.php | 109 -
.../pear/Calendar/docs/examples/11.phps | 109 -
.../pear/Calendar/docs/examples/12.php | 116 -
.../pear/Calendar/docs/examples/12.phps | 116 -
.../pear/Calendar/docs/examples/13.php | 99 -
.../pear/Calendar/docs/examples/13.phps | 99 -
.../pear/Calendar/docs/examples/14.php | 141 -
.../pear/Calendar/docs/examples/14.phps | 141 -
.../pear/Calendar/docs/examples/15.php | 58 -
.../pear/Calendar/docs/examples/15.phps | 58 -
.../pear/Calendar/docs/examples/16.php | 31 -
.../pear/Calendar/docs/examples/16.phps | 31 -
.../pear/Calendar/docs/examples/17.php | 71 -
.../pear/Calendar/docs/examples/17.phps | 71 -
.../pear/Calendar/docs/examples/18.php | 36 -
.../pear/Calendar/docs/examples/18.phps | 36 -
.../pear/Calendar/docs/examples/19.php | 24 -
.../pear/Calendar/docs/examples/19.phps | 24 -
.../library/pear/Calendar/docs/examples/2.php | 142 -
.../pear/Calendar/docs/examples/2.phps | 142 -
.../pear/Calendar/docs/examples/20.php | 240 --
.../pear/Calendar/docs/examples/20.phps | 240 --
.../pear/Calendar/docs/examples/21.php | 139 -
.../pear/Calendar/docs/examples/21.phps | 139 -
.../pear/Calendar/docs/examples/22.php | 46 -
.../pear/Calendar/docs/examples/22.phps | 46 -
.../pear/Calendar/docs/examples/23.php | 66 -
.../pear/Calendar/docs/examples/23.phps | 66 -
.../library/pear/Calendar/docs/examples/3.php | 134 -
.../pear/Calendar/docs/examples/3.phps | 134 -
.../library/pear/Calendar/docs/examples/4.php | 49 -
.../pear/Calendar/docs/examples/4.phps | 49 -
.../library/pear/Calendar/docs/examples/5.php | 132 -
.../pear/Calendar/docs/examples/5.phps | 132 -
.../library/pear/Calendar/docs/examples/6.php | 210 --
.../pear/Calendar/docs/examples/6.phps | 210 --
.../library/pear/Calendar/docs/examples/7.php | 92 -
.../pear/Calendar/docs/examples/7.phps | 92 -
.../library/pear/Calendar/docs/examples/8.php | 70 -
.../pear/Calendar/docs/examples/8.phps | 70 -
.../library/pear/Calendar/docs/examples/9.php | 16 -
.../pear/Calendar/docs/examples/9.phps | 16 -
.../pear/Calendar/docs/examples/index.html | 50 -
.../library/pear/Calendar/tests/README | 7 -
.../library/pear/Calendar/tests/all_tests.php | 34 -
.../Calendar/tests/calendar_engine_tests.php | 20 -
.../pear/Calendar/tests/calendar_include.php | 28 -
.../Calendar/tests/calendar_tabular_tests.php | 22 -
.../pear/Calendar/tests/calendar_test.php | 124 -
.../pear/Calendar/tests/calendar_tests.php | 25 -
.../library/pear/Calendar/tests/day_test.php | 107 -
.../pear/Calendar/tests/decorator_test.php | 268 --
.../pear/Calendar/tests/decorator_tests.php | 21 -
.../Calendar/tests/decorator_textual_test.php | 179 --
.../Calendar/tests/decorator_uri_test.php | 37 -
.../pear/Calendar/tests/helper_test.php | 83 -
.../library/pear/Calendar/tests/hour_test.php | 98 -
.../pear/Calendar/tests/minute_test.php | 99 -
.../pear/Calendar/tests/month_test.php | 119 -
.../Calendar/tests/month_weekdays_test.php | 182 --
.../pear/Calendar/tests/month_weeks_test.php | 129 -
.../Calendar/tests/peardate_engine_test.php | 130 -
.../pear/Calendar/tests/second_test.php | 34 -
.../pear/Calendar/tests/simple_include.php | 10 -
.../Calendar/tests/table_helper_tests.php | 19 -
.../Calendar/tests/unixts_engine_test.php | 110 -
.../pear/Calendar/tests/util_tests.php | 20 -
.../pear/Calendar/tests/util_textual_test.php | 196 --
.../pear/Calendar/tests/util_uri_test.php | 54 -
.../Calendar/tests/validator_error_test.php | 34 -
.../pear/Calendar/tests/validator_tests.php | 20 -
.../Calendar/tests/validator_unit_test.php | 210 --
.../Calendar/tests/week_firstday_0_test.php | 241 --
.../library/pear/Calendar/tests/week_test.php | 276 --
.../library/pear/Calendar/tests/year_test.php | 142 -
airtime_mvc/library/pear/Console/Getopt.php | 290 --
airtime_mvc/library/pear/DB.php | 1489 ----------
airtime_mvc/library/pear/DB/common.php | 2257 ----------------
airtime_mvc/library/pear/DB/dbase.php | 510 ----
airtime_mvc/library/pear/DB/fbsql.php | 769 ------
airtime_mvc/library/pear/DB/ibase.php | 1082 --------
airtime_mvc/library/pear/DB/ifx.php | 683 -----
airtime_mvc/library/pear/DB/msql.php | 831 ------
airtime_mvc/library/pear/DB/mssql.php | 963 -------
airtime_mvc/library/pear/DB/mysql.php | 1045 -------
airtime_mvc/library/pear/DB/mysqli.php | 1092 --------
airtime_mvc/library/pear/DB/oci8.php | 1156 --------
airtime_mvc/library/pear/DB/odbc.php | 883 ------
airtime_mvc/library/pear/DB/pgsql.php | 1116 --------
airtime_mvc/library/pear/DB/sqlite.php | 959 -------
airtime_mvc/library/pear/DB/storage.php | 506 ----
airtime_mvc/library/pear/DB/sybase.php | 942 -------
airtime_mvc/library/pear/File.php | 543 ----
airtime_mvc/library/pear/File/CSV.php | 628 -----
airtime_mvc/library/pear/File/Find.php | 485 ----
airtime_mvc/library/pear/File/Util.php | 482 ----
airtime_mvc/library/pear/HTML/Common.php | 465 ----
airtime_mvc/library/pear/HTML/QuickForm.php | 2065 --------------
.../library/pear/HTML/QuickForm/Renderer.php | 158 --
.../pear/HTML/QuickForm/Renderer/Array.php | 340 ---
.../HTML/QuickForm/Renderer/ArraySmarty.php | 403 ---
.../pear/HTML/QuickForm/Renderer/Default.php | 485 ----
.../HTML/QuickForm/Renderer/ITDynamic.php | 300 ---
.../pear/HTML/QuickForm/Renderer/ITStatic.php | 504 ----
.../pear/HTML/QuickForm/Renderer/Object.php | 461 ----
.../HTML/QuickForm/Renderer/ObjectFlexy.php | 291 --
.../HTML/QuickForm/Renderer/QuickHtml.php | 213 --
.../library/pear/HTML/QuickForm/Rule.php | 82 -
.../pear/HTML/QuickForm/Rule/Callback.php | 124 -
.../pear/HTML/QuickForm/Rule/Compare.php | 105 -
.../pear/HTML/QuickForm/Rule/Email.php | 73 -
.../pear/HTML/QuickForm/Rule/Range.php | 75 -
.../pear/HTML/QuickForm/Rule/Regex.php | 107 -
.../pear/HTML/QuickForm/Rule/Required.php | 63 -
.../pear/HTML/QuickForm/RuleRegistry.php | 349 ---
.../pear/HTML/QuickForm/advcheckbox.php | 286 --
.../pear/HTML/QuickForm/autocomplete.php | 258 --
.../library/pear/HTML/QuickForm/button.php | 80 -
.../library/pear/HTML/QuickForm/checkbox.php | 277 --
.../library/pear/HTML/QuickForm/date.php | 528 ----
.../library/pear/HTML/QuickForm/element.php | 494 ----
.../library/pear/HTML/QuickForm/file.php | 358 ---
.../library/pear/HTML/QuickForm/group.php | 588 ----
.../library/pear/HTML/QuickForm/header.php | 74 -
.../library/pear/HTML/QuickForm/hidden.php | 94 -
.../pear/HTML/QuickForm/hiddenselect.php | 118 -
.../pear/HTML/QuickForm/hierselect.php | 596 ----
.../library/pear/HTML/QuickForm/html.php | 77 -
.../library/pear/HTML/QuickForm/image.php | 127 -
.../library/pear/HTML/QuickForm/input.php | 209 --
.../library/pear/HTML/QuickForm/link.php | 200 --
.../library/pear/HTML/QuickForm/password.php | 115 -
.../library/pear/HTML/QuickForm/radio.php | 251 --
.../library/pear/HTML/QuickForm/reset.php | 79 -
.../library/pear/HTML/QuickForm/select.php | 614 -----
.../library/pear/HTML/QuickForm/static.php | 201 --
.../library/pear/HTML/QuickForm/submit.php | 89 -
.../library/pear/HTML/QuickForm/text.php | 98 -
.../library/pear/HTML/QuickForm/textarea.php | 229 --
.../library/pear/HTML/QuickForm/xbutton.php | 153 --
airtime_mvc/library/pear/OS/Guess.php | 338 ---
airtime_mvc/library/pear/PEAR.php | 1063 --------
airtime_mvc/library/pear/PEAR/Autoloader.php | 218 --
airtime_mvc/library/pear/PEAR/Builder.php | 474 ----
airtime_mvc/library/pear/PEAR/ChannelFile.php | 1559 -----------
.../library/pear/PEAR/ChannelFile/Parser.php | 68 -
airtime_mvc/library/pear/PEAR/Command.php | 414 ---
.../library/pear/PEAR/Command/Auth.php | 81 -
.../library/pear/PEAR/Command/Auth.xml | 30 -
.../library/pear/PEAR/Command/Build.php | 85 -
.../library/pear/PEAR/Command/Build.xml | 10 -
.../library/pear/PEAR/Command/Channels.php | 883 ------
.../library/pear/PEAR/Command/Channels.xml | 123 -
.../library/pear/PEAR/Command/Common.php | 273 --
.../library/pear/PEAR/Command/Config.php | 413 ---
.../library/pear/PEAR/Command/Config.xml | 92 -
.../library/pear/PEAR/Command/Install.php | 1266 ---------
.../library/pear/PEAR/Command/Install.xml | 276 --
.../library/pear/PEAR/Command/Mirror.php | 139 -
.../library/pear/PEAR/Command/Mirror.xml | 18 -
.../library/pear/PEAR/Command/Package.php | 1119 --------
.../library/pear/PEAR/Command/Package.xml | 237 --
.../library/pear/PEAR/Command/Pickle.php | 421 ---
.../library/pear/PEAR/Command/Pickle.xml | 36 -
.../library/pear/PEAR/Command/Registry.php | 1145 --------
.../library/pear/PEAR/Command/Registry.xml | 58 -
.../library/pear/PEAR/Command/Remote.php | 809 ------
.../library/pear/PEAR/Command/Remote.xml | 109 -
.../library/pear/PEAR/Command/Test.php | 337 ---
.../library/pear/PEAR/Command/Test.xml | 54 -
airtime_mvc/library/pear/PEAR/Common.php | 837 ------
airtime_mvc/library/pear/PEAR/Config.php | 2097 ---------------
airtime_mvc/library/pear/PEAR/Dependency2.php | 1358 ----------
.../library/pear/PEAR/DependencyDB.php | 769 ------
airtime_mvc/library/pear/PEAR/Downloader.php | 1762 ------------
.../library/pear/PEAR/Downloader/Package.php | 2004 --------------
airtime_mvc/library/pear/PEAR/ErrorStack.php | 985 -------
airtime_mvc/library/pear/PEAR/Exception.php | 389 ---
.../library/pear/PEAR/FixPHP5PEARWarnings.php | 7 -
airtime_mvc/library/pear/PEAR/Frontend.php | 228 --
.../library/pear/PEAR/Frontend/CLI.php | 736 -----
airtime_mvc/library/pear/PEAR/Installer.php | 1823 -------------
.../library/pear/PEAR/Installer/Role.php | 276 --
.../library/pear/PEAR/Installer/Role/Cfg.php | 106 -
.../library/pear/PEAR/Installer/Role/Cfg.xml | 15 -
.../pear/PEAR/Installer/Role/Common.php | 174 --
.../library/pear/PEAR/Installer/Role/Data.php | 28 -
.../library/pear/PEAR/Installer/Role/Data.xml | 15 -
.../library/pear/PEAR/Installer/Role/Doc.php | 28 -
.../library/pear/PEAR/Installer/Role/Doc.xml | 15 -
.../library/pear/PEAR/Installer/Role/Ext.php | 28 -
.../library/pear/PEAR/Installer/Role/Ext.xml | 12 -
.../library/pear/PEAR/Installer/Role/Php.php | 28 -
.../library/pear/PEAR/Installer/Role/Php.xml | 15 -
.../pear/PEAR/Installer/Role/Script.php | 28 -
.../pear/PEAR/Installer/Role/Script.xml | 15 -
.../library/pear/PEAR/Installer/Role/Src.php | 34 -
.../library/pear/PEAR/Installer/Role/Src.xml | 12 -
.../library/pear/PEAR/Installer/Role/Test.php | 28 -
.../library/pear/PEAR/Installer/Role/Test.xml | 15 -
.../library/pear/PEAR/Installer/Role/Www.php | 28 -
.../library/pear/PEAR/Installer/Role/Www.xml | 15 -
airtime_mvc/library/pear/PEAR/PackageFile.php | 501 ----
.../pear/PEAR/PackageFile/Generator/v1.php | 1284 ---------
.../pear/PEAR/PackageFile/Generator/v2.php | 893 ------
.../pear/PEAR/PackageFile/Parser/v1.php | 459 ----
.../pear/PEAR/PackageFile/Parser/v2.php | 113 -
.../library/pear/PEAR/PackageFile/v1.php | 1612 -----------
.../library/pear/PEAR/PackageFile/v2.php | 2045 --------------
.../pear/PEAR/PackageFile/v2/Validator.php | 2154 ---------------
.../library/pear/PEAR/PackageFile/v2/rw.php | 1604 -----------
airtime_mvc/library/pear/PEAR/Packager.php | 201 --
airtime_mvc/library/pear/PEAR/REST.php | 448 ---
airtime_mvc/library/pear/PEAR/REST/10.php | 867 ------
airtime_mvc/library/pear/PEAR/REST/11.php | 341 ---
airtime_mvc/library/pear/PEAR/REST/13.php | 299 --
airtime_mvc/library/pear/PEAR/Registry.php | 2395 -----------------
airtime_mvc/library/pear/PEAR/RunTest.php | 962 -------
airtime_mvc/library/pear/PEAR/Task/Common.php | 202 --
.../pear/PEAR/Task/Postinstallscript.php | 323 ---
.../pear/PEAR/Task/Postinstallscript/rw.php | 169 --
.../library/pear/PEAR/Task/Replace.php | 176 --
.../library/pear/PEAR/Task/Replace/rw.php | 61 -
.../library/pear/PEAR/Task/Unixeol.php | 77 -
.../library/pear/PEAR/Task/Unixeol/rw.php | 56 -
.../library/pear/PEAR/Task/Windowseol.php | 77 -
.../library/pear/PEAR/Task/Windowseol/rw.php | 56 -
airtime_mvc/library/pear/PEAR/Validate.php | 629 -----
.../library/pear/PEAR/Validator/PECL.php | 63 -
airtime_mvc/library/pear/PEAR/XMLParser.php | 253 --
airtime_mvc/library/pear/PEAR5.php | 33 -
airtime_mvc/library/pear/PHPUnit.php | 132 -
airtime_mvc/library/pear/PHPUnit/Assert.php | 426 ---
airtime_mvc/library/pear/PHPUnit/GUI/Gtk.php | 740 -----
airtime_mvc/library/pear/PHPUnit/GUI/HTML.php | 252 --
airtime_mvc/library/pear/PHPUnit/GUI/HTML.tpl | 156 --
.../pear/PHPUnit/GUI/SetupDecorator.php | 209 --
.../library/pear/PHPUnit/RepeatedTest.php | 154 --
airtime_mvc/library/pear/PHPUnit/Skeleton.php | 448 ---
airtime_mvc/library/pear/PHPUnit/TestCase.php | 293 --
.../library/pear/PHPUnit/TestDecorator.php | 156 --
.../library/pear/PHPUnit/TestFailure.php | 130 -
.../library/pear/PHPUnit/TestListener.php | 162 --
.../library/pear/PHPUnit/TestResult.php | 347 ---
.../library/pear/PHPUnit/TestSuite.php | 262 --
airtime_mvc/library/pear/System.php | 621 -----
airtime_mvc/library/pear/VERSIONS.txt | 20 -
airtime_mvc/library/pear/XML/Beautifier.php | 397 ---
.../library/pear/XML/Beautifier/Renderer.php | 226 --
.../pear/XML/Beautifier/Renderer/Plain.php | 313 ---
.../library/pear/XML/Beautifier/Tokenizer.php | 456 ----
airtime_mvc/library/pear/XML/Parser.php | 768 ------
.../library/pear/XML/Parser/Simple.php | 326 ---
airtime_mvc/library/pear/XML/RPC.php | 2053 --------------
airtime_mvc/library/pear/XML/RPC/Dump.php | 189 --
airtime_mvc/library/pear/XML/RPC/Server.php | 672 -----
airtime_mvc/library/pear/XML/Serializer.php | 1255 ---------
airtime_mvc/library/pear/XML/Unserializer.php | 983 -------
airtime_mvc/library/pear/XML/Util.php | 911 -------
.../airtime-1.8.0/airtime-upgrade.php | 5 +-
.../airtime-1.8.1/airtime-upgrade.php | 7 +-
.../airtime-1.8.2/airtime-upgrade.php | 7 +-
.../upgrades/airtime-1.9.0/conf.php | 7 +-
293 files changed, 7 insertions(+), 105114 deletions(-)
delete mode 100644 airtime_mvc/library/pear/Archive/Tar.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Calendar.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Day.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Decorator.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Decorator/Textual.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Decorator/Uri.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Decorator/Weekday.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Decorator/Wrapper.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Engine/Interface.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Engine/PearDate.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Engine/UnixTS.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Factory.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Hour.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Minute.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Month.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Month/Weekdays.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Month/Weeks.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Second.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Table/Helper.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Util/Textual.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Util/Uri.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Validator.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Week.php
delete mode 100644 airtime_mvc/library/pear/Calendar/Year.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/Readme
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/1.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/1.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/10.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/10.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/11.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/11.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/12.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/12.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/13.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/13.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/14.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/14.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/15.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/15.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/16.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/16.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/17.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/17.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/18.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/18.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/19.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/19.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/2.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/2.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/20.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/20.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/21.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/21.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/22.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/22.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/23.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/23.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/3.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/3.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/4.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/4.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/5.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/5.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/6.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/6.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/7.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/7.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/8.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/8.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/9.php
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/9.phps
delete mode 100644 airtime_mvc/library/pear/Calendar/docs/examples/index.html
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/README
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/all_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/calendar_engine_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/calendar_include.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/calendar_tabular_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/calendar_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/calendar_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/day_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/decorator_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/decorator_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/decorator_textual_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/decorator_uri_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/helper_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/hour_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/minute_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/month_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/month_weekdays_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/month_weeks_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/peardate_engine_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/second_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/simple_include.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/table_helper_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/unixts_engine_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/util_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/util_textual_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/util_uri_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/validator_error_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/validator_tests.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/validator_unit_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/week_firstday_0_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/week_test.php
delete mode 100644 airtime_mvc/library/pear/Calendar/tests/year_test.php
delete mode 100644 airtime_mvc/library/pear/Console/Getopt.php
delete mode 100644 airtime_mvc/library/pear/DB.php
delete mode 100644 airtime_mvc/library/pear/DB/common.php
delete mode 100644 airtime_mvc/library/pear/DB/dbase.php
delete mode 100644 airtime_mvc/library/pear/DB/fbsql.php
delete mode 100644 airtime_mvc/library/pear/DB/ibase.php
delete mode 100644 airtime_mvc/library/pear/DB/ifx.php
delete mode 100644 airtime_mvc/library/pear/DB/msql.php
delete mode 100644 airtime_mvc/library/pear/DB/mssql.php
delete mode 100644 airtime_mvc/library/pear/DB/mysql.php
delete mode 100644 airtime_mvc/library/pear/DB/mysqli.php
delete mode 100644 airtime_mvc/library/pear/DB/oci8.php
delete mode 100644 airtime_mvc/library/pear/DB/odbc.php
delete mode 100644 airtime_mvc/library/pear/DB/pgsql.php
delete mode 100644 airtime_mvc/library/pear/DB/sqlite.php
delete mode 100644 airtime_mvc/library/pear/DB/storage.php
delete mode 100644 airtime_mvc/library/pear/DB/sybase.php
delete mode 100644 airtime_mvc/library/pear/File.php
delete mode 100644 airtime_mvc/library/pear/File/CSV.php
delete mode 100644 airtime_mvc/library/pear/File/Find.php
delete mode 100644 airtime_mvc/library/pear/File/Util.php
delete mode 100644 airtime_mvc/library/pear/HTML/Common.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/Array.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/ArraySmarty.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/Default.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/ITDynamic.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/ITStatic.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/Object.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/ObjectFlexy.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Renderer/QuickHtml.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Rule.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Rule/Callback.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Rule/Compare.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Rule/Email.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Rule/Range.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Rule/Regex.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/Rule/Required.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/RuleRegistry.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/advcheckbox.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/autocomplete.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/button.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/checkbox.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/date.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/element.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/file.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/group.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/header.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/hidden.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/hiddenselect.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/hierselect.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/html.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/image.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/input.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/link.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/password.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/radio.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/reset.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/select.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/static.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/submit.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/text.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/textarea.php
delete mode 100644 airtime_mvc/library/pear/HTML/QuickForm/xbutton.php
delete mode 100644 airtime_mvc/library/pear/OS/Guess.php
delete mode 100644 airtime_mvc/library/pear/PEAR.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Autoloader.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Builder.php
delete mode 100644 airtime_mvc/library/pear/PEAR/ChannelFile.php
delete mode 100644 airtime_mvc/library/pear/PEAR/ChannelFile/Parser.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Auth.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Auth.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Build.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Build.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Channels.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Channels.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Common.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Config.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Config.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Install.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Install.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Mirror.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Mirror.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Package.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Package.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Pickle.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Pickle.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Registry.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Registry.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Remote.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Remote.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Test.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Command/Test.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Common.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Config.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Dependency2.php
delete mode 100644 airtime_mvc/library/pear/PEAR/DependencyDB.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Downloader.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Downloader/Package.php
delete mode 100644 airtime_mvc/library/pear/PEAR/ErrorStack.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Exception.php
delete mode 100644 airtime_mvc/library/pear/PEAR/FixPHP5PEARWarnings.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Frontend.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Frontend/CLI.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Cfg.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Cfg.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Common.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Data.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Data.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Doc.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Doc.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Ext.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Ext.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Php.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Php.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Script.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Script.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Src.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Src.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Test.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Test.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Www.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Installer/Role/Www.xml
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/Generator/v1.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/Generator/v2.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/Parser/v1.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/Parser/v2.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/v1.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/v2.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/v2/Validator.php
delete mode 100644 airtime_mvc/library/pear/PEAR/PackageFile/v2/rw.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Packager.php
delete mode 100644 airtime_mvc/library/pear/PEAR/REST.php
delete mode 100644 airtime_mvc/library/pear/PEAR/REST/10.php
delete mode 100644 airtime_mvc/library/pear/PEAR/REST/11.php
delete mode 100644 airtime_mvc/library/pear/PEAR/REST/13.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Registry.php
delete mode 100644 airtime_mvc/library/pear/PEAR/RunTest.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Common.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Postinstallscript.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Postinstallscript/rw.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Replace.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Replace/rw.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Unixeol.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Unixeol/rw.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Windowseol.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Task/Windowseol/rw.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Validate.php
delete mode 100644 airtime_mvc/library/pear/PEAR/Validator/PECL.php
delete mode 100644 airtime_mvc/library/pear/PEAR/XMLParser.php
delete mode 100644 airtime_mvc/library/pear/PEAR5.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/Assert.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/GUI/Gtk.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/GUI/HTML.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/GUI/HTML.tpl
delete mode 100644 airtime_mvc/library/pear/PHPUnit/GUI/SetupDecorator.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/RepeatedTest.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/Skeleton.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/TestCase.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/TestDecorator.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/TestFailure.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/TestListener.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/TestResult.php
delete mode 100644 airtime_mvc/library/pear/PHPUnit/TestSuite.php
delete mode 100644 airtime_mvc/library/pear/System.php
delete mode 100644 airtime_mvc/library/pear/VERSIONS.txt
delete mode 100644 airtime_mvc/library/pear/XML/Beautifier.php
delete mode 100644 airtime_mvc/library/pear/XML/Beautifier/Renderer.php
delete mode 100644 airtime_mvc/library/pear/XML/Beautifier/Renderer/Plain.php
delete mode 100644 airtime_mvc/library/pear/XML/Beautifier/Tokenizer.php
delete mode 100644 airtime_mvc/library/pear/XML/Parser.php
delete mode 100644 airtime_mvc/library/pear/XML/Parser/Simple.php
delete mode 100644 airtime_mvc/library/pear/XML/RPC.php
delete mode 100644 airtime_mvc/library/pear/XML/RPC/Dump.php
delete mode 100644 airtime_mvc/library/pear/XML/RPC/Server.php
delete mode 100644 airtime_mvc/library/pear/XML/Serializer.php
delete mode 100644 airtime_mvc/library/pear/XML/Unserializer.php
delete mode 100644 airtime_mvc/library/pear/XML/Util.php
diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php
index 2e0d56536..17c79db9b 100644
--- a/airtime_mvc/application/configs/conf.php
+++ b/airtime_mvc/application/configs/conf.php
@@ -18,7 +18,6 @@ $CC_CONFIG = array(
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
"rootDir" => __DIR__."/../..",
- 'pearPath' => dirname(__FILE__).'/../../library/pear',
'zendPath' => dirname(__FILE__).'/../../library/Zend'
);
diff --git a/airtime_mvc/library/pear/Archive/Tar.php b/airtime_mvc/library/pear/Archive/Tar.php
deleted file mode 100644
index 61eff98e6..000000000
--- a/airtime_mvc/library/pear/Archive/Tar.php
+++ /dev/null
@@ -1,1909 +0,0 @@
-
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @category File_Formats
- * @package Archive_Tar
- * @author Vincent Blavet
- * @copyright 1997-2008 The Authors
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Tar.php 295988 2010-03-09 08:39:37Z mrook $
- * @link http://pear.php.net/package/Archive_Tar
- */
-
-require_once 'PEAR.php';
-
-
-define ('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
-define ('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
-
-/**
-* Creates a (compressed) Tar archive
-*
-* @author Vincent Blavet
-* @version $Revision: 295988 $
-* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
-* @package Archive_Tar
-*/
-class Archive_Tar extends PEAR
-{
- /**
- * @var string Name of the Tar
- */
- var $_tarname='';
-
- /**
- * @var boolean if true, the Tar file will be gzipped
- */
- var $_compress=false;
-
- /**
- * @var string Type of compression : 'none', 'gz' or 'bz2'
- */
- var $_compress_type='none';
-
- /**
- * @var string Explode separator
- */
- var $_separator=' ';
-
- /**
- * @var file descriptor
- */
- var $_file=0;
-
- /**
- * @var string Local Tar name of a remote Tar (http:// or ftp://)
- */
- var $_temp_tarname='';
-
- /**
- * @var string regular expression for ignoring files or directories
- */
- var $_ignore_regexp='';
-
- // {{{ constructor
- /**
- * Archive_Tar Class constructor. This flavour of the constructor only
- * declare a new Archive_Tar object, identifying it by the name of the
- * tar file.
- * If the compress argument is set the tar will be read or created as a
- * gzip or bz2 compressed TAR file.
- *
- * @param string $p_tarname The name of the tar archive to create
- * @param string $p_compress can be null, 'gz' or 'bz2'. This
- * parameter indicates if gzip or bz2 compression
- * is required. For compatibility reason the
- * boolean value 'true' means 'gz'.
- * @access public
- */
- function Archive_Tar($p_tarname, $p_compress = null)
- {
- $this->PEAR();
- $this->_compress = false;
- $this->_compress_type = 'none';
- if (($p_compress === null) || ($p_compress == '')) {
- if (@file_exists($p_tarname)) {
- if ($fp = @fopen($p_tarname, "rb")) {
- // look for gzip magic cookie
- $data = fread($fp, 2);
- fclose($fp);
- if ($data == "\37\213") {
- $this->_compress = true;
- $this->_compress_type = 'gz';
- // No sure it's enought for a magic code ....
- } elseif ($data == "BZ") {
- $this->_compress = true;
- $this->_compress_type = 'bz2';
- }
- }
- } else {
- // probably a remote file or some file accessible
- // through a stream interface
- if (substr($p_tarname, -2) == 'gz') {
- $this->_compress = true;
- $this->_compress_type = 'gz';
- } elseif ((substr($p_tarname, -3) == 'bz2') ||
- (substr($p_tarname, -2) == 'bz')) {
- $this->_compress = true;
- $this->_compress_type = 'bz2';
- }
- }
- } else {
- if (($p_compress === true) || ($p_compress == 'gz')) {
- $this->_compress = true;
- $this->_compress_type = 'gz';
- } else if ($p_compress == 'bz2') {
- $this->_compress = true;
- $this->_compress_type = 'bz2';
- } else {
- $this->_error("Unsupported compression type '$p_compress'\n".
- "Supported types are 'gz' and 'bz2'.\n");
- return false;
- }
- }
- $this->_tarname = $p_tarname;
- if ($this->_compress) { // assert zlib or bz2 extension support
- if ($this->_compress_type == 'gz')
- $extname = 'zlib';
- else if ($this->_compress_type == 'bz2')
- $extname = 'bz2';
-
- if (!extension_loaded($extname)) {
- PEAR::loadExtension($extname);
- }
- if (!extension_loaded($extname)) {
- $this->_error("The extension '$extname' couldn't be found.\n".
- "Please make sure your version of PHP was built ".
- "with '$extname' support.\n");
- return false;
- }
- }
- }
- // }}}
-
- // {{{ destructor
- function _Archive_Tar()
- {
- $this->_close();
- // ----- Look for a local copy to delete
- if ($this->_temp_tarname != '')
- @unlink($this->_temp_tarname);
- $this->_PEAR();
- }
- // }}}
-
- // {{{ create()
- /**
- * This method creates the archive file and add the files / directories
- * that are listed in $p_filelist.
- * If a file with the same name exist and is writable, it is replaced
- * by the new tar.
- * The method return false and a PEAR error text.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * For each directory added in the archive, the files and
- * sub-directories are also added.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a
- * single string with names separated by a single
- * blank space.
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function create($p_filelist)
- {
- return $this->createModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ add()
- /**
- * This method add the files / directories that are listed in $p_filelist in
- * the archive. If the archive does not exist it is created.
- * The method return false and a PEAR error text.
- * The files and directories listed are only added at the end of the archive,
- * even if a file with the same name is already archived.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a
- * single string with names separated by a single
- * blank space.
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function add($p_filelist)
- {
- return $this->addModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ extract()
- function extract($p_path='')
- {
- return $this->extractModify($p_path, '');
- }
- // }}}
-
- // {{{ listContent()
- function listContent()
- {
- $v_list_detail = array();
-
- if ($this->_openRead()) {
- if (!$this->_extractList('', $v_list_detail, "list", '', '')) {
- unset($v_list_detail);
- $v_list_detail = 0;
- }
- $this->_close();
- }
-
- return $v_list_detail;
- }
- // }}}
-
- // {{{ createModify()
- /**
- * This method creates the archive file and add the files / directories
- * that are listed in $p_filelist.
- * If the file already exists and is writable, it is replaced by the
- * new tar. It is a create and not an add. If the file exists and is
- * read-only or is a directory it is not replaced. The method return
- * false and a PEAR error text.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * The path indicated in $p_remove_dir will be removed from the
- * memorized path of each file / directory listed when this path
- * exists. By default nothing is removed (empty path '')
- * The path indicated in $p_add_dir will be added at the beginning of
- * the memorized path of each file / directory listed. However it can
- * be set to empty ''. The adding of a path is done after the removing
- * of path.
- * The path add/remove ability enables the user to prepare an archive
- * for extraction in a different path than the origin files are.
- * See also addModify() method for file adding properties.
- *
- * @param array $p_filelist An array of filenames and directory names,
- * or a single string with names separated by
- * a single blank space.
- * @param string $p_add_dir A string which contains a path to be added
- * to the memorized path of each element in
- * the list.
- * @param string $p_remove_dir A string which contains a path to be
- * removed from the memorized path of each
- * element in the list, when relevant.
- * @return boolean true on success, false on error.
- * @access public
- * @see addModify()
- */
- function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
- {
- $v_result = true;
-
- if (!$this->_openWrite())
- return false;
-
- if ($p_filelist != '') {
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode($this->_separator, $p_filelist);
- else {
- $this->_cleanFile();
- $this->_error('Invalid file list');
- return false;
- }
-
- $v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir);
- }
-
- if ($v_result) {
- $this->_writeFooter();
- $this->_close();
- } else
- $this->_cleanFile();
-
- return $v_result;
- }
- // }}}
-
- // {{{ addModify()
- /**
- * This method add the files / directories listed in $p_filelist at the
- * end of the existing archive. If the archive does not yet exists it
- * is created.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * The path indicated in $p_remove_dir will be removed from the
- * memorized path of each file / directory listed when this path
- * exists. By default nothing is removed (empty path '')
- * The path indicated in $p_add_dir will be added at the beginning of
- * the memorized path of each file / directory listed. However it can
- * be set to empty ''. The adding of a path is done after the removing
- * of path.
- * The path add/remove ability enables the user to prepare an archive
- * for extraction in a different path than the origin files are.
- * If a file/dir is already in the archive it will only be added at the
- * end of the archive. There is no update of the existing archived
- * file/dir. However while extracting the archive, the last file will
- * replace the first one. This results in a none optimization of the
- * archive size.
- * If a file/dir does not exist the file/dir is ignored. However an
- * error text is send to PEAR error.
- * If a file/dir is not readable the file/dir is ignored. However an
- * error text is send to PEAR error.
- *
- * @param array $p_filelist An array of filenames and directory
- * names, or a single string with names
- * separated by a single blank space.
- * @param string $p_add_dir A string which contains a path to be
- * added to the memorized path of each
- * element in the list.
- * @param string $p_remove_dir A string which contains a path to be
- * removed from the memorized path of
- * each element in the list, when
- * relevant.
- * @return true on success, false on error.
- * @access public
- */
- function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
- {
- $v_result = true;
-
- if (!$this->_isArchive())
- $v_result = $this->createModify($p_filelist, $p_add_dir,
- $p_remove_dir);
- else {
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode($this->_separator, $p_filelist);
- else {
- $this->_error('Invalid file list');
- return false;
- }
-
- $v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ addString()
- /**
- * This method add a single string as a file at the
- * end of the existing archive. If the archive does not yet exists it
- * is created.
- *
- * @param string $p_filename A string which contains the full
- * filename path that will be associated
- * with the string.
- * @param string $p_string The content of the file added in
- * the archive.
- * @return true on success, false on error.
- * @access public
- */
- function addString($p_filename, $p_string)
- {
- $v_result = true;
-
- if (!$this->_isArchive()) {
- if (!$this->_openWrite()) {
- return false;
- }
- $this->_close();
- }
-
- if (!$this->_openAppend())
- return false;
-
- // Need to check the get back to the temporary file ? ....
- $v_result = $this->_addString($p_filename, $p_string);
-
- $this->_writeFooter();
-
- $this->_close();
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractModify()
- /**
- * This method extract all the content of the archive in the directory
- * indicated by $p_path. When relevant the memorized path of the
- * files/dir can be modified by removing the $p_remove_path path at the
- * beginning of the file/dir path.
- * While extracting a file, if the directory path does not exists it is
- * created.
- * While extracting a file, if the file already exists it is replaced
- * without looking for last modification date.
- * While extracting a file, if the file already exists and is write
- * protected, the extraction is aborted.
- * While extracting a file, if a directory with the same name already
- * exists, the extraction is aborted.
- * While extracting a directory, if a file with the same name already
- * exists, the extraction is aborted.
- * While extracting a file/directory if the destination directory exist
- * and is write protected, or does not exist but can not be created,
- * the extraction is aborted.
- * If after extraction an extracted file does not show the correct
- * stored file size, the extraction is aborted.
- * When the extraction is aborted, a PEAR error text is set and false
- * is returned. However the result can be a partial extraction that may
- * need to be manually cleaned.
- *
- * @param string $p_path The path of the directory where the
- * files/dir need to by extracted.
- * @param string $p_remove_path Part of the memorized path that can be
- * removed if present at the beginning of
- * the file/dir path.
- * @return boolean true on success, false on error.
- * @access public
- * @see extractList()
- */
- function extractModify($p_path, $p_remove_path)
- {
- $v_result = true;
- $v_list_detail = array();
-
- if ($v_result = $this->_openRead()) {
- $v_result = $this->_extractList($p_path, $v_list_detail,
- "complete", 0, $p_remove_path);
- $this->_close();
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractInString()
- /**
- * This method extract from the archive one file identified by $p_filename.
- * The return value is a string with the file content, or NULL on error.
- * @param string $p_filename The path of the file to extract in a string.
- * @return a string with the file content or NULL.
- * @access public
- */
- function extractInString($p_filename)
- {
- if ($this->_openRead()) {
- $v_result = $this->_extractInString($p_filename);
- $this->_close();
- } else {
- $v_result = NULL;
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractList()
- /**
- * This method extract from the archive only the files indicated in the
- * $p_filelist. These files are extracted in the current directory or
- * in the directory indicated by the optional $p_path parameter.
- * If indicated the $p_remove_path can be used in the same way as it is
- * used in extractModify() method.
- * @param array $p_filelist An array of filenames and directory names,
- * or a single string with names separated
- * by a single blank space.
- * @param string $p_path The path of the directory where the
- * files/dir need to by extracted.
- * @param string $p_remove_path Part of the memorized path that can be
- * removed if present at the beginning of
- * the file/dir path.
- * @return true on success, false on error.
- * @access public
- * @see extractModify()
- */
- function extractList($p_filelist, $p_path='', $p_remove_path='')
- {
- $v_result = true;
- $v_list_detail = array();
-
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode($this->_separator, $p_filelist);
- else {
- $this->_error('Invalid string list');
- return false;
- }
-
- if ($v_result = $this->_openRead()) {
- $v_result = $this->_extractList($p_path, $v_list_detail, "partial",
- $v_list, $p_remove_path);
- $this->_close();
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ setAttribute()
- /**
- * This method set specific attributes of the archive. It uses a variable
- * list of parameters, in the format attribute code + attribute values :
- * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
- * @param mixed $argv variable list of attributes and values
- * @return true on success, false on error.
- * @access public
- */
- function setAttribute()
- {
- $v_result = true;
-
- // ----- Get the number of variable list of arguments
- if (($v_size = func_num_args()) == 0) {
- return true;
- }
-
- // ----- Get the arguments
- $v_att_list = &func_get_args();
-
- // ----- Read the attributes
- $i=0;
- while ($i<$v_size) {
-
- // ----- Look for next option
- switch ($v_att_list[$i]) {
- // ----- Look for options that request a string value
- case ARCHIVE_TAR_ATT_SEPARATOR :
- // ----- Check the number of parameters
- if (($i+1) >= $v_size) {
- $this->_error('Invalid number of parameters for '
- .'attribute ARCHIVE_TAR_ATT_SEPARATOR');
- return false;
- }
-
- // ----- Get the value
- $this->_separator = $v_att_list[$i+1];
- $i++;
- break;
-
- default :
- $this->_error('Unknow attribute code '.$v_att_list[$i].'');
- return false;
- }
-
- // ----- Next attribute
- $i++;
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ setIgnoreRegexp()
- /**
- * This method sets the regular expression for ignoring files and directories
- * at import, for example:
- * $arch->setIgnoreRegexp("#CVS|\.svn#");
- * @param string $regexp regular expression defining which files or directories to ignore
- * @access public
- */
- function setIgnoreRegexp($regexp)
- {
- $this->_ignore_regexp = $regexp;
- }
- // }}}
-
- // {{{ setIgnoreList()
- /**
- * This method sets the regular expression for ignoring all files and directories
- * matching the filenames in the array list at import, for example:
- * $arch->setIgnoreList(array('CVS', '.svn', 'bin/tool'));
- * @param array $list a list of file or directory names to ignore
- * @access public
- */
- function setIgnoreList($list)
- {
- $regexp = str_replace(array('#', '.', '^', '$'), array('\#', '\.', '\^', '\$'), $list);
- $regexp = '#/'.join('$|/', $list).'#';
- $this->setIgnoreRegexp($regexp);
- }
- // }}}
-
- // {{{ _error()
- function _error($p_message)
- {
- // ----- To be completed
- $this->raiseError($p_message);
- }
- // }}}
-
- // {{{ _warning()
- function _warning($p_message)
- {
- // ----- To be completed
- $this->raiseError($p_message);
- }
- // }}}
-
- // {{{ _isArchive()
- function _isArchive($p_filename=NULL)
- {
- if ($p_filename == NULL) {
- $p_filename = $this->_tarname;
- }
- clearstatcache();
- return @is_file($p_filename) && !@is_link($p_filename);
- }
- // }}}
-
- // {{{ _openWrite()
- function _openWrite()
- {
- if ($this->_compress_type == 'gz')
- $this->_file = @gzopen($this->_tarname, "wb9");
- else if ($this->_compress_type == 'bz2')
- $this->_file = @bzopen($this->_tarname, "w");
- else if ($this->_compress_type == 'none')
- $this->_file = @fopen($this->_tarname, "wb");
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in write mode \''
- .$this->_tarname.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openRead()
- function _openRead()
- {
- if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
-
- // ----- Look if a local copy need to be done
- if ($this->_temp_tarname == '') {
- $this->_temp_tarname = uniqid('tar').'.tmp';
- if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
- $this->_error('Unable to open in read mode \''
- .$this->_tarname.'\'');
- $this->_temp_tarname = '';
- return false;
- }
- if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
- $this->_error('Unable to open in write mode \''
- .$this->_temp_tarname.'\'');
- $this->_temp_tarname = '';
- return false;
- }
- while ($v_data = @fread($v_file_from, 1024))
- @fwrite($v_file_to, $v_data);
- @fclose($v_file_from);
- @fclose($v_file_to);
- }
-
- // ----- File to open if the local copy
- $v_filename = $this->_temp_tarname;
-
- } else
- // ----- File to open if the normal Tar file
- $v_filename = $this->_tarname;
-
- if ($this->_compress_type == 'gz')
- $this->_file = @gzopen($v_filename, "rb");
- else if ($this->_compress_type == 'bz2')
- $this->_file = @bzopen($v_filename, "r");
- else if ($this->_compress_type == 'none')
- $this->_file = @fopen($v_filename, "rb");
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in read mode \''.$v_filename.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openReadWrite()
- function _openReadWrite()
- {
- if ($this->_compress_type == 'gz')
- $this->_file = @gzopen($this->_tarname, "r+b");
- else if ($this->_compress_type == 'bz2') {
- $this->_error('Unable to open bz2 in read/write mode \''
- .$this->_tarname.'\' (limitation of bz2 extension)');
- return false;
- } else if ($this->_compress_type == 'none')
- $this->_file = @fopen($this->_tarname, "r+b");
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in read/write mode \''
- .$this->_tarname.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _close()
- function _close()
- {
- //if (isset($this->_file)) {
- if (is_resource($this->_file)) {
- if ($this->_compress_type == 'gz')
- @gzclose($this->_file);
- else if ($this->_compress_type == 'bz2')
- @bzclose($this->_file);
- else if ($this->_compress_type == 'none')
- @fclose($this->_file);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- $this->_file = 0;
- }
-
- // ----- Look if a local copy need to be erase
- // Note that it might be interesting to keep the url for a time : ToDo
- if ($this->_temp_tarname != '') {
- @unlink($this->_temp_tarname);
- $this->_temp_tarname = '';
- }
-
- return true;
- }
- // }}}
-
- // {{{ _cleanFile()
- function _cleanFile()
- {
- $this->_close();
-
- // ----- Look for a local copy
- if ($this->_temp_tarname != '') {
- // ----- Remove the local copy but not the remote tarname
- @unlink($this->_temp_tarname);
- $this->_temp_tarname = '';
- } else {
- // ----- Remove the local tarname file
- @unlink($this->_tarname);
- }
- $this->_tarname = '';
-
- return true;
- }
- // }}}
-
- // {{{ _writeBlock()
- function _writeBlock($p_binary_data, $p_len=null)
- {
- if (is_resource($this->_file)) {
- if ($p_len === null) {
- if ($this->_compress_type == 'gz')
- @gzputs($this->_file, $p_binary_data);
- else if ($this->_compress_type == 'bz2')
- @bzwrite($this->_file, $p_binary_data);
- else if ($this->_compress_type == 'none')
- @fputs($this->_file, $p_binary_data);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
- } else {
- if ($this->_compress_type == 'gz')
- @gzputs($this->_file, $p_binary_data, $p_len);
- else if ($this->_compress_type == 'bz2')
- @bzwrite($this->_file, $p_binary_data, $p_len);
- else if ($this->_compress_type == 'none')
- @fputs($this->_file, $p_binary_data, $p_len);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- }
- }
- return true;
- }
- // }}}
-
- // {{{ _readBlock()
- function _readBlock()
- {
- $v_block = null;
- if (is_resource($this->_file)) {
- if ($this->_compress_type == 'gz')
- $v_block = @gzread($this->_file, 512);
- else if ($this->_compress_type == 'bz2')
- $v_block = @bzread($this->_file, 512);
- else if ($this->_compress_type == 'none')
- $v_block = @fread($this->_file, 512);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
- }
- return $v_block;
- }
- // }}}
-
- // {{{ _jumpBlock()
- function _jumpBlock($p_len=null)
- {
- if (is_resource($this->_file)) {
- if ($p_len === null)
- $p_len = 1;
-
- if ($this->_compress_type == 'gz') {
- @gzseek($this->_file, gztell($this->_file)+($p_len*512));
- }
- else if ($this->_compress_type == 'bz2') {
- // ----- Replace missing bztell() and bzseek()
- for ($i=0; $i<$p_len; $i++)
- $this->_readBlock();
- } else if ($this->_compress_type == 'none')
- @fseek($this->_file, $p_len*512, SEEK_CUR);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- }
- return true;
- }
- // }}}
-
- // {{{ _writeFooter()
- function _writeFooter()
- {
- if (is_resource($this->_file)) {
- // ----- Write the last 0 filled block for end of archive
- $v_binary_data = pack('a1024', '');
- $this->_writeBlock($v_binary_data);
- }
- return true;
- }
- // }}}
-
- // {{{ _addList()
- function _addList($p_list, $p_add_dir, $p_remove_dir)
- {
- $v_result=true;
- $v_header = array();
-
- // ----- Remove potential windows directory separator
- $p_add_dir = $this->_translateWinPath($p_add_dir);
- $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
-
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if (sizeof($p_list) == 0)
- return true;
-
- foreach ($p_list as $v_filename) {
- if (!$v_result) {
- break;
- }
-
- // ----- Skip the current tar name
- if ($v_filename == $this->_tarname)
- continue;
-
- if ($v_filename == '')
- continue;
-
- // ----- ignore files and directories matching the ignore regular expression
- if ($this->_ignore_regexp && preg_match($this->_ignore_regexp, '/'.$v_filename)) {
- $this->_warning("File '$v_filename' ignored");
- continue;
- }
-
- if (!file_exists($v_filename)) {
- $this->_warning("File '$v_filename' does not exist");
- continue;
- }
-
- // ----- Add the file or directory header
- if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
- return false;
-
- if (@is_dir($v_filename) && !@is_link($v_filename)) {
- if (!($p_hdir = opendir($v_filename))) {
- $this->_warning("Directory '$v_filename' can not be read");
- continue;
- }
- while (false !== ($p_hitem = readdir($p_hdir))) {
- if (($p_hitem != '.') && ($p_hitem != '..')) {
- if ($v_filename != ".")
- $p_temp_list[0] = $v_filename.'/'.$p_hitem;
- else
- $p_temp_list[0] = $p_hitem;
-
- $v_result = $this->_addList($p_temp_list,
- $p_add_dir,
- $p_remove_dir);
- }
- }
-
- unset($p_temp_list);
- unset($p_hdir);
- unset($p_hitem);
- }
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ _addFile()
- function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
- {
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if ($p_filename == '') {
- $this->_error('Invalid file name');
- return false;
- }
-
- // ----- Calculate the stored filename
- $p_filename = $this->_translateWinPath($p_filename, false);;
- $v_stored_filename = $p_filename;
- if (strcmp($p_filename, $p_remove_dir) == 0) {
- return true;
- }
- if ($p_remove_dir != '') {
- if (substr($p_remove_dir, -1) != '/')
- $p_remove_dir .= '/';
-
- if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
- $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
- }
- $v_stored_filename = $this->_translateWinPath($v_stored_filename);
- if ($p_add_dir != '') {
- if (substr($p_add_dir, -1) == '/')
- $v_stored_filename = $p_add_dir.$v_stored_filename;
- else
- $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
- }
-
- $v_stored_filename = $this->_pathReduction($v_stored_filename);
-
- if ($this->_isArchive($p_filename)) {
- if (($v_file = @fopen($p_filename, "rb")) == 0) {
- $this->_warning("Unable to open file '".$p_filename
- ."' in binary read mode");
- return true;
- }
-
- if (!$this->_writeHeader($p_filename, $v_stored_filename))
- return false;
-
- while (($v_buffer = fread($v_file, 512)) != '') {
- $v_binary_data = pack("a512", "$v_buffer");
- $this->_writeBlock($v_binary_data);
- }
-
- fclose($v_file);
-
- } else {
- // ----- Only header for dir
- if (!$this->_writeHeader($p_filename, $v_stored_filename))
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _addString()
- function _addString($p_filename, $p_string)
- {
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if ($p_filename == '') {
- $this->_error('Invalid file name');
- return false;
- }
-
- // ----- Calculate the stored filename
- $p_filename = $this->_translateWinPath($p_filename, false);;
-
- if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
- time(), 384, "", 0, 0))
- return false;
-
- $i=0;
- while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') {
- $v_binary_data = pack("a512", $v_buffer);
- $this->_writeBlock($v_binary_data);
- }
-
- return true;
- }
- // }}}
-
- // {{{ _writeHeader()
- function _writeHeader($p_filename, $p_stored_filename)
- {
- if ($p_stored_filename == '')
- $p_stored_filename = $p_filename;
- $v_reduce_filename = $this->_pathReduction($p_stored_filename);
-
- if (strlen($v_reduce_filename) > 99) {
- if (!$this->_writeLongHeader($v_reduce_filename))
- return false;
- }
-
- $v_info = lstat($p_filename);
- $v_uid = sprintf("%07s", DecOct($v_info[4]));
- $v_gid = sprintf("%07s", DecOct($v_info[5]));
- $v_perms = sprintf("%07s", DecOct($v_info['mode'] & 000777));
-
- $v_mtime = sprintf("%011s", DecOct($v_info['mtime']));
-
- $v_linkname = '';
-
- if (@is_link($p_filename)) {
- $v_typeflag = '2';
- $v_linkname = readlink($p_filename);
- $v_size = sprintf("%011s", DecOct(0));
- } elseif (@is_dir($p_filename)) {
- $v_typeflag = "5";
- $v_size = sprintf("%011s", DecOct(0));
- } else {
- $v_typeflag = '0';
- clearstatcache();
- $v_size = sprintf("%011s", DecOct($v_info['size']));
- }
-
- $v_magic = 'ustar ';
-
- $v_version = ' ';
-
- if (function_exists('posix_getpwuid'))
- {
- $userinfo = posix_getpwuid($v_info[4]);
- $groupinfo = posix_getgrgid($v_info[5]);
-
- $v_uname = $userinfo['name'];
- $v_gname = $groupinfo['name'];
- }
- else
- {
- $v_uname = '';
- $v_gname = '';
- }
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12a12",
- $v_reduce_filename, $v_perms, $v_uid,
- $v_gid, $v_size, $v_mtime);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
- $v_typeflag, $v_linkname, $v_magic,
- $v_version, $v_uname, $v_gname,
- $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%06s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- $this->_writeBlock($v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_last, 356);
-
- return true;
- }
- // }}}
-
- // {{{ _writeHeaderBlock()
- function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0,
- $p_type='', $p_uid=0, $p_gid=0)
- {
- $p_filename = $this->_pathReduction($p_filename);
-
- if (strlen($p_filename) > 99) {
- if (!$this->_writeLongHeader($p_filename))
- return false;
- }
-
- if ($p_type == "5") {
- $v_size = sprintf("%011s", DecOct(0));
- } else {
- $v_size = sprintf("%011s", DecOct($p_size));
- }
-
- $v_uid = sprintf("%07s", DecOct($p_uid));
- $v_gid = sprintf("%07s", DecOct($p_gid));
- $v_perms = sprintf("%07s", DecOct($p_perms & 000777));
-
- $v_mtime = sprintf("%11s", DecOct($p_mtime));
-
- $v_linkname = '';
-
- $v_magic = 'ustar ';
-
- $v_version = ' ';
-
- if (function_exists('posix_getpwuid'))
- {
- $userinfo = posix_getpwuid($p_uid);
- $groupinfo = posix_getgrgid($p_gid);
-
- $v_uname = $userinfo['name'];
- $v_gname = $groupinfo['name'];
- }
- else
- {
- $v_uname = '';
- $v_gname = '';
- }
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12A12",
- $p_filename, $v_perms, $v_uid, $v_gid,
- $v_size, $v_mtime);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
- $p_type, $v_linkname, $v_magic,
- $v_version, $v_uname, $v_gname,
- $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%06s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- $this->_writeBlock($v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_last, 356);
-
- return true;
- }
- // }}}
-
- // {{{ _writeLongHeader()
- function _writeLongHeader($p_filename)
- {
- $v_size = sprintf("%11s ", DecOct(strlen($p_filename)));
-
- $v_typeflag = 'L';
-
- $v_linkname = '';
-
- $v_magic = '';
-
- $v_version = '';
-
- $v_uname = '';
-
- $v_gname = '';
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12a12",
- '././@LongLink', 0, 0, 0, $v_size, 0);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
- $v_typeflag, $v_linkname, $v_magic,
- $v_version, $v_uname, $v_gname,
- $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%06s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- $this->_writeBlock($v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_last, 356);
-
- // ----- Write the filename as content of the block
- $i=0;
- while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') {
- $v_binary_data = pack("a512", "$v_buffer");
- $this->_writeBlock($v_binary_data);
- }
-
- return true;
- }
- // }}}
-
- // {{{ _readHeader()
- function _readHeader($v_binary_data, &$v_header)
- {
- if (strlen($v_binary_data)==0) {
- $v_header['filename'] = '';
- return true;
- }
-
- if (strlen($v_binary_data) != 512) {
- $v_header['filename'] = '';
- $this->_error('Invalid block size : '.strlen($v_binary_data));
- return false;
- }
-
- if (!is_array($v_header)) {
- $v_header = array();
- }
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum+=ord(substr($v_binary_data,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156; $i<512; $i++)
- $v_checksum+=ord(substr($v_binary_data,$i,1));
-
- $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
- ."a8checksum/a1typeflag/a100link/a6magic/a2version/"
- ."a32uname/a32gname/a8devmajor/a8devminor",
- $v_binary_data);
-
- // ----- Extract the checksum
- $v_header['checksum'] = OctDec(trim($v_data['checksum']));
- if ($v_header['checksum'] != $v_checksum) {
- $v_header['filename'] = '';
-
- // ----- Look for last block (empty block)
- if (($v_checksum == 256) && ($v_header['checksum'] == 0))
- return true;
-
- $this->_error('Invalid checksum for file "'.$v_data['filename']
- .'" : '.$v_checksum.' calculated, '
- .$v_header['checksum'].' expected');
- return false;
- }
-
- // ----- Extract the properties
- $v_header['filename'] = $v_data['filename'];
- if ($this->_maliciousFilename($v_header['filename'])) {
- $this->_error('Malicious .tar detected, file "' . $v_header['filename'] .
- '" will not install in desired directory tree');
- return false;
- }
- $v_header['mode'] = OctDec(trim($v_data['mode']));
- $v_header['uid'] = OctDec(trim($v_data['uid']));
- $v_header['gid'] = OctDec(trim($v_data['gid']));
- $v_header['size'] = OctDec(trim($v_data['size']));
- $v_header['mtime'] = OctDec(trim($v_data['mtime']));
- if (($v_header['typeflag'] = $v_data['typeflag']) == "5") {
- $v_header['size'] = 0;
- }
- $v_header['link'] = trim($v_data['link']);
- /* ----- All these fields are removed form the header because
- they do not carry interesting info
- $v_header[magic] = trim($v_data[magic]);
- $v_header[version] = trim($v_data[version]);
- $v_header[uname] = trim($v_data[uname]);
- $v_header[gname] = trim($v_data[gname]);
- $v_header[devmajor] = trim($v_data[devmajor]);
- $v_header[devminor] = trim($v_data[devminor]);
- */
-
- return true;
- }
- // }}}
-
- // {{{ _maliciousFilename()
- /**
- * Detect and report a malicious file name
- *
- * @param string $file
- * @return bool
- * @access private
- */
- function _maliciousFilename($file)
- {
- if (strpos($file, '/../') !== false) {
- return true;
- }
- if (strpos($file, '../') === 0) {
- return true;
- }
- return false;
- }
- // }}}
-
- // {{{ _readLongHeader()
- function _readLongHeader(&$v_header)
- {
- $v_filename = '';
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- $v_content = $this->_readBlock();
- $v_filename .= $v_content;
- }
- if (($v_header['size'] % 512) != 0) {
- $v_content = $this->_readBlock();
- $v_filename .= trim($v_content);
- }
-
- // ----- Read the next header
- $v_binary_data = $this->_readBlock();
-
- if (!$this->_readHeader($v_binary_data, $v_header))
- return false;
-
- $v_filename = trim($v_filename);
- $v_header['filename'] = $v_filename;
- if ($this->_maliciousFilename($v_filename)) {
- $this->_error('Malicious .tar detected, file "' . $v_filename .
- '" will not install in desired directory tree');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _extractInString()
- /**
- * This method extract from the archive one file identified by $p_filename.
- * The return value is a string with the file content, or NULL on error.
- * @param string $p_filename The path of the file to extract in a string.
- * @return a string with the file content or NULL.
- * @access private
- */
- function _extractInString($p_filename)
- {
- $v_result_str = "";
-
- While (strlen($v_binary_data = $this->_readBlock()) != 0)
- {
- if (!$this->_readHeader($v_binary_data, $v_header))
- return NULL;
-
- if ($v_header['filename'] == '')
- continue;
-
- // ----- Look for long filename
- if ($v_header['typeflag'] == 'L') {
- if (!$this->_readLongHeader($v_header))
- return NULL;
- }
-
- if ($v_header['filename'] == $p_filename) {
- if ($v_header['typeflag'] == "5") {
- $this->_error('Unable to extract in string a directory '
- .'entry {'.$v_header['filename'].'}');
- return NULL;
- } else {
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- $v_result_str .= $this->_readBlock();
- }
- if (($v_header['size'] % 512) != 0) {
- $v_content = $this->_readBlock();
- $v_result_str .= substr($v_content, 0,
- ($v_header['size'] % 512));
- }
- return $v_result_str;
- }
- } else {
- $this->_jumpBlock(ceil(($v_header['size']/512)));
- }
- }
-
- return NULL;
- }
- // }}}
-
- // {{{ _extractList()
- function _extractList($p_path, &$p_list_detail, $p_mode,
- $p_file_list, $p_remove_path)
- {
- $v_result=true;
- $v_nb = 0;
- $v_extract_all = true;
- $v_listing = false;
-
- $p_path = $this->_translateWinPath($p_path, false);
- if ($p_path == '' || (substr($p_path, 0, 1) != '/'
- && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
- $p_path = "./".$p_path;
- }
- $p_remove_path = $this->_translateWinPath($p_remove_path);
-
- // ----- Look for path to remove format (should end by /)
- if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
- $p_remove_path .= '/';
- $p_remove_path_size = strlen($p_remove_path);
-
- switch ($p_mode) {
- case "complete" :
- $v_extract_all = TRUE;
- $v_listing = FALSE;
- break;
- case "partial" :
- $v_extract_all = FALSE;
- $v_listing = FALSE;
- break;
- case "list" :
- $v_extract_all = FALSE;
- $v_listing = TRUE;
- break;
- default :
- $this->_error('Invalid extract mode ('.$p_mode.')');
- return false;
- }
-
- clearstatcache();
-
- while (strlen($v_binary_data = $this->_readBlock()) != 0)
- {
- $v_extract_file = FALSE;
- $v_extraction_stopped = 0;
-
- if (!$this->_readHeader($v_binary_data, $v_header))
- return false;
-
- if ($v_header['filename'] == '') {
- continue;
- }
-
- // ----- Look for long filename
- if ($v_header['typeflag'] == 'L') {
- if (!$this->_readLongHeader($v_header))
- return false;
- }
-
- if ((!$v_extract_all) && (is_array($p_file_list))) {
- // ----- By default no unzip if the file is not found
- $v_extract_file = false;
-
- for ($i=0; $i strlen($p_file_list[$i]))
- && (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
- == $p_file_list[$i])) {
- $v_extract_file = TRUE;
- break;
- }
- }
-
- // ----- It is a file, so compare the file names
- elseif ($p_file_list[$i] == $v_header['filename']) {
- $v_extract_file = TRUE;
- break;
- }
- }
- } else {
- $v_extract_file = TRUE;
- }
-
- // ----- Look if this file need to be extracted
- if (($v_extract_file) && (!$v_listing))
- {
- if (($p_remove_path != '')
- && (substr($v_header['filename'], 0, $p_remove_path_size)
- == $p_remove_path))
- $v_header['filename'] = substr($v_header['filename'],
- $p_remove_path_size);
- if (($p_path != './') && ($p_path != '/')) {
- while (substr($p_path, -1) == '/')
- $p_path = substr($p_path, 0, strlen($p_path)-1);
-
- if (substr($v_header['filename'], 0, 1) == '/')
- $v_header['filename'] = $p_path.$v_header['filename'];
- else
- $v_header['filename'] = $p_path.'/'.$v_header['filename'];
- }
- if (file_exists($v_header['filename'])) {
- if ( (@is_dir($v_header['filename']))
- && ($v_header['typeflag'] == '')) {
- $this->_error('File '.$v_header['filename']
- .' already exists as a directory');
- return false;
- }
- if ( ($this->_isArchive($v_header['filename']))
- && ($v_header['typeflag'] == "5")) {
- $this->_error('Directory '.$v_header['filename']
- .' already exists as a file');
- return false;
- }
- if (!is_writeable($v_header['filename'])) {
- $this->_error('File '.$v_header['filename']
- .' already exists and is write protected');
- return false;
- }
- if (filemtime($v_header['filename']) > $v_header['mtime']) {
- // To be completed : An error or silent no replace ?
- }
- }
-
- // ----- Check the directory availability and create it if necessary
- elseif (($v_result
- = $this->_dirCheck(($v_header['typeflag'] == "5"
- ?$v_header['filename']
- :dirname($v_header['filename'])))) != 1) {
- $this->_error('Unable to create path for '.$v_header['filename']);
- return false;
- }
-
- if ($v_extract_file) {
- if ($v_header['typeflag'] == "5") {
- if (!@file_exists($v_header['filename'])) {
- if (!@mkdir($v_header['filename'], 0777)) {
- $this->_error('Unable to create directory {'
- .$v_header['filename'].'}');
- return false;
- }
- }
- } elseif ($v_header['typeflag'] == "2") {
- if (@file_exists($v_header['filename'])) {
- @unlink($v_header['filename']);
- }
- if (!@symlink($v_header['link'], $v_header['filename'])) {
- $this->_error('Unable to extract symbolic link {'
- .$v_header['filename'].'}');
- return false;
- }
- } else {
- if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
- $this->_error('Error while opening {'.$v_header['filename']
- .'} in write binary mode');
- return false;
- } else {
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- $v_content = $this->_readBlock();
- fwrite($v_dest_file, $v_content, 512);
- }
- if (($v_header['size'] % 512) != 0) {
- $v_content = $this->_readBlock();
- fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
- }
-
- @fclose($v_dest_file);
-
- // ----- Change the file mode, mtime
- @touch($v_header['filename'], $v_header['mtime']);
- if ($v_header['mode'] & 0111) {
- // make file executable, obey umask
- $mode = fileperms($v_header['filename']) | (~umask() & 0111);
- @chmod($v_header['filename'], $mode);
- }
- }
-
- // ----- Check the file size
- clearstatcache();
- if (filesize($v_header['filename']) != $v_header['size']) {
- $this->_error('Extracted file '.$v_header['filename']
- .' does not have the correct file size \''
- .filesize($v_header['filename'])
- .'\' ('.$v_header['size']
- .' expected). Archive may be corrupted.');
- return false;
- }
- }
- } else {
- $this->_jumpBlock(ceil(($v_header['size']/512)));
- }
- } else {
- $this->_jumpBlock(ceil(($v_header['size']/512)));
- }
-
- /* TBC : Seems to be unused ...
- if ($this->_compress)
- $v_end_of_file = @gzeof($this->_file);
- else
- $v_end_of_file = @feof($this->_file);
- */
-
- if ($v_listing || $v_extract_file || $v_extraction_stopped) {
- // ----- Log extracted files
- if (($v_file_dir = dirname($v_header['filename']))
- == $v_header['filename'])
- $v_file_dir = '';
- if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
- $v_file_dir = '/';
-
- $p_list_detail[$v_nb++] = $v_header;
- if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) {
- return true;
- }
- }
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openAppend()
- function _openAppend()
- {
- if (filesize($this->_tarname) == 0)
- return $this->_openWrite();
-
- if ($this->_compress) {
- $this->_close();
-
- if (!@rename($this->_tarname, $this->_tarname.".tmp")) {
- $this->_error('Error while renaming \''.$this->_tarname
- .'\' to temporary file \''.$this->_tarname
- .'.tmp\'');
- return false;
- }
-
- if ($this->_compress_type == 'gz')
- $v_temp_tar = @gzopen($this->_tarname.".tmp", "rb");
- elseif ($this->_compress_type == 'bz2')
- $v_temp_tar = @bzopen($this->_tarname.".tmp", "r");
-
- if ($v_temp_tar == 0) {
- $this->_error('Unable to open file \''.$this->_tarname
- .'.tmp\' in binary read mode');
- @rename($this->_tarname.".tmp", $this->_tarname);
- return false;
- }
-
- if (!$this->_openWrite()) {
- @rename($this->_tarname.".tmp", $this->_tarname);
- return false;
- }
-
- if ($this->_compress_type == 'gz') {
- while (!@gzeof($v_temp_tar)) {
- $v_buffer = @gzread($v_temp_tar, 512);
- if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
- // do not copy end blocks, we will re-make them
- // after appending
- continue;
- }
- $v_binary_data = pack("a512", $v_buffer);
- $this->_writeBlock($v_binary_data);
- }
-
- @gzclose($v_temp_tar);
- }
- elseif ($this->_compress_type == 'bz2') {
- while (strlen($v_buffer = @bzread($v_temp_tar, 512)) > 0) {
- if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
- continue;
- }
- $v_binary_data = pack("a512", $v_buffer);
- $this->_writeBlock($v_binary_data);
- }
-
- @bzclose($v_temp_tar);
- }
-
- if (!@unlink($this->_tarname.".tmp")) {
- $this->_error('Error while deleting temporary file \''
- .$this->_tarname.'.tmp\'');
- }
-
- } else {
- // ----- For not compressed tar, just add files before the last
- // one or two 512 bytes block
- if (!$this->_openReadWrite())
- return false;
-
- clearstatcache();
- $v_size = filesize($this->_tarname);
-
- // We might have zero, one or two end blocks.
- // The standard is two, but we should try to handle
- // other cases.
- fseek($this->_file, $v_size - 1024);
- if (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
- fseek($this->_file, $v_size - 1024);
- }
- elseif (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
- fseek($this->_file, $v_size - 512);
- }
- }
-
- return true;
- }
- // }}}
-
- // {{{ _append()
- function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
- {
- if (!$this->_openAppend())
- return false;
-
- if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
- $this->_writeFooter();
-
- $this->_close();
-
- return true;
- }
- // }}}
-
- // {{{ _dirCheck()
-
- /**
- * Check if a directory exists and create it (including parent
- * dirs) if not.
- *
- * @param string $p_dir directory to check
- *
- * @return bool TRUE if the directory exists or was created
- */
- function _dirCheck($p_dir)
- {
- clearstatcache();
- if ((@is_dir($p_dir)) || ($p_dir == ''))
- return true;
-
- $p_parent_dir = dirname($p_dir);
-
- if (($p_parent_dir != $p_dir) &&
- ($p_parent_dir != '') &&
- (!$this->_dirCheck($p_parent_dir)))
- return false;
-
- if (!@mkdir($p_dir, 0777)) {
- $this->_error("Unable to create directory '$p_dir'");
- return false;
- }
-
- return true;
- }
-
- // }}}
-
- // {{{ _pathReduction()
-
- /**
- * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar",
- * rand emove double slashes.
- *
- * @param string $p_dir path to reduce
- *
- * @return string reduced path
- *
- * @access private
- *
- */
- function _pathReduction($p_dir)
- {
- $v_result = '';
-
- // ----- Look for not empty path
- if ($p_dir != '') {
- // ----- Explode path by directory names
- $v_list = explode('/', $p_dir);
-
- // ----- Study directories from last to first
- for ($i=sizeof($v_list)-1; $i>=0; $i--) {
- // ----- Look for current path
- if ($v_list[$i] == ".") {
- // ----- Ignore this directory
- // Should be the first $i=0, but no check is done
- }
- else if ($v_list[$i] == "..") {
- // ----- Ignore it and ignore the $i-1
- $i--;
- }
- else if ( ($v_list[$i] == '')
- && ($i!=(sizeof($v_list)-1))
- && ($i!=0)) {
- // ----- Ignore only the double '//' in path,
- // but not the first and last /
- } else {
- $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'
- .$v_result:'');
- }
- }
- }
- $v_result = strtr($v_result, '\\', '/');
- return $v_result;
- }
-
- // }}}
-
- // {{{ _translateWinPath()
- function _translateWinPath($p_path, $p_remove_disk_letter=true)
- {
- if (defined('OS_WINDOWS') && OS_WINDOWS) {
- // ----- Look for potential disk letter
- if ( ($p_remove_disk_letter)
- && (($v_position = strpos($p_path, ':')) != false)) {
- $p_path = substr($p_path, $v_position+1);
- }
- // ----- Change potential windows directory separator
- if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
- $p_path = strtr($p_path, '\\', '/');
- }
- }
- return $p_path;
- }
- // }}}
-
-}
-?>
diff --git a/airtime_mvc/library/pear/Calendar/Calendar.php b/airtime_mvc/library/pear/Calendar/Calendar.php
deleted file mode 100644
index f1670ff25..000000000
--- a/airtime_mvc/library/pear/Calendar/Calendar.php
+++ /dev/null
@@ -1,780 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Calendar.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Constant which defines the calculation engine to use
- */
-if (!defined('CALENDAR_ENGINE')) {
- define('CALENDAR_ENGINE', 'UnixTS');
-}
-
-/**
- * Define Calendar Month states
- */
-define('CALENDAR_USE_MONTH', 1);
-define('CALENDAR_USE_MONTH_WEEKDAYS', 2);
-define('CALENDAR_USE_MONTH_WEEKS', 3);
-
-/**
- * Contains a factory method to return a Singleton instance of a class
- * implementing the Calendar_Engine_Interface.
- * Note: this class must be modified to "register" alternative
- * Calendar_Engines. The engine used can be controlled with the constant
- * CALENDAR_ENGINE
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @see Calendar_Engine_Interface
- * @access protected
- */
-class Calendar_Engine_Factory
-{
- /**
- * Returns an instance of the engine
- *
- * @return object instance of a calendar calculation engine
- * @access protected
- */
- function & getEngine()
- {
- static $engine = false;
- switch (CALENDAR_ENGINE) {
- case 'PearDate':
- $class = 'Calendar_Engine_PearDate';
- break;
- case 'UnixTS':
- default:
- $class = 'Calendar_Engine_UnixTS';
- break;
- }
- if (!$engine) {
- if (!class_exists($class)) {
- include_once CALENDAR_ROOT.'Engine'.DIRECTORY_SEPARATOR.CALENDAR_ENGINE.'.php';
- }
- $engine = new $class;
- }
- return $engine;
- }
-}
-
-/**
- * Base class for Calendar API. This class should not be instantiated directly.
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @abstract
- */
-class Calendar
-{
- /**
- * Instance of class implementing calendar engine interface
- * @var object
- * @access private
- */
- var $cE;
-
- /**
- * Instance of Calendar_Validator (lazy initialized when isValid() or
- * getValidor() is called
- * @var Calendar_Validator
- * @access private
- */
- var $validator;
-
- /**
- * Year for this calendar object e.g. 2003
- * @access private
- * @var int
- */
- var $year;
-
- /**
- * Month for this calendar object e.g. 9
- * @access private
- * @var int
- */
- var $month;
-
- /**
- * Day of month for this calendar object e.g. 23
- * @access private
- * @var int
- */
- var $day;
-
- /**
- * Hour of day for this calendar object e.g. 13
- * @access private
- * @var int
- */
- var $hour;
-
- /**
- * Minute of hour this calendar object e.g. 46
- * @access private
- * @var int
- */
- var $minute;
-
- /**
- * Second of minute this calendar object e.g. 34
- * @access private
- * @var int
- */
- var $second;
-
- /**
- * Marks this calendar object as selected (e.g. 'today')
- * @access private
- * @var boolean
- */
- var $selected = false;
-
- /**
- * Collection of child calendar objects created from subclasses
- * of Calendar. Type depends on the object which created them.
- * @access private
- * @var array
- */
- var $children = array();
-
- /**
- * Constructs the Calendar
- *
- * @param int $y year
- * @param int $m month
- * @param int $d day
- * @param int $h hour
- * @param int $i minute
- * @param int $s second
- *
- * @access protected
- */
- function Calendar($y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0)
- {
- static $cE = null;
- if (!isset($cE)) {
- $cE = & Calendar_Engine_Factory::getEngine();
- }
- $this->cE = & $cE;
- $this->year = (int)$y;
- $this->month = (int)$m;
- $this->day = (int)$d;
- $this->hour = (int)$h;
- $this->minute = (int)$i;
- $this->second = (int)$s;
- }
-
- /**
- * Defines the calendar by a timestamp (Unix or ISO-8601), replacing values
- * passed to the constructor
- *
- * @param int|string $ts Unix or ISO-8601 timestamp
- *
- * @return void
- * @access public
- */
- function setTimestamp($ts)
- {
- $this->year = $this->cE->stampToYear($ts);
- $this->month = $this->cE->stampToMonth($ts);
- $this->day = $this->cE->stampToDay($ts);
- $this->hour = $this->cE->stampToHour($ts);
- $this->minute = $this->cE->stampToMinute($ts);
- $this->second = $this->cE->stampToSecond($ts);
- }
-
- /**
- * Returns a timestamp from the current date / time values. Format of
- * timestamp depends on Calendar_Engine implementation being used
- *
- * @return int|string timestamp
- * @access public
- */
- function getTimestamp()
- {
- return $this->cE->dateToStamp(
- $this->year, $this->month, $this->day,
- $this->hour, $this->minute, $this->second);
- }
-
- /**
- * Defines calendar object as selected (e.g. for today)
- *
- * @param boolean $state whether Calendar subclass
- *
- * @return void
- * @access public
- */
- function setSelected($state = true)
- {
- $this->selected = $state;
- }
-
- /**
- * True if the calendar subclass object is selected (e.g. today)
- *
- * @return boolean
- * @access public
- */
- function isSelected()
- {
- return $this->selected;
- }
-
- /**
- * Checks if the current Calendar object is today's date
- *
- * @return boolean
- * @access public
- */
- function isToday()
- {
- return $this->cE->isToday($this->getTimeStamp());
- }
-
- /**
- * Adjusts the date (helper method)
- *
- * @return void
- * @access public
- */
- function adjust()
- {
- $stamp = $this->getTimeStamp();
- $this->year = $this->cE->stampToYear($stamp);
- $this->month = $this->cE->stampToMonth($stamp);
- $this->day = $this->cE->stampToDay($stamp);
- $this->hour = $this->cE->stampToHour($stamp);
- $this->minute = $this->cE->stampToMinute($stamp);
- $this->second = $this->cE->stampToSecond($stamp);
- }
-
- /**
- * Returns the date as an associative array (helper method)
- *
- * @param mixed $stamp timestamp (leave empty for current timestamp)
- *
- * @return array
- * @access public
- */
- function toArray($stamp=null)
- {
- if (is_null($stamp)) {
- $stamp = $this->getTimeStamp();
- }
- return array(
- 'year' => $this->cE->stampToYear($stamp),
- 'month' => $this->cE->stampToMonth($stamp),
- 'day' => $this->cE->stampToDay($stamp),
- 'hour' => $this->cE->stampToHour($stamp),
- 'minute' => $this->cE->stampToMinute($stamp),
- 'second' => $this->cE->stampToSecond($stamp)
- );
- }
-
- /**
- * Returns the value as an associative array (helper method)
- *
- * @param string $returnType type of date object that return value represents
- * @param string $format ['int' | 'array' | 'timestamp' | 'object']
- * @param mixed $stamp timestamp (depending on Calendar engine being used)
- * @param int $default default value (i.e. give me the answer quick)
- *
- * @return mixed
- * @access private
- */
- function returnValue($returnType, $format, $stamp, $default)
- {
- switch (strtolower($format)) {
- case 'int':
- return $default;
- case 'array':
- return $this->toArray($stamp);
- break;
- case 'object':
- include_once CALENDAR_ROOT.'Factory.php';
- return Calendar_Factory::createByTimestamp($returnType, $stamp);
- break;
- case 'timestamp':
- default:
- return $stamp;
- break;
- }
- }
-
- /**
- * Abstract method for building the children of a calendar object.
- * Implemented by Calendar subclasses
- *
- * @param array $sDates array containing Calendar objects to select (optional)
- *
- * @return boolean
- * @access public
- * @abstract
- */
- function build($sDates = array())
- {
- include_once 'PEAR.php';
- PEAR::raiseError('Calendar::build is abstract', null, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar::build()');
- return false;
- }
-
- /**
- * Abstract method for selected data objects called from build
- *
- * @param array $sDates array of Calendar objects to select
- *
- * @return boolean
- * @access public
- * @abstract
- */
- function setSelection($sDates)
- {
- include_once 'PEAR.php';
- PEAR::raiseError(
- 'Calendar::setSelection is abstract', null, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar::setSelection()');
- return false;
- }
-
- /**
- * Iterator method for fetching child Calendar subclass objects
- * (e.g. a minute from an hour object). On reaching the end of
- * the collection, returns false and resets the collection for
- * further iteratations.
- *
- * @return mixed either an object subclass of Calendar or false
- * @access public
- */
- function fetch()
- {
- $child = each($this->children);
- if ($child) {
- return $child['value'];
- } else {
- reset($this->children);
- return false;
- }
- }
-
- /**
- * Fetches all child from the current collection of children
- *
- * @return array
- * @access public
- */
- function fetchAll()
- {
- return $this->children;
- }
-
- /**
- * Get the number Calendar subclass objects stored in the internal collection
- *
- * @return int
- * @access public
- */
- function size()
- {
- return count($this->children);
- }
-
- /**
- * Determine whether this date is valid, with the bounds determined by
- * the Calendar_Engine. The call is passed on to Calendar_Validator::isValid
- *
- * @return boolean
- * @access public
- */
- function isValid()
- {
- $validator = & $this->getValidator();
- return $validator->isValid();
- }
-
- /**
- * Returns an instance of Calendar_Validator
- *
- * @return Calendar_Validator
- * @access public
- */
- function & getValidator()
- {
- if (!isset($this->validator)) {
- include_once CALENDAR_ROOT.'Validator.php';
- $this->validator = new Calendar_Validator($this);
- }
- return $this->validator;
- }
-
- /**
- * Returns a reference to the current Calendar_Engine being used. Useful
- * for Calendar_Table_Helper and Calendar_Validator
- *
- * @return object implementing Calendar_Engine_Inteface
- * @access protected
- */
- function & getEngine()
- {
- return $this->cE;
- }
-
- /**
- * Set the CALENDAR_FIRST_DAY_OF_WEEK constant to the $firstDay value
- * if the constant is not set yet.
- *
- * @param integer $firstDay first day of the week (0=sunday, 1=monday, ...)
- *
- * @return integer
- * @throws E_USER_WARNING this method throws a WARNING if the
- * CALENDAR_FIRST_DAY_OF_WEEK constant is already defined and
- * the $firstDay parameter is set to a different value
- * @access protected
- */
- function defineFirstDayOfWeek($firstDay = null)
- {
- if (defined('CALENDAR_FIRST_DAY_OF_WEEK')) {
- if (!is_null($firstDay) && ($firstDay != CALENDAR_FIRST_DAY_OF_WEEK)) {
- $msg = 'CALENDAR_FIRST_DAY_OF_WEEK constant already defined.'
- .' The $firstDay parameter will be ignored.';
- trigger_error($msg, E_USER_WARNING);
- }
- return CALENDAR_FIRST_DAY_OF_WEEK;
- }
- if (is_null($firstDay)) {
- $firstDay = $this->cE->getFirstDayOfWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- );
- }
- define ('CALENDAR_FIRST_DAY_OF_WEEK', $firstDay);
- return CALENDAR_FIRST_DAY_OF_WEEK;
- }
-
- /**
- * Returns the value for the previous year
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 2002 or timestamp
- * @access public
- */
- function prevYear($format = 'int')
- {
- $ts = $this->cE->dateToStamp($this->year-1, 1, 1, 0, 0, 0);
- return $this->returnValue('Year', $format, $ts, $this->year-1);
- }
-
- /**
- * Returns the value for this year
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 2003 or timestamp
- * @access public
- */
- function thisYear($format = 'int')
- {
- $ts = $this->cE->dateToStamp($this->year, 1, 1, 0, 0, 0);
- return $this->returnValue('Year', $format, $ts, $this->year);
- }
-
- /**
- * Returns the value for next year
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 2004 or timestamp
- * @access public
- */
- function nextYear($format = 'int')
- {
- $ts = $this->cE->dateToStamp($this->year+1, 1, 1, 0, 0, 0);
- return $this->returnValue('Year', $format, $ts, $this->year+1);
- }
-
- /**
- * Returns the value for the previous month
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 4 or Unix timestamp
- * @access public
- */
- function prevMonth($format = 'int')
- {
- $ts = $this->cE->dateToStamp($this->year, $this->month-1, 1, 0, 0, 0);
- return $this->returnValue('Month', $format, $ts, $this->cE->stampToMonth($ts));
- }
-
- /**
- * Returns the value for this month
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 5 or timestamp
- * @access public
- */
- function thisMonth($format = 'int')
- {
- $ts = $this->cE->dateToStamp($this->year, $this->month, 1, 0, 0, 0);
- return $this->returnValue('Month', $format, $ts, $this->month);
- }
-
- /**
- * Returns the value for next month
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 6 or timestamp
- * @access public
- */
- function nextMonth($format = 'int')
- {
- $ts = $this->cE->dateToStamp($this->year, $this->month+1, 1, 0, 0, 0);
- return $this->returnValue('Month', $format, $ts, $this->cE->stampToMonth($ts));
- }
-
- /**
- * Returns the value for the previous day
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 10 or timestamp
- * @access public
- */
- function prevDay($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day-1, 0, 0, 0);
- return $this->returnValue('Day', $format, $ts, $this->cE->stampToDay($ts));
- }
-
- /**
- * Returns the value for this day
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 11 or timestamp
- * @access public
- */
- function thisDay($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day, 0, 0, 0);
- return $this->returnValue('Day', $format, $ts, $this->day);
- }
-
- /**
- * Returns the value for the next day
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 12 or timestamp
- * @access public
- */
- function nextDay($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day+1, 0, 0, 0);
- return $this->returnValue('Day', $format, $ts, $this->cE->stampToDay($ts));
- }
-
- /**
- * Returns the value for the previous hour
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 13 or timestamp
- * @access public
- */
- function prevHour($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day, $this->hour-1, 0, 0);
- return $this->returnValue('Hour', $format, $ts, $this->cE->stampToHour($ts));
- }
-
- /**
- * Returns the value for this hour
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 14 or timestamp
- * @access public
- */
- function thisHour($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day, $this->hour, 0, 0);
- return $this->returnValue('Hour', $format, $ts, $this->hour);
- }
-
- /**
- * Returns the value for the next hour
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 14 or timestamp
- * @access public
- */
- function nextHour($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day, $this->hour+1, 0, 0);
- return $this->returnValue('Hour', $format, $ts, $this->cE->stampToHour($ts));
- }
-
- /**
- * Returns the value for the previous minute
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 23 or timestamp
- * @access public
- */
- function prevMinute($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day,
- $this->hour, $this->minute-1, 0);
- return $this->returnValue('Minute', $format, $ts, $this->cE->stampToMinute($ts));
- }
-
- /**
- * Returns the value for this minute
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 24 or timestamp
- * @access public
- */
- function thisMinute($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day,
- $this->hour, $this->minute, 0);
- return $this->returnValue('Minute', $format, $ts, $this->minute);
- }
-
- /**
- * Returns the value for the next minute
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 25 or timestamp
- * @access public
- */
- function nextMinute($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day,
- $this->hour, $this->minute+1, 0);
- return $this->returnValue('Minute', $format, $ts, $this->cE->stampToMinute($ts));
- }
-
- /**
- * Returns the value for the previous second
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 43 or timestamp
- * @access public
- */
- function prevSecond($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day,
- $this->hour, $this->minute, $this->second-1);
- return $this->returnValue('Second', $format, $ts, $this->cE->stampToSecond($ts));
- }
-
- /**
- * Returns the value for this second
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 44 or timestamp
- * @access public
- */
- function thisSecond($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day,
- $this->hour, $this->minute, $this->second);
- return $this->returnValue('Second', $format, $ts, $this->second);
- }
-
- /**
- * Returns the value for the next second
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 45 or timestamp
- * @access public
- */
- function nextSecond($format = 'int')
- {
- $ts = $this->cE->dateToStamp(
- $this->year, $this->month, $this->day,
- $this->hour, $this->minute, $this->second+1);
- return $this->returnValue('Second', $format, $ts, $this->cE->stampToSecond($ts));
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Day.php b/airtime_mvc/library/pear/Calendar/Day.php
deleted file mode 100644
index 3ef48538c..000000000
--- a/airtime_mvc/library/pear/Calendar/Day.php
+++ /dev/null
@@ -1,232 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Day.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Day and builds Hours.
- *
- * require_once 'Calendar/Day.php';
- * $Day = new Calendar_Day(2003, 10, 21); // Oct 21st 2003
- * while ($Hour = & $Day->fetch()) {
- * echo $Hour->thisHour().'
';
- * }
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Day extends Calendar
-{
- /**
- * Marks the Day at the beginning of a week
- * @access private
- * @var boolean
- */
- var $first = false;
-
- /**
- * Marks the Day at the end of a week
- * @access private
- * @var boolean
- */
- var $last = false;
-
-
- /**
- * Used for tabular calendars
- * @access private
- * @var boolean
- */
- var $empty = false;
-
- /**
- * Constructs Calendar_Day
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 8
- * @param int $d day e.g. 15
- *
- * @access public
- */
- function Calendar_Day($y, $m, $d)
- {
- parent::Calendar($y, $m, $d);
- }
-
- /**
- * Builds the Hours of the Day
- *
- * @param array $sDates (optional) Caledar_Hour objects representing selected dates
- *
- * @return boolean
- * @access public
- */
- function build($sDates = array())
- {
- include_once CALENDAR_ROOT.'Hour.php';
-
- $hID = $this->cE->getHoursInDay($this->year, $this->month, $this->day);
- for ($i=0; $i < $hID; $i++) {
- $this->children[$i] =
- new Calendar_Hour($this->year, $this->month, $this->day, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array $sDates dates to be selected
- *
- * @return void
- * @access private
- */
- function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- && $this->day == $sDate->thisDay())
- {
- $key = (int)$sDate->thisHour();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-
- /**
- * Defines Day object as first in a week
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param boolean $state set this day as first in week
- *
- * @return void
- * @access private
- */
- function setFirst($state = true)
- {
- $this->first = $state;
- }
-
- /**
- * Defines Day object as last in a week
- * Used only following Calendar_Month_Weekdays::build()
- *
- * @param boolean $state set this day as last in week
- *
- * @return void
- * @access private
- */
- function setLast($state = true)
- {
- $this->last = $state;
- }
-
- /**
- * Returns true if Day object is first in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return boolean
- * @access public
- */
- function isFirst()
- {
- return $this->first;
- }
-
- /**
- * Returns true if Day object is last in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return boolean
- * @access public
- */
- function isLast()
- {
- return $this->last;
- }
-
- /**
- * Defines Day object as empty
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param boolean $state set this day as empty
- *
- * @return void
- * @access private
- */
- function setEmpty ($state = true)
- {
- $this->empty = $state;
- }
-
- /**
- * Check if this day is empty
- *
- * @return boolean
- * @access public
- */
- function isEmpty()
- {
- return $this->empty;
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Decorator.php b/airtime_mvc/library/pear/Calendar/Decorator.php
deleted file mode 100644
index e4e27663a..000000000
--- a/airtime_mvc/library/pear/Calendar/Decorator.php
+++ /dev/null
@@ -1,650 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Decorator.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Decorates any calendar class.
- * Create a subclass of this class for your own "decoration".
- * Used for "selections"
- *
- * class DayDecorator extends Calendar_Decorator
- * {
- * function thisDay($format = 'int')
- * {
-.* $day = parent::thisDay('timestamp');
-.* return date('D', $day);
- * }
- * }
- * $Day = new Calendar_Day(2003, 10, 25);
- * $DayDecorator = new DayDecorator($Day);
- * echo $DayDecorator->thisDay(); // Outputs "Sat"
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @abstract
- */
-class Calendar_Decorator
-{
- /**
- * Subclass of Calendar being decorated
- * @var object
- * @access private
- */
- var $calendar;
-
- /**
- * Constructs the Calendar_Decorator
- *
- * @param object &$calendar subclass to Calendar to decorate
- */
- function Calendar_Decorator(&$calendar)
- {
- $this->calendar = & $calendar;
- }
-
- /**
- * Defines the calendar by a Unix timestamp, replacing values
- * passed to the constructor
- *
- * @param int $ts Unix timestamp
- *
- * @return void
- * @access public
- */
- function setTimestamp($ts)
- {
- $this->calendar->setTimestamp($ts);
- }
-
- /**
- * Returns a timestamp from the current date / time values. Format of
- * timestamp depends on Calendar_Engine implementation being used
- *
- * @return int $ts timestamp
- * @access public
- */
- function getTimestamp()
- {
- return $this->calendar->getTimeStamp();
- }
-
- /**
- * Defines calendar object as selected (e.g. for today)
- *
- * @param boolean $state whether Calendar subclass must be selected
- *
- * @return void
- * @access public
- */
- function setSelected($state = true)
- {
- $this->calendar->setSelected($state = true);
- }
-
- /**
- * True if the calendar subclass object is selected (e.g. today)
- *
- * @return boolean
- * @access public
- */
- function isSelected()
- {
- return $this->calendar->isSelected();
- }
-
- /**
- * Adjusts the date (helper method)
- *
- * @return void
- * @access public
- */
- function adjust()
- {
- $this->calendar->adjust();
- }
-
- /**
- * Returns the date as an associative array (helper method)
- *
- * @param mixed $stamp timestamp (leave empty for current timestamp)
- *
- * @return array
- * @access public
- */
- function toArray($stamp = null)
- {
- return $this->calendar->toArray($stamp);
- }
-
- /**
- * Returns the value as an associative array (helper method)
- *
- * @param string $returnType type of date object that return value represents
- * @param string $format ['int'|'timestamp'|'object'|'array']
- * @param mixed $stamp timestamp (depending on Calendar engine being used)
- * @param integer $default default value (i.e. give me the answer quick)
- *
- * @return mixed
- * @access private
- */
- function returnValue($returnType, $format, $stamp, $default)
- {
- return $this->calendar->returnValue($returnType, $format, $stamp, $default);
- }
-
- /**
- * Defines Day object as first in a week
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param boolean $state whether it's first or not
- *
- * @return void
- * @access private
- */
- function setFirst($state = true)
- {
- if (method_exists($this->calendar, 'setFirst')) {
- $this->calendar->setFirst($state);
- }
- }
-
- /**
- * Defines Day object as last in a week
- * Used only following Calendar_Month_Weekdays::build()
- *
- * @param boolean $state whether it's last or not
- *
- * @return void
- * @access private
- */
- function setLast($state = true)
- {
- if (method_exists($this->calendar, 'setLast')) {
- $this->calendar->setLast($state);
- }
- }
-
- /**
- * Returns true if Day object is first in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return boolean
- * @access public
- */
- function isFirst()
- {
- if (method_exists($this->calendar, 'isFirst')) {
- return $this->calendar->isFirst();
- }
- }
-
- /**
- * Returns true if Day object is last in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return boolean
- * @access public
- */
- function isLast()
- {
- if (method_exists($this->calendar, 'isLast')) {
- return $this->calendar->isLast();
- }
- }
-
- /**
- * Defines Day object as empty
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param boolean $state whether it's empty or not
- *
- * @return void
- * @access private
- */
- function setEmpty ($state = true)
- {
- if (method_exists($this->calendar, 'setEmpty')) {
- $this->calendar->setEmpty($state);
- }
- }
-
- /**
- * Check if the current object is empty
- *
- * @return boolean
- * @access public
- */
- function isEmpty()
- {
- if (method_exists($this->calendar, 'isEmpty')) {
- return $this->calendar->isEmpty();
- }
- }
-
- /**
- * Build the children
- *
- * @param array $sDates array containing Calendar objects to select (optional)
- *
- * @return boolean
- * @access public
- * @abstract
- */
- function build($sDates = array())
- {
- $this->calendar->build($sDates);
- }
-
- /**
- * Iterator method for fetching child Calendar subclass objects
- * (e.g. a minute from an hour object). On reaching the end of
- * the collection, returns false and resets the collection for
- * further iteratations.
- *
- * @return mixed either an object subclass of Calendar or false
- * @access public
- */
- function fetch()
- {
- return $this->calendar->fetch();
- }
-
- /**
- * Fetches all child from the current collection of children
- *
- * @return array
- * @access public
- */
- function fetchAll()
- {
- return $this->calendar->fetchAll();
- }
-
- /**
- * Get the number Calendar subclass objects stored in the internal collection
- *
- * @return int
- * @access public
- */
- function size()
- {
- return $this->calendar->size();
- }
-
- /**
- * Determine whether this date is valid, with the bounds determined by
- * the Calendar_Engine. The call is passed on to Calendar_Validator::isValid
- *
- * @return boolean
- * @access public
- */
- function isValid()
- {
- return $this->calendar->isValid();
- }
-
- /**
- * Returns an instance of Calendar_Validator
- *
- * @return Calendar_Validator
- * @access public
- */
- function & getValidator()
- {
- $validator = $this->calendar->getValidator();
- return $validator;
- }
-
- /**
- * Returns a reference to the current Calendar_Engine being used. Useful
- * for Calendar_Table_Helper and Calendar_Validator
- *
- * @return object implementing Calendar_Engine_Inteface
- * @access private
- */
- function & getEngine()
- {
- $engine = $this->calendar->getEngine();
- return $engine;
- }
-
- /**
- * Returns the value for the previous year
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 2002 or timestamp
- * @access public
- */
- function prevYear($format = 'int')
- {
- return $this->calendar->prevYear($format);
- }
-
- /**
- * Returns the value for this year
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 2003 or timestamp
- * @access public
- */
- function thisYear($format = 'int')
- {
- return $this->calendar->thisYear($format);
- }
-
- /**
- * Returns the value for next year
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 2004 or timestamp
- * @access public
- */
- function nextYear($format = 'int')
- {
- return $this->calendar->nextYear($format);
- }
-
- /**
- * Returns the value for the previous month
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 4 or Unix timestamp
- * @access public
- */
- function prevMonth($format = 'int')
- {
- return $this->calendar->prevMonth($format);
- }
-
- /**
- * Returns the value for this month
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 5 or timestamp
- * @access public
- */
- function thisMonth($format = 'int')
- {
- return $this->calendar->thisMonth($format);
- }
-
- /**
- * Returns the value for next month
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 6 or timestamp
- * @access public
- */
- function nextMonth($format = 'int')
- {
- return $this->calendar->nextMonth($format);
- }
-
- /**
- * Returns the value for the previous week
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 4 or Unix timestamp
- * @access public
- */
- function prevWeek($format = 'n_in_month')
- {
- if ( method_exists($this->calendar, 'prevWeek')) {
- return $this->calendar->prevWeek($format);
- } else {
- include_once 'PEAR.php';
- PEAR::raiseError(
- 'Cannot call prevWeek on Calendar object of type: '.
- get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar_Decorator::prevWeek()');
- return false;
- }
- }
-
- /**
- * Returns the value for this week
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 5 or timestamp
- * @access public
- */
- function thisWeek($format = 'n_in_month')
- {
- if ( method_exists($this->calendar, 'thisWeek')) {
- return $this->calendar->thisWeek($format);
- } else {
- include_once 'PEAR.php';
- PEAR::raiseError(
- 'Cannot call thisWeek on Calendar object of type: '.
- get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar_Decorator::thisWeek()');
- return false;
- }
- }
-
- /**
- * Returns the value for next week
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 6 or timestamp
- * @access public
- */
- function nextWeek($format = 'n_in_month')
- {
- if ( method_exists($this->calendar, 'nextWeek')) {
- return $this->calendar->nextWeek($format);
- } else {
- include_once 'PEAR.php';
- PEAR::raiseError(
- 'Cannot call thisWeek on Calendar object of type: '.
- get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar_Decorator::nextWeek()');
- return false;
- }
- }
-
- /**
- * Returns the value for the previous day
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 10 or timestamp
- * @access public
- */
- function prevDay($format = 'int')
- {
- return $this->calendar->prevDay($format);
- }
-
- /**
- * Returns the value for this day
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 11 or timestamp
- * @access public
- */
- function thisDay($format = 'int')
- {
- return $this->calendar->thisDay($format);
- }
-
- /**
- * Returns the value for the next day
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 12 or timestamp
- * @access public
- */
- function nextDay($format = 'int')
- {
- return $this->calendar->nextDay($format);
- }
-
- /**
- * Returns the value for the previous hour
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 13 or timestamp
- * @access public
- */
- function prevHour($format = 'int')
- {
- return $this->calendar->prevHour($format);
- }
-
- /**
- * Returns the value for this hour
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 14 or timestamp
- * @access public
- */
- function thisHour($format = 'int')
- {
- return $this->calendar->thisHour($format);
- }
-
- /**
- * Returns the value for the next hour
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 14 or timestamp
- * @access public
- */
- function nextHour($format = 'int')
- {
- return $this->calendar->nextHour($format);
- }
-
- /**
- * Returns the value for the previous minute
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 23 or timestamp
- * @access public
- */
- function prevMinute($format = 'int')
- {
- return $this->calendar->prevMinute($format);
- }
-
- /**
- * Returns the value for this minute
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 24 or timestamp
- * @access public
- */
- function thisMinute($format = 'int')
- {
- return $this->calendar->thisMinute($format);
- }
-
- /**
- * Returns the value for the next minute
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 25 or timestamp
- * @access public
- */
- function nextMinute($format = 'int')
- {
- return $this->calendar->nextMinute($format);
- }
-
- /**
- * Returns the value for the previous second
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 43 or timestamp
- * @access public
- */
- function prevSecond($format = 'int')
- {
- return $this->calendar->prevSecond($format);
- }
-
- /**
- * Returns the value for this second
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 44 or timestamp
- * @access public
- */
- function thisSecond($format = 'int')
- {
- return $this->calendar->thisSecond($format);
- }
-
- /**
- * Returns the value for the next second
- *
- * @param string $format return value format ['int'|'timestamp'|'object'|'array']
- *
- * @return int e.g. 45 or timestamp
- * @access public
- */
- function nextSecond($format = 'int')
- {
- return $this->calendar->nextSecond($format);
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Decorator/Textual.php b/airtime_mvc/library/pear/Calendar/Decorator/Textual.php
deleted file mode 100644
index 729862010..000000000
--- a/airtime_mvc/library/pear/Calendar/Decorator/Textual.php
+++ /dev/null
@@ -1,208 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Textual.php 246907 2007-11-24 11:04:24Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar decorator base class
- */
-require_once CALENDAR_ROOT.'Decorator.php';
-
-/**
- * Load the Uri utility
- */
-require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
-
-/**
- * Decorator to help with fetching textual representations of months and
- * days of the week.
- * Note: for performance you should prefer Calendar_Util_Textual unless you
- * have a specific need to use a decorator
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Decorator_Textual extends Calendar_Decorator
-{
- /**
- * Constructs Calendar_Decorator_Textual
- *
- * @param object &$Calendar subclass of Calendar
- *
- * @access public
- */
- function Calendar_Decorator_Textual(&$Calendar)
- {
- parent::Calendar_Decorator($Calendar);
- }
-
- /**
- * Returns an array of 12 month names (first index = 1)
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return array
- * @access public
- * @static
- */
- function monthNames($format = 'long')
- {
- return Calendar_Util_Textual::monthNames($format);
- }
-
- /**
- * Returns an array of 7 week day names (first index = 0)
- *
- * @param string $format (optional) format of returned days (one|two|short|long)
- *
- * @return array
- * @access public
- * @static
- */
- function weekdayNames($format = 'long')
- {
- return Calendar_Util_Textual::weekdayNames($format);
- }
-
- /**
- * Returns textual representation of the previous month of the decorated calendar object
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return string
- * @access public
- */
- function prevMonthName($format = 'long')
- {
- return Calendar_Util_Textual::prevMonthName($this->calendar, $format);
- }
-
- /**
- * Returns textual representation of the month of the decorated calendar object
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return string
- * @access public
- */
- function thisMonthName($format = 'long')
- {
- return Calendar_Util_Textual::thisMonthName($this->calendar, $format);
- }
-
- /**
- * Returns textual representation of the next month of the decorated calendar object
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return string
- * @access public
- */
- function nextMonthName($format = 'long')
- {
- return Calendar_Util_Textual::nextMonthName($this->calendar, $format);
- }
-
- /**
- * Returns textual representation of the previous day of week of the decorated calendar object
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return string
- * @access public
- */
- function prevDayName($format = 'long')
- {
- return Calendar_Util_Textual::prevDayName($this->calendar, $format);
- }
-
- /**
- * Returns textual representation of the day of week of the decorated calendar object
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return string
- * @access public
- */
- function thisDayName($format = 'long')
- {
- return Calendar_Util_Textual::thisDayName($this->calendar, $format);
- }
-
- /**
- * Returns textual representation of the next day of week of the decorated calendar object
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return string
- * @access public
- */
- function nextDayName($format = 'long')
- {
- return Calendar_Util_Textual::nextDayName($this->calendar, $format);
- }
-
- /**
- * Returns the days of the week using the order defined in the decorated
- * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
- * and Calendar_Week. Otherwise the returned array will begin on Sunday
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return array ordered array of week day names
- * @access public
- */
- function orderedWeekdays($format = 'long')
- {
- return Calendar_Util_Textual::orderedWeekdays($this->calendar, $format);
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Decorator/Uri.php b/airtime_mvc/library/pear/Calendar/Decorator/Uri.php
deleted file mode 100644
index 08e4deb69..000000000
--- a/airtime_mvc/library/pear/Calendar/Decorator/Uri.php
+++ /dev/null
@@ -1,183 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Uri.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar decorator base class
- */
-require_once CALENDAR_ROOT.'Decorator.php';
-
-/**
- * Load the Uri utility
- */
-require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Uri.php';
-
-/**
- * Decorator to help with building HTML links for navigating the calendar
- * Note: for performance you should prefer Calendar_Util_Uri unless you
- * have a specific need to use a decorator
- *
- * $Day = new Calendar_Day(2003, 10, 23);
- * $Uri = new Calendar_Decorator_Uri($Day);
- * $Uri->setFragments('year', 'month', 'day');
- * echo $Uri->getPrev(); // Displays year=2003&month=10&day=22
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @see Calendar_Util_Uri
- * @access public
- */
-class Calendar_Decorator_Uri extends Calendar_Decorator
-{
-
- /**
- * @var Calendar_Util_Uri
- * @access private
- */
- var $Uri;
-
- /**
- * Constructs Calendar_Decorator_Uri
- *
- * @param object &$Calendar subclass of Calendar
- *
- * @access public
- */
- function Calendar_Decorator_Uri(&$Calendar)
- {
- parent::Calendar_Decorator($Calendar);
- }
-
- /**
- * Sets the URI fragment names
- *
- * @param string $y URI fragment for year
- * @param string $m (optional) URI fragment for month
- * @param string $d (optional) URI fragment for day
- * @param string $h (optional) URI fragment for hour
- * @param string $i (optional) URI fragment for minute
- * @param string $s (optional) URI fragment for second
- *
- * @return void
- * @access public
- */
- function setFragments($y, $m = null, $d = null, $h = null, $i = null, $s = null)
- {
- $this->Uri = new Calendar_Util_Uri($y, $m, $d, $h, $i, $s);
- }
-
- /**
- * Sets the separator string between fragments
- *
- * @param string $separator url fragment separator e.g. /
- *
- * @return void
- * @access public
- */
- function setSeparator($separator)
- {
- $this->Uri->separator = $separator;
- }
-
- /**
- * Puts Uri decorator into "scalar mode" - URI variable names are not returned
- *
- * @param boolean $state (optional)
- *
- * @return void
- * @access public
- */
- function setScalar($state = true)
- {
- $this->Uri->scalar = $state;
- }
-
- /**
- * Gets the URI string for the previous calendar unit
- *
- * @param string $method calendar unit to fetch uri for (year, month, week or day etc)
- *
- * @return string
- * @access public
- */
- function prev($method)
- {
- return $this->Uri->prev($this, $method);
- }
-
- /**
- * Gets the URI string for the current calendar unit
- *
- * @param string $method calendar unit to fetch uri for (year,month,week or day etc)
- *
- * @return string
- * @access public
- */
- function this($method)
- {
- return $this->Uri->this($this, $method);
- }
-
- /**
- * Gets the URI string for the next calendar unit
- *
- * @param string $method calendar unit to fetch uri for (year,month,week or day etc)
- *
- * @return string
- * @access public
- */
- function next($method)
- {
- return $this->Uri->next($this, $method);
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Decorator/Weekday.php b/airtime_mvc/library/pear/Calendar/Decorator/Weekday.php
deleted file mode 100644
index d02c87dcc..000000000
--- a/airtime_mvc/library/pear/Calendar/Decorator/Weekday.php
+++ /dev/null
@@ -1,195 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Weekday.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar decorator base class
- */
-require_once CALENDAR_ROOT.'Decorator.php';
-
-/**
- * Load a Calendar_Day
- */
-require_once CALENDAR_ROOT.'Day.php';
-/**
- * Decorator for fetching the day of the week
- *
- * $Day = new Calendar_Day(2003, 10, 23);
- * $Weekday = new Calendar_Decorator_Weekday($Day);
- * $Weekday->setFirstDay(0); // Set first day of week to Sunday (default Mon)
- * echo $Weekday->thisWeekDay(); // Displays 5 - fifth day of week relative to Sun
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Decorator_Weekday extends Calendar_Decorator
-{
- /**
- * First day of week
- * @var int (default = 1 for Monday)
- * @access private
- */
- var $firstDay = 1;
-
- /**
- * Constructs Calendar_Decorator_Weekday
- *
- * @param object &$Calendar subclass of Calendar
- *
- * @access public
- */
- function Calendar_Decorator_Weekday(&$Calendar)
- {
- parent::Calendar_Decorator($Calendar);
- }
-
- /**
- * Sets the first day of the week (0 = Sunday, 1 = Monday (default) etc)
- *
- * @param int $firstDay first day of week
- *
- * @return void
- * @access public
- */
- function setFirstDay($firstDay)
- {
- $this->firstDay = (int)$firstDay;
- }
-
- /**
- * Returns the previous weekday
- *
- * @param string $format (default = 'int') return value format
- *
- * @return int $format numeric day of week or timestamp
- * @access public
- */
- function prevWeekDay($format = 'int')
- {
- $ts = $this->calendar->prevDay('timestamp');
- $Day = new Calendar_Day(2000, 1, 1);
- $Day->setTimeStamp($ts);
- $day = $this->calendar->cE->getDayOfWeek(
- $Day->thisYear(),
- $Day->thisMonth(),
- $Day->thisDay()
- );
- $day = $this->adjustWeekScale($day);
- return $this->returnValue('Day', $format, $ts, $day);
- }
-
- /**
- * Returns the current weekday
- *
- * @param string $format (default = 'int') return value format
- *
- * @return int numeric day of week or timestamp
- * @access public
- */
- function thisWeekDay($format = 'int')
- {
- $ts = $this->calendar->thisDay('timestamp');
- $day = $this->calendar->cE->getDayOfWeek(
- $this->calendar->year,
- $this->calendar->month,
- $this->calendar->day
- );
- $day = $this->adjustWeekScale($day);
- return $this->returnValue('Day', $format, $ts, $day);
- }
-
- /**
- * Returns the next weekday
- *
- * @param string $format (default = 'int') return value format
- *
- * @return int numeric day of week or timestamp
- * @access public
- */
- function nextWeekDay($format = 'int')
- {
- $ts = $this->calendar->nextDay('timestamp');
- $Day = new Calendar_Day(2000, 1, 1);
- $Day->setTimeStamp($ts);
- $day = $this->calendar->cE->getDayOfWeek(
- $Day->thisYear(),
- $Day->thisMonth(),
- $Day->thisDay()
- );
- $day = $this->adjustWeekScale($day);
- return $this->returnValue('Day', $format, $ts, $day);
- }
-
- /**
- * Adjusts the day of the week relative to the first day of the week
- *
- * @param int $dayOfWeek day of week calendar from Calendar_Engine
- *
- * @return int day of week adjusted to first day
- * @access private
- */
- function adjustWeekScale($dayOfWeek)
- {
- $dayOfWeek = $dayOfWeek - $this->firstDay;
- if ($dayOfWeek >= 0) {
- return $dayOfWeek;
- } else {
- return $this->calendar->cE->getDaysInWeek(
- $this->calendar->year,
- $this->calendar->month,
- $this->calendar->day
- ) + $dayOfWeek;
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Decorator/Wrapper.php b/airtime_mvc/library/pear/Calendar/Decorator/Wrapper.php
deleted file mode 100644
index 4ed2f84ac..000000000
--- a/airtime_mvc/library/pear/Calendar/Decorator/Wrapper.php
+++ /dev/null
@@ -1,115 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Wrapper.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar decorator base class
- */
-require_once CALENDAR_ROOT.'Decorator.php';
-
-/**
- * Decorator to help with wrapping built children in another decorator
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Decorator_Wrapper extends Calendar_Decorator
-{
- /**
- * Constructs Calendar_Decorator_Wrapper
- *
- * @param object &$Calendar subclass of Calendar
- *
- * @access public
- */
- function Calendar_Decorator_Wrapper(&$Calendar)
- {
- parent::Calendar_Decorator($Calendar);
- }
-
- /**
- * Wraps objects returned from fetch in the named Decorator class
- *
- * @param string $decorator name of Decorator class to wrap with
- *
- * @return object instance of named decorator
- * @access public
- */
- function & fetch($decorator)
- {
- $Calendar = parent::fetch();
- if ($Calendar) {
- $ret = new $decorator($Calendar);
- } else {
- $ret = false;
- }
- return $ret;
- }
-
- /**
- * Wraps the returned calendar objects from fetchAll in the named decorator
- *
- * @param string $decorator name of Decorator class to wrap with
- *
- * @return array
- * @access public
- */
- function fetchAll($decorator)
- {
- $children = parent::fetchAll();
- foreach ($children as $key => $Calendar) {
- $children[$key] = new $decorator($Calendar);
- }
- return $children;
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Engine/Interface.php b/airtime_mvc/library/pear/Calendar/Engine/Interface.php
deleted file mode 100644
index d443210bc..000000000
--- a/airtime_mvc/library/pear/Calendar/Engine/Interface.php
+++ /dev/null
@@ -1,377 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Interface.php 269074 2008-11-15 21:21:42Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * The methods the classes implementing the Calendar_Engine must implement.
- * Note this class is not used but simply to help development
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access protected
- */
-class Calendar_Engine_Interface
-{
- /**
- * Provides a mechansim to make sure parsing of timestamps
- * into human dates is only performed once per timestamp.
- * Typically called "internally" by methods like stampToYear.
- * Return value can vary, depending on the specific implementation
- *
- * @param int $stamp timestamp (depending on implementation)
- *
- * @return mixed
- * @access protected
- */
- function stampCollection($stamp)
- {
- }
-
- /**
- * Returns a numeric year given a timestamp
- *
- * @param int $stamp timestamp (depending on implementation)
- *
- * @return int year (e.g. 2003)
- * @access protected
- */
- function stampToYear($stamp)
- {
- }
-
- /**
- * Returns a numeric month given a timestamp
- *
- * @param int $stamp timestamp (depending on implementation)
- *
- * @return int month (e.g. 9)
- * @access protected
- */
- function stampToMonth($stamp)
- {
- }
-
- /**
- * Returns a numeric day given a timestamp
- *
- * @param int $stamp timestamp (depending on implementation)
- *
- * @return int day (e.g. 15)
- * @access protected
- */
- function stampToDay($stamp)
- {
- }
-
- /**
- * Returns a numeric hour given a timestamp
- *
- * @param int $stamp timestamp (depending on implementation)
- *
- * @return int hour (e.g. 13)
- * @access protected
- */
- function stampToHour($stamp)
- {
- }
-
- /**
- * Returns a numeric minute given a timestamp
- *
- * @param int $stamp timestamp (depending on implementation)
- *
- * @return int minute (e.g. 34)
- * @access protected
- */
- function stampToMinute($stamp)
- {
- }
-
- /**
- * Returns a numeric second given a timestamp
- *
- * @param int $stamp timestamp (depending on implementation)
- *
- * @return int second (e.g. 51)
- * @access protected
- */
- function stampToSecond($stamp)
- {
- }
-
- /**
- * Returns a timestamp. Can be worth "caching" generated timestamps in a
- * static variable, identified by the params this method accepts,
- * to timestamp will only be calculated once.
- *
- * @param int $y year (e.g. 2003)
- * @param int $m month (e.g. 9)
- * @param int $d day (e.g. 13)
- * @param int $h hour (e.g. 13)
- * @param int $i minute (e.g. 34)
- * @param int $s second (e.g. 53)
- *
- * @return int (depends on implementation)
- * @access protected
- */
- function dateToStamp($y, $m, $d, $h, $i, $s)
- {
- }
-
- /**
- * The upper limit on years that the Calendar Engine can work with
- *
- * @return int (e.g. 2037)
- * @access protected
- */
- function getMaxYears()
- {
- }
-
- /**
- * The lower limit on years that the Calendar Engine can work with
- *
- * @return int (e.g 1902)
- * @access protected
- */
- function getMinYears()
- {
- }
-
- /**
- * Returns the number of months in a year
- *
- * @param int $y (optional) year to get months for
- *
- * @return int (e.g. 12)
- * @access protected
- */
- function getMonthsInYear($y=null)
- {
- }
-
- /**
- * Returns the number of days in a month, given year and month
- *
- * @param int $y year (e.g. 2003)
- * @param int $m month (e.g. 9)
- *
- * @return int days in month
- * @access protected
- */
- function getDaysInMonth($y, $m)
- {
- }
-
- /**
- * Returns numeric representation of the day of the week in a month,
- * given year and month
- *
- * @param int $y year (e.g. 2003)
- * @param int $m month (e.g. 9)
- *
- * @return int
- * @access protected
- */
- function getFirstDayInMonth ($y, $m)
- {
- }
-
- /**
- * Returns the number of days in a week
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (e.g. 7)
- * @access protected
- */
- function getDaysInWeek($y=null, $m=null, $d=null)
- {
- }
-
- /**
- * Returns the number of the week in the year (ISO-8601), given a date
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int week number
- * @access protected
- */
- function getWeekNInYear($y, $m, $d)
- {
- }
-
- /**
- * Returns the number of the week in the month, given a date
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $firstDay first day of the week (default: 1 - monday)
- *
- * @return int week number
- * @access protected
- */
- function getWeekNInMonth($y, $m, $d, $firstDay=1)
- {
- }
-
- /**
- * Returns the number of weeks in the month
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- *
- * @return int weeks number
- * @access protected
- */
- function getWeeksInMonth($y, $m)
- {
- }
-
- /**
- * Returns the number of the day of the week (0=sunday, 1=monday...)
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int weekday number
- * @access protected
- */
- function getDayOfWeek($y, $m, $d)
- {
- }
-
- /**
- * Returns the numeric values of the days of the week.
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return array list of numeric values of days in week, beginning 0
- * @access protected
- */
- function getWeekDays($y=null, $m=null, $d=null)
- {
- }
-
- /**
- * Returns the default first day of the week as an integer. Must be a
- * member of the array returned from getWeekDays
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (e.g. 1 for Monday)
- * @see getWeekDays
- * @access protected
- */
- function getFirstDayOfWeek($y=null, $m=null, $d=null)
- {
- }
-
- /**
- * Returns the number of hours in a day
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (e.g. 24)
- * @access protected
- */
- function getHoursInDay($y=null,$m=null,$d=null)
- {
- }
-
- /**
- * Returns the number of minutes in an hour
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $h hour
- *
- * @return int
- * @access protected
- */
- function getMinutesInHour($y=null,$m=null,$d=null,$h=null)
- {
- }
-
- /**
- * Returns the number of seconds in a minutes
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $h hour
- * @param int $i minute
- *
- * @return int
- * @access protected
- */
- function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null)
- {
- }
-
- /**
- * Checks if the given day is the current day
- *
- * @param int timestamp (depending on implementation)
- *
- * @return boolean
- * @access protected
- */
- function isToday($stamp)
- {
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Engine/PearDate.php b/airtime_mvc/library/pear/Calendar/Engine/PearDate.php
deleted file mode 100644
index 7c54d37cd..000000000
--- a/airtime_mvc/library/pear/Calendar/Engine/PearDate.php
+++ /dev/null
@@ -1,509 +0,0 @@
-
- * @copyright 2003-2007 Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: PearDate.php 269076 2008-11-15 21:41:38Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Load PEAR::Date class
- */
-require_once 'Date.php';
-
-/**
- * Performs calendar calculations based on the PEAR::Date class
- * Timestamps are in the ISO-8601 format (YYYY-MM-DD HH:MM:SS)
- *
- * @category Date and Time
- * @package Calendar
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access protected
- */
-class Calendar_Engine_PearDate /* implements Calendar_Engine_Interface */
-{
- /**
- * Makes sure a given timestamp is only ever parsed once
- * Uses a static variable to prevent date() being used twice
- * for a date which is already known
- *
- * @param mixed $stamp Any timestamp format recognized by Pear::Date
- *
- * @return object Pear::Date object
- * @access protected
- */
- function stampCollection($stamp)
- {
- static $stamps = array();
- if (!isset($stamps[$stamp])) {
- $stamps[$stamp] = new Date($stamp);
- }
- return $stamps[$stamp];
- }
-
- /**
- * Returns a numeric year given a iso-8601 datetime
- *
- * @param string $stamp iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
- *
- * @return int year (e.g. 2003)
- * @access protected
- */
- function stampToYear($stamp)
- {
- $date = Calendar_Engine_PearDate::stampCollection($stamp);
- return (int)$date->year;
- }
-
- /**
- * Returns a numeric month given a iso-8601 datetime
- *
- * @param string $stamp iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
- *
- * @return int month (e.g. 9)
- * @access protected
- */
- function stampToMonth($stamp)
- {
- $date = Calendar_Engine_PearDate::stampCollection($stamp);
- return (int)$date->month;
- }
-
- /**
- * Returns a numeric day given a iso-8601 datetime
- *
- * @param string $stamp iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
- *
- * @return int day (e.g. 15)
- * @access protected
- */
- function stampToDay($stamp)
- {
- $date = Calendar_Engine_PearDate::stampCollection($stamp);
- return (int)$date->day;
- }
-
- /**
- * Returns a numeric hour given a iso-8601 datetime
- *
- * @param string $stamp iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
- *
- * @return int hour (e.g. 13)
- * @access protected
- */
- function stampToHour($stamp)
- {
- $date = Calendar_Engine_PearDate::stampCollection($stamp);
- return (int)$date->hour;
- }
-
- /**
- * Returns a numeric minute given a iso-8601 datetime
- *
- * @param string $stamp iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
- *
- * @return int minute (e.g. 34)
- * @access protected
- */
- function stampToMinute($stamp)
- {
- $date = Calendar_Engine_PearDate::stampCollection($stamp);
- return (int)$date->minute;
- }
-
- /**
- * Returns a numeric second given a iso-8601 datetime
- *
- * @param string $stamp iso-8601 datetime (YYYY-MM-DD HH:MM:SS)
- *
- * @return int second (e.g. 51)
- * @access protected
- */
- function stampToSecond($stamp)
- {
- $date = Calendar_Engine_PearDate::stampCollection($stamp);
- return (int)$date->second;
- }
-
- /**
- * Returns a iso-8601 datetime
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (13)
- * @param int $h hour (13)
- * @param int $i minute (34)
- * @param int $s second (53)
- *
- * @return string iso-8601 datetime
- * @access protected
- */
- function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0)
- {
- $r = array();
- Calendar_Engine_PearDate::adjustDate($y, $m, $d, $h, $i, $s);
- $key = $y.$m.$d.$h.$i.$s;
- if (!isset($r[$key])) {
- $r[$key] = sprintf("%04d-%02d-%02d %02d:%02d:%02d",
- $y, $m, $d, $h, $i, $s);
- }
- return $r[$key];
- }
-
- /**
- * Set the correct date values (useful for math operations on dates)
- *
- * @param int &$y year (2003)
- * @param int &$m month (9)
- * @param int &$d day (13)
- * @param int &$h hour (13)
- * @param int &$i minute (34)
- * @param int &$s second (53)
- *
- * @return void
- * @access protected
- */
- function adjustDate(&$y, &$m, &$d, &$h, &$i, &$s)
- {
- if ($s < 0) {
- $m -= floor($s / 60);
- $s = -$s % 60;
- }
- if ($s > 60) {
- $m += floor($s / 60);
- $s %= 60;
- }
- if ($i < 0) {
- $h -= floor($i / 60);
- $i = -$i % 60;
- }
- if ($i > 60) {
- $h += floor($i / 60);
- $i %= 60;
- }
- if ($h < 0) {
- $d -= floor($h / 24);
- $h = -$h % 24;
- }
- if ($h > 24) {
- $d += floor($h / 24);
- $h %= 24;
- }
- for(; $m < 1; $y--, $m+=12);
- for(; $m > 12; $y++, $m-=12);
-
- while ($d < 1) {
- if ($m > 1) {
- $m--;
- } else {
- $m = 12;
- $y--;
- }
- $d += Date_Calc::daysInMonth($m, $y);
- }
- for ($max_days = Date_Calc::daysInMonth($m, $y); $d > $max_days; ) {
- $d -= $max_days;
- if ($m < 12) {
- $m++;
- } else {
- $m = 1;
- $y++;
- }
- }
- }
-
- /**
- * The upper limit on years that the Calendar Engine can work with
- *
- * @return int 9999
- * @access protected
- */
- function getMaxYears()
- {
- return 9999;
- }
-
- /**
- * The lower limit on years that the Calendar Engine can work with
- *
- * @return int 0
- * @access protected
- */
- function getMinYears()
- {
- return 0;
- }
-
- /**
- * Returns the number of months in a year
- *
- * @param int $y year
- *
- * @return int (12)
- * @access protected
- */
- function getMonthsInYear($y=null)
- {
- return 12;
- }
-
- /**
- * Returns the number of days in a month, given year and month
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- *
- * @return int days in month
- * @access protected
- */
- function getDaysInMonth($y, $m)
- {
- return (int)Date_Calc::daysInMonth($m, $y);
- }
-
- /**
- * Returns numeric representation of the day of the week in a month,
- * given year and month
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- *
- * @return int from 0 to 7
- * @access protected
- */
- function getFirstDayInMonth($y, $m)
- {
- return (int)Date_Calc::dayOfWeek(1, $m, $y);
- }
-
- /**
- * Returns the number of days in a week
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (7)
- * @access protected
- */
- function getDaysInWeek($y=null, $m=null, $d=null)
- {
- return 7;
- }
-
- /**
- * Returns the number of the week in the year (ISO-8601), given a date
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int week number
- * @access protected
- */
- function getWeekNInYear($y, $m, $d)
- {
- //return Date_Calc::weekOfYear($d, $m, $y); //beware, Date_Calc doesn't follow ISO-8601 standard!
- list($nYear, $nWeek) = Date_Calc::weekOfYear4th($d, $m, $y);
- return $nWeek;
- }
-
- /**
- * Returns the number of the week in the month, given a date
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $firstDay first day of the week (default: monday)
- *
- * @return int week number
- * @access protected
- */
- function getWeekNInMonth($y, $m, $d, $firstDay=1)
- {
- $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek()-1 : $firstDay-1;
- $end_of_week = (int)Date_Calc::nextDayOfWeek($weekEnd, 1, $m, $y, '%e', true);
- $w = 1;
- while ($d > $end_of_week) {
- ++$w;
- $end_of_week += $this->getDaysInWeek();
- }
- return $w;
- }
-
- /**
- * Returns the number of weeks in the month
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $firstDay first day of the week (default: monday)
- *
- * @return int weeks number
- * @access protected
- */
- function getWeeksInMonth($y, $m, $firstDay=1)
- {
- $FDOM = Date_Calc::firstOfMonthWeekday($m, $y);
- if ($FDOM == 0) {
- $FDOM = $this->getDaysInWeek();
- }
- if ($FDOM > $firstDay) {
- $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay;
- $weeks = 1;
- } else {
- $daysInTheFirstWeek = $firstDay - $FDOM;
- $weeks = 0;
- }
- $daysInTheFirstWeek %= $this->getDaysInWeek();
- return (int)(ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) /
- $this->getDaysInWeek()) + $weeks);
- }
-
- /**
- * Returns the number of the day of the week (0=sunday, 1=monday...)
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int weekday number
- * @access protected
- */
- function getDayOfWeek($y, $m, $d)
- {
- return Date_Calc::dayOfWeek($d, $m, $y);
- }
-
- /**
- * Returns a list of integer days of the week beginning 0
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return array (0, 1, 2, 3, 4, 5, 6) 1 = Monday
- * @access protected
- */
- function getWeekDays($y=null, $m=null, $d=null)
- {
- return array(0, 1, 2, 3, 4, 5, 6);
- }
-
- /**
- * Returns the default first day of the week
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (default 1 = Monday)
- * @access protected
- */
- function getFirstDayOfWeek($y=null, $m=null, $d=null)
- {
- return 1;
- }
-
- /**
- * Returns the number of hours in a day
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (24)
- * @access protected
- */
- function getHoursInDay($y=null,$m=null,$d=null)
- {
- return 24;
- }
-
- /**
- * Returns the number of minutes in an hour
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $h hour
- *
- * @return int (60)
- * @access protected
- */
- function getMinutesInHour($y=null,$m=null,$d=null,$h=null)
- {
- return 60;
- }
-
- /**
- * Returns the number of seconds in a minutes
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $h hour
- * @param int $i minute
- *
- * @return int (60)
- * @access protected
- */
- function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null)
- {
- return 60;
- }
-
- /**
- * Checks if the given day is the current day
- *
- * @param mixed $stamp Any timestamp format recognized by Pear::Date
- *
- * @return boolean
- * @access protected
- */
- function isToday($stamp)
- {
- static $today = null;
- if (is_null($today)) {
- $today = new Date();
- }
- $date = Calendar_Engine_PearDate::stampCollection($stamp);
- return ( $date->day == $today->getDay()
- && $date->month == $today->getMonth()
- && $date->year == $today->getYear()
- );
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Engine/UnixTS.php b/airtime_mvc/library/pear/Calendar/Engine/UnixTS.php
deleted file mode 100644
index e24f0240d..000000000
--- a/airtime_mvc/library/pear/Calendar/Engine/UnixTS.php
+++ /dev/null
@@ -1,463 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: UnixTS.php 269074 2008-11-15 21:21:42Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Performs calendar calculations based on the PHP date() function and
- * Unix timestamps (using PHP's mktime() function).
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access protected
- */
-class Calendar_Engine_UnixTS /* implements Calendar_Engine_Interface */
-{
- /**
- * Makes sure a given timestamp is only ever parsed once
- *
- * array (
- * [0] => year (e.g 2003),
- * [1] => month (e.g 9),
- * [2] => day (e.g 6),
- * [3] => hour (e.g 14),
- * [4] => minute (e.g 34),
- * [5] => second (e.g 45),
- * [6] => num days in month (e.g. 31),
- * [7] => week in year (e.g. 50),
- * [8] => day in week (e.g. 0 for Sunday)
- * )
- *
- * Uses a static variable to prevent date() being used twice
- * for a date which is already known
- *
- * @param int $stamp Unix timestamp
- *
- * @return array
- * @access protected
- */
- function stampCollection($stamp)
- {
- static $stamps = array();
- if ( !isset($stamps[$stamp]) ) {
- $date = @date('Y n j H i s t W w', $stamp);
- $stamps[$stamp] = sscanf($date, "%d %d %d %d %d %d %d %d %d");
- }
- return $stamps[$stamp];
- }
-
- /**
- * Returns a numeric year given a timestamp
- *
- * @param int $stamp Unix timestamp
- *
- * @return int year (e.g. 2003)
- * @access protected
- */
- function stampToYear($stamp)
- {
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return (int)$date[0];
- }
-
- /**
- * Returns a numeric month given a timestamp
- *
- * @param int $stamp Unix timestamp
- *
- * @return int month (e.g. 9)
- * @access protected
- */
- function stampToMonth($stamp)
- {
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return (int)$date[1];
- }
-
- /**
- * Returns a numeric day given a timestamp
- *
- * @param int $stamp Unix timestamp
- *
- * @return int day (e.g. 15)
- * @access protected
- */
- function stampToDay($stamp)
- {
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return (int)$date[2];
- }
-
- /**
- * Returns a numeric hour given a timestamp
- *
- * @param int $stamp Unix timestamp
- *
- * @return int hour (e.g. 13)
- * @access protected
- */
- function stampToHour($stamp)
- {
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return (int)$date[3];
- }
-
- /**
- * Returns a numeric minute given a timestamp
- *
- * @param int $stamp Unix timestamp
- *
- * @return int minute (e.g. 34)
- * @access protected
- */
- function stampToMinute($stamp)
- {
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return (int)$date[4];
- }
-
- /**
- * Returns a numeric second given a timestamp
- *
- * @param int $stamp Unix timestamp
- *
- * @return int second (e.g. 51)
- * @access protected
- */
- function stampToSecond($stamp)
- {
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return (int)$date[5];
- }
-
- /**
- * Returns a timestamp
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (13)
- * @param int $h hour (13)
- * @param int $i minute (34)
- * @param int $s second (53)
- *
- * @return int Unix timestamp
- * @access protected
- */
- function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0)
- {
- static $dates = array();
- if (!isset($dates[$y][$m][$d][$h][$i][$s])) {
- $dates[$y][$m][$d][$h][$i][$s] = @mktime($h, $i, $s, $m, $d, $y);
- }
- return $dates[$y][$m][$d][$h][$i][$s];
- }
-
- /**
- * The upper limit on years that the Calendar Engine can work with
- *
- * @return int (2037)
- * @access protected
- */
- function getMaxYears()
- {
- return 2037;
- }
-
- /**
- * The lower limit on years that the Calendar Engine can work with
- *
- * @return int (1970 if it's Windows and 1902 for all other OSs)
- * @access protected
- */
- function getMinYears()
- {
- return $min = strpos(PHP_OS, 'WIN') === false ? 1902 : 1970;
- }
-
- /**
- * Returns the number of months in a year
- *
- * @param int $y year
- *
- * @return int (12)
- * @access protected
- */
- function getMonthsInYear($y=null)
- {
- return 12;
- }
-
- /**
- * Returns the number of days in a month, given year and month
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- *
- * @return int days in month
- * @access protected
- */
- function getDaysInMonth($y, $m)
- {
- $stamp = Calendar_Engine_UnixTS::dateToStamp($y, $m, 1);
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return $date[6];
- }
-
- /**
- * Returns numeric representation of the day of the week in a month,
- * given year and month
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- *
- * @return int from 0 to 6
- * @access protected
- */
- function getFirstDayInMonth($y, $m)
- {
- $stamp = Calendar_Engine_UnixTS::dateToStamp($y, $m, 1);
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return $date[8];
- }
-
- /**
- * Returns the number of days in a week
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (7)
- * @access protected
- */
- function getDaysInWeek($y=null, $m=null, $d=null)
- {
- return 7;
- }
-
- /**
- * Returns the number of the week in the year (ISO-8601), given a date
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int week number
- * @access protected
- */
- function getWeekNInYear($y, $m, $d)
- {
- $stamp = Calendar_Engine_UnixTS::dateToStamp($y, $m, $d);
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return $date[7];
- }
-
- /**
- * Returns the number of the week in the month, given a date
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $firstDay first day of the week (default: monday)
- *
- * @return int week number
- * @access protected
- */
- function getWeekNInMonth($y, $m, $d, $firstDay=1)
- {
- $weekEnd = (0 == $firstDay) ? $this->getDaysInWeek()-1 : $firstDay-1;
- $end_of_week = 1;
- while (@date('w', @mktime(0, 0, 0, $m, $end_of_week, $y)) != $weekEnd) {
- ++$end_of_week; //find first weekend of the month
- }
- $w = 1;
- while ($d > $end_of_week) {
- ++$w;
- $end_of_week += $this->getDaysInWeek();
- }
- return $w;
- }
-
- /**
- * Returns the number of weeks in the month
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $firstDay first day of the week (default: monday)
- *
- * @return int weeks number
- * @access protected
- */
- function getWeeksInMonth($y, $m, $firstDay = 1)
- {
- $FDOM = $this->getFirstDayInMonth($y, $m);
- if ($FDOM == 0) {
- $FDOM = $this->getDaysInWeek();
- }
- if ($FDOM > $firstDay) {
- $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay;
- $weeks = 1;
- } else {
- $daysInTheFirstWeek = $firstDay - $FDOM;
- $weeks = 0;
- }
- $daysInTheFirstWeek %= $this->getDaysInWeek();
- return (int)(ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) /
- $this->getDaysInWeek()) + $weeks);
- }
-
- /**
- * Returns the number of the day of the week (0=sunday, 1=monday...)
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int weekday number
- * @access protected
- */
- function getDayOfWeek($y, $m, $d)
- {
- $stamp = Calendar_Engine_UnixTS::dateToStamp($y, $m, $d);
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return $date[8];
- }
-
- /**
- * Returns a list of integer days of the week beginning 0
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return array (0,1,2,3,4,5,6) 1 = Monday
- * @access protected
- */
- function getWeekDays($y=null, $m=null, $d=null)
- {
- return array(0, 1, 2, 3, 4, 5, 6);
- }
-
- /**
- * Returns the default first day of the week
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (default 1 = Monday)
- * @access protected
- */
- function getFirstDayOfWeek($y=null, $m=null, $d=null)
- {
- return 1;
- }
-
- /**
- * Returns the number of hours in a day
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- *
- * @return int (24)
- * @access protected
- */
- function getHoursInDay($y=null, $m=null, $d=null)
- {
- return 24;
- }
-
- /**
- * Returns the number of minutes in an hour
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $h hour
- *
- * @return int (60)
- * @access protected
- */
- function getMinutesInHour($y=null, $m=null, $d=null, $h=null)
- {
- return 60;
- }
-
- /**
- * Returns the number of seconds in a minutes
- *
- * @param int $y year (2003)
- * @param int $m month (9)
- * @param int $d day (4)
- * @param int $h hour
- * @param int $i minute
- *
- * @return int (60)
- * @access protected
- */
- function getSecondsInMinute($y=null, $m=null, $d=null, $h=null, $i=null)
- {
- return 60;
- }
-
- /**
- * Checks if the given day is the current day
- *
- * @param mixed $stamp Any timestamp format recognized by Pear::Date
- *
- * @return boolean
- * @access protected
- */
- function isToday($stamp)
- {
- static $today = null;
- if (is_null($today)) {
- $today_date = @date('Y n j');
- $today = sscanf($today_date, '%d %d %d');
- }
- $date = Calendar_Engine_UnixTS::stampCollection($stamp);
- return ( $date[2] == $today[2]
- && $date[1] == $today[1]
- && $date[0] == $today[0]
- );
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Factory.php b/airtime_mvc/library/pear/Calendar/Factory.php
deleted file mode 100644
index 39b3b3901..000000000
--- a/airtime_mvc/library/pear/Calendar/Factory.php
+++ /dev/null
@@ -1,168 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Factory.php 246404 2007-11-18 21:46:43Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Contains a factory method to return a Singleton instance of a class
- * implementing the Calendar_Engine_Interface.
- * For Month objects, to control type of month returned, use CALENDAR_MONTH_STATE
- * constact e.g.;
- *
- * require_once 'Calendar/Factory.php';
- * define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); // Use Calendar_Month_Weekdays
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); // Use Calendar_Month_Weeks
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH); // Use Calendar_Month
- *
- * It defaults to building Calendar_Month objects.
- * Use the constract CALENDAR_FIRST_DAY_OF_WEEK to control the first day of the week
- * for Month or Week objects (e.g. 0 = Sunday, 6 = Saturday)
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access protected
- */
-class Calendar_Factory
-{
- /**
- * Creates a calendar object given the type and units
- *
- * @param string $type class of calendar object to create
- * @param int $y year
- * @param int $m month
- * @param int $d day
- * @param int $h hour
- * @param int $i minute
- * @param int $s second
- *
- * @return object subclass of Calendar
- * @access public
- * @static
- */
- function create($type, $y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0)
- {
- $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1;
- switch ($type) {
- case 'Day':
- include_once CALENDAR_ROOT.'Day.php';
- return new Calendar_Day($y, $m, $d);
- case 'Month':
- // Set default state for which month type to build
- if (!defined('CALENDAR_MONTH_STATE')) {
- define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
- }
- switch (CALENDAR_MONTH_STATE) {
- case CALENDAR_USE_MONTH_WEEKDAYS:
- include_once CALENDAR_ROOT.'Month/Weekdays.php';
- $class = 'Calendar_Month_Weekdays';
- break;
- case CALENDAR_USE_MONTH_WEEKS:
- include_once CALENDAR_ROOT.'Month/Weeks.php';
- $class = 'Calendar_Month_Weeks';
- break;
- case CALENDAR_USE_MONTH:
- default:
- include_once CALENDAR_ROOT.'Month.php';
- $class = 'Calendar_Month';
- break;
- }
- return new $class($y, $m, $firstDay);
- case 'Week':
- include_once CALENDAR_ROOT.'Week.php';
- return new Calendar_Week($y, $m, $d, $firstDay);
- case 'Hour':
- include_once CALENDAR_ROOT.'Hour.php';
- return new Calendar_Hour($y, $m, $d, $h);
- case 'Minute':
- include_once CALENDAR_ROOT.'Minute.php';
- return new Calendar_Minute($y, $m, $d, $h, $i);
- case 'Second':
- include_once CALENDAR_ROOT.'Second.php';
- return new Calendar_Second($y, $m, $d, $h, $i, $s);
- case 'Year':
- include_once CALENDAR_ROOT.'Year.php';
- return new Calendar_Year($y);
- default:
- include_once 'PEAR.php';
- PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type,
- null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()');
- return false;
- }
- }
-
- /**
- * Creates an instance of a calendar object, given a type and timestamp
- *
- * @param string $type type of object to create
- * @param mixed $stamp timestamp (depending on Calendar engine being used)
- *
- * @return object subclass of Calendar
- * @access public
- * @static
- */
- function & createByTimestamp($type, $stamp)
- {
- $cE = & Calendar_Engine_Factory::getEngine();
- $y = $cE->stampToYear($stamp);
- $m = $cE->stampToMonth($stamp);
- $d = $cE->stampToDay($stamp);
- $h = $cE->stampToHour($stamp);
- $i = $cE->stampToMinute($stamp);
- $s = $cE->stampToSecond($stamp);
- $cal = Calendar_Factory::create($type, $y, $m, $d, $h, $i, $s);
- return $cal;
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Hour.php b/airtime_mvc/library/pear/Calendar/Hour.php
deleted file mode 100644
index fe05024b5..000000000
--- a/airtime_mvc/library/pear/Calendar/Hour.php
+++ /dev/null
@@ -1,137 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Hour.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents an Hour and builds Minutes
- *
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Hour.php';
- * $Hour = new Calendar_Hour(2003, 10, 21, 15); // Oct 21st 2003, 3pm
- * $Hour->build(); // Build Calendar_Minute objects
- * while ($Minute = & $Hour->fetch()) {
- * echo $Minute->thisMinute().'
';
- * }
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Hour extends Calendar
-{
- /**
- * Constructs Calendar_Hour
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $d day e.g. 11
- * @param int $h hour e.g. 13
- *
- * @access public
- */
- function Calendar_Hour($y, $m, $d, $h)
- {
- parent::Calendar($y, $m, $d, $h);
- }
-
- /**
- * Builds the Minutes in the Hour
- *
- * @param array $sDates (optional) Calendar_Minute objects representing selected dates
- *
- * @return boolean
- * @access public
- */
- function build($sDates = array())
- {
- include_once CALENDAR_ROOT.'Minute.php';
- $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day,
- $this->hour);
- for ($i=0; $i < $mIH; $i++) {
- $this->children[$i] =
- new Calendar_Minute($this->year, $this->month, $this->day,
- $this->hour, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array $sDates Calendar_Minute objects representing selected dates
- *
- * @return void
- * @access private
- */
- function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- && $this->day == $sDate->thisDay()
- && $this->hour == $sDate->thisHour())
- {
- $key = (int)$sDate->thisMinute();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Minute.php b/airtime_mvc/library/pear/Calendar/Minute.php
deleted file mode 100644
index 7c0b014f2..000000000
--- a/airtime_mvc/library/pear/Calendar/Minute.php
+++ /dev/null
@@ -1,138 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Minute.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Minute and builds Seconds
- *
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Minute.php';
- * $Minute = new Calendar_Minute(2003, 10, 21, 15, 31); // Oct 21st 2003, 3:31pm
- * $Minute->build(); // Build Calendar_Second objects
- * while ($Second = & $Minute->fetch()) {
- * echo $Second->thisSecond().'
';
- * }
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Minute extends Calendar
-{
- /**
- * Constructs Minute
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $d day e.g. 11
- * @param int $h hour e.g. 13
- * @param int $i minute e.g. 31
- *
- * @access public
- */
- function Calendar_Minute($y, $m, $d, $h, $i)
- {
- parent::Calendar($y, $m, $d, $h, $i);
- }
-
- /**
- * Builds the Calendar_Second objects
- *
- * @param array $sDates (optional) Calendar_Second objects representing selected dates
- *
- * @return boolean
- * @access public
- */
- function build($sDates = array())
- {
- include_once CALENDAR_ROOT.'Second.php';
- $sIM = $this->cE->getSecondsInMinute($this->year, $this->month,
- $this->day, $this->hour, $this->minute);
- for ($i=0; $i < $sIM; $i++) {
- $this->children[$i] = new Calendar_Second($this->year, $this->month,
- $this->day, $this->hour, $this->minute, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array $sDates Calendar_Second objects representing selected dates
- *
- * @return void
- * @access private
- */
- function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- && $this->day == $sDate->thisDay()
- && $this->hour == $sDate->thisHour()
- && $this->minute == $sDate->thisMinute())
- {
- $key = (int)$sDate->thisSecond();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Month.php b/airtime_mvc/library/pear/Calendar/Month.php
deleted file mode 100644
index afd017277..000000000
--- a/airtime_mvc/library/pear/Calendar/Month.php
+++ /dev/null
@@ -1,138 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Month.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Month and builds Days
- *
- * require_once 'Calendar/Month.php';
- * $Month = new Calendar_Month(2003, 10); // Oct 2003
- * $Month->build(); // Build Calendar_Day objects
- * while ($Day = & $Month->fetch()) {
- * echo $Day->thisDay().'
';
- * }
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Month extends Calendar
-{
- /**
- * Constructs Calendar_Month
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $firstDay first day of the week [optional]
- *
- * @access public
- */
- function Calendar_Month($y, $m, $firstDay=null)
- {
- parent::Calendar($y, $m);
- $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
- }
-
- /**
- * Builds Day objects for this Month. Creates as many Calendar_Day objects
- * as there are days in the month
- *
- * @param array $sDates (optional) Calendar_Day objects representing selected dates
- *
- * @return boolean
- * @access public
- */
- function build($sDates = array())
- {
- include_once CALENDAR_ROOT.'Day.php';
- $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
- for ($i=1; $i<=$daysInMonth; $i++) {
- $this->children[$i] = new Calendar_Day($this->year, $this->month, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array $sDates Calendar_Day objects representing selected dates
- *
- * @return void
- * @access private
- */
- function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- ) {
- $key = $sDate->thisDay();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $class = strtolower(get_class($sDate));
- if ($class == 'calendar_day' || $class == 'calendar_decorator') {
- $sDate->setFirst($this->children[$key]->isFirst());
- $sDate->setLast($this->children[$key]->isLast());
- }
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Month/Weekdays.php b/airtime_mvc/library/pear/Calendar/Month/Weekdays.php
deleted file mode 100644
index a2a4cf19e..000000000
--- a/airtime_mvc/library/pear/Calendar/Month/Weekdays.php
+++ /dev/null
@@ -1,215 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Weekdays.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Load base month
- */
-require_once CALENDAR_ROOT.'Month.php';
-
-/**
- * Represents a Month and builds Days in tabular form
- *
- * require_once 'Calendar/Month/Weekdays.php';
- * $Month = new Calendar_Month_Weekdays(2003, 10); // Oct 2003
- * $Month->build(); // Build Calendar_Day objects
- * while ($Day = & $Month->fetch()) {
- * if ($Day->isFirst()) {
- * echo '';
- * }
- * if ($Day->isEmpty()) {
- * echo ' | ';
- * } else {
- * echo ''.$Day->thisDay().' | ';
- * }
- * if ($Day->isLast()) {
- * echo '
';
- * }
- * }
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Month_Weekdays extends Calendar_Month
-{
- /**
- * Instance of Calendar_Table_Helper
- * @var Calendar_Table_Helper
- * @access private
- */
- var $tableHelper;
-
- /**
- * First day of the week
- * @access private
- * @var string
- */
- var $firstDay;
-
- /**
- * Constructs Calendar_Month_Weekdays
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $firstDay (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
- *
- * @access public
- */
- function Calendar_Month_Weekdays($y, $m, $firstDay=null)
- {
- parent::Calendar_Month($y, $m, $firstDay);
- }
-
- /**
- * Builds Day objects in tabular form, to allow display of calendar month
- * with empty cells if the first day of the week does not fall on the first
- * day of the month.
- *
- * @param array $sDates (optional) Calendar_Day objects representing selected dates
- *
- * @return boolean
- * @access public
- * @see Calendar_Day::isEmpty()
- * @see Calendar_Day_Base::isFirst()
- * @see Calendar_Day_Base::isLast()
- */
- function build($sDates = array())
- {
- include_once CALENDAR_ROOT.'Table/Helper.php';
- $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay);
- Calendar_Month::build($sDates);
- $this->buildEmptyDaysBefore();
- $this->shiftDays();
- $this->buildEmptyDaysAfter();
- $this->setWeekMarkers();
- return true;
- }
-
- /**
- * Prepends empty days before the real days in the month
- *
- * @return void
- * @access private
- */
- function buildEmptyDaysBefore()
- {
- $eBefore = $this->tableHelper->getEmptyDaysBefore();
- for ($i=0; $i < $eBefore; $i++) {
- $stamp = $this->cE->dateToStamp($this->year, $this->month, -$i);
- $Day = new Calendar_Day(
- $this->cE->stampToYear($stamp),
- $this->cE->stampToMonth($stamp),
- $this->cE->stampToDay($stamp));
- $Day->setEmpty();
- $Day->adjust();
- array_unshift($this->children, $Day);
- }
- }
-
- /**
- * Shifts the array of children forward, if necessary
- *
- * @return void
- * @access private
- */
- function shiftDays()
- {
- if (isset($this->children[0])) {
- array_unshift($this->children, null);
- unset($this->children[0]);
- }
- }
-
- /**
- * Appends empty days after the real days in the month
- *
- * @return void
- * @access private
- */
- function buildEmptyDaysAfter()
- {
- $eAfter = $this->tableHelper->getEmptyDaysAfter();
- $sDOM = $this->tableHelper->getNumTableDaysInMonth();
- for ($i=1; $i <= $sDOM-$eAfter; $i++) {
- $Day = new Calendar_Day($this->year, $this->month+1, $i);
- $Day->setEmpty();
- $Day->adjust();
- array_push($this->children, $Day);
- }
- }
-
- /**
- * Sets the "markers" for the beginning and of a of week, in the
- * built Calendar_Day children
- *
- * @return void
- * @access private
- */
- function setWeekMarkers()
- {
- $dIW = $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- );
- $sDOM = $this->tableHelper->getNumTableDaysInMonth();
- for ($i=1; $i <= $sDOM; $i+= $dIW) {
- $this->children[$i]->setFirst();
- $this->children[$i+($dIW-1)]->setLast();
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Month/Weeks.php b/airtime_mvc/library/pear/Calendar/Month/Weeks.php
deleted file mode 100644
index aab651392..000000000
--- a/airtime_mvc/library/pear/Calendar/Month/Weeks.php
+++ /dev/null
@@ -1,166 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Weeks.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Load base month
- */
-require_once CALENDAR_ROOT.'Month.php';
-
-/**
- * Represents a Month and builds Weeks
- *
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Month'.DIRECTORY_SEPARATOR.'Weeks.php';
- * $Month = new Calendar_Month_Weeks(2003, 10); // Oct 2003
- * $Month->build(); // Build Calendar_Day objects
- * while ($Week = & $Month->fetch()) {
- * echo $Week->thisWeek().'
';
- * }
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Month_Weeks extends Calendar_Month
-{
- /**
- * Instance of Calendar_Table_Helper
- * @var Calendar_Table_Helper
- * @access private
- */
- var $tableHelper;
-
- /**
- * First day of the week
- * @access private
- * @var string
- */
- var $firstDay;
-
- /**
- * Constructs Calendar_Month_Weeks
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $firstDay (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
- *
- * @access public
- */
- function Calendar_Month_Weeks($y, $m, $firstDay=null)
- {
- parent::Calendar_Month($y, $m, $firstDay);
- }
-
- /**
- * Builds Calendar_Week objects for the Month. Note that Calendar_Week
- * builds Calendar_Day object in tabular form (with Calendar_Day->empty)
- *
- * @param array $sDates (optional) Calendar_Week objects representing selected dates
- *
- * @return boolean
- * @access public
- */
- function build($sDates = array())
- {
- include_once CALENDAR_ROOT.'Table/Helper.php';
- $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay);
- include_once CALENDAR_ROOT.'Week.php';
- $numWeeks = $this->tableHelper->getNumWeeks();
- for ($i=1, $d=1; $i<=$numWeeks; $i++,
- $d+=$this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- )
- ) {
- $this->children[$i] = new Calendar_Week(
- $this->year, $this->month, $d, $this->tableHelper->getFirstDay());
- }
- //used to set empty days
- $this->children[1]->setFirst(true);
- $this->children[$numWeeks]->setLast(true);
-
- // Handle selected weeks here
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array $sDates Calendar_Week objects representing selected dates
- *
- * @return void
- * @access private
- */
- function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth())
- {
- $key = $sDate->thisWeek('n_in_month');
- if (isset($this->children[$key])) {
- $this->children[$key]->setSelected();
- }
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Second.php b/airtime_mvc/library/pear/Calendar/Second.php
deleted file mode 100644
index b1b962b8b..000000000
--- a/airtime_mvc/library/pear/Calendar/Second.php
+++ /dev/null
@@ -1,122 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Second.php 300728 2010-06-24 11:43:56Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Second
- * Note: Seconds do not build other objects
- * so related methods are overridden to return NULL
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Second extends Calendar
-{
- /**
- * Constructs Second
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $d day e.g. 11
- * @param int $h hour e.g. 13
- * @param int $i minute e.g. 31
- * @param int $s second e.g. 45
- */
- function Calendar_Second($y, $m, $d, $h, $i, $s)
- {
- parent::Calendar($y, $m, $d, $h, $i, $s);
- }
-
- /**
- * Overwrite build
- *
- * @return NULL
- */
- function build()
- {
- return null;
- }
-
- /**
- * Overwrite fetch
- *
- * @return NULL
- */
- function fetch()
- {
- return null;
- }
-
- /**
- * Overwrite fetchAll
- *
- * @return NULL
- */
- function fetchAll()
- {
- return null;
- }
-
- /**
- * Overwrite size
- *
- * @return NULL
- */
- function size()
- {
- return null;
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Table/Helper.php b/airtime_mvc/library/pear/Calendar/Table/Helper.php
deleted file mode 100644
index c852dc083..000000000
--- a/airtime_mvc/library/pear/Calendar/Table/Helper.php
+++ /dev/null
@@ -1,316 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Helper.php 246317 2007-11-16 20:05:32Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Used by Calendar_Month_Weekdays, Calendar_Month_Weeks and Calendar_Week to
- * help with building the calendar in tabular form
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Table_Helper
-{
- /**
- * Instance of the Calendar object being helped.
- * @var object
- * @access private
- */
- var $calendar;
-
- /**
- * Instance of the Calendar_Engine
- * @var object
- * @access private
- */
- var $cE;
-
- /**
- * First day of the week
- * @access private
- * @var string
- */
- var $firstDay;
-
- /**
- * The seven days of the week named
- * @access private
- * @var array
- */
- var $weekDays;
-
- /**
- * Days of the week ordered with $firstDay at the beginning
- * @access private
- * @var array
- */
- var $daysOfWeek = array();
-
- /**
- * Days of the month built from days of the week
- * @access private
- * @var array
- */
- var $daysOfMonth = array();
-
- /**
- * Number of weeks in month
- * @var int
- * @access private
- */
- var $numWeeks = null;
-
- /**
- * Number of emtpy days before real days begin in month
- * @var int
- * @access private
- */
- var $emptyBefore = 0;
-
- /**
- * Constructs Calendar_Table_Helper
- *
- * @param object &$calendar Calendar_Month_Weekdays, Calendar_Month_Weeks, Calendar_Week
- * @param int $firstDay (optional) first day of the week e.g. 1 for Monday
- *
- * @access protected
- */
- function Calendar_Table_Helper(& $calendar, $firstDay=null)
- {
- $this->calendar = & $calendar;
- $this->cE = & $calendar->getEngine();
- if (is_null($firstDay)) {
- $firstDay = $this->cE->getFirstDayOfWeek(
- $this->calendar->thisYear(),
- $this->calendar->thisMonth(),
- $this->calendar->thisDay()
- );
- }
- $this->firstDay = $firstDay;
- $this->setFirstDay();
- $this->setDaysOfMonth();
- }
-
- /**
- * Constructs $this->daysOfWeek based on $this->firstDay
- *
- * @return void
- * @access private
- */
- function setFirstDay()
- {
- $weekDays = $this->cE->getWeekDays(
- $this->calendar->thisYear(),
- $this->calendar->thisMonth(),
- $this->calendar->thisDay()
- );
- $endDays = array();
- $tmpDays = array();
- $begin = false;
- foreach ($weekDays as $day) {
- if ($begin) {
- $endDays[] = $day;
- } else if ($day === $this->firstDay) {
- $begin = true;
- $endDays[] = $day;
- } else {
- $tmpDays[] = $day;
- }
- }
- $this->daysOfWeek = array_merge($endDays, $tmpDays);
- }
-
- /**
- * Constructs $this->daysOfMonth
- *
- * @return void
- * @access private
- */
- function setDaysOfMonth()
- {
- $this->daysOfMonth = $this->daysOfWeek;
- $daysInMonth = $this->cE->getDaysInMonth(
- $this->calendar->thisYear(), $this->calendar->thisMonth());
- $firstDayInMonth = $this->cE->getFirstDayInMonth(
- $this->calendar->thisYear(), $this->calendar->thisMonth());
- $this->emptyBefore=0;
- foreach ($this->daysOfMonth as $dayOfWeek) {
- if ($firstDayInMonth == $dayOfWeek) {
- break;
- }
- $this->emptyBefore++;
- }
- $this->numWeeks = ceil(
- ($daysInMonth + $this->emptyBefore)
- /
- $this->cE->getDaysInWeek(
- $this->calendar->thisYear(),
- $this->calendar->thisMonth(),
- $this->calendar->thisDay()
- )
- );
- for ($i=1; $i < $this->numWeeks; $i++) {
- $this->daysOfMonth =
- array_merge($this->daysOfMonth, $this->daysOfWeek);
- }
- }
-
- /**
- * Returns the first day of the month
- *
- * @return int
- * @access protected
- * @see Calendar_Engine_Interface::getFirstDayOfWeek()
- */
- function getFirstDay()
- {
- return $this->firstDay;
- }
-
- /**
- * Returns the order array of days in a week
- *
- * @return int
- * @access protected
- */
- function getDaysOfWeek()
- {
- return $this->daysOfWeek;
- }
-
- /**
- * Returns the number of tabular weeks in a month
- *
- * @return int
- * @access protected
- */
- function getNumWeeks()
- {
- return $this->numWeeks;
- }
-
- /**
- * Returns the number of real days + empty days
- *
- * @return int
- * @access protected
- */
- function getNumTableDaysInMonth()
- {
- return count($this->daysOfMonth);
- }
-
- /**
- * Returns the number of empty days before the real days begin
- *
- * @return int
- * @access protected
- */
- function getEmptyDaysBefore()
- {
- return $this->emptyBefore;
- }
-
- /**
- * Returns the index of the last real day in the month
- *
- * @todo Potential performance optimization with static
- * @return int
- * @access protected
- */
- function getEmptyDaysAfter()
- {
- // Causes bug when displaying more than one month
- //static $index;
- //if (!isset($index)) {
- $index = $this->getEmptyDaysBefore() + $this->cE->getDaysInMonth(
- $this->calendar->thisYear(), $this->calendar->thisMonth());
- //}
- return $index;
- }
-
- /**
- * Returns the index of the last real day in the month, relative to the
- * beginning of the tabular week it is part of
- *
- * @return int
- * @access protected
- */
- function getEmptyDaysAfterOffset()
- {
- $eAfter = $this->getEmptyDaysAfter();
- return $eAfter - (
- $this->cE->getDaysInWeek(
- $this->calendar->thisYear(),
- $this->calendar->thisMonth(),
- $this->calendar->thisDay()
- ) * ($this->numWeeks-1));
- }
-
- /**
- * Returns the timestamp of the first day of the current week
- *
- * @param int $y year
- * @param int $m month
- * @param int $d day
- * @param int $firstDay first day of the week (default 1 = Monday)
- *
- * @return int timestamp
- */
- function getWeekStart($y, $m, $d, $firstDay=1)
- {
- $dow = $this->cE->getDayOfWeek($y, $m, $d);
- if ($dow > $firstDay) {
- $d -= ($dow - $firstDay);
- }
- if ($dow < $firstDay) {
- $d -= (
- $this->cE->getDaysInWeek(
- $this->calendar->thisYear(),
- $this->calendar->thisMonth(),
- $this->calendar->thisDay()
- ) - $firstDay + $dow);
- }
- return $this->cE->dateToStamp($y, $m, $d);
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Util/Textual.php b/airtime_mvc/library/pear/Calendar/Util/Textual.php
deleted file mode 100644
index 109a00ba0..000000000
--- a/airtime_mvc/library/pear/Calendar/Util/Textual.php
+++ /dev/null
@@ -1,304 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Textual.php 247250 2007-11-28 19:42:01Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * @package Calendar
- * @version $Id: Textual.php 247250 2007-11-28 19:42:01Z quipo $
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar decorator base class
- */
-require_once CALENDAR_ROOT.'Decorator.php';
-
-/**
- * Static utlities to help with fetching textual representations of months and
- * days of the week.
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Util_Textual
-{
-
- /**
- * Returns an array of 12 month names (first index = 1)
- *
- * @param string $format (optional) format of returned months (one|two|short|long)
- *
- * @return array
- * @access public
- * @static
- */
- function monthNames($format = 'long')
- {
- $formats = array(
- 'one' => '%b',
- 'two' => '%b',
- 'short' => '%b',
- 'long' => '%B',
- );
- if (!array_key_exists($format, $formats)) {
- $format = 'long';
- }
- $months = array();
- for ($i=1; $i<=12; $i++) {
- $stamp = mktime(0, 0, 0, $i, 1, 2003);
- $month = strftime($formats[$format], $stamp);
- switch($format) {
- case 'one':
- $month = substr($month, 0, 1);
- break;
- case 'two':
- $month = substr($month, 0, 2);
- break;
- }
- $months[$i] = $month;
- }
- return $months;
- }
-
- /**
- * Returns an array of 7 week day names (first index = 0)
- *
- * @param string $format (optional) format of returned days (one,two,short or long)
- *
- * @return array
- * @access public
- * @static
- */
- function weekdayNames($format = 'long')
- {
- $formats = array(
- 'one' => '%a',
- 'two' => '%a',
- 'short' => '%a',
- 'long' => '%A',
- );
- if (!array_key_exists($format, $formats)) {
- $format = 'long';
- }
- $days = array();
- for ($i=0; $i<=6; $i++) {
- $stamp = mktime(0, 0, 0, 11, $i+2, 2003);
- $day = strftime($formats[$format], $stamp);
- switch($format) {
- case 'one':
- $day = substr($day, 0, 1);
- break;
- case 'two':
- $day = substr($day, 0, 2);
- break;
- }
- $days[$i] = $day;
- }
- return $days;
- }
-
- /**
- * Returns textual representation of the previous month of the decorated calendar object
- *
- * @param object $Calendar subclass of Calendar e.g. Calendar_Month
- * @param string $format (optional) format of returned months (one,two,short or long)
- *
- * @return string
- * @access public
- * @static
- */
- function prevMonthName($Calendar, $format = 'long')
- {
- $months = Calendar_Util_Textual::monthNames($format);
- return $months[$Calendar->prevMonth()];
- }
-
- /**
- * Returns textual representation of the month of the decorated calendar object
- *
- * @param object $Calendar subclass of Calendar e.g. Calendar_Month
- * @param string $format (optional) format of returned months (one,two,short or long)
- *
- * @return string
- * @access public
- * @static
- */
- function thisMonthName($Calendar, $format = 'long')
- {
- $months = Calendar_Util_Textual::monthNames($format);
- return $months[$Calendar->thisMonth()];
- }
-
- /**
- * Returns textual representation of the next month of the decorated calendar object
- *
- * @param object $Calendar subclass of Calendar e.g. Calendar_Month
- * @param string $format (optional) format of returned months (one,two,short or long)
- *
- * @return string
- * @access public
- * @static
- */
- function nextMonthName($Calendar, $format = 'long')
- {
- $months = Calendar_Util_Textual::monthNames($format);
- return $months[$Calendar->nextMonth()];
- }
-
- /**
- * Returns textual representation of the previous day of week of the decorated calendar object
- * Note: Requires PEAR::Date
- *
- * @param object $Calendar subclass of Calendar e.g. Calendar_Month
- * @param string $format (optional) format of returned months (one,two,short or long)
- *
- * @return string
- * @access public
- * @static
- */
- function prevDayName($Calendar, $format = 'long')
- {
- $days = Calendar_Util_Textual::weekdayNames($format);
- $stamp = $Calendar->prevDay('timestamp');
- $cE = $Calendar->getEngine();
- include_once 'Date/Calc.php';
- $day = Date_Calc::dayOfWeek($cE->stampToDay($stamp),
- $cE->stampToMonth($stamp), $cE->stampToYear($stamp));
- return $days[$day];
- }
-
- /**
- * Returns textual representation of the day of week of the decorated calendar object
- * Note: Requires PEAR::Date
- *
- * @param object $Calendar subclass of Calendar e.g. Calendar_Month
- * @param string $format (optional) format of returned months (one,two,short or long)
- *
- * @return string
- * @access public
- * @static
- */
- function thisDayName($Calendar, $format='long')
- {
- $days = Calendar_Util_Textual::weekdayNames($format);
- include_once 'Date/Calc.php';
- $day = Date_Calc::dayOfWeek($Calendar->thisDay(), $Calendar->thisMonth(), $Calendar->thisYear());
- return $days[$day];
- }
-
- /**
- * Returns textual representation of the next day of week of the decorated calendar object
- *
- * @param object $Calendar subclass of Calendar e.g. Calendar_Month
- * @param string $format (optional) format of returned months (one,two,short or long)
- *
- * @return string
- * @access public
- * @static
- */
- function nextDayName($Calendar, $format='long')
- {
- $days = Calendar_Util_Textual::weekdayNames($format);
- $stamp = $Calendar->nextDay('timestamp');
- $cE = $Calendar->getEngine();
- include_once 'Date/Calc.php';
- $day = Date_Calc::dayOfWeek($cE->stampToDay($stamp),
- $cE->stampToMonth($stamp), $cE->stampToYear($stamp));
- return $days[$day];
- }
-
- /**
- * Returns the days of the week using the order defined in the decorated
- * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
- * and Calendar_Week. Otherwise the returned array will begin on Sunday
- *
- * @param object $Calendar subclass of Calendar e.g. Calendar_Month
- * @param string $format (optional) format of returned months (one,two,short or long)
- *
- * @return array ordered array of week day names
- * @access public
- * @static
- */
- function orderedWeekdays($Calendar, $format = 'long')
- {
- $days = Calendar_Util_Textual::weekdayNames($format);
-
- if (isset($Calendar->tableHelper)) {
- $ordereddays = $Calendar->tableHelper->getDaysOfWeek();
- } else {
- //default: start from Sunday
- $firstDay = 0;
- //check if defined / set
- if (defined('CALENDAR_FIRST_DAY_OF_WEEK')) {
- $firstDay = CALENDAR_FIRST_DAY_OF_WEEK;
- } elseif(isset($Calendar->firstDay)) {
- $firstDay = $Calendar->firstDay;
- }
- $ordereddays = array();
- for ($i = $firstDay; $i < 7; $i++) {
- $ordereddays[] = $i;
- }
- for ($i = 0; $i < $firstDay; $i++) {
- $ordereddays[] = $i;
- }
- }
-
- $ordereddays = array_flip($ordereddays);
- $i = 0;
- $returndays = array();
- foreach ($ordereddays as $key => $value) {
- $returndays[$i] = $days[$key];
- $i++;
- }
- return $returndays;
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Util/Uri.php b/airtime_mvc/library/pear/Calendar/Util/Uri.php
deleted file mode 100644
index 1490501f7..000000000
--- a/airtime_mvc/library/pear/Calendar/Util/Uri.php
+++ /dev/null
@@ -1,204 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Uri.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Utility to help building HTML links for navigating the calendar
- *
- * $Day = new Calendar_Day(2003, 10, 23);
- * $Uri = new Calendar_Util_Uri('year', 'month', 'day');
- * echo $Uri->prev($Day,'month'); // Displays year=2003&month=10
- * echo $Uri->prev($Day,'day'); // Displays year=2003&month=10&day=22
- * $Uri->seperator = '/';
- * $Uri->scalar = true;
- * echo $Uri->prev($Day,'month'); // Displays 2003/10
- * echo $Uri->prev($Day,'day'); // Displays 2003/10/22
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Util_Uri
-{
- /**
- * Uri fragments for year, month, day etc.
- * @var array
- * @access private
- */
- var $uris = array();
-
- /**
- * String to separate fragments with.
- * Set to just & for HTML.
- * For a scalar URL you might use / as the seperator
- * @var string (default XHTML &)
- * @access public
- */
- var $separator = '&';
-
- /**
- * To output a "scalar" string - variable names omitted.
- * Used for urls like index.php/2004/8/12
- * @var boolean (default false)
- * @access public
- */
- var $scalar = false;
-
- /**
- * Constructs Calendar_Decorator_Uri
- * The term "fragment" means name of a calendar GET variables in the URL
- *
- * @param string $y URI fragment for year
- * @param string $m (optional) URI fragment for month
- * @param string $d (optional) URI fragment for day
- * @param string $h (optional) URI fragment for hour
- * @param string $i (optional) URI fragment for minute
- * @param string $s (optional) URI fragment for second
- *
- * @access public
- */
- function Calendar_Util_Uri($y, $m=null, $d=null, $h=null, $i=null, $s=null)
- {
- $this->setFragments($y, $m, $d, $h, $i, $s);
- }
-
- /**
- * Sets the URI fragment names
- *
- * @param string $y URI fragment for year
- * @param string $m (optional) URI fragment for month
- * @param string $d (optional) URI fragment for day
- * @param string $h (optional) URI fragment for hour
- * @param string $i (optional) URI fragment for minute
- * @param string $s (optional) URI fragment for second
- *
- * @return void
- * @access public
- */
- function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null)
- {
- if (!is_null($y)) $this->uris['Year'] = $y;
- if (!is_null($m)) $this->uris['Month'] = $m;
- if (!is_null($d)) $this->uris['Day'] = $d;
- if (!is_null($h)) $this->uris['Hour'] = $h;
- if (!is_null($i)) $this->uris['Minute'] = $i;
- if (!is_null($s)) $this->uris['Second'] = $s;
- }
-
- /**
- * Gets the URI string for the previous calendar unit
- *
- * @param object $Calendar subclassed from Calendar e.g. Calendar_Month
- * @param string $unit calendar unit (year|month|week|day|hour|minute|second)
- *
- * @return string
- * @access public
- */
- function prev($Calendar, $unit)
- {
- $method = 'prev'.$unit;
- $stamp = $Calendar->{$method}('timestamp');
- return $this->buildUriString($Calendar, $method, $stamp);
- }
-
- /**
- * Gets the URI string for the current calendar unit
- *
- * @param object $Calendar subclassed from Calendar e.g. Calendar_Month
- * @param string $unit calendar unit (year|month|week|day|hour|minute|second)
- *
- * @return string
- * @access public
- */
- function this($Calendar, $unit)
- {
- $method = 'this'.$unit;
- $stamp = $Calendar->{$method}('timestamp');
- return $this->buildUriString($Calendar, $method, $stamp);
- }
-
- /**
- * Gets the URI string for the next calendar unit
- *
- * @param object $Calendar subclassed from Calendar e.g. Calendar_Month
- * @param string $unit calendar unit (year|month|week|day|hour|minute|second)
- *
- * @return string
- * @access public
- */
- function next($Calendar, $unit)
- {
- $method = 'next'.$unit;
- $stamp = $Calendar->{$method}('timestamp');
- return $this->buildUriString($Calendar, $method, $stamp);
- }
-
- /**
- * Build the URI string
- *
- * @param object $Calendar subclassed from Calendar e.g. Calendar_Month
- * @param string $method method substring
- * @param int $stamp timestamp
- *
- * @return string build uri string
- * @access private
- */
- function buildUriString($Calendar, $method, $stamp)
- {
- $uriString = '';
- $cE = & $Calendar->getEngine();
- $separator = '';
- foreach ($this->uris as $unit => $uri) {
- $call = 'stampTo'.$unit;
- $uriString .= $separator;
- if (!$this->scalar) {
- $uriString .= $uri.'=';
- }
- $uriString .= $cE->{$call}($stamp);
- $separator = $this->separator;
- }
- return $uriString;
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Validator.php b/airtime_mvc/library/pear/Calendar/Validator.php
deleted file mode 100644
index a96c8e223..000000000
--- a/airtime_mvc/library/pear/Calendar/Validator.php
+++ /dev/null
@@ -1,377 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Validator.php 247251 2007-11-28 19:42:33Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Validation Error Messages
- */
-if (!defined('CALENDAR_VALUE_TOOSMALL')) {
- define('CALENDAR_VALUE_TOOSMALL', 'Too small: min = ');
-}
-if (!defined('CALENDAR_VALUE_TOOLARGE')) {
- define('CALENDAR_VALUE_TOOLARGE', 'Too large: max = ');
-}
-
-/**
- * Used to validate any given Calendar date object. Instances of this class
- * can be obtained from any data object using the getValidator method
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @see Calendar::getValidator()
- * @access public
- */
-class Calendar_Validator
-{
- /**
- * Instance of the Calendar date object to validate
- * @var object
- * @access private
- */
- var $calendar;
-
- /**
- * Instance of the Calendar_Engine
- * @var object
- * @access private
- */
- var $cE;
-
- /**
- * Array of errors for validation failures
- * @var array
- * @access private
- */
- var $errors = array();
-
- /**
- * Constructs Calendar_Validator
- *
- * @param object &$calendar subclass of Calendar
- *
- * @access public
- */
- function Calendar_Validator(&$calendar)
- {
- $this->calendar = & $calendar;
- $this->cE = & $calendar->getEngine();
- }
-
- /**
- * Calls all the other isValidXXX() methods in the validator
- *
- * @return boolean
- * @access public
- */
- function isValid()
- {
- $checks = array('isValidYear', 'isValidMonth', 'isValidDay',
- 'isValidHour', 'isValidMinute', 'isValidSecond');
- $valid = true;
- foreach ($checks as $check) {
- if (!$this->{$check}()) {
- $valid = false;
- }
- }
- return $valid;
- }
-
- /**
- * Check whether this is a valid year
- *
- * @return boolean
- * @access public
- */
- function isValidYear()
- {
- $y = $this->calendar->thisYear();
- $min = $this->cE->getMinYears();
- if ($min > $y) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Year', $y, CALENDAR_VALUE_TOOSMALL.$min);
- return false;
- }
- $max = $this->cE->getMaxYears();
- if ($y > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Year', $y, CALENDAR_VALUE_TOOLARGE.$max);
- return false;
- }
- return true;
- }
-
- /**
- * Check whether this is a valid month
- *
- * @return boolean
- * @access public
- */
- function isValidMonth()
- {
- $m = $this->calendar->thisMonth();
- $min = 1;
- if ($min > $m) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Month', $m, CALENDAR_VALUE_TOOSMALL.$min);
- return false;
- }
- $max = $this->cE->getMonthsInYear($this->calendar->thisYear());
- if ($m > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Month', $m, CALENDAR_VALUE_TOOLARGE.$max);
- return false;
- }
- return true;
- }
-
- /**
- * Check whether this is a valid day
- *
- * @return boolean
- * @access public
- */
- function isValidDay()
- {
- $d = $this->calendar->thisDay();
- $min = 1;
- if ($min > $d) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Day', $d, CALENDAR_VALUE_TOOSMALL.$min);
- return false;
- }
- $max = $this->cE->getDaysInMonth(
- $this->calendar->thisYear(),
- $this->calendar->thisMonth()
- );
- if ($d > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Day', $d, CALENDAR_VALUE_TOOLARGE.$max);
- return false;
- }
- return true;
- }
-
- /**
- * Check whether this is a valid hour
- *
- * @return boolean
- * @access public
- */
- function isValidHour()
- {
- $h = $this->calendar->thisHour();
- $min = 0;
- if ($min > $h) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Hour', $h, CALENDAR_VALUE_TOOSMALL.$min);
- return false;
- }
- $max = ($this->cE->getHoursInDay($this->calendar->thisDay())-1);
- if ($h > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Hour', $h, CALENDAR_VALUE_TOOLARGE.$max);
- return false;
- }
- return true;
- }
-
- /**
- * Check whether this is a valid minute
- *
- * @return boolean
- * @access public
- */
- function isValidMinute()
- {
- $i = $this->calendar->thisMinute();
- $min = 0;
- if ($min > $i) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Minute', $i, CALENDAR_VALUE_TOOSMALL.$min);
- return false;
- }
- $max = ($this->cE->getMinutesInHour($this->calendar->thisHour())-1);
- if ($i > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Minute', $i, CALENDAR_VALUE_TOOLARGE.$max);
- return false;
- }
- return true;
- }
-
- /**
- * Check whether this is a valid second
- *
- * @return boolean
- * @access public
- */
- function isValidSecond()
- {
- $s = $this->calendar->thisSecond();
- $min = 0;
- if ($min > $s) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Second', $s, CALENDAR_VALUE_TOOSMALL.$min);
- return false;
- }
- $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute())-1);
- if ($s > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Second', $s, CALENDAR_VALUE_TOOLARGE.$max);
- return false;
- }
- return true;
- }
-
- /**
- * Iterates over any validation errors
- *
- * @return mixed either Calendar_Validation_Error or false
- * @access public
- */
- function fetch()
- {
- $error = each($this->errors);
- if ($error) {
- return $error['value'];
- } else {
- reset($this->errors);
- return false;
- }
- }
-}
-
-/**
- * For Validation Error messages
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @see Calendar::fetch()
- * @access public
- */
-class Calendar_Validation_Error
-{
- /**
- * Date unit (e.g. month,hour,second) which failed test
- * @var string
- * @access private
- */
- var $unit;
-
- /**
- * Value of unit which failed test
- * @var int
- * @access private
- */
- var $value;
-
- /**
- * Validation error message
- * @var string
- * @access private
- */
- var $message;
-
- /**
- * Constructs Calendar_Validation_Error
- *
- * @param string $unit Date unit (e.g. month,hour,second)
- * @param int $value Value of unit which failed test
- * @param string $message Validation error message
- *
- * @access protected
- */
- function Calendar_Validation_Error($unit, $value, $message)
- {
- $this->unit = $unit;
- $this->value = $value;
- $this->message = $message;
- }
-
- /**
- * Returns the Date unit
- *
- * @return string
- * @access public
- */
- function getUnit()
- {
- return $this->unit;
- }
-
- /**
- * Returns the value of the unit
- *
- * @return int
- * @access public
- */
- function getValue()
- {
- return $this->value;
- }
-
- /**
- * Returns the validation error message
- *
- * @return string
- * @access public
- */
- function getMessage()
- {
- return $this->message;
- }
-
- /**
- * Returns a string containing the unit, value and error message
- *
- * @return string
- * @access public
- */
- function toString ()
- {
- return $this->unit.' = '.$this->value.' ['.$this->message.']';
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Week.php b/airtime_mvc/library/pear/Calendar/Week.php
deleted file mode 100644
index 966128f2c..000000000
--- a/airtime_mvc/library/pear/Calendar/Week.php
+++ /dev/null
@@ -1,470 +0,0 @@
-
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Week.php 300729 2010-06-24 12:05:53Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Week and builds Days in tabular format
- *
- * require_once 'Calendar/Week.php';
- * $Week = new Calendar_Week(2003, 10, 1); Oct 2003, 1st tabular week
- * echo '';
- * while ($Day = & $Week->fetch()) {
- * if ($Day->isEmpty()) {
- * echo ' | ';
- * } else {
- * echo ''.$Day->thisDay().' | ';
- * }
- * }
- * echo '
';
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @author Lorenzo Alberton
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- */
-class Calendar_Week extends Calendar
-{
- /**
- * Instance of Calendar_Table_Helper
- * @var Calendar_Table_Helper
- * @access private
- */
- var $tableHelper;
-
- /**
- * Stores the timestamp of the first day of this week
- * @access private
- * @var object
- */
- var $thisWeek;
-
- /**
- * Stores the timestamp of first day of previous week
- * @access private
- * @var object
- */
- var $prevWeek;
-
- /**
- * Stores the timestamp of first day of next week
- * @access private
- * @var object
- */
- var $nextWeek;
-
- /**
- * Used by build() to set empty days
- * @access private
- * @var boolean
- */
- var $firstWeek = false;
-
- /**
- * Used by build() to set empty days
- * @access private
- * @var boolean
- */
- var $lastWeek = false;
-
- /**
- * First day of the week (0=sunday, 1=monday...)
- * @access private
- * @var boolean
- */
- var $firstDay = 1;
-
- /**
- * Constructs Week
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $d a day of the desired week
- * @param int $firstDay (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
- *
- * @access public
- */
- function Calendar_Week($y, $m, $d, $firstDay = null)
- {
- include_once CALENDAR_ROOT.'Table/Helper.php';
- parent::Calendar($y, $m, $d);
- $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
- $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay);
- $this->thisWeek = $this->tableHelper->getWeekStart($y, $m, $d, $this->firstDay);
- $this->prevWeek = $this->tableHelper->getWeekStart(
- $y,
- $m,
- $d - $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- ),
- $this->firstDay
- );
- $this->nextWeek = $this->tableHelper->getWeekStart(
- $y,
- $m,
- $d + $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- ),
- $this->firstDay
- );
- }
-
- /**
- * Defines the calendar by a timestamp (Unix or ISO-8601), replacing values
- * passed to the constructor
- *
- * @param int|string $ts Unix or ISO-8601 timestamp
- *
- * @return void
- * @access public
- */
- function setTimestamp($ts)
- {
- parent::setTimestamp($ts);
- $this->thisWeek = $this->tableHelper->getWeekStart(
- $this->year, $this->month, $this->day, $this->firstDay
- );
- $this->prevWeek = $this->tableHelper->getWeekStart(
- $this->year,
- $this->month,
- $this->day - $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- ),
- $this->firstDay
- );
- $this->nextWeek = $this->tableHelper->getWeekStart(
- $this->year,
- $this->month,
- $this->day + $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- ),
- $this->firstDay
- );
- }
-
- /**
- * Builds Calendar_Day objects for this Week
- *
- * @param array $sDates (optional) Calendar_Day objects representing selected dates
- *
- * @return boolean
- * @access public
- */
- function build($sDates = array())
- {
- include_once CALENDAR_ROOT.'Day.php';
- $year = $this->cE->stampToYear($this->thisWeek);
- $month = $this->cE->stampToMonth($this->thisWeek);
- $day = $this->cE->stampToDay($this->thisWeek);
- $end = $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- );
-
- for ($i=1; $i <= $end; $i++) {
- $stamp = $this->cE->dateToStamp($year, $month, $day++);
- $this->children[$i] = new Calendar_Day(
- $this->cE->stampToYear($stamp),
- $this->cE->stampToMonth($stamp),
- $this->cE->stampToDay($stamp)
- );
- }
-
- //set empty days (@see Calendar_Month_Weeks::build())
- if ($this->firstWeek) {
- $eBefore = $this->tableHelper->getEmptyDaysBefore();
- for ($i=1; $i <= $eBefore; $i++) {
- $this->children[$i]->setEmpty();
- }
- }
- if ($this->lastWeek) {
- $eAfter = $this->tableHelper->getEmptyDaysAfterOffset();
- for ($i = $eAfter+1; $i <= $end; $i++) {
- $this->children[$i]->setEmpty();
- }
- }
-
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
- return true;
- }
-
- /**
- * Set as first week of the month
- *
- * @param boolean $state whether it's first or not
- *
- * @return void
- * @access private
- */
- function setFirst($state = true)
- {
- $this->firstWeek = $state;
- }
-
- /**
- * Set as last week of the month
- *
- * @param boolean $state whether it's lasst or not
- *
- * @return void
- * @access private
- */
- function setLast($state = true)
- {
- $this->lastWeek = $state;
- }
-
- /**
- * Called from build()
- *
- * @param array $sDates Calendar_Day objects representing selected dates
- *
- * @return void
- * @access private
- */
- function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- foreach ($this->children as $key => $child) {
- if ($child->thisDay() == $sDate->thisDay() &&
- $child->thisMonth() == $sDate->thisMonth() &&
- $child->thisYear() == $sDate->thisYear()
- ) {
- $this->children[$key] = $sDate;
- $this->children[$key]->setSelected();
- }
- }
- }
- reset($this->children);
- }
-
- /**
- * Returns the value for this year
- *
- * When a on the first/last week of the year, the year of the week is
- * calculated according to ISO-8601
- *
- * @param string $format return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 2003 or timestamp
- * @access public
- */
- function thisYear($format = 'int')
- {
- if (null !== $this->thisWeek) {
- $tmp_cal = new Calendar();
- $tmp_cal->setTimestamp($this->thisWeek);
- $first_dow = $tmp_cal->thisDay('array');
- $days_in_week = $tmp_cal->cE->getDaysInWeek($tmp_cal->year, $tmp_cal->month, $tmp_cal->day);
- $tmp_cal->day += $days_in_week;
- $last_dow = $tmp_cal->thisDay('array');
-
- if ($first_dow['year'] == $last_dow['year']) {
- return $first_dow['year'];
- }
-
- if ($last_dow['day'] > floor($days_in_week / 2)) {
- return $last_dow['year'];
- }
- return $first_dow['year'];
- }
- return parent::thisYear();
- }
-
- /**
- * Gets the value of the previous week, according to the requested format
- *
- * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
- *
- * @return mixed
- * @access public
- */
- function prevWeek($format = 'n_in_month')
- {
- switch (strtolower($format)) {
- case 'int':
- case 'n_in_month':
- return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
- case 'n_in_year':
- return $this->cE->getWeekNInYear(
- $this->cE->stampToYear($this->prevWeek),
- $this->cE->stampToMonth($this->prevWeek),
- $this->cE->stampToDay($this->prevWeek));
- case 'array':
- return $this->toArray($this->prevWeek);
- case 'object':
- include_once CALENDAR_ROOT.'Factory.php';
- return Calendar_Factory::createByTimestamp('Week', $this->prevWeek);
- case 'timestamp':
- default:
- return $this->prevWeek;
- }
- }
-
- /**
- * Gets the value of the current week, according to the requested format
- *
- * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
- *
- * @return mixed
- * @access public
- */
- function thisWeek($format = 'n_in_month')
- {
- switch (strtolower($format)) {
- case 'int':
- case 'n_in_month':
- if ($this->firstWeek) {
- return 1;
- }
- if ($this->lastWeek) {
- return $this->cE->getWeeksInMonth(
- $this->thisYear(),
- $this->thisMonth(),
- $this->firstDay);
- }
- return $this->cE->getWeekNInMonth(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay(),
- $this->firstDay);
- case 'n_in_year':
- return $this->cE->getWeekNInYear(
- $this->cE->stampToYear($this->thisWeek),
- $this->cE->stampToMonth($this->thisWeek),
- $this->cE->stampToDay($this->thisWeek));
- case 'array':
- return $this->toArray($this->thisWeek);
- case 'object':
- include_once CALENDAR_ROOT.'Factory.php';
- return Calendar_Factory::createByTimestamp('Week', $this->thisWeek);
- case 'timestamp':
- default:
- return $this->thisWeek;
- }
- }
-
- /**
- * Gets the value of the following week, according to the requested format
- *
- * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
- *
- * @return mixed
- * @access public
- */
- function nextWeek($format = 'n_in_month')
- {
- switch (strtolower($format)) {
- case 'int':
- case 'n_in_month':
- return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
- case 'n_in_year':
- return $this->cE->getWeekNInYear(
- $this->cE->stampToYear($this->nextWeek),
- $this->cE->stampToMonth($this->nextWeek),
- $this->cE->stampToDay($this->nextWeek));
- case 'array':
- return $this->toArray($this->nextWeek);
- case 'object':
- include_once CALENDAR_ROOT.'Factory.php';
- return Calendar_Factory::createByTimestamp('Week', $this->nextWeek);
- case 'timestamp':
- default:
- return $this->nextWeek;
- }
- }
-
- /**
- * Returns the instance of Calendar_Table_Helper.
- * Called from Calendar_Validator::isValidWeek
- *
- * @return Calendar_Table_Helper
- * @access protected
- */
- function & getHelper()
- {
- return $this->tableHelper;
- }
-
- /**
- * Makes sure theres a value for $this->day
- *
- * @return void
- * @access private
- */
- function findFirstDay()
- {
- if (!count($this->children) > 0) {
- $this->build();
- foreach ($this->children as $Day) {
- if (!$Day->isEmpty()) {
- $this->day = $Day->thisDay();
- break;
- }
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/Year.php b/airtime_mvc/library/pear/Calendar/Year.php
deleted file mode 100644
index a52f8dd25..000000000
--- a/airtime_mvc/library/pear/Calendar/Year.php
+++ /dev/null
@@ -1,140 +0,0 @@
-
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version CVS: $Id: Year.php 300728 2010-06-24 11:43:56Z quipo $
- * @link http://pear.php.net/package/Calendar
- */
-
-/**
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Year and builds Months
- *
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Year.php';
- * $Year = & new Calendar_Year(2003, 10, 21); // 21st Oct 2003
- * $Year->build(); // Build Calendar_Month objects
- * while ($Month = & $Year->fetch()) {
- * echo $Month->thisMonth().'
';
- * }
- *
- *
- * @category Date and Time
- * @package Calendar
- * @author Harry Fuecks
- * @copyright 2003-2007 Harry Fuecks
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @link http://pear.php.net/package/Calendar
- * @access public
- */
-class Calendar_Year extends Calendar
-{
- /**
- * Constructs Calendar_Year
- *
- * @param int $y year e.g. 2003
- *
- * @access public
- */
- function Calendar_Year($y)
- {
- parent::Calendar($y);
- }
-
- /**
- * Builds the Months of the Year.
- * Note: by defining the constant CALENDAR_MONTH_STATE you can
- * control what class of Calendar_Month is built e.g.;
- *
- * require_once 'Calendar/Calendar_Year.php';
- * define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); // Use Calendar_Month_Weekdays
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); // Use Calendar_Month_Weeks
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH); // Use Calendar_Month
- *
- * It defaults to building Calendar_Month objects.
- *
- * @param array $sDates (optional) array of Calendar_Month objects
- * representing selected dates
- * @param int $firstDay (optional) first day of week
- * (e.g. 0 for Sunday, 2 for Tuesday etc.)
- *
- * @return boolean
- * @access public
- */
- function build($sDates = array(), $firstDay = null)
- {
- include_once CALENDAR_ROOT.'Factory.php';
- $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
- $monthsInYear = $this->cE->getMonthsInYear($this->thisYear());
- for ($i=1; $i <= $monthsInYear; $i++) {
- $this->children[$i] = Calendar_Factory::create('Month', $this->year, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array $sDates array of Calendar_Month objects representing selected dates
- *
- * @return void
- * @access private
- */
- function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()) {
- $key = $sDate->thisMonth();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/Readme b/airtime_mvc/library/pear/Calendar/docs/Readme
deleted file mode 100644
index 6bacca0f3..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/Readme
+++ /dev/null
@@ -1,3 +0,0 @@
-Readme
-
-See the PEAR manual at http://pear.php.net/manual/en/package.datetime.calendar.php for details.
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/1.php b/airtime_mvc/library/pear/Calendar/docs/examples/1.php
deleted file mode 100644
index 662a17da5..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/1.php
+++ /dev/null
@@ -1,92 +0,0 @@
-' );
-echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'
' );
-
-$i = 1;
-echo ( 'First Iteration
' );
-echo ( 'The first iteration is more "expensive", the calendar data
- structures having to be built.
' );
-$start = getmicrotime();
-$c->build();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-
-$i = 1;
-echo ( 'Second Iteration
' );
-echo ( 'This second iteration is faster, the data structures
- being re-used
' );
-$start = getmicrotime();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/1.phps b/airtime_mvc/library/pear/Calendar/docs/examples/1.phps
deleted file mode 100644
index 662a17da5..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/1.phps
+++ /dev/null
@@ -1,92 +0,0 @@
-' );
-echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'
' );
-
-$i = 1;
-echo ( 'First Iteration
' );
-echo ( 'The first iteration is more "expensive", the calendar data
- structures having to be built.
' );
-$start = getmicrotime();
-$c->build();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-
-$i = 1;
-echo ( 'Second Iteration
' );
-echo ( 'This second iteration is faster, the data structures
- being re-used
' );
-$start = getmicrotime();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/10.php b/airtime_mvc/library/pear/Calendar/docs/examples/10.php
deleted file mode 100644
index c9d92e026..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/10.php
+++ /dev/null
@@ -1,93 +0,0 @@
-build();
-?>
-
-
-
-
- A Simple Decorator
-
-
-A Simple Decorator
-
-thisMonth() ); ?>
-fetch() ) {
- if ( $Day->isFirst() ) {
- echo ( "\n\n" );
- }
- if ( $Day->isEmpty() ) {
- echo ( " | " );
- } else {
- echo ( "".$Day->thisDay()." | " );
- }
- if ( $Day->isLast() ) {
- echo ( "\n
\n" );
- }
-}
-?>
-
-Prev |
- |
-Next |
-
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/10.phps b/airtime_mvc/library/pear/Calendar/docs/examples/10.phps
deleted file mode 100644
index c9d92e026..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/10.phps
+++ /dev/null
@@ -1,93 +0,0 @@
-build();
-?>
-
-
-
-
- A Simple Decorator
-
-
-A Simple Decorator
-
-thisMonth() ); ?>
-fetch() ) {
- if ( $Day->isFirst() ) {
- echo ( "\n\n" );
- }
- if ( $Day->isEmpty() ) {
- echo ( " | " );
- } else {
- echo ( "".$Day->thisDay()." | " );
- }
- if ( $Day->isLast() ) {
- echo ( "\n
\n" );
- }
-}
-?>
-
-Prev |
- |
-Next |
-
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/11.php b/airtime_mvc/library/pear/Calendar/docs/examples/11.php
deleted file mode 100644
index 281dc8c70..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/11.php
+++ /dev/null
@@ -1,109 +0,0 @@
-entry = $entry;
- }
- function getEntry() {
- return $this->entry;
- }
-}
-
-// Create a day to view the hours for
-$Day = & new Calendar_Day(2003,10,24);
-
-// A sample query to get the data for today (NOT ACTUALLY USED HERE)
-$sql = "
- SELECT
- *
- FROM
- diary
- WHERE
- eventtime >= '".$Day->thisDay(TRUE)."'
- AND
- eventtime < '".$Day->nextDay(TRUE)."';";
-
-// An array simulating data from a database
-$result = array (
- array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'),
- array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'),
- array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors')
- );
-
-// An array to place selected hours in
-$selection = array();
-
-// Loop through the "database result"
-foreach ( $result as $row ) {
- $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values
- $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp
-
- // Create the decorator, passing it the Hour
- $DiaryEvent = new DiaryEvent($Hour);
-
- // Attach the payload
- $DiaryEvent->setEntry($row['entry']);
-
- // Add the decorator to the selection
- $selection[] = $DiaryEvent;
-}
-
-// Build the hours in that day, passing the selection
-$Day->build($selection);
-?>
-
-
-
- Passing a Selection Payload with a Decorator
-
-
-Passing a Selection "Payload" using a Decorator
-
-Your Schedule for thisDay(TRUE)) ); ?>
-
-Time |
-Entry |
-
-fetch() ) {
-
- $hour = $Hour->thisHour();
- $minute = $Hour->thisMinute();
-
- // Office hours only...
- if ( $hour >= 8 && $hour <= 18 ) {
- echo ( "\n" );
- echo ( "$hour:$minute | \n" );
-
- // If the hour is selected, call the decorator method...
- if ( $Hour->isSelected() ) {
- echo ( "".$Hour->getEntry()." | \n" );
- } else {
- echo ( " | \n" );
- }
- echo ( "
\n" );
- }
-}
-?>
-
-The query to fetch this data, with help from PEAR::Calendar, might be;
-
-
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/11.phps b/airtime_mvc/library/pear/Calendar/docs/examples/11.phps
deleted file mode 100644
index 281dc8c70..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/11.phps
+++ /dev/null
@@ -1,109 +0,0 @@
-entry = $entry;
- }
- function getEntry() {
- return $this->entry;
- }
-}
-
-// Create a day to view the hours for
-$Day = & new Calendar_Day(2003,10,24);
-
-// A sample query to get the data for today (NOT ACTUALLY USED HERE)
-$sql = "
- SELECT
- *
- FROM
- diary
- WHERE
- eventtime >= '".$Day->thisDay(TRUE)."'
- AND
- eventtime < '".$Day->nextDay(TRUE)."';";
-
-// An array simulating data from a database
-$result = array (
- array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'),
- array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'),
- array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors')
- );
-
-// An array to place selected hours in
-$selection = array();
-
-// Loop through the "database result"
-foreach ( $result as $row ) {
- $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values
- $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp
-
- // Create the decorator, passing it the Hour
- $DiaryEvent = new DiaryEvent($Hour);
-
- // Attach the payload
- $DiaryEvent->setEntry($row['entry']);
-
- // Add the decorator to the selection
- $selection[] = $DiaryEvent;
-}
-
-// Build the hours in that day, passing the selection
-$Day->build($selection);
-?>
-
-
-
- Passing a Selection Payload with a Decorator
-
-
-Passing a Selection "Payload" using a Decorator
-
-Your Schedule for thisDay(TRUE)) ); ?>
-
-Time |
-Entry |
-
-fetch() ) {
-
- $hour = $Hour->thisHour();
- $minute = $Hour->thisMinute();
-
- // Office hours only...
- if ( $hour >= 8 && $hour <= 18 ) {
- echo ( "\n" );
- echo ( "$hour:$minute | \n" );
-
- // If the hour is selected, call the decorator method...
- if ( $Hour->isSelected() ) {
- echo ( "".$Hour->getEntry()." | \n" );
- } else {
- echo ( " | \n" );
- }
- echo ( "
\n" );
- }
-}
-?>
-
-The query to fetch this data, with help from PEAR::Calendar, might be;
-
-
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/12.php b/airtime_mvc/library/pear/Calendar/docs/examples/12.php
deleted file mode 100644
index 0096d21ce..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/12.php
+++ /dev/null
@@ -1,116 +0,0 @@
-build();
-?>
-
-
-
- thisYear() ); ?>
-
-
-
-
-
-thisYear() ); ?>
-
-
-
-fetch() ) {
-
- switch ( $i ) {
- case 0:
- echo ( "\n" );
- break;
- case 3:
- case 6:
- case 9:
- echo ( "
\n\n" );
- break;
- case 12:
- echo ( "
\n" );
- break;
- }
-
- echo ( "\n\n" );
- echo ( "".date('F',$Month->thisMonth(TRUE))."" );
- echo ( "\nM | T | W | T | F | S | S | \n " );
- $Month->build();
- while ( $Day = $Month->fetch() ) {
- if ( $Day->isFirst() ) {
- echo ( "\n" );
- }
- if ( $Day->isEmpty() ) {
- echo ( " | \n" );
- } else {
- echo ( "".$Day->thisDay()." | \n" );
- }
- if ( $Day->isLast() ) {
- echo ( " \n" );
- }
- }
- echo ( " \n | \n" );
-
- $i++;
-}
-?>
-
-Took:
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/12.phps b/airtime_mvc/library/pear/Calendar/docs/examples/12.phps
deleted file mode 100644
index 0096d21ce..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/12.phps
+++ /dev/null
@@ -1,116 +0,0 @@
-build();
-?>
-
-
-
- thisYear() ); ?>
-
-
-
-
-
-thisYear() ); ?>
-
-
-
-fetch() ) {
-
- switch ( $i ) {
- case 0:
- echo ( "\n" );
- break;
- case 3:
- case 6:
- case 9:
- echo ( "
\n\n" );
- break;
- case 12:
- echo ( "
\n" );
- break;
- }
-
- echo ( "\n\n" );
- echo ( "".date('F',$Month->thisMonth(TRUE))."" );
- echo ( "\nM | T | W | T | F | S | S | \n " );
- $Month->build();
- while ( $Day = $Month->fetch() ) {
- if ( $Day->isFirst() ) {
- echo ( "\n" );
- }
- if ( $Day->isEmpty() ) {
- echo ( " | \n" );
- } else {
- echo ( "".$Day->thisDay()." | \n" );
- }
- if ( $Day->isLast() ) {
- echo ( " \n" );
- }
- }
- echo ( " \n | \n" );
-
- $i++;
-}
-?>
-
-Took:
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/13.php b/airtime_mvc/library/pear/Calendar/docs/examples/13.php
deleted file mode 100644
index 4fb0f317e..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/13.php
+++ /dev/null
@@ -1,99 +0,0 @@
-getTimestamp());
-
-echo ( 'Using PEAR::Date engine
' );
-echo ( 'Viewing: '.@$_GET['view'].'
' );
-echo ( 'The time is now: '.$date->format('%Y %a %e %T').'
' );
-
-$i = 1;
-echo ( 'First Iteration
' );
-echo ( 'The first iteration is more "expensive", the calendar data
- structures having to be built.
' );
-$start = getmicrotime();
-$c->build();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-
-$i = 1;
-echo ( 'Second Iteration
' );
-echo ( 'This second iteration is faster, the data structures
- being re-used
' );
-$start = getmicrotime();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/13.phps b/airtime_mvc/library/pear/Calendar/docs/examples/13.phps
deleted file mode 100644
index 4fb0f317e..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/13.phps
+++ /dev/null
@@ -1,99 +0,0 @@
-getTimestamp());
-
-echo ( 'Using PEAR::Date engine
' );
-echo ( 'Viewing: '.@$_GET['view'].'
' );
-echo ( 'The time is now: '.$date->format('%Y %a %e %T').'
' );
-
-$i = 1;
-echo ( 'First Iteration
' );
-echo ( 'The first iteration is more "expensive", the calendar data
- structures having to be built.
' );
-$start = getmicrotime();
-$c->build();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-
-$i = 1;
-echo ( 'Second Iteration
' );
-echo ( 'This second iteration is faster, the data structures
- being re-used
' );
-$start = getmicrotime();
-while ( $e = $c->fetch() ) {
- $class = strtolower(get_class($e));
- $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay().
- "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond();
- $method = 'this'.str_replace('calendar_','',$class);
- echo ( "".$e->{$method}()." : " );
- if ( ($i % 10) == 0 ) {
- echo ( '
' );
- }
- $i++;
-}
-echo ( 'Took: '.(getmicrotime()-$start).' seconds
' );
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/14.php b/airtime_mvc/library/pear/Calendar/docs/examples/14.php
deleted file mode 100644
index b1c520c80..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/14.php
+++ /dev/null
@@ -1,141 +0,0 @@
-build($selectedDays);
-
-// Construct strings for next/previous links
-$PMonth = $month->prevMonth('object'); // Get previous month as object
-$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
-$NMonth = $month->nextMonth('object');
-$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
-
-$thisDate = new Date($month->thisMonth('timestamp'));
-?>
-
-
-
- Calendar using PEAR::Date Engine
-
-
-
-
-
-Calendar using PEAR::Date Engine
-
-
-format('%B %Y'); ?>
-
-
-M |
-T |
-W |
-T |
-F |
-S |
-S |
-
-fetch()) {
- // Build a link string for each day
- $link = $_SERVER['PHP_SELF'].
- '?y='.$day->thisYear().
- '&m='.$day->thisMonth().
- '&d='.$day->thisDay();
-
- // isFirst() to find start of week
- if ($day->isFirst())
- echo "\n";
-
- if ($day->isSelected()) {
- echo ''.$day->thisDay().' | '."\n";
- } else if ($day->isEmpty()) {
- echo ' | '."\n";
- } else {
- echo ''.$day->thisDay().' | '."\n";
- }
-
- // isLast() to find end of week
- if ($day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
-
-<<
- |
- |
-
- >>
- |
-
-
-Took: '.(getmicrotime()-$start).' seconds
';
-?>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/14.phps b/airtime_mvc/library/pear/Calendar/docs/examples/14.phps
deleted file mode 100644
index b1c520c80..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/14.phps
+++ /dev/null
@@ -1,141 +0,0 @@
-build($selectedDays);
-
-// Construct strings for next/previous links
-$PMonth = $month->prevMonth('object'); // Get previous month as object
-$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
-$NMonth = $month->nextMonth('object');
-$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
-
-$thisDate = new Date($month->thisMonth('timestamp'));
-?>
-
-
-
- Calendar using PEAR::Date Engine
-
-
-
-
-
-Calendar using PEAR::Date Engine
-
-
-format('%B %Y'); ?>
-
-
-M |
-T |
-W |
-T |
-F |
-S |
-S |
-
-fetch()) {
- // Build a link string for each day
- $link = $_SERVER['PHP_SELF'].
- '?y='.$day->thisYear().
- '&m='.$day->thisMonth().
- '&d='.$day->thisDay();
-
- // isFirst() to find start of week
- if ($day->isFirst())
- echo "\n";
-
- if ($day->isSelected()) {
- echo ''.$day->thisDay().' | '."\n";
- } else if ($day->isEmpty()) {
- echo ' | '."\n";
- } else {
- echo ''.$day->thisDay().' | '."\n";
- }
-
- // isLast() to find end of week
- if ($day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
-
-<<
- |
- |
-
- >>
- |
-
-
-Took: '.(getmicrotime()-$start).' seconds';
-?>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/15.php b/airtime_mvc/library/pear/Calendar/docs/examples/15.php
deleted file mode 100644
index c13adc563..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/15.php
+++ /dev/null
@@ -1,58 +0,0 @@
-getValidator();
-if (!$Validator->isValidWeek()) {
- die ('Please enter a valid week!');
-}
-*/
-?>
-
-
-
- Paging Weeks
-
-
-Paging Weeks
-Week: thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?>
-build();
-while ($Day = $Week->fetch()) {
- echo ''.date('jS F',$Day->thisDay(true))."
\n";
-}
-$days = $Week->fetchAll();
-
-$prevWeek = $Week->prevWeek('array');
-$prevWeekLink = $_SERVER['PHP_SELF'].
- '?y='.$prevWeek['year'].
- '&m='.$prevWeek['month'].
- '&d='.$prevWeek['day'];
-
-$nextWeek = $Week->nextWeek('array');
-$nextWeekLink = $_SERVER['PHP_SELF'].
- '?y='.$nextWeek['year'].
- '&m='.$nextWeek['month'].
- '&d='.$nextWeek['day'];
-?>
-<< | >>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/15.phps b/airtime_mvc/library/pear/Calendar/docs/examples/15.phps
deleted file mode 100644
index c13adc563..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/15.phps
+++ /dev/null
@@ -1,58 +0,0 @@
-getValidator();
-if (!$Validator->isValidWeek()) {
- die ('Please enter a valid week!');
-}
-*/
-?>
-
-
-
- Paging Weeks
-
-
-Paging Weeks
-Week: thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?>
-build();
-while ($Day = $Week->fetch()) {
- echo ''.date('jS F',$Day->thisDay(true))."
\n";
-}
-$days = $Week->fetchAll();
-
-$prevWeek = $Week->prevWeek('array');
-$prevWeekLink = $_SERVER['PHP_SELF'].
- '?y='.$prevWeek['year'].
- '&m='.$prevWeek['month'].
- '&d='.$prevWeek['day'];
-
-$nextWeek = $Week->nextWeek('array');
-$nextWeekLink = $_SERVER['PHP_SELF'].
- '?y='.$nextWeek['year'].
- '&m='.$nextWeek['month'].
- '&d='.$nextWeek['day'];
-?>
-<< | >>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/16.php b/airtime_mvc/library/pear/Calendar/docs/examples/16.php
deleted file mode 100644
index 2551708a3..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/16.php
+++ /dev/null
@@ -1,31 +0,0 @@
-The current month is '
- .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'');
-
-$Uri = & new Calendar_Decorator_Uri($Calendar);
-$Uri->setFragments('jahr','monat');
-// $Uri->setSeperator('/'); // Default is &
-// $Uri->setScalar(); // Omit variable names
-echo ( "Previous Uri:\t".$Uri->prev('month')."\n" );
-echo ( "This Uri:\t".$Uri->this('month')."\n" );
-echo ( "Next Uri:\t".$Uri->next('month')."\n
" );
-?>
-
-Prev :
-Next
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/16.phps b/airtime_mvc/library/pear/Calendar/docs/examples/16.phps
deleted file mode 100644
index 2551708a3..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/16.phps
+++ /dev/null
@@ -1,31 +0,0 @@
-The current month is '
- .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'');
-
-$Uri = & new Calendar_Decorator_Uri($Calendar);
-$Uri->setFragments('jahr','monat');
-// $Uri->setSeperator('/'); // Default is &
-// $Uri->setScalar(); // Omit variable names
-echo ( "Previous Uri:\t".$Uri->prev('month')."\n" );
-echo ( "This Uri:\t".$Uri->this('month')."\n" );
-echo ( "Next Uri:\t".$Uri->next('month')."\n
" );
-?>
-
-Prev :
-Next
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/17.php b/airtime_mvc/library/pear/Calendar/docs/examples/17.php
deleted file mode 100644
index 0cfebce3c..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/17.php
+++ /dev/null
@@ -1,71 +0,0 @@
-Calling: Calendar_Decorator_Textual::monthNames('long');";
-print_r(Calendar_Decorator_Textual::monthNames('long'));
-echo '
';
-
-echo "
Calling: Calendar_Decorator_Textual::weekdayNames('two');";
-print_r(Calendar_Decorator_Textual::weekdayNames('two'));
-echo '
';
-
-echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
";
-$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
-
-// Decorate
-$Textual = & new Calendar_Decorator_Textual($Calendar);
-
-echo '
Previous month is: '.$Textual->prevMonthName('two').'
';
-echo 'This month is: '.$Textual->thisMonthName('short').'
';
-echo 'Next month is: '.$Textual->nextMonthName().'
';
-echo 'Previous day is: '.$Textual->prevDayName().'
';
-echo 'This day is: '.$Textual->thisDayName('short').'
';
-echo 'Next day is: '.$Textual->nextDayName('one').'
';
-
-echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
";
-$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
-
-// Decorate
-$Textual = & new Calendar_Decorator_Textual($Calendar);
-?>
-Rendering calendar....
-
-thisMonthName().' '.$Textual->thisYear(); ?>
-
-orderedWeekdays('short');
-foreach ($dayheaders as $dayheader) {
- echo ''.$dayheader.' | ';
-}
-?>
-
-build();
-while ($Day = $Calendar->fetch()) {
- if ($Day->isFirst()) {
- echo "\n";
- }
- if ($Day->isEmpty()) {
- echo ' | ';
- } else {
- echo ''.$Day->thisDay().' | ';
- }
- if ($Day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/17.phps b/airtime_mvc/library/pear/Calendar/docs/examples/17.phps
deleted file mode 100644
index 0cfebce3c..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/17.phps
+++ /dev/null
@@ -1,71 +0,0 @@
-Calling: Calendar_Decorator_Textual::monthNames('long');";
-print_r(Calendar_Decorator_Textual::monthNames('long'));
-echo '
';
-
-echo "
Calling: Calendar_Decorator_Textual::weekdayNames('two');";
-print_r(Calendar_Decorator_Textual::weekdayNames('two'));
-echo '
';
-
-echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
";
-$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
-
-// Decorate
-$Textual = & new Calendar_Decorator_Textual($Calendar);
-
-echo '
Previous month is: '.$Textual->prevMonthName('two').'
';
-echo 'This month is: '.$Textual->thisMonthName('short').'
';
-echo 'Next month is: '.$Textual->nextMonthName().'
';
-echo 'Previous day is: '.$Textual->prevDayName().'
';
-echo 'This day is: '.$Textual->thisDayName('short').'
';
-echo 'Next day is: '.$Textual->nextDayName('one').'
';
-
-echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
";
-$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
-
-// Decorate
-$Textual = & new Calendar_Decorator_Textual($Calendar);
-?>
-Rendering calendar....
-
-thisMonthName().' '.$Textual->thisYear(); ?>
-
-orderedWeekdays('short');
-foreach ($dayheaders as $dayheader) {
- echo ''.$dayheader.' | ';
-}
-?>
-
-build();
-while ($Day = $Calendar->fetch()) {
- if ($Day->isFirst()) {
- echo "\n";
- }
- if ($Day->isEmpty()) {
- echo ' | ';
- } else {
- echo ''.$Day->thisDay().' | ';
- }
- if ($Day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/18.php b/airtime_mvc/library/pear/Calendar/docs/examples/18.php
deleted file mode 100644
index 7ec2a4988..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/18.php
+++ /dev/null
@@ -1,36 +0,0 @@
-'.parent::thisDay().'';
- }
-}
-
-$Month = new Calendar_Month(date('Y'), date('n'));
-
-$Wrapper = & new Calendar_Decorator_Wrapper($Month);
-$Wrapper->build();
-
-echo 'The Wrapper decorator
';
-echo 'Day numbers are rendered in bold
';
-while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
- echo $DecoratedDay->thisDay().'
';
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/18.phps b/airtime_mvc/library/pear/Calendar/docs/examples/18.phps
deleted file mode 100644
index 7ec2a4988..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/18.phps
+++ /dev/null
@@ -1,36 +0,0 @@
-'.parent::thisDay().'';
- }
-}
-
-$Month = new Calendar_Month(date('Y'), date('n'));
-
-$Wrapper = & new Calendar_Decorator_Wrapper($Month);
-$Wrapper->build();
-
-echo 'The Wrapper decorator
';
-echo 'Day numbers are rendered in bold
';
-while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
- echo $DecoratedDay->thisDay().'
';
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/19.php b/airtime_mvc/library/pear/Calendar/docs/examples/19.php
deleted file mode 100644
index e46d10759..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/19.php
+++ /dev/null
@@ -1,24 +0,0 @@
-setFirstDay(0); // Make Sunday first Day
-
-echo 'Yesterday: '.$WeekDay->prevWeekDay().'
';
-echo 'Today: '.$WeekDay->thisWeekDay().'
';
-echo 'Tomorrow: '.$WeekDay->nextWeekDay().'
';
-
-$WeekDay->build();
-echo 'Hours today:
';
-while ( $Hour = $WeekDay->fetch() ) {
- echo $Hour->thisHour().'
';
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/19.phps b/airtime_mvc/library/pear/Calendar/docs/examples/19.phps
deleted file mode 100644
index e46d10759..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/19.phps
+++ /dev/null
@@ -1,24 +0,0 @@
-setFirstDay(0); // Make Sunday first Day
-
-echo 'Yesterday: '.$WeekDay->prevWeekDay().'
';
-echo 'Today: '.$WeekDay->thisWeekDay().'
';
-echo 'Tomorrow: '.$WeekDay->nextWeekDay().'
';
-
-$WeekDay->build();
-echo 'Hours today:
';
-while ( $Hour = $WeekDay->fetch() ) {
- echo $Hour->thisHour().'
';
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/2.php b/airtime_mvc/library/pear/Calendar/docs/examples/2.php
deleted file mode 100644
index 38de8a7ac..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/2.php
+++ /dev/null
@@ -1,142 +0,0 @@
-build();
-
-// Construct strings for next/previous links
-$PMonth = $Month->prevMonth('object'); // Get previous month as object
-$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
-$NMonth = $Month->nextMonth('object');
-$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
-?>
-
-
-
- Calendar
-
-
-
-
-Build with Calendar_Month_Weeks::build() then Calendar_Week::build()
-
-
-getTimeStamp()); ?>
-
-
-M |
-T |
-W |
-T |
-F |
-S |
-S |
-
-fetch()) {
- echo "\n";
- // Build the days in the week, passing the selected days
- $Week->build($selectedDays);
- while ($Day = $Week->fetch()) {
-
- // Build a link string for each day
- $link = $_SERVER['PHP_SELF'].
- '?y='.$Day->thisYear().
- '&m='.$Day->thisMonth().
- '&d='.$Day->thisDay();
-
- // Check to see if day is selected
- if ($Day->isSelected()) {
- echo ''.$Day->thisDay().' | '."\n";
- // Check to see if day is empty
- } else if ($Day->isEmpty()) {
- echo ''.$Day->thisDay().' | '."\n";
- } else {
- echo ''.$Day->thisDay().' | '."\n";
- }
- }
- echo '
'."\n";
-}
-?>
-
-
-<<
- |
- |
-
- >>
- |
-
-
-Took: '.(getmicrotime()-$start).' seconds';
-?>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/2.phps b/airtime_mvc/library/pear/Calendar/docs/examples/2.phps
deleted file mode 100644
index 38de8a7ac..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/2.phps
+++ /dev/null
@@ -1,142 +0,0 @@
-build();
-
-// Construct strings for next/previous links
-$PMonth = $Month->prevMonth('object'); // Get previous month as object
-$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
-$NMonth = $Month->nextMonth('object');
-$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
-?>
-
-
-
- Calendar
-
-
-
-
-Build with Calendar_Month_Weeks::build() then Calendar_Week::build()
-
-
-getTimeStamp()); ?>
-
-
-M |
-T |
-W |
-T |
-F |
-S |
-S |
-
-fetch()) {
- echo "\n";
- // Build the days in the week, passing the selected days
- $Week->build($selectedDays);
- while ($Day = $Week->fetch()) {
-
- // Build a link string for each day
- $link = $_SERVER['PHP_SELF'].
- '?y='.$Day->thisYear().
- '&m='.$Day->thisMonth().
- '&d='.$Day->thisDay();
-
- // Check to see if day is selected
- if ($Day->isSelected()) {
- echo ''.$Day->thisDay().' | '."\n";
- // Check to see if day is empty
- } else if ($Day->isEmpty()) {
- echo ''.$Day->thisDay().' | '."\n";
- } else {
- echo ''.$Day->thisDay().' | '."\n";
- }
- }
- echo '
'."\n";
-}
-?>
-
-
-<<
- |
- |
-
- >>
- |
-
-
-Took: '.(getmicrotime()-$start).' seconds';
-?>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/20.php b/airtime_mvc/library/pear/Calendar/docs/examples/20.php
deleted file mode 100644
index 31b868bbc..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/20.php
+++ /dev/null
@@ -1,240 +0,0 @@
-entries[] = $entry;
- }
-
- function getEntry() {
- $entry = each($this->entries);
- if ($entry) {
- return $entry['value'];
- } else {
- reset($this->entries);
- return false;
- }
- }
-}
-
-class MonthPayload_Decorator extends Calendar_Decorator
-{
- //Calendar engine
- var $cE;
- var $tableHelper;
-
- var $year;
- var $month;
- var $firstDay = false;
-
- function build($events=array())
- {
- require_once CALENDAR_ROOT . 'Day.php';
- require_once CALENDAR_ROOT . 'Table/Helper.php';
-
- $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay);
- $this->cE = & $this->getEngine();
- $this->year = $this->thisYear();
- $this->month = $this->thisMonth();
-
- $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
- for ($i=1; $i<=$daysInMonth; $i++) {
- $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values
- $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i));
- $this->children[$i] = new DiaryEvent($Day);
- }
- if (count($events) > 0) {
- $this->setSelection($events);
- }
- Calendar_Month_Weekdays::buildEmptyDaysBefore();
- Calendar_Month_Weekdays::shiftDays();
- Calendar_Month_Weekdays::buildEmptyDaysAfter();
- Calendar_Month_Weekdays::setWeekMarkers();
- return true;
- }
-
- function setSelection($events)
- {
- $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
- for ($i=1; $i<=$daysInMonth; $i++) {
- $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i);
- $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1);
- foreach ($events as $event) {
- if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) ||
- ($stamp2 >= $event['start'] && $stamp2 < $event['end']) ||
- ($stamp1 <= $event['start'] && $stamp2 > $event['end'])
- ) {
- $this->children[$i]->addEntry($event);
- $this->children[$i]->setSelected();
- }
- }
- }
- }
-
- function fetch()
- {
- $child = each($this->children);
- if ($child) {
- return $child['value'];
- } else {
- reset($this->children);
- return false;
- }
- }
-}
-
-// Calendar instance used to get the dates in the preferred format:
-// you can switch Calendar Engine and the example still works
-$cal = new Calendar;
-
-$events = array();
-//add some events
-$events[] = array(
- 'start' => $cal->cE->dateToStamp(2004, 6, 1, 10),
- 'end' => $cal->cE->dateToStamp(2004, 6, 1, 12),
- 'desc' => 'Important meeting'
-);
-$events[] = array(
- 'start' => $cal->cE->dateToStamp(2004, 6, 1, 21),
- 'end' => $cal->cE->dateToStamp(2004, 6, 1, 23, 59),
- 'desc' => 'Dinner with the boss'
-);
-$events[] = array(
- 'start' => $cal->cE->dateToStamp(2004, 6, 5),
- 'end' => $cal->cE->dateToStamp(2004, 6, 10, 23, 59),
- 'desc' => 'Holidays!'
-);
-
-
-
-$Month = & new Calendar_Month_Weekdays(2004, 6);
-$MonthDecorator = new MonthPayload_Decorator($Month);
-$MonthDecorator->build($events);
-
-?>
-
-
-
- Calendar
-
-
-
-
-
-Sample Calendar Payload Decorator (using engine)
-
-
- thisMonth().' / '.$MonthDecorator->thisYear(); ?>
-
-
- Monday |
- Tuesday |
- Wednesday |
- Thursday |
- Friday |
- Saturday |
- Sunday |
-
-fetch()) {
-
- if ($Day->isFirst()) {
- echo "\n";
- }
-
- echo '';
- echo ' '.$Day->thisDay().' ';
-
- if ($Day->isEmpty()) {
- echo ' ';
- } else {
- echo '';
- while ($entry = $Day->getEntry()) {
- echo '- '.$entry['desc'].'
';
- //you can print the time range as well
- }
- echo ' ';
- }
- echo ' | ';
-
- if ($Day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/20.phps b/airtime_mvc/library/pear/Calendar/docs/examples/20.phps
deleted file mode 100644
index 31b868bbc..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/20.phps
+++ /dev/null
@@ -1,240 +0,0 @@
-entries[] = $entry;
- }
-
- function getEntry() {
- $entry = each($this->entries);
- if ($entry) {
- return $entry['value'];
- } else {
- reset($this->entries);
- return false;
- }
- }
-}
-
-class MonthPayload_Decorator extends Calendar_Decorator
-{
- //Calendar engine
- var $cE;
- var $tableHelper;
-
- var $year;
- var $month;
- var $firstDay = false;
-
- function build($events=array())
- {
- require_once CALENDAR_ROOT . 'Day.php';
- require_once CALENDAR_ROOT . 'Table/Helper.php';
-
- $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay);
- $this->cE = & $this->getEngine();
- $this->year = $this->thisYear();
- $this->month = $this->thisMonth();
-
- $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
- for ($i=1; $i<=$daysInMonth; $i++) {
- $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values
- $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i));
- $this->children[$i] = new DiaryEvent($Day);
- }
- if (count($events) > 0) {
- $this->setSelection($events);
- }
- Calendar_Month_Weekdays::buildEmptyDaysBefore();
- Calendar_Month_Weekdays::shiftDays();
- Calendar_Month_Weekdays::buildEmptyDaysAfter();
- Calendar_Month_Weekdays::setWeekMarkers();
- return true;
- }
-
- function setSelection($events)
- {
- $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
- for ($i=1; $i<=$daysInMonth; $i++) {
- $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i);
- $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1);
- foreach ($events as $event) {
- if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) ||
- ($stamp2 >= $event['start'] && $stamp2 < $event['end']) ||
- ($stamp1 <= $event['start'] && $stamp2 > $event['end'])
- ) {
- $this->children[$i]->addEntry($event);
- $this->children[$i]->setSelected();
- }
- }
- }
- }
-
- function fetch()
- {
- $child = each($this->children);
- if ($child) {
- return $child['value'];
- } else {
- reset($this->children);
- return false;
- }
- }
-}
-
-// Calendar instance used to get the dates in the preferred format:
-// you can switch Calendar Engine and the example still works
-$cal = new Calendar;
-
-$events = array();
-//add some events
-$events[] = array(
- 'start' => $cal->cE->dateToStamp(2004, 6, 1, 10),
- 'end' => $cal->cE->dateToStamp(2004, 6, 1, 12),
- 'desc' => 'Important meeting'
-);
-$events[] = array(
- 'start' => $cal->cE->dateToStamp(2004, 6, 1, 21),
- 'end' => $cal->cE->dateToStamp(2004, 6, 1, 23, 59),
- 'desc' => 'Dinner with the boss'
-);
-$events[] = array(
- 'start' => $cal->cE->dateToStamp(2004, 6, 5),
- 'end' => $cal->cE->dateToStamp(2004, 6, 10, 23, 59),
- 'desc' => 'Holidays!'
-);
-
-
-
-$Month = & new Calendar_Month_Weekdays(2004, 6);
-$MonthDecorator = new MonthPayload_Decorator($Month);
-$MonthDecorator->build($events);
-
-?>
-
-
-
- Calendar
-
-
-
-
-
-Sample Calendar Payload Decorator (using engine)
-
-
- thisMonth().' / '.$MonthDecorator->thisYear(); ?>
-
-
- Monday |
- Tuesday |
- Wednesday |
- Thursday |
- Friday |
- Saturday |
- Sunday |
-
-fetch()) {
-
- if ($Day->isFirst()) {
- echo "\n";
- }
-
- echo '';
- echo ' '.$Day->thisDay().' ';
-
- if ($Day->isEmpty()) {
- echo ' ';
- } else {
- echo '';
- while ($entry = $Day->getEntry()) {
- echo '- '.$entry['desc'].'
';
- //you can print the time range as well
- }
- echo ' ';
- }
- echo ' | ';
-
- if ($Day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/21.php b/airtime_mvc/library/pear/Calendar/docs/examples/21.php
deleted file mode 100644
index dbdd68aec..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/21.php
+++ /dev/null
@@ -1,139 +0,0 @@
-build();
-?>
-
-
-
- thisYear(); ?>
-
-
-
-
-
-thisYear(); ?>
-
-
-
-
-fetch()) {
-
- switch ($i) {
- case 0:
- echo "\n";
- break;
- case 3:
- case 6:
- case 9:
- echo "
\n\n";
- break;
- case 12:
- echo "
\n";
- break;
- }
-
- echo "\n\n";
- echo ''.date('F', $Month->thisMonth(TRUE)).'';
- echo ''."\n";
- echo "\nWeek | M | T | W | T | F | S | S | \n ";
- $Month->build();
- while ($Week = $Month->fetch()) {
- echo "\n";
- echo ''.$Week->thisWeek($_GET['week_type'])." | \n";
- $Week->build();
-
- while ($Day = $Week->fetch()) {
- if ($Day->isEmpty()) {
- echo " | \n";
- } else {
- echo "".$Day->thisDay()." | \n";
- }
- }
- }
- echo " \n | \n";
-
- $i++;
-}
-?>
-
-Took:
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/21.phps b/airtime_mvc/library/pear/Calendar/docs/examples/21.phps
deleted file mode 100644
index dbdd68aec..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/21.phps
+++ /dev/null
@@ -1,139 +0,0 @@
-build();
-?>
-
-
-
- thisYear(); ?>
-
-
-
-
-
-thisYear(); ?>
-
-
-
-
-fetch()) {
-
- switch ($i) {
- case 0:
- echo "\n";
- break;
- case 3:
- case 6:
- case 9:
- echo "
\n\n";
- break;
- case 12:
- echo "
\n";
- break;
- }
-
- echo "\n\n";
- echo ''.date('F', $Month->thisMonth(TRUE)).'';
- echo ''."\n";
- echo "\nWeek | M | T | W | T | F | S | S | \n ";
- $Month->build();
- while ($Week = $Month->fetch()) {
- echo "\n";
- echo ''.$Week->thisWeek($_GET['week_type'])." | \n";
- $Week->build();
-
- while ($Day = $Week->fetch()) {
- if ($Day->isEmpty()) {
- echo " | \n";
- } else {
- echo "".$Day->thisDay()." | \n";
- }
- }
- }
- echo " \n | \n";
-
- $i++;
-}
-?>
-
-Took:
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/22.php b/airtime_mvc/library/pear/Calendar/docs/examples/22.php
deleted file mode 100644
index 089c53606..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/22.php
+++ /dev/null
@@ -1,46 +0,0 @@
-The current month is '
- .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'');
-
-$Uri = & new Calendar_Util_Uri('jahr','monat');
-$Uri->setFragments('jahr','monat');
-
-echo "\"Vector\" URIs";
-echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
-echo ( "This Uri:\t".htmlentities($Uri->this($Calendar, 'month'))."\n" );
-echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
-echo "
";
-
-// Switch to scalar URIs
-$Uri->separator = '/'; // Default is &
-$Uri->scalar = true; // Omit variable names
-
-echo "\"Scalar\" URIs";
-echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
-echo ( "This Uri:\t".$Uri->this($Calendar, 'month')."\n" );
-echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
-echo "
";
-
-// Restore the vector URIs
-$Uri->separator = '&';
-$Uri->scalar = false;
-?>
-
-Prev :
-Next
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/22.phps b/airtime_mvc/library/pear/Calendar/docs/examples/22.phps
deleted file mode 100644
index 089c53606..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/22.phps
+++ /dev/null
@@ -1,46 +0,0 @@
-The current month is '
- .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'');
-
-$Uri = & new Calendar_Util_Uri('jahr','monat');
-$Uri->setFragments('jahr','monat');
-
-echo "\"Vector\" URIs";
-echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
-echo ( "This Uri:\t".htmlentities($Uri->this($Calendar, 'month'))."\n" );
-echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
-echo "
";
-
-// Switch to scalar URIs
-$Uri->separator = '/'; // Default is &
-$Uri->scalar = true; // Omit variable names
-
-echo "\"Scalar\" URIs";
-echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
-echo ( "This Uri:\t".$Uri->this($Calendar, 'month')."\n" );
-echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
-echo "
";
-
-// Restore the vector URIs
-$Uri->separator = '&';
-$Uri->scalar = false;
-?>
-
-Prev :
-Next
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/23.php b/airtime_mvc/library/pear/Calendar/docs/examples/23.php
deleted file mode 100644
index 3f04b4486..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/23.php
+++ /dev/null
@@ -1,66 +0,0 @@
-Calling: Calendar_Util_Textual::monthNames('long');";
-print_r(Calendar_Util_Textual::monthNames('long'));
-echo '
';
-
-echo "
Calling: Calendar_Util_Textual::weekdayNames('two');";
-print_r(Calendar_Util_Textual::weekdayNames('two'));
-echo '
';
-
-echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
";
-$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
-
-echo '
Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'
';
-echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'
';
-echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'
';
-echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'
';
-echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'
';
-echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'
';
-
-echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
";
-$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
-
-?>
-Rendering calendar....
-
-thisYear(); ?>
-
-'.$dayheader.'';
-}
-?>
-
-build();
-while ($Day = $Calendar->fetch()) {
- if ($Day->isFirst()) {
- echo "\n";
- }
- if ($Day->isEmpty()) {
- echo ' | ';
- } else {
- echo ''.$Day->thisDay().' | ';
- }
- if ($Day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/23.phps b/airtime_mvc/library/pear/Calendar/docs/examples/23.phps
deleted file mode 100644
index 3f04b4486..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/23.phps
+++ /dev/null
@@ -1,66 +0,0 @@
-Calling: Calendar_Util_Textual::monthNames('long');";
-print_r(Calendar_Util_Textual::monthNames('long'));
-echo '
';
-
-echo "
Calling: Calendar_Util_Textual::weekdayNames('two');";
-print_r(Calendar_Util_Textual::weekdayNames('two'));
-echo '
';
-
-echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
";
-$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
-
-echo '
Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'
';
-echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'
';
-echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'
';
-echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'
';
-echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'
';
-echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'
';
-
-echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
";
-$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
-
-?>
-Rendering calendar....
-
-thisYear(); ?>
-
-'.$dayheader.'';
-}
-?>
-
-build();
-while ($Day = $Calendar->fetch()) {
- if ($Day->isFirst()) {
- echo "\n";
- }
- if ($Day->isEmpty()) {
- echo ' | ';
- } else {
- echo ''.$Day->thisDay().' | ';
- }
- if ($Day->isLast()) {
- echo "
\n";
- }
-}
-?>
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/3.php b/airtime_mvc/library/pear/Calendar/docs/examples/3.php
deleted file mode 100644
index f92dcbbc9..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/3.php
+++ /dev/null
@@ -1,134 +0,0 @@
-prevMonth('object'); // Get previous month as object
-$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
-$NMonth = $Month->nextMonth('object');
-$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
-?>
-
-
-
- Calendar
-
-
-
-
-
-build($selectedDays);
-?>
-Built with Calendar_Month_Weekday::build()
-
-
-getTimeStamp())); ?>
-
-
-M |
-T |
-W |
-T |
-F |
-S |
-S |
-
-fetch() ) {
-
- // Build a link string for each day
- $link = $_SERVER['PHP_SELF'].
- '?y='.$Day->thisYear().
- '&m='.$Day->thisMonth().
- '&d='.$Day->thisDay();
-
- // isFirst() to find start of week
- if ( $Day->isFirst() )
- echo ( "\n" );
-
- if ( $Day->isSelected() ) {
- echo ( "".$Day->thisDay()." | \n" );
- } else if ( $Day->isEmpty() ) {
- echo ( " | \n" );
- } else {
- echo ( "".$Day->thisDay()." | \n" );
- }
-
- // isLast() to find end of week
- if ( $Day->isLast() )
- echo ( "
\n" );
-}
-?>
-
-
-<<
- |
- |
-
- >>
- |
-
-
-Took: '.(getmicrotime()-$start).' seconds' );
-?>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/3.phps b/airtime_mvc/library/pear/Calendar/docs/examples/3.phps
deleted file mode 100644
index f92dcbbc9..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/3.phps
+++ /dev/null
@@ -1,134 +0,0 @@
-prevMonth('object'); // Get previous month as object
-$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay();
-$NMonth = $Month->nextMonth('object');
-$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay();
-?>
-
-
-
- Calendar
-
-
-
-
-
-build($selectedDays);
-?>
-Built with Calendar_Month_Weekday::build()
-
-
-getTimeStamp())); ?>
-
-
-M |
-T |
-W |
-T |
-F |
-S |
-S |
-
-fetch() ) {
-
- // Build a link string for each day
- $link = $_SERVER['PHP_SELF'].
- '?y='.$Day->thisYear().
- '&m='.$Day->thisMonth().
- '&d='.$Day->thisDay();
-
- // isFirst() to find start of week
- if ( $Day->isFirst() )
- echo ( "\n" );
-
- if ( $Day->isSelected() ) {
- echo ( "".$Day->thisDay()." | \n" );
- } else if ( $Day->isEmpty() ) {
- echo ( " | \n" );
- } else {
- echo ( "".$Day->thisDay()." | \n" );
- }
-
- // isLast() to find end of week
- if ( $Day->isLast() )
- echo ( "
\n" );
-}
-?>
-
-
-<<
- |
- |
-
- >>
- |
-
-
-Took: '.(getmicrotime()-$start).' seconds' );
-?>
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/4.php b/airtime_mvc/library/pear/Calendar/docs/examples/4.php
deleted file mode 100644
index 034813ee3..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/4.php
+++ /dev/null
@@ -1,49 +0,0 @@
-Result: '.$Unit->thisYear().'-'.$Unit->thisMonth().'-'.$Unit->thisDay().
- ' '.$Unit->thisHour().':'.$Unit->thisMinute().':'.$Unit->thisSecond();
-if ($Unit->isValid()) {
- echo ' is valid!';
-} else {
- $V= & $Unit->getValidator();
- echo ' is invalid:';
- while ($error = $V->fetch()) {
- echo $error->toString() .'
';
- }
-}
-?>
-Enter a date / time to validate:
-
-Note: Error messages can be controlled with the constants CALENDAR_VALUE_TOOSMALL
and CALENDAR_VALUE_TOOLARGE
- see Calendar_Validator.php
-
-Took: '.(getmicrotime()-$start).' seconds'; ?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/4.phps b/airtime_mvc/library/pear/Calendar/docs/examples/4.phps
deleted file mode 100644
index 034813ee3..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/4.phps
+++ /dev/null
@@ -1,49 +0,0 @@
-Result: '.$Unit->thisYear().'-'.$Unit->thisMonth().'-'.$Unit->thisDay().
- ' '.$Unit->thisHour().':'.$Unit->thisMinute().':'.$Unit->thisSecond();
-if ($Unit->isValid()) {
- echo ' is valid!';
-} else {
- $V= & $Unit->getValidator();
- echo ' is invalid:';
- while ($error = $V->fetch()) {
- echo $error->toString() .'
';
- }
-}
-?>
-Enter a date / time to validate:
-
-Note: Error messages can be controlled with the constants CALENDAR_VALUE_TOOSMALL
and CALENDAR_VALUE_TOOLARGE
- see Calendar_Validator.php
-
-Took: '.(getmicrotime()-$start).' seconds'; ?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/5.php b/airtime_mvc/library/pear/Calendar/docs/examples/5.php
deleted file mode 100644
index ce5ae7e00..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/5.php
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
- Select and Update
-
-
-Select and Update
-isValid() ) {
- $V= & $Second->getValidator();
- echo ('Validation failed:
' );
- while ( $error = $V->fetch() ) {
- echo ( $error->toString() .'
' );
- }
- } else {
- echo ('Validation success.
' );
- echo ( 'New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example');
- }
-} else {
-$Year = new Calendar_Year($_POST['y']);
-$Month = new Calendar_Month($_POST['y'],$_POST['m']);
-$Day = new Calendar_Day($_POST['y'],$_POST['m'],$_POST['d']);
-$Hour = new Calendar_Hour($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h']);
-$Minute = new Calendar_Minute($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i']);
-$Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']);
-?>
-
Set the alarm clock
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/8.phps b/airtime_mvc/library/pear/Calendar/docs/examples/8.phps
deleted file mode 100644
index f84887953..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/8.phps
+++ /dev/null
@@ -1,70 +0,0 @@
-") ) {
- die('PHP 5 has problems with PEAR::SOAP Client (8.0RC3)
- - remove @ before include below to see why');
-}
-
-if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Client.php')) {
- die('You must have PEAR::SOAP installed');
-}
-
-// Just to save manaul modification...
-$basePath = explode('/', $_SERVER['SCRIPT_NAME']);
-array_pop($basePath);
-$basePath = implode('/', $basePath);
-$url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl';
-
-if (!isset($_GET['y'])) $_GET['y'] = date('Y');
-if (!isset($_GET['m'])) $_GET['m'] = date('n');
-
-$wsdl = new SOAP_WSDL ($url);
-
-echo ( ''.$wsdl->generateProxyCode().'
' );
-
-$calendarClient = $wsdl->getProxy();
-
-$month = $calendarClient->getMonth((int)$_GET['y'],(int)$_GET['m']);
-
-if ( PEAR::isError($month) ) {
- die ( $month->toString() );
-}
-?>
-
-
-
- Calendar over the Wire
-
-
-Calendar Over the Wire (featuring PEAR::SOAP)
-
-monthname );?>
-
-M | T | W | T | F | S | S |
-
-days as $day ) {
-
- if ( $day->isFirst === 1 )
- echo ( "\n" );
- if ( $day->isEmpty === 1 ) {
- echo ( " | " );
- } else {
- echo ( "".$day->day." | " );
- }
- if ( $day->isLast === 1 )
- echo ( "
\n" );
-}
-?>
-
-
-Enter Year and Month to View:
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/9.php b/airtime_mvc/library/pear/Calendar/docs/examples/9.php
deleted file mode 100644
index 4b6a937a4..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/9.php
+++ /dev/null
@@ -1,16 +0,0 @@
-getTimeStamp()));
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/9.phps b/airtime_mvc/library/pear/Calendar/docs/examples/9.phps
deleted file mode 100644
index 4b6a937a4..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/9.phps
+++ /dev/null
@@ -1,16 +0,0 @@
-getTimeStamp()));
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/docs/examples/index.html b/airtime_mvc/library/pear/Calendar/docs/examples/index.html
deleted file mode 100644
index a68e996eb..000000000
--- a/airtime_mvc/library/pear/Calendar/docs/examples/index.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- PEAR::Calendar Examples
-
-
-
-
-PEAR::Calendar Examples
-$Id: index.html 166574 2004-08-17 09:10:53Z hfuecks $
-
-- 1.php [src] - shows basic usage, passing all the way down from
Calendar_Year
to Calendar_Second
- more of a quick test it's working
-- 2.php [src] - shows how to build a tabular month using
Calendar_Month_Weeks
, Calendar_Week
, Calendar_Day
as well as selecting some dates.
-- 3.php [src] - shows how to build a tabular month using
Calendar_Month_Weekdays
and Calendar_Day
, as well as selecting some dates (this method is faster).
-- 4.php [src] - shows how to use PEAR::Calendar for validation.
-- 5.php [src] - shows PEAR::Calendar in use to help generate a form.
-- 6.php [src] - a month and day "planner" calendar, which can be rendered both as HTML and WML.
-- 7.php [src] - a simple SOAP Calendar Server, using PEAR::SOAP and PEAR::Calendar
-- 8.php [src] - a WSDL SOAP client for the SOAP Calendar Server
-- 9.php [src] - quick example of i18n with
setlocale
(not working on SF)
-- 10.php [src] - an example of extending
Calendar_Decorator
to modify output
-- 11.php [src] - attaching a "payload" (e.g. results of a DB query) to a calendar using
Calendar_Decorator
to allow the payload to be available inside the main loop.
-- 12.php [src] - a complete year with months.
-- 13.php [src] - same as 1.php but using
Calendar_Engine_PearDate
, (see PEAR::Date).
-- 14.php [src] - same as 3.php but using
Calendar_Engine_PearDate
-- 15.php [src] - paging through weeks
-- 16.php [src] - example of
Calendar_Decorator_Uri
. Note you should prefer Calendar_Util_Uri
(see below) in most cases, for performance
-- 17.php [src] - example of
Calendar_Decorator_Textual
. Note you should prefer Calendar_Util_Textual
(see below) in most cases, for performance
-- 18.php [src] - example of
Calendar_Decorator_Wrapper
.
-- 19.php [src] - example of
Calendar_Decorator_Weekday
.
-- 20.php [src] - shows how to attach a "payload" spanning multiple days, with more than one entry per day
-- 21.php [src] - same as 12.php but using
Calendar_Month_Weeks
instead of Calendar_Month_Weekdays
to allow the week in the year or week in the month to be displayed.
-- 22.php [src] - demonstrates use of
Calendar_Util_Uri
.
-- 23.php [src] - demonstrates use of
Calendar_Util_Textual
.
-- 24.php [src] -
Calendar_Decorator_Weekday
combined with Calendar_Decorator_Wrapper
to decorate days in the month.
-
-
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/README b/airtime_mvc/library/pear/Calendar/tests/README
deleted file mode 100644
index cbae24227..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/README
+++ /dev/null
@@ -1,7 +0,0 @@
-These tests require Simple Test: http://www.lastcraft.com/simple_test.php
-
-Ideally they would use PEAR::PHPUnit but the current version has bugs and
-lacks alot of the functionality (e.g. Mock Objects) which Simple Test
-provides.
-
-Modifying the simple_include.php script for your simple test install dir
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/all_tests.php b/airtime_mvc/library/pear/Calendar/tests/all_tests.php
deleted file mode 100644
index bda396ada..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/all_tests.php
+++ /dev/null
@@ -1,34 +0,0 @@
-GroupTest('All PEAR::Calendar Tests');
- $this->AddTestCase(new CalendarTests());
- $this->AddTestCase(new CalendarTabularTests());
- $this->AddTestCase(new ValidatorTests());
- $this->AddTestCase(new CalendarEngineTests());
- $this->AddTestCase(new TableHelperTests());
- $this->AddTestCase(new DecoratorTests());
- $this->AddTestCase(new UtilTests());
- }
-}
-
-$test = &new AllTests();
-$test->run(new HtmlReporter());
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/calendar_engine_tests.php b/airtime_mvc/library/pear/Calendar/tests/calendar_engine_tests.php
deleted file mode 100644
index f44138189..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/calendar_engine_tests.php
+++ /dev/null
@@ -1,20 +0,0 @@
-GroupTest('Calendar Engine Tests');
- $this->addTestFile('peardate_engine_test.php');
- $this->addTestFile('unixts_engine_test.php');
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new CalendarEngineTests();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/calendar_include.php b/airtime_mvc/library/pear/Calendar/tests/calendar_include.php
deleted file mode 100644
index a375eafcf..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/calendar_include.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/calendar_tabular_tests.php b/airtime_mvc/library/pear/Calendar/tests/calendar_tabular_tests.php
deleted file mode 100644
index 8dbaf4e67..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/calendar_tabular_tests.php
+++ /dev/null
@@ -1,22 +0,0 @@
-GroupTest('Calendar Tabular Tests');
- $this->addTestFile('month_weekdays_test.php');
- $this->addTestFile('month_weeks_test.php');
- $this->addTestFile('week_test.php');
- //$this->addTestFile('week_firstday_0_test.php'); //switch with the above
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new CalendarTabularTests();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/calendar_test.php b/airtime_mvc/library/pear/Calendar/tests/calendar_test.php
deleted file mode 100644
index 62c6a696c..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/calendar_test.php
+++ /dev/null
@@ -1,124 +0,0 @@
-UnitTestCase($name);
- }
- function setUp() {
- $this->cal = new Calendar(2003,10,25,13,32,43);
- }
- function tearDown() {
- unset($this->cal);
- }
- function testPrevYear () {
- $this->assertEqual(2002,$this->cal->prevYear());
- }
- function testPrevYear_Array () {
- $this->assertEqual(
- array(
- 'year' => 2002,
- 'month' => 1,
- 'day' => 1,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevYear('array'));
- }
- function testThisYear () {
- $this->assertEqual(2003,$this->cal->thisYear());
- }
- function testNextYear () {
- $this->assertEqual(2004,$this->cal->nextYear());
- }
- function testPrevMonth () {
- $this->assertEqual(9,$this->cal->prevMonth());
- }
- function testPrevMonth_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 9,
- 'day' => 1,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevMonth('array'));
- }
- function testThisMonth () {
- $this->assertEqual(10,$this->cal->thisMonth());
- }
- function testNextMonth () {
- $this->assertEqual(11,$this->cal->nextMonth());
- }
- function testPrevDay () {
- $this->assertEqual(24,$this->cal->prevDay());
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 10,
- 'day' => 24,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testThisDay () {
- $this->assertEqual(25,$this->cal->thisDay());
- }
- function testNextDay () {
- $this->assertEqual(26,$this->cal->nextDay());
- }
- function testPrevHour () {
- $this->assertEqual(12,$this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(13,$this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(14,$this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(31,$this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(32,$this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(33,$this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(42,$this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(43,$this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(44,$this->cal->nextSecond());
- }
- function testSetTimeStamp() {
- $stamp = mktime(13,32,43,10,25,2003);
- $this->cal->setTimeStamp($stamp);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
- function testGetTimeStamp() {
- $stamp = mktime(13,32,43,10,25,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
- function testIsToday() {
- $stamp = mktime();
- $this->cal->setTimestamp($stamp);
- $this->assertTrue($this->cal->isToday());
-
- $stamp += 1000000000;
- $this->cal->setTimestamp($stamp);
- $this->assertFalse($this->cal->isToday());
- }
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/calendar_tests.php b/airtime_mvc/library/pear/Calendar/tests/calendar_tests.php
deleted file mode 100644
index 09513a307..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/calendar_tests.php
+++ /dev/null
@@ -1,25 +0,0 @@
-GroupTest('Calendar Tests');
- $this->addTestFile('calendar_test.php');
- $this->addTestFile('year_test.php');
- $this->addTestFile('month_test.php');
- $this->addTestFile('day_test.php');
- $this->addTestFile('hour_test.php');
- $this->addTestFile('minute_test.php');
- $this->addTestFile('second_test.php');
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new CalendarTests();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/day_test.php b/airtime_mvc/library/pear/Calendar/tests/day_test.php
deleted file mode 100644
index a812d4414..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/day_test.php
+++ /dev/null
@@ -1,107 +0,0 @@
-UnitTestCase('Test of Day');
- }
- function setUp() {
- $this->cal = new Calendar_Day(2003,10,25);
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 10,
- 'day' => 24,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testPrevHour () {
- $this->assertEqual(23,$this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(0,$this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(1,$this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(59,$this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0,$this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1,$this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59,$this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0,$this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1,$this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(0,0,0,10,25,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
-}
-
-class TestOfDayBuild extends TestOfDay {
- function TestOfDayBuild() {
- $this->UnitTestCase('Test of Day::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(24,$this->cal->size());
- }
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ( $Child = $this->cal->fetch() ) {
- $i++;
- }
- $this->assertEqual(24,$i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 0;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
- function testSelection() {
- require_once(CALENDAR_ROOT . 'Hour.php');
- $selection = array(new Calendar_Hour(2003,10,25,13));
- $this->cal->build($selection);
- $i = 0;
- while ( $Child = $this->cal->fetch() ) {
- if ( $i == 13 )
- break;
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfDay();
- $test->run(new HtmlReporter());
- $test = &new TestOfDayBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/decorator_test.php b/airtime_mvc/library/pear/Calendar/tests/decorator_test.php
deleted file mode 100644
index 6c6dd7974..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/decorator_test.php
+++ /dev/null
@@ -1,268 +0,0 @@
-UnitTestCase('Test of Calendar_Decorator');
- }
- function setUp() {
- $this->mockengine = new Mock_Calendar_Engine($this);
- $this->mockcal = new Mock_Calendar_Second($this);
- $this->mockcal->setReturnValue('prevYear',2002);
- $this->mockcal->setReturnValue('thisYear',2003);
- $this->mockcal->setReturnValue('nextYear',2004);
- $this->mockcal->setReturnValue('prevMonth',9);
- $this->mockcal->setReturnValue('thisMonth',10);
- $this->mockcal->setReturnValue('nextMonth',11);
- $this->mockcal->setReturnValue('prevDay',14);
- $this->mockcal->setReturnValue('thisDay',15);
- $this->mockcal->setReturnValue('nextDay',16);
- $this->mockcal->setReturnValue('prevHour',12);
- $this->mockcal->setReturnValue('thisHour',13);
- $this->mockcal->setReturnValue('nextHour',14);
- $this->mockcal->setReturnValue('prevMinute',29);
- $this->mockcal->setReturnValue('thisMinute',30);
- $this->mockcal->setReturnValue('nextMinute',31);
- $this->mockcal->setReturnValue('prevSecond',44);
- $this->mockcal->setReturnValue('thisSecond',45);
- $this->mockcal->setReturnValue('nextSecond',46);
- $this->mockcal->setReturnValue('getEngine',$this->mockengine);
- $this->mockcal->setReturnValue('getTimestamp',12345);
-
- }
- function tearDown() {
- unset ( $this->engine );
- unset ( $this->mockcal );
- }
- function testPrevYear() {
- $this->mockcal->expectOnce('prevYear',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(2002,$Decorator->prevYear());
- }
- function testThisYear() {
- $this->mockcal->expectOnce('thisYear',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(2003,$Decorator->thisYear());
- }
- function testNextYear() {
- $this->mockcal->expectOnce('nextYear',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(2004,$Decorator->nextYear());
- }
- function testPrevMonth() {
- $this->mockcal->expectOnce('prevMonth',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(9,$Decorator->prevMonth());
- }
- function testThisMonth() {
- $this->mockcal->expectOnce('thisMonth',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(10,$Decorator->thisMonth());
- }
- function testNextMonth() {
- $this->mockcal->expectOnce('nextMonth',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(11,$Decorator->nextMonth());
- }
- function testPrevWeek() {
- $mockweek = & new Mock_Calendar_Week($this);
- $mockweek->setReturnValue('prevWeek',1);
- $mockweek->expectOnce('prevWeek',array('n_in_month'));
- $Decorator =& new Calendar_Decorator($mockweek);
- $this->assertEqual(1,$Decorator->prevWeek());
- }
- function testThisWeek() {
- $mockweek = & new Mock_Calendar_Week($this);
- $mockweek->setReturnValue('thisWeek',2);
- $mockweek->expectOnce('thisWeek',array('n_in_month'));
- $Decorator =& new Calendar_Decorator($mockweek);
- $this->assertEqual(2,$Decorator->thisWeek());
- }
- function testNextWeek() {
- $mockweek = & new Mock_Calendar_Week($this);
- $mockweek->setReturnValue('nextWeek',3);
- $mockweek->expectOnce('nextWeek',array('n_in_month'));
- $Decorator =& new Calendar_Decorator($mockweek);
- $this->assertEqual(3,$Decorator->nextWeek());
- }
- function testPrevDay() {
- $this->mockcal->expectOnce('prevDay',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(14,$Decorator->prevDay());
- }
- function testThisDay() {
- $this->mockcal->expectOnce('thisDay',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(15,$Decorator->thisDay());
- }
- function testNextDay() {
- $this->mockcal->expectOnce('nextDay',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(16,$Decorator->nextDay());
- }
- function testPrevHour() {
- $this->mockcal->expectOnce('prevHour',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(12,$Decorator->prevHour());
- }
- function testThisHour() {
- $this->mockcal->expectOnce('thisHour',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(13,$Decorator->thisHour());
- }
- function testNextHour() {
- $this->mockcal->expectOnce('nextHour',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(14,$Decorator->nextHour());
- }
- function testPrevMinute() {
- $this->mockcal->expectOnce('prevMinute',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(29,$Decorator->prevMinute());
- }
- function testThisMinute() {
- $this->mockcal->expectOnce('thisMinute',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(30,$Decorator->thisMinute());
- }
- function testNextMinute() {
- $this->mockcal->expectOnce('nextMinute',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(31,$Decorator->nextMinute());
- }
- function testPrevSecond() {
- $this->mockcal->expectOnce('prevSecond',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(44,$Decorator->prevSecond());
- }
- function testThisSecond() {
- $this->mockcal->expectOnce('thisSecond',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(45,$Decorator->thisSecond());
- }
- function testNextSecond() {
- $this->mockcal->expectOnce('nextSecond',array('int'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(46,$Decorator->nextSecond());
- }
- function testGetEngine() {
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertIsA($Decorator->getEngine(),'Mock_Calendar_Engine');
- }
- function testSetTimestamp() {
- $this->mockcal->expectOnce('setTimestamp',array('12345'));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->setTimestamp('12345');
- }
- function testGetTimestamp() {
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual(12345,$Decorator->getTimestamp());
- }
- function testSetSelected() {
- $this->mockcal->expectOnce('setSelected',array(true));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->setSelected();
- }
- function testIsSelected() {
- $this->mockcal->setReturnValue('isSelected',true);
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertTrue($Decorator->isSelected());
- }
- function testAdjust() {
- $this->mockcal->expectOnce('adjust',array());
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->adjust();
- }
- function testToArray() {
- $this->mockcal->expectOnce('toArray',array(12345));
- $testArray = array('foo'=>'bar');
- $this->mockcal->setReturnValue('toArray',$testArray);
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual($testArray,$Decorator->toArray(12345));
- }
- function testReturnValue() {
- $this->mockcal->expectOnce('returnValue',array('a','b','c','d'));
- $this->mockcal->setReturnValue('returnValue','foo');
- $Decorator = new Calendar_Decorator($this->mockcal);
- $this->assertEqual('foo',$Decorator->returnValue('a','b','c','d'));
- }
- function testSetFirst() {
- $mockday = & new Mock_Calendar_Day($this);
- $mockday->expectOnce('setFirst',array(true));
- $Decorator =& new Calendar_Decorator($mockday);
- $Decorator->setFirst();
- }
- function testSetLast() {
- $mockday = & new Mock_Calendar_Day($this);
- $mockday->expectOnce('setLast',array(true));
- $Decorator =& new Calendar_Decorator($mockday);
- $Decorator->setLast();
- }
- function testIsFirst() {
- $mockday = & new Mock_Calendar_Day($this);
- $mockday->setReturnValue('isFirst',TRUE);
- $Decorator =& new Calendar_Decorator($mockday);
- $this->assertTrue($Decorator->isFirst());
- }
- function testIsLast() {
- $mockday = & new Mock_Calendar_Day($this);
- $mockday->setReturnValue('isLast',TRUE);
- $Decorator =& new Calendar_Decorator($mockday);
- $this->assertTrue($Decorator->isLast());
- }
- function testSetEmpty() {
- $mockday = & new Mock_Calendar_Day($this);
- $mockday->expectOnce('setEmpty',array(true));
- $Decorator =& new Calendar_Decorator($mockday);
- $Decorator->setEmpty();
- }
- function testIsEmpty() {
- $mockday = & new Mock_Calendar_Day($this);
- $mockday->setReturnValue('isEmpty',TRUE);
- $Decorator =& new Calendar_Decorator($mockday);
- $this->assertTrue($Decorator->isEmpty());
- }
- function testBuild() {
- $testArray=array('foo'=>'bar');
- $this->mockcal->expectOnce('build',array($testArray));
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->build($testArray);
- }
- function testFetch() {
- $this->mockcal->expectOnce('fetch',array());
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->fetch();
- }
- function testFetchAll() {
- $this->mockcal->expectOnce('fetchAll',array());
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->fetchAll();
- }
- function testSize() {
- $this->mockcal->expectOnce('size',array());
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->size();
- }
- function testIsValid() {
- $this->mockcal->expectOnce('isValid',array());
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->isValid();
- }
- function testGetValidator() {
- $this->mockcal->expectOnce('getValidator',array());
- $Decorator = new Calendar_Decorator($this->mockcal);
- $Decorator->getValidator();
- }
-}
-?>
diff --git a/airtime_mvc/library/pear/Calendar/tests/decorator_tests.php b/airtime_mvc/library/pear/Calendar/tests/decorator_tests.php
deleted file mode 100644
index 6ebc47b77..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/decorator_tests.php
+++ /dev/null
@@ -1,21 +0,0 @@
-GroupTest('Decorator Tests');
- $this->addTestFile('decorator_test.php');
- $this->addTestFile('decorator_textual_test.php');
- $this->addTestFile('decorator_uri_test.php');
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new DecoratorTests();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/decorator_textual_test.php b/airtime_mvc/library/pear/Calendar/tests/decorator_textual_test.php
deleted file mode 100644
index f9dc737e5..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/decorator_textual_test.php
+++ /dev/null
@@ -1,179 +0,0 @@
-UnitTestCase('Test of Calendar_Decorator_Textual');
- }
- function testMonthNamesLong() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $monthNames = array(
- 1=>'January',
- 2=>'February',
- 3=>'March',
- 4=>'April',
- 5=>'May',
- 6=>'June',
- 7=>'July',
- 8=>'August',
- 9=>'September',
- 10=>'October',
- 11=>'November',
- 12=>'December',
- );
- $this->assertEqual($monthNames,$Textual->monthNames());
- }
- function testMonthNamesShort() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $monthNames = array(
- 1=>'Jan',
- 2=>'Feb',
- 3=>'Mar',
- 4=>'Apr',
- 5=>'May',
- 6=>'Jun',
- 7=>'Jul',
- 8=>'Aug',
- 9=>'Sep',
- 10=>'Oct',
- 11=>'Nov',
- 12=>'Dec',
- );
- $this->assertEqual($monthNames,$Textual->monthNames('short'));
- }
- function testMonthNamesTwo() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $monthNames = array(
- 1=>'Ja',
- 2=>'Fe',
- 3=>'Ma',
- 4=>'Ap',
- 5=>'Ma',
- 6=>'Ju',
- 7=>'Ju',
- 8=>'Au',
- 9=>'Se',
- 10=>'Oc',
- 11=>'No',
- 12=>'De',
- );
- $this->assertEqual($monthNames,$Textual->monthNames('two'));
- }
- function testMonthNamesOne() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $monthNames = array(
- 1=>'J',
- 2=>'F',
- 3=>'M',
- 4=>'A',
- 5=>'M',
- 6=>'J',
- 7=>'J',
- 8=>'A',
- 9=>'S',
- 10=>'O',
- 11=>'N',
- 12=>'D',
- );
- $this->assertEqual($monthNames,$Textual->monthNames('one'));
- }
- function testWeekdayNamesLong() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $weekdayNames = array(
- 0=>'Sunday',
- 1=>'Monday',
- 2=>'Tuesday',
- 3=>'Wednesday',
- 4=>'Thursday',
- 5=>'Friday',
- 6=>'Saturday',
- );
- $this->assertEqual($weekdayNames,$Textual->weekdayNames());
- }
- function testWeekdayNamesShort() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $weekdayNames = array(
- 0=>'Sun',
- 1=>'Mon',
- 2=>'Tue',
- 3=>'Wed',
- 4=>'Thu',
- 5=>'Fri',
- 6=>'Sat',
- );
- $this->assertEqual($weekdayNames,$Textual->weekdayNames('short'));
- }
- function testWeekdayNamesTwo() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $weekdayNames = array(
- 0=>'Su',
- 1=>'Mo',
- 2=>'Tu',
- 3=>'We',
- 4=>'Th',
- 5=>'Fr',
- 6=>'Sa',
- );
- $this->assertEqual($weekdayNames,$Textual->weekdayNames('two'));
- }
- function testWeekdayNamesOne() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $weekdayNames = array(
- 0=>'S',
- 1=>'M',
- 2=>'T',
- 3=>'W',
- 4=>'T',
- 5=>'F',
- 6=>'S',
- );
- $this->assertEqual($weekdayNames,$Textual->weekdayNames('one'));
- }
- function testPrevMonthNameShort() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $this->assertEqual('Sep',$Textual->prevMonthName('short'));
- }
- function testThisMonthNameShort() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $this->assertEqual('Oct',$Textual->thisMonthName('short'));
- }
- function testNextMonthNameShort() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $this->assertEqual('Nov',$Textual->nextMonthName('short'));
- }
- function testThisDayNameShort() {
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $this->assertEqual('Wed',$Textual->thisDayName('short'));
- }
- function testOrderedWeekdaysShort() {
- $weekdayNames = array(
- 0=>'Sun',
- 1=>'Mon',
- 2=>'Tue',
- 3=>'Wed',
- 4=>'Thu',
- 5=>'Fri',
- 6=>'Sat',
- );
- $nShifts = CALENDAR_FIRST_DAY_OF_WEEK;
- while ($nShifts-- > 0) {
- $day = array_shift($weekdayNames);
- array_push($weekdayNames, $day);
- }
- $Textual = new Calendar_Decorator_Textual($this->mockcal);
- $this->assertEqual($weekdayNames,$Textual->orderedWeekdays('short'));
- }
-
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfDecoratorTextual();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/decorator_uri_test.php b/airtime_mvc/library/pear/Calendar/tests/decorator_uri_test.php
deleted file mode 100644
index 5a3624cc7..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/decorator_uri_test.php
+++ /dev/null
@@ -1,37 +0,0 @@
-UnitTestCase('Test of Calendar_Decorator_Uri');
- }
- function testFragments() {
- $Uri = new Calendar_Decorator_Uri($this->mockcal);
- $Uri->setFragments('year','month','day','hour','minute','second');
- $this->assertEqual('year=&month=&day=&hour=&minute=&second=',$Uri->this('second'));
- }
- function testScalarFragments() {
- $Uri = new Calendar_Decorator_Uri($this->mockcal);
- $Uri->setFragments('year','month','day','hour','minute','second');
- $Uri->setScalar();
- $this->assertEqual('&&&&&',$Uri->this('second'));
- }
- function testSetSeperator() {
- $Uri = new Calendar_Decorator_Uri($this->mockcal);
- $Uri->setFragments('year','month','day','hour','minute','second');
- $Uri->setSeparator('/');
- $this->assertEqual('year=/month=/day=/hour=/minute=/second=',$Uri->this('second'));
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfDecoratorUri();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/helper_test.php b/airtime_mvc/library/pear/Calendar/tests/helper_test.php
deleted file mode 100644
index 0f9702f43..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/helper_test.php
+++ /dev/null
@@ -1,83 +0,0 @@
-UnitTestCase('Test of Calendar_Table_Helper');
- }
- function setUp() {
- $this->mockengine = new Mock_Calendar_Engine($this);
- $this->mockengine->setReturnValue('getMinYears',1970);
- $this->mockengine->setReturnValue('getMaxYears',2037);
- $this->mockengine->setReturnValue('getMonthsInYear',12);
- $this->mockengine->setReturnValue('getDaysInMonth',31);
- $this->mockengine->setReturnValue('getHoursInDay',24);
- $this->mockengine->setReturnValue('getMinutesInHour',60);
- $this->mockengine->setReturnValue('getSecondsInMinute',60);
- $this->mockengine->setReturnValue('getWeekDays',array(0,1,2,3,4,5,6));
- $this->mockengine->setReturnValue('getDaysInWeek',7);
- $this->mockengine->setReturnValue('getFirstDayOfWeek',1);
- $this->mockengine->setReturnValue('getFirstDayInMonth',3);
- $this->mockcal = new Mock_Calendar_Second($this);
- $this->mockcal->setReturnValue('thisYear',2003);
- $this->mockcal->setReturnValue('thisMonth',10);
- $this->mockcal->setReturnValue('thisDay',15);
- $this->mockcal->setReturnValue('thisHour',13);
- $this->mockcal->setReturnValue('thisMinute',30);
- $this->mockcal->setReturnValue('thisSecond',45);
- $this->mockcal->setReturnValue('getEngine',$this->mockengine);
- }
- function testGetFirstDay() {
- for ( $i = 0; $i <= 7; $i++ ) {
- $Helper = & new Calendar_Table_Helper($this->mockcal,$i);
- $this->assertEqual($Helper->getFirstDay(),$i);
- }
- }
- function testGetDaysOfWeekMonday() {
- $Helper = new Calendar_Table_Helper($this->mockcal);
- $this->assertEqual($Helper->getDaysOfWeek(),array(1,2,3,4,5,6,0));
- }
- function testGetDaysOfWeekSunday() {
- $Helper = new Calendar_Table_Helper($this->mockcal,0);
- $this->assertEqual($Helper->getDaysOfWeek(),array(0,1,2,3,4,5,6));
- }
- function testGetDaysOfWeekThursday() {
- $Helper = new Calendar_Table_Helper($this->mockcal,4);
- $this->assertEqual($Helper->getDaysOfWeek(),array(4,5,6,0,1,2,3));
- }
- function testGetNumWeeks() {
- $Helper = new Calendar_Table_Helper($this->mockcal);
- $this->assertEqual($Helper->getNumWeeks(),5);
- }
- function testGetNumTableDaysInMonth() {
- $Helper = new Calendar_Table_Helper($this->mockcal);
- $this->assertEqual($Helper->getNumTableDaysInMonth(),35);
- }
- function testGetEmptyDaysBefore() {
- $Helper = new Calendar_Table_Helper($this->mockcal);
- $this->assertEqual($Helper->getEmptyDaysBefore(),2);
- }
- function testGetEmptyDaysAfter() {
- $Helper = new Calendar_Table_Helper($this->mockcal);
- $this->assertEqual($Helper->getEmptyDaysAfter(),33);
- }
- function testGetEmptyDaysAfterOffset() {
- $Helper = new Calendar_Table_Helper($this->mockcal);
- $this->assertEqual($Helper->getEmptyDaysAfterOffset(),5);
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfTableHelper();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/hour_test.php b/airtime_mvc/library/pear/Calendar/tests/hour_test.php
deleted file mode 100644
index 9c04a9eb4..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/hour_test.php
+++ /dev/null
@@ -1,98 +0,0 @@
-UnitTestCase('Test of Hour');
- }
- function setUp() {
- $this->cal = new Calendar_Hour(2003,10,25,13);
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 10,
- 'day' => 24,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testPrevMinute () {
- $this->assertEqual(59,$this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0,$this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1,$this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59,$this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0,$this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1,$this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(13,0,0,10,25,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
-}
-
-class TestOfHourBuild extends TestOfHour {
- function TestOfHourBuild() {
- $this->UnitTestCase('Test of Hour::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(60,$this->cal->size());
- }
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ( $Child = $this->cal->fetch() ) {
- $i++;
- }
- $this->assertEqual(60,$i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 0;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
- function testSelection() {
- require_once(CALENDAR_ROOT . 'Minute.php');
- $selection = array(new Calendar_Minute(2003,10,25,13,32));
- $this->cal->build($selection);
- $i = 0;
- while ( $Child = $this->cal->fetch() ) {
- if ( $i == 32 )
- break;
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfHour();
- $test->run(new HtmlReporter());
- $test = &new TestOfHourBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/minute_test.php b/airtime_mvc/library/pear/Calendar/tests/minute_test.php
deleted file mode 100644
index 07a7db242..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/minute_test.php
+++ /dev/null
@@ -1,99 +0,0 @@
-UnitTestCase('Test of Minute');
- }
- function setUp() {
- $this->cal = new Calendar_Minute(2003,10,25,13,32);
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 10,
- 'day' => 24,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testPrevSecond () {
- $this->assertEqual(59,$this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0,$this->cal->thisSecond());
- }
- function testThisSecond_Timestamp () {
- $this->assertEqual($this->cal->cE->dateToStamp(
- 2003, 10, 25, 13, 32, 0),
- $this->cal->thisSecond('timestamp'));
- }
- function testNextSecond () {
- $this->assertEqual(1,$this->cal->nextSecond());
- }
- function testNextSecond_Timestamp () {
- $this->assertEqual($this->cal->cE->dateToStamp(
- 2003, 10, 25, 13, 32, 1),
- $this->cal->nextSecond('timestamp'));
- }
- function testGetTimeStamp() {
- $stamp = mktime(13,32,0,10,25,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
-}
-
-class TestOfMinuteBuild extends TestOfMinute {
- function TestOfMinuteBuild() {
- $this->UnitTestCase('Test of Minute::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(60,$this->cal->size());
- }
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ( $Child = $this->cal->fetch() ) {
- $i++;
- }
- $this->assertEqual(60,$i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 0;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
- function testSelection() {
- require_once(CALENDAR_ROOT . 'Second.php');
- $selection = array(new Calendar_Second(2003,10,25,13,32,43));
- $this->cal->build($selection);
- $i = 0;
- while ( $Child = $this->cal->fetch() ) {
- if ( $i == 43 )
- break;
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfMinute();
- $test->run(new HtmlReporter());
- $test = &new TestOfMinuteBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/month_test.php b/airtime_mvc/library/pear/Calendar/tests/month_test.php
deleted file mode 100644
index c2238406b..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/month_test.php
+++ /dev/null
@@ -1,119 +0,0 @@
-UnitTestCase('Test of Month');
- }
- function setUp() {
- $this->cal = new Calendar_Month(2003,10);
- }
- function testPrevMonth_Object() {
- $this->assertEqual(new Calendar_Month(2003, 9), $this->cal->prevMonth('object'));
- }
- function testPrevDay () {
- $this->assertEqual(30,$this->cal->prevDay());
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 9,
- 'day' => 30,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testThisDay () {
- $this->assertEqual(1,$this->cal->thisDay());
- }
- function testNextDay () {
- $this->assertEqual(2,$this->cal->nextDay());
- }
- function testPrevHour () {
- $this->assertEqual(23,$this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(0,$this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(1,$this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(59,$this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0,$this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1,$this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59,$this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0,$this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1,$this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(0,0,0,10,1,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
-}
-
-class TestOfMonthBuild extends TestOfMonth {
- function TestOfMonthBuild() {
- $this->UnitTestCase('Test of Month::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(31,$this->cal->size());
- }
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ( $Child = $this->cal->fetch() ) {
- $i++;
- }
- $this->assertEqual(31,$i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 1;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
- function testSelection() {
- require_once(CALENDAR_ROOT . 'Day.php');
- $selection = array(new Calendar_Day(2003,10,25));
- $this->cal->build($selection);
- $i = 1;
- while ( $Child = $this->cal->fetch() ) {
- if ( $i == 25 )
- break;
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfMonth();
- $test->run(new HtmlReporter());
- $test = &new TestOfMonthBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/month_weekdays_test.php b/airtime_mvc/library/pear/Calendar/tests/month_weekdays_test.php
deleted file mode 100644
index b60005d7e..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/month_weekdays_test.php
+++ /dev/null
@@ -1,182 +0,0 @@
-UnitTestCase('Test of Month Weekdays');
- }
- function setUp() {
- $this->cal = new Calendar_Month_Weekdays(2003, 10);
- }
- function testPrevDay () {
- $this->assertEqual(30,$this->cal->prevDay());
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 9,
- 'day' => 30,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testThisDay () {
- $this->assertEqual(1, $this->cal->thisDay());
- }
- function testNextDay () {
- $this->assertEqual(2, $this->cal->nextDay());
- }
- function testPrevHour () {
- $this->assertEqual(23, $this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(0, $this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(1, $this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(59, $this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0, $this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1, $this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59, $this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0, $this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1, $this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(0, 0, 0, 10, 1, 2003);
- $this->assertEqual($stamp, $this->cal->getTimeStamp());
- }
-}
-
-class TestOfMonthWeekdaysBuild extends TestOfMonthWeekdays {
- function TestOfMonthWeekdaysBuild() {
- $this->UnitTestCase('Test of Month_Weekdays::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(35, $this->cal->size());
- }
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ($Child = $this->cal->fetch()) {
- $i++;
- }
- $this->assertEqual(35, $i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 1;
- while ($Child = $this->cal->fetch()) {
- $children[$i] = $Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
- function testSelection() {
- include_once CALENDAR_ROOT . 'Day.php';
- $selection = array(new Calendar_Day(2003, 10, 25));
- $this->cal->build($selection);
- $daysInPrevMonth = (0 == CALENDAR_FIRST_DAY_OF_WEEK) ? 3 : 2;
- $end = 25 + $daysInPrevMonth;
- $i = 1;
- while ($Child = $this->cal->fetch()) {
- if ($i == $end) {
- break;
- }
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- $this->assertEqual(25, $Child->day);
- }
- function testEmptyCount() {
- $this->cal->build();
- $empty = 0;
- while ($Child = $this->cal->fetch()) {
- if ($Child->isEmpty()) {
- $empty++;
- }
- }
- $this->assertEqual(4, $empty);
- }
- function testEmptyCount2() {
- $this->cal = new Calendar_Month_Weekdays(2010,3);
- $this->cal->build();
- $empty = 0;
- while ($Child = $this->cal->fetch()) {
- if ($Child->isEmpty()) {
- $empty++;
- }
- }
- $this->assertEqual(4, $empty);
- }
- function testEmptyCount3() {
- $this->cal = new Calendar_Month_Weekdays(2010,6);
- $this->cal->build();
- $empty = 0;
- while ($Child = $this->cal->fetch()) {
- if ($Child->isEmpty()) {
- $empty++;
- }
- }
- $this->assertEqual(5, $empty);
- }
- function testEmptyDaysBefore_AfterAdjust() {
- $this->cal = new Calendar_Month_Weekdays(2004, 0);
- $this->cal->build();
- $expected = (CALENDAR_FIRST_DAY_OF_WEEK == 0) ? 1 : 0;
- $this->assertEqual($expected, $this->cal->tableHelper->getEmptyDaysBefore());
- }
- function testEmptyDaysBefore() {
- $this->cal = new Calendar_Month_Weekdays(2010, 3);
- $this->cal->build();
- $expected = (CALENDAR_FIRST_DAY_OF_WEEK == 0) ? 1 : 0;
- $this->assertEqual($expected, $this->cal->tableHelper->getEmptyDaysBefore());
- }
- function testEmptyDaysBefore2() {
- $this->cal = new Calendar_Month_Weekdays(2010, 6);
- $this->cal->build();
- $expected = (CALENDAR_FIRST_DAY_OF_WEEK == 0) ? 2 : 1;
- $this->assertEqual($expected, $this->cal->tableHelper->getEmptyDaysBefore());
- }
- function testEmptyDaysAfter() {
- $this->cal = new Calendar_Month_Weekdays(2010, 3);
- $this->cal->build();
- $expected = (CALENDAR_FIRST_DAY_OF_WEEK == 0) ? 30 : 31;
- $this->assertEqual($expected, $this->cal->tableHelper->getEmptyDaysAfter());
- }
- function testEmptyDaysAfter2() {
- $this->cal = new Calendar_Month_Weekdays(2010, 6);
- $this->cal->build();
- $expected = (CALENDAR_FIRST_DAY_OF_WEEK == 0) ? 30 : 31;
- $this->assertEqual($expected, $this->cal->tableHelper->getEmptyDaysAfter());
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfMonthWeekdays();
- $test->run(new HtmlReporter());
- $test = &new TestOfMonthWeekdaysBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/month_weeks_test.php b/airtime_mvc/library/pear/Calendar/tests/month_weeks_test.php
deleted file mode 100644
index d8f130294..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/month_weeks_test.php
+++ /dev/null
@@ -1,129 +0,0 @@
-UnitTestCase('Test of Month Weeks');
- }
- function setUp() {
- $this->cal = new Calendar_Month_Weeks(2003, 10);
- }
- function testPrevDay () {
- $this->assertEqual(30, $this->cal->prevDay());
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 9,
- 'day' => 30,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testThisDay () {
- $this->assertEqual(1, $this->cal->thisDay());
- }
- function testNextDay () {
- $this->assertEqual(2, $this->cal->nextDay());
- }
- function testPrevHour () {
- $this->assertEqual(23, $this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(0, $this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(1, $this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(59, $this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0, $this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1, $this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59, $this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0, $this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1, $this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(0,0,0,10,1,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
-}
-
-class TestOfMonthWeeksBuild extends TestOfMonthWeeks {
- function TestOfMonthWeeksBuild() {
- $this->UnitTestCase('Test of Month_Weeks::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(5,$this->cal->size());
- }
-
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ($Child = $this->cal->fetch()) {
- $i++;
- }
- $this->assertEqual(5,$i);
- }
-/* Recusive dependency issue with SimpleTest
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 1;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
-*/
- function testSelection() {
- include_once CALENDAR_ROOT . 'Week.php';
- $selection = array(new Calendar_Week(2003, 10, 12));
- $this->cal->build($selection);
- $i = 1;
- $expected = (CALENDAR_FIRST_DAY_OF_WEEK == 0) ? 3 : 2;
- while ($Child = $this->cal->fetch()) {
- if ($i == $expected) {
- //12-10-2003 is in the 2nd week of the month if firstDay is Monday,
- //in the 3rd if firstDay is Sunday
- break;
- }
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
- function testEmptyDaysBefore_AfterAdjust() {
- $this->cal = new Calendar_Month_Weeks(2004, 0);
- $this->cal->build();
- $expected = (CALENDAR_FIRST_DAY_OF_WEEK == 0) ? 1 : 0;
- $this->assertEqual($expected, $this->cal->tableHelper->getEmptyDaysBefore());
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfMonthWeeks();
- $test->run(new HtmlReporter());
- $test = &new TestOfMonthWeeksBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/peardate_engine_test.php b/airtime_mvc/library/pear/Calendar/tests/peardate_engine_test.php
deleted file mode 100644
index c32c890d7..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/peardate_engine_test.php
+++ /dev/null
@@ -1,130 +0,0 @@
-UnitTestCase('Test of Calendar_Engine_PearDate');
- }
- function setUp() {
- $this->engine = new Calendar_Engine_PearDate();
- }
- function testGetSecondsInMinute() {
- $this->assertEqual($this->engine->getSecondsInMinute(),60);
- }
- function testGetMinutesInHour() {
- $this->assertEqual($this->engine->getMinutesInHour(),60);
- }
- function testGetHoursInDay() {
- $this->assertEqual($this->engine->getHoursInDay(),24);
- }
- function testGetFirstDayOfWeek() {
- $this->assertEqual($this->engine->getFirstDayOfWeek(),1);
- }
- function testGetWeekDays() {
- $this->assertEqual($this->engine->getWeekDays(),array(0,1,2,3,4,5,6));
- }
- function testGetDaysInWeek() {
- $this->assertEqual($this->engine->getDaysInWeek(),7);
- }
- function testGetWeekNInYear() {
- $this->assertEqual($this->engine->getWeekNInYear(2003, 11, 3), 45);
- }
- function testGetWeekNInMonth() {
- $this->assertEqual($this->engine->getWeekNInMonth(2003, 11, 3), 2);
- }
- function testGetWeeksInMonth0() {
- $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 0), 6); //week starts on sunday
- }
- function testGetWeeksInMonth1() {
- $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 1), 5); //week starts on monday
- }
- function testGetWeeksInMonth2() {
- $this->assertEqual($this->engine->getWeeksInMonth(2003, 2, 6), 4); //week starts on saturday
- }
- function testGetWeeksInMonth3() {
- // Unusual cases that can cause fails (shows up with example 21.php)
- $this->assertEqual($this->engine->getWeeksInMonth(2004,2,1),5);
- $this->assertEqual($this->engine->getWeeksInMonth(2004,8,1),6);
- }
- function testGetDayOfWeek() {
- $this->assertEqual($this->engine->getDayOfWeek(2003, 11, 18), 2);
- }
- function testGetFirstDayInMonth() {
- $this->assertEqual($this->engine->getFirstDayInMonth(2003,10),3);
- }
- function testGetDaysInMonth() {
- $this->assertEqual($this->engine->getDaysInMonth(2003,10),31);
- }
- function testGetMinYears() {
- $this->assertEqual($this->engine->getMinYears(),0);
- }
- function testGetMaxYears() {
- $this->assertEqual($this->engine->getMaxYears(),9999);
- }
- function testDateToStamp() {
- $stamp = '2003-10-15 13:30:45';
- $this->assertEqual($this->engine->dateToStamp(2003,10,15,13,30,45),$stamp);
- }
- function testStampToSecond() {
- $stamp = '2003-10-15 13:30:45';
- $this->assertEqual($this->engine->stampToSecond($stamp),45);
- }
- function testStampToMinute() {
- $stamp = '2003-10-15 13:30:45';
- $this->assertEqual($this->engine->stampToMinute($stamp),30);
- }
- function testStampToHour() {
- $stamp = '2003-10-15 13:30:45';
- $this->assertEqual($this->engine->stampToHour($stamp),13);
- }
- function testStampToDay() {
- $stamp = '2003-10-15 13:30:45';
- $this->assertEqual($this->engine->stampToDay($stamp),15);
- }
- function testStampToMonth() {
- $stamp = '2003-10-15 13:30:45';
- $this->assertEqual($this->engine->stampToMonth($stamp),10);
- }
- function testStampToYear() {
- $stamp = '2003-10-15 13:30:45';
- $this->assertEqual($this->engine->stampToYear($stamp),2003);
- }
- function testAdjustDate() {
- $stamp = '2004-01-01 13:30:45';
- $y = $this->engine->stampToYear($stamp);
- $m = $this->engine->stampToMonth($stamp);
- $d = $this->engine->stampToDay($stamp);
-
- //the first day of the month should be thursday
- $this->assertEqual($this->engine->getDayOfWeek($y, $m, $d), 4);
-
- $m--; // 2004-00-01 => 2003-12-01
- $this->engine->adjustDate($y, $m, $d, $dummy, $dummy, $dummy);
-
- $this->assertEqual($y, 2003);
- $this->assertEqual($m, 12);
- $this->assertEqual($d, 1);
-
- // get last day and check if it's wednesday
- $d = $this->engine->getDaysInMonth($y, $m);
-
- $this->assertEqual($this->engine->getDayOfWeek($y, $m, $d), 3);
- }
- function testIsToday() {
- $stamp = date('Y-m-d H:i:s');
- $this->assertTrue($this->engine->isToday($stamp));
- $stamp = date('Y-m-d H:i:s', time() + 1000000000);
- $this->assertFalse($this->engine->isToday($stamp));
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfPearDateEngine();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/second_test.php b/airtime_mvc/library/pear/Calendar/tests/second_test.php
deleted file mode 100644
index 78c56565a..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/second_test.php
+++ /dev/null
@@ -1,34 +0,0 @@
-UnitTestCase('Test of Second');
- }
- function setUp() {
- $this->cal = new Calendar_Second(2003,10,25,13,32,43);
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 10,
- 'day' => 24,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfSecond();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/simple_include.php b/airtime_mvc/library/pear/Calendar/tests/simple_include.php
deleted file mode 100644
index cd7ad4413..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/simple_include.php
+++ /dev/null
@@ -1,10 +0,0 @@
-
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/table_helper_tests.php b/airtime_mvc/library/pear/Calendar/tests/table_helper_tests.php
deleted file mode 100644
index c8abe64eb..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/table_helper_tests.php
+++ /dev/null
@@ -1,19 +0,0 @@
-GroupTest('Table Helper Tests');
- $this->addTestFile('helper_test.php');
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TableHelperTests();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/unixts_engine_test.php b/airtime_mvc/library/pear/Calendar/tests/unixts_engine_test.php
deleted file mode 100644
index 2d7c11f97..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/unixts_engine_test.php
+++ /dev/null
@@ -1,110 +0,0 @@
-UnitTestCase('Test of Calendar_Engine_UnixTs');
- }
- function setUp() {
- $this->engine = new Calendar_Engine_UnixTs();
- }
- function testGetSecondsInMinute() {
- $this->assertEqual($this->engine->getSecondsInMinute(),60);
- }
- function testGetMinutesInHour() {
- $this->assertEqual($this->engine->getMinutesInHour(),60);
- }
- function testGetHoursInDay() {
- $this->assertEqual($this->engine->getHoursInDay(),24);
- }
- function testGetFirstDayOfWeek() {
- $this->assertEqual($this->engine->getFirstDayOfWeek(),1);
- }
- function testGetWeekDays() {
- $this->assertEqual($this->engine->getWeekDays(),array(0,1,2,3,4,5,6));
- }
- function testGetDaysInWeek() {
- $this->assertEqual($this->engine->getDaysInWeek(),7);
- }
- function testGetWeekNInYear() {
- $this->assertEqual($this->engine->getWeekNInYear(2003, 11, 3), 45);
- }
- function testGetWeekNInMonth() {
- $this->assertEqual($this->engine->getWeekNInMonth(2003, 11, 3), 2);
- }
- function testGetWeeksInMonth0() {
- $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 0), 6); //week starts on sunday
- }
- function testGetWeeksInMonth1() {
- $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 1), 5); //week starts on monday
- }
- function testGetWeeksInMonth2() {
- $this->assertEqual($this->engine->getWeeksInMonth(2003, 2, 6), 4); //week starts on saturday
- }
- function testGetWeeksInMonth3() {
- // Unusual cases that can cause fails (shows up with example 21.php)
- $this->assertEqual($this->engine->getWeeksInMonth(2004,2,1),5);
- $this->assertEqual($this->engine->getWeeksInMonth(2004,8,1),6);
- }
- function testGetDayOfWeek() {
- $this->assertEqual($this->engine->getDayOfWeek(2003, 11, 18), 2);
- }
- function testGetFirstDayInMonth() {
- $this->assertEqual($this->engine->getFirstDayInMonth(2003,10),3);
- }
- function testGetDaysInMonth() {
- $this->assertEqual($this->engine->getDaysInMonth(2003,10),31);
- }
- function testGetMinYears() {
- $test = strpos(PHP_OS, 'WIN') >= 0 ? 1970 : 1902;
- $this->assertEqual($this->engine->getMinYears(),$test);
- }
- function testGetMaxYears() {
- $this->assertEqual($this->engine->getMaxYears(),2037);
- }
- function testDateToStamp() {
- $stamp = mktime(0,0,0,10,15,2003);
- $this->assertEqual($this->engine->dateToStamp(2003,10,15,0,0,0),$stamp);
- }
- function testStampToSecond() {
- $stamp = mktime(13,30,45,10,15,2003);
- $this->assertEqual($this->engine->stampToSecond($stamp),45);
- }
- function testStampToMinute() {
- $stamp = mktime(13,30,45,10,15,2003);
- $this->assertEqual($this->engine->stampToMinute($stamp),30);
- }
- function testStampToHour() {
- $stamp = mktime(13,30,45,10,15,2003);
- $this->assertEqual($this->engine->stampToHour($stamp),13);
- }
- function testStampToDay() {
- $stamp = mktime(13,30,45,10,15,2003);
- $this->assertEqual($this->engine->stampToDay($stamp),15);
- }
- function testStampToMonth() {
- $stamp = mktime(13,30,45,10,15,2003);
- $this->assertEqual($this->engine->stampToMonth($stamp),10);
- }
- function testStampToYear() {
- $stamp = mktime(13,30,45,10,15,2003);
- $this->assertEqual($this->engine->stampToYear($stamp),2003);
- }
- function testIsToday() {
- $stamp = mktime();
- $this->assertTrue($this->engine->isToday($stamp));
- $stamp += 1000000000;
- $this->assertFalse($this->engine->isToday($stamp));
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfUnixTsEngine();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/util_tests.php b/airtime_mvc/library/pear/Calendar/tests/util_tests.php
deleted file mode 100644
index ce058ea4b..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/util_tests.php
+++ /dev/null
@@ -1,20 +0,0 @@
-GroupTest('Util Tests');
- $this->addTestFile('util_uri_test.php');
- $this->addTestFile('util_textual_test.php');
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new UtilTests();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/util_textual_test.php b/airtime_mvc/library/pear/Calendar/tests/util_textual_test.php
deleted file mode 100644
index e47735dca..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/util_textual_test.php
+++ /dev/null
@@ -1,196 +0,0 @@
-UnitTestCase('Test of Calendar_Util_Textual');
- }
- function setUp() {
- $this->mockengine = new Mock_Calendar_Engine($this);
- $this->mockcal = new Mock_Calendar_Second($this);
- $this->mockcal->setReturnValue('prevYear',2002);
- $this->mockcal->setReturnValue('thisYear',2003);
- $this->mockcal->setReturnValue('nextYear',2004);
- $this->mockcal->setReturnValue('prevMonth',9);
- $this->mockcal->setReturnValue('thisMonth',10);
- $this->mockcal->setReturnValue('nextMonth',11);
- $this->mockcal->setReturnValue('prevDay',14);
- $this->mockcal->setReturnValue('thisDay',15);
- $this->mockcal->setReturnValue('nextDay',16);
- $this->mockcal->setReturnValue('prevHour',12);
- $this->mockcal->setReturnValue('thisHour',13);
- $this->mockcal->setReturnValue('nextHour',14);
- $this->mockcal->setReturnValue('prevMinute',29);
- $this->mockcal->setReturnValue('thisMinute',30);
- $this->mockcal->setReturnValue('nextMinute',31);
- $this->mockcal->setReturnValue('prevSecond',44);
- $this->mockcal->setReturnValue('thisSecond',45);
- $this->mockcal->setReturnValue('nextSecond',46);
- $this->mockcal->setReturnValue('getEngine',$this->mockengine);
- $this->mockcal->setReturnValue('getTimestamp',12345);
- }
- function tearDown() {
- unset ( $this->engine );
- unset ( $this->mockcal );
- }
- function testMonthNamesLong() {
- $monthNames = array(
- 1=>'January',
- 2=>'February',
- 3=>'March',
- 4=>'April',
- 5=>'May',
- 6=>'June',
- 7=>'July',
- 8=>'August',
- 9=>'September',
- 10=>'October',
- 11=>'November',
- 12=>'December',
- );
- $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames());
- }
- function testMonthNamesShort() {
- $monthNames = array(
- 1=>'Jan',
- 2=>'Feb',
- 3=>'Mar',
- 4=>'Apr',
- 5=>'May',
- 6=>'Jun',
- 7=>'Jul',
- 8=>'Aug',
- 9=>'Sep',
- 10=>'Oct',
- 11=>'Nov',
- 12=>'Dec',
- );
- $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('short'));
- }
- function testMonthNamesTwo() {
- $monthNames = array(
- 1=>'Ja',
- 2=>'Fe',
- 3=>'Ma',
- 4=>'Ap',
- 5=>'Ma',
- 6=>'Ju',
- 7=>'Ju',
- 8=>'Au',
- 9=>'Se',
- 10=>'Oc',
- 11=>'No',
- 12=>'De',
- );
- $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('two'));
- }
- function testMonthNamesOne() {
- $monthNames = array(
- 1=>'J',
- 2=>'F',
- 3=>'M',
- 4=>'A',
- 5=>'M',
- 6=>'J',
- 7=>'J',
- 8=>'A',
- 9=>'S',
- 10=>'O',
- 11=>'N',
- 12=>'D',
- );
- $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('one'));
- }
- function testWeekdayNamesLong() {
- $weekdayNames = array(
- 0=>'Sunday',
- 1=>'Monday',
- 2=>'Tuesday',
- 3=>'Wednesday',
- 4=>'Thursday',
- 5=>'Friday',
- 6=>'Saturday',
- );
- $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames());
- }
- function testWeekdayNamesShort() {
- $weekdayNames = array(
- 0=>'Sun',
- 1=>'Mon',
- 2=>'Tue',
- 3=>'Wed',
- 4=>'Thu',
- 5=>'Fri',
- 6=>'Sat',
- );
- $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('short'));
- }
- function testWeekdayNamesTwo() {
- $weekdayNames = array(
- 0=>'Su',
- 1=>'Mo',
- 2=>'Tu',
- 3=>'We',
- 4=>'Th',
- 5=>'Fr',
- 6=>'Sa',
- );
- $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('two'));
- }
- function testWeekdayNamesOne() {
- $weekdayNames = array(
- 0=>'S',
- 1=>'M',
- 2=>'T',
- 3=>'W',
- 4=>'T',
- 5=>'F',
- 6=>'S',
- );
- $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('one'));
- }
- function testPrevMonthNameShort() {
- $this->assertEqual('Sep',Calendar_Util_Textual::prevMonthName($this->mockcal,'short'));
- }
- function testThisMonthNameShort() {
- $this->assertEqual('Oct',Calendar_Util_Textual::thisMonthName($this->mockcal,'short'));
- }
- function testNextMonthNameShort() {
- $this->assertEqual('Nov',Calendar_Util_Textual::nextMonthName($this->mockcal,'short'));
- }
- function testThisDayNameShort() {
- $this->assertEqual('Wed',Calendar_Util_Textual::thisDayName($this->mockcal,'short'));
- }
- function testOrderedWeekdaysShort() {
- $weekdayNames = array(
- 0=>'Sun',
- 1=>'Mon',
- 2=>'Tue',
- 3=>'Wed',
- 4=>'Thu',
- 5=>'Fri',
- 6=>'Sat',
- );
- $nShifts = CALENDAR_FIRST_DAY_OF_WEEK;
- while ($nShifts-- > 0) {
- $day = array_shift($weekdayNames);
- array_push($weekdayNames, $day);
- }
- $this->assertEqual($weekdayNames,Calendar_Util_Textual::orderedWeekdays($this->mockcal,'short'));
- }
-
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfUtilTextual();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/util_uri_test.php b/airtime_mvc/library/pear/Calendar/tests/util_uri_test.php
deleted file mode 100644
index 970f26985..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/util_uri_test.php
+++ /dev/null
@@ -1,54 +0,0 @@
-UnitTestCase('Test of Calendar_Util_Uri');
- }
-
- function setUp() {
- $this->MockCal = & new Mock_Calendar_Day($this);
- $this->MockCal->setReturnValue('getEngine',new Mock_Calendar_Engine($this));
- }
-
- function testFragments() {
- $Uri = new Calendar_Util_Uri('y','m','d','h','m','s');
- $Uri->setFragments('year','month','day','hour','minute','second');
- $this->assertEqual(
- 'year=&month=&day=&hour=&minute=&second=',
- $Uri->this($this->MockCal, 'second')
- );
- }
- function testScalarFragments() {
- $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second');
- $Uri->scalar = true;
- $this->assertEqual(
- '&&&&&',
- $Uri->this($this->MockCal, 'second')
- );
- }
- function testSetSeperator() {
- $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second');
- $Uri->separator = '/';
- $this->assertEqual(
- 'year=/month=/day=/hour=/minute=/second=',
- $Uri->this($this->MockCal, 'second')
- );
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfUtilUri();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/validator_error_test.php b/airtime_mvc/library/pear/Calendar/tests/validator_error_test.php
deleted file mode 100644
index ba47092cd..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/validator_error_test.php
+++ /dev/null
@@ -1,34 +0,0 @@
-UnitTestCase('Test of Validation Error');
- }
- function setUp() {
- $this->vError = new Calendar_Validation_Error('foo',20,'bar');
- }
- function testGetUnit() {
- $this->assertEqual($this->vError->getUnit(),'foo');
- }
- function testGetValue() {
- $this->assertEqual($this->vError->getValue(),20);
- }
- function testGetMessage() {
- $this->assertEqual($this->vError->getMessage(),'bar');
- }
- function testToString() {
- $this->assertEqual($this->vError->toString(),'foo = 20 [bar]');
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfValidationError();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/validator_tests.php b/airtime_mvc/library/pear/Calendar/tests/validator_tests.php
deleted file mode 100644
index 9d06b7fff..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/validator_tests.php
+++ /dev/null
@@ -1,20 +0,0 @@
-GroupTest('Validator Tests');
- $this->addTestFile('validator_unit_test.php');
- $this->addTestFile('validator_error_test.php');
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new ValidatorTests();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/validator_unit_test.php b/airtime_mvc/library/pear/Calendar/tests/validator_unit_test.php
deleted file mode 100644
index c655bee02..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/validator_unit_test.php
+++ /dev/null
@@ -1,210 +0,0 @@
-UnitTestCase('Test of Validator');
- }
- function setUp() {
- $this->mockengine = new Mock_Calendar_Engine($this);
- $this->mockengine->setReturnValue('getMinYears',1970);
- $this->mockengine->setReturnValue('getMaxYears',2037);
- $this->mockengine->setReturnValue('getMonthsInYear',12);
- $this->mockengine->setReturnValue('getDaysInMonth',30);
- $this->mockengine->setReturnValue('getHoursInDay',24);
- $this->mockengine->setReturnValue('getMinutesInHour',60);
- $this->mockengine->setReturnValue('getSecondsInMinute',60);
- $this->mockcal = new Mock_Calendar_Second($this);
- $this->mockcal->setReturnValue('getEngine',$this->mockengine);
- }
- function tearDown() {
- unset ($this->mockengine);
- unset ($this->mocksecond);
- }
- function testIsValidYear() {
- $this->mockcal->setReturnValue('thisYear',2000);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertTrue($Validator->isValidYear());
- }
- function testIsValidYearTooSmall() {
- $this->mockcal->setReturnValue('thisYear',1969);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidYear());
- }
- function testIsValidYearTooLarge() {
- $this->mockcal->setReturnValue('thisYear',2038);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidYear());
- }
- function testIsValidMonth() {
- $this->mockcal->setReturnValue('thisMonth',10);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertTrue($Validator->isValidMonth());
- }
- function testIsValidMonthTooSmall() {
- $this->mockcal->setReturnValue('thisMonth',0);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidMonth());
- }
- function testIsValidMonthTooLarge() {
- $this->mockcal->setReturnValue('thisMonth',13);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidMonth());
- }
- function testIsValidDay() {
- $this->mockcal->setReturnValue('thisDay',10);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertTrue($Validator->isValidDay());
- }
- function testIsValidDayTooSmall() {
- $this->mockcal->setReturnValue('thisDay',0);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidDay());
- }
- function testIsValidDayTooLarge() {
- $this->mockcal->setReturnValue('thisDay',31);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidDay());
- }
- function testIsValidHour() {
- $this->mockcal->setReturnValue('thisHour',10);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertTrue($Validator->isValidHour());
- }
- function testIsValidHourTooSmall() {
- $this->mockcal->setReturnValue('thisHour',-1);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidHour());
- }
- function testIsValidHourTooLarge() {
- $this->mockcal->setReturnValue('thisHour',24);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidHour());
- }
- function testIsValidMinute() {
- $this->mockcal->setReturnValue('thisMinute',30);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertTrue($Validator->isValidMinute());
- }
- function testIsValidMinuteTooSmall() {
- $this->mockcal->setReturnValue('thisMinute',-1);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidMinute());
- }
- function testIsValidMinuteTooLarge() {
- $this->mockcal->setReturnValue('thisMinute',60);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidMinute());
- }
- function testIsValidSecond() {
- $this->mockcal->setReturnValue('thisSecond',30);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertTrue($Validator->isValidSecond());
- }
- function testIsValidSecondTooSmall() {
- $this->mockcal->setReturnValue('thisSecond',-1);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidSecond());
- }
- function testIsValidSecondTooLarge() {
- $this->mockcal->setReturnValue('thisSecond',60);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValidSecond());
- }
- function testIsValid() {
- $this->mockcal->setReturnValue('thisYear',2000);
- $this->mockcal->setReturnValue('thisMonth',5);
- $this->mockcal->setReturnValue('thisDay',15);
- $this->mockcal->setReturnValue('thisHour',13);
- $this->mockcal->setReturnValue('thisMinute',30);
- $this->mockcal->setReturnValue('thisSecond',40);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertTrue($Validator->isValid());
- }
- function testIsValidAllWrong() {
- $this->mockcal->setReturnValue('thisYear',2038);
- $this->mockcal->setReturnValue('thisMonth',13);
- $this->mockcal->setReturnValue('thisDay',31);
- $this->mockcal->day = 31;
- $this->mockcal->setReturnValue('thisHour',24);
- $this->mockcal->setReturnValue('thisMinute',60);
- $this->mockcal->setReturnValue('thisSecond',60);
- $Validator = new Calendar_Validator($this->mockcal);
- $this->assertFalse($Validator->isValid());
- $i = 0;
- while ( $Validator->fetch() ) {
- $i++;
- }
- $this->assertEqual($i,6);
- }
-}
-
-class TestOfValidatorLive extends UnitTestCase {
- function TestOfValidatorLive() {
- $this->UnitTestCase('Test of Validator Live');
- }
- function testYear() {
- $Unit = new Calendar_Year(2038);
- $Validator = & $Unit->getValidator();
- $this->assertFalse($Validator->isValidYear());
- }
- function testMonth() {
- $Unit = new Calendar_Month(2000,13);
- $Validator = & $Unit->getValidator();
- $this->assertFalse($Validator->isValidMonth());
- }
-/*
- function testWeek() {
- $Unit = new Calendar_Week(2000,12,7);
- $Validator = & $Unit->getValidator();
- $this->assertFalse($Validator->isValidWeek());
- }
-*/
- function testDay() {
- $Unit = new Calendar_Day(2000,12,32);
- $Validator = & $Unit->getValidator();
- $this->assertFalse($Validator->isValidDay());
- }
- function testHour() {
- $Unit = new Calendar_Hour(2000,12,20,24);
- $Validator = & $Unit->getValidator();
- $this->assertFalse($Validator->isValidHour());
- }
- function testMinute() {
- $Unit = new Calendar_Minute(2000,12,20,23,60);
- $Validator = & $Unit->getValidator();
- $this->assertFalse($Validator->isValidMinute());
- }
- function testSecond() {
- $Unit = new Calendar_Second(2000,12,20,23,59,60);
- $Validator = & $Unit->getValidator();
- $this->assertFalse($Validator->isValidSecond());
- }
- function testAllBad() {
- $Unit = new Calendar_Second(2000,13,32,24,60,60);
- $this->assertFalse($Unit->isValid());
- $Validator = & $Unit->getValidator();
- $i = 0;
- while ( $Validator->fetch() ) {
- $i++;
- }
- $this->assertEqual($i,5);
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfValidator();
- $test->run(new HtmlReporter());
- $test = &new TestOfValidatorLive();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/week_firstday_0_test.php b/airtime_mvc/library/pear/Calendar/tests/week_firstday_0_test.php
deleted file mode 100644
index 4ba0c48f5..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/week_firstday_0_test.php
+++ /dev/null
@@ -1,241 +0,0 @@
-UnitTestCase('Test of Week - Week Starting on Sunday');
- }
- function setUp() {
- $this->cal = Calendar_Factory::create('Week', 2003, 10, 9);
- //print_r($this->cal);
- }
- function testPrevDay () {
- $this->assertEqual(8, $this->cal->prevDay());
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 10,
- 'day' => 8,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testThisDay () {
- $this->assertEqual(9, $this->cal->thisDay());
- }
- function testNextDay () {
- $this->assertEqual(10, $this->cal->nextDay());
- }
- function testPrevHour () {
- $this->assertEqual(23, $this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(0, $this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(1, $this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(59, $this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0, $this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1, $this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59, $this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0, $this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1, $this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(0,0,0,10,9,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
- function testNewTimeStamp() {
- $stamp = mktime(0,0,0,7,28,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual('29 2004', date('W Y', $this->cal->prevWeek(true)));
- $this->assertEqual('30 2004', date('W Y', $this->cal->thisWeek(true)));
- $this->assertEqual('31 2004', date('W Y', $this->cal->nextWeek(true)));
- }
- function testPrevWeekInMonth() {
- $this->assertEqual(1, $this->cal->prevWeek());
- $stamp = mktime(0,0,0,2,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(0, $this->cal->prevWeek());
- }
- function testThisWeekInMonth() {
- $this->assertEqual(2, $this->cal->thisWeek());
- $stamp = mktime(0,0,0,2,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(1, $this->cal->thisWeek());
- $stamp = mktime(0,0,0,1,1,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(1, $this->cal->thisWeek());
- $stamp = mktime(0,0,0,1,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2, $this->cal->thisWeek());
- }
- function testNextWeekInMonth() {
- $this->assertEqual(3, $this->cal->nextWeek());
- $stamp = mktime(0,0,0,2,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2, $this->cal->nextWeek());
- }
- function testPrevWeekInYear() {
- $this->assertEqual(date('W', $this->cal->prevWeek('timestamp')), $this->cal->prevWeek('n_in_year'));
- $stamp = mktime(0,0,0,1,1,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
- }
- function testThisWeekInYear() {
- $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
- $stamp = mktime(0,0,0,1,1,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
- }
- function testFirstWeekInYear() {
- $stamp = mktime(0,0,0,1,4,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(1, $this->cal->thisWeek('n_in_year'));
- }
- function testNextWeekInYear() {
- $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
- }
- function testPrevWeekArray() {
- $testArray = array(
- 'year'=>2003,
- 'month'=>9,
- 'day'=>28,
- 'hour'=>0,
- 'minute'=>0,
- 'second'=>0
- );
- $this->assertEqual($testArray, $this->cal->prevWeek('array'));
- }
- function testThisWeekArray() {
- $testArray = array(
- 'year'=>2003,
- 'month'=>10,
- 'day'=>5,
- 'hour'=>0,
- 'minute'=>0,
- 'second'=>0
- );
- $this->assertEqual($testArray, $this->cal->thisWeek('array'));
- }
- function testNextWeekArray() {
- $testArray = array(
- 'year'=>2003,
- 'month'=>10,
- 'day'=>12,
- 'hour'=>0,
- 'minute'=>0,
- 'second'=>0
- );
- $this->assertEqual($testArray, $this->cal->nextWeek('array'));
- }
- function testPrevWeekObject() {
- $testWeek = Calendar_Factory::create('Week', 2003,9,28);
- $Week = $this->cal->prevWeek('object');
- $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp());
- }
- function testThisWeekObject() {
- $testWeek = Calendar_Factory::create('Week', 2003,10,5);
- $Week = $this->cal->thisWeek('object');
- $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp());
- }
- function testNextWeekObject() {
- $testWeek = Calendar_Factory::create('Week', 2003,10,12);
- $Week = $this->cal->nextWeek('object');
- $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp());
- }
-}
-
-class TestOfWeek_firstday_0_Build extends TestOfWeek_firstday_0 {
- function TestOfWeek_firstday_0_Build() {
- $this->UnitTestCase('Test of Week::build() - FirstDay = Sunday');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(7, $this->cal->size());
- }
-
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ($Child = $this->cal->fetch()) {
- $i++;
- }
- $this->assertEqual(7, $i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 1;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
-
- function testSelection() {
- require_once(CALENDAR_ROOT . 'Day.php');
- $selection = array(Calendar_Factory::create('Day', 2003, 10, 6));
- $this->cal->build($selection);
- $i = 1;
- while ($Child = $this->cal->fetch()) {
- if ($i == 2) {
- break; //06-10-2003 is the 2nd day of the week
- }
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
- function testSelectionCornerCase() {
- require_once(CALENDAR_ROOT . 'Day.php');
- $selectedDays = array(
- Calendar_Factory::create('Day', 2003, 12, 28),
- Calendar_Factory::create('Day', 2003, 12, 29),
- Calendar_Factory::create('Day', 2003, 12, 30),
- Calendar_Factory::create('Day', 2003, 12, 31),
- Calendar_Factory::create('Day', 2004, 01, 01),
- Calendar_Factory::create('Day', 2004, 01, 02),
- Calendar_Factory::create('Day', 2004, 01, 03)
- );
- $this->cal = Calendar_Factory::create('Week', 2003, 12, 31, 0);
- $this->cal->build($selectedDays);
- while ($Day = $this->cal->fetch()) {
- $this->assertTrue($Day->isSelected());
- }
- $this->cal = Calendar_Factory::create('Week', 2004, 1, 1, 0);
- $this->cal->build($selectedDays);
- while ($Day = $this->cal->fetch()) {
- $this->assertTrue($Day->isSelected());
- }
- }
-}
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfWeek_firstday_0();
- $test->run(new HtmlReporter());
- $test = &new TestOfWeek_firstday_0_Build();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/week_test.php b/airtime_mvc/library/pear/Calendar/tests/week_test.php
deleted file mode 100644
index 64db83071..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/week_test.php
+++ /dev/null
@@ -1,276 +0,0 @@
-UnitTestCase('Test of Week');
- }
- function setUp() {
- $this->cal = Calendar_Factory::create('Week', 2003, 10, 9);
- //print_r($this->cal);
- }
- function testThisYear () {
- $this->assertEqual(2003, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,1,1,2003);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2003, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,12,31,2003);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2004, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,1,1,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2004, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,12,31,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2004, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,1,1,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2004, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,12,31,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2005, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,1,1,2006);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2005, $this->cal->thisYear());
-
- $stamp = mktime(0,0,0,12,31,2006);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2006, $this->cal->thisYear());
- }
- function testPrevDay () {
- $this->assertEqual(8, $this->cal->prevDay());
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2003,
- 'month' => 10,
- 'day' => 8,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testThisDay () {
- $this->assertEqual(9, $this->cal->thisDay());
- }
- function testNextDay () {
- $this->assertEqual(10, $this->cal->nextDay());
- }
- function testPrevHour () {
- $this->assertEqual(23, $this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(0, $this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(1, $this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(59, $this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0, $this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1, $this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59, $this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0, $this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1, $this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(0,0,0,10,9,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
- function testNewTimeStamp() {
- $stamp = mktime(0,0,0,7,28,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual('30 2004', date('W Y', $this->cal->prevWeek(true)));
- $this->assertEqual('31 2004', date('W Y', $this->cal->thisWeek(true)));
- $this->assertEqual('32 2004', date('W Y', $this->cal->nextWeek(true)));
- }
- function testPrevWeekInMonth() {
- $this->assertEqual(1, $this->cal->prevWeek());
- $stamp = mktime(0,0,0,2,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(0, $this->cal->prevWeek());
- }
- function testThisWeekInMonth() {
- $this->assertEqual(2, $this->cal->thisWeek());
- $stamp = mktime(0,0,0,2,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(1, $this->cal->thisWeek());
- $stamp = mktime(0,0,0,1,1,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(1, $this->cal->thisWeek());
- $stamp = mktime(0,0,0,1,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2, $this->cal->thisWeek());
- }
- function testNextWeekInMonth() {
- $this->assertEqual(3, $this->cal->nextWeek());
- $stamp = mktime(0,0,0,2,3,2005);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(2, $this->cal->nextWeek());
- }
- function testPrevWeekInYear() {
- $this->assertEqual(date('W', $this->cal->prevWeek('timestamp')), $this->cal->prevWeek('n_in_year'));
- $stamp = mktime(0,0,0,1,1,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
- }
- function testThisWeekInYear() {
- $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
- $stamp = mktime(0,0,0,1,1,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year'));
- }
- function testFirstWeekInYear() {
- $stamp = mktime(0,0,0,1,4,2004);
- $this->cal->setTimestamp($stamp);
- $this->assertEqual(1, $this->cal->thisWeek('n_in_year'));
- }
- function testNextWeekInYear() {
- $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year'));
- }
- function testPrevWeekArray() {
- $testArray = array(
- 'year'=>2003,
- 'month'=>9,
- 'day'=>29,
- 'hour'=>0,
- 'minute'=>0,
- 'second'=>0
- );
- $this->assertEqual($testArray, $this->cal->prevWeek('array'));
- }
- function testThisWeekArray() {
- $testArray = array(
- 'year'=>2003,
- 'month'=>10,
- 'day'=>6,
- 'hour'=>0,
- 'minute'=>0,
- 'second'=>0
- );
- $this->assertEqual($testArray, $this->cal->thisWeek('array'));
- }
- function testNextWeekArray() {
- $testArray = array(
- 'year'=>2003,
- 'month'=>10,
- 'day'=>13,
- 'hour'=>0,
- 'minute'=>0,
- 'second'=>0
- );
- $this->assertEqual($testArray, $this->cal->nextWeek('array'));
- }
- function testPrevWeekObject() {
- $testWeek = Calendar_Factory::create('Week', 2003, 9, 29); //week starts on monday
- $Week = $this->cal->prevWeek('object');
- $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp());
- }
- function testThisWeekObject() {
- $testWeek = Calendar_Factory::create('Week', 2003, 10, 6); //week starts on monday
- $Week = $this->cal->thisWeek('object');
- $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp());
- }
- function testNextWeekObject() {
- $testWeek = Calendar_Factory::create('Week', 2003, 10, 13); //week starts on monday
- $Week = $this->cal->nextWeek('object');
- $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp());
- }
-}
-
-class TestOfWeekBuild extends TestOfWeek {
- function TestOfWeekBuild() {
- $this->UnitTestCase('Test of Week::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(7, $this->cal->size());
- }
-
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ($Child = $this->cal->fetch()) {
- $i++;
- }
- $this->assertEqual(7, $i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 1;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
-
- function testSelection() {
- require_once(CALENDAR_ROOT . 'Day.php');
- $selection = array(Calendar_Factory::create('Day', 2003, 10, 7));
- $this->cal->build($selection);
- $i = 1;
- while ($Child = $this->cal->fetch()) {
- if ($i == 2) {
- break; //07-10-2003 is the 2nd day of the week (starting on monday)
- }
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
- function testSelectionCornerCase() {
- require_once(CALENDAR_ROOT . 'Day.php');
- $selectedDays = array(
- Calendar_Factory::create('Day', 2003, 12, 29),
- Calendar_Factory::create('Day', 2003, 12, 30),
- Calendar_Factory::create('Day', 2003, 12, 31),
- Calendar_Factory::create('Day', 2004, 01, 01),
- Calendar_Factory::create('Day', 2004, 01, 02),
- Calendar_Factory::create('Day', 2004, 01, 03),
- Calendar_Factory::create('Day', 2004, 01, 04)
- );
- $this->cal = Calendar_Factory::create('Week', 2003, 12, 31, 0);
- $this->cal->build($selectedDays);
- while ($Day = $this->cal->fetch()) {
- $this->assertTrue($Day->isSelected());
- }
- $this->cal = Calendar_Factory::create('Week', 2004, 1, 1, 0);
- $this->cal->build($selectedDays);
- while ($Day = $this->cal->fetch()) {
- $this->assertTrue($Day->isSelected());
- }
- }
-}
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfWeek();
- $test->run(new HtmlReporter());
- $test = &new TestOfWeekBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Calendar/tests/year_test.php b/airtime_mvc/library/pear/Calendar/tests/year_test.php
deleted file mode 100644
index bacd1ec8d..000000000
--- a/airtime_mvc/library/pear/Calendar/tests/year_test.php
+++ /dev/null
@@ -1,142 +0,0 @@
-UnitTestCase('Test of Year');
- }
- function setUp() {
- $this->cal = new Calendar_Year(2003);
- }
- function testPrevYear_Object() {
- $this->assertEqual(new Calendar_Year(2002), $this->cal->prevYear('object'));
- }
- function testThisYear_Object() {
- $this->assertEqual(new Calendar_Year(2003), $this->cal->thisYear('object'));
- }
- function testPrevMonth () {
- $this->assertEqual(12,$this->cal->prevMonth());
- }
- function testPrevMonth_Array () {
- $this->assertEqual(
- array(
- 'year' => 2002,
- 'month' => 12,
- 'day' => 1,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevMonth('array'));
- }
- function testThisMonth () {
- $this->assertEqual(1,$this->cal->thisMonth());
- }
- function testNextMonth () {
- $this->assertEqual(2,$this->cal->nextMonth());
- }
- function testPrevDay () {
- $this->assertEqual(31,$this->cal->prevDay());
- }
- function testPrevDay_Array () {
- $this->assertEqual(
- array(
- 'year' => 2002,
- 'month' => 12,
- 'day' => 31,
- 'hour' => 0,
- 'minute' => 0,
- 'second' => 0),
- $this->cal->prevDay('array'));
- }
- function testThisDay () {
- $this->assertEqual(1,$this->cal->thisDay());
- }
- function testNextDay () {
- $this->assertEqual(2,$this->cal->nextDay());
- }
- function testPrevHour () {
- $this->assertEqual(23,$this->cal->prevHour());
- }
- function testThisHour () {
- $this->assertEqual(0,$this->cal->thisHour());
- }
- function testNextHour () {
- $this->assertEqual(1,$this->cal->nextHour());
- }
- function testPrevMinute () {
- $this->assertEqual(59,$this->cal->prevMinute());
- }
- function testThisMinute () {
- $this->assertEqual(0,$this->cal->thisMinute());
- }
- function testNextMinute () {
- $this->assertEqual(1,$this->cal->nextMinute());
- }
- function testPrevSecond () {
- $this->assertEqual(59,$this->cal->prevSecond());
- }
- function testThisSecond () {
- $this->assertEqual(0,$this->cal->thisSecond());
- }
- function testNextSecond () {
- $this->assertEqual(1,$this->cal->nextSecond());
- }
- function testGetTimeStamp() {
- $stamp = mktime(0,0,0,1,1,2003);
- $this->assertEqual($stamp,$this->cal->getTimeStamp());
- }
-}
-
-class TestOfYearBuild extends TestOfYear {
- function TestOfYearBuild() {
- $this->UnitTestCase('Test of Year::build()');
- }
- function testSize() {
- $this->cal->build();
- $this->assertEqual(12,$this->cal->size());
- }
- function testFetch() {
- $this->cal->build();
- $i=0;
- while ( $Child = $this->cal->fetch() ) {
- $i++;
- }
- $this->assertEqual(12,$i);
- }
- function testFetchAll() {
- $this->cal->build();
- $children = array();
- $i = 1;
- while ( $Child = $this->cal->fetch() ) {
- $children[$i]=$Child;
- $i++;
- }
- $this->assertEqual($children,$this->cal->fetchAll());
- }
- function testSelection() {
- require_once(CALENDAR_ROOT . 'Month.php');
- $selection = array(new Calendar_Month(2003,10));
- $this->cal->build($selection);
- $i = 1;
- while ( $Child = $this->cal->fetch() ) {
- if ( $i == 10 )
- break;
- $i++;
- }
- $this->assertTrue($Child->isSelected());
- }
-}
-
-if (!defined('TEST_RUNNING')) {
- define('TEST_RUNNING', true);
- $test = &new TestOfYear();
- $test->run(new HtmlReporter());
- $test = &new TestOfYearBuild();
- $test->run(new HtmlReporter());
-}
-?>
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/Console/Getopt.php b/airtime_mvc/library/pear/Console/Getopt.php
deleted file mode 100644
index bb9d69ca2..000000000
--- a/airtime_mvc/library/pear/Console/Getopt.php
+++ /dev/null
@@ -1,290 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Getopt.php,v 1.4 2007/06/12 14:58:56 cellog Exp $
-
-require_once 'PEAR.php';
-
-/**
- * Command-line options parsing class.
- *
- * @author Andrei Zmievski
- *
- */
-class Console_Getopt {
- /**
- * Parses the command-line options.
- *
- * The first parameter to this function should be the list of command-line
- * arguments without the leading reference to the running program.
- *
- * The second parameter is a string of allowed short options. Each of the
- * option letters can be followed by a colon ':' to specify that the option
- * requires an argument, or a double colon '::' to specify that the option
- * takes an optional argument.
- *
- * The third argument is an optional array of allowed long options. The
- * leading '--' should not be included in the option name. Options that
- * require an argument should be followed by '=', and options that take an
- * option argument should be followed by '=='.
- *
- * The return value is an array of two elements: the list of parsed
- * options and the list of non-option command-line arguments. Each entry in
- * the list of parsed options is a pair of elements - the first one
- * specifies the option, and the second one specifies the option argument,
- * if there was one.
- *
- * Long and short options can be mixed.
- *
- * Most of the semantics of this function are based on GNU getopt_long().
- *
- * @param array $args an array of command-line arguments
- * @param string $short_options specifies the list of allowed short options
- * @param array $long_options specifies the list of allowed long options
- *
- * @return array two-element array containing the list of parsed options and
- * the non-option arguments
- *
- * @access public
- *
- */
- function getopt2($args, $short_options, $long_options = null)
- {
- return Console_Getopt::doGetopt(2, $args, $short_options, $long_options);
- }
-
- /**
- * This function expects $args to start with the script name (POSIX-style).
- * Preserved for backwards compatibility.
- * @see getopt2()
- */
- function getopt($args, $short_options, $long_options = null)
- {
- return Console_Getopt::doGetopt(1, $args, $short_options, $long_options);
- }
-
- /**
- * The actual implementation of the argument parsing code.
- */
- function doGetopt($version, $args, $short_options, $long_options = null)
- {
- // in case you pass directly readPHPArgv() as the first arg
- if (PEAR::isError($args)) {
- return $args;
- }
- if (empty($args)) {
- return array(array(), array());
- }
- $opts = array();
- $non_opts = array();
-
- settype($args, 'array');
-
- if ($long_options) {
- sort($long_options);
- }
-
- /*
- * Preserve backwards compatibility with callers that relied on
- * erroneous POSIX fix.
- */
- if ($version < 2) {
- if (isset($args[0]{0}) && $args[0]{0} != '-') {
- array_shift($args);
- }
- }
-
- reset($args);
- while (list($i, $arg) = each($args)) {
-
- /* The special element '--' means explicit end of
- options. Treat the rest of the arguments as non-options
- and end the loop. */
- if ($arg == '--') {
- $non_opts = array_merge($non_opts, array_slice($args, $i + 1));
- break;
- }
-
- if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
- $non_opts = array_merge($non_opts, array_slice($args, $i));
- break;
- } elseif (strlen($arg) > 1 && $arg{1} == '-') {
- $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- } elseif ($arg == '-') {
- // - is stdin
- $non_opts = array_merge($non_opts, array_slice($args, $i));
- break;
- } else {
- $error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- }
- }
-
- return array($opts, $non_opts);
- }
-
- /**
- * @access private
- *
- */
- function _parseShortOption($arg, $short_options, &$opts, &$args)
- {
- for ($i = 0; $i < strlen($arg); $i++) {
- $opt = $arg{$i};
- $opt_arg = null;
-
- /* Try to find the short option in the specifier string. */
- if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
- {
- return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
- }
-
- if (strlen($spec) > 1 && $spec{1} == ':') {
- if (strlen($spec) > 2 && $spec{2} == ':') {
- if ($i + 1 < strlen($arg)) {
- /* Option takes an optional argument. Use the remainder of
- the arg string if there is anything left. */
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- }
- } else {
- /* Option requires an argument. Use the remainder of the arg
- string if there is anything left. */
- if ($i + 1 < strlen($arg)) {
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- } else if (list(, $opt_arg) = each($args)) {
- /* Else use the next argument. */;
- if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) {
- return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt");
- }
- } else {
- return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt");
- }
- }
- }
-
- $opts[] = array($opt, $opt_arg);
- }
- }
-
- /**
- * @access private
- *
- */
- function _isShortOpt($arg)
- {
- return strlen($arg) == 2 && $arg[0] == '-' && preg_match('/[a-zA-Z]/', $arg[1]);
- }
-
- /**
- * @access private
- *
- */
- function _isLongOpt($arg)
- {
- return strlen($arg) > 2 && $arg[0] == '-' && $arg[1] == '-' &&
- preg_match('/[a-zA-Z]+$/', substr($arg, 2));
- }
-
- /**
- * @access private
- *
- */
- function _parseLongOption($arg, $long_options, &$opts, &$args)
- {
- @list($opt, $opt_arg) = explode('=', $arg, 2);
- $opt_len = strlen($opt);
-
- for ($i = 0; $i < count($long_options); $i++) {
- $long_opt = $long_options[$i];
- $opt_start = substr($long_opt, 0, $opt_len);
- $long_opt_name = str_replace('=', '', $long_opt);
-
- /* Option doesn't match. Go on to the next one. */
- if ($long_opt_name != $opt) {
- continue;
- }
-
- $opt_rest = substr($long_opt, $opt_len);
-
- /* Check that the options uniquely matches one of the allowed
- options. */
- if ($i + 1 < count($long_options)) {
- $next_option_rest = substr($long_options[$i + 1], $opt_len);
- } else {
- $next_option_rest = '';
- }
- if ($opt_rest != '' && $opt{0} != '=' &&
- $i + 1 < count($long_options) &&
- $opt == substr($long_options[$i+1], 0, $opt_len) &&
- $next_option_rest != '' &&
- $next_option_rest{0} != '=') {
- return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
- }
-
- if (substr($long_opt, -1) == '=') {
- if (substr($long_opt, -2) != '==') {
- /* Long option requires an argument.
- Take the next argument if one wasn't specified. */;
- if (!strlen($opt_arg) && !(list(, $opt_arg) = each($args))) {
- return PEAR::raiseError("Console_Getopt: option --$opt requires an argument");
- }
- if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) {
- return PEAR::raiseError("Console_Getopt: option requires an argument --$opt");
- }
- }
- } else if ($opt_arg) {
- return PEAR::raiseError("Console_Getopt: option --$opt doesn't allow an argument");
- }
-
- $opts[] = array('--' . $opt, $opt_arg);
- return;
- }
-
- return PEAR::raiseError("Console_Getopt: unrecognized option --$opt");
- }
-
- /**
- * Safely read the $argv PHP array across different PHP configurations.
- * Will take care on register_globals and register_argc_argv ini directives
- *
- * @access public
- * @return mixed the $argv PHP array or PEAR error if not registered
- */
- function readPHPArgv()
- {
- global $argv;
- if (!is_array($argv)) {
- if (!@is_array($_SERVER['argv'])) {
- if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
- return PEAR::raiseError("Console_Getopt: Could not read cmd args (register_argc_argv=Off?)");
- }
- return $GLOBALS['HTTP_SERVER_VARS']['argv'];
- }
- return $_SERVER['argv'];
- }
- return $argv;
- }
-
-}
-
-?>
diff --git a/airtime_mvc/library/pear/DB.php b/airtime_mvc/library/pear/DB.php
deleted file mode 100644
index a511979e6..000000000
--- a/airtime_mvc/library/pear/DB.php
+++ /dev/null
@@ -1,1489 +0,0 @@
-
- * @author Tomas V.V.Cox
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: DB.php,v 1.88 2007/08/12 05:27:25 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the PEAR class so it can be extended from
- */
-require_once 'PEAR.php';
-
-
-// {{{ constants
-// {{{ error codes
-
-/**#@+
- * One of PEAR DB's portable error codes.
- * @see DB_common::errorCode(), DB::errorMessage()
- *
- * {@internal If you add an error code here, make sure you also add a textual
- * version of it in DB::errorMessage().}}
- */
-
-/**
- * The code returned by many methods upon success
- */
-define('DB_OK', 1);
-
-/**
- * Unkown error
- */
-define('DB_ERROR', -1);
-
-/**
- * Syntax error
- */
-define('DB_ERROR_SYNTAX', -2);
-
-/**
- * Tried to insert a duplicate value into a primary or unique index
- */
-define('DB_ERROR_CONSTRAINT', -3);
-
-/**
- * An identifier in the query refers to a non-existant object
- */
-define('DB_ERROR_NOT_FOUND', -4);
-
-/**
- * Tried to create a duplicate object
- */
-define('DB_ERROR_ALREADY_EXISTS', -5);
-
-/**
- * The current driver does not support the action you attempted
- */
-define('DB_ERROR_UNSUPPORTED', -6);
-
-/**
- * The number of parameters does not match the number of placeholders
- */
-define('DB_ERROR_MISMATCH', -7);
-
-/**
- * A literal submitted did not match the data type expected
- */
-define('DB_ERROR_INVALID', -8);
-
-/**
- * The current DBMS does not support the action you attempted
- */
-define('DB_ERROR_NOT_CAPABLE', -9);
-
-/**
- * A literal submitted was too long so the end of it was removed
- */
-define('DB_ERROR_TRUNCATED', -10);
-
-/**
- * A literal number submitted did not match the data type expected
- */
-define('DB_ERROR_INVALID_NUMBER', -11);
-
-/**
- * A literal date submitted did not match the data type expected
- */
-define('DB_ERROR_INVALID_DATE', -12);
-
-/**
- * Attempt to divide something by zero
- */
-define('DB_ERROR_DIVZERO', -13);
-
-/**
- * A database needs to be selected
- */
-define('DB_ERROR_NODBSELECTED', -14);
-
-/**
- * Could not create the object requested
- */
-define('DB_ERROR_CANNOT_CREATE', -15);
-
-/**
- * Could not drop the database requested because it does not exist
- */
-define('DB_ERROR_CANNOT_DROP', -17);
-
-/**
- * An identifier in the query refers to a non-existant table
- */
-define('DB_ERROR_NOSUCHTABLE', -18);
-
-/**
- * An identifier in the query refers to a non-existant column
- */
-define('DB_ERROR_NOSUCHFIELD', -19);
-
-/**
- * The data submitted to the method was inappropriate
- */
-define('DB_ERROR_NEED_MORE_DATA', -20);
-
-/**
- * The attempt to lock the table failed
- */
-define('DB_ERROR_NOT_LOCKED', -21);
-
-/**
- * The number of columns doesn't match the number of values
- */
-define('DB_ERROR_VALUE_COUNT_ON_ROW', -22);
-
-/**
- * The DSN submitted has problems
- */
-define('DB_ERROR_INVALID_DSN', -23);
-
-/**
- * Could not connect to the database
- */
-define('DB_ERROR_CONNECT_FAILED', -24);
-
-/**
- * The PHP extension needed for this DBMS could not be found
- */
-define('DB_ERROR_EXTENSION_NOT_FOUND',-25);
-
-/**
- * The present user has inadequate permissions to perform the task requestd
- */
-define('DB_ERROR_ACCESS_VIOLATION', -26);
-
-/**
- * The database requested does not exist
- */
-define('DB_ERROR_NOSUCHDB', -27);
-
-/**
- * Tried to insert a null value into a column that doesn't allow nulls
- */
-define('DB_ERROR_CONSTRAINT_NOT_NULL',-29);
-/**#@-*/
-
-
-// }}}
-// {{{ prepared statement-related
-
-
-/**#@+
- * Identifiers for the placeholders used in prepared statements.
- * @see DB_common::prepare()
- */
-
-/**
- * Indicates a scalar (?) placeholder was used
- *
- * Quote and escape the value as necessary.
- */
-define('DB_PARAM_SCALAR', 1);
-
-/**
- * Indicates an opaque (&) placeholder was used
- *
- * The value presented is a file name. Extract the contents of that file
- * and place them in this column.
- */
-define('DB_PARAM_OPAQUE', 2);
-
-/**
- * Indicates a misc (!) placeholder was used
- *
- * The value should not be quoted or escaped.
- */
-define('DB_PARAM_MISC', 3);
-/**#@-*/
-
-
-// }}}
-// {{{ binary data-related
-
-
-/**#@+
- * The different ways of returning binary data from queries.
- */
-
-/**
- * Sends the fetched data straight through to output
- */
-define('DB_BINMODE_PASSTHRU', 1);
-
-/**
- * Lets you return data as usual
- */
-define('DB_BINMODE_RETURN', 2);
-
-/**
- * Converts the data to hex format before returning it
- *
- * For example the string "123" would become "313233".
- */
-define('DB_BINMODE_CONVERT', 3);
-/**#@-*/
-
-
-// }}}
-// {{{ fetch modes
-
-
-/**#@+
- * Fetch Modes.
- * @see DB_common::setFetchMode()
- */
-
-/**
- * Indicates the current default fetch mode should be used
- * @see DB_common::$fetchmode
- */
-define('DB_FETCHMODE_DEFAULT', 0);
-
-/**
- * Column data indexed by numbers, ordered from 0 and up
- */
-define('DB_FETCHMODE_ORDERED', 1);
-
-/**
- * Column data indexed by column names
- */
-define('DB_FETCHMODE_ASSOC', 2);
-
-/**
- * Column data as object properties
- */
-define('DB_FETCHMODE_OBJECT', 3);
-
-/**
- * For multi-dimensional results, make the column name the first level
- * of the array and put the row number in the second level of the array
- *
- * This is flipped from the normal behavior, which puts the row numbers
- * in the first level of the array and the column names in the second level.
- */
-define('DB_FETCHMODE_FLIPPED', 4);
-/**#@-*/
-
-/**#@+
- * Old fetch modes. Left here for compatibility.
- */
-define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
-define('DB_GETMODE_ASSOC', DB_FETCHMODE_ASSOC);
-define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
-/**#@-*/
-
-
-// }}}
-// {{{ tableInfo() && autoPrepare()-related
-
-
-/**#@+
- * The type of information to return from the tableInfo() method.
- *
- * Bitwised constants, so they can be combined using |
- * and removed using ^.
- *
- * @see DB_common::tableInfo()
- *
- * {@internal Since the TABLEINFO constants are bitwised, if more of them are
- * added in the future, make sure to adjust DB_TABLEINFO_FULL accordingly.}}
- */
-define('DB_TABLEINFO_ORDER', 1);
-define('DB_TABLEINFO_ORDERTABLE', 2);
-define('DB_TABLEINFO_FULL', 3);
-/**#@-*/
-
-
-/**#@+
- * The type of query to create with the automatic query building methods.
- * @see DB_common::autoPrepare(), DB_common::autoExecute()
- */
-define('DB_AUTOQUERY_INSERT', 1);
-define('DB_AUTOQUERY_UPDATE', 2);
-/**#@-*/
-
-
-// }}}
-// {{{ portability modes
-
-
-/**#@+
- * Portability Modes.
- *
- * Bitwised constants, so they can be combined using |
- * and removed using ^.
- *
- * @see DB_common::setOption()
- *
- * {@internal Since the PORTABILITY constants are bitwised, if more of them are
- * added in the future, make sure to adjust DB_PORTABILITY_ALL accordingly.}}
- */
-
-/**
- * Turn off all portability features
- */
-define('DB_PORTABILITY_NONE', 0);
-
-/**
- * Convert names of tables and fields to lower case
- * when using the get*(), fetch*() and tableInfo() methods
- */
-define('DB_PORTABILITY_LOWERCASE', 1);
-
-/**
- * Right trim the data output by get*() and fetch*()
- */
-define('DB_PORTABILITY_RTRIM', 2);
-
-/**
- * Force reporting the number of rows deleted
- */
-define('DB_PORTABILITY_DELETE_COUNT', 4);
-
-/**
- * Enable hack that makes numRows() work in Oracle
- */
-define('DB_PORTABILITY_NUMROWS', 8);
-
-/**
- * Makes certain error messages in certain drivers compatible
- * with those from other DBMS's
- *
- * + mysql, mysqli: change unique/primary key constraints
- * DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
- *
- * + odbc(access): MS's ODBC driver reports 'no such field' as code
- * 07001, which means 'too few parameters.' When this option is on
- * that code gets mapped to DB_ERROR_NOSUCHFIELD.
- */
-define('DB_PORTABILITY_ERRORS', 16);
-
-/**
- * Convert null values to empty strings in data output by
- * get*() and fetch*()
- */
-define('DB_PORTABILITY_NULL_TO_EMPTY', 32);
-
-/**
- * Turn on all portability features
- */
-define('DB_PORTABILITY_ALL', 63);
-/**#@-*/
-
-// }}}
-
-
-// }}}
-// {{{ class DB
-
-/**
- * Database independent query interface
- *
- * The main "DB" class is simply a container class with some static
- * methods for creating DB objects as well as some utility functions
- * common to all parts of DB.
- *
- * The object model of DB is as follows (indentation means inheritance):
- *
- * DB The main DB class. This is simply a utility class
- * with some "static" methods for creating DB objects as
- * well as common utility functions for other DB classes.
- *
- * DB_common The base for each DB implementation. Provides default
- * | implementations (in OO lingo virtual methods) for
- * | the actual DB implementations as well as a bunch of
- * | query utility functions.
- * |
- * +-DB_mysql The DB implementation for MySQL. Inherits DB_common.
- * When calling DB::factory or DB::connect for MySQL
- * connections, the object returned is an instance of this
- * class.
- *
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @author Tomas V.V.Cox
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB
-{
- // {{{ &factory()
-
- /**
- * Create a new DB object for the specified database type but don't
- * connect to the database
- *
- * @param string $type the database type (eg "mysql")
- * @param array $options an associative array of option names and values
- *
- * @return object a new DB object. A DB_Error object on failure.
- *
- * @see DB_common::setOption()
- */
- function &factory($type, $options = false)
- {
- if (!is_array($options)) {
- $options = array('persistent' => $options);
- }
-
- if (isset($options['debug']) && $options['debug'] >= 2) {
- // expose php errors with sufficient debug level
- include_once "DB/{$type}.php";
- } else {
- @include_once "DB/{$type}.php";
- }
-
- $classname = "DB_${type}";
-
- if (!class_exists($classname)) {
- $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
- "Unable to include the DB/{$type}.php"
- . " file for '$dsn'",
- 'DB_Error', true);
- return $tmp;
- }
-
- @$obj = new $classname;
-
- foreach ($options as $option => $value) {
- $test = $obj->setOption($option, $value);
- if (DB::isError($test)) {
- return $test;
- }
- }
-
- return $obj;
- }
-
- // }}}
- // {{{ &connect()
-
- /**
- * Create a new DB object including a connection to the specified database
- *
- * Example 1.
- *
- * require_once 'DB.php';
- *
- * $dsn = 'pgsql://user:password@host/database';
- * $options = array(
- * 'debug' => 2,
- * 'portability' => DB_PORTABILITY_ALL,
- * );
- *
- * $db =& DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param mixed $dsn the string "data source name" or array in the
- * format returned by DB::parseDSN()
- * @param array $options an associative array of option names and values
- *
- * @return object a new DB object. A DB_Error object on failure.
- *
- * @uses DB_dbase::connect(), DB_fbsql::connect(), DB_ibase::connect(),
- * DB_ifx::connect(), DB_msql::connect(), DB_mssql::connect(),
- * DB_mysql::connect(), DB_mysqli::connect(), DB_oci8::connect(),
- * DB_odbc::connect(), DB_pgsql::connect(), DB_sqlite::connect(),
- * DB_sybase::connect()
- *
- * @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError()
- */
- function &connect($dsn, $options = array())
- {
- $dsninfo = DB::parseDSN($dsn);
- $type = $dsninfo['phptype'];
-
- if (!is_array($options)) {
- /*
- * For backwards compatibility. $options used to be boolean,
- * indicating whether the connection should be persistent.
- */
- $options = array('persistent' => $options);
- }
-
- if (isset($options['debug']) && $options['debug'] >= 2) {
- // expose php errors with sufficient debug level
- include_once "DB/${type}.php";
- } else {
- @include_once "DB/${type}.php";
- }
-
- $classname = "DB_${type}";
- if (!class_exists($classname)) {
- $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
- "Unable to include the DB/{$type}.php"
- . " file for '$dsn'",
- 'DB_Error', true);
- return $tmp;
- }
-
- @$obj = new $classname;
-
- foreach ($options as $option => $value) {
- $test = $obj->setOption($option, $value);
- if (DB::isError($test)) {
- return $test;
- }
- }
-
- $err = $obj->connect($dsninfo, $obj->getOption('persistent'));
- if (DB::isError($err)) {
- if (is_array($dsn)) {
- $err->addUserInfo(DB::getDSNString($dsn, true));
- } else {
- $err->addUserInfo($dsn);
- }
- return $err;
- }
-
- return $obj;
- }
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Return the DB API version
- *
- * @return string the DB API version number
- */
- function apiVersion()
- {
- return '1.7.13';
- }
-
- // }}}
- // {{{ isError()
-
- /**
- * Determines if a variable is a DB_Error object
- *
- * @param mixed $value the variable to check
- *
- * @return bool whether $value is DB_Error object
- */
- function isError($value)
- {
- return is_a($value, 'DB_Error');
- }
-
- // }}}
- // {{{ isConnection()
-
- /**
- * Determines if a value is a DB_ object
- *
- * @param mixed $value the value to test
- *
- * @return bool whether $value is a DB_ object
- */
- function isConnection($value)
- {
- return (is_object($value) &&
- is_subclass_of($value, 'db_common') &&
- method_exists($value, 'simpleQuery'));
- }
-
- // }}}
- // {{{ isManip()
-
- /**
- * Tell whether a query is a data manipulation or data definition query
- *
- * Examples of data manipulation queries are INSERT, UPDATE and DELETE.
- * Examples of data definition queries are CREATE, DROP, ALTER, GRANT,
- * REVOKE.
- *
- * @param string $query the query
- *
- * @return boolean whether $query is a data manipulation query
- */
- function isManip($query)
- {
- $manips = 'INSERT|UPDATE|DELETE|REPLACE|'
- . 'CREATE|DROP|'
- . 'LOAD DATA|SELECT .* INTO .* FROM|COPY|'
- . 'ALTER|GRANT|REVOKE|'
- . 'LOCK|UNLOCK';
- if (preg_match('/^\s*"?(' . $manips . ')\s+/i', $query)) {
- return true;
- }
- return false;
- }
-
- // }}}
- // {{{ errorMessage()
-
- /**
- * Return a textual error message for a DB error code
- *
- * @param integer $value the DB error code
- *
- * @return string the error message or false if the error code was
- * not recognized
- */
- function errorMessage($value)
- {
- static $errorMessages;
- if (!isset($errorMessages)) {
- $errorMessages = array(
- DB_ERROR => 'unknown error',
- DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions',
- DB_ERROR_ALREADY_EXISTS => 'already exists',
- DB_ERROR_CANNOT_CREATE => 'can not create',
- DB_ERROR_CANNOT_DROP => 'can not drop',
- DB_ERROR_CONNECT_FAILED => 'connect failed',
- DB_ERROR_CONSTRAINT => 'constraint violation',
- DB_ERROR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint',
- DB_ERROR_DIVZERO => 'division by zero',
- DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found',
- DB_ERROR_INVALID => 'invalid',
- DB_ERROR_INVALID_DATE => 'invalid date or time',
- DB_ERROR_INVALID_DSN => 'invalid DSN',
- DB_ERROR_INVALID_NUMBER => 'invalid number',
- DB_ERROR_MISMATCH => 'mismatch',
- DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied',
- DB_ERROR_NODBSELECTED => 'no database selected',
- DB_ERROR_NOSUCHDB => 'no such database',
- DB_ERROR_NOSUCHFIELD => 'no such field',
- DB_ERROR_NOSUCHTABLE => 'no such table',
- DB_ERROR_NOT_CAPABLE => 'DB backend not capable',
- DB_ERROR_NOT_FOUND => 'not found',
- DB_ERROR_NOT_LOCKED => 'not locked',
- DB_ERROR_SYNTAX => 'syntax error',
- DB_ERROR_UNSUPPORTED => 'not supported',
- DB_ERROR_TRUNCATED => 'truncated',
- DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
- DB_OK => 'no error',
- );
- }
-
- if (DB::isError($value)) {
- $value = $value->getCode();
- }
-
- return isset($errorMessages[$value]) ? $errorMessages[$value]
- : $errorMessages[DB_ERROR];
- }
-
- // }}}
- // {{{ parseDSN()
-
- /**
- * Parse a data source name
- *
- * Additional keys can be added by appending a URI query string to the
- * end of the DSN.
- *
- * The format of the supplied DSN is in its fullest form:
- *
- * phptype(dbsyntax)://username:password@protocol+hostspec/database?option=8&another=true
- *
- *
- * Most variations are allowed:
- *
- * phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644
- * phptype://username:password@hostspec/database_name
- * phptype://username:password@hostspec
- * phptype://username@hostspec
- * phptype://hostspec/database
- * phptype://hostspec
- * phptype(dbsyntax)
- * phptype
- *
- *
- * @param string $dsn Data Source Name to be parsed
- *
- * @return array an associative array with the following keys:
- * + phptype: Database backend used in PHP (mysql, odbc etc.)
- * + dbsyntax: Database used with regards to SQL syntax etc.
- * + protocol: Communication protocol to use (tcp, unix etc.)
- * + hostspec: Host specification (hostname[:port])
- * + database: Database to use on the DBMS server
- * + username: User name for login
- * + password: Password for login
- */
- function parseDSN($dsn)
- {
- $parsed = array(
- 'phptype' => false,
- 'dbsyntax' => false,
- 'username' => false,
- 'password' => false,
- 'protocol' => false,
- 'hostspec' => false,
- 'port' => false,
- 'socket' => false,
- 'database' => false,
- );
-
- if (is_array($dsn)) {
- $dsn = array_merge($parsed, $dsn);
- if (!$dsn['dbsyntax']) {
- $dsn['dbsyntax'] = $dsn['phptype'];
- }
- return $dsn;
- }
-
- // Find phptype and dbsyntax
- if (($pos = strpos($dsn, '://')) !== false) {
- $str = substr($dsn, 0, $pos);
- $dsn = substr($dsn, $pos + 3);
- } else {
- $str = $dsn;
- $dsn = null;
- }
-
- // Get phptype and dbsyntax
- // $str => phptype(dbsyntax)
- if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
- $parsed['phptype'] = $arr[1];
- $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
- } else {
- $parsed['phptype'] = $str;
- $parsed['dbsyntax'] = $str;
- }
-
- if (!count($dsn)) {
- return $parsed;
- }
-
- // Get (if found): username and password
- // $dsn => username:password@protocol+hostspec/database
- if (($at = strrpos($dsn,'@')) !== false) {
- $str = substr($dsn, 0, $at);
- $dsn = substr($dsn, $at + 1);
- if (($pos = strpos($str, ':')) !== false) {
- $parsed['username'] = rawurldecode(substr($str, 0, $pos));
- $parsed['password'] = rawurldecode(substr($str, $pos + 1));
- } else {
- $parsed['username'] = rawurldecode($str);
- }
- }
-
- // Find protocol and hostspec
-
- if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
- // $dsn => proto(proto_opts)/database
- $proto = $match[1];
- $proto_opts = $match[2] ? $match[2] : false;
- $dsn = $match[3];
-
- } else {
- // $dsn => protocol+hostspec/database (old format)
- if (strpos($dsn, '+') !== false) {
- list($proto, $dsn) = explode('+', $dsn, 2);
- }
- if (strpos($dsn, '/') !== false) {
- list($proto_opts, $dsn) = explode('/', $dsn, 2);
- } else {
- $proto_opts = $dsn;
- $dsn = null;
- }
- }
-
- // process the different protocol options
- $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
- $proto_opts = rawurldecode($proto_opts);
- if (strpos($proto_opts, ':') !== false) {
- list($proto_opts, $parsed['port']) = explode(':', $proto_opts);
- }
- if ($parsed['protocol'] == 'tcp') {
- $parsed['hostspec'] = $proto_opts;
- } elseif ($parsed['protocol'] == 'unix') {
- $parsed['socket'] = $proto_opts;
- }
-
- // Get dabase if any
- // $dsn => database
- if ($dsn) {
- if (($pos = strpos($dsn, '?')) === false) {
- // /database
- $parsed['database'] = rawurldecode($dsn);
- } else {
- // /database?param1=value1¶m2=value2
- $parsed['database'] = rawurldecode(substr($dsn, 0, $pos));
- $dsn = substr($dsn, $pos + 1);
- if (strpos($dsn, '&') !== false) {
- $opts = explode('&', $dsn);
- } else { // database?param1=value1
- $opts = array($dsn);
- }
- foreach ($opts as $opt) {
- list($key, $value) = explode('=', $opt);
- if (!isset($parsed[$key])) {
- // don't allow params overwrite
- $parsed[$key] = rawurldecode($value);
- }
- }
- }
- }
-
- return $parsed;
- }
-
- // }}}
- // {{{ getDSNString()
-
- /**
- * Returns the given DSN in a string format suitable for output.
- *
- * @param array|string the DSN to parse and format
- * @param boolean true to hide the password, false to include it
- * @return string
- */
- function getDSNString($dsn, $hidePassword) {
- /* Calling parseDSN will ensure that we have all the array elements
- * defined, and means that we deal with strings and array in the same
- * manner. */
- $dsnArray = DB::parseDSN($dsn);
-
- if ($hidePassword) {
- $dsnArray['password'] = 'PASSWORD';
- }
-
- /* Protocol is special-cased, as using the default "tcp" along with an
- * Oracle TNS connection string fails. */
- if (is_string($dsn) && strpos($dsn, 'tcp') === false && $dsnArray['protocol'] == 'tcp') {
- $dsnArray['protocol'] = false;
- }
-
- // Now we just have to construct the actual string. This is ugly.
- $dsnString = $dsnArray['phptype'];
- if ($dsnArray['dbsyntax']) {
- $dsnString .= '('.$dsnArray['dbsyntax'].')';
- }
- $dsnString .= '://'
- .$dsnArray['username']
- .':'
- .$dsnArray['password']
- .'@'
- .$dsnArray['protocol'];
- if ($dsnArray['socket']) {
- $dsnString .= '('.$dsnArray['socket'].')';
- }
- if ($dsnArray['protocol'] && $dsnArray['hostspec']) {
- $dsnString .= '+';
- }
- $dsnString .= $dsnArray['hostspec'];
- if ($dsnArray['port']) {
- $dsnString .= ':'.$dsnArray['port'];
- }
- $dsnString .= '/'.$dsnArray['database'];
-
- /* Option handling. Unfortunately, parseDSN simply places options into
- * the top-level array, so we'll first get rid of the fields defined by
- * DB and see what's left. */
- unset($dsnArray['phptype'],
- $dsnArray['dbsyntax'],
- $dsnArray['username'],
- $dsnArray['password'],
- $dsnArray['protocol'],
- $dsnArray['socket'],
- $dsnArray['hostspec'],
- $dsnArray['port'],
- $dsnArray['database']
- );
- if (count($dsnArray) > 0) {
- $dsnString .= '?';
- $i = 0;
- foreach ($dsnArray as $key => $value) {
- if (++$i > 1) {
- $dsnString .= '&';
- }
- $dsnString .= $key.'='.$value;
- }
- }
-
- return $dsnString;
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class DB_Error
-
-/**
- * DB_Error implements a class for reporting portable database error
- * messages
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_Error extends PEAR_Error
-{
- // {{{ constructor
-
- /**
- * DB_Error constructor
- *
- * @param mixed $code DB error code, or string with error message
- * @param int $mode what "error mode" to operate in
- * @param int $level what error level to use for $mode &
- * PEAR_ERROR_TRIGGER
- * @param mixed $debuginfo additional debug info, such as the last query
- *
- * @see PEAR_Error
- */
- function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- if (is_int($code)) {
- $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code,
- $mode, $level, $debuginfo);
- } else {
- $this->PEAR_Error("DB Error: $code", DB_ERROR,
- $mode, $level, $debuginfo);
- }
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class DB_result
-
-/**
- * This class implements a wrapper for a DB result set
- *
- * A new instance of this class will be returned by the DB implementation
- * after processing a query that returns data.
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_result
-{
- // {{{ properties
-
- /**
- * Should results be freed automatically when there are no more rows?
- * @var boolean
- * @see DB_common::$options
- */
- var $autofree;
-
- /**
- * A reference to the DB_ object
- * @var object
- */
- var $dbh;
-
- /**
- * The current default fetch mode
- * @var integer
- * @see DB_common::$fetchmode
- */
- var $fetchmode;
-
- /**
- * The name of the class into which results should be fetched when
- * DB_FETCHMODE_OBJECT is in effect
- *
- * @var string
- * @see DB_common::$fetchmode_object_class
- */
- var $fetchmode_object_class;
-
- /**
- * The number of rows to fetch from a limit query
- * @var integer
- */
- var $limit_count = null;
-
- /**
- * The row to start fetching from in limit queries
- * @var integer
- */
- var $limit_from = null;
-
- /**
- * The execute parameters that created this result
- * @var array
- * @since Property available since Release 1.7.0
- */
- var $parameters;
-
- /**
- * The query string that created this result
- *
- * Copied here incase it changes in $dbh, which is referenced
- *
- * @var string
- * @since Property available since Release 1.7.0
- */
- var $query;
-
- /**
- * The query result resource id created by PHP
- * @var resource
- */
- var $result;
-
- /**
- * The present row being dealt with
- * @var integer
- */
- var $row_counter = null;
-
- /**
- * The prepared statement resource id created by PHP in $dbh
- *
- * This resource is only available when the result set was created using
- * a driver's native execute() method, not PEAR DB's emulated one.
- *
- * Copied here incase it changes in $dbh, which is referenced
- *
- * {@internal Mainly here because the InterBase/Firebird API is only
- * able to retrieve data from result sets if the statemnt handle is
- * still in scope.}}
- *
- * @var resource
- * @since Property available since Release 1.7.0
- */
- var $statement;
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor sets the object's properties
- *
- * @param object &$dbh the DB object reference
- * @param resource $result the result resource id
- * @param array $options an associative array with result options
- *
- * @return void
- */
- function DB_result(&$dbh, $result, $options = array())
- {
- $this->autofree = $dbh->options['autofree'];
- $this->dbh = &$dbh;
- $this->fetchmode = $dbh->fetchmode;
- $this->fetchmode_object_class = $dbh->fetchmode_object_class;
- $this->parameters = $dbh->last_parameters;
- $this->query = $dbh->last_query;
- $this->result = $result;
- $this->statement = empty($dbh->last_stmt) ? null : $dbh->last_stmt;
- foreach ($options as $key => $value) {
- $this->setOption($key, $value);
- }
- }
-
- /**
- * Set options for the DB_result object
- *
- * @param string $key the option to set
- * @param mixed $value the value to set the option to
- *
- * @return void
- */
- function setOption($key, $value = null)
- {
- switch ($key) {
- case 'limit_from':
- $this->limit_from = $value;
- break;
- case 'limit_count':
- $this->limit_count = $value;
- }
- }
-
- // }}}
- // {{{ fetchRow()
-
- /**
- * Fetch a row of data and return it by reference into an array
- *
- * The type of array returned can be controlled either by setting this
- * method's $fetchmode parameter or by changing the default
- * fetch mode setFetchMode() before calling this method.
- *
- * There are two options for standardizing the information returned
- * from databases, ensuring their values are consistent when changing
- * DBMS's. These portability options can be turned on when creating a
- * new DB object or by using setOption().
- *
- * + DB_PORTABILITY_LOWERCASE
- * convert names of fields to lower case
- *
- * + DB_PORTABILITY_RTRIM
- * right trim the data
- *
- * @param int $fetchmode the constant indicating how to format the data
- * @param int $rownum the row number to fetch (index starts at 0)
- *
- * @return mixed an array or object containing the row's data,
- * NULL when the end of the result set is reached
- * or a DB_Error object on failure.
- *
- * @see DB_common::setOption(), DB_common::setFetchMode()
- */
- function &fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
- {
- if ($fetchmode === DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->fetchmode;
- }
- if ($fetchmode === DB_FETCHMODE_OBJECT) {
- $fetchmode = DB_FETCHMODE_ASSOC;
- $object_class = $this->fetchmode_object_class;
- }
- if (is_null($rownum) && $this->limit_from !== null) {
- if ($this->row_counter === null) {
- $this->row_counter = $this->limit_from;
- // Skip rows
- if ($this->dbh->features['limit'] === false) {
- $i = 0;
- while ($i++ < $this->limit_from) {
- $this->dbh->fetchInto($this->result, $arr, $fetchmode);
- }
- }
- }
- if ($this->row_counter >= ($this->limit_from + $this->limit_count))
- {
- if ($this->autofree) {
- $this->free();
- }
- $tmp = null;
- return $tmp;
- }
- if ($this->dbh->features['limit'] === 'emulate') {
- $rownum = $this->row_counter;
- }
- $this->row_counter++;
- }
- $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
- if ($res === DB_OK) {
- if (isset($object_class)) {
- // The default mode is specified in the
- // DB_common::fetchmode_object_class property
- if ($object_class == 'stdClass') {
- $arr = (object) $arr;
- } else {
- $arr = new $object_class($arr);
- }
- }
- return $arr;
- }
- if ($res == null && $this->autofree) {
- $this->free();
- }
- return $res;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Fetch a row of data into an array which is passed by reference
- *
- * The type of array returned can be controlled either by setting this
- * method's $fetchmode parameter or by changing the default
- * fetch mode setFetchMode() before calling this method.
- *
- * There are two options for standardizing the information returned
- * from databases, ensuring their values are consistent when changing
- * DBMS's. These portability options can be turned on when creating a
- * new DB object or by using setOption().
- *
- * + DB_PORTABILITY_LOWERCASE
- * convert names of fields to lower case
- *
- * + DB_PORTABILITY_RTRIM
- * right trim the data
- *
- * @param array &$arr the variable where the data should be placed
- * @param int $fetchmode the constant indicating how to format the data
- * @param int $rownum the row number to fetch (index starts at 0)
- *
- * @return mixed DB_OK if a row is processed, NULL when the end of the
- * result set is reached or a DB_Error object on failure
- *
- * @see DB_common::setOption(), DB_common::setFetchMode()
- */
- function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
- {
- if ($fetchmode === DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->fetchmode;
- }
- if ($fetchmode === DB_FETCHMODE_OBJECT) {
- $fetchmode = DB_FETCHMODE_ASSOC;
- $object_class = $this->fetchmode_object_class;
- }
- if (is_null($rownum) && $this->limit_from !== null) {
- if ($this->row_counter === null) {
- $this->row_counter = $this->limit_from;
- // Skip rows
- if ($this->dbh->features['limit'] === false) {
- $i = 0;
- while ($i++ < $this->limit_from) {
- $this->dbh->fetchInto($this->result, $arr, $fetchmode);
- }
- }
- }
- if ($this->row_counter >= (
- $this->limit_from + $this->limit_count))
- {
- if ($this->autofree) {
- $this->free();
- }
- return null;
- }
- if ($this->dbh->features['limit'] === 'emulate') {
- $rownum = $this->row_counter;
- }
-
- $this->row_counter++;
- }
- $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
- if ($res === DB_OK) {
- if (isset($object_class)) {
- // default mode specified in the
- // DB_common::fetchmode_object_class property
- if ($object_class == 'stdClass') {
- $arr = (object) $arr;
- } else {
- $arr = new $object_class($arr);
- }
- }
- return DB_OK;
- }
- if ($res == null && $this->autofree) {
- $this->free();
- }
- return $res;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Get the the number of columns in a result set
- *
- * @return int the number of columns. A DB_Error object on failure.
- */
- function numCols()
- {
- return $this->dbh->numCols($this->result);
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Get the number of rows in a result set
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function numRows()
- {
- if ($this->dbh->features['numrows'] === 'emulate'
- && $this->dbh->options['portability'] & DB_PORTABILITY_NUMROWS)
- {
- if ($this->dbh->features['prepare']) {
- $res = $this->dbh->query($this->query, $this->parameters);
- } else {
- $res = $this->dbh->query($this->query);
- }
- if (DB::isError($res)) {
- return $res;
- }
- $i = 0;
- while ($res->fetchInto($tmp, DB_FETCHMODE_ORDERED)) {
- $i++;
- }
- $count = $i;
- } else {
- $count = $this->dbh->numRows($this->result);
- }
-
- /* fbsql is checked for here because limit queries are implemented
- * using a TOP() function, which results in fbsql_num_rows still
- * returning the total number of rows that would have been returned,
- * rather than the real number. As a result, we'll just do the limit
- * calculations for fbsql in the same way as a database with emulated
- * limits. Unfortunately, we can't just do this in DB_fbsql::numRows()
- * because that only gets the result resource, rather than the full
- * DB_Result object. */
- if (($this->dbh->features['limit'] === 'emulate'
- && $this->limit_from !== null)
- || $this->dbh->phptype == 'fbsql') {
- $limit_count = is_null($this->limit_count) ? $count : $this->limit_count;
- if ($count < $this->limit_from) {
- $count = 0;
- } elseif ($count < ($this->limit_from + $limit_count)) {
- $count -= $this->limit_from;
- } else {
- $count = $limit_count;
- }
- }
-
- return $count;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Get the next result if a batch of queries was executed
- *
- * @return bool true if a new result is available or false if not
- */
- function nextResult()
- {
- return $this->dbh->nextResult($this->result);
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Frees the resources allocated for this result set
- *
- * @return bool true on success. A DB_Error object on failure.
- */
- function free()
- {
- $err = $this->dbh->freeResult($this->result);
- if (DB::isError($err)) {
- return $err;
- }
- $this->result = false;
- $this->statement = false;
- return true;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * @see DB_common::tableInfo()
- * @deprecated Method deprecated some time before Release 1.2
- */
- function tableInfo($mode = null)
- {
- if (is_string($mode)) {
- return $this->dbh->raiseError(DB_ERROR_NEED_MORE_DATA);
- }
- return $this->dbh->tableInfo($this, $mode);
- }
-
- // }}}
- // {{{ getQuery()
-
- /**
- * Determine the query string that created this result
- *
- * @return string the query string
- *
- * @since Method available since Release 1.7.0
- */
- function getQuery()
- {
- return $this->query;
- }
-
- // }}}
- // {{{ getRowCounter()
-
- /**
- * Tells which row number is currently being processed
- *
- * @return integer the current row being looked at. Starts at 1.
- */
- function getRowCounter()
- {
- return $this->row_counter;
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class DB_row
-
-/**
- * PEAR DB Row Object
- *
- * The object contains a row of data from a result set. Each column's data
- * is placed in a property named for the column.
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- * @see DB_common::setFetchMode()
- */
-class DB_row
-{
- // {{{ constructor
-
- /**
- * The constructor places a row's data into properties of this object
- *
- * @param array the array containing the row's data
- *
- * @return void
- */
- function DB_row(&$arr)
- {
- foreach ($arr as $key => $value) {
- $this->$key = &$arr[$key];
- }
- }
-
- // }}}
-}
-
-// }}}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/common.php b/airtime_mvc/library/pear/DB/common.php
deleted file mode 100644
index 8d403126f..000000000
--- a/airtime_mvc/library/pear/DB/common.php
+++ /dev/null
@@ -1,2257 +0,0 @@
-
- * @author Tomas V.V. Cox
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: common.php,v 1.143 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the PEAR class so it can be extended from
- */
-require_once 'PEAR.php';
-
-/**
- * DB_common is the base class from which each database driver class extends
- *
- * All common methods are declared here. If a given DBMS driver contains
- * a particular method, that method will overload the one here.
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @author Tomas V.V. Cox
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_common extends PEAR
-{
- // {{{ properties
-
- /**
- * The current default fetch mode
- * @var integer
- */
- var $fetchmode = DB_FETCHMODE_ORDERED;
-
- /**
- * The name of the class into which results should be fetched when
- * DB_FETCHMODE_OBJECT is in effect
- *
- * @var string
- */
- var $fetchmode_object_class = 'stdClass';
-
- /**
- * Was a connection present when the object was serialized()?
- * @var bool
- * @see DB_common::__sleep(), DB_common::__wake()
- */
- var $was_connected = null;
-
- /**
- * The most recently executed query
- * @var string
- */
- var $last_query = '';
-
- /**
- * Run-time configuration options
- *
- * The 'optimize' option has been deprecated. Use the 'portability'
- * option instead.
- *
- * @var array
- * @see DB_common::setOption()
- */
- var $options = array(
- 'result_buffering' => 500,
- 'persistent' => false,
- 'ssl' => false,
- 'debug' => 0,
- 'seqname_format' => '%s_seq',
- 'autofree' => false,
- 'portability' => DB_PORTABILITY_NONE,
- 'optimize' => 'performance', // Deprecated. Use 'portability'.
- );
-
- /**
- * The parameters from the most recently executed query
- * @var array
- * @since Property available since Release 1.7.0
- */
- var $last_parameters = array();
-
- /**
- * The elements from each prepared statement
- * @var array
- */
- var $prepare_tokens = array();
-
- /**
- * The data types of the various elements in each prepared statement
- * @var array
- */
- var $prepare_types = array();
-
- /**
- * The prepared queries
- * @var array
- */
- var $prepared_queries = array();
-
- /**
- * Flag indicating that the last query was a manipulation query.
- * @access protected
- * @var boolean
- */
- var $_last_query_manip = false;
-
- /**
- * Flag indicating that the next query must be a manipulation
- * query.
- * @access protected
- * @var boolean
- */
- var $_next_query_manip = false;
-
-
- // }}}
- // {{{ DB_common
-
- /**
- * This constructor calls $this->PEAR('DB_Error')
- *
- * @return void
- */
- function DB_common()
- {
- $this->PEAR('DB_Error');
- }
-
- // }}}
- // {{{ __sleep()
-
- /**
- * Automatically indicates which properties should be saved
- * when PHP's serialize() function is called
- *
- * @return array the array of properties names that should be saved
- */
- function __sleep()
- {
- if ($this->connection) {
- // Don't disconnect(), people use serialize() for many reasons
- $this->was_connected = true;
- } else {
- $this->was_connected = false;
- }
- if (isset($this->autocommit)) {
- return array('autocommit',
- 'dbsyntax',
- 'dsn',
- 'features',
- 'fetchmode',
- 'fetchmode_object_class',
- 'options',
- 'was_connected',
- );
- } else {
- return array('dbsyntax',
- 'dsn',
- 'features',
- 'fetchmode',
- 'fetchmode_object_class',
- 'options',
- 'was_connected',
- );
- }
- }
-
- // }}}
- // {{{ __wakeup()
-
- /**
- * Automatically reconnects to the database when PHP's unserialize()
- * function is called
- *
- * The reconnection attempt is only performed if the object was connected
- * at the time PHP's serialize() function was run.
- *
- * @return void
- */
- function __wakeup()
- {
- if ($this->was_connected) {
- $this->connect($this->dsn, $this->options);
- }
- }
-
- // }}}
- // {{{ __toString()
-
- /**
- * Automatic string conversion for PHP 5
- *
- * @return string a string describing the current PEAR DB object
- *
- * @since Method available since Release 1.7.0
- */
- function __toString()
- {
- $info = strtolower(get_class($this));
- $info .= ': (phptype=' . $this->phptype .
- ', dbsyntax=' . $this->dbsyntax .
- ')';
- if ($this->connection) {
- $info .= ' [connected]';
- }
- return $info;
- }
-
- // }}}
- // {{{ toString()
-
- /**
- * DEPRECATED: String conversion method
- *
- * @return string a string describing the current PEAR DB object
- *
- * @deprecated Method deprecated in Release 1.7.0
- */
- function toString()
- {
- return $this->__toString();
- }
-
- // }}}
- // {{{ quoteString()
-
- /**
- * DEPRECATED: Quotes a string so it can be safely used within string
- * delimiters in a query
- *
- * @param string $string the string to be quoted
- *
- * @return string the quoted string
- *
- * @see DB_common::quoteSmart(), DB_common::escapeSimple()
- * @deprecated Method deprecated some time before Release 1.2
- */
- function quoteString($string)
- {
- $string = $this->quote($string);
- if ($string{0} == "'") {
- return substr($string, 1, -1);
- }
- return $string;
- }
-
- // }}}
- // {{{ quote()
-
- /**
- * DEPRECATED: Quotes a string so it can be safely used in a query
- *
- * @param string $string the string to quote
- *
- * @return string the quoted string or the string NULL
- * if the value submitted is null.
- *
- * @see DB_common::quoteSmart(), DB_common::escapeSimple()
- * @deprecated Deprecated in release 1.6.0
- */
- function quote($string = null)
- {
- return ($string === null) ? 'NULL'
- : "'" . str_replace("'", "''", $string) . "'";
- }
-
- // }}}
- // {{{ quoteIdentifier()
-
- /**
- * Quotes a string so it can be safely used as a table or column name
- *
- * Delimiting style depends on which database driver is being used.
- *
- * NOTE: just because you CAN use delimited identifiers doesn't mean
- * you SHOULD use them. In general, they end up causing way more
- * problems than they solve.
- *
- * Portability is broken by using the following characters inside
- * delimited identifiers:
- * + backtick (`) -- due to MySQL
- * + double quote (") -- due to Oracle
- * + brackets ([ or ]) -- due to Access
- *
- * Delimited identifiers are known to generally work correctly under
- * the following drivers:
- * + mssql
- * + mysql
- * + mysqli
- * + oci8
- * + odbc(access)
- * + odbc(db2)
- * + pgsql
- * + sqlite
- * + sybase (must execute set quoted_identifier on sometime
- * prior to use)
- *
- * InterBase doesn't seem to be able to use delimited identifiers
- * via PHP 4. They work fine under PHP 5.
- *
- * @param string $str the identifier name to be quoted
- *
- * @return string the quoted identifier
- *
- * @since Method available since Release 1.6.0
- */
- function quoteIdentifier($str)
- {
- return '"' . str_replace('"', '""', $str) . '"';
- }
-
- // }}}
- // {{{ quoteSmart()
-
- /**
- * Formats input so it can be safely used in a query
- *
- * The output depends on the PHP data type of input and the database
- * type being used.
- *
- * @param mixed $in the data to be formatted
- *
- * @return mixed the formatted data. The format depends on the input's
- * PHP type:
- *
- * -
- * input -> returns
- *
- * -
- * null -> the string NULL
- *
- * -
- * integer or double -> the unquoted number
- *
- * -
- * bool -> output depends on the driver in use
- * Most drivers return integers: 1 if
- * true or 0 if
- * false.
- * Some return strings: TRUE if
- * true or FALSE if
- * false.
- * Finally one returns strings: T if
- * true or F if
- * false. Here is a list of each DBMS,
- * the values returned and the suggested column type:
- *
- * -
- * dbase -> T/F
- * (Logical)
- *
- * -
- * fbase -> TRUE/FALSE
- * (BOOLEAN)
- *
- * -
- * ibase -> 1/0
- * (SMALLINT) [1]
- *
- * -
- * ifx -> 1/0
- * (SMALLINT) [1]
- *
- * -
- * msql -> 1/0
- * (INTEGER)
- *
- * -
- * mssql -> 1/0
- * (BIT)
- *
- * -
- * mysql -> 1/0
- * (TINYINT(1))
- *
- * -
- * mysqli -> 1/0
- * (TINYINT(1))
- *
- * -
- * oci8 -> 1/0
- * (NUMBER(1))
- *
- * -
- * odbc -> 1/0
- * (SMALLINT) [1]
- *
- * -
- * pgsql -> TRUE/FALSE
- * (BOOLEAN)
- *
- * -
- * sqlite -> 1/0
- * (INTEGER)
- *
- * -
- * sybase -> 1/0
- * (TINYINT(1))
- *
- *
- * [1] Accommodate the lowest common denominator because not all
- * versions of have BOOLEAN.
- *
- * -
- * other (including strings and numeric strings) ->
- * the data with single quotes escaped by preceeding
- * single quotes, backslashes are escaped by preceeding
- * backslashes, then the whole string is encapsulated
- * between single quotes
- *
- *
- *
- * @see DB_common::escapeSimple()
- * @since Method available since Release 1.6.0
- */
- function quoteSmart($in)
- {
- if (is_int($in)) {
- return $in;
- } elseif (is_float($in)) {
- return $this->quoteFloat($in);
- } elseif (is_bool($in)) {
- return $this->quoteBoolean($in);
- } elseif (is_null($in)) {
- return 'NULL';
- } else {
- if ($this->dbsyntax == 'access'
- && preg_match('/^#.+#$/', $in))
- {
- return $this->escapeSimple($in);
- }
- return "'" . $this->escapeSimple($in) . "'";
- }
- }
-
- // }}}
- // {{{ quoteBoolean()
-
- /**
- * Formats a boolean value for use within a query in a locale-independent
- * manner.
- *
- * @param boolean the boolean value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteBoolean($boolean) {
- return $boolean ? '1' : '0';
- }
-
- // }}}
- // {{{ quoteFloat()
-
- /**
- * Formats a float value for use within a query in a locale-independent
- * manner.
- *
- * @param float the float value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteFloat($float) {
- return "'".$this->escapeSimple(str_replace(',', '.', strval(floatval($float))))."'";
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * In SQLite, this makes things safe for inserts/updates, but may
- * cause problems when performing text comparisons against columns
- * containing binary data. See the
- * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.6.0
- */
- function escapeSimple($str)
- {
- return str_replace("'", "''", $str);
- }
-
- // }}}
- // {{{ provides()
-
- /**
- * Tells whether the present driver supports a given feature
- *
- * @param string $feature the feature you're curious about
- *
- * @return bool whether this driver supports $feature
- */
- function provides($feature)
- {
- return $this->features[$feature];
- }
-
- // }}}
- // {{{ setFetchMode()
-
- /**
- * Sets the fetch mode that should be used by default for query results
- *
- * @param integer $fetchmode DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC
- * or DB_FETCHMODE_OBJECT
- * @param string $object_class the class name of the object to be returned
- * by the fetch methods when the
- * DB_FETCHMODE_OBJECT mode is selected.
- * If no class is specified by default a cast
- * to object from the assoc array row will be
- * done. There is also the posibility to use
- * and extend the 'DB_row' class.
- *
- * @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT
- */
- function setFetchMode($fetchmode, $object_class = 'stdClass')
- {
- switch ($fetchmode) {
- case DB_FETCHMODE_OBJECT:
- $this->fetchmode_object_class = $object_class;
- case DB_FETCHMODE_ORDERED:
- case DB_FETCHMODE_ASSOC:
- $this->fetchmode = $fetchmode;
- break;
- default:
- return $this->raiseError('invalid fetchmode mode');
- }
- }
-
- // }}}
- // {{{ setOption()
-
- /**
- * Sets run-time configuration options for PEAR DB
- *
- * Options, their data types, default values and description:
- *
- * -
- * autofree boolean = false
- *
should results be freed automatically when there are no
- * more rows?
- * -
- * result_buffering integer = 500
- *
how many rows of the result set should be buffered?
- *
In mysql: mysql_unbuffered_query() is used instead of
- * mysql_query() if this value is 0. (Release 1.7.0)
- *
In oci8: this value is passed to ocisetprefetch().
- * (Release 1.7.0)
- * -
- * debug integer = 0
- *
debug level
- * -
- * persistent boolean = false
- *
should the connection be persistent?
- * -
- * portability integer = DB_PORTABILITY_NONE
- *
portability mode constant (see below)
- * -
- * seqname_format string = %s_seq
- *
the sprintf() format string used on sequence names. This
- * format is applied to sequence names passed to
- * createSequence(), nextID() and dropSequence().
- * -
- * ssl boolean = false
- *
use ssl to connect?
- *
- *
- *
- * -----------------------------------------
- *
- * PORTABILITY MODES
- *
- * These modes are bitwised, so they can be combined using |
- * and removed using ^. See the examples section below on how
- * to do this.
- *
- * DB_PORTABILITY_NONE
- * turn off all portability features
- *
- * This mode gets automatically turned on if the deprecated
- * optimize option gets set to performance.
- *
- *
- * DB_PORTABILITY_LOWERCASE
- * convert names of tables and fields to lower case when using
- * get*(), fetch*() and tableInfo()
- *
- * This mode gets automatically turned on in the following databases
- * if the deprecated option optimize gets set to
- * portability:
- * + oci8
- *
- *
- * DB_PORTABILITY_RTRIM
- * right trim the data output by get*() fetch*()
- *
- *
- * DB_PORTABILITY_DELETE_COUNT
- * force reporting the number of rows deleted
- *
- * Some DBMS's don't count the number of rows deleted when performing
- * simple DELETE FROM tablename queries. This portability
- * mode tricks such DBMS's into telling the count by adding
- * WHERE 1=1 to the end of DELETE queries.
- *
- * This mode gets automatically turned on in the following databases
- * if the deprecated option optimize gets set to
- * portability:
- * + fbsql
- * + mysql
- * + mysqli
- * + sqlite
- *
- *
- * DB_PORTABILITY_NUMROWS
- * enable hack that makes numRows() work in Oracle
- *
- * This mode gets automatically turned on in the following databases
- * if the deprecated option optimize gets set to
- * portability:
- * + oci8
- *
- *
- * DB_PORTABILITY_ERRORS
- * makes certain error messages in certain drivers compatible
- * with those from other DBMS's
- *
- * + mysql, mysqli: change unique/primary key constraints
- * DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
- *
- * + odbc(access): MS's ODBC driver reports 'no such field' as code
- * 07001, which means 'too few parameters.' When this option is on
- * that code gets mapped to DB_ERROR_NOSUCHFIELD.
- * DB_ERROR_MISMATCH -> DB_ERROR_NOSUCHFIELD
- *
- * DB_PORTABILITY_NULL_TO_EMPTY
- * convert null values to empty strings in data output by get*() and
- * fetch*(). Needed because Oracle considers empty strings to be null,
- * while most other DBMS's know the difference between empty and null.
- *
- *
- * DB_PORTABILITY_ALL
- * turn on all portability features
- *
- * -----------------------------------------
- *
- * Example 1. Simple setOption() example
- *
- * $db->setOption('autofree', true);
- *
- *
- * Example 2. Portability for lowercasing and trimming
- *
- * $db->setOption('portability',
- * DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_RTRIM);
- *
- *
- * Example 3. All portability options except trimming
- *
- * $db->setOption('portability',
- * DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM);
- *
- *
- * @param string $option option name
- * @param mixed $value value for the option
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::$options
- */
- function setOption($option, $value)
- {
- if (isset($this->options[$option])) {
- $this->options[$option] = $value;
-
- /*
- * Backwards compatibility check for the deprecated 'optimize'
- * option. Done here in case settings change after connecting.
- */
- if ($option == 'optimize') {
- if ($value == 'portability') {
- switch ($this->phptype) {
- case 'oci8':
- $this->options['portability'] =
- DB_PORTABILITY_LOWERCASE |
- DB_PORTABILITY_NUMROWS;
- break;
- case 'fbsql':
- case 'mysql':
- case 'mysqli':
- case 'sqlite':
- $this->options['portability'] =
- DB_PORTABILITY_DELETE_COUNT;
- break;
- }
- } else {
- $this->options['portability'] = DB_PORTABILITY_NONE;
- }
- }
-
- return DB_OK;
- }
- return $this->raiseError("unknown option $option");
- }
-
- // }}}
- // {{{ getOption()
-
- /**
- * Returns the value of an option
- *
- * @param string $option the option name you're curious about
- *
- * @return mixed the option's value
- */
- function getOption($option)
- {
- if (isset($this->options[$option])) {
- return $this->options[$option];
- }
- return $this->raiseError("unknown option $option");
- }
-
- // }}}
- // {{{ prepare()
-
- /**
- * Prepares a query for multiple execution with execute()
- *
- * Creates a query that can be run multiple times. Each time it is run,
- * the placeholders, if any, will be replaced by the contents of
- * execute()'s $data argument.
- *
- * Three types of placeholders can be used:
- * + ? scalar value (i.e. strings, integers). The system
- * will automatically quote and escape the data.
- * + ! value is inserted 'as is'
- * + & requires a file name. The file's contents get
- * inserted into the query (i.e. saving binary
- * data in a db)
- *
- * Example 1.
- *
- * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
- * $data = array(
- * "John's text",
- * "'it''s good'",
- * 'filename.txt'
- * );
- * $res = $db->execute($sth, $data);
- *
- *
- * Use backslashes to escape placeholder characters if you don't want
- * them to be interpreted as placeholders:
- *
- * "UPDATE foo SET col=? WHERE col='over \& under'"
- *
- *
- * With some database backends, this is emulated.
- *
- * {@internal ibase and oci8 have their own prepare() methods.}}
- *
- * @param string $query the query to be prepared
- *
- * @return mixed DB statement resource on success. A DB_Error object
- * on failure.
- *
- * @see DB_common::execute()
- */
- function prepare($query)
- {
- $tokens = preg_split('/((?prepare_tokens[] = &$newtokens;
- end($this->prepare_tokens);
-
- $k = key($this->prepare_tokens);
- $this->prepare_types[$k] = $types;
- $this->prepared_queries[$k] = implode(' ', $newtokens);
-
- return $k;
- }
-
- // }}}
- // {{{ autoPrepare()
-
- /**
- * Automaticaly generates an insert or update query and pass it to prepare()
- *
- * @param string $table the table name
- * @param array $table_fields the array of field names
- * @param int $mode a type of query to make:
- * DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
- * @param string $where for update queries: the WHERE clause to
- * append to the SQL statement. Don't
- * include the "WHERE" keyword.
- *
- * @return resource the query handle
- *
- * @uses DB_common::prepare(), DB_common::buildManipSQL()
- */
- function autoPrepare($table, $table_fields, $mode = DB_AUTOQUERY_INSERT,
- $where = false)
- {
- $query = $this->buildManipSQL($table, $table_fields, $mode, $where);
- if (DB::isError($query)) {
- return $query;
- }
- return $this->prepare($query);
- }
-
- // }}}
- // {{{ autoExecute()
-
- /**
- * Automaticaly generates an insert or update query and call prepare()
- * and execute() with it
- *
- * @param string $table the table name
- * @param array $fields_values the associative array where $key is a
- * field name and $value its value
- * @param int $mode a type of query to make:
- * DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
- * @param string $where for update queries: the WHERE clause to
- * append to the SQL statement. Don't
- * include the "WHERE" keyword.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- *
- * @uses DB_common::autoPrepare(), DB_common::execute()
- */
- function autoExecute($table, $fields_values, $mode = DB_AUTOQUERY_INSERT,
- $where = false)
- {
- $sth = $this->autoPrepare($table, array_keys($fields_values), $mode,
- $where);
- if (DB::isError($sth)) {
- return $sth;
- }
- $ret = $this->execute($sth, array_values($fields_values));
- $this->freePrepared($sth);
- return $ret;
-
- }
-
- // }}}
- // {{{ buildManipSQL()
-
- /**
- * Produces an SQL query string for autoPrepare()
- *
- * Example:
- *
- * buildManipSQL('table_sql', array('field1', 'field2', 'field3'),
- * DB_AUTOQUERY_INSERT);
- *
- *
- * That returns
- *
- * INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?)
- *
- *
- * NOTES:
- * - This belongs more to a SQL Builder class, but this is a simple
- * facility.
- * - Be carefull! If you don't give a $where param with an UPDATE
- * query, all the records of the table will be updated!
- *
- * @param string $table the table name
- * @param array $table_fields the array of field names
- * @param int $mode a type of query to make:
- * DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
- * @param string $where for update queries: the WHERE clause to
- * append to the SQL statement. Don't
- * include the "WHERE" keyword.
- *
- * @return string the sql query for autoPrepare()
- */
- function buildManipSQL($table, $table_fields, $mode, $where = false)
- {
- if (count($table_fields) == 0) {
- return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
- }
- $first = true;
- switch ($mode) {
- case DB_AUTOQUERY_INSERT:
- $values = '';
- $names = '';
- foreach ($table_fields as $value) {
- if ($first) {
- $first = false;
- } else {
- $names .= ',';
- $values .= ',';
- }
- $names .= $value;
- $values .= '?';
- }
- return "INSERT INTO $table ($names) VALUES ($values)";
- case DB_AUTOQUERY_UPDATE:
- $set = '';
- foreach ($table_fields as $value) {
- if ($first) {
- $first = false;
- } else {
- $set .= ',';
- }
- $set .= "$value = ?";
- }
- $sql = "UPDATE $table SET $set";
- if ($where) {
- $sql .= " WHERE $where";
- }
- return $sql;
- default:
- return $this->raiseError(DB_ERROR_SYNTAX);
- }
- }
-
- // }}}
- // {{{ execute()
-
- /**
- * Executes a DB statement prepared with prepare()
- *
- * Example 1.
- *
- * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
- * $data = array(
- * "John's text",
- * "'it''s good'",
- * 'filename.txt'
- * );
- * $res = $db->execute($sth, $data);
- *
- *
- * @param resource $stmt a DB statement resource returned from prepare()
- * @param mixed $data array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- *
- * {@internal ibase and oci8 have their own execute() methods.}}
- *
- * @see DB_common::prepare()
- */
- function &execute($stmt, $data = array())
- {
- $realquery = $this->executeEmulateQuery($stmt, $data);
- if (DB::isError($realquery)) {
- return $realquery;
- }
- $result = $this->simpleQuery($realquery);
-
- if ($result === DB_OK || DB::isError($result)) {
- return $result;
- } else {
- $tmp = new DB_result($this, $result);
- return $tmp;
- }
- }
-
- // }}}
- // {{{ executeEmulateQuery()
-
- /**
- * Emulates executing prepared statements if the DBMS not support them
- *
- * @param resource $stmt a DB statement resource returned from execute()
- * @param mixed $data array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a string containing the real query run when emulating
- * prepare/execute. A DB_Error object on failure.
- *
- * @access protected
- * @see DB_common::execute()
- */
- function executeEmulateQuery($stmt, $data = array())
- {
- $stmt = (int)$stmt;
- $data = (array)$data;
- $this->last_parameters = $data;
-
- if (count($this->prepare_types[$stmt]) != count($data)) {
- $this->last_query = $this->prepared_queries[$stmt];
- return $this->raiseError(DB_ERROR_MISMATCH);
- }
-
- $realquery = $this->prepare_tokens[$stmt][0];
-
- $i = 0;
- foreach ($data as $value) {
- if ($this->prepare_types[$stmt][$i] == DB_PARAM_SCALAR) {
- $realquery .= $this->quoteSmart($value);
- } elseif ($this->prepare_types[$stmt][$i] == DB_PARAM_OPAQUE) {
- $fp = @fopen($value, 'rb');
- if (!$fp) {
- return $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
- }
- $realquery .= $this->quoteSmart(fread($fp, filesize($value)));
- fclose($fp);
- } else {
- $realquery .= $value;
- }
-
- $realquery .= $this->prepare_tokens[$stmt][++$i];
- }
-
- return $realquery;
- }
-
- // }}}
- // {{{ executeMultiple()
-
- /**
- * Performs several execute() calls on the same statement handle
- *
- * $data must be an array indexed numerically
- * from 0, one execute call is done for every "row" in the array.
- *
- * If an error occurs during execute(), executeMultiple() does not
- * execute the unfinished rows, but rather returns that error.
- *
- * @param resource $stmt query handle from prepare()
- * @param array $data numeric array containing the
- * data to insert into the query
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::prepare(), DB_common::execute()
- */
- function executeMultiple($stmt, $data)
- {
- foreach ($data as $value) {
- $res = $this->execute($stmt, $value);
- if (DB::isError($res)) {
- return $res;
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freePrepared()
-
- /**
- * Frees the internal resources associated with a prepared query
- *
- * @param resource $stmt the prepared statement's PHP resource
- * @param bool $free_resource should the PHP resource be freed too?
- * Use false if you need to get data
- * from the result set later.
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_common::prepare()
- */
- function freePrepared($stmt, $free_resource = true)
- {
- $stmt = (int)$stmt;
- if (isset($this->prepare_tokens[$stmt])) {
- unset($this->prepare_tokens[$stmt]);
- unset($this->prepare_types[$stmt]);
- unset($this->prepared_queries[$stmt]);
- return true;
- }
- return false;
- }
-
- // }}}
- // {{{ modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * It is defined here to ensure all drivers have this method available.
- *
- * @param string $query the query string to modify
- *
- * @return string the modified query string
- *
- * @access protected
- * @see DB_mysql::modifyQuery(), DB_oci8::modifyQuery(),
- * DB_sqlite::modifyQuery()
- */
- function modifyQuery($query)
- {
- return $query;
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * It is defined here to assure that all implementations
- * have this method defined.
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- return $query;
- }
-
- // }}}
- // {{{ query()
-
- /**
- * Sends a query to the database server
- *
- * The query string can be either a normal statement to be sent directly
- * to the server OR if $params are passed the query can have
- * placeholders and it will be passed through prepare() and execute().
- *
- * @param string $query the SQL query or the statement to prepare
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- *
- * @see DB_result, DB_common::prepare(), DB_common::execute()
- */
- function &query($query, $params = array())
- {
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
- if (DB::isError($sth)) {
- return $sth;
- }
- $ret = $this->execute($sth, $params);
- $this->freePrepared($sth, false);
- return $ret;
- } else {
- $this->last_parameters = array();
- $result = $this->simpleQuery($query);
- if ($result === DB_OK || DB::isError($result)) {
- return $result;
- } else {
- $tmp = new DB_result($this, $result);
- return $tmp;
- }
- }
- }
-
- // }}}
- // {{{ limitQuery()
-
- /**
- * Generates and executes a LIMIT query
- *
- * @param string $query the query
- * @param intr $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- */
- function &limitQuery($query, $from, $count, $params = array())
- {
- $query = $this->modifyLimitQuery($query, $from, $count, $params);
- if (DB::isError($query)){
- return $query;
- }
- $result = $this->query($query, $params);
- if (is_a($result, 'DB_result')) {
- $result->setOption('limit_from', $from);
- $result->setOption('limit_count', $count);
- }
- return $result;
- }
-
- // }}}
- // {{{ getOne()
-
- /**
- * Fetches the first column of the first row from a query result
- *
- * Takes care of doing the query and freeing the results when finished.
- *
- * @param string $query the SQL query
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed the returned value of the query.
- * A DB_Error object on failure.
- */
- function &getOne($query, $params = array())
- {
- $params = (array)$params;
- // modifyLimitQuery() would be nice here, but it causes BC issues
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
- if (DB::isError($sth)) {
- return $sth;
- }
- $res = $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res = $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
-
- $err = $res->fetchInto($row, DB_FETCHMODE_ORDERED);
- $res->free();
-
- if ($err !== DB_OK) {
- return $err;
- }
-
- return $row[0];
- }
-
- // }}}
- // {{{ getRow()
-
- /**
- * Fetches the first row of data returned from a query result
- *
- * Takes care of doing the query and freeing the results when finished.
- *
- * @param string $query the SQL query
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- * @param int $fetchmode the fetch mode to use
- *
- * @return array the first row of results as an array.
- * A DB_Error object on failure.
- */
- function &getRow($query, $params = array(),
- $fetchmode = DB_FETCHMODE_DEFAULT)
- {
- // compat check, the params and fetchmode parameters used to
- // have the opposite order
- if (!is_array($params)) {
- if (is_array($fetchmode)) {
- if ($params === null) {
- $tmp = DB_FETCHMODE_DEFAULT;
- } else {
- $tmp = $params;
- }
- $params = $fetchmode;
- $fetchmode = $tmp;
- } elseif ($params !== null) {
- $fetchmode = $params;
- $params = array();
- }
- }
- // modifyLimitQuery() would be nice here, but it causes BC issues
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
- if (DB::isError($sth)) {
- return $sth;
- }
- $res = $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res = $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
-
- $err = $res->fetchInto($row, $fetchmode);
-
- $res->free();
-
- if ($err !== DB_OK) {
- return $err;
- }
-
- return $row;
- }
-
- // }}}
- // {{{ getCol()
-
- /**
- * Fetches a single column from a query result and returns it as an
- * indexed array
- *
- * @param string $query the SQL query
- * @param mixed $col which column to return (integer [column number,
- * starting at 0] or string [column name])
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return array the results as an array. A DB_Error object on failure.
- *
- * @see DB_common::query()
- */
- function &getCol($query, $col = 0, $params = array())
- {
- $params = (array)$params;
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
-
- if (DB::isError($sth)) {
- return $sth;
- }
-
- $res = $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res = $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
-
- $fetchmode = is_int($col) ? DB_FETCHMODE_ORDERED : DB_FETCHMODE_ASSOC;
-
- if (!is_array($row = $res->fetchRow($fetchmode))) {
- $ret = array();
- } else {
- if (!array_key_exists($col, $row)) {
- $ret = $this->raiseError(DB_ERROR_NOSUCHFIELD);
- } else {
- $ret = array($row[$col]);
- while (is_array($row = $res->fetchRow($fetchmode))) {
- $ret[] = $row[$col];
- }
- }
- }
-
- $res->free();
-
- if (DB::isError($row)) {
- $ret = $row;
- }
-
- return $ret;
- }
-
- // }}}
- // {{{ getAssoc()
-
- /**
- * Fetches an entire query result and returns it as an
- * associative array using the first column as the key
- *
- * If the result set contains more than two columns, the value
- * will be an array of the values from column 2-n. If the result
- * set contains only two columns, the returned value will be a
- * scalar with the value of the second column (unless forced to an
- * array with the $force_array parameter). A DB error code is
- * returned on errors. If the result set contains fewer than two
- * columns, a DB_ERROR_TRUNCATED error is returned.
- *
- * For example, if the table "mytable" contains:
- *
- *
- * ID TEXT DATE
- * --------------------------------
- * 1 'one' 944679408
- * 2 'two' 944679408
- * 3 'three' 944679408
- *
- *
- * Then the call getAssoc('SELECT id,text FROM mytable') returns:
- *
- * array(
- * '1' => 'one',
- * '2' => 'two',
- * '3' => 'three',
- * )
- *
- *
- * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns:
- *
- * array(
- * '1' => array('one', '944679408'),
- * '2' => array('two', '944679408'),
- * '3' => array('three', '944679408')
- * )
- *
- *
- * If the more than one row occurs with the same value in the
- * first column, the last row overwrites all previous ones by
- * default. Use the $group parameter if you don't want to
- * overwrite like this. Example:
- *
- *
- * getAssoc('SELECT category,id,name FROM mytable', false, null,
- * DB_FETCHMODE_ASSOC, true) returns:
- *
- * array(
- * '1' => array(array('id' => '4', 'name' => 'number four'),
- * array('id' => '6', 'name' => 'number six')
- * ),
- * '9' => array(array('id' => '4', 'name' => 'number four'),
- * array('id' => '6', 'name' => 'number six')
- * )
- * )
- *
- *
- * Keep in mind that database functions in PHP usually return string
- * values for results regardless of the database's internal type.
- *
- * @param string $query the SQL query
- * @param bool $force_array used only when the query returns
- * exactly two columns. If true, the values
- * of the returned array will be one-element
- * arrays instead of scalars.
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of
- * items passed must match quantity of
- * placeholders in query: meaning 1
- * placeholder for non-array parameters or
- * 1 placeholder per array element.
- * @param int $fetchmode the fetch mode to use
- * @param bool $group if true, the values of the returned array
- * is wrapped in another array. If the same
- * key value (in the first column) repeats
- * itself, the values will be appended to
- * this array instead of overwriting the
- * existing values.
- *
- * @return array the associative array containing the query results.
- * A DB_Error object on failure.
- */
- function &getAssoc($query, $force_array = false, $params = array(),
- $fetchmode = DB_FETCHMODE_DEFAULT, $group = false)
- {
- $params = (array)$params;
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
-
- if (DB::isError($sth)) {
- return $sth;
- }
-
- $res = $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res = $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
- if ($fetchmode == DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->fetchmode;
- }
- $cols = $res->numCols();
-
- if ($cols < 2) {
- $tmp = $this->raiseError(DB_ERROR_TRUNCATED);
- return $tmp;
- }
-
- $results = array();
-
- if ($cols > 2 || $force_array) {
- // return array values
- // XXX this part can be optimized
- if ($fetchmode == DB_FETCHMODE_ASSOC) {
- while (is_array($row = $res->fetchRow(DB_FETCHMODE_ASSOC))) {
- reset($row);
- $key = current($row);
- unset($row[key($row)]);
- if ($group) {
- $results[$key][] = $row;
- } else {
- $results[$key] = $row;
- }
- }
- } elseif ($fetchmode == DB_FETCHMODE_OBJECT) {
- while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
- $arr = get_object_vars($row);
- $key = current($arr);
- if ($group) {
- $results[$key][] = $row;
- } else {
- $results[$key] = $row;
- }
- }
- } else {
- while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
- // we shift away the first element to get
- // indices running from 0 again
- $key = array_shift($row);
- if ($group) {
- $results[$key][] = $row;
- } else {
- $results[$key] = $row;
- }
- }
- }
- if (DB::isError($row)) {
- $results = $row;
- }
- } else {
- // return scalar values
- while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
- if ($group) {
- $results[$row[0]][] = $row[1];
- } else {
- $results[$row[0]] = $row[1];
- }
- }
- if (DB::isError($row)) {
- $results = $row;
- }
- }
-
- $res->free();
-
- return $results;
- }
-
- // }}}
- // {{{ getAll()
-
- /**
- * Fetches all of the rows from a query result
- *
- * @param string $query the SQL query
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of
- * items passed must match quantity of
- * placeholders in query: meaning 1
- * placeholder for non-array parameters or
- * 1 placeholder per array element.
- * @param int $fetchmode the fetch mode to use:
- * + DB_FETCHMODE_ORDERED
- * + DB_FETCHMODE_ASSOC
- * + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED
- * + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED
- *
- * @return array the nested array. A DB_Error object on failure.
- */
- function &getAll($query, $params = array(),
- $fetchmode = DB_FETCHMODE_DEFAULT)
- {
- // compat check, the params and fetchmode parameters used to
- // have the opposite order
- if (!is_array($params)) {
- if (is_array($fetchmode)) {
- if ($params === null) {
- $tmp = DB_FETCHMODE_DEFAULT;
- } else {
- $tmp = $params;
- }
- $params = $fetchmode;
- $fetchmode = $tmp;
- } elseif ($params !== null) {
- $fetchmode = $params;
- $params = array();
- }
- }
-
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
-
- if (DB::isError($sth)) {
- return $sth;
- }
-
- $res = $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res = $this->query($query);
- }
-
- if ($res === DB_OK || DB::isError($res)) {
- return $res;
- }
-
- $results = array();
- while (DB_OK === $res->fetchInto($row, $fetchmode)) {
- if ($fetchmode & DB_FETCHMODE_FLIPPED) {
- foreach ($row as $key => $val) {
- $results[$key][] = $val;
- }
- } else {
- $results[] = $row;
- }
- }
-
- $res->free();
-
- if (DB::isError($row)) {
- $tmp = $this->raiseError($row);
- return $tmp;
- }
- return $results;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Determines the number of rows in a query result
- *
- * @param resource $result the query result idenifier produced by PHP
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function numRows($result)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ getSequenceName()
-
- /**
- * Generates the name used inside the database for a sequence
- *
- * The createSequence() docblock contains notes about storing sequence
- * names.
- *
- * @param string $sqn the sequence's public name
- *
- * @return string the sequence's name in the backend
- *
- * @access protected
- * @see DB_common::createSequence(), DB_common::dropSequence(),
- * DB_common::nextID(), DB_common::setOption()
- */
- function getSequenceName($sqn)
- {
- return sprintf($this->getOption('seqname_format'),
- preg_replace('/[^a-z0-9_.]/i', '_', $sqn));
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::dropSequence(),
- * DB_common::getSequenceName()
- */
- function nextId($seq_name, $ondemand = true)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Creates a new sequence
- *
- * The name of a given sequence is determined by passing the string
- * provided in the $seq_name argument through PHP's sprintf()
- * function using the value from the seqname_format option as
- * the sprintf()'s format argument.
- *
- * seqname_format is set via setOption().
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_common::nextID()
- */
- function createSequence($seq_name)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_common::nextID()
- */
- function dropSequence($seq_name)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * Communicates an error and invoke error callbacks, etc
- *
- * Basically a wrapper for PEAR::raiseError without the message string.
- *
- * @param mixed integer error code, or a PEAR error object (all
- * other parameters are ignored if this parameter is
- * an object
- * @param int error mode, see PEAR_Error docs
- * @param mixed if error mode is PEAR_ERROR_TRIGGER, this is the
- * error level (E_USER_NOTICE etc). If error mode is
- * PEAR_ERROR_CALLBACK, this is the callback function,
- * either as a function name, or as an array of an
- * object and method name. For other error modes this
- * parameter is ignored.
- * @param string extra debug information. Defaults to the last
- * query and native error code.
- * @param mixed native error code, integer or string depending the
- * backend
- *
- * @return object the PEAR_Error object
- *
- * @see PEAR_Error
- */
- function &raiseError($code = DB_ERROR, $mode = null, $options = null,
- $userinfo = null, $nativecode = null)
- {
- // The error is yet a DB error object
- if (is_object($code)) {
- // because we the static PEAR::raiseError, our global
- // handler should be used if it is set
- if ($mode === null && !empty($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- $options = $this->_default_error_options;
- }
- $tmp = PEAR::raiseError($code, null, $mode, $options,
- null, null, true);
- return $tmp;
- }
-
- if ($userinfo === null) {
- $userinfo = $this->last_query;
- }
-
- if ($nativecode) {
- $userinfo .= ' [nativecode=' . trim($nativecode) . ']';
- } else {
- $userinfo .= ' [DB Error: ' . DB::errorMessage($code) . ']';
- }
-
- $tmp = PEAR::raiseError(null, $code, $mode, $options, $userinfo,
- 'DB_Error', true);
- return $tmp;
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return mixed the DBMS' error code. A DB_Error object on failure.
- */
- function errorNative()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Maps native error codes to DB's portable ones
- *
- * Uses the $errorcode_map property defined in each driver.
- *
- * @param string|int $nativecode the error code returned by the DBMS
- *
- * @return int the portable DB error code. Return DB_ERROR if the
- * current driver doesn't have a mapping for the
- * $nativecode submitted.
- */
- function errorCode($nativecode)
- {
- if (isset($this->errorcode_map[$nativecode])) {
- return $this->errorcode_map[$nativecode];
- }
- // Fall back to DB_ERROR if there was no mapping.
- return DB_ERROR;
- }
-
- // }}}
- // {{{ errorMessage()
-
- /**
- * Maps a DB error code to a textual message
- *
- * @param integer $dbcode the DB error code
- *
- * @return string the error message corresponding to the error code
- * submitted. FALSE if the error code is unknown.
- *
- * @see DB::errorMessage()
- */
- function errorMessage($dbcode)
- {
- return DB::errorMessage($this->errorcode_map[$dbcode]);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * The format of the resulting array depends on which $mode
- * you select. The sample output below is based on this query:
- *
- * SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
- * FROM tblFoo
- * JOIN tblBar ON tblFoo.fldId = tblBar.fldId
- *
- *
- *
- * -
- *
- * null (default)
- *
- * [0] => Array (
- * [table] => tblFoo
- * [name] => fldId
- * [type] => int
- * [len] => 11
- * [flags] => primary_key not_null
- * )
- * [1] => Array (
- * [table] => tblFoo
- * [name] => fldPhone
- * [type] => string
- * [len] => 20
- * [flags] =>
- * )
- * [2] => Array (
- * [table] => tblBar
- * [name] => fldId
- * [type] => int
- * [len] => 11
- * [flags] => primary_key not_null
- * )
- *
- *
- * -
- *
- * DB_TABLEINFO_ORDER
- *
- *
In addition to the information found in the default output,
- * a notation of the number of columns is provided by the
- * num_fields element while the order
- * element provides an array with the column names as the keys and
- * their location index number (corresponding to the keys in the
- * the default output) as the values.
- *
- * If a result set has identical field names, the last one is
- * used.
- *
- *
- * [num_fields] => 3
- * [order] => Array (
- * [fldId] => 2
- * [fldTrans] => 1
- * )
- *
- *
- * -
- *
- * DB_TABLEINFO_ORDERTABLE
- *
- *
Similar to DB_TABLEINFO_ORDER but adds more
- * dimensions to the array in which the table names are keys and
- * the field names are sub-keys. This is helpful for queries that
- * join tables which have identical field names.
- *
- *
- * [num_fields] => 3
- * [ordertable] => Array (
- * [tblFoo] => Array (
- * [fldId] => 0
- * [fldPhone] => 1
- * )
- * [tblBar] => Array (
- * [fldId] => 2
- * )
- * )
- *
- *
- *
- *
- *
- * The flags element contains a space separated list
- * of extra information about the field. This data is inconsistent
- * between DBMS's due to the way each DBMS works.
- * + primary_key
- * + unique_key
- * + multiple_key
- * + not_null
- *
- * Most DBMS's only provide the table and flags
- * elements if $result is a table name. The following DBMS's
- * provide full information from queries:
- * + fbsql
- * + mysql
- *
- * If the 'portability' option has DB_PORTABILITY_LOWERCASE
- * turned on, the names of tables and fields will be lowercased.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode either unused or one of the tableInfo modes:
- * DB_TABLEINFO_ORDERTABLE,
- * DB_TABLEINFO_ORDER or
- * DB_TABLEINFO_FULL (which does both).
- * These are bitwise, so the first two can be
- * combined using |.
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::setOption()
- */
- function tableInfo($result, $mode = null)
- {
- /*
- * If the DB_ class has a tableInfo() method, that one
- * overrides this one. But, if the driver doesn't have one,
- * this method runs and tells users about that fact.
- */
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ getTables()
-
- /**
- * Lists the tables in the current database
- *
- * @return array the list of tables. A DB_Error object on failure.
- *
- * @deprecated Method deprecated some time before Release 1.2
- */
- function getTables()
- {
- return $this->getListOf('tables');
- }
-
- // }}}
- // {{{ getListOf()
-
- /**
- * Lists internal database information
- *
- * @param string $type type of information being sought.
- * Common items being sought are:
- * tables, databases, users, views, functions
- * Each DBMS's has its own capabilities.
- *
- * @return array an array listing the items sought.
- * A DB DB_Error object on failure.
- */
- function getListOf($type)
- {
- $sql = $this->getSpecialQuery($type);
- if ($sql === null) {
- $this->last_query = '';
- return $this->raiseError(DB_ERROR_UNSUPPORTED);
- } elseif (is_int($sql) || DB::isError($sql)) {
- // Previous error
- return $this->raiseError($sql);
- } elseif (is_array($sql)) {
- // Already the result
- return $sql;
- }
- // Launch this query
- return $this->getCol($sql);
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- return $this->raiseError(DB_ERROR_UNSUPPORTED);
- }
-
- // }}}
- // {{{ nextQueryIsManip()
-
- /**
- * Sets (or unsets) a flag indicating that the next query will be a
- * manipulation query, regardless of the usual DB::isManip() heuristics.
- *
- * @param boolean true to set the flag overriding the isManip() behaviour,
- * false to clear it and fall back onto isManip()
- *
- * @return void
- *
- * @access public
- */
- function nextQueryIsManip($manip)
- {
- $this->_next_query_manip = $manip;
- }
-
- // }}}
- // {{{ _checkManip()
-
- /**
- * Checks if the given query is a manipulation query. This also takes into
- * account the _next_query_manip flag and sets the _last_query_manip flag
- * (and resets _next_query_manip) according to the result.
- *
- * @param string The query to check.
- *
- * @return boolean true if the query is a manipulation query, false
- * otherwise
- *
- * @access protected
- */
- function _checkManip($query)
- {
- if ($this->_next_query_manip || DB::isManip($query)) {
- $this->_last_query_manip = true;
- } else {
- $this->_last_query_manip = false;
- }
- $this->_next_query_manip = false;
- return $this->_last_query_manip;
- $manip = $this->_next_query_manip;
- }
-
- // }}}
- // {{{ _rtrimArrayValues()
-
- /**
- * Right-trims all strings in an array
- *
- * @param array $array the array to be trimmed (passed by reference)
- *
- * @return void
- *
- * @access protected
- */
- function _rtrimArrayValues(&$array)
- {
- foreach ($array as $key => $value) {
- if (is_string($value)) {
- $array[$key] = rtrim($value);
- }
- }
- }
-
- // }}}
- // {{{ _convertNullArrayValuesToEmpty()
-
- /**
- * Converts all null values in an array to empty strings
- *
- * @param array $array the array to be de-nullified (passed by reference)
- *
- * @return void
- *
- * @access protected
- */
- function _convertNullArrayValuesToEmpty(&$array)
- {
- foreach ($array as $key => $value) {
- if (is_null($value)) {
- $array[$key] = '';
- }
- }
- }
-
- // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/dbase.php b/airtime_mvc/library/pear/DB/dbase.php
deleted file mode 100644
index cdd2e59ef..000000000
--- a/airtime_mvc/library/pear/DB/dbase.php
+++ /dev/null
@@ -1,510 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: dbase.php,v 1.45 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's dbase extension
- * for interacting with dBase databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category Database
- * @package DB
- * @author Tomas V.V. Cox
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_dbase extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'dbase';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'dbase';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => false,
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => false,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => false,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * A means of emulating result resources
- * @var array
- */
- var $res_row = array();
-
- /**
- * The quantity of results so far
- *
- * For emulating result resources.
- *
- * @var integer
- */
- var $result = 0;
-
- /**
- * Maps dbase data type id's to human readable strings
- *
- * The human readable values are based on the output of PHP's
- * dbase_get_header_info() function.
- *
- * @var array
- * @since Property available since Release 1.7.0
- */
- var $types = array(
- 'C' => 'character',
- 'D' => 'date',
- 'L' => 'boolean',
- 'M' => 'memo',
- 'N' => 'number',
- );
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_dbase()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database and create it if it doesn't exist
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's dbase driver supports the following extra DSN options:
- * + mode An integer specifying the read/write mode to use
- * (0 = read only, 1 = write only, 2 = read/write).
- * Available since PEAR DB 1.7.0.
- * + fields An array of arrays that PHP's dbase_create() function needs
- * to create a new database. This information is used if the
- * dBase file specified in the "database" segment of the DSN
- * does not exist. For more info, see the PHP manual's
- * {@link http://php.net/dbase_create dbase_create()} page.
- * Available since PEAR DB 1.7.0.
- *
- * Example of how to connect and establish a new dBase file if necessary:
- *
- * require_once 'DB.php';
- *
- * $dsn = array(
- * 'phptype' => 'dbase',
- * 'database' => '/path/and/name/of/dbase/file',
- * 'mode' => 2,
- * 'fields' => array(
- * array('a', 'N', 5, 0),
- * array('b', 'C', 40),
- * array('c', 'C', 255),
- * array('d', 'C', 20),
- * ),
- * );
- * $options = array(
- * 'debug' => 2,
- * 'portability' => DB_PORTABILITY_ALL,
- * );
- *
- * $db = DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('dbase')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- /*
- * Turn track_errors on for entire script since $php_errormsg
- * is the only way to find errors from the dbase extension.
- */
- @ini_set('track_errors', 1);
- $php_errormsg = '';
-
- if (!file_exists($dsn['database'])) {
- $this->dsn['mode'] = 2;
- if (empty($dsn['fields']) || !is_array($dsn['fields'])) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- 'the dbase file does not exist and '
- . 'it could not be created because '
- . 'the "fields" element of the DSN '
- . 'is not properly set');
- }
- $this->connection = @dbase_create($dsn['database'],
- $dsn['fields']);
- if (!$this->connection) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- 'the dbase file does not exist and '
- . 'the attempt to create it failed: '
- . $php_errormsg);
- }
- } else {
- if (!isset($this->dsn['mode'])) {
- $this->dsn['mode'] = 0;
- }
- $this->connection = @dbase_open($dsn['database'],
- $this->dsn['mode']);
- if (!$this->connection) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @dbase_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ &query()
-
- function &query($query = null)
- {
- // emulate result resources
- $this->res_row[(int)$this->result] = 0;
- $tmp = new DB_result($this, $this->result++);
- return $tmp;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum === null) {
- $rownum = $this->res_row[(int)$result]++;
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @dbase_get_record_with_names($this->connection, $rownum);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @dbase_get_record($this->connection, $rownum);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set.
- *
- * This method is a no-op for dbase, as there aren't result resources in
- * the same sense as most other database backends.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return true;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($foo)
- {
- return @dbase_numfields($this->connection);
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($foo)
- {
- return @dbase_numrecords($this->connection);
- }
-
- // }}}
- // {{{ quoteBoolean()
-
- /**
- * Formats a boolean value for use within a query in a locale-independent
- * manner.
- *
- * @param boolean the boolean value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteBoolean($boolean) {
- return $boolean ? 'T' : 'F';
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about the current database
- *
- * @param mixed $result THIS IS UNUSED IN DBASE. The current database
- * is examined regardless of what is provided here.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- * @since Method available since Release 1.7.0
- */
- function tableInfo($result = null, $mode = null)
- {
- if (function_exists('dbase_get_header_info')) {
- $id = @dbase_get_header_info($this->connection);
- if (!$id && $php_errormsg) {
- return $this->raiseError(DB_ERROR,
- null, null, null,
- $php_errormsg);
- }
- } else {
- /*
- * This segment for PHP 4 is loosely based on code by
- * Hadi Rusiah in the comments on
- * the dBase reference page in the PHP manual.
- */
- $db = @fopen($this->dsn['database'], 'r');
- if (!$db) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
-
- $id = array();
- $i = 0;
-
- $line = fread($db, 32);
- while (!feof($db)) {
- $line = fread($db, 32);
- if (substr($line, 0, 1) == chr(13)) {
- break;
- } else {
- $pos = strpos(substr($line, 0, 10), chr(0));
- $pos = ($pos == 0 ? 10 : $pos);
- $id[$i] = array(
- 'name' => substr($line, 0, $pos),
- 'type' => $this->types[substr($line, 11, 1)],
- 'length' => ord(substr($line, 16, 1)),
- 'precision' => ord(substr($line, 17, 1)),
- );
- }
- $i++;
- }
-
- fclose($db);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $res = array();
- $count = count($id);
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => $this->dsn['database'],
- 'name' => $case_func($id[$i]['name']),
- 'type' => $id[$i]['type'],
- 'len' => $id[$i]['length'],
- 'flags' => ''
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- return $res;
- }
-
- // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/fbsql.php b/airtime_mvc/library/pear/DB/fbsql.php
deleted file mode 100644
index 7749a98fa..000000000
--- a/airtime_mvc/library/pear/DB/fbsql.php
+++ /dev/null
@@ -1,769 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: fbsql.php,v 1.88 2007/07/06 05:19:21 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's fbsql extension
- * for interacting with FrontBase databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category Database
- * @package DB
- * @author Frank M. Kromann
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- * @since Class functional since Release 1.7.0
- */
-class DB_fbsql extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'fbsql';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'fbsql';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'alter',
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- 22 => DB_ERROR_SYNTAX,
- 85 => DB_ERROR_ALREADY_EXISTS,
- 108 => DB_ERROR_SYNTAX,
- 116 => DB_ERROR_NOSUCHTABLE,
- 124 => DB_ERROR_VALUE_COUNT_ON_ROW,
- 215 => DB_ERROR_NOSUCHFIELD,
- 217 => DB_ERROR_INVALID_NUMBER,
- 226 => DB_ERROR_NOSUCHFIELD,
- 231 => DB_ERROR_INVALID,
- 239 => DB_ERROR_TRUNCATED,
- 251 => DB_ERROR_SYNTAX,
- 266 => DB_ERROR_NOT_FOUND,
- 357 => DB_ERROR_CONSTRAINT_NOT_NULL,
- 358 => DB_ERROR_CONSTRAINT,
- 360 => DB_ERROR_CONSTRAINT,
- 361 => DB_ERROR_CONSTRAINT,
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_fbsql()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('fbsql')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $params = array(
- $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
- $dsn['username'] ? $dsn['username'] : null,
- $dsn['password'] ? $dsn['password'] : null,
- );
-
- $connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect';
-
- $ini = ini_get('track_errors');
- $php_errormsg = '';
- if ($ini) {
- $this->connection = @call_user_func_array($connect_function,
- $params);
- } else {
- @ini_set('track_errors', 1);
- $this->connection = @call_user_func_array($connect_function,
- $params);
- @ini_set('track_errors', $ini);
- }
-
- if (!$this->connection) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
-
- if ($dsn['database']) {
- if (!@fbsql_select_db($dsn['database'], $this->connection)) {
- return $this->fbsqlRaiseError();
- }
- }
-
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @fbsql_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- $result = @fbsql_query("$query;", $this->connection);
- if (!$result) {
- return $this->fbsqlRaiseError();
- }
- // Determine which queries that should return data, and which
- // should return an error code only.
- if ($this->_checkManip($query)) {
- return DB_OK;
- }
- return $result;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal fbsql result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return @fbsql_next_result($result);
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- if (!@fbsql_data_seek($result, $rownum)) {
- return null;
- }
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @fbsql_fetch_array($result, FBSQL_ASSOC);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @fbsql_fetch_row($result);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? fbsql_free_result($result) : false;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff=false)
- {
- if ($onoff) {
- $this->query("SET COMMIT TRUE");
- } else {
- $this->query("SET COMMIT FALSE");
- }
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- @fbsql_commit($this->connection);
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- @fbsql_rollback($this->connection);
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @fbsql_num_fields($result);
- if (!$cols) {
- return $this->fbsqlRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @fbsql_num_rows($result);
- if ($rows === null) {
- return $this->fbsqlRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if ($this->_last_query_manip) {
- $result = @fbsql_affected_rows($this->connection);
- } else {
- $result = 0;
- }
- return $result;
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_fbsql::createSequence(), DB_fbsql::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- do {
- $repeat = 0;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query('SELECT UNIQUE FROM ' . $seqname);
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE) {
- $repeat = 1;
- $result = $this->createSequence($seq_name);
- if (DB::isError($result)) {
- return $result;
- }
- } else {
- $repeat = 0;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->fbsqlRaiseError();
- }
- $result->fetchInto($tmp, DB_FETCHMODE_ORDERED);
- return $tmp[0];
- }
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_fbsql::nextID(), DB_fbsql::dropSequence()
- */
- function createSequence($seq_name)
- {
- $seqname = $this->getSequenceName($seq_name);
- $res = $this->query('CREATE TABLE ' . $seqname
- . ' (id INTEGER NOT NULL,'
- . ' PRIMARY KEY(id))');
- if ($res) {
- $res = $this->query('SET UNIQUE = 0 FOR ' . $seqname);
- }
- return $res;
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_fbsql::nextID(), DB_fbsql::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name)
- . ' RESTRICT');
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- if (DB::isManip($query) || $this->_next_query_manip) {
- return preg_replace('/^([\s(])*SELECT/i',
- "\\1SELECT TOP($count)", $query);
- } else {
- return preg_replace('/([\s(])*SELECT/i',
- "\\1SELECT TOP($from, $count)", $query);
- }
- }
-
- // }}}
- // {{{ quoteBoolean()
-
- /**
- * Formats a boolean value for use within a query in a locale-independent
- * manner.
- *
- * @param boolean the boolean value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteBoolean($boolean) {
- return $boolean ? 'TRUE' : 'FALSE';
- }
-
- // }}}
- // {{{ quoteFloat()
-
- /**
- * Formats a float value for use within a query in a locale-independent
- * manner.
- *
- * @param float the float value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteFloat($float) {
- return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
- }
-
- // }}}
- // {{{ fbsqlRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_fbsql::errorNative(), DB_common::errorCode()
- */
- function fbsqlRaiseError($errno = null)
- {
- if ($errno === null) {
- $errno = $this->errorCode(fbsql_errno($this->connection));
- }
- return $this->raiseError($errno, null, null, null,
- @fbsql_error($this->connection));
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return int the DBMS' error code
- */
- function errorNative()
- {
- return @fbsql_errno($this->connection);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @fbsql_list_fields($this->dsn['database'],
- $result, $this->connection);
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->fbsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @fbsql_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => $case_func(@fbsql_field_table($id, $i)),
- 'name' => $case_func(@fbsql_field_name($id, $i)),
- 'type' => @fbsql_field_type($id, $i),
- 'len' => @fbsql_field_len($id, $i),
- 'flags' => @fbsql_field_flags($id, $i),
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @fbsql_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SELECT "table_name" FROM information_schema.tables'
- . ' t0, information_schema.schemata t1'
- . ' WHERE t0.schema_pk=t1.schema_pk AND'
- . ' "table_type" = \'BASE TABLE\''
- . ' AND "schema_name" = current_schema';
- case 'views':
- return 'SELECT "table_name" FROM information_schema.tables'
- . ' t0, information_schema.schemata t1'
- . ' WHERE t0.schema_pk=t1.schema_pk AND'
- . ' "table_type" = \'VIEW\''
- . ' AND "schema_name" = current_schema';
- case 'users':
- return 'SELECT "user_name" from information_schema.users';
- case 'functions':
- return 'SELECT "routine_name" FROM'
- . ' information_schema.psm_routines'
- . ' t0, information_schema.schemata t1'
- . ' WHERE t0.schema_pk=t1.schema_pk'
- . ' AND "routine_kind"=\'FUNCTION\''
- . ' AND "schema_name" = current_schema';
- case 'procedures':
- return 'SELECT "routine_name" FROM'
- . ' information_schema.psm_routines'
- . ' t0, information_schema.schemata t1'
- . ' WHERE t0.schema_pk=t1.schema_pk'
- . ' AND "routine_kind"=\'PROCEDURE\''
- . ' AND "schema_name" = current_schema';
- default:
- return null;
- }
- }
-
- // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/ibase.php b/airtime_mvc/library/pear/DB/ibase.php
deleted file mode 100644
index 783606425..000000000
--- a/airtime_mvc/library/pear/DB/ibase.php
+++ /dev/null
@@ -1,1082 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: ibase.php,v 1.116 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's interbase extension
- * for interacting with Interbase and Firebird databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * While this class works with PHP 4, PHP's InterBase extension is
- * unstable in PHP 4. Use PHP 5.
- *
- * NOTICE: limitQuery() only works for Firebird.
- *
- * @category Database
- * @package DB
- * @author Sterling Hughes
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- * @since Class became stable in Release 1.7.0
- */
-class DB_ibase extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'ibase';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'ibase';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * NOTE: only firebird supports limit.
- *
- * @var array
- */
- var $features = array(
- 'limit' => false,
- 'new_link' => false,
- 'numrows' => 'emulate',
- 'pconnect' => true,
- 'prepare' => true,
- 'ssl' => false,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- -104 => DB_ERROR_SYNTAX,
- -150 => DB_ERROR_ACCESS_VIOLATION,
- -151 => DB_ERROR_ACCESS_VIOLATION,
- -155 => DB_ERROR_NOSUCHTABLE,
- -157 => DB_ERROR_NOSUCHFIELD,
- -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
- -170 => DB_ERROR_MISMATCH,
- -171 => DB_ERROR_MISMATCH,
- -172 => DB_ERROR_INVALID,
- // -204 => // Covers too many errors, need to use regex on msg
- -205 => DB_ERROR_NOSUCHFIELD,
- -206 => DB_ERROR_NOSUCHFIELD,
- -208 => DB_ERROR_INVALID,
- -219 => DB_ERROR_NOSUCHTABLE,
- -297 => DB_ERROR_CONSTRAINT,
- -303 => DB_ERROR_INVALID,
- -413 => DB_ERROR_INVALID_NUMBER,
- -530 => DB_ERROR_CONSTRAINT,
- -551 => DB_ERROR_ACCESS_VIOLATION,
- -552 => DB_ERROR_ACCESS_VIOLATION,
- // -607 => // Covers too many errors, need to use regex on msg
- -625 => DB_ERROR_CONSTRAINT_NOT_NULL,
- -803 => DB_ERROR_CONSTRAINT,
- -804 => DB_ERROR_VALUE_COUNT_ON_ROW,
- // -902 => // Covers too many errors, need to use regex on msg
- -904 => DB_ERROR_CONNECT_FAILED,
- -922 => DB_ERROR_NOSUCHDB,
- -923 => DB_ERROR_CONNECT_FAILED,
- -924 => DB_ERROR_CONNECT_FAILED
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * The number of rows affected by a data manipulation query
- * @var integer
- * @access private
- */
- var $affected = 0;
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * The prepared statement handle from the most recently executed statement
- *
- * {@internal Mainly here because the InterBase/Firebird API is only
- * able to retrieve data from result sets if the statemnt handle is
- * still in scope.}}
- *
- * @var resource
- */
- var $last_stmt;
-
- /**
- * Is the given prepared statement a data manipulation query?
- * @var array
- * @access private
- */
- var $manip_query = array();
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_ibase()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's ibase driver supports the following extra DSN options:
- * + buffers The number of database buffers to allocate for the
- * server-side cache.
- * + charset The default character set for a database.
- * + dialect The default SQL dialect for any statement
- * executed within a connection. Defaults to the
- * highest one supported by client libraries.
- * Functional only with InterBase 6 and up.
- * + role Functional only with InterBase 5 and up.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('interbase')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
- if ($this->dbsyntax == 'firebird') {
- $this->features['limit'] = 'alter';
- }
-
- $params = array(
- $dsn['hostspec']
- ? ($dsn['hostspec'] . ':' . $dsn['database'])
- : $dsn['database'],
- $dsn['username'] ? $dsn['username'] : null,
- $dsn['password'] ? $dsn['password'] : null,
- isset($dsn['charset']) ? $dsn['charset'] : null,
- isset($dsn['buffers']) ? $dsn['buffers'] : null,
- isset($dsn['dialect']) ? $dsn['dialect'] : null,
- isset($dsn['role']) ? $dsn['role'] : null,
- );
-
- $connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
-
- $this->connection = @call_user_func_array($connect_function, $params);
- if (!$this->connection) {
- return $this->ibaseRaiseError(DB_ERROR_CONNECT_FAILED);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @ibase_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- $result = @ibase_query($this->connection, $query);
-
- if (!$result) {
- return $this->ibaseRaiseError();
- }
- if ($this->autocommit && $ismanip) {
- @ibase_commit($this->connection);
- }
- if ($ismanip) {
- $this->affected = $result;
- return DB_OK;
- } else {
- $this->affected = 0;
- return $result;
- }
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * Only works with Firebird.
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- if ($this->dsn['dbsyntax'] == 'firebird') {
- $query = preg_replace('/^([\s(])*SELECT/i',
- "SELECT FIRST $count SKIP $from", $query);
- }
- return $query;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal ibase result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- if (function_exists('ibase_fetch_assoc')) {
- $arr = @ibase_fetch_assoc($result);
- } else {
- $arr = get_object_vars(ibase_fetch_object($result));
- }
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @ibase_fetch_row($result);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? ibase_free_result($result) : false;
- }
-
- // }}}
- // {{{ freeQuery()
-
- function freeQuery($query)
- {
- return is_resource($query) ? ibase_free_query($query) : false;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if (is_integer($this->affected)) {
- return $this->affected;
- }
- return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @ibase_num_fields($result);
- if (!$cols) {
- return $this->ibaseRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ prepare()
-
- /**
- * Prepares a query for multiple execution with execute().
- *
- * prepare() requires a generic query as string like
- * INSERT INTO numbers VALUES (?, ?, ?)
- *
. The ? characters are placeholders.
- *
- * Three types of placeholders can be used:
- * + ? a quoted scalar value, i.e. strings, integers
- * + ! value is inserted 'as is'
- * + & requires a file name. The file's contents get
- * inserted into the query (i.e. saving binary
- * data in a db)
- *
- * Use backslashes to escape placeholder characters if you don't want
- * them to be interpreted as placeholders. Example:
- * "UPDATE foo SET col=? WHERE col='over \& under'"
- *
- *
- * @param string $query query to be prepared
- * @return mixed DB statement resource on success. DB_Error on failure.
- */
- function prepare($query)
- {
- $tokens = preg_split('/((? $val) {
- switch ($val) {
- case '?':
- $types[$token++] = DB_PARAM_SCALAR;
- break;
- case '&':
- $types[$token++] = DB_PARAM_OPAQUE;
- break;
- case '!':
- $types[$token++] = DB_PARAM_MISC;
- break;
- default:
- $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
- $newquery .= $tokens[$key] . '?';
- }
- }
-
- $newquery = substr($newquery, 0, -1);
- $this->last_query = $query;
- $newquery = $this->modifyQuery($newquery);
- $stmt = @ibase_prepare($this->connection, $newquery);
-
- if ($stmt === false) {
- $stmt = $this->ibaseRaiseError();
- } else {
- $this->prepare_types[(int)$stmt] = $types;
- $this->manip_query[(int)$stmt] = DB::isManip($query);
- }
-
- return $stmt;
- }
-
- // }}}
- // {{{ execute()
-
- /**
- * Executes a DB statement prepared with prepare().
- *
- * @param resource $stmt a DB statement resource returned from prepare()
- * @param mixed $data array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 for non-array items or the
- * quantity of elements in the array.
- * @return object a new DB_Result or a DB_Error when fail
- * @see DB_ibase::prepare()
- * @access public
- */
- function &execute($stmt, $data = array())
- {
- $data = (array)$data;
- $this->last_parameters = $data;
-
- $types = $this->prepare_types[(int)$stmt];
- if (count($types) != count($data)) {
- $tmp = $this->raiseError(DB_ERROR_MISMATCH);
- return $tmp;
- }
-
- $i = 0;
- foreach ($data as $key => $value) {
- if ($types[$i] == DB_PARAM_MISC) {
- /*
- * ibase doesn't seem to have the ability to pass a
- * parameter along unchanged, so strip off quotes from start
- * and end, plus turn two single quotes to one single quote,
- * in order to avoid the quotes getting escaped by
- * ibase and ending up in the database.
- */
- $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
- $data[$key] = str_replace("''", "'", $data[$key]);
- } elseif ($types[$i] == DB_PARAM_OPAQUE) {
- $fp = @fopen($data[$key], 'rb');
- if (!$fp) {
- $tmp = $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
- return $tmp;
- }
- $data[$key] = fread($fp, filesize($data[$key]));
- fclose($fp);
- }
- $i++;
- }
-
- array_unshift($data, $stmt);
-
- $res = call_user_func_array('ibase_execute', $data);
- if (!$res) {
- $tmp = $this->ibaseRaiseError();
- return $tmp;
- }
- /* XXX need this?
- if ($this->autocommit && $this->manip_query[(int)$stmt]) {
- @ibase_commit($this->connection);
- }*/
- $this->last_stmt = $stmt;
- if ($this->manip_query[(int)$stmt] || $this->_next_query_manip) {
- $this->_last_query_manip = true;
- $this->_next_query_manip = false;
- $tmp = DB_OK;
- } else {
- $this->_last_query_manip = false;
- $tmp = new DB_result($this, $res);
- }
- return $tmp;
- }
-
- /**
- * Frees the internal resources associated with a prepared query
- *
- * @param resource $stmt the prepared statement's PHP resource
- * @param bool $free_resource should the PHP resource be freed too?
- * Use false if you need to get data
- * from the result set later.
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_ibase::prepare()
- */
- function freePrepared($stmt, $free_resource = true)
- {
- if (!is_resource($stmt)) {
- return false;
- }
- if ($free_resource) {
- @ibase_free_query($stmt);
- }
- unset($this->prepare_tokens[(int)$stmt]);
- unset($this->prepare_types[(int)$stmt]);
- unset($this->manip_query[(int)$stmt]);
- return true;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- $this->autocommit = $onoff ? 1 : 0;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- return @ibase_commit($this->connection);
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- return @ibase_rollback($this->connection);
- }
-
- // }}}
- // {{{ transactionInit()
-
- function transactionInit($trans_args = 0)
- {
- return $trans_args
- ? @ibase_trans($trans_args, $this->connection)
- : @ibase_trans();
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_ibase::createSequence(), DB_ibase::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $sqn = strtoupper($this->getSequenceName($seq_name));
- $repeat = 0;
- do {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("SELECT GEN_ID(${sqn}, 1) "
- . 'FROM RDB$GENERATORS '
- . "WHERE RDB\$GENERATOR_NAME='${sqn}'");
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result)) {
- $repeat = 1;
- $result = $this->createSequence($seq_name);
- if (DB::isError($result)) {
- return $result;
- }
- } else {
- $repeat = 0;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
- $result->free();
- return $arr[0];
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_ibase::nextID(), DB_ibase::dropSequence()
- */
- function createSequence($seq_name)
- {
- $sqn = strtoupper($this->getSequenceName($seq_name));
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("CREATE GENERATOR ${sqn}");
- $this->popErrorHandling();
-
- return $result;
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_ibase::nextID(), DB_ibase::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DELETE FROM RDB$GENERATORS '
- . "WHERE RDB\$GENERATOR_NAME='"
- . strtoupper($this->getSequenceName($seq_name))
- . "'");
- }
-
- // }}}
- // {{{ _ibaseFieldFlags()
-
- /**
- * Get the column's flags
- *
- * Supports "primary_key", "unique_key", "not_null", "default",
- * "computed" and "blob".
- *
- * @param string $field_name the name of the field
- * @param string $table_name the name of the table
- *
- * @return string the flags
- *
- * @access private
- */
- function _ibaseFieldFlags($field_name, $table_name)
- {
- $sql = 'SELECT R.RDB$CONSTRAINT_TYPE CTYPE'
- .' FROM RDB$INDEX_SEGMENTS I'
- .' JOIN RDB$RELATION_CONSTRAINTS R ON I.RDB$INDEX_NAME=R.RDB$INDEX_NAME'
- .' WHERE I.RDB$FIELD_NAME=\'' . $field_name . '\''
- .' AND UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\'';
-
- $result = @ibase_query($this->connection, $sql);
- if (!$result) {
- return $this->ibaseRaiseError();
- }
-
- $flags = '';
- if ($obj = @ibase_fetch_object($result)) {
- @ibase_free_result($result);
- if (isset($obj->CTYPE) && trim($obj->CTYPE) == 'PRIMARY KEY') {
- $flags .= 'primary_key ';
- }
- if (isset($obj->CTYPE) && trim($obj->CTYPE) == 'UNIQUE') {
- $flags .= 'unique_key ';
- }
- }
-
- $sql = 'SELECT R.RDB$NULL_FLAG AS NFLAG,'
- .' R.RDB$DEFAULT_SOURCE AS DSOURCE,'
- .' F.RDB$FIELD_TYPE AS FTYPE,'
- .' F.RDB$COMPUTED_SOURCE AS CSOURCE'
- .' FROM RDB$RELATION_FIELDS R '
- .' JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME'
- .' WHERE UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\''
- .' AND R.RDB$FIELD_NAME=\'' . $field_name . '\'';
-
- $result = @ibase_query($this->connection, $sql);
- if (!$result) {
- return $this->ibaseRaiseError();
- }
- if ($obj = @ibase_fetch_object($result)) {
- @ibase_free_result($result);
- if (isset($obj->NFLAG)) {
- $flags .= 'not_null ';
- }
- if (isset($obj->DSOURCE)) {
- $flags .= 'default ';
- }
- if (isset($obj->CSOURCE)) {
- $flags .= 'computed ';
- }
- if (isset($obj->FTYPE) && $obj->FTYPE == 261) {
- $flags .= 'blob ';
- }
- }
-
- return trim($flags);
- }
-
- // }}}
- // {{{ ibaseRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_ibase::errorNative(), DB_ibase::errorCode()
- */
- function &ibaseRaiseError($errno = null)
- {
- if ($errno === null) {
- $errno = $this->errorCode($this->errorNative());
- }
- $tmp = $this->raiseError($errno, null, null, null, @ibase_errmsg());
- return $tmp;
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return int the DBMS' error code. NULL if there is no error code.
- *
- * @since Method available since Release 1.7.0
- */
- function errorNative()
- {
- if (function_exists('ibase_errcode')) {
- return @ibase_errcode();
- }
- if (preg_match('/^Dynamic SQL Error SQL error code = ([0-9-]+)/i',
- @ibase_errmsg(), $m)) {
- return (int)$m[1];
- }
- return null;
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Maps native error codes to DB's portable ones
- *
- * @param int $nativecode the error code returned by the DBMS
- *
- * @return int the portable DB error code. Return DB_ERROR if the
- * current driver doesn't have a mapping for the
- * $nativecode submitted.
- *
- * @since Method available since Release 1.7.0
- */
- function errorCode($nativecode = null)
- {
- if (isset($this->errorcode_map[$nativecode])) {
- return $this->errorcode_map[$nativecode];
- }
-
- static $error_regexps;
- if (!isset($error_regexps)) {
- $error_regexps = array(
- '/generator .* is not defined/'
- => DB_ERROR_SYNTAX, // for compat. w ibase_errcode()
- '/table.*(not exist|not found|unknown)/i'
- => DB_ERROR_NOSUCHTABLE,
- '/table .* already exists/i'
- => DB_ERROR_ALREADY_EXISTS,
- '/unsuccessful metadata update .* failed attempt to store duplicate value/i'
- => DB_ERROR_ALREADY_EXISTS,
- '/unsuccessful metadata update .* not found/i'
- => DB_ERROR_NOT_FOUND,
- '/validation error for column .* value "\*\*\* null/i'
- => DB_ERROR_CONSTRAINT_NOT_NULL,
- '/violation of [\w ]+ constraint/i'
- => DB_ERROR_CONSTRAINT,
- '/conversion error from string/i'
- => DB_ERROR_INVALID_NUMBER,
- '/no permission for/i'
- => DB_ERROR_ACCESS_VIOLATION,
- '/arithmetic exception, numeric overflow, or string truncation/i'
- => DB_ERROR_INVALID,
- '/feature is not supported/i'
- => DB_ERROR_NOT_CAPABLE,
- );
- }
-
- $errormsg = @ibase_errmsg();
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $errormsg)) {
- return $code;
- }
- }
- return DB_ERROR;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if $result
- * is a table name.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @ibase_query($this->connection,
- "SELECT * FROM $result WHERE 1=0");
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->ibaseRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @ibase_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $info = @ibase_field_info($id, $i);
- $res[$i] = array(
- 'table' => $got_string ? $case_func($result) : '',
- 'name' => $case_func($info['name']),
- 'type' => $info['type'],
- 'len' => $info['length'],
- 'flags' => ($got_string)
- ? $this->_ibaseFieldFlags($info['name'], $result)
- : '',
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @ibase_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SELECT DISTINCT R.RDB$RELATION_NAME FROM '
- . 'RDB$RELATION_FIELDS R WHERE R.RDB$SYSTEM_FLAG=0';
- case 'views':
- return 'SELECT DISTINCT RDB$VIEW_NAME from RDB$VIEW_RELATIONS';
- case 'users':
- return 'SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES';
- default:
- return null;
- }
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/ifx.php b/airtime_mvc/library/pear/DB/ifx.php
deleted file mode 100644
index 98ebecb2d..000000000
--- a/airtime_mvc/library/pear/DB/ifx.php
+++ /dev/null
@@ -1,683 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: ifx.php,v 1.75 2007/07/06 05:19:21 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's ifx extension
- * for interacting with Informix databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * More info on Informix errors can be found at:
- * http://www.informix.com/answers/english/ierrors.htm
- *
- * TODO:
- * - set needed env Informix vars on connect
- * - implement native prepare/execute
- *
- * @category Database
- * @package DB
- * @author Tomas V.V.Cox
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_ifx extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'ifx';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'ifx';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'emulate',
- 'new_link' => false,
- 'numrows' => 'emulate',
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- '-201' => DB_ERROR_SYNTAX,
- '-206' => DB_ERROR_NOSUCHTABLE,
- '-217' => DB_ERROR_NOSUCHFIELD,
- '-236' => DB_ERROR_VALUE_COUNT_ON_ROW,
- '-239' => DB_ERROR_CONSTRAINT,
- '-253' => DB_ERROR_SYNTAX,
- '-268' => DB_ERROR_CONSTRAINT,
- '-292' => DB_ERROR_CONSTRAINT_NOT_NULL,
- '-310' => DB_ERROR_ALREADY_EXISTS,
- '-316' => DB_ERROR_ALREADY_EXISTS,
- '-319' => DB_ERROR_NOT_FOUND,
- '-329' => DB_ERROR_NODBSELECTED,
- '-346' => DB_ERROR_CONSTRAINT,
- '-386' => DB_ERROR_CONSTRAINT_NOT_NULL,
- '-391' => DB_ERROR_CONSTRAINT_NOT_NULL,
- '-554' => DB_ERROR_SYNTAX,
- '-691' => DB_ERROR_CONSTRAINT,
- '-692' => DB_ERROR_CONSTRAINT,
- '-703' => DB_ERROR_CONSTRAINT_NOT_NULL,
- '-1202' => DB_ERROR_DIVZERO,
- '-1204' => DB_ERROR_INVALID_DATE,
- '-1205' => DB_ERROR_INVALID_DATE,
- '-1206' => DB_ERROR_INVALID_DATE,
- '-1209' => DB_ERROR_INVALID_DATE,
- '-1210' => DB_ERROR_INVALID_DATE,
- '-1212' => DB_ERROR_INVALID_DATE,
- '-1213' => DB_ERROR_INVALID_NUMBER,
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * The quantity of transactions begun
- *
- * {@internal While this is private, it can't actually be designated
- * private in PHP 5 because it is directly accessed in the test suite.}}
- *
- * @var integer
- * @access private
- */
- var $transaction_opcount = 0;
-
- /**
- * The number of rows affected by a data manipulation query
- * @var integer
- * @access private
- */
- var $affected = 0;
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_ifx()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('informix') &&
- !PEAR::loadExtension('Informix'))
- {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $dbhost = $dsn['hostspec'] ? '@' . $dsn['hostspec'] : '';
- $dbname = $dsn['database'] ? $dsn['database'] . $dbhost : '';
- $user = $dsn['username'] ? $dsn['username'] : '';
- $pw = $dsn['password'] ? $dsn['password'] : '';
-
- $connect_function = $persistent ? 'ifx_pconnect' : 'ifx_connect';
-
- $this->connection = @$connect_function($dbname, $user, $pw);
- if (!is_resource($this->connection)) {
- return $this->ifxRaiseError(DB_ERROR_CONNECT_FAILED);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @ifx_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- $this->affected = null;
- if (preg_match('/(SELECT|EXECUTE)/i', $query)) { //TESTME: Use !DB::isManip()?
- // the scroll is needed for fetching absolute row numbers
- // in a select query result
- $result = @ifx_query($query, $this->connection, IFX_SCROLL);
- } else {
- if (!$this->autocommit && $ismanip) {
- if ($this->transaction_opcount == 0) {
- $result = @ifx_query('BEGIN WORK', $this->connection);
- if (!$result) {
- return $this->ifxRaiseError();
- }
- }
- $this->transaction_opcount++;
- }
- $result = @ifx_query($query, $this->connection);
- }
- if (!$result) {
- return $this->ifxRaiseError();
- }
- $this->affected = @ifx_affected_rows($result);
- // Determine which queries should return data, and which
- // should return an error code only.
- if (preg_match('/(SELECT|EXECUTE)/i', $query)) {
- return $result;
- }
- // XXX Testme: free results inside a transaction
- // may cause to stop it and commit the work?
-
- // Result has to be freed even with a insert or update
- @ifx_free_result($result);
-
- return DB_OK;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal ifx result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if ($this->_last_query_manip) {
- return $this->affected;
- } else {
- return 0;
- }
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if (($rownum !== null) && ($rownum < 0)) {
- return null;
- }
- if ($rownum === null) {
- /*
- * Even though fetch_row() should return the next row if
- * $rownum is null, it doesn't in all cases. Bug 598.
- */
- $rownum = 'NEXT';
- } else {
- // Index starts at row 1, unlike most DBMS's starting at 0.
- $rownum++;
- }
- if (!$arr = @ifx_fetch_row($result, $rownum)) {
- return null;
- }
- if ($fetchmode !== DB_FETCHMODE_ASSOC) {
- $i=0;
- $order = array();
- foreach ($arr as $val) {
- $order[$i++] = $val;
- }
- $arr = $order;
- } elseif ($fetchmode == DB_FETCHMODE_ASSOC &&
- $this->options['portability'] & DB_PORTABILITY_LOWERCASE)
- {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- if (!$cols = @ifx_num_fields($result)) {
- return $this->ifxRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? ifx_free_result($result) : false;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = true)
- {
- // XXX if $this->transaction_opcount > 0, we should probably
- // issue a warning here.
- $this->autocommit = $onoff ? true : false;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if ($this->transaction_opcount > 0) {
- $result = @ifx_query('COMMIT WORK', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->ifxRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if ($this->transaction_opcount > 0) {
- $result = @ifx_query('ROLLBACK WORK', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->ifxRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ ifxRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_ifx::errorNative(), DB_ifx::errorCode()
- */
- function ifxRaiseError($errno = null)
- {
- if ($errno === null) {
- $errno = $this->errorCode(ifx_error());
- }
- return $this->raiseError($errno, null, null, null,
- $this->errorNative());
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code and message produced by the last query
- *
- * @return string the DBMS' error code and message
- */
- function errorNative()
- {
- return @ifx_error() . ' ' . @ifx_errormsg();
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Maps native error codes to DB's portable ones.
- *
- * Requires that the DB implementation's constructor fills
- * in the $errorcode_map property.
- *
- * @param string $nativecode error code returned by the database
- * @return int a portable DB error code, or DB_ERROR if this DB
- * implementation has no mapping for the given error code.
- */
- function errorCode($nativecode)
- {
- if (ereg('SQLCODE=(.*)]', $nativecode, $match)) {
- $code = $match[1];
- if (isset($this->errorcode_map[$code])) {
- return $this->errorcode_map[$code];
- }
- }
- return DB_ERROR;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' if $result is a table name.
- *
- * If analyzing a query result and the result has duplicate field names,
- * an error will be raised saying
- * can't distinguish duplicate field names.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- * @since Method available since Release 1.6.0
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @ifx_query("SELECT * FROM $result WHERE 1=0",
- $this->connection);
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->ifxRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- $flds = @ifx_fieldproperties($id);
- $count = @ifx_num_fields($id);
-
- if (count($flds) != $count) {
- return $this->raiseError("can't distinguish duplicate field names");
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $i = 0;
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- foreach ($flds as $key => $value) {
- $props = explode(';', $value);
- $res[$i] = array(
- 'table' => $got_string ? $case_func($result) : '',
- 'name' => $case_func($key),
- 'type' => $props[0],
- 'len' => $props[1],
- 'flags' => $props[4] == 'N' ? 'not_null' : '',
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- $i++;
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @ifx_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SELECT tabname FROM systables WHERE tabid >= 100';
- default:
- return null;
- }
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/msql.php b/airtime_mvc/library/pear/DB/msql.php
deleted file mode 100644
index f9c107d34..000000000
--- a/airtime_mvc/library/pear/DB/msql.php
+++ /dev/null
@@ -1,831 +0,0 @@
-
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: msql.php,v 1.64 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's msql extension
- * for interacting with Mini SQL databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * PHP's mSQL extension did weird things with NULL values prior to PHP
- * 4.3.11 and 5.0.4. Make sure your version of PHP meets or exceeds
- * those versions.
- *
- * @category Database
- * @package DB
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- * @since Class not functional until Release 1.7.0
- */
-class DB_msql extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'msql';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'msql';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'emulate',
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => false,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * The query result resource created by PHP
- *
- * Used to make affectedRows() work. Only contains the result for
- * data manipulation queries. Contains false for other queries.
- *
- * @var resource
- * @access private
- */
- var $_result;
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_msql()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * Example of how to connect:
- *
- * require_once 'DB.php';
- *
- * // $dsn = 'msql://hostname/dbname'; // use a TCP connection
- * $dsn = 'msql:///dbname'; // use a socket
- * $options = array(
- * 'portability' => DB_PORTABILITY_ALL,
- * );
- *
- * $db = DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('msql')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $params = array();
- if ($dsn['hostspec']) {
- $params[] = $dsn['port']
- ? $dsn['hostspec'] . ',' . $dsn['port']
- : $dsn['hostspec'];
- }
-
- $connect_function = $persistent ? 'msql_pconnect' : 'msql_connect';
-
- $ini = ini_get('track_errors');
- $php_errormsg = '';
- if ($ini) {
- $this->connection = @call_user_func_array($connect_function,
- $params);
- } else {
- @ini_set('track_errors', 1);
- $this->connection = @call_user_func_array($connect_function,
- $params);
- @ini_set('track_errors', $ini);
- }
-
- if (!$this->connection) {
- if (($err = @msql_error()) != '') {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $err);
- } else {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
- }
-
- if (!@msql_select_db($dsn['database'], $this->connection)) {
- return $this->msqlRaiseError();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @msql_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- $result = @msql_query($query, $this->connection);
- if (!$result) {
- return $this->msqlRaiseError();
- }
- // Determine which queries that should return data, and which
- // should return an error code only.
- if ($this->_checkManip($query)) {
- $this->_result = $result;
- return DB_OK;
- } else {
- $this->_result = false;
- return $result;
- }
- }
-
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal msql result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * PHP's mSQL extension did weird things with NULL values prior to PHP
- * 4.3.11 and 5.0.4. Make sure your version of PHP meets or exceeds
- * those versions.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- if (!@msql_data_seek($result, $rownum)) {
- return null;
- }
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @msql_fetch_array($result, MSQL_ASSOC);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @msql_fetch_row($result);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? msql_free_result($result) : false;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @msql_num_fields($result);
- if (!$cols) {
- return $this->msqlRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @msql_num_rows($result);
- if ($rows === false) {
- return $this->msqlRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ affected()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if (!$this->_result) {
- return 0;
- }
- return msql_affected_rows($this->_result);
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_msql::createSequence(), DB_msql::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- $repeat = false;
- do {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("SELECT _seq FROM ${seqname}");
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE) {
- $repeat = true;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->createSequence($seq_name);
- $this->popErrorHandling();
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- } else {
- $repeat = false;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
- $result->free();
- return $arr[0];
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Creates a new sequence
- *
- * Also creates a new table to associate the sequence with. Uses
- * a separate table to ensure portability with other drivers.
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_msql::nextID(), DB_msql::dropSequence()
- */
- function createSequence($seq_name)
- {
- $seqname = $this->getSequenceName($seq_name);
- $res = $this->query('CREATE TABLE ' . $seqname
- . ' (id INTEGER NOT NULL)');
- if (DB::isError($res)) {
- return $res;
- }
- $res = $this->query("CREATE SEQUENCE ON ${seqname}");
- return $res;
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_msql::nextID(), DB_msql::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ quoteIdentifier()
-
- /**
- * mSQL does not support delimited identifiers
- *
- * @param string $str the identifier name to be quoted
- *
- * @return object a DB_Error object
- *
- * @see DB_common::quoteIdentifier()
- * @since Method available since Release 1.7.0
- */
- function quoteIdentifier($str)
- {
- return $this->raiseError(DB_ERROR_UNSUPPORTED);
- }
-
- // }}}
- // {{{ quoteFloat()
-
- /**
- * Formats a float value for use within a query in a locale-independent
- * manner.
- *
- * @param float the float value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteFloat($float) {
- return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.7.0
- */
- function escapeSimple($str)
- {
- return addslashes($str);
- }
-
- // }}}
- // {{{ msqlRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_msql::errorNative(), DB_msql::errorCode()
- */
- function msqlRaiseError($errno = null)
- {
- $native = $this->errorNative();
- if ($errno === null) {
- $errno = $this->errorCode($native);
- }
- return $this->raiseError($errno, null, null, null, $native);
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error message produced by the last query
- *
- * @return string the DBMS' error message
- */
- function errorNative()
- {
- return @msql_error();
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Determines PEAR::DB error code from the database's text error message
- *
- * @param string $errormsg the error message returned from the database
- *
- * @return integer the error number from a DB_ERROR* constant
- */
- function errorCode($errormsg)
- {
- static $error_regexps;
-
- // PHP 5.2+ prepends the function name to $php_errormsg, so we need
- // this hack to work around it, per bug #9599.
- $errormsg = preg_replace('/^msql[a-z_]+\(\): /', '', $errormsg);
-
- if (!isset($error_regexps)) {
- $error_regexps = array(
- '/^Access to database denied/i'
- => DB_ERROR_ACCESS_VIOLATION,
- '/^Bad index name/i'
- => DB_ERROR_ALREADY_EXISTS,
- '/^Bad order field/i'
- => DB_ERROR_SYNTAX,
- '/^Bad type for comparison/i'
- => DB_ERROR_SYNTAX,
- '/^Can\'t perform LIKE on/i'
- => DB_ERROR_SYNTAX,
- '/^Can\'t use TEXT fields in LIKE comparison/i'
- => DB_ERROR_SYNTAX,
- '/^Couldn\'t create temporary table/i'
- => DB_ERROR_CANNOT_CREATE,
- '/^Error creating table file/i'
- => DB_ERROR_CANNOT_CREATE,
- '/^Field .* cannot be null$/i'
- => DB_ERROR_CONSTRAINT_NOT_NULL,
- '/^Index (field|condition) .* cannot be null$/i'
- => DB_ERROR_SYNTAX,
- '/^Invalid date format/i'
- => DB_ERROR_INVALID_DATE,
- '/^Invalid time format/i'
- => DB_ERROR_INVALID,
- '/^Literal value for .* is wrong type$/i'
- => DB_ERROR_INVALID_NUMBER,
- '/^No Database Selected/i'
- => DB_ERROR_NODBSELECTED,
- '/^No value specified for field/i'
- => DB_ERROR_VALUE_COUNT_ON_ROW,
- '/^Non unique value for unique index/i'
- => DB_ERROR_CONSTRAINT,
- '/^Out of memory for temporary table/i'
- => DB_ERROR_CANNOT_CREATE,
- '/^Permission denied/i'
- => DB_ERROR_ACCESS_VIOLATION,
- '/^Reference to un-selected table/i'
- => DB_ERROR_SYNTAX,
- '/^syntax error/i'
- => DB_ERROR_SYNTAX,
- '/^Table .* exists$/i'
- => DB_ERROR_ALREADY_EXISTS,
- '/^Unknown database/i'
- => DB_ERROR_NOSUCHDB,
- '/^Unknown field/i'
- => DB_ERROR_NOSUCHFIELD,
- '/^Unknown (index|system variable)/i'
- => DB_ERROR_NOT_FOUND,
- '/^Unknown table/i'
- => DB_ERROR_NOSUCHTABLE,
- '/^Unqualified field/i'
- => DB_ERROR_SYNTAX,
- );
- }
-
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $errormsg)) {
- return $code;
- }
- }
- return DB_ERROR;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::setOption()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @msql_query("SELECT * FROM $result",
- $this->connection);
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @msql_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $tmp = @msql_fetch_field($id);
-
- $flags = '';
- if ($tmp->not_null) {
- $flags .= 'not_null ';
- }
- if ($tmp->unique) {
- $flags .= 'unique_key ';
- }
- $flags = trim($flags);
-
- $res[$i] = array(
- 'table' => $case_func($tmp->table),
- 'name' => $case_func($tmp->name),
- 'type' => $tmp->type,
- 'len' => msql_field_len($id, $i),
- 'flags' => $flags,
- );
-
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @msql_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtain a list of a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return array the array containing the list of objects requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'databases':
- $id = @msql_list_dbs($this->connection);
- break;
- case 'tables':
- $id = @msql_list_tables($this->dsn['database'],
- $this->connection);
- break;
- default:
- return null;
- }
- if (!$id) {
- return $this->msqlRaiseError();
- }
- $out = array();
- while ($row = @msql_fetch_row($id)) {
- $out[] = $row[0];
- }
- return $out;
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/mssql.php b/airtime_mvc/library/pear/DB/mssql.php
deleted file mode 100644
index 57e19b0fd..000000000
--- a/airtime_mvc/library/pear/DB/mssql.php
+++ /dev/null
@@ -1,963 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: mssql.php,v 1.92 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's mssql extension
- * for interacting with Microsoft SQL Server databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * DB's mssql driver is only for Microsfoft SQL Server databases.
- *
- * If you're connecting to a Sybase database, you MUST specify "sybase"
- * as the "phptype" in the DSN.
- *
- * This class only works correctly if you have compiled PHP using
- * --with-mssql=[dir_to_FreeTDS].
- *
- * @category Database
- * @package DB
- * @author Sterling Hughes
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_mssql extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'mssql';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'mssql';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'emulate',
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- // XXX Add here error codes ie: 'S100E' => DB_ERROR_SYNTAX
- var $errorcode_map = array(
- 102 => DB_ERROR_SYNTAX,
- 110 => DB_ERROR_VALUE_COUNT_ON_ROW,
- 155 => DB_ERROR_NOSUCHFIELD,
- 156 => DB_ERROR_SYNTAX,
- 170 => DB_ERROR_SYNTAX,
- 207 => DB_ERROR_NOSUCHFIELD,
- 208 => DB_ERROR_NOSUCHTABLE,
- 245 => DB_ERROR_INVALID_NUMBER,
- 319 => DB_ERROR_SYNTAX,
- 321 => DB_ERROR_NOSUCHFIELD,
- 325 => DB_ERROR_SYNTAX,
- 336 => DB_ERROR_SYNTAX,
- 515 => DB_ERROR_CONSTRAINT_NOT_NULL,
- 547 => DB_ERROR_CONSTRAINT,
- 1018 => DB_ERROR_SYNTAX,
- 1035 => DB_ERROR_SYNTAX,
- 1913 => DB_ERROR_ALREADY_EXISTS,
- 2209 => DB_ERROR_SYNTAX,
- 2223 => DB_ERROR_SYNTAX,
- 2248 => DB_ERROR_SYNTAX,
- 2256 => DB_ERROR_SYNTAX,
- 2257 => DB_ERROR_SYNTAX,
- 2627 => DB_ERROR_CONSTRAINT,
- 2714 => DB_ERROR_ALREADY_EXISTS,
- 3607 => DB_ERROR_DIVZERO,
- 3701 => DB_ERROR_NOSUCHTABLE,
- 7630 => DB_ERROR_SYNTAX,
- 8134 => DB_ERROR_DIVZERO,
- 9303 => DB_ERROR_SYNTAX,
- 9317 => DB_ERROR_SYNTAX,
- 9318 => DB_ERROR_SYNTAX,
- 9331 => DB_ERROR_SYNTAX,
- 9332 => DB_ERROR_SYNTAX,
- 15253 => DB_ERROR_SYNTAX,
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * The quantity of transactions begun
- *
- * {@internal While this is private, it can't actually be designated
- * private in PHP 5 because it is directly accessed in the test suite.}}
- *
- * @var integer
- * @access private
- */
- var $transaction_opcount = 0;
-
- /**
- * The database specified in the DSN
- *
- * It's a fix to allow calls to different databases in the same script.
- *
- * @var string
- * @access private
- */
- var $_db = null;
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_mssql()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('mssql') && !PEAR::loadExtension('sybase')
- && !PEAR::loadExtension('sybase_ct'))
- {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $params = array(
- $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
- $dsn['username'] ? $dsn['username'] : null,
- $dsn['password'] ? $dsn['password'] : null,
- );
- if ($dsn['port']) {
- $params[0] .= ((substr(PHP_OS, 0, 3) == 'WIN') ? ',' : ':')
- . $dsn['port'];
- }
-
- $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect';
-
- $this->connection = @call_user_func_array($connect_function, $params);
-
- if (!$this->connection) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- @mssql_get_last_message());
- }
- if ($dsn['database']) {
- if (!@mssql_select_db($dsn['database'], $this->connection)) {
- return $this->raiseError(DB_ERROR_NODBSELECTED,
- null, null, null,
- @mssql_get_last_message());
- }
- $this->_db = $dsn['database'];
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @mssql_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- if (!@mssql_select_db($this->_db, $this->connection)) {
- return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- $query = $this->modifyQuery($query);
- if (!$this->autocommit && $ismanip) {
- if ($this->transaction_opcount == 0) {
- $result = @mssql_query('BEGIN TRAN', $this->connection);
- if (!$result) {
- return $this->mssqlRaiseError();
- }
- }
- $this->transaction_opcount++;
- }
- $result = @mssql_query($query, $this->connection);
- if (!$result) {
- return $this->mssqlRaiseError();
- }
- // Determine which queries that should return data, and which
- // should return an error code only.
- return $ismanip ? DB_OK : $result;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal mssql result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return @mssql_next_result($result);
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- if (!@mssql_data_seek($result, $rownum)) {
- return null;
- }
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @mssql_fetch_assoc($result);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @mssql_fetch_row($result);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? mssql_free_result($result) : false;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @mssql_num_fields($result);
- if (!$cols) {
- return $this->mssqlRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @mssql_num_rows($result);
- if ($rows === false) {
- return $this->mssqlRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- // XXX if $this->transaction_opcount > 0, we should probably
- // issue a warning here.
- $this->autocommit = $onoff ? true : false;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if ($this->transaction_opcount > 0) {
- if (!@mssql_select_db($this->_db, $this->connection)) {
- return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- $result = @mssql_query('COMMIT TRAN', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->mssqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if ($this->transaction_opcount > 0) {
- if (!@mssql_select_db($this->_db, $this->connection)) {
- return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- $result = @mssql_query('ROLLBACK TRAN', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->mssqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if ($this->_last_query_manip) {
- $res = @mssql_query('select @@rowcount', $this->connection);
- if (!$res) {
- return $this->mssqlRaiseError();
- }
- $ar = @mssql_fetch_row($res);
- if (!$ar) {
- $result = 0;
- } else {
- @mssql_free_result($res);
- $result = $ar[0];
- }
- } else {
- $result = 0;
- }
- return $result;
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_mssql::createSequence(), DB_mssql::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- if (!@mssql_select_db($this->_db, $this->connection)) {
- return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- $repeat = 0;
- do {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result) &&
- ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
- {
- $repeat = 1;
- $result = $this->createSequence($seq_name);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- } elseif (!DB::isError($result)) {
- $result = $this->query("SELECT IDENT_CURRENT('$seqname')");
- if (DB::isError($result)) {
- /* Fallback code for MS SQL Server 7.0, which doesn't have
- * IDENT_CURRENT. This is *not* safe for concurrent
- * requests, and really, if you're using it, you're in a
- * world of hurt. Nevertheless, it's here to ensure BC. See
- * bug #181 for the gory details.*/
- $result = $this->query("SELECT @@IDENTITY FROM $seqname");
- }
- $repeat = 0;
- } else {
- $repeat = false;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
- return $result[0];
- }
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_mssql::nextID(), DB_mssql::dropSequence()
- */
- function createSequence($seq_name)
- {
- return $this->query('CREATE TABLE '
- . $this->getSequenceName($seq_name)
- . ' ([id] [int] IDENTITY (1, 1) NOT NULL,'
- . ' [vapor] [int] NULL)');
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_mssql::nextID(), DB_mssql::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ quoteIdentifier()
-
- /**
- * Quotes a string so it can be safely used as a table or column name
- *
- * @param string $str identifier name to be quoted
- *
- * @return string quoted identifier string
- *
- * @see DB_common::quoteIdentifier()
- * @since Method available since Release 1.6.0
- */
- function quoteIdentifier($str)
- {
- return '[' . str_replace(']', ']]', $str) . ']';
- }
-
- // }}}
- // {{{ mssqlRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_mssql::errorNative(), DB_mssql::errorCode()
- */
- function mssqlRaiseError($code = null)
- {
- $message = @mssql_get_last_message();
- if (!$code) {
- $code = $this->errorNative();
- }
- return $this->raiseError($this->errorCode($code, $message),
- null, null, null, "$code - $message");
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return int the DBMS' error code
- */
- function errorNative()
- {
- $res = @mssql_query('select @@ERROR as ErrorCode', $this->connection);
- if (!$res) {
- return DB_ERROR;
- }
- $row = @mssql_fetch_row($res);
- return $row[0];
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Determines PEAR::DB error code from mssql's native codes.
- *
- * If $nativecode isn't known yet, it will be looked up.
- *
- * @param mixed $nativecode mssql error code, if known
- * @return integer an error number from a DB error constant
- * @see errorNative()
- */
- function errorCode($nativecode = null, $msg = '')
- {
- if (!$nativecode) {
- $nativecode = $this->errorNative();
- }
- if (isset($this->errorcode_map[$nativecode])) {
- if ($nativecode == 3701
- && preg_match('/Cannot drop the index/i', $msg))
- {
- return DB_ERROR_NOT_FOUND;
- }
- return $this->errorcode_map[$nativecode];
- } else {
- return DB_ERROR;
- }
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if $result
- * is a table name.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- if (!@mssql_select_db($this->_db, $this->connection)) {
- return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- $id = @mssql_query("SELECT * FROM $result WHERE 1=0",
- $this->connection);
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->mssqlRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @mssql_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- if ($got_string) {
- $flags = $this->_mssql_field_flags($result,
- @mssql_field_name($id, $i));
- if (DB::isError($flags)) {
- return $flags;
- }
- } else {
- $flags = '';
- }
-
- $res[$i] = array(
- 'table' => $got_string ? $case_func($result) : '',
- 'name' => $case_func(@mssql_field_name($id, $i)),
- 'type' => @mssql_field_type($id, $i),
- 'len' => @mssql_field_length($id, $i),
- 'flags' => $flags,
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @mssql_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ _mssql_field_flags()
-
- /**
- * Get a column's flags
- *
- * Supports "not_null", "primary_key",
- * "auto_increment" (mssql identity), "timestamp" (mssql timestamp),
- * "unique_key" (mssql unique index, unique check or primary_key) and
- * "multiple_key" (multikey index)
- *
- * mssql timestamp is NOT similar to the mysql timestamp so this is maybe
- * not useful at all - is the behaviour of mysql_field_flags that primary
- * keys are alway unique? is the interpretation of multiple_key correct?
- *
- * @param string $table the table name
- * @param string $column the field name
- *
- * @return string the flags
- *
- * @access private
- * @author Joern Barthel
- */
- function _mssql_field_flags($table, $column)
- {
- static $tableName = null;
- static $flags = array();
-
- if ($table != $tableName) {
-
- $flags = array();
- $tableName = $table;
-
- // get unique and primary keys
- $res = $this->getAll("EXEC SP_HELPINDEX $table", DB_FETCHMODE_ASSOC);
- if (DB::isError($res)) {
- return $res;
- }
-
- foreach ($res as $val) {
- $keys = explode(', ', $val['index_keys']);
-
- if (sizeof($keys) > 1) {
- foreach ($keys as $key) {
- $this->_add_flag($flags[$key], 'multiple_key');
- }
- }
-
- if (strpos($val['index_description'], 'primary key')) {
- foreach ($keys as $key) {
- $this->_add_flag($flags[$key], 'primary_key');
- }
- } elseif (strpos($val['index_description'], 'unique')) {
- foreach ($keys as $key) {
- $this->_add_flag($flags[$key], 'unique_key');
- }
- }
- }
-
- // get auto_increment, not_null and timestamp
- $res = $this->getAll("EXEC SP_COLUMNS $table", DB_FETCHMODE_ASSOC);
- if (DB::isError($res)) {
- return $res;
- }
-
- foreach ($res as $val) {
- $val = array_change_key_case($val, CASE_LOWER);
- if ($val['nullable'] == '0') {
- $this->_add_flag($flags[$val['column_name']], 'not_null');
- }
- if (strpos($val['type_name'], 'identity')) {
- $this->_add_flag($flags[$val['column_name']], 'auto_increment');
- }
- if (strpos($val['type_name'], 'timestamp')) {
- $this->_add_flag($flags[$val['column_name']], 'timestamp');
- }
- }
- }
-
- if (array_key_exists($column, $flags)) {
- return(implode(' ', $flags[$column]));
- }
- return '';
- }
-
- // }}}
- // {{{ _add_flag()
-
- /**
- * Adds a string to the flags array if the flag is not yet in there
- * - if there is no flag present the array is created
- *
- * @param array &$array the reference to the flag-array
- * @param string $value the flag value
- *
- * @return void
- *
- * @access private
- * @author Joern Barthel
- */
- function _add_flag(&$array, $value)
- {
- if (!is_array($array)) {
- $array = array($value);
- } elseif (!in_array($value, $array)) {
- array_push($array, $value);
- }
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return "SELECT name FROM sysobjects WHERE type = 'U'"
- . ' ORDER BY name';
- case 'views':
- return "SELECT name FROM sysobjects WHERE type = 'V'";
- default:
- return null;
- }
- }
-
- // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/mysql.php b/airtime_mvc/library/pear/DB/mysql.php
deleted file mode 100644
index e9b5e70c9..000000000
--- a/airtime_mvc/library/pear/DB/mysql.php
+++ /dev/null
@@ -1,1045 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: mysql.php,v 1.126 2007/09/21 13:32:52 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's mysql extension
- * for interacting with MySQL databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_mysql extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'mysql';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'mysql';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'alter',
- 'new_link' => '4.2.0',
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- 1004 => DB_ERROR_CANNOT_CREATE,
- 1005 => DB_ERROR_CANNOT_CREATE,
- 1006 => DB_ERROR_CANNOT_CREATE,
- 1007 => DB_ERROR_ALREADY_EXISTS,
- 1008 => DB_ERROR_CANNOT_DROP,
- 1022 => DB_ERROR_ALREADY_EXISTS,
- 1044 => DB_ERROR_ACCESS_VIOLATION,
- 1046 => DB_ERROR_NODBSELECTED,
- 1048 => DB_ERROR_CONSTRAINT,
- 1049 => DB_ERROR_NOSUCHDB,
- 1050 => DB_ERROR_ALREADY_EXISTS,
- 1051 => DB_ERROR_NOSUCHTABLE,
- 1054 => DB_ERROR_NOSUCHFIELD,
- 1061 => DB_ERROR_ALREADY_EXISTS,
- 1062 => DB_ERROR_ALREADY_EXISTS,
- 1064 => DB_ERROR_SYNTAX,
- 1091 => DB_ERROR_NOT_FOUND,
- 1100 => DB_ERROR_NOT_LOCKED,
- 1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
- 1142 => DB_ERROR_ACCESS_VIOLATION,
- 1146 => DB_ERROR_NOSUCHTABLE,
- 1216 => DB_ERROR_CONSTRAINT,
- 1217 => DB_ERROR_CONSTRAINT,
- 1356 => DB_ERROR_DIVZERO,
- 1451 => DB_ERROR_CONSTRAINT,
- 1452 => DB_ERROR_CONSTRAINT,
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * The quantity of transactions begun
- *
- * {@internal While this is private, it can't actually be designated
- * private in PHP 5 because it is directly accessed in the test suite.}}
- *
- * @var integer
- * @access private
- */
- var $transaction_opcount = 0;
-
- /**
- * The database specified in the DSN
- *
- * It's a fix to allow calls to different databases in the same script.
- *
- * @var string
- * @access private
- */
- var $_db = '';
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_mysql()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's mysql driver supports the following extra DSN options:
- * + new_link If set to true, causes subsequent calls to connect()
- * to return a new connection link instead of the
- * existing one. WARNING: this is not portable to
- * other DBMS's. Available since PEAR DB 1.7.0.
- * + client_flags Any combination of MYSQL_CLIENT_* constants.
- * Only used if PHP is at version 4.3.0 or greater.
- * Available since PEAR DB 1.7.0.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('mysql')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $params = array();
- if ($dsn['protocol'] && $dsn['protocol'] == 'unix') {
- $params[0] = ':' . $dsn['socket'];
- } else {
- $params[0] = $dsn['hostspec'] ? $dsn['hostspec']
- : 'localhost';
- if ($dsn['port']) {
- $params[0] .= ':' . $dsn['port'];
- }
- }
- $params[] = $dsn['username'] ? $dsn['username'] : null;
- $params[] = $dsn['password'] ? $dsn['password'] : null;
-
- if (!$persistent) {
- if (isset($dsn['new_link'])
- && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
- {
- $params[] = true;
- } else {
- $params[] = false;
- }
- }
- if (version_compare(phpversion(), '4.3.0', '>=')) {
- $params[] = isset($dsn['client_flags'])
- ? $dsn['client_flags'] : null;
- }
-
- $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect';
-
- $ini = ini_get('track_errors');
- $php_errormsg = '';
- if ($ini) {
- $this->connection = @call_user_func_array($connect_function,
- $params);
- } else {
- @ini_set('track_errors', 1);
- $this->connection = @call_user_func_array($connect_function,
- $params);
- @ini_set('track_errors', $ini);
- }
-
- if (!$this->connection) {
- if (($err = @mysql_error()) != '') {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $err);
- } else {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
- }
-
- if ($dsn['database']) {
- if (!@mysql_select_db($dsn['database'], $this->connection)) {
- return $this->mysqlRaiseError();
- }
- $this->_db = $dsn['database'];
- }
-
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @mysql_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * Generally uses mysql_query(). If you want to use
- * mysql_unbuffered_query() set the "result_buffering" option to 0 using
- * setOptions(). This option was added in Release 1.7.0.
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- if ($this->_db) {
- if (!@mysql_select_db($this->_db, $this->connection)) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
- if (!$this->autocommit && $ismanip) {
- if ($this->transaction_opcount == 0) {
- $result = @mysql_query('SET AUTOCOMMIT=0', $this->connection);
- $result = @mysql_query('BEGIN', $this->connection);
- if (!$result) {
- return $this->mysqlRaiseError();
- }
- }
- $this->transaction_opcount++;
- }
- if (!$this->options['result_buffering']) {
- $result = @mysql_unbuffered_query($query, $this->connection);
- } else {
- $result = @mysql_query($query, $this->connection);
- }
- if (!$result) {
- return $this->mysqlRaiseError();
- }
- if (is_resource($result)) {
- return $result;
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal mysql result pointer to the next available result
- *
- * This method has not been implemented yet.
- *
- * @param a valid sql result resource
- *
- * @return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- if (!@mysql_data_seek($result, $rownum)) {
- return null;
- }
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @mysql_fetch_array($result, MYSQL_ASSOC);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @mysql_fetch_row($result);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- /*
- * Even though this DBMS already trims output, we do this because
- * a field might have intentional whitespace at the end that
- * gets removed by DB_PORTABILITY_RTRIM under another driver.
- */
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? mysql_free_result($result) : false;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @mysql_num_fields($result);
- if (!$cols) {
- return $this->mysqlRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @mysql_num_rows($result);
- if ($rows === null) {
- return $this->mysqlRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- // XXX if $this->transaction_opcount > 0, we should probably
- // issue a warning here.
- $this->autocommit = $onoff ? true : false;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if ($this->transaction_opcount > 0) {
- if ($this->_db) {
- if (!@mysql_select_db($this->_db, $this->connection)) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
- $result = @mysql_query('COMMIT', $this->connection);
- $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->mysqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if ($this->transaction_opcount > 0) {
- if ($this->_db) {
- if (!@mysql_select_db($this->_db, $this->connection)) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
- $result = @mysql_query('ROLLBACK', $this->connection);
- $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->mysqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if ($this->_last_query_manip) {
- return @mysql_affected_rows($this->connection);
- } else {
- return 0;
- }
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_mysql::createSequence(), DB_mysql::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- do {
- $repeat = 0;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("UPDATE ${seqname} ".
- 'SET id=LAST_INSERT_ID(id+1)');
- $this->popErrorHandling();
- if ($result === DB_OK) {
- // COMMON CASE
- $id = @mysql_insert_id($this->connection);
- if ($id != 0) {
- return $id;
- }
- // EMPTY SEQ TABLE
- // Sequence table must be empty for some reason, so fill
- // it and return 1 and obtain a user-level lock
- $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- if ($result == 0) {
- // Failed to get the lock
- return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
- }
-
- // add the default value
- $result = $this->query("REPLACE INTO ${seqname} (id) VALUES (0)");
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
-
- // Release the lock
- $result = $this->getOne('SELECT RELEASE_LOCK('
- . "'${seqname}_lock')");
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- // We know what the result will be, so no need to try again
- return 1;
-
- } elseif ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE)
- {
- // ONDEMAND TABLE CREATION
- $result = $this->createSequence($seq_name);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- } else {
- $repeat = 1;
- }
-
- } elseif (DB::isError($result) &&
- $result->getCode() == DB_ERROR_ALREADY_EXISTS)
- {
- // BACKWARDS COMPAT
- // see _BCsequence() comment
- $result = $this->_BCsequence($seqname);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $repeat = 1;
- }
- } while ($repeat);
-
- return $this->raiseError($result);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_mysql::nextID(), DB_mysql::dropSequence()
- */
- function createSequence($seq_name)
- {
- $seqname = $this->getSequenceName($seq_name);
- $res = $this->query('CREATE TABLE ' . $seqname
- . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
- . ' PRIMARY KEY(id))');
- if (DB::isError($res)) {
- return $res;
- }
- // insert yields value 1, nextId call will generate ID 2
- $res = $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
- if (DB::isError($res)) {
- return $res;
- }
- // so reset to zero
- return $this->query("UPDATE ${seqname} SET id = 0");
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_mysql::nextID(), DB_mysql::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ _BCsequence()
-
- /**
- * Backwards compatibility with old sequence emulation implementation
- * (clean up the dupes)
- *
- * @param string $seqname the sequence name to clean up
- *
- * @return bool true on success. A DB_Error object on failure.
- *
- * @access private
- */
- function _BCsequence($seqname)
- {
- // Obtain a user-level lock... this will release any previous
- // application locks, but unlike LOCK TABLES, it does not abort
- // the current transaction and is much less frequently used.
- $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
- if (DB::isError($result)) {
- return $result;
- }
- if ($result == 0) {
- // Failed to get the lock, can't do the conversion, bail
- // with a DB_ERROR_NOT_LOCKED error
- return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
- }
-
- $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
- if (DB::isError($highest_id)) {
- return $highest_id;
- }
- // This should kill all rows except the highest
- // We should probably do something if $highest_id isn't
- // numeric, but I'm at a loss as how to handle that...
- $result = $this->query('DELETE FROM ' . $seqname
- . " WHERE id <> $highest_id");
- if (DB::isError($result)) {
- return $result;
- }
-
- // If another thread has been waiting for this lock,
- // it will go thru the above procedure, but will have no
- // real effect
- $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
- if (DB::isError($result)) {
- return $result;
- }
- return true;
- }
-
- // }}}
- // {{{ quoteIdentifier()
-
- /**
- * Quotes a string so it can be safely used as a table or column name
- * (WARNING: using names that require this is a REALLY BAD IDEA)
- *
- * WARNING: Older versions of MySQL can't handle the backtick
- * character (`) in table or column names.
- *
- * @param string $str identifier name to be quoted
- *
- * @return string quoted identifier string
- *
- * @see DB_common::quoteIdentifier()
- * @since Method available since Release 1.6.0
- */
- function quoteIdentifier($str)
- {
- return '`' . str_replace('`', '``', $str) . '`';
- }
-
- // }}}
- // {{{ quote()
-
- /**
- * @deprecated Deprecated in release 1.6.0
- */
- function quote($str)
- {
- return $this->quoteSmart($str);
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.6.0
- */
- function escapeSimple($str)
- {
- if (function_exists('mysql_real_escape_string')) {
- return @mysql_real_escape_string($str, $this->connection);
- } else {
- return @mysql_escape_string($str);
- }
- }
-
- // }}}
- // {{{ modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * This little hack lets you know how many rows were deleted
- * when running a "DELETE FROM table" query. Only implemented
- * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
- *
- * @param string $query the query string to modify
- *
- * @return string the modified query string
- *
- * @access protected
- * @see DB_common::setOption()
- */
- function modifyQuery($query)
- {
- if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
- // "DELETE FROM table" gives 0 affected rows in MySQL.
- // This little hack lets you know how many rows were deleted.
- if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
- $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
- 'DELETE FROM \1 WHERE 1=1', $query);
- }
- }
- return $query;
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- if (DB::isManip($query) || $this->_next_query_manip) {
- return $query . " LIMIT $count";
- } else {
- return $query . " LIMIT $from, $count";
- }
- }
-
- // }}}
- // {{{ mysqlRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_mysql::errorNative(), DB_common::errorCode()
- */
- function mysqlRaiseError($errno = null)
- {
- if ($errno === null) {
- if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
- $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
- $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
- $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
- } else {
- // Doing this in case mode changes during runtime.
- $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
- $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
- $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
- }
- $errno = $this->errorCode(mysql_errno($this->connection));
- }
- return $this->raiseError($errno, null, null, null,
- @mysql_errno($this->connection) . ' ** ' .
- @mysql_error($this->connection));
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return int the DBMS' error code
- */
- function errorNative()
- {
- return @mysql_errno($this->connection);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- // Fix for bug #11580.
- if ($this->_db) {
- if (!@mysql_select_db($this->_db, $this->connection)) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
-
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @mysql_query("SELECT * FROM $result LIMIT 0",
- $this->connection);
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->mysqlRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @mysql_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => $case_func(@mysql_field_table($id, $i)),
- 'name' => $case_func(@mysql_field_name($id, $i)),
- 'type' => @mysql_field_type($id, $i),
- 'len' => @mysql_field_len($id, $i),
- 'flags' => @mysql_field_flags($id, $i),
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @mysql_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SHOW TABLES';
- case 'users':
- return 'SELECT DISTINCT User FROM mysql.user';
- case 'databases':
- return 'SHOW DATABASES';
- default:
- return null;
- }
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/mysqli.php b/airtime_mvc/library/pear/DB/mysqli.php
deleted file mode 100644
index 4449484d7..000000000
--- a/airtime_mvc/library/pear/DB/mysqli.php
+++ /dev/null
@@ -1,1092 +0,0 @@
-
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: mysqli.php,v 1.82 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's mysqli extension
- * for interacting with MySQL databases
- *
- * This is for MySQL versions 4.1 and above. Requires PHP 5.
- *
- * Note that persistent connections no longer exist.
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category Database
- * @package DB
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- * @since Class functional since Release 1.6.3
- */
-class DB_mysqli extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'mysqli';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'mysqli';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'alter',
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => false,
- 'prepare' => false,
- 'ssl' => true,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- 1004 => DB_ERROR_CANNOT_CREATE,
- 1005 => DB_ERROR_CANNOT_CREATE,
- 1006 => DB_ERROR_CANNOT_CREATE,
- 1007 => DB_ERROR_ALREADY_EXISTS,
- 1008 => DB_ERROR_CANNOT_DROP,
- 1022 => DB_ERROR_ALREADY_EXISTS,
- 1044 => DB_ERROR_ACCESS_VIOLATION,
- 1046 => DB_ERROR_NODBSELECTED,
- 1048 => DB_ERROR_CONSTRAINT,
- 1049 => DB_ERROR_NOSUCHDB,
- 1050 => DB_ERROR_ALREADY_EXISTS,
- 1051 => DB_ERROR_NOSUCHTABLE,
- 1054 => DB_ERROR_NOSUCHFIELD,
- 1061 => DB_ERROR_ALREADY_EXISTS,
- 1062 => DB_ERROR_ALREADY_EXISTS,
- 1064 => DB_ERROR_SYNTAX,
- 1091 => DB_ERROR_NOT_FOUND,
- 1100 => DB_ERROR_NOT_LOCKED,
- 1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
- 1142 => DB_ERROR_ACCESS_VIOLATION,
- 1146 => DB_ERROR_NOSUCHTABLE,
- 1216 => DB_ERROR_CONSTRAINT,
- 1217 => DB_ERROR_CONSTRAINT,
- 1356 => DB_ERROR_DIVZERO,
- 1451 => DB_ERROR_CONSTRAINT,
- 1452 => DB_ERROR_CONSTRAINT,
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * The quantity of transactions begun
- *
- * {@internal While this is private, it can't actually be designated
- * private in PHP 5 because it is directly accessed in the test suite.}}
- *
- * @var integer
- * @access private
- */
- var $transaction_opcount = 0;
-
- /**
- * The database specified in the DSN
- *
- * It's a fix to allow calls to different databases in the same script.
- *
- * @var string
- * @access private
- */
- var $_db = '';
-
- /**
- * Array for converting MYSQLI_*_FLAG constants to text values
- * @var array
- * @access public
- * @since Property available since Release 1.6.5
- */
- var $mysqli_flags = array(
- MYSQLI_NOT_NULL_FLAG => 'not_null',
- MYSQLI_PRI_KEY_FLAG => 'primary_key',
- MYSQLI_UNIQUE_KEY_FLAG => 'unique_key',
- MYSQLI_MULTIPLE_KEY_FLAG => 'multiple_key',
- MYSQLI_BLOB_FLAG => 'blob',
- MYSQLI_UNSIGNED_FLAG => 'unsigned',
- MYSQLI_ZEROFILL_FLAG => 'zerofill',
- MYSQLI_AUTO_INCREMENT_FLAG => 'auto_increment',
- MYSQLI_TIMESTAMP_FLAG => 'timestamp',
- MYSQLI_SET_FLAG => 'set',
- // MYSQLI_NUM_FLAG => 'numeric', // unnecessary
- // MYSQLI_PART_KEY_FLAG => 'multiple_key', // duplicatvie
- MYSQLI_GROUP_FLAG => 'group_by'
- );
-
- /**
- * Array for converting MYSQLI_TYPE_* constants to text values
- * @var array
- * @access public
- * @since Property available since Release 1.6.5
- */
- var $mysqli_types = array(
- MYSQLI_TYPE_DECIMAL => 'decimal',
- MYSQLI_TYPE_TINY => 'tinyint',
- MYSQLI_TYPE_SHORT => 'int',
- MYSQLI_TYPE_LONG => 'int',
- MYSQLI_TYPE_FLOAT => 'float',
- MYSQLI_TYPE_DOUBLE => 'double',
- // MYSQLI_TYPE_NULL => 'DEFAULT NULL', // let flags handle it
- MYSQLI_TYPE_TIMESTAMP => 'timestamp',
- MYSQLI_TYPE_LONGLONG => 'bigint',
- MYSQLI_TYPE_INT24 => 'mediumint',
- MYSQLI_TYPE_DATE => 'date',
- MYSQLI_TYPE_TIME => 'time',
- MYSQLI_TYPE_DATETIME => 'datetime',
- MYSQLI_TYPE_YEAR => 'year',
- MYSQLI_TYPE_NEWDATE => 'date',
- MYSQLI_TYPE_ENUM => 'enum',
- MYSQLI_TYPE_SET => 'set',
- MYSQLI_TYPE_TINY_BLOB => 'tinyblob',
- MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
- MYSQLI_TYPE_LONG_BLOB => 'longblob',
- MYSQLI_TYPE_BLOB => 'blob',
- MYSQLI_TYPE_VAR_STRING => 'varchar',
- MYSQLI_TYPE_STRING => 'char',
- MYSQLI_TYPE_GEOMETRY => 'geometry',
- /* These constants are conditionally compiled in ext/mysqli, so we'll
- * define them by number rather than constant. */
- 16 => 'bit',
- 246 => 'decimal',
- );
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_mysqli()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's mysqli driver supports the following extra DSN options:
- * + When the 'ssl' $option passed to DB::connect() is true:
- * + key The path to the key file.
- * + cert The path to the certificate file.
- * + ca The path to the certificate authority file.
- * + capath The path to a directory that contains trusted SSL
- * CA certificates in pem format.
- * + cipher The list of allowable ciphers for SSL encryption.
- *
- * Example of how to connect using SSL:
- *
- * require_once 'DB.php';
- *
- * $dsn = array(
- * 'phptype' => 'mysqli',
- * 'username' => 'someuser',
- * 'password' => 'apasswd',
- * 'hostspec' => 'localhost',
- * 'database' => 'thedb',
- * 'key' => 'client-key.pem',
- * 'cert' => 'client-cert.pem',
- * 'ca' => 'cacert.pem',
- * 'capath' => '/path/to/ca/dir',
- * 'cipher' => 'AES',
- * );
- *
- * $options = array(
- * 'ssl' => true,
- * );
- *
- * $db = DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('mysqli')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $ini = ini_get('track_errors');
- @ini_set('track_errors', 1);
- $php_errormsg = '';
-
- if (((int) $this->getOption('ssl')) === 1) {
- $init = mysqli_init();
- mysqli_ssl_set(
- $init,
- empty($dsn['key']) ? null : $dsn['key'],
- empty($dsn['cert']) ? null : $dsn['cert'],
- empty($dsn['ca']) ? null : $dsn['ca'],
- empty($dsn['capath']) ? null : $dsn['capath'],
- empty($dsn['cipher']) ? null : $dsn['cipher']
- );
- if ($this->connection = @mysqli_real_connect(
- $init,
- $dsn['hostspec'],
- $dsn['username'],
- $dsn['password'],
- $dsn['database'],
- $dsn['port'],
- $dsn['socket']))
- {
- $this->connection = $init;
- }
- } else {
- $this->connection = @mysqli_connect(
- $dsn['hostspec'],
- $dsn['username'],
- $dsn['password'],
- $dsn['database'],
- $dsn['port'],
- $dsn['socket']
- );
- }
-
- @ini_set('track_errors', $ini);
-
- if (!$this->connection) {
- if (($err = @mysqli_connect_error()) != '') {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $err);
- } else {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
- }
-
- if ($dsn['database']) {
- $this->_db = $dsn['database'];
- }
-
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @mysqli_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- if ($this->_db) {
- if (!@mysqli_select_db($this->connection, $this->_db)) {
- return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
- if (!$this->autocommit && $ismanip) {
- if ($this->transaction_opcount == 0) {
- $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=0');
- $result = @mysqli_query($this->connection, 'BEGIN');
- if (!$result) {
- return $this->mysqliRaiseError();
- }
- }
- $this->transaction_opcount++;
- }
- $result = @mysqli_query($this->connection, $query);
- if (!$result) {
- return $this->mysqliRaiseError();
- }
- if (is_object($result)) {
- return $result;
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal mysql result pointer to the next available result.
- *
- * This method has not been implemented yet.
- *
- * @param resource $result a valid sql result resource
- * @return false
- * @access public
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- if (!@mysqli_data_seek($result, $rownum)) {
- return null;
- }
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @mysqli_fetch_array($result, MYSQLI_ASSOC);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @mysqli_fetch_row($result);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- /*
- * Even though this DBMS already trims output, we do this because
- * a field might have intentional whitespace at the end that
- * gets removed by DB_PORTABILITY_RTRIM under another driver.
- */
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? mysqli_free_result($result) : false;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @mysqli_num_fields($result);
- if (!$cols) {
- return $this->mysqliRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @mysqli_num_rows($result);
- if ($rows === null) {
- return $this->mysqliRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- // XXX if $this->transaction_opcount > 0, we should probably
- // issue a warning here.
- $this->autocommit = $onoff ? true : false;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if ($this->transaction_opcount > 0) {
- if ($this->_db) {
- if (!@mysqli_select_db($this->connection, $this->_db)) {
- return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
- $result = @mysqli_query($this->connection, 'COMMIT');
- $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->mysqliRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if ($this->transaction_opcount > 0) {
- if ($this->_db) {
- if (!@mysqli_select_db($this->connection, $this->_db)) {
- return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
- $result = @mysqli_query($this->connection, 'ROLLBACK');
- $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->mysqliRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if ($this->_last_query_manip) {
- return @mysqli_affected_rows($this->connection);
- } else {
- return 0;
- }
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_mysqli::createSequence(), DB_mysqli::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- do {
- $repeat = 0;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query('UPDATE ' . $seqname
- . ' SET id = LAST_INSERT_ID(id + 1)');
- $this->popErrorHandling();
- if ($result === DB_OK) {
- // COMMON CASE
- $id = @mysqli_insert_id($this->connection);
- if ($id != 0) {
- return $id;
- }
-
- // EMPTY SEQ TABLE
- // Sequence table must be empty for some reason,
- // so fill it and return 1
- // Obtain a user-level lock
- $result = $this->getOne('SELECT GET_LOCK('
- . "'${seqname}_lock', 10)");
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- if ($result == 0) {
- return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
- }
-
- // add the default value
- $result = $this->query('REPLACE INTO ' . $seqname
- . ' (id) VALUES (0)');
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
-
- // Release the lock
- $result = $this->getOne('SELECT RELEASE_LOCK('
- . "'${seqname}_lock')");
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- // We know what the result will be, so no need to try again
- return 1;
-
- } elseif ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE)
- {
- // ONDEMAND TABLE CREATION
- $result = $this->createSequence($seq_name);
-
- // Since createSequence initializes the ID to be 1,
- // we do not need to retrieve the ID again (or we will get 2)
- if (DB::isError($result)) {
- return $this->raiseError($result);
- } else {
- // First ID of a newly created sequence is 1
- return 1;
- }
-
- } elseif (DB::isError($result) &&
- $result->getCode() == DB_ERROR_ALREADY_EXISTS)
- {
- // BACKWARDS COMPAT
- // see _BCsequence() comment
- $result = $this->_BCsequence($seqname);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $repeat = 1;
- }
- } while ($repeat);
-
- return $this->raiseError($result);
- }
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_mysqli::nextID(), DB_mysqli::dropSequence()
- */
- function createSequence($seq_name)
- {
- $seqname = $this->getSequenceName($seq_name);
- $res = $this->query('CREATE TABLE ' . $seqname
- . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
- . ' PRIMARY KEY(id))');
- if (DB::isError($res)) {
- return $res;
- }
- // insert yields value 1, nextId call will generate ID 2
- return $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_mysql::nextID(), DB_mysql::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ _BCsequence()
-
- /**
- * Backwards compatibility with old sequence emulation implementation
- * (clean up the dupes)
- *
- * @param string $seqname the sequence name to clean up
- *
- * @return bool true on success. A DB_Error object on failure.
- *
- * @access private
- */
- function _BCsequence($seqname)
- {
- // Obtain a user-level lock... this will release any previous
- // application locks, but unlike LOCK TABLES, it does not abort
- // the current transaction and is much less frequently used.
- $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
- if (DB::isError($result)) {
- return $result;
- }
- if ($result == 0) {
- // Failed to get the lock, can't do the conversion, bail
- // with a DB_ERROR_NOT_LOCKED error
- return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
- }
-
- $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
- if (DB::isError($highest_id)) {
- return $highest_id;
- }
-
- // This should kill all rows except the highest
- // We should probably do something if $highest_id isn't
- // numeric, but I'm at a loss as how to handle that...
- $result = $this->query('DELETE FROM ' . $seqname
- . " WHERE id <> $highest_id");
- if (DB::isError($result)) {
- return $result;
- }
-
- // If another thread has been waiting for this lock,
- // it will go thru the above procedure, but will have no
- // real effect
- $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
- if (DB::isError($result)) {
- return $result;
- }
- return true;
- }
-
- // }}}
- // {{{ quoteIdentifier()
-
- /**
- * Quotes a string so it can be safely used as a table or column name
- * (WARNING: using names that require this is a REALLY BAD IDEA)
- *
- * WARNING: Older versions of MySQL can't handle the backtick
- * character (`) in table or column names.
- *
- * @param string $str identifier name to be quoted
- *
- * @return string quoted identifier string
- *
- * @see DB_common::quoteIdentifier()
- * @since Method available since Release 1.6.0
- */
- function quoteIdentifier($str)
- {
- return '`' . str_replace('`', '``', $str) . '`';
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.6.0
- */
- function escapeSimple($str)
- {
- return @mysqli_real_escape_string($this->connection, $str);
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- if (DB::isManip($query) || $this->_next_query_manip) {
- return $query . " LIMIT $count";
- } else {
- return $query . " LIMIT $from, $count";
- }
- }
-
- // }}}
- // {{{ mysqliRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_mysqli::errorNative(), DB_common::errorCode()
- */
- function mysqliRaiseError($errno = null)
- {
- if ($errno === null) {
- if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
- $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
- $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
- $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
- } else {
- // Doing this in case mode changes during runtime.
- $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
- $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
- $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
- }
- $errno = $this->errorCode(mysqli_errno($this->connection));
- }
- return $this->raiseError($errno, null, null, null,
- @mysqli_errno($this->connection) . ' ** ' .
- @mysqli_error($this->connection));
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return int the DBMS' error code
- */
- function errorNative()
- {
- return @mysqli_errno($this->connection);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::setOption()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- // Fix for bug #11580.
- if ($this->_db) {
- if (!@mysqli_select_db($this->connection, $this->_db)) {
- return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
- }
- }
-
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @mysqli_query($this->connection,
- "SELECT * FROM $result LIMIT 0");
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_a($id, 'mysqli_result')) {
- return $this->mysqliRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @mysqli_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $tmp = @mysqli_fetch_field($id);
-
- $flags = '';
- foreach ($this->mysqli_flags as $const => $means) {
- if ($tmp->flags & $const) {
- $flags .= $means . ' ';
- }
- }
- if ($tmp->def) {
- $flags .= 'default_' . rawurlencode($tmp->def);
- }
- $flags = trim($flags);
-
- $res[$i] = array(
- 'table' => $case_func($tmp->table),
- 'name' => $case_func($tmp->name),
- 'type' => isset($this->mysqli_types[$tmp->type])
- ? $this->mysqli_types[$tmp->type]
- : 'unknown',
- // http://bugs.php.net/?id=36579
- 'len' => $tmp->length,
- 'flags' => $flags,
- );
-
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @mysqli_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SHOW TABLES';
- case 'users':
- return 'SELECT DISTINCT User FROM mysql.user';
- case 'databases':
- return 'SHOW DATABASES';
- default:
- return null;
- }
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/oci8.php b/airtime_mvc/library/pear/DB/oci8.php
deleted file mode 100644
index 3dfee116e..000000000
--- a/airtime_mvc/library/pear/DB/oci8.php
+++ /dev/null
@@ -1,1156 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: oci8.php,v 1.115 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's oci8 extension
- * for interacting with Oracle databases
- *
- * Definitely works with versions 8 and 9 of Oracle.
- *
- * These methods overload the ones declared in DB_common.
- *
- * Be aware... OCIError() only appears to return anything when given a
- * statement, so functions return the generic DB_ERROR instead of more
- * useful errors that have to do with feedback from the database.
- *
- * @category Database
- * @package DB
- * @author James L. Pine
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_oci8 extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'oci8';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'oci8';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'alter',
- 'new_link' => '5.0.0',
- 'numrows' => 'subquery',
- 'pconnect' => true,
- 'prepare' => true,
- 'ssl' => false,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- 1 => DB_ERROR_CONSTRAINT,
- 900 => DB_ERROR_SYNTAX,
- 904 => DB_ERROR_NOSUCHFIELD,
- 913 => DB_ERROR_VALUE_COUNT_ON_ROW,
- 921 => DB_ERROR_SYNTAX,
- 923 => DB_ERROR_SYNTAX,
- 942 => DB_ERROR_NOSUCHTABLE,
- 955 => DB_ERROR_ALREADY_EXISTS,
- 1400 => DB_ERROR_CONSTRAINT_NOT_NULL,
- 1401 => DB_ERROR_INVALID,
- 1407 => DB_ERROR_CONSTRAINT_NOT_NULL,
- 1418 => DB_ERROR_NOT_FOUND,
- 1476 => DB_ERROR_DIVZERO,
- 1722 => DB_ERROR_INVALID_NUMBER,
- 2289 => DB_ERROR_NOSUCHTABLE,
- 2291 => DB_ERROR_CONSTRAINT,
- 2292 => DB_ERROR_CONSTRAINT,
- 2449 => DB_ERROR_CONSTRAINT,
- 12899 => DB_ERROR_INVALID,
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * Stores the $data passed to execute() in the oci8 driver
- *
- * Gets reset to array() when simpleQuery() is run.
- *
- * Needed in case user wants to call numRows() after prepare/execute
- * was used.
- *
- * @var array
- * @access private
- */
- var $_data = array();
-
- /**
- * The result or statement handle from the most recently executed query
- * @var resource
- */
- var $last_stmt;
-
- /**
- * Is the given prepared statement a data manipulation query?
- * @var array
- * @access private
- */
- var $manip_query = array();
-
- /**
- * Store of prepared SQL queries.
- * @var array
- * @access private
- */
- var $_prepared_queries = array();
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_oci8()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * If PHP is at version 5.0.0 or greater:
- * + Generally, oci_connect() or oci_pconnect() are used.
- * + But if the new_link DSN option is set to true, oci_new_connect()
- * is used.
- *
- * When using PHP version 4.x, OCILogon() or OCIPLogon() are used.
- *
- * PEAR DB's oci8 driver supports the following extra DSN options:
- * + charset The character set to be used on the connection.
- * Only used if PHP is at version 5.0.0 or greater
- * and the Oracle server is at 9.2 or greater.
- * Available since PEAR DB 1.7.0.
- * + new_link If set to true, causes subsequent calls to
- * connect() to return a new connection link
- * instead of the existing one. WARNING: this is
- * not portable to other DBMS's.
- * Available since PEAR DB 1.7.0.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('oci8')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- // Backwards compatibility with DB < 1.7.0
- if (empty($dsn['database']) && !empty($dsn['hostspec'])) {
- $db = $dsn['hostspec'];
- } else {
- $db = $dsn['database'];
- }
-
- if (function_exists('oci_connect')) {
- if (isset($dsn['new_link'])
- && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
- {
- $connect_function = 'oci_new_connect';
- } else {
- $connect_function = $persistent ? 'oci_pconnect'
- : 'oci_connect';
- }
- if (isset($this->dsn['port']) && $this->dsn['port']) {
- $db = '//'.$db.':'.$this->dsn['port'];
- }
-
- $char = empty($dsn['charset']) ? null : $dsn['charset'];
- $this->connection = @$connect_function($dsn['username'],
- $dsn['password'],
- $db,
- $char);
- $error = OCIError();
- if (!empty($error) && $error['code'] == 12541) {
- // Couldn't find TNS listener. Try direct connection.
- $this->connection = @$connect_function($dsn['username'],
- $dsn['password'],
- null,
- $char);
- }
- } else {
- $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon';
- if ($db) {
- $this->connection = @$connect_function($dsn['username'],
- $dsn['password'],
- $db);
- } elseif ($dsn['username'] || $dsn['password']) {
- $this->connection = @$connect_function($dsn['username'],
- $dsn['password']);
- }
- }
-
- if (!$this->connection) {
- $error = OCIError();
- $error = (is_array($error)) ? $error['message'] : null;
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $error);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- if (function_exists('oci_close')) {
- $ret = @oci_close($this->connection);
- } else {
- $ret = @OCILogOff($this->connection);
- }
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * To determine how many rows of a result set get buffered using
- * ocisetprefetch(), see the "result_buffering" option in setOptions().
- * This option was added in Release 1.7.0.
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $this->_data = array();
- $this->last_parameters = array();
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- $result = @OCIParse($this->connection, $query);
- if (!$result) {
- return $this->oci8RaiseError();
- }
- if ($this->autocommit) {
- $success = @OCIExecute($result,OCI_COMMIT_ON_SUCCESS);
- } else {
- $success = @OCIExecute($result,OCI_DEFAULT);
- }
- if (!$success) {
- return $this->oci8RaiseError($result);
- }
- $this->last_stmt = $result;
- if ($this->_checkManip($query)) {
- return DB_OK;
- } else {
- @ocisetprefetch($result, $this->options['result_buffering']);
- return $result;
- }
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal oracle result pointer to the next available result
- *
- * @param a valid oci8 result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $moredata = @OCIFetchInto($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE &&
- $moredata)
- {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $moredata = OCIFetchInto($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS);
- }
- if (!$moredata) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? OCIFreeStatement($result) : false;
- }
-
- /**
- * Frees the internal resources associated with a prepared query
- *
- * @param resource $stmt the prepared statement's resource
- * @param bool $free_resource should the PHP resource be freed too?
- * Use false if you need to get data
- * from the result set later.
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_oci8::prepare()
- */
- function freePrepared($stmt, $free_resource = true)
- {
- if (!is_resource($stmt)) {
- return false;
- }
- if ($free_resource) {
- @ocifreestatement($stmt);
- }
- if (isset($this->prepare_types[(int)$stmt])) {
- unset($this->prepare_types[(int)$stmt]);
- unset($this->manip_query[(int)$stmt]);
- } else {
- return false;
- }
- return true;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * Only works if the DB_PORTABILITY_NUMROWS portability option
- * is turned on.
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows(), DB_common::setOption()
- */
- function numRows($result)
- {
- // emulate numRows for Oracle. yuck.
- if ($this->options['portability'] & DB_PORTABILITY_NUMROWS &&
- $result === $this->last_stmt)
- {
- $countquery = 'SELECT COUNT(*) FROM ('.$this->last_query.')';
- $save_query = $this->last_query;
- $save_stmt = $this->last_stmt;
-
- $count = $this->query($countquery);
-
- // Restore the last query and statement.
- $this->last_query = $save_query;
- $this->last_stmt = $save_stmt;
-
- if (DB::isError($count) ||
- DB::isError($row = $count->fetchRow(DB_FETCHMODE_ORDERED)))
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- return $row[0];
- }
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @OCINumCols($result);
- if (!$cols) {
- return $this->oci8RaiseError($result);
- }
- return $cols;
- }
-
- // }}}
- // {{{ prepare()
-
- /**
- * Prepares a query for multiple execution with execute().
- *
- * With oci8, this is emulated.
- *
- * prepare() requires a generic query as string like
- * INSERT INTO numbers VALUES (?, ?, ?)
- *
. The ? characters are placeholders.
- *
- * Three types of placeholders can be used:
- * + ? a quoted scalar value, i.e. strings, integers
- * + ! value is inserted 'as is'
- * + & requires a file name. The file's contents get
- * inserted into the query (i.e. saving binary
- * data in a db)
- *
- * Use backslashes to escape placeholder characters if you don't want
- * them to be interpreted as placeholders. Example:
- * "UPDATE foo SET col=? WHERE col='over \& under'"
- *
- *
- * @param string $query the query to be prepared
- *
- * @return mixed DB statement resource on success. DB_Error on failure.
- *
- * @see DB_oci8::execute()
- */
- function prepare($query)
- {
- $tokens = preg_split('/((? $val) {
- switch ($val) {
- case '?':
- $types[$token++] = DB_PARAM_SCALAR;
- unset($tokens[$key]);
- break;
- case '&':
- $types[$token++] = DB_PARAM_OPAQUE;
- unset($tokens[$key]);
- break;
- case '!':
- $types[$token++] = DB_PARAM_MISC;
- unset($tokens[$key]);
- break;
- default:
- $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
- if ($key != $binds) {
- $newquery .= $tokens[$key] . ':bind' . $token;
- } else {
- $newquery .= $tokens[$key];
- }
- }
- }
-
- $this->last_query = $query;
- $newquery = $this->modifyQuery($newquery);
- if (!$stmt = @OCIParse($this->connection, $newquery)) {
- return $this->oci8RaiseError();
- }
- $this->prepare_types[(int)$stmt] = $types;
- $this->manip_query[(int)$stmt] = DB::isManip($query);
- $this->_prepared_queries[(int)$stmt] = $newquery;
- return $stmt;
- }
-
- // }}}
- // {{{ execute()
-
- /**
- * Executes a DB statement prepared with prepare().
- *
- * To determine how many rows of a result set get buffered using
- * ocisetprefetch(), see the "result_buffering" option in setOptions().
- * This option was added in Release 1.7.0.
- *
- * @param resource $stmt a DB statement resource returned from prepare()
- * @param mixed $data array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 for non-array items or the
- * quantity of elements in the array.
- *
- * @return mixed returns an oic8 result resource for successful SELECT
- * queries, DB_OK for other successful queries.
- * A DB error object is returned on failure.
- *
- * @see DB_oci8::prepare()
- */
- function &execute($stmt, $data = array())
- {
- $data = (array)$data;
- $this->last_parameters = $data;
- $this->last_query = $this->_prepared_queries[(int)$stmt];
- $this->_data = $data;
-
- $types = $this->prepare_types[(int)$stmt];
- if (count($types) != count($data)) {
- $tmp = $this->raiseError(DB_ERROR_MISMATCH);
- return $tmp;
- }
-
- $i = 0;
- foreach ($data as $key => $value) {
- if ($types[$i] == DB_PARAM_MISC) {
- /*
- * Oracle doesn't seem to have the ability to pass a
- * parameter along unchanged, so strip off quotes from start
- * and end, plus turn two single quotes to one single quote,
- * in order to avoid the quotes getting escaped by
- * Oracle and ending up in the database.
- */
- $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
- $data[$key] = str_replace("''", "'", $data[$key]);
- } elseif ($types[$i] == DB_PARAM_OPAQUE) {
- $fp = @fopen($data[$key], 'rb');
- if (!$fp) {
- $tmp = $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
- return $tmp;
- }
- $data[$key] = fread($fp, filesize($data[$key]));
- fclose($fp);
- } elseif ($types[$i] == DB_PARAM_SCALAR) {
- // Floats have to be converted to a locale-neutral
- // representation.
- if (is_float($data[$key])) {
- $data[$key] = $this->quoteFloat($data[$key]);
- }
- }
- if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) {
- $tmp = $this->oci8RaiseError($stmt);
- return $tmp;
- }
- $this->last_query = str_replace(':bind'.$i, $this->quoteSmart($data[$key]), $this->last_query);
- $i++;
- }
- if ($this->autocommit) {
- $success = @OCIExecute($stmt, OCI_COMMIT_ON_SUCCESS);
- } else {
- $success = @OCIExecute($stmt, OCI_DEFAULT);
- }
- if (!$success) {
- $tmp = $this->oci8RaiseError($stmt);
- return $tmp;
- }
- $this->last_stmt = $stmt;
- if ($this->manip_query[(int)$stmt] || $this->_next_query_manip) {
- $this->_last_query_manip = true;
- $this->_next_query_manip = false;
- $tmp = DB_OK;
- } else {
- $this->_last_query_manip = false;
- @ocisetprefetch($stmt, $this->options['result_buffering']);
- $tmp = new DB_result($this, $stmt);
- }
- return $tmp;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- $this->autocommit = (bool)$onoff;;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- $result = @OCICommit($this->connection);
- if (!$result) {
- return $this->oci8RaiseError();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- $result = @OCIRollback($this->connection);
- if (!$result) {
- return $this->oci8RaiseError();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if ($this->last_stmt === false) {
- return $this->oci8RaiseError();
- }
- $result = @OCIRowCount($this->last_stmt);
- if ($result === false) {
- return $this->oci8RaiseError($this->last_stmt);
- }
- return $result;
- }
-
- // }}}
- // {{{ modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * "SELECT 2+2" must be "SELECT 2+2 FROM dual" in Oracle.
- *
- * @param string $query the query string to modify
- *
- * @return string the modified query string
- *
- * @access protected
- */
- function modifyQuery($query)
- {
- if (preg_match('/^\s*SELECT/i', $query) &&
- !preg_match('/\sFROM\s/i', $query)) {
- $query .= ' FROM dual';
- }
- return $query;
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- // Let Oracle return the name of the columns instead of
- // coding a "home" SQL parser
-
- if (count($params)) {
- $result = $this->prepare("SELECT * FROM ($query) "
- . 'WHERE NULL = NULL');
- $tmp = $this->execute($result, $params);
- } else {
- $q_fields = "SELECT * FROM ($query) WHERE NULL = NULL";
-
- if (!$result = @OCIParse($this->connection, $q_fields)) {
- $this->last_query = $q_fields;
- return $this->oci8RaiseError();
- }
- if (!@OCIExecute($result, OCI_DEFAULT)) {
- $this->last_query = $q_fields;
- return $this->oci8RaiseError($result);
- }
- }
-
- $ncols = OCINumCols($result);
- $cols = array();
- for ( $i = 1; $i <= $ncols; $i++ ) {
- $cols[] = '"' . OCIColumnName($result, $i) . '"';
- }
- $fields = implode(', ', $cols);
- // XXX Test that (tip by John Lim)
- //if (preg_match('/^\s*SELECT\s+/is', $query, $match)) {
- // // Introduce the FIRST_ROWS Oracle query optimizer
- // $query = substr($query, strlen($match[0]), strlen($query));
- // $query = "SELECT /* +FIRST_ROWS */ " . $query;
- //}
-
- // Construct the query
- // more at: http://marc.theaimsgroup.com/?l=php-db&m=99831958101212&w=2
- // Perhaps this could be optimized with the use of Unions
- $query = "SELECT $fields FROM".
- " (SELECT rownum as linenum, $fields FROM".
- " ($query)".
- ' WHERE rownum <= '. ($from + $count) .
- ') WHERE linenum >= ' . ++$from;
- return $query;
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_oci8::createSequence(), DB_oci8::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- $repeat = 0;
- do {
- $this->expectError(DB_ERROR_NOSUCHTABLE);
- $result = $this->query("SELECT ${seqname}.nextval FROM dual");
- $this->popExpect();
- if ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE) {
- $repeat = 1;
- $result = $this->createSequence($seq_name);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- } else {
- $repeat = 0;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
- return $arr[0];
- }
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_oci8::nextID(), DB_oci8::dropSequence()
- */
- function createSequence($seq_name)
- {
- return $this->query('CREATE SEQUENCE '
- . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_oci8::nextID(), DB_oci8::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP SEQUENCE '
- . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ oci8RaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_oci8::errorNative(), DB_oci8::errorCode()
- */
- function oci8RaiseError($errno = null)
- {
- if ($errno === null) {
- $error = @OCIError($this->connection);
- return $this->raiseError($this->errorCode($error['code']),
- null, null, null, $error['message']);
- } elseif (is_resource($errno)) {
- $error = @OCIError($errno);
- return $this->raiseError($this->errorCode($error['code']),
- null, null, null, $error['message']);
- }
- return $this->raiseError($this->errorCode($errno));
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return int the DBMS' error code. FALSE if the code could not be
- * determined
- */
- function errorNative()
- {
- if (is_resource($this->last_stmt)) {
- $error = @OCIError($this->last_stmt);
- } else {
- $error = @OCIError($this->connection);
- }
- if (is_array($error)) {
- return $error['code'];
- }
- return false;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if $result
- * is a table name.
- *
- * NOTE: flags won't contain index information.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $res = array();
-
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $result = strtoupper($result);
- $q_fields = 'SELECT column_name, data_type, data_length, '
- . 'nullable '
- . 'FROM user_tab_columns '
- . "WHERE table_name='$result' ORDER BY column_id";
-
- $this->last_query = $q_fields;
-
- if (!$stmt = @OCIParse($this->connection, $q_fields)) {
- return $this->oci8RaiseError(DB_ERROR_NEED_MORE_DATA);
- }
- if (!@OCIExecute($stmt, OCI_DEFAULT)) {
- return $this->oci8RaiseError($stmt);
- }
-
- $i = 0;
- while (@OCIFetch($stmt)) {
- $res[$i] = array(
- 'table' => $case_func($result),
- 'name' => $case_func(@OCIResult($stmt, 1)),
- 'type' => @OCIResult($stmt, 2),
- 'len' => @OCIResult($stmt, 3),
- 'flags' => (@OCIResult($stmt, 4) == 'N') ? 'not_null' : '',
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- $i++;
- }
-
- if ($mode) {
- $res['num_fields'] = $i;
- }
- @OCIFreeStatement($stmt);
-
- } else {
- if (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $result = $result->result;
- }
-
- $res = array();
-
- if ($result === $this->last_stmt) {
- $count = @OCINumCols($result);
- if ($mode) {
- $res['num_fields'] = $count;
- }
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => '',
- 'name' => $case_func(@OCIColumnName($result, $i+1)),
- 'type' => @OCIColumnType($result, $i+1),
- 'len' => @OCIColumnSize($result, $i+1),
- 'flags' => '',
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
- } else {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SELECT table_name FROM user_tables';
- case 'synonyms':
- return 'SELECT synonym_name FROM user_synonyms';
- case 'views':
- return 'SELECT view_name FROM user_views';
- default:
- return null;
- }
- }
-
- // }}}
- // {{{ quoteFloat()
-
- /**
- * Formats a float value for use within a query in a locale-independent
- * manner.
- *
- * @param float the float value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteFloat($float) {
- return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/odbc.php b/airtime_mvc/library/pear/DB/odbc.php
deleted file mode 100644
index fecc548d8..000000000
--- a/airtime_mvc/library/pear/DB/odbc.php
+++ /dev/null
@@ -1,883 +0,0 @@
-
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: odbc.php,v 1.81 2007/07/06 05:19:21 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's odbc extension
- * for interacting with databases via ODBC connections
- *
- * These methods overload the ones declared in DB_common.
- *
- * More info on ODBC errors could be found here:
- * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_err_odbc_5stz.asp
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_odbc extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'odbc';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'sql92';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * NOTE: The feature set of the following drivers are different than
- * the default:
- * + solid: 'transactions' = true
- * + navision: 'limit' = false
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'emulate',
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => false,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- '01004' => DB_ERROR_TRUNCATED,
- '07001' => DB_ERROR_MISMATCH,
- '21S01' => DB_ERROR_VALUE_COUNT_ON_ROW,
- '21S02' => DB_ERROR_MISMATCH,
- '22001' => DB_ERROR_INVALID,
- '22003' => DB_ERROR_INVALID_NUMBER,
- '22005' => DB_ERROR_INVALID_NUMBER,
- '22008' => DB_ERROR_INVALID_DATE,
- '22012' => DB_ERROR_DIVZERO,
- '23000' => DB_ERROR_CONSTRAINT,
- '23502' => DB_ERROR_CONSTRAINT_NOT_NULL,
- '23503' => DB_ERROR_CONSTRAINT,
- '23504' => DB_ERROR_CONSTRAINT,
- '23505' => DB_ERROR_CONSTRAINT,
- '24000' => DB_ERROR_INVALID,
- '34000' => DB_ERROR_INVALID,
- '37000' => DB_ERROR_SYNTAX,
- '42000' => DB_ERROR_SYNTAX,
- '42601' => DB_ERROR_SYNTAX,
- 'IM001' => DB_ERROR_UNSUPPORTED,
- 'S0000' => DB_ERROR_NOSUCHTABLE,
- 'S0001' => DB_ERROR_ALREADY_EXISTS,
- 'S0002' => DB_ERROR_NOSUCHTABLE,
- 'S0011' => DB_ERROR_ALREADY_EXISTS,
- 'S0012' => DB_ERROR_NOT_FOUND,
- 'S0021' => DB_ERROR_ALREADY_EXISTS,
- 'S0022' => DB_ERROR_NOSUCHFIELD,
- 'S1009' => DB_ERROR_INVALID,
- 'S1090' => DB_ERROR_INVALID,
- 'S1C00' => DB_ERROR_NOT_CAPABLE,
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * The number of rows affected by a data manipulation query
- * @var integer
- * @access private
- */
- var $affected = 0;
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_odbc()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's odbc driver supports the following extra DSN options:
- * + cursor The type of cursor to be used for this connection.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('odbc')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
- switch ($this->dbsyntax) {
- case 'access':
- case 'db2':
- case 'solid':
- $this->features['transactions'] = true;
- break;
- case 'navision':
- $this->features['limit'] = false;
- }
-
- /*
- * This is hear for backwards compatibility. Should have been using
- * 'database' all along, but prior to 1.6.0RC3 'hostspec' was used.
- */
- if ($dsn['database']) {
- $odbcdsn = $dsn['database'];
- } elseif ($dsn['hostspec']) {
- $odbcdsn = $dsn['hostspec'];
- } else {
- $odbcdsn = 'localhost';
- }
-
- $connect_function = $persistent ? 'odbc_pconnect' : 'odbc_connect';
-
- if (empty($dsn['cursor'])) {
- $this->connection = @$connect_function($odbcdsn, $dsn['username'],
- $dsn['password']);
- } else {
- $this->connection = @$connect_function($odbcdsn, $dsn['username'],
- $dsn['password'],
- $dsn['cursor']);
- }
-
- if (!is_resource($this->connection)) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $this->errorNative());
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $err = @odbc_close($this->connection);
- $this->connection = null;
- return $err;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- $result = @odbc_exec($this->connection, $query);
- if (!$result) {
- return $this->odbcRaiseError(); // XXX ERRORMSG
- }
- // Determine which queries that should return data, and which
- // should return an error code only.
- if ($this->_checkManip($query)) {
- $this->affected = $result; // For affectedRows()
- return DB_OK;
- }
- $this->affected = 0;
- return $result;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal odbc result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return @odbc_next_result($result);
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- $arr = array();
- if ($rownum !== null) {
- $rownum++; // ODBC first row is 1
- if (version_compare(phpversion(), '4.2.0', 'ge')) {
- $cols = @odbc_fetch_into($result, $arr, $rownum);
- } else {
- $cols = @odbc_fetch_into($result, $rownum, $arr);
- }
- } else {
- $cols = @odbc_fetch_into($result, $arr);
- }
- if (!$cols) {
- return null;
- }
- if ($fetchmode !== DB_FETCHMODE_ORDERED) {
- for ($i = 0; $i < count($arr); $i++) {
- $colName = @odbc_field_name($result, $i+1);
- $a[$colName] = $arr[$i];
- }
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $a = array_change_key_case($a, CASE_LOWER);
- }
- $arr = $a;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? odbc_free_result($result) : false;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @odbc_num_fields($result);
- if (!$cols) {
- return $this->odbcRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if (empty($this->affected)) { // In case of SELECT stms
- return 0;
- }
- $nrows = @odbc_num_rows($this->affected);
- if ($nrows == -1) {
- return $this->odbcRaiseError();
- }
- return $nrows;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * Not all ODBC drivers support this functionality. If they don't
- * a DB_Error object for DB_ERROR_UNSUPPORTED is returned.
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $nrows = @odbc_num_rows($result);
- if ($nrows == -1) {
- return $this->odbcRaiseError(DB_ERROR_UNSUPPORTED);
- }
- if ($nrows === false) {
- return $this->odbcRaiseError();
- }
- return $nrows;
- }
-
- // }}}
- // {{{ quoteIdentifier()
-
- /**
- * Quotes a string so it can be safely used as a table or column name
- *
- * Use 'mssql' as the dbsyntax in the DB DSN only if you've unchecked
- * "Use ANSI quoted identifiers" when setting up the ODBC data source.
- *
- * @param string $str identifier name to be quoted
- *
- * @return string quoted identifier string
- *
- * @see DB_common::quoteIdentifier()
- * @since Method available since Release 1.6.0
- */
- function quoteIdentifier($str)
- {
- switch ($this->dsn['dbsyntax']) {
- case 'access':
- return '[' . $str . ']';
- case 'mssql':
- case 'sybase':
- return '[' . str_replace(']', ']]', $str) . ']';
- case 'mysql':
- case 'mysqli':
- return '`' . $str . '`';
- default:
- return '"' . str_replace('"', '""', $str) . '"';
- }
- }
-
- // }}}
- // {{{ quote()
-
- /**
- * @deprecated Deprecated in release 1.6.0
- * @internal
- */
- function quote($str)
- {
- return $this->quoteSmart($str);
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_odbc::createSequence(), DB_odbc::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- $repeat = 0;
- do {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("update ${seqname} set id = id + 1");
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE) {
- $repeat = 1;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->createSequence($seq_name);
- $this->popErrorHandling();
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $result = $this->query("insert into ${seqname} (id) values(0)");
- } else {
- $repeat = 0;
- }
- } while ($repeat);
-
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
-
- $result = $this->query("select id from ${seqname}");
- if (DB::isError($result)) {
- return $result;
- }
-
- $row = $result->fetchRow(DB_FETCHMODE_ORDERED);
- if (DB::isError($row || !$row)) {
- return $row;
- }
-
- return $row[0];
- }
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_odbc::nextID(), DB_odbc::dropSequence()
- */
- function createSequence($seq_name)
- {
- return $this->query('CREATE TABLE '
- . $this->getSequenceName($seq_name)
- . ' (id integer NOT NULL,'
- . ' PRIMARY KEY(id))');
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_odbc::nextID(), DB_odbc::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- if (!@odbc_autocommit($this->connection, $onoff)) {
- return $this->odbcRaiseError();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if (!@odbc_commit($this->connection)) {
- return $this->odbcRaiseError();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if (!@odbc_rollback($this->connection)) {
- return $this->odbcRaiseError();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ odbcRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_odbc::errorNative(), DB_common::errorCode()
- */
- function odbcRaiseError($errno = null)
- {
- if ($errno === null) {
- switch ($this->dbsyntax) {
- case 'access':
- if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
- $this->errorcode_map['07001'] = DB_ERROR_NOSUCHFIELD;
- } else {
- // Doing this in case mode changes during runtime.
- $this->errorcode_map['07001'] = DB_ERROR_MISMATCH;
- }
-
- $native_code = odbc_error($this->connection);
-
- // S1000 is for "General Error." Let's be more specific.
- if ($native_code == 'S1000') {
- $errormsg = odbc_errormsg($this->connection);
- static $error_regexps;
- if (!isset($error_regexps)) {
- $error_regexps = array(
- '/includes related records.$/i' => DB_ERROR_CONSTRAINT,
- '/cannot contain a Null value/i' => DB_ERROR_CONSTRAINT_NOT_NULL,
- );
- }
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $errormsg)) {
- return $this->raiseError($code,
- null, null, null,
- $native_code . ' ' . $errormsg);
- }
- }
- $errno = DB_ERROR;
- } else {
- $errno = $this->errorCode($native_code);
- }
- break;
- default:
- $errno = $this->errorCode(odbc_error($this->connection));
- }
- }
- return $this->raiseError($errno, null, null, null,
- $this->errorNative());
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code and message produced by the last query
- *
- * @return string the DBMS' error code and message
- */
- function errorNative()
- {
- if (!is_resource($this->connection)) {
- return @odbc_error() . ' ' . @odbc_errormsg();
- }
- return @odbc_error($this->connection) . ' ' . @odbc_errormsg($this->connection);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- * @since Method available since Release 1.7.0
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @odbc_exec($this->connection, "SELECT * FROM $result");
- if (!$id) {
- return $this->odbcRaiseError();
- }
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->odbcRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @odbc_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $col = $i + 1;
- $res[$i] = array(
- 'table' => $got_string ? $case_func($result) : '',
- 'name' => $case_func(@odbc_field_name($id, $col)),
- 'type' => @odbc_field_type($id, $col),
- 'len' => @odbc_field_len($id, $col),
- 'flags' => '',
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @odbc_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * Thanks to symbol1@gmail.com and Philippe.Jausions@11abacus.com.
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the list of objects requested
- *
- * @access protected
- * @see DB_common::getListOf()
- * @since Method available since Release 1.7.0
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'databases':
- if (!function_exists('odbc_data_source')) {
- return null;
- }
- $res = @odbc_data_source($this->connection, SQL_FETCH_FIRST);
- if (is_array($res)) {
- $out = array($res['server']);
- while($res = @odbc_data_source($this->connection,
- SQL_FETCH_NEXT))
- {
- $out[] = $res['server'];
- }
- return $out;
- } else {
- return $this->odbcRaiseError();
- }
- break;
- case 'tables':
- case 'schema.tables':
- $keep = 'TABLE';
- break;
- case 'views':
- $keep = 'VIEW';
- break;
- default:
- return null;
- }
-
- /*
- * Removing non-conforming items in the while loop rather than
- * in the odbc_tables() call because some backends choke on this:
- * odbc_tables($this->connection, '', '', '', 'TABLE')
- */
- $res = @odbc_tables($this->connection);
- if (!$res) {
- return $this->odbcRaiseError();
- }
- $out = array();
- while ($row = odbc_fetch_array($res)) {
- if ($row['TABLE_TYPE'] != $keep) {
- continue;
- }
- if ($type == 'schema.tables') {
- $out[] = $row['TABLE_SCHEM'] . '.' . $row['TABLE_NAME'];
- } else {
- $out[] = $row['TABLE_NAME'];
- }
- }
- return $out;
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/pgsql.php b/airtime_mvc/library/pear/DB/pgsql.php
deleted file mode 100644
index 039888faf..000000000
--- a/airtime_mvc/library/pear/DB/pgsql.php
+++ /dev/null
@@ -1,1116 +0,0 @@
-
- * @author Stig Bakken
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: pgsql.php,v 1.138 2007/09/21 13:40:41 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's pgsql extension
- * for interacting with PostgreSQL databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category Database
- * @package DB
- * @author Rui Hirokawa
- * @author Stig Bakken
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_pgsql extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'pgsql';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'pgsql';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'alter',
- 'new_link' => '4.3.0',
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => true,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * The quantity of transactions begun
- *
- * {@internal While this is private, it can't actually be designated
- * private in PHP 5 because it is directly accessed in the test suite.}}
- *
- * @var integer
- * @access private
- */
- var $transaction_opcount = 0;
-
- /**
- * The number of rows affected by a data manipulation query
- * @var integer
- */
- var $affected = 0;
-
- /**
- * The current row being looked at in fetchInto()
- * @var array
- * @access private
- */
- var $row = array();
-
- /**
- * The number of rows in a given result set
- * @var array
- * @access private
- */
- var $_num_rows = array();
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_pgsql()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's pgsql driver supports the following extra DSN options:
- * + connect_timeout How many seconds to wait for a connection to
- * be established. Available since PEAR DB 1.7.0.
- * + new_link If set to true, causes subsequent calls to
- * connect() to return a new connection link
- * instead of the existing one. WARNING: this is
- * not portable to other DBMS's. Available only
- * if PHP is >= 4.3.0 and PEAR DB is >= 1.7.0.
- * + options Command line options to be sent to the server.
- * Available since PEAR DB 1.6.4.
- * + service Specifies a service name in pg_service.conf that
- * holds additional connection parameters.
- * Available since PEAR DB 1.7.0.
- * + sslmode How should SSL be used when connecting? Values:
- * disable, allow, prefer or require.
- * Available since PEAR DB 1.7.0.
- * + tty This was used to specify where to send server
- * debug output. Available since PEAR DB 1.6.4.
- *
- * Example of connecting to a new link via a socket:
- *
- * require_once 'DB.php';
- *
- * $dsn = 'pgsql://user:pass@unix(/tmp)/dbname?new_link=true';
- * $options = array(
- * 'portability' => DB_PORTABILITY_ALL,
- * );
- *
- * $db = DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @link http://www.postgresql.org/docs/current/static/libpq.html#LIBPQ-CONNECT
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('pgsql')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $protocol = $dsn['protocol'] ? $dsn['protocol'] : 'tcp';
-
- $params = array('');
- if ($protocol == 'tcp') {
- if ($dsn['hostspec']) {
- $params[0] .= 'host=' . $dsn['hostspec'];
- }
- if ($dsn['port']) {
- $params[0] .= ' port=' . $dsn['port'];
- }
- } elseif ($protocol == 'unix') {
- // Allow for pg socket in non-standard locations.
- if ($dsn['socket']) {
- $params[0] .= 'host=' . $dsn['socket'];
- }
- if ($dsn['port']) {
- $params[0] .= ' port=' . $dsn['port'];
- }
- }
- if ($dsn['database']) {
- $params[0] .= ' dbname=\'' . addslashes($dsn['database']) . '\'';
- }
- if ($dsn['username']) {
- $params[0] .= ' user=\'' . addslashes($dsn['username']) . '\'';
- }
- if ($dsn['password']) {
- $params[0] .= ' password=\'' . addslashes($dsn['password']) . '\'';
- }
- if (!empty($dsn['options'])) {
- $params[0] .= ' options=' . $dsn['options'];
- }
- if (!empty($dsn['tty'])) {
- $params[0] .= ' tty=' . $dsn['tty'];
- }
- if (!empty($dsn['connect_timeout'])) {
- $params[0] .= ' connect_timeout=' . $dsn['connect_timeout'];
- }
- if (!empty($dsn['sslmode'])) {
- $params[0] .= ' sslmode=' . $dsn['sslmode'];
- }
- if (!empty($dsn['service'])) {
- $params[0] .= ' service=' . $dsn['service'];
- }
-
- if (isset($dsn['new_link'])
- && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
- {
- if (version_compare(phpversion(), '4.3.0', '>=')) {
- $params[] = PGSQL_CONNECT_FORCE_NEW;
- }
- }
-
- $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
-
- $ini = ini_get('track_errors');
- $php_errormsg = '';
- if ($ini) {
- $this->connection = @call_user_func_array($connect_function,
- $params);
- } else {
- @ini_set('track_errors', 1);
- $this->connection = @call_user_func_array($connect_function,
- $params);
- @ini_set('track_errors', $ini);
- }
-
- if (!$this->connection) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @pg_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- if (!$this->autocommit && $ismanip) {
- if ($this->transaction_opcount == 0) {
- $result = @pg_exec($this->connection, 'begin;');
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
- }
- $this->transaction_opcount++;
- }
- $result = @pg_exec($this->connection, $query);
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
-
- /*
- * Determine whether queries produce affected rows, result or nothing.
- *
- * This logic was introduced in version 1.1 of the file by ssb,
- * though the regex has been modified slightly since then.
- *
- * PostgreSQL commands:
- * ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
- * CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
- * GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
- * REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
- * UNLISTEN, UPDATE, VACUUM
- */
- if ($ismanip) {
- $this->affected = @pg_affected_rows($result);
- return DB_OK;
- } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|FETCH|SHOW)\s/si',
- $query))
- {
- $this->row[(int)$result] = 0; // reset the row counter.
- $numrows = $this->numRows($result);
- if (is_object($numrows)) {
- return $numrows;
- }
- $this->_num_rows[(int)$result] = $numrows;
- $this->affected = 0;
- return $result;
- } else {
- $this->affected = 0;
- return DB_OK;
- }
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal pgsql result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- $result_int = (int)$result;
- $rownum = ($rownum !== null) ? $rownum : $this->row[$result_int];
- if ($rownum >= $this->_num_rows[$result_int]) {
- return null;
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @pg_fetch_array($result, $rownum, PGSQL_ASSOC);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @pg_fetch_row($result, $rownum);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- $this->row[$result_int] = ++$rownum;
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- if (is_resource($result)) {
- unset($this->row[(int)$result]);
- unset($this->_num_rows[(int)$result]);
- $this->affected = 0;
- return @pg_freeresult($result);
- }
- return false;
- }
-
- // }}}
- // {{{ quote()
-
- /**
- * @deprecated Deprecated in release 1.6.0
- * @internal
- */
- function quote($str)
- {
- return $this->quoteSmart($str);
- }
-
- // }}}
- // {{{ quoteBoolean()
-
- /**
- * Formats a boolean value for use within a query in a locale-independent
- * manner.
- *
- * @param boolean the boolean value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteBoolean($boolean) {
- return $boolean ? 'TRUE' : 'FALSE';
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * {@internal PostgreSQL treats a backslash as an escape character,
- * so they are escaped as well.
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.6.0
- */
- function escapeSimple($str)
- {
- if (function_exists('pg_escape_string')) {
- /* This fixes an undocumented BC break in PHP 5.2.0 which changed
- * the prototype of pg_escape_string. I'm not thrilled about having
- * to sniff the PHP version, quite frankly, but it's the only way
- * to deal with the problem. Revision 1.331.2.13.2.10 on
- * php-src/ext/pgsql/pgsql.c (PHP_5_2 branch) is to blame, for the
- * record. */
- if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
- return pg_escape_string($this->connection, $str);
- } else {
- return pg_escape_string($str);
- }
- } else {
- return str_replace("'", "''", str_replace('\\', '\\\\', $str));
- }
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @pg_numfields($result);
- if (!$cols) {
- return $this->pgsqlRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @pg_numrows($result);
- if ($rows === null) {
- return $this->pgsqlRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- // XXX if $this->transaction_opcount > 0, we should probably
- // issue a warning here.
- $this->autocommit = $onoff ? true : false;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if ($this->transaction_opcount > 0) {
- // (disabled) hack to shut up error messages from libpq.a
- //@fclose(@fopen("php://stderr", "w"));
- $result = @pg_exec($this->connection, 'end;');
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if ($this->transaction_opcount > 0) {
- $result = @pg_exec($this->connection, 'abort;');
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- return $this->affected;
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_pgsql::createSequence(), DB_pgsql::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- $repeat = false;
- do {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("SELECT NEXTVAL('${seqname}')");
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE) {
- $repeat = true;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->createSequence($seq_name);
- $this->popErrorHandling();
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- } else {
- $repeat = false;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
- $result->free();
- return $arr[0];
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_pgsql::nextID(), DB_pgsql::dropSequence()
- */
- function createSequence($seq_name)
- {
- $seqname = $this->getSequenceName($seq_name);
- $result = $this->query("CREATE SEQUENCE ${seqname}");
- return $result;
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_pgsql::nextID(), DB_pgsql::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP SEQUENCE '
- . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- return "$query LIMIT $count OFFSET $from";
- }
-
- // }}}
- // {{{ pgsqlRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_pgsql::errorNative(), DB_pgsql::errorCode()
- */
- function pgsqlRaiseError($errno = null)
- {
- $native = $this->errorNative();
- if (!$native) {
- $native = 'Database connection has been lost.';
- $errno = DB_ERROR_CONNECT_FAILED;
- }
- if ($errno === null) {
- $errno = $this->errorCode($native);
- }
- return $this->raiseError($errno, null, null, null, $native);
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error message produced by the last query
- *
- * {@internal Error messages are used instead of error codes
- * in order to support older versions of PostgreSQL.}}
- *
- * @return string the DBMS' error message
- */
- function errorNative()
- {
- return @pg_errormessage($this->connection);
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Determines PEAR::DB error code from the database's text error message.
- *
- * @param string $errormsg error message returned from the database
- * @return integer an error number from a DB error constant
- */
- function errorCode($errormsg)
- {
- static $error_regexps;
- if (!isset($error_regexps)) {
- $error_regexps = array(
- '/column .* (of relation .*)?does not exist/i'
- => DB_ERROR_NOSUCHFIELD,
- '/(relation|sequence|table).*does not exist|class .* not found/i'
- => DB_ERROR_NOSUCHTABLE,
- '/index .* does not exist/'
- => DB_ERROR_NOT_FOUND,
- '/relation .* already exists/i'
- => DB_ERROR_ALREADY_EXISTS,
- '/(divide|division) by zero$/i'
- => DB_ERROR_DIVZERO,
- '/pg_atoi: error in .*: can\'t parse /i'
- => DB_ERROR_INVALID_NUMBER,
- '/invalid input syntax for( type)? (integer|numeric)/i'
- => DB_ERROR_INVALID_NUMBER,
- '/value .* is out of range for type \w*int/i'
- => DB_ERROR_INVALID_NUMBER,
- '/integer out of range/i'
- => DB_ERROR_INVALID_NUMBER,
- '/value too long for type character/i'
- => DB_ERROR_INVALID,
- '/attribute .* not found|relation .* does not have attribute/i'
- => DB_ERROR_NOSUCHFIELD,
- '/column .* specified in USING clause does not exist in (left|right) table/i'
- => DB_ERROR_NOSUCHFIELD,
- '/parser: parse error at or near/i'
- => DB_ERROR_SYNTAX,
- '/syntax error at/'
- => DB_ERROR_SYNTAX,
- '/column reference .* is ambiguous/i'
- => DB_ERROR_SYNTAX,
- '/permission denied/'
- => DB_ERROR_ACCESS_VIOLATION,
- '/violates not-null constraint/'
- => DB_ERROR_CONSTRAINT_NOT_NULL,
- '/violates [\w ]+ constraint/'
- => DB_ERROR_CONSTRAINT,
- '/referential integrity violation/'
- => DB_ERROR_CONSTRAINT,
- '/more expressions than target columns/i'
- => DB_ERROR_VALUE_COUNT_ON_ROW,
- );
- }
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $errormsg)) {
- return $code;
- }
- }
- // Fall back to DB_ERROR if there was no mapping.
- return DB_ERROR;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if $result
- * is a table name.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @pg_numfields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => $got_string ? $case_func($result) : '',
- 'name' => $case_func(@pg_fieldname($id, $i)),
- 'type' => @pg_fieldtype($id, $i),
- 'len' => @pg_fieldsize($id, $i),
- 'flags' => $got_string
- ? $this->_pgFieldFlags($id, $i, $result)
- : '',
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @pg_freeresult($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ _pgFieldFlags()
-
- /**
- * Get a column's flags
- *
- * Supports "not_null", "default_value", "primary_key", "unique_key"
- * and "multiple_key". The default value is passed through
- * rawurlencode() in case there are spaces in it.
- *
- * @param int $resource the PostgreSQL result identifier
- * @param int $num_field the field number
- *
- * @return string the flags
- *
- * @access private
- */
- function _pgFieldFlags($resource, $num_field, $table_name)
- {
- $field_name = @pg_fieldname($resource, $num_field);
-
- // Check if there's a schema in $table_name and update things
- // accordingly.
- $from = 'pg_attribute f, pg_class tab, pg_type typ';
- if (strpos($table_name, '.') !== false) {
- $from .= ', pg_namespace nsp';
- list($schema, $table) = explode('.', $table_name);
- $tableWhere = "tab.relname = '$table' AND tab.relnamespace = nsp.oid AND nsp.nspname = '$schema'";
- } else {
- $tableWhere = "tab.relname = '$table_name'";
- }
-
- $result = @pg_exec($this->connection, "SELECT f.attnotnull, f.atthasdef
- FROM $from
- WHERE tab.relname = typ.typname
- AND typ.typrelid = f.attrelid
- AND f.attname = '$field_name'
- AND $tableWhere");
- if (@pg_numrows($result) > 0) {
- $row = @pg_fetch_row($result, 0);
- $flags = ($row[0] == 't') ? 'not_null ' : '';
-
- if ($row[1] == 't') {
- $result = @pg_exec($this->connection, "SELECT a.adsrc
- FROM $from, pg_attrdef a
- WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
- AND f.attrelid = a.adrelid AND f.attname = '$field_name'
- AND $tableWhere AND f.attnum = a.adnum");
- $row = @pg_fetch_row($result, 0);
- $num = preg_replace("/'(.*)'::\w+/", "\\1", $row[0]);
- $flags .= 'default_' . rawurlencode($num) . ' ';
- }
- } else {
- $flags = '';
- }
- $result = @pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
- FROM $from, pg_index i
- WHERE tab.relname = typ.typname
- AND typ.typrelid = f.attrelid
- AND f.attrelid = i.indrelid
- AND f.attname = '$field_name'
- AND $tableWhere");
- $count = @pg_numrows($result);
-
- for ($i = 0; $i < $count ; $i++) {
- $row = @pg_fetch_row($result, $i);
- $keys = explode(' ', $row[2]);
-
- if (in_array($num_field + 1, $keys)) {
- $flags .= ($row[0] == 't' && $row[1] == 'f') ? 'unique_key ' : '';
- $flags .= ($row[1] == 't') ? 'primary_key ' : '';
- if (count($keys) > 1)
- $flags .= 'multiple_key ';
- }
- }
-
- return trim($flags);
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SELECT c.relname AS "Name"'
- . ' FROM pg_class c, pg_user u'
- . ' WHERE c.relowner = u.usesysid'
- . " AND c.relkind = 'r'"
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_views'
- . ' WHERE viewname = c.relname)'
- . " AND c.relname !~ '^(pg_|sql_)'"
- . ' UNION'
- . ' SELECT c.relname AS "Name"'
- . ' FROM pg_class c'
- . " WHERE c.relkind = 'r'"
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_views'
- . ' WHERE viewname = c.relname)'
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_user'
- . ' WHERE usesysid = c.relowner)'
- . " AND c.relname !~ '^pg_'";
- case 'schema.tables':
- return "SELECT schemaname || '.' || tablename"
- . ' AS "Name"'
- . ' FROM pg_catalog.pg_tables'
- . ' WHERE schemaname NOT IN'
- . " ('pg_catalog', 'information_schema', 'pg_toast')";
- case 'schema.views':
- return "SELECT schemaname || '.' || viewname from pg_views WHERE schemaname"
- . " NOT IN ('information_schema', 'pg_catalog')";
- case 'views':
- // Table cols: viewname | viewowner | definition
- return 'SELECT viewname from pg_views WHERE schemaname'
- . " NOT IN ('information_schema', 'pg_catalog')";
- case 'users':
- // cols: usename |usesysid|usecreatedb|usetrace|usesuper|usecatupd|passwd |valuntil
- return 'SELECT usename FROM pg_user';
- case 'databases':
- return 'SELECT datname FROM pg_database';
- case 'functions':
- case 'procedures':
- return 'SELECT proname FROM pg_proc WHERE proowner <> 1';
- default:
- return null;
- }
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/sqlite.php b/airtime_mvc/library/pear/DB/sqlite.php
deleted file mode 100644
index bf2acec5a..000000000
--- a/airtime_mvc/library/pear/DB/sqlite.php
+++ /dev/null
@@ -1,959 +0,0 @@
-
- * @author Mika Tuupola
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
- * @version CVS: $Id: sqlite.php,v 1.117 2007/09/21 14:23:28 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's sqlite extension
- * for interacting with SQLite databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * NOTICE: This driver needs PHP's track_errors ini setting to be on.
- * It is automatically turned on when connecting to the database.
- * Make sure your scripts don't turn it off.
- *
- * @category Database
- * @package DB
- * @author Urs Gehrig
- * @author Mika Tuupola
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_sqlite extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'sqlite';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'sqlite';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'alter',
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => false,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- *
- * {@internal Error codes according to sqlite_exec. See the online
- * manual at http://sqlite.org/c_interface.html for info.
- * This error handling based on sqlite_exec is not yet implemented.}}
- *
- * @var array
- */
- var $errorcode_map = array(
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * SQLite data types
- *
- * @link http://www.sqlite.org/datatypes.html
- *
- * @var array
- */
- var $keywords = array (
- 'BLOB' => '',
- 'BOOLEAN' => '',
- 'CHARACTER' => '',
- 'CLOB' => '',
- 'FLOAT' => '',
- 'INTEGER' => '',
- 'KEY' => '',
- 'NATIONAL' => '',
- 'NUMERIC' => '',
- 'NVARCHAR' => '',
- 'PRIMARY' => '',
- 'TEXT' => '',
- 'TIMESTAMP' => '',
- 'UNIQUE' => '',
- 'VARCHAR' => '',
- 'VARYING' => '',
- );
-
- /**
- * The most recent error message from $php_errormsg
- * @var string
- * @access private
- */
- var $_lasterror = '';
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_sqlite()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's sqlite driver supports the following extra DSN options:
- * + mode The permissions for the database file, in four digit
- * chmod octal format (eg "0600").
- *
- * Example of connecting to a database in read-only mode:
- *
- * require_once 'DB.php';
- *
- * $dsn = 'sqlite:///path/and/name/of/db/file?mode=0400';
- * $options = array(
- * 'portability' => DB_PORTABILITY_ALL,
- * );
- *
- * $db = DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('sqlite')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- if (!$dsn['database']) {
- return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
- }
-
- if ($dsn['database'] !== ':memory:') {
- if (!file_exists($dsn['database'])) {
- if (!touch($dsn['database'])) {
- return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
- }
- if (!isset($dsn['mode']) ||
- !is_numeric($dsn['mode']))
- {
- $mode = 0644;
- } else {
- $mode = octdec($dsn['mode']);
- }
- if (!chmod($dsn['database'], $mode)) {
- return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
- }
- if (!file_exists($dsn['database'])) {
- return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
- }
- }
- if (!is_file($dsn['database'])) {
- return $this->sqliteRaiseError(DB_ERROR_INVALID);
- }
- if (!is_readable($dsn['database'])) {
- return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
- }
- }
-
- $connect_function = $persistent ? 'sqlite_popen' : 'sqlite_open';
-
- // track_errors must remain on for simpleQuery()
- @ini_set('track_errors', 1);
- $php_errormsg = '';
-
- if (!$this->connection = @$connect_function($dsn['database'])) {
- return $this->raiseError(DB_ERROR_NODBSELECTED,
- null, null, null,
- $php_errormsg);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @sqlite_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * NOTICE: This method needs PHP's track_errors ini setting to be on.
- * It is automatically turned on when connecting to the database.
- * Make sure your scripts don't turn it off.
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
-
- $php_errormsg = '';
-
- $result = @sqlite_query($query, $this->connection);
- $this->_lasterror = $php_errormsg ? $php_errormsg : '';
-
- $this->result = $result;
- if (!$this->result) {
- return $this->sqliteRaiseError(null);
- }
-
- // sqlite_query() seems to allways return a resource
- // so cant use that. Using $ismanip instead
- if (!$ismanip) {
- $numRows = $this->numRows($result);
- if (is_object($numRows)) {
- // we've got PEAR_Error
- return $numRows;
- }
- return $result;
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal sqlite result pointer to the next available result
- *
- * @param resource $result the valid sqlite result resource
- *
- * @return bool true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- if (!@sqlite_seek($this->result, $rownum)) {
- return null;
- }
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @sqlite_fetch_array($result, SQLITE_ASSOC);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
-
- /* Remove extraneous " characters from the fields in the result.
- * Fixes bug #11716. */
- if (is_array($arr) && count($arr) > 0) {
- $strippedArr = array();
- foreach ($arr as $field => $value) {
- $strippedArr[trim($field, '"')] = $value;
- }
- $arr = $strippedArr;
- }
- } else {
- $arr = @sqlite_fetch_array($result, SQLITE_NUM);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- /*
- * Even though this DBMS already trims output, we do this because
- * a field might have intentional whitespace at the end that
- * gets removed by DB_PORTABILITY_RTRIM under another driver.
- */
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult(&$result)
- {
- // XXX No native free?
- if (!is_resource($result)) {
- return false;
- }
- $result = null;
- return true;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @sqlite_num_fields($result);
- if (!$cols) {
- return $this->sqliteRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @sqlite_num_rows($result);
- if ($rows === null) {
- return $this->sqliteRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ affected()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- return @sqlite_changes($this->connection);
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_sqlite::nextID(), DB_sqlite::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
- }
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_sqlite::nextID(), DB_sqlite::dropSequence()
- */
- function createSequence($seq_name)
- {
- $seqname = $this->getSequenceName($seq_name);
- $query = 'CREATE TABLE ' . $seqname .
- ' (id INTEGER UNSIGNED PRIMARY KEY) ';
- $result = $this->query($query);
- if (DB::isError($result)) {
- return($result);
- }
- $query = "CREATE TRIGGER ${seqname}_cleanup AFTER INSERT ON $seqname
- BEGIN
- DELETE FROM $seqname WHERE idquery($query);
- if (DB::isError($result)) {
- return($result);
- }
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_sqlite::createSequence(), DB_sqlite::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
-
- do {
- $repeat = 0;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("INSERT INTO $seqname (id) VALUES (NULL)");
- $this->popErrorHandling();
- if ($result === DB_OK) {
- $id = @sqlite_last_insert_rowid($this->connection);
- if ($id != 0) {
- return $id;
- }
- } elseif ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE)
- {
- $result = $this->createSequence($seq_name);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- } else {
- $repeat = 1;
- }
- }
- } while ($repeat);
-
- return $this->raiseError($result);
- }
-
- // }}}
- // {{{ getDbFileStats()
-
- /**
- * Get the file stats for the current database
- *
- * Possible arguments are dev, ino, mode, nlink, uid, gid, rdev, size,
- * atime, mtime, ctime, blksize, blocks or a numeric key between
- * 0 and 12.
- *
- * @param string $arg the array key for stats()
- *
- * @return mixed an array on an unspecified key, integer on a passed
- * arg and false at a stats error
- */
- function getDbFileStats($arg = '')
- {
- $stats = stat($this->dsn['database']);
- if ($stats == false) {
- return false;
- }
- if (is_array($stats)) {
- if (is_numeric($arg)) {
- if (((int)$arg <= 12) & ((int)$arg >= 0)) {
- return false;
- }
- return $stats[$arg ];
- }
- if (array_key_exists(trim($arg), $stats)) {
- return $stats[$arg ];
- }
- }
- return $stats;
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * In SQLite, this makes things safe for inserts/updates, but may
- * cause problems when performing text comparisons against columns
- * containing binary data. See the
- * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @since Method available since Release 1.6.1
- * @see DB_common::escapeSimple()
- */
- function escapeSimple($str)
- {
- return @sqlite_escape_string($str);
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- return "$query LIMIT $count OFFSET $from";
- }
-
- // }}}
- // {{{ modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * This little hack lets you know how many rows were deleted
- * when running a "DELETE FROM table" query. Only implemented
- * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
- *
- * @param string $query the query string to modify
- *
- * @return string the modified query string
- *
- * @access protected
- * @see DB_common::setOption()
- */
- function modifyQuery($query)
- {
- if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
- if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
- $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
- 'DELETE FROM \1 WHERE 1=1', $query);
- }
- }
- return $query;
- }
-
- // }}}
- // {{{ sqliteRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_sqlite::errorNative(), DB_sqlite::errorCode()
- */
- function sqliteRaiseError($errno = null)
- {
- $native = $this->errorNative();
- if ($errno === null) {
- $errno = $this->errorCode($native);
- }
-
- $errorcode = @sqlite_last_error($this->connection);
- $userinfo = "$errorcode ** $this->last_query";
-
- return $this->raiseError($errno, null, null, $userinfo, $native);
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error message produced by the last query
- *
- * {@internal This is used to retrieve more meaningfull error messages
- * because sqlite_last_error() does not provide adequate info.}}
- *
- * @return string the DBMS' error message
- */
- function errorNative()
- {
- return $this->_lasterror;
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Determines PEAR::DB error code from the database's text error message
- *
- * @param string $errormsg the error message returned from the database
- *
- * @return integer the DB error number
- */
- function errorCode($errormsg)
- {
- static $error_regexps;
-
- // PHP 5.2+ prepends the function name to $php_errormsg, so we need
- // this hack to work around it, per bug #9599.
- $errormsg = preg_replace('/^sqlite[a-z_]+\(\): /', '', $errormsg);
-
- if (!isset($error_regexps)) {
- $error_regexps = array(
- '/^no such table:/' => DB_ERROR_NOSUCHTABLE,
- '/^no such index:/' => DB_ERROR_NOT_FOUND,
- '/^(table|index) .* already exists$/' => DB_ERROR_ALREADY_EXISTS,
- '/PRIMARY KEY must be unique/i' => DB_ERROR_CONSTRAINT,
- '/is not unique/' => DB_ERROR_CONSTRAINT,
- '/columns .* are not unique/i' => DB_ERROR_CONSTRAINT,
- '/uniqueness constraint failed/' => DB_ERROR_CONSTRAINT,
- '/may not be NULL/' => DB_ERROR_CONSTRAINT_NOT_NULL,
- '/^no such column:/' => DB_ERROR_NOSUCHFIELD,
- '/column not present in both tables/i' => DB_ERROR_NOSUCHFIELD,
- '/^near ".*": syntax error$/' => DB_ERROR_SYNTAX,
- '/[0-9]+ values for [0-9]+ columns/i' => DB_ERROR_VALUE_COUNT_ON_ROW,
- );
- }
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $errormsg)) {
- return $code;
- }
- }
- // Fall back to DB_ERROR if there was no mapping.
- return DB_ERROR;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table
- *
- * @param string $result a string containing the name of a table
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- * @since Method available since Release 1.7.0
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @sqlite_array_query($this->connection,
- "PRAGMA table_info('$result');",
- SQLITE_ASSOC);
- $got_string = true;
- } else {
- $this->last_query = '';
- return $this->raiseError(DB_ERROR_NOT_CAPABLE, null, null, null,
- 'This DBMS can not obtain tableInfo' .
- ' from result sets');
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = count($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- if (strpos($id[$i]['type'], '(') !== false) {
- $bits = explode('(', $id[$i]['type']);
- $type = $bits[0];
- $len = rtrim($bits[1],')');
- } else {
- $type = $id[$i]['type'];
- $len = 0;
- }
-
- $flags = '';
- if ($id[$i]['pk']) {
- $flags .= 'primary_key ';
- }
- if ($id[$i]['notnull']) {
- $flags .= 'not_null ';
- }
- if ($id[$i]['dflt_value'] !== null) {
- $flags .= 'default_' . rawurlencode($id[$i]['dflt_value']);
- }
- $flags = trim($flags);
-
- $res[$i] = array(
- 'table' => $case_func($result),
- 'name' => $case_func($id[$i]['name']),
- 'type' => $type,
- 'len' => $len,
- 'flags' => $flags,
- );
-
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- return $res;
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- * @param array $args SQLITE DRIVER ONLY: a private array of arguments
- * used by the getSpecialQuery(). Do not use
- * this directly.
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type, $args = array())
- {
- if (!is_array($args)) {
- return $this->raiseError('no key specified', null, null, null,
- 'Argument has to be an array.');
- }
-
- switch ($type) {
- case 'master':
- return 'SELECT * FROM sqlite_master;';
- case 'tables':
- return "SELECT name FROM sqlite_master WHERE type='table' "
- . 'UNION ALL SELECT name FROM sqlite_temp_master '
- . "WHERE type='table' ORDER BY name;";
- case 'schema':
- return 'SELECT sql FROM (SELECT * FROM sqlite_master '
- . 'UNION ALL SELECT * FROM sqlite_temp_master) '
- . "WHERE type!='meta' "
- . 'ORDER BY tbl_name, type DESC, name;';
- case 'schemax':
- case 'schema_x':
- /*
- * Use like:
- * $res = $db->query($db->getSpecialQuery('schema_x',
- * array('table' => 'table3')));
- */
- return 'SELECT sql FROM (SELECT * FROM sqlite_master '
- . 'UNION ALL SELECT * FROM sqlite_temp_master) '
- . "WHERE tbl_name LIKE '{$args['table']}' "
- . "AND type!='meta' "
- . 'ORDER BY type DESC, name;';
- case 'alter':
- /*
- * SQLite does not support ALTER TABLE; this is a helper query
- * to handle this. 'table' represents the table name, 'rows'
- * the news rows to create, 'save' the row(s) to keep _with_
- * the data.
- *
- * Use like:
- * $args = array(
- * 'table' => $table,
- * 'rows' => "id INTEGER PRIMARY KEY, firstname TEXT, surname TEXT, datetime TEXT",
- * 'save' => "NULL, titel, content, datetime"
- * );
- * $res = $db->query( $db->getSpecialQuery('alter', $args));
- */
- $rows = strtr($args['rows'], $this->keywords);
-
- $q = array(
- 'BEGIN TRANSACTION',
- "CREATE TEMPORARY TABLE {$args['table']}_backup ({$args['rows']})",
- "INSERT INTO {$args['table']}_backup SELECT {$args['save']} FROM {$args['table']}",
- "DROP TABLE {$args['table']}",
- "CREATE TABLE {$args['table']} ({$args['rows']})",
- "INSERT INTO {$args['table']} SELECT {$rows} FROM {$args['table']}_backup",
- "DROP TABLE {$args['table']}_backup",
- 'COMMIT',
- );
-
- /*
- * This is a dirty hack, since the above query will not get
- * executed with a single query call so here the query method
- * will be called directly and return a select instead.
- */
- foreach ($q as $query) {
- $this->query($query);
- }
- return "SELECT * FROM {$args['table']};";
- default:
- return null;
- }
- }
-
- // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/storage.php b/airtime_mvc/library/pear/DB/storage.php
deleted file mode 100644
index 30762e87e..000000000
--- a/airtime_mvc/library/pear/DB/storage.php
+++ /dev/null
@@ -1,506 +0,0 @@
-
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: storage.php,v 1.24 2007/08/12 05:27:25 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB class so it can be extended from
- */
-require_once 'DB.php';
-
-/**
- * Provides an object interface to a table row
- *
- * It lets you add, delete and change rows using objects rather than SQL
- * statements.
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_storage extends PEAR
-{
- // {{{ properties
-
- /** the name of the table (or view, if the backend database supports
- updates in views) we hold data from */
- var $_table = null;
-
- /** which column(s) in the table contains primary keys, can be a
- string for single-column primary keys, or an array of strings
- for multiple-column primary keys */
- var $_keycolumn = null;
-
- /** DB connection handle used for all transactions */
- var $_dbh = null;
-
- /** an assoc with the names of database fields stored as properties
- in this object */
- var $_properties = array();
-
- /** an assoc with the names of the properties in this object that
- have been changed since they were fetched from the database */
- var $_changes = array();
-
- /** flag that decides if data in this object can be changed.
- objects that don't have their table's key column in their
- property lists will be flagged as read-only. */
- var $_readonly = false;
-
- /** function or method that implements a validator for fields that
- are set, this validator function returns true if the field is
- valid, false if not */
- var $_validator = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- *
- * @param $table string the name of the database table
- *
- * @param $keycolumn mixed string with name of key column, or array of
- * strings if the table has a primary key of more than one column
- *
- * @param $dbh object database connection object
- *
- * @param $validator mixed function or method used to validate
- * each new value, called with three parameters: the name of the
- * field/column that is changing, a reference to the new value and
- * a reference to this object
- *
- */
- function DB_storage($table, $keycolumn, &$dbh, $validator = null)
- {
- $this->PEAR('DB_Error');
- $this->_table = $table;
- $this->_keycolumn = $keycolumn;
- $this->_dbh = $dbh;
- $this->_readonly = false;
- $this->_validator = $validator;
- }
-
- // }}}
- // {{{ _makeWhere()
-
- /**
- * Utility method to build a "WHERE" clause to locate ourselves in
- * the table.
- *
- * XXX future improvement: use rowids?
- *
- * @access private
- */
- function _makeWhere($keyval = null)
- {
- if (is_array($this->_keycolumn)) {
- if ($keyval === null) {
- for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
- $keyval[] = $this->{$this->_keycolumn[$i]};
- }
- }
- $whereclause = '';
- for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
- if ($i > 0) {
- $whereclause .= ' AND ';
- }
- $whereclause .= $this->_keycolumn[$i];
- if (is_null($keyval[$i])) {
- // there's not much point in having a NULL key,
- // but we support it anyway
- $whereclause .= ' IS NULL';
- } else {
- $whereclause .= ' = ' . $this->_dbh->quote($keyval[$i]);
- }
- }
- } else {
- if ($keyval === null) {
- $keyval = @$this->{$this->_keycolumn};
- }
- $whereclause = $this->_keycolumn;
- if (is_null($keyval)) {
- // there's not much point in having a NULL key,
- // but we support it anyway
- $whereclause .= ' IS NULL';
- } else {
- $whereclause .= ' = ' . $this->_dbh->quote($keyval);
- }
- }
- return $whereclause;
- }
-
- // }}}
- // {{{ setup()
-
- /**
- * Method used to initialize a DB_storage object from the
- * configured table.
- *
- * @param $keyval mixed the key[s] of the row to fetch (string or array)
- *
- * @return int DB_OK on success, a DB error if not
- */
- function setup($keyval)
- {
- $whereclause = $this->_makeWhere($keyval);
- $query = 'SELECT * FROM ' . $this->_table . ' WHERE ' . $whereclause;
- $sth = $this->_dbh->query($query);
- if (DB::isError($sth)) {
- return $sth;
- }
- $row = $sth->fetchRow(DB_FETCHMODE_ASSOC);
- if (DB::isError($row)) {
- return $row;
- }
- if (!$row) {
- return $this->raiseError(null, DB_ERROR_NOT_FOUND, null, null,
- $query, null, true);
- }
- foreach ($row as $key => $value) {
- $this->_properties[$key] = true;
- $this->$key = $value;
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ insert()
-
- /**
- * Create a new (empty) row in the configured table for this
- * object.
- */
- function insert($newpk)
- {
- if (is_array($this->_keycolumn)) {
- $primarykey = $this->_keycolumn;
- } else {
- $primarykey = array($this->_keycolumn);
- }
- settype($newpk, "array");
- for ($i = 0; $i < sizeof($primarykey); $i++) {
- $pkvals[] = $this->_dbh->quote($newpk[$i]);
- }
-
- $sth = $this->_dbh->query("INSERT INTO $this->_table (" .
- implode(",", $primarykey) . ") VALUES(" .
- implode(",", $pkvals) . ")");
- if (DB::isError($sth)) {
- return $sth;
- }
- if (sizeof($newpk) == 1) {
- $newpk = $newpk[0];
- }
- $this->setup($newpk);
- }
-
- // }}}
- // {{{ toString()
-
- /**
- * Output a simple description of this DB_storage object.
- * @return string object description
- */
- function toString()
- {
- $info = strtolower(get_class($this));
- $info .= " (table=";
- $info .= $this->_table;
- $info .= ", keycolumn=";
- if (is_array($this->_keycolumn)) {
- $info .= "(" . implode(",", $this->_keycolumn) . ")";
- } else {
- $info .= $this->_keycolumn;
- }
- $info .= ", dbh=";
- if (is_object($this->_dbh)) {
- $info .= $this->_dbh->toString();
- } else {
- $info .= "null";
- }
- $info .= ")";
- if (sizeof($this->_properties)) {
- $info .= " [loaded, key=";
- $keyname = $this->_keycolumn;
- if (is_array($keyname)) {
- $info .= "(";
- for ($i = 0; $i < sizeof($keyname); $i++) {
- if ($i > 0) {
- $info .= ",";
- }
- $info .= $this->$keyname[$i];
- }
- $info .= ")";
- } else {
- $info .= $this->$keyname;
- }
- $info .= "]";
- }
- if (sizeof($this->_changes)) {
- $info .= " [modified]";
- }
- return $info;
- }
-
- // }}}
- // {{{ dump()
-
- /**
- * Dump the contents of this object to "standard output".
- */
- function dump()
- {
- foreach ($this->_properties as $prop => $foo) {
- print "$prop = ";
- print htmlentities($this->$prop);
- print "
\n";
- }
- }
-
- // }}}
- // {{{ &create()
-
- /**
- * Static method used to create new DB storage objects.
- * @param $data assoc. array where the keys are the names
- * of properties/columns
- * @return object a new instance of DB_storage or a subclass of it
- */
- function &create($table, &$data)
- {
- $classname = strtolower(get_class($this));
- $obj = new $classname($table);
- foreach ($data as $name => $value) {
- $obj->_properties[$name] = true;
- $obj->$name = &$value;
- }
- return $obj;
- }
-
- // }}}
- // {{{ loadFromQuery()
-
- /**
- * Loads data into this object from the given query. If this
- * object already contains table data, changes will be saved and
- * the object re-initialized first.
- *
- * @param $query SQL query
- *
- * @param $params parameter list in case you want to use
- * prepare/execute mode
- *
- * @return int DB_OK on success, DB_WARNING_READ_ONLY if the
- * returned object is read-only (because the object's specified
- * key column was not found among the columns returned by $query),
- * or another DB error code in case of errors.
- */
-// XXX commented out for now
-/*
- function loadFromQuery($query, $params = null)
- {
- if (sizeof($this->_properties)) {
- if (sizeof($this->_changes)) {
- $this->store();
- $this->_changes = array();
- }
- $this->_properties = array();
- }
- $rowdata = $this->_dbh->getRow($query, DB_FETCHMODE_ASSOC, $params);
- if (DB::isError($rowdata)) {
- return $rowdata;
- }
- reset($rowdata);
- $found_keycolumn = false;
- while (list($key, $value) = each($rowdata)) {
- if ($key == $this->_keycolumn) {
- $found_keycolumn = true;
- }
- $this->_properties[$key] = true;
- $this->$key = &$value;
- unset($value); // have to unset, or all properties will
- // refer to the same value
- }
- if (!$found_keycolumn) {
- $this->_readonly = true;
- return DB_WARNING_READ_ONLY;
- }
- return DB_OK;
- }
- */
-
- // }}}
- // {{{ set()
-
- /**
- * Modify an attriute value.
- */
- function set($property, $newvalue)
- {
- // only change if $property is known and object is not
- // read-only
- if ($this->_readonly) {
- return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
- null, null, null, true);
- }
- if (@isset($this->_properties[$property])) {
- if (empty($this->_validator)) {
- $valid = true;
- } else {
- $valid = @call_user_func($this->_validator,
- $this->_table,
- $property,
- $newvalue,
- $this->$property,
- $this);
- }
- if ($valid) {
- $this->$property = $newvalue;
- if (empty($this->_changes[$property])) {
- $this->_changes[$property] = 0;
- } else {
- $this->_changes[$property]++;
- }
- } else {
- return $this->raiseError(null, DB_ERROR_INVALID, null,
- null, "invalid field: $property",
- null, true);
- }
- return true;
- }
- return $this->raiseError(null, DB_ERROR_NOSUCHFIELD, null,
- null, "unknown field: $property",
- null, true);
- }
-
- // }}}
- // {{{ &get()
-
- /**
- * Fetch an attribute value.
- *
- * @param string attribute name
- *
- * @return attribute contents, or null if the attribute name is
- * unknown
- */
- function &get($property)
- {
- // only return if $property is known
- if (isset($this->_properties[$property])) {
- return $this->$property;
- }
- $tmp = null;
- return $tmp;
- }
-
- // }}}
- // {{{ _DB_storage()
-
- /**
- * Destructor, calls DB_storage::store() if there are changes
- * that are to be kept.
- */
- function _DB_storage()
- {
- if (sizeof($this->_changes)) {
- $this->store();
- }
- $this->_properties = array();
- $this->_changes = array();
- $this->_table = null;
- }
-
- // }}}
- // {{{ store()
-
- /**
- * Stores changes to this object in the database.
- *
- * @return DB_OK or a DB error
- */
- function store()
- {
- $params = array();
- $vars = array();
- foreach ($this->_changes as $name => $foo) {
- $params[] = &$this->$name;
- $vars[] = $name . ' = ?';
- }
- if ($vars) {
- $query = 'UPDATE ' . $this->_table . ' SET ' .
- implode(', ', $vars) . ' WHERE ' .
- $this->_makeWhere();
- $stmt = $this->_dbh->prepare($query);
- $res = $this->_dbh->execute($stmt, $params);
- if (DB::isError($res)) {
- return $res;
- }
- $this->_changes = array();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ remove()
-
- /**
- * Remove the row represented by this object from the database.
- *
- * @return mixed DB_OK or a DB error
- */
- function remove()
- {
- if ($this->_readonly) {
- return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
- null, null, null, true);
- }
- $query = 'DELETE FROM ' . $this->_table .' WHERE '.
- $this->_makeWhere();
- $res = $this->_dbh->query($query);
- if (DB::isError($res)) {
- return $res;
- }
- foreach ($this->_properties as $prop => $foo) {
- unset($this->$prop);
- }
- $this->_properties = array();
- $this->_changes = array();
- return DB_OK;
- }
-
- // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/DB/sybase.php b/airtime_mvc/library/pear/DB/sybase.php
deleted file mode 100644
index bb79c78c2..000000000
--- a/airtime_mvc/library/pear/DB/sybase.php
+++ /dev/null
@@ -1,942 +0,0 @@
-
- * @author Antônio Carlos Venâncio Júnior
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: sybase.php,v 1.87 2007/09/21 13:40:42 aharvey Exp $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's sybase extension
- * for interacting with Sybase databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * WARNING: This driver may fail with multiple connections under the
- * same user/pass/host and different databases.
- *
- * @category Database
- * @package DB
- * @author Sterling Hughes
- * @author Antônio Carlos Venâncio Júnior
- * @author Daniel Convissor
- * @copyright 1997-2007 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.7.13
- * @link http://pear.php.net/package/DB
- */
-class DB_sybase extends DB_common
-{
- // {{{ properties
-
- /**
- * The DB driver type (mysql, oci8, odbc, etc.)
- * @var string
- */
- var $phptype = 'sybase';
-
- /**
- * The database syntax variant to be used (db2, access, etc.), if any
- * @var string
- */
- var $dbsyntax = 'sybase';
-
- /**
- * The capabilities of this DB implementation
- *
- * The 'new_link' element contains the PHP version that first provided
- * new_link support for this DBMS. Contains false if it's unsupported.
- *
- * Meaning of the 'limit' element:
- * + 'emulate' = emulate with fetch row by number
- * + 'alter' = alter the query
- * + false = skip rows
- *
- * @var array
- */
- var $features = array(
- 'limit' => 'emulate',
- 'new_link' => false,
- 'numrows' => true,
- 'pconnect' => true,
- 'prepare' => false,
- 'ssl' => false,
- 'transactions' => true,
- );
-
- /**
- * A mapping of native error codes to DB error codes
- * @var array
- */
- var $errorcode_map = array(
- );
-
- /**
- * The raw database connection created by PHP
- * @var resource
- */
- var $connection;
-
- /**
- * The DSN information for connecting to a database
- * @var array
- */
- var $dsn = array();
-
-
- /**
- * Should data manipulation queries be committed automatically?
- * @var bool
- * @access private
- */
- var $autocommit = true;
-
- /**
- * The quantity of transactions begun
- *
- * {@internal While this is private, it can't actually be designated
- * private in PHP 5 because it is directly accessed in the test suite.}}
- *
- * @var integer
- * @access private
- */
- var $transaction_opcount = 0;
-
- /**
- * The database specified in the DSN
- *
- * It's a fix to allow calls to different databases in the same script.
- *
- * @var string
- * @access private
- */
- var $_db = '';
-
-
- // }}}
- // {{{ constructor
-
- /**
- * This constructor calls $this->DB_common()
- *
- * @return void
- */
- function DB_sybase()
- {
- $this->DB_common();
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database server, log in and open the database
- *
- * Don't call this method directly. Use DB::connect() instead.
- *
- * PEAR DB's sybase driver supports the following extra DSN options:
- * + appname The application name to use on this connection.
- * Available since PEAR DB 1.7.0.
- * + charset The character set to use on this connection.
- * Available since PEAR DB 1.7.0.
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('sybase') &&
- !PEAR::loadExtension('sybase_ct'))
- {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $dsn['hostspec'] = $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost';
- $dsn['password'] = !empty($dsn['password']) ? $dsn['password'] : false;
- $dsn['charset'] = isset($dsn['charset']) ? $dsn['charset'] : false;
- $dsn['appname'] = isset($dsn['appname']) ? $dsn['appname'] : false;
-
- $connect_function = $persistent ? 'sybase_pconnect' : 'sybase_connect';
-
- if ($dsn['username']) {
- $this->connection = @$connect_function($dsn['hostspec'],
- $dsn['username'],
- $dsn['password'],
- $dsn['charset'],
- $dsn['appname']);
- } else {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- 'The DSN did not contain a username.');
- }
-
- if (!$this->connection) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- @sybase_get_last_message());
- }
-
- if ($dsn['database']) {
- if (!@sybase_select_db($dsn['database'], $this->connection)) {
- return $this->raiseError(DB_ERROR_NODBSELECTED,
- null, null, null,
- @sybase_get_last_message());
- }
- $this->_db = $dsn['database'];
- }
-
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @sybase_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = $this->_checkManip($query);
- $this->last_query = $query;
- if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
- return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
- }
- $query = $this->modifyQuery($query);
- if (!$this->autocommit && $ismanip) {
- if ($this->transaction_opcount == 0) {
- $result = @sybase_query('BEGIN TRANSACTION', $this->connection);
- if (!$result) {
- return $this->sybaseRaiseError();
- }
- }
- $this->transaction_opcount++;
- }
- $result = @sybase_query($query, $this->connection);
- if (!$result) {
- return $this->sybaseRaiseError();
- }
- if (is_resource($result)) {
- return $result;
- }
- // Determine which queries that should return data, and which
- // should return an error code only.
- return $ismanip ? DB_OK : $result;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal sybase result pointer to the next available result
- *
- * @param a valid sybase result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- if ($rownum !== null) {
- if (!@sybase_data_seek($result, $rownum)) {
- return null;
- }
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- if (function_exists('sybase_fetch_assoc')) {
- $arr = @sybase_fetch_assoc($result);
- } else {
- if ($arr = @sybase_fetch_array($result)) {
- foreach ($arr as $key => $value) {
- if (is_int($key)) {
- unset($arr[$key]);
- }
- }
- }
- }
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @sybase_fetch_row($result);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- return is_resource($result) ? sybase_free_result($result) : false;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @sybase_num_fields($result);
- if (!$cols) {
- return $this->sybaseRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @sybase_num_rows($result);
- if ($rows === false) {
- return $this->sybaseRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- if ($this->_last_query_manip) {
- $result = @sybase_affected_rows($this->connection);
- } else {
- $result = 0;
- }
- return $result;
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_sybase::createSequence(), DB_sybase::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
- return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
- }
- $repeat = 0;
- do {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result) &&
- ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
- {
- $repeat = 1;
- $result = $this->createSequence($seq_name);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- } elseif (!DB::isError($result)) {
- $result = $this->query("SELECT @@IDENTITY FROM $seqname");
- $repeat = 0;
- } else {
- $repeat = false;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
- return $result[0];
- }
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_sybase::nextID(), DB_sybase::dropSequence()
- */
- function createSequence($seq_name)
- {
- return $this->query('CREATE TABLE '
- . $this->getSequenceName($seq_name)
- . ' (id numeric(10, 0) IDENTITY NOT NULL,'
- . ' vapor int NULL)');
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_sybase::nextID(), DB_sybase::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ quoteFloat()
-
- /**
- * Formats a float value for use within a query in a locale-independent
- * manner.
- *
- * @param float the float value to be quoted.
- * @return string the quoted string.
- * @see DB_common::quoteSmart()
- * @since Method available since release 1.7.8.
- */
- function quoteFloat($float) {
- return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- // XXX if $this->transaction_opcount > 0, we should probably
- // issue a warning here.
- $this->autocommit = $onoff ? true : false;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if ($this->transaction_opcount > 0) {
- if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
- return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
- }
- $result = @sybase_query('COMMIT', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->sybaseRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if ($this->transaction_opcount > 0) {
- if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
- return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
- }
- $result = @sybase_query('ROLLBACK', $this->connection);
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->sybaseRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ sybaseRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_sybase::errorNative(), DB_sybase::errorCode()
- */
- function sybaseRaiseError($errno = null)
- {
- $native = $this->errorNative();
- if ($errno === null) {
- $errno = $this->errorCode($native);
- }
- return $this->raiseError($errno, null, null, null, $native);
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error message produced by the last query
- *
- * @return string the DBMS' error message
- */
- function errorNative()
- {
- return @sybase_get_last_message();
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Determines PEAR::DB error code from the database's text error message.
- *
- * @param string $errormsg error message returned from the database
- * @return integer an error number from a DB error constant
- */
- function errorCode($errormsg)
- {
- static $error_regexps;
-
- // PHP 5.2+ prepends the function name to $php_errormsg, so we need
- // this hack to work around it, per bug #9599.
- $errormsg = preg_replace('/^sybase[a-z_]+\(\): /', '', $errormsg);
-
- if (!isset($error_regexps)) {
- $error_regexps = array(
- '/Incorrect syntax near/'
- => DB_ERROR_SYNTAX,
- '/^Unclosed quote before the character string [\"\'].*[\"\']\./'
- => DB_ERROR_SYNTAX,
- '/Implicit conversion (from datatype|of NUMERIC value)/i'
- => DB_ERROR_INVALID_NUMBER,
- '/Cannot drop the table [\"\'].+[\"\'], because it doesn\'t exist in the system catalogs\./'
- => DB_ERROR_NOSUCHTABLE,
- '/Only the owner of object [\"\'].+[\"\'] or a user with System Administrator \(SA\) role can run this command\./'
- => DB_ERROR_ACCESS_VIOLATION,
- '/^.+ permission denied on object .+, database .+, owner .+/'
- => DB_ERROR_ACCESS_VIOLATION,
- '/^.* permission denied, database .+, owner .+/'
- => DB_ERROR_ACCESS_VIOLATION,
- '/[^.*] not found\./'
- => DB_ERROR_NOSUCHTABLE,
- '/There is already an object named/'
- => DB_ERROR_ALREADY_EXISTS,
- '/Invalid column name/'
- => DB_ERROR_NOSUCHFIELD,
- '/does not allow null values/'
- => DB_ERROR_CONSTRAINT_NOT_NULL,
- '/Command has been aborted/'
- => DB_ERROR_CONSTRAINT,
- '/^Cannot drop the index .* because it doesn\'t exist/i'
- => DB_ERROR_NOT_FOUND,
- '/^There is already an index/i'
- => DB_ERROR_ALREADY_EXISTS,
- '/^There are fewer columns in the INSERT statement than values specified/i'
- => DB_ERROR_VALUE_COUNT_ON_ROW,
- '/Divide by zero/i'
- => DB_ERROR_DIVZERO,
- );
- }
-
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $errormsg)) {
- return $code;
- }
- }
- return DB_ERROR;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if $result
- * is a table name.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- * @since Method available since Release 1.6.0
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
- return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
- }
- $id = @sybase_query("SELECT * FROM $result WHERE 1=0",
- $this->connection);
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->sybaseRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @sybase_num_fields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $f = @sybase_fetch_field($id, $i);
- // column_source is often blank
- $res[$i] = array(
- 'table' => $got_string
- ? $case_func($result)
- : $case_func($f->column_source),
- 'name' => $case_func($f->name),
- 'type' => $f->type,
- 'len' => $f->max_length,
- 'flags' => '',
- );
- if ($res[$i]['table']) {
- $res[$i]['flags'] = $this->_sybase_field_flags(
- $res[$i]['table'], $res[$i]['name']);
- }
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @sybase_free_result($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ _sybase_field_flags()
-
- /**
- * Get the flags for a field
- *
- * Currently supports:
- * + unique_key (unique index, unique check or primary_key)
- * + multiple_key (multi-key index)
- *
- * @param string $table the table name
- * @param string $column the field name
- *
- * @return string space delimited string of flags. Empty string if none.
- *
- * @access private
- */
- function _sybase_field_flags($table, $column)
- {
- static $tableName = null;
- static $flags = array();
-
- if ($table != $tableName) {
- $flags = array();
- $tableName = $table;
-
- /* We're running sp_helpindex directly because it doesn't exist in
- * older versions of ASE -- unfortunately, we can't just use
- * DB::isError() because the user may be using callback error
- * handling. */
- $res = @sybase_query("sp_helpindex $table", $this->connection);
-
- if ($res === false || $res === true) {
- // Fake a valid response for BC reasons.
- return '';
- }
-
- while (($val = sybase_fetch_assoc($res)) !== false) {
- if (!isset($val['index_keys'])) {
- /* No useful information returned. Break and be done with
- * it, which preserves the pre-1.7.9 behaviour. */
- break;
- }
-
- $keys = explode(', ', trim($val['index_keys']));
-
- if (sizeof($keys) > 1) {
- foreach ($keys as $key) {
- $this->_add_flag($flags[$key], 'multiple_key');
- }
- }
-
- if (strpos($val['index_description'], 'unique')) {
- foreach ($keys as $key) {
- $this->_add_flag($flags[$key], 'unique_key');
- }
- }
- }
-
- sybase_free_result($res);
-
- }
-
- if (array_key_exists($column, $flags)) {
- return(implode(' ', $flags[$column]));
- }
-
- return '';
- }
-
- // }}}
- // {{{ _add_flag()
-
- /**
- * Adds a string to the flags array if the flag is not yet in there
- * - if there is no flag present the array is created
- *
- * @param array $array reference of flags array to add a value to
- * @param mixed $value value to add to the flag array
- *
- * @return void
- *
- * @access private
- */
- function _add_flag(&$array, $value)
- {
- if (!is_array($array)) {
- $array = array($value);
- } elseif (!in_array($value, $array)) {
- array_push($array, $value);
- }
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return "SELECT name FROM sysobjects WHERE type = 'U'"
- . ' ORDER BY name';
- case 'views':
- return "SELECT name FROM sysobjects WHERE type = 'V'";
- default:
- return null;
- }
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/File.php b/airtime_mvc/library/pear/File.php
deleted file mode 100644
index d3c311116..000000000
--- a/airtime_mvc/library/pear/File.php
+++ /dev/null
@@ -1,543 +0,0 @@
-
- * @author Tal Peer
- * @author Michael Wallner
- * @copyright 2002-2005 The Authors
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: File.php,v 1.38 2007/03/24 16:38:56 dufuz Exp $
- * @link http://pear.php.net/package/File
- */
-
-/**
- * Requires PEAR
- */
-require_once 'PEAR.php';
-
-/**
- * The default number of bytes for reading
- */
-if (!defined('FILE_DEFAULT_READSIZE')) {
- define('FILE_DEFAULT_READSIZE', 1024, true);
-}
-
-/**
- * The maximum number of bytes for reading lines
- */
-if (!defined('FILE_MAX_LINE_READSIZE')) {
- define('FILE_MAX_LINE_READSIZE', 40960, true);
-}
-
-/**
- * Whether file locks should block
- */
-if (!defined('FILE_LOCKS_BLOCK')) {
- define('FILE_LOCKS_BLOCK', true, true);
-}
-
-/**
- * Mode to use for reading from files
- */
-define('FILE_MODE_READ', 'rb', true);
-
-/**
- * Mode to use for truncating files, then writing
- */
-define('FILE_MODE_WRITE', 'wb', true);
-
-/**
- * Mode to use for appending to files
- */
-define('FILE_MODE_APPEND', 'ab', true);
-
-/**
- * Use this when a shared (read) lock is required
- */
-define('FILE_LOCK_SHARED', LOCK_SH | (FILE_LOCKS_BLOCK ? 0 : LOCK_NB), true);
-
-/**
- * Use this when an exclusive (write) lock is required
- */
-define('FILE_LOCK_EXCLUSIVE', LOCK_EX | (FILE_LOCKS_BLOCK ? 0 : LOCK_NB), true);
-
-/**
- * Class for handling files
- *
- * A class with common functions for writing,
- * reading and handling files and directories
- *
- * @author Richard Heyes
- * @author Tal Peer
- * @author Michael Wallner
- * @access public
- * @package File
- *
- * @static
- */
-class File extends PEAR
-{
- /**
- * Destructor
- *
- * Unlocks any locked file pointers and closes all filepointers
- *
- * @access private
- */
- function _File()
- {
- File::closeAll();
- }
-
- /**
- * Handles file pointers. If a file pointer needs to be opened,
- * it will be. If it already exists (based on filename and mode)
- * then the existing one will be returned.
- *
- * @access private
- * @param string $filename Filename to be used
- * @param string $mode Mode to open the file in
- * @param mixed $lock Type of lock to use
- * @return mixed PEAR_Error on error or file pointer resource on success
- */
- function _getFilePointer($filename, $mode, $lock = false)
- {
- $filePointers = &PEAR::getStaticProperty('File', 'filePointers');
-
- // Win32 is case-insensitive
- if (OS_WINDOWS) {
- $filename = strtolower($filename);
- }
-
- // check if file pointer already exists
- if (!isset($filePointers[$filename][$mode]) ||
- !is_resource($filePointers[$filename][$mode])) {
-
- // check if we can open the file in the desired mode
- switch ($mode)
- {
- case FILE_MODE_READ:
- if (!preg_match('/^.+(? $modes) {
- foreach (array_keys($modes) as $mode) {
- if (is_resource($filePointers[$fname][$mode])) {
- @fclose($filePointers[$fname][$mode]);
- }
- unset($filePointers[$fname][$mode]);
- }
- }
- }
- }
-
- /**
- * This closes an open file pointer
- *
- * @access public
- * @param string $filename The filename that was opened
- * @param string $mode Mode the file was opened in
- * @return mixed PEAR Error on error, true otherwise
- */
- function close($filename, $mode)
- {
- $filePointers = &PEAR::getStaticProperty('File', 'filePointers');
-
- if (OS_WINDOWS) {
- $filename = strToLower($filename);
- }
-
- if (!isset($filePointers[$filename][$mode])) {
- return true;
- }
-
- $fp = $filePointers[$filename][$mode];
- unset($filePointers[$filename][$mode]);
-
- if (is_resource($fp)) {
- // unlock file
- @flock($fp, LOCK_UN);
- // close file
- if (!@fclose($fp)) {
- return PEAR::raiseError("Cannot close file: $filename");
- }
- }
-
- return true;
- }
-
- /**
- * This unlocks a locked file pointer.
- *
- * @access public
- * @param string $filename The filename that was opened
- * @param string $mode Mode the file was opened in
- * @return mixed PEAR Error on error, true otherwise
- */
- function unlock($filename, $mode)
- {
- $fp = File::_getFilePointer($filename, $mode);
- if (PEAR::isError($fp)) {
- return $fp;
- }
-
- if (!@flock($fp, LOCK_UN)) {
- return PEAR::raiseError("Cacnnot unlock file: $filename");
- }
-
- return true;
- }
-
- /**
- * @deprecated
- */
- function stripTrailingSeparators($path, $separator = DIRECTORY_SEPARATOR)
- {
- if ($path === $separator) {
- return $path;
- }
- return rtrim($path, $separator);
- }
-
- /**
- * @deprecated
- */
- function stripLeadingSeparators($path, $separator = DIRECTORY_SEPARATOR)
- {
- if ($path === $separator) {
- return $path;
- }
- return ltrim($path, $separator);
- }
-
- /**
- * @deprecated Use File_Util::buildPath() instead.
- */
- function buildPath($parts, $separator = DIRECTORY_SEPARATOR)
- {
- require_once 'File/Util.php';
- return File_Util::buildPath($parts, $separator);
- }
-
- /**
- * @deprecated Use File_Util::skipRoot() instead.
- */
- function skipRoot($path)
- {
- require_once 'File/Util.php';
- return File_Util::skipRoot($path);
- }
-
- /**
- * @deprecated Use File_Util::tmpDir() instead.
- */
- function getTempDir()
- {
- require_once 'File/Util.php';
- return File_Util::tmpDir();
- }
-
- /**
- * @deprecated Use File_Util::tmpFile() instead.
- */
- function getTempFile($dirname = null)
- {
- require_once 'File/Util.php';
- return File_Util::tmpFile($dirname);
- }
-
- /**
- * @deprecated Use File_Util::isAbsolute() instead.
- */
- function isAbsolute($path)
- {
- require_once 'File/Util.php';
- return File_Util::isAbsolute($path);
- }
-
- /**
- * @deprecated Use File_Util::relativePath() instead.
- */
- function relativePath($path, $root, $separator = DIRECTORY_SEPARATOR)
- {
- require_once 'File/Util.php';
- return File_Util::relativePath($path, $root, $separator);
- }
-
- /**
- * @deprecated Use File_Util::realpath() instead.
- */
- function realpath($path, $separator = DIRECTORY_SEPARATOR)
- {
- require_once 'File/Util.php';
- return File_Util::realpath($path, $separator);
- }
-}
-
-PEAR::registerShutdownFunc(array('File', '_File'));
-
-?>
diff --git a/airtime_mvc/library/pear/File/CSV.php b/airtime_mvc/library/pear/File/CSV.php
deleted file mode 100644
index a4c5141c9..000000000
--- a/airtime_mvc/library/pear/File/CSV.php
+++ /dev/null
@@ -1,628 +0,0 @@
-
- * @author Helgi Þormar
- * @copyright 2004-2005 The Authors
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: CSV.php,v 1.41 2007/05/20 12:25:14 dufuz Exp $
- * @link http://pear.php.net/package/File
- */
-
-require_once 'PEAR.php';
-require_once 'File.php';
-
-/**
-* File class for handling CSV files (Comma Separated Values), a common format
-* for exchanging data.
-*
-* TODO:
-* - Usage example and Doc
-* - Use getPointer() in discoverFormat
-* - Add a line counter for being able to output better error reports
-* - Store the last error in GLOBALS and add File_CSV::getLastError()
-*
-* Wish:
-* - Other methods like readAll(), writeAll(), numFields(), numRows()
-* - Try to detect if a CSV has header or not in discoverFormat() (not possible with CSV)
-*
-* Known Bugs:
-* (they has been analyzed but for the moment the impact in the speed for
-* properly handle this uncommon cases is too high and won't be supported)
-* - A field which is composed only by a single quoted separator (ie -> ;";";)
-* is not handled properly
-* - When there is exactly one field minus than the expected number and there
-* is a field with a separator inside, the parser will throw the "wrong count" error
-*
-* Info about CSV and links to other sources
-* http://www.shaftek.org/publications/drafts/mime-csv/draft-shafranovich-mime-csv-00.html#appendix
-*
-* @author Tomas V.V.Cox
-* @author Helgi Þormar
-* @package File
-*/
-class File_CSV
-{
- /**
- * This raiseError method works in a different way. It will always return
- * false (an error occurred) but it will call PEAR::raiseError() before
- * it. If no default PEAR global handler is set, will trigger an error.
- *
- * @param string $error The error message
- * @return bool always false
- */
- function raiseError($error)
- {
- // If a default PEAR Error handler is not set trigger the error
- // XXX Add a PEAR::isSetHandler() method?
- if ($GLOBALS['_PEAR_default_error_mode'] == PEAR_ERROR_RETURN) {
- PEAR::raiseError($error, null, PEAR_ERROR_TRIGGER, E_USER_WARNING);
- } else {
- PEAR::raiseError($error);
- }
- return false;
- }
-
- /**
- * Checks the configuration given by the user
- *
- * @access private
- * @param string &$error The error will be written here if any
- * @param array &$conf The configuration assoc array
- * @return string error Returns a error message
- */
- function _conf(&$error, &$conf)
- {
- // check conf
- if (!is_array($conf)) {
- return $error = 'Invalid configuration';
- }
-
- if (!isset($conf['fields']) || !(int)$conf['fields']) {
- return $error = 'The number of fields must be numeric (the "fields" key)';
- }
-
- if (isset($conf['sep'])) {
- if (strlen($conf['sep']) != 1) {
- return $error = 'Separator can only be one char';
- }
- } elseif ($conf['fields'] > 1) {
- return $error = 'Missing separator (the "sep" key)';
- }
-
- if (isset($conf['quote'])) {
- if (strlen($conf['quote']) != 1) {
- return $error = 'The quote char must be one char (the "quote" key)';
- }
- } else {
- $conf['quote'] = null;
- }
-
- if (!isset($conf['crlf'])) {
- $conf['crlf'] = "\n";
- }
-
- if (!isset($conf['eol2unix'])) {
- $conf['eol2unix'] = true;
- }
- }
-
- /**
- * Return or create the file descriptor associated with a file
- *
- * @param string $file The name of the file
- * @param array &$conf The configuration
- * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE)
- * @param boolean $reset if passed as true and resource for the file exists
- * than the file pointer will be moved to the beginning
- *
- * @return mixed A file resource or false
- */
- function getPointer($file, &$conf, $mode = FILE_MODE_READ, $reset = false)
- {
- static $resources = array();
- static $config;
- if (isset($resources[$file][$mode])) {
- $conf = $config;
- if ($reset) {
- fseek($resources[$file][$mode], 0);
- }
- return $resources[$file][$mode];
- }
- File_CSV::_conf($error, $conf);
- if ($error) {
- return File_CSV::raiseError($error);
- }
- $config = $conf;
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $fp = File::_getFilePointer($file, $mode);
- PEAR::popErrorHandling();
- if (PEAR::isError($fp)) {
- return File_CSV::raiseError($fp);
- }
- $resources[$file][$mode] = $fp;
- return $fp;
- }
-
- /**
- * Unquote data
- *
- * @param string $field The data to unquote
- * @param string $quote The quote char
- * @return string the unquoted data
- */
- function unquote($field, $quote)
- {
- // Trim first the string.
- $field = trim($field);
- $quote = trim($quote);
-
- // Incase null fields (form: ;;)
- if (!strlen($field)) {
- return $field;
- }
-
- // excel compat
- if ($field[0] == '=' && $field[1] == '"') {
- $field = str_replace('="', '"', $field);
- }
-
- $field_len = strlen($field);
- if ($quote && $field[0] == $quote && $field[$field_len - 1] == $quote) {
- // Get rid of escaping quotes
- $new = $prev = $c = '';
- for ($i = 0; $i < $field_len; ++$i) {
- $prev = $c;
- $c = $field[$i];
- // Deal with escaping quotes
- if ($c == $quote && $prev == $quote) {
- $c = '';
- }
-
- $new .= $c;
- }
- $field = substr($new, 1, -1);
- }
-
- return $field;
- }
-
- /**
- * Reads a row of data as an array from a CSV file. It's able to
- * read memo fields with multiline data.
- *
- * @param string $file The filename where to write the data
- * @param array &$conf The configuration of the dest CSV
- *
- * @return mixed Array with the data read or false on error/no more data
- */
- function readQuoted($file, &$conf)
- {
- if (!$fp = File_CSV::getPointer($file, $conf, FILE_MODE_READ)) {
- return false;
- }
-
- $buff = $old = $prev = $c = '';
- $ret = array();
- $i = 1;
- $in_quote = false;
- $quote = $conf['quote'];
- $f = $conf['fields'];
- $sep = $conf['sep'];
- while (false !== $ch = fgetc($fp)) {
- $old = $prev;
- $prev = $c;
- $c = $ch;
-
- // Common case
- if ($c != $quote && $c != $sep && $c != "\n" && $c != "\r") {
- $buff .= $c;
- continue;
- }
-
- // Start quote.
- if (
- $in_quote === false &&
- $quote && $c == $quote &&
- (
- $prev == $sep || $prev == "\n" || $prev === null ||
- $prev == "\r" || $prev == '' || $prev == ' '
- || $prev == '=' //excel compat
- )
- ) {
- $in_quote = true;
- // excel compat, removing the = part but only if we are in a quote
- if ($prev == '=') {
- $buff{strlen($buff) - 1} = '';
- }
- }
-
- if ($in_quote) {
-
- // When does the quote end, make sure it's not double quoted
- if ($c == $sep && $prev == $quote && $old != $quote) {
- $in_quote = false;
- } elseif ($c == $sep && $buff == $quote.$quote) {
- // In case we are dealing with double quote but empty value
- $in_quote = false;
- } elseif ($c == "\n" || $c == "\r") {
- $sub = ($prev == "\r") ? 2 : 1;
- $buff_len = strlen($buff);
- if (
- $buff_len >= $sub &&
- $buff[$buff_len - $sub] == $quote
- ) {
- $in_quote = false;
- }
- }
- }
-
- if (!$in_quote && ($c == $sep || $c == "\n" || $c == "\r") && $prev != '') {
- // More fields than expected
- if ($c == $sep && (count($ret) + 1) == $f) {
- // Seek the pointer into linebreak character.
- while (true) {
- $c = fgetc($fp);
- if ($c == "\n" || $c == "\r" || $c == '') {
- break;
- }
- }
-
- // Insert last field value.
- $ret[] = File_CSV::unquote($buff, $quote);
- return $ret;
- }
-
- // Less fields than expected
- if (($c == "\n" || $c == "\r") && $i != $f) {
- // Insert last field value.
- $ret[] = File_CSV::unquote($buff, $quote);
- if (count($ret) == 1 && empty($ret[0])) {
- return array();
- }
-
- // Pair the array elements to fields count. - inserting empty values
- $ret_count = count($ret);
- $sum = ($f - 1) - ($ret_count - 1);
- $data = array_merge($ret, array_fill($ret_count, $sum, ''));
- return $data;
- }
-
- if ($prev == "\r") {
- $buff = substr($buff, 0, -1);
- }
-
- // Convert EOL character to Unix EOL (LF).
- if ($conf['eol2unix']) {
- $buff = preg_replace('/(\r\n|\r)$/', "\n", $buff);
- }
-
- $ret[] = File_CSV::unquote($buff, $quote);
- if (count($ret) == $f) {
- return $ret;
- }
- $buff = '';
- ++$i;
- continue;
- }
- $buff .= $c;
- }
-
- /* If it's the end of the file and we still have something in buffer
- * then we process it since files can have no CL/FR at the end
- */
- $feof = feof($fp);
- if ($feof && !in_array($buff, array("\r", "\n", "\r\n")) && strlen($buff) > 0) {
- $ret[] = File_CSV::unquote($buff, $quote);
- if (count($ret) == $f) {
- return $ret;
- }
- }
-
- return !$feof ? $ret : false;
- }
-
- /**
- * Reads a "row" from a CSV file and return it as an array
- *
- * @param string $file The CSV file
- * @param array &$conf The configuration of the dest CSV
- *
- * @return mixed Array or false
- */
- function read($file, &$conf)
- {
- static $headers = array();
- if (!$fp = File_CSV::getPointer($file, $conf, FILE_MODE_READ)) {
- return false;
- }
-
- // The size is limited to 4K
- if (!$line = fgets($fp, 4096)) {
- return false;
- }
-
- $fields = $conf['fields'] == 1 ? array($line) : explode($conf['sep'], $line);
-
- $nl = array("\n", "\r", "\r\n");
- if (in_array($fields[count($fields) - 1], $nl)) {
- array_pop($fields);
- }
-
- $field_count = count($fields);
- $last =& $fields[$field_count - 1];
- $len = strlen($last);
- if (
- $field_count != $conf['fields'] ||
- $conf['quote'] &&
- (
- $len !== 0 && $last[$len - 1] == "\n"
- &&
- (
- ($last[0] == $conf['quote']
- && $last[strlen(rtrim($last)) - 1] != $conf['quote'])
- ||
- // excel support
- ($last[0] == '=' && $last[1] == $conf['quote'])
- ||
- // if the row has spaces before the quote
- preg_match('|^\s+'.preg_quote($conf['quote']) .'|Ums', $last, $match)
- )
- )
- // XXX perhaps there is a separator inside a quoted field
- //preg_match("|{$conf['quote']}.*{$conf['sep']}.*{$conf['quote']}|U", $line)
- ) {
- fseek($fp, -1 * strlen($line), SEEK_CUR);
- return File_CSV::readQuoted($file, $conf);
- } else {
- foreach ($fields as $k => $v) {
- $fields[$k] = File_CSV::unquote($v, $conf['quote']);
- }
- }
-
- if (isset($conf['header']) && empty($headers)) {
- // read the first row and assign to $headers
- $headers = $fields;
- return $headers;
- }
-
- if ($field_count != $conf['fields']) {
- File_CSV::raiseError("Read wrong fields number count: '". $field_count .
- "' expected ".$conf['fields']);
- return true;
- }
-
- if (!empty($headers)) {
- $tmp = array();
- foreach ($fields as $k => $v) {
- $tmp[$headers[$k]] = $v;
- }
- $fields = $tmp;
- }
-
- return $fields;
- }
-
- /**
- * Internal use only, will be removed in the future
- *
- * @param string $str The string to debug
- * @access private
- */
- function _dbgBuff($str)
- {
- if (strpos($str, "\r") !== false) {
- $str = str_replace("\r", "_r_", $str);
- }
- if (strpos($str, "\n") !== false) {
- $str = str_replace("\n", "_n_", $str);
- }
- if (strpos($str, "\t") !== false) {
- $str = str_replace("\t", "_t_", $str);
- }
- if ($str === null) {
- $str = '_NULL_';
- }
- if ($str === '') {
- $str = 'Empty string';
- }
- echo "buff: ($str)\n";
- }
-
- /**
- * Writes a struc (array) in a file as CSV
- *
- * @param string $file The filename where to write the data
- * @param array $fields Ordered array with the data
- * @param array &$conf The configuration of the dest CSV
- *
- * @return bool True on success false otherwise
- */
- function write($file, $fields, &$conf)
- {
- if (!$fp = File_CSV::getPointer($file, $conf, FILE_MODE_WRITE)) {
- return false;
- }
-
- $field_count = count($fields);
- if ($field_count != $conf['fields']) {
- File_CSV::raiseError("Wrong fields number count: '". $field_count .
- "' expected ".$conf['fields']);
- return true;
- }
-
- $write = '';
- for ($i = 0; $i < $field_count; ++$i) {
- // only quote if the field contains a sep
- if (!is_numeric($fields[$i]) && $conf['quote']
- && isset($conf['sep']) && strpos($fields[$i], $conf['sep'])
- ) {
- $write .= $conf['quote'] . $fields[$i] . $conf['quote'];
- } else {
- $write .= $fields[$i];
- }
-
- $write .= ($i < ($field_count - 1)) ? $conf['sep']: $conf['crlf'];
- }
-
- if (!fwrite($fp, $write, strlen($write))) {
- return File_CSV::raiseError('Can not write to file');
- }
-
- return true;
- }
-
- /**
- * Discover the format of a CSV file (the number of fields, the separator
- * and if it quote string fields)
- *
- * @param string the CSV file name
- * @param array extra separators that should be checked for.
- * @return mixed Assoc array or false
- */
- function discoverFormat($file, $extraSeps = array())
- {
- if (!$fp = @fopen($file, 'rb')) {
- return File_CSV::raiseError("Could not open file: $file");
- }
-
- // Set auto detect line ending for Mac EOL support
- $oldini = ini_get('auto_detect_line_endings');
- if ($oldini != '1') {
- ini_set('auto_detect_line_endings', '1');
- }
-
- // Take the first 30 lines and store the number of ocurrences
- // for each separator in each line
- $lines = '';
- for ($i = 0; $i < 30 && $line = fgets($fp, 4096); $i++) {
- $lines .= $line;
- }
- fclose($fp);
-
- if ($oldini != '1') {
- ini_set('auto_detect_line_endings', $oldini);
- }
-
- $seps = array("\t", ';', ':', ',');
- $seps = array_merge($seps, $extraSeps);
- $matches = array();
- $quotes = '"\'';
-
- $lines = str_replace('""', '', $lines);
- while ($lines != ($newLines = preg_replace('|((["\'])[^"]*(\2))|', '\2_\2', $lines))){
- $lines = $newLines;
- }
-
- $eol = strpos($lines, "\r") ? "\r" : "\n";
- $lines = explode($eol, $lines);
- foreach ($lines as $line) {
- $orgLine = $line;
- foreach ($seps as $sep) {
- $line = preg_replace("|^[^$quotes$sep]*$sep*([$quotes][^$quotes]*[$quotes])|sm", '_', $orgLine);
- // Find all seps that are within qoutes
- ///FIXME ... counts legitimit lines as bad ones
-
- // In case there's a whitespace infront the field
- $regex = '|\s*?';
- // Match the first quote (optional), also optionally match = since it's excel stuff
- $regex.= "(?:\=?[$quotes])";
- $regex.= '(.*';
- // Don't match a sep if we are inside a quote
- // also don't accept the sep if it has a quote on the either side
- ///FIXME has to be possible if we are inside a quote! (tests fail because of this)
- $regex.= "(?:[^$quotes])$sep(?:[^$quotes])";
- $regex.= '.*)';
- // Close quote (if it's present) and the sep (optional, could be end of line)
- $regex.= "(?:[$quotes](?:$sep?))|Ums";
- preg_match_all($regex, $line, $match);
- // Finding all seps, within quotes or not
- $sep_count = substr_count($line, $sep);
- // Real count
- $matches[$sep][] = $sep_count - count($match[0]);
- }
- }
-
- $final = array();
- // Group the results by amount of equal ocurrences
- foreach ($matches as $sep => $res) {
- $times = array();
- $times[0] = 0;
- foreach ($res as $k => $num) {
- if ($num > 0) {
- $times[$num] = (isset($times[$num])) ? $times[$num] + 1 : 1;
- }
- }
- arsort($times);
-
- // Use max fields count.
- $fields[$sep] = max(array_flip($times));
- $amount[$sep] = $times[key($times)];
- }
-
- arsort($amount);
- $sep = key($amount);
-
- $conf['fields'] = $fields[$sep] + 1;
- $conf['sep'] = $sep;
-
- // Test if there are fields with quotes around in the first 30 lines
- $quote = null;
-
- $string = implode('', $lines);
- foreach (array('"', '\'') as $q) {
- if (preg_match_all("|$sep(?:\s*?)(\=?[$q]).*([$q])$sep|Us", $string, $match)) {
- if ($match[1][0] == $match[2][0]) {
- $quote = $match[1][0];
- break;
- }
- }
-
- if (
- preg_match_all("|^(\=?[$q]).*([$q])$sep{0,1}|Ums", $string, $match)
- || preg_match_all("|(\=?[$q]).*([$q])$sep\s$|Ums", $string, $match)
- ) {
- if ($match[1][0] == $match[2][0]) {
- $quote = $match[1][0];
- break;
- }
- }
- }
-
- $conf['quote'] = $quote;
- return $conf;
- }
-
- /**
- * Front to call getPointer and moving the resource to the
- * beginning of the file
- * Reset it if you like.
- *
- * @param string $file The name of the file
- * @param array &$conf The configuration
- * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE)
- *
- * @return boolean true on success false on failure
- */
- function resetPointer($file, &$conf, $mode)
- {
- if (!File_CSV::getPointer($file, $conf, $mode, true)) {
- return false;
- }
-
- return true;
- }
-}
\ No newline at end of file
diff --git a/airtime_mvc/library/pear/File/Find.php b/airtime_mvc/library/pear/File/Find.php
deleted file mode 100644
index df99baa22..000000000
--- a/airtime_mvc/library/pear/File/Find.php
+++ /dev/null
@@ -1,485 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Find.php,v 1.27 2006/06/30 14:06:16 techtonik Exp $
-//
-
-require_once 'PEAR.php';
-
-define('FILE_FIND_VERSION', '@package_version@');
-
-// to debug uncomment this string
-// define('FILE_FIND_DEBUG', '');
-
-/**
-* Commonly needed functions searching directory trees
-*
-* @access public
-* @version $Id: Find.php,v 1.27 2006/06/30 14:06:16 techtonik Exp $
-* @package File
-* @author Sterling Hughes
-*/
-class File_Find
-{
- /**
- * internal dir-list
- * @var array
- */
- var $_dirs = array();
-
- /**
- * directory separator
- * @var string
- */
- var $dirsep = "/";
-
- /**
- * found files
- * @var array
- */
- var $files = array();
-
- /**
- * found dirs
- * @var array
- */
- var $directories = array();
-
- /**
- * Search specified directory to find matches for specified pattern
- *
- * @param string $pattern a string containing the pattern to search
- * the directory for.
- *
- * @param string $dirpath a string containing the directory path
- * to search.
- *
- * @param string $pattern_type a string containing the type of
- * pattern matching functions to use (can either be 'php',
- * 'perl' or 'shell').
- *
- * @return array containing all of the files and directories
- * matching the pattern or null if no matches
- *
- * @author Sterling Hughes
- * @access public
- * @static
- */
- function &glob($pattern, $dirpath, $pattern_type = 'php')
- {
- $dh = @opendir($dirpath);
-
- if (!$dh) {
- $pe = PEAR::raiseError("Cannot open directory $dirpath");
- return $pe;
- }
-
- $match_function = File_Find::_determineRegex($pattern, $pattern_type);
- $matches = array();
-
- // empty string cannot be specified for 'php' and 'perl' pattern
- if ($pattern || ($pattern_type != 'php' && $pattern_type != 'perl')) {
- while (false !== ($entry = @readdir($dh))) {
- if ($match_function($pattern, $entry) &&
- $entry != '.' && $entry != '..') {
- $matches[] = $entry;
- }
- }
- }
-
- @closedir($dh);
-
- if (0 == count($matches)) {
- $matches = null;
- }
-
- return $matches ;
- }
-
- /**
- * Map the directory tree given by the directory_path parameter.
- *
- * @param string $directory contains the directory path that you
- * want to map.
- *
- * @return array a two element array, the first element containing a list
- * of all the directories, the second element containing a list of all the
- * files.
- *
- * @author Sterling Hughes
- * @access public
- */
- function &maptree($directory)
- {
-
- /* if called statically */
- if (!isset($this) || !is_a($this, "File_Find")) {
- $obj = &new File_Find();
- return $obj->maptree($directory);
- }
-
- /* clear the results just in case */
- $this->files = array();
- $this->directories = array();
-
- /* strip out trailing slashes */
- $directory = preg_replace('![\\\\/]+$!', '', $directory);
-
- $this->_dirs = array($directory);
-
- while (count($this->_dirs)) {
- $dir = array_pop($this->_dirs);
- File_Find::_build($dir, $this->dirsep);
- array_push($this->directories, $dir);
- }
-
- $retval = array($this->directories, $this->files);
- return $retval;
-
- }
-
- /**
- * Map the directory tree given by the directory parameter.
- *
- * @param string $directory contains the directory path that you
- * want to map.
- * @param integer $maxrecursion maximun number of folders to recursive
- * map
- *
- * @return array a multidimensional array containing all subdirectories
- * and their files. For example:
- *
- * Array
- * (
- * [0] => file_1.php
- * [1] => file_2.php
- * [subdirname] => Array
- * (
- * [0] => file_1.php
- * )
- * )
- *
- * @author Mika Tuupola
- * @access public
- * @static
- */
- function &mapTreeMultiple($directory, $maxrecursion = 0, $count = 0)
- {
- $retval = array();
-
- $count++;
-
- /* strip trailing slashes */
- $directory = preg_replace('![\\\\/]+$!', '', $directory);
-
- if (is_readable($directory)) {
- $dh = opendir($directory);
- while (false !== ($entry = @readdir($dh))) {
- if ($entry != '.' && $entry != '..') {
- array_push($retval, $entry);
- }
- }
- closedir($dh);
- }
-
- while (list($key, $val) = each($retval)) {
- $path = $directory . "/" . $val;
-
- if (!is_array($val) && is_dir($path)) {
- unset($retval[$key]);
- if ($maxrecursion == 0 || $count < $maxrecursion) {
- $retval[$val] = &File_Find::mapTreeMultiple($path,
- $maxrecursion, $count);
- }
- }
- }
-
- return $retval;
- }
-
- /**
- * Search the specified directory tree with the specified pattern. Return
- * an array containing all matching files (no directories included).
- *
- * @param string $pattern the pattern to match every file with.
- *
- * @param string $directory the directory tree to search in.
- *
- * @param string $type the type of regular expression support to use, either
- * 'php', 'perl' or 'shell'.
- *
- * @param bool $fullpath whether the regex should be matched against the
- * full path or only against the filename
- *
- * @param string $match can be either 'files', 'dirs' or 'both' to specify
- * the kind of list to return
- *
- * @return array a list of files matching the pattern parameter in the the
- * directory path specified by the directory parameter
- *
- * @author Sterling Hughes
- * @access public
- * @static
- */
- function &search($pattern, $directory, $type = 'php', $fullpath = true, $match = 'files')
- {
-
- $matches = array();
- list ($directories,$files) = File_Find::maptree($directory);
- switch($match) {
- case 'directories':
- $data = $directories;
- break;
- case 'both':
- $data = array_merge($directories, $files);
- break;
- case 'files':
- default:
- $data = $files;
- }
- unset($files, $directories);
-
- $match_function = File_Find::_determineRegex($pattern, $type);
-
- reset($data);
- // check if empty string given (ok for 'shell' method, but bad for others)
- if ($pattern || ($type != 'php' && $type != 'perl')) {
- while (list(,$entry) = each($data)) {
- if ($match_function($pattern,
- $fullpath ? $entry : basename($entry))) {
- $matches[] = $entry;
- }
- }
- }
-
- return $matches;
- }
-
- /**
- * Determine whether or not a variable is a PEAR error
- *
- * @param object PEAR_Error $var the variable to test.
- *
- * @return boolean returns true if the variable is a PEAR error, otherwise
- * it returns false.
- * @access public
- */
- function isError(&$var)
- {
- return PEAR::isError($var);
- }
-
- /**
- * internal function to build singular directory trees, used by
- * File_Find::maptree()
- *
- * @param string $directory name of the directory to read
- * @param string $separator directory separator
- * @return void
- */
- function _build($directory, $separator = "/")
- {
-
- $dh = @opendir($directory);
-
- if (!$dh) {
- $pe = PEAR::raiseError("Cannot open directory");
- return $pe;
- }
-
- while (false !== ($entry = @readdir($dh))) {
- if ($entry != '.' && $entry != '..') {
-
- $entry = $directory.$separator.$entry;
-
- if (is_dir($entry)) {
- array_push($this->_dirs, $entry);
- } else {
- array_push($this->files, $entry);
- }
- }
- }
-
- @closedir($dh);
- }
-
- /**
- * internal function to determine the type of regular expression to
- * use, implemented by File_Find::glob() and File_Find::search()
- *
- * @param string $type given RegExp type
- * @return string kind of function ( "eregi", "ereg" or "preg_match") ;
- *
- */
- function _determineRegex($pattern, $type)
- {
- if (!strcasecmp($type, 'shell')) {
- $match_function = 'File_Find_match_shell';
- } else if (!strcasecmp($type, 'perl')) {
- $match_function = 'preg_match';
- } else if (!strcasecmp(substr($pattern, -2), '/i')) {
- $match_function = 'eregi';
- } else {
- $match_function = 'ereg';
- }
- return $match_function;
- }
-
-}
-
-/**
-* Package method to match via 'shell' pattern. Provided in global
-* scope, because it should be called like 'preg_match' and 'eregi'
-* and can be easily copied into other packages
-*
-* @author techtonik
-* @return mixed bool on success and PEAR_Error on failure
-*/
-function File_Find_match_shell($pattern, $filename)
-{
- // {{{ convert pattern to positive and negative regexps
- $positive = $pattern;
- $negation = substr_count($pattern, "|");
-
- if ($negation > 1) {
- PEAR::raiseError("Mask string contains errors!");
- return FALSE;
- } elseif ($negation) {
- list($positive, $negative) = explode("|", $pattern);
- if (strlen($negative) == 0) {
- PEAR::raiseError("File-mask string contains errors!");
- return FALSE;
- }
- }
-
- $positive = _File_Find_match_shell_get_pattern($positive);
- if ($negation) {
- $negative = _File_Find_match_shell_get_pattern($negative);
- }
- // }}} convert end
-
-
- if (defined("FILE_FIND_DEBUG")) {
- print("Method: $type\nPattern: $pattern\n Converted pattern:");
- print_r($positive);
- if (isset($negative)) print_r($negative);
- }
-
- if (!preg_match($positive, $filename)) {
- return FALSE;
- } else {
- if (isset($negative)
- && preg_match($negative, $filename)) {
- return FALSE;
- } else {
- return TRUE;
- }
- }
-}
-
-/**
-* function used by File_Find_match_shell to convert 'shell' mask
-* into pcre regexp. Some of the rules (see testcases for more):
-* escaping all special chars and replacing
-* . with \.
-* * with .*
-* ? with .{1}
-* also adding ^ and $ as the pattern matches whole filename
-*
-* @author techtonik
-* @return string pcre regexp for preg_match
-*/
-function _File_Find_match_shell_get_pattern($mask) {
- // get array of several masks (if any) delimited by comma
- // do not touch commas in char class
- $premasks = preg_split("|(\[[^\]]+\])|", $mask, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
- if (defined("FILE_FIND_DEBUG")) {
- print("\nPremask: ");
- print_r($premasks);
- }
- $pi = 0;
- foreach($premasks as $pm) {
- if (!isset($masks[$pi])) $masks[$pi] = "";
- if ($pm{0} == '[' && $pm{strlen($pm)-1} == ']') {
- // strip commas from character class
- $masks[$pi] .= str_replace(",", "", $pm);
- } else {
- $tarr = explode(",", $pm);
- if (sizeof($tarr) == 1) {
- $masks[$pi] .= $pm;
- } else {
- foreach ($tarr as $te) {
- $masks[$pi++] .= $te;
- $masks[$pi] = "";
- }
- unset($masks[$pi--]);
- }
- }
- }
-
- // if empty string given return *.* pattern
- if (strlen($mask) == 0) return "!^.*$!";
-
- // convert to preg regexp
- $regexmask = implode("|", $masks);
- if (defined("FILE_FIND_DEBUG")) {
- print("regexMask step one(implode): $regexmask");
- }
- $regexmask = addcslashes($regexmask, '^$}!{)(\/.+');
- if (defined("FILE_FIND_DEBUG")) {
- print("\nregexMask step two(addcslashes): $regexmask");
- }
- $regexmask = preg_replace("!(\*|\?)!", ".$1", $regexmask);
- if (defined("FILE_FIND_DEBUG")) {
- print("\nregexMask step three(* ? -> .* .?): $regexmask");
- }
- // a special case '*.' at the end means that there is no extension
- $regexmask = preg_replace("!\.\*\\\.(\||$)!", "[^\.]*$1", $regexmask);
- // it is impossible to have dot at the end of filename
- $regexmask = preg_replace("!\\\.(\||$)!", "$1", $regexmask);
- // and .* at the end also means that there could be nothing at all
- // (i.e. no dot at the end also)
- $regexmask = preg_replace("!\\\.\.\*(\||$)!", "(\\\\..*)?$1", $regexmask);
- if (defined("FILE_FIND_DEBUG")) {
- print("\nregexMask step two and half(*.$ \\..*$ .$ -> [^.]*$ .?.* $): $regexmask");
- }
- // if no extension supplied - add .* to match partially from filename start
- if (strpos($regexmask, "\\.") === FALSE) $regexmask .= ".*";
-
- // file mask match whole name - adding restrictions
- $regexmask = preg_replace("!(\|)!", '^'."$1".'$', $regexmask);
- $regexmask = '^'.$regexmask.'$';
- if (defined("FILE_FIND_DEBUG")) {
- print("\nregexMask step three(^ and $ to match whole name): $regexmask");
- }
- // wrap regex into ! since all ! are already escaped
- $regexmask = "!$regexmask!i";
- if (defined("FILE_FIND_DEBUG")) {
- print("\nWrapped regex: $regexmask\n");
- }
- return $regexmask;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/airtime_mvc/library/pear/File/Util.php b/airtime_mvc/library/pear/File/Util.php
deleted file mode 100644
index 92de5bed0..000000000
--- a/airtime_mvc/library/pear/File/Util.php
+++ /dev/null
@@ -1,482 +0,0 @@
-
- * @copyright 2004-2005 Michael Wallner
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: Util.php,v 1.25 2007/02/20 14:19:08 mike Exp $
- * @link http://pear.php.net/package/File
- */
-
-/**#@+
- * Sorting Constants
- */
-define('FILE_SORT_NONE', 0);
-define('FILE_SORT_REVERSE', 1);
-define('FILE_SORT_NAME', 2);
-define('FILE_SORT_SIZE', 4);
-define('FILE_SORT_DATE', 8);
-define('FILE_SORT_RANDOM', 16);
-/**#@-*/
-
-/**#@+
- * Listing Constants
- */
-define('FILE_LIST_FILES', 1);
-define('FILE_LIST_DIRS', 2);
-define('FILE_LIST_DOTS', 4);
-define('FILE_LIST_ALL', FILE_LIST_FILES | FILE_LIST_DIRS | FILE_LIST_DOTS);
-/**#@-*/
-
-/**
- * @ignore
- */
-define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3));
-
-/**
- * File_Util
- *
- * File and directory utility functions.
- *
- * @access public
- * @static
- */
-class File_Util
-{
- /**
- * Returns a string path built from the array $pathParts. Where a join
- * occurs multiple separators are removed. Joins using the optional
- * separator, defaulting to the PHP DIRECTORY_SEPARATOR constant.
- *
- * @static
- * @access public
- * @param array $parts Array containing the parts to be joined
- * @param string $separator The directory seperator
- */
- function buildPath($parts, $separator = DIRECTORY_SEPARATOR)
- {
- $qs = '/^'. preg_quote($separator, '/') .'+$/';
- for ($i = 0, $c = count($parts); $i < $c; $i++) {
- if (!strlen($parts[$i]) || preg_match($qs, $parts[$i])) {
- unset($parts[$i]);
- } elseif (0 == $i) {
- $parts[$i] = rtrim($parts[$i], $separator);
- } elseif ($c - 1 == $i) {
- $parts[$i] = ltrim($parts[$i], $separator);
- } else {
- $parts[$i] = trim($parts[$i], $separator);
- }
- }
- return implode($separator, $parts);
- }
-
- /**
- * Returns a path without leading / or C:\. If this is not
- * present the path is returned as is.
- *
- * @static
- * @access public
- * @param string $path The path to be processed
- * @return string The processed path or the path as is
- */
- function skipRoot($path)
- {
- if (File_Util::isAbsolute($path)) {
- if (FILE_WIN32) {
- return substr($path, $path{3} == '\\' ? 4 : 3);
- }
- return ltrim($path, '/');
- }
- return $path;
- }
-
- /**
- * Returns the temp directory according to either the TMP, TMPDIR, or
- * TEMP env variables. If these are not set it will also check for the
- * existence of /tmp, %WINDIR%\temp
- *
- * @static
- * @access public
- * @return string The system tmp directory
- */
- function tmpDir()
- {
- if (FILE_WIN32) {
- if (isset($_ENV['TEMP'])) {
- return $_ENV['TEMP'];
- }
- if (isset($_ENV['TMP'])) {
- return $_ENV['TMP'];
- }
- if (isset($_ENV['windir'])) {
- return $_ENV['windir'] . '\\temp';
- }
- if (isset($_ENV['SystemRoot'])) {
- return $_ENV['SystemRoot'] . '\\temp';
- }
- if (isset($_SERVER['TEMP'])) {
- return $_SERVER['TEMP'];
- }
- if (isset($_SERVER['TMP'])) {
- return $_SERVER['TMP'];
- }
- if (isset($_SERVER['windir'])) {
- return $_SERVER['windir'] . '\\temp';
- }
- if (isset($_SERVER['SystemRoot'])) {
- return $_SERVER['SystemRoot'] . '\\temp';
- }
- return '\temp';
- }
- if (isset($_ENV['TMPDIR'])) {
- return $_ENV['TMPDIR'];
- }
- if (isset($_SERVER['TMPDIR'])) {
- return $_SERVER['TMPDIR'];
- }
- return '/tmp';
- }
-
- /**
- * Returns a temporary filename using tempnam() and File::tmpDir().
- *
- * @static
- * @access public
- * @param string $dirname Optional directory name for the tmp file
- * @return string Filename and path of the tmp file
- */
- function tmpFile($dirname = null)
- {
- if (!isset($dirname)) {
- $dirname = File_Util::tmpDir();
- }
- return tempnam($dirname, 'temp.');
- }
-
- /**
- * Returns boolean based on whether given path is absolute or not.
- *
- * @static
- * @access public
- * @param string $path Given path
- * @return boolean True if the path is absolute, false if it is not
- */
- function isAbsolute($path)
- {
- if (preg_match('/(?:\/|\\\)\.\.(?=\/|$)/', $path)) {
- return false;
- }
- if (FILE_WIN32) {
- return preg_match('/^[a-zA-Z]:(\\\|\/)/', $path);
- }
- return ($path{0} == '/') || ($path{0} == '~');
- }
-
- /**
- * Checks for a file's existence, taking the current include path
- * into consideration
- *
- * This method can be called statically
- * (e.g., File_Util::isIncludable('config.php'))
- *
- * @param string $file
- * @param string $sep the directory separator (optional)
- * @return string the includable path
- * @access public
- * @static
- */
- function isIncludable($file, $sep = DIRECTORY_SEPARATOR)
- {
- foreach ((array) explode(PATH_SEPARATOR, ini_get('include_path')) as $path) {
- if (file_exists($path .= $sep . $file)) {
- return $path;
- }
- }
- if (file_exists($file)) {
- return $file;
- }
- return NULL;
- }
-
- /**
- * Get path relative to another path
- *
- * @static
- * @access public
- * @return string
- * @param string $path
- * @param string $root
- * @param string $separator
- */
- function relativePath($path, $root, $separator = DIRECTORY_SEPARATOR)
- {
- $path = File_Util::realpath($path, $separator);
- $root = File_Util::realpath($root, $separator);
- $dirs = explode($separator, $path);
- $comp = explode($separator, $root);
-
- if (FILE_WIN32) {
- if (strcasecmp($dirs[0], $comp[0])) {
- return $path;
- }
- unset($dirs[0], $comp[0]);
- }
-
- foreach ($comp as $i => $part) {
- if (isset($dirs[$i]) && $part == $dirs[$i]) {
- unset($dirs[$i], $comp[$i]);
- } else {
- break;
- }
- }
-
- return str_repeat('..' . $separator, count($comp)) . implode($separator, $dirs);
- }
-
- /**
- * Get real path (works with non-existant paths)
- *
- * @static
- * @access public
- * @return string
- * @param string $path
- * @param string $separator
- */
- function realPath($path, $separator = DIRECTORY_SEPARATOR)
- {
- if (!strlen($path)) {
- return $separator;
- }
-
- $drive = '';
- if (FILE_WIN32) {
- $path = preg_replace('/[\\\\\/]/', $separator, $path);
- if (preg_match('/([a-zA-Z]\:)(.*)/', $path, $matches)) {
- $drive = $matches[1];
- $path = $matches[2];
- } else {
- $cwd = getcwd();
- $drive = substr($cwd, 0, 2);
- if ($path{0} !== $separator{0}) {
- $path = substr($cwd, 3) . $separator . $path;
- }
- }
- } elseif ($path{0} !== $separator) {
- $path = getcwd() . $separator . $path;
- }
-
- $dirStack = array();
- foreach (explode($separator, $path) as $dir) {
- if (strlen($dir) && $dir !== '.') {
- if ($dir == '..') {
- array_pop($dirStack);
- } else {
- $dirStack[] = $dir;
- }
- }
- }
-
- return $drive . $separator . implode($separator, $dirStack);
- }
-
- /**
- * Check whether path is in root path
- *
- * @static
- * @access public
- * @return bool
- * @param string $path
- * @param string $root
- */
- function pathInRoot($path, $root)
- {
- static $realPaths = array();
-
- if (!isset($realPaths[$root])) {
- $realPaths[$root] = File_Util::realPath($root);
- }
-
- return false !== strstr(File_Util::realPath($path), $realPaths[$root]);
- }
-
- /**
- * List Directory
- *
- * The final argument, $cb, is a callback that either evaluates to true or
- * false and performs a filter operation, or it can also modify the
- * directory/file names returned. To achieve the latter effect use as
- * follows:
- *
- *
- * name, "\n";
- * }
- * ?>
- *
- *
- * @static
- * @access public
- * @return array
- * @param string $path
- * @param int $list
- * @param int $sort
- * @param mixed $cb
- */
- function listDir($path, $list = FILE_LIST_ALL, $sort = FILE_SORT_NONE, $cb = null)
- {
- if (!strlen($path) || !is_dir($path)) {
- return null;
- }
-
- $entries = array();
- for ($dir = dir($path); false !== $entry = $dir->read(); ) {
- if ($list & FILE_LIST_DOTS || $entry{0} !== '.') {
- $isRef = ($entry === '.' || $entry === '..');
- $isDir = $isRef || is_dir($path .'/'. $entry);
- if ( ((!$isDir && $list & FILE_LIST_FILES) ||
- ($isDir && $list & FILE_LIST_DIRS)) &&
- (!is_callable($cb) ||
- call_user_func_array($cb, array(&$entry)))) {
- $entries[] = (object) array(
- 'name' => $entry,
- 'size' => $isDir ? null : filesize($path .'/'. $entry),
- 'date' => filemtime($path .'/'. $entry),
- );
- }
- }
- }
- $dir->close();
-
- if ($sort) {
- $entries = File_Util::sortFiles($entries, $sort);
- }
-
- return $entries;
- }
-
- /**
- * Sort Files
- *
- * @static
- * @access public
- * @return array
- * @param array $files
- * @param int $sort
- */
- function sortFiles($files, $sort)
- {
- if (!$files) {
- return array();
- }
-
- if (!$sort) {
- return $files;
- }
-
- if ($sort === 1) {
- return array_reverse($files);
- }
-
- if ($sort & FILE_SORT_RANDOM) {
- shuffle($files);
- return $files;
- }
-
- $names = array();
- $sizes = array();
- $dates = array();
-
- if ($sort & FILE_SORT_NAME) {
- $r = &$names;
- } elseif ($sort & FILE_SORT_DATE) {
- $r = &$dates;
- } elseif ($sort & FILE_SORT_SIZE) {
- $r = &$sizes;
- } else {
- asort($files, SORT_REGULAR);
- return $files;
- }
-
- $sortFlags = array(
- FILE_SORT_NAME => SORT_STRING,
- FILE_SORT_DATE => SORT_NUMERIC,
- FILE_SORT_SIZE => SORT_NUMERIC,
- );
-
- foreach ($files as $file) {
- $names[] = $file->name;
- $sizes[] = $file->size;
- $dates[] = $file->date;
- }
-
- if ($sort & FILE_SORT_REVERSE) {
- arsort($r, $sortFlags[$sort & ~1]);
- } else {
- asort($r, $sortFlags[$sort]);
- }
-
- $result = array();
- foreach ($r as $i => $f) {
- $result[] = $files[$i];
- }
-
- return $result;
- }
-
- /**
- * Switch File Extension
- *
- * @static
- * @access public
- * @return string|array
- * @param string|array $filename
- * @param string $to new file extension
- * @param string $from change only files with this extension
- * @param bool $reverse change only files not having $from extension
- */
- function switchExt($filename, $to, $from = null, $reverse = false)
- {
- if (is_array($filename)) {
- foreach ($filename as $key => $file) {
- $filename[$key] = File_Util::switchExt($file, $to, $from);
- }
- return $filename;
- }
-
- if ($len = strlen($from)) {
- $ext = substr($filename, -$len - 1);
- $cfn = FILE_WIN32 ? 'strcasecmp' : 'strcmp';
- if (!$reverse == $cfn($ext, '.'. $from)) {
- return $filename;
- }
- return substr($filename, 0, -$len - 1) .'.'. $to;
- }
-
- if ($pos = strpos($filename, '.')) {
- return substr($filename, 0, $pos) .'.'. $to;
- }
-
- return $filename .'.'. $to;
- }
-}
-
-?>
diff --git a/airtime_mvc/library/pear/HTML/Common.php b/airtime_mvc/library/pear/HTML/Common.php
deleted file mode 100644
index 2dab2fe58..000000000
--- a/airtime_mvc/library/pear/HTML/Common.php
+++ /dev/null
@@ -1,465 +0,0 @@
-
- * @copyright 2001-2009 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id: Common.php,v 1.15 2009/04/03 15:26:22 avb Exp $
- * @link http://pear.php.net/package/HTML_Common/
- */
-
-/**
- * Base class for all HTML classes
- *
- * @category HTML
- * @package HTML_Common
- * @author Adam Daniel
- * @version Release: 1.2.5
- * @abstract
- */
-class HTML_Common
-{
- /**
- * Associative array of attributes
- * @var array
- * @access private
- */
- var $_attributes = array();
-
- /**
- * Tab offset of the tag
- * @var int
- * @access private
- */
- var $_tabOffset = 0;
-
- /**
- * Tab string
- * @var string
- * @since 1.7
- * @access private
- */
- var $_tab = "\11";
-
- /**
- * Contains the line end string
- * @var string
- * @since 1.7
- * @access private
- */
- var $_lineEnd = "\12";
-
- /**
- * HTML comment on the object
- * @var string
- * @since 1.5
- * @access private
- */
- var $_comment = '';
-
- /**
- * Class constructor
- * @param mixed $attributes Associative array of table tag attributes
- * or HTML attributes name="value" pairs
- * @param int $tabOffset Indent offset in tabs
- * @access public
- */
- function HTML_Common($attributes = null, $tabOffset = 0)
- {
- $this->setAttributes($attributes);
- $this->setTabOffset($tabOffset);
- } // end constructor
-
- /**
- * Returns the current API version
- * @access public
- * @returns double
- */
- function apiVersion()
- {
- return 1.7;
- } // end func apiVersion
-
- /**
- * Returns the lineEnd
- *
- * @since 1.7
- * @access private
- * @return string
- */
- function _getLineEnd()
- {
- return $this->_lineEnd;
- } // end func getLineEnd
-
- /**
- * Returns a string containing the unit for indenting HTML
- *
- * @since 1.7
- * @access private
- * @return string
- */
- function _getTab()
- {
- return $this->_tab;
- } // end func _getTab
-
- /**
- * Returns a string containing the offset for the whole HTML code
- *
- * @return string
- * @access private
- */
- function _getTabs()
- {
- return str_repeat($this->_getTab(), $this->_tabOffset);
- } // end func _getTabs
-
- /**
- * Returns an HTML formatted attribute string
- * @param array $attributes
- * @return string
- * @access private
- */
- function _getAttrString($attributes)
- {
- $strAttr = '';
-
- if (is_array($attributes)) {
- $charset = HTML_Common::charset();
- foreach ($attributes as $key => $value) {
- $strAttr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"';
- }
- }
- return $strAttr;
- } // end func _getAttrString
-
- /**
- * Returns a valid atrributes array from either a string or array
- * @param mixed $attributes Either a typical HTML attribute string or an associative array
- * @access private
- * @return array
- */
- function _parseAttributes($attributes)
- {
- if (is_array($attributes)) {
- $ret = array();
- foreach ($attributes as $key => $value) {
- if (is_int($key)) {
- $key = $value = strtolower($value);
- } else {
- $key = strtolower($key);
- }
- $ret[$key] = $value;
- }
- return $ret;
-
- } elseif (is_string($attributes)) {
- $preg = "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" .
- "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/";
- if (preg_match_all($preg, $attributes, $regs)) {
- for ($counter=0; $counter $value) {
- $attr1[$key] = $value;
- }
- } // end func _updateAtrrArray
-
- /**
- * Removes the given attribute from the given array
- *
- * @param string $attr Attribute name
- * @param array $attributes Attribute array
- * @since 1.4
- * @access private
- * @return void
- */
- function _removeAttr($attr, &$attributes)
- {
- $attr = strtolower($attr);
- if (isset($attributes[$attr])) {
- unset($attributes[$attr]);
- }
- } //end func _removeAttr
-
- /**
- * Returns the value of the given attribute
- *
- * @param string $attr Attribute name
- * @since 1.5
- * @access public
- * @return string|null returns null if an attribute does not exist
- */
- function getAttribute($attr)
- {
- $attr = strtolower($attr);
- if (isset($this->_attributes[$attr])) {
- return $this->_attributes[$attr];
- }
- return null;
- } //end func getAttribute
-
- /**
- * Sets the value of the attribute
- *
- * @param string Attribute name
- * @param string Attribute value (will be set to $name if omitted)
- * @access public
- */
- function setAttribute($name, $value = null)
- {
- $name = strtolower($name);
- if (is_null($value)) {
- $value = $name;
- }
- $this->_attributes[$name] = $value;
- } // end func setAttribute
-
- /**
- * Sets the HTML attributes
- * @param mixed $attributes Either a typical HTML attribute string or an associative array
- * @access public
- */
- function setAttributes($attributes)
- {
- $this->_attributes = $this->_parseAttributes($attributes);
- } // end func setAttributes
-
- /**
- * Returns the assoc array (default) or string of attributes
- *
- * @param bool Whether to return the attributes as string
- * @since 1.6
- * @access public
- * @return mixed attributes
- */
- function getAttributes($asString = false)
- {
- if ($asString) {
- return $this->_getAttrString($this->_attributes);
- } else {
- return $this->_attributes;
- }
- } //end func getAttributes
-
- /**
- * Updates the passed attributes without changing the other existing attributes
- * @param mixed $attributes Either a typical HTML attribute string or an associative array
- * @access public
- */
- function updateAttributes($attributes)
- {
- $this->_updateAttrArray($this->_attributes, $this->_parseAttributes($attributes));
- } // end func updateAttributes
-
- /**
- * Removes an attribute
- *
- * @param string $attr Attribute name
- * @since 1.4
- * @access public
- * @return void
- */
- function removeAttribute($attr)
- {
- $this->_removeAttr($attr, $this->_attributes);
- } //end func removeAttribute
-
- /**
- * Sets the line end style to Windows, Mac, Unix or a custom string.
- *
- * @param string $style "win", "mac", "unix" or custom string.
- * @since 1.7
- * @access public
- * @return void
- */
- function setLineEnd($style)
- {
- switch ($style) {
- case 'win':
- $this->_lineEnd = "\15\12";
- break;
- case 'unix':
- $this->_lineEnd = "\12";
- break;
- case 'mac':
- $this->_lineEnd = "\15";
- break;
- default:
- $this->_lineEnd = $style;
- }
- } // end func setLineEnd
-
- /**
- * Sets the tab offset
- *
- * @param int $offset
- * @access public
- */
- function setTabOffset($offset)
- {
- $this->_tabOffset = $offset;
- } // end func setTabOffset
-
- /**
- * Returns the tabOffset
- *
- * @since 1.5
- * @access public
- * @return int
- */
- function getTabOffset()
- {
- return $this->_tabOffset;
- } //end func getTabOffset
-
- /**
- * Sets the string used to indent HTML
- *
- * @since 1.7
- * @param string $string String used to indent ("\11", "\t", ' ', etc.).
- * @access public
- * @return void
- */
- function setTab($string)
- {
- $this->_tab = $string;
- } // end func setTab
-
- /**
- * Sets the HTML comment to be displayed at the beginning of the HTML string
- *
- * @param string
- * @since 1.4
- * @access public
- * @return void
- */
- function setComment($comment)
- {
- $this->_comment = $comment;
- } // end func setHtmlComment
-
- /**
- * Returns the HTML comment
- *
- * @since 1.5
- * @access public
- * @return string
- */
- function getComment()
- {
- return $this->_comment;
- } //end func getComment
-
- /**
- * Abstract method. Must be extended to return the objects HTML
- *
- * @access public
- * @return string
- * @abstract
- */
- function toHtml()
- {
- return '';
- } // end func toHtml
-
- /**
- * Displays the HTML to the screen
- *
- * @access public
- */
- function display()
- {
- print $this->toHtml();
- } // end func display
-
- /**
- * Sets the charset to use by htmlspecialchars() function
- *
- * Since this parameter is expected to be global, the function is designed
- * to be called statically:
- *
- * HTML_Common::charset('utf-8');
- *
- * or
- *
- * $charset = HTML_Common::charset();
- *
- *
- * @param string New charset to use. Omit if just getting the
- * current value. Consult the htmlspecialchars() docs
- * for a list of supported character sets.
- * @return string Current charset
- * @access public
- * @static
- */
- function charset($newCharset = null)
- {
- static $charset = 'ISO-8859-1';
-
- if (!is_null($newCharset)) {
- $charset = $newCharset;
- }
- return $charset;
- } // end func charset
-} // end class HTML_Common
-?>
diff --git a/airtime_mvc/library/pear/HTML/QuickForm.php b/airtime_mvc/library/pear/HTML/QuickForm.php
deleted file mode 100644
index 203c97f57..000000000
--- a/airtime_mvc/library/pear/HTML/QuickForm.php
+++ /dev/null
@@ -1,2065 +0,0 @@
-
- * @author Bertrand Mansion
- * @author Alexey Borzov
- * @copyright 2001-2009 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id: QuickForm.php,v 1.166 2009/04/04 21:34:02 avb Exp $
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * PEAR and PEAR_Error classes, for error handling
- */
-require_once 'PEAR.php';
-/**
- * Base class for all HTML classes
- */
-require_once 'HTML/Common.php';
-
-/**
- * Element types known to HTML_QuickForm
- * @see HTML_QuickForm::registerElementType(), HTML_QuickForm::getRegisteredTypes(),
- * HTML_QuickForm::isTypeRegistered()
- * @global array $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES']
- */
-$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] =
- array(
- 'group' =>array('HTML/QuickForm/group.php','HTML_QuickForm_group'),
- 'hidden' =>array('HTML/QuickForm/hidden.php','HTML_QuickForm_hidden'),
- 'reset' =>array('HTML/QuickForm/reset.php','HTML_QuickForm_reset'),
- 'checkbox' =>array('HTML/QuickForm/checkbox.php','HTML_QuickForm_checkbox'),
- 'file' =>array('HTML/QuickForm/file.php','HTML_QuickForm_file'),
- 'image' =>array('HTML/QuickForm/image.php','HTML_QuickForm_image'),
- 'password' =>array('HTML/QuickForm/password.php','HTML_QuickForm_password'),
- 'radio' =>array('HTML/QuickForm/radio.php','HTML_QuickForm_radio'),
- 'button' =>array('HTML/QuickForm/button.php','HTML_QuickForm_button'),
- 'submit' =>array('HTML/QuickForm/submit.php','HTML_QuickForm_submit'),
- 'select' =>array('HTML/QuickForm/select.php','HTML_QuickForm_select'),
- 'hiddenselect' =>array('HTML/QuickForm/hiddenselect.php','HTML_QuickForm_hiddenselect'),
- 'text' =>array('HTML/QuickForm/text.php','HTML_QuickForm_text'),
- 'textarea' =>array('HTML/QuickForm/textarea.php','HTML_QuickForm_textarea'),
- 'link' =>array('HTML/QuickForm/link.php','HTML_QuickForm_link'),
- 'advcheckbox' =>array('HTML/QuickForm/advcheckbox.php','HTML_QuickForm_advcheckbox'),
- 'date' =>array('HTML/QuickForm/date.php','HTML_QuickForm_date'),
- 'static' =>array('HTML/QuickForm/static.php','HTML_QuickForm_static'),
- 'header' =>array('HTML/QuickForm/header.php', 'HTML_QuickForm_header'),
- 'html' =>array('HTML/QuickForm/html.php', 'HTML_QuickForm_html'),
- 'hierselect' =>array('HTML/QuickForm/hierselect.php', 'HTML_QuickForm_hierselect'),
- 'autocomplete' =>array('HTML/QuickForm/autocomplete.php', 'HTML_QuickForm_autocomplete'),
- 'xbutton' =>array('HTML/QuickForm/xbutton.php','HTML_QuickForm_xbutton')
- );
-
-/**
- * Validation rules known to HTML_QuickForm
- * @see HTML_QuickForm::registerRule(), HTML_QuickForm::getRegisteredRules(),
- * HTML_QuickForm::isRuleRegistered()
- * @global array $GLOBALS['_HTML_QuickForm_registered_rules']
- */
-$GLOBALS['_HTML_QuickForm_registered_rules'] = array(
- 'required' => array('html_quickform_rule_required', 'HTML/QuickForm/Rule/Required.php'),
- 'maxlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'),
- 'minlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'),
- 'rangelength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'),
- 'email' => array('html_quickform_rule_email', 'HTML/QuickForm/Rule/Email.php'),
- 'regex' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'lettersonly' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'alphanumeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'numeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'nopunctuation' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'nonzero' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'callback' => array('html_quickform_rule_callback', 'HTML/QuickForm/Rule/Callback.php'),
- 'compare' => array('html_quickform_rule_compare', 'HTML/QuickForm/Rule/Compare.php')
-);
-
-// {{{ error codes
-
-/**#@+
- * Error codes for HTML_QuickForm
- *
- * Codes are mapped to textual messages by errorMessage() method, if you add a
- * new code be sure to add a new message for it to errorMessage()
- *
- * @see HTML_QuickForm::errorMessage()
- */
-define('QUICKFORM_OK', 1);
-define('QUICKFORM_ERROR', -1);
-define('QUICKFORM_INVALID_RULE', -2);
-define('QUICKFORM_NONEXIST_ELEMENT', -3);
-define('QUICKFORM_INVALID_FILTER', -4);
-define('QUICKFORM_UNREGISTERED_ELEMENT', -5);
-define('QUICKFORM_INVALID_ELEMENT_NAME', -6);
-define('QUICKFORM_INVALID_PROCESS', -7);
-define('QUICKFORM_DEPRECATED', -8);
-define('QUICKFORM_INVALID_DATASOURCE', -9);
-/**#@-*/
-
-// }}}
-
-/**
- * Create, validate and process HTML forms
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel
- * @author Bertrand Mansion
- * @author Alexey Borzov
- * @version Release: 3.2.11
- */
-class HTML_QuickForm extends HTML_Common
-{
- // {{{ properties
-
- /**
- * Array containing the form fields
- * @since 1.0
- * @var array
- * @access private
- */
- var $_elements = array();
-
- /**
- * Array containing element name to index map
- * @since 1.1
- * @var array
- * @access private
- */
- var $_elementIndex = array();
-
- /**
- * Array containing indexes of duplicate elements
- * @since 2.10
- * @var array
- * @access private
- */
- var $_duplicateIndex = array();
-
- /**
- * Array containing required field IDs
- * @since 1.0
- * @var array
- * @access private
- */
- var $_required = array();
-
- /**
- * Prefix message in javascript alert if error
- * @since 1.0
- * @var string
- * @access public
- */
- var $_jsPrefix = 'Invalid information entered.';
-
- /**
- * Postfix message in javascript alert if error
- * @since 1.0
- * @var string
- * @access public
- */
- var $_jsPostfix = 'Please correct these fields.';
-
- /**
- * Datasource object implementing the informal
- * datasource protocol
- * @since 3.3
- * @var object
- * @access private
- */
- var $_datasource;
-
- /**
- * Array of default form values
- * @since 2.0
- * @var array
- * @access private
- */
- var $_defaultValues = array();
-
- /**
- * Array of constant form values
- * @since 2.0
- * @var array
- * @access private
- */
- var $_constantValues = array();
-
- /**
- * Array of submitted form values
- * @since 1.0
- * @var array
- * @access private
- */
- var $_submitValues = array();
-
- /**
- * Array of submitted form files
- * @since 1.0
- * @var integer
- * @access public
- */
- var $_submitFiles = array();
-
- /**
- * Value for maxfilesize hidden element if form contains file input
- * @since 1.0
- * @var integer
- * @access public
- */
- var $_maxFileSize = 1048576; // 1 Mb = 1048576
-
- /**
- * Flag to know if all fields are frozen
- * @since 1.0
- * @var boolean
- * @access private
- */
- var $_freezeAll = false;
-
- /**
- * Array containing the form rules
- * @since 1.0
- * @var array
- * @access private
- */
- var $_rules = array();
-
- /**
- * Form rules, global variety
- * @var array
- * @access private
- */
- var $_formRules = array();
-
- /**
- * Array containing the validation errors
- * @since 1.0
- * @var array
- * @access private
- */
- var $_errors = array();
-
- /**
- * Note for required fields in the form
- * @var string
- * @since 1.0
- * @access private
- */
- var $_requiredNote = '* denotes required field';
-
- /**
- * Whether the form was submitted
- * @var boolean
- * @access private
- */
- var $_flagSubmitted = false;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- * @param string $formName Form's name.
- * @param string $method (optional)Form's method defaults to 'POST'
- * @param string $action (optional)Form's action
- * @param string $target (optional)Form's target defaults to '_self'
- * @param mixed $attributes (optional)Extra attributes for