<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14141] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14141">14141</a></dd>
<dt>Author</dt> <dd>voipmaster</dd>
<dt>Date</dt> <dd>2009-07-06 17:02:30 -0500 (Mon, 06 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Freeswitch Management Interface (FMC) using PHP/CodeEgniter</pre>

<h3>Added Paths</h3>
<ul>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/</li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/curl/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlhtpasswd">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/.htpasswd</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationaclconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/acl.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationconferenceconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/conference.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationconsoleconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/console.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationdingalingconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/dingaling.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationiaxconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/iax.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationivrconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/ivr.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationlimitconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/limit.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationlocal_streamconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/local_stream.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationpost_load_modulesconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/post_load_modules.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationrssconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/rss.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationsofiaconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/sofia.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationspidermonkeyconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/spidermonkey.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationvoicemailconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/voicemail.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlconfigurationxml_cdrconfphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/xml_cdr.conf.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurldialplan_importerphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplan_importer.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplans/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurldialplanslcrphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplans/lcr.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlfs_configurationphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_configuration.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlfs_curlphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_curl.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlfs_dialplanphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_dialplan.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlfs_directoryphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_directory.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlglobal_definesphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/global_defines.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlindexphp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/index.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/curl/libs/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurllibsfs_pdophp">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/libs/fs_pdo.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql40withsamplessql">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0-with-samples.sql</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql40sql">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0.sql</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql50withsamplessql">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0-with-samples.sql</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql50sql">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0.sql</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlsqloraclewithexamplessql">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle-with-examples.sql</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmccurlsqloraclesql">freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle.sql</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcindexphp">freeswitch/trunk/contrib/DelphiWorld/fmc/index.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcreadmetxt">freeswitch/trunk/contrib/DelphiWorld/fmc/readme.txt</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/</li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/</li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrParse_XML_CDRphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/Parse_XML_CDR.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrcdrphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/cdr.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrtestcdrxml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/testcdr.xml</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/xml/</li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigautoloadphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/autoload.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigconfigphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/config.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigconstantsphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/constants.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigdatabasephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/database.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigdoctypesphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/doctypes.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfighooksphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/hooks.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigmimesphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/mimes.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigroutesphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/routes.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigsmileysphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/smileys.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfiguser_agentsphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/user_agents.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcontrollersindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcontrollersstatusphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/status.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcontrollerswelcomephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/welcome.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_404php">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_404.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_dbphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_db.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_generalphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_general.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_phpphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_php.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorsindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/helpers/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationhelpersindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/helpers/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/hooks/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationhooksindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/hooks/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/language/</li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/language/english/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationlanguageenglishindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/language/english/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationlibrarieseslphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/esl.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationlibrariesindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/models/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationmodelsindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/models/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsFSgif">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/FS.gif</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewseslphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsesl_configphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl_config.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsfouterphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/fouter.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsnavphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/nav.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsstatusphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/status.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewswelcome_messagephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/welcome_message.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/cache/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemcacheindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/cache/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterBase4php">freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base4.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterBase5php">freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base5.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterCodeIgniterphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/CodeIgniter.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterCommonphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Common.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterCompatphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Compat.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDBphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_active_recphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_active_rec.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_cachephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_cache.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_utility.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_utility.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_utility.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqliindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_utility.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8indexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_utility.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_utility.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgreindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_utility.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqliteindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_driverphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_driver.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_forgephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_forge.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_resultphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_result.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_utilityphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_utility.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemfontsindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemfontstexbttf">freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/texb.ttf</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersarray_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/array_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperscompatibility_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/compatibility_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperscookie_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/cookie_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersdate_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/date_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersdirectory_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/directory_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersdownload_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/download_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersemail_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/email_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersfile_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/file_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersform_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/form_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpershtml_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/html_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersinflector_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/inflector_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperslanguage_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/language_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersnumber_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/number_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperspath_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/path_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperssecurity_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/security_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperssmiley_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/smiley_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersstring_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/string_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperstext_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/text_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelperstypography_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/typography_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersurl_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/url_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemhelpersxml_helperphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/xml_helper.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/</li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishcalendar_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/calendar_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishdate_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/date_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishdb_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/db_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishemail_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/email_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishform_validation_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/form_validation_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishftp_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/ftp_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishimglib_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/imglib_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishnumber_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/number_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishprofiler_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/profiler_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishscaffolding_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/scaffolding_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishunit_test_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/unit_test_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishupload_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/upload_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishvalidation_langphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/validation_lang.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlanguageindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesBenchmarkphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Benchmark.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesCalendarphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Calendar.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesCartphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Cart.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesConfigphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Config.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesControllerphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Controller.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesEmailphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Email.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesEncryptphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Encrypt.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesExceptionsphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Exceptions.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesForm_validationphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Form_validation.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesFtpphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Ftp.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesHooksphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Hooks.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesImage_libphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Image_lib.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesInputphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Input.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesLanguagephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Language.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesLoaderphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Loader.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesLogphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Log.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesModelphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Model.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesOutputphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Output.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesPaginationphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Pagination.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesParserphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Parser.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesProfilerphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Profiler.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesRouterphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Router.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesSessionphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Session.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesSha1php">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Sha1.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesTablephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Table.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesTrackbackphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Trackback.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesTypographyphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Typography.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesURIphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/URI.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesUnit_testphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Unit_test.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesUploadphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Upload.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesUser_agentphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/User_agent.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesValidationphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Validation.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesXmlrpcphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpc.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesXmlrpcsphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpcs.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesZipphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Zip.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/logs/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemlogsindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/logs/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystempluginscaptcha_piphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/captcha_pi.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystempluginsindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystempluginsjs_calendar_piphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/js_calendar_pi.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingScaffoldingphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/Scaffolding.php</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingimagesbackgroundjpg">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/background.jpg</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingimagesindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingimageslogojpg">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/logo.jpg</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/index.html</a></li>
<li>freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/</li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsaddphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/add.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsdeletephp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/delete.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewseditphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/edit.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsfooterphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/footer.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsheaderphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/header.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsindexhtml">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/index.html</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsno_dataphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/no_data.php</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsstylesheetcss">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/stylesheet.css</a></li>
<li><a href="#freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsviewphp">freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/view.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlhtpasswd"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/.htpasswd (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/.htpasswd                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/.htpasswd        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+admin:admin
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationaclconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/acl.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/acl.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/acl.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * acl.conf.php
+ */
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Class to write the XML for acl.conf
+ */
+class acl_conf extends fs_configuration {
+
+    public function acl_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    public function main() {
+        $acl = $this -&gt; get_acl();
+        $this -&gt; write_acl($acl);
+    }
+
+    /**
+     * Write individual node elements with their attributes
+     *
+     * @param array $node_attributes
+     */
+    private function write_node($node_attributes) {
+        $this -&gt; xmlw -&gt; startElement('node');
+        $this -&gt; xmlw -&gt; writeAttribute('type', $node_attributes['type']);
+        $this -&gt; xmlw -&gt; writeAttribute('cidr', $node_attributes['cidr']);
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * Fetch the ACL data from the database
+     *
+     * @return array $acl_data
+     */
+    private function get_acl() {
+        $query = sprintf(
+        'SELECT * FROM acl_lists al JOIN acl_nodes an ON an.list_id=al.id;'
+        );
+        $acl_data = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($profiles)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return array();
+        }
+        return $acl_data;
+    }
+
+    /**
+     * Write ACL data out
+     *
+     * @param array $acl
+     */
+    private function write_acl($acl) {
+        $this -&gt; xmlw -&gt; startElement('network-lists');
+        $node_count = count($acl);
+        for ($i=0; $i&lt;$node_count; $i++) {
+            $last = $i - 1;
+            $next = $i + 1;
+            if ($last &lt; 0 || $acl[$last]['acl_name'] != $acl[$i]['acl_name']) {
+                    $this -&gt; xmlw -&gt; startElement('list');
+                    $this -&gt; xmlw -&gt; writeAttribute('name', $acl[$i]['acl_name']);
+                    $this -&gt; xmlw -&gt; writeAttribute(
+                    'default', $acl[$i]['default_policy']
+                    );
+            }
+            $this -&gt; write_node($acl[$i]);
+            if ((!array_key_exists($next, $acl))
+            || $acl[$next]['acl_name'] != $acl[$i]['acl_name']) {
+                    $this -&gt; xmlw -&gt; endElement();
+            }
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationconferenceconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/conference.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/conference.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/conference.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,185 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * conference.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Write XML for conference.conf
+*/
+class conference_conf extends fs_configuration {
+    /**
+     * Initializer method
+     * This method calls fs_configuration to initialize all of the
+     * objects and variables that we want to inherit
+     * @return void
+    */
+    public function conference_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    /**
+     * Main sub-routine
+     * This method will call all of the other methods necessary
+     * to write out the XML for the conference.conf
+     * @return void
+    */
+    public function main() {
+        $this -&gt; write_advertises();
+        $this -&gt; write_controls();
+        $this -&gt; write_profiles();
+    }
+
+    /**
+     * Write XML for &lt;advertises&gt;
+     * This method will write the elements and attributes for the
+     * conferences that are to be advertised
+     * @return void
+    */
+    private function write_advertises() {
+        $query = &quot;SELECT * FROM conference_advertise ORDER BY room&quot;;
+        $advertises = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($advertises)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        $advertise_count = count($advertises);
+        if ($advertise_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('advertise');
+        for ($i=0; $i&lt;$advertise_count; $i++) {
+            //$this -&gt; comment_array($advertises[$i]);
+            $this -&gt; xmlw -&gt; startElement('room');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $advertises[$i]['room']);
+            $this -&gt; xmlw -&gt; writeAttribute('status', $advertises[$i]['status']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+
+    /**
+     * Pull conference profiles from the database
+     * This method will pull the conference profiles
+     * from the database using the PDO extension
+     * @return array
+    */
+    private function get_profiles_array() {
+        $query = sprintf('%s %s;'
+        , &quot;SELECT * FROM conference_profiles&quot;
+        , &quot;ORDER BY profile_name&quot;
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return array();
+        }
+        while ($row = $res -&gt; fetch(PDO::FETCH_ASSOC)) {
+            $pn = $row['profile_name'];
+            $profiles[$pn][] = $row;
+        }
+        return $profiles;
+    }
+
+    /**
+     * Write XML for &lt;profiles&gt;
+     * This method will write the XML of the array
+     * from get_profiles_array
+     * @return void
+    */
+    private function write_profiles() {
+        $profiles_array = $this -&gt; get_profiles_array();
+        $profiles_count = count($profiles_array);
+        if ($profiles_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('profiles');
+
+        foreach ($profiles_array as $profile_name =&gt; $profile_data) {
+            $this -&gt; xmlw -&gt; startElement('profile');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $profile_name);
+            foreach ($profile_data as $params) {
+                //$this -&gt; comment_array($profiles_array[$i]);
+                $this -&gt; xmlw -&gt; startElement('param');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $params['param_name']);
+                $this -&gt; xmlw -&gt; writeAttribute('value', $params['param_value']);
+                $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+
+            }
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * Pull caller-controls from database via PDO
+     * This method will pull the conference caller-controls from
+     * the database using the PDO extension
+     * @return array
+    */
+    private function get_controls_array() {
+        $query = sprintf(
+        &quot;SELECT * FROM conference_controls ORDER BY conf_group&quot;
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return array();
+        }
+        while ($row = $res -&gt; fetch(PDO::FETCH_ASSOC)) {
+            $cg = $row['conf_group'];
+            $profiles[$cg][] = $row;
+        }
+        return $profiles;
+    }
+
+    /**
+     * Write XML for &lt;caller-controls&gt;
+     * This method will write the XML of the array
+     * from get_controls_array
+     * @return void
+    */
+    private function write_controls() {
+        $controls_array = $this -&gt; get_controls_array();
+        $controls_count = count($controls_array);
+        if (FS_PDO::isError($controls_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($controls_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('caller-controls');
+
+        foreach ($controls_array as $group_name =&gt; $control_data) {
+            $this -&gt; xmlw -&gt; startElement('group');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $group_name);
+            foreach ($control_data as $controls) {
+
+                //$this -&gt; comment_array($controls_array[$i]);
+                $this -&gt; xmlw -&gt; startElement('control');
+                $this -&gt; xmlw -&gt; writeAttribute('action', $controls['action']);
+                $this -&gt; xmlw -&gt; writeAttribute('digits', $controls['digits']);
+                $this -&gt; xmlw -&gt; endElement();
+
+            }
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationconsoleconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/console.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/console.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/console.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * console.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * @todo make this configurable via db rather than hardcoded.
+ * File containing the base class for all curl XML output
+*/
+class console_conf extends fs_configuration {
+    function console_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    /**
+     * Currently this method does pretty much everything
+     */
+    function main() {
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'Console configuration');
+
+        $this -&gt; xmlw -&gt; startElement('mappings');
+        
+        $this -&gt; xmlw -&gt; startElement('map');
+        $this -&gt; xmlw -&gt; writeAttribute('name', 'all');
+        $this -&gt; xmlw -&gt; writeAttribute('value', 'notice,warning,error,crit,alert,info,debug');
+        $this -&gt; xmlw -&gt; endElement();
+
+        $this -&gt; xmlw -&gt; endElement();
+
+
+
+
+        $this -&gt; xmlw -&gt; startElement('settings');
+
+        $this -&gt; xmlw -&gt; startElement('param');
+        $this -&gt; xmlw -&gt; writeAttribute('name', 'colorize');
+        $this -&gt; xmlw -&gt; writeAttribute('value', 'true');
+        $this -&gt; xmlw -&gt; endElement();
+
+        $this -&gt; xmlw -&gt; startElement('param');
+        $this -&gt; xmlw -&gt; writeAttribute('name', 'loglevel');
+        $this -&gt; xmlw -&gt; writeAttribute('value', 'debug');
+        $this -&gt; xmlw -&gt; endElement();
+
+        $this -&gt; xmlw -&gt; endElement();
+
+
+
+
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationdingalingconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/dingaling.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/dingaling.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/dingaling.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,142 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * dingaling.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Write XML for dingaling.conf
+*/
+class dingaling_conf extends fs_configuration {
+    /**
+     * Initializer method
+     * This method calls fs_configuration to initialize all of the
+     * objects and variables that we want to inherit
+     * @return void
+    */
+    public function dingaling_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    /**
+     * Main sub-routine
+     * This method will call all of the other methods necessary
+     * to write out the XML for the dingaling.conf
+     * @return void
+    */
+    public function main() {
+        $this -&gt; write_settings();
+        $this -&gt; write_profiles();
+    }
+
+    /**
+     * Pull dingaling profiles from the database
+     * @return array
+    */
+    private function get_params_array() {
+        $query = sprintf('%s %s;'
+        , &quot;SELECT * FROM dingaling_profile_params&quot;
+        , &quot;ORDER BY dingaling_id&quot;
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return array();
+        }
+        while ($row = $res -&gt; fetchRow()) {
+            $id = $row['dingaling_id'];
+            $profiles[$id][] = $row;
+        }
+        return $profiles;
+    }
+
+    /**
+     * get dingaling profile names, types, and ids
+     * @return array
+     */
+    private function get_profile_array() {
+        $query = sprintf('SELECT * FROM dingaling_profiles');
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        while ($row = $res -&gt; fetchRow()) {
+            $id = $row['id'];
+            $profiles[$id] = $row['type'];
+        }
+        return $profiles;
+    }
+
+
+    /**
+     * Write XML for &lt;profile&gt;s
+     * This method will write the XML of the array
+     * from get_profiles_array
+     * @return void
+    */
+    private function write_profiles() {
+        $profile_array = $this -&gt; get_profile_array();
+        $params_array = $this -&gt; get_params_array();
+        $params_count = count($params_array);
+        if ($params_count &lt; 1) {
+            return ;
+        }
+        while (list($id, $type) = each($profile_array)) {
+            $this -&gt; xmlw -&gt; startElement('profile');
+            $this -&gt; xmlw -&gt; writeAttribute('type', $type);
+            if (!empty($params_array[$id])) {
+                $this_param_count = count($params_array[$id]);
+                for ($i=0; $i&lt;$this_param_count; $i++) {
+                    $this -&gt; xmlw -&gt; startElement('param');
+                    $this -&gt; xmlw -&gt; writeAttribute(
+                    'name', $params_array[$id][$i]['param_name']
+                    );
+                    $this -&gt; xmlw -&gt; writeAttribute(
+                    'value', $params_array[$id][$i]['param_value']
+                    );
+                    $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+                }
+                $this -&gt; xmlw -&gt; endElement();
+            }
+        }
+    }
+
+
+    /**
+     * Write out the XML for the dingaling &lt;settings&gt;
+     *@return void
+     */
+    private function write_settings() {
+        $query = sprintf('SELECT * FROM dingaling_settings');
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        $setting_count = count($res);
+        if ($setting_count &gt; 0) {
+            $this -&gt; xmlw -&gt; startElement('settings');
+            for ($i=0; $i&lt;$setting_count; $i++) {
+                $this -&gt; xmlw -&gt; startElement('param');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $res[$i]['param_name']);
+                $this -&gt; xmlw -&gt; writeAttribute('value', $res[$i]['param_value']);
+                $this -&gt; xmlw -&gt; endElement();
+            }
+            $this -&gt; xmlw -&gt; endElement();
+        }
+    }
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationiaxconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/iax.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/iax.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/iax.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,172 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * iax.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * @todo add gateways, aliases, etc when support is added into FS
+ * Class to write XML for iax.conf
+*/
+class iax_conf extends fs_configuration {
+    public function iax_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    public function main() {
+        $profiles = $this -&gt; get_profiles();
+        $this -&gt; write_config($profiles);
+    }
+
+    private function get_profiles() {
+        $query = &quot;SELECT * FROM iax_conf ORDER BY id LIMIT 1&quot;;
+        $profiles = $this -&gt; db -&gt; queryAll($query);
+        return $profiles;
+    }
+
+    private function write_aliases($profile_id) {
+        $query = &quot;SELECT * FROM iax_aliases WHERE iax_id=$profile_id &quot;;
+        $aliases_array = $this -&gt; db -&gt; queryAll($query);
+        $aliases_count = count($aliases_array);
+        if (FS_PDO::isError($aliases_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($aliases_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('aliases');
+
+        for ($i=0; $i&lt;$aliases_count; $i++) {
+            //$this -&gt; comment_array($aliases_array[$i]);
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $aliases_array[$i]['alias_name']);
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    private function write_settings($profile_id) {
+        $query = &quot;SELECT * FROM iax_settings WHERE iax_id=$profile_id &quot;
+        . &quot;ORDER BY iax_id, param_name&quot;;
+        $settings_array = $this -&gt; db -&gt; queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($settings_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('settings');
+
+        for ($i=0; $i&lt;$settings_count; $i++) {
+            //$this -&gt; comment_array($settings_array[$i]);
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    private function write_gateways($profile_id) {
+        $query = &quot;SELECT * FROM iax_gateways WHERE iax_id=$profile_id &quot;
+        . &quot;ORDER BY gateway_name, gateway_param&quot;;
+        $gateway_array = $this -&gt; db -&gt; queryAll($query);
+        $gateway_count = count($gateway_array);
+        //$this -&gt; comment_array($gateway_array);
+        if (MDB2::isError($gateway_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($gateway_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('gateways');
+        for ($i=0; $i&lt;$gateway_count; $i++) {
+            $this_gateway = $gateway_array[$i]['gateway_name'];
+            if ($this_gateway != $gateway_array[$i-1]['gateway_name']) {
+                $this -&gt; xmlw -&gt; startElement('gateway');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $this_gateway);
+            }
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $gateway_array[$i]['gateway_param']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $gateway_array[$i]['gateway_value']);
+            $this -&gt; xmlw -&gt; endElement();
+            if (!array_key_exists($i+1, $gateway_array)
+            || $this_gateway != $gateway_array[$i+1]['gateway_name']) {
+                $this -&gt; xmlw -&gt; endElement();
+            }
+            $last_gateway = $this_gateway;
+        }
+        $this -&gt; xmlw -&gt; endElement(); //&lt;/gateways&gt;
+    }
+
+    private function write_domains($profile_id) {
+        $query = &quot;SELECT * FROM iax_domains WHERE iax_id=$profile_id&quot;;
+        $domain_array = $this -&gt; db -&gt; queryAll($query);
+        $domain_count = count($domain_array);
+        if (FS_PDO::isError($domain_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($domain_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('domains');
+        for ($i=0; $i&lt;$domain_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('domain');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $domain_array[$i]['domain_name']);
+            $this -&gt; xmlw -&gt; writeAttribute(
+            'parse', ($domain_array[$i]['parse'] == 1 ? 'true' : 'false')
+            );
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    private function write_single_profile($profile) {
+        /*  //reserved for multi-profile
+        $this -&gt; xmlw -&gt; startElement('profile');
+        $this -&gt; xmlw -&gt; writeAttribute('name', $profile['profile_name']);
+        */
+        //$this -&gt; write_aliases($profile['id']);
+        //$this -&gt; write_domains($profile['id']);
+        //$this -&gt; write_gateways($profile['id']);
+        $this -&gt; write_settings($profile['id']);
+        //$this -&gt; xmlw -&gt; endElement(); //reserved for multi-profile
+    }
+
+    /**
+     * Write XML for iax.conf profiles
+     *
+     * @param unknown_type $profiles
+     */
+    private function write_config($profiles) {
+        $profile_count = count($profiles);
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'IAX Endpoint');
+        /*
+        $this -&gt; xmlw -&gt; startElement('profiles');
+        //we'll add this back if ever multiple iax profiles are supported
+        */
+        for ($i=0; $i&lt;$profile_count; $i++) {
+            $this -&gt; write_single_profile($profiles[$i]);
+        }
+        //$this -&gt; xmlw -&gt; endElement(); //this too
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationivrconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/ivr.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/ivr.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/ivr.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * ivr.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Write XML for ivr.conf
+*/
+class ivr_conf extends fs_configuration {
+    public function ivr_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    /**
+     * This method will run all of the methods necessary to return
+     * the XML for the ivr.conf
+     * @return void
+    */
+    public function main() {
+        $ivrs = $this -&gt; get_ivr_array();
+        $this -&gt; write_config($ivrs);
+    }
+
+    /**
+     * This method will fetch all of the ivr menus from the database
+     * using the MDB2 pear class
+     * @return array
+    */
+    private function get_ivr_array() {
+        $query = &quot;SELECT * FROM ivr_conf&quot;;
+        $menus = $this -&gt; db -&gt; queryAll($query);
+        return $menus;
+    }
+
+    /**
+     * This method will write all of the entry elements with
+     * their corresponding attributes
+     * @return void
+     */
+    private function write_entries($ivr_id) {
+        $query = sprintf(
+        &quot;SELECT * FROM ivr_entries WHERE ivr_id=$ivr_id ORDER BY digits&quot;
+        );
+        $entries_array = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($entries_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        $entries_count = count($entries_array);
+        if ($entries_count &lt; 1) {
+            return ;
+        }
+        $entries_count = count($entries_array);
+        for ($i=0; $i&lt;$entries_count; $i++) {
+            //$this -&gt; comment_array($entries_array[$i]);
+            $this -&gt; xmlw -&gt; startElement('entry');
+            $this -&gt; xmlw -&gt; writeAttribute('action', $entries_array[$i]['action']);
+            $this -&gt; xmlw -&gt; writeAttribute('digits', $entries_array[$i]['digits']);
+            if (!empty($entries_array[$i]['params'])) {
+                $this -&gt; xmlw -&gt; writeAttribute('params', $entries_array[$i]['params']);
+            }
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+    }
+
+    /**
+     * This method will evaluate the data from the db and
+     * write attributes that need written
+     * @return void
+    */
+    private function write_menu_attributes($menu_data) {
+        $this -&gt; xmlw -&gt; writeAttribute('name', $menu_data['name']);
+        $this -&gt; xmlw -&gt; writeAttribute('greet-long', $menu_data['greet_long']);
+        $this -&gt; xmlw -&gt; writeAttribute('greet-short', $menu_data['greet_short']);
+        $this -&gt; xmlw -&gt; writeAttribute('invalid-sound', $menu_data['invalid_sound']);
+        $this -&gt; xmlw -&gt; writeAttribute('exit-sound', $menu_data['exit_sound']);
+        $this -&gt; xmlw -&gt; writeAttribute('timeout', $menu_data['timeout']);
+        $this -&gt; xmlw -&gt; writeAttribute('max-failures', $menu_data['max_failures']);
+        if (!empty($menu_data['tts_engine'])) {
+            $this -&gt; xmlw -&gt; writeAttribute('tts-engine', $menu_data['tts_engine']);
+        }
+        if (!empty($menu_data['tts_voice'])) {
+            $this -&gt; xmlw -&gt; writeAttribute('tts-voice', $menu_data['tts_voice']);
+        }
+        //$this -&gt; xmlw -&gt; writeAttribute('', $menu_data['']);
+    }
+
+    /**
+     * This method will do the writing of the &quot;menu&quot; elements
+     * and call the write_entries method to do the writing of
+     * individual menu's &quot;entry&quot; elements
+     * @return void
+    */
+    private function write_config($menus) {
+        $menu_count = count($menus);
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'Sofia SIP Endpoint');
+        $this -&gt; xmlw -&gt; startElement('menus');
+        for ($i=0; $i&lt;$menu_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('menu');
+            $this -&gt; write_menu_attributes($menus[$i]);
+            $this -&gt; write_entries($menus[$i]['id']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationlimitconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/limit.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/limit.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/limit.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * limit.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Write XML for limit.conf
+*/
+class limit_conf extends fs_configuration {
+
+    public function limit_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    public function main() {
+        $params = $this -&gt; get_params_array($this -&gt; db);
+        $this -&gt; write_params_array($params);
+        $this -&gt; output_xml();
+
+    }
+
+    /**
+     * Pull limit params from the db
+     * @return array
+     */
+    private function get_params_array() {
+        $query = sprintf('SELECT * FROM limit_conf;');
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return array();
+        }
+        $this -&gt; comment($res -&gt; numRows() . 'rows');
+        if ($res -&gt; numRows() == 0) {
+            return array();
+        }
+        while ($row = $res -&gt; fetchRow(MDB2_FETCHMODE_ASSOC)) {
+            $feeds_array[] = $row;
+        }
+        return $feeds_array;
+    }
+
+    /**
+     * Write out the XML of params retreived from get_params_array
+     * @see get_params_array
+     * @param unknown_type $params
+     */
+    private function write_params_array($params) {
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'Call Limiter');
+        $this -&gt; xmlw -&gt; startElement('settings');
+
+        $param_count = count($params);
+        for ($i=0; $i&lt;$param_count; $i++) {
+            $this -&gt; comment(&quot;$param_count/$i&quot;);
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $params[$i]['name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $params[$i]['value']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationlocal_streamconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/local_stream.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/local_stream.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/local_stream.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * local_stream.conf.php
+ */
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Class to write the XML for local_stream.conf
+ */
+class local_stream_conf extends fs_configuration {
+
+    public function local_stream_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    public function main() {
+        $directories = $this -&gt; get_directories();
+        $this -&gt; write_directories($directories);
+    }
+
+    private function write_settings($profile_id) {
+        $query = sprintf('%s %s %s;'
+        , &quot;SELECT * FROM local_stream_settings &quot;
+        , &quot;WHERE stream_id=$profile_id &quot;
+        , &quot;ORDER BY stream_id, param_name&quot;
+        );
+        $settings_array = $this -&gt; db -&gt; queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($settings_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('settings');
+
+        for ($i=0; $i&lt;$settings_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+        $this -&gt; write_email($profile_id);
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    private function get_directories() {
+        $query = sprintf('SELECT * FROM local_stream_conf;');
+        $profiles = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($profiles)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return array();
+        }
+        return $profiles;
+    }
+
+    private function write_directories($directories) {
+        $directory_count = count($directories);
+        for ($i=0; $i&lt;$directory_count; $i++) {
+            $this -&gt; write_settings($directories[$i]);
+        }
+    }
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationpost_load_modulesconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/post_load_modules.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/post_load_modules.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/post_load_modules.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * post_load_modules.conf.php
+ */
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Class to write the post_load_modules.conf XML for FreeSWITCH
+*/
+class post_load_modules_conf extends fs_configuration {
+
+    public function post_load_modules_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    public function main() {
+        $params = $this -&gt; get_modules_array($this -&gt; db);
+        $this -&gt; write_modules_array($params);
+        $this -&gt; output_xml();
+
+    }
+
+    /**
+     * This method will pull the postloaded modules from the database
+     * @return array
+     */
+    function get_modules_array() {
+        $query = sprintf(
+        'SELECT * FROM post_load_modules_conf WHERE load_module=1 ORDER BY priority;'
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($res -&gt; getMessage());
+            return array();
+        }
+        $this -&gt; comment($res -&gt; numRows() . 'rows');
+        if ($res -&gt; numRows() == 0) {
+            return array();
+        }
+        while ($row = $res -&gt; fetchRow()) {
+            $feeds_array[] = $row;
+        }
+        return $feeds_array;
+    }
+
+    /**
+     * This method will write the XML from the array returned by get_modules_array
+     * @see post_load_modules_conf::get_modules_array
+     * @param array $params array of modules to load
+     */
+    function write_modules_array($params) {
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute(
+        'description', 'Load All External Modules'
+        );
+        $this -&gt; xmlw -&gt; startElement('modules');
+
+        $param_count = count($params);
+        for ($i=0; $i&lt;$param_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('load');
+            $this -&gt; xmlw -&gt; writeAttribute('module', $params[$i]['module_name']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationrssconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/rss.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/rss.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/rss.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ *
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * class to write XML for rss.conf
+*/
+class rss_conf extends fs_configuration {
+
+    function rss_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    function main() {
+        $feeds_array = $this -&gt; get_feeds_array();
+        $this -&gt; xmlw -&gt; startElement('feeds');
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; write_xml($feeds_array);
+    }
+
+    /**
+     * Get RSS feed info from DB
+     *
+     * @return array
+     */
+    function get_feeds_array() {
+        $query = sprintf(
+        'SELECT * FROM rss_conf ORDER BY priority, local_file;'
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            return false;
+        }
+        while ($row = $res -&gt; fetchRow()) {
+            $feeds_array[] = $row;
+        }
+        return $feeds_array;
+    }
+
+    /**
+     * Write XML for RSS feeds that were pulled by get_feeds_arrray
+     * @see get_feeds_array
+     * @param unknown_type $feeds_in
+     */
+    function write_xml($feeds_in) {
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'RSS Parser');
+        $this -&gt; xmlw -&gt; startElement('feeds');
+        $feed_count = count($feeds_in);
+        for ($i=0; $i&lt;$feed_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('feed');
+            $this -&gt; xmlw -&gt; writeAttribute(
+            'name', $feeds_in[$i]['description']
+            );
+            $this -&gt; xmlw -&gt; text($feeds_in[$i]['local_file']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationsofiaconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/sofia.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/sofia.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/sofia.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * sofia.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Write XML for sofia.conf
+*/
+class sofia_conf extends fs_configuration {
+    public function sofia_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    public function main() {
+        $profiles = $this -&gt; get_profiles();
+        $this -&gt; write_config($profiles);
+    }
+
+    /**
+         * Pull the sofia profiles from the db
+         * @return array
+         */
+    private function get_profiles() {
+        $query = &quot;SELECT * FROM sofia_conf&quot;;
+        $profiles = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($profiles)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        return $profiles;
+    }
+
+    /**
+         * Write aliases for current sofia &lt;profile&gt;
+         * @param integer $profile_id id of the sofia profile in sofia_conf
+         */
+    private function write_aliases($profile_id) {
+        $query = &quot;SELECT * FROM sofia_aliases WHERE sofia_id=$profile_id &quot;;
+        $aliases_array = $this -&gt; db -&gt; queryAll($query);
+        $aliases_count = count($aliases_array);
+        if (FS_PDO::isError($aliases_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($aliases_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('aliases');
+
+        for ($i=0; $i&lt;$aliases_count; $i++) {
+            //$this -&gt; comment_array($aliases_array[$i]);
+            $this -&gt; xmlw -&gt; startElement('alias');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $aliases_array[$i]['alias_name']);
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+         * Write the &lt;settings&gt; for the current profile
+         * @param integer $profile_id id of the sofia profile in sofia_conf
+         */
+    private function write_settings($profile_id) {
+        $query = &quot;SELECT * FROM sofia_settings WHERE sofia_id=$profile_id &quot;
+        . &quot;ORDER BY sofia_id, param_name&quot;;
+        $settings_array = $this -&gt; db -&gt; queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($settings_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('settings');
+
+        for ($i=0; $i&lt;$settings_count; $i++) {
+            //$this -&gt; comment_array($settings_array[$i]);
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+         * Write &lt;gateways&gt; XML for current profile
+         * @param integer $profile_id id of the sofia profile in sofia_conf
+         */
+    private function write_gateways($profile_id) {
+        $query = &quot;SELECT * FROM sofia_gateways WHERE sofia_id=$profile_id &quot;
+        . &quot;ORDER BY gateway_name, gateway_param&quot;;
+        $gateway_array = $this -&gt; db -&gt; queryAll($query);
+        $gateway_count = count($gateway_array);
+        //$this -&gt; comment_array($gateway_array);
+        if (FS_PDO::isError($gateway_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($gateway_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('gateways');
+        for ($i=0; $i&lt;$gateway_count; $i++) {
+            $this_gateway = $gateway_array[$i]['gateway_name'];
+            if ($this_gateway != $gateway_array[$i-1]['gateway_name']) {
+                $this -&gt; xmlw -&gt; startElement('gateway');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $this_gateway);
+            }
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $gateway_array[$i]['gateway_param']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $gateway_array[$i]['gateway_value']);
+            $this -&gt; xmlw -&gt; endElement();
+            if (!array_key_exists($i+1, $gateway_array)
+            || $this_gateway != $gateway_array[$i+1]['gateway_name']) {
+                $this -&gt; xmlw -&gt; endElement();
+            }
+            $last_gateway = $this_gateway;
+        }
+        $this -&gt; xmlw -&gt; endElement(); //&lt;/gateways&gt;
+    }
+
+    /**
+         * Write &lt;domains&gt; XML for current sofia profile
+         * @param integer $profile_id id of sofia profile in sofia_conf
+         */
+    private function write_domains($profile_id) {
+        $query = &quot;SELECT * FROM sofia_domains WHERE sofia_id=$profile_id&quot;;
+        $domain_array = $this -&gt; db -&gt; queryAll($query);
+        $domain_count = count($domain_array);
+        if (FS_PDO::isError($domain_array)) {
+            $this -&gt; comment($query);
+                        $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($domain_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('domains');
+        for ($i=0; $i&lt;$domain_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('domain');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $domain_array[$i]['domain_name']);
+            $this -&gt; xmlw -&gt; writeAttribute(
+            'parse', ($domain_array[$i]['parse'] == 1 ? 'true' : 'false')
+            );
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+         * Write XML for single sofia profile (including all subsections)
+         * This method opens and closes the &lt;profile&gt; as well as calling
+         * other methods to complete the other subsections of the XML
+         * @param array $profile array of the current profile
+         */
+    private function write_single_profile($profile) {
+        $this -&gt; xmlw -&gt; startElement('profile');
+        $this -&gt; xmlw -&gt; writeAttribute('name', $profile['profile_name']);
+        $this -&gt; write_aliases($profile['id']);
+        $this -&gt; write_domains($profile['id']);
+        $this -&gt; write_gateways($profile['id']);
+        $this -&gt; write_settings($profile['id']);
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+         * Iterate over the profiles and write the corresponding XML via other methods
+         * @param array $profiles multi-dimentional array from get_profiles
+         */
+    private function write_config($profiles) {
+        $profile_count = count($profiles);
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'Sofia SIP Endpoint');
+        $this -&gt; xmlw -&gt; startElement('profiles');
+        for ($i=0; $i&lt;$profile_count; $i++) {
+            $this -&gt; write_single_profile($profiles[$i]);
+        }
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationspidermonkeyconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/spidermonkey.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/spidermonkey.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/spidermonkey.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * spidermonkey.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * @todo make configuration get pulled from db? maybe just use defines if there's not evern gonna be too many options
+ * Class for writing spidermonkey.conf XML
+*/
+class spidermonkey_conf extends fs_configuration {
+
+    function spidermonkey_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    function main() {
+        $params = $this -&gt; get_params();
+        $this -&gt; write_params($params);
+    }
+
+    private function get_params() {
+        return array(
+        'mod_spidermonkey_teletone',
+        'mod_spidermonkey_odbc',
+        'mod_spidermonkey_core_db'
+        );
+    }
+
+    private function write_params($modules) {
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'JavaScript Plug-In Configuration');
+        $this -&gt; xmlw -&gt; startElement('modules');
+        $module_count = count($modules);
+        for ($i=0; $i&lt;$module_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('load');
+            $this -&gt; xmlw -&gt; writeAttribute('module', $modules[$i]);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationvoicemailconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/voicemail.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/voicemail.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/voicemail.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,132 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * voicemail.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Writes out voicemail.conf XML
+ * @see fs_configuration
+*/
+class voicemail_conf extends fs_configuration {
+
+       public function voicemail_conf() {
+        $this -&gt; fs_configuration();
+    }
+
+    public function main() {
+        $profiles = $this -&gt; get_profiles();
+        $this -&gt; write_config($profiles);
+    }
+
+    /**
+     * Get voicemail profiles from db
+     * @return array
+    */
+    private function get_profiles() {
+        $query = &quot;SELECT * FROM voicemail_conf ORDER BY id&quot;;
+        $profiles = $this -&gt; db -&gt; queryAll($query);
+        return $profiles;
+    }
+
+    /**
+     * Write XML for voicemail &lt;settings&gt;
+     * @return void
+    */
+    private function write_settings($profile_id) {
+        $query = sprintf('%s %s %s;'
+        , &quot;SELECT * FROM voicemail_settings &quot;
+        , &quot;WHERE voicemail_id=$profile_id &quot;
+        , &quot;ORDER BY voicemail_id, param_name&quot;
+        );
+        $settings_array = $this -&gt; db -&gt; queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($settings_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('settings');
+
+        for ($i=0; $i&lt;$settings_count; $i++) {
+            //$this -&gt; comment_array($settings_array[$i]);
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+        $this -&gt; write_email($profile_id);
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * Write XML for voicemail email settings
+     * @return void
+    */
+    private function write_email($profile_id) {
+        $query = sprintf('%s %s %s;'
+        , &quot;SELECT * FROM voicemail_email &quot;
+        , &quot;WHERE voicemail_id=$profile_id &quot;
+        , &quot;ORDER BY voicemail_id, param_name&quot;
+        );
+        $settings_array = $this -&gt; db -&gt; queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            return ;
+        }
+        if ($settings_count &lt; 1) {
+            return ;
+        }
+        $this -&gt; xmlw -&gt; startElement('email');
+
+        for ($i=0; $i&lt;$settings_count; $i++) {
+            //$this -&gt; comment_array($settings_array[$i]);
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -&gt; xmlw -&gt; endElement();//&lt;/param&gt;
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * Write the XML for the current profile in write_profiles
+     * @return void
+    */
+    private function write_single_profile($profile) {
+        $this -&gt; xmlw -&gt; startElement('profile');
+        $this -&gt; xmlw -&gt; writeAttribute('name', $profile['vm_profile']);
+        $this -&gt; write_settings($profile['id']);
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * Write the entire XML config for the voicemail module
+     * Write XML by calling other methods to do specific areas of config
+     * @return void
+    */
+    private function write_config($profiles) {
+        $profile_count = count($profiles);
+        $this -&gt; xmlw -&gt; startElement('configuration');
+        $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'voicemail Endpoint');
+        $this -&gt; xmlw -&gt; startElement('profiles');
+        for ($i=0; $i&lt;$profile_count; $i++) {
+            $this -&gt; write_single_profile($profiles[$i]);
+        }
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlconfigurationxml_cdrconfphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/xml_cdr.conf.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/xml_cdr.conf.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/configuration/xml_cdr.conf.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * xml_cdr.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Class for writing xml_cdr.conf XML
+*/
+class xml_cdr_conf extends fs_configuration {
+        function xml_cdr_conf() {
+                $this -&gt; fs_configuration();
+        }
+
+        function main() {
+                $params = $this -&gt; get_settings();
+                $this -&gt; write_settings($params);
+        }
+
+        function get_settings() {
+            return array('url'=&gt;'http://$${curl_host}/fs_curl/cdr.php', 'encode'=&gt;'true');
+                return array(
+                'url'=&gt;'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']
+                , 'encode'=&gt;'true'
+                );
+        }
+
+        function write_settings($params) {
+                $this -&gt; xmlw -&gt; startElement('configuration');
+                $this -&gt; xmlw -&gt; writeAttribute('name', basename(__FILE__, '.php'));
+                $this -&gt; xmlw -&gt; writeAttribute('description', 'CDRs via XML Post');
+                $this -&gt; xmlw -&gt; startElement('settings');
+                while (list($name, $value) = each($params)) {
+                        $this -&gt; xmlw -&gt; startElement('param');
+                        $this -&gt; xmlw -&gt; writeAttribute('name', $name);
+                        $this -&gt; xmlw -&gt; writeAttribute('value', $value);
+                        $this -&gt; xmlw -&gt; endElement();
+                }
+                $this -&gt; xmlw -&gt; endElement();
+                $this -&gt; xmlw -&gt; endElement();
+        }
+}
+
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurldialplan_importerphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplan_importer.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplan_importer.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplan_importer.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,215 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Dialplan
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+*/
+
+/**
+ * Switched to simple xml, pdo and new schemea.  Added several new supporint functions
+ * @author Michael Phillips
+ */
+
+require_once('libs/fs_pdo.php');
+
+/**
+ * require global definitions for FS_CURL
+ */
+require_once('global_defines.php');
+
+/**
+ * Output the upload form
+ * echo out the HTML for the upload form.
+ * @return null
+*/
+function upload_form() {
+    echo '&lt;html&gt;';
+echo '&lt;head&gt;&lt;title&gt;Freeswitch XML Dialplan Importer&lt;/title&gt;&lt;/head&gt;';
+echo '&lt;p&gt;Import Freeswitch dialplan to the Database&lt;/p&gt;';
+    echo '&lt;h2&gt;Select A File To Import&lt;/h2&gt;';
+    echo '&lt;form method=&quot;post&quot; action=&quot;' . $_SERVER['PHP_SELF'] . '&quot; enctype=&quot;multipart/form-data&quot;&gt;';
+    echo '&lt;input type=&quot;file&quot; name=&quot;file&quot;&gt;';
+    echo '&lt;input type=&quot;submit&quot; name=&quot;confirmed&quot;&gt;';
+        echo '&lt;p&gt;&lt;input type=&quot;checkbox&quot; name=&quot;clear_dialplan&quot; value=&quot;true&quot;&gt; Clear all dialplan data before insert?&lt;/p&gt;';
+    echo '&lt;/form&gt;';
+    echo '&lt;/html&gt;';
+}
+
+/**
+ * Perform Insert Query
+ * take MDB2 object and query as params and
+ * perform query, setting error flag in the event
+ * of a db error.
+ * @return null
+*/
+function run_query($db, $query) {
+    syslog(LOG_INFO, $query);
+    $affected = $db -&gt; exec($query);
+    if (FS_PDO::isError($affected)) {
+        if (!defined('UNSUCCESSFUL_QUERY')) {
+            define('UNSUCCESSFUL_QUERY', true);
+        }
+        echo &quot;$query&lt;br&gt;\n&quot;;
+        echo $affected -&gt; getMessage() . &quot;\n&quot;;
+    }
+}
+
+/**
+ * Check uploaded file for obvious problems
+ * This function checks the uploaded file's
+ * size, type, length, etc to make sure it's
+ * worth continuing with processing
+ * @return bool
+*/
+function check_uploaded_file($file_array) {
+    if (!is_uploaded_file($file_array['tmp_name'])) {
+        echo &quot;File NOT uploaded OK&lt;br&gt;&quot;;
+        die(upload_form());
+    } elseif ($file_array['size'] &lt; 1) {
+        echo &quot;File was empty&quot;;
+        die(upload_form());
+    } elseif ($file_array['error'] &gt; 0) {
+        echo &quot;Uploading file encountered error #&quot; . $file_array['error'];
+        die(upload_form());
+    } elseif ($file_array['type'] != 'text/xml') {
+        echo &quot;Expected file of type 'text/xml', but got &quot; . $file_array['type'];
+        die(upload_form());
+    } else {
+        //echo &quot;File seems uploaded OK&lt;br&gt;&quot;;
+        return true;
+    }
+}
+
+
+if (!array_key_exists('confirmed', $_REQUEST)) {
+    die(upload_form());
+}
+
+/*
+foreach ($_REQUEST as $key =&gt; $val) {
+echo &quot;$key =&gt; $val &lt;br&gt;\n&quot;;
+}
+if (is_array($_FILES) &amp;&amp; count($_FILES)&gt;0) {
+echo &quot;&lt;h2&gt;FILES is an array&lt;/h2&gt;&quot;;
+print_r($_FILES);
+}
+*/
+
+
+// no need to do anything till we check that the file's ok
+if (check_uploaded_file($_FILES['file'])) {
+    $xml_file = $_FILES['file']['tmp_name'];
+    //move_uploaded_file($tmp_file, $xml_file);
+        //is_uploaded_file
+        //echo filesize($xml_file);
+    //echo $xml_file . &quot;\n&lt;br&gt;&quot;;
+    $xml_str = file_get_contents($xml_file);
+}
+
+
+try {
+        $db = new FS_PDO(DEFAULT_DSN,DEFAULT_DSN_LOGIN, DEFAULT_DSN_PASSWORD);
+} catch(Exception $e) {
+                die($e-&gt;getMessage());
+}
+
+if($_POST['clear_dialplan']) {
+        truncate_dialplan();
+}
+
+echo &quot;&lt;pre&gt;&quot;;
+$xml = simplexml_load_string($xml_str);
+$num_of_conext = sizeof($xml-&gt;context);
+
+
+$dialplan_id = insert_dialplan();
+foreach($xml-&gt;children() as $context =&gt; $context_children) {
+        //echo $context . &quot; =&gt; &quot; . $context_children-&gt;attributes()-&gt;name . &quot;\n&quot;;
+        $context_id = insert_dialplan_context($dialplan_id, $context_children-&gt;attributes()-&gt;name);
+
+        foreach($context_children as $extension =&gt; $extension_children) {
+                //echo &quot;\t&quot; . $extension . &quot; =&gt; name: &quot; . $extension_children-&gt;attributes()-&gt;name . &quot;  continue: &quot; . $extension_children-&gt;attributes()-&gt;continue . &quot;\n&quot; ;
+                if($extension == 'extension') { //verify again bad input
+                        $extension_id = insert_dialplan_extension($context_id, $extension_children-&gt;attributes()-&gt;name, $extension_children-&gt;attributes()-&gt;continue);
+                }
+                foreach($extension_children as $condition =&gt; $condition_children) {
+                        //echo &quot;\t\t&quot; . $condition . &quot; =&gt; &quot; . $condition_children-&gt;attributes()-&gt;field . &quot;, expression; &quot; .$condition_children-&gt;attributes()-&gt;expression . &quot;\n&quot;;
+                        $condition_id = insert_dialplan_condition($extension_id, $condition_children-&gt;attributes()-&gt;field, $condition_children-&gt;attributes()-&gt;expression);
+                        foreach($condition_children as $action =&gt; $action_childress) {
+                                //echo &quot;\t\t\t&quot; . $action . &quot; =&gt; &quot; . $action_childress-&gt;attributes()-&gt;application . &quot;, expression; &quot; .$action_childress-&gt;attributes()-&gt;data . &quot;\n&quot;;
+                                if($action == ('action' || 'anti-action')) { //verify again bad input
+                                        insert_dialplan_actions($condition_id, $action_childress-&gt;attributes()-&gt;application , $action_childress-&gt;attributes()-&gt;data, $action);
+                                } else {
+                                        echo &quot;bad xml $action&quot;;
+                                }// end if
+                        } //end foreach
+                } //end foreach
+        }// end foreach
+} // end foreach
+
+echo &quot;&lt;/pre&gt;&quot;;
+
+function insert_dialplan($domain = 'freeswitch' , $ip_address = '127.0.0.1') {
+        global $db;
+        $sql = sprintf(&quot;INSERT INTO dialplan (`domain`, `ip_address`) VALUES ('%s', '%s')&quot;, $domain, $ip_address);
+        $db-&gt;query($sql);
+        return $db-&gt;lastInsertId() ;
+}
+
+function insert_dialplan_context($dialplan_id, $context) {
+        global $db;
+        $sql = sprintf(&quot;INSERT INTO dialplan_context (`dialplan_id`, `context`, `weight`) VALUES (%d, '%s', %d)&quot;, $dialplan_id, $context, get_next_weight('context'));
+        $db-&gt;query($sql);
+        return $db-&gt;lastInsertId() ;
+}
+
+function insert_dialplan_extension($context_id, $name, $continue) {
+        global $db;
+        $sql = sprintf(&quot;INSERT INTO dialplan_extension (`context_id`, `name`, `continue`, `weight`) VALUES (%d, '%s', '%s', %d)&quot;, $context_id, $name, $continue, get_next_weight('extension'));
+        get_next_weight('extension');
+        $db-&gt;query($sql);
+        return $db-&gt;lastInsertId() ;
+}
+
+function insert_dialplan_condition($extension_id, $field, $expression) {
+        global $db;
+        $sql = sprintf(&quot;INSERT INTO dialplan_condition (`extension_id`, `field`, `expression`, `weight`) VALUES (%d, '%s', '%s', %d)&quot;, $extension_id, addslashes($field), addslashes($expression),get_next_weight('condition') );
+        //echo $sql . &quot;\n&quot;;
+        $db-&gt;query($sql);
+        return $db-&gt;lastInsertId() ;
+}
+
+function insert_dialplan_actions($condition_id, $application , $data, $type) {
+        global $db;
+        $sql = sprintf(&quot;INSERT INTO dialplan_actions(`condition_id`, `application`, `data`, `type`, `weight`) VALUES (%d, '%s', '%s', '%s', %d)&quot;, $condition_id, addslashes($application), addslashes($data), $type, get_next_weight('actions'));
+        $db-&gt;query($sql);
+        return $db-&gt;lastInsertId() ;
+}
+
+function get_next_weight($table) { //used for weighting system
+        global $db;
+        $sql = sprintf(&quot;SELECT MAX(weight) as max FROM dialplan_%s&quot;, $table);
+        $res = $db-&gt;queryAll($sql);
+        return ($res[0]['max'] + 10);
+}
+
+function truncate_dialplan() {
+        global $db;
+        $db-&gt;query('TRUNCATE dialplan_extension');
+        $db-&gt;query('TRUNCATE dialplan');
+        $db-&gt;query('TRUNCATE dialplan_context');
+        $db-&gt;query('TRUNCATE dialplan_condition');
+        $db-&gt;query('TRUNCATE dialplan_actions');
+}
+
+if (defined(UNSUCCESSFUL_QUERY) &amp;&amp; UNSUCCESSFUL_QUERY == true) {
+    echo &quot;&lt;h2&gt;Some Queries Were Not Successful&lt;/h2&gt;&quot;;
+} else {
+    echo &quot;&lt;h2&gt;File Successfully Imported&lt;/h2&gt;&quot;;
+}
+upload_form();
+
+//printf(&quot;&lt;pre&gt;%s&lt;/pre&gt;&quot;, print_r($xml_obj, true);
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurldialplanslcrphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplans/lcr.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplans/lcr.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/dialplans/lcr.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+&lt;?php
+
+class dialplan_lcr {
+
+    function main(&amp;$obj) {
+        $obj -&gt; xmlw -&gt; startElement('section');
+        $obj -&gt; xmlw -&gt; writeAttribute('name', 'dialplan');
+        $obj -&gt; xmlw -&gt; writeAttribute('description', 'FreeSWITCH Dialplan');
+        $obj -&gt; xmlw -&gt; startElement('context');
+        $obj -&gt; xmlw -&gt; writeAttribute('name', 'lcr');
+        $obj -&gt; xmlw -&gt; startElement('extension');
+        $obj -&gt; xmlw -&gt; startElement('condition');
+        $applications = $this -&gt; lcr_lookup($obj);
+        $app_count = count($applications);
+        
+        $sets = array(
+        'hangup_after_bridge'=&gt;'true', 
+        'continue_on_failure'=&gt;'true'
+        );
+        foreach ($sets as $var=&gt;$val) {
+            $this -&gt; xmlw -&gt; startElement('action');
+            $this -&gt; xmlw -&gt; writeAttribute('application', 'set');
+            $this -&gt; xmlw -&gt; writeAttribute('data', &quot;$var=$val&quot;);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        for ($i=0; $i&lt;$app_count; $i++) {
+            $obj -&gt; xmlw -&gt; startElement($applications[$i]['type']);
+            $obj -&gt; xmlw -&gt; writeAttribute('application', 'bridge');
+            $obj -&gt; xmlw -&gt; writeAttribute('data', $applications[$i]['data']);
+            $obj -&gt; xmlw -&gt; endElement();
+        }
+        $obj -&gt; xmlw -&gt; endElement(); //&lt;/condition&gt;
+        $obj -&gt; xmlw -&gt; endElement(); //&lt;/extension&gt;
+        $obj -&gt; xmlw -&gt; endElement(); //&lt;/context&gt;
+        $obj -&gt; xmlw -&gt; endElement(); //&lt;/section&gt;
+
+    }
+
+    function lcr_lookup(&amp;$obj) {
+        $obj -&gt; comment_array($obj -&gt; request);
+        $digitstr = $obj -&gt; request['destination_number'];
+        $digitlen = strlen($digitstr);
+        $where_clause = '';
+        for ($i=0; $i&lt;$digitlen; $i++) {
+            $where_clause .= sprintf(&quot;%s digits='%s' &quot;
+            , ($i==0?&quot;WHERE&quot;:&quot;OR&quot;)
+            , substr($digitstr, 0, $i+1)
+            );
+        }
+        $query = sprintf(&quot;SELECT l.digits, c.Carrier_Name, l.rate, cg.id, cg.gateway, cg.id AS gwid, l.lead_strip, l.trail_strip, l.prefix, l.suffix FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id %s ORDER BY length(digits) DESC, rate;&quot;, $where_clause);
+        $res = $obj -&gt; db -&gt; query($query);
+        $obj -&gt; comment($query);
+        if (FS_PDO::isError($res)) {
+            $obj -&gt; comment($query);
+            $obj -&gt; comment($this -&gt; db  -&gt; getMessage());
+            $obj -&gt; file_not_found();
+        }
+        $carriers = array();
+        while ($row = $res -&gt; fetchRow()) {
+            $carrier_id = $row['gwid'];
+            if (array_key_exists($carrier_id, $carriers)) {
+                continue;
+            }
+            $carriers[$carrier_id] = true;
+            $datastr = sprintf('sofia/gateway/%s/%s', $row['gateway'], $digitstr);
+            $results[] = array('type'=&gt;'action', 'data'=&gt;$datastr);
+        }
+        return $results;
+    }
+}
+
+
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlfs_configurationphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_configuration.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_configuration.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_configuration.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * fs_configuration.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Class for all module configurations
+ * @return object
+*/
+class fs_configuration extends fs_curl {
+    /**
+     * Class Instantiation
+     * This method will instantiate all other objects upon which it relies.
+     * @return void
+    */
+    function fs_configuration() {
+        $this -&gt; fs_curl();
+        $mod_name = sprintf('mod_%s', str_replace('.conf', '', $this -&gt; request['key_value']));
+        $this -&gt; comment(&quot;module name is $mod_name&quot;);
+        if (!($this -&gt; is_mod_enabled($mod_name))
+        &amp;&amp; !($this -&gt; is_modless_conf($this -&gt; request['key_value']))) {
+            $this -&gt; comment('module not enabled and not modless config file');
+            $this -&gt; file_not_found();
+        }
+        $this -&gt; xmlw -&gt; startElement('section');
+        $this -&gt; xmlw -&gt; writeAttribute('name', 'configuration');
+        $this -&gt; xmlw -&gt; writeAttribute(
+        'description', 'FreeSWITCH Configuration'
+        );
+    }
+
+    /**
+     * Enabled module checker
+     * This method will check if a module is enabled before
+     * returning the XML for the module. If the module's not
+     * enabled, the file_not_found method will be called.
+     * @param string $mod_name name of module to check
+     * @return bool
+    */
+    function is_mod_enabled($mod_name) {
+        $query = sprintf('%s %s'
+        , &quot;SELECT * FROM post_load_modules_conf&quot;
+        , &quot;WHERE module_name='$mod_name' AND load_module=1&quot;
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if ($this-&gt;db-&gt;errorCode() !== FS_SQL_SUCCESS) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this-&gt;db-&gt;errorCode());
+            return true; //default allow policy
+            return false; //comment previous line to default deny
+        } elseif ($res -&gt; rowCount() == 1) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Allow config files that aren't tied to any module
+     *
+     * @param string $conf
+     * @return bool
+     */
+    private function is_modless_conf($conf) {
+        $this -&gt; comment(&quot;conf is $conf&quot;);
+        $query = sprintf(
+        &quot;SELECT COUNT(*) cnt FROM modless_conf WHERE conf_name = '$conf';&quot;
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($res -&gt; getMessage());
+            return true; //default allow policy
+            return false; //comment previous line to default deny
+        }
+        $row = $res -&gt; fetchRow();
+        //$this -&gt; comment($row['cnt']);
+        return $row['cnt'];
+    }
+}
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlfs_curlphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_curl.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_curl.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_curl.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,337 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * fs_curl.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * FreeSWITCH CURL base class
+ * Base class for all curl XML output, contains methods for XML output and
+ * connecting to a database
+ * @return void
+*/
+class fs_curl {
+    /**
+     * FS_PDO Object
+     * @link http://www.php.net/pdo
+     * @var $db FS_PDO
+     */
+    public $db;
+    /**
+     * Array of _REQUEST parameters passed
+     *
+     * @var array
+     */
+    public $request;
+    /**
+     * XMLWriter object
+     * @link http://php.net/XMLWriter
+     * @var object
+     */
+    public $xmlw;
+    /**
+     * Array of comments to be output in the XML
+     * @see fs_curl::comment
+     * @var array
+     */
+    private $comments;
+
+    /**
+     * Instantiation of XMLWriter and FS_PDO
+     * This method will instantiate the FS_PDO and XMLWriter classes for use
+     * in child classes
+     * @return void
+    */
+    public function fs_curl() {
+        openlog('fs_curl', LOG_NDELAY | LOG_PID, LOG_USER);
+        header('Content-Type: text/xml');
+        $this -&gt; generate_request_array();
+        $this -&gt; open_xml();
+        $inc = array('required'=&gt;'libs/fs_pdo.php'); // include an external file. i.e. 'required'=&gt;'important_file.php'
+        $this -&gt; include_files($inc);
+        $this -&gt; connect_db(DEFAULT_DSN, DEFAULT_DSN_LOGIN, DEFAULT_DSN_PASSWORD );
+        set_error_handler(array($this, 'error_handler'));
+        //trigger_error('blah', E_USER_ERROR);
+    }
+
+    /**
+     * Connect to a database via FS_PDO
+     * @param mixed $dsn data source for database connection (array or string)
+     * @return void
+    */
+    public function connect_db($dsn, $login, $password) {
+        try {
+            $this -&gt; db = new FS_PDO($dsn, $login, $password);
+        } catch(Exception $e) {
+            $this -&gt; comment($e-&gt;getMessage());
+            $this -&gt; file_not_found(); //program terminates in function file_not_found()
+        }
+    }
+
+    /**
+     * Method to add comments to XML
+     * Adds a comment to be displayed in the final XML
+     * @param string $comment comment string to be output in XML
+     * @return void
+    */
+    public function comment($comment) {
+        $this -&gt; comments[] = $comment;
+    }
+
+    /**
+     * Generate a globally accesible array of the _REQUEST parameters passed
+     * Generates an array from the _REQUEST parameters that were passed, keeping
+     * all key =&gt; value combinations intact
+     * @return void
+    */
+    private function generate_request_array() {
+        while (list($req_key, $req_val) = each($_REQUEST)) {
+            //$this -&gt; comment(&quot;$req_key =&gt; $req_val&quot;);
+            $this -&gt; request[$req_key] = $req_val;
+        }
+    }
+
+    /**
+     * Actual Instantiation of XMLWriter Object
+     * This method creates an XMLWriter Object and sets some needed options
+     * @return void
+    */
+    private function open_xml() {
+        $this -&gt; xmlw = new XMLWriter();
+        $this -&gt; xmlw -&gt; openMemory();
+        if (array_key_exists('fs_curl_debug', $this -&gt; request)
+            &amp;&amp; $this -&gt; request['fs_curl_debug'] == true) {
+            $this -&gt; xmlw -&gt; setIndent(true);
+            $this -&gt; xmlw -&gt; setIndentString('  ');
+        } else {
+            $this -&gt; xmlw -&gt; setIndent(false);
+            $this -&gt; xmlw -&gt; setIndentString('  ');
+        }
+        $this -&gt; xmlw -&gt; startDocument('1.0', 'UTF-8', 'no');
+        //set the freeswitch document type
+        $this -&gt; xmlw -&gt; startElement('document');
+        $this -&gt; xmlw -&gt; writeAttribute('type', 'freeswitch/xml');
+    }
+
+    /**
+     * Method to call on any error that can not be revovered from
+     * This method was written to return a valid XML response to FreeSWITCH
+     * in the event that we are unable to generate a valid configuration file
+     * from the passed information
+     * @return void
+    */
+    public function file_not_found() {
+        $this -&gt; comment('Include Path = ' . ini_get('include_path'));
+        $not_found = new XMLWriter();
+        $not_found -&gt; openMemory();
+        $not_found -&gt; setIndent(true);
+        $not_found -&gt; setIndentString('  ');
+        $not_found -&gt; startDocument('1.0', 'UTF-8', 'no');
+        //set the freeswitch document type
+        $not_found -&gt; startElement('document');
+        $not_found -&gt; writeAttribute('type', 'freeswitch/xml');
+        $not_found -&gt; startElement('section');
+        $not_found -&gt; writeAttribute('name', 'result');
+        $not_found -&gt; startElement('result');
+        $not_found -&gt; writeAttribute('status', 'not found');
+        $not_found -&gt; endElement();
+        $not_found -&gt; endElement();
+        /* we put the comments inside the root element so we don't
+         * get complaints about markup outside of it */
+        $this -&gt; comments2xml($not_found, $this -&gt; comments);
+        $not_found -&gt; endElement();
+        echo $not_found -&gt; outputMemory();
+        exit();
+    }
+
+    /**
+     * Generate XML comments from comments array
+     * This [recursive] method will iterate over the passed array, writing XML
+     * comments and calling itself in the event that the &quot;comment&quot; is an array
+     * @param object $xml_obj Already instantiated XMLWriter object
+     * @param array $comments [Multi-dementional] Array of comments to be added
+     * @param integer $space_pad Number of spaces to indent the comments
+     * @return void
+    */
+    private function comments2xml($xml_obj, $comments, $space_pad=0) {
+        $comment_count = count($comments);
+        for ($i = 0; $i &lt; $comment_count; $i++) {
+            if (array_key_exists($i, $comments)) {
+                if (!is_array($comments[$i])) {
+                    $xml_obj -&gt; writeComment($comments[$i]);
+                } else {
+                    $this -&gt; comments2xml($xml_obj, $comments[$i], $space_pad + 2);
+                }
+            }
+        }
+    }
+
+    /**
+     * End open XML elments in XMLWriter object
+     * @return void
+    */
+    private function close_xml() {
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * Close and Output XML and stop script execution
+     * @return void
+    */
+    public function output_xml() {
+        $this-&gt;comment(
+            sprintf('Total # of Queries Run: %d', $this-&gt;db-&gt;counter)
+        );
+        $this -&gt; comment(sprintf(&quot;Estimated Execution Time Is: %s&quot;
+                , (ereg_replace(
+                '^0\.([0-9]+) ([0-9]+)$', '\2.\1', microtime()) - START_TIME)
+            ));
+
+        $this -&gt; comments2xml($this -&gt; xmlw, $this -&gt; comments);
+        $this -&gt; close_xml();
+        $xml_out = $this -&gt; xmlw -&gt; outputMemory();
+        $this -&gt; debug('---- Start XML Output ----');
+        $this -&gt; debug(explode(&quot;\n&quot;, $xml_out));
+        $this -&gt; debug('---- End XML Output ----');
+        echo $xml_out;
+        exit();
+    }
+
+    /**
+     * Recursive method to add an array of comments
+     * @return void
+    */
+    public function comment_array($array, $spacepad=0) {
+        $spaces = str_repeat(' ', $spacepad);
+        foreach ($array as $key =&gt; $val) {
+            if (is_array($val)) {
+                $this -&gt; comment(&quot;$spaces$key =&gt; Array&quot;);
+                $this -&gt; comment_array($val, $spacepad+2);
+            } else {
+                $this -&gt; comment(&quot;$spaces$key =&gt; $val&quot;);
+            }
+        }
+    }
+
+    /**
+     * Include files for child classes
+     * This method will include the files needed by child classes.
+     * Expects an associative array of type =&gt; path
+     * where type = [required|any other string]
+     * @param array $file_array associative array of files to include
+     * @return void
+     * @todo add other types for different levels of errors
+    */
+    public function include_files($file_array) {
+        $return = FS_CURL_SUCCESS;
+        while (list($type, $file) = each($file_array)) {
+            $inc = @include_once($file);
+            if (!$inc) {
+                $comment = sprintf(
+                'Unable To Include %s File %s', $type, $file
+                );
+                $this -&gt; comment($comment);
+                if ($type == 'required') {
+                    $return = FS_CURL_CRITICAL;
+                } else {
+                    if ($return != FS_CURL_CRITICAL) {
+                        $return = FS_CURL_WARNING;
+                    }
+                }
+            }
+        }
+        if ($return == FS_CURL_CRITICAL) {
+            $this -&gt; file_not_found();
+        }
+        return $return;
+    }
+
+    /**
+     * Class-wide error handler
+     * This method should be called whenever there is an error in any child
+     * classes, script execution and returning is pariatlly determined by
+     * defines
+     * @see RETURN_ON_WARN
+     * @return void
+     * @todo add other defines that control what, if any, comments gets output
+    */
+    public function error_handler($no, $str, $file, $line) {
+        if ($no == E_STRICT) {
+            return true;
+        }
+        $file = ereg_replace('\.(inc|php)$', '', $file);
+        $this -&gt; comment(basename($file) . &quot;:$line - $no:$str&quot;);
+
+        switch ($no) {
+            case E_USER_NOTICE:
+                case E_NOTICE:
+                    break;
+                case E_USER_WARNING:
+                    case E_WARNING:
+                        if (defined('RETURN_ON_WARN') &amp;&amp; RETURN_ON_WARN == true) {
+                            break;
+                        }
+                        case E_ERROR:
+                            case E_USER_ERROR:
+                                default:
+                                    $this -&gt; file_not_found();
+                                }
+                                return true;
+                            }
+
+    /**
+     * Function to print out debugging info
+     * This method will recieve arbitrary data and send it using your method of
+     * choice.... enable/disable by defining FS_CURL_DEBUG to and arbitrary integer
+     * @param mixed $input what to debug, arrays and strings tested, objects MAY work
+     * @param integer $debug_level debug if $debug_level &lt;= FS_CURL_DEBUG
+     * @param integer $spaces
+     */
+                            public function debug($input, $debug_level=0, $spaces=0) {
+                                if (defined('FS_CURL_DEBUG') &amp;&amp; $debug_level &lt;= FS_CURL_DEBUG ) {
+                                    if (is_array($input)) {
+                                        $this -&gt; debug('Array (', $debug_level, $spaces);
+                                        foreach ($input as $key=&gt;$val) {
+                                            if (is_array($val) || is_object($val)) {
+                                                $this -&gt; debug(&quot;[$key] =&gt; $val&quot;, $debug_level, $spaces+4);
+                                                $this -&gt; debug('(', $debug_level, $spaces + 8);
+                                                $this -&gt; debug($val, $debug_level, $spaces + 8);
+                                            } else {
+                                                $this -&gt; debug(&quot;[$key] =&gt; '$val'&quot;, $debug_level, $spaces + 4);
+                                            }
+                                        }
+                                        $this -&gt; debug(&quot;)&quot;, $debug_level, $spaces);
+                                    } else {
+                                        $debug_str = sprintf(&quot;%s%s&quot;
+                                            , str_repeat(' ', $spaces), $input
+                                        );
+                                        switch (FS_DEBUG_TYPE) {
+                                            case 0:
+                                                syslog(LOG_NOTICE, $debug_str);
+                                                break;
+                                            case 1:
+                                                $this -&gt; comment($debug_str);
+                                                break;
+                                            case 2:
+                                                $ptr = fopen(FS_DEBUG_FILE, 'a');
+                                                fputs($ptr, &quot;$debug_str\r\n&quot;);
+                                                fclose($ptr);
+                                                break;
+                                            default:
+                                                return;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlfs_dialplanphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_dialplan.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_dialplan.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_dialplan.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,219 @@
</span><ins>+&lt;?php
+/**
+ * @package  FS_CURL
+ * @todo i should probably add a condition_weight to order the conditions inside a given extension
+ * fs_dialplan.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * Class for XML dialplan
+*/
+class fs_dialplan extends fs_curl {
+    private $special_class_file;
+
+    public function fs_dialplan() {
+        $this -&gt; fs_curl();
+    }
+
+    /**
+     * This is the method that determines the XML output. Customized dialplans can
+     * be easily created by adding a record to the dialplan_special table with the
+     * appropriate values. The php class MUST contain a &quot;main()&quot; method. The method
+     * should write directly to the xmlw obj that's pased or take care of writing
+     * out the xml itself and exiting as to not return.
+     *
+     */
+    public function main() {
+        $this -&gt; comment($this -&gt; request);
+        $context = $this -&gt; request['Caller-Context'];
+        if ($this -&gt; is_specialized_dialplan($context)) {
+            if (!include_once($this -&gt; special_class_file)) {
+                $this -&gt; file_not_found();
+            }
+            $class = sprintf('dialplan_%s', $context);
+            if (!class_exists($class)) {
+                $this -&gt; comment(&quot;No Class of name $class&quot;);
+                $this -&gt; file_not_found();
+            }
+            $obj = new $class;
+            /**
+             * recieving method should take incoming parameter as &amp;$something
+             */
+            $obj -&gt; main($this);
+        } else {
+            $dp_array = $this -&gt; get_dialplan($context);
+            $this -&gt; writeDialplan($dp_array);
+        }
+        $this -&gt; output_xml();
+    }
+
+    public function is_specialized_dialplan($context) {
+        $query = sprintf(
+        &quot;SELECT * FROM dialplan_special WHERE context='%s'&quot;, $context
+        );
+        $res = $this -&gt; db -&gt; query($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        if ($res -&gt; numRows() == 1) {
+            $row = $res -&gt; fetchRow();
+            $this -&gt; special_class_file = $row['class_file'];
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * This method will pull dialplan from database
+     *
+     * @param string $context context name for XML dialplan
+     * @return array
+     */
+    private function get_dialplan($context) {
+        $dp_array = array();
+                $dpQuery = sprintf(&quot;SELECT
+                        `context`,
+                        `name` as extension,
+                        `application` as application_name,
+                        `data` as application_data,
+                        `field` as condition_field,
+                        `expression` as condition_expression,
+                        `continue` as ext_continue,
+                        `type`
+                FROM dialplan
+                        INNER JOIN dialplan_context USING(dialplan_id)
+                        INNER JOIN dialplan_extension USING(context_id)
+                        INNER JOIN dialplan_condition USING(extension_id)
+                        INNER JOIN dialplan_actions USING(condition_id)
+                WHERE context = '%s'
+                ORDER BY dialplan_context.weight, dialplan_extension.weight, dialplan_condition.weight, dialplan_actions.weight&quot;, $context);
+
+        $res = $this -&gt; db -&gt; query($dpQuery);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        $condition_number = 0;
+        while ($row = $res -&gt; fetchRow()) {
+            $ct = $row['context'];
+            $et = $row['extension'];
+            $ec = $row['ext_continue'];
+            $app = $row['application_name'];
+            $data = $row['application_data'];
+            //$app_cdata = $row['app_cdata'];
+            $type = $row['type'];
+            $cf = $row['condition_field'];
+            $ce = $row['condition_expression'];
+            //$rcd = $row['re_cdata'];
+            $cc = empty($row['cond_break']) ? '0' : $row['cond_break'];
+            $dp_array[$ct][&quot;$et;$ec&quot;][&quot;$cf;$ce;$cc&quot;][] = array(
+            'type'=&gt;$type,
+            'application'=&gt;$app,
+            'data'=&gt;$data,
+            'is_cdata'=&gt;(empty($app_cdata) ? '' : $app_cdata)
+            );
+        }
+        return $dp_array;
+    }
+
+    /**
+     * Write XML dialplan from the array returned by get_dialplan
+     * @see fs_dialplan::get_dialplan
+     * @param array $dpArray Multi-dimentional array from which we write the XML
+     * @todo this method should REALLY be broken down into several smaller methods
+     *
+     */
+    private function writeDialplan($dpArray) {
+        //print_r($dpArray);
+        if (is_array($dpArray)) {
+            $this -&gt; xmlw -&gt; startElement('section');
+            $this -&gt; xmlw -&gt; writeAttribute('name', 'dialplan');
+            $this -&gt; xmlw -&gt; writeAttribute('description', 'FreeSWITCH Dialplan');
+            //$this -&gt; comment('dpArray is an array');
+            foreach ($dpArray as $context =&gt; $extensions_array) {
+                //$this -&gt; comment($context);
+                //start the context
+                $this -&gt; xmlw -&gt; startElement('context');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $context);
+                if (is_array($extensions_array)) {
+                    foreach ($extensions_array as $extension =&gt; $conditions) {
+                        //start an extension
+                        $ex_split = split(';', $extension);
+                        $this -&gt; xmlw -&gt; startElement('extension');
+                        $this -&gt; xmlw -&gt; writeAttribute('name', $ex_split[0]);
+                        if (strlen($ex_split[1]) &gt; 0) {
+                            $this -&gt; xmlw -&gt; writeAttribute('continue', $ex_split[1]);
+                        }
+                        $this -&gt; debug($conditions);
+                        foreach ($conditions as $condition =&gt; $app_array) {
+                            $c_split = split(';', $condition);
+                            $this -&gt; xmlw -&gt; startElement('condition');
+                            if (!empty($c_split[0])) {
+                                $this -&gt; xmlw -&gt; writeAttribute('field', $c_split[0]);
+                            }
+                            if (!empty($c_split[1])) {
+                                if (array_key_exists(3, $c_split)
+                                &amp;&amp; $c_split[3] == true) {
+                                    $this -&gt; xmlw -&gt; startElement('expression');
+                                    $this -&gt; xmlw -&gt; writeCdata($c_split[1]);
+                                    $this -&gt; xmlw -&gt; endElement();
+                                } else {
+                                    $this -&gt; xmlw -&gt; writeAttribute(
+                                    'expression', $c_split[1]
+                                    );
+                                }
+                            }
+                            //$this -&gt; debug($c_split[2]);
+                            if ($c_split[2] != '0') {
+                                $this -&gt; xmlw -&gt; writeAttribute(
+                                'break', $c_split[2]
+                                );
+                            }
+                            //$this -&gt; debug($app_array);
+                            foreach ($app_array as $app) {
+                                if (empty($app['application'])) {
+                                        continue;
+                                }
+                                $this -&gt; xmlw -&gt; startElement($app['type']);
+                                $this -&gt; xmlw -&gt; writeAttribute(
+                                'application', $app['application']
+                                );
+                                if (!empty($app['data'])) {
+                                    if (array_key_exists('is_cdata', $app)
+                                    &amp;&amp; $app['is_cdata'] == true) {
+                                        //$this -&gt; xmlw -&gt; startElement('data');
+                                        $this -&gt; xmlw -&gt; writeCdata($app['data']);
+                                        //$this -&gt; xmlw -&gt; endElement();
+                                    } else {
+                                        $this -&gt; xmlw -&gt; writeAttribute(
+                                        'data', $app['data']
+                                        );
+                                    }
+                                }
+                                $this -&gt; xmlw -&gt; endElement();
+                            }
+                            //&lt;/condition&gt;
+                            $this -&gt; xmlw -&gt; endElement();
+                        }
+                        // &lt;/extension&gt;
+                        $this -&gt; xmlw -&gt; endElement();
+                    }
+                }
+                // &lt;/context&gt;
+                $this -&gt; xmlw -&gt; endElement();
+            }
+            // &lt;/section&gt;
+            $this -&gt; xmlw -&gt; endElement();
+        }
+    }
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlfs_directoryphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_directory.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_directory.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/fs_directory.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,359 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * fs_directory.php
+*/
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @license BSD
+ * @version 0.1
+ * Class for XML directory
+*/
+class fs_directory extends fs_curl {
+    private $user;
+    private $userid;
+    private $users_vars;
+    private $users_params;
+    private $users_gateways;
+    private $users_gateway_params;
+
+    public function fs_directory() {
+        $this -&gt; fs_curl();
+        if(array_key_exists('user', $this-&gt;request)) {
+            $this -&gt; user = $this -&gt; request['user'];
+        }
+        $this -&gt; comment(&quot;User is &quot; . $this-&gt;user);
+    }
+
+    public function main() {
+        $this -&gt; comment($this -&gt; request);
+        $directory_array = $this -&gt; get_directory();
+        $this -&gt; writedirectory($directory_array);
+        $this -&gt; output_xml();
+    }
+
+    /**
+     * This method will pull directory from database
+     * @return array
+     * @todo add GROUP BY to query to make sure we don't get duplicate users
+     */
+    private function get_directory() {
+        $directory_array = array();
+        if (!array_key_exists('domain', $this -&gt; request)) {
+            $this -&gt; comment('domain not passed');
+            $this -&gt; file_not_found();
+        }
+        if (GLOBAL_USERS != true) {
+            $where_array[] = sprintf(&quot;domain='%s'&quot;, $this -&gt; request['domain']);
+        }
+        if (array_key_exists('user', $this -&gt; request)) {
+            $where_array[] = sprintf(&quot;username='%s'&quot;, $this -&gt; user);
+        }
+        if (!empty($where_array)) {
+            $this -&gt; comment('where array has contents');
+            if (count($where_array) &gt; 1) {
+                $where_clause = sprintf('WHERE %s', implode(' AND ', $where_array));
+            } else {
+                $where_clause = sprintf('WHERE %s', $where_array[0]);
+            }
+        } else {
+            $where_clause = '';
+        }
+        $query = sprintf(&quot;SELECT * FROM directory %s ORDER BY username&quot;
+            , $where_clause
+        );
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        if(!empty($this -&gt; user)) {
+            $this -&gt; userid = $res[0]['id'];
+            $this -&gt; comment(sprintf('user id is: %d', $this -&gt; userid));
+        }
+        return $res;
+    }
+
+    /**
+    * This method will pull the params for every user in a domain
+    * @return array of users' params
+    */
+    private function get_users_params() {
+        $where = '';
+        if(!empty($this -&gt; userid)) {
+            $where = sprintf('WHERE directory_id = %d', $this -&gt; userid);
+        }
+        $query = sprintf(&quot;SELECT * FROM directory_params %s;&quot;, $where);
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+
+        $record_count = count($res);
+        for($i=0; $i&lt;$record_count; $i++) {
+            $di = $res[$i]['directory_id'];
+            $pn = $res[$i]['param_name'];
+            $this-&gt;users_params[$di][$pn] = $res[$i]['param_value'];
+        }
+    }
+
+    /**
+     * Writes XML for directory user's &lt;params&gt;
+     * This method will pull all of the user params based on the passed user_id
+     * @param integer $user_id
+     * @return void
+     */
+    private function write_params($user_id) {
+        if (is_array($this-&gt;users_params[$user_id])
+            &amp;&amp; count($this-&gt;users_params[$user_id]) &gt; 0) {
+            $this -&gt; xmlw -&gt; startElement('params');
+            foreach($this-&gt;users_params[$user_id] as $pname =&gt; $pvalue) {
+                $this -&gt; xmlw -&gt; startElement('param');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $pname);
+                $this -&gt; xmlw -&gt; writeAttribute('value', $pvalue);
+                $this -&gt; xmlw -&gt; endElement();
+            }
+            $this -&gt; xmlw -&gt; endElement();
+        }
+    }
+
+    /**
+     * Get all the users' variables
+     */
+    private function get_users_vars() {
+        $where = '';
+        if(!empty($this -&gt; userid)) {
+            $where = sprintf('WHERE directory_id = %d', $this -&gt; userid);
+        }
+        $query = sprintf(&quot;SELECT * FROM directory_vars %s;&quot;, $where);
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+
+        $record_count = count($res);
+        for($i=0; $i&lt;$record_count; $i++) {
+            $di = $res[$i]['directory_id'];
+            $vn = $res[$i]['var_name'];
+            $this-&gt;users_vars[$di][$vn] = $res[$i]['var_value'];
+        }
+    }
+
+    /**
+     * Write all the &lt;variables&gt; for a given user
+     *
+     * @param integer $user_id
+     * @return void
+     */
+    private function write_variables($user_id) {
+        if (array_key_exists($user_id, $this-&gt;users_vars)
+            &amp;&amp; is_array($this-&gt;users_vars[$user_id])) {
+            $this -&gt; xmlw -&gt; startElement('variables');
+            foreach($this-&gt;users_vars[$user_id] as $vname =&gt; $vvalue) {
+                $this -&gt; xmlw -&gt; startElement('variable');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $vname);
+                $this -&gt; xmlw -&gt; writeAttribute('value', $vvalue);
+                $this -&gt; xmlw -&gt; endElement();
+            }
+            $this -&gt; xmlw -&gt; endElement();
+        }
+    }
+
+    /**
+     * get the users' gateways
+     */
+    private function get_users_gateways() {
+        $where = '';
+        if(!empty($this -&gt; userid)) {
+            $where = sprintf('WHERE directory_id = %d', $this -&gt; userid);
+        }
+        $query = sprintf(&quot;SELECT * FROM directory_gateways %s;&quot;, $where);
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        $record_count = count($res);
+        for($i=0; $i&lt;$record_count; $i++) {
+            $di = $res[$i]['directory_id'];
+            $this-&gt;users_gateways[$di][] = $res[$i];
+        }
+    }
+
+    /**
+     * Write all of the XML for the user's &lt;gateways&gt;
+     * This method takes the id of the user from the directory table and pulls
+     * all of the user's gateways. It then calls write_single_gateway for
+     * each of them to write out all of the params
+     * @param integer $user_id
+     * @return void
+     */
+    private function write_gateways($user_id) {
+        if (array_key_exists($user_id, $this-&gt;users_gateways)
+            &amp;&amp; is_array($this -&gt; users_gateways[$user_id])) {
+            $this -&gt; xmlw -&gt; startElement('gateways');
+            $gateway_count = count($this -&gt; users_gateways[$user_id]);
+            for ($i=0; $i&lt;$gateway_count; $i++) {
+                $this -&gt; xmlw -&gt; startElement('gateway');
+                $this -&gt; xmlw -&gt; writeAttribute(
+                'name', $this -&gt; users_gateways[$user_id][$i]['gateway_name']
+                );
+
+                $this -&gt; write_user_gateway_params(
+                    $this -&gt; users_gateways[$user_id][$i]['id']
+                );
+                $this -&gt; xmlw -&gt; endElement();
+            }
+            $this -&gt; xmlw -&gt; endElement();
+        }
+    }
+
+    /**
+     * get users' gateway params
+     */
+    private function get_user_gateway_params() {
+        $query = sprintf(&quot;SELECT * FROM directory_gateway_params;&quot;);
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($this -&gt; db -&gt; getMessage());
+            $this -&gt; file_not_found();
+        }
+        $param_count = count($res);
+        for($i=0; $i&lt;$param_count; $i++) {
+            $dgwid = $res[$i]['id'];
+            $pname = $res[$i]['param_name'];
+            $pvalue = $res[$i]['param_value'];
+            $this-&gt;users_gateway_params[$dgwid][$pname] = $pvalue;
+        }
+    }
+
+    /**
+     * Write out the &lt;params&gt; XML for each user-specific gateway
+     *
+     * @param integer $d_gw_id id from directory_gateways
+     * @return void
+     */
+    private function write_user_gateway_params($d_gw_id) {
+        if (is_array($this-&gt;users_gateway_params[$d_gw_id])
+            &amp;&amp; count($this-&gt;users_gateway_params[$d_gw_id]) &gt; 0) {
+            foreach($this-&gt;users_gateway_params[$d_gw_id] as $pname =&gt; $pvalue) {
+                $this -&gt; xmlw -&gt; startElement('param');
+                $this -&gt; xmlw -&gt; writeAttribute('name', $pname);
+                $this -&gt; xmlw -&gt; writeAttribute('value', $pvalue);
+                $this -&gt; xmlw -&gt; endElement();
+            }
+        }
+    }
+
+    /**
+     * This method will write out XML for global directory params
+     *
+     */
+    function write_global_params() {
+        $query = sprintf('%s %s %s;',
+        'SELECT * FROM directory_global_params dgp',
+        'JOIN directory_domains dd ON dd.id=dgp.domain_id',
+        &quot;WHERE dd.domain_name='&quot; . $this -&gt; request['domain'] . &quot;'&quot;
+        );
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $error_msg = sprintf(&quot;Error while selecting global params - %s&quot;
+                , $this -&gt; db -&gt; getMessage()
+            );
+            trigger_error($error_msg);
+        }
+        $param_count = count($res);
+        $this -&gt; xmlw -&gt; startElement('params');
+        for ($i=0; $i&lt;$param_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('param');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $res[$i]['param_name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $res[$i]['param_value']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * This method will write out XML for global directory variables
+     *
+     */
+    function write_global_vars() {
+        $query = sprintf('%s %s %s;',
+        'SELECT * FROM directory_global_vars dgv',
+        'JOIN directory_domains dd ON dd.id=dgv.domain_id',
+        &quot;WHERE dd.domain_name='&quot; . $this -&gt; request['domain'] . &quot;'&quot;
+        );
+        $res = $this -&gt; db -&gt; queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -&gt; comment($query);
+            $error_msg = sprintf(&quot;Error while selecting global vars - %s&quot;
+                , $this -&gt; db -&gt; getMessage()
+            );
+            trigger_error($error_msg);
+        }
+        $param_count = count($res);
+        $this -&gt; xmlw -&gt; startElement('variables');
+        for ($i=0; $i&lt;$param_count; $i++) {
+            $this -&gt; xmlw -&gt; startElement('variable');
+            $this -&gt; xmlw -&gt; writeAttribute('name', $res[$i]['var_name']);
+            $this -&gt; xmlw -&gt; writeAttribute('value', $res[$i]['var_value']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+    }
+
+    /**
+     * Write XML directory from the array returned by get_directory
+     * @see fs_directory::get_directory
+     * @param array $directory Multi-dimentional array from which we write the XML
+     * @return void
+     */
+    private function writedirectory($directory) {
+        if (empty($directory)) {
+            $this -&gt; comment('no users found');
+            $this -&gt; file_not_found();
+        }
+        $directory_count = count($directory);
+
+        $this -&gt; get_users_params();
+        $this -&gt; get_users_vars();
+        $this -&gt; get_users_gateways();
+        $this -&gt; get_user_gateway_params();
+
+        $this -&gt; xmlw -&gt; startElement('section');
+        $this -&gt; xmlw -&gt; writeAttribute('name', 'directory');
+        $this -&gt; xmlw -&gt; writeAttribute('description', 'FreeSWITCH Directory');
+        $this -&gt; xmlw -&gt; startElement('domain');
+        $this -&gt; xmlw -&gt; writeAttribute('name', $this -&gt; request['domain']);
+        $this -&gt; write_global_params();
+        $this -&gt; write_global_vars();
+
+        for ($i=0; $i&lt;$directory_count; $i++) {
+            $username = $directory[$i]['username'];
+            $mailbox = empty($directory[$i]['mailbox']) ? $username : $directory[$i]['mailbox'];
+            $this -&gt; xmlw -&gt; startElement('user');
+            $this -&gt; xmlw -&gt; writeAttribute('id', $username);
+            $this -&gt; xmlw -&gt; writeAttribute('mailbox', $mailbox);
+            $this -&gt; write_params($directory[$i]['id']);
+            $this -&gt; write_variables($directory[$i]['id']);
+            $this -&gt; write_gateways($directory[$i]['id']);
+            $this -&gt; xmlw -&gt; endElement();
+        }
+        $this -&gt; xmlw -&gt; endElement();
+        $this -&gt; xmlw -&gt; endElement();
+    }
+}
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlglobal_definesphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/global_defines.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/global_defines.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/global_defines.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @license
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ */
+
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * Defines the default dsn for the FS_PDO class
+ */
+define('DEFAULT_DSN', 'mysql:dbname=freeswitch;host=localhost');
+/**
+ * Defines the default dsn login for the PDO class
+ */
+define('DEFAULT_DSN_LOGIN', 'root');
+/**
+ * Defines the default dsn password for the PDOclass
+ */
+define('DEFAULT_DSN_PASSWORD', 'root');
+/**
+ * Generic return success
+ */
+define('FS_CURL_SUCCESS', 0);
+/**
+ * Generic return success
+ */
+define('FS_SQL_SUCCESS', '00000');
+/**
+ * Generic return warning
+ */
+define('FS_CURL_WARNING', 1);
+/**
+ * Generic return critical
+ */
+define('FS_CURL_CRITICAL', 2);
+
+/**
+ * determines how the error handler handles warnings
+ */
+define('RETURN_ON_WARN', true);
+
+/**
+ * Determines whether or not users should be domain specific
+ * If GLOBAL_USERS is true, user info will be returned for whatever
+ * domain is passed.....
+ * NOTE: using a1 hashes will NOT work with this setting
+ */
+define('GLOBAL_USERS', true);
+
+/**
+ * Define debug level... should not be used in production for performance reasons
+ */
+define('FS_CURL_DEBUG', 9);
+
+/**
+ * define how debugging should be done (depends on FS_CURL_DEBUG)
+ * 0 syslog
+ * 1 xml comment
+ * 2 file (named in FS_DEBUG_FILE), take care when using this option as there's currently nothing to watch the file's size
+ */
+define('FS_DEBUG_TYPE', 0);
+
+/**
+ * File to use for debugging to file
+ */
+define('FS_DEBUG_FILE', '/tmp/fs_curl.debug');
+
+
+
+
+//define('', '');
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlindexphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/index.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/index.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/index.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+&lt;?php
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
+ * @version 0.1
+ * initial page hit in all curl requests
+ */
+
+/**
+ * define for the time that execution of the script started
+ */
+define('START_TIME', ereg_replace('^0\.([0-9]+) ([0-9]+)$', '\2.\1', microtime()));
+
+/**
+ * Pre-Class initialization die function
+ * This function should be called on any
+ * critical error condition before the fs_curl
+ * class is successfully instantiated.
+ * @return void
+*/
+
+function file_not_found($no=false, $str=false, $file=false, $line=false) {
+    if ($no == E_STRICT) {
+        return;
+    }
+    header('Content-Type: text/xml');
+    $xmlw = new XMLWriter();
+    $xmlw -&gt; openMemory();
+    $xmlw -&gt; setIndent(true);
+    $xmlw -&gt; setIndentString('  ');
+    $xmlw -&gt; startDocument('1.0', 'UTF-8', 'no');
+    //set the freeswitch document type
+    $xmlw -&gt; startElement('document');
+    $xmlw -&gt; writeAttribute('type', 'freeswitch/xml');
+    $xmlw -&gt; startElement('section');
+    $xmlw -&gt; writeAttribute('name', 'result');
+    $xmlw -&gt; startElement('result');
+    $xmlw -&gt; writeAttribute('status', 'not found');
+    $xmlw -&gt; endElement();
+    $xmlw -&gt; endElement();
+    $xmlw -&gt; endElement();
+    if (!empty($no) &amp;&amp; !empty($str) &amp;&amp; !empty($file) &amp;&amp;!empty($line)) {
+        $xmlw -&gt; writeComment(&quot;ERROR: $no - ($str) on line $line of $file&quot;);
+    }
+    echo $xmlw -&gt; outputMemory();
+    exit();
+}
+error_reporting(E_ALL);
+set_error_handler('file_not_found');
+
+if (!class_exists('XMLWriter')) {
+    trigger_error(
+    &quot;XMLWriter Class NOT Found... You Must install it before using this package&quot;
+        , E_USER_ERROR
+    );
+}
+if (!(@include_once('fs_curl.php'))
+    || !(@include_once('global_defines.php'))) {
+    trigger_error(
+    'could not include fs_curl.php or global_defines.php', E_USER_ERROR
+    );
+}
+if (!is_array($_REQUEST)) {
+    trigger_error('$_REQUEST is not an array');
+}
+$section = $_REQUEST['section'];
+$section_file = sprintf('fs_%s.php', $section);
+/**
+ * this include will differ based on the section that's passed
+ */
+if (!(@include_once($section_file))) {
+    trigger_error(&quot;unable to include $section_file&quot;);
+}
+switch ($section) {
+    case 'configuration':
+        if (!array_key_exists('key_value', $_REQUEST)) {
+            trigger_error('key_value does not exist in $_REQUEST');
+        }
+        $config = $_REQUEST['key_value'];
+        $processor = sprintf('configuration/%s.php', $config);
+        $class = str_replace('.', '_', $config);
+        if (!(@include_once($processor))) {
+            trigger_error(&quot;unable to include $processor&quot;);
+        }
+        $conf = new $class;
+        $conf -&gt; comment(&quot;class name is $class&quot;);
+        break;
+    case 'dialplan':
+        $conf = new fs_dialplan();
+        break;
+    case 'directory':
+        $conf = new fs_directory();
+        break;
+}
+
+$conf -&gt; debug('---- Start _REQUEST ----');
+$conf -&gt; debug($_REQUEST);
+$conf -&gt; debug('---- End _REQUEST ----');
+$conf -&gt; main();
+$conf -&gt; output_xml();
+
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurllibsfs_pdophp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/libs/fs_pdo.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/libs/fs_pdo.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/libs/fs_pdo.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+&lt;?php
+/**
+ * FS_CURL was originally written using the MDB2 pear class for database interactions.
+ * MDB2 was deprecated in favor or PHP's PDO.
+ * 
+ * This has been tested with MySQL but should work with many other RDBMSs
+ * @author Michael Phillips &lt;michael.j.phillips@gmail.com&gt;
+ * @license bsd http://www.opensource.org/licenses/bsd-license.php
+ */

+class FS_PDO extends PDO {
+        /**
+         * Default fetch mode. Associative arrays seem to be used most often
+         */
+        private $fetch_mode = PDO::FETCH_ASSOC;
+
+        /**
+         * Basic counter for profiling the number of queries executed.
+         */        
+        public $counter = 0;
+        
+        public function __construct($dsn, $login = NULL, $password = NULL, $options = NULL) {
+                parent::__construct($dsn, $login, $password, $options);
+                $this-&gt;setAttribute( PDO::ATTR_STATEMENT_CLASS, array( 'FS_PDOStatement', array() ) );
+        }
+        
+        /**
+         * Set the fetch mode i.e. PDO::FETCH_ASSOC
+         * @param string $fetch_mode
+         */
+        public function setFetchMode($fetch_mode) {
+                $this-&gt;fetch_mode = $fetch_mode;
+        }
+        
+        /**
+         * Return an associative array instead of a PDO statement object 
+         * @param string $query Query to be executed
+         * @return mixed Associative array result set
+         */ 
+         public function queryAll($query) {
+                $this-&gt;counter++;
+                $res = $this-&gt;query($query);
+                if(!$res) {
+                        return false;
+                } else {
+                        return $res-&gt;fetchAll($this-&gt;fetch_mode);
+                }                
+        }
+        
+        /**
+         * Backwards compatibility for error checking with MDB2 
+         * @static
+         * @param string $result The return status of a previous query operation
+         * @return bool
+         */
+        public static function isError($result) {
+                if($result === false) {
+                        return true;
+                } else {
+                        return false;
+                }
+        }
+        
+        /**
+         *  
+         * @param string $query Query to be executed
+         * @return PDOStatement 
+         */
+        public function query($query) {
+                $this-&gt;counter++; 
+                return PDO::query($query);
+        }
+        
+        /**
+         * Takes and array and converts to a string
+         * @return string $full_error A formated message 
+         */
+        public function getMessage() {
+                $full_error = &quot;&quot;;
+                foreach($this-&gt;errorInfo() as $error) {
+                        $full_error .= $error . &quot;\n&quot;;        
+                }
+                return $full_error;
+        }
+}
+
+/**
+ * PDOStatment was extended to provide backwards compatible functions such as 
+ * fetchRow and rowCount. At some point all references to numRow() should be 
+ * replaced with rowCount() 
+ */
+
+class FS_PDOStatement extends PDOStatement {
+
+    protected function __construct() {
+
+    }
+        
+        public function fetchRow() {
+                                
+                return $this-&gt;fetch(PDO::FETCH_ASSOC);
+        }
+        
+        public function numRows() {
+                
+                return $this-&gt;rowCount();
+        }
+}
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql40withsamplessql"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0-with-samples.sql (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0-with-samples.sql                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0-with-samples.sql        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1431 @@
</span><ins>+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:35 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+INSERT INTO `acl_lists` (`id`, `acl_name`, `default_policy`) VALUES
+(1, 'rfc1918', 'deny'),
+(2, 'lan', 'allow'),
+(3, 'default', 'allow');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+INSERT INTO `acl_nodes` (`id`, `cidr`, `type`, `list_id`) VALUES
+(1, '192.168.0.0/16', 'allow', 1),
+(2, '10.0.0.0/8', 'allow', 1),
+(3, '172.16.0.0/12', 'allow', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+INSERT INTO `conference_advertise` (`id`, `room`, `status`) VALUES
+(1, '3000@$${domain}', 'Freeswitch Conference'),
+(2, '3001@$${domain}', 'FreeSWITCH Conference 2'),
+(3, '3002@$${domain}', 'FreeSWITCH Conference 3');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` (`conf_group`,`action`)
+) TYPE=InnoDB  AUTO_INCREMENT=13 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+INSERT INTO `conference_controls` (`id`, `conf_group`, `action`, `digits`) VALUES
+(1, 'default', 'mute', '0'),
+(2, 'default', 'deaf_mute', '*'),
+(3, 'default', 'energy up', '9'),
+(4, 'default', 'energy equ', '8'),
+(5, 'default', 'energy dn', '7'),
+(6, 'default', 'vol talk up', '3'),
+(7, 'default', 'vol talk dn', '1'),
+(8, 'default', 'vol talk zero', '2'),
+(9, 'default', 'vol listen up', '6'),
+(10, 'default', 'vol listen dn', '4'),
+(11, 'default', 'vol listen zero', '5'),
+(12, 'default', 'hangup', '#');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=8 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+INSERT INTO `conference_profiles` (`id`, `profile_name`, `param_name`, `param_value`) VALUES
+(1, 'default', 'domain', '$${domain}'),
+(2, 'default', 'rate', '8000'),
+(3, 'default', 'interval', '20'),
+(4, 'default', 'energy-level', '300'),
+(5, 'default', 'moh-sound', '$${moh_uri}'),
+(6, 'default', 'caller-id-name', '$${outbound_caller_name}'),
+(7, 'default', 'caller-id-number', '$${outbound_caller_number}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) TYPE=MyISAM  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+INSERT INTO `dialplan` (`dialplan_id`, `domain`, `ip_address`) VALUES
+(1, 'freeswitch', '127.0.0.1');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) TYPE=MyISAM  AUTO_INCREMENT=170 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+INSERT INTO `dialplan_actions` (`action_id`, `condition_id`, `application`, `data`, `type`, `weight`) VALUES
+(1, 2, 'deflect', '${destination_number}', 'action', 10),
+(2, 5, 'set', 'domain_name=$${domain}', 'action', 20),
+(3, 5, 'set', 'domain_name=${sip_auth_realm}', 'anti-action', 30),
+(4, 7, 'set', 'domain_name=$${domain}', 'action', 40),
+(5, 9, 'set', 'open=true', 'action', 50),
+(6, 10, 'answer', '', 'action', 60),
+(7, 10, 'intercept', '${db(select/${domain_name}-last_dial/global)}', 'action', 70),
+(8, 10, 'sleep', '2000', 'action', 80),
+(9, 11, 'answer', '', 'action', 90),
+(10, 11, 'intercept', '${db(select/${domain_name}-last_dial/${callgroup})}', 'action', 100),
+(11, 11, 'sleep', '2000', 'action', 110),
+(12, 12, 'answer', '', 'action', 120),
+(13, 12, 'intercept', '${db(select/${domain_name}-last_dial_ext/$1)}', 'action', 130),
+(14, 12, 'sleep', '2000', 'action', 140),
+(15, 13, 'transfer', '${db(select/${domain_name}-last_dial/${caller_id_number})}', 'action', 150),
+(16, 14, 'set', 'use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}', 'action', 160),
+(17, 14, 'set', 'use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}', 'anti-action', 170),
+(18, 15, 'set_user', 'default@${domain_name}', 'action', 180),
+(19, 16, 'info', '', 'action', 190),
+(20, 17, 'set', 'sip_secure_media=true', 'action', 200),
+(21, 18, 'db', 'insert/${domain_name}-spymap/${caller_id_number}/${uuid}', 'action', 210),
+(22, 18, 'db', 'insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}', 'action', 220),
+(23, 18, 'db', 'insert/${domain_name}-last_dial/global/${uuid}', 'action', 230),
+(24, 19, 'eval', '${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}', 'action', 240),
+(25, 19, 'transfer', '3000', 'action', 250),
+(26, 20, 'eval', '${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}', 'action', 260),
+(27, 20, 'playback', '$${hold_music}', 'action', 270),
+(28, 21, 'answer', '', 'action', 280),
+(29, 21, 'eavesdrop', '${db(select/${domain_name}-spymap/$1)}', 'action', 290),
+(30, 22, 'answer', '', 'action', 300),
+(31, 22, 'set', 'eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)', 'action', 310),
+(32, 22, 'set', 'eavesdrop_indicate_new=tone_stream://%(500, 0, 620)', 'action', 320),
+(33, 22, 'set', 'eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)', 'action', 330),
+(34, 22, 'eavesdrop', 'all', 'action', 340),
+(35, 23, 'transfer', '${db(select/${domain_name}-call_return/${caller_id_number})}', 'action', 350),
+(36, 24, 'answer', '', 'action', 360),
+(37, 24, 'group', 'delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 370),
+(38, 24, 'gentones', '%(1000, 0, 320)', 'action', 380),
+(39, 25, 'answer', '', 'action', 390),
+(40, 25, 'group', 'insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 400),
+(41, 25, 'gentones', '%(1000, 0, 640)', 'action', 410),
+(42, 26, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name})}', 'action', 420),
+(43, 27, 'set', 'call_timeout=10', 'action', 430),
+(44, 27, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name}:order)}', 'action', 440),
+(45, 28, 'set', 'dialed_extension=$1', 'action', 450),
+(46, 28, 'export', 'sip_auto_answer=true', 'action', 460),
+(47, 28, 'bridge', 'user/${dialed_extension}@${domain_name}', 'action', 470),
+(48, 29, 'set', 'dialed_extension=$1', 'action', 480),
+(49, 29, 'export', 'dialed_extension=$1', 'action', 490),
+(50, 30, 'set', 'voicemail_authorized=${sip_authorized}', 'action', 500),
+(51, 30, 'answer', '', 'action', 510),
+(52, 30, 'sleep', '1000', 'action', 520),
+(53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
+(54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
+(57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
+(58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),
+(59, 30, 'set', 'call_timeout=30', 'anti-action', 590),
+(60, 30, 'set', 'hangup_after_bridge=true', 'anti-action', 600),
+(61, 30, 'set', 'continue_on_fail=true', 'anti-action', 610),
+(62, 30, 'db', 'insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}', 'anti-action', 620),
+(63, 30, 'db', 'insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}', 'anti-action', 630),
+(64, 30, 'set', 'called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}', 'anti-action', 640),
+(65, 30, 'db', 'insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}', 'anti-action', 650),
+(66, 30, 'bridge', 'user/${dialed_extension}@${domain_name}', 'anti-action', 660),
+(67, 30, 'answer', '', 'anti-action', 670),
+(68, 30, 'sleep', '1000', 'anti-action', 680),
+(69, 30, 'voicemail', 'default ${domain_name} ${dialed_extension}', 'anti-action', 690),
+(70, 31, 'bridge', '${group_call(sales@${domain_name})}', 'action', 700),
+(71, 32, 'bridge', 'group/support@${domain_name}', 'action', 710),
+(72, 33, 'bridge', 'group/billing@${domain_name}', 'action', 720),
+(73, 34, 'set', 'transfer_ringback=$${hold_music}', 'action', 730),
+(74, 34, 'transfer', '1000 XML features', 'action', 740),
+(75, 35, 'answer', '', 'action', 750),
+(76, 35, 'sleep', '1000', 'action', 760),
+(77, 35, 'voicemail', 'check default ${domain_name}', 'action', 770),
+(78, 36, 'bridge', 'sofia/${use_profile}/$1', 'action', 780),
+(79, 37, 'answer', '', 'action', 790),
+(80, 37, 'conference', '$1-${domain_name}@default', 'action', 800),
+(81, 38, 'answer', '', 'action', 810),
+(82, 38, 'conference', '$1-${domain_name}@wideband', 'action', 820),
+(83, 39, 'answer', '', 'action', 830),
+(84, 39, 'conference', '$1-${domain_name}@ultrawideband', 'action', 840),
+(85, 40, 'answer', '', 'action', 850),
+(86, 40, 'conference', '$1-${domain_name}@cdquality', 'action', 860),
+(87, 41, 'bridge', 'sofia/${use_profile}/$1@conference.freeswitch.org', 'action', 870),
+(88, 42, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss1', 'action', 880),
+(89, 42, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 890),
+(90, 42, 'set', 'conference_auto_outcall_timeout=60', 'action', 900),
+(91, 42, 'set', 'conference_auto_outcall_flags=mute', 'action', 910),
+(92, 42, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 920),
+(93, 42, 'set', 'sip_exclude_contact=${network_addr}', 'action', 930),
+(94, 42, 'conference_set_auto_outcall', '${group_call(sales)}', 'action', 940),
+(95, 42, 'conference', 'madboss_intercom1@default+flags{endconf|deaf}', 'action', 950),
+(96, 43, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss2', 'action', 960),
+(97, 43, 'set', 'conference_auto_outcall_caller_id_number=0912', 'action', 970),
+(98, 43, 'set', 'conference_auto_outcall_timeout=60', 'action', 980),
+(99, 43, 'set', 'conference_auto_outcall_flags=mute', 'action', 990),
+(100, 43, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 1000),
+(101, 43, 'set', 'sip_exclude_contact=${network_addr}', 'action', 1010),
+(102, 43, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1020),
+(103, 43, 'conference', 'madboss_intercom2@default+flags{endconf|deaf}', 'action', 1030),
+(104, 44, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss', 'action', 1040),
+(105, 44, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 1050),
+(106, 44, 'set', 'conference_auto_outcall_timeout=60', 'action', 1060),
+(107, 44, 'set', 'conference_auto_outcall_flags=none', 'action', 1070),
+(108, 44, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1080),
+(109, 44, 'conference', 'madboss3@default', 'action', 1090),
+(110, 45, 'answer', '', 'action', 1100),
+(111, 45, 'sleep', '2000', 'action', 1110),
+(112, 45, 'ivr', 'demo_ivr', 'action', 1120),
+(113, 46, 'conference', 'bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org', 'action', 1130),
+(114, 47, 'answer', '', 'action', 1140),
+(115, 47, 'esf_page_group', '', 'action', 1150),
+(116, 48, 'set', 'fifo_music=$${hold_music}', 'action', 1160),
+(117, 48, 'fifo', '5900@${domain_name} in', 'action', 1170),
+(118, 49, 'answer', '', 'action', 1180),
+(119, 49, 'fifo', '5900@${domain_name} out nowait', 'action', 1190),
+(120, 51, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1200),
+(121, 54, 'answer', '', 'action', 1210),
+(122, 54, 'fifo', '$1@${domain_name} out nowait', 'action', 1220),
+(123, 57, '', '', 'expression', 1230),
+(124, 57, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1240),
+(125, 60, 'answer', '', 'action', 1250),
+(126, 60, 'fifo', '$1@${domain_name} out nowait', 'action', 1260),
+(127, 61, 'pre_answer', '', 'action', 1270),
+(128, 61, 'sleep', '20000', 'action', 1280),
+(129, 61, 'answer', '', 'action', 1290),
+(130, 61, 'sleep', '1000', 'action', 1300),
+(131, 61, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1310),
+(132, 61, 'hangup', '', 'action', 1320),
+(133, 62, 'ring_ready', '', 'action', 1330),
+(134, 62, 'sleep', '20000', 'action', 1340),
+(135, 62, 'answer', '', 'action', 1350),
+(136, 62, 'sleep', '1000', 'action', 1360),
+(137, 62, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1370),
+(138, 62, 'hangup', '', 'action', 1380),
+(139, 63, 'set', 'ringback=$${uk-ring}', 'action', 1390),
+(140, 63, 'bridge', 'loopback/wait', 'action', 1400),
+(141, 64, 'set', 'ringback=$${hold_music}', 'action', 1410),
+(142, 64, 'bridge', 'loopback/wait', 'action', 1420),
+(143, 65, 'set', 'transfer_ringback=$${uk-ring}', 'action', 1430),
+(144, 65, 'answer', '', 'action', 1440),
+(145, 65, 'bridge', 'loopback/wait', 'action', 1450),
+(146, 66, 'set', 'transfer_ringback=$${hold_music}', 'action', 1460),
+(147, 66, 'answer', '', 'action', 1470),
+(148, 66, 'bridge', 'loopback/wait', 'action', 1480),
+(149, 67, 'answer', '', 'action', 1490),
+(150, 67, 'info', '', 'action', 1500),
+(151, 67, 'sleep', '250', 'action', 1510),
+(152, 67, 'hangup', '', 'action', 1520),
+(153, 68, 'answer', '', 'action', 1530),
+(154, 68, 'record_fsv', '/tmp/testrecord.fsv', 'action', 1540),
+(155, 69, 'answer', '', 'action', 1550),
+(156, 69, 'play_fsv', '/tmp/testrecord.fsv', 'action', 1560),
+(157, 70, 'answer', '', 'action', 1570),
+(158, 70, 'delay_echo', '5000', 'action', 1580),
+(159, 71, 'answer', '', 'action', 1590),
+(160, 71, 'echo', '', 'action', 1600),
+(161, 72, 'answer', '', 'action', 1610),
+(162, 72, 'playback', 'tone_stream://%(10000,0,1004);loops=-1', 'action', 1620),
+(163, 73, 'answer', '', 'action', 1630),
+(164, 73, 'playback', 'tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10', 'action', 1640),
+(165, 75, 'answer', '', 'action', 1650),
+(166, 75, 'execute_extension', 'is_secure XML features', 'action', 1660),
+(167, 75, 'playback', '$${hold_music}', 'action', 1670),
+(168, 75, 'answer', '', 'anti-action', 1680),
+(169, 75, 'playback', '$${hold_music}', 'anti-action', 1690);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) TYPE=MyISAM  AUTO_INCREMENT=76 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+INSERT INTO `dialplan_condition` (`condition_id`, `extension_id`, `field`, `expression`, `weight`) VALUES
+(1, 1, '$${unroll_loops}', '^true$', 10),
+(2, 1, '${sip_looped_call}', '^true$', 20),
+(3, 2, '${domain_name}', '^$', 30),
+(4, 2, 'source', 'mod_sofia', 40),
+(5, 2, '${sip_auth_realm}', '^$', 50),
+(6, 3, '${domain_name}', '^$', 60),
+(7, 3, 'source', 'mod_openzap', 70),
+(8, 4, '${strftime(%w)}', '^([1-5])$', 80),
+(9, 4, '${strftime(%H%M)}', '^((09|1[0-7])[0-5][0-9]|1800)$', 90),
+(10, 5, 'destination_number', '^886$', 100),
+(11, 6, 'destination_number', '^\\*8$', 110),
+(12, 7, 'destination_number', '^\\*\\*(\\d+)$', 120),
+(13, 8, 'destination_number', '^870$', 130),
+(14, 9, '${network_addr}', '^$', 140),
+(15, 9, '${numbering_plan}', '^$', 150),
+(16, 9, '${call_debug}', '^true$', 160),
+(17, 9, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 170),
+(18, 9, '', '', 180),
+(19, 10, 'destination_number', '^9001$', 190),
+(20, 11, 'destination_number', '^9000$', 200),
+(21, 12, 'destination_number', '^88(.*)$|^\\*0(.*)$', 210),
+(22, 13, 'destination_number', '^779$', 220),
+(23, 14, 'destination_number', '^\\*69$|^869$|^lcr$', 230),
+(24, 15, 'destination_number', '^80(\\d{2})$', 240),
+(25, 16, 'destination_number', '^81(\\d{2})$', 250),
+(26, 17, 'destination_number', '^82(\\d{2})$', 260),
+(27, 18, 'destination_number', '^83(\\d{2})$', 270),
+(28, 19, 'destination_number', '^8(10[01][0-9])$', 280),
+(29, 20, 'destination_number', '^(20[01][0-9])$', 290),
+(30, 20, 'destination_number', '^${caller_id_number}$', 300),
+(31, 21, 'destination_number', '^3000$', 310),
+(32, 22, 'destination_number', '^3001$', 320),
+(33, 23, 'destination_number', '^3002$', 330),
+(34, 24, 'destination_number', '^operator$|^0$', 340),
+(35, 25, 'destination_number', '^vmain|4000$', 350),
+(36, 26, 'destination_number', '^sip:(.*)$', 360),
+(37, 27, 'destination_number', '^(30\\d{2})$', 370),
+(38, 28, 'destination_number', '^(31\\d{2})$', 380),
+(39, 29, 'destination_number', '^(32\\d{2})$', 390),
+(40, 30, 'destination_number', '^(33\\d{2})$', 400),
+(41, 31, 'destination_number', '^9(888|1616|3232)$', 410),
+(42, 32, 'destination_number', '^0911$', 420),
+(43, 33, 'destination_number', '^0912$', 430),
+(44, 34, 'destination_number', '^0913$', 440),
+(45, 35, 'destination_number', '^5000$', 450),
+(46, 36, 'destination_number', '^5001$', 460),
+(47, 37, 'destination_number', '^pagegroup$|^7243', 470),
+(48, 38, 'destination_number', '^5900$', 480),
+(49, 39, 'destination_number', '^5901$', 490),
+(50, 40, 'source', 'mod_sofia', 500),
+(51, 40, 'destination_number', 'park\\+(\\d+)', 510),
+(52, 41, 'source', 'mod_sofia', 520),
+(53, 41, 'destination_number', '^parking$', 530),
+(54, 41, '${sip_to_params}', 'fifo\\=(\\d+)', 540),
+(55, 42, 'source', 'mod_sofia', 550),
+(56, 42, 'destination_number', 'callpark', 560),
+(57, 42, '${sip_refer_to}', '', 570),
+(58, 43, 'source', 'mod_sofia', 580),
+(59, 43, 'destination_number', 'pickup', 590),
+(60, 43, '${sip_to_params}', 'orbit\\=(\\d+)', 600),
+(61, 44, 'destination_number', '^wait$', 610),
+(62, 45, 'destination_number', '^9980$', 620),
+(63, 46, 'destination_number', '^9981$', 630),
+(64, 47, 'destination_number', '^9982$', 640),
+(65, 48, 'destination_number', '^9983$', 650),
+(66, 49, 'destination_number', '^9984$', 660),
+(67, 50, 'destination_number', '^9992$', 670),
+(68, 51, 'destination_number', '^9993$', 680),
+(69, 52, 'destination_number', '^9994$', 690),
+(70, 53, 'destination_number', '^9995$', 700),
+(71, 54, 'destination_number', '^9996$', 710),
+(72, 55, 'destination_number', '^9997$', 720),
+(73, 56, 'destination_number', '^9998$', 730),
+(74, 57, 'destination_number', '^9999$', 740),
+(75, 57, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 750);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) TYPE=InnoDB  AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+INSERT INTO `dialplan_context` (`context_id`, `dialplan_id`, `context`, `weight`) VALUES
+(1, 1, 'default', 10),
+(2, 1, 'public', 20);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) TYPE=InnoDB  AUTO_INCREMENT=58 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+INSERT INTO `dialplan_extension` (`extension_id`, `context_id`, `name`, `continue`, `weight`) VALUES
+(1, 1, 'unloop', '', 10),
+(2, 1, 'set_domain', 'true', 20),
+(3, 1, 'set_domain_openzap', 'true', 30),
+(4, 1, 'tod_example', 'true', 40),
+(5, 1, 'global-intercept', '', 50),
+(6, 1, 'group-intercept', '', 60),
+(7, 1, 'intercept-ext', '', 70),
+(8, 1, 'redial', '', 80),
+(9, 1, 'global', 'true', 90),
+(10, 1, 'snom-demo-2', '', 100),
+(11, 1, 'snom-demo-1', '', 110),
+(12, 1, 'eavesdrop', '', 120),
+(13, 1, 'eavesdrop', '', 130),
+(14, 1, 'call_return', '', 140),
+(15, 1, 'del-group', '', 150),
+(16, 1, 'add-group', '', 160),
+(17, 1, 'call-group-simo', '', 170),
+(18, 1, 'call-group-order', '', 180),
+(19, 1, 'extension-intercom', '', 190),
+(20, 1, 'Local_Extension', '', 200),
+(21, 1, 'group_dial_sales', '', 210),
+(22, 1, 'group_dial_support', '', 220),
+(23, 1, 'group_dial_billing', '', 230),
+(24, 1, 'operator', '', 240),
+(25, 1, 'vmain', '', 250),
+(26, 1, 'sip_uri', '', 260),
+(27, 1, 'nb_conferences', '', 270),
+(28, 1, 'wb_conferences', '', 280),
+(29, 1, 'uwb_conferences', '', 290),
+(30, 1, 'cdquality_conferences', '', 300),
+(31, 1, 'freeswitch_public_conf_via_sip', '', 310),
+(32, 1, 'mad_boss_intercom', '', 320),
+(33, 1, 'mad_boss_intercom', '', 330),
+(34, 1, 'mad_boss', '', 340),
+(35, 1, 'ivr_demo', '', 350),
+(36, 1, 'dyanmic conference', '', 360),
+(37, 1, 'rtp_multicast_page', '', 370),
+(38, 1, 'park', '', 380),
+(39, 1, 'unpark', '', 390),
+(40, 1, 'park', '', 400),
+(41, 1, 'unpark', '', 410),
+(42, 1, 'park', '', 420),
+(43, 1, 'unpark', '', 430),
+(44, 1, 'wait', '', 440),
+(45, 1, 'ringback_180', '', 450),
+(46, 1, 'ringback_183_uk_ring', '', 460),
+(47, 1, 'ringback_183_music_ring', '', 470),
+(48, 1, 'ringback_post_answer_uk_ring', '', 480),
+(49, 1, 'ringback_post_answer_music', '', 490),
+(50, 1, 'show_info', '', 500),
+(51, 1, 'video_record', '', 510),
+(52, 1, 'video_playback', '', 520),
+(53, 1, 'delay_echo', '', 530),
+(54, 1, 'echo', '', 540),
+(55, 1, 'milliwatt', '', 550),
+(56, 2, 'tone_stream', '', 560),
+(57, 2, 'hold_music', '', 570);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+INSERT INTO `dingaling_profiles` (`id`, `profile_name`, `type`) VALUES
+(1, 'fs.intralanman.servehttp.com', 'component');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+INSERT INTO `dingaling_profile_params` (`id`, `dingaling_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', 'secret'),
+(2, 1, 'dialplan', 'XML,enum'),
+(3, 1, 'server', 'example.org'),
+(4, 1, 'name', 'fs.example.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+INSERT INTO `dingaling_settings` (`id`, `param_name`, `param_value`) VALUES
+(1, 'debug', '0'),
+(2, 'codec-prefs', '$${global_codec_prefs}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=12 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+INSERT INTO `directory` (`id`, `username`, `domain`) VALUES
+(1, '1000', 'example.com'),
+(2, '1001', 'example.org'),
+(3, '1002', 'example.net'),
+(5, '1003', 'example.info'),
+(6, '1004', 'example.com'),
+(7, '1005', 'example.org'),
+(8, '1006', 'example.net'),
+(9, '1007', 'example.info'),
+(10, '2000', 'default'),
+(11, '1009', '$${local_ip_v4}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+INSERT INTO `directory_domains` (`id`, `domain_name`) VALUES
+(1, 'freeswitch.org'),
+(2, 'sofaswitch.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+INSERT INTO `directory_global_params` (`id`, `param_name`, `param_value`, `domain_id`) VALUES
+(1, 'default_gateway', 'errors', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=23 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+INSERT INTO `directory_params` (`id`, `directory_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', '1234'),
+(2, 1, 'vm-password', '861000'),
+(3, 2, 'password', '1234'),
+(4, 2, 'vm-password', '861001'),
+(7, 5, 'password', '1234'),
+(8, 6, 'password', '1234'),
+(9, 7, 'password', '1234'),
+(10, 8, 'password', '123456'),
+(11, 9, 'password', '1234'),
+(12, 10, 'password', '123456'),
+(13, 11, 'password', '1234'),
+(14, 3, 'vm-password', '861002'),
+(15, 3, 'password', '1234'),
+(16, 11, 'vm-password', '861009'),
+(17, 10, 'vm-password', '1234'),
+(18, 9, 'vm-password', '861007'),
+(19, 8, 'vm-password', '861006'),
+(20, 7, 'vm-password', '861005'),
+(21, 6, 'vm-password', '861004'),
+(22, 5, 'vm-password', '861003');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=6 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+INSERT INTO `directory_vars` (`id`, `directory_id`, `var_name`, `var_value`) VALUES
+(1, 1, 'numbering_plan', 'US'),
+(2, 2, 'numbering_plan', 'US'),
+(3, 3, 'numbering_plan', 'AU'),
+(4, 5, 'numbering_plan', 'US'),
+(5, 5, 'area_code', '434');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+INSERT INTO `iax_conf` (`id`, `profile_name`) VALUES
+(3, 'test_profile');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=43 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+INSERT INTO `iax_settings` (`id`, `iax_id`, `param_name`, `param_value`) VALUES
+(35, 3, 'debug', '1'),
+(36, 3, 'ip', '$${local_ip_v4}'),
+(37, 3, 'port', '4569'),
+(38, 3, 'context', 'public'),
+(39, 3, 'dialplan', 'enum,XML'),
+(40, 3, 'codec-prefs', '$${global_codec_prefs}'),
+(41, 3, 'codec-master', 'us'),
+(42, 3, 'codec-rate', '8');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+INSERT INTO `ivr_conf` (`id`, `name`, `greet_long`, `greet_short`, `invalid_sound`, `exit_sound`, `max_failures`, `timeout`, `tts_engine`, `tts_voice`) VALUES
+(1, 'demo', 'soundfiles/ivr/demo/greet-long.wav', 'soundfiles/ivr/demo/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, 'cepstral', 'allison'),
+(2, 'demo2', 'soundfiles/ivr/demo2/greet-long.wav', 'soundfiles/ivr/demo2/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, NULL, NULL),
+(3, 'menu8', 'soundfiles/ivr/menu8/greet-long.wav', 'soundfiles/ivr/menu8/greet-short.wav', 'soundfiles/ivr/menu8/invalid.wav', 'soundfiles/ivr/menu8/exit.wav', 3, 5, NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` (`ivr_id`,`digits`)
+) TYPE=InnoDB  AUTO_INCREMENT=11 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+INSERT INTO `ivr_entries` (`id`, `ivr_id`, `action`, `digits`, `params`) VALUES
+(1, 1, 'menu-play-sound', '1', 'soundfiles/features.wav'),
+(2, 1, 'menu-exit', '*', NULL),
+(3, 1, 'menu-sub', '2', 'demo2'),
+(4, 1, 'menu-exec-api', '3', 'bridge sofia/$${domain}/888@conference.freeswtich.org'),
+(5, 1, 'menu-call-transfer', '4', '888'),
+(6, 2, 'menu-back', '#', NULL),
+(7, 2, 'menu-top', '*', NULL),
+(8, 3, 'menu-back', '#', NULL),
+(9, 3, 'menu-top', '*', NULL),
+(10, 3, 'menu-playsound', '4', 'soundfiles/4.wav');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+INSERT INTO `modless_conf` (`id`, `conf_name`) VALUES
+(1, 'acl.conf'),
+(2, 'postl_load_switch.conf'),
+(3, 'post_load_modules.conf');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=54 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+INSERT INTO `post_load_modules_conf` (`id`, `module_name`, `load_module`, `priority`) VALUES
+(1, 'mod_sofia', 1, 2000),
+(2, 'mod_iax', 1, 2000),
+(3, 'mod_xml_rpc', 1, 100),
+(4, 'mod_portaudio', 1, 1000),
+(5, 'mod_enum', 1, 2000),
+(6, 'mod_xml_cdr', 1, 1000),
+(7, 'mod_spidermonkey', 1, 1000),
+(8, 'mod_alsa', 0, 1000),
+(9, 'mod_log_file', 1, 0),
+(10, 'mod_commands', 1, 1000),
+(11, 'mod_voicemail', 1, 1000),
+(12, 'mod_dialplan_xml', 1, 150),
+(13, 'mod_dialplan_asterisk', 1, 150),
+(14, 'mod_openzap', 0, 1000),
+(15, 'mod_woomera', 0, 1000),
+(17, 'mod_speex', 1, 500),
+(18, 'mod_ilbc', 0, 1000),
+(20, 'mod_g723_1', 1, 500),
+(21, 'mod_g729', 1, 500),
+(22, 'mod_g722', 1, 500),
+(23, 'mod_g726', 1, 500),
+(25, 'mod_amr', 1, 500),
+(26, 'mod_fifo', 1, 1000),
+(27, 'mod_limit', 1, 1000),
+(28, 'mod_syslog', 1, 0),
+(29, 'mod_dingaling', 1, 2000),
+(30, 'mod_cdr_csv', 1, 1000),
+(31, 'mod_event_socket', 1, 100),
+(32, 'mod_multicast', 0, 1000),
+(33, 'mod_zeroconf', 0, 1000),
+(34, 'mod_xmpp_event', 0, 1000),
+(35, 'mod_sndfile', 1, 1000),
+(36, 'mod_native_file', 1, 1000),
+(37, 'mod_shout', 1, 1000),
+(38, 'mod_local_stream', 1, 1000),
+(39, 'mod_perl', 0, 1000),
+(40, 'mod_python', 0, 1000),
+(41, 'mod_java', 0, 1000),
+(42, 'mod_cepstral', 0, 1000),
+(43, 'mod_openmrcp', 0, 1000),
+(44, 'mod_lumenvox', 0, 1000),
+(45, 'mod_rss', 0, 1000),
+(46, 'mod_say_de', 1, 1000),
+(47, 'mod_say_fr', 0, 1000),
+(48, 'mod_say_en', 1, 1000),
+(49, 'mod_conference', 1, 1000),
+(50, 'mod_ivr', 0, 1000),
+(51, 'mod_console', 1, 0),
+(52, 'mod_dptools', 1, 1500),
+(53, 'mod_voipcodecs', 1, 500);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+INSERT INTO `sofia_aliases` (`id`, `sofia_id`, `alias_name`) VALUES
+(1, 1, 'default'),
+(3, 1, 'sip.example.com');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+INSERT INTO `sofia_conf` (`id`, `profile_name`) VALUES
+(1, '$${domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+INSERT INTO `sofia_gateways` (`id`, `sofia_id`, `gateway_name`, `gateway_param`, `gateway_value`) VALUES
+(8, 1, 'default', 'proxy', 'asterlink.com'),
+(9, 1, 'default', 'realm', 'asterlink.com'),
+(10, 1, 'default', 'username', 'USERNAME_HERE'),
+(11, 1, 'default', 'register', 'false'),
+(12, 1, 'default', 'expire-seconds', '60'),
+(13, 1, 'default', 'retry_seconds', '2'),
+(14, 1, 'default', 'password', 'PASSWORD_HERE');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=37 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+INSERT INTO `sofia_settings` (`id`, `sofia_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'user-agent-string', 'RayUA 2.0pre4'),
+(2, 1, 'auth-calls', 'true'),
+(5, 1, 'debug', '1'),
+(6, 1, 'rfc2833-pt', '101'),
+(7, 1, 'sip-port', '5060'),
+(8, 1, 'dialplan', 'XML'),
+(9, 1, 'dtmf-duration', '100'),
+(10, 1, 'codec-prefs', '$${global_codec_prefs}'),
+(11, 1, 'rtp-timeout-sec', '300'),
+(12, 1, 'rtp-ip', '$${local_ip_v4}'),
+(13, 1, 'sip-ip', '$${local_ip_v4}'),
+(14, 1, 'context', 'default'),
+(15, 1, 'manage-presence', 'true'),
+(16, 1, 'force-register-domain', 'intralanman.servehttp.com'),
+(17, 1, 'inbound-codec-negotiation', 'generous'),
+(18, 1, 'rtp-rewrite-timestampes', 'true'),
+(19, 1, 'nonce-ttl', '60'),
+(20, 1, 'vad', 'out'),
+(36, 1, 'odbc-dsn', 'freeswitch-mysql:freeswitch:Fr33Sw1tch');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+INSERT INTO `voicemail_conf` (`id`, `vm_profile`) VALUES
+(1, 'default');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+INSERT INTO `voicemail_email` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'template-file', 'voicemail.tpl'),
+(2, 1, 'date-fmt', '%A, %B %d %Y, %I %M %p'),
+(3, 1, 'email-from', '${voicemail_account}@${voicemail_domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=31 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+INSERT INTO `voicemail_settings` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'file-extension', 'wav'),
+(2, 1, 'terminator-key', '#'),
+(3, 1, 'max-login-attempts', '3'),
+(4, 1, 'digit-timeout', '10000'),
+(5, 1, 'max-record-length', '300'),
+(6, 1, 'tone-spec', '%(1000, 0, 640)'),
+(7, 1, 'callback-dialplan', 'XML'),
+(8, 1, 'callback-context', 'default'),
+(9, 1, 'play-new-messages-key', '1'),
+(10, 1, 'play-saved-messages-key', '2'),
+(11, 1, 'main-menu-key', '*'),
+(12, 1, 'config-menu-key', '5'),
+(13, 1, 'record-greeting-key', '1'),
+(14, 1, 'choose-greeting-key', '2'),
+(15, 1, 'record-file-key', '3'),
+(16, 1, 'listen-file-key', '1'),
+(17, 1, 'record-name-key', '3'),
+(18, 1, 'save-file-key', '9'),
+(19, 1, 'delete-file-key', '7'),
+(20, 1, 'undelete-file-key', '8'),
+(21, 1, 'email-key', '4'),
+(22, 1, 'pause-key', '0'),
+(23, 1, 'restart-key', '1'),
+(24, 1, 'ff-key', '6'),
+(25, 1, 'rew-key', '4'),
+(26, 1, 'record-silence-threshold', '200'),
+(27, 1, 'record-silence-hits', '2'),
+(28, 1, 'web-template-file', 'web-vm.tpl'),
+(29, 1, 'operator-extension', 'operator XML default'),
+(30, 1, 'operator-key', '9');
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql40sql"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0.sql (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0.sql                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-4.0.sql        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,885 @@
</span><ins>+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:36 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` (`conf_group`,`action`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` (`ivr_id`,`digits`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql50withsamplessql"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0-with-samples.sql (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0-with-samples.sql                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0-with-samples.sql        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1433 @@
</span><ins>+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:35 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+SET SQL_MODE=&quot;NO_AUTO_VALUE_ON_ZERO&quot;;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+INSERT INTO `acl_lists` (`id`, `acl_name`, `default_policy`) VALUES
+(1, 'rfc1918', 'deny'),
+(2, 'lan', 'allow'),
+(3, 'default', 'allow');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+INSERT INTO `acl_nodes` (`id`, `cidr`, `type`, `list_id`) VALUES
+(1, '192.168.0.0/16', 'allow', 1),
+(2, '10.0.0.0/8', 'allow', 1),
+(3, '172.16.0.0/12', 'allow', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+INSERT INTO `conference_advertise` (`id`, `room`, `status`) VALUES
+(1, '3000@$${domain}', 'Freeswitch Conference'),
+(2, '3001@$${domain}', 'FreeSWITCH Conference 2'),
+(3, '3002@$${domain}', 'FreeSWITCH Conference 3');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` USING BTREE (`conf_group`,`action`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+INSERT INTO `conference_controls` (`id`, `conf_group`, `action`, `digits`) VALUES
+(1, 'default', 'mute', '0'),
+(2, 'default', 'deaf_mute', '*'),
+(3, 'default', 'energy up', '9'),
+(4, 'default', 'energy equ', '8'),
+(5, 'default', 'energy dn', '7'),
+(6, 'default', 'vol talk up', '3'),
+(7, 'default', 'vol talk dn', '1'),
+(8, 'default', 'vol talk zero', '2'),
+(9, 'default', 'vol listen up', '6'),
+(10, 'default', 'vol listen dn', '4'),
+(11, 'default', 'vol listen zero', '5'),
+(12, 'default', 'hangup', '#');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+INSERT INTO `conference_profiles` (`id`, `profile_name`, `param_name`, `param_value`) VALUES
+(1, 'default', 'domain', '$${domain}'),
+(2, 'default', 'rate', '8000'),
+(3, 'default', 'interval', '20'),
+(4, 'default', 'energy-level', '300'),
+(5, 'default', 'moh-sound', '$${moh_uri}'),
+(6, 'default', 'caller-id-name', '$${outbound_caller_name}'),
+(7, 'default', 'caller-id-number', '$${outbound_caller_number}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+INSERT INTO `dialplan` (`dialplan_id`, `domain`, `ip_address`) VALUES
+(1, 'freeswitch', '127.0.0.1');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=170 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+INSERT INTO `dialplan_actions` (`action_id`, `condition_id`, `application`, `data`, `type`, `weight`) VALUES
+(1, 2, 'deflect', '${destination_number}', 'action', 10),
+(2, 5, 'set', 'domain_name=$${domain}', 'action', 20),
+(3, 5, 'set', 'domain_name=${sip_auth_realm}', 'anti-action', 30),
+(4, 7, 'set', 'domain_name=$${domain}', 'action', 40),
+(5, 9, 'set', 'open=true', 'action', 50),
+(6, 10, 'answer', '', 'action', 60),
+(7, 10, 'intercept', '${db(select/${domain_name}-last_dial/global)}', 'action', 70),
+(8, 10, 'sleep', '2000', 'action', 80),
+(9, 11, 'answer', '', 'action', 90),
+(10, 11, 'intercept', '${db(select/${domain_name}-last_dial/${callgroup})}', 'action', 100),
+(11, 11, 'sleep', '2000', 'action', 110),
+(12, 12, 'answer', '', 'action', 120),
+(13, 12, 'intercept', '${db(select/${domain_name}-last_dial_ext/$1)}', 'action', 130),
+(14, 12, 'sleep', '2000', 'action', 140),
+(15, 13, 'transfer', '${db(select/${domain_name}-last_dial/${caller_id_number})}', 'action', 150),
+(16, 14, 'set', 'use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}', 'action', 160),
+(17, 14, 'set', 'use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}', 'anti-action', 170),
+(18, 15, 'set_user', 'default@${domain_name}', 'action', 180),
+(19, 16, 'info', '', 'action', 190),
+(20, 17, 'set', 'sip_secure_media=true', 'action', 200),
+(21, 18, 'db', 'insert/${domain_name}-spymap/${caller_id_number}/${uuid}', 'action', 210),
+(22, 18, 'db', 'insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}', 'action', 220),
+(23, 18, 'db', 'insert/${domain_name}-last_dial/global/${uuid}', 'action', 230),
+(24, 19, 'eval', '${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}', 'action', 240),
+(25, 19, 'transfer', '3000', 'action', 250),
+(26, 20, 'eval', '${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}', 'action', 260),
+(27, 20, 'playback', '$${hold_music}', 'action', 270),
+(28, 21, 'answer', '', 'action', 280),
+(29, 21, 'eavesdrop', '${db(select/${domain_name}-spymap/$1)}', 'action', 290),
+(30, 22, 'answer', '', 'action', 300),
+(31, 22, 'set', 'eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)', 'action', 310),
+(32, 22, 'set', 'eavesdrop_indicate_new=tone_stream://%(500, 0, 620)', 'action', 320),
+(33, 22, 'set', 'eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)', 'action', 330),
+(34, 22, 'eavesdrop', 'all', 'action', 340),
+(35, 23, 'transfer', '${db(select/${domain_name}-call_return/${caller_id_number})}', 'action', 350),
+(36, 24, 'answer', '', 'action', 360),
+(37, 24, 'group', 'delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 370),
+(38, 24, 'gentones', '%(1000, 0, 320)', 'action', 380),
+(39, 25, 'answer', '', 'action', 390),
+(40, 25, 'group', 'insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 400),
+(41, 25, 'gentones', '%(1000, 0, 640)', 'action', 410),
+(42, 26, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name})}', 'action', 420),
+(43, 27, 'set', 'call_timeout=10', 'action', 430),
+(44, 27, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name}:order)}', 'action', 440),
+(45, 28, 'set', 'dialed_extension=$1', 'action', 450),
+(46, 28, 'export', 'sip_auto_answer=true', 'action', 460),
+(47, 28, 'bridge', 'user/${dialed_extension}@${domain_name}', 'action', 470),
+(48, 29, 'set', 'dialed_extension=$1', 'action', 480),
+(49, 29, 'export', 'dialed_extension=$1', 'action', 490),
+(50, 30, 'set', 'voicemail_authorized=${sip_authorized}', 'action', 500),
+(51, 30, 'answer', '', 'action', 510),
+(52, 30, 'sleep', '1000', 'action', 520),
+(53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
+(54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
+(57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
+(58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),
+(59, 30, 'set', 'call_timeout=30', 'anti-action', 590),
+(60, 30, 'set', 'hangup_after_bridge=true', 'anti-action', 600),
+(61, 30, 'set', 'continue_on_fail=true', 'anti-action', 610),
+(62, 30, 'db', 'insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}', 'anti-action', 620),
+(63, 30, 'db', 'insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}', 'anti-action', 630),
+(64, 30, 'set', 'called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}', 'anti-action', 640),
+(65, 30, 'db', 'insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}', 'anti-action', 650),
+(66, 30, 'bridge', 'user/${dialed_extension}@${domain_name}', 'anti-action', 660),
+(67, 30, 'answer', '', 'anti-action', 670),
+(68, 30, 'sleep', '1000', 'anti-action', 680),
+(69, 30, 'voicemail', 'default ${domain_name} ${dialed_extension}', 'anti-action', 690),
+(70, 31, 'bridge', '${group_call(sales@${domain_name})}', 'action', 700),
+(71, 32, 'bridge', 'group/support@${domain_name}', 'action', 710),
+(72, 33, 'bridge', 'group/billing@${domain_name}', 'action', 720),
+(73, 34, 'set', 'transfer_ringback=$${hold_music}', 'action', 730),
+(74, 34, 'transfer', '1000 XML features', 'action', 740),
+(75, 35, 'answer', '', 'action', 750),
+(76, 35, 'sleep', '1000', 'action', 760),
+(77, 35, 'voicemail', 'check default ${domain_name}', 'action', 770),
+(78, 36, 'bridge', 'sofia/${use_profile}/$1', 'action', 780),
+(79, 37, 'answer', '', 'action', 790),
+(80, 37, 'conference', '$1-${domain_name}@default', 'action', 800),
+(81, 38, 'answer', '', 'action', 810),
+(82, 38, 'conference', '$1-${domain_name}@wideband', 'action', 820),
+(83, 39, 'answer', '', 'action', 830),
+(84, 39, 'conference', '$1-${domain_name}@ultrawideband', 'action', 840),
+(85, 40, 'answer', '', 'action', 850),
+(86, 40, 'conference', '$1-${domain_name}@cdquality', 'action', 860),
+(87, 41, 'bridge', 'sofia/${use_profile}/$1@conference.freeswitch.org', 'action', 870),
+(88, 42, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss1', 'action', 880),
+(89, 42, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 890),
+(90, 42, 'set', 'conference_auto_outcall_timeout=60', 'action', 900),
+(91, 42, 'set', 'conference_auto_outcall_flags=mute', 'action', 910),
+(92, 42, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 920),
+(93, 42, 'set', 'sip_exclude_contact=${network_addr}', 'action', 930),
+(94, 42, 'conference_set_auto_outcall', '${group_call(sales)}', 'action', 940),
+(95, 42, 'conference', 'madboss_intercom1@default+flags{endconf|deaf}', 'action', 950),
+(96, 43, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss2', 'action', 960),
+(97, 43, 'set', 'conference_auto_outcall_caller_id_number=0912', 'action', 970),
+(98, 43, 'set', 'conference_auto_outcall_timeout=60', 'action', 980),
+(99, 43, 'set', 'conference_auto_outcall_flags=mute', 'action', 990),
+(100, 43, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 1000),
+(101, 43, 'set', 'sip_exclude_contact=${network_addr}', 'action', 1010),
+(102, 43, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1020),
+(103, 43, 'conference', 'madboss_intercom2@default+flags{endconf|deaf}', 'action', 1030),
+(104, 44, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss', 'action', 1040),
+(105, 44, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 1050),
+(106, 44, 'set', 'conference_auto_outcall_timeout=60', 'action', 1060),
+(107, 44, 'set', 'conference_auto_outcall_flags=none', 'action', 1070),
+(108, 44, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1080),
+(109, 44, 'conference', 'madboss3@default', 'action', 1090),
+(110, 45, 'answer', '', 'action', 1100),
+(111, 45, 'sleep', '2000', 'action', 1110),
+(112, 45, 'ivr', 'demo_ivr', 'action', 1120),
+(113, 46, 'conference', 'bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org', 'action', 1130),
+(114, 47, 'answer', '', 'action', 1140),
+(115, 47, 'esf_page_group', '', 'action', 1150),
+(116, 48, 'set', 'fifo_music=$${hold_music}', 'action', 1160),
+(117, 48, 'fifo', '5900@${domain_name} in', 'action', 1170),
+(118, 49, 'answer', '', 'action', 1180),
+(119, 49, 'fifo', '5900@${domain_name} out nowait', 'action', 1190),
+(120, 51, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1200),
+(121, 54, 'answer', '', 'action', 1210),
+(122, 54, 'fifo', '$1@${domain_name} out nowait', 'action', 1220),
+(123, 57, '', '', 'expression', 1230),
+(124, 57, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1240),
+(125, 60, 'answer', '', 'action', 1250),
+(126, 60, 'fifo', '$1@${domain_name} out nowait', 'action', 1260),
+(127, 61, 'pre_answer', '', 'action', 1270),
+(128, 61, 'sleep', '20000', 'action', 1280),
+(129, 61, 'answer', '', 'action', 1290),
+(130, 61, 'sleep', '1000', 'action', 1300),
+(131, 61, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1310),
+(132, 61, 'hangup', '', 'action', 1320),
+(133, 62, 'ring_ready', '', 'action', 1330),
+(134, 62, 'sleep', '20000', 'action', 1340),
+(135, 62, 'answer', '', 'action', 1350),
+(136, 62, 'sleep', '1000', 'action', 1360),
+(137, 62, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1370),
+(138, 62, 'hangup', '', 'action', 1380),
+(139, 63, 'set', 'ringback=$${uk-ring}', 'action', 1390),
+(140, 63, 'bridge', 'loopback/wait', 'action', 1400),
+(141, 64, 'set', 'ringback=$${hold_music}', 'action', 1410),
+(142, 64, 'bridge', 'loopback/wait', 'action', 1420),
+(143, 65, 'set', 'transfer_ringback=$${uk-ring}', 'action', 1430),
+(144, 65, 'answer', '', 'action', 1440),
+(145, 65, 'bridge', 'loopback/wait', 'action', 1450),
+(146, 66, 'set', 'transfer_ringback=$${hold_music}', 'action', 1460),
+(147, 66, 'answer', '', 'action', 1470),
+(148, 66, 'bridge', 'loopback/wait', 'action', 1480),
+(149, 67, 'answer', '', 'action', 1490),
+(150, 67, 'info', '', 'action', 1500),
+(151, 67, 'sleep', '250', 'action', 1510),
+(152, 67, 'hangup', '', 'action', 1520),
+(153, 68, 'answer', '', 'action', 1530),
+(154, 68, 'record_fsv', '/tmp/testrecord.fsv', 'action', 1540),
+(155, 69, 'answer', '', 'action', 1550),
+(156, 69, 'play_fsv', '/tmp/testrecord.fsv', 'action', 1560),
+(157, 70, 'answer', '', 'action', 1570),
+(158, 70, 'delay_echo', '5000', 'action', 1580),
+(159, 71, 'answer', '', 'action', 1590),
+(160, 71, 'echo', '', 'action', 1600),
+(161, 72, 'answer', '', 'action', 1610),
+(162, 72, 'playback', 'tone_stream://%(10000,0,1004);loops=-1', 'action', 1620),
+(163, 73, 'answer', '', 'action', 1630),
+(164, 73, 'playback', 'tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10', 'action', 1640),
+(165, 75, 'answer', '', 'action', 1650),
+(166, 75, 'execute_extension', 'is_secure XML features', 'action', 1660),
+(167, 75, 'playback', '$${hold_music}', 'action', 1670),
+(168, 75, 'answer', '', 'anti-action', 1680),
+(169, 75, 'playback', '$${hold_music}', 'anti-action', 1690);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=76 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+INSERT INTO `dialplan_condition` (`condition_id`, `extension_id`, `field`, `expression`, `weight`) VALUES
+(1, 1, '$${unroll_loops}', '^true$', 10),
+(2, 1, '${sip_looped_call}', '^true$', 20),
+(3, 2, '${domain_name}', '^$', 30),
+(4, 2, 'source', 'mod_sofia', 40),
+(5, 2, '${sip_auth_realm}', '^$', 50),
+(6, 3, '${domain_name}', '^$', 60),
+(7, 3, 'source', 'mod_openzap', 70),
+(8, 4, '${strftime(%w)}', '^([1-5])$', 80),
+(9, 4, '${strftime(%H%M)}', '^((09|1[0-7])[0-5][0-9]|1800)$', 90),
+(10, 5, 'destination_number', '^886$', 100),
+(11, 6, 'destination_number', '^\\*8$', 110),
+(12, 7, 'destination_number', '^\\*\\*(\\d+)$', 120),
+(13, 8, 'destination_number', '^870$', 130),
+(14, 9, '${network_addr}', '^$', 140),
+(15, 9, '${numbering_plan}', '^$', 150),
+(16, 9, '${call_debug}', '^true$', 160),
+(17, 9, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 170),
+(18, 9, '', '', 180),
+(19, 10, 'destination_number', '^9001$', 190),
+(20, 11, 'destination_number', '^9000$', 200),
+(21, 12, 'destination_number', '^88(.*)$|^\\*0(.*)$', 210),
+(22, 13, 'destination_number', '^779$', 220),
+(23, 14, 'destination_number', '^\\*69$|^869$|^lcr$', 230),
+(24, 15, 'destination_number', '^80(\\d{2})$', 240),
+(25, 16, 'destination_number', '^81(\\d{2})$', 250),
+(26, 17, 'destination_number', '^82(\\d{2})$', 260),
+(27, 18, 'destination_number', '^83(\\d{2})$', 270),
+(28, 19, 'destination_number', '^8(10[01][0-9])$', 280),
+(29, 20, 'destination_number', '^(20[01][0-9])$', 290),
+(30, 20, 'destination_number', '^${caller_id_number}$', 300),
+(31, 21, 'destination_number', '^3000$', 310),
+(32, 22, 'destination_number', '^3001$', 320),
+(33, 23, 'destination_number', '^3002$', 330),
+(34, 24, 'destination_number', '^operator$|^0$', 340),
+(35, 25, 'destination_number', '^vmain|4000$', 350),
+(36, 26, 'destination_number', '^sip:(.*)$', 360),
+(37, 27, 'destination_number', '^(30\\d{2})$', 370),
+(38, 28, 'destination_number', '^(31\\d{2})$', 380),
+(39, 29, 'destination_number', '^(32\\d{2})$', 390),
+(40, 30, 'destination_number', '^(33\\d{2})$', 400),
+(41, 31, 'destination_number', '^9(888|1616|3232)$', 410),
+(42, 32, 'destination_number', '^0911$', 420),
+(43, 33, 'destination_number', '^0912$', 430),
+(44, 34, 'destination_number', '^0913$', 440),
+(45, 35, 'destination_number', '^5000$', 450),
+(46, 36, 'destination_number', '^5001$', 460),
+(47, 37, 'destination_number', '^pagegroup$|^7243', 470),
+(48, 38, 'destination_number', '^5900$', 480),
+(49, 39, 'destination_number', '^5901$', 490),
+(50, 40, 'source', 'mod_sofia', 500),
+(51, 40, 'destination_number', 'park\\+(\\d+)', 510),
+(52, 41, 'source', 'mod_sofia', 520),
+(53, 41, 'destination_number', '^parking$', 530),
+(54, 41, '${sip_to_params}', 'fifo\\=(\\d+)', 540),
+(55, 42, 'source', 'mod_sofia', 550),
+(56, 42, 'destination_number', 'callpark', 560),
+(57, 42, '${sip_refer_to}', '', 570),
+(58, 43, 'source', 'mod_sofia', 580),
+(59, 43, 'destination_number', 'pickup', 590),
+(60, 43, '${sip_to_params}', 'orbit\\=(\\d+)', 600),
+(61, 44, 'destination_number', '^wait$', 610),
+(62, 45, 'destination_number', '^9980$', 620),
+(63, 46, 'destination_number', '^9981$', 630),
+(64, 47, 'destination_number', '^9982$', 640),
+(65, 48, 'destination_number', '^9983$', 650),
+(66, 49, 'destination_number', '^9984$', 660),
+(67, 50, 'destination_number', '^9992$', 670),
+(68, 51, 'destination_number', '^9993$', 680),
+(69, 52, 'destination_number', '^9994$', 690),
+(70, 53, 'destination_number', '^9995$', 700),
+(71, 54, 'destination_number', '^9996$', 710),
+(72, 55, 'destination_number', '^9997$', 720),
+(73, 56, 'destination_number', '^9998$', 730),
+(74, 57, 'destination_number', '^9999$', 740),
+(75, 57, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 750);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+INSERT INTO `dialplan_context` (`context_id`, `dialplan_id`, `context`, `weight`) VALUES
+(1, 1, 'default', 10),
+(2, 1, 'public', 20);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=58 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+INSERT INTO `dialplan_extension` (`extension_id`, `context_id`, `name`, `continue`, `weight`) VALUES
+(1, 1, 'unloop', '', 10),
+(2, 1, 'set_domain', 'true', 20),
+(3, 1, 'set_domain_openzap', 'true', 30),
+(4, 1, 'tod_example', 'true', 40),
+(5, 1, 'global-intercept', '', 50),
+(6, 1, 'group-intercept', '', 60),
+(7, 1, 'intercept-ext', '', 70),
+(8, 1, 'redial', '', 80),
+(9, 1, 'global', 'true', 90),
+(10, 1, 'snom-demo-2', '', 100),
+(11, 1, 'snom-demo-1', '', 110),
+(12, 1, 'eavesdrop', '', 120),
+(13, 1, 'eavesdrop', '', 130),
+(14, 1, 'call_return', '', 140),
+(15, 1, 'del-group', '', 150),
+(16, 1, 'add-group', '', 160),
+(17, 1, 'call-group-simo', '', 170),
+(18, 1, 'call-group-order', '', 180),
+(19, 1, 'extension-intercom', '', 190),
+(20, 1, 'Local_Extension', '', 200),
+(21, 1, 'group_dial_sales', '', 210),
+(22, 1, 'group_dial_support', '', 220),
+(23, 1, 'group_dial_billing', '', 230),
+(24, 1, 'operator', '', 240),
+(25, 1, 'vmain', '', 250),
+(26, 1, 'sip_uri', '', 260),
+(27, 1, 'nb_conferences', '', 270),
+(28, 1, 'wb_conferences', '', 280),
+(29, 1, 'uwb_conferences', '', 290),
+(30, 1, 'cdquality_conferences', '', 300),
+(31, 1, 'freeswitch_public_conf_via_sip', '', 310),
+(32, 1, 'mad_boss_intercom', '', 320),
+(33, 1, 'mad_boss_intercom', '', 330),
+(34, 1, 'mad_boss', '', 340),
+(35, 1, 'ivr_demo', '', 350),
+(36, 1, 'dyanmic conference', '', 360),
+(37, 1, 'rtp_multicast_page', '', 370),
+(38, 1, 'park', '', 380),
+(39, 1, 'unpark', '', 390),
+(40, 1, 'park', '', 400),
+(41, 1, 'unpark', '', 410),
+(42, 1, 'park', '', 420),
+(43, 1, 'unpark', '', 430),
+(44, 1, 'wait', '', 440),
+(45, 1, 'ringback_180', '', 450),
+(46, 1, 'ringback_183_uk_ring', '', 460),
+(47, 1, 'ringback_183_music_ring', '', 470),
+(48, 1, 'ringback_post_answer_uk_ring', '', 480),
+(49, 1, 'ringback_post_answer_music', '', 490),
+(50, 1, 'show_info', '', 500),
+(51, 1, 'video_record', '', 510),
+(52, 1, 'video_playback', '', 520),
+(53, 1, 'delay_echo', '', 530),
+(54, 1, 'echo', '', 540),
+(55, 1, 'milliwatt', '', 550),
+(56, 2, 'tone_stream', '', 560),
+(57, 2, 'hold_music', '', 570);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+INSERT INTO `dingaling_profiles` (`id`, `profile_name`, `type`) VALUES
+(1, 'fs.intralanman.servehttp.com', 'component');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+INSERT INTO `dingaling_profile_params` (`id`, `dingaling_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', 'secret'),
+(2, 1, 'dialplan', 'XML,enum'),
+(3, 1, 'server', 'example.org'),
+(4, 1, 'name', 'fs.example.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+INSERT INTO `dingaling_settings` (`id`, `param_name`, `param_value`) VALUES
+(1, 'debug', '0'),
+(2, 'codec-prefs', '$${global_codec_prefs}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+INSERT INTO `directory` (`id`, `username`, `domain`) VALUES
+(1, '1000', 'example.com'),
+(2, '1001', 'example.org'),
+(3, '1002', 'example.net'),
+(5, '1003', 'example.info'),
+(6, '1004', 'example.com'),
+(7, '1005', 'example.org'),
+(8, '1006', 'example.net'),
+(9, '1007', 'example.info'),
+(10, '2000', 'default'),
+(11, '1009', '$${local_ip_v4}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+INSERT INTO `directory_domains` (`id`, `domain_name`) VALUES
+(1, 'freeswitch.org'),
+(2, 'sofaswitch.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+INSERT INTO `directory_global_params` (`id`, `param_name`, `param_value`, `domain_id`) VALUES
+(1, 'default_gateway', 'errors', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+INSERT INTO `directory_params` (`id`, `directory_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', '1234'),
+(2, 1, 'vm-password', '861000'),
+(3, 2, 'password', '1234'),
+(4, 2, 'vm-password', '861001'),
+(7, 5, 'password', '1234'),
+(8, 6, 'password', '1234'),
+(9, 7, 'password', '1234'),
+(10, 8, 'password', '123456'),
+(11, 9, 'password', '1234'),
+(12, 10, 'password', '123456'),
+(13, 11, 'password', '1234'),
+(14, 3, 'vm-password', '861002'),
+(15, 3, 'password', '1234'),
+(16, 11, 'vm-password', '861009'),
+(17, 10, 'vm-password', '1234'),
+(18, 9, 'vm-password', '861007'),
+(19, 8, 'vm-password', '861006'),
+(20, 7, 'vm-password', '861005'),
+(21, 6, 'vm-password', '861004'),
+(22, 5, 'vm-password', '861003');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+INSERT INTO `directory_vars` (`id`, `directory_id`, `var_name`, `var_value`) VALUES
+(1, 1, 'numbering_plan', 'US'),
+(2, 2, 'numbering_plan', 'US'),
+(3, 3, 'numbering_plan', 'AU'),
+(4, 5, 'numbering_plan', 'US'),
+(5, 5, 'area_code', '434');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+INSERT INTO `iax_conf` (`id`, `profile_name`) VALUES
+(3, 'test_profile');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=43 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+INSERT INTO `iax_settings` (`id`, `iax_id`, `param_name`, `param_value`) VALUES
+(35, 3, 'debug', '1'),
+(36, 3, 'ip', '$${local_ip_v4}'),
+(37, 3, 'port', '4569'),
+(38, 3, 'context', 'public'),
+(39, 3, 'dialplan', 'enum,XML'),
+(40, 3, 'codec-prefs', '$${global_codec_prefs}'),
+(41, 3, 'codec-master', 'us'),
+(42, 3, 'codec-rate', '8');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+INSERT INTO `ivr_conf` (`id`, `name`, `greet_long`, `greet_short`, `invalid_sound`, `exit_sound`, `max_failures`, `timeout`, `tts_engine`, `tts_voice`) VALUES
+(1, 'demo', 'soundfiles/ivr/demo/greet-long.wav', 'soundfiles/ivr/demo/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, 'cepstral', 'allison'),
+(2, 'demo2', 'soundfiles/ivr/demo2/greet-long.wav', 'soundfiles/ivr/demo2/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, NULL, NULL),
+(3, 'menu8', 'soundfiles/ivr/menu8/greet-long.wav', 'soundfiles/ivr/menu8/greet-short.wav', 'soundfiles/ivr/menu8/invalid.wav', 'soundfiles/ivr/menu8/exit.wav', 3, 5, NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` USING BTREE (`ivr_id`,`digits`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+INSERT INTO `ivr_entries` (`id`, `ivr_id`, `action`, `digits`, `params`) VALUES
+(1, 1, 'menu-play-sound', '1', 'soundfiles/features.wav'),
+(2, 1, 'menu-exit', '*', NULL),
+(3, 1, 'menu-sub', '2', 'demo2'),
+(4, 1, 'menu-exec-api', '3', 'bridge sofia/$${domain}/888@conference.freeswtich.org'),
+(5, 1, 'menu-call-transfer', '4', '888'),
+(6, 2, 'menu-back', '#', NULL),
+(7, 2, 'menu-top', '*', NULL),
+(8, 3, 'menu-back', '#', NULL),
+(9, 3, 'menu-top', '*', NULL),
+(10, 3, 'menu-playsound', '4', 'soundfiles/4.wav');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+INSERT INTO `modless_conf` (`id`, `conf_name`) VALUES
+(1, 'acl.conf'),
+(2, 'postl_load_switch.conf'),
+(3, 'post_load_modules.conf');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+INSERT INTO `post_load_modules_conf` (`id`, `module_name`, `load_module`, `priority`) VALUES
+(1, 'mod_sofia', 1, 2000),
+(2, 'mod_iax', 1, 2000),
+(3, 'mod_xml_rpc', 1, 100),
+(4, 'mod_portaudio', 1, 1000),
+(5, 'mod_enum', 1, 2000),
+(6, 'mod_xml_cdr', 1, 1000),
+(7, 'mod_spidermonkey', 1, 1000),
+(8, 'mod_alsa', 0, 1000),
+(9, 'mod_log_file', 1, 0),
+(10, 'mod_commands', 1, 1000),
+(11, 'mod_voicemail', 1, 1000),
+(12, 'mod_dialplan_xml', 1, 150),
+(13, 'mod_dialplan_asterisk', 1, 150),
+(14, 'mod_openzap', 0, 1000),
+(15, 'mod_woomera', 0, 1000),
+(17, 'mod_speex', 1, 500),
+(18, 'mod_ilbc', 0, 1000),
+(20, 'mod_g723_1', 1, 500),
+(21, 'mod_g729', 1, 500),
+(22, 'mod_g722', 1, 500),
+(23, 'mod_g726', 1, 500),
+(25, 'mod_amr', 1, 500),
+(26, 'mod_fifo', 1, 1000),
+(27, 'mod_limit', 1, 1000),
+(28, 'mod_syslog', 1, 0),
+(29, 'mod_dingaling', 1, 2000),
+(30, 'mod_cdr_csv', 1, 1000),
+(31, 'mod_event_socket', 1, 100),
+(32, 'mod_multicast', 0, 1000),
+(33, 'mod_zeroconf', 0, 1000),
+(34, 'mod_xmpp_event', 0, 1000),
+(35, 'mod_sndfile', 1, 1000),
+(36, 'mod_native_file', 1, 1000),
+(37, 'mod_shout', 1, 1000),
+(38, 'mod_local_stream', 1, 1000),
+(39, 'mod_perl', 0, 1000),
+(40, 'mod_python', 0, 1000),
+(41, 'mod_java', 0, 1000),
+(42, 'mod_cepstral', 0, 1000),
+(43, 'mod_openmrcp', 0, 1000),
+(44, 'mod_lumenvox', 0, 1000),
+(45, 'mod_rss', 0, 1000),
+(46, 'mod_say_de', 1, 1000),
+(47, 'mod_say_fr', 0, 1000),
+(48, 'mod_say_en', 1, 1000),
+(49, 'mod_conference', 1, 1000),
+(50, 'mod_ivr', 0, 1000),
+(51, 'mod_console', 1, 0),
+(52, 'mod_dptools', 1, 1500),
+(53, 'mod_voipcodecs', 1, 500);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+INSERT INTO `sofia_aliases` (`id`, `sofia_id`, `alias_name`) VALUES
+(1, 1, 'default'),
+(3, 1, 'sip.example.com');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+INSERT INTO `sofia_conf` (`id`, `profile_name`) VALUES
+(1, '$${domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+INSERT INTO `sofia_gateways` (`id`, `sofia_id`, `gateway_name`, `gateway_param`, `gateway_value`) VALUES
+(8, 1, 'default', 'proxy', 'asterlink.com'),
+(9, 1, 'default', 'realm', 'asterlink.com'),
+(10, 1, 'default', 'username', 'USERNAME_HERE'),
+(11, 1, 'default', 'register', 'false'),
+(12, 1, 'default', 'expire-seconds', '60'),
+(13, 1, 'default', 'retry_seconds', '2'),
+(14, 1, 'default', 'password', 'PASSWORD_HERE');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=37 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+INSERT INTO `sofia_settings` (`id`, `sofia_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'user-agent-string', 'RayUA 2.0pre4'),
+(2, 1, 'auth-calls', 'true'),
+(5, 1, 'debug', '1'),
+(6, 1, 'rfc2833-pt', '101'),
+(7, 1, 'sip-port', '5060'),
+(8, 1, 'dialplan', 'XML'),
+(9, 1, 'dtmf-duration', '100'),
+(10, 1, 'codec-prefs', '$${global_codec_prefs}'),
+(11, 1, 'rtp-timeout-sec', '300'),
+(12, 1, 'rtp-ip', '$${local_ip_v4}'),
+(13, 1, 'sip-ip', '$${local_ip_v4}'),
+(14, 1, 'context', 'default'),
+(15, 1, 'manage-presence', 'true'),
+(16, 1, 'force-register-domain', 'intralanman.servehttp.com'),
+(17, 1, 'inbound-codec-negotiation', 'generous'),
+(18, 1, 'rtp-rewrite-timestampes', 'true'),
+(19, 1, 'nonce-ttl', '60'),
+(20, 1, 'vad', 'out'),
+(36, 1, 'odbc-dsn', 'freeswitch-mysql:freeswitch:Fr33Sw1tch');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+INSERT INTO `voicemail_conf` (`id`, `vm_profile`) VALUES
+(1, 'default');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+INSERT INTO `voicemail_email` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'template-file', 'voicemail.tpl'),
+(2, 1, 'date-fmt', '%A, %B %d %Y, %I %M %p'),
+(3, 1, 'email-from', '${voicemail_account}@${voicemail_domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+INSERT INTO `voicemail_settings` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'file-extension', 'wav'),
+(2, 1, 'terminator-key', '#'),
+(3, 1, 'max-login-attempts', '3'),
+(4, 1, 'digit-timeout', '10000'),
+(5, 1, 'max-record-length', '300'),
+(6, 1, 'tone-spec', '%(1000, 0, 640)'),
+(7, 1, 'callback-dialplan', 'XML'),
+(8, 1, 'callback-context', 'default'),
+(9, 1, 'play-new-messages-key', '1'),
+(10, 1, 'play-saved-messages-key', '2'),
+(11, 1, 'main-menu-key', '*'),
+(12, 1, 'config-menu-key', '5'),
+(13, 1, 'record-greeting-key', '1'),
+(14, 1, 'choose-greeting-key', '2'),
+(15, 1, 'record-file-key', '3'),
+(16, 1, 'listen-file-key', '1'),
+(17, 1, 'record-name-key', '3'),
+(18, 1, 'save-file-key', '9'),
+(19, 1, 'delete-file-key', '7'),
+(20, 1, 'undelete-file-key', '8'),
+(21, 1, 'email-key', '4'),
+(22, 1, 'pause-key', '0'),
+(23, 1, 'restart-key', '1'),
+(24, 1, 'ff-key', '6'),
+(25, 1, 'rew-key', '4'),
+(26, 1, 'record-silence-threshold', '200'),
+(27, 1, 'record-silence-hits', '2'),
+(28, 1, 'web-template-file', 'web-vm.tpl'),
+(29, 1, 'operator-extension', 'operator XML default'),
+(30, 1, 'operator-key', '9');
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlsqlmysql50sql"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0.sql (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0.sql                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/mysql-5.0.sql        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,887 @@
</span><ins>+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:36 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+SET SQL_MODE=&quot;NO_AUTO_VALUE_ON_ZERO&quot;;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` USING BTREE (`conf_group`,`action`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` USING BTREE (`ivr_id`,`digits`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlsqloraclewithexamplessql"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle-with-examples.sql (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle-with-examples.sql                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle-with-examples.sql        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1431 @@
</span><ins>+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:35 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;acl_lists&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;acl_name&quot; varchar(128) NOT NULL,
+  &quot;default_policy&quot; varchar(45) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+INSERT INTO `acl_lists` (`id`, `acl_name`, `default_policy`) VALUES
+(1, 'rfc1918', 'deny'),
+(2, 'lan', 'allow'),
+(3, 'default', 'allow');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;acl_nodes&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;cidr&quot; varchar(45) NOT NULL,
+  &quot;type&quot; varchar(16) NOT NULL,
+  &quot;list_id&quot; int(10) unsigned NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+INSERT INTO `acl_nodes` (`id`, `cidr`, `type`, `list_id`) VALUES
+(1, '192.168.0.0/16', 'allow', 1),
+(2, '10.0.0.0/8', 'allow', 1),
+(3, '172.16.0.0/12', 'allow', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;conference_advertise&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;room&quot; varchar(64) NOT NULL,
+  &quot;status&quot; varchar(128) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_room&quot; (&quot;room&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+INSERT INTO `conference_advertise` (`id`, `room`, `status`) VALUES
+(1, '3000@$${domain}', 'Freeswitch Conference'),
+(2, '3001@$${domain}', 'FreeSWITCH Conference 2'),
+(3, '3002@$${domain}', 'FreeSWITCH Conference 3');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;conference_controls&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;conf_group&quot; varchar(64) NOT NULL,
+  &quot;action&quot; varchar(64) NOT NULL,
+  &quot;digits&quot; varchar(16) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_group_action&quot; (&quot;conf_group&quot;,&quot;action&quot;)
+) AUTO_INCREMENT=13 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+INSERT INTO `conference_controls` (`id`, `conf_group`, `action`, `digits`) VALUES
+(1, 'default', 'mute', '0'),
+(2, 'default', 'deaf_mute', '*'),
+(3, 'default', 'energy up', '9'),
+(4, 'default', 'energy equ', '8'),
+(5, 'default', 'energy dn', '7'),
+(6, 'default', 'vol talk up', '3'),
+(7, 'default', 'vol talk dn', '1'),
+(8, 'default', 'vol talk zero', '2'),
+(9, 'default', 'vol listen up', '6'),
+(10, 'default', 'vol listen dn', '4'),
+(11, 'default', 'vol listen zero', '5'),
+(12, 'default', 'hangup', '#');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;conference_profiles&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;profile_name&quot; varchar(64) NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  KEY &quot;unique_profile_param&quot; (&quot;profile_name&quot;,&quot;param_name&quot;)
+) AUTO_INCREMENT=8 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+INSERT INTO `conference_profiles` (`id`, `profile_name`, `param_name`, `param_value`) VALUES
+(1, 'default', 'domain', '$${domain}'),
+(2, 'default', 'rate', '8000'),
+(3, 'default', 'interval', '20'),
+(4, 'default', 'energy-level', '300'),
+(5, 'default', 'moh-sound', '$${moh_uri}'),
+(6, 'default', 'caller-id-name', '$${outbound_caller_name}'),
+(7, 'default', 'caller-id-number', '$${outbound_caller_number}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan&quot; (
+  &quot;dialplan_id&quot; int(11) NOT NULL,
+  &quot;domain&quot; varchar(128) NOT NULL,
+  &quot;ip_address&quot; varchar(15) NOT NULL,
+  PRIMARY KEY  (&quot;dialplan_id&quot;)
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+INSERT INTO `dialplan` (`dialplan_id`, `domain`, `ip_address`) VALUES
+(1, 'freeswitch', '127.0.0.1');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_actions&quot; (
+  &quot;action_id&quot; int(11) NOT NULL,
+  &quot;condition_id&quot; int(11) NOT NULL,
+  &quot;application&quot; varchar(256) NOT NULL,
+  &quot;data&quot; varchar(256) NOT NULL,
+  &quot;type&quot; varchar(32) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;action_id&quot;)
+) AUTO_INCREMENT=170 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+INSERT INTO `dialplan_actions` (`action_id`, `condition_id`, `application`, `data`, `type`, `weight`) VALUES
+(1, 2, 'deflect', '${destination_number}', 'action', 10),
+(2, 5, 'set', 'domain_name=$${domain}', 'action', 20),
+(3, 5, 'set', 'domain_name=${sip_auth_realm}', 'anti-action', 30),
+(4, 7, 'set', 'domain_name=$${domain}', 'action', 40),
+(5, 9, 'set', 'open=true', 'action', 50),
+(6, 10, 'answer', '', 'action', 60),
+(7, 10, 'intercept', '${db(select/${domain_name}-last_dial/global)}', 'action', 70),
+(8, 10, 'sleep', '2000', 'action', 80),
+(9, 11, 'answer', '', 'action', 90),
+(10, 11, 'intercept', '${db(select/${domain_name}-last_dial/${callgroup})}', 'action', 100),
+(11, 11, 'sleep', '2000', 'action', 110),
+(12, 12, 'answer', '', 'action', 120),
+(13, 12, 'intercept', '${db(select/${domain_name}-last_dial_ext/$1)}', 'action', 130),
+(14, 12, 'sleep', '2000', 'action', 140),
+(15, 13, 'transfer', '${db(select/${domain_name}-last_dial/${caller_id_number})}', 'action', 150),
+(16, 14, 'set', 'use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}', 'action', 160),
+(17, 14, 'set', 'use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}', 'anti-action', 170),
+(18, 15, 'set_user', 'default@${domain_name}', 'action', 180),
+(19, 16, 'info', '', 'action', 190),
+(20, 17, 'set', 'sip_secure_media=true', 'action', 200),
+(21, 18, 'db', 'insert/${domain_name}-spymap/${caller_id_number}/${uuid}', 'action', 210),
+(22, 18, 'db', 'insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}', 'action', 220),
+(23, 18, 'db', 'insert/${domain_name}-last_dial/global/${uuid}', 'action', 230),
+(24, 19, 'eval', '${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}', 'action', 240),
+(25, 19, 'transfer', '3000', 'action', 250),
+(26, 20, 'eval', '${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}', 'action', 260),
+(27, 20, 'playback', '$${hold_music}', 'action', 270),
+(28, 21, 'answer', '', 'action', 280),
+(29, 21, 'eavesdrop', '${db(select/${domain_name}-spymap/$1)}', 'action', 290),
+(30, 22, 'answer', '', 'action', 300),
+(31, 22, 'set', 'eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)', 'action', 310),
+(32, 22, 'set', 'eavesdrop_indicate_new=tone_stream://%(500, 0, 620)', 'action', 320),
+(33, 22, 'set', 'eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)', 'action', 330),
+(34, 22, 'eavesdrop', 'all', 'action', 340),
+(35, 23, 'transfer', '${db(select/${domain_name}-call_return/${caller_id_number})}', 'action', 350),
+(36, 24, 'answer', '', 'action', 360),
+(37, 24, 'group', 'delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 370),
+(38, 24, 'gentones', '%(1000, 0, 320)', 'action', 380),
+(39, 25, 'answer', '', 'action', 390),
+(40, 25, 'group', 'insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 400),
+(41, 25, 'gentones', '%(1000, 0, 640)', 'action', 410),
+(42, 26, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name})}', 'action', 420),
+(43, 27, 'set', 'call_timeout=10', 'action', 430),
+(44, 27, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name}:order)}', 'action', 440),
+(45, 28, 'set', 'dialed_extension=$1', 'action', 450),
+(46, 28, 'export', 'sip_auto_answer=true', 'action', 460),
+(47, 28, 'bridge', 'user/${dialed_extension}@${domain_name}', 'action', 470),
+(48, 29, 'set', 'dialed_extension=$1', 'action', 480),
+(49, 29, 'export', 'dialed_extension=$1', 'action', 490),
+(50, 30, 'set', 'voicemail_authorized=${sip_authorized}', 'action', 500),
+(51, 30, 'answer', '', 'action', 510),
+(52, 30, 'sleep', '1000', 'action', 520),
+(53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
+(54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
+(57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
+(58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),
+(59, 30, 'set', 'call_timeout=30', 'anti-action', 590),
+(60, 30, 'set', 'hangup_after_bridge=true', 'anti-action', 600),
+(61, 30, 'set', 'continue_on_fail=true', 'anti-action', 610),
+(62, 30, 'db', 'insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}', 'anti-action', 620),
+(63, 30, 'db', 'insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}', 'anti-action', 630),
+(64, 30, 'set', 'called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}', 'anti-action', 640),
+(65, 30, 'db', 'insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}', 'anti-action', 650),
+(66, 30, 'bridge', 'user/${dialed_extension}@${domain_name}', 'anti-action', 660),
+(67, 30, 'answer', '', 'anti-action', 670),
+(68, 30, 'sleep', '1000', 'anti-action', 680),
+(69, 30, 'voicemail', 'default ${domain_name} ${dialed_extension}', 'anti-action', 690),
+(70, 31, 'bridge', '${group_call(sales@${domain_name})}', 'action', 700),
+(71, 32, 'bridge', 'group/support@${domain_name}', 'action', 710),
+(72, 33, 'bridge', 'group/billing@${domain_name}', 'action', 720),
+(73, 34, 'set', 'transfer_ringback=$${hold_music}', 'action', 730),
+(74, 34, 'transfer', '1000 XML features', 'action', 740),
+(75, 35, 'answer', '', 'action', 750),
+(76, 35, 'sleep', '1000', 'action', 760),
+(77, 35, 'voicemail', 'check default ${domain_name}', 'action', 770),
+(78, 36, 'bridge', 'sofia/${use_profile}/$1', 'action', 780),
+(79, 37, 'answer', '', 'action', 790),
+(80, 37, 'conference', '$1-${domain_name}@default', 'action', 800),
+(81, 38, 'answer', '', 'action', 810),
+(82, 38, 'conference', '$1-${domain_name}@wideband', 'action', 820),
+(83, 39, 'answer', '', 'action', 830),
+(84, 39, 'conference', '$1-${domain_name}@ultrawideband', 'action', 840),
+(85, 40, 'answer', '', 'action', 850),
+(86, 40, 'conference', '$1-${domain_name}@cdquality', 'action', 860),
+(87, 41, 'bridge', 'sofia/${use_profile}/$1@conference.freeswitch.org', 'action', 870),
+(88, 42, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss1', 'action', 880),
+(89, 42, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 890),
+(90, 42, 'set', 'conference_auto_outcall_timeout=60', 'action', 900),
+(91, 42, 'set', 'conference_auto_outcall_flags=mute', 'action', 910),
+(92, 42, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 920),
+(93, 42, 'set', 'sip_exclude_contact=${network_addr}', 'action', 930),
+(94, 42, 'conference_set_auto_outcall', '${group_call(sales)}', 'action', 940),
+(95, 42, 'conference', 'madboss_intercom1@default+flags{endconf|deaf}', 'action', 950),
+(96, 43, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss2', 'action', 960),
+(97, 43, 'set', 'conference_auto_outcall_caller_id_number=0912', 'action', 970),
+(98, 43, 'set', 'conference_auto_outcall_timeout=60', 'action', 980),
+(99, 43, 'set', 'conference_auto_outcall_flags=mute', 'action', 990),
+(100, 43, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 1000),
+(101, 43, 'set', 'sip_exclude_contact=${network_addr}', 'action', 1010),
+(102, 43, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1020),
+(103, 43, 'conference', 'madboss_intercom2@default+flags{endconf|deaf}', 'action', 1030),
+(104, 44, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss', 'action', 1040),
+(105, 44, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 1050),
+(106, 44, 'set', 'conference_auto_outcall_timeout=60', 'action', 1060),
+(107, 44, 'set', 'conference_auto_outcall_flags=none', 'action', 1070),
+(108, 44, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1080),
+(109, 44, 'conference', 'madboss3@default', 'action', 1090),
+(110, 45, 'answer', '', 'action', 1100),
+(111, 45, 'sleep', '2000', 'action', 1110),
+(112, 45, 'ivr', 'demo_ivr', 'action', 1120),
+(113, 46, 'conference', 'bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org', 'action', 1130),
+(114, 47, 'answer', '', 'action', 1140),
+(115, 47, 'esf_page_group', '', 'action', 1150),
+(116, 48, 'set', 'fifo_music=$${hold_music}', 'action', 1160),
+(117, 48, 'fifo', '5900@${domain_name} in', 'action', 1170),
+(118, 49, 'answer', '', 'action', 1180),
+(119, 49, 'fifo', '5900@${domain_name} out nowait', 'action', 1190),
+(120, 51, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1200),
+(121, 54, 'answer', '', 'action', 1210),
+(122, 54, 'fifo', '$1@${domain_name} out nowait', 'action', 1220),
+(123, 57, '', '', 'expression', 1230),
+(124, 57, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1240),
+(125, 60, 'answer', '', 'action', 1250),
+(126, 60, 'fifo', '$1@${domain_name} out nowait', 'action', 1260),
+(127, 61, 'pre_answer', '', 'action', 1270),
+(128, 61, 'sleep', '20000', 'action', 1280),
+(129, 61, 'answer', '', 'action', 1290),
+(130, 61, 'sleep', '1000', 'action', 1300),
+(131, 61, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1310),
+(132, 61, 'hangup', '', 'action', 1320),
+(133, 62, 'ring_ready', '', 'action', 1330),
+(134, 62, 'sleep', '20000', 'action', 1340),
+(135, 62, 'answer', '', 'action', 1350),
+(136, 62, 'sleep', '1000', 'action', 1360),
+(137, 62, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1370),
+(138, 62, 'hangup', '', 'action', 1380),
+(139, 63, 'set', 'ringback=$${uk-ring}', 'action', 1390),
+(140, 63, 'bridge', 'loopback/wait', 'action', 1400),
+(141, 64, 'set', 'ringback=$${hold_music}', 'action', 1410),
+(142, 64, 'bridge', 'loopback/wait', 'action', 1420),
+(143, 65, 'set', 'transfer_ringback=$${uk-ring}', 'action', 1430),
+(144, 65, 'answer', '', 'action', 1440),
+(145, 65, 'bridge', 'loopback/wait', 'action', 1450),
+(146, 66, 'set', 'transfer_ringback=$${hold_music}', 'action', 1460),
+(147, 66, 'answer', '', 'action', 1470),
+(148, 66, 'bridge', 'loopback/wait', 'action', 1480),
+(149, 67, 'answer', '', 'action', 1490),
+(150, 67, 'info', '', 'action', 1500),
+(151, 67, 'sleep', '250', 'action', 1510),
+(152, 67, 'hangup', '', 'action', 1520),
+(153, 68, 'answer', '', 'action', 1530),
+(154, 68, 'record_fsv', '/tmp/testrecord.fsv', 'action', 1540),
+(155, 69, 'answer', '', 'action', 1550),
+(156, 69, 'play_fsv', '/tmp/testrecord.fsv', 'action', 1560),
+(157, 70, 'answer', '', 'action', 1570),
+(158, 70, 'delay_echo', '5000', 'action', 1580),
+(159, 71, 'answer', '', 'action', 1590),
+(160, 71, 'echo', '', 'action', 1600),
+(161, 72, 'answer', '', 'action', 1610),
+(162, 72, 'playback', 'tone_stream://%(10000,0,1004);loops=-1', 'action', 1620),
+(163, 73, 'answer', '', 'action', 1630),
+(164, 73, 'playback', 'tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10', 'action', 1640),
+(165, 75, 'answer', '', 'action', 1650),
+(166, 75, 'execute_extension', 'is_secure XML features', 'action', 1660),
+(167, 75, 'playback', '$${hold_music}', 'action', 1670),
+(168, 75, 'answer', '', 'anti-action', 1680),
+(169, 75, 'playback', '$${hold_music}', 'anti-action', 1690);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_condition&quot; (
+  &quot;condition_id&quot; int(11) NOT NULL,
+  &quot;extension_id&quot; int(11) NOT NULL,
+  &quot;field&quot; varchar(1238) NOT NULL,
+  &quot;expression&quot; varchar(128) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;condition_id&quot;)
+) AUTO_INCREMENT=76 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+INSERT INTO `dialplan_condition` (`condition_id`, `extension_id`, `field`, `expression`, `weight`) VALUES
+(1, 1, '$${unroll_loops}', '^true$', 10),
+(2, 1, '${sip_looped_call}', '^true$', 20),
+(3, 2, '${domain_name}', '^$', 30),
+(4, 2, 'source', 'mod_sofia', 40),
+(5, 2, '${sip_auth_realm}', '^$', 50),
+(6, 3, '${domain_name}', '^$', 60),
+(7, 3, 'source', 'mod_openzap', 70),
+(8, 4, '${strftime(%w)}', '^([1-5])$', 80),
+(9, 4, '${strftime(%H%M)}', '^((09|1[0-7])[0-5][0-9]|1800)$', 90),
+(10, 5, 'destination_number', '^886$', 100),
+(11, 6, 'destination_number', '^\\*8$', 110),
+(12, 7, 'destination_number', '^\\*\\*(\\d+)$', 120),
+(13, 8, 'destination_number', '^870$', 130),
+(14, 9, '${network_addr}', '^$', 140),
+(15, 9, '${numbering_plan}', '^$', 150),
+(16, 9, '${call_debug}', '^true$', 160),
+(17, 9, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 170),
+(18, 9, '', '', 180),
+(19, 10, 'destination_number', '^9001$', 190),
+(20, 11, 'destination_number', '^9000$', 200),
+(21, 12, 'destination_number', '^88(.*)$|^\\*0(.*)$', 210),
+(22, 13, 'destination_number', '^779$', 220),
+(23, 14, 'destination_number', '^\\*69$|^869$|^lcr$', 230),
+(24, 15, 'destination_number', '^80(\\d{2})$', 240),
+(25, 16, 'destination_number', '^81(\\d{2})$', 250),
+(26, 17, 'destination_number', '^82(\\d{2})$', 260),
+(27, 18, 'destination_number', '^83(\\d{2})$', 270),
+(28, 19, 'destination_number', '^8(10[01][0-9])$', 280),
+(29, 20, 'destination_number', '^(20[01][0-9])$', 290),
+(30, 20, 'destination_number', '^${caller_id_number}$', 300),
+(31, 21, 'destination_number', '^3000$', 310),
+(32, 22, 'destination_number', '^3001$', 320),
+(33, 23, 'destination_number', '^3002$', 330),
+(34, 24, 'destination_number', '^operator$|^0$', 340),
+(35, 25, 'destination_number', '^vmain|4000$', 350),
+(36, 26, 'destination_number', '^sip:(.*)$', 360),
+(37, 27, 'destination_number', '^(30\\d{2})$', 370),
+(38, 28, 'destination_number', '^(31\\d{2})$', 380),
+(39, 29, 'destination_number', '^(32\\d{2})$', 390),
+(40, 30, 'destination_number', '^(33\\d{2})$', 400),
+(41, 31, 'destination_number', '^9(888|1616|3232)$', 410),
+(42, 32, 'destination_number', '^0911$', 420),
+(43, 33, 'destination_number', '^0912$', 430),
+(44, 34, 'destination_number', '^0913$', 440),
+(45, 35, 'destination_number', '^5000$', 450),
+(46, 36, 'destination_number', '^5001$', 460),
+(47, 37, 'destination_number', '^pagegroup$|^7243', 470),
+(48, 38, 'destination_number', '^5900$', 480),
+(49, 39, 'destination_number', '^5901$', 490),
+(50, 40, 'source', 'mod_sofia', 500),
+(51, 40, 'destination_number', 'park\\+(\\d+)', 510),
+(52, 41, 'source', 'mod_sofia', 520),
+(53, 41, 'destination_number', '^parking$', 530),
+(54, 41, '${sip_to_params}', 'fifo\\=(\\d+)', 540),
+(55, 42, 'source', 'mod_sofia', 550),
+(56, 42, 'destination_number', 'callpark', 560),
+(57, 42, '${sip_refer_to}', '', 570),
+(58, 43, 'source', 'mod_sofia', 580),
+(59, 43, 'destination_number', 'pickup', 590),
+(60, 43, '${sip_to_params}', 'orbit\\=(\\d+)', 600),
+(61, 44, 'destination_number', '^wait$', 610),
+(62, 45, 'destination_number', '^9980$', 620),
+(63, 46, 'destination_number', '^9981$', 630),
+(64, 47, 'destination_number', '^9982$', 640),
+(65, 48, 'destination_number', '^9983$', 650),
+(66, 49, 'destination_number', '^9984$', 660),
+(67, 50, 'destination_number', '^9992$', 670),
+(68, 51, 'destination_number', '^9993$', 680),
+(69, 52, 'destination_number', '^9994$', 690),
+(70, 53, 'destination_number', '^9995$', 700),
+(71, 54, 'destination_number', '^9996$', 710),
+(72, 55, 'destination_number', '^9997$', 720),
+(73, 56, 'destination_number', '^9998$', 730),
+(74, 57, 'destination_number', '^9999$', 740),
+(75, 57, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 750);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_context&quot; (
+  &quot;context_id&quot; int(11) NOT NULL,
+  &quot;dialplan_id&quot; int(11) NOT NULL,
+  &quot;context&quot; varchar(64) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;context_id&quot;)
+) AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+INSERT INTO `dialplan_context` (`context_id`, `dialplan_id`, `context`, `weight`) VALUES
+(1, 1, 'default', 10),
+(2, 1, 'public', 20);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_extension&quot; (
+  &quot;extension_id&quot; int(11) NOT NULL,
+  &quot;context_id&quot; int(11) NOT NULL,
+  &quot;name&quot; varchar(128) NOT NULL,
+  &quot;continue&quot; varchar(32) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;extension_id&quot;)
+) AUTO_INCREMENT=58 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+INSERT INTO `dialplan_extension` (`extension_id`, `context_id`, `name`, `continue`, `weight`) VALUES
+(1, 1, 'unloop', '', 10),
+(2, 1, 'set_domain', 'true', 20),
+(3, 1, 'set_domain_openzap', 'true', 30),
+(4, 1, 'tod_example', 'true', 40),
+(5, 1, 'global-intercept', '', 50),
+(6, 1, 'group-intercept', '', 60),
+(7, 1, 'intercept-ext', '', 70),
+(8, 1, 'redial', '', 80),
+(9, 1, 'global', 'true', 90),
+(10, 1, 'snom-demo-2', '', 100),
+(11, 1, 'snom-demo-1', '', 110),
+(12, 1, 'eavesdrop', '', 120),
+(13, 1, 'eavesdrop', '', 130),
+(14, 1, 'call_return', '', 140),
+(15, 1, 'del-group', '', 150),
+(16, 1, 'add-group', '', 160),
+(17, 1, 'call-group-simo', '', 170),
+(18, 1, 'call-group-order', '', 180),
+(19, 1, 'extension-intercom', '', 190),
+(20, 1, 'Local_Extension', '', 200),
+(21, 1, 'group_dial_sales', '', 210),
+(22, 1, 'group_dial_support', '', 220),
+(23, 1, 'group_dial_billing', '', 230),
+(24, 1, 'operator', '', 240),
+(25, 1, 'vmain', '', 250),
+(26, 1, 'sip_uri', '', 260),
+(27, 1, 'nb_conferences', '', 270),
+(28, 1, 'wb_conferences', '', 280),
+(29, 1, 'uwb_conferences', '', 290),
+(30, 1, 'cdquality_conferences', '', 300),
+(31, 1, 'freeswitch_public_conf_via_sip', '', 310),
+(32, 1, 'mad_boss_intercom', '', 320),
+(33, 1, 'mad_boss_intercom', '', 330),
+(34, 1, 'mad_boss', '', 340),
+(35, 1, 'ivr_demo', '', 350),
+(36, 1, 'dyanmic conference', '', 360),
+(37, 1, 'rtp_multicast_page', '', 370),
+(38, 1, 'park', '', 380),
+(39, 1, 'unpark', '', 390),
+(40, 1, 'park', '', 400),
+(41, 1, 'unpark', '', 410),
+(42, 1, 'park', '', 420),
+(43, 1, 'unpark', '', 430),
+(44, 1, 'wait', '', 440),
+(45, 1, 'ringback_180', '', 450),
+(46, 1, 'ringback_183_uk_ring', '', 460),
+(47, 1, 'ringback_183_music_ring', '', 470),
+(48, 1, 'ringback_post_answer_uk_ring', '', 480),
+(49, 1, 'ringback_post_answer_music', '', 490),
+(50, 1, 'show_info', '', 500),
+(51, 1, 'video_record', '', 510),
+(52, 1, 'video_playback', '', 520),
+(53, 1, 'delay_echo', '', 530),
+(54, 1, 'echo', '', 540),
+(55, 1, 'milliwatt', '', 550),
+(56, 2, 'tone_stream', '', 560),
+(57, 2, 'hold_music', '', 570);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_special&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;context&quot; varchar(255) NOT NULL,
+  &quot;class_file&quot; varchar(255) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_context&quot; (&quot;context&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dingaling_profiles&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;profile_name&quot; varchar(64) NOT NULL,
+  &quot;type&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_name&quot; (&quot;profile_name&quot;)
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+INSERT INTO `dingaling_profiles` (`id`, `profile_name`, `type`) VALUES
+(1, 'fs.intralanman.servehttp.com', 'component');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dingaling_profile_params&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;dingaling_id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_type_name&quot; (&quot;dingaling_id&quot;,&quot;param_name&quot;)
+) AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+INSERT INTO `dingaling_profile_params` (`id`, `dingaling_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', 'secret'),
+(2, 1, 'dialplan', 'XML,enum'),
+(3, 1, 'server', 'example.org'),
+(4, 1, 'name', 'fs.example.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dingaling_settings&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_param&quot; (&quot;param_name&quot;)
+) AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+INSERT INTO `dingaling_settings` (`id`, `param_name`, `param_value`) VALUES
+(1, 'debug', '0'),
+(2, 'codec-prefs', '$${global_codec_prefs}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;username&quot; varchar(255) NOT NULL,
+  &quot;domain&quot; varchar(255) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=12 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+INSERT INTO `directory` (`id`, `username`, `domain`) VALUES
+(1, '1000', 'example.com'),
+(2, '1001', 'example.org'),
+(3, '1002', 'example.net'),
+(5, '1003', 'example.info'),
+(6, '1004', 'example.com'),
+(7, '1005', 'example.org'),
+(8, '1006', 'example.net'),
+(9, '1007', 'example.info'),
+(10, '2000', 'default'),
+(11, '1009', '$${local_ip_v4}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_domains&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;domain_name&quot; varchar(128) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+INSERT INTO `directory_domains` (`id`, `domain_name`) VALUES
+(1, 'freeswitch.org'),
+(2, 'sofaswitch.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_gateways&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;directory_id&quot; int(10) unsigned NOT NULL,
+  &quot;gateway_name&quot; varchar(128) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_gateway_params&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;d_gw_id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_gw_param&quot; (&quot;d_gw_id&quot;,&quot;param_name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_global_params&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(128) NOT NULL,
+  &quot;domain_id&quot; int(10) unsigned NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+INSERT INTO `directory_global_params` (`id`, `param_name`, `param_value`, `domain_id`) VALUES
+(1, 'default_gateway', 'errors', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_global_vars&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;var_name&quot; varchar(64) NOT NULL,
+  &quot;var_value&quot; varchar(128) NOT NULL,
+  &quot;domain_id&quot; int(10) unsigned NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_params&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=23 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+INSERT INTO `directory_params` (`id`, `directory_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', '1234'),
+(2, 1, 'vm-password', '861000'),
+(3, 2, 'password', '1234'),
+(4, 2, 'vm-password', '861001'),
+(7, 5, 'password', '1234'),
+(8, 6, 'password', '1234'),
+(9, 7, 'password', '1234'),
+(10, 8, 'password', '123456'),
+(11, 9, 'password', '1234'),
+(12, 10, 'password', '123456'),
+(13, 11, 'password', '1234'),
+(14, 3, 'vm-password', '861002'),
+(15, 3, 'password', '1234'),
+(16, 11, 'vm-password', '861009'),
+(17, 10, 'vm-password', '1234'),
+(18, 9, 'vm-password', '861007'),
+(19, 8, 'vm-password', '861006'),
+(20, 7, 'vm-password', '861005'),
+(21, 6, 'vm-password', '861004'),
+(22, 5, 'vm-password', '861003');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_vars&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_id&quot; int(11) default NULL,
+  &quot;var_name&quot; varchar(255) default NULL,
+  &quot;var_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=6 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+INSERT INTO `directory_vars` (`id`, `directory_id`, `var_name`, `var_value`) VALUES
+(1, 1, 'numbering_plan', 'US'),
+(2, 2, 'numbering_plan', 'US'),
+(3, 3, 'numbering_plan', 'AU'),
+(4, 5, 'numbering_plan', 'US'),
+(5, 5, 'area_code', '434');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;iax_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;profile_name&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+INSERT INTO `iax_conf` (`id`, `profile_name`) VALUES
+(3, 'test_profile');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;iax_settings&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;iax_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=43 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+INSERT INTO `iax_settings` (`id`, `iax_id`, `param_name`, `param_value`) VALUES
+(35, 3, 'debug', '1'),
+(36, 3, 'ip', '$${local_ip_v4}'),
+(37, 3, 'port', '4569'),
+(38, 3, 'context', 'public'),
+(39, 3, 'dialplan', 'enum,XML'),
+(40, 3, 'codec-prefs', '$${global_codec_prefs}'),
+(41, 3, 'codec-master', 'us'),
+(42, 3, 'codec-rate', '8');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;ivr_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;name&quot; varchar(64) NOT NULL,
+  &quot;greet_long&quot; varchar(255) NOT NULL,
+  &quot;greet_short&quot; varchar(255) NOT NULL,
+  &quot;invalid_sound&quot; varchar(255) NOT NULL,
+  &quot;exit_sound&quot; varchar(255) NOT NULL,
+  &quot;max_failures&quot; int(10) unsigned NOT NULL default '3',
+  &quot;timeout&quot; int(11) NOT NULL default '5',
+  &quot;tts_engine&quot; varchar(64) default NULL,
+  &quot;tts_voice&quot; varchar(64) default NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_name&quot; (&quot;name&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+INSERT INTO `ivr_conf` (`id`, `name`, `greet_long`, `greet_short`, `invalid_sound`, `exit_sound`, `max_failures`, `timeout`, `tts_engine`, `tts_voice`) VALUES
+(1, 'demo', 'soundfiles/ivr/demo/greet-long.wav', 'soundfiles/ivr/demo/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, 'cepstral', 'allison'),
+(2, 'demo2', 'soundfiles/ivr/demo2/greet-long.wav', 'soundfiles/ivr/demo2/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, NULL, NULL),
+(3, 'menu8', 'soundfiles/ivr/menu8/greet-long.wav', 'soundfiles/ivr/menu8/greet-short.wav', 'soundfiles/ivr/menu8/invalid.wav', 'soundfiles/ivr/menu8/exit.wav', 3, 5, NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;ivr_entries&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;ivr_id&quot; int(10) unsigned NOT NULL,
+  &quot;action&quot; varchar(64) NOT NULL,
+  &quot;digits&quot; varchar(16) NOT NULL,
+  &quot;params&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_ivr_digits&quot; (&quot;ivr_id&quot;,&quot;digits&quot;)
+) AUTO_INCREMENT=11 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+INSERT INTO `ivr_entries` (`id`, `ivr_id`, `action`, `digits`, `params`) VALUES
+(1, 1, 'menu-play-sound', '1', 'soundfiles/features.wav'),
+(2, 1, 'menu-exit', '*', NULL),
+(3, 1, 'menu-sub', '2', 'demo2'),
+(4, 1, 'menu-exec-api', '3', 'bridge sofia/$${domain}/888@conference.freeswtich.org'),
+(5, 1, 'menu-call-transfer', '4', '888'),
+(6, 2, 'menu-back', '#', NULL),
+(7, 2, 'menu-top', '*', NULL),
+(8, 3, 'menu-back', '#', NULL),
+(9, 3, 'menu-top', '*', NULL),
+(10, 3, 'menu-playsound', '4', 'soundfiles/4.wav');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;limit_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;name&quot; varchar(255) default NULL,
+  &quot;value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;limit_data&quot; (
+  &quot;hostname&quot; varchar(255) default NULL,
+  &quot;realm&quot; varchar(255) default NULL,
+  &quot;id&quot; varchar(255) default NULL,
+  &quot;uuid&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;local_stream_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_name&quot; varchar(255) default NULL,
+  &quot;directory_path&quot; text,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;modless_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;conf_name&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+INSERT INTO `modless_conf` (`id`, `conf_name`) VALUES
+(1, 'acl.conf'),
+(2, 'postl_load_switch.conf'),
+(3, 'post_load_modules.conf');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;post_load_modules_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;module_name&quot; varchar(64) NOT NULL,
+  &quot;load_module&quot; tinyint(1) NOT NULL default '1',
+  &quot;priority&quot; int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_mod&quot; (&quot;module_name&quot;)
+) AUTO_INCREMENT=54 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+INSERT INTO `post_load_modules_conf` (`id`, `module_name`, `load_module`, `priority`) VALUES
+(1, 'mod_sofia', 1, 2000),
+(2, 'mod_iax', 1, 2000),
+(3, 'mod_xml_rpc', 1, 100),
+(4, 'mod_portaudio', 1, 1000),
+(5, 'mod_enum', 1, 2000),
+(6, 'mod_xml_cdr', 1, 1000),
+(7, 'mod_spidermonkey', 1, 1000),
+(8, 'mod_alsa', 0, 1000),
+(9, 'mod_log_file', 1, 0),
+(10, 'mod_commands', 1, 1000),
+(11, 'mod_voicemail', 1, 1000),
+(12, 'mod_dialplan_xml', 1, 150),
+(13, 'mod_dialplan_asterisk', 1, 150),
+(14, 'mod_openzap', 0, 1000),
+(15, 'mod_woomera', 0, 1000),
+(17, 'mod_speex', 1, 500),
+(18, 'mod_ilbc', 0, 1000),
+(20, 'mod_g723_1', 1, 500),
+(21, 'mod_g729', 1, 500),
+(22, 'mod_g722', 1, 500),
+(23, 'mod_g726', 1, 500),
+(25, 'mod_amr', 1, 500),
+(26, 'mod_fifo', 1, 1000),
+(27, 'mod_limit', 1, 1000),
+(28, 'mod_syslog', 1, 0),
+(29, 'mod_dingaling', 1, 2000),
+(30, 'mod_cdr_csv', 1, 1000),
+(31, 'mod_event_socket', 1, 100),
+(32, 'mod_multicast', 0, 1000),
+(33, 'mod_zeroconf', 0, 1000),
+(34, 'mod_xmpp_event', 0, 1000),
+(35, 'mod_sndfile', 1, 1000),
+(36, 'mod_native_file', 1, 1000),
+(37, 'mod_shout', 1, 1000),
+(38, 'mod_local_stream', 1, 1000),
+(39, 'mod_perl', 0, 1000),
+(40, 'mod_python', 0, 1000),
+(41, 'mod_java', 0, 1000),
+(42, 'mod_cepstral', 0, 1000),
+(43, 'mod_openmrcp', 0, 1000),
+(44, 'mod_lumenvox', 0, 1000),
+(45, 'mod_rss', 0, 1000),
+(46, 'mod_say_de', 1, 1000),
+(47, 'mod_say_fr', 0, 1000),
+(48, 'mod_say_en', 1, 1000),
+(49, 'mod_conference', 1, 1000),
+(50, 'mod_ivr', 0, 1000),
+(51, 'mod_console', 1, 0),
+(52, 'mod_dptools', 1, 1500),
+(53, 'mod_voipcodecs', 1, 500);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;rss_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_id&quot; int(11) NOT NULL,
+  &quot;feed&quot; text NOT NULL,
+  &quot;local_file&quot; text NOT NULL,
+  &quot;description&quot; text,
+  &quot;priority&quot; int(11) NOT NULL default '1000',
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_authentication&quot; (
+  &quot;nonce&quot; varchar(255) default NULL,
+  &quot;expires&quot; int(11) default NULL
+);
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_dialogs&quot; (
+  &quot;call_id&quot; varchar(255) default NULL,
+  &quot;uuid&quot; varchar(255) default NULL,
+  &quot;sip_to_user&quot; varchar(255) default NULL,
+  &quot;sip_to_host&quot; varchar(255) default NULL,
+  &quot;sip_from_user&quot; varchar(255) default NULL,
+  &quot;sip_from_host&quot; varchar(255) default NULL,
+  &quot;contact_user&quot; varchar(255) default NULL,
+  &quot;contact_host&quot; varchar(255) default NULL,
+  &quot;state&quot; varchar(255) default NULL,
+  &quot;direction&quot; varchar(255) default NULL,
+  &quot;user_agent&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_registrations&quot; (
+  &quot;call_id&quot; varchar(255) default NULL,
+  &quot;sip_user&quot; varchar(255) default NULL,
+  &quot;sip_host&quot; varchar(255) default NULL,
+  &quot;contact&quot; varchar(1024) default NULL,
+  &quot;status&quot; varchar(255) default NULL,
+  &quot;rpid&quot; varchar(255) default NULL,
+  &quot;expires&quot; int(11) default NULL,
+  &quot;user_agent&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_subscriptions&quot; (
+  &quot;proto&quot; varchar(255) default NULL,
+  &quot;sip_user&quot; varchar(255) default NULL,
+  &quot;sip_host&quot; varchar(255) default NULL,
+  &quot;sub_to_user&quot; varchar(255) default NULL,
+  &quot;sub_to_host&quot; varchar(255) default NULL,
+  &quot;event&quot; varchar(255) default NULL,
+  &quot;contact&quot; varchar(1024) default NULL,
+  &quot;call_id&quot; varchar(255) default NULL,
+  &quot;full_from&quot; varchar(255) default NULL,
+  &quot;full_via&quot; varchar(255) default NULL,
+  &quot;expires&quot; int(11) default NULL,
+  &quot;user_agent&quot; varchar(255) default NULL,
+  &quot;accept&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_aliases&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;sofia_id&quot; int(10) unsigned NOT NULL,
+  &quot;alias_name&quot; varchar(255) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+INSERT INTO `sofia_aliases` (`id`, `sofia_id`, `alias_name`) VALUES
+(1, 1, 'default'),
+(3, 1, 'sip.example.com');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;profile_name&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+INSERT INTO `sofia_conf` (`id`, `profile_name`) VALUES
+(1, '$${domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_domains&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;sofia_id&quot; int(11) default NULL,
+  &quot;domain_name&quot; varchar(255) default NULL,
+  &quot;parse&quot; tinyint(1) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_gateways&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;sofia_id&quot; int(11) default NULL,
+  &quot;gateway_name&quot; varchar(255) default NULL,
+  &quot;gateway_param&quot; varchar(255) default NULL,
+  &quot;gateway_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+INSERT INTO `sofia_gateways` (`id`, `sofia_id`, `gateway_name`, `gateway_param`, `gateway_value`) VALUES
+(8, 1, 'default', 'proxy', 'asterlink.com'),
+(9, 1, 'default', 'realm', 'asterlink.com'),
+(10, 1, 'default', 'username', 'USERNAME_HERE'),
+(11, 1, 'default', 'register', 'false'),
+(12, 1, 'default', 'expire-seconds', '60'),
+(13, 1, 'default', 'retry_seconds', '2'),
+(14, 1, 'default', 'password', 'PASSWORD_HERE');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_settings&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;sofia_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=37 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+INSERT INTO `sofia_settings` (`id`, `sofia_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'user-agent-string', 'RayUA 2.0pre4'),
+(2, 1, 'auth-calls', 'true'),
+(5, 1, 'debug', '1'),
+(6, 1, 'rfc2833-pt', '101'),
+(7, 1, 'sip-port', '5060'),
+(8, 1, 'dialplan', 'XML'),
+(9, 1, 'dtmf-duration', '100'),
+(10, 1, 'codec-prefs', '$${global_codec_prefs}'),
+(11, 1, 'rtp-timeout-sec', '300'),
+(12, 1, 'rtp-ip', '$${local_ip_v4}'),
+(13, 1, 'sip-ip', '$${local_ip_v4}'),
+(14, 1, 'context', 'default'),
+(15, 1, 'manage-presence', 'true'),
+(16, 1, 'force-register-domain', 'intralanman.servehttp.com'),
+(17, 1, 'inbound-codec-negotiation', 'generous'),
+(18, 1, 'rtp-rewrite-timestampes', 'true'),
+(19, 1, 'nonce-ttl', '60'),
+(20, 1, 'vad', 'out'),
+(36, 1, 'odbc-dsn', 'freeswitch-mysql:freeswitch:Fr33Sw1tch');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;voicemail_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;vm_profile&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_profile&quot; (&quot;vm_profile&quot;)
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+INSERT INTO `voicemail_conf` (`id`, `vm_profile`) VALUES
+(1, 'default');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;voicemail_email&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;voicemail_id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_profile_param&quot; (&quot;param_name&quot;,&quot;voicemail_id&quot;)
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+INSERT INTO `voicemail_email` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'template-file', 'voicemail.tpl'),
+(2, 1, 'date-fmt', '%A, %B %d %Y, %I %M %p'),
+(3, 1, 'email-from', '${voicemail_account}@${voicemail_domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;voicemail_settings&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;voicemail_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=31 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+INSERT INTO `voicemail_settings` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'file-extension', 'wav'),
+(2, 1, 'terminator-key', '#'),
+(3, 1, 'max-login-attempts', '3'),
+(4, 1, 'digit-timeout', '10000'),
+(5, 1, 'max-record-length', '300'),
+(6, 1, 'tone-spec', '%(1000, 0, 640)'),
+(7, 1, 'callback-dialplan', 'XML'),
+(8, 1, 'callback-context', 'default'),
+(9, 1, 'play-new-messages-key', '1'),
+(10, 1, 'play-saved-messages-key', '2'),
+(11, 1, 'main-menu-key', '*'),
+(12, 1, 'config-menu-key', '5'),
+(13, 1, 'record-greeting-key', '1'),
+(14, 1, 'choose-greeting-key', '2'),
+(15, 1, 'record-file-key', '3'),
+(16, 1, 'listen-file-key', '1'),
+(17, 1, 'record-name-key', '3'),
+(18, 1, 'save-file-key', '9'),
+(19, 1, 'delete-file-key', '7'),
+(20, 1, 'undelete-file-key', '8'),
+(21, 1, 'email-key', '4'),
+(22, 1, 'pause-key', '0'),
+(23, 1, 'restart-key', '1'),
+(24, 1, 'ff-key', '6'),
+(25, 1, 'rew-key', '4'),
+(26, 1, 'record-silence-threshold', '200'),
+(27, 1, 'record-silence-hits', '2'),
+(28, 1, 'web-template-file', 'web-vm.tpl'),
+(29, 1, 'operator-extension', 'operator XML default'),
+(30, 1, 'operator-key', '9');
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT &quot;dingaling_profile&quot; FOREIGN KEY (&quot;dingaling_id&quot;) REFERENCES &quot;dingaling_profiles&quot; (&quot;id&quot;) ON DELETE CASCADE ON UPDATE CASCADE;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmccurlsqloraclesql"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle.sql (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle.sql                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/curl/sql/oracle.sql        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,885 @@
</span><ins>+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:37 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;acl_lists&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;acl_name&quot; varchar(128) NOT NULL,
+  &quot;default_policy&quot; varchar(45) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;acl_nodes&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;cidr&quot; varchar(45) NOT NULL,
+  &quot;type&quot; varchar(16) NOT NULL,
+  &quot;list_id&quot; int(10) unsigned NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;conference_advertise&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;room&quot; varchar(64) NOT NULL,
+  &quot;status&quot; varchar(128) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_room&quot; (&quot;room&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;conference_controls&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;conf_group&quot; varchar(64) NOT NULL,
+  &quot;action&quot; varchar(64) NOT NULL,
+  &quot;digits&quot; varchar(16) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_group_action&quot; (&quot;conf_group&quot;,&quot;action&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;conference_profiles&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;profile_name&quot; varchar(64) NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  KEY &quot;unique_profile_param&quot; (&quot;profile_name&quot;,&quot;param_name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan&quot; (
+  &quot;dialplan_id&quot; int(11) NOT NULL,
+  &quot;domain&quot; varchar(128) NOT NULL,
+  &quot;ip_address&quot; varchar(15) NOT NULL,
+  PRIMARY KEY  (&quot;dialplan_id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_actions&quot; (
+  &quot;action_id&quot; int(11) NOT NULL,
+  &quot;condition_id&quot; int(11) NOT NULL,
+  &quot;application&quot; varchar(256) NOT NULL,
+  &quot;data&quot; varchar(256) NOT NULL,
+  &quot;type&quot; varchar(32) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;action_id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_condition&quot; (
+  &quot;condition_id&quot; int(11) NOT NULL,
+  &quot;extension_id&quot; int(11) NOT NULL,
+  &quot;field&quot; varchar(1238) NOT NULL,
+  &quot;expression&quot; varchar(128) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;condition_id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_context&quot; (
+  &quot;context_id&quot; int(11) NOT NULL,
+  &quot;dialplan_id&quot; int(11) NOT NULL,
+  &quot;context&quot; varchar(64) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;context_id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_extension&quot; (
+  &quot;extension_id&quot; int(11) NOT NULL,
+  &quot;context_id&quot; int(11) NOT NULL,
+  &quot;name&quot; varchar(128) NOT NULL,
+  &quot;continue&quot; varchar(32) NOT NULL,
+  &quot;weight&quot; int(11) NOT NULL,
+  PRIMARY KEY  (&quot;extension_id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dialplan_special&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;context&quot; varchar(255) NOT NULL,
+  &quot;class_file&quot; varchar(255) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_context&quot; (&quot;context&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dingaling_profiles&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;profile_name&quot; varchar(64) NOT NULL,
+  &quot;type&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_name&quot; (&quot;profile_name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dingaling_profile_params&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;dingaling_id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_type_name&quot; (&quot;dingaling_id&quot;,&quot;param_name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;dingaling_settings&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_param&quot; (&quot;param_name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;username&quot; varchar(255) NOT NULL,
+  &quot;domain&quot; varchar(255) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_domains&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;domain_name&quot; varchar(128) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_gateways&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;directory_id&quot; int(10) unsigned NOT NULL,
+  &quot;gateway_name&quot; varchar(128) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_gateway_params&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;d_gw_id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_gw_param&quot; (&quot;d_gw_id&quot;,&quot;param_name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_global_params&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(128) NOT NULL,
+  &quot;domain_id&quot; int(10) unsigned NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_global_vars&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;var_name&quot; varchar(64) NOT NULL,
+  &quot;var_value&quot; varchar(128) NOT NULL,
+  &quot;domain_id&quot; int(10) unsigned NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_params&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;directory_vars&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_id&quot; int(11) default NULL,
+  &quot;var_name&quot; varchar(255) default NULL,
+  &quot;var_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;iax_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;profile_name&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;iax_settings&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;iax_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;ivr_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;name&quot; varchar(64) NOT NULL,
+  &quot;greet_long&quot; varchar(255) NOT NULL,
+  &quot;greet_short&quot; varchar(255) NOT NULL,
+  &quot;invalid_sound&quot; varchar(255) NOT NULL,
+  &quot;exit_sound&quot; varchar(255) NOT NULL,
+  &quot;max_failures&quot; int(10) unsigned NOT NULL default '3',
+  &quot;timeout&quot; int(11) NOT NULL default '5',
+  &quot;tts_engine&quot; varchar(64) default NULL,
+  &quot;tts_voice&quot; varchar(64) default NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_name&quot; (&quot;name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;ivr_entries&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;ivr_id&quot; int(10) unsigned NOT NULL,
+  &quot;action&quot; varchar(64) NOT NULL,
+  &quot;digits&quot; varchar(16) NOT NULL,
+  &quot;params&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_ivr_digits&quot; (&quot;ivr_id&quot;,&quot;digits&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;limit_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;name&quot; varchar(255) default NULL,
+  &quot;value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;limit_data&quot; (
+  &quot;hostname&quot; varchar(255) default NULL,
+  &quot;realm&quot; varchar(255) default NULL,
+  &quot;id&quot; varchar(255) default NULL,
+  &quot;uuid&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;local_stream_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_name&quot; varchar(255) default NULL,
+  &quot;directory_path&quot; text,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;modless_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;conf_name&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;post_load_modules_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;module_name&quot; varchar(64) NOT NULL,
+  &quot;load_module&quot; tinyint(1) NOT NULL default '1',
+  &quot;priority&quot; int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_mod&quot; (&quot;module_name&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;rss_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;directory_id&quot; int(11) NOT NULL,
+  &quot;feed&quot; text NOT NULL,
+  &quot;local_file&quot; text NOT NULL,
+  &quot;description&quot; text,
+  &quot;priority&quot; int(11) NOT NULL default '1000',
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_authentication&quot; (
+  &quot;nonce&quot; varchar(255) default NULL,
+  &quot;expires&quot; int(11) default NULL
+);
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_dialogs&quot; (
+  &quot;call_id&quot; varchar(255) default NULL,
+  &quot;uuid&quot; varchar(255) default NULL,
+  &quot;sip_to_user&quot; varchar(255) default NULL,
+  &quot;sip_to_host&quot; varchar(255) default NULL,
+  &quot;sip_from_user&quot; varchar(255) default NULL,
+  &quot;sip_from_host&quot; varchar(255) default NULL,
+  &quot;contact_user&quot; varchar(255) default NULL,
+  &quot;contact_host&quot; varchar(255) default NULL,
+  &quot;state&quot; varchar(255) default NULL,
+  &quot;direction&quot; varchar(255) default NULL,
+  &quot;user_agent&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_registrations&quot; (
+  &quot;call_id&quot; varchar(255) default NULL,
+  &quot;sip_user&quot; varchar(255) default NULL,
+  &quot;sip_host&quot; varchar(255) default NULL,
+  &quot;contact&quot; varchar(1024) default NULL,
+  &quot;status&quot; varchar(255) default NULL,
+  &quot;rpid&quot; varchar(255) default NULL,
+  &quot;expires&quot; int(11) default NULL,
+  &quot;user_agent&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sip_subscriptions&quot; (
+  &quot;proto&quot; varchar(255) default NULL,
+  &quot;sip_user&quot; varchar(255) default NULL,
+  &quot;sip_host&quot; varchar(255) default NULL,
+  &quot;sub_to_user&quot; varchar(255) default NULL,
+  &quot;sub_to_host&quot; varchar(255) default NULL,
+  &quot;event&quot; varchar(255) default NULL,
+  &quot;contact&quot; varchar(1024) default NULL,
+  &quot;call_id&quot; varchar(255) default NULL,
+  &quot;full_from&quot; varchar(255) default NULL,
+  &quot;full_via&quot; varchar(255) default NULL,
+  &quot;expires&quot; int(11) default NULL,
+  &quot;user_agent&quot; varchar(255) default NULL,
+  &quot;accept&quot; varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_aliases&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;sofia_id&quot; int(10) unsigned NOT NULL,
+  &quot;alias_name&quot; varchar(255) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_conf&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;profile_name&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_domains&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;sofia_id&quot; int(11) default NULL,
+  &quot;domain_name&quot; varchar(255) default NULL,
+  &quot;parse&quot; tinyint(1) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_gateways&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;sofia_id&quot; int(11) default NULL,
+  &quot;gateway_name&quot; varchar(255) default NULL,
+  &quot;gateway_param&quot; varchar(255) default NULL,
+  &quot;gateway_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;sofia_settings&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;sofia_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;voicemail_conf&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;vm_profile&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_profile&quot; (&quot;vm_profile&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;voicemail_email&quot; (
+  &quot;id&quot; int(10) unsigned NOT NULL,
+  &quot;voicemail_id&quot; int(10) unsigned NOT NULL,
+  &quot;param_name&quot; varchar(64) NOT NULL,
+  &quot;param_value&quot; varchar(64) NOT NULL,
+  PRIMARY KEY  (&quot;id&quot;),
+  UNIQUE KEY &quot;unique_profile_param&quot; (&quot;param_name&quot;,&quot;voicemail_id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS &quot;voicemail_settings&quot; (
+  &quot;id&quot; int(11) NOT NULL,
+  &quot;voicemail_id&quot; int(11) default NULL,
+  &quot;param_name&quot; varchar(255) default NULL,
+  &quot;param_value&quot; varchar(255) default NULL,
+  PRIMARY KEY  (&quot;id&quot;)
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT &quot;dingaling_profile&quot; FOREIGN KEY (&quot;dingaling_id&quot;) REFERENCES &quot;dingaling_profiles&quot; (&quot;id&quot;) ON DELETE CASCADE ON UPDATE CASCADE;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcindexphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/index.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/index.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/index.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,118 @@
</span><ins>+&lt;?php
+/*
+|---------------------------------------------------------------
+| PHP ERROR REPORTING LEVEL
+|---------------------------------------------------------------
+|
+| By default CI runs with error reporting set to ALL.  For security
+| reasons you are encouraged to change this when your site goes live.
+| For more info visit:  http://www.php.net/error_reporting
+|
+*/
+        error_reporting(E_ALL);
+
+/*
+|---------------------------------------------------------------
+| SYSTEM FOLDER NAME
+|---------------------------------------------------------------
+|
+| This variable must contain the name of your &quot;system&quot; folder.
+| Include the path if the folder is not in the same  directory
+| as this file.
+|
+| NO TRAILING SLASH!
+|
+*/
+        $system_folder = &quot;system&quot;;
+
+/*
+|---------------------------------------------------------------
+| APPLICATION FOLDER NAME
+|---------------------------------------------------------------
+|
+| If you want this front controller to use a different &quot;application&quot;
+| folder then the default one you can set its name here. The folder 
+| can also be renamed or relocated anywhere on your server.
+| For more info please see the user guide:
+| http://codeigniter.com/user_guide/general/managing_apps.html
+|
+|
+| NO TRAILING SLASH!
+|
+*/
+        $application_folder = &quot;application&quot;;
+
+/*
+|===============================================================
+| END OF USER CONFIGURABLE SETTINGS
+|===============================================================
+*/
+
+
+/*
+|---------------------------------------------------------------
+| SET THE SERVER PATH
+|---------------------------------------------------------------
+|
+| Let's attempt to determine the full-server path to the &quot;system&quot;
+| folder in order to reduce the possibility of path problems.
+| Note: We only attempt this if the user hasn't specified a 
+| full server path.
+|
+*/
+if (strpos($system_folder, '/') === FALSE)
+{
+        if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
+        {
+                $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
+        }
+}
+else
+{
+        // Swap directory separators to Unix style for consistency
+        $system_folder = str_replace(&quot;\\&quot;, &quot;/&quot;, $system_folder); 
+}
+
+/*
+|---------------------------------------------------------------
+| DEFINE APPLICATION CONSTANTS
+|---------------------------------------------------------------
+|
+| EXT                - The file extension.  Typically &quot;.php&quot;
+| SELF                - The name of THIS file (typically &quot;index.php&quot;)
+| FCPATH        - The full server path to THIS file
+| BASEPATH        - The full server path to the &quot;system&quot; folder
+| APPPATH        - The full server path to the &quot;application&quot; folder
+|
+*/
+define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
+define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
+define('FCPATH', str_replace(SELF, '', __FILE__));
+define('BASEPATH', $system_folder.'/');
+
+if (is_dir($application_folder))
+{
+        define('APPPATH', $application_folder.'/');
+}
+else
+{
+        if ($application_folder == '')
+        {
+                $application_folder = 'application';
+        }
+
+        define('APPPATH', BASEPATH.$application_folder.'/');
+}
+
+/*
+|---------------------------------------------------------------
+| LOAD THE FRONT CONTROLLER
+|---------------------------------------------------------------
+|
+| And away we go...
+|
+*/
+require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;
+
+/* End of file index.php */
+/* Location: ./index.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcreadmetxt"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/readme.txt (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/readme.txt                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/readme.txt        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+FMC Freeswitch Management Interface
+FMC is a Freeswitch web frontend developed using PHP (no completed)
+using EventSocket and XML_Curl (Thank to Intra)
+this is only the basic Application Framework, i'm looking for a PHP Developers to help me mor
+any PHP developer? DelphiWorld@#Freeswitch
+for the Interface design, i'm sory bicose i'm no able to see the Text aligneman bicose i'm using a screen reader
+thanks!
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrParse_XML_CDRphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/Parse_XML_CDR.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/Parse_XML_CDR.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/Parse_XML_CDR.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+&lt;?php //  -*- mode:c; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+class Parse_CDR_XML {
+    var $_data = Array();
+    var $_name = Array();
+    var $_rep = Array();
+    var $_parser = 0;
+    var $_showAttribs;
+    var $_level = 0;
+    var $currentTag;
+    var $_CDR=array();
+    var $_callflowcnt=0;
+    var $_iscallflow=0;
+   
+    function Parse_CDR_XML(&amp;$data,$showattribs = false) {
+        $data = stripslashes(preg_replace('/&lt;.xml (.*?)&gt;(.*)/',&quot;\\2&quot;,$data));
+        $data = preg_replace(&quot;/&lt;(.*?)&gt;&lt;(.*?)&gt;&lt;\/(.*?)&gt;/&quot;,&quot;&lt;\\1&gt;\\2&lt;/\\3&gt;&quot;,$data);
+        $this-&gt;_showAttribs = $showattribs;
+        $this-&gt;_parser = xml_parser_create();
+        
+        xml_set_object($this-&gt;_parser,$this);
+        
+        xml_parser_set_option($this-&gt;_parser,XML_OPTION_CASE_FOLDING,false);
+        
+        xml_set_element_handler($this-&gt;_parser, &quot;_startElement&quot;, &quot;_endElement&quot;);
+        xml_set_character_data_handler($this-&gt;_parser, &quot;_cdata&quot;);
+        
+        $this-&gt;_data = array();
+        $this-&gt;_level = 0;
+        if(!xml_parse($this-&gt;_parser, $data, true)){
+            return false;
+        }
+        xml_parser_free($this-&gt;_parser);
+    }
+    
+    
+    function &amp; ReturnArray() {
+        return $this-&gt;_CDR;
+    }
+    
+    
+    function &amp; ReturnAttributes() {
+        return $this-&gt;_data['_Attributes_'];
+    }
+    
+    
+    function _startElement($parser, $name, $attrs){
+        $this-&gt;_ElementName=&quot;&quot;;
+        if (!isset($this-&gt;_rep[$name])) $this-&gt;_rep[$name] = 0;
+        switch ($name) {
+        case &quot;cdr&quot;:
+            break;
+        case &quot;app_log&quot;:
+        case &quot;variables&quot;:
+            if(!isset($this-&gt;_CDR[$name])) {
+                $this-&gt;_CDR[$name]=array();
+            }
+            $this-&gt;currentTag = $name;
+            break;
+        case &quot;application&quot;:
+            if($this-&gt;_iscallflow) {
+                $this-&gt;_CDR[$this-&gt;currentTag][$this-&gt;_callflowcnt]['extension']['application'][]=$attrs;
+            } else {
+                $this-&gt;_CDR[$this-&gt;currentTag][]=$attrs;
+            }
+            break;
+        case &quot;callflow&quot;:
+            if(!is_array($this-&gt;_CDR[$name])) { $this-&gt;_CDR[$name]=array(); }
+            $this-&gt;currentTag = $name;
+            foreach ($attrs as $key =&gt; $value) {
+                $this-&gt;_CDR[$this-&gt;currentTag][$this-&gt;_callflowcnt][$key]=$value;
+            }
+            $this-&gt;_iscallflow=1;
+            break;
+        case &quot;extension&quot;:
+            foreach ($attrs as $key =&gt; $value) {
+                $this-&gt;_CDR[$this-&gt;currentTag][$this-&gt;_callflowcnt]['extension'][$key]=$value;
+            }
+            break;
+        case &quot;originator&quot;:
+            if($this-&gt;_iscallflow) {
+                $this-&gt;currentTag = $name;
+            } else {
+                $this-&gt;_ElementName=$name;
+            }
+            break;
+        case &quot;caller_profile&quot;:
+        case &quot;times&quot;:
+        case &quot;originator_caller_profile&quot;:
+            $this-&gt;currentTag = $name;
+            break;
+        default:
+            $this-&gt;_ElementName=$name;
+            break;
+        }
+        
+    }
+    
+    
+    function _endElement($parser,$name){
+        $this-&gt;_ElementName=&quot;&quot;;
+        switch ($name) {
+        case &quot;callflow&quot;:
+            $this-&gt;_callflowcnt++;
+            $this-&gt;_iscallflow=0;
+            break;
+        }
+        
+    }
+    
+    
+    
+    function _cdata($parser, $data) {
+        switch($this-&gt;currentTag) {
+        case &quot;cdr&quot;:
+            return;
+            break;
+        case &quot;app_log&quot;:
+            return;
+            break;
+        case &quot;originator_caller_profile&quot;:
+            if(isset($data) &amp;&amp; $this-&gt;_ElementName != &quot;&quot; &amp;&amp;
+               !isset($this-&gt;_CDR[$this-&gt;currentTag][$this-&gt;_ElementName])
+               ) {
+
+                $this-&gt;_CDR['callflow'][$this-&gt;_callflowcnt]['originator'][$this-&gt;currentTag][$this-&gt;_ElementName]=$data;
+            }
+            return;
+            break;
+        case &quot;caller_profile&quot;:
+        case &quot;times&quot;:
+            if(isset($data) &amp;&amp; $this-&gt;_ElementName != &quot;&quot; &amp;&amp;
+               !isset($this-&gt;_CDR[$this-&gt;currentTag][$this-&gt;_ElementName])
+               ) {
+
+                $this-&gt;_CDR['callflow'][$this-&gt;_callflowcnt][$this-&gt;currentTag][$this-&gt;_ElementName]=$data;
+            }
+            return;
+            break;
+        }
+        if(isset($data) &amp;&amp; $this-&gt;_ElementName != &quot;&quot; &amp;&amp;
+           !isset($this-&gt;_CDR[$this-&gt;currentTag][$this-&gt;_ElementName])
+           ) {
+            $this-&gt;_CDR[$this-&gt;currentTag][$this-&gt;_ElementName]=$data;
+        }
+    }
+    
+}
+?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrcdrphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/cdr.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/cdr.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/cdr.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;?php
+  include_once('Parse_XML_CDR.php');
+  Header(&quot;Content-type: text/plain&quot;);
+  $xml = new Parse_CDR_XML($_POST['cdr']);
+  $cdr=$xml-&gt;ReturnArray();
+  // log the entries
+  // it would probably be better to log to a database but simple examples dont do that
+  $fh = fopen(&quot;xml/cdr.xml.&quot;.uniqid(), 'wb');
+  fwrite($fh, $_POST['cdr'] . &quot;\n\nprint_r\n\n&quot;);
+  fwrite($fh,print_r($cdr,true).&quot;\n\n&quot;);
+  fclose($fh);
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcdrtestcdrxml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/testcdr.xml (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/testcdr.xml                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/cdr/testcdr.xml        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1528 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot;?&gt;
+&lt;cdr&gt;
+  &lt;variables&gt;
+    &lt;sip_authorized&gt;true&lt;/sip_authorized&gt;
+    &lt;sip_mailbox&gt;1006&lt;/sip_mailbox&gt;
+    &lt;sip_auth_username&gt;1006&lt;/sip_auth_username&gt;
+    &lt;sip_auth_realm&gt;10.0.1.250&lt;/sip_auth_realm&gt;
+    &lt;mailbox&gt;1006&lt;/mailbox&gt;
+    &lt;accountcode&gt;1006&lt;/accountcode&gt;
+    &lt;user_context&gt;default&lt;/user_context&gt;
+    &lt;effective_caller_id_name&gt;Extension%201006&lt;/effective_caller_id_name&gt;
+    &lt;effective_caller_id_number&gt;1006&lt;/effective_caller_id_number&gt;
+    &lt;sip_from_user&gt;1006&lt;/sip_from_user&gt;
+    &lt;sip_from_port&gt;5060&lt;/sip_from_port&gt;
+    &lt;sip_from_uri&gt;1006%4010.0.1.250%3A5060&lt;/sip_from_uri&gt;
+    &lt;sip_from_host&gt;10.0.1.250&lt;/sip_from_host&gt;
+    &lt;sip_from_user_stripped&gt;1006&lt;/sip_from_user_stripped&gt;
+    &lt;sofia_profile_name&gt;default&lt;/sofia_profile_name&gt;
+    &lt;sip_req_user&gt;1009&lt;/sip_req_user&gt;
+    &lt;sip_req_port&gt;5060&lt;/sip_req_port&gt;
+    &lt;sip_req_uri&gt;1009%4010.0.1.250%3A5060&lt;/sip_req_uri&gt;
+    &lt;sip_req_host&gt;10.0.1.250&lt;/sip_req_host&gt;
+    &lt;sip_to_user&gt;1009&lt;/sip_to_user&gt;
+    &lt;sip_to_port&gt;5060&lt;/sip_to_port&gt;
+    &lt;sip_to_uri&gt;1009%4010.0.1.250%3A5060&lt;/sip_to_uri&gt;
+    &lt;sip_to_host&gt;10.0.1.250&lt;/sip_to_host&gt;
+    &lt;sip_contact_user&gt;1006&lt;/sip_contact_user&gt;
+    &lt;sip_contact_port&gt;5060&lt;/sip_contact_port&gt;
+    &lt;sip_contact_uri&gt;1006%4010.0.1.240%3A5060&lt;/sip_contact_uri&gt;
+    &lt;sip_contact_host&gt;10.0.1.240&lt;/sip_contact_host&gt;
+    &lt;channel_name&gt;sofia/default/1006%4010.0.1.250%3A5060&lt;/channel_name&gt;
+    &lt;sip_call_id&gt;1f9e6333-e0128840-f539ae8d%4010.0.1.240&lt;/sip_call_id&gt;
+    &lt;sip_via_host&gt;10.0.1.240&lt;/sip_via_host&gt;
+    &lt;sip_via_port&gt;5060&lt;/sip_via_port&gt;
+    &lt;sip_via_rport&gt;34699&lt;/sip_via_rport&gt;
+    &lt;max_forwards&gt;70&lt;/max_forwards&gt;
+    &lt;presence_id&gt;1006%4010.0.1.250&lt;/presence_id&gt;
+    &lt;switch_r_sdp&gt;v%3D0%0D%0Ao%3D-%201198125579%201198125579%20IN%20IP4%2010.0.1.240%0D%0As%3DPolycom%20IP%20Phone%0D%0Ac%3DIN%20IP4%2010.0.1.240%0D%0At%3D0%200%0D%0Aa%3Dsendrecv%0D%0Am%3Daudio%202236%20RTP/AVP%209%200%208%2018%20101%0D%0Aa%3Drtpmap%3A9%20G722/8000%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A8%20PCMA/8000%0D%0Aa%3Drtpmap%3A18%20G729/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0A&lt;/switch_r_sdp&gt;
+    &lt;remote_media_ip&gt;10.0.1.240&lt;/remote_media_ip&gt;
+    &lt;remote_media_port&gt;2236&lt;/remote_media_port&gt;
+    &lt;read_codec&gt;G722&lt;/read_codec&gt;
+    &lt;read_rate&gt;16000&lt;/read_rate&gt;
+    &lt;write_codec&gt;G722&lt;/write_codec&gt;
+    &lt;write_rate&gt;16000&lt;/write_rate&gt;
+    &lt;local_media_ip&gt;10.0.1.250&lt;/local_media_ip&gt;
+    &lt;local_media_port&gt;2236&lt;/local_media_port&gt;
+    &lt;endpoint_disposition&gt;ANSWER&lt;/endpoint_disposition&gt;
+    &lt;fifo_target&gt;7fa22ce4-9487-4501-965e-7e062792f6c3&lt;/fifo_target&gt;
+    &lt;fifo_status&gt;DONE&lt;/fifo_status&gt;
+    &lt;fifo_timestamp&gt;2007-12-20%2007%3A20%3A20&lt;/fifo_timestamp&gt;
+    &lt;use_profile&gt;nat&lt;/use_profile&gt;
+    &lt;numbering_plan&gt;US&lt;/numbering_plan&gt;
+    &lt;default_gateway&gt;asterlink.com&lt;/default_gateway&gt;
+    &lt;default_area_code&gt;918&lt;/default_area_code&gt;
+    &lt;user_name&gt;default&lt;/user_name&gt;
+    &lt;domain_name&gt;10.0.1.250&lt;/domain_name&gt;
+    &lt;dialed_ext&gt;1002&lt;/dialed_ext&gt;
+    &lt;call_timeout&gt;130&lt;/call_timeout&gt;
+    &lt;hangup_after_bridge&gt;true&lt;/hangup_after_bridge&gt;
+    &lt;left_hanging_extension&gt;5900&lt;/left_hanging_extension&gt;
+    &lt;continue_on_fail&gt;true&lt;/continue_on_fail&gt;
+    &lt;dialed_user&gt;1002&lt;/dialed_user&gt;
+    &lt;dialed_domain&gt;10.0.1.250&lt;/dialed_domain&gt;
+    &lt;switch_m_sdp&gt;v%3D0%0D%0Ao%3D1002%208000%208000%20IN%20IP4%2010.0.1.5%0D%0As%3DSIP%20Call%0D%0Ac%3DIN%20IP4%2010.0.1.5%0D%0At%3D0%200%0D%0Am%3Daudio%205004%20RTP/AVP%200%20101%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-11%0D%0Aa%3Dptime%3A20%0D%0A&lt;/switch_m_sdp&gt;
+    &lt;originate_disposition&gt;SUCCESS&lt;/originate_disposition&gt;
+    &lt;bridge_channel&gt;sofia/default/1002&lt;/bridge_channel&gt;
+    &lt;bridge_uuid&gt;cf150cd3-af80-49b1-90c9-da7484e9b033&lt;/bridge_uuid&gt;
+    &lt;signal_bond&gt;cf150cd3-af80-49b1-90c9-da7484e9b033&lt;/signal_bond&gt;
+    &lt;hangup_cause&gt;NORMAL_CLEARING&lt;/hangup_cause&gt;
+    &lt;start_stamp&gt;2007-12-20%2007%3A21%3A28&lt;/start_stamp&gt;
+    &lt;answer_stamp&gt;2007-12-20%2007%3A19%3A34&lt;/answer_stamp&gt;
+    &lt;end_stamp&gt;2007-12-20%2007%3A21%3A32&lt;/end_stamp&gt;
+    &lt;start_epoch&gt;1198156888&lt;/start_epoch&gt;
+    &lt;start_uepoch&gt;1198156888447769&lt;/start_uepoch&gt;
+    &lt;answer_epoch&gt;1198156774&lt;/answer_epoch&gt;
+    &lt;answer_uepoch&gt;1198156774875311&lt;/answer_uepoch&gt;
+    &lt;end_epoch&gt;1198156892&lt;/end_epoch&gt;
+    &lt;end_uepoch&gt;1198156892250109&lt;/end_uepoch&gt;
+    &lt;last_app&gt;bridge&lt;/last_app&gt;
+    &lt;last_arg&gt;USER/1002%4010.0.1.250&lt;/last_arg&gt;
+    &lt;caller_id&gt;%22Brian%20West%22%20%3C1006%3E&lt;/caller_id&gt;
+    &lt;duration&gt;4&lt;/duration&gt;
+    &lt;billsec&gt;118&lt;/billsec&gt;
+    &lt;mduration&gt;3803&lt;/mduration&gt;
+    &lt;billmsec&gt;117375&lt;/billmsec&gt;
+    &lt;uduration&gt;3802340&lt;/uduration&gt;
+    &lt;billusec&gt;117374798&lt;/billusec&gt;
+  &lt;/variables&gt;
+  &lt;app_log&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1009/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1009@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1009/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1009@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1009/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1009@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1009/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1009@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;fifo&quot; app_data=&quot;5900@10.0.1.250 in undef local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1009/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1009@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1009/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1009@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1009/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1009@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;playback&quot; app_data=&quot;local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=nat&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@10.0.1.250&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/1006/1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/1002/1006&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361&quot;&gt;&lt;/application&gt;
+    &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/1002@10.0.1.250&quot;&gt;&lt;/application&gt;
+  &lt;/app_log&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;cf150cd3-af80-49b1-90c9-da7484e9b033&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;cf150cd3-af80-49b1-90c9-da7484e9b033&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156888447769&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;1198156892250109&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;0&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1009&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1009 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1009&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;4b8d3f9d-0bbd-48b3-b0e0-3a8eb9ead4d7&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;4b8d3f9d-0bbd-48b3-b0e0-3a8eb9ead4d7&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156885001861&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156888447769&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;c68e2ba8-12b8-417f-a919-4caa5437bd9a&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;c68e2ba8-12b8-417f-a919-4caa5437bd9a&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156880578019&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156885001861&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1009&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1009 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1009&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;073c1939-561c-466a-b652-a39ca2aae77a&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;073c1939-561c-466a-b652-a39ca2aae77a&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156876612260&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156880578019&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;2a3db176-a105-4a44-92f2-6e3ac7048d5b&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;2a3db176-a105-4a44-92f2-6e3ac7048d5b&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156839911708&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156876612260&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1009&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1009 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1009&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;a36354f8-4804-4f76-805b-fa0a0ca8903e&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;a36354f8-4804-4f76-805b-fa0a0ca8903e&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156833485893&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156839911708&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;d01dbfc2-d692-48b8-bb10-8b62127f43cd&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;d01dbfc2-d692-48b8-bb10-8b62127f43cd&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156820268791&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156833485893&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;5900&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;fifo&quot; app_data=&quot;5900@10.0.1.250 in undef local_stream://moh&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;5900&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originator&gt;
+        &lt;originator_caller_profile&gt;
+          &lt;username&gt;1009&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1009&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.28&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;**park+5900&lt;/destination_number&gt;
+          &lt;uuid&gt;7fa22ce4-9487-4501-965e-7e062792f6c3&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009@10.0.1.250:5060&lt;/chan_name&gt;
+        &lt;/originator_caller_profile&gt;
+      &lt;/originator&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156812978484&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156820268791&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;22b5e34f-d334-40fe-b7e7-9ca54b2a7160&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;22b5e34f-d334-40fe-b7e7-9ca54b2a7160&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156806464364&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156812978484&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1009&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1009 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1009&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;6070e39b-71a4-4872-a851-a8c9ac45488d&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;6070e39b-71a4-4872-a851-a8c9ac45488d&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156801337500&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156806464364&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;a95fdc9d-1f64-4962-acb8-a26507c9d224&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;a95fdc9d-1f64-4962-acb8-a26507c9d224&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156797434745&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156801337500&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1009&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1009 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1009&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;a5dfe2cc-7754-4a82-a645-231a15decb3f&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;a5dfe2cc-7754-4a82-a645-231a15decb3f&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156792878476&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156797434745&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;fec1ae9e-546c-4cc5-b22a-55dc997a0e35&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;fec1ae9e-546c-4cc5-b22a-55dc997a0e35&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156788685547&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156792878476&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1009&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1009 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1009&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;4aa48010-4595-461c-936a-179f9fb4d1f3&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;4aa48010-4595-461c-936a-179f9fb4d1f3&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156784428990&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156788685547&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1002&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1002&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1002 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1002&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;545f4ba0-5978-4b41-892f-aca78f174a91&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1002&lt;/destination_number&gt;
+          &lt;uuid&gt;545f4ba0-5978-4b41-892f-aca78f174a91&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1002&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156778376001&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156784428990&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+  &lt;callflow dialplan=&quot;XML&quot;&gt;
+    &lt;extension name=&quot;global&quot; number=&quot;1009&quot; current_app=&quot;answer&quot;&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set_user&quot; app_data=&quot;default@${domain}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;info&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/spymap/${caller_id_number}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/${caller_id_number}/${destination_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial/global/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;dialed_ext=1009&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;ring_ready&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;call_timeout=130&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;hangup_after_bridge=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;left_hanging_extension=5900&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;set&quot; app_data=&quot;continue_on_fail=true&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/call_return/${dialed_ext}/${caller_id_number}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;db&quot; app_data=&quot;insert/last_dial_ext/${dialed_ext}/${uuid}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;bridge&quot; app_data=&quot;USER/${dialed_ext}@10.0.1.250&quot;&gt;&lt;/application&gt;
+      &lt;application last_executed=&quot;true&quot; app_name=&quot;answer&quot; app_data=&quot;&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;sleep&quot; app_data=&quot;1000&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;voicemail&quot; app_data=&quot;default 10.0.1.250 ${dialed_ext}&quot;&gt;&lt;/application&gt;
+      &lt;application app_name=&quot;transfer&quot; app_data=&quot;1009 enum&quot;&gt;&lt;/application&gt;
+    &lt;/extension&gt;
+    &lt;caller_profile&gt;
+      &lt;username&gt;1006&lt;/username&gt;
+      &lt;dialplan&gt;XML&lt;/dialplan&gt;
+      &lt;caller_id_name&gt;Brian West&lt;/caller_id_name&gt;
+      &lt;ani&gt;&lt;/ani&gt;
+      &lt;aniii&gt;&lt;/aniii&gt;
+      &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+      &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+      &lt;rdnis&gt;&lt;/rdnis&gt;
+      &lt;destination_number&gt;1009&lt;/destination_number&gt;
+      &lt;uuid&gt;f1d9f5e9-1ccd-4df7-876e-adf6e3602361&lt;/uuid&gt;
+      &lt;source&gt;mod_sofia&lt;/source&gt;
+      &lt;context&gt;default&lt;/context&gt;
+      &lt;chan_name&gt;sofia/default/1006@10.0.1.250:5060&lt;/chan_name&gt;
+      &lt;originatee&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;efb71d06-c38c-4af9-a4bd-c5a23b501689&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+        &lt;originatee_caller_profile&gt;
+          &lt;username&gt;1006&lt;/username&gt;
+          &lt;dialplan&gt;XML&lt;/dialplan&gt;
+          &lt;caller_id_name&gt;Extension 1006&lt;/caller_id_name&gt;
+          &lt;ani&gt;&lt;/ani&gt;
+          &lt;aniii&gt;&lt;/aniii&gt;
+          &lt;caller_id_number&gt;1006&lt;/caller_id_number&gt;
+          &lt;network_addr&gt;10.0.1.240&lt;/network_addr&gt;
+          &lt;rdnis&gt;&lt;/rdnis&gt;
+          &lt;destination_number&gt;10.0.1.250/1009&lt;/destination_number&gt;
+          &lt;uuid&gt;efb71d06-c38c-4af9-a4bd-c5a23b501689&lt;/uuid&gt;
+          &lt;source&gt;mod_sofia&lt;/source&gt;
+          &lt;context&gt;default&lt;/context&gt;
+          &lt;chan_name&gt;sofia/default/1009&lt;/chan_name&gt;
+        &lt;/originatee_caller_profile&gt;
+      &lt;/originatee&gt;
+    &lt;/caller_profile&gt;
+    &lt;times&gt;
+      &lt;created_time&gt;1198156772841382&lt;/created_time&gt;
+      &lt;answered_time&gt;1198156774875311&lt;/answered_time&gt;
+      &lt;hangup_time&gt;0&lt;/hangup_time&gt;
+      &lt;transfer_time&gt;1198156778376001&lt;/transfer_time&gt;
+    &lt;/times&gt;
+  &lt;/callflow&gt;
+&lt;/cdr&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigautoloadphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/autoload.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/autoload.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/autoload.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------
+| AUTO-LOADER
+| -------------------------------------------------------------------
+| This file specifies which systems should be loaded by default.
+|
+| In order to keep the framework as light-weight as possible only the
+| absolute minimal resources are loaded by default. For example,
+| the database is not connected to automatically since no assumption
+| is made regarding whether you intend to use it.  This file lets
+| you globally define which systems you would like loaded with every
+| request.
+|
+| -------------------------------------------------------------------
+| Instructions
+| -------------------------------------------------------------------
+|
+| These are the things you can load automatically:
+|
+| 1. Libraries
+| 2. Helper files
+| 3. Plugins
+| 4. Custom config files
+| 5. Language files
+| 6. Models
+|
+*/
+
+/*
+| -------------------------------------------------------------------
+|  Auto-load Libraries
+| -------------------------------------------------------------------
+| These are the classes located in the system/libraries folder
+| or in your system/application/libraries folder.
+|
+| Prototype:
+|
+*/
+
+//$autoload['libraries'] = array();
+                $autoload['libraries'] = array('database', 'session', 'xmlrpc');
+
+/*
+| -------------------------------------------------------------------
+|  Auto-load Helper Files
+| -------------------------------------------------------------------
+| Prototype:
+|
+|        $autoload['helper'] = array('url', 'file');
+*/
+
+$autoload['helper'] = array();
+
+
+/*
+| -------------------------------------------------------------------
+|  Auto-load Plugins
+| -------------------------------------------------------------------
+| Prototype:
+|
+|        $autoload['plugin'] = array('captcha', 'js_calendar');
+*/
+
+$autoload['plugin'] = array();
+
+
+/*
+| -------------------------------------------------------------------
+|  Auto-load Config files
+| -------------------------------------------------------------------
+| Prototype:
+|
+|        $autoload['config'] = array('config1', 'config2');
+|
+| NOTE: This item is intended for use ONLY if you have created custom
+| config files.  Otherwise, leave it blank.
+|
+*/
+
+$autoload['config'] = array();
+
+
+/*
+| -------------------------------------------------------------------
+|  Auto-load Language files
+| -------------------------------------------------------------------
+| Prototype:
+|
+|        $autoload['language'] = array('lang1', 'lang2');
+|
+| NOTE: Do not include the &quot;_lang&quot; part of your file.  For example 
+| &quot;codeigniter_lang.php&quot; would be referenced as array('codeigniter');
+|
+*/
+
+$autoload['language'] = array();
+
+
+/*
+| -------------------------------------------------------------------
+|  Auto-load Models
+| -------------------------------------------------------------------
+| Prototype:
+|
+|        $autoload['model'] = array('model1', 'model2');
+|
+*/
+
+$autoload['model'] = array();
+
+
+
+/* End of file autoload.php */
+/* Location: ./system/application/config/autoload.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigconfigphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/config.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/config.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/config.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,329 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+/*
+|--------------------------------------------------------------------------
+| Base Site URL
+|--------------------------------------------------------------------------
+|
+| URL to your CodeIgniter root. Typically this will be your base URL,
+| WITH a trailing slash:
+|
+|        http://example.com/
+|
+*/
+$config['base_url']        = &quot;http://example.com/&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| Index File
+|--------------------------------------------------------------------------
+|
+| Typically this will be your index.php file, unless you've renamed it to
+| something else. If you are using mod_rewrite to remove the page set this
+| variable so that it is blank.
+|
+*/
+$config['index_page'] = &quot;index.php&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| URI PROTOCOL
+|--------------------------------------------------------------------------
+|
+| This item determines which server global should be used to retrieve the
+| URI string.  The default setting of &quot;AUTO&quot; works for most servers.
+| If your links do not seem to work, try one of the other delicious flavors:
+|
+| 'AUTO'                        Default - auto detects
+| 'PATH_INFO'                Uses the PATH_INFO
+| 'QUERY_STRING'        Uses the QUERY_STRING
+| 'REQUEST_URI'                Uses the REQUEST_URI
+| 'ORIG_PATH_INFO'        Uses the ORIG_PATH_INFO
+|
+*/
+$config['uri_protocol']        = &quot;AUTO&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| URL suffix
+|--------------------------------------------------------------------------
+|
+| This option allows you to add a suffix to all URLs generated by CodeIgniter.
+| For more information please see the user guide:
+|
+| http://codeigniter.com/user_guide/general/urls.html
+*/
+
+$config['url_suffix'] = &quot;&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| Default Language
+|--------------------------------------------------------------------------
+|
+| This determines which set of language files should be used. Make sure
+| there is an available translation if you intend to use something other
+| than english.
+|
+*/
+$config['language']        = &quot;english&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| Default Character Set
+|--------------------------------------------------------------------------
+|
+| This determines which character set is used by default in various methods
+| that require a character set to be provided.
+|
+*/
+$config['charset'] = &quot;UTF-8&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| Enable/Disable System Hooks
+|--------------------------------------------------------------------------
+|
+| If you would like to use the &quot;hooks&quot; feature you must enable it by
+| setting this variable to TRUE (boolean).  See the user guide for details.
+|
+*/
+$config['enable_hooks'] = FALSE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Class Extension Prefix
+|--------------------------------------------------------------------------
+|
+| This item allows you to set the filename/classname prefix when extending
+| native libraries.  For more information please see the user guide:
+|
+| http://codeigniter.com/user_guide/general/core_classes.html
+| http://codeigniter.com/user_guide/general/creating_libraries.html
+|
+*/
+$config['subclass_prefix'] = 'MY_';
+
+
+/*
+|--------------------------------------------------------------------------
+| Allowed URL Characters
+|--------------------------------------------------------------------------
+|
+| This lets you specify with a regular expression which characters are permitted
+| within your URLs.  When someone tries to submit a URL with disallowed
+| characters they will get a warning message.
+|
+| As a security measure you are STRONGLY encouraged to restrict URLs to
+| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
+|
+| Leave blank to allow all characters -- but only if you are insane.
+|
+| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
+|
+*/
+$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
+
+
+/*
+|--------------------------------------------------------------------------
+| Enable Query Strings
+|--------------------------------------------------------------------------
+|
+| By default CodeIgniter uses search-engine friendly segment based URLs:
+| example.com/who/what/where/
+|
+| You can optionally enable standard query string based URLs:
+| example.com?who=me&amp;what=something&amp;where=here
+|
+| Options are: TRUE or FALSE (boolean)
+|
+| The other items let you set the query string &quot;words&quot; that will
+| invoke your controllers and its functions:
+| example.com/index.php?c=controller&amp;m=function
+|
+| Please note that some of the helpers won't work as expected when
+| this feature is enabled, since CodeIgniter is designed primarily to
+| use segment based URLs.
+|
+*/
+$config['enable_query_strings'] = FALSE;
+$config['controller_trigger']         = 'c';
+$config['function_trigger']         = 'm';
+$config['directory_trigger']         = 'd'; // experimental not currently in use
+
+/*
+|--------------------------------------------------------------------------
+| Error Logging Threshold
+|--------------------------------------------------------------------------
+|
+| If you have enabled error logging, you can set an error threshold to 
+| determine what gets logged. Threshold options are:
+| You can enable error logging by setting a threshold over zero. The
+| threshold determines what gets logged. Threshold options are:
+|
+|        0 = Disables logging, Error logging TURNED OFF
+|        1 = Error Messages (including PHP errors)
+|        2 = Debug Messages
+|        3 = Informational Messages
+|        4 = All Messages
+|
+| For a live site you'll usually only enable Errors (1) to be logged otherwise
+| your log files will fill up very fast.
+|
+*/
+$config['log_threshold'] = 0;
+
+/*
+|--------------------------------------------------------------------------
+| Error Logging Directory Path
+|--------------------------------------------------------------------------
+|
+| Leave this BLANK unless you would like to set something other than the default
+| system/logs/ folder.  Use a full server path with trailing slash.
+|
+*/
+$config['log_path'] = '';
+
+/*
+|--------------------------------------------------------------------------
+| Date Format for Logs
+|--------------------------------------------------------------------------
+|
+| Each item that is logged has an associated date. You can use PHP date
+| codes to set your own date formatting
+|
+*/
+$config['log_date_format'] = 'Y-m-d H:i:s';
+
+/*
+|--------------------------------------------------------------------------
+| Cache Directory Path
+|--------------------------------------------------------------------------
+|
+| Leave this BLANK unless you would like to set something other than the default
+| system/cache/ folder.  Use a full server path with trailing slash.
+|
+*/
+$config['cache_path'] = '';
+
+/*
+|--------------------------------------------------------------------------
+| Encryption Key
+|--------------------------------------------------------------------------
+|
+| If you use the Encryption class or the Sessions class with encryption
+| enabled you MUST set an encryption key.  See the user guide for info.
+|
+*/
+$config['encryption_key'] = &quot;&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| Session Variables
+|--------------------------------------------------------------------------
+|
+| 'session_cookie_name' = the name you want for the cookie
+| 'encrypt_sess_cookie' = TRUE/FALSE (boolean).  Whether to encrypt the cookie
+| 'session_expiration'  = the number of SECONDS you want the session to last.
+|  by default sessions last 7200 seconds (two hours).  Set to zero for no expiration.
+| 'time_to_update'                = how many seconds between CI refreshing Session Information
+|
+*/
+$config['sess_cookie_name']                = 'ci_session';
+$config['sess_expiration']                = 7200;
+$config['sess_encrypt_cookie']        = FALSE;
+$config['sess_use_database']        = FALSE;
+$config['sess_table_name']                = 'ci_sessions';
+$config['sess_match_ip']                = FALSE;
+$config['sess_match_useragent']        = TRUE;
+$config['sess_time_to_update']         = 300;
+
+/*
+|--------------------------------------------------------------------------
+| Cookie Related Variables
+|--------------------------------------------------------------------------
+|
+| 'cookie_prefix' = Set a prefix if you need to avoid collisions
+| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
+| 'cookie_path'   =  Typically will be a forward slash
+|
+*/
+$config['cookie_prefix']        = &quot;&quot;;
+$config['cookie_domain']        = &quot;&quot;;
+$config['cookie_path']                = &quot;/&quot;;
+
+/*
+|--------------------------------------------------------------------------
+| Global XSS Filtering
+|--------------------------------------------------------------------------
+|
+| Determines whether the XSS filter is always active when GET, POST or
+| COOKIE data is encountered
+|
+*/
+$config['global_xss_filtering'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
+| Output Compression
+|--------------------------------------------------------------------------
+|
+| Enables Gzip output compression for faster page loads.  When enabled,
+| the output class will test whether your server supports Gzip.
+| Even if it does, however, not all browsers support compression
+| so enable only if you are reasonably sure your visitors can handle it.
+|
+| VERY IMPORTANT:  If you are getting a blank page when compression is enabled it
+| means you are prematurely outputting something to your browser. It could
+| even be a line of whitespace at the end of one of your scripts.  For
+| compression to work, nothing can be sent before the output buffer is called
+| by the output class.  Do not &quot;echo&quot; any values with compression enabled.
+|
+*/
+$config['compress_output'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
+| Master Time Reference
+|--------------------------------------------------------------------------
+|
+| Options are &quot;local&quot; or &quot;gmt&quot;.  This pref tells the system whether to use
+| your server's local time as the master &quot;now&quot; reference, or convert it to
+| GMT.  See the &quot;date helper&quot; page of the user guide for information
+| regarding date handling.
+|
+*/
+$config['time_reference'] = 'local';
+
+
+/*
+|--------------------------------------------------------------------------
+| Rewrite PHP Short Tags
+|--------------------------------------------------------------------------
+|
+| If your PHP installation does not have short tag support enabled CI
+| can rewrite the tags on-the-fly, enabling you to utilize that syntax
+| in your view files.  Options are TRUE or FALSE (boolean)
+|
+*/
+$config['rewrite_short_tags'] = FALSE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Reverse Proxy IPs
+|--------------------------------------------------------------------------
+|
+| If your server is behind a reverse proxy, you must whitelist the proxy IP
+| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
+| header in order to properly identify the visitor's IP address.
+| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
+|
+*/
+$config['proxy_ips'] = '';
+
+
+/* End of file config.php */
+/* Location: ./system/application/config/config.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigconstantsphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/constants.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/constants.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/constants.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+/*
+|--------------------------------------------------------------------------
+| File and Directory Modes
+|--------------------------------------------------------------------------
+|
+| These prefs are used when checking and setting modes when working
+| with the file system.  The defaults are fine on servers with proper
+| security, but you may wish (or even need) to change the values in
+| certain environments (Apache running a separate process for each
+| user, PHP under CGI with Apache suEXEC, etc.).  Octal values should
+| always be used to set the mode correctly.
+|
+*/
+define('FILE_READ_MODE', 0644);
+define('FILE_WRITE_MODE', 0666);
+define('DIR_READ_MODE', 0755);
+define('DIR_WRITE_MODE', 0777);
+
+/*
+|--------------------------------------------------------------------------
+| File Stream Modes
+|--------------------------------------------------------------------------
+|
+| These modes are used when working with fopen()/popen()
+|
+*/
+
+define('FOPEN_READ',                                                         'rb');
+define('FOPEN_READ_WRITE',                                                'r+b');
+define('FOPEN_WRITE_CREATE_DESTRUCTIVE',                 'wb'); // truncates existing file data, use with care
+define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE',         'w+b'); // truncates existing file data, use with care
+define('FOPEN_WRITE_CREATE',                                         'ab');
+define('FOPEN_READ_WRITE_CREATE',                                 'a+b');
+define('FOPEN_WRITE_CREATE_STRICT',                         'xb');
+define('FOPEN_READ_WRITE_CREATE_STRICT',                'x+b');
+
+
+/* End of file constants.php */
+/* Location: ./system/application/config/constants.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigdatabasephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/database.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/database.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/database.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------
+| DATABASE CONNECTIVITY SETTINGS
+| -------------------------------------------------------------------
+| This file will contain the settings needed to access your database.
+|
+| For complete instructions please consult the &quot;Database Connection&quot;
+| page of the User Guide.
+|
+| -------------------------------------------------------------------
+| EXPLANATION OF VARIABLES
+| -------------------------------------------------------------------
+|
+|        ['hostname'] The hostname of your database server.
+|        ['username'] The username used to connect to the database
+|        ['password'] The password used to connect to the database
+|        ['database'] The name of the database you want to connect to
+|        ['dbdriver'] The database type. ie: mysql.  Currently supported:
+                                 mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
+|        ['dbprefix'] You can add an optional prefix, which will be added
+|                                 to the table name when using the  Active Record class
+|        ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
+|        ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
+|        ['cache_on'] TRUE/FALSE - Enables/disables query caching
+|        ['cachedir'] The path to the folder where cache files should be stored
+|        ['char_set'] The character set used in communicating with the database
+|        ['dbcollat'] The character collation used in communicating with the database
+|
+| The $active_group variable lets you choose which connection group to
+| make active.  By default there is only one group (the &quot;default&quot; group).
+|
+| The $active_record variables lets you determine whether or not to load
+| the active record class
+*/
+
+$active_group = &quot;default&quot;;
+$active_record = TRUE;
+
+$db['default']['hostname'] = &quot;localhost&quot;;
+$db['default']['username'] = &quot;root&quot;;
+$db['default']['password'] = &quot;root&quot;;
+$db['default']['database'] = &quot;freeswitch&quot;;
+$db['default']['dbdriver'] = &quot;mysql&quot;;
+$db['default']['dbprefix'] = &quot;&quot;;
+$db['default']['pconnect'] = TRUE;
+$db['default']['db_debug'] = TRUE;
+$db['default']['cache_on'] = FALSE;
+$db['default']['cachedir'] = &quot;&quot;;
+$db['default']['char_set'] = &quot;utf8&quot;;
+$db['default']['dbcollat'] = &quot;utf8_general_ci&quot;;
+
+
+/* End of file database.php */
+/* Location: ./system/application/config/database.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigdoctypesphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/doctypes.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/doctypes.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/doctypes.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+$_doctypes = array(
+                                        'xhtml11'                =&gt; '&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&gt;',
+                                        'xhtml1-strict'        =&gt; '&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;',
+                                        'xhtml1-trans'        =&gt; '&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;',
+                                        'xhtml1-frame'        =&gt; '&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Frameset//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd&quot;&gt;',
+                                        'html5'                        =&gt; '&lt;!DOCTYPE html&gt;',
+                                        'html4-strict'        =&gt; '&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;',
+                                        'html4-trans'        =&gt; '&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;',
+                                        'html4-frame'        =&gt; '&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Frameset//EN&quot; &quot;http://www.w3.org/TR/html4/frameset.dtd&quot;&gt;'
+                                        );
+
+/* End of file doctypes.php */
+/* Location: application/config/doctypes.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfighooksphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/hooks.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/hooks.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/hooks.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------------
+| Hooks
+| -------------------------------------------------------------------------
+| This file lets you define &quot;hooks&quot; to extend CI without hacking the core
+| files.  Please see the user guide for info:
+|
+|        http://codeigniter.com/user_guide/general/hooks.html
+|
+*/
+
+
+
+/* End of file hooks.php */
+/* Location: ./system/application/config/hooks.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigmimesphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/mimes.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/mimes.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/mimes.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,105 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------
+| MIME TYPES
+| -------------------------------------------------------------------
+| This file contains an array of mime types.  It is used by the
+| Upload class to help identify allowed file types.
+|
+*/
+
+$mimes = array(        'hqx'        =&gt;        'application/mac-binhex40',
+                                'cpt'        =&gt;        'application/mac-compactpro',
+                                'csv'        =&gt;        array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
+                                'bin'        =&gt;        'application/macbinary',
+                                'dms'        =&gt;        'application/octet-stream',
+                                'lha'        =&gt;        'application/octet-stream',
+                                'lzh'        =&gt;        'application/octet-stream',
+                                'exe'        =&gt;        'application/octet-stream',
+                                'class'        =&gt;        'application/octet-stream',
+                                'psd'        =&gt;        'application/x-photoshop',
+                                'so'        =&gt;        'application/octet-stream',
+                                'sea'        =&gt;        'application/octet-stream',
+                                'dll'        =&gt;        'application/octet-stream',
+                                'oda'        =&gt;        'application/oda',
+                                'pdf'        =&gt;        array('application/pdf', 'application/x-download'),
+                                'ai'        =&gt;        'application/postscript',
+                                'eps'        =&gt;        'application/postscript',
+                                'ps'        =&gt;        'application/postscript',
+                                'smi'        =&gt;        'application/smil',
+                                'smil'        =&gt;        'application/smil',
+                                'mif'        =&gt;        'application/vnd.mif',
+                                'xls'        =&gt;        array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
+                                'ppt'        =&gt;        array('application/powerpoint', 'application/vnd.ms-powerpoint'),
+                                'wbxml'        =&gt;        'application/wbxml',
+                                'wmlc'        =&gt;        'application/wmlc',
+                                'dcr'        =&gt;        'application/x-director',
+                                'dir'        =&gt;        'application/x-director',
+                                'dxr'        =&gt;        'application/x-director',
+                                'dvi'        =&gt;        'application/x-dvi',
+                                'gtar'        =&gt;        'application/x-gtar',
+                                'gz'        =&gt;        'application/x-gzip',
+                                'php'        =&gt;        'application/x-httpd-php',
+                                'php4'        =&gt;        'application/x-httpd-php',
+                                'php3'        =&gt;        'application/x-httpd-php',
+                                'phtml'        =&gt;        'application/x-httpd-php',
+                                'phps'        =&gt;        'application/x-httpd-php-source',
+                                'js'        =&gt;        'application/x-javascript',
+                                'swf'        =&gt;        'application/x-shockwave-flash',
+                                'sit'        =&gt;        'application/x-stuffit',
+                                'tar'        =&gt;        'application/x-tar',
+                                'tgz'        =&gt;        'application/x-tar',
+                                'xhtml'        =&gt;        'application/xhtml+xml',
+                                'xht'        =&gt;        'application/xhtml+xml',
+                                'zip'        =&gt;  array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
+                                'mid'        =&gt;        'audio/midi',
+                                'midi'        =&gt;        'audio/midi',
+                                'mpga'        =&gt;        'audio/mpeg',
+                                'mp2'        =&gt;        'audio/mpeg',
+                                'mp3'        =&gt;        array('audio/mpeg', 'audio/mpg'),
+                                'aif'        =&gt;        'audio/x-aiff',
+                                'aiff'        =&gt;        'audio/x-aiff',
+                                'aifc'        =&gt;        'audio/x-aiff',
+                                'ram'        =&gt;        'audio/x-pn-realaudio',
+                                'rm'        =&gt;        'audio/x-pn-realaudio',
+                                'rpm'        =&gt;        'audio/x-pn-realaudio-plugin',
+                                'ra'        =&gt;        'audio/x-realaudio',
+                                'rv'        =&gt;        'video/vnd.rn-realvideo',
+                                'wav'        =&gt;        'audio/x-wav',
+                                'bmp'        =&gt;        'image/bmp',
+                                'gif'        =&gt;        'image/gif',
+                                'jpeg'        =&gt;        array('image/jpeg', 'image/pjpeg'),
+                                'jpg'        =&gt;        array('image/jpeg', 'image/pjpeg'),
+                                'jpe'        =&gt;        array('image/jpeg', 'image/pjpeg'),
+                                'png'        =&gt;        array('image/png',  'image/x-png'),
+                                'tiff'        =&gt;        'image/tiff',
+                                'tif'        =&gt;        'image/tiff',
+                                'css'        =&gt;        'text/css',
+                                'html'        =&gt;        'text/html',
+                                'htm'        =&gt;        'text/html',
+                                'shtml'        =&gt;        'text/html',
+                                'txt'        =&gt;        'text/plain',
+                                'text'        =&gt;        'text/plain',
+                                'log'        =&gt;        array('text/plain', 'text/x-log'),
+                                'rtx'        =&gt;        'text/richtext',
+                                'rtf'        =&gt;        'text/rtf',
+                                'xml'        =&gt;        'text/xml',
+                                'xsl'        =&gt;        'text/xml',
+                                'mpeg'        =&gt;        'video/mpeg',
+                                'mpg'        =&gt;        'video/mpeg',
+                                'mpe'        =&gt;        'video/mpeg',
+                                'qt'        =&gt;        'video/quicktime',
+                                'mov'        =&gt;        'video/quicktime',
+                                'avi'        =&gt;        'video/x-msvideo',
+                                'movie'        =&gt;        'video/x-sgi-movie',
+                                'doc'        =&gt;        'application/msword',
+                                'docx'        =&gt;        'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+                                'xlsx'        =&gt;        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+                                'word'        =&gt;        array('application/msword', 'application/octet-stream'),
+                                'xl'        =&gt;        'application/excel',
+                                'eml'        =&gt;        'message/rfc822'
+                        );
+
+
+/* End of file mimes.php */
+/* Location: ./system/application/config/mimes.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigroutesphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/routes.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/routes.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/routes.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------------
+| URI ROUTING
+| -------------------------------------------------------------------------
+| This file lets you re-map URI requests to specific controller functions.
+|
+| Typically there is a one-to-one relationship between a URL string
+| and its corresponding controller class/method. The segments in a
+| URL normally follow this pattern:
+|
+|         example.com/class/method/id/
+|
+| In some instances, however, you may want to remap this relationship
+| so that a different class/function is called than the one
+| corresponding to the URL.
+|
+| Please see the user guide for complete details:
+|
+|        http://codeigniter.com/user_guide/general/routing.html
+|
+| -------------------------------------------------------------------------
+| RESERVED ROUTES
+| -------------------------------------------------------------------------
+|
+| There are two reserved routes:
+|
+|        $route['default_controller'] = 'welcome';
+|
+| This route indicates which controller class should be loaded if the
+| URI contains no data. In the above example, the &quot;welcome&quot; class
+| would be loaded.
+|
+|        $route['scaffolding_trigger'] = 'scaffolding';
+|
+| This route lets you set a &quot;secret&quot; word that will trigger the
+| scaffolding feature for added security. Note: Scaffolding must be
+| enabled in the controller in which you intend to use it.   The reserved 
+| routes must come before any wildcard or regular expression routes.
+|
+*/
+
+$route['default_controller'] = &quot;welcome&quot;;
+$route['scaffolding_trigger'] = &quot;&quot;;
+
+
+/* End of file routes.php */
+/* Location: ./system/application/config/routes.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfigsmileysphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/smileys.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/smileys.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/smileys.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------
+| SMILEYS
+| -------------------------------------------------------------------
+| This file contains an array of smileys for use with the emoticon helper.
+| Individual images can be used to replace multiple simileys.  For example:
+| :-) and :) use the same image replacement.
+|
+| Please see user guide for more info: 
+| http://codeigniter.com/user_guide/helpers/smiley_helper.html
+|
+*/
+
+$smileys = array(
+
+//        smiley                        image name                                                width        height        alt
+
+        ':-)'                        =&gt;        array('grin.gif',                        '19',        '19',        'grin'),
+        ':lol:'                        =&gt;        array('lol.gif',                        '19',        '19',        'LOL'),
+        ':cheese:'                =&gt;        array('cheese.gif',                        '19',        '19',        'cheese'),
+        ':)'                        =&gt;        array('smile.gif',                        '19',        '19',        'smile'),
+        ';-)'                        =&gt;        array('wink.gif',                        '19',        '19',        'wink'),
+        ';)'                        =&gt;        array('wink.gif',                        '19',        '19',        'wink'),
+        ':smirk:'                =&gt;        array('smirk.gif',                        '19',        '19',        'smirk'),
+        ':roll:'                =&gt;        array('rolleyes.gif',                '19',        '19',        'rolleyes'),
+        ':-S'                        =&gt;        array('confused.gif',                '19',        '19',        'confused'),
+        ':wow:'                        =&gt;        array('surprise.gif',                '19',        '19',        'surprised'),
+        ':bug:'                        =&gt;        array('bigsurprise.gif',        '19',        '19',        'big surprise'),
+        ':-P'                        =&gt;        array('tongue_laugh.gif',        '19',        '19',        'tongue laugh'),
+        '%-P'                        =&gt;        array('tongue_rolleye.gif',        '19',        '19',        'tongue rolleye'),
+        ';-P'                        =&gt;        array('tongue_wink.gif',        '19',        '19',        'tongue wink'),
+        ':P'                        =&gt;        array('raspberry.gif',                '19',        '19',        'raspberry'),
+        ':blank:'                =&gt;        array('blank.gif',                        '19',        '19',        'blank stare'),
+        ':long:'                =&gt;        array('longface.gif',                '19',        '19',        'long face'),
+        ':ohh:'                        =&gt;        array('ohh.gif',                        '19',        '19',        'ohh'),
+        ':grrr:'                =&gt;        array('grrr.gif',                        '19',        '19',        'grrr'),
+        ':gulp:'                =&gt;        array('gulp.gif',                        '19',        '19',        'gulp'),
+        '8-/'                        =&gt;        array('ohoh.gif',                        '19',        '19',        'oh oh'),
+        ':down:'                =&gt;        array('downer.gif',                        '19',        '19',        'downer'),
+        ':red:'                        =&gt;        array('embarrassed.gif',        '19',        '19',        'red face'),
+        ':sick:'                =&gt;        array('sick.gif',                        '19',        '19',        'sick'),
+        ':shut:'                =&gt;        array('shuteye.gif',                '19',        '19',        'shut eye'),
+        ':-/'                        =&gt;        array('hmm.gif',                        '19',        '19',        'hmmm'),
+        '&gt;:('                        =&gt;        array('mad.gif',                        '19',        '19',        'mad'),
+        ':mad:'                        =&gt;        array('mad.gif',                        '19',        '19',        'mad'),
+        '&gt;:-('                        =&gt;        array('angry.gif',                        '19',        '19',        'angry'),
+        ':angry:'                =&gt;        array('angry.gif',                        '19',        '19',        'angry'),
+        ':zip:'                        =&gt;        array('zip.gif',                        '19',        '19',        'zipper'),
+        ':kiss:'                =&gt;        array('kiss.gif',                        '19',        '19',        'kiss'),
+        ':ahhh:'                =&gt;        array('shock.gif',                        '19',        '19',        'shock'),
+        ':coolsmile:'        =&gt;        array('shade_smile.gif',        '19',        '19',        'cool smile'),
+        ':coolsmirk:'        =&gt;        array('shade_smirk.gif',        '19',        '19',        'cool smirk'),
+        ':coolgrin:'        =&gt;        array('shade_grin.gif',                '19',        '19',        'cool grin'),
+        ':coolhmm:'                =&gt;        array('shade_hmm.gif',                '19',        '19',        'cool hmm'),
+        ':coolmad:'                =&gt;        array('shade_mad.gif',                '19',        '19',        'cool mad'),
+        ':coolcheese:'        =&gt;        array('shade_cheese.gif',        '19',        '19',        'cool cheese'),
+        ':vampire:'                =&gt;        array('vampire.gif',                '19',        '19',        'vampire'),
+        ':snake:'                =&gt;        array('snake.gif',                        '19',        '19',        'snake'),
+        ':exclaim:'                =&gt;        array('exclaim.gif',                '19',        '19',        'excaim'),
+        ':question:'        =&gt;        array('question.gif',                '19',        '19',        'question') // no comma after last item
+
+                );
+
+/* End of file smileys.php */
+/* Location: ./system/application/config/smileys.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationconfiguser_agentsphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/user_agents.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/user_agents.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/config/user_agents.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,175 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------
+| USER AGENT TYPES
+| -------------------------------------------------------------------
+| This file contains four arrays of user agent data.  It is used by the
+| User Agent Class to help identify browser, platform, robot, and
+| mobile device data.  The array keys are used to identify the device
+| and the array values are used to set the actual name of the item.
+|
+*/
+
+$platforms = array (
+                                        'windows nt 6.0'        =&gt; 'Windows Longhorn',
+                                        'windows nt 5.2'        =&gt; 'Windows 2003',
+                                        'windows nt 5.0'        =&gt; 'Windows 2000',
+                                        'windows nt 5.1'        =&gt; 'Windows XP',
+                                        'windows nt 4.0'        =&gt; 'Windows NT 4.0',
+                                        'winnt4.0'                        =&gt; 'Windows NT 4.0',
+                                        'winnt 4.0'                        =&gt; 'Windows NT',
+                                        'winnt'                                =&gt; 'Windows NT',
+                                        'windows 98'                =&gt; 'Windows 98',
+                                        'win98'                                =&gt; 'Windows 98',
+                                        'windows 95'                =&gt; 'Windows 95',
+                                        'win95'                                =&gt; 'Windows 95',
+                                        'windows'                        =&gt; 'Unknown Windows OS',
+                                        'os x'                                =&gt; 'Mac OS X',
+                                        'ppc mac'                        =&gt; 'Power PC Mac',
+                                        'freebsd'                        =&gt; 'FreeBSD',
+                                        'ppc'                                =&gt; 'Macintosh',
+                                        'linux'                                =&gt; 'Linux',
+                                        'debian'                        =&gt; 'Debian',
+                                        'sunos'                                =&gt; 'Sun Solaris',
+                                        'beos'                                =&gt; 'BeOS',
+                                        'apachebench'                =&gt; 'ApacheBench',
+                                        'aix'                                =&gt; 'AIX',
+                                        'irix'                                =&gt; 'Irix',
+                                        'osf'                                =&gt; 'DEC OSF',
+                                        'hp-ux'                                =&gt; 'HP-UX',
+                                        'netbsd'                        =&gt; 'NetBSD',
+                                        'bsdi'                                =&gt; 'BSDi',
+                                        'openbsd'                        =&gt; 'OpenBSD',
+                                        'gnu'                                =&gt; 'GNU/Linux',
+                                        'unix'                                =&gt; 'Unknown Unix OS'
+                                );
+
+
+// The order of this array should NOT be changed. Many browsers return
+// multiple browser types so we want to identify the sub-type first.
+$browsers = array(
+                                        'Opera'                                =&gt; 'Opera',
+                                        'MSIE'                                =&gt; 'Internet Explorer',
+                                        'Internet Explorer'        =&gt; 'Internet Explorer',
+                                        'Shiira'                        =&gt; 'Shiira',
+                                        'Firefox'                        =&gt; 'Firefox',
+                                        'Chimera'                        =&gt; 'Chimera',
+                                        'Phoenix'                        =&gt; 'Phoenix',
+                                        'Firebird'                        =&gt; 'Firebird',
+                                        'Camino'                        =&gt; 'Camino',
+                                        'Netscape'                        =&gt; 'Netscape',
+                                        'OmniWeb'                        =&gt; 'OmniWeb',
+                                        'Safari'                        =&gt; 'Safari',
+                                        'Mozilla'                        =&gt; 'Mozilla',
+                                        'Konqueror'                        =&gt; 'Konqueror',
+                                        'icab'                                =&gt; 'iCab',
+                                        'Lynx'                                =&gt; 'Lynx',
+                                        'Links'                                =&gt; 'Links',
+                                        'hotjava'                        =&gt; 'HotJava',
+                                        'amaya'                                =&gt; 'Amaya',
+                                        'IBrowse'                        =&gt; 'IBrowse'
+                                );
+
+$mobiles = array(
+                                        // legacy array, old values commented out
+                                        'mobileexplorer'        =&gt; 'Mobile Explorer',
+//                                        'openwave'                        =&gt; 'Open Wave',
+//                                        'opera mini'                =&gt; 'Opera Mini',
+//                                        'operamini'                        =&gt; 'Opera Mini',
+//                                        'elaine'                        =&gt; 'Palm',
+                                        'palmsource'                =&gt; 'Palm',
+//                                        'digital paths'                =&gt; 'Palm',
+//                                        'avantgo'                        =&gt; 'Avantgo',
+//                                        'xiino'                                =&gt; 'Xiino',
+                                        'palmscape'                        =&gt; 'Palmscape',
+//                                        'nokia'                                =&gt; 'Nokia',
+//                                        'ericsson'                        =&gt; 'Ericsson',
+//                                        'blackberry'                =&gt; 'BlackBerry',
+//                                        'motorola'                        =&gt; 'Motorola'
+
+                                        // Phones and Manufacturers
+                                        'motorola'                        =&gt; &quot;Motorola&quot;,
+                                        'nokia'                                =&gt; &quot;Nokia&quot;,
+                                        'palm'                                =&gt; &quot;Palm&quot;,
+                                        'iphone'                        =&gt; &quot;Apple iPhone&quot;,
+                                        'ipod'                                =&gt; &quot;Apple iPod Touch&quot;,
+                                        'sony'                                =&gt; &quot;Sony Ericsson&quot;,
+                                        'ericsson'                        =&gt; &quot;Sony Ericsson&quot;,
+                                        'blackberry'                =&gt; &quot;BlackBerry&quot;,
+                                        'cocoon'                        =&gt; &quot;O2 Cocoon&quot;,
+                                        'blazer'                        =&gt; &quot;Treo&quot;,
+                                        'lg'                                =&gt; &quot;LG&quot;,
+                                        'amoi'                                =&gt; &quot;Amoi&quot;,
+                                        'xda'                                =&gt; &quot;XDA&quot;,
+                                        'mda'                                =&gt; &quot;MDA&quot;,
+                                        'vario'                                =&gt; &quot;Vario&quot;,
+                                        'htc'                                =&gt; &quot;HTC&quot;,
+                                        'samsung'                        =&gt; &quot;Samsung&quot;,
+                                        'sharp'                                =&gt; &quot;Sharp&quot;,
+                                        'sie-'                                =&gt; &quot;Siemens&quot;,
+                                        'alcatel'                        =&gt; &quot;Alcatel&quot;,
+                                        'benq'                                =&gt; &quot;BenQ&quot;,
+                                        'ipaq'                                =&gt; &quot;HP iPaq&quot;,
+                                        'mot-'                                =&gt; &quot;Motorola&quot;,
+                                        'playstation portable'         =&gt; &quot;PlayStation Portable&quot;,
+                                        'hiptop'                        =&gt; &quot;Danger Hiptop&quot;,
+                                        'nec-'                                =&gt; &quot;NEC&quot;,
+                                        'panasonic'                        =&gt; &quot;Panasonic&quot;,
+                                        'philips'                        =&gt; &quot;Philips&quot;,
+                                        'sagem'                                =&gt; &quot;Sagem&quot;,
+                                        'sanyo'                                =&gt; &quot;Sanyo&quot;,
+                                        'spv'                                =&gt; &quot;SPV&quot;,
+                                        'zte'                                =&gt; &quot;ZTE&quot;,
+                                        'sendo'                                =&gt; &quot;Sendo&quot;,
+
+                                        // Operating Systems
+                                        'symbian'                                =&gt; &quot;Symbian&quot;,
+                                        'SymbianOS'                                =&gt; &quot;SymbianOS&quot;, 
+                                        'elaine'                                =&gt; &quot;Palm&quot;,
+                                        'palm'                                        =&gt; &quot;Palm&quot;,
+                                        'series60'                                =&gt; &quot;Symbian S60&quot;,
+                                        'windows ce'                        =&gt; &quot;Windows CE&quot;,
+
+                                        // Browsers
+                                        'obigo'                                        =&gt; &quot;Obigo&quot;,
+                                        'netfront'                                =&gt; &quot;Netfront Browser&quot;,
+                                        'openwave'                                =&gt; &quot;Openwave Browser&quot;,
+                                        'mobilexplorer'                        =&gt; &quot;Mobile Explorer&quot;,
+                                        'operamini'                                =&gt; &quot;Opera Mini&quot;,
+                                        'opera mini'                        =&gt; &quot;Opera Mini&quot;,
+
+                                        // Other
+                                        'digital paths'                        =&gt; &quot;Digital Paths&quot;,
+                                        'avantgo'                                =&gt; &quot;AvantGo&quot;,
+                                        'xiino'                                        =&gt; &quot;Xiino&quot;,
+                                        'novarra'                                =&gt; &quot;Novarra Transcoder&quot;,
+                                        'vodafone'                                =&gt; &quot;Vodafone&quot;,
+                                        'docomo'                                =&gt; &quot;NTT DoCoMo&quot;,
+                                        'o2'                                        =&gt; &quot;O2&quot;,
+
+                                        // Fallback
+                                        'mobile'                                =&gt; &quot;Generic Mobile&quot;,
+                                        'wireless'                                 =&gt; &quot;Generic Mobile&quot;,
+                                        'j2me'                                        =&gt; &quot;Generic Mobile&quot;,
+                                        'midp'                                        =&gt; &quot;Generic Mobile&quot;,
+                                        'cldc'                                        =&gt; &quot;Generic Mobile&quot;,
+                                        'up.link'                                =&gt; &quot;Generic Mobile&quot;,
+                                        'up.browser'                        =&gt; &quot;Generic Mobile&quot;,
+                                        'smartphone'                        =&gt; &quot;Generic Mobile&quot;,
+                                        'cellphone'                                =&gt; &quot;Generic Mobile&quot;
+                                );
+
+// There are hundreds of bots but these are the most common.
+$robots = array(
+                                        'googlebot'                        =&gt; 'Googlebot',
+                                        'msnbot'                        =&gt; 'MSNBot',
+                                        'slurp'                                =&gt; 'Inktomi Slurp',
+                                        'yahoo'                                =&gt; 'Yahoo',
+                                        'askjeeves'                        =&gt; 'AskJeeves',
+                                        'fastcrawler'                =&gt; 'FastCrawler',
+                                        'infoseek'                        =&gt; 'InfoSeek Robot 1.0',
+                                        'lycos'                                =&gt; 'Lycos'
+                                );
+
+/* End of file user_agents.php */
+/* Location: ./system/application/config/user_agents.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcontrollersindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcontrollersstatusphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/status.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/status.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/status.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+&lt;?php
+class status extends Controller {
+        function index()
+        {
+$this-&gt;load-&gt;view('nav');
+$this-&gt;load-&gt;view('status');
+echo ('&lt;p&gt;&lt;/p&gt;');
+$this-&gt;load-&gt;view('fouter');
+        }
+}
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationcontrollerswelcomephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/welcome.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/welcome.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/controllers/welcome.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;?php
+
+class Welcome extends Controller {
+
+        
+function Welcome()
+        {
+                parent::Controller();        
+        }
+        
+        function index()
+        {
+        
+        $this-&gt;load-&gt;view('nav');
+
+        $this-&gt;load-&gt;view('welcome_message');
+        $this-&gt;load-&gt;view('fouter');
+}
+}
+
+/* End of file welcome.php */
+/* 
+
+        }
+}
+
+/* End of file welcome.php 
+Location: ./system/application/controllers/welcome.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_404php"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_404.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_404.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_404.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;?php header(&quot;HTTP/1.1 404 Not Found&quot;); ?&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;404 Page Not Found&lt;/title&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+
+body {
+background-color:        #fff;
+margin:                                40px;
+font-family:                Lucida Grande, Verdana, Sans-serif;
+font-size:                        12px;
+color:                                #000;
+}
+
+#content  {
+border:                                #999 1px solid;
+background-color:        #fff;
+padding:                        20px 20px 12px 20px;
+}
+
+h1 {
+font-weight:                normal;
+font-size:                        14px;
+color:                                #990000;
+margin:                         0 0 4px 0;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+        &lt;div id=&quot;content&quot;&gt;
+                &lt;h1&gt;&lt;?php echo $heading; ?&gt;&lt;/h1&gt;
+                &lt;?php echo $message; ?&gt;
+&lt;? echo ('please contact the server administrator for mor informations');?&gt;
+        &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_dbphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_db.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_db.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_db.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;Database Error&lt;/title&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+
+body {
+background-color:        #fff;
+margin:                                40px;
+font-family:                Lucida Grande, Verdana, Sans-serif;
+font-size:                        12px;
+color:                                #000;
+}
+
+#content  {
+border:                                #999 1px solid;
+background-color:        #fff;
+padding:                        20px 20px 12px 20px;
+}
+
+h1 {
+font-weight:                normal;
+font-size:                        14px;
+color:                                #990000;
+margin:                         0 0 4px 0;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+        &lt;div id=&quot;content&quot;&gt;
+                &lt;h1&gt;&lt;?php echo $heading; ?&gt;&lt;/h1&gt;
+                &lt;?php echo $message; ?&gt;
+        &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_generalphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_general.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_general.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_general.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;Error&lt;/title&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+
+body {
+background-color:        #fff;
+margin:                                40px;
+font-family:                Lucida Grande, Verdana, Sans-serif;
+font-size:                        12px;
+color:                                #000;
+}
+
+#content  {
+border:                                #999 1px solid;
+background-color:        #fff;
+padding:                        20px 20px 12px 20px;
+}
+
+h1 {
+font-weight:                normal;
+font-size:                        14px;
+color:                                #990000;
+margin:                         0 0 4px 0;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+        &lt;div id=&quot;content&quot;&gt;
+                &lt;h1&gt;&lt;?php echo $heading; ?&gt;&lt;/h1&gt;
+                &lt;?php echo $message; ?&gt;
+        &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorserror_phpphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_php.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_php.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/error_php.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;div style=&quot;border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;&quot;&gt;
+
+&lt;h4&gt;A PHP Error was encountered&lt;/h4&gt;
+
+&lt;p&gt;Severity: &lt;?php echo $severity; ?&gt;&lt;/p&gt;
+&lt;p&gt;Message:  &lt;?php echo $message; ?&gt;&lt;/p&gt;
+&lt;p&gt;Filename: &lt;?php echo $filepath; ?&gt;&lt;/p&gt;
+&lt;p&gt;Line Number: &lt;?php echo $line; ?&gt;&lt;/p&gt;
+
+&lt;/div&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationerrorsindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/errors/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationhelpersindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/helpers/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/helpers/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/helpers/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationhooksindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/hooks/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/hooks/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/hooks/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationlanguageenglishindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/language/english/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/language/english/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/language/english/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationlibrarieseslphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/esl.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/esl.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/esl.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+ &lt;?php

+ $password = &quot;ClueCon&quot;;
+ $port = &quot;8021&quot;;
+ $host = &quot;127.0.0.1&quot;;

+ function event_socket_create($host, $port, $password) {
+     $fp = fsockopen($host, $port, $errno, $errdesc) 
+       or die(&quot;Connection to $host failed&quot;);
+     socket_set_blocking($fp,false);
+     
+     if ($fp) {
+         while (!feof($fp)) {
+            $buffer = fgets($fp, 1024);
+            usleep(100); //allow time for reponse
+            if (trim($buffer) == &quot;Content-Type: auth/request&quot;) {
+               fputs($fp, &quot;auth $password\n\n&quot;);
+               break;
+            }
+         }
+         return $fp;
+     }
+     else {
+         return false;
+     }           
+ }


+ function event_socket_request($fp, $cmd) {
+    
+     if ($fp) {    
+         fputs($fp, $cmd.&quot;\n\n&quot;);    
+         usleep(100); //allow time for reponse
+         
+         $response = &quot;&quot;;
+         $i = 0;
+         $contentlength = 0;
+         while (!feof($fp)) {
+            $buffer = fgets($fp, 4096);
+            if ($contentlength &gt; 0) {
+               $response .= $buffer;
+            }
+            
+            if ($contentlength == 0) { //if contentlenght is already don't process again
+                if (strlen(trim($buffer)) &gt; 0) { //run only if buffer has content
+                    $temparray = split(&quot;:&quot;, trim($buffer));
+                    if ($temparray[0] == &quot;Content-Length&quot;) {
+                       $contentlength = trim($temparray[1]);
+                    }
+                }
+            }
+            
+            usleep(100); //allow time for reponse
+            
+            //optional because of script timeout //don't let while loop become endless
+            if ($i &gt; 10000) { break; } 
+            
+            if ($contentlength &gt; 0) { //is contentlength set
+                //stop reading if all content has been read.
+                if (strlen($response) &gt;= $contentlength) {  
+                   break;
+                }
+            }
+            $i++;
+         }
+         
+         return $response;
+     }
+     else {
+       echo &quot;no handle&quot;;
+     }
+ }

+ $fp = event_socket_create($host, $port, $password);
+ $cmd = &quot;api help&quot;;
+ $response = event_socket_request($fp, $cmd);
+ echo $response;
+\xA0?&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationlibrariesindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/libraries/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationmodelsindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/models/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/models/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/models/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsFSgif"></a>
<div class="binary"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/FS.gif</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/FS.gif
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx">   + application/octet-stream
</span><a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewseslphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+ &lt;?php
+include ('esl_config.php');
+ function event_socket_create($host, $port, $password) {
+     $fp = fsockopen($host, $port, $errno, $errdesc) 
+       or die(&quot;Connection to $host failed&quot;);
+     socket_set_blocking($fp,false);
+     if ($fp) {
+         while (!feof($fp)) {
+            $buffer = fgets($fp, 1024);
+            usleep(100); //allow time for reponse
+            if (trim($buffer) == &quot;Content-Type: auth/request&quot;) {
+               fputs($fp, &quot;auth $password\n\n&quot;);
+               break;
+            }
+         }
+         return $fp;
+     }
+     else {
+         return false;
+     }           
+ }
+ function event_socket_request($fp, $cmd) {
+    
+     if ($fp) {    
+         fputs($fp, $cmd.&quot;\n\n&quot;);    
+         usleep(100); //allow time for reponse
+         
+         $response = &quot;&quot;;
+         $i = 0;
+         $contentlength = 0;
+         while (!feof($fp)) {
+            $buffer = fgets($fp, 4096);
+            if ($contentlength &gt; 0) {
+               $response .= $buffer;
+            }
+            
+            if ($contentlength == 0) { //if contentlenght is already don't process again
+                if (strlen(trim($buffer)) &gt; 0) { //run only if buffer has content
+                    $temparray = split(&quot;:&quot;, trim($buffer));
+                    if ($temparray[0] == &quot;Content-Length&quot;) {
+                       $contentlength = trim($temparray[1]);
+                    }
+                }
+            }
+            
+            usleep(100); //allow time for reponse
+            
+            //optional because of script timeout //don't let while loop become endless
+            if ($i &gt; 10000) { break; } 
+            
+            if ($contentlength &gt; 0) { //is contentlength set
+                //stop reading if all content has been read.
+                if (strlen($response) &gt;= $contentlength) {  
+                   break;
+                }
+            }
+            $i++;
+         }
+         
+         return $response;
+     }
+     else {
+       echo &quot;no handle&quot;;
+     }
+ }
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsesl_configphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl_config.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl_config.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/esl_config.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+ &lt;?php
+ $password = &quot;ClueCon&quot;;
+ $port = &quot;8021&quot;;
+ $host = &quot;127.0.0.1&quot;;
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsfouterphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/fouter.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/fouter.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/fouter.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+&lt;?php
+echo ('copyright \xA9 (C) 2009 Freeswitch.Org');
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsnavphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/nav.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/nav.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/nav.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;Freeswitch Management Consol&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;img alt=&quot;I Love Freeswitch.org Team!&quot; title=&quot;I Love Freeswitch.org Team!&quot; src=&quot;fs.gif&quot;&gt;
+&lt;ul&gt;
+&lt;li&gt;&lt;a href=&quot;http://www.freeswitch.org&quot;&gt;Freeswitch Home page&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.netsoftproduction.net&quot;&gt;Netsoft Production Home Page&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
+&lt;h1&gt;Status&lt;/h1&gt;
+&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;index.php/status&quot;&gt; Freeswitch Status &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewsstatusphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/status.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/status.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/status.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;?php
+include (&quot;esl.php&quot;);
+include (&quot;esl_config.php&quot;);
+echo ('&lt;title&gt;status&lt;/title&gt;');
+echo ('&lt;p&gt;&lt;/p&gt;');
+ $fp = event_socket_create($host, $port, $password);
+if ($_POST[mod]=='sofia'{
+ $cmd = &quot;api sofia status&quot;;
+};
+ $response = event_socket_request($fp, $cmd);
+ echo $response; 
+ fclose($fp);  
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemapplicationviewswelcome_messagephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/welcome_message.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/welcome_message.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/application/views/welcome_message.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;Freeswitch Management Consol&lt;/title&gt;
+&lt;/head&gt;
+&lt;p&gt;Welcome to Freeswitch Management Consol&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemcacheindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/cache/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/cache/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/cache/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterBase4php"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base4.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base4.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base4.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.3
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CI_BASE - For PHP 4
+ *
+ * This file is used only when CodeIgniter is being run under PHP 4.
+ *
+ * In order to allow CI to work under PHP 4 we had to make the Loader class
+ * the parent of the Controller Base class.  It's the only way we can
+ * enable functions like $this-&gt;load-&gt;library('email') to instantiate
+ * classes that can then be used within controllers as $this-&gt;email-&gt;send()
+ *
+ * PHP 4 also has trouble referencing the CI super object within application
+ * constructors since objects do not exist until the class is fully
+ * instantiated.  Basically PHP 4 sucks...
+ *
+ * Since PHP 5 doesn't suffer from this problem so we load one of
+ * two files based on the version of PHP being run.
+ *
+ * @package                CodeIgniter
+ * @subpackage        codeigniter
+ * @category        front-controller
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/
+ */
+ class CI_Base extends CI_Loader {
+
+        function CI_Base()
+        {
+                // This allows syntax like $this-&gt;load-&gt;foo() to work
+                parent::CI_Loader();
+                $this-&gt;load =&amp; $this;
+                
+                // This allows resources used within controller constructors to work
+                global $OBJ;
+                $OBJ = $this-&gt;load; // Do NOT use a reference.
+        }
+}
+
+function &amp;get_instance()
+{
+        global $CI, $OBJ;
+        
+        if (is_object($CI))
+        {
+                return $CI;
+        }
+        
+        return $OBJ-&gt;load;
+}
+
+
+/* End of file Base4.php */
+/* Location: ./system/codeigniter/Base4.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterBase5php"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base5.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base5.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Base5.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.3
+ * @filesource
+ */
+
+
+// ------------------------------------------------------------------------
+
+/**
+ * CI_BASE - For PHP 5
+ *
+ * This file contains some code used only when CodeIgniter is being
+ * run under PHP 5.  It allows us to manage the CI super object more
+ * gracefully than what is possible with PHP 4.
+ *
+ * @package                CodeIgniter
+ * @subpackage        codeigniter
+ * @category        front-controller
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/
+ */
+
+class CI_Base {
+
+        private static $instance;
+
+        public function CI_Base()
+        {
+                self::$instance =&amp; $this;
+        }
+
+        public static function &amp;get_instance()
+        {
+                return self::$instance;
+        }
+}
+
+function &amp;get_instance()
+{
+        return CI_Base::get_instance();
+}
+
+
+
+/* End of file Base5.php */
+/* Location: ./system/codeigniter/Base5.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterCodeIgniterphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/CodeIgniter.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/CodeIgniter.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/CodeIgniter.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,276 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * System Front Controller
+ *
+ * Loads the base classes and executes the request.
+ *
+ * @package                CodeIgniter
+ * @subpackage        codeigniter
+ * @category        Front-controller
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/
+ */
+
+// CI Version
+define('CI_VERSION',        '1.7.1');
+
+/*
+ * ------------------------------------------------------
+ *  Load the global functions
+ * ------------------------------------------------------
+ */
+require(BASEPATH.'codeigniter/Common'.EXT);
+
+/*
+ * ------------------------------------------------------
+ *  Load the compatibility override functions
+ * ------------------------------------------------------
+ */
+require(BASEPATH.'codeigniter/Compat'.EXT);
+
+/*
+ * ------------------------------------------------------
+ *  Load the framework constants
+ * ------------------------------------------------------
+ */
+require(APPPATH.'config/constants'.EXT);
+
+/*
+ * ------------------------------------------------------
+ *  Define a custom error handler so we can log PHP errors
+ * ------------------------------------------------------
+ */
+set_error_handler('_exception_handler');
+set_magic_quotes_runtime(0); // Kill magic quotes
+
+/*
+ * ------------------------------------------------------
+ *  Start the timer... tick tock tick tock...
+ * ------------------------------------------------------
+ */
+
+$BM =&amp; load_class('Benchmark');
+$BM-&gt;mark('total_execution_time_start');
+$BM-&gt;mark('loading_time_base_classes_start');
+
+/*
+ * ------------------------------------------------------
+ *  Instantiate the hooks class
+ * ------------------------------------------------------
+ */
+
+$EXT =&amp; load_class('Hooks');
+
+/*
+ * ------------------------------------------------------
+ *  Is there a &quot;pre_system&quot; hook?
+ * ------------------------------------------------------
+ */
+$EXT-&gt;_call_hook('pre_system');
+
+/*
+ * ------------------------------------------------------
+ *  Instantiate the base classes
+ * ------------------------------------------------------
+ */
+
+$CFG =&amp; load_class('Config');
+$URI =&amp; load_class('URI');
+$RTR =&amp; load_class('Router');
+$OUT =&amp; load_class('Output');
+
+/*
+ * ------------------------------------------------------
+ *        Is there a valid cache file?  If so, we're done...
+ * ------------------------------------------------------
+ */
+
+if ($EXT-&gt;_call_hook('cache_override') === FALSE)
+{
+        if ($OUT-&gt;_display_cache($CFG, $URI) == TRUE)
+        {
+                exit;
+        }
+}
+
+/*
+ * ------------------------------------------------------
+ *  Load the remaining base classes
+ * ------------------------------------------------------
+ */
+
+$IN                =&amp; load_class('Input');
+$LANG        =&amp; load_class('Language');
+
+/*
+ * ------------------------------------------------------
+ *  Load the app controller and local controller
+ * ------------------------------------------------------
+ *
+ *  Note: Due to the poor object handling in PHP 4 we'll
+ *  conditionally load different versions of the base
+ *  class.  Retaining PHP 4 compatibility requires a bit of a hack.
+ *
+ *  Note: The Loader class needs to be included first
+ *
+ */
+if (floor(phpversion()) &lt; 5)
+{
+        load_class('Loader', FALSE);
+        require(BASEPATH.'codeigniter/Base4'.EXT);
+}
+else
+{
+        require(BASEPATH.'codeigniter/Base5'.EXT);
+}
+
+// Load the base controller class
+load_class('Controller', FALSE);
+
+// Load the local application controller
+// Note: The Router class automatically validates the controller path.  If this include fails it 
+// means that the default controller in the Routes.php file is not resolving to something valid.
+if ( ! file_exists(APPPATH.'controllers/'.$RTR-&gt;fetch_directory().$RTR-&gt;fetch_class().EXT))
+{
+        show_error('Unable to load your default controller.  Please make sure the controller specified in your Routes.php file is valid.');
+}
+
+include(APPPATH.'controllers/'.$RTR-&gt;fetch_directory().$RTR-&gt;fetch_class().EXT);
+
+// Set a mark point for benchmarking
+$BM-&gt;mark('loading_time_base_classes_end');
+
+
+/*
+ * ------------------------------------------------------
+ *  Security check
+ * ------------------------------------------------------
+ *
+ *  None of the functions in the app controller or the
+ *  loader class can be called via the URI, nor can
+ *  controller functions that begin with an underscore
+ */
+$class  = $RTR-&gt;fetch_class();
+$method = $RTR-&gt;fetch_method();
+
+if ( ! class_exists($class)
+        OR $method == 'controller'
+        OR strncmp($method, '_', 1) == 0
+        OR in_array(strtolower($method), array_map('strtolower', get_class_methods('Controller')))
+        )
+{
+        show_404(&quot;{$class}/{$method}&quot;);
+}
+
+/*
+ * ------------------------------------------------------
+ *  Is there a &quot;pre_controller&quot; hook?
+ * ------------------------------------------------------
+ */
+$EXT-&gt;_call_hook('pre_controller');
+
+/*
+ * ------------------------------------------------------
+ *  Instantiate the controller and call requested method
+ * ------------------------------------------------------
+ */
+
+// Mark a start point so we can benchmark the controller
+$BM-&gt;mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
+
+$CI = new $class();
+
+// Is this a scaffolding request?
+if ($RTR-&gt;scaffolding_request === TRUE)
+{
+        if ($EXT-&gt;_call_hook('scaffolding_override') === FALSE)
+        {
+                $CI-&gt;_ci_scaffolding();
+        }
+}
+else
+{
+        /*
+         * ------------------------------------------------------
+         *  Is there a &quot;post_controller_constructor&quot; hook?
+         * ------------------------------------------------------
+         */
+        $EXT-&gt;_call_hook('post_controller_constructor');
+        
+        // Is there a &quot;remap&quot; function?
+        if (method_exists($CI, '_remap'))
+        {
+                $CI-&gt;_remap($method);
+        }
+        else
+        {
+                // is_callable() returns TRUE on some versions of PHP 5 for private and protected
+                // methods, so we'll use this workaround for consistent behavior
+                if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
+                {
+                        show_404(&quot;{$class}/{$method}&quot;);
+                }
+
+                // Call the requested method.
+                // Any URI segments present (besides the class/function) will be passed to the method for convenience
+                call_user_func_array(array(&amp;$CI, $method), array_slice($URI-&gt;rsegments, 2));
+        }
+}
+
+// Mark a benchmark end point
+$BM-&gt;mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
+
+/*
+ * ------------------------------------------------------
+ *  Is there a &quot;post_controller&quot; hook?
+ * ------------------------------------------------------
+ */
+$EXT-&gt;_call_hook('post_controller');
+
+/*
+ * ------------------------------------------------------
+ *  Send the final rendered output to the browser
+ * ------------------------------------------------------
+ */
+
+if ($EXT-&gt;_call_hook('display_override') === FALSE)
+{
+        $OUT-&gt;_display();
+}
+
+/*
+ * ------------------------------------------------------
+ *  Is there a &quot;post_system&quot; hook?
+ * ------------------------------------------------------
+ */
+$EXT-&gt;_call_hook('post_system');
+
+/*
+ * ------------------------------------------------------
+ *  Close the DB connection if one exists
+ * ------------------------------------------------------
+ */
+if (class_exists('CI_DB') AND isset($CI-&gt;db))
+{
+        $CI-&gt;db-&gt;close();
+}
+
+
+/* End of file CodeIgniter.php */
+/* Location: ./system/codeigniter/CodeIgniter.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterCommonphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Common.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Common.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Common.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,307 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Common Functions
+ *
+ * Loads the base classes and executes the request.
+ *
+ * @package                CodeIgniter
+ * @subpackage        codeigniter
+ * @category        Common Functions
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Tests for file writability
+ *
+ * is_writable() returns TRUE on Windows servers when you really can't write to 
+ * the file, based on the read-only attribute.  is_writable() is also unreliable
+ * on Unix servers if safe_mode is on. 
+ *
+ * @access        private
+ * @return        void
+ */
+function is_really_writable($file)
+{        
+        // If we're on a Unix server with safe_mode off we call is_writable
+        if (DIRECTORY_SEPARATOR == '/' AND @ini_get(&quot;safe_mode&quot;) == FALSE)
+        {
+                return is_writable($file);
+        }
+
+        // For windows servers and safe_mode &quot;on&quot; installations we'll actually
+        // write a file then read it.  Bah...
+        if (is_dir($file))
+        {
+                $file = rtrim($file, '/').'/'.md5(rand(1,100));
+
+                if (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE)
+                {
+                        return FALSE;
+                }
+
+                fclose($fp);
+                @chmod($file, DIR_WRITE_MODE);
+                @unlink($file);
+                return TRUE;
+        }
+        elseif (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE)
+        {
+                return FALSE;
+        }
+
+        fclose($fp);
+        return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+/**
+* Class registry
+*
+* This function acts as a singleton.  If the requested class does not
+* exist it is instantiated and set to a static variable.  If it has
+* previously been instantiated the variable is returned.
+*
+* @access        public
+* @param        string        the class name being requested
+* @param        bool        optional flag that lets classes get loaded but not instantiated
+* @return        object
+*/
+function &amp;load_class($class, $instantiate = TRUE)
+{
+        static $objects = array();
+
+        // Does the class exist?  If so, we're done...
+        if (isset($objects[$class]))
+        {
+                return $objects[$class];
+        }
+
+        // If the requested class does not exist in the application/libraries
+        // folder we'll load the native class from the system/libraries folder.        
+        if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT))
+        {
+                require(BASEPATH.'libraries/'.$class.EXT);
+                require(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT);
+                $is_subclass = TRUE;
+        }
+        else
+        {
+                if (file_exists(APPPATH.'libraries/'.$class.EXT))
+                {
+                        require(APPPATH.'libraries/'.$class.EXT);
+                        $is_subclass = FALSE;
+                }
+                else
+                {
+                        require(BASEPATH.'libraries/'.$class.EXT);
+                        $is_subclass = FALSE;
+                }
+        }
+
+        if ($instantiate == FALSE)
+        {
+                $objects[$class] = TRUE;
+                return $objects[$class];
+        }
+
+        if ($is_subclass == TRUE)
+        {
+                $name = config_item('subclass_prefix').$class;
+                $objects[$class] =&amp; new $name();
+                return $objects[$class];
+        }
+
+        $name = ($class != 'Controller') ? 'CI_'.$class : $class;
+        
+        $objects[$class] =&amp; new $name();
+        return $objects[$class];
+}
+
+/**
+* Loads the main config.php file
+*
+* @access        private
+* @return        array
+*/
+function &amp;get_config()
+{
+        static $main_conf;
+
+        if ( ! isset($main_conf))
+        {
+                if ( ! file_exists(APPPATH.'config/config'.EXT))
+                {
+                        exit('The configuration file config'.EXT.' does not exist.');
+                }
+
+                require(APPPATH.'config/config'.EXT);
+
+                if ( ! isset($config) OR ! is_array($config))
+                {
+                        exit('Your config file does not appear to be formatted correctly.');
+                }
+
+                $main_conf[0] =&amp; $config;
+        }
+        return $main_conf[0];
+}
+
+/**
+* Gets a config item
+*
+* @access        public
+* @return        mixed
+*/
+function config_item($item)
+{
+        static $config_item = array();
+
+        if ( ! isset($config_item[$item]))
+        {
+                $config =&amp; get_config();
+
+                if ( ! isset($config[$item]))
+                {
+                        return FALSE;
+                }
+                $config_item[$item] = $config[$item];
+        }
+
+        return $config_item[$item];
+}
+
+
+/**
+* Error Handler
+*
+* This function lets us invoke the exception class and
+* display errors using the standard error template located
+* in application/errors/errors.php
+* This function will send the error page directly to the
+* browser and exit.
+*
+* @access        public
+* @return        void
+*/
+function show_error($message)
+{
+        $error =&amp; load_class('Exceptions');
+        echo $error-&gt;show_error('An Error Was Encountered', $message);
+        exit;
+}
+
+
+/**
+* 404 Page Handler
+*
+* This function is similar to the show_error() function above
+* However, instead of the standard error template it displays
+* 404 errors.
+*
+* @access        public
+* @return        void
+*/
+function show_404($page = '')
+{
+        $error =&amp; load_class('Exceptions');
+        $error-&gt;show_404($page);
+        exit;
+}
+
+
+/**
+* Error Logging Interface
+*
+* We use this as a simple mechanism to access the logging
+* class and send messages to be logged.
+*
+* @access        public
+* @return        void
+*/
+function log_message($level = 'error', $message, $php_error = FALSE)
+{
+        static $LOG;
+        
+        $config =&amp; get_config();
+        if ($config['log_threshold'] == 0)
+        {
+                return;
+        }
+
+        $LOG =&amp; load_class('Log');
+        $LOG-&gt;write_log($level, $message, $php_error);
+}
+
+/**
+* Exception Handler
+*
+* This is the custom exception handler that is declaired at the top
+* of Codeigniter.php.  The main reason we use this is permit
+* PHP errors to be logged in our own log files since we may
+* not have access to server logs. Since this function
+* effectively intercepts PHP errors, however, we also need
+* to display errors based on the current error_reporting level.
+* We do that with the use of a PHP error template.
+*
+* @access        private
+* @return        void
+*/
+function _exception_handler($severity, $message, $filepath, $line)
+{        
+         // We don't bother with &quot;strict&quot; notices since they will fill up
+         // the log file with information that isn't normally very
+         // helpful.  For example, if you are running PHP 5 and you
+         // use version 4 style class functions (without prefixes
+         // like &quot;public&quot;, &quot;private&quot;, etc.) you'll get notices telling
+         // you that these have been deprecated.
+        
+        if ($severity == E_STRICT)
+        {
+                return;
+        }
+
+        $error =&amp; load_class('Exceptions');
+
+        // Should we display the error?
+        // We'll get the current error_reporting level and add its bits
+        // with the severity bits to find out.
+        
+        if (($severity &amp; error_reporting()) == $severity)
+        {
+                $error-&gt;show_php_error($severity, $message, $filepath, $line);
+        }
+        
+        // Should we log the error?  No?  We're done...
+        $config =&amp; get_config();
+        if ($config['log_threshold'] == 0)
+        {
+                return;
+        }
+
+        $error-&gt;log_exception($severity, $message, $filepath, $line);
+}
+
+
+
+/* End of file Common.php */
+/* Location: ./system/codeigniter/Common.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterCompatphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Compat.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Compat.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/Compat.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Compatibility Functions
+ *
+ * Function overrides for older versions of PHP or PHP environments missing
+ * certain extensions / libraries
+ *
+ * @package                CodeIgniter
+ * @subpackage        codeigniter
+ * @category        Compatibility Functions
+ * @author                ExpressionEngine Development Team
+ * @link                http://codeigniter.com/user_guide/
+ */
+
+// ------------------------------------------------------------------------
+
+/*
+ * PHP versions prior to 5.0 don't support the E_STRICT constant
+ * so we need to explicitly define it otherwise the Exception class 
+ * will generate errors when running under PHP 4
+ *
+ */
+if ( ! defined('E_STRICT'))
+{
+        define('E_STRICT', 2048);
+}
+
+/**
+ * ctype_digit()
+ *
+ * Determines if a string is comprised only of digits
+ * http://us.php.net/manual/en/function.ctype_digit.php
+ *
+ * @access        public
+ * @param        string
+ * @return        bool
+ */
+if ( ! function_exists('ctype_digit'))
+{
+        function ctype_digit($str)
+        {
+                if ( ! is_string($str) OR $str == '')
+                {
+                        return FALSE;
+                }
+                
+                return ! preg_match('/[^0-9]/', $str);
+        }        
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * ctype_alnum()
+ *
+ * Determines if a string is comprised of only alphanumeric characters
+ * http://us.php.net/manual/en/function.ctype-alnum.php
+ *
+ * @access        public
+ * @param        string
+ * @return        bool
+ */
+if ( ! function_exists('ctype_alnum'))
+{
+        function ctype_alnum($str)
+        {
+                if ( ! is_string($str) OR $str == '')
+                {
+                        return FALSE;
+                }
+                
+                return ! preg_match('/[^0-9a-z]/i', $str);
+        }        
+}
+
+/* End of file Compat.php */
+/* Location: ./system/codeigniter/Compat.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemcodeigniterindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/codeigniter/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDBphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,146 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Initialize the database
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+function &amp;DB($params = '', $active_record_override = FALSE)
+{
+        // Load the DB config file if a DSN string wasn't passed
+        if (is_string($params) AND strpos($params, '://') === FALSE)
+        {
+                include(APPPATH.'config/database'.EXT);
+                
+                if ( ! isset($db) OR count($db) == 0)
+                {
+                        show_error('No database connection settings were found in the database config file.');
+                }
+                
+                if ($params != '')
+                {
+                        $active_group = $params;
+                }
+                
+                if ( ! isset($active_group) OR ! isset($db[$active_group]))
+                {
+                        show_error('You have specified an invalid database connection group.');
+                }
+                
+                $params = $db[$active_group];
+        }
+        elseif (is_string($params))
+        {
+                
+                /* parse the URL from the DSN string
+                *  Database settings can be passed as discreet
+                 *  parameters or as a data source name in the first
+                 *  parameter. DSNs must have this prototype:
+                 *  $dsn = 'driver://username:password@hostname/database';
+                */
+        
+                if (($dns = @parse_url($params)) === FALSE)
+                {
+                        show_error('Invalid DB Connection String');
+                }
+                
+                $params = array(
+                                                        'dbdriver'        =&gt; $dns['scheme'],
+                                                        'hostname'        =&gt; (isset($dns['host'])) ? rawurldecode($dns['host']) : '',
+                                                        'username'        =&gt; (isset($dns['user'])) ? rawurldecode($dns['user']) : '',
+                                                        'password'        =&gt; (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '',
+                                                        'database'        =&gt; (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : ''
+                                                );
+                
+                // were additional config items set?
+                if (isset($dns['query']))
+                {
+                        parse_str($dns['query'], $extra);
+
+                        foreach($extra as $key =&gt; $val)
+                        {
+                                // booleans please
+                                if (strtoupper($val) == &quot;TRUE&quot;)
+                                {
+                                        $val = TRUE;
+                                }
+                                elseif (strtoupper($val) == &quot;FALSE&quot;)
+                                {
+                                        $val = FALSE;
+                                }
+
+                                $params[$key] = $val;
+                        }
+                }
+        }
+        
+        // No DB specified yet?  Beat them senseless...
+        if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '')
+        {
+                show_error('You have not selected a database type to connect to.');
+        }
+
+        // Load the DB classes.  Note: Since the active record class is optional
+        // we need to dynamically create a class that extends proper parent class
+        // based on whether we're using the active record class or not.
+        // Kudos to Paul for discovering this clever use of eval()
+        
+        if ($active_record_override == TRUE)
+        {
+                $active_record = TRUE;
+        }
+        
+        require_once(BASEPATH.'database/DB_driver'.EXT);
+
+        if ( ! isset($active_record) OR $active_record == TRUE)
+        {
+                require_once(BASEPATH.'database/DB_active_rec'.EXT);
+                
+                if ( ! class_exists('CI_DB'))
+                {
+                        eval('class CI_DB extends CI_DB_active_record { }');
+                }
+        }
+        else
+        {
+                if ( ! class_exists('CI_DB'))
+                {
+                        eval('class CI_DB extends CI_DB_driver { }');
+                }
+        }
+                        
+        require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT);
+
+        // Instantiate the DB adapter
+        $driver = 'CI_DB_'.$params['dbdriver'].'_driver';
+        $DB =&amp; new $driver($params);
+        
+        if ($DB-&gt;autoinit == TRUE)
+        {
+                $DB-&gt;initialize();
+        }
+        
+        return $DB;
+}        
+
+
+
+/* End of file DB.php */
+/* Location: ./system/database/DB.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_active_recphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_active_rec.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_active_rec.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_active_rec.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1820 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Active Record Class
+ *
+ * This is the platform-independent base Active Record implementation class.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_active_record extends CI_DB_driver {
+
+        var $ar_select                                = array();
+        var $ar_distinct                        = FALSE;
+        var $ar_from                                = array();
+        var $ar_join                                = array();
+        var $ar_where                                = array();
+        var $ar_like                                = array();
+        var $ar_groupby                                = array();
+        var $ar_having                                = array();
+        var $ar_limit                                = FALSE;
+        var $ar_offset                                = FALSE;
+        var $ar_order                                = FALSE;
+        var $ar_orderby                                = array();
+        var $ar_set                                        = array();        
+        var $ar_wherein                                = array();
+        var $ar_aliased_tables                = array();
+        var $ar_store_array                        = array();
+        
+        // Active Record Caching variables
+        var $ar_caching                         = FALSE;
+        var $ar_cache_exists                = array();
+        var $ar_cache_select                = array();
+        var $ar_cache_from                        = array();
+        var $ar_cache_join                        = array();
+        var $ar_cache_where                        = array();
+        var $ar_cache_like                        = array();
+        var $ar_cache_groupby                = array();
+        var $ar_cache_having                = array();
+        var $ar_cache_orderby                = array();
+        var $ar_cache_set                        = array();        
+
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select
+         *
+         * Generates the SELECT portion of the query
+         *
+         * @access        public
+         * @param        string
+         * @return        object
+         */
+        function select($select = '*', $escape = NULL)
+        {
+                // Set the global value if this was sepecified        
+                if (is_bool($escape))
+                {
+                        $this-&gt;_protect_identifiers = $escape;
+                }
+                
+                if (is_string($select))
+                {
+                        $select = explode(',', $select);
+                }
+
+                foreach ($select as $val)
+                {
+                        $val = trim($val);
+
+                        if ($val != '')
+                        {
+                                $this-&gt;ar_select[] = $val;
+
+                                if ($this-&gt;ar_caching === TRUE)
+                                {
+                                        $this-&gt;ar_cache_select[] = $val;
+                                        $this-&gt;ar_cache_exists[] = 'select';
+                                }
+                        }
+                }
+                return $this;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select Max
+         *
+         * Generates a SELECT MAX(field) portion of a query
+         *
+         * @access        public
+         * @param        string        the field
+         * @param        string        an alias
+         * @return        object
+         */
+        function select_max($select = '', $alias = '')
+        {
+                return $this-&gt;_max_min_avg_sum($select, $alias, 'MAX');
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Select Min
+         *
+         * Generates a SELECT MIN(field) portion of a query
+         *
+         * @access        public
+         * @param        string        the field
+         * @param        string        an alias
+         * @return        object
+         */
+        function select_min($select = '', $alias = '')
+        {
+                return $this-&gt;_max_min_avg_sum($select, $alias, 'MIN');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select Average
+         *
+         * Generates a SELECT AVG(field) portion of a query
+         *
+         * @access        public
+         * @param        string        the field
+         * @param        string        an alias
+         * @return        object
+         */
+        function select_avg($select = '', $alias = '')
+        {
+                return $this-&gt;_max_min_avg_sum($select, $alias, 'AVG');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select Sum
+         *
+         * Generates a SELECT SUM(field) portion of a query
+         *
+         * @access        public
+         * @param        string        the field
+         * @param        string        an alias
+         * @return        object
+         */
+        function select_sum($select = '', $alias = '')
+        {
+                return $this-&gt;_max_min_avg_sum($select, $alias, 'SUM');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Processing Function for the four functions above:
+         *
+         *        select_max()
+         *        select_min()
+         *        select_avg()
+         *  select_sum()
+         *        
+         * @access        public
+         * @param        string        the field
+         * @param        string        an alias
+         * @return        object
+         */
+        function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
+        {
+                if ( ! is_string($select) OR $select == '')
+                {
+                        $this-&gt;display_error('db_invalid_query');
+                }
+        
+                $type = strtoupper($type);
+        
+                if ( ! in_array($type, array('MAX', 'MIN', 'AVG', 'SUM')))
+                {
+                        show_error('Invalid function type: '.$type);
+                }
+        
+                if ($alias == '')
+                {
+                        $alias = $this-&gt;_create_alias_from_table(trim($select));
+                }
+        
+                $sql = $type.'('.$this-&gt;_protect_identifiers(trim($select)).') AS '.$alias;
+
+                $this-&gt;ar_select[] = $sql;
+                
+                if ($this-&gt;ar_caching === TRUE)
+                {
+                        $this-&gt;ar_cache_select[] = $sql;
+                        $this-&gt;ar_cache_exists[] = 'select';
+                }
+                
+                return $this;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Determines the alias name based on the table
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _create_alias_from_table($item)
+        {
+                if (strpos($item, '.') !== FALSE)
+                {
+                        return end(explode('.', $item));
+                }
+                
+                return $item;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * DISTINCT
+         *
+         * Sets a flag which tells the query string compiler to add DISTINCT
+         *
+         * @access        public
+         * @param        bool
+         * @return        object
+         */
+        function distinct($val = TRUE)
+        {
+                $this-&gt;ar_distinct = (is_bool($val)) ? $val : TRUE;
+                return $this;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * From
+         *
+         * Generates the FROM portion of the query
+         *
+         * @access        public
+         * @param        mixed        can be a string or array
+         * @return        object
+         */
+        function from($from)
+        {
+                foreach ((array)$from as $val)
+                {
+                        if (strpos($val, ',') !== FALSE)
+                        {
+                                foreach (explode(',', $val) as $v)
+                                {
+                                        $v = trim($v);
+                                        $this-&gt;_track_aliases($v);
+
+                                        $this-&gt;ar_from[] = $this-&gt;_protect_identifiers($v, TRUE, NULL, FALSE);
+                                        
+                                        if ($this-&gt;ar_caching === TRUE)
+                                        {
+                                                $this-&gt;ar_cache_from[] = $this-&gt;_protect_identifiers($v, TRUE, NULL, FALSE);
+                                                $this-&gt;ar_cache_exists[] = 'from';
+                                        }                                
+                                }
+
+                        }
+                        else
+                        {
+                                $val = trim($val);
+
+                                // Extract any aliases that might exist.  We use this information
+                                // in the _protect_identifiers to know whether to add a table prefix 
+                                $this-&gt;_track_aliases($val);
+        
+                                $this-&gt;ar_from[] = $this-&gt;_protect_identifiers($val, TRUE, NULL, FALSE);
+                                
+                                if ($this-&gt;ar_caching === TRUE)
+                                {
+                                        $this-&gt;ar_cache_from[] = $this-&gt;_protect_identifiers($val, TRUE, NULL, FALSE);
+                                        $this-&gt;ar_cache_exists[] = 'from';
+                                }
+                        }
+                }
+
+                return $this;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Join
+         *
+         * Generates the JOIN portion of the query
+         *
+         * @access        public
+         * @param        string
+         * @param        string        the join condition
+         * @param        string        the type of join
+         * @return        object
+         */
+        function join($table, $cond, $type = '')
+        {                
+                if ($type != '')
+                {
+                        $type = strtoupper(trim($type));
+
+                        if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER')))
+                        {
+                                $type = '';
+                        }
+                        else
+                        {
+                                $type .= ' ';
+                        }
+                }
+
+                // Extract any aliases that might exist.  We use this information
+                // in the _protect_identifiers to know whether to add a table prefix 
+                $this-&gt;_track_aliases($table);
+
+                // Strip apart the condition and protect the identifiers
+                if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match))
+                {
+                        $match[1] = $this-&gt;_protect_identifiers($match[1]);
+                        $match[3] = $this-&gt;_protect_identifiers($match[3]);
+                
+                        $cond = $match[1].$match[2].$match[3];                
+                }
+                
+                // Assemble the JOIN statement
+                $join = $type.'JOIN '.$this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond;
+
+                $this-&gt;ar_join[] = $join;
+                if ($this-&gt;ar_caching === TRUE)
+                {
+                        $this-&gt;ar_cache_join[] = $join;
+                        $this-&gt;ar_cache_exists[] = 'join';
+                }
+
+                return $this;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Where
+         *
+         * Generates the WHERE portion of the query. Separates
+         * multiple calls with AND
+         *
+         * @access        public
+         * @param        mixed
+         * @param        mixed
+         * @return        object
+         */
+        function where($key, $value = NULL, $escape = TRUE)
+        {
+                return $this-&gt;_where($key, $value, 'AND ', $escape);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * OR Where
+         *
+         * Generates the WHERE portion of the query. Separates
+         * multiple calls with OR
+         *
+         * @access        public
+         * @param        mixed
+         * @param        mixed
+         * @return        object
+         */
+        function or_where($key, $value = NULL, $escape = TRUE)
+        {
+                return $this-&gt;_where($key, $value, 'OR ', $escape);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * orwhere() is an alias of or_where()
+         * this function is here for backwards compatibility, as
+         * orwhere() has been deprecated
+         */
+        function orwhere($key, $value = NULL, $escape = TRUE)
+        {
+                return $this-&gt;or_where($key, $value, $escape);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Where
+         *
+         * Called by where() or orwhere()
+         *
+         * @access        private
+         * @param        mixed
+         * @param        mixed
+         * @param        string
+         * @return        object
+         */
+        function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
+        {
+                if ( ! is_array($key))
+                {
+                        $key = array($key =&gt; $value);
+                }
+                
+                // If the escape value was not set will will base it on the global setting
+                if ( ! is_bool($escape))
+                {
+                        $escape = $this-&gt;_protect_identifiers;
+                }
+
+                foreach ($key as $k =&gt; $v)
+                {
+                        $prefix = (count($this-&gt;ar_where) == 0 AND count($this-&gt;ar_cache_where) == 0) ? '' : $type;
+
+                        if (is_null($v) &amp;&amp; ! $this-&gt;_has_operator($k))
+                        {
+                                // value appears not to have been set, assign the test to IS NULL
+                                $k .= ' IS NULL';
+                        }
+                        
+                        if ( ! is_null($v))
+                        {
+                                if ($escape === TRUE)
+                                {
+                                        $k = $this-&gt;_protect_identifiers($k, FALSE, $escape);
+                                        
+                                        $v = ' '.$this-&gt;escape($v);
+                                }
+
+                                if ( ! $this-&gt;_has_operator($k))
+                                {
+                                        $k .= ' =';
+                                }
+                        }
+                        else
+                        {
+                                $k = $this-&gt;_protect_identifiers($k, FALSE, $escape);                        
+                        }
+
+                        $this-&gt;ar_where[] = $prefix.$k.$v;
+                        
+                        if ($this-&gt;ar_caching === TRUE)
+                        {
+                                $this-&gt;ar_cache_where[] = $prefix.$k.$v;
+                                $this-&gt;ar_cache_exists[] = 'where';
+                        }
+                        
+                }
+                
+                return $this;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Where_in
+         *
+         * Generates a WHERE field IN ('item', 'item') SQL query joined with
+         * AND if appropriate
+         *
+         * @access        public
+         * @param        string        The field to search
+         * @param        array        The values searched on
+         * @return        object
+         */
+        function where_in($key = NULL, $values = NULL)
+        {
+                return $this-&gt;_where_in($key, $values);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Where_in_or
+         *
+         * Generates a WHERE field IN ('item', 'item') SQL query joined with
+         * OR if appropriate
+         *
+         * @access        public
+         * @param        string        The field to search
+         * @param        array        The values searched on
+         * @return        object
+         */
+        function or_where_in($key = NULL, $values = NULL)
+        {
+                return $this-&gt;_where_in($key, $values, FALSE, 'OR ');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Where_not_in
+         *
+         * Generates a WHERE field NOT IN ('item', 'item') SQL query joined
+         * with AND if appropriate
+         *
+         * @access        public
+         * @param        string        The field to search
+         * @param        array        The values searched on
+         * @return        object
+         */
+        function where_not_in($key = NULL, $values = NULL)
+        {
+                return $this-&gt;_where_in($key, $values, TRUE);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Where_not_in_or
+         *
+         * Generates a WHERE field NOT IN ('item', 'item') SQL query joined
+         * with OR if appropriate
+         *
+         * @access        public
+         * @param        string        The field to search
+         * @param        array        The values searched on
+         * @return        object
+         */
+        function or_where_not_in($key = NULL, $values = NULL)
+        {
+                return $this-&gt;_where_in($key, $values, TRUE, 'OR ');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Where_in
+         *
+         * Called by where_in, where_in_or, where_not_in, where_not_in_or
+         *
+         * @access        public
+         * @param        string        The field to search
+         * @param        array        The values searched on
+         * @param        boolean        If the statement would be IN or NOT IN
+         * @param        string        
+         * @return        object
+         */
+        function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
+        {
+                if ($key === NULL OR $values === NULL)
+                {
+                        return;
+                }
+                
+                if ( ! is_array($values))
+                {
+                        $values = array($values);
+                }
+                
+                $not = ($not) ? ' NOT' : '';
+
+                foreach ($values as $value)
+                {
+                        $this-&gt;ar_wherein[] = $this-&gt;escape($value);
+                }
+
+                $prefix = (count($this-&gt;ar_where) == 0) ? '' : $type;

+                $where_in = $prefix . $this-&gt;_protect_identifiers($key) . $not . &quot; IN (&quot; . implode(&quot;, &quot;, $this-&gt;ar_wherein) . &quot;) &quot;;
+
+                $this-&gt;ar_where[] = $where_in;
+                if ($this-&gt;ar_caching === TRUE)
+                {
+                        $this-&gt;ar_cache_where[] = $where_in;
+                        $this-&gt;ar_cache_exists[] = 'where';
+                }
+
+                // reset the array for multiple calls
+                $this-&gt;ar_wherein = array();
+                return $this;
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Like
+         *
+         * Generates a %LIKE% portion of the query. Separates
+         * multiple calls with AND
+         *
+         * @access        public
+         * @param        mixed
+         * @param        mixed
+         * @return        object
+         */
+        function like($field, $match = '', $side = 'both')
+        {
+                return $this-&gt;_like($field, $match, 'AND ', $side);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Not Like
+         *
+         * Generates a NOT LIKE portion of the query. Separates
+         * multiple calls with AND
+         *
+         * @access        public
+         * @param        mixed
+         * @param        mixed
+         * @return        object
+         */
+        function not_like($field, $match = '', $side = 'both')
+        {
+                return $this-&gt;_like($field, $match, 'AND ', $side, 'NOT');
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * OR Like
+         *
+         * Generates a %LIKE% portion of the query. Separates
+         * multiple calls with OR
+         *
+         * @access        public
+         * @param        mixed
+         * @param        mixed
+         * @return        object
+         */
+        function or_like($field, $match = '', $side = 'both')
+        {
+                return $this-&gt;_like($field, $match, 'OR ', $side);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * OR Not Like
+         *
+         * Generates a NOT LIKE portion of the query. Separates
+         * multiple calls with OR
+         *
+         * @access        public
+         * @param        mixed
+         * @param        mixed
+         * @return        object
+         */
+        function or_not_like($field, $match = '', $side = 'both')
+        {
+                return $this-&gt;_like($field, $match, 'OR ', $side, 'NOT');
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * orlike() is an alias of or_like()
+         * this function is here for backwards compatibility, as
+         * orlike() has been deprecated
+         */
+        function orlike($field, $match = '', $side = 'both')
+        {
+                return $this-&gt;or_like($field, $match, $side);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Like
+         *
+         * Called by like() or orlike()
+         *
+         * @access        private
+         * @param        mixed
+         * @param        mixed
+         * @param        string
+         * @return        object
+         */
+        function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
+        {
+                if ( ! is_array($field))
+                {
+                        $field = array($field =&gt; $match);
+                }
+         
+                foreach ($field as $k =&gt; $v)
+                {
+                        $k = $this-&gt;_protect_identifiers($k);
+
+                        $prefix = (count($this-&gt;ar_like) == 0) ? '' : $type;
+
+                        $v = $this-&gt;escape_like_str($v);
+
+                        if ($side == 'before')
+                        {
+                                $like_statement = $prefix.&quot; $k $not LIKE '%{$v}'&quot;;
+                        }
+                        elseif ($side == 'after')
+                        {
+                                $like_statement = $prefix.&quot; $k $not LIKE '{$v}%'&quot;;
+                        }
+                        else
+                        {
+                                $like_statement = $prefix.&quot; $k $not LIKE '%{$v}%'&quot;;
+                        }
+                        
+                        // some platforms require an escape sequence definition for LIKE wildcards
+                        if ($this-&gt;_like_escape_str != '')
+                        {
+                                $like_statement = $like_statement.sprintf($this-&gt;_like_escape_str, $this-&gt;_like_escape_char);
+                        }
+                        
+                        $this-&gt;ar_like[] = $like_statement;
+                        if ($this-&gt;ar_caching === TRUE)
+                        {
+                                $this-&gt;ar_cache_like[] = $like_statement;
+                                $this-&gt;ar_cache_exists[] = 'like';
+                        }
+                        
+                }
+                return $this;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * GROUP BY
+         *
+         * @access        public
+         * @param        string
+         * @return        object
+         */
+        function group_by($by)
+        {
+                if (is_string($by))
+                {
+                        $by = explode(',', $by);
+                }
+        
+                foreach ($by as $val)
+                {
+                        $val = trim($val);
+                
+                        if ($val != '')
+                        {
+                                $this-&gt;ar_groupby[] = $this-&gt;_protect_identifiers($val);
+                                
+                                if ($this-&gt;ar_caching === TRUE)
+                                {
+                                        $this-&gt;ar_cache_groupby[] = $this-&gt;_protect_identifiers($val);
+                                        $this-&gt;ar_cache_exists[] = 'groupby';
+                                }
+                        }
+                }
+                return $this;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * groupby() is an alias of group_by()
+         * this function is here for backwards compatibility, as
+         * groupby() has been deprecated
+         */
+        function groupby($by)
+        {
+                return $this-&gt;group_by($by);
+        }        
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Sets the HAVING value
+         *
+         * Separates multiple calls with AND
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        object
+         */
+        function having($key, $value = '', $escape = TRUE)
+        {
+                return $this-&gt;_having($key, $value, 'AND ', $escape);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * orhaving() is an alias of or_having()
+         * this function is here for backwards compatibility, as
+         * orhaving() has been deprecated
+         */
+
+        function orhaving($key, $value = '', $escape = TRUE)
+        {
+                return $this-&gt;or_having($key, $value, $escape);
+        }        
+        // --------------------------------------------------------------------
+
+        /**
+         * Sets the OR HAVING value
+         *
+         * Separates multiple calls with OR
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        object
+         */
+        function or_having($key, $value = '', $escape = TRUE)
+        {
+                return $this-&gt;_having($key, $value, 'OR ', $escape);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Sets the HAVING values
+         *
+         * Called by having() or or_having()
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        object
+         */
+        function _having($key, $value = '', $type = 'AND ', $escape = TRUE)
+        {
+                if ( ! is_array($key))
+                {
+                        $key = array($key =&gt; $value);
+                }
+        
+                foreach ($key as $k =&gt; $v)
+                {
+                        $prefix = (count($this-&gt;ar_having) == 0) ? '' : $type;
+
+                        if ($escape === TRUE)
+                        {
+                                $k = $this-&gt;_protect_identifiers($k);
+                        }
+
+                        if ( ! $this-&gt;_has_operator($k))
+                        {
+                                $k .= ' = ';
+                        }
+
+                        if ($v != '')
+                        {
+                                $v = ' '.$this-&gt;escape_str($v);
+                        }
+                        
+                        $this-&gt;ar_having[] = $prefix.$k.$v;
+                        if ($this-&gt;ar_caching === TRUE)
+                        {
+                                $this-&gt;ar_cache_having[] = $prefix.$k.$v;
+                                $this-&gt;ar_cache_exists[] = 'having';
+                        }
+                }
+                
+                return $this;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Sets the ORDER BY value
+         *
+         * @access        public
+         * @param        string
+         * @param        string        direction: asc or desc
+         * @return        object
+         */
+        function order_by($orderby, $direction = '')
+        {
+                if (strtolower($direction) == 'random')
+                {
+                        $orderby = ''; // Random results want or don't need a field name
+                        $direction = $this-&gt;_random_keyword;
+                }
+                elseif (trim($direction) != '')
+                {
+                        $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' '.$direction : ' ASC';
+                }
+        
+        
+                if (strpos($orderby, ',') !== FALSE)
+                {
+                        $temp = array();
+                        foreach (explode(',', $orderby) as $part)
+                        {
+                                $part = trim($part);
+                                if ( ! in_array($part, $this-&gt;ar_aliased_tables))
+                                {
+                                        $part = $this-&gt;_protect_identifiers(trim($part));
+                                }
+                                
+                                $temp[] = $part;
+                        }
+                        
+                        $orderby = implode(', ', $temp);                        
+                }
+                else if ($direction != $this-&gt;_random_keyword)
+                {
+                        $orderby = $this-&gt;_protect_identifiers($orderby);
+                }
+        
+                $orderby_statement = $orderby.$direction;
+                
+                $this-&gt;ar_orderby[] = $orderby_statement;
+                if ($this-&gt;ar_caching === TRUE)
+                {
+                        $this-&gt;ar_cache_orderby[] = $orderby_statement;
+                        $this-&gt;ar_cache_exists[] = 'orderby';
+                }
+
+                return $this;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * orderby() is an alias of order_by()
+         * this function is here for backwards compatibility, as
+         * orderby() has been deprecated
+         */
+        function orderby($orderby, $direction = '')
+        {
+                return $this-&gt;order_by($orderby, $direction);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Sets the LIMIT value
+         *
+         * @access        public
+         * @param        integer        the limit value
+         * @param        integer        the offset value
+         * @return        object
+         */
+        function limit($value, $offset = '')
+        {
+                $this-&gt;ar_limit = $value;
+
+                if ($offset != '')
+                {
+                        $this-&gt;ar_offset = $offset;
+                }
+                
+                return $this;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Sets the OFFSET value
+         *
+         * @access        public
+         * @param        integer        the offset value
+         * @return        object
+         */
+        function offset($offset)
+        {
+                $this-&gt;ar_offset = $offset;
+                return $this;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The &quot;set&quot; function.  Allows key/value pairs to be set for inserting or updating
+         *
+         * @access        public
+         * @param        mixed
+         * @param        string
+         * @param        boolean
+         * @return        object
+         */
+        function set($key, $value = '', $escape = TRUE)
+        {
+                $key = $this-&gt;_object_to_array($key);
+        
+                if ( ! is_array($key))
+                {
+                        $key = array($key =&gt; $value);
+                }        
+
+                foreach ($key as $k =&gt; $v)
+                {
+                        if ($escape === FALSE)
+                        {
+                                $this-&gt;ar_set[$this-&gt;_protect_identifiers($k)] = $v;
+                        }
+                        else
+                        {
+                                $this-&gt;ar_set[$this-&gt;_protect_identifiers($k)] = $this-&gt;escape($v);
+                        }
+                }
+                
+                return $this;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Get
+         *
+         * Compiles the select statement based on the other functions called
+         * and runs the query
+         *
+         * @access        public
+         * @param        string        the table
+         * @param        string        the limit clause
+         * @param        string        the offset clause
+         * @return        object
+         */
+        function get($table = '', $limit = null, $offset = null)
+        {
+                if ($table != '')
+                {
+                        $this-&gt;_track_aliases($table);
+                        $this-&gt;from($table);
+                }
+                
+                if ( ! is_null($limit))
+                {
+                        $this-&gt;limit($limit, $offset);
+                }
+                        
+                $sql = $this-&gt;_compile_select();
+
+                $result = $this-&gt;query($sql);
+                $this-&gt;_reset_select();
+                return $result;
+        }
+
+        /**
+         * &quot;Count All Results&quot; query
+         *
+         * Generates a platform-specific query string that counts all records 
+         * returned by an Active Record query.
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function count_all_results($table = '')
+        {
+                if ($table != '')
+                {
+                        $this-&gt;_track_aliases($table);
+                        $this-&gt;from($table);
+                }
+                
+                $sql = $this-&gt;_compile_select($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows'));
+
+                $query = $this-&gt;query($sql);
+                $this-&gt;_reset_select();
+        
+                if ($query-&gt;num_rows() == 0)
+                {
+                        return '0';
+                }
+
+                $row = $query-&gt;row();
+                return $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get_Where
+         *
+         * Allows the where clause, limit and offset to be added directly
+         *
+         * @access        public
+         * @param        string        the where clause
+         * @param        string        the limit clause
+         * @param        string        the offset clause
+         * @return        object
+         */
+        function get_where($table = '', $where = null, $limit = null, $offset = null)
+        {
+                if ($table != '')
+                {
+                        $this-&gt;from($table);
+                }
+
+                if ( ! is_null($where))
+                {
+                        $this-&gt;where($where);
+                }
+                
+                if ( ! is_null($limit))
+                {
+                        $this-&gt;limit($limit, $offset);
+                }
+                        
+                $sql = $this-&gt;_compile_select();
+
+                $result = $this-&gt;query($sql);
+                $this-&gt;_reset_select();
+                return $result;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * getwhere() is an alias of get_where()
+         * this function is here for backwards compatibility, as
+         * getwhere() has been deprecated
+         */
+        function getwhere($table = '', $where = null, $limit = null, $offset = null)
+        {
+                return $this-&gt;get_where($table, $where, $limit, $offset);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Insert
+         *
+         * Compiles an insert string and runs the query
+         *
+         * @access        public
+         * @param        string        the table to retrieve the results from
+         * @param        array        an associative array of insert values
+         * @return        object
+         */
+        function insert($table = '', $set = NULL)
+        {        
+                if ( ! is_null($set))
+                {
+                        $this-&gt;set($set);
+                }
+        
+                if (count($this-&gt;ar_set) == 0)
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_must_use_set');
+                        }
+                        return FALSE;
+                }
+
+                if ($table == '')
+                {
+                        if ( ! isset($this-&gt;ar_from[0]))
+                        {
+                                if ($this-&gt;db_debug)
+                                {
+                                        return $this-&gt;display_error('db_must_set_table');
+                                }
+                                return FALSE;
+                        }
+                        
+                        $table = $this-&gt;ar_from[0];
+                }
+
+                $sql = $this-&gt;_insert($this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this-&gt;ar_set), array_values($this-&gt;ar_set));
+                
+                $this-&gt;_reset_write();
+                return $this-&gt;query($sql);                
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Update
+         *
+         * Compiles an update string and runs the query
+         *
+         * @access        public
+         * @param        string        the table to retrieve the results from
+         * @param        array        an associative array of update values
+         * @param        mixed        the where clause
+         * @return        object
+         */
+        function update($table = '', $set = NULL, $where = NULL, $limit = NULL)
+        {
+                // Combine any cached components with the current statements
+                $this-&gt;_merge_cache();
+
+                if ( ! is_null($set))
+                {
+                        $this-&gt;set($set);
+                }
+        
+                if (count($this-&gt;ar_set) == 0)
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_must_use_set');
+                        }
+                        return FALSE;
+                }
+
+                if ($table == '')
+                {
+                        if ( ! isset($this-&gt;ar_from[0]))
+                        {
+                                if ($this-&gt;db_debug)
+                                {
+                                        return $this-&gt;display_error('db_must_set_table');
+                                }
+                                return FALSE;
+                        }
+                        
+                        $table = $this-&gt;ar_from[0];
+                }
+                
+                if ($where != NULL)
+                {
+                        $this-&gt;where($where);
+                }
+
+                if ($limit != NULL)
+                {
+                        $this-&gt;limit($limit);
+                }
+                
+                $sql = $this-&gt;_update($this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE), $this-&gt;ar_set, $this-&gt;ar_where, $this-&gt;ar_orderby, $this-&gt;ar_limit);
+                
+                $this-&gt;_reset_write();
+                return $this-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Empty Table
+         *
+         * Compiles a delete string and runs &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table to empty
+         * @return        object
+         */
+        function empty_table($table = '')
+        {
+                if ($table == '')
+                {
+                        if ( ! isset($this-&gt;ar_from[0]))
+                        {
+                                if ($this-&gt;db_debug)
+                                {
+                                        return $this-&gt;display_error('db_must_set_table');
+                                }
+                                return FALSE;
+                        }
+
+                        $table = $this-&gt;ar_from[0];
+                }
+                else
+                {
+                        $table = $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE);
+                }
+
+                $sql = $this-&gt;_delete($table);
+
+                $this-&gt;_reset_write();
+                
+                return $this-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate
+         *
+         * Compiles a truncate string and runs the query
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table to truncate
+         * @return        object
+         */
+        function truncate($table = '')
+        {
+                if ($table == '')
+                {
+                        if ( ! isset($this-&gt;ar_from[0]))
+                        {
+                                if ($this-&gt;db_debug)
+                                {
+                                        return $this-&gt;display_error('db_must_set_table');
+                                }
+                                return FALSE;
+                        }
+
+                        $table = $this-&gt;ar_from[0];
+                }
+                else
+                {
+                        $table = $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE);
+                }
+
+                $sql = $this-&gt;_truncate($table);
+
+                $this-&gt;_reset_write();
+                
+                return $this-&gt;query($sql);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete
+         *
+         * Compiles a delete string and runs the query
+         *
+         * @access        public
+         * @param        mixed        the table(s) to delete from. String or array
+         * @param        mixed        the where clause
+         * @param        mixed        the limit clause
+         * @param        boolean
+         * @return        object
+         */
+        function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE)
+        {
+                // Combine any cached components with the current statements
+                $this-&gt;_merge_cache();
+
+                if ($table == '')
+                {
+                        if ( ! isset($this-&gt;ar_from[0]))
+                        {
+                                if ($this-&gt;db_debug)
+                                {
+                                        return $this-&gt;display_error('db_must_set_table');
+                                }
+                                return FALSE;
+                        }
+
+                        $table = $this-&gt;ar_from[0];
+                }
+                elseif (is_array($table))
+                {
+                        foreach($table as $single_table)
+                        {
+                                $this-&gt;delete($single_table, $where, $limit, FALSE);
+                        }
+
+                        $this-&gt;_reset_write();
+                        return;
+                }
+                else
+                {
+                        $table = $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE);
+                }
+
+                if ($where != '')
+                {
+                        $this-&gt;where($where);
+                }
+
+                if ($limit != NULL)
+                {
+                        $this-&gt;limit($limit);
+                }
+
+                if (count($this-&gt;ar_where) == 0 &amp;&amp; count($this-&gt;ar_wherein) == 0 &amp;&amp; count($this-&gt;ar_like) == 0)
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_del_must_use_where');
+                        }
+
+                        return FALSE;
+                }                
+
+                $sql = $this-&gt;_delete($table, $this-&gt;ar_where, $this-&gt;ar_like, $this-&gt;ar_limit);
+
+                if ($reset_data)
+                {
+                        $this-&gt;_reset_write();
+                }
+                
+                return $this-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * DB Prefix
+         *
+         * Prepends a database prefix if one exists in configuration
+         *
+         * @access        public
+         * @param        string        the table
+         * @return        string
+         */
+        function dbprefix($table = '')
+        {
+                if ($table == '')
+                {
+                        $this-&gt;display_error('db_table_name_required');
+                }
+
+                return $this-&gt;dbprefix.$table;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Track Aliases
+         *
+         * Used to track SQL statements written with aliased tables.
+         *
+         * @access        private
+         * @param        string        The table to inspect
+         * @return        string
+         */        
+        function _track_aliases($table)
+        {
+                if (is_array($table))
+                {
+                        foreach ($table as $t)
+                        {
+                                $this-&gt;_track_aliases($t);
+                        }
+                        return;
+                }
+                
+                // Does the string contain a comma?  If so, we need to separate
+                // the string into discreet statements
+                if (strpos($table, ',') !== FALSE)
+                {
+                        return $this-&gt;_track_aliases(explode(',', $table));
+                }
+        
+                // if a table alias is used we can recognize it by a space
+                if (strpos($table, &quot; &quot;) !== FALSE)
+                {
+                        // if the alias is written with the AS keyword, remove it
+                        $table = preg_replace('/ AS /i', ' ', $table);
+                        
+                        // Grab the alias
+                        $table = trim(strrchr($table, &quot; &quot;));
+                        
+                        // Store the alias, if it doesn't already exist
+                        if ( ! in_array($table, $this-&gt;ar_aliased_tables))
+                        {
+                                $this-&gt;ar_aliased_tables[] = $table;
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Compile the SELECT statement
+         *
+         * Generates a query string based on which functions were used.
+         * Should not be called directly.  The get() function calls it.
+         *
+         * @access        private
+         * @return        string
+         */
+        function _compile_select($select_override = FALSE)
+        {
+                // Combine any cached components with the current statements
+                $this-&gt;_merge_cache();
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;select&quot; portion of the query
+
+                if ($select_override !== FALSE)
+                {
+                        $sql = $select_override;
+                }
+                else
+                {
+                        $sql = ( ! $this-&gt;ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT ';
+                
+                        if (count($this-&gt;ar_select) == 0)
+                        {
+                                $sql .= '*';                
+                        }
+                        else
+                        {                                
+                                // Cycle through the &quot;select&quot; portion of the query and prep each column name.
+                                // The reason we protect identifiers here rather then in the select() function
+                                // is because until the user calls the from() function we don't know if there are aliases
+                                foreach ($this-&gt;ar_select as $key =&gt; $val)
+                                {
+                                        $this-&gt;ar_select[$key] = $this-&gt;_protect_identifiers($val);
+                                }
+                                
+                                $sql .= implode(', ', $this-&gt;ar_select);
+                        }
+                }
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;FROM&quot; portion of the query
+
+                if (count($this-&gt;ar_from) &gt; 0)
+                {
+                        $sql .= &quot;\nFROM &quot;;
+
+                        $sql .= $this-&gt;_from_tables($this-&gt;ar_from);
+                }
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;JOIN&quot; portion of the query
+
+                if (count($this-&gt;ar_join) &gt; 0)
+                {
+                        $sql .= &quot;\n&quot;;
+
+                        $sql .= implode(&quot;\n&quot;, $this-&gt;ar_join);
+                }
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;WHERE&quot; portion of the query
+
+                if (count($this-&gt;ar_where) &gt; 0 OR count($this-&gt;ar_like) &gt; 0)
+                {
+                        $sql .= &quot;\n&quot;;
+
+                        $sql .= &quot;WHERE &quot;;
+                }
+
+                $sql .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;LIKE&quot; portion of the query
+        
+                if (count($this-&gt;ar_like) &gt; 0)
+                {
+                        if (count($this-&gt;ar_where) &gt; 0)
+                        {
+                                $sql .= &quot;\nAND &quot;;
+                        }
+
+                        $sql .= implode(&quot;\n&quot;, $this-&gt;ar_like);
+                }
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;GROUP BY&quot; portion of the query
+        
+                if (count($this-&gt;ar_groupby) &gt; 0)
+                {
+                        $sql .= &quot;\nGROUP BY &quot;;
+                        
+                        $sql .= implode(', ', $this-&gt;ar_groupby);
+                }
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;HAVING&quot; portion of the query
+                
+                if (count($this-&gt;ar_having) &gt; 0)
+                {
+                        $sql .= &quot;\nHAVING &quot;;
+                        $sql .= implode(&quot;\n&quot;, $this-&gt;ar_having);
+                }
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;ORDER BY&quot; portion of the query
+
+                if (count($this-&gt;ar_orderby) &gt; 0)
+                {
+                        $sql .= &quot;\nORDER BY &quot;;
+                        $sql .= implode(', ', $this-&gt;ar_orderby);
+                        
+                        if ($this-&gt;ar_order !== FALSE)
+                        {
+                                $sql .= ($this-&gt;ar_order == 'desc') ? ' DESC' : ' ASC';
+                        }                
+                }
+
+                // ----------------------------------------------------------------
+                
+                // Write the &quot;LIMIT&quot; portion of the query
+                
+                if (is_numeric($this-&gt;ar_limit))
+                {
+                        $sql .= &quot;\n&quot;;
+                        $sql = $this-&gt;_limit($sql, $this-&gt;ar_limit, $this-&gt;ar_offset);
+                }
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Object to Array
+         *
+         * Takes an object as input and converts the class variables to array key/vals
+         *
+         * @access        public
+         * @param        object
+         * @return        array
+         */
+        function _object_to_array($object)
+        {
+                if ( ! is_object($object))
+                {
+                        return $object;
+                }
+                
+                $array = array();
+                foreach (get_object_vars($object) as $key =&gt; $val)
+                {
+                        // There are some built in keys we need to ignore for this conversion
+                        if ( ! is_object($val) &amp;&amp; ! is_array($val) &amp;&amp; $key != '_parent_name' &amp;&amp; $key != '_ci_scaffolding' &amp;&amp; $key != '_ci_scaff_table')
+                        {
+                                $array[$key] = $val;
+                        }
+                }
+        
+                return $array;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Start Cache
+         *
+         * Starts AR caching
+         *
+         * @access        public
+         * @return        void
+         */                
+        function start_cache()
+        {
+                $this-&gt;ar_caching = TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Stop Cache
+         *
+         * Stops AR caching
+         *
+         * @access        public
+         * @return        void
+         */                
+        function stop_cache()
+        {
+                $this-&gt;ar_caching = FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Flush Cache
+         *
+         * Empties the AR cache
+         *
+         * @access        public
+         * @return        void
+         */        
+        function flush_cache()
+        {        
+                $this-&gt;_reset_run(
+                                                        array(
+                                                                        'ar_cache_select'        =&gt; array(), 
+                                                                        'ar_cache_from'                =&gt; array(), 
+                                                                        'ar_cache_join'                =&gt; array(),
+                                                                        'ar_cache_where'        =&gt; array(), 
+                                                                        'ar_cache_like'                =&gt; array(), 
+                                                                        'ar_cache_groupby'        =&gt; array(), 
+                                                                        'ar_cache_having'        =&gt; array(), 
+                                                                        'ar_cache_orderby'        =&gt; array(), 
+                                                                        'ar_cache_set'                =&gt; array(),
+                                                                        'ar_cache_exists'        =&gt; array()
+                                                                )
+                                                        );        
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Merge Cache
+         *
+         * When called, this function merges any cached AR arrays with 
+         * locally called ones.
+         *
+         * @access        private
+         * @return        void
+         */
+        function _merge_cache()
+        {
+                if (count($this-&gt;ar_cache_exists) == 0)
+                {
+                        return;
+                }
+
+                foreach ($this-&gt;ar_cache_exists as $val)
+                {
+                        $ar_variable        = 'ar_'.$val;
+                        $ar_cache_var        = 'ar_cache_'.$val;
+
+                        if (count($this-&gt;$ar_cache_var) == 0)
+                        {
+                                continue;
+                        }
+
+                        $this-&gt;$ar_variable = array_unique(array_merge($this-&gt;$ar_cache_var, $this-&gt;$ar_variable));
+                }
+
+                // If we are &quot;protecting identifiers&quot; we need to examine the &quot;from&quot;
+                // portion of the query to determine if there are any aliases
+                if ($this-&gt;_protect_identifiers === TRUE AND count($this-&gt;ar_cache_from) &gt; 0)
+                {
+                        $this-&gt;_track_aliases($this-&gt;ar_from);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Resets the active record values.  Called by the get() function
+         *
+         * @access        private
+         * @param        array        An array of fields to reset
+         * @return        void
+         */
+        function _reset_run($ar_reset_items)
+        {
+                foreach ($ar_reset_items as $item =&gt; $default_value)
+                {
+                        if ( ! in_array($item, $this-&gt;ar_store_array))
+                        {
+                                $this-&gt;$item = $default_value;
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Resets the active record values.  Called by the get() function
+         *
+         * @access        private
+         * @return        void
+         */
+        function _reset_select()
+        {
+                $ar_reset_items = array(
+                                                                'ar_select'                        =&gt; array(), 
+                                                                'ar_from'                        =&gt; array(), 
+                                                                'ar_join'                        =&gt; array(), 
+                                                                'ar_where'                        =&gt; array(), 
+                                                                'ar_like'                        =&gt; array(), 
+                                                                'ar_groupby'                =&gt; array(), 
+                                                                'ar_having'                        =&gt; array(), 
+                                                                'ar_orderby'                =&gt; array(), 
+                                                                'ar_wherein'                =&gt; array(), 
+                                                                'ar_aliased_tables'        =&gt; array(),
+                                                                'ar_distinct'                =&gt; FALSE, 
+                                                                'ar_limit'                        =&gt; FALSE, 
+                                                                'ar_offset'                        =&gt; FALSE, 
+                                                                'ar_order'                        =&gt; FALSE,
+                                                        );
+                
+                $this-&gt;_reset_run($ar_reset_items);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Resets the active record &quot;write&quot; values.
+         *
+         * Called by the insert() update() and delete() functions
+         *
+         * @access        private
+         * @return        void
+         */
+        function _reset_write()
+        {        
+                $ar_reset_items = array(
+                                                                'ar_set'                =&gt; array(), 
+                                                                'ar_from'                =&gt; array(), 
+                                                                'ar_where'                =&gt; array(), 
+                                                                'ar_like'                =&gt; array(),
+                                                                'ar_orderby'        =&gt; array(), 
+                                                                'ar_limit'                =&gt; FALSE, 
+                                                                'ar_order'                =&gt; FALSE
+                                                                );
+
+                $this-&gt;_reset_run($ar_reset_items);
+        }
+        
+}
+
+/* End of file DB_active_rec.php */
+/* Location: ./system/database/DB_active_rec.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_cachephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_cache.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_cache.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_cache.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Database Cache Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_Cache {
+
+        var $CI;
+        var $db;        // allows passing of db object so that multiple database connections and returned db objects can be supported
+
+        /**
+         * Constructor
+         *
+         * Grabs the CI super object instance so we can access it.
+         *
+         */        
+        function CI_DB_Cache(&amp;$db)
+        {
+                // Assign the main CI object to $this-&gt;CI
+                // and load the file helper since we use it a lot
+                $this-&gt;CI =&amp; get_instance();
+                $this-&gt;db =&amp; $db;
+                $this-&gt;CI-&gt;load-&gt;helper('file');        
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Cache Directory Path
+         *
+         * @access        public
+         * @param        string        the path to the cache directory
+         * @return        bool
+         */                
+        function check_path($path = '')
+        {
+                if ($path == '')
+                {
+                        if ($this-&gt;db-&gt;cachedir == '')
+                        {
+                                return $this-&gt;db-&gt;cache_off();
+                        }
+                
+                        $path = $this-&gt;db-&gt;cachedir;
+                }
+        
+                // Add a trailing slash to the path if needed
+                $path = preg_replace(&quot;/(.+?)\/*$/&quot;, &quot;\\1/&quot;,  $path);
+
+                if ( ! is_dir($path) OR ! is_really_writable($path))
+                {
+                        // If the path is wrong we'll turn off caching
+                        return $this-&gt;db-&gt;cache_off();
+                }
+                
+                $this-&gt;db-&gt;cachedir = $path;
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Retrieve a cached query
+         *
+         * The URI being requested will become the name of the cache sub-folder.
+         * An MD5 hash of the SQL statement will become the cache file name
+         *
+         * @access        public
+         * @return        string
+         */
+        function read($sql)
+        {
+                if ( ! $this-&gt;check_path())
+                {
+                        return $this-&gt;db-&gt;cache_off();
+                }
+
+                $segment_one = ($this-&gt;CI-&gt;uri-&gt;segment(1) == FALSE) ? 'default' : $this-&gt;CI-&gt;uri-&gt;segment(1);
+                
+                $segment_two = ($this-&gt;CI-&gt;uri-&gt;segment(2) == FALSE) ? 'index' : $this-&gt;CI-&gt;uri-&gt;segment(2);
+        
+                $filepath = $this-&gt;db-&gt;cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql);                
+                
+                if (FALSE === ($cachedata = read_file($filepath)))
+                {        
+                        return FALSE;
+                }
+                
+                return unserialize($cachedata);                        
+        }        
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Write a query to a cache file
+         *
+         * @access        public
+         * @return        bool
+         */
+        function write($sql, $object)
+        {
+                if ( ! $this-&gt;check_path())
+                {
+                        return $this-&gt;db-&gt;cache_off();
+                }
+
+                $segment_one = ($this-&gt;CI-&gt;uri-&gt;segment(1) == FALSE) ? 'default' : $this-&gt;CI-&gt;uri-&gt;segment(1);
+                
+                $segment_two = ($this-&gt;CI-&gt;uri-&gt;segment(2) == FALSE) ? 'index' : $this-&gt;CI-&gt;uri-&gt;segment(2);
+        
+                $dir_path = $this-&gt;db-&gt;cachedir.$segment_one.'+'.$segment_two.'/';
+                
+                $filename = md5($sql);
+        
+                if ( ! @is_dir($dir_path))
+                {
+                        if ( ! @mkdir($dir_path, DIR_WRITE_MODE))
+                        {
+                                return FALSE;
+                        }
+                        
+                        @chmod($dir_path, DIR_WRITE_MODE);                        
+                }
+                
+                if (write_file($dir_path.$filename, serialize($object)) === FALSE)
+                {
+                        return FALSE;
+                }
+                
+                @chmod($dir_path.$filename, DIR_WRITE_MODE);
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete cache files within a particular directory
+         *
+         * @access        public
+         * @return        bool
+         */
+        function delete($segment_one = '', $segment_two = '')
+        {        
+                if ($segment_one == '')
+                {
+                        $segment_one  = ($this-&gt;CI-&gt;uri-&gt;segment(1) == FALSE) ? 'default' : $this-&gt;CI-&gt;uri-&gt;segment(1);
+                }
+                
+                if ($segment_two == '')
+                {
+                        $segment_two = ($this-&gt;CI-&gt;uri-&gt;segment(2) == FALSE) ? 'index' : $this-&gt;CI-&gt;uri-&gt;segment(2);
+                }
+                
+                $dir_path = $this-&gt;db-&gt;cachedir.$segment_one.'+'.$segment_two.'/';
+                
+                delete_files($dir_path, TRUE);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete all existing cache files
+         *
+         * @access        public
+         * @return        bool
+         */
+        function delete_all()
+        {
+                delete_files($this-&gt;db-&gt;cachedir, TRUE);
+        }
+
+}
+
+
+/* End of file DB_cache.php */
+/* Location: ./system/database/DB_cache.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1354 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Database Driver Class
+ *
+ * This is the platform-independent base DB implementation class.
+ * This class will not be called directly. Rather, the adapter
+ * class for the specific database will extend and instantiate it.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_driver {
+
+        var $username;
+        var $password;
+        var $hostname;
+        var $database;
+        var $dbdriver                = 'mysql';
+        var $dbprefix                = '';
+        var $char_set                = 'utf8';
+        var $dbcollat                = 'utf8_general_ci';
+        var $autoinit                = TRUE; // Whether to automatically initialize the DB
+        var $swap_pre                = '';
+        var $port                        = '';
+        var $pconnect                = FALSE;
+        var $conn_id                = FALSE;
+        var $result_id                = FALSE;
+        var $db_debug                = FALSE;
+        var $benchmark                = 0;
+        var $query_count        = 0;
+        var $bind_marker        = '?';
+        var $save_queries        = TRUE;
+        var $queries                = array();
+        var $query_times        = array();
+        var $data_cache                = array();
+        var $trans_enabled        = TRUE;
+        var $trans_strict        = TRUE;
+        var $_trans_depth        = 0;
+        var $_trans_status        = TRUE; // Used with transactions to determine if a rollback should occur
+        var $cache_on                = FALSE;
+        var $cachedir                = '';
+        var $cache_autodel        = FALSE;
+        var $CACHE; // The cache class object
+
+        // Private variables
+        var $_protect_identifiers        = TRUE;
+        var $_reserved_identifiers        = array('*'); // Identifiers that should NOT be escaped
+
+        // These are use with Oracle
+        var $stmt_id;
+        var $curs_id;
+        var $limit_used;
+
+
+        
+        /**
+         * Constructor.  Accepts one parameter containing the database
+         * connection settings.
+         *
+         * @param array
+         */        
+        function CI_DB_driver($params)
+        {
+                if (is_array($params))
+                {
+                        foreach ($params as $key =&gt; $val)
+                        {
+                                $this-&gt;$key = $val;
+                        }
+                }
+
+                log_message('debug', 'Database Driver Class Initialized');
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize Database Settings
+         *
+         * @access        private Called by the constructor
+         * @param        mixed
+         * @return        void
+         */        
+        function initialize()
+        {
+                // If an existing connection resource is available
+                // there is no need to connect and select the database
+                if (is_resource($this-&gt;conn_id) OR is_object($this-&gt;conn_id))
+                {
+                        return TRUE;
+                }
+        
+                // ----------------------------------------------------------------
+                
+                // Connect to the database and set the connection ID
+                $this-&gt;conn_id = ($this-&gt;pconnect == FALSE) ? $this-&gt;db_connect() : $this-&gt;db_pconnect();
+
+                // No connection resource?  Throw an error
+                if ( ! $this-&gt;conn_id)
+                {
+                        log_message('error', 'Unable to connect to the database');
+                        
+                        if ($this-&gt;db_debug)
+                        {
+                                $this-&gt;display_error('db_unable_to_connect');
+                        }
+                        return FALSE;
+                }
+
+                // ----------------------------------------------------------------
+
+                // Select the DB... assuming a database name is specified in the config file
+                if ($this-&gt;database != '')
+                {
+                        if ( ! $this-&gt;db_select())
+                        {
+                                log_message('error', 'Unable to select database: '.$this-&gt;database);
+                        
+                                if ($this-&gt;db_debug)
+                                {
+                                        $this-&gt;display_error('db_unable_to_select', $this-&gt;database);
+                                }
+                                return FALSE;                        
+                        }
+                        else
+                        {
+                                // We've selected the DB. Now we set the character set
+                                if ( ! $this-&gt;db_set_charset($this-&gt;char_set, $this-&gt;dbcollat))
+                                {
+                                        return FALSE;
+                                }
+                
+                                return TRUE;
+                        }
+                }
+
+                return TRUE;
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Set client character set
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function db_set_charset($charset, $collation)
+        {
+                if ( ! $this-&gt;_db_set_charset($this-&gt;char_set, $this-&gt;dbcollat))
+                {
+                        log_message('error', 'Unable to set database connection charset: '.$this-&gt;char_set);
+                
+                        if ($this-&gt;db_debug)
+                        {
+                                $this-&gt;display_error('db_unable_to_set_charset', $this-&gt;char_set);
+                        }
+                        
+                        return FALSE;
+                }
+                
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The name of the platform in use (mysql, mssql, etc...)
+         *
+         * @access        public
+         * @return        string                
+         */        
+        function platform()
+        {
+                return $this-&gt;dbdriver;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Database Version Number.  Returns a string containing the
+         * version of the database being used
+         *
+         * @access        public
+         * @return        string        
+         */        
+        function version()
+        {
+                if (FALSE === ($sql = $this-&gt;_version()))
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_unsupported_function');
+                        }
+                        return FALSE;
+                }
+                
+                if ($this-&gt;dbdriver == 'oci8')
+                {
+                        return $sql;
+                }
+        
+                $query = $this-&gt;query($sql);
+                return $query-&gt;row('ver');
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Execute the query
+         *
+         * Accepts an SQL string as input and returns a result object upon
+         * successful execution of a &quot;read&quot; type query.  Returns boolean TRUE
+         * upon successful execution of a &quot;write&quot; type query. Returns boolean
+         * FALSE upon failure, and if the $db_debug variable is set to TRUE
+         * will raise an error.
+         *
+         * @access        public
+         * @param        string        An SQL query string
+         * @param        array        An array of binding data
+         * @return        mixed                
+         */        
+        function query($sql, $binds = FALSE, $return_object = TRUE)
+        {
+                if ($sql == '')
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                log_message('error', 'Invalid query: '.$sql);
+                                return $this-&gt;display_error('db_invalid_query');
+                        }
+                        return FALSE;
+                }
+
+                // Verify table prefix and replace if necessary
+                if ( ($this-&gt;dbprefix != '' AND $this-&gt;swap_pre != '') AND ($this-&gt;dbprefix != $this-&gt;swap_pre) )
+                {                        
+                        $sql = preg_replace(&quot;/(\W)&quot;.$this-&gt;swap_pre.&quot;(\S+?)/&quot;, &quot;\\1&quot;.$this-&gt;dbprefix.&quot;\\2&quot;, $sql);
+                }
+                
+                // Is query caching enabled?  If the query is a &quot;read type&quot;
+                // we will load the caching class and return the previously
+                // cached query if it exists
+                if ($this-&gt;cache_on == TRUE AND stristr($sql, 'SELECT'))
+                {
+                        if ($this-&gt;_cache_init())
+                        {
+                                $this-&gt;load_rdriver();
+                                if (FALSE !== ($cache = $this-&gt;CACHE-&gt;read($sql)))
+                                {
+                                        return $cache;
+                                }
+                        }
+                }
+                
+                // Compile binds if needed
+                if ($binds !== FALSE)
+                {
+                        $sql = $this-&gt;compile_binds($sql, $binds);
+                }
+
+                // Save the  query for debugging
+                if ($this-&gt;save_queries == TRUE)
+                {
+                        $this-&gt;queries[] = $sql;
+                }
+                
+                // Start the Query Timer
+                $time_start = list($sm, $ss) = explode(' ', microtime());
+        
+                // Run the Query
+                if (FALSE === ($this-&gt;result_id = $this-&gt;simple_query($sql)))
+                {
+                        if ($this-&gt;save_queries == TRUE)
+                        {
+                                $this-&gt;query_times[] = 0;
+                        }
+                
+                        // This will trigger a rollback if transactions are being used
+                        $this-&gt;_trans_status = FALSE;
+
+                        if ($this-&gt;db_debug)
+                        {
+                                // grab the error number and message now, as we might run some
+                                // additional queries before displaying the error
+                                $error_no = $this-&gt;_error_number();
+                                $error_msg = $this-&gt;_error_message();
+                                
+                                // We call this function in order to roll-back queries
+                                // if transactions are enabled.  If we don't call this here
+                                // the error message will trigger an exit, causing the 
+                                // transactions to remain in limbo.
+                                $this-&gt;trans_complete();
+
+                                // Log and display errors
+                                log_message('error', 'Query error: '.$error_msg);
+                                return $this-&gt;display_error(
+                                                                                array(
+                                                                                                'Error Number: '.$error_no,
+                                                                                                $error_msg,
+                                                                                                $sql
+                                                                                        )
+                                                                                );
+                        }
+                
+                        return FALSE;
+                }
+                
+                // Stop and aggregate the query time results
+                $time_end = list($em, $es) = explode(' ', microtime());
+                $this-&gt;benchmark += ($em + $es) - ($sm + $ss);
+
+                if ($this-&gt;save_queries == TRUE)
+                {
+                        $this-&gt;query_times[] = ($em + $es) - ($sm + $ss);
+                }
+                
+                // Increment the query counter
+                $this-&gt;query_count++;
+                
+                // Was the query a &quot;write&quot; type?
+                // If so we'll simply return true
+                if ($this-&gt;is_write_type($sql) === TRUE)
+                {
+                        // If caching is enabled we'll auto-cleanup any
+                        // existing files related to this particular URI
+                        if ($this-&gt;cache_on == TRUE AND $this-&gt;cache_autodel == TRUE AND $this-&gt;_cache_init())
+                        {
+                                $this-&gt;CACHE-&gt;delete();
+                        }
+                
+                        return TRUE;
+                }
+                
+                // Return TRUE if we don't need to create a result object
+                // Currently only the Oracle driver uses this when stored
+                // procedures are used
+                if ($return_object !== TRUE)
+                {
+                        return TRUE;
+                }
+        
+                // Load and instantiate the result driver        
+                
+                $driver                 = $this-&gt;load_rdriver();
+                $RES                         = new $driver();
+                $RES-&gt;conn_id        = $this-&gt;conn_id;
+                $RES-&gt;result_id        = $this-&gt;result_id;
+
+                if ($this-&gt;dbdriver == 'oci8')
+                {
+                        $RES-&gt;stmt_id                = $this-&gt;stmt_id;
+                        $RES-&gt;curs_id                = NULL;
+                        $RES-&gt;limit_used        = $this-&gt;limit_used;
+                        $this-&gt;stmt_id                = FALSE;
+                }
+                
+                // oci8 vars must be set before calling this
+                $RES-&gt;num_rows        = $RES-&gt;num_rows();
+                                
+                // Is query caching enabled?  If so, we'll serialize the
+                // result object and save it to a cache file.
+                if ($this-&gt;cache_on == TRUE AND $this-&gt;_cache_init())
+                {
+                        // We'll create a new instance of the result object
+                        // only without the platform specific driver since
+                        // we can't use it with cached data (the query result
+                        // resource ID won't be any good once we've cached the
+                        // result object, so we'll have to compile the data
+                        // and save it)
+                        $CR = new CI_DB_result();
+                        $CR-&gt;num_rows                 = $RES-&gt;num_rows();
+                        $CR-&gt;result_object        = $RES-&gt;result_object();
+                        $CR-&gt;result_array        = $RES-&gt;result_array();
+                        
+                        // Reset these since cached objects can not utilize resource IDs.
+                        $CR-&gt;conn_id                = NULL;
+                        $CR-&gt;result_id                = NULL;
+
+                        $this-&gt;CACHE-&gt;write($sql, $CR);
+                }
+                
+                return $RES;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Load the result drivers
+         *
+         * @access        public
+         * @return        string         the name of the result class                
+         */                
+        function load_rdriver()
+        {
+                $driver = 'CI_DB_'.$this-&gt;dbdriver.'_result';
+
+                if ( ! class_exists($driver))
+                {
+                        include_once(BASEPATH.'database/DB_result'.EXT);
+                        include_once(BASEPATH.'database/drivers/'.$this-&gt;dbdriver.'/'.$this-&gt;dbdriver.'_result'.EXT);
+                }
+                
+                return $driver;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Simple Query
+         * This is a simplified version of the query() function.  Internally
+         * we only use it when running transaction commands since they do
+         * not require all the features of the main query() function.
+         *
+         * @access        public
+         * @param        string        the sql query
+         * @return        mixed                
+         */        
+        function simple_query($sql)
+        {
+                if ( ! $this-&gt;conn_id)
+                {
+                        $this-&gt;initialize();
+                }
+
+                return $this-&gt;_execute($sql);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Disable Transactions
+         * This permits transactions to be disabled at run-time.
+         *
+         * @access        public
+         * @return        void                
+         */        
+        function trans_off()
+        {
+                $this-&gt;trans_enabled = FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Enable/disable Transaction Strict Mode
+         * When strict mode is enabled, if you are running multiple groups of
+         * transactions, if one group fails all groups will be rolled back.
+         * If strict mode is disabled, each group is treated autonomously, meaning
+         * a failure of one group will not affect any others
+         *
+         * @access        public
+         * @return        void                
+         */        
+        function trans_strict($mode = TRUE)
+        {
+                $this-&gt;trans_strict = is_bool($mode) ? $mode : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Start Transaction
+         *
+         * @access        public
+         * @return        void                
+         */        
+        function trans_start($test_mode = FALSE)
+        {        
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return FALSE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        $this-&gt;_trans_depth += 1;
+                        return;
+                }
+                
+                $this-&gt;trans_begin($test_mode);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Complete Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_complete()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return FALSE;
+                }
+        
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 1)
+                {
+                        $this-&gt;_trans_depth -= 1;
+                        return TRUE;
+                }
+        
+                // The query() function will set this flag to FALSE in the event that a query failed
+                if ($this-&gt;_trans_status === FALSE)
+                {
+                        $this-&gt;trans_rollback();
+                        
+                        // If we are NOT running in strict mode, we will reset
+                        // the _trans_status flag so that subsequent groups of transactions
+                        // will be permitted.
+                        if ($this-&gt;trans_strict === FALSE)
+                        {
+                                $this-&gt;_trans_status = TRUE;
+                        }
+
+                        log_message('debug', 'DB Transaction Failure');
+                        return FALSE;
+                }
+                
+                $this-&gt;trans_commit();
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Lets you retrieve the transaction flag to determine if it has failed
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_status()
+        {
+                return $this-&gt;_trans_status;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Compile Bindings
+         *
+         * @access        public
+         * @param        string        the sql statement
+         * @param        array        an array of bind data
+         * @return        string                
+         */        
+        function compile_binds($sql, $binds)
+        {
+                if (strpos($sql, $this-&gt;bind_marker) === FALSE)
+                {
+                        return $sql;
+                }
+                
+                if ( ! is_array($binds))
+                {
+                        $binds = array($binds);
+                }
+                
+                // Get the sql segments around the bind markers
+                $segments = explode($this-&gt;bind_marker, $sql);
+
+                // The count of bind should be 1 less then the count of segments
+                // If there are more bind arguments trim it down
+                if (count($binds) &gt;= count($segments)) {
+                        $binds = array_slice($binds, 0, count($segments)-1);
+                }
+
+                // Construct the binded query
+                $result = $segments[0];
+                $i = 0;
+                foreach ($binds as $bind)
+                {
+                        $result .= $this-&gt;escape($bind);
+                        $result .= $segments[++$i];
+                }
+
+                return $result;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Determines if a query is a &quot;write&quot; type.
+         *
+         * @access        public
+         * @param        string        An SQL query string
+         * @return        boolean                
+         */        
+        function is_write_type($sql)
+        {
+                if ( ! preg_match('/^\s*&quot;?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))
+                {
+                        return FALSE;
+                }
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Calculate the aggregate query elapsed time
+         *
+         * @access        public
+         * @param        integer        The number of decimal places
+         * @return        integer                
+         */        
+        function elapsed_time($decimals = 6)
+        {
+                return number_format($this-&gt;benchmark, $decimals);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns the total number of queries
+         *
+         * @access        public
+         * @return        integer                
+         */        
+        function total_queries()
+        {
+                return $this-&gt;query_count;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns the last query that was executed
+         *
+         * @access        public
+         * @return        void                
+         */        
+        function last_query()
+        {
+                return end($this-&gt;queries);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Smart&quot; Escape String
+         *
+         * Escapes data based on type
+         * Sets boolean and null types
+         *
+         * @access        public
+         * @param        string
+         * @return        mixed                
+         */        
+        function escape($str)
+        {
+                if (is_string($str))
+                {
+                        $str = &quot;'&quot;.$this-&gt;escape_str($str).&quot;'&quot;;
+                }
+                elseif (is_bool($str))
+                {
+                        $str = ($str === FALSE) ? 0 : 1;
+                }
+                elseif (is_null($str))
+                {
+                        $str = 'NULL';
+                }
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Escape LIKE String
+         *
+         * Calls the individual driver for platform
+         * specific escaping for LIKE conditions
+         * 
+         * @access        public
+         * @param        string
+         * @return        mixed
+         */
+    function escape_like_str($str)    
+    {    
+            return $this-&gt;escape_str($str, TRUE);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Primary
+         *
+         * Retrieves the primary key.  It assumes that the row in the first
+         * position is the primary key
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string                
+         */        
+        function primary($table = '')
+        {        
+                $fields = $this-&gt;list_fields($table);
+                
+                if ( ! is_array($fields))
+                {
+                        return FALSE;
+                }
+
+                return current($fields);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns an array of table names
+         *
+         * @access        public
+         * @return        array                
+         */        
+        function list_tables($constrain_by_prefix = FALSE)
+        {
+                // Is there a cached result?
+                if (isset($this-&gt;data_cache['table_names']))
+                {
+                        return $this-&gt;data_cache['table_names'];
+                }
+        
+                if (FALSE === ($sql = $this-&gt;_list_tables($constrain_by_prefix)))
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_unsupported_function');
+                        }
+                        return FALSE;
+                }
+
+                $retval = array();
+                $query = $this-&gt;query($sql);
+                
+                if ($query-&gt;num_rows() &gt; 0)
+                {
+                        foreach($query-&gt;result_array() as $row)
+                        {
+                                if (isset($row['TABLE_NAME']))
+                                {
+                                        $retval[] = $row['TABLE_NAME'];
+                                }
+                                else
+                                {
+                                        $retval[] = array_shift($row);
+                                }
+                        }
+                }
+
+                $this-&gt;data_cache['table_names'] = $retval;
+                return $this-&gt;data_cache['table_names'];
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Determine if a particular table exists
+         * @access        public
+         * @return        boolean
+         */
+        function table_exists($table_name)
+        {        
+                return ( ! in_array($this-&gt;_protect_identifiers($table_name, TRUE, FALSE, FALSE), $this-&gt;list_tables())) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch MySQL Field Names
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        array                
+         */
+        function list_fields($table = '')
+        {
+                // Is there a cached result?
+                if (isset($this-&gt;data_cache['field_names'][$table]))
+                {
+                        return $this-&gt;data_cache['field_names'][$table];
+                }
+        
+                if ($table == '')
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_field_param_missing');
+                        }
+                        return FALSE;
+                }
+                
+                if (FALSE === ($sql = $this-&gt;_list_columns($this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE))))
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_unsupported_function');
+                        }
+                        return FALSE;
+                }
+                
+                $query = $this-&gt;query($sql);
+                
+                $retval = array();
+                foreach($query-&gt;result_array() as $row)
+                {
+                        if (isset($row['COLUMN_NAME']))
+                        {
+                                $retval[] = $row['COLUMN_NAME'];
+                        }
+                        else
+                        {
+                                $retval[] = current($row);
+                        }                
+                }
+                
+                $this-&gt;data_cache['field_names'][$table] = $retval;
+                return $this-&gt;data_cache['field_names'][$table];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Determine if a particular field exists
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        boolean
+         */
+        function field_exists($field_name, $table_name)
+        {        
+                return ( ! in_array($field_name, $this-&gt;list_fields($table_name))) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns an object with field data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        object                
+         */        
+        function field_data($table = '')
+        {
+                if ($table == '')
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_field_param_missing');
+                        }
+                        return FALSE;
+                }
+                
+                $query = $this-&gt;query($this-&gt;_field_data($this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE)));
+
+                return $query-&gt;field_data();
+        }        
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Generate an insert string
+         *
+         * @access        public
+         * @param        string        the table upon which the query will be performed
+         * @param        array        an associative array data of key/values
+         * @return        string                
+         */        
+        function insert_string($table, $data)
+        {
+                $fields = array();
+                $values = array();
+                
+                foreach($data as $key =&gt; $val)
+                {
+                        $fields[] = $this-&gt;_escape_identifiers($key);
+                        $values[] = $this-&gt;escape($val);
+                }
+                                
+                return $this-&gt;_insert($this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE), $fields, $values);
+        }        
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate an update string
+         *
+         * @access        public
+         * @param        string        the table upon which the query will be performed
+         * @param        array        an associative array data of key/values
+         * @param        mixed        the &quot;where&quot; statement
+         * @return        string                
+         */        
+        function update_string($table, $data, $where)
+        {
+                if ($where == '')
+                {
+                        return false;
+                }
+                                        
+                $fields = array();
+                foreach($data as $key =&gt; $val)
+                {
+                        $fields[$this-&gt;_protect_identifiers($key)] = $this-&gt;escape($val);
+                }
+
+                if ( ! is_array($where))
+                {
+                        $dest = array($where);
+                }
+                else
+                {
+                        $dest = array();
+                        foreach ($where as $key =&gt; $val)
+                        {
+                                $prefix = (count($dest) == 0) ? '' : ' AND ';
+        
+                                if ($val !== '')
+                                {
+                                        if ( ! $this-&gt;_has_operator($key))
+                                        {
+                                                $key .= ' =';
+                                        }
+                                
+                                        $val = ' '.$this-&gt;escape($val);
+                                }
+                                                        
+                                $dest[] = $prefix.$key.$val;
+                        }
+                }                
+
+                return $this-&gt;_update($this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE), $fields, $dest);
+        }        
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Tests whether the string has an SQL operator
+         *
+         * @access        private
+         * @param        string
+         * @return        bool
+         */
+        function _has_operator($str)
+        {
+                $str = trim($str);
+                if ( ! preg_match(&quot;/(\s|&lt;|&gt;|!|=|is null|is not null)/i&quot;, $str))
+                {
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Enables a native PHP function to be run, using a platform agnostic wrapper.
+         *
+         * @access        public
+         * @param        string        the function name
+         * @param        mixed        any parameters needed by the function
+         * @return        mixed                
+         */        
+        function call_function($function)
+        {
+                $driver = ($this-&gt;dbdriver == 'postgre') ? 'pg_' : $this-&gt;dbdriver.'_';
+        
+                if (FALSE === strpos($driver, $function))
+                {
+                        $function = $driver.$function;
+                }
+                
+                if ( ! function_exists($function))
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                return $this-&gt;display_error('db_unsupported_function');
+                        }
+                        return FALSE;
+                }
+                else
+                {
+                        $args = (func_num_args() &gt; 1) ? array_splice(func_get_args(), 1) : null;
+
+                        return call_user_func_array($function, $args);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Cache Directory Path
+         *
+         * @access        public
+         * @param        string        the path to the cache directory
+         * @return        void
+         */                
+        function cache_set_path($path = '')
+        {
+                $this-&gt;cachedir = $path;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Enable Query Caching
+         *
+         * @access        public
+         * @return        void
+         */                
+        function cache_on()
+        {
+                $this-&gt;cache_on = TRUE;
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Disable Query Caching
+         *
+         * @access        public
+         * @return        void
+         */        
+        function cache_off()
+        {
+                $this-&gt;cache_on = FALSE;
+                return FALSE;
+        }
+        
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete the cache files associated with a particular URI
+         *
+         * @access        public
+         * @return        void
+         */                
+        function cache_delete($segment_one = '', $segment_two = '')
+        {
+                if ( ! $this-&gt;_cache_init())
+                {
+                        return FALSE;
+                }
+                return $this-&gt;CACHE-&gt;delete($segment_one, $segment_two);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete All cache files
+         *
+         * @access        public
+         * @return        void
+         */                
+        function cache_delete_all()
+        {
+                if ( ! $this-&gt;_cache_init())
+                {
+                        return FALSE;
+                }
+
+                return $this-&gt;CACHE-&gt;delete_all();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize the Cache Class
+         *
+         * @access        private
+         * @return        void
+         */        
+        function _cache_init()
+        {
+                if (is_object($this-&gt;CACHE) AND class_exists('CI_DB_Cache'))
+                {
+                        return TRUE;
+                }
+
+                if ( ! class_exists('CI_DB_Cache'))
+                {
+                        if ( ! @include(BASEPATH.'database/DB_cache'.EXT))
+                        {
+                                return $this-&gt;cache_off();
+                        }
+                }
+
+                $this-&gt;CACHE = new CI_DB_Cache($this); // pass db object to support multiple db connections and returned db objects
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access        public
+         * @return        void                
+         */        
+        function close()
+        {
+                if (is_resource($this-&gt;conn_id) OR is_object($this-&gt;conn_id))
+                {
+                        $this-&gt;_close($this-&gt;conn_id);
+                }
+                $this-&gt;conn_id = FALSE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Display an error message
+         *
+         * @access        public
+         * @param        string        the error message
+         * @param        string        any &quot;swap&quot; values
+         * @param        boolean        whether to localize the message
+         * @return        string        sends the application/error_db.php template                
+         */        
+        function display_error($error = '', $swap = '', $native = FALSE)
+        {
+                $LANG =&amp; load_class('Language');
+                $LANG-&gt;load('db');
+
+                $heading = $LANG-&gt;line('db_error_heading');
+
+                if ($native == TRUE)
+                {
+                        $message = $error;
+                }
+                else
+                {
+                        $message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG-&gt;line($error))) : $error;
+                }
+                
+                $error =&amp; load_class('Exceptions');
+                echo $error-&gt;show_error($heading, $message, 'error_db');
+                exit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Protect Identifiers
+         *
+         * This function adds backticks if appropriate based on db type
+         *
+         * @access        private
+         * @param        mixed        the item to escape
+         * @return        mixed        the item with backticks
+         */
+        function protect_identifiers($item, $prefix_single = FALSE)
+        {
+                return $this-&gt;_protect_identifiers($item, $prefix_single);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Protect Identifiers
+         *
+         * This function is used extensively by the Active Record class, and by
+         * a couple functions in this class. 
+         * It takes a column or table name (optionally with an alias) and inserts
+         * the table prefix onto it.  Some logic is necessary in order to deal with
+         * column names that include the path.  Consider a query like this:
+         *
+         * SELECT * FROM hostname.database.table.column AS c FROM hostname.database.table
+         *
+         * Or a query with aliasing:
+         *
+         * SELECT m.member_id, m.member_name FROM members AS m
+         *
+         * Since the column name can include up to four segments (host, DB, table, column)
+         * or also have an alias prefix, we need to do a bit of work to figure this out and
+         * insert the table prefix (if it exists) in the proper position, and escape only
+         * the correct identifiers.
+         *
+         * @access        private
+         * @param        string
+         * @param        bool
+         * @param        mixed
+         * @param        bool
+         * @return        string
+         */        
+        function _protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL, $field_exists = TRUE)
+        {
+                if ( ! is_bool($protect_identifiers))
+                {
+                        $protect_identifiers = $this-&gt;_protect_identifiers;
+                }
+
+                if (is_array($item))
+                {
+                        $escaped_array = array();
+
+                        foreach($item as $k =&gt; $v)
+                        {
+                                $escaped_array[$this-&gt;_protect_identifiers($k)] = $this-&gt;_protect_identifiers($v);
+                        }
+
+                        return $escaped_array;
+                }
+
+                // Convert tabs or multiple spaces into single spaces
+                $item = preg_replace('/[\t ]+/', ' ', $item);
+        
+                // If the item has an alias declaration we remove it and set it aside.
+                // Basically we remove everything to the right of the first space
+                $alias = '';
+                if (strpos($item, ' ') !== FALSE)
+                {
+                        $alias = strstr($item, &quot; &quot;);
+                        $item = substr($item, 0, - strlen($alias));
+                }
+
+                // This is basically a bug fix for queries that use MAX, MIN, etc.
+                // If a parenthesis is found we know that we do not need to 
+                // escape the data or add a prefix.  There's probably a more graceful
+                // way to deal with this, but I'm not thinking of it -- Rick
+                if (strpos($item, '(') !== FALSE)
+                {
+                        return $item.$alias;
+                }
+
+                // Break the string apart if it contains periods, then insert the table prefix
+                // in the correct location, assuming the period doesn't indicate that we're dealing
+                // with an alias. While we're at it, we will escape the components
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $parts        = explode('.', $item);
+                        
+                        // Does the first segment of the exploded item match
+                        // one of the aliases previously identified?  If so,
+                        // we have nothing more to do other than escape the item
+                        if (in_array($parts[0], $this-&gt;ar_aliased_tables))
+                        {
+                                if ($protect_identifiers === TRUE)
+                                {
+                                        foreach ($parts as $key =&gt; $val)
+                                        {
+                                                if ( ! in_array($val, $this-&gt;_reserved_identifiers))
+                                                {
+                                                        $parts[$key] = $this-&gt;_escape_identifiers($val);
+                                                }
+                                        }
+                                
+                                        $item = implode('.', $parts);
+                                }                        
+                                return $item.$alias;
+                        }
+                        
+                        // Is there a table prefix defined in the config file?  If not, no need to do anything
+                        if ($this-&gt;dbprefix != '')
+                        {
+                                // We now add the table prefix based on some logic.
+                                // Do we have 4 segments (hostname.database.table.column)?
+                                // If so, we add the table prefix to the column name in the 3rd segment.
+                                if (isset($parts[3]))
+                                {
+                                        $i = 2;
+                                }
+                                // Do we have 3 segments (database.table.column)?
+                                // If so, we add the table prefix to the column name in 2nd position
+                                elseif (isset($parts[2]))
+                                {
+                                        $i = 1;
+                                }
+                                // Do we have 2 segments (table.column)?
+                                // If so, we add the table prefix to the column name in 1st segment
+                                else
+                                {
+                                        $i = 0;
+                                }
+                                
+                                // This flag is set when the supplied $item does not contain a field name.
+                                // This can happen when this function is being called from a JOIN.
+                                if ($field_exists == FALSE)
+                                {
+                                        $i++;
+                                }
+                                
+                                // We only add the table prefix if it does not already exist
+                                if (substr($parts[$i], 0, strlen($this-&gt;dbprefix)) != $this-&gt;dbprefix)
+                                {
+                                        $parts[$i] = $this-&gt;dbprefix.$parts[$i];
+                                }
+                                
+                                // Put the parts back together
+                                $item = implode('.', $parts);
+                        }
+                        
+                        if ($protect_identifiers === TRUE)
+                        {
+                                $item = $this-&gt;_escape_identifiers($item);
+                        }
+                        
+                        return $item.$alias;
+                }
+
+                // Is there a table prefix?  If not, no need to insert it
+                if ($this-&gt;dbprefix != '')
+                {
+                        // Do we prefix an item with no segments?
+                        if ($prefix_single == TRUE AND substr($item, 0, strlen($this-&gt;dbprefix)) != $this-&gt;dbprefix)
+                        {
+                                $item = $this-&gt;dbprefix.$item;
+                        }                
+                }
+
+                if ($protect_identifiers === TRUE AND ! in_array($item, $this-&gt;_reserved_identifiers))
+                {
+                        $item = $this-&gt;_escape_identifiers($item);
+                }
+                
+                return $item.$alias;
+        }
+
+
+}
+
+
+/* End of file DB_driver.php */
+/* Location: ./system/database/DB_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,375 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * Code Igniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Database Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_forge {
+
+        var $fields                         = array();
+        var $keys                        = array();
+        var $primary_keys         = array();
+        var $db_char_set        =        '';
+
+        /**
+         * Constructor
+         *
+         * Grabs the CI super object instance so we can access it.
+         *
+         */        
+        function CI_DB_forge()
+        {
+                // Assign the main database object to $this-&gt;db
+                $CI =&amp; get_instance();
+                $this-&gt;db =&amp; $CI-&gt;db;
+                log_message('debug', &quot;Database Forge Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create database
+         *
+         * @access        public
+         * @param        string        the database name
+         * @return        bool
+         */
+        function create_database($db_name)
+        {
+                $sql = $this-&gt;_create_database($db_name);
+                
+                if (is_bool($sql))
+                {
+                        return $sql;
+                }
+        
+                return $this-&gt;db-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        public
+         * @param        string        the database name
+         * @return        bool
+         */
+        function drop_database($db_name)
+        {
+                $sql = $this-&gt;_drop_database($db_name);
+                
+                if (is_bool($sql))
+                {
+                        return $sql;
+                }
+        
+                return $this-&gt;db-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add Key
+         *
+         * @access        public
+         * @param        string        key
+         * @param        string        type
+         * @return        void
+         */
+        function add_key($key = '', $primary = FALSE)
+        {
+                if (is_array($key))
+                {
+                        foreach($key as $one)
+                        {
+                                $this-&gt;add_key($one, $primary);
+                        }
+                        
+                        return;
+                }
+        
+                if ($key == '')
+                {
+                        show_error('Key information is required for that operation.');
+                }
+                
+                if ($primary === TRUE)
+                {
+                        $this-&gt;primary_keys[] = $key;
+                }
+                else
+                {
+                        $this-&gt;keys[] = $key;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add Field
+         *
+         * @access        public
+         * @param        string        collation
+         * @return        void
+         */
+        function add_field($field = '')
+        {
+                if ($field == '')
+                {
+                        show_error('Field information is required.');
+                }
+                
+                if (is_string($field))
+                {
+                        if ($field == 'id')
+                        {
+                                $this-&gt;add_field(array(
+                                                                                'id' =&gt; array(
+                                                                                                        'type' =&gt; 'INT',
+                                                                                                        'constraint' =&gt; 9,
+                                                                                                        'auto_increment' =&gt; TRUE
+                                                                                                        )
+                                                                ));
+                                $this-&gt;add_key('id', TRUE);
+                        }
+                        else
+                        {
+                                if (strpos($field, ' ') === FALSE)
+                                {
+                                        show_error('Field information is required for that operation.');
+                                }
+                                
+                                $this-&gt;fields[] = $field;
+                        }
+                }
+                
+                if (is_array($field))
+                {
+                        $this-&gt;fields = array_merge($this-&gt;fields, $field);
+                }
+                
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        bool
+         */
+        function create_table($table = '', $if_not_exists = FALSE)
+        {        
+                if ($table == '')
+                {
+                        show_error('A table name is required for that operation.');
+                }
+                        
+                if (count($this-&gt;fields) == 0)
+                {        
+                        show_error('Field information is required.');
+                }
+
+                $sql = $this-&gt;_create_table($this-&gt;db-&gt;dbprefix.$table, $this-&gt;fields, $this-&gt;primary_keys, $this-&gt;keys, $if_not_exists);
+                
+                $this-&gt;_reset();
+                return $this-&gt;db-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        bool
+         */
+        function drop_table($table_name)
+        {
+                $sql = $this-&gt;_drop_table($this-&gt;db-&gt;dbprefix.$table_name);
+                
+                if (is_bool($sql))
+                {
+                        return $sql;
+                }
+        
+                return $this-&gt;db-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename Table
+         *
+         * @access        public
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        bool
+         */
+        function rename_table($table_name, $new_table_name)
+        {
+                if ($table_name == '' OR $new_table_name == '')
+                {
+                        show_error('A table name is required for that operation.');
+                }
+                        
+                $sql = $this-&gt;_rename_table($table_name, $new_table_name);
+                return $this-&gt;db-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Column Add
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        string        the column name
+         * @param        string        the column definition
+         * @return        bool
+         */
+        function add_column($table = '', $field = array(), $after_field = '')
+        {
+                if ($table == '')
+                {
+                        show_error('A table name is required for that operation.');
+                }
+
+                // add field info into field array, but we can only do one at a time
+                // so we cycle through
+
+                foreach ($field as $k =&gt; $v)
+                {
+                        $this-&gt;add_field(array($k =&gt; $field[$k]));                
+
+                        if (count($this-&gt;fields) == 0)
+                        {        
+                                show_error('Field information is required.');
+                        }
+                        
+                        $sql = $this-&gt;_alter_table('ADD', $this-&gt;db-&gt;dbprefix.$table, $this-&gt;fields, $after_field);
+
+                        $this-&gt;_reset();
+        
+                        if ($this-&gt;db-&gt;query($sql) === FALSE)
+                        {
+                                return FALSE;
+                        }
+                }
+                
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Column Drop
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        string        the column name
+         * @return        bool
+         */
+        function drop_column($table = '', $column_name = '')
+        {
+        
+                if ($table == '')
+                {
+                        show_error('A table name is required for that operation.');
+                }
+
+                if ($column_name == '')
+                {
+                        show_error('A column name is required for that operation.');
+                }
+
+                $sql = $this-&gt;_alter_table('DROP', $this-&gt;db-&gt;dbprefix.$table, $column_name);
+        
+                return $this-&gt;db-&gt;query($sql);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Column Modify
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        string        the column name
+         * @param        string        the column definition
+         * @return        bool
+         */
+        function modify_column($table = '', $field = array())
+        {
+                if ($table == '')
+                {
+                        show_error('A table name is required for that operation.');
+                }
+
+                // add field info into field array, but we can only do one at a time
+                // so we cycle through
+
+                foreach ($field as $k =&gt; $v)
+                {
+                        $this-&gt;add_field(array($k =&gt; $field[$k]));
+
+                        if (count($this-&gt;fields) == 0)
+                        {        
+                                show_error('Field information is required.');
+                        }
+                
+                        $sql = $this-&gt;_alter_table('CHANGE', $this-&gt;db-&gt;dbprefix.$table, $this-&gt;fields);
+
+                        $this-&gt;_reset();
+        
+                        if ($this-&gt;db-&gt;query($sql) === FALSE)
+                        {
+                                return FALSE;
+                        }
+                }
+                
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Reset
+         *
+         * Resets table creation vars
+         *
+         * @access        private
+         * @return        void
+         */
+        function _reset()
+        {
+                $this-&gt;fields                 = array();
+                $this-&gt;keys                        = array();
+                $this-&gt;primary_keys         = array();
+        }
+
+}
+
+/* End of file DB_forge.php */
+/* Location: ./system/database/DB_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,342 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Database Result Class
+ *
+ * This is the platform-independent result class.
+ * This class will not be called directly. Rather, the adapter
+ * class for the specific database will extend and instantiate it.
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_result {
+
+        var $conn_id                = NULL;
+        var $result_id                = NULL;
+        var $result_array        = array();
+        var $result_object        = array();
+        var $current_row         = 0;
+        var $num_rows                = 0;
+        var $row_data                = NULL;
+
+
+        /**
+         * Query result.  Acts as a wrapper function for the following functions.
+         *
+         * @access        public
+         * @param        string        can be &quot;object&quot; or &quot;array&quot;
+         * @return        mixed        either a result object or array        
+         */        
+        function result($type = 'object')
+        {        
+                return ($type == 'object') ? $this-&gt;result_object() : $this-&gt;result_array();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Query result.  &quot;object&quot; version.
+         *
+         * @access        public
+         * @return        object
+         */        
+        function result_object()
+        {
+                if (count($this-&gt;result_object) &gt; 0)
+                {
+                        return $this-&gt;result_object;
+                }
+                
+                // In the event that query caching is on the result_id variable 
+                // will return FALSE since there isn't a valid SQL resource so 
+                // we'll simply return an empty array.
+                if ($this-&gt;result_id === FALSE OR $this-&gt;num_rows() == 0)
+                {
+                        return array();
+                }
+
+                $this-&gt;_data_seek(0);
+                while ($row = $this-&gt;_fetch_object())
+                {
+                        $this-&gt;result_object[] = $row;
+                }
+                
+                return $this-&gt;result_object;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Query result.  &quot;array&quot; version.
+         *
+         * @access        public
+         * @return        array
+         */        
+        function result_array()
+        {
+                if (count($this-&gt;result_array) &gt; 0)
+                {
+                        return $this-&gt;result_array;
+                }
+
+                // In the event that query caching is on the result_id variable 
+                // will return FALSE since there isn't a valid SQL resource so 
+                // we'll simply return an empty array.
+                if ($this-&gt;result_id === FALSE OR $this-&gt;num_rows() == 0)
+                {
+                        return array();
+                }
+
+                $this-&gt;_data_seek(0);
+                while ($row = $this-&gt;_fetch_assoc())
+                {
+                        $this-&gt;result_array[] = $row;
+                }
+                
+                return $this-&gt;result_array;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Query result.  Acts as a wrapper function for the following functions.
+         *
+         * @access        public
+         * @param        string
+         * @param        string        can be &quot;object&quot; or &quot;array&quot;
+         * @return        mixed        either a result object or array        
+         */        
+        function row($n = 0, $type = 'object')
+        {
+                if ( ! is_numeric($n))
+                {
+                        // We cache the row data for subsequent uses
+                        if ( ! is_array($this-&gt;row_data))
+                        {
+                                $this-&gt;row_data = $this-&gt;row_array(0);
+                        }
+                
+                        // array_key_exists() instead of isset() to allow for MySQL NULL values
+                        if (array_key_exists($n, $this-&gt;row_data))
+                        {
+                                return $this-&gt;row_data[$n];
+                        }
+                        // reset the $n variable if the result was not achieved                        
+                        $n = 0;
+                }
+                
+                return ($type == 'object') ? $this-&gt;row_object($n) : $this-&gt;row_array($n);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Assigns an item into a particular column slot
+         *
+         * @access        public
+         * @return        object
+         */        
+        function set_row($key, $value = NULL)
+        {
+                // We cache the row data for subsequent uses
+                if ( ! is_array($this-&gt;row_data))
+                {
+                        $this-&gt;row_data = $this-&gt;row_array(0);
+                }
+        
+                if (is_array($key))
+                {
+                        foreach ($key as $k =&gt; $v)
+                        {
+                                $this-&gt;row_data[$k] = $v;
+                        }
+                        
+                        return;
+                }
+        
+                if ($key != '' AND ! is_null($value))
+                {
+                        $this-&gt;row_data[$key] = $value;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns a single result row - object version
+         *
+         * @access        public
+         * @return        object
+         */        
+        function row_object($n = 0)
+        {
+                $result = $this-&gt;result_object();
+                
+                if (count($result) == 0)
+                {
+                        return $result;
+                }
+
+                if ($n != $this-&gt;current_row AND isset($result[$n]))
+                {
+                        $this-&gt;current_row = $n;
+                }
+
+                return $result[$this-&gt;current_row];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns a single result row - array version
+         *
+         * @access        public
+         * @return        array
+         */        
+        function row_array($n = 0)
+        {
+                $result = $this-&gt;result_array();
+
+                if (count($result) == 0)
+                {
+                        return $result;
+                }
+                        
+                if ($n != $this-&gt;current_row AND isset($result[$n]))
+                {
+                        $this-&gt;current_row = $n;
+                }
+                
+                return $result[$this-&gt;current_row];
+        }
+
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns the &quot;first&quot; row
+         *
+         * @access        public
+         * @return        object
+         */        
+        function first_row($type = 'object')
+        {
+                $result = $this-&gt;result($type);
+
+                if (count($result) == 0)
+                {
+                        return $result;
+                }
+                return $result[0];
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns the &quot;last&quot; row
+         *
+         * @access        public
+         * @return        object
+         */        
+        function last_row($type = 'object')
+        {
+                $result = $this-&gt;result($type);
+
+                if (count($result) == 0)
+                {
+                        return $result;
+                }
+                return $result[count($result) -1];
+        }        
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns the &quot;next&quot; row
+         *
+         * @access        public
+         * @return        object
+         */        
+        function next_row($type = 'object')
+        {
+                $result = $this-&gt;result($type);
+
+                if (count($result) == 0)
+                {
+                        return $result;
+                }
+
+                if (isset($result[$this-&gt;current_row + 1]))
+                {
+                        ++$this-&gt;current_row;
+                }
+                                
+                return $result[$this-&gt;current_row];
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Returns the &quot;previous&quot; row
+         *
+         * @access        public
+         * @return        object
+         */        
+        function previous_row($type = 'object')
+        {
+                $result = $this-&gt;result($type);
+
+                if (count($result) == 0)
+                {
+                        return $result;
+                }
+
+                if (isset($result[$this-&gt;current_row - 1]))
+                {
+                        --$this-&gt;current_row;
+                }
+                return $result[$this-&gt;current_row];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The following functions are normally overloaded by the identically named
+         * methods in the platform-specific driver -- except when query caching
+         * is used.  When caching is enabled we do not load the other driver.
+         * These functions are primarily here to prevent undefined function errors
+         * when a cached result object is in use.  They are not otherwise fully
+         * operational due to the unavailability of the database resource IDs with
+         * cached results.
+         */
+        function num_rows() { return $this-&gt;num_rows; }
+        function num_fields() { return 0; }
+        function list_fields() { return array(); }
+        function field_data() { return array(); }        
+        function free_result() { return TRUE; }
+        function _data_seek() { return TRUE; }
+        function _fetch_assoc() { return array(); }        
+        function _fetch_object() { return array(); }
+        
+}
+// END DB_result class
+
+/* End of file DB_result.php */
+/* Location: ./system/database/DB_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseDB_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/DB_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,389 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * Code Igniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Database Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_utility extends CI_DB_forge {
+
+        var $db;
+        var $data_cache         = array();
+
+        /**
+         * Constructor
+         *
+         * Grabs the CI super object instance so we can access it.
+         *
+         */        
+        function CI_DB_utility()
+        {
+                // Assign the main database object to $this-&gt;db
+                $CI =&amp; get_instance();
+                $this-&gt;db =&amp; $CI-&gt;db;
+                
+                log_message('debug', &quot;Database Utility Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * List databases
+         *
+         * @access        public
+         * @return        bool
+         */
+        function list_databases()
+        {        
+                // Is there a cached result?
+                if (isset($this-&gt;data_cache['db_names']))
+                {
+                        return $this-&gt;data_cache['db_names'];
+                }
+        
+                $query = $this-&gt;db-&gt;query($this-&gt;_list_databases());
+                $dbs = array();
+                if ($query-&gt;num_rows() &gt; 0)
+                {
+                        foreach ($query-&gt;result_array() as $row)
+                        {
+                                $dbs[] = current($row);
+                        }
+                }
+                        
+                $this-&gt;data_cache['db_names'] = $dbs;
+                return $this-&gt;data_cache['db_names'];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize Table
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        bool
+         */
+        function optimize_table($table_name)
+        {
+                $sql = $this-&gt;_optimize_table($table_name);
+                
+                if (is_bool($sql))
+                {
+                                show_error('db_must_use_set');
+                }
+        
+                $query = $this-&gt;db-&gt;query($sql);
+                $res = $query-&gt;result_array();
+                
+                // Note: Due to a bug in current() that affects some versions
+                // of PHP we can not pass function call directly into it
+                return current($res);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize Database
+         *
+         * @access        public
+         * @return        array
+         */
+        function optimize_database()
+        {
+                $result = array();
+                foreach ($this-&gt;db-&gt;list_tables() as $table_name)
+                {
+                        $sql = $this-&gt;_optimize_table($table_name);
+                        
+                        if (is_bool($sql))
+                        {
+                                return $sql;
+                        }
+                        
+                        $query = $this-&gt;db-&gt;query($sql);
+                        
+                        // Build the result array...
+                        // Note: Due to a bug in current() that affects some versions
+                        // of PHP we can not pass function call directly into it
+                        $res = $query-&gt;result_array();
+                        $res = current($res);
+                        $key = str_replace($this-&gt;db-&gt;database.'.', '', current($res));
+                        $keys = array_keys($res);
+                        unset($res[$keys[0]]);
+                        
+                        $result[$key] = $res;
+                }
+
+                return $result;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Repair Table
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        bool
+         */
+        function repair_table($table_name)
+        {
+                $sql = $this-&gt;_repair_table($table_name);
+                
+                if (is_bool($sql))
+                {
+                        return $sql;
+                }
+        
+                $query = $this-&gt;db-&gt;query($sql);
+                
+                // Note: Due to a bug in current() that affects some versions
+                // of PHP we can not pass function call directly into it
+                $res = $query-&gt;result_array();
+                return current($res);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate CSV from a query result object
+         *
+         * @access        public
+         * @param        object        The query result object
+         * @param        string        The delimiter - comma by default
+         * @param        string        The newline character - \n by default
+         * @param        string        The enclosure - double quote by default
+         * @return        string
+         */
+        function csv_from_result($query, $delim = &quot;,&quot;, $newline = &quot;\n&quot;, $enclosure = '&quot;')
+        {
+                if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))
+                {
+                        show_error('You must submit a valid result object');
+                }        
+        
+                $out = '';
+                
+                // First generate the headings from the table column names
+                foreach ($query-&gt;list_fields() as $name)
+                {
+                        $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
+                }
+                
+                $out = rtrim($out);
+                $out .= $newline;
+                
+                // Next blast through the result array and build out the rows
+                foreach ($query-&gt;result_array() as $row)
+                {
+                        foreach ($row as $item)
+                        {
+                                $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;                        
+                        }
+                        $out = rtrim($out);
+                        $out .= $newline;
+                }
+
+                return $out;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate XML data from a query result object
+         *
+         * @access        public
+         * @param        object        The query result object
+         * @param        array        Any preferences
+         * @return        string
+         */
+        function xml_from_result($query, $params = array())
+        {
+                if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
+                {
+                        show_error('You must submit a valid result object');
+                }
+                
+                // Set our default values
+                foreach (array('root' =&gt; 'root', 'element' =&gt; 'element', 'newline' =&gt; &quot;\n&quot;, 'tab' =&gt; &quot;\t&quot;) as $key =&gt; $val)
+                {
+                        if ( ! isset($params[$key]))
+                        {
+                                $params[$key] = $val;
+                        }
+                }
+                
+                // Create variables for convenience
+                extract($params);
+                        
+                // Load the xml helper
+                $CI =&amp; get_instance();
+                $CI-&gt;load-&gt;helper('xml');
+
+                // Generate the result
+                $xml = &quot;&lt;{$root}&gt;&quot;.$newline;
+                foreach ($query-&gt;result_array() as $row)
+                {
+                        $xml .= $tab.&quot;&lt;{$element}&gt;&quot;.$newline;
+                        
+                        foreach ($row as $key =&gt; $val)
+                        {
+                                $xml .= $tab.$tab.&quot;&lt;{$key}&gt;&quot;.xml_convert($val).&quot;&lt;/{$key}&gt;&quot;.$newline;
+                        }
+                        $xml .= $tab.&quot;&lt;/{$element}&gt;&quot;.$newline;
+                }
+                $xml .= &quot;&lt;/$root&gt;&quot;.$newline;
+                
+                return $xml;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Database Backup
+         *
+         * @access        public
+         * @return        void
+         */
+        function backup($params = array())
+        {
+                // If the parameters have not been submitted as an
+                // array then we know that it is simply the table
+                // name, which is a valid short cut.
+                if (is_string($params))
+                {
+                        $params = array('tables' =&gt; $params);
+                }
+                
+                // ------------------------------------------------------
+        
+                // Set up our default preferences
+                $prefs = array(
+                                                        'tables'                =&gt; array(),
+                                                        'ignore'                =&gt; array(),
+                                                        'filename'                =&gt; '',
+                                                        'format'                =&gt; 'gzip', // gzip, zip, txt
+                                                        'add_drop'                =&gt; TRUE,
+                                                        'add_insert'        =&gt; TRUE,
+                                                        'newline'                =&gt; &quot;\n&quot;
+                                                );
+
+                // Did the user submit any preferences? If so set them....
+                if (count($params) &gt; 0)
+                {
+                        foreach ($prefs as $key =&gt; $val)
+                        {
+                                if (isset($params[$key]))
+                                {
+                                        $prefs[$key] = $params[$key];
+                                }
+                        }
+                }
+
+                // ------------------------------------------------------
+
+                // Are we backing up a complete database or individual tables?        
+                // If no table names were submitted we'll fetch the entire table list
+                if (count($prefs['tables']) == 0)
+                {
+                        $prefs['tables'] = $this-&gt;db-&gt;list_tables();
+                }
+                
+                // ------------------------------------------------------
+
+                // Validate the format
+                if ( ! in_array($prefs['format'], array('gzip', 'zip', 'txt'), TRUE))
+                {
+                        $prefs['format'] = 'txt';
+                }
+
+                // ------------------------------------------------------
+
+                // Is the encoder supported?  If not, we'll either issue an
+                // error or use plain text depending on the debug settings
+                if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode'))
+                 OR ($prefs['format'] == 'zip'  AND ! @function_exists('gzcompress')))
+                {
+                        if ($this-&gt;db-&gt;db_debug)
+                        {
+                                return $this-&gt;db-&gt;display_error('db_unsuported_compression');
+                        }
+                
+                        $prefs['format'] = 'txt';
+                }
+
+                // ------------------------------------------------------
+
+                // Set the filename if not provided - Only needed with Zip files
+                if ($prefs['filename'] == '' AND $prefs['format'] == 'zip')
+                {
+                        $prefs['filename'] = (count($prefs['tables']) == 1) ? $prefs['tables'] : $this-&gt;db-&gt;database;
+                        $prefs['filename'] .= '_'.date('Y-m-d_H-i', time());
+                }
+
+                // ------------------------------------------------------
+                                
+                // Was a Gzip file requested?
+                if ($prefs['format'] == 'gzip')
+                {
+                        return gzencode($this-&gt;_backup($prefs));
+                }
+
+                // ------------------------------------------------------
+                
+                // Was a text file requested?
+                if ($prefs['format'] == 'txt')
+                {
+                        return $this-&gt;_backup($prefs);
+                }
+
+                // ------------------------------------------------------
+
+                // Was a Zip file requested?                
+                if ($prefs['format'] == 'zip')
+                {
+                        // If they included the .zip file extension we'll remove it
+                        if (preg_match(&quot;|.+?\.zip$|&quot;, $prefs['filename']))
+                        {
+                                $prefs['filename'] = str_replace('.zip', '', $prefs['filename']);
+                        }
+                        
+                        // Tack on the &quot;.sql&quot; file extension if needed
+                        if ( ! preg_match(&quot;|.+?\.sql$|&quot;, $prefs['filename']))
+                        {
+                                $prefs['filename'] .= '.sql';
+                        }
+
+                        // Load the Zip class and output it
+                        
+                        $CI =&amp; get_instance();
+                        $CI-&gt;load-&gt;library('zip');
+                        $CI-&gt;zip-&gt;add_data($prefs['filename'], $this-&gt;_backup($prefs));                                                        
+                        return $CI-&gt;zip-&gt;get_zip();
+                }
+                
+        }
+
+}
+
+
+/* End of file DB_utility.php */
+/* Location: ./system/database/DB_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,668 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MS SQL Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mssql_driver extends CI_DB {
+
+        var $dbdriver = 'mssql';
+        
+        // The character used for escaping
+        var $_escape_char = '';
+
+        // clause and character used for LIKE escape sequences
+        var $_like_escape_str = &quot; ESCAPE '%s' &quot;;
+        var $_like_escape_chr = '!';
+        
+        /**
+         * The syntax to count rows is slightly different across different
+         * database engines, so this string appears in each driver and is
+         * used for the count_all() and count_all_results() functions.
+         */
+        var $_count_string = &quot;SELECT COUNT(*) AS &quot;;
+        var $_random_keyword = ' ASC'; // not currently supported
+
+        /**
+         * Non-persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_connect()
+        {
+                if ($this-&gt;port != '')
+                {
+                        $this-&gt;hostname .= ','.$this-&gt;port;
+                }
+
+                return @mssql_connect($this-&gt;hostname, $this-&gt;username, $this-&gt;password);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_pconnect()
+        {
+                if ($this-&gt;port != '')
+                {
+                        $this-&gt;hostname .= ','.$this-&gt;port;
+                }
+
+                return @mssql_pconnect($this-&gt;hostname, $this-&gt;username, $this-&gt;password);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Reconnect
+         *
+         * Keep / reestablish the db connection if no queries have been
+         * sent for a length of time exceeding the server's idle timeout
+         *
+         * @access        public
+         * @return        void
+         */
+        function reconnect()
+        {
+                // not implemented in MSSQL
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Select the database
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_select()
+        {
+                // Note: The brackets are required in the event that the DB name
+                // contains reserved characters
+                return @mssql_select_db('['.$this-&gt;database.']', $this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set client character set
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function db_set_charset($charset, $collation)
+        {
+                // @todo - add support if needed
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Execute the query
+         *
+         * @access        private called by the base class
+         * @param        string        an SQL query
+         * @return        resource
+         */        
+        function _execute($sql)
+        {
+                $sql = $this-&gt;_prep_query($sql);
+                return @mssql_query($sql, $this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep the query
+         *
+         * If needed, each database adapter can prep the query string
+         *
+         * @access        private called by execute()
+         * @param        string        an SQL query
+         * @return        string
+         */        
+        function _prep_query($sql)
+        {
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Begin Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_begin($test_mode = FALSE)
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+                
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                // Reset the transaction failure flag.
+                // If the $test_mode flag is set to TRUE transactions will be rolled back
+                // even if the queries produce a successful result.
+                $this-&gt;_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+
+                $this-&gt;simple_query('BEGIN TRAN');
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Commit Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_commit()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('COMMIT TRAN');
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rollback Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_rollback()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('ROLLBACK TRAN');
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape String
+         *
+         * @access        public
+         * @param        string
+         * @param        bool        whether or not the string will be used in a LIKE condition
+         * @return        string
+         */
+        function escape_str($str, $like = FALSE)
+        {
+                if (is_array($str))
+                {
+                        foreach($str as $key =&gt; $val)
+                           {
+                                $str[$key] = $this-&gt;escape_str($val, $like);
+                           }
+                   
+                           return $str;
+                   }
+
+                // Access the CI object
+                $CI =&amp; get_instance();
+                
+                // Escape single quotes
+                $str = str_replace(&quot;'&quot;, &quot;''&quot;, $CI-&gt;input-&gt;_remove_invisible_characters($str));
+                
+                // escape LIKE condition wildcards
+                if ($like === TRUE)
+                {
+                        $str = str_replace(        array('%', '_', $this-&gt;_like_escape_chr),
+                                                                array($this-&gt;_like_escape_chr.'%', $this-&gt;_like_escape_chr.'_', $this-&gt;_like_escape_chr.$this-&gt;_like_escape_chr),
+                                                                $str);
+                }
+                
+                return $str;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Affected Rows
+         *
+         * @access        public
+         * @return        integer
+         */
+        function affected_rows()
+        {
+                return @mssql_rows_affected($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+        * Insert ID
+        *
+        * Returns the last id created in the Identity column.
+        *
+        * @access public
+        * @return integer
+        */
+        function insert_id()
+        {
+                $ver = self::_parse_major_version($this-&gt;version());
+                $sql = ($ver &gt;= 8 ? &quot;SELECT SCOPE_IDENTITY() AS last_id&quot; : &quot;SELECT @@IDENTITY AS last_id&quot;);
+                $query = $this-&gt;query($sql);
+                $row = $query-&gt;row();
+                return $row-&gt;last_id;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Parse major version
+        *
+        * Grabs the major version number from the 
+        * database server version string passed in.
+        *
+        * @access private
+        * @param string $version
+        * @return int16 major version number
+        */
+        function _parse_major_version($version)
+        {
+                preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info);
+                return $ver_info[1]; // return the major version b/c that's all we're interested in.
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Version number query string
+        *
+        * @access public
+        * @return string
+        */
+        function _version()
+        {
+                return &quot;SELECT @@VERSION AS ver&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Count All&quot; query
+         *
+         * Generates a platform-specific query string that counts all records in
+         * the specified database
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function count_all($table = '')
+        {
+                if ($table == '')
+                {
+                        return 0;
+                }
+
+                $query = $this-&gt;query($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows') . &quot; FROM &quot; . $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE));
+
+                if ($query-&gt;num_rows() == 0)
+                {
+                        return 0;
+                }
+
+                $row = $query-&gt;row();
+                return (int) $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * List table query
+         *
+         * Generates a platform-specific query string so that the table names can be fetched
+         *
+         * @access        private
+         * @param        boolean
+         * @return        string
+         */
+        function _list_tables($prefix_limit = FALSE)
+        {
+                $sql = &quot;SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name&quot;;
+                
+                // for future compatibility
+                if ($prefix_limit !== FALSE AND $this-&gt;dbprefix != '')
+                {
+                        //$sql .= &quot; LIKE '&quot;.$this-&gt;escape_like_str($this-&gt;dbprefix).&quot;%' &quot;.sprintf($this-&gt;_like_escape_str, $this-&gt;_like_escape_char);
+                        return FALSE; // not currently supported
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * List column query
+         *
+         * Generates a platform-specific query string so that the column names can be fetched
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        string
+         */
+        function _list_columns($table = '')
+        {
+                return &quot;SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '&quot;.$table.&quot;'&quot;;        
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data query
+         *
+         * Generates a platform-specific query so that the column data can be retrieved
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        object
+         */
+        function _field_data($table)
+        {
+                return &quot;SELECT TOP 1 * FROM &quot;.$table;        
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message string
+         *
+         * @access        private
+         * @return        string
+         */
+        function _error_message()
+        {
+                // Are errros even supported in MS SQL?
+                return '';
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message number
+         *
+         * @access        private
+         * @return        integer
+         */
+        function _error_number()
+        {
+                // Are error numbers supported?
+                return '';
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape the SQL Identifiers
+         *
+         * This function escapes column and table names
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _escape_identifiers($item)
+        {
+                if ($this-&gt;_escape_char == '')
+                {
+                        return $item;
+                }
+
+                foreach ($this-&gt;_reserved_identifiers as $id)
+                {
+                        if (strpos($item, '.'.$id) !== FALSE)
+                        {
+                                $str = $this-&gt;_escape_char. str_replace('.', $this-&gt;_escape_char.'.', $item);  
+                                
+                                // remove duplicates if the user already included the escape
+                                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+                        }                
+                }
+
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $str = $this-&gt;_escape_char.str_replace('.', $this-&gt;_escape_char.'.'.$this-&gt;_escape_char, $item).$this-&gt;_escape_char;                        
+                }
+                else
+                {
+                        $str = $this-&gt;_escape_char.$item.$this-&gt;_escape_char;
+                }
+                
+                // remove duplicates if the user already included the escape
+                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * From Tables
+         *
+         * This function implicitly groups FROM tables so there is no confusion
+         * about operator precedence in harmony with SQL standards
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _from_tables($tables)
+        {
+                if ( ! is_array($tables))
+                {
+                        $tables = array($tables);
+                }
+                
+                return implode(', ', $tables);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert statement
+         *
+         * Generates a platform-specific insert string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the insert keys
+         * @param        array        the insert values
+         * @return        string
+         */
+        function _insert($table, $keys, $values)
+        {        
+                return &quot;INSERT INTO &quot;.$table.&quot; (&quot;.implode(', ', $keys).&quot;) VALUES (&quot;.implode(', ', $values).&quot;)&quot;;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Update statement
+         *
+         * Generates a platform-specific update string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the update data
+         * @param        array        the where clause
+         * @param        array        the orderby clause
+         * @param        array        the limit clause
+         * @return        string
+         */
+        function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+        {
+                foreach($values as $key =&gt; $val)
+                {
+                        $valstr[] = $key.&quot; = &quot;.$val;
+                }
+                
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+                
+                $orderby = (count($orderby) &gt;= 1)?' ORDER BY '.implode(&quot;, &quot;, $orderby):'';
+        
+                $sql = &quot;UPDATE &quot;.$table.&quot; SET &quot;.implode(', ', $valstr);
+
+                $sql .= ($where != '' AND count($where) &gt;=1) ? &quot; WHERE &quot;.implode(&quot; &quot;, $where) : '';
+
+                $sql .= $orderby.$limit;
+                
+                return $sql;
+        }
+
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate statement
+         *
+         * Generates a platform-specific truncate string from the supplied data
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */        
+        function _truncate($table)
+        {
+                return &quot;TRUNCATE &quot;.$table;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete statement
+         *
+         * Generates a platform-specific delete string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the where clause
+         * @param        string        the limit clause
+         * @return        string
+         */        
+        function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+        {
+                $conditions = '';
+
+                if (count($where) &gt; 0 OR count($like) &gt; 0)
+                {
+                        $conditions = &quot;\nWHERE &quot;;
+                        $conditions .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                        if (count($where) &gt; 0 &amp;&amp; count($like) &gt; 0)
+                        {
+                                $conditions .= &quot; AND &quot;;
+                        }
+                        $conditions .= implode(&quot;\n&quot;, $like);
+                }
+
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+        
+                return &quot;DELETE FROM &quot;.$table.$conditions.$limit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Limit string
+         *
+         * Generates a platform-specific LIMIT clause
+         *
+         * @access        public
+         * @param        string        the sql query string
+         * @param        integer        the number of rows to limit the query to
+         * @param        integer        the offset value
+         * @return        string
+         */
+        function _limit($sql, $limit, $offset)
+        {
+                $i = $limit + $offset;
+        
+                return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql);                
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access        public
+         * @param        resource
+         * @return        void
+         */
+        function _close($conn_id)
+        {
+                @mssql_close($conn_id);
+        }        
+
+}
+
+
+
+/* End of file mssql_driver.php */
+/* Location: ./system/database/drivers/mssql/mssql_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,248 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MS SQL Forge Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mssql_forge extends CI_DB_forge {
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _drop_table($table)
+        {
+                return &quot;DROP TABLE &quot;.$this-&gt;db-&gt;_escape_identifiers($table);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        private
+         * @param        string        the table name
+         * @param        array        the fields
+         * @param        mixed        primary key(s)
+         * @param        mixed        key(s)
+         * @param        boolean        should 'IF NOT EXISTS' be added to the SQL
+         * @return        bool
+         */
+        function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+        {
+                $sql = 'CREATE TABLE ';
+                
+                if ($if_not_exists === TRUE)
+                {
+                        $sql .= 'IF NOT EXISTS ';
+                }
+                
+                $sql .= $this-&gt;db-&gt;_escape_identifiers($table).&quot; (&quot;;
+                $current_field_count = 0;
+
+                foreach ($fields as $field=&gt;$attributes)
+                {
+                        // Numeric field names aren't allowed in databases, so if the key is
+                        // numeric, we know it was assigned by PHP and the developer manually
+                        // entered the field information, so we'll simply add it to the list
+                        if (is_numeric($field))
+                        {
+                                $sql .= &quot;\n\t$attributes&quot;;
+                        }
+                        else
+                        {
+                                $attributes = array_change_key_case($attributes, CASE_UPPER);
+                                
+                                $sql .= &quot;\n\t&quot;.$this-&gt;db-&gt;_protect_identifiers($field);
+                                
+                                $sql .=  ' '.$attributes['TYPE'];
+        
+                                if (array_key_exists('CONSTRAINT', $attributes))
+                                {
+                                        $sql .= '('.$attributes['CONSTRAINT'].')';
+                                }
+        
+                                if (array_key_exists('UNSIGNED', $attributes) &amp;&amp; $attributes['UNSIGNED'] === TRUE)
+                                {
+                                        $sql .= ' UNSIGNED';
+                                }
+        
+                                if (array_key_exists('DEFAULT', $attributes))
+                                {
+                                        $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+                                }
+        
+                                if (array_key_exists('NULL', $attributes) &amp;&amp; $attributes['NULL'] === TRUE)
+                                {
+                                        $sql .= ' NULL';
+                                }
+                                else
+                                {
+                                        $sql .= ' NOT NULL';                        
+                                }
+        
+                                if (array_key_exists('AUTO_INCREMENT', $attributes) &amp;&amp; $attributes['AUTO_INCREMENT'] === TRUE)
+                                {
+                                        $sql .= ' AUTO_INCREMENT';
+                                }
+                        }
+                        
+                        // don't add a comma on the end of the last field
+                        if (++$current_field_count &lt; count($fields))
+                        {
+                                $sql .= ',';
+                        }
+                }
+
+                if (count($primary_keys) &gt; 0)
+                {
+                        $primary_keys = $this-&gt;db-&gt;_protect_identifiers($primary_keys);
+                        $sql .= &quot;,\n\tPRIMARY KEY (&quot; . implode(', ', $primary_keys) . &quot;)&quot;;
+                }
+                
+                if (is_array($keys) &amp;&amp; count($keys) &gt; 0)
+                {
+                        foreach ($keys as $key)
+                        {
+                                if (is_array($key))
+                                {
+                                        $key = $this-&gt;db-&gt;_protect_identifiers($key);        
+                                }
+                                else
+                                {
+                                        $key = array($this-&gt;db-&gt;_protect_identifiers($key));
+                                }
+                                
+                                $sql .= &quot;,\n\tFOREIGN KEY (&quot; . implode(', ', $key) . &quot;)&quot;;
+                        }
+                }
+                
+                $sql .= &quot;\n)&quot;;
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Alter table query
+         *
+         * Generates a platform-specific query so that a table can be altered
+         * Called by add_column(), drop_column(), and column_alter(),
+         *
+         * @access        private
+         * @param        string        the ALTER type (ADD, DROP, CHANGE)
+         * @param        string        the column name
+         * @param        string        the table name
+         * @param        string        the column definition
+         * @param        string        the default value
+         * @param        boolean        should 'NOT NULL' be added
+         * @param        string        the field after which we should add the new field
+         * @return        object
+         */
+        function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table).&quot; $alter_type &quot;.$this-&gt;db-&gt;_protect_identifiers($column_name);
+
+                // DROP has everything it needs now.
+                if ($alter_type == 'DROP')
+                {
+                        return $sql;
+                }
+
+                $sql .= &quot; $column_definition&quot;;
+
+                if ($default_value != '')
+                {
+                        $sql .= &quot; DEFAULT \&quot;$default_value\&quot;&quot;;
+                }
+
+                if ($null === NULL)
+                {
+                        $sql .= ' NULL';
+                }
+                else
+                {
+                        $sql .= ' NOT NULL';
+                }
+
+                if ($after_field != '')
+                {
+                        $sql .= ' AFTER ' . $this-&gt;db-&gt;_protect_identifiers($after_field);
+                }
+                
+                return $sql;
+                
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename a table
+         *
+         * Generates a platform-specific query so that a table can be renamed
+         *
+         * @access        private
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        string
+         */
+        function _rename_table($table_name, $new_table_name)
+        {
+                // I think this syntax will work, but can find little documentation on renaming tables in MSSQL
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table_name).&quot; RENAME TO &quot;.$this-&gt;db-&gt;_protect_identifiers($new_table_name);
+                return $sql;
+        }
+
+}
+
+/* End of file mssql_forge.php */
+/* Location: ./system/database/drivers/mssql/mssql_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,169 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MS SQL Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mssql_result extends CI_DB_result {
+        
+        /**
+         * Number of rows in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_rows()
+        {
+                return @mssql_num_rows($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Number of fields in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_fields()
+        {
+                return @mssql_num_fields($this-&gt;result_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch Field Names
+         *
+         * Generates an array of column names
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_fields()
+        {
+                $field_names = array();
+                while ($field = mssql_fetch_field($this-&gt;result_id))
+                {
+                        $field_names[] = $field-&gt;name;
+                }
+                
+                return $field_names;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data
+         *
+         * Generates an array of objects containing field meta-data
+         *
+         * @access        public
+         * @return        array
+         */
+        function field_data()
+        {
+                $retval = array();
+                while ($field = mssql_fetch_field($this-&gt;result_id))
+                {        
+                        $F                                 = new stdClass();
+                        $F-&gt;name                 = $field-&gt;name;
+                        $F-&gt;type                 = $field-&gt;type;
+                        $F-&gt;max_length        = $field-&gt;max_length;
+                        $F-&gt;primary_key = 0;
+                        $F-&gt;default                = '';
+                        
+                        $retval[] = $F;
+                }
+                
+                return $retval;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Free the result
+         *
+         * @return        null
+         */                
+        function free_result()
+        {
+                if (is_resource($this-&gt;result_id))
+                {
+                        mssql_free_result($this-&gt;result_id);
+                        $this-&gt;result_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Data Seek
+         *
+         * Moves the internal pointer to the desired offset.  We call
+         * this internally before fetching results to make sure the
+         * result set starts at zero
+         *
+         * @access        private
+         * @return        array
+         */
+        function _data_seek($n = 0)
+        {
+                return mssql_data_seek($this-&gt;result_id, $n);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - associative array
+         *
+         * Returns the result set as an array
+         *
+         * @access        private
+         * @return        array
+         */
+        function _fetch_assoc()
+        {
+                return mssql_fetch_assoc($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - object
+         *
+         * Returns the result set as an object
+         *
+         * @access        private
+         * @return        object
+         */
+        function _fetch_object()
+        {
+                return mssql_fetch_object($this-&gt;result_id);
+        }
+
+}
+
+
+/* End of file mssql_result.php */
+/* Location: ./system/database/drivers/mssql/mssql_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmssqlmssql_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mssql/mssql_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,123 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MS SQL Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mssql_utility extends CI_DB_utility {
+
+        /**
+         * List databases
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _list_databases()
+        {
+                return &quot;EXEC sp_helpdb&quot;; // Can also be: EXEC sp_databases
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize table query
+         *
+         * Generates a platform-specific query so that a table can be optimized
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _optimize_table($table)
+        {
+                return FALSE; // Is this supported in MS SQL?
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Repair table query
+         *
+         * Generates a platform-specific query so that a table can be repaired
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _repair_table($table)
+        {
+                return FALSE; // Is this supported in MS SQL?
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * MSSQL Export
+         *
+         * @access        private
+         * @param        array        Preferences
+         * @return        mixed
+         */
+        function _backup($params = array())
+        {
+                // Currently unsupported
+                return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+        }
+
+        /**
+         *
+         * The functions below have been deprecated as of 1.6, and are only here for backwards
+         * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
+         * is STRONGLY discouraged in favour if using dbforge.
+         *
+         */
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+}
+
+
+/* End of file mssql_utility.php */
+/* Location: ./system/database/drivers/mssql/mssql_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,670 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQL Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysql_driver extends CI_DB {
+
+        var $dbdriver = 'mysql';
+
+        // The character used for escaping
+        var        $_escape_char = '`';
+
+        // clause and character used for LIKE escape sequences - not used in MySQL
+        var $_like_escape_str = '';
+        var $_like_escape_chr = '';
+
+        /**
+         * Whether to use the MySQL &quot;delete hack&quot; which allows the number
+         * of affected rows to be shown. Uses a preg_replace when enabled,
+         * adding a bit more processing to all queries.
+         */        
+        var $delete_hack = TRUE;
+        
+        /**
+         * The syntax to count rows is slightly different across different
+         * database engines, so this string appears in each driver and is
+         * used for the count_all() and count_all_results() functions.
+         */
+        var $_count_string = 'SELECT COUNT(*) AS ';
+        var $_random_keyword = ' RAND()'; // database specific random keyword
+
+        /**
+         * Non-persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_connect()
+        {
+                if ($this-&gt;port != '')
+                {
+                        $this-&gt;hostname .= ':'.$this-&gt;port;
+                }
+                
+                return @mysql_connect($this-&gt;hostname, $this-&gt;username, $this-&gt;password, TRUE);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_pconnect()
+        {
+                if ($this-&gt;port != '')
+                {
+                        $this-&gt;hostname .= ':'.$this-&gt;port;
+                }
+
+                return @mysql_pconnect($this-&gt;hostname, $this-&gt;username, $this-&gt;password);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Reconnect
+         *
+         * Keep / reestablish the db connection if no queries have been
+         * sent for a length of time exceeding the server's idle timeout
+         *
+         * @access        public
+         * @return        void
+         */
+        function reconnect()
+        {
+                if (mysql_ping($this-&gt;conn_id) === FALSE)
+                {
+                        $this-&gt;conn_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Select the database
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_select()
+        {
+                return @mysql_select_db($this-&gt;database, $this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set client character set
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function db_set_charset($charset, $collation)
+        {
+                return @mysql_query(&quot;SET NAMES '&quot;.$this-&gt;escape_str($charset).&quot;' COLLATE '&quot;.$this-&gt;escape_str($collation).&quot;'&quot;, $this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Version number query string
+         *
+         * @access        public
+         * @return        string
+         */
+        function _version()
+        {
+                return &quot;SELECT version() AS ver&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Execute the query
+         *
+         * @access        private called by the base class
+         * @param        string        an SQL query
+         * @return        resource
+         */        
+        function _execute($sql)
+        {
+                $sql = $this-&gt;_prep_query($sql);
+                return @mysql_query($sql, $this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep the query
+         *
+         * If needed, each database adapter can prep the query string
+         *
+         * @access        private called by execute()
+         * @param        string        an SQL query
+         * @return        string
+         */        
+        function _prep_query($sql)
+        {
+                // &quot;DELETE FROM TABLE&quot; returns 0 affected rows This hack modifies
+                // the query so that it returns the number of affected rows
+                if ($this-&gt;delete_hack === TRUE)
+                {
+                        if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql))
+                        {
+                                $sql = preg_replace(&quot;/^\s*DELETE\s+FROM\s+(\S+)\s*$/&quot;, &quot;DELETE FROM \\1 WHERE 1=1&quot;, $sql);
+                        }
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Begin Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_begin($test_mode = FALSE)
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+                
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                // Reset the transaction failure flag.
+                // If the $test_mode flag is set to TRUE transactions will be rolled back
+                // even if the queries produce a successful result.
+                $this-&gt;_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+                
+                $this-&gt;simple_query('SET AUTOCOMMIT=0');
+                $this-&gt;simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Commit Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_commit()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('COMMIT');
+                $this-&gt;simple_query('SET AUTOCOMMIT=1');
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rollback Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_rollback()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('ROLLBACK');
+                $this-&gt;simple_query('SET AUTOCOMMIT=1');
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape String
+         *
+         * @access        public
+         * @param        string
+         * @param        bool        whether or not the string will be used in a LIKE condition
+         * @return        string
+         */
+        function escape_str($str, $like = FALSE)        
+        {        
+                if (is_array($str))
+                {
+                        foreach($str as $key =&gt; $val)
+                           {
+                                $str[$key] = $this-&gt;escape_str($val, $like);
+                           }
+                   
+                           return $str;
+                   }
+
+                if (function_exists('mysql_real_escape_string') AND is_resource($this-&gt;conn_id))
+                {
+                        $str = mysql_real_escape_string($str, $this-&gt;conn_id);
+                }
+                elseif (function_exists('mysql_escape_string'))
+                {
+                        $str = mysql_escape_string($str);
+                }
+                else
+                {
+                        $str = addslashes($str);
+                }
+                
+                // escape LIKE condition wildcards
+                if ($like === TRUE)
+                {
+                        $str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
+                }
+                
+                return $str;
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Affected Rows
+         *
+         * @access        public
+         * @return        integer
+         */
+        function affected_rows()
+        {
+                return @mysql_affected_rows($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Insert ID
+         *
+         * @access        public
+         * @return        integer
+         */
+        function insert_id()
+        {
+                return @mysql_insert_id($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Count All&quot; query
+         *
+         * Generates a platform-specific query string that counts all records in
+         * the specified database
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function count_all($table = '')
+        {
+                if ($table == '')
+                {
+                        return 0;
+                }
+        
+                $query = $this-&gt;query($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows') . &quot; FROM &quot; . $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE));
+
+                if ($query-&gt;num_rows() == 0)
+                {
+                        return 0;
+                }
+
+                $row = $query-&gt;row();
+                return (int) $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * List table query
+         *
+         * Generates a platform-specific query string so that the table names can be fetched
+         *
+         * @access        private
+         * @param        boolean
+         * @return        string
+         */
+        function _list_tables($prefix_limit = FALSE)
+        {
+                $sql = &quot;SHOW TABLES FROM &quot;.$this-&gt;_escape_char.$this-&gt;database.$this-&gt;_escape_char;        
+
+                if ($prefix_limit !== FALSE AND $this-&gt;dbprefix != '')
+                {
+                        $sql .= &quot; LIKE '&quot;.$this-&gt;escape_like_str($this-&gt;dbprefix).&quot;%'&quot;;
+                }
+
+                return $sql;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Show column query
+         *
+         * Generates a platform-specific query string so that the column names can be fetched
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */
+        function _list_columns($table = '')
+        {
+                return &quot;SHOW COLUMNS FROM &quot;.$table;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data query
+         *
+         * Generates a platform-specific query so that the column data can be retrieved
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        object
+         */
+        function _field_data($table)
+        {
+                return &quot;SELECT * FROM &quot;.$table.&quot; LIMIT 1&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message string
+         *
+         * @access        private
+         * @return        string
+         */
+        function _error_message()
+        {
+                return mysql_error($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message number
+         *
+         * @access        private
+         * @return        integer
+         */
+        function _error_number()
+        {
+                return mysql_errno($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape the SQL Identifiers
+         *
+         * This function escapes column and table names
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _escape_identifiers($item)
+        {
+                if ($this-&gt;_escape_char == '')
+                {
+                        return $item;
+                }
+
+                foreach ($this-&gt;_reserved_identifiers as $id)
+                {
+                        if (strpos($item, '.'.$id) !== FALSE)
+                        {
+                                $str = $this-&gt;_escape_char. str_replace('.', $this-&gt;_escape_char.'.', $item);  
+                                
+                                // remove duplicates if the user already included the escape
+                                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+                        }                
+                }
+                
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $str = $this-&gt;_escape_char.str_replace('.', $this-&gt;_escape_char.'.'.$this-&gt;_escape_char, $item).$this-&gt;_escape_char;                        
+                }
+                else
+                {
+                        $str = $this-&gt;_escape_char.$item.$this-&gt;_escape_char;
+                }
+        
+                // remove duplicates if the user already included the escape
+                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+        }
+                        
+        // --------------------------------------------------------------------
+
+        /**
+         * From Tables
+         *
+         * This function implicitly groups FROM tables so there is no confusion
+         * about operator precedence in harmony with SQL standards
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _from_tables($tables)
+        {
+                if ( ! is_array($tables))
+                {
+                        $tables = array($tables);
+                }
+                
+                return '('.implode(', ', $tables).')';
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert statement
+         *
+         * Generates a platform-specific insert string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the insert keys
+         * @param        array        the insert values
+         * @return        string
+         */
+        function _insert($table, $keys, $values)
+        {        
+                return &quot;INSERT INTO &quot;.$table.&quot; (&quot;.implode(', ', $keys).&quot;) VALUES (&quot;.implode(', ', $values).&quot;)&quot;;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Update statement
+         *
+         * Generates a platform-specific update string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the update data
+         * @param        array        the where clause
+         * @param        array        the orderby clause
+         * @param        array        the limit clause
+         * @return        string
+         */
+        function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+        {
+                foreach($values as $key =&gt; $val)
+                {
+                        $valstr[] = $key.&quot; = &quot;.$val;
+                }
+                
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+                
+                $orderby = (count($orderby) &gt;= 1)?' ORDER BY '.implode(&quot;, &quot;, $orderby):'';
+        
+                $sql = &quot;UPDATE &quot;.$table.&quot; SET &quot;.implode(', ', $valstr);
+
+                $sql .= ($where != '' AND count($where) &gt;=1) ? &quot; WHERE &quot;.implode(&quot; &quot;, $where) : '';
+
+                $sql .= $orderby.$limit;
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate statement
+         *
+         * Generates a platform-specific truncate string from the supplied data
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */        
+        function _truncate($table)
+        {
+                return &quot;TRUNCATE &quot;.$table;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete statement
+         *
+         * Generates a platform-specific delete string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the where clause
+         * @param        string        the limit clause
+         * @return        string
+         */        
+        function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+        {
+                $conditions = '';
+
+                if (count($where) &gt; 0 OR count($like) &gt; 0)
+                {
+                        $conditions = &quot;\nWHERE &quot;;
+                        $conditions .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                        if (count($where) &gt; 0 &amp;&amp; count($like) &gt; 0)
+                        {
+                                $conditions .= &quot; AND &quot;;
+                        }
+                        $conditions .= implode(&quot;\n&quot;, $like);
+                }
+
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+        
+                return &quot;DELETE FROM &quot;.$table.$conditions.$limit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Limit string
+         *
+         * Generates a platform-specific LIMIT clause
+         *
+         * @access        public
+         * @param        string        the sql query string
+         * @param        integer        the number of rows to limit the query to
+         * @param        integer        the offset value
+         * @return        string
+         */
+        function _limit($sql, $limit, $offset)
+        {        
+                if ($offset == 0)
+                {
+                        $offset = '';
+                }
+                else
+                {
+                        $offset .= &quot;, &quot;;
+                }
+                
+                return $sql.&quot;LIMIT &quot;.$offset.$limit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access        public
+         * @param        resource
+         * @return        void
+         */
+        function _close($conn_id)
+        {
+                @mysql_close($conn_id);
+        }
+        
+}
+
+
+/* End of file mysql_driver.php */
+/* Location: ./system/database/drivers/mysql/mysql_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,254 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQL Forge Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysql_forge extends CI_DB_forge {
+        
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Process Fields
+         *
+         * @access        private
+         * @param        mixed        the fields
+         * @return        string
+         */
+        function _process_fields($fields)
+        {
+                $current_field_count = 0;
+                $sql = '';
+
+                foreach ($fields as $field=&gt;$attributes)
+                {
+                        // Numeric field names aren't allowed in databases, so if the key is
+                        // numeric, we know it was assigned by PHP and the developer manually
+                        // entered the field information, so we'll simply add it to the list
+                        if (is_numeric($field))
+                        {
+                                $sql .= &quot;\n\t$attributes&quot;;
+                        }
+                        else
+                        {
+                                $attributes = array_change_key_case($attributes, CASE_UPPER);
+                                
+                                $sql .= &quot;\n\t&quot;.$this-&gt;db-&gt;_protect_identifiers($field);
+
+                                if (array_key_exists('NAME', $attributes))
+                                {
+                                        $sql .= ' '.$this-&gt;db-&gt;_protect_identifiers($attributes['NAME']).' ';
+                                }
+                                
+                                if (array_key_exists('TYPE', $attributes))
+                                {
+                                        $sql .=  ' '.$attributes['TYPE'];
+                                }
+        
+                                if (array_key_exists('CONSTRAINT', $attributes))
+                                {
+                                        $sql .= '('.$attributes['CONSTRAINT'].')';
+                                }
+        
+                                if (array_key_exists('UNSIGNED', $attributes) &amp;&amp; $attributes['UNSIGNED'] === TRUE)
+                                {
+                                        $sql .= ' UNSIGNED';
+                                }
+        
+                                if (array_key_exists('DEFAULT', $attributes))
+                                {
+                                        $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+                                }
+        
+                                if (array_key_exists('NULL', $attributes))
+                                {
+                                        $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
+                                }
+        
+                                if (array_key_exists('AUTO_INCREMENT', $attributes) &amp;&amp; $attributes['AUTO_INCREMENT'] === TRUE)
+                                {
+                                        $sql .= ' AUTO_INCREMENT';
+                                }
+                        }
+                        
+                        // don't add a comma on the end of the last field
+                        if (++$current_field_count &lt; count($fields))
+                        {
+                                $sql .= ',';
+                        }
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        private
+         * @param        string        the table name
+         * @param        mixed        the fields
+         * @param        mixed        primary key(s)
+         * @param        mixed        key(s)
+         * @param        boolean        should 'IF NOT EXISTS' be added to the SQL
+         * @return        bool
+         */
+        function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+        {
+                $sql = 'CREATE TABLE ';
+                
+                if ($if_not_exists === TRUE)
+                {
+                        $sql .= 'IF NOT EXISTS ';
+                }
+                
+                $sql .= $this-&gt;db-&gt;_escape_identifiers($table).&quot; (&quot;;
+
+                $sql .= $this-&gt;_process_fields($fields);
+
+                if (count($primary_keys) &gt; 0)
+                {
+                        $key_name = $this-&gt;db-&gt;_protect_identifiers(implode('_', $primary_keys));
+                        $primary_keys = $this-&gt;db-&gt;_protect_identifiers($primary_keys);
+                        $sql .= &quot;,\n\tPRIMARY KEY &quot;.$key_name.&quot; (&quot; . implode(', ', $primary_keys) . &quot;)&quot;;
+                }
+
+                if (is_array($keys) &amp;&amp; count($keys) &gt; 0)
+                {
+                        foreach ($keys as $key)
+                        {
+                                if (is_array($key))
+                                {
+                                        $key_name = $this-&gt;db-&gt;_protect_identifiers(implode('_', $key));
+                                        $key = $this-&gt;db-&gt;_protect_identifiers($key);        
+                                }
+                                else
+                                {
+                                        $key_name = $this-&gt;db-&gt;_protect_identifiers($key);
+                                        $key = array($key_name);
+                                }
+                                
+                                $sql .= &quot;,\n\tKEY {$key_name} (&quot; . implode(', ', $key) . &quot;)&quot;;
+                        }
+                }
+
+                $sql .= &quot;\n) DEFAULT CHARACTER SET {$this-&gt;db-&gt;char_set} COLLATE {$this-&gt;db-&gt;dbcollat};&quot;;
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         * @access        private
+         * @return        string
+         */
+        function _drop_table($table)
+        {
+                return &quot;DROP TABLE IF EXISTS &quot;.$this-&gt;db-&gt;_escape_identifiers($table);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Alter table query
+         *
+         * Generates a platform-specific query so that a table can be altered
+         * Called by add_column(), drop_column(), and column_alter(),
+         *
+         * @access        private
+         * @param        string        the ALTER type (ADD, DROP, CHANGE)
+         * @param        string        the column name
+         * @param        array        fields
+         * @param        string        the field after which we should add the new field
+         * @return        object
+         */
+        function _alter_table($alter_type, $table, $fields, $after_field = '')
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table).&quot; $alter_type &quot;;
+
+                // DROP has everything it needs now.
+                if ($alter_type == 'DROP')
+                {
+                        return $sql.$this-&gt;db-&gt;_protect_identifiers($fields);
+                }
+
+                $sql .= $this-&gt;_process_fields($fields);
+
+                if ($after_field != '')
+                {
+                        $sql .= ' AFTER ' . $this-&gt;db-&gt;_protect_identifiers($after_field);
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename a table
+         *
+         * Generates a platform-specific query so that a table can be renamed
+         *
+         * @access        private
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        string
+         */
+        function _rename_table($table_name, $new_table_name)
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table_name).&quot; RENAME TO &quot;.$this-&gt;db-&gt;_protect_identifiers($new_table_name);
+                return $sql;
+        }
+
+}
+
+/* End of file mysql_forge.php */
+/* Location: ./system/database/drivers/mysql/mysql_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,169 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// --------------------------------------------------------------------
+
+/**
+ * MySQL Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysql_result extends CI_DB_result {
+
+        /**
+         * Number of rows in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_rows()
+        {
+                return @mysql_num_rows($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Number of fields in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_fields()
+        {
+                return @mysql_num_fields($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch Field Names
+         *
+         * Generates an array of column names
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_fields()
+        {
+                $field_names = array();
+                while ($field = mysql_fetch_field($this-&gt;result_id))
+                {
+                        $field_names[] = $field-&gt;name;
+                }
+                
+                return $field_names;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data
+         *
+         * Generates an array of objects containing field meta-data
+         *
+         * @access        public
+         * @return        array
+         */
+        function field_data()
+        {
+                $retval = array();
+                while ($field = mysql_fetch_field($this-&gt;result_id))
+                {        
+                        $F                                = new stdClass();
+                        $F-&gt;name                 = $field-&gt;name;
+                        $F-&gt;type                 = $field-&gt;type;
+                        $F-&gt;default                = $field-&gt;def;
+                        $F-&gt;max_length        = $field-&gt;max_length;
+                        $F-&gt;primary_key = $field-&gt;primary_key;
+                        
+                        $retval[] = $F;
+                }
+                
+                return $retval;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Free the result
+         *
+         * @return        null
+         */                
+        function free_result()
+        {
+                if (is_resource($this-&gt;result_id))
+                {
+                        mysql_free_result($this-&gt;result_id);
+                        $this-&gt;result_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Data Seek
+         *
+         * Moves the internal pointer to the desired offset.  We call
+         * this internally before fetching results to make sure the
+         * result set starts at zero
+         *
+         * @access        private
+         * @return        array
+         */
+        function _data_seek($n = 0)
+        {
+                return mysql_data_seek($this-&gt;result_id, $n);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - associative array
+         *
+         * Returns the result set as an array
+         *
+         * @access        private
+         * @return        array
+         */
+        function _fetch_assoc()
+        {
+                return mysql_fetch_assoc($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - object
+         *
+         * Returns the result set as an object
+         *
+         * @access        private
+         * @return        object
+         */
+        function _fetch_object()
+        {
+                return mysql_fetch_object($this-&gt;result_id);
+        }
+        
+}
+
+
+/* End of file mysql_result.php */
+/* Location: ./system/database/drivers/mysql/mysql_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlmysql_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysql/mysql_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,245 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQL Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysql_utility extends CI_DB_utility {
+
+        /**
+         * List databases
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _list_databases()
+        {
+                return &quot;SHOW DATABASES&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize table query
+         *
+         * Generates a platform-specific query so that a table can be optimized
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _optimize_table($table)
+        {
+                return &quot;OPTIMIZE TABLE &quot;.$this-&gt;db-&gt;_escape_identifiers($table);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Repair table query
+         *
+         * Generates a platform-specific query so that a table can be repaired
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _repair_table($table)
+        {
+                return &quot;REPAIR TABLE &quot;.$this-&gt;db-&gt;_escape_identifiers($table);
+        }
+
+        // --------------------------------------------------------------------
+        /**
+         * MySQL Export
+         *
+         * @access        private
+         * @param        array        Preferences
+         * @return        mixed
+         */
+        function _backup($params = array())
+        {
+                if (count($params) == 0)
+                {
+                        return FALSE;
+                }
+
+                // Extract the prefs for simplicity
+                extract($params);
+        
+                // Build the output
+                $output = '';
+                foreach ((array)$tables as $table)
+                {
+                        // Is the table in the &quot;ignore&quot; list?
+                        if (in_array($table, (array)$ignore, TRUE))
+                        {
+                                continue;
+                        }
+
+                        // Get the table schema
+                        $query = $this-&gt;db-&gt;query(&quot;SHOW CREATE TABLE `&quot;.$this-&gt;db-&gt;database.'`.'.$table);
+                        
+                        // No result means the table name was invalid
+                        if ($query === FALSE)
+                        {
+                                continue;
+                        }
+                        
+                        // Write out the table schema
+                        $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
+
+                         if ($add_drop == TRUE)
+                         {
+                                $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
+                        }
+                        
+                        $i = 0;
+                        $result = $query-&gt;result_array();
+                        foreach ($result[0] as $val)
+                        {
+                                if ($i++ % 2)
+                                {                                         
+                                        $output .= $val.';'.$newline.$newline;
+                                }
+                        }
+                        
+                        // If inserts are not needed we're done...
+                        if ($add_insert == FALSE)
+                        {
+                                continue;
+                        }
+
+                        // Grab all the data from the current table
+                        $query = $this-&gt;db-&gt;query(&quot;SELECT * FROM $table&quot;);
+                        
+                        if ($query-&gt;num_rows() == 0)
+                        {
+                                continue;
+                        }
+                
+                        // Fetch the field names and determine if the field is an
+                        // integer type.  We use this info to decide whether to
+                        // surround the data with quotes or not
+                        
+                        $i = 0;
+                        $field_str = '';
+                        $is_int = array();
+                        while ($field = mysql_fetch_field($query-&gt;result_id))
+                        {
+                                // Most versions of MySQL store timestamp as a string
+                                $is_int[$i] = (in_array(
+                                                                                strtolower(mysql_field_type($query-&gt;result_id, $i)),
+                                                                                array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), //, 'timestamp'), 
+                                                                                TRUE)
+                                                                                ) ? TRUE : FALSE;
+                                                                                
+                                // Create a string of field names
+                                $field_str .= '`'.$field-&gt;name.'`, ';
+                                $i++;
+                        }
+                        
+                        // Trim off the end comma
+                        $field_str = preg_replace( &quot;/, $/&quot; , &quot;&quot; , $field_str);
+                        
+                        
+                        // Build the insert string
+                        foreach ($query-&gt;result_array() as $row)
+                        {
+                                $val_str = '';
+                        
+                                $i = 0;
+                                foreach ($row as $v)
+                                {
+                                        // Is the value NULL?
+                                        if ($v === NULL)
+                                        {
+                                                $val_str .= 'NULL';
+                                        }
+                                        else
+                                        {
+                                                // Escape the data if it's not an integer
+                                                if ($is_int[$i] == FALSE)
+                                                {
+                                                        $val_str .= $this-&gt;db-&gt;escape($v);
+                                                }
+                                                else
+                                                {
+                                                        $val_str .= $v;
+                                                }                                        
+                                        }                                        
+                                        
+                                        // Append a comma
+                                        $val_str .= ', ';
+                                        $i++;
+                                }
+                                
+                                // Remove the comma at the end of the string
+                                $val_str = preg_replace( &quot;/, $/&quot; , &quot;&quot; , $val_str);
+                                                                
+                                // Build the INSERT string
+                                $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
+                        }
+                        
+                        $output .= $newline.$newline;
+                }
+
+                return $output;
+        }
+
+        /**
+         *
+         * The functions below have been deprecated as of 1.6, and are only here for backwards
+         * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
+         * is STRONGLY discouraged in favour if using dbforge.
+         *
+         */
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+}
+
+/* End of file mysql_utility.php */
+/* Location: ./system/database/drivers/mysql/mysql_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqliindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,671 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQLi Database Adapter Class - MySQLi only works with PHP 5
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysqli_driver extends CI_DB {
+
+        var $dbdriver = 'mysqli';
+        
+        // The character used for escaping
+        var $_escape_char = '`';
+
+        // clause and character used for LIKE escape sequences - not used in MySQL
+        var $_like_escape_str = '';
+        var $_like_escape_chr = '';
+
+        /**
+         * The syntax to count rows is slightly different across different
+         * database engines, so this string appears in each driver and is
+         * used for the count_all() and count_all_results() functions.
+         */
+        var $_count_string = &quot;SELECT COUNT(*) AS &quot;;
+        var $_random_keyword = ' RAND()'; // database specific random keyword
+
+        /**
+         * Whether to use the MySQL &quot;delete hack&quot; which allows the number
+         * of affected rows to be shown. Uses a preg_replace when enabled,
+         * adding a bit more processing to all queries.
+         */        
+        var $delete_hack = TRUE;
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Non-persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_connect()
+        {
+                if ($this-&gt;port != '')
+                {
+                        return @mysqli_connect($this-&gt;hostname, $this-&gt;username, $this-&gt;password, $this-&gt;database, $this-&gt;port);                        
+                }
+                else
+                {
+                        return @mysqli_connect($this-&gt;hostname, $this-&gt;username, $this-&gt;password, $this-&gt;database);
+                }
+
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_pconnect()
+        {
+                return $this-&gt;db_connect();
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Reconnect
+         *
+         * Keep / reestablish the db connection if no queries have been
+         * sent for a length of time exceeding the server's idle timeout
+         *
+         * @access        public
+         * @return        void
+         */
+        function reconnect()
+        {
+                if (mysqli_ping($this-&gt;conn_id) === FALSE)
+                {
+                        $this-&gt;conn_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select the database
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_select()
+        {
+                return @mysqli_select_db($this-&gt;conn_id, $this-&gt;database);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set client character set
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function _db_set_charset($charset, $collation)
+        {
+                return @mysqli_query($this-&gt;conn_id, &quot;SET NAMES '&quot;.$this-&gt;escape_str($charset).&quot;' COLLATE '&quot;.$this-&gt;escape_str($collation).&quot;'&quot;);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Version number query string
+         *
+         * @access        public
+         * @return        string
+         */
+        function _version()
+        {
+                return &quot;SELECT version() AS ver&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Execute the query
+         *
+         * @access        private called by the base class
+         * @param        string        an SQL query
+         * @return        resource
+         */        
+        function _execute($sql)
+        {
+                $sql = $this-&gt;_prep_query($sql);        
+                $result = @mysqli_query($this-&gt;conn_id, $sql);
+                return $result;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep the query
+         *
+         * If needed, each database adapter can prep the query string
+         *
+         * @access        private called by execute()
+         * @param        string        an SQL query
+         * @return        string
+         */        
+        function _prep_query($sql)
+        {
+                // &quot;DELETE FROM TABLE&quot; returns 0 affected rows This hack modifies
+                // the query so that it returns the number of affected rows
+                if ($this-&gt;delete_hack === TRUE)
+                {
+                        if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql))
+                        {
+                                $sql = preg_replace(&quot;/^\s*DELETE\s+FROM\s+(\S+)\s*$/&quot;, &quot;DELETE FROM \\1 WHERE 1=1&quot;, $sql);
+                        }
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Begin Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_begin($test_mode = FALSE)
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+                
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                // Reset the transaction failure flag.
+                // If the $test_mode flag is set to TRUE transactions will be rolled back
+                // even if the queries produce a successful result.
+                $this-&gt;_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+
+                $this-&gt;simple_query('SET AUTOCOMMIT=0');
+                $this-&gt;simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Commit Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_commit()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('COMMIT');
+                $this-&gt;simple_query('SET AUTOCOMMIT=1');
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rollback Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_rollback()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('ROLLBACK');
+                $this-&gt;simple_query('SET AUTOCOMMIT=1');
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape String
+         *
+         * @access        public
+         * @param        string
+         * @param        bool        whether or not the string will be used in a LIKE condition
+         * @return        string
+         */
+        function escape_str($str, $like = FALSE)        
+        {
+                if (is_array($str))
+                {
+                        foreach($str as $key =&gt; $val)
+                           {
+                                $str[$key] = $this-&gt;escape_str($val, $like);
+                           }
+                   
+                           return $str;
+                   }
+
+                if (function_exists('mysqli_real_escape_string') AND is_object($this-&gt;conn_id))
+                {
+                        $str = mysqli_real_escape_string($this-&gt;conn_id, $str);
+                }
+                elseif (function_exists('mysql_escape_string'))
+                {
+                        $str = mysql_escape_string($str);
+                }
+                else
+                {
+                        $str = addslashes($str);
+                }
+                
+                // escape LIKE condition wildcards
+                if ($like === TRUE)
+                {
+                        $str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
+                }
+                
+                return $str;
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Affected Rows
+         *
+         * @access        public
+         * @return        integer
+         */
+        function affected_rows()
+        {
+                return @mysqli_affected_rows($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Insert ID
+         *
+         * @access        public
+         * @return        integer
+         */
+        function insert_id()
+        {
+                return @mysqli_insert_id($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Count All&quot; query
+         *
+         * Generates a platform-specific query string that counts all records in
+         * the specified database
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function count_all($table = '')
+        {
+                if ($table == '')
+                {
+                        return 0;
+                }
+
+                $query = $this-&gt;query($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows') . &quot; FROM &quot; . $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE));
+
+                if ($query-&gt;num_rows() == 0)
+                {
+                        return 0;
+                }
+
+                $row = $query-&gt;row();
+                return (int) $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * List table query
+         *
+         * Generates a platform-specific query string so that the table names can be fetched
+         *
+         * @access        private
+         * @param        boolean
+         * @return        string
+         */
+        function _list_tables($prefix_limit = FALSE)
+        {
+                $sql = &quot;SHOW TABLES FROM &quot;.$this-&gt;_escape_char.$this-&gt;database.$this-&gt;_escape_char;        
+                
+                if ($prefix_limit !== FALSE AND $this-&gt;dbprefix != '')
+                {
+                        $sql .= &quot; LIKE '&quot;.$this-&gt;escape_like_str($this-&gt;dbprefix).&quot;%'&quot;;
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Show column query
+         *
+         * Generates a platform-specific query string so that the column names can be fetched
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */
+        function _list_columns($table = '')
+        {
+                return &quot;SHOW COLUMNS FROM &quot;.$table;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data query
+         *
+         * Generates a platform-specific query so that the column data can be retrieved
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        object
+         */
+        function _field_data($table)
+        {
+                return &quot;SELECT * FROM &quot;.$table.&quot; LIMIT 1&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message string
+         *
+         * @access        private
+         * @return        string
+         */
+        function _error_message()
+        {
+                return mysqli_error($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message number
+         *
+         * @access        private
+         * @return        integer
+         */
+        function _error_number()
+        {
+                return mysqli_errno($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape the SQL Identifiers
+         *
+         * This function escapes column and table names
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _escape_identifiers($item)
+        {
+                if ($this-&gt;_escape_char == '')
+                {
+                        return $item;
+                }
+                
+                foreach ($this-&gt;_reserved_identifiers as $id)
+                {
+                        if (strpos($item, '.'.$id) !== FALSE)
+                        {
+                                $str = $this-&gt;_escape_char. str_replace('.', $this-&gt;_escape_char.'.', $item);  
+                                
+                                // remove duplicates if the user already included the escape
+                                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+                        }                
+                }
+                
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $str = $this-&gt;_escape_char.str_replace('.', $this-&gt;_escape_char.'.'.$this-&gt;_escape_char, $item).$this-&gt;_escape_char;                        
+                }
+                else
+                {
+                        $str = $this-&gt;_escape_char.$item.$this-&gt;_escape_char;
+                }
+                
+                // remove duplicates if the user already included the escape
+                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+        }
+                        
+        // --------------------------------------------------------------------
+
+        /**
+         * From Tables
+         *
+         * This function implicitly groups FROM tables so there is no confusion
+         * about operator precedence in harmony with SQL standards
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _from_tables($tables)
+        {
+                if ( ! is_array($tables))
+                {
+                        $tables = array($tables);
+                }
+                
+                return '('.implode(', ', $tables).')';
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert statement
+         *
+         * Generates a platform-specific insert string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the insert keys
+         * @param        array        the insert values
+         * @return        string
+         */
+        function _insert($table, $keys, $values)
+        {        
+                return &quot;INSERT INTO &quot;.$table.&quot; (&quot;.implode(', ', $keys).&quot;) VALUES (&quot;.implode(', ', $values).&quot;)&quot;;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Update statement
+         *
+         * Generates a platform-specific update string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the update data
+         * @param        array        the where clause
+         * @param        array        the orderby clause
+         * @param        array        the limit clause
+         * @return        string
+         */
+        function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+        {
+                foreach($values as $key =&gt; $val)
+                {
+                        $valstr[] = $key.&quot; = &quot;.$val;
+                }
+                
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+                
+                $orderby = (count($orderby) &gt;= 1)?' ORDER BY '.implode(&quot;, &quot;, $orderby):'';
+        
+                $sql = &quot;UPDATE &quot;.$table.&quot; SET &quot;.implode(', ', $valstr);
+                
+                $sql .= ($where != '' AND count($where) &gt;=1) ? &quot; WHERE &quot;.implode(&quot; &quot;, $where) : '';
+                
+                $sql .= $orderby.$limit;
+                
+                return $sql;
+        }
+
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate statement
+         *
+         * Generates a platform-specific truncate string from the supplied data
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */        
+        function _truncate($table)
+        {
+                return &quot;TRUNCATE &quot;.$table;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete statement
+         *
+         * Generates a platform-specific delete string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the where clause
+         * @param        string        the limit clause
+         * @return        string
+         */        
+        function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+        {
+                $conditions = '';
+
+                if (count($where) &gt; 0 OR count($like) &gt; 0)
+                {
+                        $conditions = &quot;\nWHERE &quot;;
+                        $conditions .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                        if (count($where) &gt; 0 &amp;&amp; count($like) &gt; 0)
+                        {
+                                $conditions .= &quot; AND &quot;;
+                        }
+                        $conditions .= implode(&quot;\n&quot;, $like);
+                }
+
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+        
+                return &quot;DELETE FROM &quot;.$table.$conditions.$limit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Limit string
+         *
+         * Generates a platform-specific LIMIT clause
+         *
+         * @access        public
+         * @param        string        the sql query string
+         * @param        integer        the number of rows to limit the query to
+         * @param        integer        the offset value
+         * @return        string
+         */
+        function _limit($sql, $limit, $offset)
+        {        
+                $sql .= &quot;LIMIT &quot;.$limit;
+        
+                if ($offset &gt; 0)
+                {
+                        $sql .= &quot; OFFSET &quot;.$offset;
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access        public
+         * @param        resource
+         * @return        void
+         */
+        function _close($conn_id)
+        {
+                @mysqli_close($conn_id);
+        }
+
+
+}
+
+
+/* End of file mysqli_driver.php */
+/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,254 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQLi Forge Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysqli_forge extends CI_DB_forge {
+        
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Process Fields
+         *
+         * @access        private
+         * @param        mixed        the fields
+         * @return        string
+         */
+        function _process_fields($fields)
+        {
+                $current_field_count = 0;
+                $sql = '';
+
+                foreach ($fields as $field=&gt;$attributes)
+                {
+                        // Numeric field names aren't allowed in databases, so if the key is
+                        // numeric, we know it was assigned by PHP and the developer manually
+                        // entered the field information, so we'll simply add it to the list
+                        if (is_numeric($field))
+                        {
+                                $sql .= &quot;\n\t$attributes&quot;;
+                        }
+                        else
+                        {
+                                $attributes = array_change_key_case($attributes, CASE_UPPER);
+                                
+                                $sql .= &quot;\n\t&quot;.$this-&gt;db-&gt;_protect_identifiers($field);
+
+                                if (array_key_exists('NAME', $attributes))
+                                {
+                                        $sql .= ' '.$this-&gt;db-&gt;_protect_identifiers($attributes['NAME']).' ';
+                                }
+                                
+                                if (array_key_exists('TYPE', $attributes))
+                                {
+                                        $sql .=  ' '.$attributes['TYPE'];
+                                }
+        
+                                if (array_key_exists('CONSTRAINT', $attributes))
+                                {
+                                        $sql .= '('.$attributes['CONSTRAINT'].')';
+                                }
+        
+                                if (array_key_exists('UNSIGNED', $attributes) &amp;&amp; $attributes['UNSIGNED'] === TRUE)
+                                {
+                                        $sql .= ' UNSIGNED';
+                                }
+        
+                                if (array_key_exists('DEFAULT', $attributes))
+                                {
+                                        $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+                                }
+        
+                                if (array_key_exists('NULL', $attributes))
+                                {
+                                        $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
+                                }
+        
+                                if (array_key_exists('AUTO_INCREMENT', $attributes) &amp;&amp; $attributes['AUTO_INCREMENT'] === TRUE)
+                                {
+                                        $sql .= ' AUTO_INCREMENT';
+                                }
+                        }
+                        
+                        // don't add a comma on the end of the last field
+                        if (++$current_field_count &lt; count($fields))
+                        {
+                                $sql .= ',';
+                        }
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        private
+         * @param        string        the table name
+         * @param        mixed        the fields
+         * @param        mixed        primary key(s)
+         * @param        mixed        key(s)
+         * @param        boolean        should 'IF NOT EXISTS' be added to the SQL
+         * @return        bool
+         */
+        function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+        {
+                $sql = 'CREATE TABLE ';
+                
+                if ($if_not_exists === TRUE)
+                {
+                        $sql .= 'IF NOT EXISTS ';
+                }
+                
+                $sql .= $this-&gt;db-&gt;_escape_identifiers($table).&quot; (&quot;;
+
+                $sql .= $this-&gt;_process_fields($fields);
+
+                if (count($primary_keys) &gt; 0)
+                {
+                        $key_name = $this-&gt;db-&gt;_protect_identifiers(implode('_', $primary_keys));
+                        $primary_keys = $this-&gt;db-&gt;_protect_identifiers($primary_keys);
+                        $sql .= &quot;,\n\tPRIMARY KEY &quot;.$key_name.&quot; (&quot; . implode(', ', $primary_keys) . &quot;)&quot;;
+                }
+
+                if (is_array($keys) &amp;&amp; count($keys) &gt; 0)
+                {
+                        foreach ($keys as $key)
+                        {
+                                if (is_array($key))
+                                {
+                                        $key_name = $this-&gt;db-&gt;_protect_identifiers(implode('_', $key));
+                                        $key = $this-&gt;db-&gt;_protect_identifiers($key);        
+                                }
+                                else
+                                {
+                                        $key_name = $this-&gt;db-&gt;_protect_identifiers($key);
+                                        $key = array($key_name);
+                                }
+                                
+                                $sql .= &quot;,\n\tKEY {$key_name} (&quot; . implode(', ', $key) . &quot;)&quot;;
+                        }
+                }
+
+                $sql .= &quot;\n) DEFAULT CHARACTER SET {$this-&gt;db-&gt;char_set} COLLATE {$this-&gt;db-&gt;dbcollat};&quot;;
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         * @access        private
+         * @return        string
+         */
+        function _drop_table($table)
+        {
+                return &quot;DROP TABLE IF EXISTS &quot;.$this-&gt;db-&gt;_escape_identifiers($table);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Alter table query
+         *
+         * Generates a platform-specific query so that a table can be altered
+         * Called by add_column(), drop_column(), and column_alter(),
+         *
+         * @access        private
+         * @param        string        the ALTER type (ADD, DROP, CHANGE)
+         * @param        string        the column name
+         * @param        array        fields
+         * @param        string        the field after which we should add the new field
+         * @return        object
+         */
+        function _alter_table($alter_type, $table, $fields, $after_field = '')
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table).&quot; $alter_type &quot;;
+
+                // DROP has everything it needs now.
+                if ($alter_type == 'DROP')
+                {
+                        return $sql.$this-&gt;db-&gt;_protect_identifiers($fields);
+                }
+
+                $sql .= $this-&gt;_process_fields($fields);
+
+                if ($after_field != '')
+                {
+                        $sql .= ' AFTER ' . $this-&gt;db-&gt;_protect_identifiers($after_field);
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename a table
+         *
+         * Generates a platform-specific query so that a table can be renamed
+         *
+         * @access        private
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        string
+         */
+        function _rename_table($table_name, $new_table_name)
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table_name).&quot; RENAME TO &quot;.$this-&gt;db-&gt;_protect_identifiers($new_table_name);
+                return $sql;
+        }
+
+}
+
+/* End of file mysqli_forge.php */
+/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,169 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQLi Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysqli_result extends CI_DB_result {
+        
+        /**
+         * Number of rows in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_rows()
+        {
+                return @mysqli_num_rows($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Number of fields in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_fields()
+        {
+                return @mysqli_num_fields($this-&gt;result_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch Field Names
+         *
+         * Generates an array of column names
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_fields()
+        {
+                $field_names = array();
+                while ($field = mysqli_fetch_field($this-&gt;result_id))
+                {
+                        $field_names[] = $field-&gt;name;
+                }
+                
+                return $field_names;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data
+         *
+         * Generates an array of objects containing field meta-data
+         *
+         * @access        public
+         * @return        array
+         */
+        function field_data()
+        {
+                $retval = array();
+                while ($field = mysqli_fetch_field($this-&gt;result_id))
+                {        
+                        $F                                 = new stdClass();
+                        $F-&gt;name                 = $field-&gt;name;
+                        $F-&gt;type                 = $field-&gt;type;
+                        $F-&gt;default                = $field-&gt;def;
+                        $F-&gt;max_length        = $field-&gt;max_length;
+                        $F-&gt;primary_key = ($field-&gt;flags &amp; MYSQLI_PRI_KEY_FLAG) ? 1 : 0;
+                        
+                        $retval[] = $F;
+                }
+                
+                return $retval;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Free the result
+         *
+         * @return        null
+         */                
+        function free_result()
+        {
+                if (is_object($this-&gt;result_id))
+                {
+                        mysqli_free_result($this-&gt;result_id);
+                        $this-&gt;result_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Data Seek
+         *
+         * Moves the internal pointer to the desired offset.  We call
+         * this internally before fetching results to make sure the
+         * result set starts at zero
+         *
+         * @access        private
+         * @return        array
+         */
+        function _data_seek($n = 0)
+        {
+                return mysqli_data_seek($this-&gt;result_id, $n);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - associative array
+         *
+         * Returns the result set as an array
+         *
+         * @access        private
+         * @return        array
+         */
+        function _fetch_assoc()
+        {
+                return mysqli_fetch_assoc($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - object
+         *
+         * Returns the result set as an object
+         *
+         * @access        private
+         * @return        object
+         */
+        function _fetch_object()
+        {
+                return mysqli_fetch_object($this-&gt;result_id);
+        }
+        
+}
+
+
+/* End of file mysqli_result.php */
+/* Location: ./system/database/drivers/mysqli/mysqli_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversmysqlimysqli_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/mysqli/mysqli_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,123 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MySQLi Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_mysqli_utility extends CI_DB_utility {
+        
+        /**
+         * List databases
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _list_databases()
+        {
+                return &quot;SHOW DATABASES&quot;;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize table query
+         *
+         * Generates a platform-specific query so that a table can be optimized
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _optimize_table($table)
+        {
+                return &quot;OPTIMIZE TABLE &quot;.$this-&gt;db-&gt;_escape_identifiers($table);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Repair table query
+         *
+         * Generates a platform-specific query so that a table can be repaired
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _repair_table($table)
+        {
+                return &quot;REPAIR TABLE &quot;.$this-&gt;db-&gt;_escape_identifiers($table);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * MySQLi Export
+         *
+         * @access        private
+         * @param        array        Preferences
+         * @return        mixed
+         */
+        function _backup($params = array())
+        {
+                // Currently unsupported
+                return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+        }
+
+
+        /**
+         *
+         * The functions below have been deprecated as of 1.6, and are only here for backwards
+         * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
+         * is STRONGLY discouraged in favour if using dbforge.
+         *
+         */
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+}
+
+/* End of file mysqli_utility.php */
+/* Location: ./system/database/drivers/mysqli/mysqli_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8indexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,780 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                 CodeIgniter
+ * @author                  ExpressionEngine Dev Team
+ * @copyright   Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                 http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                   Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * oci8 Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package                 CodeIgniter
+ * @subpackage  Drivers
+ * @category        Database
+ * @author                  ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+
+/**
+ * oci8 Database Adapter Class
+ *
+ * This is a modification of the DB_driver class to
+ * permit access to oracle databases
+ *
+ * NOTE: this uses the PHP 4 oci methods
+ *
+ * @author          Kelly McArdle
+ *
+ */
+
+class CI_DB_oci8_driver extends CI_DB {
+
+        var $dbdriver = 'oci8';
+        
+        // The character used for excaping
+        var $_escape_char = '&quot;';
+        
+        // clause and character used for LIKE escape sequences
+        var $_like_escape_str = &quot; escape '%s' &quot;;
+        var $_like_escape_chr = '!';
+        
+        /**
+         * The syntax to count rows is slightly different across different
+         * database engines, so this string appears in each driver and is
+         * used for the count_all() and count_all_results() functions.
+         */
+        var $_count_string = &quot;SELECT COUNT(1) AS &quot;;
+        var $_random_keyword = ' ASC'; // not currently supported
+
+        // Set &quot;auto commit&quot; by default
+        var $_commit = OCI_COMMIT_ON_SUCCESS;
+
+        // need to track statement id and cursor id
+        var $stmt_id;
+        var $curs_id;
+
+        // if we use a limit, we will add a field that will
+        // throw off num_fields later
+        var $limit_used;
+
+        /**
+         * Non-persistent database connection
+         *
+         * @access  private called by the base class
+         * @return  resource
+         */
+        function db_connect()
+        {
+                return @ocilogon($this-&gt;username, $this-&gt;password, $this-&gt;hostname);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Persistent database connection
+         *
+         * @access  private called by the base class
+         * @return  resource
+         */
+        function db_pconnect()
+        {
+                return @ociplogon($this-&gt;username, $this-&gt;password, $this-&gt;hostname);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Reconnect
+         *
+         * Keep / reestablish the db connection if no queries have been
+         * sent for a length of time exceeding the server's idle timeout
+         *
+         * @access        public
+         * @return        void
+         */
+        function reconnect()
+        {
+                // not implemented in oracle
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select the database
+         *
+         * @access  private called by the base class
+         * @return  resource
+         */
+        function db_select()
+        {
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set client character set
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function db_set_charset($charset, $collation)
+        {
+                // @todo - add support if needed
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Version number query string
+         *
+         * @access  public
+         * @return  string
+         */
+        function _version()
+        {
+                return ociserverversion($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Execute the query
+         *
+         * @access  private called by the base class
+         * @param   string  an SQL query
+         * @return  resource
+         */
+        function _execute($sql)
+        {
+                // oracle must parse the query before it is run. All of the actions with
+                // the query are based on the statement id returned by ociparse
+                $this-&gt;stmt_id = FALSE;
+                $this-&gt;_set_stmt_id($sql);
+                ocisetprefetch($this-&gt;stmt_id, 1000);
+                return @ociexecute($this-&gt;stmt_id, $this-&gt;_commit);
+        }
+
+        /**
+         * Generate a statement ID
+         *
+         * @access  private
+         * @param   string  an SQL query
+         * @return  none
+         */
+        function _set_stmt_id($sql)
+        {
+                if ( ! is_resource($this-&gt;stmt_id))
+                {
+                        $this-&gt;stmt_id = ociparse($this-&gt;conn_id, $this-&gt;_prep_query($sql));
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep the query
+         *
+         * If needed, each database adapter can prep the query string
+         *
+         * @access  private called by execute()
+         * @param   string  an SQL query
+         * @return  string
+         */
+        function _prep_query($sql)
+        {
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * getCursor.  Returns a cursor from the datbase
+         *
+         * @access  public
+         * @return  cursor id
+         */
+        function get_cursor()
+        {
+                $this-&gt;curs_id = ocinewcursor($this-&gt;conn_id);
+                return $this-&gt;curs_id;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Stored Procedure.  Executes a stored procedure
+         *
+         * @access  public
+         * @param   package         package stored procedure is in
+         * @param   procedure   stored procedure to execute
+         * @param   params          array of parameters
+         * @return  array
+         *
+         * params array keys
+         *
+         * KEY          OPTIONAL        NOTES
+         * name                no                the name of the parameter should be in :&lt;param_name&gt; format
+         * value        no                the value of the parameter.  If this is an OUT or IN OUT parameter,
+         *                                        this should be a reference to a variable
+         * type                yes                the type of the parameter
+         * length        yes                the max size of the parameter
+         */
+        function stored_procedure($package, $procedure, $params)
+        {
+                if ($package == '' OR $procedure == '' OR ! is_array($params))
+                {
+                        if ($this-&gt;db_debug)
+                        {
+                                log_message('error', 'Invalid query: '.$package.'.'.$procedure);
+                                return $this-&gt;display_error('db_invalid_query');
+                        }
+                        return FALSE;
+                }
+                
+                // build the query string
+                $sql = &quot;begin $package.$procedure(&quot;;
+
+                $have_cursor = FALSE;
+                foreach($params as $param)
+                {
+                        $sql .= $param['name'] . &quot;,&quot;;
+                        
+                        if (array_key_exists('type', $param) &amp;&amp; ($param['type'] == OCI_B_CURSOR))
+                        {
+                                $have_cursor = TRUE;
+                        }
+                }
+                $sql = trim($sql, &quot;,&quot;) . &quot;); end;&quot;;
+                                
+                $this-&gt;stmt_id = FALSE;
+                $this-&gt;_set_stmt_id($sql);
+                $this-&gt;_bind_params($params);
+                $this-&gt;query($sql, FALSE, $have_cursor);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Bind parameters
+         *
+         * @access  private
+         * @return  none
+         */
+        function _bind_params($params)
+        {
+                if ( ! is_array($params) OR ! is_resource($this-&gt;stmt_id))
+                {
+                        return;
+                }
+                
+                foreach ($params as $param)
+                {
+                         foreach (array('name', 'value', 'type', 'length') as $val)
+                        {
+                                if ( ! isset($param[$val]))
+                                {
+                                        $param[$val] = '';
+                                }
+                        }
+
+                        ocibindbyname($this-&gt;stmt_id, $param['name'], $param['value'], $param['length'], $param['type']);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Begin Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_begin($test_mode = FALSE)
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+                
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+                
+                // Reset the transaction failure flag.
+                // If the $test_mode flag is set to TRUE transactions will be rolled back
+                // even if the queries produce a successful result.
+                $this-&gt;_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+                
+                $this-&gt;_commit = OCI_DEFAULT;
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Commit Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_commit()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $ret = OCIcommit($this-&gt;conn_id);
+                $this-&gt;_commit = OCI_COMMIT_ON_SUCCESS;
+                return $ret;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rollback Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_rollback()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $ret = OCIrollback($this-&gt;conn_id);
+                $this-&gt;_commit = OCI_COMMIT_ON_SUCCESS;
+                return $ret;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape String
+         *
+         * @access  public
+         * @param   string
+         * @param        bool        whether or not the string will be used in a LIKE condition
+         * @return  string
+         */
+        function escape_str($str, $like = FALSE)
+        {
+                if (is_array($str))
+                {
+                        foreach($str as $key =&gt; $val)
+                           {
+                                $str[$key] = $this-&gt;escape_str($val, $like);
+                           }
+                   
+                           return $str;
+                   }
+
+                // Access the CI object
+                $CI =&amp; get_instance();
+
+                $str = $CI-&gt;input-&gt;_remove_invisible_characters($str);
+                
+                // escape LIKE condition wildcards
+                if ($like === TRUE)
+                {
+                        $str = str_replace(        array('%', '_', $this-&gt;_like_escape_chr),
+                                                                array($this-&gt;_like_escape_chr.'%', $this-&gt;_like_escape_chr.'_', $this-&gt;_like_escape_chr.$this-&gt;_like_escape_chr),
+                                                                $str);
+                }
+                
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Affected Rows
+         *
+         * @access  public
+         * @return  integer
+         */
+        function affected_rows()
+        {
+                return @ocirowcount($this-&gt;stmt_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Insert ID
+         *
+         * @access  public
+         * @return  integer
+         */
+        function insert_id()
+        {
+                // not supported in oracle
+                return $this-&gt;display_error('db_unsupported_function');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Count All&quot; query
+         *
+         * Generates a platform-specific query string that counts all records in
+         * the specified database
+         *
+         * @access  public
+         * @param   string
+         * @return  string
+         */
+        function count_all($table = '')
+        {
+                if ($table == '')
+                {
+                        return 0;
+                }
+
+                $query = $this-&gt;query($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows') . &quot; FROM &quot; . $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE));
+
+                if ($query == FALSE)
+                {
+                        return 0;
+                }
+
+                $row = $query-&gt;row();
+                return (int) $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Show table query
+         *
+         * Generates a platform-specific query string so that the table names can be fetched
+         *
+         * @access  private
+         * @param        boolean
+         * @return  string
+         */
+        function _list_tables($prefix_limit = FALSE)
+        {
+                $sql = &quot;SELECT TABLE_NAME FROM ALL_TABLES&quot;;
+
+                if ($prefix_limit !== FALSE AND $this-&gt;dbprefix != '')
+                {
+                        $sql .= &quot; WHERE TABLE_NAME LIKE '&quot;.$this-&gt;escape_like_str($this-&gt;dbprefix).&quot;%' &quot;.sprintf($this-&gt;_like_escape_str, $this-&gt;_like_escape_char);
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Show column query
+         *
+         * Generates a platform-specific query string so that the column names can be fetched
+         *
+         * @access  public
+         * @param   string  the table name
+         * @return  string
+         */
+        function _list_columns($table = '')
+        {
+                return &quot;SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data query
+         *
+         * Generates a platform-specific query so that the column data can be retrieved
+         *
+         * @access  public
+         * @param   string  the table name
+         * @return  object
+         */
+        function _field_data($table)
+        {
+                return &quot;SELECT * FROM &quot;.$table.&quot; where rownum = 1&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message string
+         *
+         * @access  private
+         * @return  string
+         */
+        function _error_message()
+        {
+                $error = ocierror($this-&gt;conn_id);
+                return $error['message'];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message number
+         *
+         * @access  private
+         * @return  integer
+         */
+        function _error_number()
+        {
+                $error = ocierror($this-&gt;conn_id);
+                return $error['code'];
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape the SQL Identifiers
+         *
+         * This function escapes column and table names
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _escape_identifiers($item)
+        {
+                if ($this-&gt;_escape_char == '')
+                {
+                        return $item;
+                }
+
+                foreach ($this-&gt;_reserved_identifiers as $id)
+                {
+                        if (strpos($item, '.'.$id) !== FALSE)
+                        {
+                                $str = $this-&gt;_escape_char. str_replace('.', $this-&gt;_escape_char.'.', $item);  
+                                
+                                // remove duplicates if the user already included the escape
+                                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+                        }                
+                }
+        
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $str = $this-&gt;_escape_char.str_replace('.', $this-&gt;_escape_char.'.'.$this-&gt;_escape_char, $item).$this-&gt;_escape_char;                        
+                }
+                else
+                {
+                        $str = $this-&gt;_escape_char.$item.$this-&gt;_escape_char;
+                }
+                
+                // remove duplicates if the user already included the escape
+                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * From Tables
+         *
+         * This function implicitly groups FROM tables so there is no confusion
+         * about operator precedence in harmony with SQL standards
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _from_tables($tables)
+        {
+                if ( ! is_array($tables))
+                {
+                        $tables = array($tables);
+                }
+                
+                return implode(', ', $tables);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert statement
+         *
+         * Generates a platform-specific insert string from the supplied data
+         *
+         * @access  public
+         * @param   string  the table name
+         * @param   array   the insert keys
+         * @param   array   the insert values
+         * @return  string
+         */
+        function _insert($table, $keys, $values)
+        {
+        return &quot;INSERT INTO &quot;.$table.&quot; (&quot;.implode(', ', $keys).&quot;) VALUES (&quot;.implode(', ', $values).&quot;)&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Update statement
+         *
+         * Generates a platform-specific update string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the update data
+         * @param        array        the where clause
+         * @param        array        the orderby clause
+         * @param        array        the limit clause
+         * @return        string
+         */
+        function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+        {
+                foreach($values as $key =&gt; $val)
+                {
+                        $valstr[] = $key.&quot; = &quot;.$val;
+                }
+                
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+                
+                $orderby = (count($orderby) &gt;= 1)?' ORDER BY '.implode(&quot;, &quot;, $orderby):'';
+        
+                $sql = &quot;UPDATE &quot;.$table.&quot; SET &quot;.implode(', ', $valstr);
+
+                $sql .= ($where != '' AND count($where) &gt;=1) ? &quot; WHERE &quot;.implode(&quot; &quot;, $where) : '';
+
+                $sql .= $orderby.$limit;
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate statement
+         *
+         * Generates a platform-specific truncate string from the supplied data
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */        
+        function _truncate($table)
+        {
+                return &quot;TRUNCATE TABLE &quot;.$table;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete statement
+         *
+         * Generates a platform-specific delete string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the where clause
+         * @param        string        the limit clause
+         * @return        string
+         */        
+        function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+        {
+                $conditions = '';
+
+                if (count($where) &gt; 0 OR count($like) &gt; 0)
+                {
+                        $conditions = &quot;\nWHERE &quot;;
+                        $conditions .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                        if (count($where) &gt; 0 &amp;&amp; count($like) &gt; 0)
+                        {
+                                $conditions .= &quot; AND &quot;;
+                        }
+                        $conditions .= implode(&quot;\n&quot;, $like);
+                }
+
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+        
+                return &quot;DELETE FROM &quot;.$table.$conditions.$limit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Limit string
+         *
+         * Generates a platform-specific LIMIT clause
+         *
+         * @access  public
+         * @param   string  the sql query string
+         * @param   integer the number of rows to limit the query to
+         * @param   integer the offset value
+         * @return  string
+         */
+        function _limit($sql, $limit, $offset)
+        {
+                $limit = $offset + $limit;
+                $newsql = &quot;SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum &lt; $limit)&quot;;
+
+                if ($offset != 0)
+                {
+                        $newsql .= &quot; WHERE rnum &gt;= $offset&quot;;
+                }
+
+                // remember that we used limits
+                $this-&gt;limit_used = TRUE;
+
+                return $newsql;
+        }        
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access  public
+         * @param   resource
+         * @return  void
+         */
+        function _close($conn_id)
+        {
+                @ocilogoff($conn_id);
+        }
+
+
+}
+
+
+
+/* End of file oci8_driver.php */
+/* Location: ./system/database/drivers/oci8/oci8_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,248 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Oracle Forge Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_oci8_forge extends CI_DB_forge {
+
+        /**
+         * Create database
+         *
+         * @access        public
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        private
+         * @param        string        the table name
+         * @param        array        the fields
+         * @param        mixed        primary key(s)
+         * @param        mixed        key(s)
+         * @param        boolean        should 'IF NOT EXISTS' be added to the SQL
+         * @return        bool
+         */
+        function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+        {
+                $sql = 'CREATE TABLE ';
+                
+                if ($if_not_exists === TRUE)
+                {
+                        $sql .= 'IF NOT EXISTS ';
+                }
+                
+                $sql .= $this-&gt;db-&gt;_escape_identifiers($table).&quot; (&quot;;
+                $current_field_count = 0;
+
+                foreach ($fields as $field=&gt;$attributes)
+                {
+                        // Numeric field names aren't allowed in databases, so if the key is
+                        // numeric, we know it was assigned by PHP and the developer manually
+                        // entered the field information, so we'll simply add it to the list
+                        if (is_numeric($field))
+                        {
+                                $sql .= &quot;\n\t$attributes&quot;;
+                        }
+                        else
+                        {
+                                $attributes = array_change_key_case($attributes, CASE_UPPER);
+                                
+                                $sql .= &quot;\n\t&quot;.$this-&gt;db-&gt;_protect_identifiers($field);
+                                
+                                $sql .=  ' '.$attributes['TYPE'];
+        
+                                if (array_key_exists('CONSTRAINT', $attributes))
+                                {
+                                        $sql .= '('.$attributes['CONSTRAINT'].')';
+                                }
+        
+                                if (array_key_exists('UNSIGNED', $attributes) &amp;&amp; $attributes['UNSIGNED'] === TRUE)
+                                {
+                                        $sql .= ' UNSIGNED';
+                                }
+        
+                                if (array_key_exists('DEFAULT', $attributes))
+                                {
+                                        $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+                                }
+        
+                                if (array_key_exists('NULL', $attributes) &amp;&amp; $attributes['NULL'] === TRUE)
+                                {
+                                        $sql .= ' NULL';
+                                }
+                                else
+                                {
+                                        $sql .= ' NOT NULL';                        
+                                }
+        
+                                if (array_key_exists('AUTO_INCREMENT', $attributes) &amp;&amp; $attributes['AUTO_INCREMENT'] === TRUE)
+                                {
+                                        $sql .= ' AUTO_INCREMENT';
+                                }
+                        }
+                        
+                        // don't add a comma on the end of the last field
+                        if (++$current_field_count &lt; count($fields))
+                        {
+                                $sql .= ',';
+                        }
+                }
+
+                if (count($primary_keys) &gt; 0)
+                {
+                        $primary_keys = $this-&gt;db-&gt;_protect_identifiers($primary_keys);
+                        $sql .= &quot;,\n\tPRIMARY KEY (&quot; . implode(', ', $primary_keys) . &quot;)&quot;;
+                }
+
+                if (is_array($keys) &amp;&amp; count($keys) &gt; 0)
+                {
+                        foreach ($keys as $key)
+                        {
+                                if (is_array($key))
+                                {
+                                        $key = $this-&gt;db-&gt;_protect_identifiers($key);        
+                                }
+                                else
+                                {
+                                        $key = array($this-&gt;db-&gt;_protect_identifiers($key));
+                                }
+                                
+                                $sql .= &quot;,\n\tUNIQUE COLUMNS (&quot; . implode(', ', $key) . &quot;)&quot;;
+                        }
+                }
+                
+                $sql .= &quot;\n)&quot;;
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _drop_table($table)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Alter table query
+         *
+         * Generates a platform-specific query so that a table can be altered
+         * Called by add_column(), drop_column(), and column_alter(),
+         *
+         * @access        private
+         * @param        string        the ALTER type (ADD, DROP, CHANGE)
+         * @param        string        the column name
+         * @param        string        the table name
+         * @param        string        the column definition
+         * @param        string        the default value
+         * @param        boolean        should 'NOT NULL' be added
+         * @param        string        the field after which we should add the new field
+         * @return        object
+         */
+        function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table).&quot; $alter_type &quot;.$this-&gt;db-&gt;_protect_identifiers($column_name);
+
+                // DROP has everything it needs now.
+                if ($alter_type == 'DROP')
+                {
+                        return $sql;
+                }
+
+                $sql .= &quot; $column_definition&quot;;
+
+                if ($default_value != '')
+                {
+                        $sql .= &quot; DEFAULT \&quot;$default_value\&quot;&quot;;
+                }
+
+                if ($null === NULL)
+                {
+                        $sql .= ' NULL';
+                }
+                else
+                {
+                        $sql .= ' NOT NULL';
+                }
+
+                if ($after_field != '')
+                {
+                        $sql .= ' AFTER ' . $this-&gt;db-&gt;_protect_identifiers($after_field);
+                }
+                
+                return $sql;
+                
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename a table
+         *
+         * Generates a platform-specific query so that a table can be renamed
+         *
+         * @access        private
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        string
+         */
+        function _rename_table($table_name, $new_table_name)
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table_name).&quot; RENAME TO &quot;.$this-&gt;db-&gt;_protect_identifiers($new_table_name);
+                return $sql;
+        }
+
+
+}
+
+/* End of file oci8_forge.php */
+/* Location: ./system/database/drivers/oci8/oci8_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,249 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                 CodeIgniter
+ * @author                 ExpressionEngine Dev Team
+ * @copyright   Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                 http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                   Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * oci8 Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category        Database
+ * @author                 ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_oci8_result extends CI_DB_result {
+
+        var $stmt_id;
+        var $curs_id;
+        var $limit_used;
+
+        /**
+         * Number of rows in the result set.
+         *
+         * Oracle doesn't have a graceful way to retun the number of rows
+         * so we have to use what amounts to a hack.
+         * 
+         *
+         * @access  public
+         * @return  integer
+         */
+        function num_rows()
+        {
+                $rowcount = count($this-&gt;result_array());
+                @ociexecute($this-&gt;stmt_id);
+
+                if ($this-&gt;curs_id)
+                {
+                        @ociexecute($this-&gt;curs_id);
+                }
+
+                return $rowcount;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Number of fields in the result set
+         *
+         * @access  public
+         * @return  integer
+         */
+        function num_fields()
+        {
+                $count = @ocinumcols($this-&gt;stmt_id);
+
+                // if we used a limit we subtract it
+                if ($this-&gt;limit_used)
+                {
+                        $count = $count - 1;
+                }
+
+                return $count;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch Field Names
+         *
+         * Generates an array of column names
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_fields()
+        {
+                $field_names = array();
+                $fieldCount = $this-&gt;num_fields();
+                for ($c = 1; $c &lt;= $fieldCount; $c++)
+                {
+                        $field_names[] = ocicolumnname($this-&gt;stmt_id, $c);
+                }
+                return $field_names;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data
+         *
+         * Generates an array of objects containing field meta-data
+         *
+         * @access  public
+         * @return  array
+         */
+        function field_data()
+        {
+                $retval = array();
+                $fieldCount = $this-&gt;num_fields();
+                for ($c = 1; $c &lt;= $fieldCount; $c++)
+                {
+                        $F                          = new stdClass();
+                        $F-&gt;name                = ocicolumnname($this-&gt;stmt_id, $c);
+                        $F-&gt;type                = ocicolumntype($this-&gt;stmt_id, $c);
+                        $F-&gt;max_length  = ocicolumnsize($this-&gt;stmt_id, $c);
+
+                        $retval[] = $F;
+                }
+
+                return $retval;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Free the result
+         *
+         * @return        null
+         */                
+        function free_result()
+        {
+                if (is_resource($this-&gt;result_id))
+                {
+                        ocifreestatement($this-&gt;result_id);                        
+                        $this-&gt;result_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - associative array
+         *
+         * Returns the result set as an array
+         *
+         * @access  private
+         * @return  array
+         */
+        function _fetch_assoc(&amp;$row)
+        {
+                $id = ($this-&gt;curs_id) ? $this-&gt;curs_id : $this-&gt;stmt_id;
+        
+                return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);        
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - object
+         *
+         * Returns the result set as an object
+         *
+         * @access  private
+         * @return  object
+         */
+        function _fetch_object()
+        {        
+                $result = array();
+
+                // If PHP 5 is being used we can fetch an result object
+                if (function_exists('oci_fetch_object'))
+                {
+                        $id = ($this-&gt;curs_id) ? $this-&gt;curs_id : $this-&gt;stmt_id;
+                        
+                        return @oci_fetch_object($id);
+                }
+                
+                // If PHP 4 is being used we have to build our own result
+                foreach ($this-&gt;result_array() as $key =&gt; $val)
+                {
+                        $obj = new stdClass();
+                        if (is_array($val))
+                        {
+                                foreach ($val as $k =&gt; $v)
+                                {
+                                        $obj-&gt;$k = $v;
+                                }
+                        }
+                        else
+                        {
+                                $obj-&gt;$key = $val;
+                        }
+                        
+                        $result[] = $obj;
+                }
+
+                return $result;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Query result.  &quot;array&quot; version.
+         *
+         * @access  public
+         * @return  array
+         */
+        function result_array()
+        {
+                if (count($this-&gt;result_array) &gt; 0)
+                {
+                        return $this-&gt;result_array;
+                }
+
+                // oracle's fetch functions do not return arrays.
+                // The information is returned in reference parameters
+                $row = NULL;
+                while ($this-&gt;_fetch_assoc($row))
+                {
+                        $this-&gt;result_array[] = $row;
+                }
+
+                return $this-&gt;result_array;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Data Seek
+         *
+         * Moves the internal pointer to the desired offset.  We call
+         * this internally before fetching results to make sure the
+         * result set starts at zero
+         *
+         * @access        private
+         * @return        array
+         */
+        function _data_seek($n = 0)
+        {
+                return FALSE; // Not needed
+        }
+
+}
+
+
+/* End of file oci8_result.php */
+/* Location: ./system/database/drivers/oci8/oci8_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversoci8oci8_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/oci8/oci8_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Oracle Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_oci8_utility extends CI_DB_utility {
+
+        /**
+         * List databases
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _list_databases()
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize table query
+         *
+         * Generates a platform-specific query so that a table can be optimized
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _optimize_table($table)
+        {
+                return FALSE; // Is this supported in Oracle?
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Repair table query
+         *
+         * Generates a platform-specific query so that a table can be repaired
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _repair_table($table)
+        {
+                return FALSE; // Is this supported in Oracle?
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Oracle Export
+         *
+         * @access        private
+         * @param        array        Preferences
+         * @return        mixed
+         */
+        function _backup($params = array())
+        {
+                // Currently unsupported
+                return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+        }
+
+        /**
+         *
+         * The functions below have been deprecated as of 1.6, and are only here for backwards
+         * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
+         * is STRONGLY discouraged in favour if using dbforge.
+         *
+         */
+
+        /**
+         * Create database
+         *
+         * @access        public
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return FALSE;
+        }
+
+}
+
+/* End of file oci8_utility.php */
+/* Location: ./system/database/drivers/oci8/oci8_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,639 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * ODBC Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_odbc_driver extends CI_DB {
+
+        var $dbdriver = 'odbc';
+        
+        // the character used to excape - not necessary for ODBC
+        var $_escape_char = '';
+        
+        // clause and character used for LIKE escape sequences
+        var $_like_escape_str = &quot; {escape '%s'} &quot;;
+        var $_like_escape_chr = '!';
+        
+        /**
+         * The syntax to count rows is slightly different across different
+         * database engines, so this string appears in each driver and is
+         * used for the count_all() and count_all_results() functions.
+         */
+        var $_count_string = &quot;SELECT COUNT(*) AS &quot;;
+        var $_random_keyword;
+
+
+        function CI_DB_odbc_driver($params)
+        {
+                parent::CI_DB($params);
+                
+                $this-&gt;_random_keyword = ' RND('.time().')'; // database specific random keyword
+        }
+
+        /**
+         * Non-persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_connect()
+        {
+                return @odbc_connect($this-&gt;hostname, $this-&gt;username, $this-&gt;password);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_pconnect()
+        {
+                return @odbc_pconnect($this-&gt;hostname, $this-&gt;username, $this-&gt;password);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Reconnect
+         *
+         * Keep / reestablish the db connection if no queries have been
+         * sent for a length of time exceeding the server's idle timeout
+         *
+         * @access        public
+         * @return        void
+         */
+        function reconnect()
+        {
+                // not implemented in odbc
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select the database
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_select()
+        {
+                // Not needed for ODBC
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set client character set
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function db_set_charset($charset, $collation)
+        {
+                // @todo - add support if needed
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Version number query string
+         *
+         * @access        public
+         * @return        string
+         */
+        function _version()
+        {
+                return &quot;SELECT version() AS ver&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Execute the query
+         *
+         * @access        private called by the base class
+         * @param        string        an SQL query
+         * @return        resource
+         */        
+        function _execute($sql)
+        {
+                $sql = $this-&gt;_prep_query($sql);
+                return @odbc_exec($this-&gt;conn_id, $sql);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep the query
+         *
+         * If needed, each database adapter can prep the query string
+         *
+         * @access        private called by execute()
+         * @param        string        an SQL query
+         * @return        string
+         */        
+        function _prep_query($sql)
+        {
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Begin Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_begin($test_mode = FALSE)
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+                
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                // Reset the transaction failure flag.
+                // If the $test_mode flag is set to TRUE transactions will be rolled back
+                // even if the queries produce a successful result.
+                $this-&gt;_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+
+                return odbc_autocommit($this-&gt;conn_id, FALSE);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Commit Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_commit()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $ret = odbc_commit($this-&gt;conn_id);
+                odbc_autocommit($this-&gt;conn_id, TRUE);
+                return $ret;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rollback Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_rollback()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $ret = odbc_rollback($this-&gt;conn_id);
+                odbc_autocommit($this-&gt;conn_id, TRUE);
+                return $ret;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape String
+         *
+         * @access        public
+         * @param        string
+         * @param        bool        whether or not the string will be used in a LIKE condition
+         * @return        string
+         */
+        function escape_str($str, $like = FALSE)
+        {
+                if (is_array($str))
+                {
+                        foreach($str as $key =&gt; $val)
+                           {
+                                $str[$key] = $this-&gt;escape_str($val, $like);
+                           }
+                   
+                           return $str;
+                   }
+
+                // Access the CI object
+                $CI =&amp; get_instance();
+                
+                // ODBC doesn't require escaping
+                $str = $CI-&gt;input-&gt;_remove_invisible_characters($str);
+                
+                // escape LIKE condition wildcards
+                if ($like === TRUE)
+                {
+                        $str = str_replace(        array('%', '_', $this-&gt;_like_escape_chr),
+                                                                array($this-&gt;_like_escape_chr.'%', $this-&gt;_like_escape_chr.'_', $this-&gt;_like_escape_chr.$this-&gt;_like_escape_chr),
+                                                                $str);
+                }
+                
+                return $str;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Affected Rows
+         *
+         * @access        public
+         * @return        integer
+         */
+        function affected_rows()
+        {
+                return @odbc_num_rows($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Insert ID
+         *
+         * @access        public
+         * @return        integer
+         */
+        function insert_id()
+        {
+                return @odbc_insert_id($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Count All&quot; query
+         *
+         * Generates a platform-specific query string that counts all records in
+         * the specified database
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function count_all($table = '')
+        {
+                if ($table == '')
+                {
+                        return 0;
+                }
+
+                $query = $this-&gt;query($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows') . &quot; FROM &quot; . $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE));
+
+                if ($query-&gt;num_rows() == 0)
+                {
+                        return 0;
+                }
+
+                $row = $query-&gt;row();
+                return (int) $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Show table query
+         *
+         * Generates a platform-specific query string so that the table names can be fetched
+         *
+         * @access        private
+         * @param        boolean
+         * @return        string
+         */
+        function _list_tables($prefix_limit = FALSE)
+        {
+                $sql = &quot;SHOW TABLES FROM `&quot;.$this-&gt;database.&quot;`&quot;;
+
+                if ($prefix_limit !== FALSE AND $this-&gt;dbprefix != '')
+                {
+                        //$sql .= &quot; LIKE '&quot;.$this-&gt;escape_like_str($this-&gt;dbprefix).&quot;%' &quot;.sprintf($this-&gt;_like_escape_str, $this-&gt;_like_escape_char);
+                        return FALSE; // not currently supported
+                }
+                
+                return $sql;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Show column query
+         *
+         * Generates a platform-specific query string so that the column names can be fetched
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */
+        function _list_columns($table = '')
+        {
+                return &quot;SHOW COLUMNS FROM &quot;.$table;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data query
+         *
+         * Generates a platform-specific query so that the column data can be retrieved
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        object
+         */
+        function _field_data($table)
+        {
+                return &quot;SELECT TOP 1 FROM &quot;.$table;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message string
+         *
+         * @access        private
+         * @return        string
+         */
+        function _error_message()
+        {
+                return odbc_errormsg($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message number
+         *
+         * @access        private
+         * @return        integer
+         */
+        function _error_number()
+        {
+                return odbc_error($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape the SQL Identifiers
+         *
+         * This function escapes column and table names
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _escape_identifiers($item)
+        {
+                if ($this-&gt;_escape_char == '')
+                {
+                        return $item;
+                }
+
+                foreach ($this-&gt;_reserved_identifiers as $id)
+                {
+                        if (strpos($item, '.'.$id) !== FALSE)
+                        {
+                                $str = $this-&gt;_escape_char. str_replace('.', $this-&gt;_escape_char.'.', $item);  
+                                
+                                // remove duplicates if the user already included the escape
+                                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+                        }                
+                }
+        
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $str = $this-&gt;_escape_char.str_replace('.', $this-&gt;_escape_char.'.'.$this-&gt;_escape_char, $item).$this-&gt;_escape_char;                        
+                }
+                else
+                {
+                        $str = $this-&gt;_escape_char.$item.$this-&gt;_escape_char;
+                }
+                
+                // remove duplicates if the user already included the escape
+                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+        }
+                        
+        // --------------------------------------------------------------------
+
+        /**
+         * From Tables
+         *
+         * This function implicitly groups FROM tables so there is no confusion
+         * about operator precedence in harmony with SQL standards
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _from_tables($tables)
+        {
+                if ( ! is_array($tables))
+                {
+                        $tables = array($tables);
+                }
+                
+                return '('.implode(', ', $tables).')';
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert statement
+         *
+         * Generates a platform-specific insert string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the insert keys
+         * @param        array        the insert values
+         * @return        string
+         */
+        function _insert($table, $keys, $values)
+        {        
+                return &quot;INSERT INTO &quot;.$table.&quot; (&quot;.implode(', ', $keys).&quot;) VALUES (&quot;.implode(', ', $values).&quot;)&quot;;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Update statement
+         *
+         * Generates a platform-specific update string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the update data
+         * @param        array        the where clause
+         * @param        array        the orderby clause
+         * @param        array        the limit clause
+         * @return        string
+         */
+        function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+        {
+                foreach($values as $key =&gt; $val)
+                {
+                        $valstr[] = $key.&quot; = &quot;.$val;
+                }
+                
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+                
+                $orderby = (count($orderby) &gt;= 1)?' ORDER BY '.implode(&quot;, &quot;, $orderby):'';
+        
+                $sql = &quot;UPDATE &quot;.$table.&quot; SET &quot;.implode(', ', $valstr);
+
+                $sql .= ($where != '' AND count($where) &gt;=1) ? &quot; WHERE &quot;.implode(&quot; &quot;, $where) : '';
+
+                $sql .= $orderby.$limit;
+                
+                return $sql;
+        }
+
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate statement
+         *
+         * Generates a platform-specific truncate string from the supplied data
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */        
+        function _truncate($table)
+        {
+                return $this-&gt;_delete($table);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete statement
+         *
+         * Generates a platform-specific delete string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the where clause
+         * @param        string        the limit clause
+         * @return        string
+         */        
+        function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+        {
+                $conditions = '';
+
+                if (count($where) &gt; 0 OR count($like) &gt; 0)
+                {
+                        $conditions = &quot;\nWHERE &quot;;
+                        $conditions .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                        if (count($where) &gt; 0 &amp;&amp; count($like) &gt; 0)
+                        {
+                                $conditions .= &quot; AND &quot;;
+                        }
+                        $conditions .= implode(&quot;\n&quot;, $like);
+                }
+
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+        
+                return &quot;DELETE FROM &quot;.$table.$conditions.$limit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Limit string
+         *
+         * Generates a platform-specific LIMIT clause
+         *
+         * @access        public
+         * @param        string        the sql query string
+         * @param        integer        the number of rows to limit the query to
+         * @param        integer        the offset value
+         * @return        string
+         */
+        function _limit($sql, $limit, $offset)
+        {
+                // Does ODBC doesn't use the LIMIT clause?
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access        public
+         * @param        resource
+         * @return        void
+         */
+        function _close($conn_id)
+        {
+                @odbc_close($conn_id);
+        }
+
+        
+}
+
+
+
+/* End of file odbc_driver.php */
+/* Location: ./system/database/drivers/odbc/odbc_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,266 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * ODBC Forge Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/database/
+ */
+class CI_DB_odbc_forge extends CI_DB_forge {
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database()
+        {
+                // ODBC has no &quot;create database&quot; command since it's
+                // designed to connect to an existing database
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                // ODBC has no &quot;drop database&quot; command since it's
+                // designed to connect to an existing database                
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        private
+         * @param        string        the table name
+         * @param        array        the fields
+         * @param        mixed        primary key(s)
+         * @param        mixed        key(s)
+         * @param        boolean        should 'IF NOT EXISTS' be added to the SQL
+         * @return        bool
+         */
+        function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+        {
+                $sql = 'CREATE TABLE ';
+                
+                if ($if_not_exists === TRUE)
+                {
+                        $sql .= 'IF NOT EXISTS ';
+                }
+                
+                $sql .= $this-&gt;db-&gt;_escape_identifiers($table).&quot; (&quot;;
+                $current_field_count = 0;
+
+                foreach ($fields as $field=&gt;$attributes)
+                {
+                        // Numeric field names aren't allowed in databases, so if the key is
+                        // numeric, we know it was assigned by PHP and the developer manually
+                        // entered the field information, so we'll simply add it to the list
+                        if (is_numeric($field))
+                        {
+                                $sql .= &quot;\n\t$attributes&quot;;
+                        }
+                        else
+                        {
+                                $attributes = array_change_key_case($attributes, CASE_UPPER);
+                                
+                                $sql .= &quot;\n\t&quot;.$this-&gt;db-&gt;_protect_identifiers($field);
+                                
+                                $sql .=  ' '.$attributes['TYPE'];
+        
+                                if (array_key_exists('CONSTRAINT', $attributes))
+                                {
+                                        $sql .= '('.$attributes['CONSTRAINT'].')';
+                                }
+        
+                                if (array_key_exists('UNSIGNED', $attributes) &amp;&amp; $attributes['UNSIGNED'] === TRUE)
+                                {
+                                        $sql .= ' UNSIGNED';
+                                }
+        
+                                if (array_key_exists('DEFAULT', $attributes))
+                                {
+                                        $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+                                }
+        
+                                if (array_key_exists('NULL', $attributes) &amp;&amp; $attributes['NULL'] === TRUE)
+                                {
+                                        $sql .= ' NULL';
+                                }
+                                else
+                                {
+                                        $sql .= ' NOT NULL';                        
+                                }
+        
+                                if (array_key_exists('AUTO_INCREMENT', $attributes) &amp;&amp; $attributes['AUTO_INCREMENT'] === TRUE)
+                                {
+                                        $sql .= ' AUTO_INCREMENT';
+                                }
+                        }
+                        
+                        // don't add a comma on the end of the last field
+                        if (++$current_field_count &lt; count($fields))
+                        {
+                                $sql .= ',';
+                        }
+                }
+
+                if (count($primary_keys) &gt; 0)
+                {
+                        $primary_keys = $this-&gt;db-&gt;_protect_identifiers($primary_keys);
+                        $sql .= &quot;,\n\tPRIMARY KEY (&quot; . implode(', ', $primary_keys) . &quot;)&quot;;
+                }
+                
+                if (is_array($keys) &amp;&amp; count($keys) &gt; 0)
+                {
+                        foreach ($keys as $key)
+                        {
+                                if (is_array($key))
+                                {
+                                        $key = $this-&gt;db-&gt;_protect_identifiers($key);        
+                                }
+                                else
+                                {
+                                        $key = array($this-&gt;db-&gt;_protect_identifiers($key));
+                                }
+                                
+                                $sql .= &quot;,\n\tFOREIGN KEY (&quot; . implode(', ', $key) . &quot;)&quot;;
+                        }
+                }
+                
+                $sql .= &quot;\n)&quot;;
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _drop_table($table)
+        {
+                // Not a supported ODBC feature        
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Alter table query
+         *
+         * Generates a platform-specific query so that a table can be altered
+         * Called by add_column(), drop_column(), and column_alter(),
+         *
+         * @access        private
+         * @param        string        the ALTER type (ADD, DROP, CHANGE)
+         * @param        string        the column name
+         * @param        string        the table name
+         * @param        string        the column definition
+         * @param        string        the default value
+         * @param        boolean        should 'NOT NULL' be added
+         * @param        string        the field after which we should add the new field
+         * @return        object
+         */
+        function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table).&quot; $alter_type &quot;.$this-&gt;db-&gt;_protect_identifiers($column_name);
+
+                // DROP has everything it needs now.
+                if ($alter_type == 'DROP')
+                {
+                        return $sql;
+                }
+
+                $sql .= &quot; $column_definition&quot;;
+
+                if ($default_value != '')
+                {
+                        $sql .= &quot; DEFAULT \&quot;$default_value\&quot;&quot;;
+                }
+
+                if ($null === NULL)
+                {
+                        $sql .= ' NULL';
+                }
+                else
+                {
+                        $sql .= ' NOT NULL';
+                }
+
+                if ($after_field != '')
+                {
+                        $sql .= ' AFTER ' . $this-&gt;db-&gt;_protect_identifiers($after_field);
+                }
+                
+                return $sql;
+                
+        }
+
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename a table
+         *
+         * Generates a platform-specific query so that a table can be renamed
+         *
+         * @access        private
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        string
+         */
+        function _rename_table($table_name, $new_table_name)
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table_name).&quot; RENAME TO &quot;.$this-&gt;db-&gt;_protect_identifiers($new_table_name);
+                return $sql;
+        }
+
+
+}
+
+/* End of file odbc_forge.php */
+/* Location: ./system/database/drivers/odbc/odbc_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,228 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * ODBC Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_odbc_result extends CI_DB_result {
+        
+        /**
+         * Number of rows in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_rows()
+        {
+                return @odbc_num_rows($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Number of fields in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_fields()
+        {
+                return @odbc_num_fields($this-&gt;result_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch Field Names
+         *
+         * Generates an array of column names
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_fields()
+        {
+                $field_names = array();
+                for ($i = 0; $i &lt; $this-&gt;num_fields(); $i++)
+                {
+                        $field_names[]         = odbc_field_name($this-&gt;result_id, $i);
+                }
+                
+                return $field_names;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data
+         *
+         * Generates an array of objects containing field meta-data
+         *
+         * @access        public
+         * @return        array
+         */
+        function field_data()
+        {
+                $retval = array();
+                for ($i = 0; $i &lt; $this-&gt;num_fields(); $i++)
+                {
+                        $F                                 = new stdClass();
+                        $F-&gt;name                 = odbc_field_name($this-&gt;result_id, $i);
+                        $F-&gt;type                 = odbc_field_type($this-&gt;result_id, $i);
+                        $F-&gt;max_length        = odbc_field_len($this-&gt;result_id, $i);
+                        $F-&gt;primary_key = 0;
+                        $F-&gt;default                = '';
+
+                        $retval[] = $F;
+                }
+                
+                return $retval;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Free the result
+         *
+         * @return        null
+         */                
+        function free_result()
+        {
+                if (is_resource($this-&gt;result_id))
+                {
+                        odbc_free_result($this-&gt;result_id);
+                        $this-&gt;result_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Data Seek
+         *
+         * Moves the internal pointer to the desired offset.  We call
+         * this internally before fetching results to make sure the
+         * result set starts at zero
+         *
+         * @access        private
+         * @return        array
+         */
+        function _data_seek($n = 0)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - associative array
+         *
+         * Returns the result set as an array
+         *
+         * @access        private
+         * @return        array
+         */
+        function _fetch_assoc()
+        {
+                if (function_exists('odbc_fetch_object'))
+                {
+                        return odbc_fetch_array($this-&gt;result_id);
+                }
+                else
+                {
+                        return $this-&gt;_odbc_fetch_array($this-&gt;result_id);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - object
+         *
+         * Returns the result set as an object
+         *
+         * @access        private
+         * @return        object
+         */
+        function _fetch_object()
+        {
+                if (function_exists('odbc_fetch_object'))
+                {
+                        return odbc_fetch_object($this-&gt;result_id);
+                }
+                else
+                {
+                        return $this-&gt;_odbc_fetch_object($this-&gt;result_id);
+                }
+        }
+
+
+        /**
+         * Result - object
+         *
+         * subsititutes the odbc_fetch_object function when
+         * not available (odbc_fetch_object requires unixODBC)
+         *
+         * @access        private
+         * @return        object
+         */
+        function _odbc_fetch_object(&amp; $odbc_result) {
+                $rs = array();
+                $rs_obj = false;
+                if (odbc_fetch_into($odbc_result, $rs)) {
+                        foreach ($rs as $k=&gt;$v) {
+                                $field_name= odbc_field_name($odbc_result, $k+1);
+                                $rs_obj-&gt;$field_name = $v;
+                        }
+                }
+                return $rs_obj;
+        }
+
+
+        /**
+         * Result - array
+         *
+         * subsititutes the odbc_fetch_array function when
+         * not available (odbc_fetch_array requires unixODBC)
+         *
+         * @access        private
+         * @return        array
+         */
+        function _odbc_fetch_array(&amp; $odbc_result) {
+                $rs = array();
+                $rs_assoc = false;
+                if (odbc_fetch_into($odbc_result, $rs)) {
+                        $rs_assoc=array();
+                        foreach ($rs as $k=&gt;$v) {
+                                $field_name= odbc_field_name($odbc_result, $k+1);
+                                $rs_assoc[$field_name] = $v;
+                        }
+                }
+                return $rs_assoc;
+        }
+
+}
+
+
+/* End of file odbc_result.php */
+/* Location: ./system/database/drivers/odbc/odbc_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriversodbcodbc_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/odbc/odbc_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * ODBC Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/database/
+ */
+class CI_DB_odbc_utility extends CI_DB_utility {
+
+        /**
+         * List databases
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _list_databases()
+        {
+                // Not sure if ODBC lets you list all databases...        
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize table query
+         *
+         * Generates a platform-specific query so that a table can be optimized
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _optimize_table($table)
+        {
+                // Not a supported ODBC feature        
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Repair table query
+         *
+         * Generates a platform-specific query so that a table can be repaired
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _repair_table($table)
+        {
+                // Not a supported ODBC feature        
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * ODBC Export
+         *
+         * @access        private
+         * @param        array        Preferences
+         * @return        mixed
+         */
+        function _backup($params = array())
+        {
+                // Currently unsupported
+                return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+        }
+        
+        /**
+         *
+         * The functions below have been deprecated as of 1.6, and are only here for backwards
+         * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
+         * is STRONGLY discouraged in favour if using dbforge.
+         *
+         */
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database()
+        {
+                // ODBC has no &quot;create database&quot; command since it's
+                // designed to connect to an existing database
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                // ODBC has no &quot;drop database&quot; command since it's
+                // designed to connect to an existing database                
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return FALSE;
+        }
+}
+
+/* End of file odbc_utility.php */
+/* Location: ./system/database/drivers/odbc/odbc_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgreindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,684 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Postgre Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_postgre_driver extends CI_DB {
+
+        var $dbdriver = 'postgre';
+        
+        var $_escape_char = '&quot;';
+
+        // clause and character used for LIKE escape sequences
+        var $_like_escape_str = &quot; ESCAPE '%s' &quot;;
+        var $_like_escape_chr = '!';
+
+        /**
+         * The syntax to count rows is slightly different across different
+         * database engines, so this string appears in each driver and is
+         * used for the count_all() and count_all_results() functions.
+         */
+        var $_count_string = &quot;SELECT COUNT(*) AS &quot;;
+        var $_random_keyword = ' RANDOM()'; // database specific random keyword
+
+        /**
+         * Connection String
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _connect_string()
+        {
+                $components = array(
+                                                                'hostname'        =&gt; 'host',
+                                                                'port'                =&gt; 'port',
+                                                                'database'        =&gt; 'dbname',
+                                                                'username'        =&gt; 'user',
+                                                                'password'        =&gt; 'password'
+                                                        );
+                
+                $connect_string = &quot;&quot;;
+                foreach ($components as $key =&gt; $val)
+                {
+                        if (isset($this-&gt;$key) &amp;&amp; $this-&gt;$key != '')
+                        {
+                                $connect_string .= &quot; $val=&quot;.$this-&gt;$key;
+                        }
+                }
+                return trim($connect_string);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Non-persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_connect()
+        {                
+                return @pg_connect($this-&gt;_connect_string());
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_pconnect()
+        {
+                return @pg_pconnect($this-&gt;_connect_string());
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Reconnect
+         *
+         * Keep / reestablish the db connection if no queries have been
+         * sent for a length of time exceeding the server's idle timeout
+         *
+         * @access        public
+         * @return        void
+         */
+        function reconnect()
+        {
+                if (pg_ping($this-&gt;conn_id) === FALSE)
+                {
+                        $this-&gt;conn_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select the database
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_select()
+        {
+                // Not needed for Postgre so we'll return TRUE
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set client character set
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function db_set_charset($charset, $collation)
+        {
+                // @todo - add support if needed
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Version number query string
+         *
+         * @access        public
+         * @return        string
+         */
+        function _version()
+        {
+                return &quot;SELECT version() AS ver&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Execute the query
+         *
+         * @access        private called by the base class
+         * @param        string        an SQL query
+         * @return        resource
+         */        
+        function _execute($sql)
+        {
+                $sql = $this-&gt;_prep_query($sql);
+                return @pg_query($this-&gt;conn_id, $sql);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep the query
+         *
+         * If needed, each database adapter can prep the query string
+         *
+         * @access        private called by execute()
+         * @param        string        an SQL query
+         * @return        string
+         */        
+        function _prep_query($sql)
+        {
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Begin Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_begin($test_mode = FALSE)
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+                
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                // Reset the transaction failure flag.
+                // If the $test_mode flag is set to TRUE transactions will be rolled back
+                // even if the queries produce a successful result.
+                $this-&gt;_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+
+                return @pg_exec($this-&gt;conn_id, &quot;begin&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Commit Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_commit()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                return @pg_exec($this-&gt;conn_id, &quot;commit&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rollback Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_rollback()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                return @pg_exec($this-&gt;conn_id, &quot;rollback&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape String
+         *
+         * @access        public
+         * @param        string
+         * @param        bool        whether or not the string will be used in a LIKE condition
+         * @return        string
+         */
+        function escape_str($str, $like = FALSE)
+        {
+                if (is_array($str))
+                {
+                        foreach($str as $key =&gt; $val)
+                           {
+                                $str[$key] = $this-&gt;escape_str($val, $like);
+                           }
+                   
+                           return $str;
+                   }
+
+                $str = pg_escape_string($str);
+                
+                // escape LIKE condition wildcards
+                if ($like === TRUE)
+                {
+                        $str = str_replace(        array('%', '_', $this-&gt;_like_escape_chr),
+                                                                array($this-&gt;_like_escape_chr.'%', $this-&gt;_like_escape_chr.'_', $this-&gt;_like_escape_chr.$this-&gt;_like_escape_chr),
+                                                                $str);
+                }
+                
+                return $str;
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Affected Rows
+         *
+         * @access        public
+         * @return        integer
+         */
+        function affected_rows()
+        {
+                return @pg_affected_rows($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Insert ID
+         *
+         * @access        public
+         * @return        integer
+         */
+        function insert_id()
+        {
+                $v = $this-&gt;_version();
+                $v = $v['server'];
+                
+                $table        = func_num_args() &gt; 0 ? func_get_arg(0) : null;
+                $column        = func_num_args() &gt; 1 ? func_get_arg(1) : null;
+                
+                if ($table == null &amp;&amp; $v &gt;= '8.1')
+                {
+                        $sql='SELECT LASTVAL() as ins_id';
+                }
+                elseif ($table != null &amp;&amp; $column != null &amp;&amp; $v &gt;= '8.0')
+                {
+                        $sql = sprintf(&quot;SELECT pg_get_serial_sequence('%s','%s') as seq&quot;, $table, $column);
+                        $query = $this-&gt;query($sql);
+                        $row = $query-&gt;row();
+                        $sql = sprintf(&quot;SELECT CURRVAL('%s') as ins_id&quot;, $row-&gt;seq);
+                }
+                elseif ($table != null)
+                {
+                        // seq_name passed in table parameter
+                        $sql = sprintf(&quot;SELECT CURRVAL('%s') as ins_id&quot;, $table);
+                }
+                else
+                {
+                        return pg_last_oid($this-&gt;result_id);
+                }
+                $query = $this-&gt;query($sql);
+                $row = $query-&gt;row();
+                return $row-&gt;ins_id;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Count All&quot; query
+         *
+         * Generates a platform-specific query string that counts all records in
+         * the specified database
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function count_all($table = '')
+        {
+                if ($table == '')
+                {
+                        return 0;
+                }
+
+                $query = $this-&gt;query($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows') . &quot; FROM &quot; . $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE));
+
+                if ($query-&gt;num_rows() == 0)
+                {
+                        return 0;
+                }
+
+                $row = $query-&gt;row();
+                return (int) $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Show table query
+         *
+         * Generates a platform-specific query string so that the table names can be fetched
+         *
+         * @access        private
+         * @param        boolean
+         * @return        string
+         */
+        function _list_tables($prefix_limit = FALSE)
+        {        
+                $sql = &quot;SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'&quot;;        
+                
+                if ($prefix_limit !== FALSE AND $this-&gt;dbprefix != '')
+                {
+                        $sql .= &quot; AND table_name LIKE '&quot;.$this-&gt;escape_like_str($this-&gt;dbprefix).&quot;%' &quot;.sprintf($this-&gt;_like_escape_str, $this-&gt;_like_escape_char);
+                }
+                
+                return $sql;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Show column query
+         *
+         * Generates a platform-specific query string so that the column names can be fetched
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */
+        function _list_columns($table = '')
+        {
+                return &quot;SELECT column_name FROM information_schema.columns WHERE table_name ='&quot;.$table.&quot;'&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data query
+         *
+         * Generates a platform-specific query so that the column data can be retrieved
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        object
+         */
+        function _field_data($table)
+        {
+                return &quot;SELECT * FROM &quot;.$table.&quot; LIMIT 1&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message string
+         *
+         * @access        private
+         * @return        string
+         */
+        function _error_message()
+        {
+                return pg_last_error($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message number
+         *
+         * @access        private
+         * @return        integer
+         */
+        function _error_number()
+        {
+                return '';
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape the SQL Identifiers
+         *
+         * This function escapes column and table names
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _escape_identifiers($item)
+        {
+                if ($this-&gt;_escape_char == '')
+                {
+                        return $item;
+                }
+
+                foreach ($this-&gt;_reserved_identifiers as $id)
+                {
+                        if (strpos($item, '.'.$id) !== FALSE)
+                        {
+                                $str = $this-&gt;_escape_char. str_replace('.', $this-&gt;_escape_char.'.', $item);  
+                                
+                                // remove duplicates if the user already included the escape
+                                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+                        }                
+                }
+        
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $str = $this-&gt;_escape_char.str_replace('.', $this-&gt;_escape_char.'.'.$this-&gt;_escape_char, $item).$this-&gt;_escape_char;                        
+                }
+                else
+                {
+                        $str = $this-&gt;_escape_char.$item.$this-&gt;_escape_char;
+                }
+                
+                // remove duplicates if the user already included the escape
+                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+        }
+                        
+        // --------------------------------------------------------------------
+
+        /**
+         * From Tables
+         *
+         * This function implicitly groups FROM tables so there is no confusion
+         * about operator precedence in harmony with SQL standards
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _from_tables($tables)
+        {
+                if ( ! is_array($tables))
+                {
+                        $tables = array($tables);
+                }
+                
+                return implode(', ', $tables);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert statement
+         *
+         * Generates a platform-specific insert string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the insert keys
+         * @param        array        the insert values
+         * @return        string
+         */
+        function _insert($table, $keys, $values)
+        {        
+                return &quot;INSERT INTO &quot;.$table.&quot; (&quot;.implode(', ', $keys).&quot;) VALUES (&quot;.implode(', ', $values).&quot;)&quot;;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Update statement
+         *
+         * Generates a platform-specific update string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the update data
+         * @param        array        the where clause
+         * @param        array        the orderby clause
+         * @param        array        the limit clause
+         * @return        string
+         */
+        function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+        {
+                foreach($values as $key =&gt; $val)
+                {
+                        $valstr[] = $key.&quot; = &quot;.$val;
+                }
+                
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+                
+                $orderby = (count($orderby) &gt;= 1)?' ORDER BY '.implode(&quot;, &quot;, $orderby):'';
+        
+                $sql = &quot;UPDATE &quot;.$table.&quot; SET &quot;.implode(', ', $valstr);
+
+                $sql .= ($where != '' AND count($where) &gt;=1) ? &quot; WHERE &quot;.implode(&quot; &quot;, $where) : '';
+
+                $sql .= $orderby.$limit;
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate statement
+         *
+         * Generates a platform-specific truncate string from the supplied data
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */        
+        function _truncate($table)
+        {
+                return &quot;TRUNCATE &quot;.$table;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete statement
+         *
+         * Generates a platform-specific delete string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the where clause
+         * @param        string        the limit clause
+         * @return        string
+         */        
+        function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+        {
+                $conditions = '';
+
+                if (count($where) &gt; 0 OR count($like) &gt; 0)
+                {
+                        $conditions = &quot;\nWHERE &quot;;
+                        $conditions .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                        if (count($where) &gt; 0 &amp;&amp; count($like) &gt; 0)
+                        {
+                                $conditions .= &quot; AND &quot;;
+                        }
+                        $conditions .= implode(&quot;\n&quot;, $like);
+                }
+
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+        
+                return &quot;DELETE FROM &quot;.$table.$conditions.$limit;
+        }
+
+        // --------------------------------------------------------------------
+        /**
+         * Limit string
+         *
+         * Generates a platform-specific LIMIT clause
+         *
+         * @access        public
+         * @param        string        the sql query string
+         * @param        integer        the number of rows to limit the query to
+         * @param        integer        the offset value
+         * @return        string
+         */
+        function _limit($sql, $limit, $offset)
+        {        
+                $sql .= &quot;LIMIT &quot;.$limit;
+        
+                if ($offset &gt; 0)
+                {
+                        $sql .= &quot; OFFSET &quot;.$offset;
+                }
+                
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access        public
+         * @param        resource
+         * @return        void
+         */
+        function _close($conn_id)
+        {
+                @pg_close($conn_id);
+        }
+
+
+}
+
+
+/* End of file postgre_driver.php */
+/* Location: ./system/database/drivers/postgre/postgre_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,248 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Postgre Forge Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_postgre_forge extends CI_DB_forge {
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        private
+         * @param        string        the table name
+         * @param        array        the fields
+         * @param        mixed        primary key(s)
+         * @param        mixed        key(s)
+         * @param        boolean        should 'IF NOT EXISTS' be added to the SQL
+         * @return        bool
+         */
+        function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+        {
+                $sql = 'CREATE TABLE ';
+                
+                if ($if_not_exists === TRUE)
+                {
+                        $sql .= 'IF NOT EXISTS ';
+                }
+                
+                $sql .= $this-&gt;db-&gt;_escape_identifiers($table).&quot; (&quot;;
+                $current_field_count = 0;
+
+                foreach ($fields as $field=&gt;$attributes)
+                {
+                        // Numeric field names aren't allowed in databases, so if the key is
+                        // numeric, we know it was assigned by PHP and the developer manually
+                        // entered the field information, so we'll simply add it to the list
+                        if (is_numeric($field))
+                        {
+                                $sql .= &quot;\n\t$attributes&quot;;
+                        }
+                        else
+                        {
+                                $attributes = array_change_key_case($attributes, CASE_UPPER);
+                                
+                                $sql .= &quot;\n\t&quot;.$this-&gt;db-&gt;_protect_identifiers($field);
+                                
+                                $sql .=  ' '.$attributes['TYPE'];
+        
+                                if (array_key_exists('CONSTRAINT', $attributes))
+                                {
+                                        $sql .= '('.$attributes['CONSTRAINT'].')';
+                                }
+        
+                                if (array_key_exists('UNSIGNED', $attributes) &amp;&amp; $attributes['UNSIGNED'] === TRUE)
+                                {
+                                        $sql .= ' UNSIGNED';
+                                }
+        
+                                if (array_key_exists('DEFAULT', $attributes))
+                                {
+                                        $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+                                }
+        
+                                if (array_key_exists('NULL', $attributes) &amp;&amp; $attributes['NULL'] === TRUE)
+                                {
+                                        $sql .= ' NULL';
+                                }
+                                else
+                                {
+                                        $sql .= ' NOT NULL';                        
+                                }
+        
+                                if (array_key_exists('AUTO_INCREMENT', $attributes) &amp;&amp; $attributes['AUTO_INCREMENT'] === TRUE)
+                                {
+                                        $sql .= ' AUTO_INCREMENT';
+                                }
+                        }
+                        
+                        // don't add a comma on the end of the last field
+                        if (++$current_field_count &lt; count($fields))
+                        {
+                                $sql .= ',';
+                        }
+                }
+
+                if (count($primary_keys) &gt; 0)
+                {
+                        $primary_keys = $this-&gt;db-&gt;_protect_identifiers($primary_keys);
+                        $sql .= &quot;,\n\tPRIMARY KEY (&quot; . implode(', ', $primary_keys) . &quot;)&quot;;
+                }
+                
+                if (is_array($keys) &amp;&amp; count($keys) &gt; 0)
+                {
+                        foreach ($keys as $key)
+                        {
+                                if (is_array($key))
+                                {
+                                        $key = $this-&gt;db-&gt;_protect_identifiers($key);        
+                                }
+                                else
+                                {
+                                        $key = array($this-&gt;db-&gt;_protect_identifiers($key));
+                                }
+                                
+                                $sql .= &quot;,\n\tFOREIGN KEY (&quot; . implode(', ', $key) . &quot;)&quot;;
+                        }
+                }
+
+                $sql .= &quot;\n);&quot;;
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _drop_table($table)
+        {
+                return &quot;DROP TABLE &quot;.$this-&gt;db-&gt;_escape_identifiers($table).&quot; CASCADE&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Alter table query
+         *
+         * Generates a platform-specific query so that a table can be altered
+         * Called by add_column(), drop_column(), and column_alter(),
+         *
+         * @access        private
+         * @param        string        the ALTER type (ADD, DROP, CHANGE)
+         * @param        string        the column name
+         * @param        string        the table name
+         * @param        string        the column definition
+         * @param        string        the default value
+         * @param        boolean        should 'NOT NULL' be added
+         * @param        string        the field after which we should add the new field
+         * @return        object
+         */
+        function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table).&quot; $alter_type &quot;.$this-&gt;db-&gt;_protect_identifiers($column_name);
+
+                // DROP has everything it needs now.
+                if ($alter_type == 'DROP')
+                {
+                        return $sql;
+                }
+
+                $sql .= &quot; $column_definition&quot;;
+
+                if ($default_value != '')
+                {
+                        $sql .= &quot; DEFAULT \&quot;$default_value\&quot;&quot;;
+                }
+
+                if ($null === NULL)
+                {
+                        $sql .= ' NULL';
+                }
+                else
+                {
+                        $sql .= ' NOT NULL';
+                }
+
+                if ($after_field != '')
+                {
+                        $sql .= ' AFTER ' . $this-&gt;db-&gt;_protect_identifiers($after_field);
+                }
+                
+                return $sql;
+                
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename a table
+         *
+         * Generates a platform-specific query so that a table can be renamed
+         *
+         * @access        private
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        string
+         */
+        function _rename_table($table_name, $new_table_name)
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table_name).&quot; RENAME TO &quot;.$this-&gt;db-&gt;_protect_identifiers($new_table_name);
+                return $sql;
+        }
+
+
+}
+
+/* End of file postgre_forge.php */
+/* Location: ./system/database/drivers/postgre/postgre_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,169 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Postgres Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_postgre_result extends CI_DB_result {
+
+        /**
+         * Number of rows in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_rows()
+        {
+                return @pg_num_rows($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Number of fields in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_fields()
+        {
+                return @pg_num_fields($this-&gt;result_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch Field Names
+         *
+         * Generates an array of column names
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_fields()
+        {
+                $field_names = array();
+                for ($i = 0; $i &lt; $this-&gt;num_fields(); $i++)
+                {
+                        $field_names[] = pg_field_name($this-&gt;result_id, $i);
+                }
+                
+                return $field_names;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data
+         *
+         * Generates an array of objects containing field meta-data
+         *
+         * @access        public
+         * @return        array
+         */
+        function field_data()
+        {
+                $retval = array();
+                for ($i = 0; $i &lt; $this-&gt;num_fields(); $i++)
+                {
+                        $F                                 = new stdClass();
+                        $F-&gt;name                 = pg_field_name($this-&gt;result_id, $i);
+                        $F-&gt;type                 = pg_field_type($this-&gt;result_id, $i);
+                        $F-&gt;max_length        = pg_field_size($this-&gt;result_id, $i);
+                        $F-&gt;primary_key = 0;
+                        $F-&gt;default                = '';
+
+                        $retval[] = $F;
+                }
+                
+                return $retval;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Free the result
+         *
+         * @return        null
+         */                
+        function free_result()
+        {
+                if (is_resource($this-&gt;result_id))
+                {
+                        pg_free_result($this-&gt;result_id);
+                        $this-&gt;result_id = FALSE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Data Seek
+         *
+         * Moves the internal pointer to the desired offset.  We call
+         * this internally before fetching results to make sure the
+         * result set starts at zero
+         *
+         * @access        private
+         * @return        array
+         */
+        function _data_seek($n = 0)
+        {
+                return pg_result_seek($this-&gt;result_id, $n);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - associative array
+         *
+         * Returns the result set as an array
+         *
+         * @access        private
+         * @return        array
+         */
+        function _fetch_assoc()
+        {
+                return pg_fetch_assoc($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - object
+         *
+         * Returns the result set as an object
+         *
+         * @access        private
+         * @return        object
+         */
+        function _fetch_object()
+        {
+                return pg_fetch_object($this-&gt;result_id);
+        }
+        
+}
+
+
+/* End of file postgre_result.php */
+/* Location: ./system/database/drivers/postgre/postgre_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverspostgrepostgre_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/postgre/postgre_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,124 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Postgre Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_postgre_utility extends CI_DB_utility {
+
+        /**
+         * List databases
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _list_databases()
+        {
+                return &quot;SELECT datname FROM pg_database&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize table query
+         *
+         * Is table optimization supported in Postgre?
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _optimize_table($table)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Repair table query
+         *
+         * Are table repairs supported in Postgre?
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _repair_table($table)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Postgre Export
+         *
+         * @access        private
+         * @param        array        Preferences
+         * @return        mixed
+         */
+        function _backup($params = array())
+        {
+                // Currently unsupported
+                return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+        }
+
+        /**
+         *
+         * The functions below have been deprecated as of 1.6, and are only here for backwards
+         * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
+         * is STRONGLY discouraged in favour if using dbforge.
+         *
+         */
+
+        /**
+         * Create database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database($name)
+        {
+                return &quot;CREATE DATABASE &quot;.$name;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                return &quot;DROP DATABASE &quot;.$name;
+        }
+
+
+}
+
+
+/* End of file postgre_utility.php */
+/* Location: ./system/database/drivers/postgre/postgre_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqliteindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_driverphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_driver.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_driver.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_driver.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,657 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+
+
+/**
+ * SQLite Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Drivers
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_sqlite_driver extends CI_DB {
+
+        var $dbdriver = 'sqlite';
+        
+        // The character used to escape with - not needed for SQLite
+        var $_escape_char = '';
+
+        // clause and character used for LIKE escape sequences
+         var $_like_escape_str = &quot; ESCAPE '%s' &quot;;
+        var $_like_escape_chr = '!';
+        
+        /**
+         * The syntax to count rows is slightly different across different
+         * database engines, so this string appears in each driver and is
+         * used for the count_all() and count_all_results() functions.
+         */
+        var $_count_string = &quot;SELECT COUNT(*) AS &quot;;
+        var $_random_keyword = ' Random()'; // database specific random keyword
+
+        /**
+         * Non-persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_connect()
+        {
+                if ( ! $conn_id = @sqlite_open($this-&gt;database, FILE_WRITE_MODE, $error))
+                {
+                        log_message('error', $error);
+                        
+                        if ($this-&gt;db_debug)
+                        {
+                                $this-&gt;display_error($error, '', TRUE);
+                        }
+                        
+                        return FALSE;
+                }
+                
+                return $conn_id;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Persistent database connection
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_pconnect()
+        {
+                if ( ! $conn_id = @sqlite_popen($this-&gt;database, FILE_WRITE_MODE, $error))
+                {
+                        log_message('error', $error);
+                        
+                        if ($this-&gt;db_debug)
+                        {
+                                $this-&gt;display_error($error, '', TRUE);
+                        }
+                        
+                        return FALSE;
+                }
+                
+                return $conn_id;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Reconnect
+         *
+         * Keep / reestablish the db connection if no queries have been
+         * sent for a length of time exceeding the server's idle timeout
+         *
+         * @access        public
+         * @return        void
+         */
+        function reconnect()
+        {
+                // not implemented in SQLite
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Select the database
+         *
+         * @access        private called by the base class
+         * @return        resource
+         */        
+        function db_select()
+        {
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set client character set
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        resource
+         */
+        function db_set_charset($charset, $collation)
+        {
+                // @todo - add support if needed
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Version number query string
+         *
+         * @access        public
+         * @return        string
+         */
+        function _version()
+        {
+                return sqlite_libversion();
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Execute the query
+         *
+         * @access        private called by the base class
+         * @param        string        an SQL query
+         * @return        resource
+         */        
+        function _execute($sql)
+        {
+                $sql = $this-&gt;_prep_query($sql);
+                return @sqlite_query($this-&gt;conn_id, $sql);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep the query
+         *
+         * If needed, each database adapter can prep the query string
+         *
+         * @access        private called by execute()
+         * @param        string        an SQL query
+         * @return        string
+         */        
+        function _prep_query($sql)
+        {
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Begin Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_begin($test_mode = FALSE)
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+                
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                // Reset the transaction failure flag.
+                // If the $test_mode flag is set to TRUE transactions will be rolled back
+                // even if the queries produce a successful result.
+                $this-&gt;_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+
+                $this-&gt;simple_query('BEGIN TRANSACTION');
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Commit Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_commit()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('COMMIT');
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rollback Transaction
+         *
+         * @access        public
+         * @return        bool                
+         */        
+        function trans_rollback()
+        {
+                if ( ! $this-&gt;trans_enabled)
+                {
+                        return TRUE;
+                }
+
+                // When transactions are nested we only begin/commit/rollback the outermost ones
+                if ($this-&gt;_trans_depth &gt; 0)
+                {
+                        return TRUE;
+                }
+
+                $this-&gt;simple_query('ROLLBACK');
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape String
+         *
+         * @access        public
+         * @param        string
+         * @param        bool        whether or not the string will be used in a LIKE condition
+         * @return        string
+         */
+        function escape_str($str, $like = FALSE)
+        {
+                if (is_array($str))
+                {
+                        foreach($str as $key =&gt; $val)
+                           {
+                                $str[$key] = $this-&gt;escape_str($val, $like);
+                           }
+                   
+                           return $str;
+                   }
+        
+                $str = sqlite_escape_string($str);
+                
+                // escape LIKE condition wildcards
+                if ($like === TRUE)
+                {
+                        $str = str_replace(        array('%', '_', $this-&gt;_like_escape_chr),
+                                                                array($this-&gt;_like_escape_chr.'%', $this-&gt;_like_escape_chr.'_', $this-&gt;_like_escape_chr.$this-&gt;_like_escape_chr),
+                                                                $str);
+                }
+                
+                return $str;
+        }
+                
+        // --------------------------------------------------------------------
+
+        /**
+         * Affected Rows
+         *
+         * @access        public
+         * @return        integer
+         */
+        function affected_rows()
+        {
+                return sqlite_changes($this-&gt;conn_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Insert ID
+         *
+         * @access        public
+         * @return        integer
+         */
+        function insert_id()
+        {
+                return @sqlite_last_insert_rowid($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * &quot;Count All&quot; query
+         *
+         * Generates a platform-specific query string that counts all records in
+         * the specified database
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function count_all($table = '')
+        {
+                if ($table == '')
+                {
+                        return 0;
+                }
+
+                $query = $this-&gt;query($this-&gt;_count_string . $this-&gt;_protect_identifiers('numrows') . &quot; FROM &quot; . $this-&gt;_protect_identifiers($table, TRUE, NULL, FALSE));
+                
+                if ($query-&gt;num_rows() == 0)
+                {
+                        return 0;
+                }
+
+                $row = $query-&gt;row();
+                return (int) $row-&gt;numrows;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * List table query
+         *
+         * Generates a platform-specific query string so that the table names can be fetched
+         *
+         * @access        private
+         * @param        boolean
+         * @return        string
+         */
+        function _list_tables($prefix_limit = FALSE)
+        {
+                $sql = &quot;SELECT name from sqlite_master WHERE type='table'&quot;;
+
+                if ($prefix_limit !== FALSE AND $this-&gt;dbprefix != '')
+                {
+                        $sql .= &quot; AND 'name' LIKE '&quot;.$this-&gt;escape_like_str($this-&gt;dbprefix).&quot;%' &quot;.sprintf($this-&gt;_like_escape_str, $this-&gt;_like_escape_char);
+                }
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Show column query
+         *
+         * Generates a platform-specific query string so that the column names can be fetched
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */
+        function _list_columns($table = '')
+        {
+                // Not supported
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data query
+         *
+         * Generates a platform-specific query so that the column data can be retrieved
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        object
+         */
+        function _field_data($table)
+        {
+                return &quot;SELECT * FROM &quot;.$table.&quot; LIMIT 1&quot;;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message string
+         *
+         * @access        private
+         * @return        string
+         */
+        function _error_message()
+        {
+                return sqlite_error_string(sqlite_last_error($this-&gt;conn_id));
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * The error message number
+         *
+         * @access        private
+         * @return        integer
+         */
+        function _error_number()
+        {
+                return sqlite_last_error($this-&gt;conn_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Escape the SQL Identifiers
+         *
+         * This function escapes column and table names
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _escape_identifiers($item)
+        {
+                if ($this-&gt;_escape_char == '')
+                {
+                        return $item;
+                }
+
+                foreach ($this-&gt;_reserved_identifiers as $id)
+                {
+                        if (strpos($item, '.'.$id) !== FALSE)
+                        {
+                                $str = $this-&gt;_escape_char. str_replace('.', $this-&gt;_escape_char.'.', $item);  
+                                
+                                // remove duplicates if the user already included the escape
+                                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+                        }                
+                }
+        
+                if (strpos($item, '.') !== FALSE)
+                {
+                        $str = $this-&gt;_escape_char.str_replace('.', $this-&gt;_escape_char.'.'.$this-&gt;_escape_char, $item).$this-&gt;_escape_char;                        
+                }
+                else
+                {
+                        $str = $this-&gt;_escape_char.$item.$this-&gt;_escape_char;
+                }
+                
+                // remove duplicates if the user already included the escape
+                return preg_replace('/['.$this-&gt;_escape_char.']+/', $this-&gt;_escape_char, $str);
+        }
+                        
+        // --------------------------------------------------------------------
+
+        /**
+         * From Tables
+         *
+         * This function implicitly groups FROM tables so there is no confusion
+         * about operator precedence in harmony with SQL standards
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _from_tables($tables)
+        {
+                if ( ! is_array($tables))
+                {
+                        $tables = array($tables);
+                }
+                
+                return '('.implode(', ', $tables).')';
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert statement
+         *
+         * Generates a platform-specific insert string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the insert keys
+         * @param        array        the insert values
+         * @return        string
+         */
+        function _insert($table, $keys, $values)
+        {        
+                return &quot;INSERT INTO &quot;.$table.&quot; (&quot;.implode(', ', $keys).&quot;) VALUES (&quot;.implode(', ', $values).&quot;)&quot;;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Update statement
+         *
+         * Generates a platform-specific update string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the update data
+         * @param        array        the where clause
+         * @param        array        the orderby clause
+         * @param        array        the limit clause
+         * @return        string
+         */
+        function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+        {
+                foreach($values as $key =&gt; $val)
+                {
+                        $valstr[] = $key.&quot; = &quot;.$val;
+                }
+                
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+                
+                $orderby = (count($orderby) &gt;= 1)?' ORDER BY '.implode(&quot;, &quot;, $orderby):'';
+        
+                $sql = &quot;UPDATE &quot;.$table.&quot; SET &quot;.implode(', ', $valstr);
+
+                $sql .= ($where != '' AND count($where) &gt;=1) ? &quot; WHERE &quot;.implode(&quot; &quot;, $where) : '';
+
+                $sql .= $orderby.$limit;
+                
+                return $sql;
+        }
+
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Truncate statement
+         *
+         * Generates a platform-specific truncate string from the supplied data
+         * If the database does not support the truncate() command
+         * This function maps to &quot;DELETE FROM table&quot;
+         *
+         * @access        public
+         * @param        string        the table name
+         * @return        string
+         */        
+        function _truncate($table)
+        {
+                return $this-&gt;_delete($table);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete statement
+         *
+         * Generates a platform-specific delete string from the supplied data
+         *
+         * @access        public
+         * @param        string        the table name
+         * @param        array        the where clause
+         * @param        string        the limit clause
+         * @return        string
+         */        
+        function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+        {
+                $conditions = '';
+
+                if (count($where) &gt; 0 OR count($like) &gt; 0)
+                {
+                        $conditions = &quot;\nWHERE &quot;;
+                        $conditions .= implode(&quot;\n&quot;, $this-&gt;ar_where);
+
+                        if (count($where) &gt; 0 &amp;&amp; count($like) &gt; 0)
+                        {
+                                $conditions .= &quot; AND &quot;;
+                        }
+                        $conditions .= implode(&quot;\n&quot;, $like);
+                }
+
+                $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+        
+                return &quot;DELETE FROM &quot;.$table.$conditions.$limit;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Limit string
+         *
+         * Generates a platform-specific LIMIT clause
+         *
+         * @access        public
+         * @param        string        the sql query string
+         * @param        integer        the number of rows to limit the query to
+         * @param        integer        the offset value
+         * @return        string
+         */
+        function _limit($sql, $limit, $offset)
+        {        
+                if ($offset == 0)
+                {
+                        $offset = '';
+                }
+                else
+                {
+                        $offset .= &quot;, &quot;;
+                }
+                
+                return $sql.&quot;LIMIT &quot;.$offset.$limit;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Close DB Connection
+         *
+         * @access        public
+         * @param        resource
+         * @return        void
+         */
+        function _close($conn_id)
+        {
+                @sqlite_close($conn_id);
+        }
+
+
+}
+
+
+/* End of file sqlite_driver.php */
+/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_forgephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_forge.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_forge.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_forge.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,265 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * SQLite Forge Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_sqlite_forge extends CI_DB_forge {
+
+        /**
+         * Create database
+         *
+         * @access        public
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database()
+        {
+                // In SQLite, a database is created when you connect to the database.
+                // We'll return TRUE so that an error isn't generated
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                if ( ! @file_exists($this-&gt;db-&gt;database) OR ! @unlink($this-&gt;db-&gt;database))
+                {
+                        if ($this-&gt;db-&gt;db_debug)
+                        {
+                                return $this-&gt;db-&gt;display_error('db_unable_to_drop');
+                        }
+                        return FALSE;
+                }
+                return TRUE;
+        }
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Table
+         *
+         * @access        private
+         * @param        string        the table name
+         * @param        array        the fields
+         * @param        mixed        primary key(s)
+         * @param        mixed        key(s)
+         * @param        boolean        should 'IF NOT EXISTS' be added to the SQL
+         * @return        bool
+         */
+        function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+        {
+                $sql = 'CREATE TABLE ';
+                
+                // IF NOT EXISTS added to SQLite in 3.3.0
+                if ($if_not_exists === TRUE &amp;&amp; version_compare($this-&gt;_version(), '3.3.0', '&gt;=') === TRUE)
+                {
+                        $sql .= 'IF NOT EXISTS ';
+                }
+                
+                $sql .= $this-&gt;db-&gt;_escape_identifiers($table).&quot;(&quot;;
+                $current_field_count = 0;
+
+                foreach ($fields as $field=&gt;$attributes)
+                {
+                        // Numeric field names aren't allowed in databases, so if the key is
+                        // numeric, we know it was assigned by PHP and the developer manually
+                        // entered the field information, so we'll simply add it to the list
+                        if (is_numeric($field))
+                        {
+                                $sql .= &quot;\n\t$attributes&quot;;
+                        }
+                        else
+                        {
+                                $attributes = array_change_key_case($attributes, CASE_UPPER);
+                                
+                                $sql .= &quot;\n\t&quot;.$this-&gt;db-&gt;_protect_identifiers($field);
+                                
+                                $sql .=  ' '.$attributes['TYPE'];
+        
+                                if (array_key_exists('CONSTRAINT', $attributes))
+                                {
+                                        $sql .= '('.$attributes['CONSTRAINT'].')';
+                                }
+        
+                                if (array_key_exists('UNSIGNED', $attributes) &amp;&amp; $attributes['UNSIGNED'] === TRUE)
+                                {
+                                        $sql .= ' UNSIGNED';
+                                }
+        
+                                if (array_key_exists('DEFAULT', $attributes))
+                                {
+                                        $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+                                }
+        
+                                if (array_key_exists('NULL', $attributes) &amp;&amp; $attributes['NULL'] === TRUE)
+                                {
+                                        $sql .= ' NULL';
+                                }
+                                else
+                                {
+                                        $sql .= ' NOT NULL';                        
+                                }
+        
+                                if (array_key_exists('AUTO_INCREMENT', $attributes) &amp;&amp; $attributes['AUTO_INCREMENT'] === TRUE)
+                                {
+                                        $sql .= ' AUTO_INCREMENT';
+                                }
+                        }
+                        
+                        // don't add a comma on the end of the last field
+                        if (++$current_field_count &lt; count($fields))
+                        {
+                                $sql .= ',';
+                        }
+                }
+
+                if (count($primary_keys) &gt; 0)
+                {
+                        $primary_keys = $this-&gt;db-&gt;_protect_identifiers($primary_keys);
+                        $sql .= &quot;,\n\tPRIMARY KEY (&quot; . implode(', ', $primary_keys) . &quot;)&quot;;
+                }
+
+                if (is_array($keys) &amp;&amp; count($keys) &gt; 0)
+                {
+                        foreach ($keys as $key)
+                        {
+                                if (is_array($key))
+                                {
+                                        $key = $this-&gt;db-&gt;_protect_identifiers($key);        
+                                }
+                                else
+                                {
+                                        $key = array($this-&gt;db-&gt;_protect_identifiers($key));
+                                }
+                                
+                                $sql .= &quot;,\n\tUNIQUE (&quot; . implode(', ', $key) . &quot;)&quot;;
+                        }
+                }
+
+                $sql .= &quot;\n)&quot;;
+
+                return $sql;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop Table
+         *
+         *  Unsupported feature in SQLite
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _drop_table($table)
+        {
+                if ($this-&gt;db-&gt;db_debug)
+                {
+                        return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+                }
+                return array();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Alter table query
+         *
+         * Generates a platform-specific query so that a table can be altered
+         * Called by add_column(), drop_column(), and column_alter(),
+         *
+         * @access        private
+         * @param        string        the ALTER type (ADD, DROP, CHANGE)
+         * @param        string        the column name
+         * @param        string        the table name
+         * @param        string        the column definition
+         * @param        string        the default value
+         * @param        boolean        should 'NOT NULL' be added
+         * @param        string        the field after which we should add the new field
+         * @return        object
+         */
+        function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table).&quot; $alter_type &quot;.$this-&gt;db-&gt;_protect_identifiers($column_name);
+
+                // DROP has everything it needs now.
+                if ($alter_type == 'DROP')
+                {
+                        // SQLite does not support dropping columns
+                        // http://www.sqlite.org/omitted.html
+                        // http://www.sqlite.org/faq.html#q11
+                        return FALSE;
+                }
+
+                $sql .= &quot; $column_definition&quot;;
+
+                if ($default_value != '')
+                {
+                        $sql .= &quot; DEFAULT \&quot;$default_value\&quot;&quot;;
+                }
+
+                if ($null === NULL)
+                {
+                        $sql .= ' NULL';
+                }
+                else
+                {
+                        $sql .= ' NOT NULL';
+                }
+
+                if ($after_field != '')
+                {
+                        $sql .= ' AFTER ' . $this-&gt;db-&gt;_protect_identifiers($after_field);
+                }
+                
+                return $sql;
+                
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename a table
+         *
+         * Generates a platform-specific query so that a table can be renamed
+         *
+         * @access        private
+         * @param        string        the old table name
+         * @param        string        the new table name
+         * @return        string
+         */
+        function _rename_table($table_name, $new_table_name)
+        {
+                $sql = 'ALTER TABLE '.$this-&gt;db-&gt;_protect_identifiers($table_name).&quot; RENAME TO &quot;.$this-&gt;db-&gt;_protect_identifiers($new_table_name);
+                return $sql;
+        }
+}
+
+/* End of file sqlite_forge.php */
+/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_resultphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_result.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_result.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_result.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,179 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * SQLite Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_sqlite_result extends CI_DB_result {
+        
+        /**
+         * Number of rows in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_rows()
+        {
+                return @sqlite_num_rows($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Number of fields in the result set
+         *
+         * @access        public
+         * @return        integer
+         */
+        function num_fields()
+        {
+                return @sqlite_num_fields($this-&gt;result_id);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch Field Names
+         *
+         * Generates an array of column names
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_fields()
+        {
+                $field_names = array();
+                for ($i = 0; $i &lt; $this-&gt;num_fields(); $i++)
+                {
+                        $field_names[] = sqlite_field_name($this-&gt;result_id, $i);
+                }
+                
+                return $field_names;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Field data
+         *
+         * Generates an array of objects containing field meta-data
+         *
+         * @access        public
+         * @return        array
+         */
+        function field_data()
+        {
+                $retval = array();
+                for ($i = 0; $i &lt; $this-&gt;num_fields(); $i++)
+                {
+                        $F                                 = new stdClass();
+                        $F-&gt;name                 = sqlite_field_name($this-&gt;result_id, $i);
+                        $F-&gt;type                 = 'varchar';
+                        $F-&gt;max_length        = 0;
+                        $F-&gt;primary_key = 0;
+                        $F-&gt;default                = '';
+
+                        $retval[] = $F;
+                }
+                
+                return $retval;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Free the result
+         *
+         * @return        null
+         */                
+        function free_result()
+        {
+                // Not implemented in SQLite
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Data Seek
+         *
+         * Moves the internal pointer to the desired offset.  We call
+         * this internally before fetching results to make sure the
+         * result set starts at zero
+         *
+         * @access        private
+         * @return        array
+         */
+        function _data_seek($n = 0)
+        {
+                return sqlite_seek($this-&gt;result_id, $n);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - associative array
+         *
+         * Returns the result set as an array
+         *
+         * @access        private
+         * @return        array
+         */
+        function _fetch_assoc()
+        {
+                return sqlite_fetch_array($this-&gt;result_id);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Result - object
+         *
+         * Returns the result set as an object
+         *
+         * @access        private
+         * @return        object
+         */
+        function _fetch_object()
+        {
+                if (function_exists('sqlite_fetch_object'))
+                {
+                        return sqlite_fetch_object($this-&gt;result_id);
+                }
+                else
+                {
+                        $arr = sqlite_fetch_array($this-&gt;result_id, SQLITE_ASSOC);
+                        if (is_array($arr))
+                        {
+                                $obj = (object) $arr;
+                                return $obj;
+                        } else {
+                                return NULL;
+                        } 
+                }
+        }
+
+}
+
+
+/* End of file sqlite_result.php */
+/* Location: ./system/database/drivers/sqlite/sqlite_result.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabasedriverssqlitesqlite_utilityphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_utility.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_utility.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/drivers/sqlite/sqlite_utility.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,141 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * SQLite Utility Class
+ *
+ * @category        Database
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_sqlite_utility extends CI_DB_utility {
+
+        /**
+         * List databases
+         *
+         * I don't believe you can do a database listing with SQLite
+         * since each database is its own file.  I suppose we could
+         * try reading a directory looking for SQLite files, but
+         * that doesn't seem like a terribly good idea
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _list_databases()
+        {
+                if ($this-&gt;db_debug)
+                {
+                        return $this-&gt;display_error('db_unsuported_feature');
+                }
+                return array();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Optimize table query
+         *
+         * Is optimization even supported in SQLite?
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _optimize_table($table)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Repair table query
+         *
+         * Are table repairs even supported in SQLite?
+         *
+         * @access        private
+         * @param        string        the table name
+         * @return        object
+         */
+        function _repair_table($table)
+        {
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * SQLite Export
+         *
+         * @access        private
+         * @param        array        Preferences
+         * @return        mixed
+         */
+        function _backup($params = array())
+        {
+                // Currently unsupported
+                return $this-&gt;db-&gt;display_error('db_unsuported_feature');
+        }
+
+        /**
+         *
+         * The functions below have been deprecated as of 1.6, and are only here for backwards
+         * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
+         * is STRONGLY discouraged in favour if using dbforge.
+         *
+         */
+
+        /**
+         * Create database
+         *
+         * @access        public
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _create_database()
+        {
+                // In SQLite, a database is created when you connect to the database.
+                // We'll return TRUE so that an error isn't generated
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Drop database
+         *
+         * @access        private
+         * @param        string        the database name
+         * @return        bool
+         */
+        function _drop_database($name)
+        {
+                if ( ! @file_exists($this-&gt;db-&gt;database) OR ! @unlink($this-&gt;db-&gt;database))
+                {
+                        if ($this-&gt;db-&gt;db_debug)
+                        {
+                                return $this-&gt;db-&gt;display_error('db_unable_to_drop');
+                        }
+                        return FALSE;
+                }
+                return TRUE;
+        }
+
+}
+
+/* End of file sqlite_utility.php */
+/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemdatabaseindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/database/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemfontsindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemfontstexbttf"></a>
<div class="binary"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/texb.ttf</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: freeswitch/trunk/contrib/DelphiWorld/fmc/system/fonts/texb.ttf
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx">   + application/octet-stream
</span><a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersarray_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/array_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/array_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/array_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Array Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/array_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Element
+ *
+ * Lets you determine whether an array index is set and whether it has a value.
+ * If the element is empty it returns FALSE (or whatever you specify as the default value.)
+ *
+ * @access        public
+ * @param        string
+ * @param        array
+ * @param        mixed
+ * @return        mixed        depends on what the array contains
+ */        
+if ( ! function_exists('element'))
+{
+        function element($item, $array, $default = FALSE)
+        {
+                if ( ! isset($array[$item]) OR $array[$item] == &quot;&quot;)
+                {
+                        return $default;
+                }
+
+                return $array[$item];
+        }        
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Random Element - Takes an array as input and returns a random element
+ *
+ * @access        public
+ * @param        array
+ * @return        mixed        depends on what the array contains
+ */        
+if ( ! function_exists('random_element'))
+{
+        function random_element($array)
+        {
+                if ( ! is_array($array))
+                {
+                        return $array;
+                }
+                return $array[array_rand($array)];
+        }        
+}
+
+
+/* End of file array_helper.php */
+/* Location: ./system/helpers/array_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperscompatibility_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/compatibility_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/compatibility_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/compatibility_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,498 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Compatibility Helpers
+ *
+ * This helper contains some functions based on the PEAR PHP_Compat library
+ * http://pear.php.net/package/PHP_Compat
+ * 
+ * The PEAR compat library is a little bloated and the code doesn't harmonize
+ * well with CodeIgniter, so those functions have been refactored.
+ * We cheat a little and use CI's _exception_handler() to output our own PHP errors
+ * so that the behavior fully mimicks the PHP 5 counterparts.  -- Derek Jones
+ * 
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/compatibility_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+if ( ! defined('PHP_EOL'))
+{
+        define('PHP_EOL', (DIRECTORY_SEPARATOR == '/') ? &quot;\n&quot; : &quot;\r\n&quot;);
+} 
+
+// ------------------------------------------------------------------------
+
+/**
+ * file_put_contents()
+ *
+ * Writes a string to a file
+ * http://us.php.net/manual/en/function.file_put_contents.php
+ * argument 4, $context, not supported
+ *
+ * @access        public
+ * @param        string                file name
+ * @param        mixed                data to be written
+ * @param        int                        flags
+ * @return        int                        length of written string
+ */
+if ( ! function_exists('file_put_contents'))
+{
+        function file_put_contents($filename, $data, $flags = NULL)
+        {
+                if (is_scalar($data))
+                {
+                        settype($data, 'STRING');
+                }
+
+                if ( ! is_string($data) &amp;&amp; ! is_array($data) &amp;&amp; ! is_resource($data))
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'file_put_contents(): the 2nd parameter should be either a string or an array', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+
+                // read stream if given a stream resource
+                if (is_resource($data))
+                {
+                        if (get_resource_type($data) !== 'stream')
+                        {
+                                $backtrace = debug_backtrace();
+                                _exception_handler(E_USER_WARNING, 'file_put_contents(): supplied resource is not a valid stream resource', $backtrace[0]['file'], $backtrace[0]['line']);
+                                return FALSE;
+                        }
+
+                        $text = '';
+                        
+                        while ( ! feof($data))
+                        {
+                                $text .= fread($data, 4096);
+                        }
+                        
+                        $data = $text;
+                        unset($text);
+                }
+        
+                // strings only please!
+                if (is_array($data))
+                {
+                        $data = implode('', $data);
+                }
+
+                // Set the appropriate mode
+                if (($flags &amp; 8) &gt; 0) // 8 = FILE_APPEND flag
+                {
+                        $mode = FOPEN_WRITE_CREATE;
+                }
+                else
+                {
+                        $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE;
+                }
+        
+                // Check if we're using the include path
+                if (($flags &amp; 1) &gt; 0) // 1 = FILE_USE_INCLUDE_PATH flag
+                {
+                        $use_include_path = TRUE;
+                }
+                else
+                {
+                        $use_include_path = FALSE;
+                }
+        
+                $fp = @fopen($filename, $mode, $use_include_path);
+        
+                if ($fp === FALSE)
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to open stream', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+        
+                if (($flags &amp; LOCK_EX) &gt; 0)
+                {
+                        if ( ! flock($fp, LOCK_EX))
+                        {
+                                $backtrace = debug_backtrace();
+                                _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') unable to acquire an exclusive lock on file', $backtrace[0]['file'], $backtrace[0]['line']);
+                                return FALSE;
+                        }
+                }
+                
+                // write it
+                if (($written = @fwrite($fp, $data)) === FALSE)
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to write to '.htmlentities($filename), $backtrace[0]['file'], $backtrace[0]['line']);
+                }
+        
+                // Close the handle
+                @fclose($fp);
+        
+                // Return length
+                return $written;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * fputcsv()
+ *
+ * Format line as CSV and write to file pointer
+ * http://us.php.net/manual/en/function.fputcsv.php
+ *
+ * @access        public
+ * @param        resource        file pointer
+ * @param        array                data to be written
+ * @param        string                delimiter
+ * @param        string                enclosure
+ * @return        int                        length of written string
+ */
+if ( ! function_exists('fputcsv'))
+{
+        function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '&quot;')
+        {
+                // Checking for a handle resource
+                if ( ! is_resource($handle))
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+        
+                // OK, it is a resource, but is it a stream?
+                if (get_resource_type($handle) !== 'stream')
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.get_resource_type($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+        
+                // Checking for an array of fields
+                if ( ! is_array($fields))
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+        
+                // validate delimiter
+                if (strlen($delimiter) &gt; 1)
+                {
+                        $delimiter = substr($delimiter, 0, 1);
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_NOTICE, 'fputcsv() delimiter must be one character long, &quot;'.htmlentities($delimiter).'&quot; used', $backtrace[0]['file'], $backtrace[0]['line']);
+                }
+        
+                // validate enclosure
+                if (strlen($enclosure) &gt; 1)
+                {
+                        $enclosure = substr($enclosure, 0, 1);
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_NOTICE, 'fputcsv() enclosure must be one character long, &quot;'.htmlentities($enclosure).'&quot; used', $backtrace[0]['file'], $backtrace[0]['line']);
+
+                }
+        
+                $out = '';
+        
+                foreach ($fields as $cell)
+                {
+                        $cell = str_replace($enclosure, $enclosure.$enclosure, $cell);
+
+                        if (strpos($cell, $delimiter) !== FALSE OR strpos($cell, $enclosure) !== FALSE OR strpos($cell, &quot;\n&quot;) !== FALSE)
+                        {
+                                $out .= $enclosure.$cell.$enclosure.$delimiter;
+                        }
+                        else
+                        {
+                                $out .= $cell.$delimiter;
+                        }
+                }
+        
+                $length = @fwrite($handle, substr($out, 0, -1).&quot;\n&quot;);
+        
+                return $length;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * stripos()
+ *
+ * Find position of first occurrence of a case-insensitive string
+ * http://us.php.net/manual/en/function.stripos.php
+ *
+ * @access        public
+ * @param        string                haystack
+ * @param        string                needle
+ * @param        int                        offset
+ * @return        int                        numeric position of the first occurrence of needle in the haystack
+ */
+if ( ! function_exists('stripos'))
+{
+        function stripos($haystack, $needle, $offset = NULL)
+        {
+                // Cast non string scalar values
+                if (is_scalar($haystack))
+                {
+                        settype($haystack, 'STRING');
+                }
+        
+                if ( ! is_string($haystack))
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+        
+                if ( ! is_scalar($needle))
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+        
+                if (is_float($offset))
+                {
+                        $offset = (int)$offset;
+                }
+        
+                if ( ! is_int($offset) &amp;&amp; ! is_bool($offset) &amp;&amp; ! is_null($offset))
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return NULL;
+                }
+        
+                return strpos(strtolower($haystack), strtolower($needle), $offset);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * str_ireplace()
+ *
+ * Find position of first occurrence of a case-insensitive string
+ * http://us.php.net/manual/en/function.str-ireplace.php
+ * (parameter 4, $count, is not supported as to do so in PHP 4 would make
+ * it a required parameter)
+ *
+ * @access        public
+ * @param        mixed                search
+ * @param        mixed                replace
+ * @param        mixed                subject
+ * @return        int                        numeric position of the first occurrence of needle in the haystack
+ */
+if ( ! function_exists('str_ireplace'))
+{
+        function str_ireplace($search, $replace, $subject)
+        {
+                // Nothing to do here
+                if ($search === NULL OR $subject === NULL)
+                {
+                        return $subject;
+                }
+        
+                // Crazy arguments
+                if (is_scalar($search) &amp;&amp; is_array($replace))
+                {
+                        $backtrace = debug_backtrace();
+
+                        if (is_object($replace))
+                        {
+                                show_error('Object of class '.get_class($replace).' could not be converted to string in '.$backtrace[0]['file'].' on line '.$backtrace[0]['line']);
+                        }
+                        else
+                        {
+                                _exception_handler(E_USER_NOTICE, 'Array to string conversion in '.$backtrace[0]['file'], $backtrace[0]['line']);
+                        }
+                }
+        
+                // Searching for an array
+                if (is_array($search))
+                {
+                        // Replacing with an array
+                        if (is_array($replace))
+                        {
+                                $search = array_values($search);
+                                $replace = array_values($replace);
+
+                                if (count($search) &gt;= count($replace))
+                                {
+                                        $replace = array_pad($replace, count($search), '');
+                                }
+                                else
+                                {
+                                        $replace = array_slice($replace, 0, count($search));
+                                }
+                        }
+                        else
+                        {
+                                // Replacing with a string all positions
+                                $replace = array_fill(0, count($search), $replace);
+                        }
+                }
+                else
+                {
+                        //Searching for a string and replacing with a string.
+                        $search  = array((string)$search);
+                        $replace = array((string)$replace);
+                }
+                
+                // Prepare the search array
+                foreach ($search as $search_key =&gt; $search_value)
+                {
+                        $search[$search_key] = '/'.preg_quote($search_value, '/').'/i';
+                }
+                
+                // Prepare the replace array (escape backreferences)
+                foreach ($replace as $k =&gt; $v)
+                {
+                        $replace[$k] = str_replace(array(chr(92), '$'), array(chr(92).chr(92), '\$'), $v);
+                }
+        
+                // do the replacement
+                $result = preg_replace($search, $replace, (array)$subject);
+        
+                // Check if subject was initially a string and return it as a string
+                if ( ! is_array($subject))
+                {
+                        return current($result);
+                }
+        
+                // Otherwise, just return the array
+                return $result;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * http_build_query()
+ *
+ * Generate URL-encoded query string
+ * http://us.php.net/manual/en/function.http-build-query.php
+ *
+ * @access        public
+ * @param        array                form data
+ * @param        string                numeric prefix
+ * @param        string                argument separator
+ * @return        string                URL-encoded string
+ */
+if ( ! function_exists('http_build_query'))
+{
+        function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL)
+        {
+                // Check the data
+                if ( ! is_array($formdata) &amp;&amp; ! is_object($formdata))
+                {
+                        $backtrace = debug_backtrace();
+                        _exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']);
+                        return FALSE;
+                }
+        
+                // Cast it as array
+                if (is_object($formdata))
+                {
+                        $formdata = get_object_vars($formdata);
+                }
+        
+                // If the array is empty, return NULL
+                if (empty($formdata))
+                {
+                        return NULL;
+                }
+        
+                // Argument separator
+                if ($separator === NULL)
+                {
+                        $separator = ini_get('arg_separator.output');
+
+                        if (strlen($separator) == 0)
+                        {
+                                $separator = '&amp;';
+                        }
+                }
+        
+                // Start building the query
+                $tmp = array();
+
+                foreach ($formdata as $key =&gt; $val)
+                {
+                        if ($val === NULL)
+                        {
+                                continue;
+                        }
+        
+                        if (is_integer($key) &amp;&amp; $numeric_prefix != NULL)
+                        {
+                                $key = $numeric_prefix.$key;
+                        }
+        
+                        if (is_resource($val))
+                        {
+                                return NULL;
+                        }
+                        
+                        // hand it off to a recursive parser
+                        $tmp[] = _http_build_query_helper($key, $val, $separator);
+                }
+        
+                return implode($separator, $tmp);
+        }
+        
+        
+        // Helper helper.  Remind anyone of college?
+        // Required to handle recursion in nested arrays.
+        // 
+        // You could shave fractions of fractions of a second by moving where
+        // the urlencoding takes place, but it's much less intuitive, and if
+        // your application has 10,000 form fields, well, you have other problems ;)
+        function _http_build_query_helper($key, $val, $separator = '&amp;')
+        {        
+                if (is_scalar($val))
+                {
+                        return urlencode($key).'='.urlencode($val);                        
+                }
+                else
+                {
+                        // arrays please
+                        if (is_object($val))
+                        {
+                                $val = get_object_vars($val);
+                        }
+                        
+                        foreach ($val as $k =&gt; $v)
+                        {
+                                $tmp[] = _http_build_query_helper($key.'['.$k.']', $v, $separator);
+                        }
+                }
+                        
+                return implode($separator, $tmp);
+        }
+}
+
+
+/* End of file compatibility_helper.php */
+/* Location: ./system/helpers/compatibility_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperscookie_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/cookie_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/cookie_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/cookie_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,144 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Cookie Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/cookie_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set cookie
+ *
+ * Accepts six parameter, or you can submit an associative
+ * array in the first parameter containing all the values.
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string        the value of the cookie
+ * @param        string        the number of seconds until expiration
+ * @param        string        the cookie domain.  Usually:  .yourdomain.com
+ * @param        string        the cookie path
+ * @param        string        the cookie prefix
+ * @return        void
+ */
+if ( ! function_exists('set_cookie'))
+{
+        function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
+        {
+                if (is_array($name))
+                {                
+                        foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item)
+                        {
+                                if (isset($name[$item]))
+                                {
+                                        $$item = $name[$item];
+                                }
+                        }
+                }
+        
+                // Set the config file options
+                $CI =&amp; get_instance();
+        
+                if ($prefix == '' AND $CI-&gt;config-&gt;item('cookie_prefix') != '')
+                {
+                        $prefix = $CI-&gt;config-&gt;item('cookie_prefix');
+                }
+                if ($domain == '' AND $CI-&gt;config-&gt;item('cookie_domain') != '')
+                {
+                        $domain = $CI-&gt;config-&gt;item('cookie_domain');
+                }
+                if ($path == '/' AND $CI-&gt;config-&gt;item('cookie_path') != '/')
+                {
+                        $path = $CI-&gt;config-&gt;item('cookie_path');
+                }
+                
+                if ( ! is_numeric($expire))
+                {
+                        $expire = time() - 86500;
+                }
+                else
+                {
+                        if ($expire &gt; 0)
+                        {
+                                $expire = time() + $expire;
+                        }
+                        else
+                        {
+                                $expire = 0;
+                        }
+                }
+        
+                setcookie($prefix.$name, $value, $expire, $path, $domain, 0);
+        }
+}
+        
+// --------------------------------------------------------------------
+
+/**
+ * Fetch an item from the COOKIE array
+ *
+ * @access        public
+ * @param        string
+ * @param        bool
+ * @return        mixed
+ */
+if ( ! function_exists('get_cookie'))
+{
+        function get_cookie($index = '', $xss_clean = FALSE)
+        {
+                $CI =&amp; get_instance();
+                
+                $prefix = '';
+                
+                if ( ! isset($_COOKIE[$index]) &amp;&amp; config_item('cookie_prefix') != '')
+                {
+                        $prefix = config_item('cookie_prefix');
+                }
+                
+                return $CI-&gt;input-&gt;cookie($prefix.$index, $xss_clean);
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Delete a COOKIE
+ *
+ * @param        mixed
+ * @param        string        the cookie domain.  Usually:  .yourdomain.com
+ * @param        string        the cookie path
+ * @param        string        the cookie prefix
+ * @return        void
+ */
+if ( ! function_exists('delete_cookie'))
+{
+        function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
+        {
+                set_cookie($name, '', '', $domain, $path, $prefix);
+        }
+}
+
+
+/* End of file cookie_helper.php */
+/* Location: ./system/helpers/cookie_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersdate_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/date_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/date_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/date_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,611 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Date Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/date_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Get &quot;now&quot; time
+ *
+ * Returns time() or its GMT equivalent based on the config file preference
+ *
+ * @access        public
+ * @return        integer
+ */        
+if ( ! function_exists('now'))
+{
+        function now()
+        {
+                $CI =&amp; get_instance();
+        
+                if (strtolower($CI-&gt;config-&gt;item('time_reference')) == 'gmt')
+                {
+                        $now = time();
+                        $system_time = mktime(gmdate(&quot;H&quot;, $now), gmdate(&quot;i&quot;, $now), gmdate(&quot;s&quot;, $now), gmdate(&quot;m&quot;, $now), gmdate(&quot;d&quot;, $now), gmdate(&quot;Y&quot;, $now));
+        
+                        if (strlen($system_time) &lt; 10)
+                        {
+                                $system_time = time();
+                                log_message('error', 'The Date class could not set a proper GMT timestamp so the local time() value was used.');
+                        }
+        
+                        return $system_time;
+                }
+                else
+                {
+                        return time();
+                }
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Convert MySQL Style Datecodes
+ *
+ * This function is identical to PHPs date() function,
+ * except that it allows date codes to be formatted using
+ * the MySQL style, where each code letter is preceded
+ * with a percent sign:  %Y %m %d etc...
+ *
+ * The benefit of doing dates this way is that you don't
+ * have to worry about escaping your text letters that
+ * match the date codes.
+ *
+ * @access        public
+ * @param        string
+ * @param        integer
+ * @return        integer
+ */        
+if ( ! function_exists('mdate'))
+{
+        function mdate($datestr = '', $time = '')
+        {
+                if ($datestr == '')
+                        return '';
+        
+                if ($time == '')
+                        $time = now();
+                
+                $datestr = str_replace('%\\', '', preg_replace(&quot;/([a-z]+?){1}/i&quot;, &quot;\\\\\\1&quot;, $datestr));
+                return date($datestr, $time);
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Standard Date
+ *
+ * Returns a date formatted according to the submitted standard.
+ *
+ * @access        public
+ * @param        string        the chosen format
+ * @param        integer        Unix timestamp
+ * @return        string
+ */        
+if ( ! function_exists('standard_date'))
+{
+        function standard_date($fmt = 'DATE_RFC822', $time = '')
+        {
+                $formats = array(
+                                                'DATE_ATOM'                =&gt;        '%Y-%m-%dT%H:%i:%s%Q',
+                                                'DATE_COOKIE'        =&gt;        '%l, %d-%M-%y %H:%i:%s UTC',
+                                                'DATE_ISO8601'        =&gt;        '%Y-%m-%dT%H:%i:%s%O',
+                                                'DATE_RFC822'        =&gt;        '%D, %d %M %y %H:%i:%s %O',
+                                                'DATE_RFC850'        =&gt;        '%l, %d-%M-%y %H:%m:%i UTC',
+                                                'DATE_RFC1036'        =&gt;        '%D, %d %M %y %H:%i:%s %O',
+                                                'DATE_RFC1123'        =&gt;        '%D, %d %M %Y %H:%i:%s %O',
+                                                'DATE_RSS'                =&gt;        '%D, %d %M %Y %H:%i:%s %O',
+                                                'DATE_W3C'                =&gt;        '%Y-%m-%dT%H:%i:%s%Q'
+                                                );
+
+                if ( ! isset($formats[$fmt]))
+                {
+                        return FALSE;
+                }
+        
+                return mdate($formats[$fmt], $time);
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Timespan
+ *
+ * Returns a span of seconds in this format:
+ *        10 days 14 hours 36 minutes 47 seconds
+ *
+ * @access        public
+ * @param        integer        a number of seconds
+ * @param        integer        Unix timestamp
+ * @return        integer
+ */        
+if ( ! function_exists('timespan'))
+{
+        function timespan($seconds = 1, $time = '')
+        {
+                $CI =&amp; get_instance();
+                $CI-&gt;lang-&gt;load('date');
+
+                if ( ! is_numeric($seconds))
+                {
+                        $seconds = 1;
+                }
+        
+                if ( ! is_numeric($time))
+                {
+                        $time = time();
+                }
+        
+                if ($time &lt;= $seconds)
+                {
+                        $seconds = 1;
+                }
+                else
+                {
+                        $seconds = $time - $seconds;
+                }
+                
+                $str = '';
+                $years = floor($seconds / 31536000);
+        
+                if ($years &gt; 0)
+                {        
+                        $str .= $years.' '.$CI-&gt;lang-&gt;line((($years        &gt; 1) ? 'date_years' : 'date_year')).', ';
+                }        
+        
+                $seconds -= $years * 31536000;
+                $months = floor($seconds / 2628000);
+        
+                if ($years &gt; 0 OR $months &gt; 0)
+                {
+                        if ($months &gt; 0)
+                        {        
+                                $str .= $months.' '.$CI-&gt;lang-&gt;line((($months        &gt; 1) ? 'date_months' : 'date_month')).', ';
+                        }        
+        
+                        $seconds -= $months * 2628000;
+                }
+
+                $weeks = floor($seconds / 604800);
+        
+                if ($years &gt; 0 OR $months &gt; 0 OR $weeks &gt; 0)
+                {
+                        if ($weeks &gt; 0)
+                        {        
+                                $str .= $weeks.' '.$CI-&gt;lang-&gt;line((($weeks        &gt; 1) ? 'date_weeks' : 'date_week')).', ';
+                        }
+                
+                        $seconds -= $weeks * 604800;
+                }                        
+
+                $days = floor($seconds / 86400);
+        
+                if ($months &gt; 0 OR $weeks &gt; 0 OR $days &gt; 0)
+                {
+                        if ($days &gt; 0)
+                        {        
+                                $str .= $days.' '.$CI-&gt;lang-&gt;line((($days        &gt; 1) ? 'date_days' : 'date_day')).', ';
+                        }
+        
+                        $seconds -= $days * 86400;
+                }
+        
+                $hours = floor($seconds / 3600);
+        
+                if ($days &gt; 0 OR $hours &gt; 0)
+                {
+                        if ($hours &gt; 0)
+                        {
+                                $str .= $hours.' '.$CI-&gt;lang-&gt;line((($hours        &gt; 1) ? 'date_hours' : 'date_hour')).', ';
+                        }
+                
+                        $seconds -= $hours * 3600;
+                }
+        
+                $minutes = floor($seconds / 60);
+        
+                if ($days &gt; 0 OR $hours &gt; 0 OR $minutes &gt; 0)
+                {
+                        if ($minutes &gt; 0)
+                        {        
+                                $str .= $minutes.' '.$CI-&gt;lang-&gt;line((($minutes        &gt; 1) ? 'date_minutes' : 'date_minute')).', ';
+                        }
+                
+                        $seconds -= $minutes * 60;
+                }
+        
+                if ($str == '')
+                {
+                        $str .= $seconds.' '.$CI-&gt;lang-&gt;line((($seconds        &gt; 1) ? 'date_seconds' : 'date_second')).', ';
+                }
+                        
+                return substr(trim($str), 0, -1);
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Number of days in a month
+ *
+ * Takes a month/year as input and returns the number of days
+ * for the given month/year. Takes leap years into consideration.
+ *
+ * @access        public
+ * @param        integer a numeric month
+ * @param        integer        a numeric year
+ * @return        integer
+ */        
+if ( ! function_exists('days_in_month'))
+{
+        function days_in_month($month = 0, $year = '')
+        {
+                if ($month &lt; 1 OR $month &gt; 12)
+                {
+                        return 0;
+                }
+        
+                if ( ! is_numeric($year) OR strlen($year) != 4)
+                {
+                        $year = date('Y');
+                }
+        
+                if ($month == 2)
+                {
+                        if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0))
+                        {
+                                return 29;
+                        }
+                }
+
+                $days_in_month        = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+                return $days_in_month[$month - 1];
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Converts a local Unix timestamp to GMT
+ *
+ * @access        public
+ * @param        integer Unix timestamp
+ * @return        integer
+ */        
+if ( ! function_exists('local_to_gmt'))
+{
+        function local_to_gmt($time = '')
+        {
+                if ($time == '')
+                        $time = time();
+        
+                return mktime( gmdate(&quot;H&quot;, $time), gmdate(&quot;i&quot;, $time), gmdate(&quot;s&quot;, $time), gmdate(&quot;m&quot;, $time), gmdate(&quot;d&quot;, $time), gmdate(&quot;Y&quot;, $time));
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Converts GMT time to a localized value
+ *
+ * Takes a Unix timestamp (in GMT) as input, and returns
+ * at the local value based on the timezone and DST setting
+ * submitted
+ *
+ * @access        public
+ * @param        integer Unix timestamp
+ * @param        string        timezone
+ * @param        bool        whether DST is active
+ * @return        integer
+ */        
+if ( ! function_exists('gmt_to_local'))
+{
+        function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
+        {                        
+                if ($time == '')
+                {
+                        return now();
+                }
+        
+                $time += timezones($timezone) * 3600;
+
+                if ($dst == TRUE)
+                {
+                        $time += 3600;
+                }
+        
+                return $time;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Converts a MySQL Timestamp to Unix
+ *
+ * @access        public
+ * @param        integer Unix timestamp
+ * @return        integer
+ */        
+if ( ! function_exists('mysql_to_unix'))
+{
+        function mysql_to_unix($time = '')
+        {
+                // We'll remove certain characters for backward compatibility
+                // since the formatting changed with MySQL 4.1
+                // YYYY-MM-DD HH:MM:SS
+        
+                $time = str_replace('-', '', $time);
+                $time = str_replace(':', '', $time);
+                $time = str_replace(' ', '', $time);
+        
+                // YYYYMMDDHHMMSS
+                return  mktime(
+                                                substr($time, 8, 2),
+                                                substr($time, 10, 2),
+                                                substr($time, 12, 2),
+                                                substr($time, 4, 2),
+                                                substr($time, 6, 2),
+                                                substr($time, 0, 4)
+                                                );
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Unix to &quot;Human&quot;
+ *
+ * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM
+ *
+ * @access        public
+ * @param        integer Unix timestamp
+ * @param        bool        whether to show seconds
+ * @param        string        format: us or euro
+ * @return        string
+ */        
+if ( ! function_exists('unix_to_human'))
+{
+        function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
+        {
+                $r  = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
+                
+                if ($fmt == 'us')
+                {
+                        $r .= date('h', $time).':'.date('i', $time);
+                }
+                else
+                {
+                        $r .= date('H', $time).':'.date('i', $time);
+                }
+        
+                if ($seconds)
+                {
+                        $r .= ':'.date('s', $time);
+                }
+        
+                if ($fmt == 'us')
+                {
+                        $r .= ' '.date('A', $time);
+                }
+                
+                return $r;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Convert &quot;human&quot; date to GMT
+ *
+ * Reverses the above process
+ *
+ * @access        public
+ * @param        string        format: us or euro
+ * @return        integer
+ */        
+if ( ! function_exists('human_to_unix'))
+{
+        function human_to_unix($datestr = '')
+        {
+                if ($datestr == '')
+                {
+                        return FALSE;
+                }
+        
+                $datestr = trim($datestr);
+                $datestr = preg_replace(&quot;/\040+/&quot;, &quot;\040&quot;, $datestr);
+
+                if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr))
+                {
+                        return FALSE;
+                }
+
+                $split = preg_split(&quot;/\040/&quot;, $datestr);
+
+                $ex = explode(&quot;-&quot;, $split['0']);
+        
+                $year  = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0'];
+                $month = (strlen($ex['1']) == 1) ? '0'.$ex['1']  : $ex['1'];
+                $day   = (strlen($ex['2']) == 1) ? '0'.$ex['2']  : $ex['2'];
+
+                $ex = explode(&quot;:&quot;, $split['1']);
+        
+                $hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0'];
+                $min  = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
+
+                if (isset($ex['2']) &amp;&amp; preg_match('/[0-9]{1,2}/', $ex['2']))
+                {
+                        $sec  = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
+                }
+                else
+                {
+                        // Unless specified, seconds get set to zero.
+                        $sec = '00';
+                }
+        
+                if (isset($split['2']))
+                {
+                        $ampm = strtolower($split['2']);
+                
+                        if (substr($ampm, 0, 1) == 'p' AND $hour &lt; 12)
+                                $hour = $hour + 12;
+                        
+                        if (substr($ampm, 0, 1) == 'a' AND $hour == 12)
+                                $hour =  '00';
+                        
+                        if (strlen($hour) == 1)
+                                $hour = '0'.$hour;
+                }
+                        
+                return mktime($hour, $min, $sec, $month, $day, $year);
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Timezone Menu
+ *
+ * Generates a drop-down menu of timezones.
+ *
+ * @access        public
+ * @param        string        timezone
+ * @param        string        classname
+ * @param        string        menu name
+ * @return        string
+ */        
+if ( ! function_exists('timezone_menu'))
+{
+        function timezone_menu($default = 'UTC', $class = &quot;&quot;, $name = 'timezones')
+        {
+                $CI =&amp; get_instance();
+                $CI-&gt;lang-&gt;load('date');
+        
+                if ($default == 'GMT')
+                        $default = 'UTC';
+
+                $menu = '&lt;select name=&quot;'.$name.'&quot;';
+        
+                if ($class != '')
+                {
+                        $menu .= ' class=&quot;'.$class.'&quot;';
+                }
+        
+                $menu .= &quot;&gt;\n&quot;;
+        
+                foreach (timezones() as $key =&gt; $val)
+                {
+                        $selected = ($default == $key) ? &quot; selected='selected'&quot; : '';
+                        $menu .= &quot;&lt;option value='{$key}'{$selected}&gt;&quot;.$CI-&gt;lang-&gt;line($key).&quot;&lt;/option&gt;\n&quot;;
+                }
+
+                $menu .= &quot;&lt;/select&gt;&quot;;
+
+                return $menu;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Timezones
+ *
+ * Returns an array of timezones.  This is a helper function
+ * for various other ones in this library
+ *
+ * @access        public
+ * @param        string        timezone
+ * @return        string
+ */        
+if ( ! function_exists('timezones'))
+{
+        function timezones($tz = '')
+        {
+                // Note: Don't change the order of these even though
+                // some items appear to be in the wrong order
+                
+                $zones = array( 
+                                                'UM12'                =&gt; -12,
+                                                'UM11'                =&gt; -11,
+                                                'UM10'                =&gt; -10,
+                                                'UM95'                =&gt; -9.5,
+                                                'UM9'                =&gt; -9,
+                                                'UM8'                =&gt; -8,
+                                                'UM7'                =&gt; -7,
+                                                'UM6'                =&gt; -6,
+                                                'UM5'                =&gt; -5,
+                                                'UM45'                =&gt; -4.5,
+                                                'UM4'                =&gt; -4,
+                                                'UM35'                =&gt; -3.5,
+                                                'UM3'                =&gt; -3,
+                                                'UM2'                =&gt; -2,
+                                                'UM1'                =&gt; -1,
+                                                'UTC'                =&gt; 0,
+                                                'UP1'                =&gt; +1,
+                                                'UP2'                =&gt; +2,
+                                                'UP3'                =&gt; +3,
+                                                'UP35'                =&gt; +3.5,
+                                                'UP4'                =&gt; +4,
+                                                'UP45'                =&gt; +4.5,
+                                                'UP5'                =&gt; +5,
+                                                'UP55'                =&gt; +5.5,
+                                                'UP575'                =&gt; +5.75,
+                                                'UP6'                =&gt; +6,
+                                                'UP65'                =&gt; +6.5,
+                                                'UP7'                =&gt; +7,
+                                                'UP8'                =&gt; +8,
+                                                'UP875'                =&gt; +8.75,
+                                                'UP9'                =&gt; +9,
+                                                'UP95'                =&gt; +9.5,
+                                                'UP10'                =&gt; +10,
+                                                'UP105'                =&gt; +10.5,
+                                                'UP11'                =&gt; +11,
+                                                'UP115'                =&gt; +11.5,
+                                                'UP12'                =&gt; +12,
+                                                'UP1275'        =&gt; +12.75,
+                                                'UP13'                =&gt; +13,
+                                                'UP14'                =&gt; +14
+                                        );
+                                
+                if ($tz == '')
+                {
+                        return $zones;
+                }
+        
+                if ($tz == 'GMT')
+                        $tz = 'UTC';
+        
+                return ( ! isset($zones[$tz])) ? 0 : $zones[$tz];
+        }
+}
+
+
+/* End of file date_helper.php */
+/* Location: ./system/helpers/date_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersdirectory_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/directory_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/directory_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/directory_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Directory Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/directory_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Create a Directory Map
+ *
+ * Reads the specified directory and builds an array
+ * representation of it.  Sub-folders contained with the
+ * directory will be mapped as well.
+ *
+ * @access        public
+ * @param        string        path to source
+ * @param        bool        whether to limit the result to the top level only
+ * @return        array
+ */        
+if ( ! function_exists('directory_map'))
+{
+        function directory_map($source_dir, $top_level_only = FALSE, $hidden = FALSE)
+        {        
+                if ($fp = @opendir($source_dir))
+                {
+                        $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;                
+                        $filedata = array();
+                        
+                        while (FALSE !== ($file = readdir($fp)))
+                        {
+                                if (($hidden == FALSE &amp;&amp; strncmp($file, '.', 1) == 0) OR ($file == '.' OR $file == '..'))
+                                {
+                                        continue;
+                                }
+                                
+                                if ($top_level_only == FALSE &amp;&amp; @is_dir($source_dir.$file))
+                                {
+                                        $temp_array = array();
+                                
+                                        $temp_array = directory_map($source_dir.$file.DIRECTORY_SEPARATOR, $top_level_only, $hidden);
+                                
+                                        $filedata[$file] = $temp_array;
+                                }
+                                else
+                                {
+                                        $filedata[] = $file;
+                                }
+                        }
+                        
+                        closedir($fp);
+                        return $filedata;
+                }
+        }
+}
+
+
+/* End of file directory_helper.php */
+/* Location: ./system/helpers/directory_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersdownload_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/download_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/download_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/download_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Download Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/download_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Force Download
+ *
+ * Generates headers that force a download to happen
+ *
+ * @access        public
+ * @param        string        filename
+ * @param        mixed        the data to be downloaded
+ * @return        void
+ */        
+if ( ! function_exists('force_download'))
+{
+        function force_download($filename = '', $data = '')
+        {
+                if ($filename == '' OR $data == '')
+                {
+                        return FALSE;
+                }
+
+                // Try to determine if the filename includes a file extension.
+                // We need it in order to set the MIME type
+                if (FALSE === strpos($filename, '.'))
+                {
+                        return FALSE;
+                }
+        
+                // Grab the file extension
+                $x = explode('.', $filename);
+                $extension = end($x);
+
+                // Load the mime types
+                @include(APPPATH.'config/mimes'.EXT);
+        
+                // Set a default mime if we can't find it
+                if ( ! isset($mimes[$extension]))
+                {
+                        $mime = 'application/octet-stream';
+                }
+                else
+                {
+                        $mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] : $mimes[$extension];
+                }
+        
+                // Generate the server headers
+                if (strstr($_SERVER['HTTP_USER_AGENT'], &quot;MSIE&quot;))
+                {
+                        header('Content-Type: &quot;'.$mime.'&quot;');
+                        header('Content-Disposition: attachment; filename=&quot;'.$filename.'&quot;');
+                        header('Expires: 0');
+                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+                        header(&quot;Content-Transfer-Encoding: binary&quot;);
+                        header('Pragma: public');
+                        header(&quot;Content-Length: &quot;.strlen($data));
+                }
+                else
+                {
+                        header('Content-Type: &quot;'.$mime.'&quot;');
+                        header('Content-Disposition: attachment; filename=&quot;'.$filename.'&quot;');
+                        header(&quot;Content-Transfer-Encoding: binary&quot;);
+                        header('Expires: 0');
+                        header('Pragma: no-cache');
+                        header(&quot;Content-Length: &quot;.strlen($data));
+                }
+        
+                exit($data);
+        }
+}
+
+
+/* End of file download_helper.php */
+/* Location: ./system/helpers/download_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersemail_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/email_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/email_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/email_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Email Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/email_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validate email address
+ *
+ * @access        public
+ * @return        bool
+ */        
+if ( ! function_exists('valid_email'))
+{
+        function valid_email($address)
+        {
+                return ( ! preg_match(&quot;/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix&quot;, $address)) ? FALSE : TRUE;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Send an email
+ *
+ * @access        public
+ * @return        bool
+ */        
+if ( ! function_exists('send_email'))
+{
+        function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
+        {
+                return mail($recipient, $subject, $message);
+        }
+}
+
+
+/* End of file email_helper.php */
+/* Location: ./system/helpers/email_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersfile_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/file_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/file_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/file_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,464 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter File Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/file_helpers.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Read File
+ *
+ * Opens the file specfied in the path and returns it as a string.
+ *
+ * @access        public
+ * @param        string        path to file
+ * @return        string
+ */        
+if ( ! function_exists('read_file'))
+{
+        function read_file($file)
+        {
+                if ( ! file_exists($file))
+                {
+                        return FALSE;
+                }
+        
+                if (function_exists('file_get_contents'))
+                {
+                        return file_get_contents($file);                
+                }
+
+                if ( ! $fp = @fopen($file, FOPEN_READ))
+                {
+                        return FALSE;
+                }
+                
+                flock($fp, LOCK_SH);
+        
+                $data = '';
+                if (filesize($file) &gt; 0)
+                {
+                        $data =&amp; fread($fp, filesize($file));
+                }
+
+                flock($fp, LOCK_UN);
+                fclose($fp);
+
+                return $data;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Write File
+ *
+ * Writes data to the file specified in the path.
+ * Creates a new file if non-existent.
+ *
+ * @access        public
+ * @param        string        path to file
+ * @param        string        file data
+ * @return        bool
+ */        
+if ( ! function_exists('write_file'))
+{
+        function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE)
+        {
+                if ( ! $fp = @fopen($path, $mode))
+                {
+                        return FALSE;
+                }
+                
+                flock($fp, LOCK_EX);
+                fwrite($fp, $data);
+                flock($fp, LOCK_UN);
+                fclose($fp);        
+
+                return TRUE;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Delete Files
+ *
+ * Deletes all files contained in the supplied directory path.
+ * Files must be writable or owned by the system in order to be deleted.
+ * If the second parameter is set to TRUE, any directories contained
+ * within the supplied base directory will be nuked as well.
+ *
+ * @access        public
+ * @param        string        path to file
+ * @param        bool        whether to delete any directories found in the path
+ * @return        bool
+ */        
+if ( ! function_exists('delete_files'))
+{
+        function delete_files($path, $del_dir = FALSE, $level = 0)
+        {        
+                // Trim the trailing slash
+                $path = rtrim($path, DIRECTORY_SEPARATOR);
+                        
+                if ( ! $current_dir = @opendir($path))
+                        return;
+        
+                while(FALSE !== ($filename = @readdir($current_dir)))
+                {
+                        if ($filename != &quot;.&quot; and $filename != &quot;..&quot;)
+                        {
+                                if (is_dir($path.DIRECTORY_SEPARATOR.$filename))
+                                {
+                                        // Ignore empty folders
+                                        if (substr($filename, 0, 1) != '.')
+                                        {
+                                                delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1);
+                                        }                                
+                                }
+                                else
+                                {
+                                        unlink($path.DIRECTORY_SEPARATOR.$filename);
+                                }
+                        }
+                }
+                @closedir($current_dir);
+        
+                if ($del_dir == TRUE AND $level &gt; 0)
+                {
+                        @rmdir($path);
+                }
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Get Filenames
+ *
+ * Reads the specified directory and builds an array containing the filenames.  
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @access        public
+ * @param        string        path to source
+ * @param        bool        whether to include the path as part of the filename
+ * @param        bool        internal variable to determine recursion status - do not use in calls
+ * @return        array
+ */        
+if ( ! function_exists('get_filenames'))
+{
+        function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
+        {
+                static $_filedata = array();
+                                
+                if ($fp = @opendir($source_dir))
+                {
+                        // reset the array and make sure $source_dir has a trailing slash on the initial call
+                        if ($_recursion === FALSE)
+                        {
+                                $_filedata = array();
+                                $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
+                        }
+                        
+                        while (FALSE !== ($file = readdir($fp)))
+                        {
+                                if (@is_dir($source_dir.$file) &amp;&amp; strncmp($file, '.', 1) !== 0)
+                                {
+                                         get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
+                                }
+                                elseif (strncmp($file, '.', 1) !== 0)
+                                {
+                                        $_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file;
+                                }
+                        }
+                        return $_filedata;
+                }
+                else
+                {
+                        return FALSE;
+                }
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Get Directory File Information
+ *
+ * Reads the specified directory and builds an array containing the filenames,  
+ * filesize, dates, and permissions
+ *
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @access        public
+ * @param        string        path to source
+ * @param        bool        whether to include the path as part of the filename
+ * @param        bool        internal variable to determine recursion status - do not use in calls
+ * @return        array
+ */        
+if ( ! function_exists('get_dir_file_info'))
+{
+        function get_dir_file_info($source_dir, $include_path = FALSE, $_recursion = FALSE)
+        {
+                static $_filedata = array();
+                $relative_path = $source_dir;
+
+                if ($fp = @opendir($source_dir))
+                {
+                        // reset the array and make sure $source_dir has a trailing slash on the initial call
+                        if ($_recursion === FALSE)
+                        {
+                                $_filedata = array();
+                                $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
+                        }
+
+                        while (FALSE !== ($file = readdir($fp)))
+                        {
+                                if (@is_dir($source_dir.$file) &amp;&amp; strncmp($file, '.', 1) !== 0)
+                                {
+                                         get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
+                                }
+                                elseif (strncmp($file, '.', 1) !== 0)
+                                {
+                                        $_filedata[$file] = get_file_info($source_dir.$file);
+                                        $_filedata[$file]['relative_path'] = $relative_path;
+                                }
+                        }
+                        return $_filedata;
+                }
+                else
+                {
+                        return FALSE;
+                }
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+* Get File Info
+*
+* Given a file and path, returns the name, path, size, date modified
+* Second parameter allows you to explicitly declare what information you want returned
+* Options are: name, server_path, size, date, readable, writable, executable, fileperms
+* Returns FALSE if the file cannot be found.
+*
+* @access        public
+* @param        string        path to file
+* @param        mixed        array or comma separated string of information returned
+* @return        array
+*/
+if ( ! function_exists('get_file_info'))
+{
+        function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
+        {
+
+                if ( ! file_exists($file))
+                {
+                        return FALSE;
+                }
+
+                if (is_string($returned_values))
+                {
+                        $returned_values = explode(',', $returned_values);
+                }
+
+                foreach ($returned_values as $key)
+                {
+                        switch ($key)
+                        {
+                                case 'name':
+                                        $fileinfo['name'] = substr(strrchr($file, DIRECTORY_SEPARATOR), 1);
+                                        break;
+                                case 'server_path':
+                                        $fileinfo['server_path'] = $file;
+                                        break;
+                                case 'size':
+                                        $fileinfo['size'] = filesize($file);
+                                        break;
+                                case 'date':
+                                        $fileinfo['date'] = filectime($file);
+                                        break;
+                                case 'readable':
+                                        $fileinfo['readable'] = is_readable($file);
+                                        break;
+                                case 'writable':
+                                        // There are known problems using is_weritable on IIS.  It may not be reliable - consider fileperms()
+                                        $fileinfo['writable'] = is_writable($file);
+                                        break;
+                                case 'executable':
+                                        $fileinfo['executable'] = is_executable($file);
+                                        break;
+                                case 'fileperms':
+                                        $fileinfo['fileperms'] = fileperms($file);
+                                        break;
+                        }
+                }
+
+                return $fileinfo;
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Get Mime by Extension
+ *
+ * Translates a file extension into a mime type based on config/mimes.php. 
+ * Returns FALSE if it can't determine the type, or open the mime config file
+ *
+ * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
+ * It should NOT be trusted, and should certainly NOT be used for security
+ *
+ * @access        public
+ * @param        string        path to file
+ * @return        mixed
+ */        
+if ( ! function_exists('get_mime_by_extension'))
+{
+        function get_mime_by_extension($file)
+        {
+                $extension = substr(strrchr($file, '.'), 1);
+
+                global $mimes;
+
+                if ( ! is_array($mimes))
+                {
+                        if ( ! require_once(APPPATH.'config/mimes.php'))
+                        {
+                                return FALSE;
+                        }
+                }
+
+                if (array_key_exists($extension, $mimes))
+                {
+                        if (is_array($mimes[$extension]))
+                        {
+                                // Multiple mime types, just give the first one
+                                return current($mimes[$extension]);
+                        }
+                        else
+                        {
+                                return $mimes[$extension];
+                        }
+                }
+                else
+                {
+                        return FALSE;
+                }
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Symbolic Permissions
+ *
+ * Takes a numeric value representing a file's permissions and returns
+ * standard symbolic notation representing that value
+ *
+ * @access        public
+ * @param        int
+ * @return        string
+ */        
+if ( ! function_exists('symbolic_permissions'))
+{
+        function symbolic_permissions($perms)
+        {        
+                if (($perms &amp; 0xC000) == 0xC000)
+                {
+                        $symbolic = 's'; // Socket
+                }
+                elseif (($perms &amp; 0xA000) == 0xA000)
+                {
+                        $symbolic = 'l'; // Symbolic Link
+                }
+                elseif (($perms &amp; 0x8000) == 0x8000)
+                {
+                        $symbolic = '-'; // Regular
+                }
+                elseif (($perms &amp; 0x6000) == 0x6000)
+                {
+                        $symbolic = 'b'; // Block special
+                }
+                elseif (($perms &amp; 0x4000) == 0x4000)
+                {
+                        $symbolic = 'd'; // Directory
+                }
+                elseif (($perms &amp; 0x2000) == 0x2000)
+                {
+                        $symbolic = 'c'; // Character special
+                }
+                elseif (($perms &amp; 0x1000) == 0x1000)
+                {
+                        $symbolic = 'p'; // FIFO pipe
+                }
+                else
+                {
+                        $symbolic = 'u'; // Unknown
+                }
+
+                // Owner
+                $symbolic .= (($perms &amp; 0x0100) ? 'r' : '-');
+                $symbolic .= (($perms &amp; 0x0080) ? 'w' : '-');
+                $symbolic .= (($perms &amp; 0x0040) ? (($perms &amp; 0x0800) ? 's' : 'x' ) : (($perms &amp; 0x0800) ? 'S' : '-'));
+
+                // Group
+                $symbolic .= (($perms &amp; 0x0020) ? 'r' : '-');
+                $symbolic .= (($perms &amp; 0x0010) ? 'w' : '-');
+                $symbolic .= (($perms &amp; 0x0008) ? (($perms &amp; 0x0400) ? 's' : 'x' ) : (($perms &amp; 0x0400) ? 'S' : '-'));
+
+                // World
+                $symbolic .= (($perms &amp; 0x0004) ? 'r' : '-');
+                $symbolic .= (($perms &amp; 0x0002) ? 'w' : '-');
+                $symbolic .= (($perms &amp; 0x0001) ? (($perms &amp; 0x0200) ? 't' : 'x' ) : (($perms &amp; 0x0200) ? 'T' : '-'));
+
+                return $symbolic;                
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Octal Permissions
+ *
+ * Takes a numeric value representing a file's permissions and returns
+ * a three character string representing the file's octal permissions
+ *
+ * @access        public
+ * @param        int
+ * @return        string
+ */        
+if ( ! function_exists('octal_permissions'))
+{
+        function octal_permissions($perms)
+        {
+                return substr(sprintf('%o', $perms), -3);
+        }
+}
+
+
+/* End of file file_helper.php */
+/* Location: ./system/helpers/file_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersform_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/form_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/form_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/form_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1019 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Form Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/form_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Declaration
+ *
+ * Creates the opening portion of the form.
+ *
+ * @access        public
+ * @param        string        the URI segments of the form destination
+ * @param        array        a key/value pair of attributes
+ * @param        array        a key/value pair hidden data
+ * @return        string
+ */        
+if ( ! function_exists('form_open'))
+{
+        function form_open($action = '', $attributes = '', $hidden = array())
+        {
+                $CI =&amp; get_instance();
+
+                if ($attributes == '')
+                {
+                        $attributes = 'method=&quot;post&quot;';
+                }
+
+                $action = ( strpos($action, '://') === FALSE) ? $CI-&gt;config-&gt;site_url($action) : $action;
+
+                $form = '&lt;form action=&quot;'.$action.'&quot;';
+        
+                $form .= _attributes_to_string($attributes, TRUE);
+        
+                $form .= '&gt;';
+
+                if (is_array($hidden) AND count($hidden) &gt; 0)
+                {
+                        $form .= form_hidden($hidden);
+                }
+
+                return $form;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Declaration - Multipart type
+ *
+ * Creates the opening portion of the form, but with &quot;multipart/form-data&quot;.
+ *
+ * @access        public
+ * @param        string        the URI segments of the form destination
+ * @param        array        a key/value pair of attributes
+ * @param        array        a key/value pair hidden data
+ * @return        string
+ */
+if ( ! function_exists('form_open_multipart'))
+{
+        function form_open_multipart($action, $attributes = array(), $hidden = array())
+        {
+                $attributes['enctype'] = 'multipart/form-data';
+                return form_open($action, $attributes, $hidden);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Hidden Input Field
+ *
+ * Generates hidden fields.  You can pass a simple key/value string or an associative
+ * array with multiple values.
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_hidden'))
+{
+        function form_hidden($name, $value = '', $recursing = FALSE)
+        {
+                static $form;
+
+                if ($recursing === FALSE)
+                {
+                        $form = &quot;\n&quot;;
+                }
+
+                if (is_array($name))
+                {
+                        foreach ($name as $key =&gt; $val)
+                        {
+                                form_hidden($key, $val, TRUE);
+                        }
+                        return $form;
+                }
+
+                if ( ! is_array($value))
+                {
+                        $form .= '&lt;input type=&quot;hidden&quot; name=&quot;'.$name.'&quot; value=&quot;'.form_prep($value).'&quot; /&gt;'.&quot;\n&quot;;
+                }
+                else
+                {
+                        foreach ($value as $k =&gt; $v)
+                        {
+                                $k = (is_int($k)) ? '' : $k; 
+                                form_hidden($name.'['.$k.']', $v, TRUE);
+                        }
+                }
+
+                return $form;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Text Input Field
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_input'))
+{
+        function form_input($data = '', $value = '', $extra = '')
+        {
+                $defaults = array('type' =&gt; 'text', 'name' =&gt; (( ! is_array($data)) ? $data : ''), 'value' =&gt; $value);
+
+                return &quot;&lt;input &quot;._parse_form_attributes($data, $defaults).$extra.&quot; /&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Password Field
+ *
+ * Identical to the input function but adds the &quot;password&quot; type
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_password'))
+{
+        function form_password($data = '', $value = '', $extra = '')
+        {
+                if ( ! is_array($data))
+                {
+                        $data = array('name' =&gt; $data);
+                }
+
+                $data['type'] = 'password';
+                return form_input($data, $value, $extra);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Upload Field
+ *
+ * Identical to the input function but adds the &quot;file&quot; type
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_upload'))
+{
+        function form_upload($data = '', $value = '', $extra = '')
+        {
+                if ( ! is_array($data))
+                {
+                        $data = array('name' =&gt; $data);
+                }
+
+                $data['type'] = 'file';
+                return form_input($data, $value, $extra);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Textarea field
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_textarea'))
+{
+        function form_textarea($data = '', $value = '', $extra = '')
+        {
+                $defaults = array('name' =&gt; (( ! is_array($data)) ? $data : ''), 'cols' =&gt; '90', 'rows' =&gt; '12');
+
+                if ( ! is_array($data) OR ! isset($data['value']))
+                {
+                        $val = $value;
+                }
+                else
+                {
+                        $val = $data['value']; 
+                        unset($data['value']); // textareas don't use the value attribute
+                }
+
+                return &quot;&lt;textarea &quot;._parse_form_attributes($data, $defaults).$extra.&quot;&gt;&quot;.form_prep($val).&quot;&lt;/textarea&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Multi-select menu
+ *
+ * @access        public
+ * @param        string
+ * @param        array
+ * @param        mixed
+ * @param        string
+ * @return        type
+ */
+if (! function_exists('form_multiselect'))
+{
+        function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '')
+        {
+                if ( ! strpos($extra, 'multiple'))
+                {
+                        $extra .= ' multiple=&quot;multiple&quot;';
+                }
+        
+                return form_dropdown($name, $options, $selected, $extra);
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Drop-down Menu
+ *
+ * @access        public
+ * @param        string
+ * @param        array
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_dropdown'))
+{
+        function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '')
+        {
+                if ( ! is_array($selected))
+                {
+                        $selected = array($selected);
+                }
+
+                // If no selected state was submitted we will attempt to set it automatically
+                if (count($selected) === 0)
+                {
+                        // If the form name appears in the $_POST array we have a winner!
+                        if (isset($_POST[$name]))
+                        {
+                                $selected = array($_POST[$name]);
+                        }
+                }
+
+                if ($extra != '') $extra = ' '.$extra;
+
+                $multiple = (count($selected) &gt; 1 &amp;&amp; strpos($extra, 'multiple') === FALSE) ? ' multiple=&quot;multiple&quot;' : '';
+
+                $form = '&lt;select name=&quot;'.$name.'&quot;'.$extra.$multiple.&quot;&gt;\n&quot;;
+
+                foreach ($options as $key =&gt; $val)
+                {
+                        $key = (string) $key;
+
+                        if (is_array($val))
+                        {
+                                $form .= '&lt;optgroup label=&quot;'.$key.'&quot;&gt;'.&quot;\n&quot;;
+
+                                foreach ($val as $optgroup_key =&gt; $optgroup_val)
+                                {
+                                        $sel = (in_array($optgroup_key, $selected)) ? ' selected=&quot;selected&quot;' : '';
+
+                                        $form .= '&lt;option value=&quot;'.$optgroup_key.'&quot;'.$sel.'&gt;'.(string) $optgroup_val.&quot;&lt;/option&gt;\n&quot;;
+                                }
+
+                                $form .= '&lt;/optgroup&gt;'.&quot;\n&quot;;
+                        }
+                        else
+                        {
+                                $sel = (in_array($key, $selected)) ? ' selected=&quot;selected&quot;' : '';
+
+                                $form .= '&lt;option value=&quot;'.$key.'&quot;'.$sel.'&gt;'.(string) $val.&quot;&lt;/option&gt;\n&quot;;
+                        }
+                }
+
+                $form .= '&lt;/select&gt;';
+
+                return $form;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Checkbox Field
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        bool
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_checkbox'))
+{
+        function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
+        {
+                $defaults = array('type' =&gt; 'checkbox', 'name' =&gt; (( ! is_array($data)) ? $data : ''), 'value' =&gt; $value);
+
+                if (is_array($data) AND array_key_exists('checked', $data))
+                {
+                        $checked = $data['checked'];
+
+                        if ($checked == FALSE)
+                        {
+                                unset($data['checked']);
+                        }
+                        else
+                        {
+                                $data['checked'] = 'checked';
+                        }
+                }
+
+                if ($checked == TRUE)
+                {
+                        $defaults['checked'] = 'checked';
+                }
+                else
+                {
+                        unset($defaults['checked']);
+                }
+
+                return &quot;&lt;input &quot;._parse_form_attributes($data, $defaults).$extra.&quot; /&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Radio Button
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        bool
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_radio'))
+{
+        function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
+        {
+                if ( ! is_array($data))
+                {        
+                        $data = array('name' =&gt; $data);
+                }
+
+                $data['type'] = 'radio';
+                return form_checkbox($data, $value, $checked, $extra);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Submit Button
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_submit'))
+{        
+        function form_submit($data = '', $value = '', $extra = '')
+        {
+                $defaults = array('type' =&gt; 'submit', 'name' =&gt; (( ! is_array($data)) ? $data : ''), 'value' =&gt; $value);
+
+                return &quot;&lt;input &quot;._parse_form_attributes($data, $defaults).$extra.&quot; /&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Reset Button
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_reset'))
+{
+        function form_reset($data = '', $value = '', $extra = '')
+        {
+                $defaults = array('type' =&gt; 'reset', 'name' =&gt; (( ! is_array($data)) ? $data : ''), 'value' =&gt; $value);
+
+                return &quot;&lt;input &quot;._parse_form_attributes($data, $defaults).$extra.&quot; /&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Button
+ *
+ * @access        public
+ * @param        mixed
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_button'))
+{
+        function form_button($data = '', $content = '', $extra = '')
+        {
+                $defaults = array('name' =&gt; (( ! is_array($data)) ? $data : ''), 'type' =&gt; 'button');
+
+                if ( is_array($data) AND isset($data['content']))
+                {
+                        $content = $data['content'];
+                        unset($data['content']); // content is not an attribute
+                }
+
+                return &quot;&lt;button &quot;._parse_form_attributes($data, $defaults).$extra.&quot;&gt;&quot;.$content.&quot;&lt;/button&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Label Tag
+ *
+ * @access        public
+ * @param        string        The text to appear onscreen
+ * @param        string        The id the label applies to
+ * @param        string        Additional attributes
+ * @return        string
+ */
+if ( ! function_exists('form_label'))
+{
+        function form_label($label_text = '', $id = '', $attributes = array())
+        {
+
+                $label = '&lt;label';
+
+                if ($id != '')
+                {
+                         $label .= &quot; for=\&quot;$id\&quot;&quot;;
+                }
+
+                if (is_array($attributes) AND count($attributes) &gt; 0)
+                {
+                        foreach ($attributes as $key =&gt; $val)
+                        {
+                                $label .= ' '.$key.'=&quot;'.$val.'&quot;';
+                        }
+                }
+
+                $label .= &quot;&gt;$label_text&lt;/label&gt;&quot;;
+
+                return $label;
+        }
+}
+
+// ------------------------------------------------------------------------
+/**
+ * Fieldset Tag
+ *
+ * Used to produce &lt;fieldset&gt;&lt;legend&gt;text&lt;/legend&gt;.  To close fieldset
+ * use form_fieldset_close()
+ *
+ * @access        public
+ * @param        string        The legend text
+ * @param        string        Additional attributes
+ * @return        string
+ */
+if ( ! function_exists('form_fieldset'))
+{
+        function form_fieldset($legend_text = '', $attributes = array())
+        {
+                $fieldset = &quot;&lt;fieldset&quot;;
+
+                $fieldset .= _attributes_to_string($attributes, FALSE);
+
+                $fieldset .= &quot;&gt;\n&quot;;
+
+                if ($legend_text != '')
+                {
+                        $fieldset .= &quot;&lt;legend&gt;$legend_text&lt;/legend&gt;\n&quot;;
+                }
+
+                return $fieldset;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Fieldset Close Tag
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_fieldset_close'))
+{
+        function form_fieldset_close($extra = '')
+        {
+                return &quot;&lt;/fieldset&gt;&quot;.$extra;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Close Tag
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_close'))
+{
+        function form_close($extra = '')
+        {
+                return &quot;&lt;/form&gt;&quot;.$extra;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Prep
+ *
+ * Formats text so that it can be safely placed in a form field in the event it has HTML tags.
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_prep'))
+{
+        function form_prep($str = '')
+        {
+                // if the field name is an array we do this recursively
+                if (is_array($str))
+                {
+                        foreach ($str as $key =&gt; $val)
+                        {
+                                $str[$key] = form_prep($val);
+                        }
+
+                        return $str;
+                }
+
+                if ($str === '')
+                {
+                        return '';
+                }
+
+                $temp = '__TEMP_AMPERSANDS__';
+
+                // Replace entities to temporary markers so that 
+                // htmlspecialchars won't mess them up
+                $str = preg_replace(&quot;/&amp;#(\d+);/&quot;, &quot;$temp\\1;&quot;, $str);
+                $str = preg_replace(&quot;/&amp;(\w+);/&quot;,  &quot;$temp\\1;&quot;, $str);
+
+                $str = htmlspecialchars($str);
+
+                // In case htmlspecialchars misses these.
+                $str = str_replace(array(&quot;'&quot;, '&quot;'), array(&quot;&amp;#39;&quot;, &quot;&amp;quot;&quot;), $str);
+
+                // Decode the temp markers back to entities
+                $str = preg_replace(&quot;/$temp(\d+);/&quot;,&quot;&amp;#\\1;&quot;,$str);
+                $str = preg_replace(&quot;/$temp(\w+);/&quot;,&quot;&amp;\\1;&quot;,$str);
+
+                return $str;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Value
+ *
+ * Grabs a value from the POST array for the specified field so you can
+ * re-populate an input field or textarea.  If Form Validation
+ * is active it retrieves the info from the validation class
+ *
+ * @access        public
+ * @param        string
+ * @return        mixed
+ */
+if ( ! function_exists('set_value'))
+{
+        function set_value($field = '', $default = '')
+        {
+                if (FALSE === ($OBJ =&amp; _get_validation_object()))
+                {
+                        if ( ! isset($_POST[$field]))
+                        {
+                                return $default;
+                        }
+
+                        return form_prep($_POST[$field]);
+                }
+
+                return form_prep($OBJ-&gt;set_value($field, $default));
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Select
+ *
+ * Let's you set the selected value of a &lt;select&gt; menu via data in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @access        public
+ * @param        string
+ * @param        string
+ * @param        bool
+ * @return        string
+ */
+if ( ! function_exists('set_select'))
+{
+        function set_select($field = '', $value = '', $default = FALSE)
+        {
+                $OBJ =&amp; _get_validation_object();
+
+                if ($OBJ === FALSE)
+                {
+                        if ( ! isset($_POST[$field]))
+                        {
+                                if (count($_POST) === 0 AND $default == TRUE)
+                                {
+                                        return ' selected=&quot;selected&quot;';
+                                }
+                                return '';
+                        }
+
+                        $field = $_POST[$field];
+
+                        if (is_array($field))
+                        {
+                                if ( ! in_array($value, $field))
+                                {
+                                        return '';
+                                }
+                        }
+                        else
+                        {
+                                if (($field == '' OR $value == '') OR ($field != $value))
+                                {
+                                        return '';
+                                }
+                        }
+
+                        return ' selected=&quot;selected&quot;';
+                }
+
+                return $OBJ-&gt;set_select($field, $value, $default);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Checkbox
+ *
+ * Let's you set the selected value of a checkbox via the value in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @access        public
+ * @param        string
+ * @param        string
+ * @param        bool
+ * @return        string
+ */
+if ( ! function_exists('set_checkbox'))
+{
+        function set_checkbox($field = '', $value = '', $default = FALSE)
+        {
+                $OBJ =&amp; _get_validation_object();
+
+                if ($OBJ === FALSE)
+                { 
+                        if ( ! isset($_POST[$field]))
+                        {
+                                if (count($_POST) === 0 AND $default == TRUE)
+                                {
+                                        return ' checked=&quot;checked&quot;';
+                                }
+                                return '';
+                        }
+
+                        $field = $_POST[$field];
+                        
+                        if (is_array($field))
+                        {
+                                if ( ! in_array($value, $field))
+                                {
+                                        return '';
+                                }
+                        }
+                        else
+                        {
+                                if (($field == '' OR $value == '') OR ($field != $value))
+                                {
+                                        return '';
+                                }
+                        }
+
+                        return ' checked=&quot;checked&quot;';
+                }
+
+                return $OBJ-&gt;set_checkbox($field, $value, $default);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Radio
+ *
+ * Let's you set the selected value of a radio field via info in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @access        public
+ * @param        string
+ * @param        string
+ * @param        bool
+ * @return        string
+ */
+if ( ! function_exists('set_radio'))
+{
+        function set_radio($field = '', $value = '', $default = FALSE)
+        {
+                $OBJ =&amp; _get_validation_object();
+
+                if ($OBJ === FALSE)
+                {
+                        if ( ! isset($_POST[$field]))
+                        {
+                                if (count($_POST) === 0 AND $default == TRUE)
+                                {
+                                        return ' checked=&quot;checked&quot;';
+                                }
+                                return '';
+                        }
+
+                        $field = $_POST[$field];
+                        
+                        if (is_array($field))
+                        {
+                                if ( ! in_array($value, $field))
+                                {
+                                        return '';
+                                }
+                        }
+                        else
+                        {
+                                if (($field == '' OR $value == '') OR ($field != $value))
+                                {
+                                        return '';
+                                }
+                        }
+
+                        return ' checked=&quot;checked&quot;';
+                }
+
+                return $OBJ-&gt;set_radio($field, $value, $default);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Error
+ *
+ * Returns the error for a specific form field.  This is a helper for the
+ * form validation class.
+ *
+ * @access        public
+ * @param        string
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('form_error'))
+{
+        function form_error($field = '', $prefix = '', $suffix = '')
+        {
+                if (FALSE === ($OBJ =&amp; _get_validation_object()))
+                {
+                        return '';
+                }
+
+                return $OBJ-&gt;error($field, $prefix, $suffix);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validation Error String
+ *
+ * Returns all the errors associated with a form submission.  This is a helper
+ * function for the form validation class.
+ *
+ * @access        public
+ * @param        string
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('validation_errors'))
+{
+        function validation_errors($prefix = '', $suffix = '')
+        {
+                if (FALSE === ($OBJ =&amp; _get_validation_object()))
+                {
+                        return '';
+                }
+
+                return $OBJ-&gt;error_string($prefix, $suffix);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Parse the form attributes
+ *
+ * Helper function used by some of the form helpers
+ *
+ * @access        private
+ * @param        array
+ * @param        array
+ * @return        string
+ */
+if ( ! function_exists('_parse_form_attributes'))
+{
+        function _parse_form_attributes($attributes, $default)
+        {
+                if (is_array($attributes))
+                {
+                        foreach ($default as $key =&gt; $val)
+                        {
+                                if (isset($attributes[$key]))
+                                {
+                                        $default[$key] = $attributes[$key];
+                                        unset($attributes[$key]);
+                                }
+                        }
+
+                        if (count($attributes) &gt; 0)
+                        {
+                                $default = array_merge($default, $attributes);
+                        }
+                }
+
+                $att = '';
+
+                foreach ($default as $key =&gt; $val)
+                {
+                        if ($key == 'value')
+                        {
+                                $val = form_prep($val);
+                        }
+
+                        $att .= $key . '=&quot;' . $val . '&quot; ';
+                }
+
+                return $att;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Attributes To String
+ *
+ * Helper function used by some of the form helpers
+ *
+ * @access        private
+ * @param        mixed
+ * @param        bool
+ * @return        string
+ */
+if ( ! function_exists('_attributes_to_string'))
+{
+        function _attributes_to_string($attributes, $formtag = FALSE)
+        {
+                if (is_string($attributes) AND strlen($attributes) &gt; 0)
+                {
+                        if ($formtag == TRUE AND strpos($attributes, 'method=') === FALSE)
+                        {
+                                $attributes .= ' method=&quot;post&quot;';
+                        }
+
+                return ' '.$attributes;
+                }
+        
+                if (is_object($attributes) AND count($attributes) &gt; 0)
+                {
+                        $attributes = (array)$attributes;
+                }
+
+                if (is_array($attributes) AND count($attributes) &gt; 0)
+                {
+                $atts = '';
+
+                if ( ! isset($attributes['method']) AND $formtag === TRUE)
+                {
+                        $atts .= ' method=&quot;post&quot;';
+                }
+
+                foreach ($attributes as $key =&gt; $val)
+                {
+                        $atts .= ' '.$key.'=&quot;'.$val.'&quot;';
+                }
+
+                return $atts;
+                }
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validation Object
+ *
+ * Determines what the form validation class was instantiated as, fetches
+ * the object and returns it.
+ *
+ * @access        private
+ * @return        mixed
+ */
+if ( ! function_exists('_get_validation_object'))
+{
+        function &amp;_get_validation_object()
+        {
+                $CI =&amp; get_instance();
+
+                // We set this as a variable since we're returning by reference
+                $return = FALSE;
+
+                if ( ! isset($CI-&gt;load-&gt;_ci_classes) OR  ! isset($CI-&gt;load-&gt;_ci_classes['form_validation']))
+                {
+                        return $return;
+                }
+
+                $object = $CI-&gt;load-&gt;_ci_classes['form_validation'];
+
+                if ( ! isset($CI-&gt;$object) OR ! is_object($CI-&gt;$object))
+                {
+                        return $return;
+                }
+
+                return $CI-&gt;$object;
+        }
+}
+
+
+/* End of file form_helper.php */
+/* Location: ./system/helpers/form_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpershtml_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/html_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/html_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/html_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,416 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter HTML Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/html_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Heading
+ *
+ * Generates an HTML heading tag.  First param is the data.
+ * Second param is the size of the heading tag.
+ *
+ * @access        public
+ * @param        string
+ * @param        integer
+ * @return        string
+ */
+if ( ! function_exists('heading'))
+{
+        function heading($data = '', $h = '1')
+        {
+                return &quot;&lt;h&quot;.$h.&quot;&gt;&quot;.$data.&quot;&lt;/h&quot;.$h.&quot;&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Unordered List
+ *
+ * Generates an HTML unordered list from an single or multi-dimensional array.
+ *
+ * @access        public
+ * @param        array
+ * @param        mixed
+ * @return        string
+ */
+if ( ! function_exists('ul'))
+{
+        function ul($list, $attributes = '')
+        {
+                return _list('ul', $list, $attributes);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Ordered List
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access        public
+ * @param        array
+ * @param        mixed
+ * @return        string
+ */
+if ( ! function_exists('ol'))
+{
+        function ol($list, $attributes = '')
+        {
+                return _list('ol', $list, $attributes);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates the list
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access        private
+ * @param        string
+ * @param        mixed
+ * @param        mixed
+ * @param        intiger
+ * @return        string
+ */
+if ( ! function_exists('_list'))
+{
+        function _list($type = 'ul', $list, $attributes = '', $depth = 0)
+        {
+                // If an array wasn't submitted there's nothing to do...
+                if ( ! is_array($list))
+                {
+                        return $list;
+                }
+
+                // Set the indentation based on the depth
+                $out = str_repeat(&quot; &quot;, $depth);
+
+                // Were any attributes submitted?  If so generate a string
+                if (is_array($attributes))
+                {
+                        $atts = '';
+                        foreach ($attributes as $key =&gt; $val)
+                        {
+                                $atts .= ' ' . $key . '=&quot;' . $val . '&quot;';
+                        }
+                        $attributes = $atts;
+                }
+
+                // Write the opening list tag
+                $out .= &quot;&lt;&quot;.$type.$attributes.&quot;&gt;\n&quot;;
+
+                // Cycle through the list elements.  If an array is
+                // encountered we will recursively call _list()
+
+                static $_last_list_item = '';
+                foreach ($list as $key =&gt; $val)
+                {
+                        $_last_list_item = $key;
+
+                        $out .= str_repeat(&quot; &quot;, $depth + 2);
+                        $out .= &quot;&lt;li&gt;&quot;;
+
+                        if ( ! is_array($val))
+                        {
+                                $out .= $val;
+                        }
+                        else
+                        {
+                                $out .= $_last_list_item.&quot;\n&quot;;
+                                $out .= _list($type, $val, '', $depth + 4);
+                                $out .= str_repeat(&quot; &quot;, $depth + 2);
+                        }
+
+                        $out .= &quot;&lt;/li&gt;\n&quot;;
+                }
+
+                // Set the indentation for the closing tag
+                $out .= str_repeat(&quot; &quot;, $depth);
+
+                // Write the closing list tag
+                $out .= &quot;&lt;/&quot;.$type.&quot;&gt;\n&quot;;
+
+                return $out;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates HTML BR tags based on number supplied
+ *
+ * @access        public
+ * @param        integer
+ * @return        string
+ */
+if ( ! function_exists('br'))
+{
+        function br($num = 1)
+        {
+                return str_repeat(&quot;&lt;br /&gt;&quot;, $num);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Image
+ *
+ * Generates an &lt;img /&gt; element
+ *
+ * @access        public
+ * @param        mixed
+ * @return        string
+ */
+if ( ! function_exists('img'))
+{
+        function img($src = '', $index_page = FALSE)
+        {
+                if ( ! is_array($src) )
+                {
+                        $src = array('src' =&gt; $src);
+                }
+
+                $img = '&lt;img';
+
+                foreach ($src as $k=&gt;$v)
+                {
+
+                        if ($k == 'src' AND strpos($v, '://') === FALSE)
+                        {
+                                $CI =&amp; get_instance();
+
+                                if ($index_page === TRUE)
+                                {
+                                        $img .= ' src=&quot;'.$CI-&gt;config-&gt;site_url($v).'&quot; ';
+                                }
+                                else
+                                {
+                                        $img .= ' src=&quot;'.$CI-&gt;config-&gt;slash_item('base_url').$v.'&quot; ';
+                                }
+                        }
+                        else
+                        {
+                                $img .= &quot; $k=\&quot;$v\&quot; &quot;;
+                        }
+                }
+
+                $img .= '/&gt;';
+
+                return $img;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Doctype
+ *
+ * Generates a page document type declaration
+ *
+ * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame,
+ * html4-strict, html4-trans, and html4-frame.  Values are saved in the
+ * doctypes config file.
+ *
+ * @access        public
+ * @param        string        type        The doctype to be generated
+ * @return        string
+ */
+if ( ! function_exists('doctype'))
+{
+        function doctype($type = 'xhtml1-strict')
+        {
+                global $_doctypes;
+
+                if ( ! is_array($_doctypes))
+                {
+                        if ( ! require_once(APPPATH.'config/doctypes.php'))
+                        {
+                                return FALSE;
+                        }
+                }
+
+                if (isset($_doctypes[$type]))
+                {
+                        return $_doctypes[$type];
+                }
+                else
+                {
+                        return FALSE;
+                }
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Link
+ *
+ * Generates link to a CSS file
+ *
+ * @access        public
+ * @param        mixed        stylesheet hrefs or an array
+ * @param        string        rel
+ * @param        string        type
+ * @param        string        title
+ * @param        string        media
+ * @param        boolean        should index_page be added to the css path
+ * @return        string
+ */
+if ( ! function_exists('link_tag'))
+{
+        function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
+        {
+                $CI =&amp; get_instance();
+
+                $link = '&lt;link ';
+
+                if (is_array($href))
+                {
+                        foreach ($href as $k=&gt;$v)
+                        {
+                                if ($k == 'href' AND strpos($v, '://') === FALSE)
+                                {
+                                        if ($index_page === TRUE)
+                                        {
+                                                $link .= ' href=&quot;'.$CI-&gt;config-&gt;site_url($v).'&quot; ';
+                                        }
+                                        else
+                                        {
+                                                $link .= ' href=&quot;'.$CI-&gt;config-&gt;slash_item('base_url').$v.'&quot; ';
+                                        }
+                                }
+                                else
+                                {
+                                        $link .= &quot;$k=\&quot;$v\&quot; &quot;;
+                                }
+                        }
+
+                        $link .= &quot;/&gt;&quot;;
+                }
+                else
+                {
+                        if ( strpos($href, '://') !== FALSE)
+                        {
+                                $link .= ' href=&quot;'.$href.'&quot; ';
+                        }
+                        elseif ($index_page === TRUE)
+                        {
+                                $link .= ' href=&quot;'.$CI-&gt;config-&gt;site_url($href).'&quot; ';
+                        }
+                        else
+                        {
+                                $link .= ' href=&quot;'.$CI-&gt;config-&gt;slash_item('base_url').$href.'&quot; ';
+                        }
+
+                        $link .= 'rel=&quot;'.$rel.'&quot; type=&quot;'.$type.'&quot; ';
+
+                        if ($media        != '')
+                        {
+                                $link .= 'media=&quot;'.$media.'&quot; ';
+                        }
+
+                        if ($title        != '')
+                        {
+                                $link .= 'title=&quot;'.$title.'&quot; ';
+                        }
+
+                        $link .= '/&gt;';
+                }
+
+
+                return $link;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates meta tags from an array of key/values
+ *
+ * @access        public
+ * @param        array
+ * @return        string
+ */
+if ( ! function_exists('meta'))
+{
+        function meta($name = '', $content = '', $type = 'name', $newline = &quot;\n&quot;)
+        {
+                // Since we allow the data to be passes as a string, a simple array
+                // or a multidimensional one, we need to do a little prepping.
+                if ( ! is_array($name))
+                {
+                        $name = array(array('name' =&gt; $name, 'content' =&gt; $content, 'type' =&gt; $type, 'newline' =&gt; $newline));
+                }
+                else
+                {
+                        // Turn single array into multidimensional
+                        if (isset($name['name']))
+                        {
+                                $name = array($name);
+                        }
+                }
+
+                $str = '';
+                foreach ($name as $meta)
+                {
+                        $type                 = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
+                        $name                 = ( ! isset($meta['name']))         ? ''         : $meta['name'];
+                        $content        = ( ! isset($meta['content']))        ? ''         : $meta['content'];
+                        $newline        = ( ! isset($meta['newline']))        ? &quot;\n&quot;        : $meta['newline'];
+
+                        $str .= '&lt;meta '.$type.'=&quot;'.$name.'&quot; content=&quot;'.$content.'&quot; /&gt;'.$newline;
+                }
+
+                return $str;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates non-breaking space entities based on number supplied
+ *
+ * @access        public
+ * @param        integer
+ * @return        string
+ */
+if ( ! function_exists('nbs'))
+{
+        function nbs($num = 1)
+        {
+                return str_repeat(&quot;&amp;nbsp;&quot;, $num);
+        }
+}
+
+
+/* End of file html_helper.php */
+/* Location: ./system/helpers/html_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersinflector_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/inflector_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/inflector_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/inflector_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,171 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Inflector Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/directory_helper.html
+ */
+
+
+// --------------------------------------------------------------------
+
+/**
+ * Singular
+ *
+ * Takes a plural word and makes it singular
+ *
+ * @access        public
+ * @param        string
+ * @return        str
+ */        
+if ( ! function_exists('singular'))
+{        
+        function singular($str)
+        {
+                $str = strtolower(trim($str));
+                $end = substr($str, -3);
+        
+                if ($end == 'ies')
+                {
+                        $str = substr($str, 0, strlen($str)-3).'y';
+                }
+                elseif ($end == 'ses')
+                {
+                        $str = substr($str, 0, strlen($str)-2);
+                }
+                else
+                {
+                        $end = substr($str, -1);
+                
+                        if ($end == 's')
+                        {
+                                $str = substr($str, 0, strlen($str)-1);
+                        }
+                }
+        
+                return $str;
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Plural
+ *
+ * Takes a singular word and makes it plural
+ *
+ * @access        public
+ * @param        string
+ * @param        bool
+ * @return        str
+ */        
+if ( ! function_exists('plural'))
+{        
+        function plural($str, $force = FALSE)
+        {
+                $str = strtolower(trim($str));
+                $end = substr($str, -1);
+
+                if ($end == 'y')
+                {
+                        // Y preceded by vowel =&gt; regular plural
+                        $vowels = array('a', 'e', 'i', 'o', 'u');
+                        $str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies';
+                }
+                elseif ($end == 's')
+                {
+                        if ($force == TRUE)
+                        {
+                                $str .= 'es';
+                        }
+                }
+                else
+                {
+                        $str .= 's';
+                }
+
+                return $str;
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Camelize
+ *
+ * Takes multiple words separated by spaces or underscores and camelizes them
+ *
+ * @access        public
+ * @param        string
+ * @return        str
+ */        
+if ( ! function_exists('camelize'))
+{        
+        function camelize($str)
+        {                
+                $str = 'x'.strtolower(trim($str));
+                $str = ucwords(preg_replace('/[\s_]+/', ' ', $str));
+                return substr(str_replace(' ', '', $str), 1);
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Underscore
+ *
+ * Takes multiple words separated by spaces and underscores them
+ *
+ * @access        public
+ * @param        string
+ * @return        str
+ */        
+if ( ! function_exists('underscore'))
+{
+        function underscore($str)
+        {
+                return preg_replace('/[\s]+/', '_', strtolower(trim($str)));
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Humanize
+ *
+ * Takes multiple words separated by underscores and changes them to spaces
+ *
+ * @access        public
+ * @param        string
+ * @return        str
+ */        
+if ( ! function_exists('humanize'))
+{        
+        function humanize($str)
+        {
+                return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str))));
+        }
+}
+        
+
+/* End of file inflector_helper.php */
+/* Location: ./system/helpers/inflector_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperslanguage_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/language_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/language_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/language_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+&lt;?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Language Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/language_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Lang
+ *
+ * Fetches a language variable and optionally outputs a form label
+ *
+ * @access        public
+ * @param        string        the language line
+ * @param        string        the id of the form element
+ * @return        string
+ */        
+if ( ! function_exists('lang'))
+{
+        function lang($line, $id = '')
+        {
+                $CI =&amp; get_instance();
+                $line = $CI-&gt;lang-&gt;line($line);
+
+                if ($id != '')
+                {
+                        $line = '&lt;label for=&quot;'.$id.'&quot;&gt;'.$line.&quot;&lt;/label&gt;&quot;;
+                }
+
+                return $line;
+        }
+}
+
+// ------------------------------------------------------------------------
+/* End of file language_helper.php */
+/* Location: ./system/helpers/language_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersnumber_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/number_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/number_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/number_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+&lt;?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Number Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/number_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Formats a numbers as bytes, based on size, and adds the appropriate suffix
+ *
+ * @access        public
+ * @param        mixed        // will be cast as int
+ * @return        string
+ */
+if ( ! function_exists('byte_format'))
+{
+        function byte_format($num)
+        {
+                $CI =&amp; get_instance();
+                $CI-&gt;lang-&gt;load('number');
+        
+                if ($num &gt;= 1000000000000) 
+                {
+                        $num = round($num / 1099511627776, 1);
+                        $unit = $CI-&gt;lang-&gt;line('terabyte_abbr');
+                }
+                elseif ($num &gt;= 1000000000) 
+                {
+                        $num = round($num / 1073741824, 1);
+                        $unit = $CI-&gt;lang-&gt;line('gigabyte_abbr');
+                }
+                elseif ($num &gt;= 1000000) 
+                {
+                        $num = round($num / 1048576, 1);
+                        $unit = $CI-&gt;lang-&gt;line('megabyte_abbr');
+                }
+                elseif ($num &gt;= 1000) 
+                {
+                        $num = round($num / 1024, 1);
+                        $unit = $CI-&gt;lang-&gt;line('kilobyte_abbr');
+                }
+                else
+                {
+                        $unit = $CI-&gt;lang-&gt;line('bytes');
+                        return number_format($num).' '.$unit;
+                }
+
+                return number_format($num, 1).' '.$unit;
+        }        
+}
+
+/* End of file number_helper.php */
+/* Location: ./system/helpers/number_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperspath_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/path_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/path_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/path_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Path Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/xml_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Realpath
+ *
+ * @access        public
+ * @param        string
+ * @param        bool        checks to see if the path exists
+ * @return        string
+ */        
+if ( ! function_exists('set_realpath'))
+{
+        function set_realpath($path, $check_existance = FALSE)
+        {
+                // Security check to make sure the path is NOT a URL.  No remote file inclusion!
+                if (preg_match(&quot;#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i&quot;, $path))
+                {
+                        show_error('The path you submitted must be a local server path, not a URL');
+                }
+        
+                // Resolve the path
+                if (function_exists('realpath') AND @realpath($path) !== FALSE)
+                {
+                        $path = realpath($path).'/';
+                }
+        
+                // Add a trailing slash
+                $path = preg_replace(&quot;#([^/])/*$#&quot;, &quot;\\1/&quot;, $path);
+        
+                // Make sure the path exists
+                if ($check_existance == TRUE)
+                {
+                        if ( ! is_dir($path))
+                        {
+                                show_error('Not a valid path: '.$path);
+                        }
+                }
+        
+                return $path;
+        }
+}
+
+
+/* End of file path_helper.php */
+/* Location: ./system/helpers/path_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperssecurity_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/security_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/security_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/security_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,126 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Security Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/security_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * XSS Filtering
+ *
+ * @access        public
+ * @param        string
+ * @param        bool        whether or not the content is an image file
+ * @return        string
+ */        
+if ( ! function_exists('xss_clean'))
+{
+        function xss_clean($str, $is_image = FALSE)
+        {
+                $CI =&amp; get_instance();
+                return $CI-&gt;input-&gt;xss_clean($str, $is_image);
+        }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Hash encode a string
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('dohash'))
+{        
+        function dohash($str, $type = 'sha1')
+        {
+                if ($type == 'sha1')
+                {
+                        if ( ! function_exists('sha1'))
+                        {
+                                if ( ! function_exists('mhash'))
+                                {        
+                                        require_once(BASEPATH.'libraries/Sha1'.EXT);
+                                        $SH = new CI_SHA;
+                                        return $SH-&gt;generate($str);
+                                }
+                                else
+                                {
+                                        return bin2hex(mhash(MHASH_SHA1, $str));
+                                }
+                        }
+                        else
+                        {
+                                return sha1($str);
+                        }        
+                }
+                else
+                {
+                        return md5($str);
+                }
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Strip Image Tags
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('strip_image_tags'))
+{
+        function strip_image_tags($str)
+        {
+                $str = preg_replace(&quot;#&lt;img\s+.*?src\s*=\s*[\&quot;'](.+?)[\&quot;'].*?\&gt;#&quot;, &quot;\\1&quot;, $str);
+                $str = preg_replace(&quot;#&lt;img\s+.*?src\s*=\s*(.+?).*?\&gt;#&quot;, &quot;\\1&quot;, $str);
+                        
+                return $str;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Convert PHP tags to entities
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('encode_php_tags'))
+{
+        function encode_php_tags($str)
+        {
+                return str_replace(array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'),  array('&amp;lt;?php', '&amp;lt;?PHP', '&amp;lt;?', '?&amp;gt;'), $str);
+        }
+}
+
+
+/* End of file security_helper.php */
+/* Location: ./system/helpers/security_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperssmiley_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/smiley_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/smiley_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/smiley_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,175 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Smiley Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/smiley_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * JS Insert Smiley
+ *
+ * Generates the javascrip function needed to insert smileys into a form field
+ *
+ * @access        public
+ * @param        string        form name
+ * @param        string        field name
+ * @return        string
+ */
+if ( ! function_exists('js_insert_smiley'))
+{
+        function js_insert_smiley($form_name = '', $form_field = '')
+        {
+                return &lt;&lt;&lt;EOF
+&lt;script type=&quot;text/javascript&quot;&gt;
+        function insert_smiley(smiley)
+        {
+                document.{$form_name}.{$form_field}.value += &quot; &quot; + smiley;
+        }
+&lt;/script&gt;
+EOF;
+        }
+}
+// ------------------------------------------------------------------------
+
+/**
+ * Get Clickable Smileys
+ *
+ * Returns an array of image tag links that can be clicked to be inserted 
+ * into a form field.  
+ *
+ * @access        public
+ * @param        string        the URL to the folder containing the smiley images
+ * @return        array
+ */
+if ( ! function_exists('get_clickable_smileys'))
+{
+        function get_clickable_smileys($image_url = '', $smileys = NULL)
+        {
+                if ( ! is_array($smileys))
+                {
+                        if (FALSE === ($smileys = _get_smiley_array()))
+                        {
+                                return $smileys;
+                        }
+                }
+
+                // Add a trailing slash to the file path if needed
+                $image_url = preg_replace(&quot;/(.+?)\/*$/&quot;, &quot;\\1/&quot;,  $image_url);
+
+                $used = array();
+                foreach ($smileys as $key =&gt; $val)
+                {
+                        // Keep duplicates from being used, which can happen if the
+                        // mapping array contains multiple identical replacements.  For example:
+                        // :-) and :) might be replaced with the same image so both smileys
+                        // will be in the array.
+                        if (isset($used[$smileys[$key][0]]))
+                        {
+                                continue;
+                        }
+
+                        $link[] = &quot;&lt;a href=\&quot;javascript:void(0);\&quot; onClick=\&quot;insert_smiley('&quot;.$key.&quot;')\&quot;&gt;&lt;img src=\&quot;&quot;.$image_url.$smileys[$key][0].&quot;\&quot; width=\&quot;&quot;.$smileys[$key][1].&quot;\&quot; height=\&quot;&quot;.$smileys[$key][2].&quot;\&quot; alt=\&quot;&quot;.$smileys[$key][3].&quot;\&quot; style=\&quot;border:0;\&quot; /&gt;&lt;/a&gt;&quot;;
+
+                        $used[$smileys[$key][0]] = TRUE;
+                }
+
+                return $link;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Parse Smileys
+ *
+ * Takes a string as input and swaps any contained smileys for the actual image
+ *
+ * @access        public
+ * @param        string        the text to be parsed
+ * @param        string        the URL to the folder containing the smiley images
+ * @return        string
+ */
+if ( ! function_exists('parse_smileys'))
+{
+        function parse_smileys($str = '', $image_url = '', $smileys = NULL)
+        {
+                if ($image_url == '')
+                {
+                        return $str;
+                }
+
+                if ( ! is_array($smileys))
+                {
+                        if (FALSE === ($smileys = _get_smiley_array()))
+                        {
+                                return $str;
+                        }
+                }
+
+                // Add a trailing slash to the file path if needed
+                $image_url = preg_replace(&quot;/(.+?)\/*$/&quot;, &quot;\\1/&quot;,  $image_url);
+
+                foreach ($smileys as $key =&gt; $val)
+                {
+                        $str = str_replace($key, &quot;&lt;img src=\&quot;&quot;.$image_url.$smileys[$key][0].&quot;\&quot; width=\&quot;&quot;.$smileys[$key][1].&quot;\&quot; height=\&quot;&quot;.$smileys[$key][2].&quot;\&quot; alt=\&quot;&quot;.$smileys[$key][3].&quot;\&quot; style=\&quot;border:0;\&quot; /&gt;&quot;, $str);
+                }
+
+                return $str;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Get Smiley Array
+ *
+ * Fetches the config/smiley.php file
+ *
+ * @access        private
+ * @return        mixed
+ */
+if ( ! function_exists('_get_smiley_array'))
+{
+        function _get_smiley_array()
+        {
+                if ( ! file_exists(APPPATH.'config/smileys'.EXT))
+                {
+                        return FALSE;
+                }
+
+                include(APPPATH.'config/smileys'.EXT);
+
+                if ( ! isset($smileys) OR ! is_array($smileys))
+                {
+                        return FALSE;
+                }
+
+                return $smileys;
+        }
+}
+
+
+/* End of file smiley_helper.php */
+/* Location: ./system/helpers/smiley_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersstring_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/string_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/string_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/string_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,273 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter String Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/string_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Trim Slashes
+ *
+ * Removes any leading/traling slashes from a string:
+ *
+ * /this/that/theother/
+ *
+ * becomes:
+ *
+ * this/that/theother
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('trim_slashes'))
+{
+        function trim_slashes($str)
+        {
+                return trim($str, '/');
+        } 
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Strip Slashes
+ *
+ * Removes slashes contained in a string or in an array
+ *
+ * @access        public
+ * @param        mixed        string or array
+ * @return        mixed        string or array
+ */        
+if ( ! function_exists('strip_slashes'))
+{
+        function strip_slashes($str)
+        {
+                if (is_array($str))
+                {        
+                        foreach ($str as $key =&gt; $val)
+                        {
+                                $str[$key] = strip_slashes($val);
+                        }
+                }
+                else
+                {
+                        $str = stripslashes($str);
+                }
+        
+                return $str;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Strip Quotes
+ *
+ * Removes single and double quotes from a string
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('strip_quotes'))
+{
+        function strip_quotes($str)
+        {
+                return str_replace(array('&quot;', &quot;'&quot;), '', $str);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Quotes to Entities
+ *
+ * Converts single and double quotes to entities
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('quotes_to_entities'))
+{
+        function quotes_to_entities($str)
+        {        
+                return str_replace(array(&quot;\'&quot;,&quot;\&quot;&quot;,&quot;'&quot;,'&quot;'), array(&quot;&amp;#39;&quot;,&quot;&amp;quot;&quot;,&quot;&amp;#39;&quot;,&quot;&amp;quot;&quot;), $str);
+        }
+}
+
+// ------------------------------------------------------------------------
+/**
+ * Reduce Double Slashes
+ *
+ * Converts double slashes in a string to a single slash,
+ * except those found in http://
+ *
+ * http://www.some-site.com//index.php
+ *
+ * becomes:
+ *
+ * http://www.some-site.com/index.php
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('reduce_double_slashes'))
+{
+        function reduce_double_slashes($str)
+        {
+                return preg_replace(&quot;#([^:])//+#&quot;, &quot;\\1/&quot;, $str);
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Reduce Multiples
+ *
+ * Reduces multiple instances of a particular character.  Example:
+ *
+ * Fred, Bill,, Joe, Jimmy
+ *
+ * becomes:
+ *
+ * Fred, Bill, Joe, Jimmy
+ *
+ * @access        public
+ * @param        string
+ * @param        string        the character you wish to reduce
+ * @param        bool        TRUE/FALSE - whether to trim the character from the beginning/end
+ * @return        string
+ */        
+if ( ! function_exists('reduce_multiples'))
+{
+        function reduce_multiples($str, $character = ',', $trim = FALSE)
+        {
+                $str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
+
+                if ($trim === TRUE)
+                {
+                        $str = trim($str, $character);
+                }
+
+                return $str;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Create a Random String
+ *
+ * Useful for generating passwords or hashes.
+ *
+ * @access        public
+ * @param        string         type of random string.  Options: alunum, numeric, nozero, unique
+ * @param        integer        number of characters
+ * @return        string
+ */
+if ( ! function_exists('random_string'))
+{        
+        function random_string($type = 'alnum', $len = 8)
+        {                                        
+                switch($type)
+                {
+                        case 'alnum'        :
+                        case 'numeric'        :
+                        case 'nozero'        :
+                
+                                        switch ($type)
+                                        {
+                                                case 'alnum'        :        $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+                                                        break;
+                                                case 'numeric'        :        $pool = '0123456789';
+                                                        break;
+                                                case 'nozero'        :        $pool = '123456789';
+                                                        break;
+                                        }
+
+                                        $str = '';
+                                        for ($i=0; $i &lt; $len; $i++)
+                                        {
+                                                $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
+                                        }
+                                        return $str;
+                          break;
+                        case 'unique' : return md5(uniqid(mt_rand()));
+                          break;
+                }
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Alternator
+ *
+ * Allows strings to be alternated.  See docs...
+ *
+ * @access        public
+ * @param        string (as many parameters as needed)
+ * @return        string
+ */        
+if ( ! function_exists('alternator'))
+{
+        function alternator()
+        {
+                static $i;        
+
+                if (func_num_args() == 0)
+                {
+                        $i = 0;
+                        return '';
+                }
+                $args = func_get_args();
+                return $args[($i++ % count($args))];
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Repeater function
+ *
+ * @access        public
+ * @param        string
+ * @param        integer        number of repeats
+ * @return        string
+ */        
+if ( ! function_exists('repeater'))
+{
+        function repeater($data, $num = 1)
+        {
+                return (($num &gt; 0) ? str_repeat($data, $num) : '');
+        } 
+}
+
+
+/* End of file string_helper.php */
+/* Location: ./system/helpers/string_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperstext_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/text_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/text_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/text_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,462 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Text Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/text_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Word Limiter
+ *
+ * Limits a string to X number of words.
+ *
+ * @access        public
+ * @param        string
+ * @param        integer
+ * @param        string        the end character. Usually an ellipsis
+ * @return        string
+ */        
+if ( ! function_exists('word_limiter'))
+{
+        function word_limiter($str, $limit = 100, $end_char = '&amp;#8230;')
+        {
+                if (trim($str) == '')
+                {
+                        return $str;
+                }
+        
+                preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
+                        
+                if (strlen($str) == strlen($matches[0]))
+                {
+                        $end_char = '';
+                }
+                
+                return rtrim($matches[0]).$end_char;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Character Limiter
+ *
+ * Limits the string based on the character count.  Preserves complete words
+ * so the character count may not be exactly as specified.
+ *
+ * @access        public
+ * @param        string
+ * @param        integer
+ * @param        string        the end character. Usually an ellipsis
+ * @return        string
+ */        
+if ( ! function_exists('character_limiter'))
+{
+        function character_limiter($str, $n = 500, $end_char = '&amp;#8230;')
+        {
+                if (strlen($str) &lt; $n)
+                {
+                        return $str;
+                }
+                
+                $str = preg_replace(&quot;/\s+/&quot;, ' ', str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;, &quot;\n&quot;), ' ', $str));
+
+                if (strlen($str) &lt;= $n)
+                {
+                        return $str;
+                }
+
+                $out = &quot;&quot;;
+                foreach (explode(' ', trim($str)) as $val)
+                {
+                        $out .= $val.' ';
+                        
+                        if (strlen($out) &gt;= $n)
+                        {
+                                $out = trim($out);
+                                return (strlen($out) == strlen($str)) ? $out : $out.$end_char;
+                        }                
+                }
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * High ASCII to Entities
+ *
+ * Converts High ascii text and MS Word special characters to character entities
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('ascii_to_entities'))
+{
+        function ascii_to_entities($str)
+        {
+           $count        = 1;
+           $out        = '';
+           $temp        = array();
+        
+           for ($i = 0, $s = strlen($str); $i &lt; $s; $i++)
+           {
+                   $ordinal = ord($str[$i]);
+        
+                   if ($ordinal &lt; 128)
+                   {
+                                /*
+                                        If the $temp array has a value but we have moved on, then it seems only
+                                        fair that we output that entity and restart $temp before continuing. -Paul
+                                */
+                                if (count($temp) == 1)
+                                {
+                                        $out  .= '&amp;#'.array_shift($temp).';';
+                                        $count = 1;
+                                }
+
+                                $out .= $str[$i];
+                   }
+                   else
+                   {
+                           if (count($temp) == 0)
+                           {
+                                   $count = ($ordinal &lt; 224) ? 2 : 3;
+                           }
+                
+                           $temp[] = $ordinal;
+                
+                           if (count($temp) == $count)
+                           {
+                                   $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
+
+                                   $out .= '&amp;#'.$number.';';
+                                   $count = 1;
+                                   $temp = array();
+                           }
+                   }
+           }
+
+           return $out;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Entities to ASCII
+ *
+ * Converts character entities back to ASCII
+ *
+ * @access        public
+ * @param        string
+ * @param        bool
+ * @return        string
+ */        
+if ( ! function_exists('entities_to_ascii'))
+{
+        function entities_to_ascii($str, $all = TRUE)
+        {
+           if (preg_match_all('/\&amp;#(\d+)\;/', $str, $matches))
+           {
+                   for ($i = 0, $s = count($matches['0']); $i &lt; $s; $i++)
+                   {                                
+                           $digits = $matches['1'][$i];
+
+                           $out = '';
+
+                           if ($digits &lt; 128)
+                           {
+                                   $out .= chr($digits);
+                
+                           }
+                           elseif ($digits &lt; 2048)
+                           {
+                                   $out .= chr(192 + (($digits - ($digits % 64)) / 64));
+                                   $out .= chr(128 + ($digits % 64));
+                           }
+                           else
+                           {
+                                   $out .= chr(224 + (($digits - ($digits % 4096)) / 4096));
+                                   $out .= chr(128 + ((($digits % 4096) - ($digits % 64)) / 64));
+                                   $out .= chr(128 + ($digits % 64));
+                           }
+
+                           $str = str_replace($matches['0'][$i], $out, $str);                                
+                   }
+           }
+
+           if ($all)
+           {
+                   $str = str_replace(array(&quot;&amp;amp;&quot;, &quot;&amp;lt;&quot;, &quot;&amp;gt;&quot;, &quot;&amp;quot;&quot;, &quot;&amp;apos;&quot;, &quot;&amp;#45;&quot;),
+                                                          array(&quot;&amp;&quot;,&quot;&lt;&quot;,&quot;&gt;&quot;,&quot;\&quot;&quot;, &quot;'&quot;, &quot;-&quot;),
+                                                          $str);
+           }
+
+           return $str;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Word Censoring Function
+ *
+ * Supply a string and an array of disallowed words and any
+ * matched words will be converted to #### or to the replacement
+ * word you've submitted.
+ *
+ * @access        public
+ * @param        string        the text string
+ * @param        string        the array of censoered words
+ * @param        string        the optional replacement value
+ * @return        string
+ */        
+if ( ! function_exists('word_censor'))
+{
+        function word_censor($str, $censored, $replacement = '')
+        {
+                if ( ! is_array($censored))
+                {
+                        return $str;
+                }
+        
+        $str = ' '.$str.' ';
+
+                // \w, \b and a few others do not match on a unicode character
+                // set for performance reasons. As a result words like Ã¼ber
+                // will not match on a word boundary. Instead, we'll assume that
+                // a bad word will be bookended by any of these characters.
+                $delim = '[-_\'\&quot;`(){}&lt;&gt;\[\]|!?@#%&amp;,.:;^~*+=\/ 0-9\n\r\t]';
+
+                foreach ($censored as $badword)
+                {
+                        if ($replacement != '')
+                        {
+                                $str = preg_replace(&quot;/({$delim})(&quot;.str_replace('\*', '\w*?', preg_quote($badword, '/')).&quot;)({$delim})/i&quot;, &quot;\\1{$replacement}\\3&quot;, $str);
+                        }
+                        else
+                        {
+                                $str = preg_replace(&quot;/({$delim})(&quot;.str_replace('\*', '\w*?', preg_quote($badword, '/')).&quot;)({$delim})/ie&quot;, &quot;'\\1'.str_repeat('#', strlen('\\2')).'\\3'&quot;, $str);
+                        }
+                }
+
+        return trim($str);
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Code Highlighter
+ *
+ * Colorizes code strings
+ *
+ * @access        public
+ * @param        string        the text string
+ * @return        string
+ */        
+if ( ! function_exists('highlight_code'))
+{
+        function highlight_code($str)
+        {                
+                // The highlight string function encodes and highlights
+                // brackets so we need them to start raw
+                $str = str_replace(array('&amp;lt;', '&amp;gt;'), array('&lt;', '&gt;'), $str);
+        
+                // Replace any existing PHP tags to temporary markers so they don't accidentally
+                // break the string out of PHP, and thus, thwart the highlighting.
+        
+                $str = str_replace(array('&lt;?', '?&gt;', '&lt;%', '%&gt;', '\\', '&lt;/script&gt;'), 
+                                                        array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), $str);
+
+                // The highlight_string function requires that the text be surrounded
+                // by PHP tags, which we will remove later
+                $str = '&lt;?php '.$str.' ?&gt;'; // &lt;?
+
+                // All the magic happens here, baby!        
+                $str = highlight_string($str, TRUE);
+
+                // Prior to PHP 5, the highligh function used icky &lt;font&gt; tags
+                // so we'll replace them with &lt;span&gt; tags.
+
+                if (abs(PHP_VERSION) &lt; 5)
+                {
+                        $str = str_replace(array('&lt;font ', '&lt;/font&gt;'), array('&lt;span ', '&lt;/span&gt;'), $str);
+                        $str = preg_replace('#color=&quot;(.*?)&quot;#', 'style=&quot;color: \\1&quot;', $str);
+                }
+                
+                // Remove our artificially added PHP, and the syntax highlighting that came with it
+                $str = preg_replace('/&lt;span style=&quot;color: #([A-Z0-9]+)&quot;&gt;&amp;lt;\?php(&amp;nbsp;| )/i', '&lt;span style=&quot;color: #$1&quot;&gt;', $str);
+                $str = preg_replace('/(&lt;span style=&quot;color: #[A-Z0-9]+&quot;&gt;.*?)\?&amp;gt;&lt;\/span&gt;\n&lt;\/span&gt;\n&lt;\/code&gt;/is', &quot;$1&lt;/span&gt;\n&lt;/span&gt;\n&lt;/code&gt;&quot;, $str);
+                $str = preg_replace('/&lt;span style=&quot;color: #[A-Z0-9]+&quot;\&gt;&lt;\/span&gt;/i', '', $str);
+                        
+                // Replace our markers back to PHP tags.
+                $str = str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'),
+                                                        array('&amp;lt;?', '?&amp;gt;', '&amp;lt;%', '%&amp;gt;', '\\', '&amp;lt;/script&amp;gt;'), $str);
+                                                                                
+                return $str;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Phrase Highlighter
+ *
+ * Highlights a phrase within a text string
+ *
+ * @access        public
+ * @param        string        the text string
+ * @param        string        the phrase you'd like to highlight
+ * @param        string        the openging tag to precede the phrase with
+ * @param        string        the closing tag to end the phrase with
+ * @return        string
+ */        
+if ( ! function_exists('highlight_phrase'))
+{
+        function highlight_phrase($str, $phrase, $tag_open = '&lt;strong&gt;', $tag_close = '&lt;/strong&gt;')
+        {
+                if ($str == '')
+                {
+                        return '';
+                }
+        
+                if ($phrase != '')
+                {
+                        return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open.&quot;\\1&quot;.$tag_close, $str);
+                }
+
+                return $str;
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Word Wrap
+ *
+ * Wraps text at the specified character.  Maintains the integrity of words.
+ * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor
+ * will URLs.
+ *
+ * @access        public
+ * @param        string        the text string
+ * @param        integer        the number of characters to wrap at
+ * @return        string
+ */        
+if ( ! function_exists('word_wrap'))
+{
+        function word_wrap($str, $charlim = '76')
+        {
+                // Se the character limit
+                if ( ! is_numeric($charlim))
+                        $charlim = 76;
+        
+                // Reduce multiple spaces
+                $str = preg_replace(&quot;| +|&quot;, &quot; &quot;, $str);
+        
+                // Standardize newlines
+                if (strpos($str, &quot;\r&quot;) !== FALSE)
+                {
+                        $str = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;), &quot;\n&quot;, $str);                        
+                }
+        
+                // If the current word is surrounded by {unwrap} tags we'll 
+                // strip the entire chunk and replace it with a marker.
+                $unwrap = array();
+                if (preg_match_all(&quot;|(\{unwrap\}.+?\{/unwrap\})|s&quot;, $str, $matches))
+                {
+                        for ($i = 0; $i &lt; count($matches['0']); $i++)
+                        {
+                                $unwrap[] = $matches['1'][$i];                                
+                                $str = str_replace($matches['1'][$i], &quot;{{unwrapped&quot;.$i.&quot;}}&quot;, $str);
+                        }
+                }
+        
+                // Use PHP's native function to do the initial wordwrap.  
+                // We set the cut flag to FALSE so that any individual words that are 
+                // too long get left alone.  In the next step we'll deal with them.
+                $str = wordwrap($str, $charlim, &quot;\n&quot;, FALSE);
+        
+                // Split the string into individual lines of text and cycle through them
+                $output = &quot;&quot;;
+                foreach (explode(&quot;\n&quot;, $str) as $line) 
+                {
+                        // Is the line within the allowed character count?
+                        // If so we'll join it to the output and continue
+                        if (strlen($line) &lt;= $charlim)
+                        {
+                                $output .= $line.&quot;\n&quot;;                        
+                                continue;
+                        }
+                        
+                        $temp = '';
+                        while((strlen($line)) &gt; $charlim) 
+                        {
+                                // If the over-length word is a URL we won't wrap it
+                                if (preg_match(&quot;!\[url.+\]|://|wwww.!&quot;, $line))
+                                {
+                                        break;
+                                }
+
+                                // Trim the word down
+                                $temp .= substr($line, 0, $charlim-1);
+                                $line = substr($line, $charlim-1);
+                        }
+                
+                        // If $temp contains data it means we had to split up an over-length 
+                        // word into smaller chunks so we'll add it back to our current line
+                        if ($temp != '')
+                        {
+                                $output .= $temp . &quot;\n&quot; . $line; 
+                        }
+                        else
+                        {
+                                $output .= $line;
+                        }
+
+                        $output .= &quot;\n&quot;;
+                }
+
+                // Put our markers back
+                if (count($unwrap) &gt; 0)
+                {        
+                        foreach ($unwrap as $key =&gt; $val)
+                        {
+                                $output = str_replace(&quot;{{unwrapped&quot;.$key.&quot;}}&quot;, $val, $output);
+                        }
+                }
+
+                // Remove the unwrap tags
+                $output = str_replace(array('{unwrap}', '{/unwrap}'), '', $output);
+
+                return $output;        
+        }
+}
+
+
+/* End of file text_helper.php */
+/* Location: ./system/helpers/text_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelperstypography_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/typography_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/typography_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/typography_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Typography Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/typography_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Convert newlines to HTML line breaks except within PRE tags
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('nl2br_except_pre'))
+{
+        function nl2br_except_pre($str)
+        {
+                $CI =&amp; get_instance();
+        
+                $CI-&gt;load-&gt;library('typography');
+                
+                return $CI-&gt;typography-&gt;nl2br_except_pre($str);
+        }
+}
+        
+// ------------------------------------------------------------------------
+
+/**
+ * Auto Typography Wrapper Function
+ *
+ *
+ * @access        public
+ * @param        string
+ * @param        bool        whether to reduce multiple instances of double newlines to two
+ * @return        string
+ */
+if ( ! function_exists('auto_typography'))
+{
+        function auto_typography($str, $reduce_linebreaks = FALSE)
+        {
+                $CI =&amp; get_instance();        
+                $CI-&gt;load-&gt;library('typography');
+                return $CI-&gt;typography-&gt;auto_typography($str, $reduce_linebreaks);
+        }
+}
+
+/* End of file typography_helper.php */
+/* Location: ./system/helpers/typography_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersurl_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/url_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/url_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/url_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,593 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter URL Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/url_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Site URL
+ *
+ * Create a local URL based on your basepath. Segments can be passed via the
+ * first parameter either as a string or an array.
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */
+if ( ! function_exists('site_url'))
+{
+        function site_url($uri = '')
+        {
+                $CI =&amp; get_instance();
+                return $CI-&gt;config-&gt;site_url($uri);
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Base URL
+ *
+ * Returns the &quot;base_url&quot; item from your config file
+ *
+ * @access        public
+ * @return        string
+ */
+if ( ! function_exists('base_url'))
+{
+        function base_url()
+        {
+                $CI =&amp; get_instance();
+                return $CI-&gt;config-&gt;slash_item('base_url');
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Current URL
+ *
+ * Returns the full URL (including segments) of the page where this 
+ * function is placed
+ *
+ * @access        public
+ * @return        string
+ */
+if ( ! function_exists('current_url'))
+{
+        function current_url()
+        {
+                $CI =&amp; get_instance();
+                return $CI-&gt;config-&gt;site_url($CI-&gt;uri-&gt;uri_string());
+        }
+}
+
+// ------------------------------------------------------------------------
+/**
+ * URL String
+ *
+ * Returns the URI segments.
+ *
+ * @access        public
+ * @return        string
+ */
+if ( ! function_exists('uri_string'))
+{
+        function uri_string()
+        {
+                $CI =&amp; get_instance();
+                return $CI-&gt;uri-&gt;uri_string();
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Index page
+ *
+ * Returns the &quot;index_page&quot; from your config file
+ *
+ * @access        public
+ * @return        string
+ */
+if ( ! function_exists('index_page'))
+{
+        function index_page()
+        {
+                $CI =&amp; get_instance();
+                return $CI-&gt;config-&gt;item('index_page');
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Anchor Link
+ *
+ * Creates an anchor based on the local URL.
+ *
+ * @access        public
+ * @param        string        the URL
+ * @param        string        the link title
+ * @param        mixed        any attributes
+ * @return        string
+ */
+if ( ! function_exists('anchor'))
+{
+        function anchor($uri = '', $title = '', $attributes = '')
+        {
+                $title = (string) $title;
+
+                if ( ! is_array($uri))
+                {
+                        $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
+                }
+                else
+                {
+                        $site_url = site_url($uri);
+                }
+
+                if ($title == '')
+                {
+                        $title = $site_url;
+                }
+
+                if ($attributes != '')
+                {
+                        $attributes = _parse_attributes($attributes);
+                }
+
+                return '&lt;a href=&quot;'.$site_url.'&quot;'.$attributes.'&gt;'.$title.'&lt;/a&gt;';
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Anchor Link - Pop-up version
+ *
+ * Creates an anchor based on the local URL. The link
+ * opens a new window based on the attributes specified.
+ *
+ * @access        public
+ * @param        string        the URL
+ * @param        string        the link title
+ * @param        mixed        any attributes
+ * @return        string
+ */
+if ( ! function_exists('anchor_popup'))
+{
+        function anchor_popup($uri = '', $title = '', $attributes = FALSE)
+        {
+                $title = (string) $title;
+
+                $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
+
+                if ($title == '')
+                {
+                        $title = $site_url;
+                }
+
+                if ($attributes === FALSE)
+                {
+                        return &quot;&lt;a href='javascript:void(0);' onclick=\&quot;window.open('&quot;.$site_url.&quot;', '_blank');\&quot;&gt;&quot;.$title.&quot;&lt;/a&gt;&quot;;
+                }
+
+                if ( ! is_array($attributes))
+                {
+                        $attributes = array();
+                }
+
+                foreach (array('width' =&gt; '800', 'height' =&gt; '600', 'scrollbars' =&gt; 'yes', 'status' =&gt; 'yes', 'resizable' =&gt; 'yes', 'screenx' =&gt; '0', 'screeny' =&gt; '0', ) as $key =&gt; $val)
+                {
+                        $atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key];
+                        unset($attributes[$key]);
+                }
+
+                if ($attributes != '')
+                {
+                        $attributes = _parse_attributes($attributes);
+                }
+
+                return &quot;&lt;a href='javascript:void(0);' onclick=\&quot;window.open('&quot;.$site_url.&quot;', '_blank', '&quot;._parse_attributes($atts, TRUE).&quot;');\&quot;$attributes&gt;&quot;.$title.&quot;&lt;/a&gt;&quot;;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Mailto Link
+ *
+ * @access        public
+ * @param        string        the email address
+ * @param        string        the link title
+ * @param        mixed         any attributes
+ * @return        string
+ */
+if ( ! function_exists('mailto'))
+{
+        function mailto($email, $title = '', $attributes = '')
+        {
+                $title = (string) $title;
+
+                if ($title == &quot;&quot;)
+                {
+                        $title = $email;
+                }
+
+                $attributes = _parse_attributes($attributes);
+
+                return '&lt;a href=&quot;mailto:'.$email.'&quot;'.$attributes.'&gt;'.$title.'&lt;/a&gt;';
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Encoded Mailto Link
+ *
+ * Create a spam-protected mailto link written in Javascript
+ *
+ * @access        public
+ * @param        string        the email address
+ * @param        string        the link title
+ * @param        mixed         any attributes
+ * @return        string
+ */
+if ( ! function_exists('safe_mailto'))
+{
+        function safe_mailto($email, $title = '', $attributes = '')
+        {
+                $title = (string) $title;
+
+                if ($title == &quot;&quot;)
+                {
+                        $title = $email;
+                }
+
+                for ($i = 0; $i &lt; 16; $i++)
+                {
+                        $x[] = substr('&lt;a href=&quot;mailto:', $i, 1);
+                }
+
+                for ($i = 0; $i &lt; strlen($email); $i++)
+                {
+                        $x[] = &quot;|&quot;.ord(substr($email, $i, 1));
+                }
+
+                $x[] = '&quot;';
+
+                if ($attributes != '')
+                {
+                        if (is_array($attributes))
+                        {
+                                foreach ($attributes as $key =&gt; $val)
+                                {
+                                        $x[] =  ' '.$key.'=&quot;';
+                                        for ($i = 0; $i &lt; strlen($val); $i++)
+                                        {
+                                                $x[] = &quot;|&quot;.ord(substr($val, $i, 1));
+                                        }
+                                        $x[] = '&quot;';
+                                }
+                        }
+                        else
+                        {
+                                for ($i = 0; $i &lt; strlen($attributes); $i++)
+                                {
+                                        $x[] = substr($attributes, $i, 1);
+                                }
+                        }
+                }
+
+                $x[] = '&gt;';
+
+                $temp = array();
+                for ($i = 0; $i &lt; strlen($title); $i++)
+                {
+                        $ordinal = ord($title[$i]);
+
+                        if ($ordinal &lt; 128)
+                        {
+                                $x[] = &quot;|&quot;.$ordinal;
+                        }
+                        else
+                        {
+                                if (count($temp) == 0)
+                                {
+                                        $count = ($ordinal &lt; 224) ? 2 : 3;
+                                }
+        
+                                $temp[] = $ordinal;
+                                if (count($temp) == $count)
+                                {
+                                        $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
+                                        $x[] = &quot;|&quot;.$number;
+                                        $count = 1;
+                                        $temp = array();
+                                }
+                        }
+                }
+
+                $x[] = '&lt;'; $x[] = '/'; $x[] = 'a'; $x[] = '&gt;';
+
+                $x = array_reverse($x);
+                ob_start();
+
+        ?&gt;&lt;script type=&quot;text/javascript&quot;&gt;
+        //&lt;![CDATA[
+        var l=new Array();
+        &lt;?php
+        $i = 0;
+        foreach ($x as $val){ ?&gt;l[&lt;?php echo $i++; ?&gt;]='&lt;?php echo $val; ?&gt;';&lt;?php } ?&gt;
+
+        for (var i = l.length-1; i &gt;= 0; i=i-1){
+        if (l[i].substring(0, 1) == '|') document.write(&quot;&amp;#&quot;+unescape(l[i].substring(1))+&quot;;&quot;);
+        else document.write(unescape(l[i]));}
+        //]]&gt;
+        &lt;/script&gt;&lt;?php
+
+                $buffer = ob_get_contents();
+                ob_end_clean();
+                return $buffer;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Auto-linker
+ *
+ * Automatically links URL and Email addresses.
+ * Note: There's a bit of extra code here to deal with
+ * URLs or emails that end in a period.  We'll strip these
+ * off and add them after the link.
+ *
+ * @access        public
+ * @param        string        the string
+ * @param        string        the type: email, url, or both
+ * @param        bool         whether to create pop-up links
+ * @return        string
+ */
+if ( ! function_exists('auto_link'))
+{
+        function auto_link($str, $type = 'both', $popup = FALSE)
+        {
+                if ($type != 'email')
+                {
+                        if (preg_match_all(&quot;#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\&lt;]+)#i&quot;, $str, $matches))
+                        {
+                                $pop = ($popup == TRUE) ? &quot; target=\&quot;_blank\&quot; &quot; : &quot;&quot;;
+        
+                                for ($i = 0; $i &lt; count($matches['0']); $i++)
+                                {
+                                        $period = '';
+                                        if (preg_match(&quot;|\.$|&quot;, $matches['6'][$i]))
+                                        {
+                                                $period = '.';
+                                                $matches['6'][$i] = substr($matches['6'][$i], 0, -1);
+                                        }
+                
+                                        $str = str_replace($matches['0'][$i],
+                                                                                $matches['1'][$i].'&lt;a href=&quot;http'.
+                                                                                $matches['4'][$i].'://'.
+                                                                                $matches['5'][$i].
+                                                                                $matches['6'][$i].'&quot;'.$pop.'&gt;http'.
+                                                                                $matches['4'][$i].'://'.
+                                                                                $matches['5'][$i].
+                                                                                $matches['6'][$i].'&lt;/a&gt;'.
+                                                                                $period, $str);
+                                }
+                        }
+                }
+
+                if ($type != 'url')
+                {
+                        if (preg_match_all(&quot;/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i&quot;, $str, $matches))
+                        {
+                                for ($i = 0; $i &lt; count($matches['0']); $i++)
+                                {
+                                        $period = '';
+                                        if (preg_match(&quot;|\.$|&quot;, $matches['3'][$i]))
+                                        {
+                                                $period = '.';
+                                                $matches['3'][$i] = substr($matches['3'][$i], 0, -1);
+                                        }
+                
+                                        $str = str_replace($matches['0'][$i], safe_mailto($matches['1'][$i].'@'.$matches['2'][$i].'.'.$matches['3'][$i]).$period, $str);
+                                }
+                        }
+                }
+
+                return $str;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Prep URL
+ *
+ * Simply adds the http:// part if missing
+ *
+ * @access        public
+ * @param        string        the URL
+ * @return        string
+ */
+if ( ! function_exists('prep_url'))
+{
+        function prep_url($str = '')
+        {
+                if ($str == 'http://' OR $str == '')
+                {
+                        return '';
+                }
+
+                if (substr($str, 0, 7) != 'http://' &amp;&amp; substr($str, 0, 8) != 'https://')
+                {
+                        $str = 'http://'.$str;
+                }
+
+                return $str;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Create URL Title
+ *
+ * Takes a &quot;title&quot; string as input and creates a
+ * human-friendly URL string with either a dash
+ * or an underscore as the word separator.
+ *
+ * @access        public
+ * @param        string        the string
+ * @param        string        the separator: dash, or underscore
+ * @return        string
+ */
+if ( ! function_exists('url_title'))
+{
+        function url_title($str, $separator = 'dash', $lowercase = FALSE)
+        {
+                if ($separator == 'dash')
+                {
+                        $search                = '_';
+                        $replace        = '-';
+                }
+                else
+                {
+                        $search                = '-';
+                        $replace        = '_';
+                }
+
+                $trans = array(
+                                                '&amp;\#\d+?;'                                =&gt; '',
+                                                '&amp;\S+?;'                                =&gt; '',
+                                                '\s+'                                        =&gt; $replace,
+                                                '[^a-z0-9\-\._]'                =&gt; '',
+                                                $replace.'+'                        =&gt; $replace,
+                                                $replace.'$'                        =&gt; $replace,
+                                                '^'.$replace                        =&gt; $replace,
+                                                '\.+$'                                        =&gt; ''
+                                          );
+
+                $str = strip_tags($str);
+
+                foreach ($trans as $key =&gt; $val)
+                {
+                        $str = preg_replace(&quot;#&quot;.$key.&quot;#i&quot;, $val, $str);
+                }
+
+                if ($lowercase === TRUE)
+                {
+                        $str = strtolower($str);
+                }
+                
+                return trim(stripslashes($str));
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Header Redirect
+ *
+ * Header redirect in two flavors
+ * For very fine grained control over headers, you could use the Output
+ * Library's set_header() function.
+ *
+ * @access        public
+ * @param        string        the URL
+ * @param        string        the method: location or redirect
+ * @return        string
+ */
+if ( ! function_exists('redirect'))
+{
+        function redirect($uri = '', $method = 'location', $http_response_code = 302)
+        {
+                if ( ! preg_match('#^https?://#i', $uri))
+                {
+                        $uri = site_url($uri);
+                }
+                
+                switch($method)
+                {
+                        case 'refresh'        : header(&quot;Refresh:0;url=&quot;.$uri);
+                                break;
+                        default                        : header(&quot;Location: &quot;.$uri, TRUE, $http_response_code);
+                                break;
+                }
+                exit;
+        }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Parse out the attributes
+ *
+ * Some of the functions use this
+ *
+ * @access        private
+ * @param        array
+ * @param        bool
+ * @return        string
+ */
+if ( ! function_exists('_parse_attributes'))
+{
+        function _parse_attributes($attributes, $javascript = FALSE)
+        {
+                if (is_string($attributes))
+                {
+                        return ($attributes != '') ? ' '.$attributes : '';
+                }
+
+                $att = '';
+                foreach ($attributes as $key =&gt; $val)
+                {
+                        if ($javascript == TRUE)
+                        {
+                                $att .= $key . '=' . $val . ',';
+                        }
+                        else
+                        {
+                                $att .= ' ' . $key . '=&quot;' . $val . '&quot;';
+                        }
+                }
+
+                if ($javascript == TRUE AND $att != '')
+                {
+                        $att = substr($att, 0, -1);
+                }
+
+                return $att;
+        }
+}
+
+
+/* End of file url_helper.php */
+/* Location: ./system/helpers/url_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemhelpersxml_helperphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/xml_helper.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/xml_helper.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/helpers/xml_helper.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter XML Helpers
+ *
+ * @package                CodeIgniter
+ * @subpackage        Helpers
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/xml_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Convert Reserved XML characters to Entities
+ *
+ * @access        public
+ * @param        string
+ * @return        string
+ */        
+if ( ! function_exists('xml_convert'))
+{
+        function xml_convert($str)
+        {
+                $temp = '__TEMP_AMPERSANDS__';
+
+                // Replace entities to temporary markers so that 
+                // ampersands won't get messed up
+                $str = preg_replace(&quot;/&amp;#(\d+);/&quot;, &quot;$temp\\1;&quot;, $str);
+                $str = preg_replace(&quot;/&amp;(\w+);/&quot;,  &quot;$temp\\1;&quot;, $str);
+        
+                $str = str_replace(array(&quot;&amp;&quot;,&quot;&lt;&quot;,&quot;&gt;&quot;,&quot;\&quot;&quot;, &quot;'&quot;, &quot;-&quot;),
+                                                   array(&quot;&amp;amp;&quot;, &quot;&amp;lt;&quot;, &quot;&amp;gt;&quot;, &quot;&amp;quot;&quot;, &quot;&amp;#39;&quot;, &quot;&amp;#45;&quot;),
+                                                   $str);
+
+                // Decode the temp markers back to entities                
+                $str = preg_replace(&quot;/$temp(\d+);/&quot;,&quot;&amp;#\\1;&quot;,$str);
+                $str = preg_replace(&quot;/$temp(\w+);/&quot;,&quot;&amp;\\1;&quot;, $str);
+                
+                return $str;
+        }
+}
+
+
+/* End of file xml_helper.php */
+/* Location: ./system/helpers/xml_helper.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishcalendar_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/calendar_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/calendar_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/calendar_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+&lt;?php
+
+$lang['cal_su']                        = &quot;Su&quot;;
+$lang['cal_mo']                 = &quot;Mo&quot;;
+$lang['cal_tu']                 = &quot;Tu&quot;;
+$lang['cal_we']                 = &quot;We&quot;;
+$lang['cal_th']                 = &quot;Th&quot;;
+$lang['cal_fr']                 = &quot;Fr&quot;;
+$lang['cal_sa']                 = &quot;Sa&quot;;
+$lang['cal_sun']                 = &quot;Sun&quot;;
+$lang['cal_mon']                 = &quot;Mon&quot;;
+$lang['cal_tue']                 = &quot;Tue&quot;;
+$lang['cal_wed']                 = &quot;Wed&quot;;
+$lang['cal_thu']                 = &quot;Thu&quot;;
+$lang['cal_fri']                 = &quot;Fri&quot;;
+$lang['cal_sat']                 = &quot;Sat&quot;;
+$lang['cal_sunday']                = &quot;Sunday&quot;;
+$lang['cal_monday']                = &quot;Monday&quot;;
+$lang['cal_tuesday']        = &quot;Tuesday&quot;;
+$lang['cal_wednesday']        = &quot;Wednesday&quot;;
+$lang['cal_thursday']        = &quot;Thursday&quot;;
+$lang['cal_friday']                = &quot;Friday&quot;;
+$lang['cal_saturday']        = &quot;Saturday&quot;;
+$lang['cal_jan']                 = &quot;Jan&quot;;
+$lang['cal_feb']                 = &quot;Feb&quot;;
+$lang['cal_mar']                 = &quot;Mar&quot;;
+$lang['cal_apr']                 = &quot;Apr&quot;;
+$lang['cal_may']                 = &quot;May&quot;;
+$lang['cal_jun']                 = &quot;Jun&quot;;
+$lang['cal_jul']                 = &quot;Jul&quot;;
+$lang['cal_aug']                 = &quot;Aug&quot;;
+$lang['cal_sep']                 = &quot;Sep&quot;;
+$lang['cal_oct']                 = &quot;Oct&quot;;
+$lang['cal_nov']                 = &quot;Nov&quot;;
+$lang['cal_dec']                 = &quot;Dec&quot;;
+$lang['cal_january']         = &quot;January&quot;;
+$lang['cal_february']         = &quot;February&quot;;
+$lang['cal_march']                 = &quot;March&quot;;
+$lang['cal_april']                = &quot;April&quot;;
+$lang['cal_mayl']                 = &quot;May&quot;;
+$lang['cal_june']                 = &quot;June&quot;;
+$lang['cal_july']                 = &quot;July&quot;;
+$lang['cal_august']                = &quot;August&quot;;
+$lang['cal_september']        = &quot;September&quot;;
+$lang['cal_october']         = &quot;October&quot;;
+$lang['cal_november']        = &quot;November&quot;;
+$lang['cal_december']         = &quot;December&quot;;
+
+
+/* End of file calendar_lang.php */
+/* Location: ./system/language/english/calendar_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishdate_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/date_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/date_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/date_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+&lt;?php
+
+$lang['date_year'] = &quot;Year&quot;;
+$lang['date_years'] = &quot;Years&quot;;
+$lang['date_month'] = &quot;Month&quot;;
+$lang['date_months'] = &quot;Months&quot;;
+$lang['date_week'] = &quot;Week&quot;;
+$lang['date_weeks'] = &quot;Weeks&quot;;
+$lang['date_day'] = &quot;Day&quot;;
+$lang['date_days'] = &quot;Days&quot;;
+$lang['date_hour'] = &quot;Hour&quot;;
+$lang['date_hours'] = &quot;Hours&quot;;
+$lang['date_minute'] = &quot;Minute&quot;;
+$lang['date_minutes'] = &quot;Minutes&quot;;
+$lang['date_second'] = &quot;Second&quot;;
+$lang['date_seconds'] = &quot;Seconds&quot;;
+
+$lang['UM12']        = '(UTC -12:00) Baker/Howland Island';
+$lang['UM11']        = '(UTC -11:00) Samoa Time Zone, Niue';
+$lang['UM10']        = '(UTC -10:00) Hawaii-Aleutian Standard Time, Cook Islands, Tahiti';
+$lang['UM95']        = '(UTC -9:30) Marquesas Islands';
+$lang['UM9']        = '(UTC -9:00) Alaska Standard Time, Gambier Islands';
+$lang['UM8']        = '(UTC -8:00) Pacific Standard Time, Clipperton Island';
+$lang['UM7']        = '(UTC -7:00) Mountain Standard Time';
+$lang['UM6']        = '(UTC -6:00) Central Standard Time';
+$lang['UM5']        = '(UTC -5:00) Eastern Standard Time, Western Caribbean Standard Time';
+$lang['UM45']        = '(UTC -4:30) Venezuelan Standard Time';
+$lang['UM4']        = '(UTC -4:00) Atlantic Standard Time, Eastern Caribbean Standard Time';
+$lang['UM35']        = '(UTC -3:30) Newfoundland Standard Time';
+$lang['UM3']        = '(UTC -3:00) Argentina, Brazil, French Guiana, Uruguay';
+$lang['UM2']        = '(UTC -2:00) South Georgia/South Sandwich Islands';
+$lang['UM1']        = '(UTC -1:00) Azores, Cape Verde Islands';
+$lang['UTC']        = '(UTC) Greenwich Mean Time, Western European Time';
+$lang['UP1']        = '(UTC +1:00) Central European Time, West Africa Time';
+$lang['UP2']        = '(UTC +2:00) Central Africa Time, Eastern European Time, Kaliningrad Time';
+$lang['UP3']        = '(UTC +3:00) Moscow Time, East Africa Time';
+$lang['UP35']        = '(UTC +3:30) Iran Standard Time';
+$lang['UP4']        = '(UTC +4:00) Azerbaijan Standard Time, Samara Time';
+$lang['UP45']        = '(UTC +4:30) Afghanistan';
+$lang['UP5']        = '(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time';
+$lang['UP55']        = '(UTC +5:30) Indian Standard Time, Sri Lanka Time';
+$lang['UP575']        = '(UTC +5:45) Nepal Time';
+$lang['UP6']        = '(UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time';
+$lang['UP65']        = '(UTC +6:30) Cocos Islands, Myanmar';
+$lang['UP7']        = '(UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam';
+$lang['UP8']        = '(UTC +8:00) Australian Western Standard Time, Beijing Time, Irkutsk Time';
+$lang['UP875']        = '(UTC +8:45) Australian Central Western Standard Time';
+$lang['UP9']        = '(UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk Time';
+$lang['UP95']        = '(UTC +9:30) Australian Central Standard Time';
+$lang['UP10']        = '(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time';
+$lang['UP105']        = '(UTC +10:30) Lord Howe Island';
+$lang['UP11']        = '(UTC +11:00) Magadan Time, Solomon Islands, Vanuatu';
+$lang['UP115']        = '(UTC +11:30) Norfolk Island';
+$lang['UP12']        = '(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand Standard Time';
+$lang['UP1275']        = '(UTC +12:45) Chatham Islands Standard Time';
+$lang['UP13']        = '(UTC +13:00) Phoenix Islands Time, Tonga';
+$lang['UP14']        = '(UTC +14:00) Line Islands';
+
+/* End of file date_lang.php */
+/* Location: ./system/language/english/date_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishdb_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/db_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/db_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/db_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;?php
+
+$lang['db_invalid_connection_str'] = 'Unable to determine the database settings based on the connection string you submitted.';
+$lang['db_unable_to_connect'] = 'Unable to connect to your database server using the provided settings.';
+$lang['db_unable_to_select'] = 'Unable to select the specified database: %s';
+$lang['db_unable_to_create'] = 'Unable to create the specified database: %s';
+$lang['db_invalid_query'] = 'The query you submitted is not valid.';
+$lang['db_must_set_table'] = 'You must set the database table to be used with your query.';
+$lang['db_must_set_database'] = 'You must set the database name in your database config file.';
+$lang['db_must_use_set'] = 'You must use the &quot;set&quot; method to update an entry.';
+$lang['db_must_use_where'] = 'Updates are not allowed unless they contain a &quot;where&quot; clause.';
+$lang['db_del_must_use_where'] = 'Deletes are not allowed unless they contain a &quot;where&quot; or &quot;like&quot; clause.';
+$lang['db_field_param_missing'] = 'To fetch fields requires the name of the table as a parameter.';
+$lang['db_unsupported_function'] = 'This feature is not available for the database you are using.';
+$lang['db_transaction_failure'] = 'Transaction failure: Rollback performed.';
+$lang['db_unable_to_drop'] = 'Unable to drop the specified database.';
+$lang['db_unsuported_feature'] = 'Unsupported feature of the database platform you are using.';
+$lang['db_unsuported_compression'] = 'The file compression format you chose is not supported by your server.';
+$lang['db_filepath_error'] = 'Unable to write data to the file path you have submitted.';
+$lang['db_invalid_cache_path'] = 'The cache path you submitted is not valid or writable.';
+$lang['db_table_name_required'] = 'A table name is required for that operation.';
+$lang['db_column_name_required'] = 'A column name is required for that operation.';
+$lang['db_column_definition_required'] = 'A column definition is required for that operation.';
+$lang['db_unable_to_set_charset'] = 'Unable to set client connection character set: %s';
+$lang['db_error_heading'] = 'A Database Error Occurred';
+
+/* End of file db_lang.php */
+/* Location: ./system/language/english/db_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishemail_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/email_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/email_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/email_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;?php
+
+$lang['email_must_be_array'] = &quot;The email validation method must be passed an array.&quot;;
+$lang['email_invalid_address'] = &quot;Invalid email address: %s&quot;;
+$lang['email_attachment_missing'] = &quot;Unable to locate the following email attachment: %s&quot;;
+$lang['email_attachment_unreadable'] = &quot;Unable to open this attachment: %s&quot;;
+$lang['email_no_recipients'] = &quot;You must include recipients: To, Cc, or Bcc&quot;;
+$lang['email_send_failure_phpmail'] = &quot;Unable to send email using PHP mail().  Your server might not be configured to send mail using this method.&quot;;
+$lang['email_send_failure_sendmail'] = &quot;Unable to send email using PHP Sendmail.  Your server might not be configured to send mail using this method.&quot;;
+$lang['email_send_failure_smtp'] = &quot;Unable to send email using PHP SMTP.  Your server might not be configured to send mail using this method.&quot;;
+$lang['email_sent'] = &quot;Your message has been successfully sent using the following protocol: %s&quot;;
+$lang['email_no_socket'] = &quot;Unable to open a socket to Sendmail. Please check settings.&quot;;
+$lang['email_no_hostname'] = &quot;You did not specify a SMTP hostname.&quot;;
+$lang['email_smtp_error'] = &quot;The following SMTP error was encountered: %s&quot;;
+$lang['email_no_smtp_unpw'] = &quot;Error: You must assign a SMTP username and password.&quot;;
+$lang['email_failed_smtp_login'] = &quot;Failed to send AUTH LOGIN command. Error: %s&quot;;
+$lang['email_smtp_auth_un'] = &quot;Failed to authenticate username. Error: %s&quot;;
+$lang['email_smtp_auth_pw'] = &quot;Failed to authenticate password. Error: %s&quot;;
+$lang['email_smtp_data_failure'] = &quot;Unable to send data: %s&quot;;
+$lang['email_exit_status'] = &quot;Exit status code: %s&quot;;
+
+
+/* End of file email_lang.php */
+/* Location: ./system/language/english/email_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishform_validation_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/form_validation_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/form_validation_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/form_validation_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;?php
+
+$lang['required']                         = &quot;The %s field is required.&quot;;
+$lang['isset']                                = &quot;The %s field must have a value.&quot;;
+$lang['valid_email']                = &quot;The %s field must contain a valid email address.&quot;;
+$lang['valid_emails']                 = &quot;The %s field must contain all valid email addresses.&quot;;
+$lang['valid_url']                         = &quot;The %s field must contain a valid URL.&quot;;
+$lang['valid_ip']                         = &quot;The %s field must contain a valid IP.&quot;;
+$lang['min_length']                        = &quot;The %s field must be at least %s characters in length.&quot;;
+$lang['max_length']                        = &quot;The %s field can not exceed %s characters in length.&quot;;
+$lang['exact_length']                = &quot;The %s field must be exactly %s characters in length.&quot;;
+$lang['alpha']                                = &quot;The %s field may only contain alphabetical characters.&quot;;
+$lang['alpha_numeric']                = &quot;The %s field may only contain alpha-numeric characters.&quot;;
+$lang['alpha_dash']                        = &quot;The %s field may only contain alpha-numeric characters, underscores, and dashes.&quot;;
+$lang['numeric']                        = &quot;The %s field must contain only numbers.&quot;;
+$lang['is_numeric']                        = &quot;The %s field must contain only numeric characters.&quot;;
+$lang['integer']                        = &quot;The %s field must contain an integer.&quot;;
+$lang['matches']                        = &quot;The %s field does not match the %s field.&quot;;
+$lang['is_natural']                        = &quot;The %s field must contain only positive numbers.&quot;;
+$lang['is_natural_no_zero']        = &quot;The %s field must contain a number greater than zero.&quot;;
+
+
+/* End of file form_validation_lang.php */
+/* Location: ./system/language/english/form_validation_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishftp_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/ftp_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/ftp_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/ftp_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;?php
+
+$lang['ftp_no_connection']                        = &quot;Unable to locate a valid connection ID.  Please make sure you are connected before peforming any file routines.&quot;;
+$lang['ftp_unable_to_connect']                = &quot;Unable to connect to your FTP server using the supplied hostname.&quot;;
+$lang['ftp_unable_to_login']                = &quot;Unable to login to your FTP server.  Please check your username and password.&quot;;
+$lang['ftp_unable_to_makdir']                = &quot;Unable to create the directory you have specified.&quot;;
+$lang['ftp_unable_to_changedir']        = &quot;Unable to change directories.&quot;;
+$lang['ftp_unable_to_chmod']                = &quot;Unable to set file permissions.  Please check your path.  Note: This feature is only available in PHP 5 or higher.&quot;;
+$lang['ftp_unable_to_upload']                = &quot;Unable to upload the specified file.  Please check your path.&quot;;
+$lang['ftp_no_source_file']                        = &quot;Unable to locate the source file.  Please check your path.&quot;;
+$lang['ftp_unable_to_rename']                = &quot;Unable to rename the file.&quot;;
+$lang['ftp_unable_to_delete']                = &quot;Unable to delete the file.&quot;;
+$lang['ftp_unable_to_move']                        = &quot;Unable to move the file.  Please make sure the destination directory exists.&quot;;
+
+
+/* End of file ftp_lang.php */
+/* Location: ./system/language/english/ftp_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishimglib_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/imglib_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/imglib_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/imglib_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;?php
+
+$lang['imglib_source_image_required'] = &quot;You must specify a source image in your preferences.&quot;;
+$lang['imglib_gd_required'] = &quot;The GD image library is required for this feature.&quot;;
+$lang['imglib_gd_required_for_props'] = &quot;Your server must support the GD image library in order to determine the image properties.&quot;;
+$lang['imglib_unsupported_imagecreate'] = &quot;Your server does not support the GD function required to process this type of image.&quot;;
+$lang['imglib_gif_not_supported'] = &quot;GIF images are often not supported due to licensing restrictions.  You may have to use JPG or PNG images instead.&quot;;
+$lang['imglib_jpg_not_supported'] = &quot;JPG images are not supported.&quot;;
+$lang['imglib_png_not_supported'] = &quot;PNG images are not supported.&quot;;
+$lang['imglib_jpg_or_png_required'] = &quot;The image resize protocol specified in your preferences only works with JPEG or PNG image types.&quot;;
+$lang['imglib_copy_error'] = &quot;An error was encountered while attempting to replace the file.  Please make sure your file directory is writable.&quot;;
+$lang['imglib_rotate_unsupported'] = &quot;Image rotation does not appear to be supported by your server.&quot;;
+$lang['imglib_libpath_invalid'] = &quot;The path to your image library is not correct.  Please set the correct path in your image preferences.&quot;;
+$lang['imglib_image_process_failed'] = &quot;Image processing failed.  Please verify that your server supports the chosen protocol and that the path to your image library is correct.&quot;;
+$lang['imglib_rotation_angle_required'] = &quot;An angle of rotation is required to rotate the image.&quot;;
+$lang['imglib_writing_failed_gif'] = &quot;GIF image.&quot;;
+$lang['imglib_invalid_path'] = &quot;The path to the image is not correct.&quot;;
+$lang['imglib_copy_failed'] = &quot;The image copy routine failed.&quot;;
+$lang['imglib_missing_font'] = &quot;Unable to find a font to use.&quot;;
+$lang['imglib_save_failed'] = &quot;Unable to save the image.  Please make sure the image and file directory are writable.&quot;;
+
+
+/* End of file imglib_lang.php */
+/* Location: ./system/language/english/imglib_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishnumber_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/number_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/number_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/number_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;?php
+
+$lang['terabyte_abbr'] = &quot;TB&quot;;
+$lang['gigabyte_abbr'] = &quot;GB&quot;;
+$lang['megabyte_abbr'] = &quot;MB&quot;;
+$lang['kilobyte_abbr'] = &quot;KB&quot;;
+$lang['bytes'] = &quot;Bytes&quot;;
+
+/* End of file number_lang.php */
+/* Location: ./system/language/english/number_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishprofiler_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/profiler_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/profiler_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/profiler_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;?php
+
+$lang['profiler_database']                  = 'DATABASE';
+$lang['profiler_controller_info'] = 'CLASS/METHOD';
+$lang['profiler_benchmarks']        = 'BENCHMARKS';
+$lang['profiler_queries']                = 'QUERIES';
+$lang['profiler_get_data']                = 'GET DATA';
+$lang['profiler_post_data']                = 'POST DATA';
+$lang['profiler_uri_string']        = 'URI STRING';
+$lang['profiler_memory_usage']        = 'MEMORY USAGE';
+$lang['profiler_no_db']                        = 'Database driver is not currently loaded';
+$lang['profiler_no_queries']        = 'No queries were run';
+$lang['profiler_no_post']                = 'No POST data exists';
+$lang['profiler_no_get']                = 'No GET data exists';
+$lang['profiler_no_uri']                = 'No URI data exists';
+$lang['profiler_no_memory']                = 'Memory Usage Unavailable';
+
+/* End of file profiler_lang.php */
+/* Location: ./system/language/english/profiler_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishscaffolding_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/scaffolding_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/scaffolding_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/scaffolding_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;?php
+
+$lang['scaff_view_records']                = 'View Records';
+$lang['scaff_create_record']        = 'Create New Record';
+$lang['scaff_add']                                = 'Add Data';
+$lang['scaff_view']                                = 'View Data';
+$lang['scaff_edit']                                = 'Edit';
+$lang['scaff_delete']                        = 'Delete';
+$lang['scaff_view_all']                        = 'View All';
+$lang['scaff_yes']                                = 'Yes';
+$lang['scaff_no']                                = 'No';
+$lang['scaff_no_data']                        = 'No data exists for this table yet.';
+$lang['scaff_del_confirm']                = 'Are you sure you want to delete the following row:';
+
+
+/* End of file scaffolding_lang.php */
+/* Location: ./system/language/english/scaffolding_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishunit_test_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/unit_test_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/unit_test_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/unit_test_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;?php
+
+$lang['ut_test_name']                = 'Test Name';
+$lang['ut_test_datatype']        = 'Test Datatype';
+$lang['ut_res_datatype']        = 'Expected Datatype';
+$lang['ut_result']                        = 'Result';
+$lang['ut_undefined']                = 'Undefined Test Name';
+$lang['ut_file']                        = 'File Name';
+$lang['ut_line']                        = 'Line Number';
+$lang['ut_passed']                        = 'Passed';
+$lang['ut_failed']                        = 'Failed';
+$lang['ut_boolean']                        = 'Boolean';
+$lang['ut_integer']                        = 'Integer';
+$lang['ut_float']                        = 'Float';
+$lang['ut_double']                        = 'Float'; // can be the same as float
+$lang['ut_string']                        = 'String';
+$lang['ut_array']                        = 'Array';
+$lang['ut_object']                        = 'Object';
+$lang['ut_resource']                = 'Resource';
+$lang['ut_null']                        = 'Null';
+
+
+/* End of file unit_test_lang.php */
+/* Location: ./system/language/english/unit_test_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishupload_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/upload_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/upload_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/upload_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;?php
+
+$lang['upload_userfile_not_set'] = &quot;Unable to find a post variable called userfile.&quot;;
+$lang['upload_file_exceeds_limit'] = &quot;The uploaded file exceeds the maximum allowed size in your PHP configuration file.&quot;;
+$lang['upload_file_exceeds_form_limit'] = &quot;The uploaded file exceeds the maximum size allowed by the submission form.&quot;;
+$lang['upload_file_partial'] = &quot;The file was only partially uploaded.&quot;;
+$lang['upload_no_temp_directory'] = &quot;The temporary folder is missing.&quot;;
+$lang['upload_unable_to_write_file'] = &quot;The file could not be written to disk.&quot;;
+$lang['upload_stopped_by_extension'] = &quot;The file upload was stopped by extension.&quot;;
+$lang['upload_no_file_selected'] = &quot;You did not select a file to upload.&quot;;
+$lang['upload_invalid_filetype'] = &quot;The filetype you are attempting to upload is not allowed.&quot;;
+$lang['upload_invalid_filesize'] = &quot;The file you are attempting to upload is larger than the permitted size.&quot;;
+$lang['upload_invalid_dimensions'] = &quot;The image you are attempting to upload exceedes the maximum height or width.&quot;;
+$lang['upload_destination_error'] = &quot;A problem was encountered while attempting to move the uploaded file to the final destination.&quot;;
+$lang['upload_no_filepath'] = &quot;The upload path does not appear to be valid.&quot;;
+$lang['upload_no_file_types'] = &quot;You have not specified any allowed file types.&quot;;
+$lang['upload_bad_filename'] = &quot;The file name you submitted already exists on the server.&quot;;
+$lang['upload_not_writable'] = &quot;The upload destination folder does not appear to be writable.&quot;;
+
+
+/* End of file upload_lang.php */
+/* Location: ./system/language/english/upload_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageenglishvalidation_langphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/validation_lang.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/validation_lang.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/english/validation_lang.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;?php
+
+$lang['required']                         = &quot;The %s field is required.&quot;;
+$lang['isset']                                = &quot;The %s field must have a value.&quot;;
+$lang['valid_email']                = &quot;The %s field must contain a valid email address.&quot;;
+$lang['valid_emails']                 = &quot;The %s field must contain all valid email addresses.&quot;;
+$lang['valid_url']                         = &quot;The %s field must contain a valid URL.&quot;;
+$lang['valid_ip']                         = &quot;The %s field must contain a valid IP.&quot;;
+$lang['min_length']                        = &quot;The %s field must be at least %s characters in length.&quot;;
+$lang['max_length']                        = &quot;The %s field can not exceed %s characters in length.&quot;;
+$lang['exact_length']                = &quot;The %s field must be exactly %s characters in length.&quot;;
+$lang['alpha']                                = &quot;The %s field may only contain alphabetical characters.&quot;;
+$lang['alpha_numeric']                = &quot;The %s field may only contain alpha-numeric characters.&quot;;
+$lang['alpha_dash']                        = &quot;The %s field may only contain alpha-numeric characters, underscores, and dashes.&quot;;
+$lang['numeric']                        = &quot;The %s field must contain a number.&quot;;
+$lang['is_numeric']                        = &quot;The %s field must contain a number.&quot;;
+$lang['integer']                        = &quot;The %s field must contain an integer.&quot;;
+$lang['matches']                        = &quot;The %s field does not match the %s field.&quot;;
+$lang['is_natural']                        = &quot;The %s field must contain a number.&quot;;
+$lang['is_natural_no_zero']        = &quot;The %s field must contain a number greater than zero.&quot;;
+
+
+/* End of file validation_lang.php */
+/* Location: ./system/language/english/validation_lang.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlanguageindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/language/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesBenchmarkphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Benchmark.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Benchmark.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Benchmark.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,113 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Benchmark Class
+ *
+ * This class enables you to mark points and calculate the time difference
+ * between them.  Memory consumption can also be displayed.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/benchmark.html
+ */
+class CI_Benchmark {
+
+        var $marker = array();
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set a benchmark marker
+         *
+         * Multiple calls to this function can be made so that several
+         * execution points can be timed
+         *
+         * @access        public
+         * @param        string        $name        name of the marker
+         * @return        void
+         */
+        function mark($name)
+        {
+                $this-&gt;marker[$name] = microtime();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Calculates the time difference between two marked points.
+         *
+         * If the first parameter is empty this function instead returns the
+         * {elapsed_time} pseudo-variable. This permits the full system
+         * execution time to be shown in a template. The output class will
+         * swap the real value for this variable.
+         *
+         * @access        public
+         * @param        string        a particular marked point
+         * @param        string        a particular marked point
+         * @param        integer        the number of decimal places
+         * @return        mixed
+         */
+        function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
+        {
+                if ($point1 == '')
+                {
+                        return '{elapsed_time}';
+                }
+
+                if ( ! isset($this-&gt;marker[$point1]))
+                {
+                        return '';
+                }
+
+                if ( ! isset($this-&gt;marker[$point2]))
+                {
+                        $this-&gt;marker[$point2] = microtime();
+                }
+        
+                list($sm, $ss) = explode(' ', $this-&gt;marker[$point1]);
+                list($em, $es) = explode(' ', $this-&gt;marker[$point2]);
+
+                return number_format(($em + $es) - ($sm + $ss), $decimals);
+        }
+         
+        // --------------------------------------------------------------------
+
+        /**
+         * Memory Usage
+         *
+         * This function returns the {memory_usage} pseudo-variable.
+         * This permits it to be put it anywhere in a template
+         * without the memory being calculated until the end.
+         * The output class will swap the real value for this variable.
+         *
+         * @access        public
+         * @return        string
+         */
+        function memory_usage()
+        {
+                return '{memory_usage}';
+        }
+
+}
+
+// END CI_Benchmark class
+
+/* End of file Benchmark.php */
+/* Location: ./system/libraries/Benchmark.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesCalendarphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Calendar.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Calendar.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Calendar.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,477 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Calendar Class
+ *
+ * This class enables the creation of calendars
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/calendar.html
+ */
+class CI_Calendar {
+
+        var $CI;
+        var $lang;
+        var $local_time;
+        var $template                = '';
+        var $start_day                = 'sunday';
+        var $month_type         = 'long';
+        var $day_type                = 'abr';
+        var $show_next_prev        = FALSE;
+        var $next_prev_url        = '';
+
+        /**
+         * Constructor
+         *
+         * Loads the calendar language file and sets the default time reference
+         *
+         * @access        public
+         */
+        function CI_Calendar($config = array())
+        {                
+                $this-&gt;CI =&amp; get_instance();
+                
+                if ( ! in_array('calendar_lang'.EXT, $this-&gt;CI-&gt;lang-&gt;is_loaded, TRUE))
+                {
+                        $this-&gt;CI-&gt;lang-&gt;load('calendar');
+                }
+
+                $this-&gt;local_time = time();
+                
+                if (count($config) &gt; 0)
+                {
+                        $this-&gt;initialize($config);
+                }
+                
+                log_message('debug', &quot;Calendar Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Initialize the user preferences
+         *
+         * Accepts an associative array as input, containing display preferences
+         *
+         * @access        public
+         * @param        array        config preferences
+         * @return        void
+         */        
+        function initialize($config = array())
+        {
+                foreach ($config as $key =&gt; $val)
+                {
+                        if (isset($this-&gt;$key))
+                        {
+                                $this-&gt;$key = $val;
+                        }
+                }
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate the calendar
+         *
+         * @access        public
+         * @param        integer        the year
+         * @param        integer        the month
+         * @param        array        the data to be shown in the calendar cells
+         * @return        string
+         */
+        function generate($year = '', $month = '', $data = array())
+        {
+                // Set and validate the supplied month/year
+                if ($year == '')
+                        $year  = date(&quot;Y&quot;, $this-&gt;local_time);
+                        
+                if ($month == '')
+                        $month = date(&quot;m&quot;, $this-&gt;local_time);
+                        
+                 if (strlen($year) == 1)
+                        $year = '200'.$year;
+                
+                 if (strlen($year) == 2)
+                        $year = '20'.$year;
+
+                 if (strlen($month) == 1)
+                        $month = '0'.$month;
+                
+                $adjusted_date = $this-&gt;adjust_date($month, $year);
+                
+                $month        = $adjusted_date['month'];
+                $year        = $adjusted_date['year'];
+                
+                // Determine the total days in the month
+                $total_days = $this-&gt;get_total_days($month, $year);
+                                                
+                // Set the starting day of the week
+                $start_days        = array('sunday' =&gt; 0, 'monday' =&gt; 1, 'tuesday' =&gt; 2, 'wednesday' =&gt; 3, 'thursday' =&gt; 4, 'friday' =&gt; 5, 'saturday' =&gt; 6);
+                $start_day = ( ! isset($start_days[$this-&gt;start_day])) ? 0 : $start_days[$this-&gt;start_day];
+                
+                // Set the starting day number
+                $local_date = mktime(12, 0, 0, $month, 1, $year);
+                $date = getdate($local_date);
+                $day  = $start_day + 1 - $date[&quot;wday&quot;];
+                
+                while ($day &gt; 1)
+                {
+                        $day -= 7;
+                }
+                
+                // Set the current month/year/day
+                // We use this to determine the &quot;today&quot; date
+                $cur_year        = date(&quot;Y&quot;, $this-&gt;local_time);
+                $cur_month        = date(&quot;m&quot;, $this-&gt;local_time);
+                $cur_day        = date(&quot;j&quot;, $this-&gt;local_time);
+                
+                $is_current_month = ($cur_year == $year AND $cur_month == $month) ? TRUE : FALSE;
+        
+                // Generate the template data array
+                $this-&gt;parse_template();
+        
+                // Begin building the calendar output                                                
+                $out = $this-&gt;temp['table_open'];
+                $out .= &quot;\n&quot;;        
+
+                $out .= &quot;\n&quot;;                
+                $out .= $this-&gt;temp['heading_row_start'];
+                $out .= &quot;\n&quot;;
+                
+                // &quot;previous&quot; month link
+                if ($this-&gt;show_next_prev == TRUE)
+                {
+                        // Add a trailing slash to the  URL if needed
+                        $this-&gt;next_prev_url = preg_replace(&quot;/(.+?)\/*$/&quot;, &quot;\\1/&quot;,  $this-&gt;next_prev_url);
+                
+                        $adjusted_date = $this-&gt;adjust_date($month - 1, $year);
+                        $out .= str_replace('{previous_url}', $this-&gt;next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this-&gt;temp['heading_previous_cell']);
+                        $out .= &quot;\n&quot;;
+                }
+
+                // Heading containing the month/year
+                $colspan = ($this-&gt;show_next_prev == TRUE) ? 5 : 7;
+                
+                $this-&gt;temp['heading_title_cell'] = str_replace('{colspan}', $colspan, $this-&gt;temp['heading_title_cell']);
+                $this-&gt;temp['heading_title_cell'] = str_replace('{heading}', $this-&gt;get_month_name($month).&quot;&amp;nbsp;&quot;.$year, $this-&gt;temp['heading_title_cell']);
+                
+                $out .= $this-&gt;temp['heading_title_cell'];
+                $out .= &quot;\n&quot;;
+
+                // &quot;next&quot; month link
+                if ($this-&gt;show_next_prev == TRUE)
+                {                
+                        $adjusted_date = $this-&gt;adjust_date($month + 1, $year);
+                        $out .= str_replace('{next_url}', $this-&gt;next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this-&gt;temp['heading_next_cell']);
+                }
+
+                $out .= &quot;\n&quot;;                
+                $out .= $this-&gt;temp['heading_row_end'];
+                $out .= &quot;\n&quot;;
+
+                // Write the cells containing the days of the week
+                $out .= &quot;\n&quot;;        
+                $out .= $this-&gt;temp['week_row_start'];
+                $out .= &quot;\n&quot;;
+
+                $day_names = $this-&gt;get_day_names();
+
+                for ($i = 0; $i &lt; 7; $i ++)
+                {
+                        $out .= str_replace('{week_day}', $day_names[($start_day + $i) %7], $this-&gt;temp['week_day_cell']);
+                }
+
+                $out .= &quot;\n&quot;;
+                $out .= $this-&gt;temp['week_row_end'];
+                $out .= &quot;\n&quot;;
+
+                // Build the main body of the calendar
+                while ($day &lt;= $total_days)
+                {
+                        $out .= &quot;\n&quot;;
+                        $out .= $this-&gt;temp['cal_row_start'];
+                        $out .= &quot;\n&quot;;
+
+                        for ($i = 0; $i &lt; 7; $i++)
+                        {
+                                $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this-&gt;temp['cal_cell_start_today'] : $this-&gt;temp['cal_cell_start'];
+                        
+                                if ($day &gt; 0 AND $day &lt;= $total_days)
+                                {                                         
+                                        if (isset($data[$day]))
+                                        {        
+                                                // Cells with content
+                                                $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this-&gt;temp['cal_cell_content_today'] : $this-&gt;temp['cal_cell_content'];
+                                                $out .= str_replace('{day}', $day, str_replace('{content}', $data[$day], $temp));
+                                        }
+                                        else
+                                        {
+                                                // Cells with no content
+                                                $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this-&gt;temp['cal_cell_no_content_today'] : $this-&gt;temp['cal_cell_no_content'];
+                                                $out .= str_replace('{day}', $day, $temp);
+                                        }
+                                }
+                                else
+                                {
+                                        // Blank cells
+                                        $out .= $this-&gt;temp['cal_cell_blank'];
+                                }
+                                
+                                $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this-&gt;temp['cal_cell_end_today'] : $this-&gt;temp['cal_cell_end'];                                                  
+                                $day++;
+                        }
+                        
+                        $out .= &quot;\n&quot;;                
+                        $out .= $this-&gt;temp['cal_row_end'];
+                        $out .= &quot;\n&quot;;                
+                }
+
+                $out .= &quot;\n&quot;;                
+                $out .= $this-&gt;temp['table_close'];
+
+                return $out;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Month Name
+         *
+         * Generates a textual month name based on the numeric
+         * month provided.
+         *
+         * @access        public
+         * @param        integer        the month
+         * @return        string
+         */
+        function get_month_name($month)
+        {
+                if ($this-&gt;month_type == 'short')
+                {
+                        $month_names = array('01' =&gt; 'cal_jan', '02' =&gt; 'cal_feb', '03' =&gt; 'cal_mar', '04' =&gt; 'cal_apr', '05' =&gt; 'cal_may', '06' =&gt; 'cal_jun', '07' =&gt; 'cal_jul', '08' =&gt; 'cal_aug', '09' =&gt; 'cal_sep', '10' =&gt; 'cal_oct', '11' =&gt; 'cal_nov', '12' =&gt; 'cal_dec');
+                }
+                else
+                {
+                        $month_names = array('01' =&gt; 'cal_january', '02' =&gt; 'cal_february', '03' =&gt; 'cal_march', '04' =&gt; 'cal_april', '05' =&gt; 'cal_may', '06' =&gt; 'cal_june', '07' =&gt; 'cal_july', '08' =&gt; 'cal_august', '09' =&gt; 'cal_september', '10' =&gt; 'cal_october', '11' =&gt; 'cal_november', '12' =&gt; 'cal_december');
+                }
+                
+                $month = $month_names[$month];
+                
+                if ($this-&gt;CI-&gt;lang-&gt;line($month) === FALSE)
+                {
+                        return ucfirst(str_replace('cal_', '', $month));
+                }
+
+                return $this-&gt;CI-&gt;lang-&gt;line($month);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Day Names
+         *
+         * Returns an array of day names (Sunday, Monday, etc.) based
+         * on the type.  Options: long, short, abrev
+         *
+         * @access        public
+         * @param        string
+         * @return        array
+         */
+        function get_day_names($day_type = '')
+        {
+                if ($day_type != '')
+                        $this-&gt;day_type = $day_type;
+        
+                if ($this-&gt;day_type == 'long')
+                {
+                        $day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
+                }
+                elseif ($this-&gt;day_type == 'short')
+                {
+                        $day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
+                }
+                else
+                {
+                        $day_names = array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa');
+                }
+        
+                $days = array();
+                foreach ($day_names as $val)
+                {                        
+                        $days[] = ($this-&gt;CI-&gt;lang-&gt;line('cal_'.$val) === FALSE) ? ucfirst($val) : $this-&gt;CI-&gt;lang-&gt;line('cal_'.$val);
+                }
+        
+                return $days;
+        }
+         
+        // --------------------------------------------------------------------
+
+        /**
+         * Adjust Date
+         *
+         * This function makes sure that we have a valid month/year.
+         * For example, if you submit 13 as the month, the year will
+         * increment and the month will become January.
+         *
+         * @access        public
+         * @param        integer        the month
+         * @param        integer        the year
+         * @return        array
+         */
+        function adjust_date($month, $year)
+        {
+                $date = array();
+
+                $date['month']        = $month;
+                $date['year']        = $year;
+
+                while ($date['month'] &gt; 12)
+                {
+                        $date['month'] -= 12;
+                        $date['year']++;
+                }
+
+                while ($date['month'] &lt;= 0)
+                {
+                        $date['month'] += 12;
+                        $date['year']--;
+                }
+
+                if (strlen($date['month']) == 1)
+                {
+                        $date['month'] = '0'.$date['month'];
+                }
+
+                return $date;
+        }
+         
+        // --------------------------------------------------------------------
+
+        /**
+         * Total days in a given month
+         *
+         * @access        public
+         * @param        integer        the month
+         * @param        integer        the year
+         * @return        integer
+         */
+        function get_total_days($month, $year)
+        {
+                $days_in_month        = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+
+                if ($month &lt; 1 OR $month &gt; 12)
+                {
+                        return 0;
+                }
+
+                // Is the year a leap year?
+                if ($month == 2)
+                {
+                        if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0))
+                        {
+                                return 29;
+                        }
+                }
+
+                return $days_in_month[$month - 1];
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Default Template Data
+         *
+         * This is used in the event that the user has not created their own template
+         *
+         * @access        public
+         * @return array
+         */
+        function default_template()
+        {
+                return  array (
+                                                'table_open'                                 =&gt; '&lt;table border=&quot;0&quot; cellpadding=&quot;4&quot; cellspacing=&quot;0&quot;&gt;',
+                                                'heading_row_start'                 =&gt; '&lt;tr&gt;',
+                                                'heading_previous_cell'                =&gt; '&lt;th&gt;&lt;a href=&quot;{previous_url}&quot;&gt;&amp;lt;&amp;lt;&lt;/a&gt;&lt;/th&gt;',
+                                                'heading_title_cell'                 =&gt; '&lt;th colspan=&quot;{colspan}&quot;&gt;{heading}&lt;/th&gt;',
+                                                'heading_next_cell'                 =&gt; '&lt;th&gt;&lt;a href=&quot;{next_url}&quot;&gt;&amp;gt;&amp;gt;&lt;/a&gt;&lt;/th&gt;',
+                                                'heading_row_end'                         =&gt; '&lt;/tr&gt;',
+                                                'week_row_start'                         =&gt; '&lt;tr&gt;',
+                                                'week_day_cell'                         =&gt; '&lt;td&gt;{week_day}&lt;/td&gt;',
+                                                'week_row_end'                                 =&gt; '&lt;/tr&gt;',
+                                                'cal_row_start'                         =&gt; '&lt;tr&gt;',
+                                                'cal_cell_start'                         =&gt; '&lt;td&gt;',
+                                                'cal_cell_start_today'                =&gt; '&lt;td&gt;',
+                                                'cal_cell_content'                        =&gt; '&lt;a href=&quot;{content}&quot;&gt;{day}&lt;/a&gt;',
+                                                'cal_cell_content_today'        =&gt; '&lt;a href=&quot;{content}&quot;&gt;&lt;strong&gt;{day}&lt;/strong&gt;&lt;/a&gt;',
+                                                'cal_cell_no_content'                =&gt; '{day}',
+                                                'cal_cell_no_content_today'        =&gt; '&lt;strong&gt;{day}&lt;/strong&gt;',
+                                                'cal_cell_blank'                        =&gt; '&amp;nbsp;',
+                                                'cal_cell_end'                                =&gt; '&lt;/td&gt;',
+                                                'cal_cell_end_today'                =&gt; '&lt;/td&gt;',
+                                                'cal_row_end'                                =&gt; '&lt;/tr&gt;',
+                                                'table_close'                                =&gt; '&lt;/table&gt;'
+                                        );        
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Parse Template
+         *
+         * Harvests the data within the template {pseudo-variables}
+         * used to display the calendar
+         *
+         * @access        public
+         * @return        void
+         */
+         function parse_template()
+         {
+                $this-&gt;temp = $this-&gt;default_template();
+         
+                 if ($this-&gt;template == '')
+                 {
+                         return;
+                 }
+                 
+                $today = array('cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today');
+                
+                foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content',  'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val)
+                {
+                        if (preg_match(&quot;/\{&quot;.$val.&quot;\}(.*?)\{\/&quot;.$val.&quot;\}/si&quot;, $this-&gt;template, $match))
+                        {
+                                $this-&gt;temp[$val] = $match['1'];
+                        }
+                        else
+                        {
+                                if (in_array($val, $today, TRUE))
+                                {
+                                        $this-&gt;temp[$val] = $this-&gt;temp[str_replace('_today', '', $val)];
+                                }
+                        }
+                }         
+         }
+
+}
+
+// END CI_Calendar class
+
+/* End of file Calendar.php */
+/* Location: ./system/libraries/Calendar.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesCartphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Cart.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Cart.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Cart.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,550 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2006 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Shopping Cart Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Shopping Cart
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/cart.html
+ */
+class CI_Cart {
+
+        // These are the regular expression rules that we use to validate the product ID and product name
+        var $product_id_rules        = '\.a-z0-9_-'; // alpha-numeric, dashes, underscores, or periods
+        var $product_name_rules        = '\.\:\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods
+        
+        // Private variables.  Do not change!
+        var $CI;
+        var $_cart_contents        = array();
+
+
+        /**
+         * Shopping Class Constructor
+         *
+         * The constructor loads the Session class, used to store the shopping cart contents.
+         */                
+        function CI_Cart($params = array())
+        {        
+                // Set the super object to a local variable for use later
+                $this-&gt;CI =&amp; get_instance();
+                
+                // Are any config settings being passed manually?  If so, set them
+                $config = array();
+                if (count($params) &gt; 0)
+                {
+                        foreach ($params as $key =&gt; $val)
+                        {
+                                $config[$key] = $val;
+                        }
+                }
+                
+                // Load the Sessions class
+                $this-&gt;CI-&gt;load-&gt;library('session', $config);
+                        
+                // Grab the shopping cart array from the session table, if it exists
+                if ($this-&gt;CI-&gt;session-&gt;userdata('cart_contents') !== FALSE)
+                {
+                        $this-&gt;_cart_contents = $this-&gt;CI-&gt;session-&gt;userdata('cart_contents');
+                }
+                else
+                {
+                        // No cart exists so we'll set some base values
+                        $this-&gt;_cart_contents['cart_total'] = 0;                
+                        $this-&gt;_cart_contents['total_items'] = 0;                
+                }
+        
+                log_message('debug', &quot;Cart Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert items into the cart and save it to the session table
+         *
+         * @access        public
+         * @param        array
+         * @return        bool
+         */
+        function insert($items = array())
+        {
+                // Was any cart data passed? No? Bah...
+                if ( ! is_array($items) OR count($items) == 0)
+                {
+                        log_message('error', 'The insert method must be passed an array containing data.');
+                        return FALSE;
+                }
+                                
+                // You can either insert a single product using a one-dimensional array, 
+                // or multiple products using a multi-dimensional one. The way we
+                // determine the array type is by looking for a required array key named &quot;id&quot;
+                // at the top level. If it's not found, we will assume it's a multi-dimensional array.
+        
+                $save_cart = FALSE;                
+                if (isset($items['id']))
+                {                        
+                        if ($this-&gt;_insert($items) == TRUE)
+                        {
+                                $save_cart = TRUE;
+                        }
+                }
+                else
+                {
+                        foreach ($items as $val)
+                        {
+                                if (is_array($val) AND isset($val['id']))
+                                {
+                                        if ($this-&gt;_insert($val) == TRUE)
+                                        {
+                                                $save_cart = TRUE;
+                                        }
+                                }                        
+                        }
+                }
+
+                // Save the cart data if the insert was successful
+                if ($save_cart == TRUE)
+                {
+                        $this-&gt;_save_cart();
+                        return TRUE;
+                }
+
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert
+         *
+         * @access        private
+         * @param        array
+         * @return        bool
+         */
+        function _insert($items = array())
+        {
+                // Was any cart data passed? No? Bah...
+                if ( ! is_array($items) OR count($items) == 0)
+                {
+                        log_message('error', 'The insert method must be passed an array containing data.');
+                        return FALSE;
+                }
+                
+                // --------------------------------------------------------------------
+        
+                // Does the $items array contain an id, quantity, price, and name?  These are required
+                if ( ! isset($items['id']) OR ! isset($items['qty']) OR ! isset($items['price']) OR ! isset($items['name']))
+                {
+                        log_message('error', 'The cart array must contain a product ID, quantity, price, and name.');
+                        return FALSE;
+                }
+
+                // --------------------------------------------------------------------
+        
+                // Prep the quantity. It can only be a number.  Duh...
+                $items['qty'] = trim(preg_replace('/([^0-9])/i', '', $items['qty']));
+                // Trim any leading zeros
+                $items['qty'] = trim(preg_replace('/(^[0]+)/i', '', $items['qty']));
+
+                // If the quantity is zero or blank there's nothing for us to do
+                if ( ! is_numeric($items['qty']) OR $items['qty'] == 0)
+                {
+                        return FALSE;
+                }
+                                
+                // --------------------------------------------------------------------
+        
+                // Validate the product ID. It can only be alpha-numeric, dashes, underscores or periods
+                // Not totally sure we should impose this rule, but it seems prudent to standardize IDs.
+                // Note: These can be user-specified by setting the $this-&gt;product_id_rules variable.
+                if ( ! preg_match(&quot;/^[&quot;.$this-&gt;product_id_rules.&quot;]+$/i&quot;, $items['id']))
+                {
+                        log_message('error', 'Invalid product ID.  The product ID can only contain alpha-numeric characters, dashes, and underscores');
+                        return FALSE;
+                }
+
+                // --------------------------------------------------------------------
+        
+                // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods.
+                // Note: These can be user-specified by setting the $this-&gt;product_name_rules variable.
+                if ( ! preg_match(&quot;/^[&quot;.$this-&gt;product_name_rules.&quot;]+$/i&quot;, $items['name']))
+                {
+                        log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces');
+                        return FALSE;
+                }
+
+                // --------------------------------------------------------------------
+
+                // Prep the price.  Remove anything that isn't a number or decimal point.
+                $items['price'] = trim(preg_replace('/([^0-9\.])/i', '', $items['price']));
+                // Trim any leading zeros
+                $items['price'] = trim(preg_replace('/(^[0]+)/i', '', $items['price']));
+                
+                // Is the price a valid number?
+                if ( ! is_numeric($items['price']))
+                {
+                        log_message('error', 'An invalid price was submitted for product ID: '.$items['id']);
+                        return FALSE;
+                }
+
+                // --------------------------------------------------------------------
+                
+                // We now need to create a unique identifier for the item being inserted into the cart.
+                // Every time something is added to the cart it is stored in the master cart array.  
+                // Each row in the cart array, however, must have a unique index that identifies not only 
+                // a particular product, but makes it possible to store identical products with different options.  
+                // For example, what if someone buys two identical t-shirts (same product ID), but in 
+                // different sizes?  The product ID (and other attributes, like the name) will be identical for 
+                // both sizes because it's the same shirt. The only difference will be the size.
+                // Internally, we need to treat identical submissions, but with different options, as a unique product.
+                // Our solution is to convert the options array to a string and MD5 it along with the product ID.
+                // This becomes the unique &quot;row ID&quot;
+                if (isset($items['options']) AND count($items['options']) &gt; 0)
+                {
+                        $rowid = md5($items['id'].implode('', $items['options']));
+                }
+                else
+                {
+                        // No options were submitted so we simply MD5 the product ID.
+                        // Technically, we don't need to MD5 the ID in this case, but it makes
+                        // sense to standardize the format of array indexes for both conditions
+                        $rowid = md5($items['id']);
+                }                
+
+                // --------------------------------------------------------------------
+
+                // Now that we have our unique &quot;row ID&quot;, we'll add our cart items to the master array
+                
+                // let's unset this first, just to make sure our index contains only the data from this submission
+                unset($this-&gt;_cart_contents[$rowid]);                
+                
+                // Create a new index with our new row ID
+                $this-&gt;_cart_contents[$rowid]['rowid'] = $rowid;
+        
+                // And add the new items to the cart array                        
+                foreach ($items as $key =&gt; $val)
+                {
+                        $this-&gt;_cart_contents[$rowid][$key] = $val;
+                }
+
+                // Woot!
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Update the cart
+         *
+         * This function permits the quantity of a given item to be changed. 
+         * Typically it is called from the &quot;view cart&quot; page if a user makes
+         * changes to the quantity before checkout. That array must contain the
+         * product ID and quantity for each item.
+         *
+         * @access        public
+         * @param        array
+         * @param        string
+         * @return        bool
+         */
+        function update($items = array())
+        {
+                // Was any cart data passed?
+                if ( ! is_array($items) OR count($items) == 0)
+                {
+                        return FALSE;
+                }
+                        
+                // You can either update a single product using a one-dimensional array, 
+                // or multiple products using a multi-dimensional one.  The way we
+                // determine the array type is by looking for a required array key named &quot;id&quot;.
+                // If it's not found we assume it's a multi-dimensional array
+                $save_cart = FALSE;
+                if (isset($items['rowid']) AND isset($items['qty']))
+                {
+                        if ($this-&gt;_update($items) == TRUE)
+                        {
+                                $save_cart = TRUE;
+                        }
+                }
+                else
+                {
+                        foreach ($items as $val)
+                        {
+                                if (is_array($val) AND isset($val['rowid']) AND isset($val['qty']))
+                                {
+                                        if ($this-&gt;_update($val) == TRUE)
+                                        {
+                                                $save_cart = TRUE;
+                                        }
+                                }                        
+                        }
+                }
+
+                // Save the cart data if the insert was successful
+                if ($save_cart == TRUE)
+                {
+                        $this-&gt;_save_cart();
+                        return TRUE;
+                }
+
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Update the cart
+         *
+         * This function permits the quantity of a given item to be changed. 
+         * Typically it is called from the &quot;view cart&quot; page if a user makes
+         * changes to the quantity before checkout. That array must contain the
+         * product ID and quantity for each item.
+         *
+         * @access        private
+         * @param        array
+         * @return        bool
+         */        
+        function _update($items = array())
+        {
+                // Without these array indexes there is nothing we can do
+                if ( ! isset($items['qty']) OR ! isset($items['rowid']) OR ! isset($this-&gt;_cart_contents[$items['rowid']]))
+                {
+                        return FALSE;
+                }
+                
+                // Prep the quantity
+                $items['qty'] = preg_replace('/([^0-9])/i', '', $items['qty']);
+
+                // Is the quantity a number?
+                if ( ! is_numeric($items['qty']))
+                {
+                        return FALSE;
+                }
+                
+                // Is the new quantity different than what is already saved in the cart?
+                // If it's the same there's nothing to do
+                if ($this-&gt;_cart_contents[$items['rowid']]['qty'] == $items['qty'])
+                {
+                        return FALSE;
+                }
+
+                // Is the quantity zero?  If so we will remove the item from the cart.
+                // If the quantity is greater than zero we are updating
+                if ($items['qty'] == 0)
+                {
+                        unset($this-&gt;_cart_contents[$items['rowid']]);                
+                }
+                else
+                {
+                        $this-&gt;_cart_contents[$items['rowid']]['qty'] = $items['qty'];
+                }
+                
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Save the cart array to the session DB
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _save_cart()
+        {
+                // Unset these so our total can be calculated correctly below
+                unset($this-&gt;_cart_contents['total_items']);
+                unset($this-&gt;_cart_contents['cart_total']);
+
+                // Lets add up the individual prices and set the cart sub-total
+                $total = 0;
+                foreach ($this-&gt;_cart_contents as $key =&gt; $val)
+                {
+                        // We make sure the array contains the proper indexes
+                        if ( ! is_array($val) OR ! isset($val['price']) OR ! isset($val['qty']))
+                        {
+                                continue;
+                        }
+
+                        $total += ($val['price'] * $val['qty']);
+                        
+                        // Set the subtotal
+                        $this-&gt;_cart_contents[$key]['subtotal'] = ($this-&gt;_cart_contents[$key]['price'] * $this-&gt;_cart_contents[$key]['qty']);
+                }
+
+                // Set the cart total and total items.
+                $this-&gt;_cart_contents['total_items'] = count($this-&gt;_cart_contents);                        
+                $this-&gt;_cart_contents['cart_total'] = $total;
+        
+                // Is our cart empty?  If so we delete it from the session
+                if (count($this-&gt;_cart_contents) &lt;= 2)
+                {
+                        $this-&gt;CI-&gt;session-&gt;unset_userdata('cart_contents');
+                        
+                        // Nothing more to do... coffee time!
+                        return FALSE;
+                }
+
+                // If we made it this far it means that our cart has data.
+                // Let's pass it to the Session class so it can be stored
+                $this-&gt;CI-&gt;session-&gt;set_userdata(array('cart_contents' =&gt; $this-&gt;_cart_contents));
+
+                // Woot!
+                return TRUE;        
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Cart Total
+         *
+         * @access        public
+         * @return        integer
+         */
+        function total()
+        {
+                return $this-&gt;_cart_contents['cart_total'];
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Total Items
+         *
+         * Returns the total item count
+         *
+         * @access        public
+         * @return        integer
+         */
+        function total_items()
+        {
+                return $this-&gt;_cart_contents['total_items'];
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Cart Contents
+         *
+         * Returns the entire cart array
+         *
+         * @access        public
+         * @return        array
+         */
+        function contents()
+        {
+                $cart = $this-&gt;_cart_contents;
+                
+                // Remove these so they don't create a problem when showing the cart table
+                unset($cart['total_items']);
+                unset($cart['cart_total']);
+        
+                return $cart;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Has options
+         *
+         * Returns TRUE if the rowid passed to this function correlates to an item
+         * that has options associated with it.
+         *
+         * @access        public
+         * @return        array
+         */
+        function has_options($rowid = '')
+        {
+                if ( ! isset($this-&gt;_cart_contents[$rowid]['options']) OR count($this-&gt;_cart_contents[$rowid]['options']) === 0)
+                {
+                        return FALSE;
+                }
+                
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Product options
+         *
+         * Returns the an array of options, for a particular product row ID
+         *
+         * @access        public
+         * @return        array
+         */
+        function product_options($rowid = '')
+        {
+                if ( ! isset($this-&gt;_cart_contents[$rowid]['options']))
+                {
+                        return array();
+                }
+
+                return $this-&gt;_cart_contents[$rowid]['options'];
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Format Number
+         *
+         * Returns the supplied number with commas and a decimal point.
+         *
+         * @access        public
+         * @return        integer
+         */
+        function format_number($n = '')
+        {
+                if ($n == '')
+                {
+                        return '';
+                }
+        
+                // Remove anything that isn't a number or decimal point.
+                $n = trim(preg_replace('/([^0-9\.])/i', '', $n));
+        
+                return number_format($n, 2, '.', ',');
+        }
+                
+        // --------------------------------------------------------------------
+        
+        /**
+         * Destroy the cart
+         *
+         * Empties the cart and kills the session
+         *
+         * @access        public
+         * @return        null
+         */
+        function destroy()
+        {
+                unset($this-&gt;_cart_contents);
+        
+                $this-&gt;_cart_contents['cart_total'] = 0;                
+                $this-&gt;_cart_contents['total_items'] = 0;                
+
+                $this-&gt;CI-&gt;session-&gt;unset_userdata('cart_contents');
+        }
+
+
+}
+// END Cart Class
+
+/* End of file Cart.php */
+/* Location: ./system/libraries/Cart.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesConfigphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Config.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Config.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Config.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,244 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Config Class
+ *
+ * This class contains functions that enable config files to be managed
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/config.html
+ */
+class CI_Config {
+
+        var $config = array();
+        var $is_loaded = array();
+
+        /**
+         * Constructor
+         *
+         * Sets the $config data from the primary config.php file as a class variable
+         *
+         * @access   public
+         * @param   string        the config file name
+         * @param   boolean  if configuration values should be loaded into their own section
+         * @param   boolean  true if errors should just return false, false if an error message should be displayed
+         * @return  boolean  if the file was successfully loaded or not
+         */
+        function CI_Config()
+        {
+                $this-&gt;config =&amp; get_config();
+                log_message('debug', &quot;Config Class Initialized&quot;);
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Load Config File
+         *
+         * @access        public
+         * @param        string        the config file name
+         * @return        boolean        if the file was loaded correctly
+         */        
+        function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
+        {
+                $file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
+        
+                if (in_array($file, $this-&gt;is_loaded, TRUE))
+                {
+                        return TRUE;
+                }
+
+                if ( ! file_exists(APPPATH.'config/'.$file.EXT))
+                {
+                        if ($fail_gracefully === TRUE)
+                        {
+                                return FALSE;
+                        }
+                        show_error('The configuration file '.$file.EXT.' does not exist.');
+                }
+        
+                include(APPPATH.'config/'.$file.EXT);
+
+                if ( ! isset($config) OR ! is_array($config))
+                {
+                        if ($fail_gracefully === TRUE)
+                        {
+                                return FALSE;
+                        }
+                        show_error('Your '.$file.EXT.' file does not appear to contain a valid configuration array.');
+                }
+
+                if ($use_sections === TRUE)
+                {
+                        if (isset($this-&gt;config[$file]))
+                        {
+                                $this-&gt;config[$file] = array_merge($this-&gt;config[$file], $config);
+                        }
+                        else
+                        {
+                                $this-&gt;config[$file] = $config;
+                        }
+                }
+                else
+                {
+                        $this-&gt;config = array_merge($this-&gt;config, $config);
+                }
+
+                $this-&gt;is_loaded[] = $file;
+                unset($config);
+
+                log_message('debug', 'Config file loaded: config/'.$file.EXT);
+                return TRUE;
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a config file item
+         *
+         *
+         * @access        public
+         * @param        string        the config item name
+         * @param        string        the index name
+         * @param        bool
+         * @return        string
+         */
+        function item($item, $index = '')
+        {        
+                if ($index == '')
+                {        
+                        if ( ! isset($this-&gt;config[$item]))
+                        {
+                                return FALSE;
+                        }
+
+                        $pref = $this-&gt;config[$item];
+                }
+                else
+                {
+                        if ( ! isset($this-&gt;config[$index]))
+                        {
+                                return FALSE;
+                        }
+
+                        if ( ! isset($this-&gt;config[$index][$item]))
+                        {
+                                return FALSE;
+                        }
+
+                        $pref = $this-&gt;config[$index][$item];
+                }
+
+                return $pref;
+        }
+          
+          // --------------------------------------------------------------------
+
+        /**
+         * Fetch a config file item - adds slash after item
+         *
+         * The second parameter allows a slash to be added to the end of
+         * the item, in the case of a path.
+         *
+         * @access        public
+         * @param        string        the config item name
+         * @param        bool
+         * @return        string
+         */
+        function slash_item($item)
+        {
+                if ( ! isset($this-&gt;config[$item]))
+                {
+                        return FALSE;
+                }
+
+                $pref = $this-&gt;config[$item];
+
+                if ($pref != '' &amp;&amp; substr($pref, -1) != '/')
+                {        
+                        $pref .= '/';
+                }
+
+                return $pref;
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Site URL
+         *
+         * @access        public
+         * @param        string        the URI string
+         * @return        string
+         */
+        function site_url($uri = '')
+        {
+                if (is_array($uri))
+                {
+                        $uri = implode('/', $uri);
+                }
+
+                if ($uri == '')
+                {
+                        return $this-&gt;slash_item('base_url').$this-&gt;item('index_page');
+                }
+                else
+                {
+                        $suffix = ($this-&gt;item('url_suffix') == FALSE) ? '' : $this-&gt;item('url_suffix');
+                        return $this-&gt;slash_item('base_url').$this-&gt;slash_item('index_page').preg_replace(&quot;|^/*(.+?)/*$|&quot;, &quot;\\1&quot;, $uri).$suffix;
+                }
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * System URL
+         *
+         * @access        public
+         * @return        string
+         */
+        function system_url()
+        {
+                $x = explode(&quot;/&quot;, preg_replace(&quot;|/*(.+?)/*$|&quot;, &quot;\\1&quot;, BASEPATH));
+                return $this-&gt;slash_item('base_url').end($x).'/';
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Set a config file item
+         *
+         * @access        public
+         * @param        string        the config item key
+         * @param        string        the config item value
+         * @return        void
+         */
+        function set_item($item, $value)
+        {
+                $this-&gt;config[$item] = $value;
+        }
+
+}
+
+// END CI_Config class
+
+/* End of file Config.php */
+/* Location: ./system/libraries/Config.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesControllerphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Controller.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Controller.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Controller.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,127 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Application Controller Class
+ *
+ * This class object is the super class that every library in
+ * CodeIgniter will be assigned to.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/general/controllers.html
+ */
+class Controller extends CI_Base {
+
+        var $_ci_scaffolding        = FALSE;
+        var $_ci_scaff_table        = FALSE;
+        
+        /**
+         * Constructor
+         *
+         * Calls the initialize() function
+         */
+        function Controller()
+        {        
+                parent::CI_Base();
+                $this-&gt;_ci_initialize();
+                log_message('debug', &quot;Controller Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize
+         *
+         * Assigns all the bases classes loaded by the front controller to
+         * variables in this class.  Also calls the autoload routine.
+         *
+         * @access        private
+         * @return        void
+         */
+        function _ci_initialize()
+        {
+                // Assign all the class objects that were instantiated by the
+                // front controller to local class variables so that CI can be
+                // run as one big super object.
+                $classes = array(
+                                                        'config'        =&gt; 'Config',
+                                                        'input'                =&gt; 'Input',
+                                                        'benchmark'        =&gt; 'Benchmark',
+                                                        'uri'                =&gt; 'URI',
+                                                        'output'        =&gt; 'Output',
+                                                        'lang'                =&gt; 'Language',
+                                                        'router'        =&gt; 'Router'
+                                                        );
+                
+                foreach ($classes as $var =&gt; $class)
+                {
+                        $this-&gt;$var =&amp; load_class($class);
+                }
+
+                // In PHP 5 the Loader class is run as a discreet
+                // class.  In PHP 4 it extends the Controller
+                if (floor(phpversion()) &gt;= 5)
+                {
+                        $this-&gt;load =&amp; load_class('Loader');
+                        $this-&gt;load-&gt;_ci_autoloader();
+                }
+                else
+                {
+                        $this-&gt;_ci_autoloader();
+                        
+                        // sync up the objects since PHP4 was working from a copy
+                        foreach (array_keys(get_object_vars($this)) as $attribute)
+                        {
+                                if (is_object($this-&gt;$attribute))
+                                {
+                                        $this-&gt;load-&gt;$attribute =&amp; $this-&gt;$attribute;
+                                }
+                        }
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Run Scaffolding
+         *
+         * @access        private
+         * @return        void
+         */        
+        function _ci_scaffolding()
+        {
+                if ($this-&gt;_ci_scaffolding === FALSE OR $this-&gt;_ci_scaff_table === FALSE)
+                {
+                        show_404('Scaffolding unavailable');
+                }
+                
+                $method = ( ! in_array($this-&gt;uri-&gt;segment(3), array('add', 'insert', 'edit', 'update', 'view', 'delete', 'do_delete'), TRUE)) ? 'view' : $this-&gt;uri-&gt;segment(3);
+                
+                require_once(BASEPATH.'scaffolding/Scaffolding'.EXT);
+                $scaff = new Scaffolding($this-&gt;_ci_scaff_table);
+                $scaff-&gt;$method();
+        }
+
+
+}
+// END _Controller class
+
+/* End of file Controller.php */
+/* Location: ./system/libraries/Controller.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesEmailphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Email.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Email.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Email.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,2041 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Email Class
+ *
+ * Permits email to be sent using Mail, Sendmail, or SMTP.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/email.html
+ */
+class CI_Email {
+
+        var        $useragent                = &quot;CodeIgniter&quot;;
+        var        $mailpath                = &quot;/usr/sbin/sendmail&quot;;        // Sendmail path
+        var        $protocol                = &quot;mail&quot;;        // mail/sendmail/smtp
+        var        $smtp_host                = &quot;&quot;;                // SMTP Server.  Example: mail.earthlink.net
+        var        $smtp_user                = &quot;&quot;;                // SMTP Username
+        var        $smtp_pass                = &quot;&quot;;                // SMTP Password
+        var        $smtp_port                = &quot;25&quot;;                // SMTP Port
+        var        $smtp_timeout        = 5;                // SMTP Timeout in seconds
+        var        $wordwrap                = TRUE;                // TRUE/FALSE  Turns word-wrap on/off
+        var        $wrapchars                = &quot;76&quot;;                // Number of characters to wrap at.
+        var        $mailtype                = &quot;text&quot;;        // text/html  Defines email formatting
+        var        $charset                = &quot;utf-8&quot;;        // Default char set: iso-8859-1 or us-ascii
+        var        $multipart                = &quot;mixed&quot;;        // &quot;mixed&quot; (in the body) or &quot;related&quot; (separate)
+        var $alt_message        = '';                // Alternative message for HTML emails
+        var        $validate                = FALSE;        // TRUE/FALSE.  Enables email validation
+        var        $priority                = &quot;3&quot;;                // Default priority (1 - 5)
+        var        $newline                = &quot;\n&quot;;                // Default newline. &quot;\r\n&quot; or &quot;\n&quot; (Use &quot;\r\n&quot; to comply with RFC 822)
+        var $crlf                        = &quot;\n&quot;;                // The RFC 2045 compliant CRLF for quoted-printable is &quot;\r\n&quot;.  Apparently some servers,
+                                                                        // even on the receiving end think they need to muck with CRLFs, so using &quot;\n&quot;, while
+                                                                        // distasteful, is the only thing that seems to work for all environments.
+        var $send_multipart        = TRUE;                // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override.  Set to FALSE for Yahoo.
+        var        $bcc_batch_mode        = FALSE;        // TRUE/FALSE  Turns on/off Bcc batch feature
+        var        $bcc_batch_size        = 200;                // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
+        var $_safe_mode                = FALSE;
+        var        $_subject                = &quot;&quot;;
+        var        $_body                        = &quot;&quot;;
+        var        $_finalbody                = &quot;&quot;;
+        var        $_alt_boundary        = &quot;&quot;;
+        var        $_atc_boundary        = &quot;&quot;;
+        var        $_header_str        = &quot;&quot;;
+        var        $_smtp_connect        = &quot;&quot;;
+        var        $_encoding                = &quot;8bit&quot;;
+        var $_IP                        = FALSE;
+        var        $_smtp_auth                = FALSE;
+        var $_replyto_flag        = FALSE;
+        var        $_debug_msg                = array();
+        var        $_recipients        = array();
+        var        $_cc_array                = array();
+        var        $_bcc_array                = array();
+        var        $_headers                = array();
+        var        $_attach_name        = array();
+        var        $_attach_type        = array();
+        var        $_attach_disp        = array();
+        var        $_protocols                = array('mail', 'sendmail', 'smtp');
+        var        $_base_charsets        = array('us-ascii', 'iso-2022-');        // 7-bit charsets (excluding language suffix)
+        var        $_bit_depths        = array('7bit', '8bit');
+        var        $_priorities        = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
+
+
+        /**
+         * Constructor - Sets Email Preferences
+         *
+         * The constructor can be passed an array of config values
+         */
+        function CI_Email($config = array())
+        {
+                if (count($config) &gt; 0)
+                {
+                        $this-&gt;initialize($config);
+                }
+                else
+                {
+                        $this-&gt;_smtp_auth = ($this-&gt;smtp_user == '' AND $this-&gt;smtp_pass == '') ? FALSE : TRUE;
+                        $this-&gt;_safe_mode = ((boolean)@ini_get(&quot;safe_mode&quot;) === FALSE) ? FALSE : TRUE;
+                }
+
+                log_message('debug', &quot;Email Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize preferences
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function initialize($config = array())
+        {
+                $this-&gt;clear();
+                foreach ($config as $key =&gt; $val)
+                {
+                        if (isset($this-&gt;$key))
+                        {
+                                $method = 'set_'.$key;
+
+                                if (method_exists($this, $method))
+                                {
+                                        $this-&gt;$method($val);
+                                }
+                                else
+                                {
+                                        $this-&gt;$key = $val;
+                                }
+                        }
+                }
+
+                $this-&gt;_smtp_auth = ($this-&gt;smtp_user == '' AND $this-&gt;smtp_pass == '') ? FALSE : TRUE;
+                $this-&gt;_safe_mode = ((boolean)@ini_get(&quot;safe_mode&quot;) === FALSE) ? FALSE : TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize the Email Data
+         *
+         * @access        public
+         * @return        void
+         */
+        function clear($clear_attachments = FALSE)
+        {
+                $this-&gt;_subject                = &quot;&quot;;
+                $this-&gt;_body                = &quot;&quot;;
+                $this-&gt;_finalbody        = &quot;&quot;;
+                $this-&gt;_header_str        = &quot;&quot;;
+                $this-&gt;_replyto_flag = FALSE;
+                $this-&gt;_recipients        = array();
+                $this-&gt;_headers                = array();
+                $this-&gt;_debug_msg        = array();
+
+                $this-&gt;_set_header('User-Agent', $this-&gt;useragent);
+                $this-&gt;_set_header('Date', $this-&gt;_set_date());
+
+                if ($clear_attachments !== FALSE)
+                {
+                        $this-&gt;_attach_name = array();
+                        $this-&gt;_attach_type = array();
+                        $this-&gt;_attach_disp = array();
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set FROM
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        void
+         */
+        function from($from, $name = '')
+        {
+                if (preg_match( '/\&lt;(.*)\&gt;/', $from, $match))
+                {
+                        $from = $match['1'];
+                }
+
+                if ($this-&gt;validate)
+                {
+                        $this-&gt;validate_email($this-&gt;_str_to_array($from));
+                }
+
+                // prepare the display name
+                if ($name != '')
+                {
+                        // only use Q encoding if there are characters that would require it
+                        if ( ! preg_match('/[\200-\377]/', $name))
+                        {
+                                // add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes
+                                $name = '&quot;'.addcslashes($name, &quot;\0..\37\177'\&quot;\\&quot;).'&quot;';
+                        }
+                        else
+                        {
+                                $name = $this-&gt;_prep_q_encoding($name, TRUE);
+                        }
+                }
+
+                $this-&gt;_set_header('From', $name.' &lt;'.$from.'&gt;');
+                $this-&gt;_set_header('Return-Path', '&lt;'.$from.'&gt;');
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Reply-to
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        void
+         */
+        function reply_to($replyto, $name = '')
+        {
+                if (preg_match( '/\&lt;(.*)\&gt;/', $replyto, $match))
+                {
+                        $replyto = $match['1'];
+                }
+
+                if ($this-&gt;validate)
+                {
+                        $this-&gt;validate_email($this-&gt;_str_to_array($replyto));
+                }
+
+                if ($name == '')
+                {
+                        $name = $replyto;
+                }
+
+                if (strncmp($name, '&quot;', 1) != 0)
+                {
+                        $name = '&quot;'.$name.'&quot;';
+                }
+
+                $this-&gt;_set_header('Reply-To', $name.' &lt;'.$replyto.'&gt;');
+                $this-&gt;_replyto_flag = TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Recipients
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function to($to)
+        {
+                $to = $this-&gt;_str_to_array($to);
+                $to = $this-&gt;clean_email($to);
+
+                if ($this-&gt;validate)
+                {
+                        $this-&gt;validate_email($to);
+                }
+
+                if ($this-&gt;_get_protocol() != 'mail')
+                {
+                        $this-&gt;_set_header('To', implode(&quot;, &quot;, $to));
+                }
+
+                switch ($this-&gt;_get_protocol())
+                {
+                        case 'smtp'                : $this-&gt;_recipients = $to;
+                        break;
+                        case 'sendmail'        : $this-&gt;_recipients = implode(&quot;, &quot;, $to);
+                        break;
+                        case 'mail'                : $this-&gt;_recipients = implode(&quot;, &quot;, $to);
+                        break;
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set CC
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function cc($cc)
+        {
+                $cc = $this-&gt;_str_to_array($cc);
+                $cc = $this-&gt;clean_email($cc);
+
+                if ($this-&gt;validate)
+                {
+                        $this-&gt;validate_email($cc);
+                }
+
+                $this-&gt;_set_header('Cc', implode(&quot;, &quot;, $cc));
+
+                if ($this-&gt;_get_protocol() == &quot;smtp&quot;)
+                {
+                        $this-&gt;_cc_array = $cc;
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set BCC
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        void
+         */
+        function bcc($bcc, $limit = '')
+        {
+                if ($limit != '' &amp;&amp; is_numeric($limit))
+                {
+                        $this-&gt;bcc_batch_mode = TRUE;
+                        $this-&gt;bcc_batch_size = $limit;
+                }
+
+                $bcc = $this-&gt;_str_to_array($bcc);
+                $bcc = $this-&gt;clean_email($bcc);
+
+                if ($this-&gt;validate)
+                {
+                        $this-&gt;validate_email($bcc);
+                }
+
+                if (($this-&gt;_get_protocol() == &quot;smtp&quot;) OR ($this-&gt;bcc_batch_mode &amp;&amp; count($bcc) &gt; $this-&gt;bcc_batch_size))
+                {
+                        $this-&gt;_bcc_array = $bcc;
+                }
+                else
+                {
+                        $this-&gt;_set_header('Bcc', implode(&quot;, &quot;, $bcc));
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Email Subject
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function subject($subject)
+        {
+                $subject = $this-&gt;_prep_q_encoding($subject);
+                $this-&gt;_set_header('Subject', $subject);
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Body
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function message($body)
+        {
+                $this-&gt;_body = stripslashes(rtrim(str_replace(&quot;\r&quot;, &quot;&quot;, $body)));
+        }

+        // --------------------------------------------------------------------
+
+        /**
+         * Assign file attachments
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function attach($filename, $disposition = 'attachment')
+        {
+                $this-&gt;_attach_name[] = $filename;
+                $this-&gt;_attach_type[] = $this-&gt;_mime_types(next(explode('.', basename($filename))));
+                $this-&gt;_attach_disp[] = $disposition; // Can also be 'inline'  Not sure if it matters
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add a Header Item
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        void
+         */
+        function _set_header($header, $value)
+        {
+                $this-&gt;_headers[$header] = $value;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Convert a String to an Array
+         *
+         * @access        private
+         * @param        string
+         * @return        array
+         */
+        function _str_to_array($email)
+        {
+                if ( ! is_array($email))
+                {
+                        if (strpos($email, ',') !== FALSE)
+                        {
+                                $email = preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY);
+                        }
+                        else
+                        {
+                                $email = trim($email);
+                                settype($email, &quot;array&quot;);
+                        }
+                }
+                return $email;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Multipart Value
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_alt_message($str = '')
+        {
+                $this-&gt;alt_message = ($str == '') ? '' : $str;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Mailtype
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_mailtype($type = 'text')
+        {
+                $this-&gt;mailtype = ($type == 'html') ? 'html' : 'text';
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Wordwrap
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_wordwrap($wordwrap = TRUE)
+        {
+                $this-&gt;wordwrap = ($wordwrap === FALSE) ? FALSE : TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Protocol
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_protocol($protocol = 'mail')
+        {
+                $this-&gt;protocol = ( ! in_array($protocol, $this-&gt;_protocols, TRUE)) ? 'mail' : strtolower($protocol);
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Priority
+         *
+         * @access        public
+         * @param        integer
+         * @return        void
+         */
+        function set_priority($n = 3)
+        {
+                if ( ! is_numeric($n))
+                {
+                        $this-&gt;priority = 3;
+                        return;
+                }
+
+                if ($n &lt; 1 OR $n &gt; 5)
+                {
+                        $this-&gt;priority = 3;
+                        return;
+                }
+
+                $this-&gt;priority = $n;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Newline Character
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_newline($newline = &quot;\n&quot;)
+        {
+                if ($newline != &quot;\n&quot; AND $newline != &quot;\r\n&quot; AND $newline != &quot;\r&quot;)
+                {
+                        $this-&gt;newline        = &quot;\n&quot;;
+                        return;
+                }
+
+                $this-&gt;newline        = $newline;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set CRLF
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_crlf($crlf = &quot;\n&quot;)
+        {
+                if ($crlf != &quot;\n&quot; AND $crlf != &quot;\r\n&quot; AND $crlf != &quot;\r&quot;)
+                {
+                        $this-&gt;crlf        = &quot;\n&quot;;
+                        return;
+                }
+
+                $this-&gt;crlf        = $crlf;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Message Boundary
+         *
+         * @access        private
+         * @return        void
+         */
+        function _set_boundaries()
+        {
+                $this-&gt;_alt_boundary = &quot;B_ALT_&quot;.uniqid(''); // multipart/alternative
+                $this-&gt;_atc_boundary = &quot;B_ATC_&quot;.uniqid(''); // attachment boundary
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Get the Message ID
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_message_id()
+        {
+                $from = $this-&gt;_headers['Return-Path'];
+                $from = str_replace(&quot;&gt;&quot;, &quot;&quot;, $from);
+                $from = str_replace(&quot;&lt;&quot;, &quot;&quot;, $from);
+
+                return  &quot;&lt;&quot;.uniqid('').strstr($from, '@').&quot;&gt;&quot;;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Mail Protocol
+         *
+         * @access        private
+         * @param        bool
+         * @return        string
+         */
+        function _get_protocol($return = TRUE)
+        {
+                $this-&gt;protocol = strtolower($this-&gt;protocol);
+                $this-&gt;protocol = ( ! in_array($this-&gt;protocol, $this-&gt;_protocols, TRUE)) ? 'mail' : $this-&gt;protocol;
+
+                if ($return == TRUE)
+                {
+                        return $this-&gt;protocol;
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Mail Encoding
+         *
+         * @access        private
+         * @param        bool
+         * @return        string
+         */
+        function _get_encoding($return = TRUE)
+        {
+                $this-&gt;_encoding = ( ! in_array($this-&gt;_encoding, $this-&gt;_bit_depths)) ? '8bit' : $this-&gt;_encoding;
+
+                foreach ($this-&gt;_base_charsets as $charset)
+                {
+                        if (strncmp($charset, $this-&gt;charset, strlen($charset)) == 0)
+                        {
+                                $this-&gt;_encoding = '7bit';
+                        }
+                }
+
+                if ($return == TRUE)
+                {
+                        return $this-&gt;_encoding;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get content type (text/html/attachment)
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_content_type()
+        {
+                if        ($this-&gt;mailtype == 'html' &amp;&amp;  count($this-&gt;_attach_name) == 0)
+                {
+                        return 'html';
+                }
+                elseif        ($this-&gt;mailtype == 'html' &amp;&amp;  count($this-&gt;_attach_name)  &gt; 0)
+                {
+                        return 'html-attach';
+                }
+                elseif        ($this-&gt;mailtype == 'text' &amp;&amp;  count($this-&gt;_attach_name)  &gt; 0)
+                {
+                        return 'plain-attach';
+                }
+                else
+                {
+                        return 'plain';
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set RFC 822 Date
+         *
+         * @access        private
+         * @return        string
+         */
+        function _set_date()
+        {
+                $timezone = date(&quot;Z&quot;);
+                $operator = (strncmp($timezone, '-', 1) == 0) ? '-' : '+';
+                $timezone = abs($timezone);
+                $timezone = floor($timezone/3600) * 100 + ($timezone % 3600 ) / 60;
+
+                return sprintf(&quot;%s %s%04d&quot;, date(&quot;D, j M Y H:i:s&quot;), $operator, $timezone);
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Mime message
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_mime_message()
+        {
+                return &quot;This is a multi-part message in MIME format.&quot;.$this-&gt;newline.&quot;Your email application may not support this format.&quot;;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Validate Email Address
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function validate_email($email)
+        {
+                if ( ! is_array($email))
+                {
+                        $this-&gt;_set_error_message('email_must_be_array');
+                        return FALSE;
+                }
+
+                foreach ($email as $val)
+                {
+                        if ( ! $this-&gt;valid_email($val))
+                        {
+                                $this-&gt;_set_error_message('email_invalid_address', $val);
+                                return FALSE;
+                        }
+                }
+
+                return TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Email Validation
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function valid_email($address)
+        {
+                return ( ! preg_match(&quot;/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix&quot;, $address)) ? FALSE : TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Clean Extended Email Address: Joe Smith &lt;joe@smith.com&gt;
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function clean_email($email)
+        {
+                if ( ! is_array($email))
+                {
+                        if (preg_match('/\&lt;(.*)\&gt;/', $email, $match))
+                        {
+                                   return $match['1'];
+                        }
+                           else
+                        {
+                                   return $email;
+                        }
+                }
+
+                $clean_email = array();
+
+                foreach ($email as $addy)
+                {
+                        if (preg_match( '/\&lt;(.*)\&gt;/', $addy, $match))
+                        {
+                                   $clean_email[] = $match['1'];
+                        }
+                           else
+                        {
+                                   $clean_email[] = $addy;
+                        }
+                }
+
+                return $clean_email;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Build alternative plain text message
+         *
+         * This function provides the raw message for use
+         * in plain-text headers of HTML-formatted emails.
+         * If the user hasn't specified his own alternative message
+         * it creates one by stripping the HTML
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_alt_message()
+        {
+                if ($this-&gt;alt_message != &quot;&quot;)
+                {
+                        return $this-&gt;word_wrap($this-&gt;alt_message, '76');
+                }
+
+                if (preg_match('/\&lt;body.*?\&gt;(.*)\&lt;\/body\&gt;/si', $this-&gt;_body, $match))
+                {
+                        $body = $match['1'];
+                }
+                else
+                {
+                        $body = $this-&gt;_body;
+                }
+
+                $body = trim(strip_tags($body));
+                $body = preg_replace( '#&lt;!--(.*)--\&gt;#', &quot;&quot;, $body);
+                $body = str_replace(&quot;\t&quot;, &quot;&quot;, $body);
+
+                for ($i = 20; $i &gt;= 3; $i--)
+                {
+                        $n = &quot;&quot;;
+
+                        for ($x = 1; $x &lt;= $i; $x ++)
+                        {
+                                 $n .= &quot;\n&quot;;
+                        }
+
+                        $body = str_replace($n, &quot;\n\n&quot;, $body);
+                }
+
+                return $this-&gt;word_wrap($body, '76');
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Word Wrap
+         *
+         * @access        public
+         * @param        string
+         * @param        integer
+         * @return        string
+         */
+        function word_wrap($str, $charlim = '')
+        {
+                // Se the character limit
+                if ($charlim == '')
+                {
+                        $charlim = ($this-&gt;wrapchars == &quot;&quot;) ? &quot;76&quot; : $this-&gt;wrapchars;
+                }
+
+                // Reduce multiple spaces
+                $str = preg_replace(&quot;| +|&quot;, &quot; &quot;, $str);
+
+                // Standardize newlines
+                if (strpos($str, &quot;\r&quot;) !== FALSE)
+                {
+                        $str = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;), &quot;\n&quot;, $str);
+                }
+
+                // If the current word is surrounded by {unwrap} tags we'll
+                // strip the entire chunk and replace it with a marker.
+                $unwrap = array();
+                if (preg_match_all(&quot;|(\{unwrap\}.+?\{/unwrap\})|s&quot;, $str, $matches))
+                {
+                        for ($i = 0; $i &lt; count($matches['0']); $i++)
+                        {
+                                $unwrap[] = $matches['1'][$i];
+                                $str = str_replace($matches['1'][$i], &quot;{{unwrapped&quot;.$i.&quot;}}&quot;, $str);
+                        }
+                }
+
+                // Use PHP's native function to do the initial wordwrap.
+                // We set the cut flag to FALSE so that any individual words that are
+                // too long get left alone.  In the next step we'll deal with them.
+                $str = wordwrap($str, $charlim, &quot;\n&quot;, FALSE);
+
+                // Split the string into individual lines of text and cycle through them
+                $output = &quot;&quot;;
+                foreach (explode(&quot;\n&quot;, $str) as $line)
+                {
+                        // Is the line within the allowed character count?
+                        // If so we'll join it to the output and continue
+                        if (strlen($line) &lt;= $charlim)
+                        {
+                                $output .= $line.$this-&gt;newline;
+                                continue;
+                        }
+
+                        $temp = '';
+                        while((strlen($line)) &gt; $charlim)
+                        {
+                                // If the over-length word is a URL we won't wrap it
+                                if (preg_match(&quot;!\[url.+\]|://|wwww.!&quot;, $line))
+                                {
+                                        break;
+                                }
+
+                                // Trim the word down
+                                $temp .= substr($line, 0, $charlim-1);
+                                $line = substr($line, $charlim-1);
+                        }
+
+                        // If $temp contains data it means we had to split up an over-length
+                        // word into smaller chunks so we'll add it back to our current line
+                        if ($temp != '')
+                        {
+                                $output .= $temp.$this-&gt;newline.$line;
+                        }
+                        else
+                        {
+                                $output .= $line;
+                        }
+
+                        $output .= $this-&gt;newline;
+                }
+
+                // Put our markers back
+                if (count($unwrap) &gt; 0)
+                {
+                        foreach ($unwrap as $key =&gt; $val)
+                        {
+                                $output = str_replace(&quot;{{unwrapped&quot;.$key.&quot;}}&quot;, $val, $output);
+                        }
+                }
+
+                return $output;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Build final headers
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _build_headers()
+        {
+                $this-&gt;_set_header('X-Sender', $this-&gt;clean_email($this-&gt;_headers['From']));
+                $this-&gt;_set_header('X-Mailer', $this-&gt;useragent);
+                $this-&gt;_set_header('X-Priority', $this-&gt;_priorities[$this-&gt;priority - 1]);
+                $this-&gt;_set_header('Message-ID', $this-&gt;_get_message_id());
+                $this-&gt;_set_header('Mime-Version', '1.0');
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Write Headers as a string
+         *
+         * @access        private
+         * @return        void
+         */
+        function _write_headers()
+        {
+                if ($this-&gt;protocol == 'mail')
+                {
+                        $this-&gt;_subject = $this-&gt;_headers['Subject'];
+                        unset($this-&gt;_headers['Subject']);
+                }
+
+                reset($this-&gt;_headers);
+                $this-&gt;_header_str = &quot;&quot;;
+
+                foreach($this-&gt;_headers as $key =&gt; $val)
+                {
+                        $val = trim($val);
+
+                        if ($val != &quot;&quot;)
+                        {
+                                $this-&gt;_header_str .= $key.&quot;: &quot;.$val.$this-&gt;newline;
+                        }
+                }
+
+                if ($this-&gt;_get_protocol() == 'mail')
+                {
+                        $this-&gt;_header_str = rtrim($this-&gt;_header_str);
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Build Final Body and attachments
+         *
+         * @access        private
+         * @return        void
+         */
+        function _build_message()
+        {
+                if ($this-&gt;wordwrap === TRUE  AND  $this-&gt;mailtype != 'html')
+                {
+                        $this-&gt;_body = $this-&gt;word_wrap($this-&gt;_body);
+                }
+
+                $this-&gt;_set_boundaries();
+                $this-&gt;_write_headers();
+
+                $hdr = ($this-&gt;_get_protocol() == 'mail') ? $this-&gt;newline : '';
+
+                switch ($this-&gt;_get_content_type())
+                {
+                        case 'plain' :
+
+                                $hdr .= &quot;Content-Type: text/plain; charset=&quot; . $this-&gt;charset . $this-&gt;newline;
+                                $hdr .= &quot;Content-Transfer-Encoding: &quot; . $this-&gt;_get_encoding();
+
+                                if ($this-&gt;_get_protocol() == 'mail')
+                                {
+                                        $this-&gt;_header_str .= $hdr;
+                                        $this-&gt;_finalbody = $this-&gt;_body;
+
+                                        return;
+                                }
+
+                                $hdr .= $this-&gt;newline . $this-&gt;newline . $this-&gt;_body;
+
+                                $this-&gt;_finalbody = $hdr;
+                                return;
+
+                        break;
+                        case 'html' :
+
+                                if ($this-&gt;send_multipart === FALSE)
+                                {
+                                        $hdr .= &quot;Content-Type: text/html; charset=&quot; . $this-&gt;charset . $this-&gt;newline;
+                                        $hdr .= &quot;Content-Transfer-Encoding: quoted-printable&quot;;
+                                }
+                                else
+                                {
+                                        $hdr .= &quot;Content-Type: multipart/alternative; boundary=\&quot;&quot; . $this-&gt;_alt_boundary . &quot;\&quot;&quot; . $this-&gt;newline . $this-&gt;newline;
+                                        $hdr .= $this-&gt;_get_mime_message() . $this-&gt;newline . $this-&gt;newline;
+                                        $hdr .= &quot;--&quot; . $this-&gt;_alt_boundary . $this-&gt;newline;
+
+                                        $hdr .= &quot;Content-Type: text/plain; charset=&quot; . $this-&gt;charset . $this-&gt;newline;
+                                        $hdr .= &quot;Content-Transfer-Encoding: &quot; . $this-&gt;_get_encoding() . $this-&gt;newline . $this-&gt;newline;
+                                        $hdr .= $this-&gt;_get_alt_message() . $this-&gt;newline . $this-&gt;newline . &quot;--&quot; . $this-&gt;_alt_boundary . $this-&gt;newline;
+
+                                        $hdr .= &quot;Content-Type: text/html; charset=&quot; . $this-&gt;charset . $this-&gt;newline;
+                                        $hdr .= &quot;Content-Transfer-Encoding: quoted-printable&quot;;
+                                }
+
+                                $this-&gt;_body = $this-&gt;_prep_quoted_printable($this-&gt;_body);
+
+                                if ($this-&gt;_get_protocol() == 'mail')
+                                {
+                                        $this-&gt;_header_str .= $hdr;
+                                        $this-&gt;_finalbody = $this-&gt;_body . $this-&gt;newline . $this-&gt;newline;
+
+                                        if ($this-&gt;send_multipart !== FALSE)
+                                        {
+                                                $this-&gt;_finalbody .= &quot;--&quot; . $this-&gt;_alt_boundary . &quot;--&quot;;
+                                        }
+
+                                        return;
+                                }
+
+                                $hdr .= $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= $this-&gt;_body . $this-&gt;newline . $this-&gt;newline;
+
+                                if ($this-&gt;send_multipart !== FALSE)
+                                {
+                                        $hdr .= &quot;--&quot; . $this-&gt;_alt_boundary . &quot;--&quot;;
+                                }
+
+                                $this-&gt;_finalbody = $hdr;
+                                return;
+
+                        break;
+                        case 'plain-attach' :
+
+                                $hdr .= &quot;Content-Type: multipart/&quot;.$this-&gt;multipart.&quot;; boundary=\&quot;&quot; . $this-&gt;_atc_boundary.&quot;\&quot;&quot; . $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= $this-&gt;_get_mime_message() . $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= &quot;--&quot; . $this-&gt;_atc_boundary . $this-&gt;newline;
+
+                                $hdr .= &quot;Content-Type: text/plain; charset=&quot; . $this-&gt;charset . $this-&gt;newline;
+                                $hdr .= &quot;Content-Transfer-Encoding: &quot; . $this-&gt;_get_encoding();
+
+                                if ($this-&gt;_get_protocol() == 'mail')
+                                {
+                                        $this-&gt;_header_str .= $hdr;
+
+                                        $body  = $this-&gt;_body . $this-&gt;newline . $this-&gt;newline;
+                                }
+
+                                $hdr .= $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= $this-&gt;_body . $this-&gt;newline . $this-&gt;newline;
+
+                        break;
+                        case 'html-attach' :
+
+                                $hdr .= &quot;Content-Type: multipart/&quot;.$this-&gt;multipart.&quot;; boundary=\&quot;&quot; . $this-&gt;_atc_boundary.&quot;\&quot;&quot; . $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= $this-&gt;_get_mime_message() . $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= &quot;--&quot; . $this-&gt;_atc_boundary . $this-&gt;newline;
+
+                                $hdr .= &quot;Content-Type: multipart/alternative; boundary=\&quot;&quot; . $this-&gt;_alt_boundary . &quot;\&quot;&quot; . $this-&gt;newline .$this-&gt;newline;
+                                $hdr .= &quot;--&quot; . $this-&gt;_alt_boundary . $this-&gt;newline;
+
+                                $hdr .= &quot;Content-Type: text/plain; charset=&quot; . $this-&gt;charset . $this-&gt;newline;
+                                $hdr .= &quot;Content-Transfer-Encoding: &quot; . $this-&gt;_get_encoding() . $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= $this-&gt;_get_alt_message() . $this-&gt;newline . $this-&gt;newline . &quot;--&quot; . $this-&gt;_alt_boundary . $this-&gt;newline;
+
+                                $hdr .= &quot;Content-Type: text/html; charset=&quot; . $this-&gt;charset . $this-&gt;newline;
+                                $hdr .= &quot;Content-Transfer-Encoding: quoted-printable&quot;;
+
+                                $this-&gt;_body = $this-&gt;_prep_quoted_printable($this-&gt;_body);
+
+                                if ($this-&gt;_get_protocol() == 'mail')
+                                {
+                                        $this-&gt;_header_str .= $hdr;
+
+                                        $body  = $this-&gt;_body . $this-&gt;newline . $this-&gt;newline;
+                                        $body .= &quot;--&quot; . $this-&gt;_alt_boundary . &quot;--&quot; . $this-&gt;newline . $this-&gt;newline;
+                                }
+
+                                $hdr .= $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= $this-&gt;_body . $this-&gt;newline . $this-&gt;newline;
+                                $hdr .= &quot;--&quot; . $this-&gt;_alt_boundary . &quot;--&quot; . $this-&gt;newline . $this-&gt;newline;
+
+                        break;
+                }
+
+                $attachment = array();
+
+                $z = 0;
+
+                for ($i=0; $i &lt; count($this-&gt;_attach_name); $i++)
+                {
+                        $filename = $this-&gt;_attach_name[$i];
+                        $basename = basename($filename);
+                        $ctype = $this-&gt;_attach_type[$i];
+
+                        if ( ! file_exists($filename))
+                        {
+                                $this-&gt;_set_error_message('email_attachment_missing', $filename);
+                                return FALSE;
+                        }
+
+                        $h  = &quot;--&quot;.$this-&gt;_atc_boundary.$this-&gt;newline;
+                        $h .= &quot;Content-type: &quot;.$ctype.&quot;; &quot;;
+                        $h .= &quot;name=\&quot;&quot;.$basename.&quot;\&quot;&quot;.$this-&gt;newline;
+                        $h .= &quot;Content-Disposition: &quot;.$this-&gt;_attach_disp[$i].&quot;;&quot;.$this-&gt;newline;
+                        $h .= &quot;Content-Transfer-Encoding: base64&quot;.$this-&gt;newline;
+
+                        $attachment[$z++] = $h;
+                        $file = filesize($filename) +1;
+
+                        if ( ! $fp = fopen($filename, FOPEN_READ))
+                        {
+                                $this-&gt;_set_error_message('email_attachment_unreadable', $filename);
+                                return FALSE;
+                        }
+
+                        $attachment[$z++] = chunk_split(base64_encode(fread($fp, $file)));
+                        fclose($fp);
+                }
+
+                if ($this-&gt;_get_protocol() == 'mail')
+                {
+                        $this-&gt;_finalbody = $body . implode($this-&gt;newline, $attachment).$this-&gt;newline.&quot;--&quot;.$this-&gt;_atc_boundary.&quot;--&quot;;
+
+                        return;
+                }
+
+                $this-&gt;_finalbody = $hdr.implode($this-&gt;newline, $attachment).$this-&gt;newline.&quot;--&quot;.$this-&gt;_atc_boundary.&quot;--&quot;;
+
+                return;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Prep Quoted Printable
+         *
+         * Prepares string for Quoted-Printable Content-Transfer-Encoding
+         * Refer to RFC 2045 http://www.ietf.org/rfc/rfc2045.txt
+         *
+         * @access        private
+         * @param        string
+         * @param        integer
+         * @return        string
+         */
+        function _prep_quoted_printable($str, $charlim = '')
+        {
+                // Set the character limit
+                // Don't allow over 76, as that will make servers and MUAs barf
+                // all over quoted-printable data
+                if ($charlim == '' OR $charlim &gt; '76')
+                {
+                        $charlim = '76';
+                }
+
+                // Reduce multiple spaces
+                $str = preg_replace(&quot;| +|&quot;, &quot; &quot;, $str);
+
+                // kill nulls
+                $str = preg_replace('/\x00+/', '', $str);
+
+                // Standardize newlines
+                if (strpos($str, &quot;\r&quot;) !== FALSE)
+                {
+                        $str = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;), &quot;\n&quot;, $str);
+                }
+
+                // We are intentionally wrapping so mail servers will encode characters
+                // properly and MUAs will behave, so {unwrap} must go!
+                $str = str_replace(array('{unwrap}', '{/unwrap}'), '', $str);
+
+                // Break into an array of lines
+                $lines = explode(&quot;\n&quot;, $str);
+
+                $escape = '=';
+                $output = '';
+
+                foreach ($lines as $line)
+                {
+                        $length = strlen($line);
+                        $temp = '';
+
+                        // Loop through each character in the line to add soft-wrap
+                        // characters at the end of a line &quot; =\r\n&quot; and add the newly
+                        // processed line(s) to the output (see comment on $crlf class property)
+                        for ($i = 0; $i &lt; $length; $i++)
+                        {
+                                // Grab the next character
+                                $char = substr($line, $i, 1);
+                                $ascii = ord($char);
+
+                                // Convert spaces and tabs but only if it's the end of the line
+                                if ($i == ($length - 1))
+                                {
+                                        $char = ($ascii == '32' OR $ascii == '9') ? $escape.sprintf('%02s', dechex($ascii)) : $char;
+                                }
+
+                                // encode = signs
+                                if ($ascii == '61')
+                                {
+                                        $char = $escape.strtoupper(sprintf('%02s', dechex($ascii)));  // =3D
+                                }
+
+                                // If we're at the character limit, add the line to the output,
+                                // reset our temp variable, and keep on chuggin'
+                                if ((strlen($temp) + strlen($char)) &gt;= $charlim)
+                                {
+                                        $output .= $temp.$escape.$this-&gt;crlf;
+                                        $temp = '';
+                                }
+
+                                // Add the character to our temporary line
+                                $temp .= $char;
+                        }
+
+                        // Add our completed line to the output
+                        $output .= $temp.$this-&gt;crlf;
+                }
+
+                // get rid of extra CRLF tacked onto the end
+                $output = substr($output, 0, strlen($this-&gt;crlf) * -1);
+
+                return $output;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Prep Q Encoding
+         *
+         * Performs &quot;Q Encoding&quot; on a string for use in email headers.  It's related
+         * but not identical to quoted-printable, so it has its own method
+         *
+         * @access        public
+         * @param        str
+         * @param        bool        // set to TRUE for processing From: headers
+         * @return        str
+         */
+        function _prep_q_encoding($str, $from = FALSE)
+        {
+                $str = str_replace(array(&quot;\r&quot;, &quot;\n&quot;), array('', ''), $str);
+
+                // Line length must not exceed 76 characters, so we adjust for
+                // a space, 7 extra characters =??Q??=, and the charset that we will add to each line
+                $limit = 75 - 7 - strlen($this-&gt;charset);
+
+                // these special characters must be converted too
+                $convert = array('_', '=', '?');
+
+                if ($from === TRUE)
+                {
+                        $convert[] = ',';
+                        $convert[] = ';';
+                }
+
+                $output = '';
+                $temp = '';
+
+                for ($i = 0, $length = strlen($str); $i &lt; $length; $i++)
+                {
+                        // Grab the next character
+                        $char = substr($str, $i, 1);
+                        $ascii = ord($char);
+
+                        // convert ALL non-printable ASCII characters and our specials
+                        if ($ascii &lt; 32 OR $ascii &gt; 126 OR in_array($char, $convert))
+                        {
+                                $char = '='.dechex($ascii);
+                        }
+
+                        // handle regular spaces a bit more compactly than =20
+                        if ($ascii == 32)
+                        {
+                                $char = '_';
+                        }
+
+                        // If we're at the character limit, add the line to the output,
+                        // reset our temp variable, and keep on chuggin'
+                        if ((strlen($temp) + strlen($char)) &gt;= $limit)
+                        {
+                                $output .= $temp.$this-&gt;crlf;
+                                $temp = '';
+                        }
+
+                        // Add the character to our temporary line
+                        $temp .= $char;
+                }
+
+                $str = $output.$temp;
+
+                // wrap each line with the shebang, charset, and transfer encoding
+                // the preceding space on successive lines is required for header &quot;folding&quot;
+                $str = trim(preg_replace('/^(.*)$/m', ' =?'.$this-&gt;charset.'?Q?$1?=', $str));
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Send Email
+         *
+         * @access        public
+         * @return        bool
+         */
+        function send()
+        {
+                if ($this-&gt;_replyto_flag == FALSE)
+                {
+                        $this-&gt;reply_to($this-&gt;_headers['From']);
+                }
+
+                if (( ! isset($this-&gt;_recipients) AND ! isset($this-&gt;_headers['To']))  AND
+                        ( ! isset($this-&gt;_bcc_array) AND ! isset($this-&gt;_headers['Bcc'])) AND
+                        ( ! isset($this-&gt;_headers['Cc'])))
+                {
+                        $this-&gt;_set_error_message('email_no_recipients');
+                        return FALSE;
+                }
+
+                $this-&gt;_build_headers();
+
+                if ($this-&gt;bcc_batch_mode  AND  count($this-&gt;_bcc_array) &gt; 0)
+                {
+                        if (count($this-&gt;_bcc_array) &gt; $this-&gt;bcc_batch_size)
+                                return $this-&gt;batch_bcc_send();
+                }
+
+                $this-&gt;_build_message();
+
+                if ( ! $this-&gt;_spool_email())
+                {
+                        return FALSE;
+                }
+                else
+                {
+                        return TRUE;
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Batch Bcc Send.  Sends groups of BCCs in batches
+         *
+         * @access        public
+         * @return        bool
+         */
+        function batch_bcc_send()
+        {
+                $float = $this-&gt;bcc_batch_size -1;
+
+                $set = &quot;&quot;;
+
+                $chunk = array();
+
+                for ($i = 0; $i &lt; count($this-&gt;_bcc_array); $i++)
+                {
+                        if (isset($this-&gt;_bcc_array[$i]))
+                        {
+                                $set .= &quot;, &quot;.$this-&gt;_bcc_array[$i];
+                        }
+
+                        if ($i == $float)
+                        {
+                                $chunk[] = substr($set, 1);
+                                $float = $float + $this-&gt;bcc_batch_size;
+                                $set = &quot;&quot;;
+                        }
+
+                        if ($i == count($this-&gt;_bcc_array)-1)
+                        {
+                                $chunk[] = substr($set, 1);
+                        }
+                }
+
+                for ($i = 0; $i &lt; count($chunk); $i++)
+                {
+                        unset($this-&gt;_headers['Bcc']);
+                        unset($bcc);
+
+                        $bcc = $this-&gt;_str_to_array($chunk[$i]);
+                        $bcc = $this-&gt;clean_email($bcc);
+
+                        if ($this-&gt;protocol != 'smtp')
+                        {
+                                $this-&gt;_set_header('Bcc', implode(&quot;, &quot;, $bcc));
+                        }
+                        else
+                        {
+                                $this-&gt;_bcc_array = $bcc;
+                        }
+
+                        $this-&gt;_build_message();
+                        $this-&gt;_spool_email();
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Unwrap special elements
+         *
+         * @access        private
+         * @return        void
+         */
+        function _unwrap_specials()
+        {
+                $this-&gt;_finalbody = preg_replace_callback(&quot;/\{unwrap\}(.*?)\{\/unwrap\}/si&quot;, array($this, '_remove_nl_callback'), $this-&gt;_finalbody);
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Strip line-breaks via callback
+         *
+         * @access        private
+         * @return        string
+         */
+        function _remove_nl_callback($matches)
+        {
+                if (strpos($matches[1], &quot;\r&quot;) !== FALSE OR strpos($matches[1], &quot;\n&quot;) !== FALSE)
+                {
+                        $matches[1] = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;, &quot;\n&quot;), '', $matches[1]);
+                }
+
+                return $matches[1];
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Spool mail to the mail server
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _spool_email()
+        {
+                $this-&gt;_unwrap_specials();
+
+                switch ($this-&gt;_get_protocol())
+                {
+                        case 'mail'        :
+
+                                        if ( ! $this-&gt;_send_with_mail())
+                                        {
+                                                $this-&gt;_set_error_message('email_send_failure_phpmail');
+                                                return FALSE;
+                                        }
+                        break;
+                        case 'sendmail'        :
+
+                                        if ( ! $this-&gt;_send_with_sendmail())
+                                        {
+                                                $this-&gt;_set_error_message('email_send_failure_sendmail');
+                                                return FALSE;
+                                        }
+                        break;
+                        case 'smtp'        :
+
+                                        if ( ! $this-&gt;_send_with_smtp())
+                                        {
+                                                $this-&gt;_set_error_message('email_send_failure_smtp');
+                                                return FALSE;
+                                        }
+                        break;
+
+                }
+
+                $this-&gt;_set_error_message('email_sent', $this-&gt;_get_protocol());
+                return TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Send using mail()
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _send_with_mail()
+        {
+                if ($this-&gt;_safe_mode == TRUE)
+                {
+                        if ( ! mail($this-&gt;_recipients, $this-&gt;_subject, $this-&gt;_finalbody, $this-&gt;_header_str))
+                        {
+                                return FALSE;
+                        }
+                        else
+                        {
+                                return TRUE;
+                        }
+                }
+                else
+                {
+                        // most documentation of sendmail using the &quot;-f&quot; flag lacks a space after it, however
+                        // we've encountered servers that seem to require it to be in place.
+                        if ( ! mail($this-&gt;_recipients, $this-&gt;_subject, $this-&gt;_finalbody, $this-&gt;_header_str, &quot;-f &quot;.$this-&gt;clean_email($this-&gt;_headers['From'])))
+                        {
+                                return FALSE;
+                        }
+                        else
+                        {
+                                return TRUE;
+                        }
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Send using Sendmail
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _send_with_sendmail()
+        {
+                $fp = @popen($this-&gt;mailpath . &quot; -oi -f &quot;.$this-&gt;clean_email($this-&gt;_headers['From']).&quot; -t&quot;, 'w');
+
+                if ($fp === FALSE OR $fp === NULL)
+                {
+                        // server probably has popen disabled, so nothing we can do to get a verbose error.
+                        return FALSE;
+                }
+                
+                fputs($fp, $this-&gt;_header_str);
+                fputs($fp, $this-&gt;_finalbody);
+
+            $status = pclose($fp);
+            
+                if (version_compare(PHP_VERSION, '4.2.3') == -1)
+                {
+                        $status = $status &gt;&gt; 8 &amp; 0xFF;
+            }
+        
+                if ($status != 0)
+                {
+                        $this-&gt;_set_error_message('email_exit_status', $status);
+                        $this-&gt;_set_error_message('email_no_socket');
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Send using SMTP
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _send_with_smtp()
+        {
+                if ($this-&gt;smtp_host == '')
+                {
+                        $this-&gt;_set_error_message('email_no_hostname');
+                        return FALSE;
+                }
+
+                $this-&gt;_smtp_connect();
+                $this-&gt;_smtp_authenticate();
+
+                $this-&gt;_send_command('from', $this-&gt;clean_email($this-&gt;_headers['From']));
+
+                foreach($this-&gt;_recipients as $val)
+                {
+                        $this-&gt;_send_command('to', $val);
+                }
+
+                if (count($this-&gt;_cc_array) &gt; 0)
+                {
+                        foreach($this-&gt;_cc_array as $val)
+                        {
+                                if ($val != &quot;&quot;)
+                                {
+                                        $this-&gt;_send_command('to', $val);
+                                }
+                        }
+                }
+
+                if (count($this-&gt;_bcc_array) &gt; 0)
+                {
+                        foreach($this-&gt;_bcc_array as $val)
+                        {
+                                if ($val != &quot;&quot;)
+                                {
+                                        $this-&gt;_send_command('to', $val);
+                                }
+                        }
+                }
+
+                $this-&gt;_send_command('data');
+
+                // perform dot transformation on any lines that begin with a dot
+                $this-&gt;_send_data($this-&gt;_header_str . preg_replace('/^\./m', '..$1', $this-&gt;_finalbody));
+
+                $this-&gt;_send_data('.');
+
+                $reply = $this-&gt;_get_smtp_data();
+
+                $this-&gt;_set_error_message($reply);
+
+                if (strncmp($reply, '250', 3) != 0)
+                {
+                        $this-&gt;_set_error_message('email_smtp_error', $reply);
+                        return FALSE;
+                }
+
+                $this-&gt;_send_command('quit');
+                return TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * SMTP Connect
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _smtp_connect()
+        {
+                $this-&gt;_smtp_connect = fsockopen($this-&gt;smtp_host,
+                                                                                $this-&gt;smtp_port,
+                                                                                $errno,
+                                                                                $errstr,
+                                                                                $this-&gt;smtp_timeout);
+
+                if( ! is_resource($this-&gt;_smtp_connect))
+                {
+                        $this-&gt;_set_error_message('email_smtp_error', $errno.&quot; &quot;.$errstr);
+                        return FALSE;
+                }
+
+                $this-&gt;_set_error_message($this-&gt;_get_smtp_data());
+                return $this-&gt;_send_command('hello');
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Send SMTP command
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function _send_command($cmd, $data = '')
+        {
+                switch ($cmd)
+                {
+                        case 'hello' :
+
+                                        if ($this-&gt;_smtp_auth OR $this-&gt;_get_encoding() == '8bit')
+                                                $this-&gt;_send_data('EHLO '.$this-&gt;_get_hostname());
+                                        else
+                                                $this-&gt;_send_data('HELO '.$this-&gt;_get_hostname());
+
+                                                $resp = 250;
+                        break;
+                        case 'from' :
+
+                                                $this-&gt;_send_data('MAIL FROM:&lt;'.$data.'&gt;');
+
+                                                $resp = 250;
+                        break;
+                        case 'to'        :
+
+                                                $this-&gt;_send_data('RCPT TO:&lt;'.$data.'&gt;');
+
+                                                $resp = 250;
+                        break;
+                        case 'data'        :
+
+                                                $this-&gt;_send_data('DATA');
+
+                                                $resp = 354;
+                        break;
+                        case 'quit'        :
+
+                                                $this-&gt;_send_data('QUIT');
+
+                                                $resp = 221;
+                        break;
+                }
+
+                $reply = $this-&gt;_get_smtp_data();
+
+                $this-&gt;_debug_msg[] = &quot;&lt;pre&gt;&quot;.$cmd.&quot;: &quot;.$reply.&quot;&lt;/pre&gt;&quot;;
+
+                if (substr($reply, 0, 3) != $resp)
+                {
+                        $this-&gt;_set_error_message('email_smtp_error', $reply);
+                        return FALSE;
+                }
+
+                if ($cmd == 'quit')
+                {
+                        fclose($this-&gt;_smtp_connect);
+                }
+
+                return TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         *  SMTP Authenticate
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _smtp_authenticate()
+        {
+                if ( ! $this-&gt;_smtp_auth)
+                {
+                        return TRUE;
+                }
+
+                if ($this-&gt;smtp_user == &quot;&quot;  AND  $this-&gt;smtp_pass == &quot;&quot;)
+                {
+                        $this-&gt;_set_error_message('email_no_smtp_unpw');
+                        return FALSE;
+                }
+
+                $this-&gt;_send_data('AUTH LOGIN');
+
+                $reply = $this-&gt;_get_smtp_data();
+
+                if (strncmp($reply, '334', 3) != 0)
+                {
+                        $this-&gt;_set_error_message('email_failed_smtp_login', $reply);
+                        return FALSE;
+                }
+
+                $this-&gt;_send_data(base64_encode($this-&gt;smtp_user));
+
+                $reply = $this-&gt;_get_smtp_data();
+
+                if (strncmp($reply, '334', 3) != 0)
+                {
+                        $this-&gt;_set_error_message('email_smtp_auth_un', $reply);
+                        return FALSE;
+                }
+
+                $this-&gt;_send_data(base64_encode($this-&gt;smtp_pass));
+
+                $reply = $this-&gt;_get_smtp_data();
+
+                if (strncmp($reply, '235', 3) != 0)
+                {
+                        $this-&gt;_set_error_message('email_smtp_auth_pw', $reply);
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Send SMTP data
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _send_data($data)
+        {
+                if ( ! fwrite($this-&gt;_smtp_connect, $data . $this-&gt;newline))
+                {
+                        $this-&gt;_set_error_message('email_smtp_data_failure', $data);
+                        return FALSE;
+                }
+                else
+                {
+                        return TRUE;
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Get SMTP data
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_smtp_data()
+        {
+                $data = &quot;&quot;;
+
+                while ($str = fgets($this-&gt;_smtp_connect, 512))
+                {
+                        $data .= $str;
+
+                        if (substr($str, 3, 1) == &quot; &quot;)
+                        {
+                                break;
+                        }
+                }
+
+                return $data;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Hostname
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_hostname()
+        {
+                return (isset($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain';
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Get IP
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_ip()
+        {
+                if ($this-&gt;_IP !== FALSE)
+                {
+                        return $this-&gt;_IP;
+                }
+
+                $cip = (isset($_SERVER['HTTP_CLIENT_IP']) AND $_SERVER['HTTP_CLIENT_IP'] != &quot;&quot;) ? $_SERVER['HTTP_CLIENT_IP'] : FALSE;
+                $rip = (isset($_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR'] != &quot;&quot;) ? $_SERVER['REMOTE_ADDR'] : FALSE;
+                $fip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND $_SERVER['HTTP_X_FORWARDED_FOR'] != &quot;&quot;) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : FALSE;
+
+                if ($cip &amp;&amp; $rip)         $this-&gt;_IP = $cip;
+                elseif ($rip)                $this-&gt;_IP = $rip;
+                elseif ($cip)                $this-&gt;_IP = $cip;
+                elseif ($fip)                $this-&gt;_IP = $fip;
+
+                if (strstr($this-&gt;_IP, ','))
+                {
+                        $x = explode(',', $this-&gt;_IP);
+                        $this-&gt;_IP = end($x);
+                }
+
+                if ( ! preg_match( &quot;/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/&quot;, $this-&gt;_IP))
+                {
+                        $this-&gt;_IP = '0.0.0.0';
+                }
+
+                unset($cip);
+                unset($rip);
+                unset($fip);
+
+                return $this-&gt;_IP;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Debug Message
+         *
+         * @access        public
+         * @return        string
+         */
+        function print_debugger()
+        {
+                $msg = '';
+
+                if (count($this-&gt;_debug_msg) &gt; 0)
+                {
+                        foreach ($this-&gt;_debug_msg as $val)
+                        {
+                                $msg .= $val;
+                        }
+                }
+
+                $msg .= &quot;&lt;pre&gt;&quot;.$this-&gt;_header_str.&quot;\n&quot;.htmlspecialchars($this-&gt;_subject).&quot;\n&quot;.htmlspecialchars($this-&gt;_finalbody).'&lt;/pre&gt;';
+                return $msg;
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Message
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _set_error_message($msg, $val = '')
+        {
+                $CI =&amp; get_instance();
+                $CI-&gt;lang-&gt;load('email');
+
+                if (FALSE === ($line = $CI-&gt;lang-&gt;line($msg)))
+                {
+                        $this-&gt;_debug_msg[] = str_replace('%s', $val, $msg).&quot;&lt;br /&gt;&quot;;
+                }
+                else
+                {
+                        $this-&gt;_debug_msg[] = str_replace('%s', $val, $line).&quot;&lt;br /&gt;&quot;;
+                }
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Mime Types
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _mime_types($ext = &quot;&quot;)
+        {
+                $mimes = array(        'hqx'        =&gt;        'application/mac-binhex40',
+                                                'cpt'        =&gt;        'application/mac-compactpro',
+                                                'doc'        =&gt;        'application/msword',
+                                                'bin'        =&gt;        'application/macbinary',
+                                                'dms'        =&gt;        'application/octet-stream',
+                                                'lha'        =&gt;        'application/octet-stream',
+                                                'lzh'        =&gt;        'application/octet-stream',
+                                                'exe'        =&gt;        'application/octet-stream',
+                                                'class'        =&gt;        'application/octet-stream',
+                                                'psd'        =&gt;        'application/octet-stream',
+                                                'so'        =&gt;        'application/octet-stream',
+                                                'sea'        =&gt;        'application/octet-stream',
+                                                'dll'        =&gt;        'application/octet-stream',
+                                                'oda'        =&gt;        'application/oda',
+                                                'pdf'        =&gt;        'application/pdf',
+                                                'ai'        =&gt;        'application/postscript',
+                                                'eps'        =&gt;        'application/postscript',
+                                                'ps'        =&gt;        'application/postscript',
+                                                'smi'        =&gt;        'application/smil',
+                                                'smil'        =&gt;        'application/smil',
+                                                'mif'        =&gt;        'application/vnd.mif',
+                                                'xls'        =&gt;        'application/vnd.ms-excel',
+                                                'ppt'        =&gt;        'application/vnd.ms-powerpoint',
+                                                'wbxml'        =&gt;        'application/vnd.wap.wbxml',
+                                                'wmlc'        =&gt;        'application/vnd.wap.wmlc',
+                                                'dcr'        =&gt;        'application/x-director',
+                                                'dir'        =&gt;        'application/x-director',
+                                                'dxr'        =&gt;        'application/x-director',
+                                                'dvi'        =&gt;        'application/x-dvi',
+                                                'gtar'        =&gt;        'application/x-gtar',
+                                                'php'        =&gt;        'application/x-httpd-php',
+                                                'php4'        =&gt;        'application/x-httpd-php',
+                                                'php3'        =&gt;        'application/x-httpd-php',
+                                                'phtml'        =&gt;        'application/x-httpd-php',
+                                                'phps'        =&gt;        'application/x-httpd-php-source',
+                                                'js'        =&gt;        'application/x-javascript',
+                                                'swf'        =&gt;        'application/x-shockwave-flash',
+                                                'sit'        =&gt;        'application/x-stuffit',
+                                                'tar'        =&gt;        'application/x-tar',
+                                                'tgz'        =&gt;        'application/x-tar',
+                                                'xhtml'        =&gt;        'application/xhtml+xml',
+                                                'xht'        =&gt;        'application/xhtml+xml',
+                                                'zip'        =&gt;        'application/zip',
+                                                'mid'        =&gt;        'audio/midi',
+                                                'midi'        =&gt;        'audio/midi',
+                                                'mpga'        =&gt;        'audio/mpeg',
+                                                'mp2'        =&gt;        'audio/mpeg',
+                                                'mp3'        =&gt;        'audio/mpeg',
+                                                'aif'        =&gt;        'audio/x-aiff',
+                                                'aiff'        =&gt;        'audio/x-aiff',
+                                                'aifc'        =&gt;        'audio/x-aiff',
+                                                'ram'        =&gt;        'audio/x-pn-realaudio',
+                                                'rm'        =&gt;        'audio/x-pn-realaudio',
+                                                'rpm'        =&gt;        'audio/x-pn-realaudio-plugin',
+                                                'ra'        =&gt;        'audio/x-realaudio',
+                                                'rv'        =&gt;        'video/vnd.rn-realvideo',
+                                                'wav'        =&gt;        'audio/x-wav',
+                                                'bmp'        =&gt;        'image/bmp',
+                                                'gif'        =&gt;        'image/gif',
+                                                'jpeg'        =&gt;        'image/jpeg',
+                                                'jpg'        =&gt;        'image/jpeg',
+                                                'jpe'        =&gt;        'image/jpeg',
+                                                'png'        =&gt;        'image/png',
+                                                'tiff'        =&gt;        'image/tiff',
+                                                'tif'        =&gt;        'image/tiff',
+                                                'css'        =&gt;        'text/css',
+                                                'html'        =&gt;        'text/html',
+                                                'htm'        =&gt;        'text/html',
+                                                'shtml'        =&gt;        'text/html',
+                                                'txt'        =&gt;        'text/plain',
+                                                'text'        =&gt;        'text/plain',
+                                                'log'        =&gt;        'text/plain',
+                                                'rtx'        =&gt;        'text/richtext',
+                                                'rtf'        =&gt;        'text/rtf',
+                                                'xml'        =&gt;        'text/xml',
+                                                'xsl'        =&gt;        'text/xml',
+                                                'mpeg'        =&gt;        'video/mpeg',
+                                                'mpg'        =&gt;        'video/mpeg',
+                                                'mpe'        =&gt;        'video/mpeg',
+                                                'qt'        =&gt;        'video/quicktime',
+                                                'mov'        =&gt;        'video/quicktime',
+                                                'avi'        =&gt;        'video/x-msvideo',
+                                                'movie'        =&gt;        'video/x-sgi-movie',
+                                                'doc'        =&gt;        'application/msword',
+                                                'word'        =&gt;        'application/msword',
+                                                'xl'        =&gt;        'application/excel',
+                                                'eml'        =&gt;        'message/rfc822'
+                                        );
+
+                return ( ! isset($mimes[strtolower($ext)])) ? &quot;application/x-unknown-content-type&quot; : $mimes[strtolower($ext)];
+        }
+
+}
+// END CI_Email class
+
+/* End of file Email.php */
+/* Location: ./system/libraries/Email.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesEncryptphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Encrypt.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Encrypt.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Encrypt.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,484 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Encryption Class
+ *
+ * Provides two-way keyed encoding using XOR Hashing and Mcrypt
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/encryption.html
+ */
+class CI_Encrypt {
+
+        var $CI;
+        var $encryption_key        = '';
+        var $_hash_type        = 'sha1';
+        var $_mcrypt_exists = FALSE;
+        var $_mcrypt_cipher;
+        var $_mcrypt_mode;
+
+        /**
+         * Constructor
+         *
+         * Simply determines whether the mcrypt library exists.
+         *
+         */
+        function CI_Encrypt()
+        {
+                $this-&gt;CI =&amp; get_instance();
+                $this-&gt;_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE;
+                log_message('debug', &quot;Encrypt Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch the encryption key
+         *
+         * Returns it as MD5 in order to have an exact-length 128 bit key.
+         * Mcrypt is sensitive to keys that are not the correct length
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function get_key($key = '')
+        {
+                if ($key == '')
+                {
+                        if ($this-&gt;encryption_key != '')
+                        {
+                                return $this-&gt;encryption_key;
+                        }
+
+                        $CI =&amp; get_instance();
+                        $key = $CI-&gt;config-&gt;item('encryption_key');
+
+                        if ($key === FALSE)
+                        {
+                                show_error('In order to use the encryption class requires that you set an encryption key in your config file.');
+                        }
+                }
+
+                return md5($key);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set the encryption key
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_key($key = '')
+        {
+                $this-&gt;encryption_key = $key;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Encode
+         *
+         * Encodes the message string using bitwise XOR encoding.
+         * The key is combined with a random hash, and then it
+         * too gets converted using XOR. The whole thing is then run
+         * through mcrypt (if supported) using the randomized key.
+         * The end result is a double-encrypted message string
+         * that is randomized with each call to this function,
+         * even if the supplied message and key are the same.
+         *
+         * @access        public
+         * @param        string        the string to encode
+         * @param        string        the key
+         * @return        string
+         */
+        function encode($string, $key = '')
+        {
+                $key = $this-&gt;get_key($key);
+                $enc = $this-&gt;_xor_encode($string, $key);
+                
+                if ($this-&gt;_mcrypt_exists === TRUE)
+                {
+                        $enc = $this-&gt;mcrypt_encode($enc, $key);
+                }
+                return base64_encode($enc);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Decode
+         *
+         * Reverses the above process
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function decode($string, $key = '')
+        {
+                $key = $this-&gt;get_key($key);
+                
+                if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string))
+                {
+                        return FALSE;
+                }
+
+                $dec = base64_decode($string);
+
+                if ($this-&gt;_mcrypt_exists === TRUE)
+                {
+                        if (($dec = $this-&gt;mcrypt_decode($dec, $key)) === FALSE)
+                        {
+                                return FALSE;
+                        }
+                }
+
+                return $this-&gt;_xor_decode($dec, $key);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * XOR Encode
+         *
+         * Takes a plain-text string and key as input and generates an
+         * encoded bit-string using XOR
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function _xor_encode($string, $key)
+        {
+                $rand = '';
+                while (strlen($rand) &lt; 32)
+                {
+                        $rand .= mt_rand(0, mt_getrandmax());
+                }
+
+                $rand = $this-&gt;hash($rand);
+
+                $enc = '';
+                for ($i = 0; $i &lt; strlen($string); $i++)
+                {                        
+                        $enc .= substr($rand, ($i % strlen($rand)), 1).(substr($rand, ($i % strlen($rand)), 1) ^ substr($string, $i, 1));
+                }
+
+                return $this-&gt;_xor_merge($enc, $key);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * XOR Decode
+         *
+         * Takes an encoded string and key as input and generates the
+         * plain-text original message
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function _xor_decode($string, $key)
+        {
+                $string = $this-&gt;_xor_merge($string, $key);
+
+                $dec = '';
+                for ($i = 0; $i &lt; strlen($string); $i++)
+                {
+                        $dec .= (substr($string, $i++, 1) ^ substr($string, $i, 1));
+                }
+
+                return $dec;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * XOR key + string Combiner
+         *
+         * Takes a string and key as input and computes the difference using XOR
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function _xor_merge($string, $key)
+        {
+                $hash = $this-&gt;hash($key);
+                $str = '';
+                for ($i = 0; $i &lt; strlen($string); $i++)
+                {
+                        $str .= substr($string, $i, 1) ^ substr($hash, ($i % strlen($hash)), 1);
+                }
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Encrypt using Mcrypt
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function mcrypt_encode($data, $key)
+        {
+                $init_size = mcrypt_get_iv_size($this-&gt;_get_cipher(), $this-&gt;_get_mode());
+                $init_vect = mcrypt_create_iv($init_size, MCRYPT_RAND);
+                return $this-&gt;_add_cipher_noise($init_vect.mcrypt_encrypt($this-&gt;_get_cipher(), $key, $data, $this-&gt;_get_mode(), $init_vect), $key);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Decrypt using Mcrypt
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function mcrypt_decode($data, $key)
+        {
+                $data = $this-&gt;_remove_cipher_noise($data, $key);
+                $init_size = mcrypt_get_iv_size($this-&gt;_get_cipher(), $this-&gt;_get_mode());
+
+                if ($init_size &gt; strlen($data))
+                {
+                        return FALSE;
+                }
+
+                $init_vect = substr($data, 0, $init_size);
+                $data = substr($data, $init_size);
+                return rtrim(mcrypt_decrypt($this-&gt;_get_cipher(), $key, $data, $this-&gt;_get_mode(), $init_vect), &quot;\0&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Adds permuted noise to the IV + encrypted data to protect
+         * against Man-in-the-middle attacks on CBC mode ciphers
+         * http://www.ciphersbyritter.com/GLOSSARY.HTM#IV
+         *
+         * Function description
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function _add_cipher_noise($data, $key)
+        {
+                $keyhash = $this-&gt;hash($key);
+                $keylen = strlen($keyhash);
+                $str = '';
+
+                for ($i = 0, $j = 0, $len = strlen($data); $i &lt; $len; ++$i, ++$j)
+                {
+                        if ($j &gt;= $keylen)
+                        {
+                                $j = 0;
+                        }
+
+                        $str .= chr((ord($data[$i]) + ord($keyhash[$j])) % 256);
+                }
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Removes permuted noise from the IV + encrypted data, reversing
+         * _add_cipher_noise()
+         *
+         * Function description
+         *
+         * @access        public
+         * @param        type
+         * @return        type
+         */
+        function _remove_cipher_noise($data, $key)
+        {
+                $keyhash = $this-&gt;hash($key);
+                $keylen = strlen($keyhash);
+                $str = '';
+
+                for ($i = 0, $j = 0, $len = strlen($data); $i &lt; $len; ++$i, ++$j)
+                {
+                        if ($j &gt;= $keylen)
+                        {
+                                $j = 0;
+                        }
+
+                        $temp = ord($data[$i]) - ord($keyhash[$j]);
+
+                        if ($temp &lt; 0)
+                        {
+                                $temp = $temp + 256;
+                        }
+                        
+                        $str .= chr($temp);
+                }
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the Mcrypt Cipher
+         *
+         * @access        public
+         * @param        constant
+         * @return        string
+         */
+        function set_cipher($cipher)
+        {
+                $this-&gt;_mcrypt_cipher = $cipher;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set the Mcrypt Mode
+         *
+         * @access        public
+         * @param        constant
+         * @return        string
+         */
+        function set_mode($mode)
+        {
+                $this-&gt;_mcrypt_mode = $mode;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Mcrypt cipher Value
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_cipher()
+        {
+                if ($this-&gt;_mcrypt_cipher == '')
+                {
+                        $this-&gt;_mcrypt_cipher = MCRYPT_RIJNDAEL_256;
+                }
+
+                return $this-&gt;_mcrypt_cipher;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get Mcrypt Mode Value
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_mode()
+        {
+                if ($this-&gt;_mcrypt_mode == '')
+                {
+                        $this-&gt;_mcrypt_mode = MCRYPT_MODE_ECB;
+                }
+                
+                return $this-&gt;_mcrypt_mode;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set the Hash type
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function set_hash($type = 'sha1')
+        {
+                $this-&gt;_hash_type = ($type != 'sha1' AND $type != 'md5') ? 'sha1' : $type;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Hash encode a string
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function hash($str)
+        {
+                return ($this-&gt;_hash_type == 'sha1') ? $this-&gt;sha1($str) : md5($str);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate an SHA1 Hash
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function sha1($str)
+        {
+                if ( ! function_exists('sha1'))
+                {
+                        if ( ! function_exists('mhash'))
+                        {
+                                require_once(BASEPATH.'libraries/Sha1'.EXT);
+                                $SH = new CI_SHA;
+                                return $SH-&gt;generate($str);
+                        }
+                        else
+                        {
+                                return bin2hex(mhash(MHASH_SHA1, $str));
+                        }
+                }
+                else
+                {
+                        return sha1($str);
+                }
+        }
+
+}
+
+// END CI_Encrypt class
+
+/* End of file Encrypt.php */
+/* Location: ./system/libraries/Encrypt.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesExceptionsphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Exceptions.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Exceptions.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Exceptions.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,172 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Exceptions Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Exceptions
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/exceptions.html
+ */
+class CI_Exceptions {
+        var $action;
+        var $severity;
+        var $message;
+        var $filename;
+        var $line;
+        var $ob_level;
+
+        var $levels = array(
+                                                E_ERROR                                =&gt;        'Error',
+                                                E_WARNING                        =&gt;        'Warning',
+                                                E_PARSE                                =&gt;        'Parsing Error',
+                                                E_NOTICE                        =&gt;        'Notice',
+                                                E_CORE_ERROR                =&gt;        'Core Error',
+                                                E_CORE_WARNING                =&gt;        'Core Warning',
+                                                E_COMPILE_ERROR                =&gt;        'Compile Error',
+                                                E_COMPILE_WARNING        =&gt;        'Compile Warning',
+                                                E_USER_ERROR                =&gt;        'User Error',
+                                                E_USER_WARNING                =&gt;        'User Warning',
+                                                E_USER_NOTICE                =&gt;        'User Notice',
+                                                E_STRICT                        =&gt;        'Runtime Notice'
+                                        );
+
+
+        /**
+         * Constructor
+         *
+         */        
+        function CI_Exceptions()
+        {
+                $this-&gt;ob_level = ob_get_level();
+                // Note:  Do not log messages from this constructor.
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Exception Logger
+         *
+         * This function logs PHP generated error messages
+         *
+         * @access        private
+         * @param        string        the error severity
+         * @param        string        the error string
+         * @param        string        the error filepath
+         * @param        string        the error line number
+         * @return        string
+         */
+        function log_exception($severity, $message, $filepath, $line)
+        {        
+                $severity = ( ! isset($this-&gt;levels[$severity])) ? $severity : $this-&gt;levels[$severity];
+                
+                log_message('error', 'Severity: '.$severity.'  --&gt; '.$message. ' '.$filepath.' '.$line, TRUE);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * 404 Page Not Found Handler
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function show_404($page = '')
+        {        
+                $heading = &quot;404 Page Not Found&quot;;
+                $message = &quot;The page you requested was not found.&quot;;
+
+                log_message('error', '404 Page Not Found --&gt; '.$page);
+                echo $this-&gt;show_error($heading, $message, 'error_404');
+                exit;
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * General Error Page
+         *
+         * This function takes an error message as input
+         * (either as a string or an array) and displays
+         * it using the specified template.
+         *
+         * @access        private
+         * @param        string        the heading
+         * @param        string        the message
+         * @param        string        the template name
+         * @return        string
+         */
+        function show_error($heading, $message, $template = 'error_general')
+        {
+                $message = '&lt;p&gt;'.implode('&lt;/p&gt;&lt;p&gt;', ( ! is_array($message)) ? array($message) : $message).'&lt;/p&gt;';
+
+                if (ob_get_level() &gt; $this-&gt;ob_level + 1)
+                {
+                        ob_end_flush();        
+                }
+                ob_start();
+                include(APPPATH.'errors/'.$template.EXT);
+                $buffer = ob_get_contents();
+                ob_end_clean();
+                return $buffer;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Native PHP error handler
+         *
+         * @access        private
+         * @param        string        the error severity
+         * @param        string        the error string
+         * @param        string        the error filepath
+         * @param        string        the error line number
+         * @return        string
+         */
+        function show_php_error($severity, $message, $filepath, $line)
+        {        
+                $severity = ( ! isset($this-&gt;levels[$severity])) ? $severity : $this-&gt;levels[$severity];
+        
+                $filepath = str_replace(&quot;\\&quot;, &quot;/&quot;, $filepath);
+                
+                // For safety reasons we do not show the full file path
+                if (FALSE !== strpos($filepath, '/'))
+                {
+                        $x = explode('/', $filepath);
+                        $filepath = $x[count($x)-2].'/'.end($x);
+                }
+                
+                if (ob_get_level() &gt; $this-&gt;ob_level + 1)
+                {
+                        ob_end_flush();        
+                }
+                ob_start();
+                include(APPPATH.'errors/error_php'.EXT);
+                $buffer = ob_get_contents();
+                ob_end_clean();
+                echo $buffer;
+        }
+
+
+}
+// END Exceptions Class
+
+/* End of file Exceptions.php */
+/* Location: ./system/libraries/Exceptions.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesForm_validationphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Form_validation.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Form_validation.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Form_validation.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1278 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Validation Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Validation
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/form_validation.html
+ */
+class CI_Form_validation {
+        
+        var $CI;
+        var $_field_data                        = array();        
+        var $_config_rules                        = array();
+        var $_error_array                        = array();
+        var $_error_messages                = array();        
+        var $_error_prefix                        = '&lt;p&gt;';
+        var $_error_suffix                        = '&lt;/p&gt;';
+        var $error_string                        = '';
+        var $_safe_form_data                 = FALSE;
+
+
+        /**
+         * Constructor
+         *
+         */        
+        function CI_Form_validation($rules = array())
+        {        
+                $this-&gt;CI =&amp; get_instance();
+                
+                // Validation rules can be stored in a config file.
+                $this-&gt;_config_rules = $rules;
+                
+                // Automatically load the form helper
+                $this-&gt;CI-&gt;load-&gt;helper('form');
+
+                // Set the character encoding in MB.
+                if (function_exists('mb_internal_encoding'))
+                {
+                        mb_internal_encoding($this-&gt;CI-&gt;config-&gt;item('charset'));
+                }
+        
+                log_message('debug', &quot;Form Validation Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Rules
+         *
+         * This function takes an array of field names and validation
+         * rules as input, validates the info, and stores it
+         *
+         * @access        public
+         * @param        mixed
+         * @param        string
+         * @return        void
+         */
+        function set_rules($field, $label = '', $rules = '')
+        {
+                // No reason to set rules if we have no POST data
+                if (count($_POST) == 0)
+                {
+                        return;
+                }
+        
+                // If an array was passed via the first parameter instead of indidual string
+                // values we cycle through it and recursively call this function.
+                if (is_array($field))
+                {
+                        foreach ($field as $row)
+                        {
+                                // Houston, we have a problem...
+                                if ( ! isset($row['field']) OR ! isset($row['rules']))
+                                {
+                                        continue;
+                                }
+
+                                // If the field label wasn't passed we use the field name
+                                $label = ( ! isset($row['label'])) ? $row['field'] : $row['label'];
+
+                                // Here we go!
+                                $this-&gt;set_rules($row['field'], $label, $row['rules']);
+                        }
+                        return;
+                }
+                
+                // No fields? Nothing to do...
+                if ( ! is_string($field) OR  ! is_string($rules) OR $field == '')
+                {
+                        return;
+                }
+
+                // If the field label wasn't passed we use the field name
+                $label = ($label == '') ? $field : $label;
+
+                // Is the field name an array?  We test for the existence of a bracket &quot;[&quot; in
+                // the field name to determine this.  If it is an array, we break it apart
+                // into its components so that we can fetch the corresponding POST data later                
+                if (strpos($field, '[') !== FALSE AND preg_match_all('/\[(.*?)\]/', $field, $matches))
+                {        
+                        // Note: Due to a bug in current() that affects some versions
+                        // of PHP we can not pass function call directly into it
+                        $x = explode('[', $field);
+                        $indexes[] = current($x);
+
+                        for ($i = 0; $i &lt; count($matches['0']); $i++)
+                        {
+                                if ($matches['1'][$i] != '')
+                                {
+                                        $indexes[] = $matches['1'][$i];
+                                }
+                        }
+                        
+                        $is_array = TRUE;
+                }
+                else
+                {
+                        $indexes         = array();
+                        $is_array        = FALSE;                
+                }
+                
+                // Build our master array                
+                $this-&gt;_field_data[$field] = array(
+                                                                                        'field'                                =&gt; $field, 
+                                                                                        'label'                                =&gt; $label, 
+                                                                                        'rules'                                =&gt; $rules,
+                                                                                        'is_array'                        =&gt; $is_array,
+                                                                                        'keys'                                =&gt; $indexes,
+                                                                                        'postdata'                        =&gt; NULL,
+                                                                                        'error'                                =&gt; ''
+                                                                                        );
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Error Message
+         *
+         * Lets users set their own error messages on the fly.  Note:  The key
+         * name has to match the  function name that it corresponds to.
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function set_message($lang, $val = '')
+        {
+                if ( ! is_array($lang))
+                {
+                        $lang = array($lang =&gt; $val);
+                }
+        
+                $this-&gt;_error_messages = array_merge($this-&gt;_error_messages, $lang);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set The Error Delimiter
+         *
+         * Permits a prefix/suffix to be added to each error message
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        void
+         */        
+        function set_error_delimiters($prefix = '&lt;p&gt;', $suffix = '&lt;/p&gt;')
+        {
+                $this-&gt;_error_prefix = $prefix;
+                $this-&gt;_error_suffix = $suffix;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get Error Message
+         *
+         * Gets the error message associated with a particular field
+         *
+         * @access        public
+         * @param        string        the field name
+         * @return        void
+         */        
+        function error($field = '', $prefix = '', $suffix = '')
+        {        
+                if ( ! isset($this-&gt;_field_data[$field]['error']) OR $this-&gt;_field_data[$field]['error'] == '')
+                {
+                        return '';
+                }
+                
+                if ($prefix == '')
+                {
+                        $prefix = $this-&gt;_error_prefix;
+                }
+
+                if ($suffix == '')
+                {
+                        $suffix = $this-&gt;_error_suffix;
+                }
+
+                return $prefix.$this-&gt;_field_data[$field]['error'].$suffix;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Error String
+         *
+         * Returns the error messages as a string, wrapped in the error delimiters
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        str
+         */        
+        function error_string($prefix = '', $suffix = '')
+        {
+                // No errrors, validation passes!
+                if (count($this-&gt;_error_array) === 0)
+                {
+                        return '';
+                }
+                
+                if ($prefix == '')
+                {
+                        $prefix = $this-&gt;_error_prefix;
+                }
+
+                if ($suffix == '')
+                {
+                        $suffix = $this-&gt;_error_suffix;
+                }
+                
+                // Generate the error string
+                $str = '';
+                foreach ($this-&gt;_error_array as $val)
+                {
+                        if ($val != '')
+                        {
+                                $str .= $prefix.$val.$suffix.&quot;\n&quot;;
+                        }
+                }
+                
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Run the Validator
+         *
+         * This function does all the work.
+         *
+         * @access        public
+         * @return        bool
+         */                
+        function run($group = '')
+        {
+                // Do we even have any data to process?  Mm?
+                if (count($_POST) == 0)
+                {
+                        return FALSE;
+                }
+                
+                // Does the _field_data array containing the validation rules exist?
+                // If not, we look to see if they were assigned via a config file
+                if (count($this-&gt;_field_data) == 0)
+                {
+                        // No validation rules?  We're done...
+                        if (count($this-&gt;_config_rules) == 0)
+                        {
+                                return FALSE;
+                        }
+                        
+                        // Is there a validation rule for the particular URI being accessed?
+                        $uri = ($group == '') ? trim($this-&gt;CI-&gt;uri-&gt;ruri_string(), '/') : $group;
+                        
+                        if ($uri != '' AND isset($this-&gt;_config_rules[$uri]))
+                        {
+                                $this-&gt;set_rules($this-&gt;_config_rules[$uri]);
+                        }
+                        else
+                        {
+                                $this-&gt;set_rules($this-&gt;_config_rules);
+                        }
+        
+                        // We're we able to set the rules correctly?
+                        if (count($this-&gt;_field_data) == 0)
+                        {
+                                log_message('debug', &quot;Unable to find validation rules&quot;);
+                                return FALSE;
+                        }
+                }
+        
+                // Load the language file containing error messages
+                $this-&gt;CI-&gt;lang-&gt;load('form_validation');
+                                                        
+                // Cycle through the rules for each field, match the 
+                // corresponding $_POST item and test for errors
+                foreach ($this-&gt;_field_data as $field =&gt; $row)
+                {                
+                        // Fetch the data from the corresponding $_POST array and cache it in the _field_data array.
+                        // Depending on whether the field name is an array or a string will determine where we get it from.
+                        
+                        if ($row['is_array'] == TRUE)
+                        {
+                                $this-&gt;_field_data[$field]['postdata'] = $this-&gt;_reduce_array($_POST, $row['keys']);
+                        }
+                        else
+                        {
+                                if (isset($_POST[$field]) AND $_POST[$field] != &quot;&quot;)
+                                {
+                                        $this-&gt;_field_data[$field]['postdata'] = $_POST[$field];
+                                }
+                        }
+                
+                        $this-&gt;_execute($row, explode('|', $row['rules']), $this-&gt;_field_data[$field]['postdata']);                
+                }
+
+                // Did we end up with any errors?
+                $total_errors = count($this-&gt;_error_array);
+
+                if ($total_errors &gt; 0)
+                {
+                        $this-&gt;_safe_form_data = TRUE;
+                }
+
+                // Now we need to re-set the POST data with the new, processed data
+                $this-&gt;_reset_post_array();
+                
+                // No errors, validation passes!
+                if ($total_errors == 0)
+                {
+                        return TRUE;
+                }
+
+                // Validation fails
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Traverse a multidimensional $_POST array index until the data is found
+         *
+         * @access        private
+         * @param        array
+         * @param        array
+         * @param        integer
+         * @return        mixed
+         */                
+        function _reduce_array($array, $keys, $i = 0)
+        {
+                if (is_array($array))
+                {
+                        if (isset($keys[$i]))
+                        {
+                                if (isset($array[$keys[$i]]))
+                                {
+                                        $array = $this-&gt;_reduce_array($array[$keys[$i]], $keys, ($i+1));
+                                }
+                                else
+                                {
+                                        return NULL;
+                                }
+                        }
+                        else
+                        {
+                                return $array;
+                        }
+                }
+        
+                return $array;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Re-populate the _POST array with our finalized and processed data
+         *
+         * @access        private
+         * @return        null
+         */                
+        function _reset_post_array()
+        {
+                foreach ($this-&gt;_field_data as $field =&gt; $row)
+                {
+                        if ( ! is_null($row['postdata']))
+                        {
+                                if ($row['is_array'] == FALSE)
+                                {
+                                        if (isset($_POST[$row['field']]))
+                                        {
+                                                $_POST[$row['field']] = $this-&gt;prep_for_form($row['postdata']);
+                                        }
+                                }
+                                else
+                                {
+                                        // start with a reference
+                                        $post_ref =&amp; $_POST;
+                                        
+                                        // before we assign values, make a reference to the right POST key
+                                        if (count($row['keys']) == 1)
+                                        {
+                                                $post_ref =&amp; $post_ref[current($row['keys'])];
+                                        }
+                                        else
+                                        {
+                                                foreach ($row['keys'] as $val)
+                                                {
+                                                        $post_ref =&amp; $post_ref[$val];
+                                                }
+                                        }
+
+                                        if (is_array($row['postdata']))
+                                        {
+                                                $array = array();
+                                                foreach ($row['postdata'] as $k =&gt; $v)
+                                                {
+                                                        $array[$k] = $this-&gt;prep_for_form($v);
+                                                }
+
+                                                $post_ref = $array;
+                                        }
+                                        else
+                                        {
+                                                $post_ref = $this-&gt;prep_for_form($row['postdata']);
+                                        }
+                                }
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Executes the Validation routines
+         *
+         * @access        private
+         * @param        array
+         * @param        array
+         * @param        mixed
+         * @param        integer
+         * @return        mixed
+         */        
+        function _execute($row, $rules, $postdata = NULL, $cycles = 0)
+        {
+                // If the $_POST data is an array we will run a recursive call
+                if (is_array($postdata))
+                { 
+                        foreach ($postdata as $key =&gt; $val)
+                        {
+                                $this-&gt;_execute($row, $rules, $val, $cycles);
+                                $cycles++;
+                        }
+                        
+                        return;
+                }
+                
+                // --------------------------------------------------------------------
+
+                // If the field is blank, but NOT required, no further tests are necessary
+                $callback = FALSE;
+                if ( ! in_array('required', $rules) AND is_null($postdata))
+                {
+                        // Before we bail out, does the rule contain a callback?
+                        if (preg_match(&quot;/(callback_\w+)/&quot;, implode(' ', $rules), $match))
+                        {
+                                $callback = TRUE;
+                                $rules = (array('1' =&gt; $match[1]));
+                        }
+                        else
+                        {
+                                return;
+                        }
+                }
+
+                // --------------------------------------------------------------------
+                
+                // Isset Test. Typically this rule will only apply to checkboxes.
+                if (is_null($postdata) AND $callback == FALSE)
+                {
+                        if (in_array('isset', $rules, TRUE) OR in_array('required', $rules))
+                        {
+                                // Set the message type
+                                $type = (in_array('required', $rules)) ? 'required' : 'isset';
+                        
+                                if ( ! isset($this-&gt;_error_messages[$type]))
+                                {
+                                        if (FALSE === ($line = $this-&gt;CI-&gt;lang-&gt;line($type)))
+                                        {
+                                                $line = 'The field was not set';
+                                        }                                                        
+                                }
+                                else
+                                {
+                                        $line = $this-&gt;_error_messages[$type];
+                                }
+                                
+                                // Build the error message
+                                $message = sprintf($line, $this-&gt;_translate_fieldname($row['label']));
+
+                                // Save the error message
+                                $this-&gt;_field_data[$row['field']]['error'] = $message;
+                                
+                                if ( ! isset($this-&gt;_error_array[$row['field']]))
+                                {
+                                        $this-&gt;_error_array[$row['field']] = $message;
+                                }
+                        }
+                                        
+                        return;
+                }
+
+                // --------------------------------------------------------------------
+
+                // Cycle through each rule and run it
+                foreach ($rules As $rule)
+                {
+                        $_in_array = FALSE;
+                        
+                        // We set the $postdata variable with the current data in our master array so that
+                        // each cycle of the loop is dealing with the processed data from the last cycle
+                        if ($row['is_array'] == TRUE AND is_array($this-&gt;_field_data[$row['field']]['postdata']))
+                        {
+                                // We shouldn't need this safety, but just in case there isn't an array index
+                                // associated with this cycle we'll bail out
+                                if ( ! isset($this-&gt;_field_data[$row['field']]['postdata'][$cycles]))
+                                {
+                                        continue;
+                                }
+                        
+                                $postdata = $this-&gt;_field_data[$row['field']]['postdata'][$cycles];
+                                $_in_array = TRUE;
+                        }
+                        else
+                        {
+                                $postdata = $this-&gt;_field_data[$row['field']]['postdata'];
+                        }
+
+                        // --------------------------------------------------------------------
+        
+                        // Is the rule a callback?                        
+                        $callback = FALSE;
+                        if (substr($rule, 0, 9) == 'callback_')
+                        {
+                                $rule = substr($rule, 9);
+                                $callback = TRUE;
+                        }
+                        
+                        // Strip the parameter (if exists) from the rule
+                        // Rules can contain a parameter: max_length[5]
+                        $param = FALSE;
+                        if (preg_match(&quot;/(.*?)\[(.*?)\]/&quot;, $rule, $match))
+                        {
+                                $rule        = $match[1];
+                                $param        = $match[2];
+                        }
+                        
+                        // Call the function that corresponds to the rule
+                        if ($callback === TRUE)
+                        {
+                                if ( ! method_exists($this-&gt;CI, $rule))
+                                {                 
+                                        continue;
+                                }
+                                
+                                // Run the function and grab the result
+                                $result = $this-&gt;CI-&gt;$rule($postdata, $param);
+
+                                // Re-assign the result to the master data array
+                                if ($_in_array == TRUE)
+                                {
+                                        $this-&gt;_field_data[$row['field']]['postdata'][$cycles] = (is_bool($result)) ? $postdata : $result;
+                                }
+                                else
+                                {
+                                        $this-&gt;_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
+                                }
+                        
+                                // If the field isn't required and we just processed a callback we'll move on...
+                                if ( ! in_array('required', $rules, TRUE) AND $result !== FALSE)
+                                {
+                                        return;
+                                }
+                        }
+                        else
+                        {                                
+                                if ( ! method_exists($this, $rule))
+                                {
+                                        // If our own wrapper function doesn't exist we see if a native PHP function does. 
+                                        // Users can use any native PHP function call that has one param.
+                                        if (function_exists($rule))
+                                        {
+                                                $result = $rule($postdata);
+                                                                                        
+                                                if ($_in_array == TRUE)
+                                                {
+                                                        $this-&gt;_field_data[$row['field']]['postdata'][$cycles] = (is_bool($result)) ? $postdata : $result;
+                                                }
+                                                else
+                                                {
+                                                        $this-&gt;_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
+                                                }
+                                        }
+                                                                                
+                                        continue;
+                                }
+
+                                $result = $this-&gt;$rule($postdata, $param);
+
+                                if ($_in_array == TRUE)
+                                {
+                                        $this-&gt;_field_data[$row['field']]['postdata'][$cycles] = (is_bool($result)) ? $postdata : $result;
+                                }
+                                else
+                                {
+                                        $this-&gt;_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
+                                }
+                        }
+                                                        
+                        // Did the rule test negatively?  If so, grab the error.
+                        if ($result === FALSE)
+                        {                        
+                                if ( ! isset($this-&gt;_error_messages[$rule]))
+                                {
+                                        if (FALSE === ($line = $this-&gt;CI-&gt;lang-&gt;line($rule)))
+                                        {
+                                                $line = 'Unable to access an error message corresponding to your field name.';
+                                        }                                                
+                                }
+                                else
+                                {
+                                        $line = $this-&gt;_error_messages[$rule];
+                                }
+                                
+                                // Is the parameter we are inserting into the error message the name
+                                // of another field?  If so we need to grab its &quot;field label&quot;
+                                if (isset($this-&gt;_field_data[$param]) AND isset($this-&gt;_field_data[$param]['label']))
+                                {
+                                        $param = $this-&gt;_field_data[$param]['label'];
+                                }
+                                
+                                // Build the error message
+                                $message = sprintf($line, $this-&gt;_translate_fieldname($row['label']), $param);
+
+                                // Save the error message
+                                $this-&gt;_field_data[$row['field']]['error'] = $message;
+                                
+                                if ( ! isset($this-&gt;_error_array[$row['field']]))
+                                {
+                                        $this-&gt;_error_array[$row['field']] = $message;
+                                }
+                                
+                                return;
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Translate a field name
+         *
+         * @access        private
+         * @param        string        the field name
+         * @return        string
+         */        
+        function _translate_fieldname($fieldname)
+        {
+                // Do we need to translate the field name?
+                // We look for the prefix lang: to determine this
+                if (substr($fieldname, 0, 5) == 'lang:')
+                {
+                        // Grab the variable
+                        $line = substr($fieldname, 5);                        
+                        
+                        // Were we able to translate the field name?  If not we use $line
+                        if (FALSE === ($fieldname = $this-&gt;CI-&gt;lang-&gt;line($line)))
+                        {
+                                return $line;
+                        }
+                }
+
+                return $fieldname;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get the value from a form
+         *
+         * Permits you to repopulate a form field with the value it was submitted
+         * with, or, if that value doesn't exist, with the default
+         *
+         * @access        public
+         * @param        string        the field name
+         * @param        string
+         * @return        void
+         */        
+        function set_value($field = '', $default = '')
+        {
+                if ( ! isset($this-&gt;_field_data[$field]))
+                {
+                        return $default;
+                }
+                
+                return $this-&gt;_field_data[$field]['postdata'];
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Select
+         *
+         * Enables pull-down lists to be set to the value the user
+         * selected in the event of an error
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function set_select($field = '', $value = '', $default = FALSE)
+        {                
+                if ( ! isset($this-&gt;_field_data[$field]) OR ! isset($this-&gt;_field_data[$field]['postdata']))
+                {
+                        if ($default === TRUE AND count($this-&gt;_field_data) === 0)
+                        {
+                                return ' selected=&quot;selected&quot;';
+                        }
+                        return '';
+                }
+        
+                $field = $this-&gt;_field_data[$field]['postdata'];
+                
+                if (is_array($field))
+                {
+                        if ( ! in_array($value, $field))
+                        {
+                                return '';
+                        }
+                }
+                else
+                {
+                        if (($field == '' OR $value == '') OR ($field != $value))
+                        {
+                                return '';
+                        }
+                }
+                        
+                return ' selected=&quot;selected&quot;';
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Radio
+         *
+         * Enables radio buttons to be set to the value the user
+         * selected in the event of an error
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function set_radio($field = '', $value = '', $default = FALSE)
+        {
+                if ( ! isset($this-&gt;_field_data[$field]) OR ! isset($this-&gt;_field_data[$field]['postdata']))
+                {
+                        if ($default === TRUE AND count($this-&gt;_field_data) === 0)
+                        {
+                                return ' checked=&quot;checked&quot;';
+                        }
+                        return '';
+                }
+        
+                $field = $this-&gt;_field_data[$field]['postdata'];
+                
+                if (is_array($field))
+                {
+                        if ( ! in_array($value, $field))
+                        {
+                                return '';
+                        }
+                }
+                else
+                {
+                        if (($field == '' OR $value == '') OR ($field != $value))
+                        {
+                                return '';
+                        }
+                }
+                        
+                return ' checked=&quot;checked&quot;';
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Checkbox
+         *
+         * Enables checkboxes to be set to the value the user
+         * selected in the event of an error
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function set_checkbox($field = '', $value = '', $default = FALSE)
+        {
+                if ( ! isset($this-&gt;_field_data[$field]) OR ! isset($this-&gt;_field_data[$field]['postdata']))
+                {
+                        if ($default === TRUE AND count($this-&gt;_field_data) === 0)
+                        {
+                                return ' checked=&quot;checked&quot;';
+                        }
+                        return '';
+                }
+        
+                $field = $this-&gt;_field_data[$field]['postdata'];
+                
+                if (is_array($field))
+                {
+                        if ( ! in_array($value, $field))
+                        {
+                                return '';
+                        }
+                }
+                else
+                {
+                        if (($field == '' OR $value == '') OR ($field != $value))
+                        {
+                                return '';
+                        }
+                }
+                        
+                return ' checked=&quot;checked&quot;';
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Required
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function required($str)
+        {
+                if ( ! is_array($str))
+                {
+                        return (trim($str) == '') ? FALSE : TRUE;
+                }
+                else
+                {
+                        return ( ! empty($str));
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Match one field to another
+         *
+         * @access        public
+         * @param        string
+         * @param        field
+         * @return        bool
+         */
+        function matches($str, $field)
+        {
+                if ( ! isset($_POST[$field]))
+                {
+                        return FALSE;                                
+                }
+                
+                $field = $_POST[$field];
+
+                return ($str !== $field) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Minimum Length
+         *
+         * @access        public
+         * @param        string
+         * @param        value
+         * @return        bool
+         */        
+        function min_length($str, $val)
+        {
+                if (preg_match(&quot;/[^0-9]/&quot;, $val))
+                {
+                        return FALSE;
+                }
+
+                if (function_exists('mb_strlen'))
+                {
+                        return (mb_strlen($str) &lt; $val) ? FALSE : TRUE;                
+                }
+        
+                return (strlen($str) &lt; $val) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Max Length
+         *
+         * @access        public
+         * @param        string
+         * @param        value
+         * @return        bool
+         */        
+        function max_length($str, $val)
+        {
+                if (preg_match(&quot;/[^0-9]/&quot;, $val))
+                {
+                        return FALSE;
+                }
+
+                if (function_exists('mb_strlen'))
+                {
+                        return (mb_strlen($str) &gt; $val) ? FALSE : TRUE;                
+                }
+        
+                return (strlen($str) &gt; $val) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Exact Length
+         *
+         * @access        public
+         * @param        string
+         * @param        value
+         * @return        bool
+         */        
+        function exact_length($str, $val)
+        {
+                if (preg_match(&quot;/[^0-9]/&quot;, $val))
+                {
+                        return FALSE;
+                }
+
+                if (function_exists('mb_strlen'))
+                {
+                        return (mb_strlen($str) != $val) ? FALSE : TRUE;                
+                }
+        
+                return (strlen($str) != $val) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Valid Email
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function valid_email($str)
+        {
+                return ( ! preg_match(&quot;/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix&quot;, $str)) ? FALSE : TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Valid Emails
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function valid_emails($str)
+        {
+                if (strpos($str, ',') === FALSE)
+                {
+                        return $this-&gt;valid_email(trim($str));
+                }
+                
+                foreach(explode(',', $str) as $email)
+                {
+                        if (trim($email) != '' &amp;&amp; $this-&gt;valid_email(trim($email)) === FALSE)
+                        {
+                                return FALSE;
+                        }
+                }
+                
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Validate IP Address
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function valid_ip($ip)
+        {
+                return $this-&gt;CI-&gt;input-&gt;valid_ip($ip);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Alpha
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */                
+        function alpha($str)
+        {
+                return ( ! preg_match(&quot;/^([a-z])+$/i&quot;, $str)) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Alpha-numeric
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function alpha_numeric($str)
+        {
+                return ( ! preg_match(&quot;/^([a-z0-9])+$/i&quot;, $str)) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Alpha-numeric with underscores and dashes
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function alpha_dash($str)
+        {
+                return ( ! preg_match(&quot;/^([-a-z0-9_-])+$/i&quot;, $str)) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Numeric
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function numeric($str)
+        {
+                return (bool)preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
+
+        }
+
+        // --------------------------------------------------------------------
+
+    /**
+     * Is Numeric
+     *
+     * @access    public
+     * @param    string
+     * @return    bool
+     */
+    function is_numeric($str)
+    {
+        return ( ! is_numeric($str)) ? FALSE : TRUE;
+    } 
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Integer
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function integer($str)
+        {
+                return (bool)preg_match( '/^[\-+]?[0-9]+$/', $str);
+        }
+        
+        // --------------------------------------------------------------------
+
+    /**
+     * Is a Natural number  (0,1,2,3, etc.)
+     *
+     * @access        public
+     * @param        string
+     * @return        bool
+     */
+    function is_natural($str)
+    {   
+                   return (bool)preg_match( '/^[0-9]+$/', $str);
+    }
+
+        // --------------------------------------------------------------------
+
+    /**
+     * Is a Natural number, but not a zero  (1,2,3, etc.)
+     *
+     * @access        public
+     * @param        string
+     * @return        bool
+     */
+        function is_natural_no_zero($str)
+    {
+            if ( ! preg_match( '/^[0-9]+$/', $str))
+            {
+                    return FALSE;
+            }
+            
+            if ($str == 0)
+            {
+                    return FALSE;
+            }
+    
+                   return TRUE;
+    }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Valid Base64
+         *
+         * Tests a string for characters outside of the Base64 alphabet
+         * as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function valid_base64($str)
+        {
+                return (bool) ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Prep data for form
+         *
+         * This function allows HTML to be safely shown in a form.
+         * Special characters are converted.
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function prep_for_form($data = '')
+        {
+                if (is_array($data))
+                {
+                        foreach ($data as $key =&gt; $val)
+                        {
+                                $data[$key] = $this-&gt;prep_for_form($val);
+                        }
+                        
+                        return $data;
+                }
+                
+                if ($this-&gt;_safe_form_data == FALSE OR $data === '')
+                {
+                        return $data;
+                }
+
+                return str_replace(array(&quot;'&quot;, '&quot;', '&lt;', '&gt;'), array(&quot;&amp;#39;&quot;, &quot;&amp;quot;&quot;, '&amp;lt;', '&amp;gt;'), stripslashes($data));
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Prep URL
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function prep_url($str = '')
+        {
+                if ($str == 'http://' OR $str == '')
+                {
+                        return '';
+                }
+                
+                if (substr($str, 0, 7) != 'http://' &amp;&amp; substr($str, 0, 8) != 'https://')
+                {
+                        $str = 'http://'.$str;
+                }
+                
+                return $str;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Strip Image Tags
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function strip_image_tags($str)
+        {
+                return $this-&gt;CI-&gt;input-&gt;strip_image_tags($str);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * XSS Clean
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function xss_clean($str)
+        {
+                return $this-&gt;CI-&gt;input-&gt;xss_clean($str);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Convert PHP tags to entities
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function encode_php_tags($str)
+        {
+                return str_replace(array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'),  array('&amp;lt;?php', '&amp;lt;?PHP', '&amp;lt;?', '?&amp;gt;'), $str);
+        }
+
+}
+// END Form Validation Class
+
+/* End of file Form_validation.php */
+/* Location: ./system/libraries/Form_validation.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesFtpphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Ftp.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Ftp.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Ftp.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,618 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * FTP Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/ftp.html
+ */
+class CI_FTP {
+
+        var $hostname        = '';
+        var $username        = '';
+        var $password        = '';
+        var $port                = 21;
+        var $passive        = TRUE;
+        var $debug                = FALSE;
+        var $conn_id        = FALSE;
+
+
+        /**
+         * Constructor - Sets Preferences
+         *
+         * The constructor can be passed an array of config values
+         */
+        function CI_FTP($config = array())
+        {
+                if (count($config) &gt; 0)
+                {
+                        $this-&gt;initialize($config);
+                }
+
+                log_message('debug', &quot;FTP Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize preferences
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function initialize($config = array())
+        {
+                foreach ($config as $key =&gt; $val)
+                {
+                        if (isset($this-&gt;$key))
+                        {
+                                $this-&gt;$key = $val;
+                        }
+                }
+
+                // Prep the hostname
+                $this-&gt;hostname = preg_replace('|.+?://|', '', $this-&gt;hostname);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * FTP Connect
+         *
+         * @access        public
+         * @param        array         the connection values
+         * @return        bool
+         */
+        function connect($config = array())
+        {
+                if (count($config) &gt; 0)
+                {
+                        $this-&gt;initialize($config);
+                }
+
+                if (FALSE === ($this-&gt;conn_id = @ftp_connect($this-&gt;hostname, $this-&gt;port)))
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_connect');
+                        }
+                        return FALSE;
+                }
+
+                if ( ! $this-&gt;_login())
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_login');
+                        }
+                        return FALSE;
+                }
+
+                // Set passive mode if needed
+                if ($this-&gt;passive == TRUE)
+                {
+                        ftp_pasv($this-&gt;conn_id, TRUE);
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * FTP Login
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _login()
+        {
+                return @ftp_login($this-&gt;conn_id, $this-&gt;username, $this-&gt;password);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Validates the connection ID
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _is_conn()
+        {
+                if ( ! is_resource($this-&gt;conn_id))
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_no_connection');
+                        }
+                        return FALSE;
+                }
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+
+        /**
+         * Change direcotry
+         *
+         * The second parameter lets us momentarily turn off debugging so that
+         * this function can be used to test for the existance of a folder
+         * without throwing an error.  There's no FTP equivalent to is_dir()
+         * so we do it by trying to change to a particular directory.
+         * Internally, this paramter is only used by the &quot;mirror&quot; function below.
+         *
+         * @access        public
+         * @param        string
+         * @param        bool
+         * @return        bool
+         */
+        function changedir($path = '', $supress_debug = FALSE)
+        {
+                if ($path == '' OR ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                $result = @ftp_chdir($this-&gt;conn_id, $path);
+
+                if ($result === FALSE)
+                {
+                        if ($this-&gt;debug == TRUE AND $supress_debug == FALSE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_changedir');
+                        }
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create a directory
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function mkdir($path = '', $permissions = NULL)
+        {
+                if ($path == '' OR ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                $result = @ftp_mkdir($this-&gt;conn_id, $path);
+
+                if ($result === FALSE)
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_makdir');
+                        }
+                        return FALSE;
+                }
+
+                // Set file permissions if needed
+                if ( ! is_null($permissions))
+                {
+                        $this-&gt;chmod($path, (int)$permissions);
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Upload a file to the server
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @param        string
+         * @return        bool
+         */
+        function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL)
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                if ( ! file_exists($locpath))
+                {
+                        $this-&gt;_error('ftp_no_source_file');
+                        return FALSE;
+                }
+
+                // Set the mode if not specified
+                if ($mode == 'auto')
+                {
+                        // Get the file extension so we can set the upload type
+                        $ext = $this-&gt;_getext($locpath);
+                        $mode = $this-&gt;_settype($ext);
+                }
+
+                $mode = ($mode == 'ascii') ? FTP_ASCII : FTP_BINARY;
+
+                $result = @ftp_put($this-&gt;conn_id, $rempath, $locpath, $mode);
+
+                if ($result === FALSE)
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_upload');
+                        }
+                        return FALSE;
+                }
+
+                // Set file permissions if needed
+                if ( ! is_null($permissions))
+                {
+                        $this-&gt;chmod($rempath, (int)$permissions);
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename (or move) a file
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @param        bool
+         * @return        bool
+         */
+        function rename($old_file, $new_file, $move = FALSE)
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                $result = @ftp_rename($this-&gt;conn_id, $old_file, $new_file);
+
+                if ($result === FALSE)
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $msg = ($move == FALSE) ? 'ftp_unable_to_rename' : 'ftp_unable_to_move';
+
+                                $this-&gt;_error($msg);
+                        }
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Move a file
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        bool
+         */
+        function move($old_file, $new_file)
+        {
+                return $this-&gt;rename($old_file, $new_file, TRUE);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Rename (or move) a file
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function delete_file($filepath)
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                $result = @ftp_delete($this-&gt;conn_id, $filepath);
+
+                if ($result === FALSE)
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_delete');
+                        }
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete a folder and recursively delete everything (including sub-folders)
+         * containted within it.
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function delete_dir($filepath)
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                // Add a trailing slash to the file path if needed
+                $filepath = preg_replace(&quot;/(.+?)\/*$/&quot;, &quot;\\1/&quot;,  $filepath);
+
+                $list = $this-&gt;list_files($filepath);
+
+                if ($list !== FALSE AND count($list) &gt; 0)
+                {
+                        foreach ($list as $item)
+                        {
+                                // If we can't delete the item it's probaly a folder so
+                                // we'll recursively call delete_dir()
+                                if ( ! @ftp_delete($this-&gt;conn_id, $item))
+                                {
+                                        $this-&gt;delete_dir($item);
+                                }
+                        }
+                }
+
+                $result = @ftp_rmdir($this-&gt;conn_id, $filepath);
+
+                if ($result === FALSE)
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_delete');
+                        }
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set file permissions
+         *
+         * @access        public
+         * @param        string         the file path
+         * @param        string        the permissions
+         * @return        bool
+         */
+        function chmod($path, $perm)
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                // Permissions can only be set when running PHP 5
+                if ( ! function_exists('ftp_chmod'))
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_chmod');
+                        }
+                        return FALSE;
+                }
+
+                $result = @ftp_chmod($this-&gt;conn_id, $perm, $path);
+
+                if ($result === FALSE)
+                {
+                        if ($this-&gt;debug == TRUE)
+                        {
+                                $this-&gt;_error('ftp_unable_to_chmod');
+                        }
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * FTP List files in the specified directory
+         *
+         * @access        public
+         * @return        array
+         */
+        function list_files($path = '.')
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                return ftp_nlist($this-&gt;conn_id, $path);
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Read a directory and recreate it remotely
+         *
+         * This function recursively reads a folder and everything it contains (including
+         * sub-folders) and creates a mirror via FTP based on it.  Whatever the directory structure
+         * of the original file path will be recreated on the server.
+         *
+         * @access        public
+         * @param        string        path to source with trailing slash
+         * @param        string        path to destination - include the base folder with trailing slash
+         * @return        bool
+         */
+        function mirror($locpath, $rempath)
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                // Open the local file path
+                if ($fp = @opendir($locpath))
+                {
+                        // Attempt to open the remote file path.
+                        if ( ! $this-&gt;changedir($rempath, TRUE))
+                        {
+                                // If it doesn't exist we'll attempt to create the direcotory
+                                if ( ! $this-&gt;mkdir($rempath) OR ! $this-&gt;changedir($rempath))
+                                {
+                                        return FALSE;
+                                }
+                        }
+
+                        // Recursively read the local directory
+                        while (FALSE !== ($file = readdir($fp)))
+                        {
+                                if (@is_dir($locpath.$file) &amp;&amp; substr($file, 0, 1) != '.')
+                                {
+                                        $this-&gt;mirror($locpath.$file.&quot;/&quot;, $rempath.$file.&quot;/&quot;);
+                                }
+                                elseif (substr($file, 0, 1) != &quot;.&quot;)
+                                {
+                                        // Get the file extension so we can se the upload type
+                                        $ext = $this-&gt;_getext($file);
+                                        $mode = $this-&gt;_settype($ext);
+
+                                        $this-&gt;upload($locpath.$file, $rempath.$file, $mode);
+                                }
+                        }
+                        return TRUE;
+                }
+
+                return FALSE;
+        }
+
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Extract the file extension
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _getext($filename)
+        {
+                if (FALSE === strpos($filename, '.'))
+                {
+                        return 'txt';
+                }
+
+                $x = explode('.', $filename);
+                return end($x);
+        }
+
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set the upload type
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _settype($ext)
+        {
+                $text_types = array(
+                                                        'txt',
+                                                        'text',
+                                                        'php',
+                                                        'phps',
+                                                        'php4',
+                                                        'js',
+                                                        'css',
+                                                        'htm',
+                                                        'html',
+                                                        'phtml',
+                                                        'shtml',
+                                                        'log',
+                                                        'xml'
+                                                        );
+
+
+                return (in_array($ext, $text_types)) ? 'ascii' : 'binary';
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Close the connection
+         *
+         * @access        public
+         * @param        string        path to source
+         * @param        string        path to destination
+         * @return        bool
+         */
+        function close()
+        {
+                if ( ! $this-&gt;_is_conn())
+                {
+                        return FALSE;
+                }
+
+                @ftp_close($this-&gt;conn_id);
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Display error message
+         *
+         * @access        private
+         * @param        string
+         * @return        bool
+         */
+        function _error($line)
+        {
+                $CI =&amp; get_instance();
+                $CI-&gt;lang-&gt;load('ftp');
+                show_error($CI-&gt;lang-&gt;line($line));
+        }
+
+
+}
+// END FTP Class
+
+/* End of file Ftp.php */
+/* Location: ./system/libraries/Ftp.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesHooksphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Hooks.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Hooks.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Hooks.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,226 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Hooks Class
+ *
+ * Provides a mechanism to extend the base system without hacking.  Most of
+ * this class is borrowed from Paul's Extension class in ExpressionEngine.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/encryption.html
+ */
+class CI_Hooks {
+
+        var $enabled                 = FALSE;
+        var $hooks                   = array();
+        var $in_progress        = FALSE;
+
+        /**
+         * Constructor
+         *
+         */
+        function CI_Hooks()
+        {
+                $this-&gt;_initialize();
+                log_message('debug', &quot;Hooks Class Initialized&quot;);
+        }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize the Hooks Preferences
+         *
+         * @access        private
+         * @return        void
+         */  
+          function _initialize()
+          {
+                $CFG =&amp; load_class('Config');
+
+                // If hooks are not enabled in the config file
+                // there is nothing else to do
+
+                if ($CFG-&gt;item('enable_hooks') == FALSE)
+                {
+                        return;
+                }
+
+                // Grab the &quot;hooks&quot; definition file.
+                // If there are no hooks, we're done.
+
+                @include(APPPATH.'config/hooks'.EXT);
+
+                if ( ! isset($hook) OR ! is_array($hook))
+                {
+                        return;
+                }
+
+                $this-&gt;hooks =&amp; $hook;
+                $this-&gt;enabled = TRUE;
+          }
+  
+        // --------------------------------------------------------------------
+
+        /**
+         * Call Hook
+         *
+         * Calls a particular hook
+         *
+         * @access        private
+         * @param        string        the hook name
+         * @return        mixed
+         */
+        function _call_hook($which = '')
+        {
+                if ( ! $this-&gt;enabled OR ! isset($this-&gt;hooks[$which]))
+                {
+                        return FALSE;
+                }
+
+                if (isset($this-&gt;hooks[$which][0]) AND is_array($this-&gt;hooks[$which][0]))
+                {
+                        foreach ($this-&gt;hooks[$which] as $val)
+                        {
+                                $this-&gt;_run_hook($val);
+                        }
+                }
+                else
+                {
+                        $this-&gt;_run_hook($this-&gt;hooks[$which]);
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Run Hook
+         *
+         * Runs a particular hook
+         *
+         * @access        private
+         * @param        array        the hook details
+         * @return        bool
+         */
+        function _run_hook($data)
+        {
+                if ( ! is_array($data))
+                {
+                        return FALSE;
+                }
+
+                // -----------------------------------
+                // Safety - Prevents run-away loops
+                // -----------------------------------
+
+                // If the script being called happens to have the same
+                // hook call within it a loop can happen
+
+                if ($this-&gt;in_progress == TRUE)
+                {
+                        return;
+                }
+
+                // -----------------------------------
+                // Set file path
+                // -----------------------------------
+
+                if ( ! isset($data['filepath']) OR ! isset($data['filename']))
+                {
+                        return FALSE;
+                }
+
+                $filepath = APPPATH.$data['filepath'].'/'.$data['filename'];
+
+                if ( ! file_exists($filepath))
+                {
+                        return FALSE;
+                }
+
+                // -----------------------------------
+                // Set class/function name
+                // -----------------------------------
+
+                $class                = FALSE;
+                $function        = FALSE;
+                $params                = '';
+
+                if (isset($data['class']) AND $data['class'] != '')
+                {
+                        $class = $data['class'];
+                }
+
+                if (isset($data['function']))
+                {
+                        $function = $data['function'];
+                }
+
+                if (isset($data['params']))
+                {
+                        $params = $data['params'];
+                }
+
+                if ($class === FALSE AND $function === FALSE)
+                {
+                        return FALSE;
+                }
+
+                // -----------------------------------
+                // Set the in_progress flag
+                // -----------------------------------
+
+                $this-&gt;in_progress = TRUE;
+
+                // -----------------------------------
+                // Call the requested class and/or function
+                // -----------------------------------
+
+                if ($class !== FALSE)
+                {
+                        if ( ! class_exists($class))
+                        {
+                                require($filepath);
+                        }
+
+                        $HOOK = new $class;
+                        $HOOK-&gt;$function($params);
+                }
+                else
+                {
+                        if ( ! function_exists($function))
+                        {
+                                require($filepath);
+                        }
+
+                        $function($params);
+                }
+
+                $this-&gt;in_progress = FALSE;
+                return TRUE;
+        }
+
+}
+
+// END CI_Hooks class
+
+/* End of file Hooks.php */
+/* Location: ./system/libraries/Hooks.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesImage_libphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Image_lib.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Image_lib.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Image_lib.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1544 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Image Manipulation class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Image_lib
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/image_lib.html
+ */
+class CI_Image_lib {
+
+        var $image_library                = 'gd2';          // Can be:  imagemagick, netpbm, gd, gd2
+        var $library_path                = '';
+        var $dynamic_output                = FALSE;        // Whether to send to browser or write to disk
+        var $source_image                = '';
+        var $new_image                        = '';
+        var $width                                = '';
+        var $height                                = '';
+        var $quality                        = '90';
+        var $create_thumb                = FALSE;
+        var $thumb_marker                = '_thumb';
+        var $maintain_ratio                = TRUE;          // Whether to maintain aspect ratio when resizing or use hard values
+        var $master_dim                        = 'auto';        // auto, height, or width.  Determines what to use as the master dimension
+        var $rotation_angle                = '';
+        var $x_axis                                = '';
+        var        $y_axis                                = '';
+
+        // Watermark Vars
+        var $wm_text                        = '';                        // Watermark text if graphic is not used
+        var $wm_type                        = 'text';                // Type of watermarking.  Options:  text/overlay
+        var $wm_x_transp                = 4;
+        var $wm_y_transp                = 4;
+        var $wm_overlay_path        = '';                        // Watermark image path
+        var $wm_font_path                = '';                        // TT font
+        var $wm_font_size                = 17;                        // Font size (different versions of GD will either use points or pixels)
+        var $wm_vrt_alignment        = 'B';                        // Vertical alignment:   T M B
+        var $wm_hor_alignment        = 'C';                        // Horizontal alignment: L R C
+        var $wm_padding                        = 0;                        // Padding around text
+        var $wm_hor_offset                = 0;                        // Lets you push text to the right
+        var $wm_vrt_offset                = 0;                         // Lets you push  text down
+        var $wm_font_color                = '#ffffff';        // Text color
+        var $wm_shadow_color        = '';                        // Dropshadow color
+        var $wm_shadow_distance        = 2;                        // Dropshadow distance
+        var $wm_opacity                        = 50;                         // Image opacity: 1 - 100  Only works with image
+
+        // Private Vars
+        var $source_folder                = '';
+        var $dest_folder                = '';
+        var $mime_type                        = '';
+        var $orig_width                        = '';
+        var $orig_height                = '';
+        var $image_type                        = '';
+        var $size_str                        = '';
+        var $full_src_path                = '';
+        var $full_dst_path                = '';
+        var $create_fnc                        = 'imagecreatetruecolor';
+        var $copy_fnc                        = 'imagecopyresampled';
+        var $error_msg                        = array();
+        var $wm_use_drop_shadow        = FALSE;
+        var $wm_use_truetype        = FALSE;
+
+        /**
+         * Constructor
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function CI_Image_lib($props = array())
+        {
+                if (count($props) &gt; 0)
+                {
+                        $this-&gt;initialize($props);
+                }
+
+                log_message('debug', &quot;Image Lib Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize image properties
+         *
+         * Resets values in case this class is used in a loop
+         *
+         * @access        public
+         * @return        void
+         */
+        function clear()
+        {
+                $props = array('source_folder', 'dest_folder', 'source_image', 'full_src_path', 'full_dst_path', 'new_image', 'image_type', 'size_str', 'quality', 'orig_width', 'orig_height', 'rotation_angle', 'x_axis', 'y_axis', 'create_fnc', 'copy_fnc', 'wm_overlay_path', 'wm_use_truetype', 'dynamic_output', 'wm_font_size', 'wm_text', 'wm_vrt_alignment', 'wm_hor_alignment', 'wm_padding', 'wm_hor_offset', 'wm_vrt_offset', 'wm_font_color', 'wm_use_drop_shadow', 'wm_shadow_color', 'wm_shadow_distance', 'wm_opacity');
+
+                foreach ($props as $val)
+                {
+                        $this-&gt;$val = '';
+                }
+
+                // special consideration for master_dim
+                $this-&gt;master_dim = 'auto';
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * initialize image preferences
+         *
+         * @access        public
+         * @param        array
+         * @return        bool
+         */
+        function initialize($props = array())
+        {
+                /*
+                 * Convert array elements into class variables
+                 */
+                if (count($props) &gt; 0)
+                {
+                        foreach ($props as $key =&gt; $val)
+                        {
+                                $this-&gt;$key = $val;
+                        }
+                }
+
+                /*
+                 * Is there a source image?
+                 *
+                 * If not, there's no reason to continue
+                 *
+                 */
+                if ($this-&gt;source_image == '')
+                {
+                        $this-&gt;set_error('imglib_source_image_required');
+                        return FALSE;           
+                }
+
+                /*
+                 * Is getimagesize() Available?
+                 *
+                 * We use it to determine the image properties (width/height).
+                 * Note:  We need to figure out how to determine image
+                 * properties using ImageMagick and NetPBM
+                 *
+                 */
+                if ( ! function_exists('getimagesize'))
+                {
+                        $this-&gt;set_error('imglib_gd_required_for_props');
+                        return FALSE;
+                }
+
+                $this-&gt;image_library = strtolower($this-&gt;image_library);
+
+                /*
+                 * Set the full server path
+                 *
+                 * The source image may or may not contain a path.
+                 * Either way, we'll try use realpath to generate the
+                 * full server path in order to more reliably read it.
+                 *
+                 */
+                if (function_exists('realpath') AND @realpath($this-&gt;source_image) !== FALSE)
+                {
+                        $full_source_path = str_replace(&quot;\\&quot;, &quot;/&quot;, realpath($this-&gt;source_image));
+                }
+                else
+                {
+                        $full_source_path = $this-&gt;source_image;
+                }
+
+                $x = explode('/', $full_source_path);
+                $this-&gt;source_image = end($x);
+                $this-&gt;source_folder = str_replace($this-&gt;source_image, '', $full_source_path);
+
+                // Set the Image Properties
+                if ( ! $this-&gt;get_image_properties($this-&gt;source_folder.$this-&gt;source_image))
+                {
+                        return FALSE;           
+                }
+
+                /*
+                 * Assign the &quot;new&quot; image name/path
+                 *
+                 * If the user has set a &quot;new_image&quot; name it means
+                 * we are making a copy of the source image. If not
+                 * it means we are altering the original.  We'll
+                 * set the destination filename and path accordingly.
+                 *
+                 */
+                if ($this-&gt;new_image == '')
+                {
+                        $this-&gt;dest_image = $this-&gt;source_image;
+                        $this-&gt;dest_folder = $this-&gt;source_folder;
+                }
+                else
+                {
+                        if (strpos($this-&gt;new_image, '/') === FALSE)
+                        {
+                                $this-&gt;dest_folder = $this-&gt;source_folder;
+                                $this-&gt;dest_image = $this-&gt;new_image;
+                        }
+                        else
+                        {
+                                if (function_exists('realpath') AND @realpath($this-&gt;new_image) !== FALSE)
+                                {
+                                        $full_dest_path = str_replace(&quot;\\&quot;, &quot;/&quot;, realpath($this-&gt;new_image));
+                                }
+                                else
+                                {
+                                        $full_dest_path = $this-&gt;new_image;
+                                }
+
+                                // Is there a file name?
+                                if ( ! preg_match(&quot;#\.(jpg|jpeg|gif|png)$#i&quot;, $full_dest_path))
+                                {
+                                        $this-&gt;dest_folder = $full_dest_path.'/';
+                                        $this-&gt;dest_image = $this-&gt;source_image;
+                                }
+                                else
+                                {
+                                        $x = explode('/', $full_dest_path);
+                                        $this-&gt;dest_image = end($x);
+                                        $this-&gt;dest_folder = str_replace($this-&gt;dest_image, '', $full_dest_path);
+                                }
+                        }
+                }
+
+                /*
+                 * Compile the finalized filenames/paths
+                 *
+                 * We'll create two master strings containing the
+                 * full server path to the source image and the
+                 * full server path to the destination image.
+                 * We'll also split the destination image name
+                 * so we can insert the thumbnail marker if needed.
+                 *
+                 */
+                if ($this-&gt;create_thumb === FALSE OR $this-&gt;thumb_marker == '')
+                {
+                        $this-&gt;thumb_marker = '';
+                }
+
+                $xp        = $this-&gt;explode_name($this-&gt;dest_image);
+
+                $filename = $xp['name'];
+                $file_ext = $xp['ext'];
+
+                $this-&gt;full_src_path = $this-&gt;source_folder.$this-&gt;source_image;
+                $this-&gt;full_dst_path = $this-&gt;dest_folder.$filename.$this-&gt;thumb_marker.$file_ext;
+
+                /*
+                 * Should we maintain image proportions?
+                 *
+                 * When creating thumbs or copies, the target width/height
+                 * might not be in correct proportion with the source
+                 * image's width/height.  We'll recalculate it here.
+                 *
+                 */
+                if ($this-&gt;maintain_ratio === TRUE &amp;&amp; ($this-&gt;width != '' AND $this-&gt;height != ''))
+                {
+                        $this-&gt;image_reproportion();
+                }
+
+                /*
+                 * Was a width and height specified?
+                 *
+                 * If the destination width/height was
+                 * not submitted we will use the values
+                 * from the actual file
+                 *
+                 */
+                if ($this-&gt;width == '')
+                        $this-&gt;width = $this-&gt;orig_width;
+
+                if ($this-&gt;height == '')
+                        $this-&gt;height = $this-&gt;orig_height;
+
+                // Set the quality
+                $this-&gt;quality = trim(str_replace(&quot;%&quot;, &quot;&quot;, $this-&gt;quality));
+
+                if ($this-&gt;quality == '' OR $this-&gt;quality == 0 OR ! is_numeric($this-&gt;quality))
+                        $this-&gt;quality = 90;
+
+                // Set the x/y coordinates
+                $this-&gt;x_axis = ($this-&gt;x_axis == '' OR ! is_numeric($this-&gt;x_axis)) ? 0 : $this-&gt;x_axis;
+                $this-&gt;y_axis = ($this-&gt;y_axis == '' OR ! is_numeric($this-&gt;y_axis)) ? 0 : $this-&gt;y_axis;
+
+                // Watermark-related Stuff...
+                if ($this-&gt;wm_font_color != '')
+                {
+                        if (strlen($this-&gt;wm_font_color) == 6)
+                        {
+                                $this-&gt;wm_font_color = '#'.$this-&gt;wm_font_color;
+                        }
+                }
+
+                if ($this-&gt;wm_shadow_color != '')
+                {
+                        if (strlen($this-&gt;wm_shadow_color) == 6)
+                        {
+                                $this-&gt;wm_shadow_color = '#'.$this-&gt;wm_shadow_color;
+                        }
+                }
+
+                if ($this-&gt;wm_overlay_path != '')
+                {
+                        $this-&gt;wm_overlay_path = str_replace(&quot;\\&quot;, &quot;/&quot;, realpath($this-&gt;wm_overlay_path));
+                }
+
+                if ($this-&gt;wm_shadow_color != '')
+                {
+                        $this-&gt;wm_use_drop_shadow = TRUE;
+                }
+
+                if ($this-&gt;wm_font_path != '')
+                {
+                        $this-&gt;wm_use_truetype = TRUE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Resize
+         *
+         * This is a wrapper function that chooses the proper
+         * resize function based on the protocol specified
+         *
+         * @access        public
+         * @return        bool
+         */
+        function resize()
+        {
+                $protocol = 'image_process_'.$this-&gt;image_library;
+
+                if (preg_match('/gd2$/i', $protocol))
+                {
+                        $protocol = 'image_process_gd';
+                }
+
+                return $this-&gt;$protocol('resize');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Crop
+         *
+         * This is a wrapper function that chooses the proper
+         * cropping function based on the protocol specified
+         *
+         * @access        public
+         * @return        bool
+         */
+        function crop()
+        {
+                $protocol = 'image_process_'.$this-&gt;image_library;
+
+                if (preg_match('/gd2$/i', $protocol))
+                {
+                        $protocol = 'image_process_gd';
+                }
+
+                return $this-&gt;$protocol('crop');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Rotate
+         *
+         * This is a wrapper function that chooses the proper
+         * rotation function based on the protocol specified
+         *
+         * @access        public
+         * @return        bool
+         */
+        function rotate()
+        {
+                // Allowed rotation values
+                $degs = array(90, 180, 270, 'vrt', 'hor');
+
+                if ($this-&gt;rotation_angle == '' OR ! in_array($this-&gt;rotation_angle, $degs))
+                {
+                        $this-&gt;set_error('imglib_rotation_angle_required');
+                        return FALSE;           
+                }
+
+                // Reassign the width and height
+                if ($this-&gt;rotation_angle == 90 OR $this-&gt;rotation_angle == 270)
+                {
+                        $this-&gt;width        = $this-&gt;orig_height;
+                        $this-&gt;height        = $this-&gt;orig_width;
+                }
+                else
+                {
+                        $this-&gt;width        = $this-&gt;orig_width;
+                        $this-&gt;height        = $this-&gt;orig_height;
+                }
+
+
+                // Choose resizing function
+                if ($this-&gt;image_library == 'imagemagick' OR $this-&gt;image_library == 'netpbm')
+                {
+                        $protocol = 'image_process_'.$this-&gt;image_library;
+
+                        return $this-&gt;$protocol('rotate');
+                }
+
+                if ($this-&gt;rotation_angle == 'hor' OR $this-&gt;rotation_angle == 'vrt')
+                {
+                        return $this-&gt;image_mirror_gd();
+                }
+                else
+                {
+                        return $this-&gt;image_rotate_gd();
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Process Using GD/GD2
+         *
+         * This function will resize or crop
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function image_process_gd($action = 'resize')
+        {
+                $v2_override = FALSE;
+
+                // If the target width/height match the source, AND if the new file name is not equal to the old file name
+                // we'll simply make a copy of the original with the new name... assuming dynamic rendering is off.
+                if ($this-&gt;dynamic_output === FALSE)
+                {
+                        if ($this-&gt;orig_width == $this-&gt;width AND $this-&gt;orig_height == $this-&gt;height)
+                        {
+                                 if ($this-&gt;source_image != $this-&gt;new_image)
+                                 {
+                                        if (@copy($this-&gt;full_src_path, $this-&gt;full_dst_path))
+                                        {
+                                                @chmod($this-&gt;full_dst_path, DIR_WRITE_MODE);
+                                        }
+                                }
+
+                                return TRUE;
+                        }
+                }
+
+                // Let's set up our values based on the action
+                if ($action == 'crop')
+                {
+                        //  Reassign the source width/height if cropping
+                        $this-&gt;orig_width  = $this-&gt;width;
+                        $this-&gt;orig_height = $this-&gt;height;
+
+                        // GD 2.0 has a cropping bug so we'll test for it
+                        if ($this-&gt;gd_version() !== FALSE)
+                        {
+                                $gd_version = str_replace('0', '', $this-&gt;gd_version());
+                                $v2_override = ($gd_version == 2) ? TRUE : FALSE;
+                        }
+                }
+                else
+                {
+                        // If resizing the x/y axis must be zero
+                        $this-&gt;x_axis = 0;
+                        $this-&gt;y_axis = 0;
+                }
+
+                //  Create the image handle
+                if ( ! ($src_img = $this-&gt;image_create_gd()))
+                {
+                        return FALSE;
+                }
+
+                 //  Create The Image
+                //
+                //  old conditional which users report cause problems with shared GD libs who report themselves as &quot;2.0 or greater&quot;
+                //  it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment
+                //  below should that ever prove inaccurate.
+                //
+                //  if ($this-&gt;image_library == 'gd2' AND function_exists('imagecreatetruecolor') AND $v2_override == FALSE)
+                 if ($this-&gt;image_library == 'gd2' AND function_exists('imagecreatetruecolor'))
+                {
+                        $create        = 'imagecreatetruecolor';
+                        $copy        = 'imagecopyresampled';
+                }
+                else
+                {
+                        $create        = 'imagecreate';
+                        $copy        = 'imagecopyresized';
+                }
+
+                $dst_img = $create($this-&gt;width, $this-&gt;height);
+                $copy($dst_img, $src_img, 0, 0, $this-&gt;x_axis, $this-&gt;y_axis, $this-&gt;width, $this-&gt;height, $this-&gt;orig_width, $this-&gt;orig_height);
+
+                //  Show the image
+                if ($this-&gt;dynamic_output == TRUE)
+                {
+                        $this-&gt;image_display_gd($dst_img);
+                }
+                else
+                {
+                        // Or save it
+                        if ( ! $this-&gt;image_save_gd($dst_img))
+                        {
+                                return FALSE;
+                        }
+                }
+
+                //  Kill the file handles
+                imagedestroy($dst_img);
+                imagedestroy($src_img);
+
+                // Set the file to 777
+                @chmod($this-&gt;full_dst_path, DIR_WRITE_MODE);
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Process Using ImageMagick
+         *
+         * This function will resize, crop or rotate
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function image_process_imagemagick($action = 'resize')
+        {
+                //  Do we have a vaild library path?
+                if ($this-&gt;library_path == '')
+                {
+                        $this-&gt;set_error('imglib_libpath_invalid');
+                        return FALSE;
+                }
+
+                if ( ! preg_match(&quot;/convert$/i&quot;, $this-&gt;library_path))
+                {
+                        $this-&gt;library_path = rtrim($this-&gt;library_path, '/').'/';
+
+                        $this-&gt;library_path .= 'convert';
+                }
+
+                // Execute the command
+                $cmd = $this-&gt;library_path.&quot; -quality &quot;.$this-&gt;quality;
+
+                if ($action == 'crop')
+                {
+                        $cmd .= &quot; -crop &quot;.$this-&gt;width.&quot;x&quot;.$this-&gt;height.&quot;+&quot;.$this-&gt;x_axis.&quot;+&quot;.$this-&gt;y_axis.&quot; \&quot;$this-&gt;full_src_path\&quot; \&quot;$this-&gt;full_dst_path\&quot; 2&gt;&amp;1&quot;;
+                }
+                elseif ($action == 'rotate')
+                {
+                        switch ($this-&gt;rotation_angle)
+                        {
+                                case 'hor'         : $angle = '-flop';
+                                        break;
+                                case 'vrt'         : $angle = '-flip';
+                                        break;
+                                default                : $angle = '-rotate '.$this-&gt;rotation_angle;
+                                        break;
+                        }
+
+                        $cmd .= &quot; &quot;.$angle.&quot; \&quot;$this-&gt;full_src_path\&quot; \&quot;$this-&gt;full_dst_path\&quot; 2&gt;&amp;1&quot;;
+                }
+                else  // Resize
+                {
+                        $cmd .= &quot; -resize &quot;.$this-&gt;width.&quot;x&quot;.$this-&gt;height.&quot; \&quot;$this-&gt;full_src_path\&quot; \&quot;$this-&gt;full_dst_path\&quot; 2&gt;&amp;1&quot;;
+                }
+
+                $retval = 1;
+
+                @exec($cmd, $output, $retval);
+
+                //        Did it work?
+                if ($retval &gt; 0)
+                {
+                        $this-&gt;set_error('imglib_image_process_failed');
+                        return FALSE;
+                }
+
+                // Set the file to 777
+                @chmod($this-&gt;full_dst_path, DIR_WRITE_MODE);
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Process Using NetPBM
+         *
+         * This function will resize, crop or rotate
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function image_process_netpbm($action = 'resize')
+        {
+                if ($this-&gt;library_path == '')
+                {
+                        $this-&gt;set_error('imglib_libpath_invalid');
+                        return FALSE;
+                }
+
+                //  Build the resizing command
+                switch ($this-&gt;image_type)
+                {
+                        case 1 :
+                                                $cmd_in                = 'giftopnm';
+                                                $cmd_out        = 'ppmtogif';
+                                break;
+                        case 2 :
+                                                $cmd_in                = 'jpegtopnm';
+                                                $cmd_out        = 'ppmtojpeg';
+                                break;
+                        case 3 :
+                                                $cmd_in                = 'pngtopnm';
+                                                $cmd_out        = 'ppmtopng';
+                                break;
+                }
+
+                if ($action == 'crop')
+                {
+                        $cmd_inner = 'pnmcut -left '.$this-&gt;x_axis.' -top '.$this-&gt;y_axis.' -width '.$this-&gt;width.' -height '.$this-&gt;height;
+                }
+                elseif ($action == 'rotate')
+                {
+                        switch ($this-&gt;rotation_angle)
+                        {
+                                case 90                :        $angle = 'r270';
+                                        break;
+                                case 180        :        $angle = 'r180';
+                                        break;
+                                case 270         :        $angle = 'r90';
+                                        break;
+                                case 'vrt'        :        $angle = 'tb';
+                                        break;
+                                case 'hor'        :        $angle = 'lr';
+                                        break;
+                        }
+
+                        $cmd_inner = 'pnmflip -'.$angle.' ';
+                }
+                else // Resize
+                {
+                        $cmd_inner = 'pnmscale -xysize '.$this-&gt;width.' '.$this-&gt;height;
+                }
+
+                $cmd = $this-&gt;library_path.$cmd_in.' '.$this-&gt;full_src_path.' | '.$cmd_inner.' | '.$cmd_out.' &gt; '.$this-&gt;dest_folder.'netpbm.tmp';
+
+                $retval = 1;
+
+                @exec($cmd, $output, $retval);
+
+                //  Did it work?
+                if ($retval &gt; 0)
+                {
+                        $this-&gt;set_error('imglib_image_process_failed');
+                        return FALSE;
+                }
+
+                // With NetPBM we have to create a temporary image.
+                // If you try manipulating the original it fails so
+                // we have to rename the temp file.
+                copy ($this-&gt;dest_folder.'netpbm.tmp', $this-&gt;full_dst_path);
+                unlink ($this-&gt;dest_folder.'netpbm.tmp');
+                @chmod($this-&gt;full_dst_path, DIR_WRITE_MODE);
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Rotate Using GD
+         *
+         * @access        public
+         * @return        bool
+         */
+        function image_rotate_gd()
+        {
+                // Is Image Rotation Supported?
+                // this function is only supported as of PHP 4.3
+                if ( ! function_exists('imagerotate'))
+                {
+                        $this-&gt;set_error('imglib_rotate_unsupported');
+                        return FALSE;
+                }
+
+                //  Create the image handle
+                if ( ! ($src_img = $this-&gt;image_create_gd()))
+                {
+                        return FALSE;
+                }
+
+                // Set the background color
+                // This won't work with transparent PNG files so we are
+                // going to have to figure out how to determine the color
+                // of the alpha channel in a future release.
+
+                $white        = imagecolorallocate($src_img, 255, 255, 255);
+
+                //  Rotate it!
+                $dst_img = imagerotate($src_img, $this-&gt;rotation_angle, $white);
+
+                //  Save the Image
+                if ($this-&gt;dynamic_output == TRUE)
+                {
+                        $this-&gt;image_display_gd($dst_img);
+                }
+                else
+                {
+                        // Or save it
+                        if ( ! $this-&gt;image_save_gd($dst_img))
+                        {
+                                return FALSE;
+                        }
+                }
+
+                //  Kill the file handles
+                imagedestroy($dst_img);
+                imagedestroy($src_img);
+
+                // Set the file to 777
+
+                @chmod($this-&gt;full_dst_path, DIR_WRITE_MODE);
+
+                return true;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Mirror Image using GD
+         *
+         * This function will flip horizontal or vertical
+         *
+         * @access        public
+         * @return        bool
+         */
+        function image_mirror_gd()
+        {
+                if ( ! $src_img = $this-&gt;image_create_gd())
+                {
+                        return FALSE;
+                }
+
+                $width  = $this-&gt;orig_width;
+                $height = $this-&gt;orig_height;
+
+                if ($this-&gt;rotation_angle == 'hor')
+                {
+                        for ($i = 0; $i &lt; $height; $i++)
+                        {
+                                $left  = 0;
+                                $right = $width-1;
+
+                                while ($left &lt; $right)
+                                {
+                                        $cl = imagecolorat($src_img, $left, $i);
+                                        $cr = imagecolorat($src_img, $right, $i);
+
+                                        imagesetpixel($src_img, $left, $i, $cr);
+                                        imagesetpixel($src_img, $right, $i, $cl);
+
+                                        $left++;
+                                        $right--;
+                                }
+                        }
+                }
+                else
+                {
+                        for ($i = 0; $i &lt; $width; $i++)
+                        {
+                                $top = 0;
+                                $bot = $height-1;
+
+                                while ($top &lt; $bot)
+                                {
+                                        $ct = imagecolorat($src_img, $i, $top);
+                                        $cb = imagecolorat($src_img, $i, $bot);
+
+                                        imagesetpixel($src_img, $i, $top, $cb);
+                                        imagesetpixel($src_img, $i, $bot, $ct);
+
+                                        $top++;
+                                        $bot--;
+                                }
+                        }
+                }
+
+                //  Show the image
+                if ($this-&gt;dynamic_output == TRUE)
+                {
+                        $this-&gt;image_display_gd($src_img);
+                }
+                else
+                {
+                        // Or save it
+                        if ( ! $this-&gt;image_save_gd($src_img))
+                        {
+                                return FALSE;
+                        }
+                }
+
+                //  Kill the file handles
+                imagedestroy($src_img);
+
+                // Set the file to 777
+                @chmod($this-&gt;full_dst_path, DIR_WRITE_MODE);
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Image Watermark
+         *
+         * This is a wrapper function that chooses the type
+         * of watermarking based on the specified preference.
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function watermark()
+        {
+                if ($this-&gt;wm_type == 'overlay')
+                {
+                        return $this-&gt;overlay_watermark();
+                }
+                else
+                {
+                        return $this-&gt;text_watermark();
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Watermark - Graphic Version
+         *
+         * @access        public
+         * @return        bool
+         */
+        function overlay_watermark()
+        {
+                if ( ! function_exists('imagecolortransparent'))
+                {
+                        $this-&gt;set_error('imglib_gd_required');
+                        return FALSE;
+                }
+
+                //  Fetch source image properties
+                $this-&gt;get_image_properties();
+
+                //  Fetch watermark image properties
+                $props                         = $this-&gt;get_image_properties($this-&gt;wm_overlay_path, TRUE);
+                $wm_img_type        = $props['image_type'];
+                $wm_width                = $props['width'];
+                $wm_height                = $props['height'];
+
+                //  Create two image resources
+                $wm_img  = $this-&gt;image_create_gd($this-&gt;wm_overlay_path, $wm_img_type);
+                $src_img = $this-&gt;image_create_gd($this-&gt;full_src_path);
+
+                // Reverse the offset if necessary
+                // When the image is positioned at the bottom
+                // we don't want the vertical offset to push it
+                // further down.  We want the reverse, so we'll
+                // invert the offset.  Same with the horizontal
+                // offset when the image is at the right
+
+                $this-&gt;wm_vrt_alignment = strtoupper(substr($this-&gt;wm_vrt_alignment, 0, 1));
+                $this-&gt;wm_hor_alignment = strtoupper(substr($this-&gt;wm_hor_alignment, 0, 1));
+
+                if ($this-&gt;wm_vrt_alignment == 'B')
+                        $this-&gt;wm_vrt_offset = $this-&gt;wm_vrt_offset * -1;
+
+                if ($this-&gt;wm_hor_alignment == 'R')
+                        $this-&gt;wm_hor_offset = $this-&gt;wm_hor_offset * -1;
+
+                //  Set the base x and y axis values
+                $x_axis = $this-&gt;wm_hor_offset + $this-&gt;wm_padding;
+                $y_axis = $this-&gt;wm_vrt_offset + $this-&gt;wm_padding;
+
+                //  Set the vertical position
+                switch ($this-&gt;wm_vrt_alignment)
+                {
+                        case 'T':
+                                break;
+                        case 'M':        $y_axis += ($this-&gt;orig_height / 2) - ($wm_height / 2);
+                                break;
+                        case 'B':        $y_axis += $this-&gt;orig_height - $wm_height;
+                                break;
+                }
+
+                //  Set the horizontal position
+                switch ($this-&gt;wm_hor_alignment)
+                {
+                        case 'L':
+                                break;
+                        case 'C':        $x_axis += ($this-&gt;orig_width / 2) - ($wm_width / 2);
+                                break;
+                        case 'R':        $x_axis += $this-&gt;orig_width - $wm_width;
+                                break;
+                }
+
+                //  Build the finalized image
+                if ($wm_img_type == 3 AND function_exists('imagealphablending'))
+                {
+                        @imagealphablending($src_img, TRUE);
+                } 
+
+                // Set RGB values for text and shadow
+                $rgba = imagecolorat($wm_img, $this-&gt;wm_x_transp, $this-&gt;wm_y_transp);
+                $alpha = ($rgba &amp; 0x7F000000) &gt;&gt; 24;
+
+                // make a best guess as to whether we're dealing with an image with alpha transparency or no/binary transparency
+                if ($alpha &gt; 0)
+                {
+                        // copy the image directly, the image's alpha transparency being the sole determinant of blending
+                        imagecopy($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height);
+                }
+                else
+                {
+                        // set our RGB value from above to be transparent and merge the images with the specified opacity
+                        imagecolortransparent($wm_img, imagecolorat($wm_img, $this-&gt;wm_x_transp, $this-&gt;wm_y_transp));
+                        imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this-&gt;wm_opacity);
+                }
+
+                //  Output the image
+                if ($this-&gt;dynamic_output == TRUE)
+                {
+                        $this-&gt;image_display_gd($src_img);
+                }
+                else
+                {
+                        if ( ! $this-&gt;image_save_gd($src_img))
+                        {
+                                return FALSE;
+                        }
+                }
+
+                imagedestroy($src_img);
+                imagedestroy($wm_img);
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Watermark - Text Version
+         *
+         * @access        public
+         * @return        bool
+         */
+        function text_watermark()
+        {
+                if ( ! ($src_img = $this-&gt;image_create_gd()))
+                {
+                        return FALSE;
+                }
+
+                if ($this-&gt;wm_use_truetype == TRUE AND ! file_exists($this-&gt;wm_font_path))
+                {
+                        $this-&gt;set_error('imglib_missing_font');
+                        return FALSE;
+                }
+
+                //  Fetch source image properties
+                $this-&gt;get_image_properties();
+
+                // Set RGB values for text and shadow
+                $this-&gt;wm_font_color        = str_replace('#', '', $this-&gt;wm_font_color);
+                $this-&gt;wm_shadow_color        = str_replace('#', '', $this-&gt;wm_shadow_color);
+
+                $R1 = hexdec(substr($this-&gt;wm_font_color, 0, 2));
+                $G1 = hexdec(substr($this-&gt;wm_font_color, 2, 2));
+                $B1 = hexdec(substr($this-&gt;wm_font_color, 4, 2));
+
+                $R2 = hexdec(substr($this-&gt;wm_shadow_color, 0, 2));
+                $G2 = hexdec(substr($this-&gt;wm_shadow_color, 2, 2));
+                $B2 = hexdec(substr($this-&gt;wm_shadow_color, 4, 2));
+
+                $txt_color        = imagecolorclosest($src_img, $R1, $G1, $B1);
+                $drp_color        = imagecolorclosest($src_img, $R2, $G2, $B2);
+
+                // Reverse the vertical offset
+                // When the image is positioned at the bottom
+                // we don't want the vertical offset to push it
+                // further down.  We want the reverse, so we'll
+                // invert the offset.  Note: The horizontal
+                // offset flips itself automatically
+
+                if ($this-&gt;wm_vrt_alignment == 'B')
+                        $this-&gt;wm_vrt_offset = $this-&gt;wm_vrt_offset * -1;
+
+                if ($this-&gt;wm_hor_alignment == 'R')
+                        $this-&gt;wm_hor_offset = $this-&gt;wm_hor_offset * -1;
+
+                // Set font width and height
+                // These are calculated differently depending on
+                // whether we are using the true type font or not
+                if ($this-&gt;wm_use_truetype == TRUE)
+                {
+                        if ($this-&gt;wm_font_size == '')
+                                $this-&gt;wm_font_size = '17';
+
+                        $fontwidth  = $this-&gt;wm_font_size-($this-&gt;wm_font_size/4);
+                        $fontheight = $this-&gt;wm_font_size;
+                        $this-&gt;wm_vrt_offset += $this-&gt;wm_font_size;
+                }
+                else
+                {
+                        $fontwidth  = imagefontwidth($this-&gt;wm_font_size);
+                        $fontheight = imagefontheight($this-&gt;wm_font_size);
+                }
+
+                // Set base X and Y axis values
+                $x_axis = $this-&gt;wm_hor_offset + $this-&gt;wm_padding;
+                $y_axis = $this-&gt;wm_vrt_offset + $this-&gt;wm_padding;
+
+                // Set verticle alignment
+                if ($this-&gt;wm_use_drop_shadow == FALSE)
+                        $this-&gt;wm_shadow_distance = 0;
+
+                $this-&gt;wm_vrt_alignment = strtoupper(substr($this-&gt;wm_vrt_alignment, 0, 1));
+                $this-&gt;wm_hor_alignment = strtoupper(substr($this-&gt;wm_hor_alignment, 0, 1));
+
+                switch ($this-&gt;wm_vrt_alignment)
+                {
+                        case         &quot;T&quot; :
+                                break;
+                        case &quot;M&quot;:        $y_axis += ($this-&gt;orig_height/2)+($fontheight/2);
+                                break;
+                        case &quot;B&quot;:        $y_axis += ($this-&gt;orig_height - $fontheight - $this-&gt;wm_shadow_distance - ($fontheight/2));
+                                break;
+                }
+
+                $x_shad = $x_axis + $this-&gt;wm_shadow_distance;
+                $y_shad = $y_axis + $this-&gt;wm_shadow_distance;
+
+                // Set horizontal alignment
+                switch ($this-&gt;wm_hor_alignment)
+                {
+                        case &quot;L&quot;:
+                                break;
+                        case &quot;R&quot;:
+                                                if ($this-&gt;wm_use_drop_shadow)
+                                                        $x_shad += ($this-&gt;orig_width - $fontwidth*strlen($this-&gt;wm_text));
+                                                        $x_axis += ($this-&gt;orig_width - $fontwidth*strlen($this-&gt;wm_text));
+                                break;
+                        case &quot;C&quot;:
+                                                if ($this-&gt;wm_use_drop_shadow)
+                                                        $x_shad += floor(($this-&gt;orig_width - $fontwidth*strlen($this-&gt;wm_text))/2);
+                                                        $x_axis += floor(($this-&gt;orig_width  -$fontwidth*strlen($this-&gt;wm_text))/2);
+                                break;
+                }
+
+                //  Add the text to the source image
+                if ($this-&gt;wm_use_truetype)
+                {
+                        if ($this-&gt;wm_use_drop_shadow)
+                                imagettftext($src_img, $this-&gt;wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this-&gt;wm_font_path, $this-&gt;wm_text);
+                                imagettftext($src_img, $this-&gt;wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this-&gt;wm_font_path, $this-&gt;wm_text);
+                }
+                else
+                {
+                        if ($this-&gt;wm_use_drop_shadow)
+                                imagestring($src_img, $this-&gt;wm_font_size, $x_shad, $y_shad, $this-&gt;wm_text, $drp_color);
+                                imagestring($src_img, $this-&gt;wm_font_size, $x_axis, $y_axis, $this-&gt;wm_text, $txt_color);
+                }
+
+                //  Output the final image
+                if ($this-&gt;dynamic_output == TRUE)
+                {
+                        $this-&gt;image_display_gd($src_img);
+                }
+                else
+                {
+                        $this-&gt;image_save_gd($src_img);
+                }
+
+                imagedestroy($src_img);
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create Image - GD
+         *
+         * This simply creates an image resource handle
+         * based on the type of image being processed
+         *
+         * @access        public
+         * @param        string
+         * @return        resource
+         */
+        function image_create_gd($path = '', $image_type = '')
+        {
+                if ($path == '')
+                        $path = $this-&gt;full_src_path;
+
+                if ($image_type == '')
+                        $image_type = $this-&gt;image_type;
+
+
+                switch ($image_type)
+                {
+                        case         1 :
+                                                if ( ! function_exists('imagecreatefromgif'))
+                                                {
+                                                        $this-&gt;set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
+                                                        return FALSE;
+                                                }
+
+                                                return imagecreatefromgif($path);
+                                break;
+                        case 2 :
+                                                if ( ! function_exists('imagecreatefromjpeg'))
+                                                {
+                                                        $this-&gt;set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
+                                                        return FALSE;
+                                                }
+
+                                                return imagecreatefromjpeg($path);
+                                break;
+                        case 3 :
+                                                if ( ! function_exists('imagecreatefrompng'))
+                                                {
+                                                        $this-&gt;set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
+                                                        return FALSE;
+                                                }
+
+                                                return imagecreatefrompng($path);
+                                break;
+
+                }
+
+                $this-&gt;set_error(array('imglib_unsupported_imagecreate'));
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Write image file to disk - GD
+         *
+         * Takes an image resource as input and writes the file
+         * to the specified destination
+         *
+         * @access        public
+         * @param        resource
+         * @return        bool
+         */
+        function image_save_gd($resource)
+        {
+                switch ($this-&gt;image_type)
+                {
+                        case 1 :
+                                                if ( ! function_exists('imagegif'))
+                                                {
+                                                        $this-&gt;set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
+                                                        return FALSE;
+                                                }
+
+                                                if ( ! @imagegif($resource, $this-&gt;full_dst_path))
+                                                {
+                                                        $this-&gt;set_error('imglib_save_failed');
+                                                        return FALSE;
+                                                }
+                                break;
+                        case 2        :
+                                                if ( ! function_exists('imagejpeg'))
+                                                {
+                                                        $this-&gt;set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
+                                                        return FALSE;
+                                                }
+
+                                                if (phpversion() == '4.4.1')
+                                                {
+                                                        @touch($this-&gt;full_dst_path); // PHP 4.4.1 bug #35060 - workaround
+                                                }
+
+                                                if ( ! @imagejpeg($resource, $this-&gt;full_dst_path, $this-&gt;quality))
+                                                {
+                                                        $this-&gt;set_error('imglib_save_failed');
+                                                        return FALSE;
+                                                }
+                                break;
+                        case 3        :
+                                                if ( ! function_exists('imagepng'))
+                                                {
+                                                        $this-&gt;set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
+                                                        return FALSE;
+                                                }
+
+                                                if ( ! @imagepng($resource, $this-&gt;full_dst_path))
+                                                {
+                                                        $this-&gt;set_error('imglib_save_failed');
+                                                        return FALSE;
+                                                }
+                                break;
+                        default                :
+                                                        $this-&gt;set_error(array('imglib_unsupported_imagecreate'));
+                                                        return FALSE;
+                                break;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Dynamically outputs an image
+         *
+         * @access        public
+         * @param        resource
+         * @return        void
+         */
+        function image_display_gd($resource)
+        {
+                header(&quot;Content-Disposition: filename={$this-&gt;source_image};&quot;);
+                header(&quot;Content-Type: {$this-&gt;mime_type}&quot;);
+                header('Content-Transfer-Encoding: binary');
+                header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
+
+                switch ($this-&gt;image_type)
+                {
+                        case 1                 :        imagegif($resource);
+                                break;
+                        case 2                :        imagejpeg($resource, '', $this-&gt;quality);
+                                break;
+                        case 3                :        imagepng($resource);
+                                break;
+                        default                :        echo 'Unable to display the image';
+                                break;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Re-proportion Image Width/Height
+         *
+         * When creating thumbs, the desired width/height
+         * can end up warping the image due to an incorrect
+         * ratio between the full-sized image and the thumb.
+         *
+         * This function lets us re-proportion the width/height
+         * if users choose to maintain the aspect ratio when resizing.
+         *
+         * @access        public
+         * @return        void
+         */
+        function image_reproportion()
+        {
+                if ( ! is_numeric($this-&gt;width) OR ! is_numeric($this-&gt;height) OR $this-&gt;width == 0 OR $this-&gt;height == 0)
+                        return;
+
+                if ( ! is_numeric($this-&gt;orig_width) OR ! is_numeric($this-&gt;orig_height) OR $this-&gt;orig_width == 0 OR $this-&gt;orig_height == 0)
+                        return;
+
+                $new_width        = ceil($this-&gt;orig_width*$this-&gt;height/$this-&gt;orig_height);
+                $new_height        = ceil($this-&gt;width*$this-&gt;orig_height/$this-&gt;orig_width);
+
+                $ratio = (($this-&gt;orig_height/$this-&gt;orig_width) - ($this-&gt;height/$this-&gt;width));
+
+                if ($this-&gt;master_dim != 'width' AND $this-&gt;master_dim != 'height')
+                {
+                        $this-&gt;master_dim = ($ratio &lt; 0) ? 'width' : 'height';
+                }
+
+                if (($this-&gt;width != $new_width) AND ($this-&gt;height != $new_height))
+                {
+                        if ($this-&gt;master_dim == 'height')
+                        {
+                                $this-&gt;width = $new_width;
+                        }
+                        else
+                        {
+                                $this-&gt;height = $new_height;
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get image properties
+         *
+         * A helper function that gets info about the file
+         *
+         * @access        public
+         * @param        string
+         * @return        mixed
+         */
+        function get_image_properties($path = '', $return = FALSE)
+        {
+                // For now we require GD but we should
+                // find a way to determine this using IM or NetPBM
+
+                if ($path == '')
+                        $path = $this-&gt;full_src_path;
+
+                if ( ! file_exists($path))
+                {
+                        $this-&gt;set_error('imglib_invalid_path');
+                        return FALSE;
+                }
+
+                $vals = @getimagesize($path);
+
+                $types = array(1 =&gt; 'gif', 2 =&gt; 'jpeg', 3 =&gt; 'png');
+
+                $mime = (isset($types[$vals['2']])) ? 'image/'.$types[$vals['2']] : 'image/jpg';
+
+                if ($return == TRUE)
+                {
+                        $v['width']                        = $vals['0'];
+                        $v['height']                = $vals['1'];
+                        $v['image_type']        = $vals['2'];
+                        $v['size_str']                = $vals['3'];
+                        $v['mime_type']                = $mime;
+
+                        return $v;
+                }
+
+                $this-&gt;orig_width        = $vals['0'];
+                $this-&gt;orig_height        = $vals['1'];
+                $this-&gt;image_type        = $vals['2'];
+                $this-&gt;size_str                = $vals['3'];
+                $this-&gt;mime_type        = $mime;
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Size calculator
+         *
+         * This function takes a known width x height and
+         * recalculates it to a new size.  Only one
+         * new variable needs to be known
+         *
+         *        $props = array(
+         *                                        'width'                 =&gt; $width,
+         *                                        'height'                 =&gt; $height,
+         *                                        'new_width'                =&gt; 40,
+         *                                        'new_height'        =&gt; ''
+         *                                  );
+         *
+         * @access        public
+         * @param        array
+         * @return        array
+         */
+        function size_calculator($vals)
+        {
+                if ( ! is_array($vals))
+                {
+                        return;
+                }
+
+                $allowed = array('new_width', 'new_height', 'width', 'height');
+
+                foreach ($allowed as $item)
+                {
+                        if ( ! isset($vals[$item]) OR $vals[$item] == '')
+                                $vals[$item] = 0;
+                }
+
+                if ($vals['width'] == 0 OR $vals['height'] == 0)
+                {
+                        return $vals;
+                }
+
+                if ($vals['new_width'] == 0)
+                {
+                        $vals['new_width'] = ceil($vals['width']*$vals['new_height']/$vals['height']);
+                }
+                elseif ($vals['new_height'] == 0)
+                {
+                        $vals['new_height'] = ceil($vals['new_width']*$vals['height']/$vals['width']);
+                }
+
+                return $vals;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Explode source_image
+         *
+         * This is a helper function that extracts the extension
+         * from the source_image.  This function lets us deal with
+         * source_images with multiple periods, like:  my.cool.jpg
+         * It returns an associative array with two elements:
+         * $array['ext']  = '.jpg';
+         * $array['name'] = 'my.cool';
+         *
+         * @access        public
+         * @param        array
+         * @return        array
+         */
+        function explode_name($source_image)
+        {
+                $ext = strrchr($source_image, '.');
+                $name = ($ext === FALSE) ? $source_image : substr($source_image, 0, -strlen($ext));
+                
+                return array('ext' =&gt; $ext, 'name' =&gt; $name);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Is GD Installed?
+         *
+         * @access        public
+         * @return        bool
+         */
+        function gd_loaded()
+        {
+                if ( ! extension_loaded('gd'))
+                {
+                        if ( ! dl('gd.so'))
+                        {
+                                return FALSE;
+                        }
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get GD version
+         *
+         * @access        public
+         * @return        mixed
+         */
+        function gd_version()
+        {
+                if (function_exists('gd_info'))
+                {
+                        $gd_version = @gd_info();
+                        $gd_version = preg_replace(&quot;/\D/&quot;, &quot;&quot;, $gd_version['GD Version']);
+
+                        return $gd_version;
+                }
+
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set error message
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_error($msg)
+        {
+                $CI =&amp; get_instance();
+                $CI-&gt;lang-&gt;load('imglib');
+
+                if (is_array($msg))
+                {
+                        foreach ($msg as $val)
+                        {
+
+                                $msg = ($CI-&gt;lang-&gt;line($val) == FALSE) ? $val : $CI-&gt;lang-&gt;line($val);
+                                $this-&gt;error_msg[] = $msg;
+                                log_message('error', $msg);
+                        }
+                }
+                else
+                {
+                        $msg = ($CI-&gt;lang-&gt;line($msg) == FALSE) ? $msg : $CI-&gt;lang-&gt;line($msg);
+                        $this-&gt;error_msg[] = $msg;
+                        log_message('error', $msg);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Show error messages
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function display_errors($open = '&lt;p&gt;', $close = '&lt;/p&gt;')
+        {
+                $str = '';
+                foreach ($this-&gt;error_msg as $val)
+                {
+                        $str .= $open.$val.$close;
+                }
+
+                return $str;
+        }
+
+}
+// END Image_lib Class
+
+/* End of file Image_lib.php */
+/* Location: ./system/libraries/Image_lib.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesInputphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Input.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Input.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Input.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1067 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Input Class
+ *
+ * Pre-processes global input data for security
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Input
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/input.html
+ */
+class CI_Input {
+        var $use_xss_clean                = FALSE;
+        var $xss_hash                        = '';
+        var $ip_address                        = FALSE;
+        var $user_agent                        = FALSE;
+        var $allow_get_array        = FALSE;
+
+        /* never allowed, string replacement */
+        var $never_allowed_str = array(
+                                                                        'document.cookie'        =&gt; '[removed]',
+                                                                        'document.write'        =&gt; '[removed]',
+                                                                        '.parentNode'                =&gt; '[removed]',
+                                                                        '.innerHTML'                =&gt; '[removed]',
+                                                                        'window.location'        =&gt; '[removed]',
+                                                                        '-moz-binding'                =&gt; '[removed]',
+                                                                        '&lt;!--'                                =&gt; '&amp;lt;!--',
+                                                                        '--&gt;'                                =&gt; '--&amp;gt;',
+                                                                        '&lt;![CDATA['                        =&gt; '&amp;lt;![CDATA['
+                                                                        );
+        /* never allowed, regex replacement */
+        var $never_allowed_regex = array(
+                                                                                &quot;javascript\s*:&quot;                        =&gt; '[removed]',
+                                                                                &quot;expression\s*(\(|&amp;\#40;)&quot;        =&gt; '[removed]', // CSS and IE
+                                                                                &quot;vbscript\s*:&quot;                                =&gt; '[removed]', // IE, surprise!
+                                                                                &quot;Redirect\s+302&quot;                        =&gt; '[removed]'
+                                                                        );
+
+        /**
+        * Constructor
+        *
+        * Sets whether to globally enable the XSS processing
+        * and whether to allow the $_GET array
+        *
+        * @access        public
+        */
+        function CI_Input()
+        {
+                log_message('debug', &quot;Input Class Initialized&quot;);
+
+                $CFG =&amp; load_class('Config');
+                $this-&gt;use_xss_clean        = ($CFG-&gt;item('global_xss_filtering') === TRUE) ? TRUE : FALSE;
+                $this-&gt;allow_get_array        = ($CFG-&gt;item('enable_query_strings') === TRUE) ? TRUE : FALSE;
+                $this-&gt;_sanitize_globals();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Sanitize Globals
+        *
+        * This function does the following:
+        *
+        * Unsets $_GET data (if query strings are not enabled)
+        *
+        * Unsets all globals if register_globals is enabled
+        *
+        * Standardizes newline characters to \n
+        *
+        * @access        private
+        * @return        void
+        */
+        function _sanitize_globals()
+        {
+                // Would kind of be &quot;wrong&quot; to unset any of these GLOBALS
+                $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA',
+                                                        'system_folder', 'application_folder', 'BM', 'EXT', 'CFG', 'URI', 'RTR', 'OUT', 'IN');
+
+                // Unset globals for security. 
+                // This is effectively the same as register_globals = off
+                foreach (array($_GET, $_POST, $_COOKIE, $_SERVER, $_FILES, $_ENV, (isset($_SESSION) &amp;&amp; is_array($_SESSION)) ? $_SESSION : array()) as $global)
+                {
+                        if ( ! is_array($global))
+                        {
+                                if ( ! in_array($global, $protected))
+                                {
+                                        unset($GLOBALS[$global]);
+                                }
+                        }
+                        else
+                        {
+                                foreach ($global as $key =&gt; $val)
+                                {
+                                        if ( ! in_array($key, $protected))
+                                        {
+                                                unset($GLOBALS[$key]);
+                                        }
+
+                                        if (is_array($val))
+                                        {
+                                                foreach($val as $k =&gt; $v)
+                                                {
+                                                        if ( ! in_array($k, $protected))
+                                                        {
+                                                                unset($GLOBALS[$k]);
+                                                        }
+                                                }
+                                        }
+                                }
+                        }
+                }
+
+                // Is $_GET data allowed? If not we'll set the $_GET to an empty array
+                if ($this-&gt;allow_get_array == FALSE)
+                {
+                        $_GET = array();
+                }
+                else
+                {
+                        $_GET = $this-&gt;_clean_input_data($_GET);
+                }
+
+                // Clean $_POST Data
+                $_POST = $this-&gt;_clean_input_data($_POST);
+
+                // Clean $_COOKIE Data
+                // Also get rid of specially treated cookies that might be set by a server
+                // or silly application, that are of no use to a CI application anyway
+                // but that when present will trip our 'Disallowed Key Characters' alarm
+                // http://www.ietf.org/rfc/rfc2109.txt
+                // note that the key names below are single quoted strings, and are not PHP variables
+                unset($_COOKIE['$Version']);
+                unset($_COOKIE['$Path']);
+                unset($_COOKIE['$Domain']);
+                $_COOKIE = $this-&gt;_clean_input_data($_COOKIE);
+
+                log_message('debug', &quot;Global POST and COOKIE data sanitized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Clean Input Data
+        *
+        * This is a helper function. It escapes data and
+        * standardizes newline characters to \n
+        *
+        * @access        private
+        * @param        string
+        * @return        string
+        */
+        function _clean_input_data($str)
+        {
+                if (is_array($str))
+                {
+                        $new_array = array();
+                        foreach ($str as $key =&gt; $val)
+                        {
+                                $new_array[$this-&gt;_clean_input_keys($key)] = $this-&gt;_clean_input_data($val);
+                        }
+                        return $new_array;
+                }
+
+                // We strip slashes if magic quotes is on to keep things consistent
+                if (get_magic_quotes_gpc())
+                {
+                        $str = stripslashes($str);
+                }
+
+                // Should we filter the input data?
+                if ($this-&gt;use_xss_clean === TRUE)
+                {
+                        $str = $this-&gt;xss_clean($str);
+                }
+
+                // Standardize newlines
+                if (strpos($str, &quot;\r&quot;) !== FALSE)
+                {
+                        $str = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;), &quot;\n&quot;, $str);
+                }
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Clean Keys
+        *
+        * This is a helper function. To prevent malicious users
+        * from trying to exploit keys we make sure that keys are
+        * only named with alpha-numeric text and a few other items.
+        *
+        * @access        private
+        * @param        string
+        * @return        string
+        */
+        function _clean_input_keys($str)
+        {
+                if ( ! preg_match(&quot;/^[a-z0-9:_\/-]+$/i&quot;, $str))
+                {
+                        exit('Disallowed Key Characters.');
+                }
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Fetch from array
+        *
+        * This is a helper function to retrieve values from global arrays
+        *
+        * @access        private
+        * @param        array
+        * @param        string
+        * @param        bool
+        * @return        string
+        */
+        function _fetch_from_array(&amp;$array, $index = '', $xss_clean = FALSE)
+        {
+                if ( ! isset($array[$index]))
+                {
+                        return FALSE;
+                }
+
+                if ($xss_clean === TRUE)
+                {
+                        return $this-&gt;xss_clean($array[$index]);
+                }
+
+                return $array[$index];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Fetch an item from the GET array
+        *
+        * @access        public
+        * @param        string
+        * @param        bool
+        * @return        string
+        */
+        function get($index = '', $xss_clean = FALSE)
+        {
+                return $this-&gt;_fetch_from_array($_GET, $index, $xss_clean);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Fetch an item from the POST array
+        *
+        * @access        public
+        * @param        string
+        * @param        bool
+        * @return        string
+        */
+        function post($index = '', $xss_clean = FALSE)
+        {
+                return $this-&gt;_fetch_from_array($_POST, $index, $xss_clean);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Fetch an item from either the GET array or the POST
+        *
+        * @access        public
+        * @param        string        The index key
+        * @param        bool        XSS cleaning
+        * @return        string
+        */
+        function get_post($index = '', $xss_clean = FALSE)
+        {
+                if ( ! isset($_POST[$index]) )
+                {
+                        return $this-&gt;get($index, $xss_clean);
+                }
+                else
+                {
+                        return $this-&gt;post($index, $xss_clean);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Fetch an item from the COOKIE array
+        *
+        * @access        public
+        * @param        string
+        * @param        bool
+        * @return        string
+        */
+        function cookie($index = '', $xss_clean = FALSE)
+        {
+                return $this-&gt;_fetch_from_array($_COOKIE, $index, $xss_clean);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Fetch an item from the SERVER array
+        *
+        * @access        public
+        * @param        string
+        * @param        bool
+        * @return        string
+        */
+        function server($index = '', $xss_clean = FALSE)
+        {
+                return $this-&gt;_fetch_from_array($_SERVER, $index, $xss_clean);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Fetch the IP Address
+        *
+        * @access        public
+        * @return        string
+        */
+        function ip_address()
+        {
+                if ($this-&gt;ip_address !== FALSE)
+                {
+                        return $this-&gt;ip_address;
+                }
+                
+                if (config_item('proxy_ips') != '' &amp;&amp; $this-&gt;server('HTTP_X_FORWARDED_FOR') &amp;&amp; $this-&gt;server('REMOTE_ADDR'))
+                {
+                        $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY);
+                        $proxies = is_array($proxies) ? $proxies : array($proxies);
+
+                        $this-&gt;ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
+                }
+                elseif ($this-&gt;server('REMOTE_ADDR') AND $this-&gt;server('HTTP_CLIENT_IP'))
+                {
+                        $this-&gt;ip_address = $_SERVER['HTTP_CLIENT_IP'];
+                }
+                elseif ($this-&gt;server('REMOTE_ADDR'))
+                {
+                        $this-&gt;ip_address = $_SERVER['REMOTE_ADDR'];
+                }
+                elseif ($this-&gt;server('HTTP_CLIENT_IP'))
+                {
+                        $this-&gt;ip_address = $_SERVER['HTTP_CLIENT_IP'];
+                }
+                elseif ($this-&gt;server('HTTP_X_FORWARDED_FOR'))
+                {
+                        $this-&gt;ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
+                }
+
+                if ($this-&gt;ip_address === FALSE)
+                {
+                        $this-&gt;ip_address = '0.0.0.0';
+                        return $this-&gt;ip_address;
+                }
+
+                if (strstr($this-&gt;ip_address, ','))
+                {
+                        $x = explode(',', $this-&gt;ip_address);
+                        $this-&gt;ip_address = trim(end($x));
+                }
+
+                if ( ! $this-&gt;valid_ip($this-&gt;ip_address))
+                {
+                        $this-&gt;ip_address = '0.0.0.0';
+                }
+
+                return $this-&gt;ip_address;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Validate IP Address
+        *
+        * Updated version suggested by Geert De Deckere
+        * 
+        * @access        public
+        * @param        string
+        * @return        string
+        */
+        function valid_ip($ip)
+        {
+                $ip_segments = explode('.', $ip);
+
+                // Always 4 segments needed
+                if (count($ip_segments) != 4)
+                {
+                        return FALSE;
+                }
+                // IP can not start with 0
+                if ($ip_segments[0][0] == '0')
+                {
+                        return FALSE;
+                }
+                // Check each segment
+                foreach ($ip_segments as $segment)
+                {
+                        // IP segments must be digits and can not be 
+                        // longer than 3 digits or greater then 255
+                        if ($segment == '' OR preg_match(&quot;/[^0-9]/&quot;, $segment) OR $segment &gt; 255 OR strlen($segment) &gt; 3)
+                        {
+                                return FALSE;
+                        }
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * User Agent
+        *
+        * @access        public
+        * @return        string
+        */
+        function user_agent()
+        {
+                if ($this-&gt;user_agent !== FALSE)
+                {
+                        return $this-&gt;user_agent;
+                }
+
+                $this-&gt;user_agent = ( ! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT'];
+
+                return $this-&gt;user_agent;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Filename Security
+        *
+        * @access        public
+        * @param        string
+        * @return        string
+        */
+        function filename_security($str)
+        {
+                $bad = array(
+                                                &quot;../&quot;,
+                                                &quot;./&quot;,
+                                                &quot;&lt;!--&quot;,
+                                                &quot;--&gt;&quot;,
+                                                &quot;&lt;&quot;,
+                                                &quot;&gt;&quot;,
+                                                &quot;'&quot;,
+                                                '&quot;',
+                                                '&amp;',
+                                                '$',
+                                                '#',
+                                                '{',
+                                                '}',
+                                                '[',
+                                                ']',
+                                                '=',
+                                                ';',
+                                                '?',
+                                                &quot;%20&quot;,
+                                                &quot;%22&quot;,
+                                                &quot;%3c&quot;,                // &lt;
+                                                &quot;%253c&quot;,         // &lt;
+                                                &quot;%3e&quot;,                 // &gt;
+                                                &quot;%0e&quot;,                 // &gt;
+                                                &quot;%28&quot;,                 // (  
+                                                &quot;%29&quot;,                 // ) 
+                                                &quot;%2528&quot;,         // (
+                                                &quot;%26&quot;,                 // &amp;
+                                                &quot;%24&quot;,                 // $
+                                                &quot;%3f&quot;,                 // ?
+                                                &quot;%3b&quot;,                 // ;
+                                                &quot;%3d&quot;                // =
+                                        );
+
+                return stripslashes(str_replace($bad, '', $str));
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * XSS Clean
+        *
+        * Sanitizes data so that Cross Site Scripting Hacks can be
+        * prevented.  This function does a fair amount of work but
+        * it is extremely thorough, designed to prevent even the
+        * most obscure XSS attempts.  Nothing is ever 100% foolproof,
+        * of course, but I haven't been able to get anything passed
+        * the filter.
+        *
+        * Note: This function should only be used to deal with data
+        * upon submission.  It's not something that should
+        * be used for general runtime processing.
+        *
+        * This function was based in part on some code and ideas I
+        * got from Bitflux: http://blog.bitflux.ch/wiki/XSS_Prevention
+        *
+        * To help develop this script I used this great list of
+        * vulnerabilities along with a few other hacks I've
+        * harvested from examining vulnerabilities in other programs:
+        * http://ha.ckers.org/xss.html
+        *
+        * @access        public
+        * @param        string
+        * @return        string
+        */
+        function xss_clean($str, $is_image = FALSE)
+        {
+                /*
+                * Is the string an array?
+                *
+                */
+                if (is_array($str))
+                {
+                        while (list($key) = each($str))
+                        {
+                                $str[$key] = $this-&gt;xss_clean($str[$key]);
+                        }
+
+                        return $str;
+                }
+
+                /*
+                * Remove Invisible Characters
+                */
+                $str = $this-&gt;_remove_invisible_characters($str);
+
+                /*
+                * Protect GET variables in URLs
+                */
+
+                // 901119URL5918AMP18930PROTECT8198
+
+                $str = preg_replace('|\&amp;([a-z\_0-9]+)\=([a-z\_0-9]+)|i', $this-&gt;xss_hash().&quot;\\1=\\2&quot;, $str);
+
+                /*
+                * Validate standard character entities
+                *
+                * Add a semicolon if missing.  We do this to enable
+                * the conversion of entities to ASCII later.
+                *
+                */
+                $str = preg_replace('#(&amp;\#?[0-9a-z]{2,})([\x00-\x20])*;?#i', &quot;\\1;\\2&quot;, $str);
+
+                /*
+                * Validate UTF16 two byte encoding (x00) 
+                *
+                * Just as above, adds a semicolon if missing.
+                *
+                */
+                $str = preg_replace('#(&amp;\#x?)([0-9A-F]+);?#i',&quot;\\1\\2;&quot;,$str);
+
+                /*
+                * Un-Protect GET variables in URLs
+                */
+                $str = str_replace($this-&gt;xss_hash(), '&amp;', $str);
+
+                /*
+                * URL Decode
+                *
+                * Just in case stuff like this is submitted:
+                *
+                * &lt;a href=&quot;http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D&quot;&gt;Google&lt;/a&gt;
+                *
+                * Note: Use rawurldecode() so it does not remove plus signs
+                *
+                */
+                $str = rawurldecode($str);
+
+                /*
+                * Convert character entities to ASCII 
+                *
+                * This permits our tests below to work reliably.
+                * We only convert entities that are within tags since
+                * these are the ones that will pose security problems.
+                *
+                */
+
+                $str = preg_replace_callback(&quot;/[a-z]+=([\'\&quot;]).*?\\1/si&quot;, array($this, '_convert_attribute'), $str);
+
+                $str = preg_replace_callback(&quot;/&lt;\w+.*?(?=&gt;|&lt;|$)/si&quot;, array($this, '_html_entity_decode_callback'), $str);
+
+                /*
+                * Remove Invisible Characters Again!
+                */
+                $str = $this-&gt;_remove_invisible_characters($str);
+
+                /*
+                * Convert all tabs to spaces
+                *
+                * This prevents strings like this: ja        vascript
+                * NOTE: we deal with spaces between characters later.
+                * NOTE: preg_replace was found to be amazingly slow here on large blocks of data,
+                * so we use str_replace.
+                *
+                */
+
+                 if (strpos($str, &quot;\t&quot;) !== FALSE)
+                {
+                        $str = str_replace(&quot;\t&quot;, ' ', $str);
+                }
+
+                /*
+                * Capture converted string for later comparison
+                */
+                $converted_string = $str;
+
+                /*
+                * Not Allowed Under Any Conditions
+                */
+
+                foreach ($this-&gt;never_allowed_str as $key =&gt; $val)
+                {
+                        $str = str_replace($key, $val, $str);   
+                }
+
+                foreach ($this-&gt;never_allowed_regex as $key =&gt; $val)
+                {
+                        $str = preg_replace(&quot;#&quot;.$key.&quot;#i&quot;, $val, $str);   
+                }
+
+                /*
+                * Makes PHP tags safe
+                *
+                *  Note: XML tags are inadvertently replaced too:
+                *
+                *        &lt;?xml
+                *
+                * But it doesn't seem to pose a problem.
+                *
+                */
+                if ($is_image === TRUE)
+                {
+                        // Images have a tendency to have the PHP short opening and closing tags every so often
+                        // so we skip those and only do the long opening tags.
+                        $str = str_replace(array('&lt;?php', '&lt;?PHP'),  array('&amp;lt;?php', '&amp;lt;?PHP'), $str);
+                }
+                else
+                {
+                        $str = str_replace(array('&lt;?php', '&lt;?PHP', '&lt;?', '?'.'&gt;'),  array('&amp;lt;?php', '&amp;lt;?PHP', '&amp;lt;?', '?&amp;gt;'), $str);
+                }
+
+                /*
+                * Compact any exploded words
+                *
+                * This corrects words like:  j a v a s c r i p t
+                * These words are compacted back to their correct state.
+                *
+                */
+                $words = array('javascript', 'expression', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window');
+                foreach ($words as $word)
+                {
+                        $temp = '';
+
+                        for ($i = 0, $wordlen = strlen($word); $i &lt; $wordlen; $i++)
+                        {
+                                $temp .= substr($word, $i, 1).&quot;\s*&quot;;
+                        }
+
+                        // We only want to do this when it is followed by a non-word character
+                        // That way valid stuff like &quot;dealer to&quot; does not become &quot;dealerto&quot;
+                        $str = preg_replace_callback('#('.substr($temp, 0, -3).')(\W)#is', array($this, '_compact_exploded_words'), $str);
+                }
+
+                /*
+                * Remove disallowed Javascript in links or img tags
+                * We used to do some version comparisons and use of stripos for PHP5, but it is dog slow compared
+                * to these simplified non-capturing preg_match(), especially if the pattern exists in the string
+                */
+                do
+                {
+                        $original = $str;
+
+                        if (preg_match(&quot;/&lt;a/i&quot;, $str))
+                        {
+                                $str = preg_replace_callback(&quot;#&lt;a\s+([^&gt;]*?)(&gt;|$)#si&quot;, array($this, '_js_link_removal'), $str);
+                        }
+
+                        if (preg_match(&quot;/&lt;img/i&quot;, $str))
+                        {
+                                $str = preg_replace_callback(&quot;#&lt;img\s+([^&gt;]*?)(\s?/?&gt;|$)#si&quot;, array($this, '_js_img_removal'), $str);
+                        }
+
+                        if (preg_match(&quot;/script/i&quot;, $str) OR preg_match(&quot;/xss/i&quot;, $str))
+                        {
+                                $str = preg_replace(&quot;#&lt;(/*)(script|xss)(.*?)\&gt;#si&quot;, '[removed]', $str);
+                        }
+                }
+                while($original != $str);
+
+                unset($original);
+
+                /*
+                * Remove JavaScript Event Handlers
+                *
+                * Note: This code is a little blunt.  It removes
+                * the event handler and anything up to the closing &gt;,
+                * but it's unlikely to be a problem.
+                *
+                */
+                $event_handlers = array('[^a-z_\-]on\w*','xmlns');
+
+                if ($is_image === TRUE)
+                {
+                        /*
+                        * Adobe Photoshop puts XML metadata into JFIF images, including namespacing, 
+                        * so we have to allow this for images. -Paul
+                        */
+                        unset($event_handlers[array_search('xmlns', $event_handlers)]);
+                }
+
+                $str = preg_replace(&quot;#&lt;([^&gt;&lt;]+?)(&quot;.implode('|', $event_handlers).&quot;)(\s*=\s*[^&gt;&lt;]*)([&gt;&lt;]*)#i&quot;, &quot;&lt;\\1\\4&quot;, $str);
+
+                /*
+                * Sanitize naughty HTML elements
+                *
+                * If a tag containing any of the words in the list
+                * below is found, the tag gets converted to entities.
+                *
+                * So this: &lt;blink&gt;
+                * Becomes: &amp;lt;blink&amp;gt;
+                *
+                */
+                $naughty = 'alert|applet|audio|basefont|base|behavior|bgsound|blink|body|embed|expression|form|frameset|frame|head|html|ilayer|iframe|input|isindex|layer|link|meta|object|plaintext|style|script|textarea|title|video|xml|xss';
+                $str = preg_replace_callback('#&lt;(/*\s*)('.$naughty.')([^&gt;&lt;]*)([&gt;&lt;]*)#is', array($this, '_sanitize_naughty_html'), $str);
+
+                /*
+                * Sanitize naughty scripting elements
+                *
+                * Similar to above, only instead of looking for
+                * tags it looks for PHP and JavaScript commands
+                * that are disallowed.  Rather than removing the
+                * code, it simply converts the parenthesis to entities
+                * rendering the code un-executable.
+                *
+                * For example:        eval('some code')
+                * Becomes:                eval&amp;#40;'some code'&amp;#41;
+                *
+                */
+                $str = preg_replace('#(alert|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', &quot;\\1\\2&amp;#40;\\3&amp;#41;&quot;, $str);
+
+                /*
+                * Final clean up
+                *
+                * This adds a bit of extra precaution in case
+                * something got through the above filters
+                *
+                */
+                foreach ($this-&gt;never_allowed_str as $key =&gt; $val)
+                {
+                        $str = str_replace($key, $val, $str);   
+                }
+
+                foreach ($this-&gt;never_allowed_regex as $key =&gt; $val)
+                {
+                        $str = preg_replace(&quot;#&quot;.$key.&quot;#i&quot;, $val, $str);
+                }
+
+                /*
+                *  Images are Handled in a Special Way
+                *  - Essentially, we want to know that after all of the character conversion is done whether
+                *  any unwanted, likely XSS, code was found.  If not, we return TRUE, as the image is clean.
+                *  However, if the string post-conversion does not matched the string post-removal of XSS,
+                *  then it fails, as there was unwanted XSS code found and removed/changed during processing.
+                */
+
+                if ($is_image === TRUE)
+                {
+                        if ($str == $converted_string)
+                        {
+                                return TRUE;
+                        }
+                        else
+                        {
+                                return FALSE;
+                        }
+                }
+
+                log_message('debug', &quot;XSS Filtering completed&quot;);
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Random Hash for protecting URLs
+        *
+        * @access        public
+        * @return        string
+        */
+        function xss_hash()
+        {
+                if ($this-&gt;xss_hash == '')
+                {
+                        if (phpversion() &gt;= 4.2)
+                                mt_srand();
+                        else
+                                mt_srand(hexdec(substr(md5(microtime()), -8)) &amp; 0x7fffffff);
+
+                        $this-&gt;xss_hash = md5(time() + mt_rand(0, 1999999999));
+                }
+
+                return $this-&gt;xss_hash;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Remove Invisible Characters
+        *
+        * This prevents sandwiching null characters
+        * between ascii characters, like Java\0script.
+        *
+        * @access        public
+        * @param        string
+        * @return        string
+        */
+        function _remove_invisible_characters($str)
+        {
+                static $non_displayables;
+
+                if ( ! isset($non_displayables))
+                {
+                        // every control character except newline (dec 10), carriage return (dec 13), and horizontal tab (dec 09),
+                        $non_displayables = array(
+                                                                                '/%0[0-8bcef]/',                        // url encoded 00-08, 11, 12, 14, 15
+                                                                                '/%1[0-9a-f]/',                                // url encoded 16-31
+                                                                                '/[\x00-\x08]/',                        // 00-08
+                                                                                '/\x0b/', '/\x0c/',                        // 11, 12
+                                                                                '/[\x0e-\x1f]/'                                // 14-31
+                                                                        );
+                }
+
+                do
+                {
+                        $cleaned = $str;
+                        $str = preg_replace($non_displayables, '', $str);
+                }
+                while ($cleaned != $str);
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Compact Exploded Words
+        *
+        * Callback function for xss_clean() to remove whitespace from
+        * things like j a v a s c r i p t
+        *
+        * @access        public
+        * @param        type
+        * @return        type
+        */
+        function _compact_exploded_words($matches)
+        {
+                return preg_replace('/\s+/s', '', $matches[1]).$matches[2];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Sanitize Naughty HTML
+        *
+        * Callback function for xss_clean() to remove naughty HTML elements
+        *
+        * @access        private
+        * @param        array
+        * @return        string
+        */
+        function _sanitize_naughty_html($matches)
+        {
+                // encode opening brace
+                $str = '&amp;lt;'.$matches[1].$matches[2].$matches[3];
+
+                // encode captured opening or closing brace to prevent recursive vectors
+                $str .= str_replace(array('&gt;', '&lt;'), array('&amp;gt;', '&amp;lt;'), $matches[4]);
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * JS Link Removal
+        *
+        * Callback function for xss_clean() to sanitize links
+        * This limits the PCRE backtracks, making it more performance friendly
+        * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in
+        * PHP 5.2+ on link-heavy strings
+        *
+        * @access        private
+        * @param        array
+        * @return        string
+        */
+        function _js_link_removal($match)
+        {
+                $attributes = $this-&gt;_filter_attributes(str_replace(array('&lt;', '&gt;'), '', $match[1]));
+                return str_replace($match[1], preg_replace(&quot;#href=.*?(alert\(|alert&amp;\#40;|javascript\:|charset\=|window\.|document\.|\.cookie|&lt;script|&lt;xss|base64\s*,)#si&quot;, &quot;&quot;, $attributes), $match[0]);
+        }
+
+        /**
+        * JS Image Removal
+        *
+        * Callback function for xss_clean() to sanitize image tags
+        * This limits the PCRE backtracks, making it more performance friendly
+        * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in
+        * PHP 5.2+ on image tag heavy strings
+        *
+        * @access        private
+        * @param        array
+        * @return        string
+        */
+        function _js_img_removal($match)
+        {
+                $attributes = $this-&gt;_filter_attributes(str_replace(array('&lt;', '&gt;'), '', $match[1]));
+                return str_replace($match[1], preg_replace(&quot;#src=.*?(alert\(|alert&amp;\#40;|javascript\:|charset\=|window\.|document\.|\.cookie|&lt;script|&lt;xss|base64\s*,)#si&quot;, &quot;&quot;, $attributes), $match[0]);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Attribute Conversion
+        *
+        * Used as a callback for XSS Clean
+        *
+        * @access        public
+        * @param        array
+        * @return        string
+        */
+        function _convert_attribute($match)
+        {
+                return str_replace(array('&gt;', '&lt;', '\\'), array('&amp;gt;', '&amp;lt;', '\\\\'), $match[0]);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * HTML Entity Decode Callback
+        *
+        * Used as a callback for XSS Clean
+        *
+        * @access        public
+        * @param        array
+        * @return        string
+        */
+        function _html_entity_decode_callback($match)
+        {
+                $CFG =&amp; load_class('Config');
+                $charset = $CFG-&gt;item('charset');
+
+                return $this-&gt;_html_entity_decode($match[0], strtoupper($charset));
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * HTML Entities Decode
+        *
+        * This function is a replacement for html_entity_decode()
+        *
+        * In some versions of PHP the native function does not work
+        * when UTF-8 is the specified character set, so this gives us
+        * a work-around.  More info here:
+        * http://bugs.php.net/bug.php?id=25670
+        *
+        * @access        private
+        * @param        string
+        * @param        string
+        * @return        string
+        */
+        /* -------------------------------------------------
+        /*  Replacement for html_entity_decode()
+        /* -------------------------------------------------*/
+
+        /*
+        NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the
+        character set, and the PHP developers said they were not back porting the
+        fix to versions other than PHP 5.x.
+        */
+        function _html_entity_decode($str, $charset='UTF-8')
+        {
+                if (stristr($str, '&amp;') === FALSE) return $str;
+
+                // The reason we are not using html_entity_decode() by itself is because
+                // while it is not technically correct to leave out the semicolon
+                // at the end of an entity most browsers will still interpret the entity
+                // correctly.  html_entity_decode() does not convert entities without
+                // semicolons, so we are left with our own little solution here. Bummer.
+
+                if (function_exists('html_entity_decode') &amp;&amp; (strtolower($charset) != 'utf-8' OR version_compare(phpversion(), '5.0.0', '&gt;=')))
+                {
+                        $str = html_entity_decode($str, ENT_COMPAT, $charset);
+                        $str = preg_replace('~&amp;#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec(&quot;\\1&quot;))', $str);
+                        return preg_replace('~&amp;#([0-9]{2,4})~e', 'chr(\\1)', $str);
+                }
+
+                // Numeric Entities
+                $str = preg_replace('~&amp;#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec(&quot;\\1&quot;))', $str);
+                $str = preg_replace('~&amp;#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);
+
+                // Literal Entities - Slightly slow so we do another check
+                if (stristr($str, '&amp;') === FALSE)
+                {
+                        $str = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES)));
+                }
+
+                return $str;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+        * Filter Attributes
+        *
+        * Filters tag attributes for consistency and safety
+        *
+        * @access        public
+        * @param        string
+        * @return        string
+        */
+        function _filter_attributes($str)
+        {
+                $out = '';
+
+                if (preg_match_all('#\s*[a-z\-]+\s*=\s*(\042|\047)([^\\1]*?)\\1#is', $str, $matches))
+                {
+                        foreach ($matches[0] as $match)
+                        {
+                                $out .= preg_replace(&quot;#/\*.*?\*/#s&quot;, '', $match);
+                        }
+                }
+
+                return $out;
+        }
+
+        // --------------------------------------------------------------------
+
+}
+// END Input class
+
+/* End of file Input.php */
+/* Location: ./system/libraries/Input.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesLanguagephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Language.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Language.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Language.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,123 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Language Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Language
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/language.html
+ */
+class CI_Language {
+
+        var $language        = array();
+        var $is_loaded        = array();
+
+        /**
+         * Constructor
+         *
+         * @access        public
+         */
+        function CI_Language()
+        {
+                log_message('debug', &quot;Language Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Load a language file
+         *
+         * @access        public
+         * @param        mixed        the name of the language file to be loaded. Can be an array
+         * @param        string        the language (english, etc.)
+         * @return        mixed
+         */
+        function load($langfile = '', $idiom = '', $return = FALSE)
+        {
+                $langfile = str_replace(EXT, '', str_replace('_lang.', '', $langfile)).'_lang'.EXT;
+
+                if (in_array($langfile, $this-&gt;is_loaded, TRUE))
+                {
+                        return;
+                }
+
+                if ($idiom == '')
+                {
+                        $CI =&amp; get_instance();
+                        $deft_lang = $CI-&gt;config-&gt;item('language');
+                        $idiom = ($deft_lang == '') ? 'english' : $deft_lang;
+                }
+
+                // Determine where the language file is and load it
+                if (file_exists(APPPATH.'language/'.$idiom.'/'.$langfile))
+                {
+                        include(APPPATH.'language/'.$idiom.'/'.$langfile);
+                }
+                else
+                {
+                        if (file_exists(BASEPATH.'language/'.$idiom.'/'.$langfile))
+                        {
+                                include(BASEPATH.'language/'.$idiom.'/'.$langfile);
+                        }
+                        else
+                        {
+                                show_error('Unable to load the requested language file: language/'.$langfile);
+                        }
+                }
+
+                if ( ! isset($lang))
+                {
+                        log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile);
+                        return;
+                }
+
+                if ($return == TRUE)
+                {
+                        return $lang;
+                }
+
+                $this-&gt;is_loaded[] = $langfile;
+                $this-&gt;language = array_merge($this-&gt;language, $lang);
+                unset($lang);
+
+                log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile);
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a single line of text from the language array
+         *
+         * @access        public
+         * @param        string        $line         the language line
+         * @return        string
+         */
+        function line($line = '')
+        {
+                $line = ($line == '' OR ! isset($this-&gt;language[$line])) ? FALSE : $this-&gt;language[$line];
+                return $line;
+        }
+
+}
+// END Language Class
+
+/* End of file Language.php */
+/* Location: ./system/libraries/Language.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesLoaderphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Loader.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Loader.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Loader.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1088 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Loader Class
+ *
+ * Loads views and files
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @category        Loader
+ * @link                http://codeigniter.com/user_guide/libraries/loader.html
+ */
+class CI_Loader {
+
+        // All these are set automatically. Don't mess with them.
+        var $_ci_ob_level;
+        var $_ci_view_path                = '';
+        var $_ci_is_php5                = FALSE;
+        var $_ci_is_instance         = FALSE; // Whether we should use $this or $CI =&amp; get_instance()
+        var $_ci_cached_vars        = array();
+        var $_ci_classes                = array();
+        var $_ci_loaded_files        = array();
+        var $_ci_models                        = array();
+        var $_ci_helpers                = array();
+        var $_ci_plugins                = array();
+        var $_ci_varmap                        = array('unit_test' =&gt; 'unit', 'user_agent' =&gt; 'agent');
+        
+
+        /**
+         * Constructor
+         *
+         * Sets the path to the view files and gets the initial output buffering level
+         *
+         * @access        public
+         */
+        function CI_Loader()
+        {        
+                $this-&gt;_ci_is_php5 = (floor(phpversion()) &gt;= 5) ? TRUE : FALSE;
+                $this-&gt;_ci_view_path = APPPATH.'views/';
+                $this-&gt;_ci_ob_level  = ob_get_level();
+                                
+                log_message('debug', &quot;Loader Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Class Loader
+         *
+         * This function lets users load and instantiate classes.
+         * It is designed to be called from a user's app controllers.
+         *
+         * @access        public
+         * @param        string        the name of the class
+         * @param        mixed        the optional parameters
+         * @param        string        an optional object name
+         * @return        void
+         */        
+        function library($library = '', $params = NULL, $object_name = NULL)
+        {
+                if ($library == '')
+                {
+                        return FALSE;
+                }
+
+                if ( ! is_null($params) AND ! is_array($params))
+                {
+                        $params = NULL;
+                }
+
+                if (is_array($library))
+                {
+                        foreach ($library as $class)
+                        {
+                                $this-&gt;_ci_load_class($class, $params, $object_name);
+                        }
+                }
+                else
+                {
+                        $this-&gt;_ci_load_class($library, $params, $object_name);
+                }
+                
+                $this-&gt;_ci_assign_to_models();
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Model Loader
+         *
+         * This function lets users load and instantiate models.
+         *
+         * @access        public
+         * @param        string        the name of the class
+         * @param        string        name for the model
+         * @param        bool        database connection
+         * @return        void
+         */        
+        function model($model, $name = '', $db_conn = FALSE)
+        {                
+                if (is_array($model))
+                {
+                        foreach($model as $babe)
+                        {
+                                $this-&gt;model($babe);        
+                        }
+                        return;
+                }
+
+                if ($model == '')
+                {
+                        return;
+                }
+        
+                // Is the model in a sub-folder? If so, parse out the filename and path.
+                if (strpos($model, '/') === FALSE)
+                {
+                        $path = '';
+                }
+                else
+                {
+                        $x = explode('/', $model);
+                        $model = end($x);                        
+                        unset($x[count($x)-1]);
+                        $path = implode('/', $x).'/';
+                }
+        
+                if ($name == '')
+                {
+                        $name = $model;
+                }
+                
+                if (in_array($name, $this-&gt;_ci_models, TRUE))
+                {
+                        return;
+                }
+                
+                $CI =&amp; get_instance();
+                if (isset($CI-&gt;$name))
+                {
+                        show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
+                }
+        
+                $model = strtolower($model);
+                
+                if ( ! file_exists(APPPATH.'models/'.$path.$model.EXT))
+                {
+                        show_error('Unable to locate the model you have specified: '.$model);
+                }
+                                
+                if ($db_conn !== FALSE AND ! class_exists('CI_DB'))
+                {
+                        if ($db_conn === TRUE)
+                                $db_conn = '';
+                
+                        $CI-&gt;load-&gt;database($db_conn, FALSE, TRUE);
+                }
+        
+                if ( ! class_exists('Model'))
+                {
+                        load_class('Model', FALSE);
+                }
+
+                require_once(APPPATH.'models/'.$path.$model.EXT);
+
+                $model = ucfirst($model);
+                                
+                $CI-&gt;$name = new $model();
+                $CI-&gt;$name-&gt;_assign_libraries();
+                
+                $this-&gt;_ci_models[] = $name;        
+        }
+                
+        // --------------------------------------------------------------------
+        
+        /**
+         * Database Loader
+         *
+         * @access        public
+         * @param        string        the DB credentials
+         * @param        bool        whether to return the DB object
+         * @param        bool        whether to enable active record (this allows us to override the config setting)
+         * @return        object
+         */        
+        function database($params = '', $return = FALSE, $active_record = FALSE)
+        {
+                // Grab the super object
+                $CI =&amp; get_instance();
+                
+                // Do we even need to load the database class?
+                if (class_exists('CI_DB') AND $return == FALSE AND $active_record == FALSE AND isset($CI-&gt;db) AND is_object($CI-&gt;db))
+                {
+                        return FALSE;
+                }        
+        
+                require_once(BASEPATH.'database/DB'.EXT);
+
+                if ($return === TRUE)
+                {
+                        return DB($params, $active_record);
+                }
+                
+                // Initialize the db variable.  Needed to prevent   
+                // reference errors with some configurations
+                $CI-&gt;db = '';
+                
+                // Load the DB class
+                $CI-&gt;db =&amp; DB($params, $active_record);        
+                
+                // Assign the DB object to any existing models
+                $this-&gt;_ci_assign_to_models();
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Load the Utilities Class
+         *
+         * @access        public
+         * @return        string                
+         */                
+        function dbutil()
+        {
+                if ( ! class_exists('CI_DB'))
+                {
+                        $this-&gt;database();
+                }
+                
+                $CI =&amp; get_instance();
+
+                // for backwards compatibility, load dbforge so we can extend dbutils off it
+                // this use is deprecated and strongly discouraged
+                $CI-&gt;load-&gt;dbforge();
+        
+                require_once(BASEPATH.'database/DB_utility'.EXT);
+                require_once(BASEPATH.'database/drivers/'.$CI-&gt;db-&gt;dbdriver.'/'.$CI-&gt;db-&gt;dbdriver.'_utility'.EXT);
+                $class = 'CI_DB_'.$CI-&gt;db-&gt;dbdriver.'_utility';
+
+                $CI-&gt;dbutil =&amp; new $class();
+
+                $CI-&gt;load-&gt;_ci_assign_to_models();
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Load the Database Forge Class
+         *
+         * @access        public
+         * @return        string                
+         */                
+        function dbforge()
+        {
+                if ( ! class_exists('CI_DB'))
+                {
+                        $this-&gt;database();
+                }
+                
+                $CI =&amp; get_instance();
+        
+                require_once(BASEPATH.'database/DB_forge'.EXT);
+                require_once(BASEPATH.'database/drivers/'.$CI-&gt;db-&gt;dbdriver.'/'.$CI-&gt;db-&gt;dbdriver.'_forge'.EXT);
+                $class = 'CI_DB_'.$CI-&gt;db-&gt;dbdriver.'_forge';
+
+                $CI-&gt;dbforge = new $class();
+                
+                $CI-&gt;load-&gt;_ci_assign_to_models();
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Load View
+         *
+         * This function is used to load a &quot;view&quot; file.  It has three parameters:
+         *
+         * 1. The name of the &quot;view&quot; file to be included.
+         * 2. An associative array of data to be extracted for use in the view.
+         * 3. TRUE/FALSE - whether to return the data or load it.  In
+         * some cases it's advantageous to be able to return data so that
+         * a developer can process it in some way.
+         *
+         * @access        public
+         * @param        string
+         * @param        array
+         * @param        bool
+         * @return        void
+         */
+        function view($view, $vars = array(), $return = FALSE)
+        {
+                return $this-&gt;_ci_load(array('_ci_view' =&gt; $view, '_ci_vars' =&gt; $this-&gt;_ci_object_to_array($vars), '_ci_return' =&gt; $return));
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Load File
+         *
+         * This is a generic file loader
+         *
+         * @access        public
+         * @param        string
+         * @param        bool
+         * @return        string
+         */
+        function file($path, $return = FALSE)
+        {
+                return $this-&gt;_ci_load(array('_ci_path' =&gt; $path, '_ci_return' =&gt; $return));
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Variables
+         *
+         * Once variables are set they become available within
+         * the controller class and its &quot;view&quot; files.
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function vars($vars = array(), $val = '')
+        {
+                if ($val != '' AND is_string($vars))
+                {
+                        $vars = array($vars =&gt; $val);
+                }
+        
+                $vars = $this-&gt;_ci_object_to_array($vars);
+        
+                if (is_array($vars) AND count($vars) &gt; 0)
+                {
+                        foreach ($vars as $key =&gt; $val)
+                        {
+                                $this-&gt;_ci_cached_vars[$key] = $val;
+                        }
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Load Helper
+         *
+         * This function loads the specified helper file.
+         *
+         * @access        public
+         * @param        mixed
+         * @return        void
+         */
+        function helper($helpers = array())
+        {
+                if ( ! is_array($helpers))
+                {
+                        $helpers = array($helpers);
+                }
+        
+                foreach ($helpers as $helper)
+                {                
+                        $helper = strtolower(str_replace(EXT, '', str_replace('_helper', '', $helper)).'_helper');
+
+                        if (isset($this-&gt;_ci_helpers[$helper]))
+                        {
+                                continue;
+                        }
+                        
+                        $ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.EXT;
+
+                        // Is this a helper extension request?                        
+                        if (file_exists($ext_helper))
+                        {
+                                $base_helper = BASEPATH.'helpers/'.$helper.EXT;
+                                
+                                if ( ! file_exists($base_helper))
+                                {
+                                        show_error('Unable to load the requested file: helpers/'.$helper.EXT);
+                                }
+                                
+                                include_once($ext_helper);
+                                include_once($base_helper);
+                        }
+                        elseif (file_exists(APPPATH.'helpers/'.$helper.EXT))
+                        { 
+                                include_once(APPPATH.'helpers/'.$helper.EXT);
+                        }
+                        else
+                        {                
+                                if (file_exists(BASEPATH.'helpers/'.$helper.EXT))
+                                {
+                                        include_once(BASEPATH.'helpers/'.$helper.EXT);
+                                }
+                                else
+                                {
+                                        show_error('Unable to load the requested file: helpers/'.$helper.EXT);
+                                }
+                        }
+
+                        $this-&gt;_ci_helpers[$helper] = TRUE;
+                        log_message('debug', 'Helper loaded: '.$helper);        
+                }                
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Load Helpers
+         *
+         * This is simply an alias to the above function in case the
+         * user has written the plural form of this function.
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function helpers($helpers = array())
+        {
+                $this-&gt;helper($helpers);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Load Plugin
+         *
+         * This function loads the specified plugin.
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function plugin($plugins = array())
+        {
+                if ( ! is_array($plugins))
+                {
+                        $plugins = array($plugins);
+                }
+        
+                foreach ($plugins as $plugin)
+                {        
+                        $plugin = strtolower(str_replace(EXT, '', str_replace('_pi', '', $plugin)).'_pi');                
+
+                        if (isset($this-&gt;_ci_plugins[$plugin]))
+                        {
+                                continue;
+                        }
+
+                        if (file_exists(APPPATH.'plugins/'.$plugin.EXT))
+                        {
+                                include_once(APPPATH.'plugins/'.$plugin.EXT);        
+                        }
+                        else
+                        {
+                                if (file_exists(BASEPATH.'plugins/'.$plugin.EXT))
+                                {
+                                        include_once(BASEPATH.'plugins/'.$plugin.EXT);        
+                                }
+                                else
+                                {
+                                        show_error('Unable to load the requested file: plugins/'.$plugin.EXT);
+                                }
+                        }
+                        
+                        $this-&gt;_ci_plugins[$plugin] = TRUE;
+                        log_message('debug', 'Plugin loaded: '.$plugin);
+                }                
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Load Plugins
+         *
+         * This is simply an alias to the above function in case the
+         * user has written the plural form of this function.
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function plugins($plugins = array())
+        {
+                $this-&gt;plugin($plugins);
+        }
+                
+        // --------------------------------------------------------------------
+        
+        /**
+         * Loads a language file
+         *
+         * @access        public
+         * @param        array
+         * @param        string
+         * @return        void
+         */
+        function language($file = array(), $lang = '')
+        {
+                $CI =&amp; get_instance();
+
+                if ( ! is_array($file))
+                {
+                        $file = array($file);
+                }
+
+                foreach ($file as $langfile)
+                {        
+                        $CI-&gt;lang-&gt;load($langfile, $lang);
+                }
+        }
+
+        /**
+         * Loads language files for scaffolding
+         *
+         * @access        public
+         * @param        string
+         * @return        arra
+         */
+        function scaffold_language($file = '', $lang = '', $return = FALSE)
+        {
+                $CI =&amp; get_instance();
+                return $CI-&gt;lang-&gt;load($file, $lang, $return);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Loads a config file
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
+        {                        
+                $CI =&amp; get_instance();
+                $CI-&gt;config-&gt;load($file, $use_sections, $fail_gracefully);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Scaffolding Loader
+         *
+         * This initializing function works a bit different than the
+         * others. It doesn't load the class.  Instead, it simply
+         * sets a flag indicating that scaffolding is allowed to be
+         * used.  The actual scaffolding function below is
+         * called by the front controller based on whether the
+         * second segment of the URL matches the &quot;secret&quot; scaffolding
+         * word stored in the application/config/routes.php
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function scaffolding($table = '')
+        {                
+                if ($table === FALSE)
+                {
+                        show_error('You must include the name of the table you would like to access when you initialize scaffolding');
+                }
+                
+                $CI =&amp; get_instance();
+                $CI-&gt;_ci_scaffolding = TRUE;
+                $CI-&gt;_ci_scaff_table = $table;
+        }
+
+        // --------------------------------------------------------------------
+                
+        /**
+         * Loader
+         *
+         * This function is used to load views and files.
+         * Variables are prefixed with _ci_ to avoid symbol collision with
+         * variables made available to view files
+         *
+         * @access        private
+         * @param        array
+         * @return        void
+         */
+        function _ci_load($_ci_data)
+        {
+                // Set the default data variables
+                foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
+                {
+                        $$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val];
+                }
+
+                // Set the path to the requested file
+                if ($_ci_path == '')
+                {
+                        $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
+                        $_ci_file = ($_ci_ext == '') ? $_ci_view.EXT : $_ci_view;
+                        $_ci_path = $this-&gt;_ci_view_path.$_ci_file;
+                }
+                else
+                {
+                        $_ci_x = explode('/', $_ci_path);
+                        $_ci_file = end($_ci_x);
+                }
+                
+                if ( ! file_exists($_ci_path))
+                {
+                        show_error('Unable to load the requested file: '.$_ci_file);
+                }
+        
+                // This allows anything loaded using $this-&gt;load (views, files, etc.)
+                // to become accessible from within the Controller and Model functions.
+                // Only needed when running PHP 5
+                
+                if ($this-&gt;_ci_is_instance())
+                {
+                        $_ci_CI =&amp; get_instance();
+                        foreach (get_object_vars($_ci_CI) as $_ci_key =&gt; $_ci_var)
+                        {
+                                if ( ! isset($this-&gt;$_ci_key))
+                                {
+                                        $this-&gt;$_ci_key =&amp; $_ci_CI-&gt;$_ci_key;
+                                }
+                        }
+                }
+
+                /*
+                 * Extract and cache variables
+                 *
+                 * You can either set variables using the dedicated $this-&gt;load_vars()
+                 * function or via the second parameter of this function. We'll merge
+                 * the two types and cache them so that views that are embedded within
+                 * other views can have access to these variables.
+                 */        
+                if (is_array($_ci_vars))
+                {
+                        $this-&gt;_ci_cached_vars = array_merge($this-&gt;_ci_cached_vars, $_ci_vars);
+                }
+                extract($this-&gt;_ci_cached_vars);
+                                
+                /*
+                 * Buffer the output
+                 *
+                 * We buffer the output for two reasons:
+                 * 1. Speed. You get a significant speed boost.
+                 * 2. So that the final rendered template can be
+                 * post-processed by the output class.  Why do we
+                 * need post processing?  For one thing, in order to
+                 * show the elapsed page load time.  Unless we
+                 * can intercept the content right before it's sent to
+                 * the browser and then stop the timer it won't be accurate.
+                 */
+                ob_start();
+                                
+                // If the PHP installation does not support short tags we'll
+                // do a little string replacement, changing the short tags
+                // to standard PHP echo statements.
+                
+                if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE)
+                {
+                        echo eval('?&gt;'.preg_replace(&quot;/;*\s*\?&gt;/&quot;, &quot;; ?&gt;&quot;, str_replace('&lt;?=', '&lt;?php echo ', file_get_contents($_ci_path))));
+                }
+                else
+                {
+                        include($_ci_path); // include() vs include_once() allows for multiple views with the same name
+                }
+                
+                log_message('debug', 'File loaded: '.$_ci_path);
+                
+                // Return the file data if requested
+                if ($_ci_return === TRUE)
+                {                
+                        $buffer = ob_get_contents();
+                        @ob_end_clean();
+                        return $buffer;
+                }
+
+                /*
+                 * Flush the buffer... or buff the flusher?
+                 *
+                 * In order to permit views to be nested within
+                 * other views, we need to flush the content back out whenever
+                 * we are beyond the first level of output buffering so that
+                 * it can be seen and included properly by the first included
+                 * template and any subsequent ones. Oy!
+                 *
+                 */        
+                if (ob_get_level() &gt; $this-&gt;_ci_ob_level + 1)
+                {
+                        ob_end_flush();
+                }
+                else
+                {
+                        // PHP 4 requires that we use a global
+                        global $OUT;
+                        $OUT-&gt;append_output(ob_get_contents());
+                        @ob_end_clean();
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Load class
+         *
+         * This function loads the requested class.
+         *
+         * @access        private
+         * @param         string        the item that is being loaded
+         * @param        mixed        any additional parameters
+         * @param        string        an optional object name
+         * @return         void
+         */
+        function _ci_load_class($class, $params = NULL, $object_name = NULL)
+        {        
+                // Get the class name, and while we're at it trim any slashes.  
+                // The directory path can be included as part of the class name, 
+                // but we don't want a leading slash
+                $class = str_replace(EXT, '', trim($class, '/'));
+        
+                // Was the path included with the class name?
+                // We look for a slash to determine this
+                $subdir = '';
+                if (strpos($class, '/') !== FALSE)
+                {
+                        // explode the path so we can separate the filename from the path
+                        $x = explode('/', $class);        
+                        
+                        // Reset the $class variable now that we know the actual filename
+                        $class = end($x);
+                        
+                        // Kill the filename from the array
+                        unset($x[count($x)-1]);
+                        
+                        // Glue the path back together, sans filename
+                        $subdir = implode($x, '/').'/';
+                }
+
+                // We'll test for both lowercase and capitalized versions of the file name
+                foreach (array(ucfirst($class), strtolower($class)) as $class)
+                {
+                        $subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.EXT;
+
+                        // Is this a class extension request?                        
+                        if (file_exists($subclass))
+                        {
+                                $baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT;
+                                
+                                if ( ! file_exists($baseclass))
+                                {
+                                        log_message('error', &quot;Unable to load the requested class: &quot;.$class);
+                                        show_error(&quot;Unable to load the requested class: &quot;.$class);
+                                }
+
+                                // Safety:  Was the class already loaded by a previous call?
+                                if (in_array($subclass, $this-&gt;_ci_loaded_files))
+                                {
+                                        // Before we deem this to be a duplicate request, let's see
+                                        // if a custom object name is being supplied.  If so, we'll
+                                        // return a new instance of the object
+                                        if ( ! is_null($object_name))
+                                        {
+                                                $CI =&amp; get_instance();
+                                                if ( ! isset($CI-&gt;$object_name))
+                                                {
+                                                        return $this-&gt;_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);                        
+                                                }
+                                        }
+                                        
+                                        $is_duplicate = TRUE;
+                                        log_message('debug', $class.&quot; class already loaded. Second attempt ignored.&quot;);
+                                        return;
+                                }
+        
+                                include_once($baseclass);                                
+                                include_once($subclass);
+                                $this-&gt;_ci_loaded_files[] = $subclass;
+        
+                                return $this-&gt;_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);                        
+                        }
+                
+                        // Lets search for the requested library file and load it.
+                        $is_duplicate = FALSE;                
+                        for ($i = 1; $i &lt; 3; $i++)
+                        {
+                                $path = ($i % 2) ? APPPATH : BASEPATH;        
+                                $filepath = $path.'libraries/'.$subdir.$class.EXT;
+                                
+                                // Does the file exist?  No?  Bummer...
+                                if ( ! file_exists($filepath))
+                                {
+                                        continue;
+                                }
+                                
+                                // Safety:  Was the class already loaded by a previous call?
+                                if (in_array($filepath, $this-&gt;_ci_loaded_files))
+                                {
+                                        // Before we deem this to be a duplicate request, let's see
+                                        // if a custom object name is being supplied.  If so, we'll
+                                        // return a new instance of the object
+                                        if ( ! is_null($object_name))
+                                        {
+                                                $CI =&amp; get_instance();
+                                                if ( ! isset($CI-&gt;$object_name))
+                                                {
+                                                        return $this-&gt;_ci_init_class($class, '', $params, $object_name);
+                                                }
+                                        }
+                                
+                                        $is_duplicate = TRUE;
+                                        log_message('debug', $class.&quot; class already loaded. Second attempt ignored.&quot;);
+                                        return;
+                                }
+                                
+                                include_once($filepath);
+                                $this-&gt;_ci_loaded_files[] = $filepath;
+                                return $this-&gt;_ci_init_class($class, '', $params, $object_name);
+                        }
+                } // END FOREACH
+
+                // One last attempt.  Maybe the library is in a subdirectory, but it wasn't specified?
+                if ($subdir == '')
+                {
+                        $path = strtolower($class).'/'.$class;
+                        return $this-&gt;_ci_load_class($path, $params);
+                }
+                
+                // If we got this far we were unable to find the requested class.
+                // We do not issue errors if the load call failed due to a duplicate request
+                if ($is_duplicate == FALSE)
+                {
+                        log_message('error', &quot;Unable to load the requested class: &quot;.$class);
+                        show_error(&quot;Unable to load the requested class: &quot;.$class);
+                }
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Instantiates a class
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @param        string        an optional object name
+         * @return        null
+         */
+        function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
+        {        
+                // Is there an associated config file for this class?
+                if ($config === NULL)
+                {
+                        // We test for both uppercase and lowercase, for servers that
+                        // are case-sensitive with regard to file names
+                        if (file_exists(APPPATH.'config/'.strtolower($class).EXT))
+                        {
+                                include_once(APPPATH.'config/'.strtolower($class).EXT);
+                        }                        
+                        else
+                        {
+                                if (file_exists(APPPATH.'config/'.ucfirst(strtolower($class)).EXT))
+                                {
+                                        include_once(APPPATH.'config/'.ucfirst(strtolower($class)).EXT);
+                                }                        
+                        }
+                }
+                
+                if ($prefix == '')
+                {                        
+                        if (class_exists('CI_'.$class)) 
+                        {
+                                $name = 'CI_'.$class;
+                        }
+                        elseif (class_exists(config_item('subclass_prefix').$class)) 
+                        {
+                                $name = config_item('subclass_prefix').$class;
+                        }
+                        else
+                        {
+                                $name = $class;
+                        }
+                }
+                else
+                {
+                        $name = $prefix.$class;
+                }
+                
+                // Is the class name valid?
+                if ( ! class_exists($name))
+                {
+                        log_message('error', &quot;Non-existent class: &quot;.$name);
+                        show_error(&quot;Non-existent class: &quot;.$class);
+                }
+                
+                // Set the variable name we will assign the class to
+                // Was a custom class name supplied?  If so we'll use it
+                $class = strtolower($class);
+                
+                if (is_null($object_name))
+                {
+                        $classvar = ( ! isset($this-&gt;_ci_varmap[$class])) ? $class : $this-&gt;_ci_varmap[$class];
+                }
+                else
+                {
+                        $classvar = $object_name;
+                }
+
+                // Save the class name and object name                
+                $this-&gt;_ci_classes[$class] = $classvar;
+
+                // Instantiate the class                
+                $CI =&amp; get_instance();
+                if ($config !== NULL)
+                {
+                        $CI-&gt;$classvar = new $name($config);
+                }
+                else
+                {                
+                        $CI-&gt;$classvar = new $name;
+                }        
+        }         
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Autoloader
+         *
+         * The config/autoload.php file contains an array that permits sub-systems,
+         * libraries, plugins, and helpers to be loaded automatically.
+         *
+         * @access        private
+         * @param        array
+         * @return        void
+         */
+        function _ci_autoloader()
+        {        
+                include_once(APPPATH.'config/autoload'.EXT);
+                
+                if ( ! isset($autoload))
+                {
+                        return FALSE;
+                }
+                
+                // Load any custom config file
+                if (count($autoload['config']) &gt; 0)
+                {                        
+                        $CI =&amp; get_instance();
+                        foreach ($autoload['config'] as $key =&gt; $val)
+                        {
+                                $CI-&gt;config-&gt;load($val);
+                        }
+                }                
+
+                // Autoload plugins, helpers and languages
+                foreach (array('helper', 'plugin', 'language') as $type)
+                {                        
+                        if (isset($autoload[$type]) AND count($autoload[$type]) &gt; 0)
+                        {
+                                $this-&gt;$type($autoload[$type]);
+                        }                
+                }
+
+                // A little tweak to remain backward compatible
+                // The $autoload['core'] item was deprecated
+                if ( ! isset($autoload['libraries']))
+                {
+                        $autoload['libraries'] = $autoload['core'];
+                }
+                
+                // Load libraries
+                if (isset($autoload['libraries']) AND count($autoload['libraries']) &gt; 0)
+                {
+                        // Load the database driver.
+                        if (in_array('database', $autoload['libraries']))
+                        {
+                                $this-&gt;database();
+                                $autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
+                        }
+
+                        // Load scaffolding
+                        if (in_array('scaffolding', $autoload['libraries']))
+                        {
+                                $this-&gt;scaffolding();
+                                $autoload['libraries'] = array_diff($autoload['libraries'], array('scaffolding'));
+                        }
+                
+                        // Load all other libraries
+                        foreach ($autoload['libraries'] as $item)
+                        {
+                                $this-&gt;library($item);
+                        }
+                }                
+
+                // Autoload models
+                if (isset($autoload['model']))
+                {
+                        $this-&gt;model($autoload['model']);
+                }
+
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Assign to Models
+         *
+         * Makes sure that anything loaded by the loader class (libraries, plugins, etc.)
+         * will be available to models, if any exist.
+         *
+         * @access        private
+         * @param        object
+         * @return        array
+         */
+        function _ci_assign_to_models()
+        {
+                if (count($this-&gt;_ci_models) == 0)
+                {
+                        return;
+                }
+        
+                if ($this-&gt;_ci_is_instance())
+                {
+                        $CI =&amp; get_instance();
+                        foreach ($this-&gt;_ci_models as $model)
+                        {                        
+                                $CI-&gt;$model-&gt;_assign_libraries();
+                        }
+                }
+                else
+                {                
+                        foreach ($this-&gt;_ci_models as $model)
+                        {                        
+                                $this-&gt;$model-&gt;_assign_libraries();
+                        }
+                }
+        }          
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Object to Array
+         *
+         * Takes an object as input and converts the class variables to array key/vals
+         *
+         * @access        private
+         * @param        object
+         * @return        array
+         */
+        function _ci_object_to_array($object)
+        {
+                return (is_object($object)) ? get_object_vars($object) : $object;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Determines whether we should use the CI instance or $this
+         *
+         * @access        private
+         * @return        bool
+         */
+        function _ci_is_instance()
+        {
+                if ($this-&gt;_ci_is_php5 == TRUE)
+                {
+                        return TRUE;
+                }
+        
+                global $CI;
+                return (is_object($CI)) ? TRUE : FALSE;
+        }
+
+}
+
+/* End of file Loader.php */
+/* Location: ./system/libraries/Loader.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesLogphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Log.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Log.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Log.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Logging Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Logging
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/general/errors.html
+ */
+class CI_Log {
+
+        var $log_path;
+        var $_threshold        = 1;
+        var $_date_fmt        = 'Y-m-d H:i:s';
+        var $_enabled        = TRUE;
+        var $_levels        = array('ERROR' =&gt; '1', 'DEBUG' =&gt; '2',  'INFO' =&gt; '3', 'ALL' =&gt; '4');
+
+        /**
+         * Constructor
+         *
+         * @access        public
+         */
+        function CI_Log()
+        {
+                $config =&amp; get_config();
+                
+                $this-&gt;log_path = ($config['log_path'] != '') ? $config['log_path'] : BASEPATH.'logs/';
+                
+                if ( ! is_dir($this-&gt;log_path) OR ! is_really_writable($this-&gt;log_path))
+                {
+                        $this-&gt;_enabled = FALSE;
+                }
+                
+                if (is_numeric($config['log_threshold']))
+                {
+                        $this-&gt;_threshold = $config['log_threshold'];
+                }
+                        
+                if ($config['log_date_format'] != '')
+                {
+                        $this-&gt;_date_fmt = $config['log_date_format'];
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Write Log File
+         *
+         * Generally this function will be called using the global log_message() function
+         *
+         * @access        public
+         * @param        string        the error level
+         * @param        string        the error message
+         * @param        bool        whether the error is a native PHP error
+         * @return        bool
+         */                
+        function write_log($level = 'error', $msg, $php_error = FALSE)
+        {                
+                if ($this-&gt;_enabled === FALSE)
+                {
+                        return FALSE;
+                }
+        
+                $level = strtoupper($level);
+                
+                if ( ! isset($this-&gt;_levels[$level]) OR ($this-&gt;_levels[$level] &gt; $this-&gt;_threshold))
+                {
+                        return FALSE;
+                }
+        
+                $filepath = $this-&gt;log_path.'log-'.date('Y-m-d').EXT;
+                $message  = '';
+                
+                if ( ! file_exists($filepath))
+                {
+                        $message .= &quot;&lt;&quot;.&quot;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?&quot;.&quot;&gt;\n\n&quot;;
+                }
+                        
+                if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))
+                {
+                        return FALSE;
+                }
+
+                $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this-&gt;_date_fmt). ' --&gt; '.$msg.&quot;\n&quot;;
+                
+                flock($fp, LOCK_EX);        
+                fwrite($fp, $message);
+                flock($fp, LOCK_UN);
+                fclose($fp);
+        
+                @chmod($filepath, FILE_WRITE_MODE);                 
+                return TRUE;
+        }
+
+}
+// END Log Class
+
+/* End of file Log.php */
+/* Location: ./system/libraries/Log.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesModelphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Model.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Model.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Model.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Model Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/config.html
+ */
+class Model {
+
+        var $_parent_name = '';
+
+        /**
+         * Constructor
+         *
+         * @access public
+         */
+        function Model()
+        {
+                // If the magic __get() or __set() methods are used in a Model references can't be used.
+                $this-&gt;_assign_libraries( (method_exists($this, '__get') OR method_exists($this, '__set')) ? FALSE : TRUE );
+                
+                // We don't want to assign the model object to itself when using the
+                // assign_libraries function below so we'll grab the name of the model parent
+                $this-&gt;_parent_name = ucfirst(get_class($this));
+                
+                log_message('debug', &quot;Model Class Initialized&quot;);
+        }
+
+        /**
+         * Assign Libraries
+         *
+         * Creates local references to all currently instantiated objects
+         * so that any syntax that can be legally used in a controller
+         * can be used within models.  
+         *
+         * @access private
+         */        
+        function _assign_libraries($use_reference = TRUE)
+        {
+                $CI =&amp; get_instance();                                
+                foreach (array_keys(get_object_vars($CI)) as $key)
+                {
+                        if ( ! isset($this-&gt;$key) AND $key != $this-&gt;_parent_name)
+                        {                        
+                                // In some cases using references can cause
+                                // problems so we'll conditionally use them
+                                if ($use_reference == TRUE)
+                                {
+                                        $this-&gt;$key = NULL; // Needed to prevent reference errors with some configurations
+                                        $this-&gt;$key =&amp; $CI-&gt;$key;
+                                }
+                                else
+                                {
+                                        $this-&gt;$key = $CI-&gt;$key;
+                                }
+                        }
+                }                
+        }
+
+}
+// END Model Class
+
+/* End of file Model.php */
+/* Location: ./system/libraries/Model.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesOutputphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Output.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Output.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Output.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,478 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Output Class
+ *
+ * Responsible for sending final output to browser
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Output
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/output.html
+ */
+class CI_Output {
+
+        var $final_output;
+        var $cache_expiration        = 0;
+        var $headers                         = array();
+        var $enable_profiler         = FALSE;
+
+
+        function CI_Output()
+        {
+                log_message('debug', &quot;Output Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get Output
+         *
+         * Returns the current output string
+         *
+         * @access        public
+         * @return        string
+         */        
+        function get_output()
+        {
+                return $this-&gt;final_output;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Output
+         *
+         * Sets the output string
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_output($output)
+        {
+                $this-&gt;final_output = $output;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Append Output
+         *
+         * Appends data onto the output string
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function append_output($output)
+        {
+                if ($this-&gt;final_output == '')
+                {
+                        $this-&gt;final_output = $output;
+                }
+                else
+                {
+                        $this-&gt;final_output .= $output;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set Header
+         *
+         * Lets you set a server header which will be outputted with the final display.
+         *
+         * Note:  If a file is cached, headers will not be sent.  We need to figure out
+         * how to permit header data to be saved with the cache data...
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_header($header, $replace = TRUE)
+        {
+                $this-&gt;headers[] = array($header, $replace);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set HTTP Status Header
+         *
+         * @access        public
+         * @param        int         the status code
+         * @param        string        
+         * @return        void
+         */        
+        function set_status_header($code = '200', $text = '')
+        {
+                $stati = array(
+                                                        '200'        =&gt; 'OK',
+                                                        '201'        =&gt; 'Created',
+                                                        '202'        =&gt; 'Accepted',
+                                                        '203'        =&gt; 'Non-Authoritative Information',
+                                                        '204'        =&gt; 'No Content',
+                                                        '205'        =&gt; 'Reset Content',
+                                                        '206'        =&gt; 'Partial Content',
+                                                        
+                                                        '300'        =&gt; 'Multiple Choices',
+                                                        '301'        =&gt; 'Moved Permanently',
+                                                        '302'        =&gt; 'Found',
+                                                        '304'        =&gt; 'Not Modified',
+                                                        '305'        =&gt; 'Use Proxy',
+                                                        '307'        =&gt; 'Temporary Redirect',
+                                                        
+                                                        '400'        =&gt; 'Bad Request',
+                                                        '401'        =&gt; 'Unauthorized',
+                                                        '403'        =&gt; 'Forbidden',
+                                                        '404'        =&gt; 'Not Found',
+                                                        '405'        =&gt; 'Method Not Allowed',
+                                                        '406'        =&gt; 'Not Acceptable',
+                                                        '407'        =&gt; 'Proxy Authentication Required',
+                                                        '408'        =&gt; 'Request Timeout',
+                                                        '409'        =&gt; 'Conflict',
+                                                        '410'        =&gt; 'Gone',
+                                                        '411'        =&gt; 'Length Required',
+                                                        '412'        =&gt; 'Precondition Failed',
+                                                        '413'        =&gt; 'Request Entity Too Large',
+                                                        '414'        =&gt; 'Request-URI Too Long',
+                                                        '415'        =&gt; 'Unsupported Media Type',
+                                                        '416'        =&gt; 'Requested Range Not Satisfiable',
+                                                        '417'        =&gt; 'Expectation Failed',
+                
+                                                        '500'        =&gt; 'Internal Server Error',
+                                                        '501'        =&gt; 'Not Implemented',
+                                                        '502'        =&gt; 'Bad Gateway',
+                                                        '503'        =&gt; 'Service Unavailable',
+                                                        '504'        =&gt; 'Gateway Timeout',
+                                                        '505'        =&gt; 'HTTP Version Not Supported'
+                                                );
+
+                if ($code == '' OR ! is_numeric($code))
+                {
+                        show_error('Status codes must be numeric');
+                }
+
+                if (isset($stati[$code]) AND $text == '')
+                {                                
+                        $text = $stati[$code];
+                }
+                
+                if ($text == '')
+                {
+                        show_error('No status text available.  Please check your status code number or supply your own message text.');
+                }
+                
+                $server_protocol = (isset($_SERVER['SERVER_PROTOCOL'])) ? $_SERVER['SERVER_PROTOCOL'] : FALSE;
+        
+                if (substr(php_sapi_name(), 0, 3) == 'cgi')
+                {
+                        header(&quot;Status: {$code} {$text}&quot;, TRUE);
+                }
+                elseif ($server_protocol == 'HTTP/1.1' OR $server_protocol == 'HTTP/1.0')
+                {
+                        header($server_protocol.&quot; {$code} {$text}&quot;, TRUE, $code);
+                }
+                else
+                {
+                        header(&quot;HTTP/1.1 {$code} {$text}&quot;, TRUE, $code);
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Enable/disable Profiler
+         *
+         * @access        public
+         * @param        bool
+         * @return        void
+         */        
+        function enable_profiler($val = TRUE)
+        {
+                $this-&gt;enable_profiler = (is_bool($val)) ? $val : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Cache
+         *
+         * @access        public
+         * @param        integer
+         * @return        void
+         */        
+        function cache($time)
+        {
+                $this-&gt;cache_expiration = ( ! is_numeric($time)) ? 0 : $time;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Display Output
+         *
+         * All &quot;view&quot; data is automatically put into this variable by the controller class:
+         *
+         * $this-&gt;final_output
+         *
+         * This function sends the finalized output data to the browser along
+         * with any server headers and profile data.  It also stops the
+         * benchmark timer so the page rendering speed and memory usage can be shown.
+         *
+         * @access        public
+         * @return        mixed
+         */                
+        function _display($output = '')
+        {        
+                // Note:  We use globals because we can't use $CI =&amp; get_instance()
+                // since this function is sometimes called by the caching mechanism,
+                // which happens before the CI super object is available.
+                global $BM, $CFG;
+                
+                // --------------------------------------------------------------------
+                
+                // Set the output data
+                if ($output == '')
+                {
+                        $output =&amp; $this-&gt;final_output;
+                }
+                
+                // --------------------------------------------------------------------
+                
+                // Do we need to write a cache file?
+                if ($this-&gt;cache_expiration &gt; 0)
+                {
+                        $this-&gt;_write_cache($output);
+                }
+                
+                // --------------------------------------------------------------------
+
+                // Parse out the elapsed time and memory usage,
+                // then swap the pseudo-variables with the data
+
+                $elapsed = $BM-&gt;elapsed_time('total_execution_time_start', 'total_execution_time_end');                
+                $output = str_replace('{elapsed_time}', $elapsed, $output);
+                
+                $memory         = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
+                $output = str_replace('{memory_usage}', $memory, $output);                
+
+                // --------------------------------------------------------------------
+                
+                // Is compression requested?
+                if ($CFG-&gt;item('compress_output') === TRUE)
+                {
+                        if (extension_loaded('zlib'))
+                        {
+                                if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
+                                {
+                                        ob_start('ob_gzhandler');
+                                }
+                        }
+                }
+
+                // --------------------------------------------------------------------
+                
+                // Are there any server headers to send?
+                if (count($this-&gt;headers) &gt; 0)
+                {
+                        foreach ($this-&gt;headers as $header)
+                        {
+                                @header($header[0], $header[1]);
+                        }
+                }                
+
+                // --------------------------------------------------------------------
+                
+                // Does the get_instance() function exist?
+                // If not we know we are dealing with a cache file so we'll
+                // simply echo out the data and exit.
+                if ( ! function_exists('get_instance'))
+                {
+                        echo $output;
+                        log_message('debug', &quot;Final output sent to browser&quot;);
+                        log_message('debug', &quot;Total execution time: &quot;.$elapsed);
+                        return TRUE;
+                }
+        
+                // --------------------------------------------------------------------
+
+                // Grab the super object.  We'll need it in a moment...
+                $CI =&amp; get_instance();
+                
+                // Do we need to generate profile data?
+                // If so, load the Profile class and run it.
+                if ($this-&gt;enable_profiler == TRUE)
+                {
+                        $CI-&gt;load-&gt;library('profiler');                                
+                                                                                
+                        // If the output data contains closing &lt;/body&gt; and &lt;/html&gt; tags
+                        // we will remove them and add them back after we insert the profile data
+                        if (preg_match(&quot;|&lt;/body&gt;.*?&lt;/html&gt;|is&quot;, $output))
+                        {
+                                $output  = preg_replace(&quot;|&lt;/body&gt;.*?&lt;/html&gt;|is&quot;, '', $output);
+                                $output .= $CI-&gt;profiler-&gt;run();
+                                $output .= '&lt;/body&gt;&lt;/html&gt;';
+                        }
+                        else
+                        {
+                                $output .= $CI-&gt;profiler-&gt;run();
+                        }
+                }
+                
+                // --------------------------------------------------------------------
+
+                // Does the controller contain a function named _output()?
+                // If so send the output there.  Otherwise, echo it.
+                if (method_exists($CI, '_output'))
+                {
+                        $CI-&gt;_output($output);
+                }
+                else
+                {
+                        echo $output;  // Send it to the browser!
+                }
+                
+                log_message('debug', &quot;Final output sent to browser&quot;);
+                log_message('debug', &quot;Total execution time: &quot;.$elapsed);                
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Write a Cache File
+         *
+         * @access        public
+         * @return        void
+         */        
+        function _write_cache($output)
+        {
+                $CI =&amp; get_instance();        
+                $path = $CI-&gt;config-&gt;item('cache_path');
+        
+                $cache_path = ($path == '') ? BASEPATH.'cache/' : $path;
+                
+                if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
+                {
+                        return;
+                }
+                
+                $uri =        $CI-&gt;config-&gt;item('base_url').
+                                $CI-&gt;config-&gt;item('index_page').
+                                $CI-&gt;uri-&gt;uri_string();
+                
+                $cache_path .= md5($uri);
+
+                if ( ! $fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE))
+                {
+                        log_message('error', &quot;Unable to write cache file: &quot;.$cache_path);
+                        return;
+                }
+                
+                $expire = time() + ($this-&gt;cache_expiration * 60);
+                
+                if (flock($fp, LOCK_EX))
+                {
+                        fwrite($fp, $expire.'TS---&gt;'.$output);
+                        flock($fp, LOCK_UN);
+                }
+                else
+                {
+                        log_message('error', &quot;Unable to secure a file lock for file at: &quot;.$cache_path);
+                        return;
+                }
+                fclose($fp);
+                @chmod($cache_path, DIR_WRITE_MODE);
+
+                log_message('debug', &quot;Cache file written: &quot;.$cache_path);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Update/serve a cached file
+         *
+         * @access        public
+         * @return        void
+         */        
+        function _display_cache(&amp;$CFG, &amp;$URI)
+        {
+                $cache_path = ($CFG-&gt;item('cache_path') == '') ? BASEPATH.'cache/' : $CFG-&gt;item('cache_path');
+                        
+                if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
+                {
+                        return FALSE;
+                }
+                
+                // Build the file path.  The file name is an MD5 hash of the full URI
+                $uri =        $CFG-&gt;item('base_url').
+                                $CFG-&gt;item('index_page').
+                                $URI-&gt;uri_string;
+                                
+                $filepath = $cache_path.md5($uri);
+                
+                if ( ! @file_exists($filepath))
+                {
+                        return FALSE;
+                }
+        
+                if ( ! $fp = @fopen($filepath, FOPEN_READ))
+                {
+                        return FALSE;
+                }
+                        
+                flock($fp, LOCK_SH);
+                
+                $cache = '';
+                if (filesize($filepath) &gt; 0)
+                {
+                        $cache = fread($fp, filesize($filepath));
+                }
+        
+                flock($fp, LOCK_UN);
+                fclose($fp);
+                                        
+                // Strip out the embedded timestamp                
+                if ( ! preg_match(&quot;/(\d+TS---&gt;)/&quot;, $cache, $match))
+                {
+                        return FALSE;
+                }
+                
+                // Has the file expired? If so we'll delete it.
+                if (time() &gt;= trim(str_replace('TS---&gt;', '', $match['1'])))
+                {                 
+                        @unlink($filepath);
+                        log_message('debug', &quot;Cache file has expired. File deleted&quot;);
+                        return FALSE;
+                }
+
+                // Display the cache
+                $this-&gt;_display(str_replace($match['0'], '', $cache));
+                log_message('debug', &quot;Cache file is current. Sending it to browser.&quot;);                
+                return TRUE;
+        }
+
+
+}
+// END Output Class
+
+/* End of file Output.php */
+/* Location: ./system/libraries/Output.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesPaginationphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Pagination.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Pagination.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Pagination.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,244 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Pagination Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Pagination
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/pagination.html
+ */
+class CI_Pagination {
+
+        var $base_url                        = ''; // The page we are linking to
+        var $total_rows                  = ''; // Total number of items (database results)
+        var $per_page                         = 10; // Max number of items you want shown per page
+        var $num_links                        =  2; // Number of &quot;digit&quot; links to show before/after the currently viewed page
+        var $cur_page                         =  0; // The current page being viewed
+        var $first_link                   = '&amp;lsaquo; First';
+        var $next_link                        = '&amp;gt;';
+        var $prev_link                        = '&amp;lt;';
+        var $last_link                        = 'Last &amp;rsaquo;';
+        var $uri_segment                = 3;
+        var $full_tag_open                = '';
+        var $full_tag_close                = '';
+        var $first_tag_open                = '';
+        var $first_tag_close        = '&amp;nbsp;';
+        var $last_tag_open                = '&amp;nbsp;';
+        var $last_tag_close                = '';
+        var $cur_tag_open                = '&amp;nbsp;&lt;strong&gt;';
+        var $cur_tag_close                = '&lt;/strong&gt;';
+        var $next_tag_open                = '&amp;nbsp;';
+        var $next_tag_close                = '&amp;nbsp;';
+        var $prev_tag_open                = '&amp;nbsp;';
+        var $prev_tag_close                = '';
+        var $num_tag_open                = '&amp;nbsp;';
+        var $num_tag_close                = '';
+        var $page_query_string        = FALSE;
+        var $query_string_segment = 'per_page';
+
+        /**
+         * Constructor
+         *
+         * @access        public
+         * @param        array        initialization parameters
+         */
+        function CI_Pagination($params = array())
+        {
+                if (count($params) &gt; 0)
+                {
+                        $this-&gt;initialize($params);
+                }
+
+                log_message('debug', &quot;Pagination Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize Preferences
+         *
+         * @access        public
+         * @param        array        initialization parameters
+         * @return        void
+         */
+        function initialize($params = array())
+        {
+                if (count($params) &gt; 0)
+                {
+                        foreach ($params as $key =&gt; $val)
+                        {
+                                if (isset($this-&gt;$key))
+                                {
+                                        $this-&gt;$key = $val;
+                                }
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate the pagination links
+         *
+         * @access        public
+         * @return        string
+         */
+        function create_links()
+        {
+                // If our item count or per-page total is zero there is no need to continue.
+                if ($this-&gt;total_rows == 0 OR $this-&gt;per_page == 0)
+                {
+                        return '';
+                }
+
+                // Calculate the total number of pages
+                $num_pages = ceil($this-&gt;total_rows / $this-&gt;per_page);
+
+                // Is there only one page? Hm... nothing more to do here then.
+                if ($num_pages == 1)
+                {
+                        return '';
+                }
+
+                // Determine the current page number.
+                $CI =&amp; get_instance();
+
+                if ($CI-&gt;config-&gt;item('enable_query_strings') === TRUE OR $this-&gt;page_query_string === TRUE)
+                {
+                        if ($CI-&gt;input-&gt;get($this-&gt;query_string_segment) != 0)
+                        {
+                                $this-&gt;cur_page = $CI-&gt;input-&gt;get($this-&gt;query_string_segment);
+
+                                // Prep the current page - no funny business!
+                                $this-&gt;cur_page = (int) $this-&gt;cur_page;
+                        }
+                }
+                else
+                {
+                        if ($CI-&gt;uri-&gt;segment($this-&gt;uri_segment) != 0)
+                        {
+                                $this-&gt;cur_page = $CI-&gt;uri-&gt;segment($this-&gt;uri_segment);
+
+                                // Prep the current page - no funny business!
+                                $this-&gt;cur_page = (int) $this-&gt;cur_page;
+                        }
+                }
+
+                $this-&gt;num_links = (int)$this-&gt;num_links;
+
+                if ($this-&gt;num_links &lt; 1)
+                {
+                        show_error('Your number of links must be a positive number.');
+                }
+
+                if ( ! is_numeric($this-&gt;cur_page))
+                {
+                        $this-&gt;cur_page = 0;
+                }
+
+                // Is the page number beyond the result range?
+                // If so we show the last page
+                if ($this-&gt;cur_page &gt; $this-&gt;total_rows)
+                {
+                        $this-&gt;cur_page = ($num_pages - 1) * $this-&gt;per_page;
+                }
+
+                $uri_page_number = $this-&gt;cur_page;
+                $this-&gt;cur_page = floor(($this-&gt;cur_page/$this-&gt;per_page) + 1);
+
+                // Calculate the start and end numbers. These determine
+                // which number to start and end the digit links with
+                $start = (($this-&gt;cur_page - $this-&gt;num_links) &gt; 0) ? $this-&gt;cur_page - ($this-&gt;num_links - 1) : 1;
+                $end   = (($this-&gt;cur_page + $this-&gt;num_links) &lt; $num_pages) ? $this-&gt;cur_page + $this-&gt;num_links : $num_pages;
+
+                // Is pagination being used over GET or POST?  If get, add a per_page query
+                // string. If post, add a trailing slash to the base URL if needed
+                if ($CI-&gt;config-&gt;item('enable_query_strings') === TRUE OR $this-&gt;page_query_string === TRUE)
+                {
+                        $this-&gt;base_url = rtrim($this-&gt;base_url).'&amp;amp;'.$this-&gt;query_string_segment.'=';
+                }
+                else
+                {
+                        $this-&gt;base_url = rtrim($this-&gt;base_url, '/') .'/';
+                }
+
+                  // And here we go...
+                $output = '';
+
+                // Render the &quot;First&quot; link
+                if  ($this-&gt;cur_page &gt; ($this-&gt;num_links + 1))
+                {
+                        $output .= $this-&gt;first_tag_open.'&lt;a href=&quot;'.$this-&gt;base_url.'&quot;&gt;'.$this-&gt;first_link.'&lt;/a&gt;'.$this-&gt;first_tag_close;
+                }
+
+                // Render the &quot;previous&quot; link
+                if  ($this-&gt;cur_page != 1)
+                {
+                        $i = $uri_page_number - $this-&gt;per_page;
+                        if ($i == 0) $i = '';
+                        $output .= $this-&gt;prev_tag_open.'&lt;a href=&quot;'.$this-&gt;base_url.$i.'&quot;&gt;'.$this-&gt;prev_link.'&lt;/a&gt;'.$this-&gt;prev_tag_close;
+                }
+
+                // Write the digit links
+                for ($loop = $start -1; $loop &lt;= $end; $loop++)
+                {
+                        $i = ($loop * $this-&gt;per_page) - $this-&gt;per_page;
+
+                        if ($i &gt;= 0)
+                        {
+                                if ($this-&gt;cur_page == $loop)
+                                {
+                                        $output .= $this-&gt;cur_tag_open.$loop.$this-&gt;cur_tag_close; // Current page
+                                }
+                                else
+                                {
+                                        $n = ($i == 0) ? '' : $i;
+                                        $output .= $this-&gt;num_tag_open.'&lt;a href=&quot;'.$this-&gt;base_url.$n.'&quot;&gt;'.$loop.'&lt;/a&gt;'.$this-&gt;num_tag_close;
+                                }
+                        }
+                }
+
+                // Render the &quot;next&quot; link
+                if ($this-&gt;cur_page &lt; $num_pages)
+                {
+                        $output .= $this-&gt;next_tag_open.'&lt;a href=&quot;'.$this-&gt;base_url.($this-&gt;cur_page * $this-&gt;per_page).'&quot;&gt;'.$this-&gt;next_link.'&lt;/a&gt;'.$this-&gt;next_tag_close;
+                }
+
+                // Render the &quot;Last&quot; link
+                if (($this-&gt;cur_page + $this-&gt;num_links) &lt; $num_pages)
+                {
+                        $i = (($num_pages * $this-&gt;per_page) - $this-&gt;per_page);
+                        $output .= $this-&gt;last_tag_open.'&lt;a href=&quot;'.$this-&gt;base_url.$i.'&quot;&gt;'.$this-&gt;last_link.'&lt;/a&gt;'.$this-&gt;last_tag_close;
+                }
+
+                // Kill double slashes.  Note: Sometimes we can end up with a double slash
+                // in the penultimate link so we'll kill all double slashes.
+                $output = preg_replace(&quot;#([^:])//+#&quot;, &quot;\\1/&quot;, $output);
+
+                // Add the wrapper HTML if exists
+                $output = $this-&gt;full_tag_open.$output.$this-&gt;full_tag_close;
+
+                return $output;
+        }
+}
+// END Pagination Class
+
+/* End of file Pagination.php */
+/* Location: ./system/libraries/Pagination.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesParserphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Parser.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Parser.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Parser.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,173 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Parser Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Parser
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/parser.html
+ */
+class CI_Parser {
+
+        var $l_delim = '{';
+        var $r_delim = '}';
+        var $object;
+                
+        /**
+         *  Parse a template
+         *
+         * Parses pseudo-variables contained in the specified template,
+         * replacing them with the data in the second param
+         *
+         * @access        public
+         * @param        string
+         * @param        array
+         * @param        bool
+         * @return        string
+         */
+        function parse($template, $data, $return = FALSE)
+        {
+                $CI =&amp; get_instance();
+                $template = $CI-&gt;load-&gt;view($template, $data, TRUE);
+                
+                if ($template == '')
+                {
+                        return FALSE;
+                }
+                
+                foreach ($data as $key =&gt; $val)
+                {
+                        if (is_array($val))
+                        {
+                                $template = $this-&gt;_parse_pair($key, $val, $template);                
+                        }
+                        else
+                        {
+                                $template = $this-&gt;_parse_single($key, (string)$val, $template);
+                        }
+                }
+                
+                if ($return == FALSE)
+                {
+                        $CI-&gt;output-&gt;append_output($template);
+                }
+                
+                return $template;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Set the left/right variable delimiters
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        void
+         */
+        function set_delimiters($l = '{', $r = '}')
+        {
+                $this-&gt;l_delim = $l;
+                $this-&gt;r_delim = $r;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Parse a single key/value
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function _parse_single($key, $val, $string)
+        {
+                return str_replace($this-&gt;l_delim.$key.$this-&gt;r_delim, $val, $string);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Parse a tag pair
+         *
+         * Parses tag pairs:  {some_tag} string... {/some_tag}
+         *
+         * @access        private
+         * @param        string
+         * @param        array
+         * @param        string
+         * @return        string
+         */
+        function _parse_pair($variable, $data, $string)
+        {        
+                if (FALSE === ($match = $this-&gt;_match_pair($string, $variable)))
+                {
+                        return $string;
+                }
+
+                $str = '';
+                foreach ($data as $row)
+                {
+                        $temp = $match['1'];
+                        foreach ($row as $key =&gt; $val)
+                        {
+                                if ( ! is_array($val))
+                                {
+                                        $temp = $this-&gt;_parse_single($key, $val, $temp);
+                                }
+                                else
+                                {
+                                        $temp = $this-&gt;_parse_pair($key, $val, $temp);
+                                }
+                        }
+                        
+                        $str .= $temp;
+                }
+                
+                return str_replace($match['0'], $str, $string);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Matches a variable pair
+         *
+         * @access        private
+         * @param        string
+         * @param        string
+         * @return        mixed
+         */
+        function _match_pair($string, $variable)
+        {
+                if ( ! preg_match(&quot;|&quot;.$this-&gt;l_delim . $variable . $this-&gt;r_delim.&quot;(.+?)&quot;.$this-&gt;l_delim . '/' . $variable . $this-&gt;r_delim.&quot;|s&quot;, $string, $match))
+                {
+                        return FALSE;
+                }
+                
+                return $match;
+        }
+
+}
+// END Parser Class
+
+/* End of file Parser.php */
+/* Location: ./system/libraries/Parser.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesProfilerphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Profiler.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Profiler.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Profiler.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,392 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Profiler Class
+ *
+ * This class enables you to display benchmark, query, and other data
+ * in order to help with debugging and optimization.
+ *
+ * Note: At some point it would be good to move all the HTML in this class
+ * into a set of template files in order to allow customization.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/general/profiling.html
+ */
+class CI_Profiler {
+
+        var $CI;
+         
+         function CI_Profiler()
+         {
+                 $this-&gt;CI =&amp; get_instance();
+                 $this-&gt;CI-&gt;load-&gt;language('profiler');
+         }
+         
+        // --------------------------------------------------------------------
+
+        /**
+         * Auto Profiler
+         *
+         * This function cycles through the entire array of mark points and
+         * matches any two points that are named identically (ending in &quot;_start&quot;
+         * and &quot;_end&quot; respectively).  It then compiles the execution times for
+         * all points and returns it as an array
+         *
+         * @access        private
+         * @return        array
+         */
+         function _compile_benchmarks()
+         {
+                  $profile = array();
+                 foreach ($this-&gt;CI-&gt;benchmark-&gt;marker as $key =&gt; $val)
+                 {
+                         // We match the &quot;end&quot; marker so that the list ends
+                         // up in the order that it was defined
+                         if (preg_match(&quot;/(.+?)_end/i&quot;, $key, $match))
+                         {                         
+                                 if (isset($this-&gt;CI-&gt;benchmark-&gt;marker[$match[1].'_end']) AND isset($this-&gt;CI-&gt;benchmark-&gt;marker[$match[1].'_start']))
+                                 {
+                                         $profile[$match[1]] = $this-&gt;CI-&gt;benchmark-&gt;elapsed_time($match[1].'_start', $key);
+                                 }
+                         }
+                 }
+
+                // Build a table containing the profile data.
+                // Note: At some point we should turn this into a template that can
+                // be modified.  We also might want to make this data available to be logged
+        
+                $output  = &quot;\n\n&quot;;
+                $output .= '&lt;fieldset style=&quot;border:1px solid #990000;padding:6px 10px 10px 10px;margin:0 0 20px 0;background-color:#eee&quot;&gt;';
+                $output .= &quot;\n&quot;;
+                $output .= '&lt;legend style=&quot;color:#990000;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_benchmarks').'&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                $output .= &quot;\n&quot;;                        
+                $output .= &quot;\n\n&lt;table cellpadding='4' cellspacing='1' border='0' width='100%'&gt;\n&quot;;
+                
+                foreach ($profile as $key =&gt; $val)
+                {
+                        $key = ucwords(str_replace(array('_', '-'), ' ', $key));
+                        $output .= &quot;&lt;tr&gt;&lt;td width='50%' style='color:#000;font-weight:bold;background-color:#ddd;'&gt;&quot;.$key.&quot;&amp;nbsp;&amp;nbsp;&lt;/td&gt;&lt;td width='50%' style='color:#990000;font-weight:normal;background-color:#ddd;'&gt;&quot;.$val.&quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
+                }
+                
+                $output .= &quot;&lt;/table&gt;\n&quot;;
+                $output .= &quot;&lt;/fieldset&gt;&quot;;
+                 
+                 return $output;
+         }
+         
+        // --------------------------------------------------------------------
+
+        /**
+         * Compile Queries
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _compile_queries()
+        {
+                $dbs = array();
+                
+                // Let's determine which databases are currently connected to
+                foreach (get_object_vars($this-&gt;CI) as $CI_object)
+                {
+                        if ( is_subclass_of(get_class($CI_object), 'CI_DB') )
+                        {
+                                $dbs[] = $CI_object;
+                        }
+                }
+                                        
+                if (count($dbs) == 0)
+                {
+                        $output  = &quot;\n\n&quot;;
+                        $output .= '&lt;fieldset style=&quot;border:1px solid #0000FF;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee&quot;&gt;';
+                        $output .= &quot;\n&quot;;
+                        $output .= '&lt;legend style=&quot;color:#0000FF;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_queries').'&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                        $output .= &quot;\n&quot;;                
+                        $output .= &quot;\n\n&lt;table cellpadding='4' cellspacing='1' border='0' width='100%'&gt;\n&quot;;
+                        $output .=&quot;&lt;tr&gt;&lt;td width='100%' style='color:#0000FF;font-weight:normal;background-color:#eee;'&gt;&quot;.$this-&gt;CI-&gt;lang-&gt;line('profiler_no_db').&quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
+                        $output .= &quot;&lt;/table&gt;\n&quot;;
+                        $output .= &quot;&lt;/fieldset&gt;&quot;;
+                        
+                        return $output;
+                }
+                
+                // Load the text helper so we can highlight the SQL
+                $this-&gt;CI-&gt;load-&gt;helper('text');
+
+                // Key words we want bolded
+                $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT&amp;nbsp;JOIN', 'ORDER&amp;nbsp;BY', 'GROUP&amp;nbsp;BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR', 'HAVING', 'OFFSET', 'NOT&amp;nbsp;IN', 'IN', 'LIKE', 'NOT&amp;nbsp;LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')');
+
+                $output  = &quot;\n\n&quot;;
+                        
+                foreach ($dbs as $db)
+                {
+                        $output .= '&lt;fieldset style=&quot;border:1px solid #0000FF;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee&quot;&gt;';
+                        $output .= &quot;\n&quot;;
+                        $output .= '&lt;legend style=&quot;color:#0000FF;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_database').':&amp;nbsp; '.$db-&gt;database.'&amp;nbsp;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_queries').': '.count($this-&gt;CI-&gt;db-&gt;queries).'&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                        $output .= &quot;\n&quot;;                
+                        $output .= &quot;\n\n&lt;table cellpadding='4' cellspacing='1' border='0' width='100%'&gt;\n&quot;;
+                
+                        if (count($db-&gt;queries) == 0)
+                        {
+                                $output .= &quot;&lt;tr&gt;&lt;td width='100%' style='color:#0000FF;font-weight:normal;background-color:#eee;'&gt;&quot;.$this-&gt;CI-&gt;lang-&gt;line('profiler_no_queries').&quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
+                        }
+                        else
+                        {                                
+                                foreach ($db-&gt;queries as $key =&gt; $val)
+                                {                                        
+                                        $time = number_format($db-&gt;query_times[$key], 4);
+
+                                        $val = highlight_code($val, ENT_QUOTES);
+        
+                                        foreach ($highlight as $bold)
+                                        {
+                                                $val = str_replace($bold, '&lt;strong&gt;'.$bold.'&lt;/strong&gt;', $val);        
+                                        }
+                                        
+                                        $output .= &quot;&lt;tr&gt;&lt;td width='1%' valign='top' style='color:#990000;font-weight:normal;background-color:#ddd;'&gt;&quot;.$time.&quot;&amp;nbsp;&amp;nbsp;&lt;/td&gt;&lt;td style='color:#000;font-weight:normal;background-color:#ddd;'&gt;&quot;.$val.&quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
+                                }
+                        }
+                        
+                        $output .= &quot;&lt;/table&gt;\n&quot;;
+                        $output .= &quot;&lt;/fieldset&gt;&quot;;
+                        
+                }
+                
+                return $output;
+        }
+
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Compile $_GET Data
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _compile_get()
+        {        
+                $output  = &quot;\n\n&quot;;
+                $output .= '&lt;fieldset style=&quot;border:1px solid #cd6e00;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee&quot;&gt;';
+                $output .= &quot;\n&quot;;
+                $output .= '&lt;legend style=&quot;color:#cd6e00;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_get_data').'&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                $output .= &quot;\n&quot;;
+                                
+                if (count($_GET) == 0)
+                {
+                        $output .= &quot;&lt;div style='color:#cd6e00;font-weight:normal;padding:4px 0 4px 0'&gt;&quot;.$this-&gt;CI-&gt;lang-&gt;line('profiler_no_get').&quot;&lt;/div&gt;&quot;;
+                }
+                else
+                {
+                        $output .= &quot;\n\n&lt;table cellpadding='4' cellspacing='1' border='0' width='100%'&gt;\n&quot;;
+                
+                        foreach ($_GET as $key =&gt; $val)
+                        {
+                                if ( ! is_numeric($key))
+                                {
+                                        $key = &quot;'&quot;.$key.&quot;'&quot;;
+                                }
+                        
+                                $output .= &quot;&lt;tr&gt;&lt;td width='50%' style='color:#000;background-color:#ddd;'&gt;&amp;#36;_GET[&quot;.$key.&quot;]&amp;nbsp;&amp;nbsp; &lt;/td&gt;&lt;td width='50%' style='color:#cd6e00;font-weight:normal;background-color:#ddd;'&gt;&quot;;
+                                if (is_array($val))
+                                {
+                                        $output .= &quot;&lt;pre&gt;&quot; . htmlspecialchars(stripslashes(print_r($val, true))) . &quot;&lt;/pre&gt;&quot;;
+                                }
+                                else
+                                {
+                                        $output .= htmlspecialchars(stripslashes($val));
+                                }
+                                $output .= &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
+                        }
+                        
+                        $output .= &quot;&lt;/table&gt;\n&quot;;
+                }
+                $output .= &quot;&lt;/fieldset&gt;&quot;;
+
+                return $output;        
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Compile $_POST Data
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _compile_post()
+        {        
+                $output  = &quot;\n\n&quot;;
+                $output .= '&lt;fieldset style=&quot;border:1px solid #009900;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee&quot;&gt;';
+                $output .= &quot;\n&quot;;
+                $output .= '&lt;legend style=&quot;color:#009900;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_post_data').'&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                $output .= &quot;\n&quot;;
+                                
+                if (count($_POST) == 0)
+                {
+                        $output .= &quot;&lt;div style='color:#009900;font-weight:normal;padding:4px 0 4px 0'&gt;&quot;.$this-&gt;CI-&gt;lang-&gt;line('profiler_no_post').&quot;&lt;/div&gt;&quot;;
+                }
+                else
+                {
+                        $output .= &quot;\n\n&lt;table cellpadding='4' cellspacing='1' border='0' width='100%'&gt;\n&quot;;
+                
+                        foreach ($_POST as $key =&gt; $val)
+                        {
+                                if ( ! is_numeric($key))
+                                {
+                                        $key = &quot;'&quot;.$key.&quot;'&quot;;
+                                }
+                        
+                                $output .= &quot;&lt;tr&gt;&lt;td width='50%' style='color:#000;background-color:#ddd;'&gt;&amp;#36;_POST[&quot;.$key.&quot;]&amp;nbsp;&amp;nbsp; &lt;/td&gt;&lt;td width='50%' style='color:#009900;font-weight:normal;background-color:#ddd;'&gt;&quot;;
+                                if (is_array($val))
+                                {
+                                        $output .= &quot;&lt;pre&gt;&quot; . htmlspecialchars(stripslashes(print_r($val, true))) . &quot;&lt;/pre&gt;&quot;;
+                                }
+                                else
+                                {
+                                        $output .= htmlspecialchars(stripslashes($val));
+                                }
+                                $output .= &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
+                        }
+                        
+                        $output .= &quot;&lt;/table&gt;\n&quot;;
+                }
+                $output .= &quot;&lt;/fieldset&gt;&quot;;
+
+                return $output;        
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Show query string
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _compile_uri_string()
+        {        
+                $output  = &quot;\n\n&quot;;
+                $output .= '&lt;fieldset style=&quot;border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee&quot;&gt;';
+                $output .= &quot;\n&quot;;
+                $output .= '&lt;legend style=&quot;color:#000;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_uri_string').'&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                $output .= &quot;\n&quot;;
+                
+                if ($this-&gt;CI-&gt;uri-&gt;uri_string == '')
+                {
+                        $output .= &quot;&lt;div style='color:#000;font-weight:normal;padding:4px 0 4px 0'&gt;&quot;.$this-&gt;CI-&gt;lang-&gt;line('profiler_no_uri').&quot;&lt;/div&gt;&quot;;
+                }
+                else
+                {
+                        $output .= &quot;&lt;div style='color:#000;font-weight:normal;padding:4px 0 4px 0'&gt;&quot;.$this-&gt;CI-&gt;uri-&gt;uri_string.&quot;&lt;/div&gt;&quot;;                                
+                }
+                
+                $output .= &quot;&lt;/fieldset&gt;&quot;;
+
+                return $output;        
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Show the controller and function that were called
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _compile_controller_info()
+        {        
+                $output  = &quot;\n\n&quot;;
+                $output .= '&lt;fieldset style=&quot;border:1px solid #995300;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee&quot;&gt;';
+                $output .= &quot;\n&quot;;
+                $output .= '&lt;legend style=&quot;color:#995300;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_controller_info').'&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                $output .= &quot;\n&quot;;
+                
+                $output .= &quot;&lt;div style='color:#995300;font-weight:normal;padding:4px 0 4px 0'&gt;&quot;.$this-&gt;CI-&gt;router-&gt;fetch_class().&quot;/&quot;.$this-&gt;CI-&gt;router-&gt;fetch_method().&quot;&lt;/div&gt;&quot;;                                
+
+                
+                $output .= &quot;&lt;/fieldset&gt;&quot;;
+
+                return $output;        
+        }
+        // --------------------------------------------------------------------
+        
+        /**
+         * Compile memory usage
+         *
+         * Display total used memory
+         *
+         * @access        public
+         * @return        string
+         */
+        function _compile_memory_usage()
+        {
+                $output  = &quot;\n\n&quot;;
+                $output .= '&lt;fieldset style=&quot;border:1px solid #5a0099;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee&quot;&gt;';
+                $output .= &quot;\n&quot;;
+                $output .= '&lt;legend style=&quot;color:#5a0099;&quot;&gt;&amp;nbsp;&amp;nbsp;'.$this-&gt;CI-&gt;lang-&gt;line('profiler_memory_usage').'&amp;nbsp;&amp;nbsp;&lt;/legend&gt;';
+                $output .= &quot;\n&quot;;
+                
+                if (function_exists('memory_get_usage') &amp;&amp; ($usage = memory_get_usage()) != '')
+                {
+                        $output .= &quot;&lt;div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'&gt;&quot;.number_format($usage).' bytes&lt;/div&gt;';
+                }
+                else
+                {
+                        $output .= &quot;&lt;div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'&gt;&quot;.$this-&gt;CI-&gt;lang-&gt;line('profiler_no_memory_usage').&quot;&lt;/div&gt;&quot;;                                
+                }
+                
+                $output .= &quot;&lt;/fieldset&gt;&quot;;
+
+                return $output;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Run the Profiler
+         *
+         * @access        private
+         * @return        string
+         */        
+        function run()
+        {
+                $output = &quot;&lt;div id='codeigniter_profiler' style='clear:both;background-color:#fff;padding:10px;'&gt;&quot;;
+
+                $output .= $this-&gt;_compile_uri_string();
+                $output .= $this-&gt;_compile_controller_info();
+                $output .= $this-&gt;_compile_memory_usage();
+                $output .= $this-&gt;_compile_benchmarks();
+                $output .= $this-&gt;_compile_get();
+                $output .= $this-&gt;_compile_post();
+                $output .= $this-&gt;_compile_queries();
+
+                $output .= '&lt;/div&gt;';
+
+                return $output;
+        }
+
+}
+
+// END CI_Profiler class
+
+/* End of file Profiler.php */
+/* Location: ./system/libraries/Profiler.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesRouterphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Router.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Router.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Router.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,389 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Router Class
+ *
+ * Parses URIs and determines routing
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @author                ExpressionEngine Dev Team
+ * @category        Libraries
+ * @link                http://codeigniter.com/user_guide/general/routing.html
+ */
+class CI_Router {
+
+        var $config;        
+        var $routes                 = array();
+        var $error_routes        = array();
+        var $class                        = '';
+        var $method                        = 'index';
+        var $directory                = '';
+        var $uri_protocol         = 'auto';
+        var $default_controller;
+        var $scaffolding_request = FALSE; // Must be set to FALSE
+        
+        /**
+         * Constructor
+         *
+         * Runs the route mapping function.
+         */
+        function CI_Router()
+        {
+                $this-&gt;config =&amp; load_class('Config');
+                $this-&gt;uri =&amp; load_class('URI');
+                $this-&gt;_set_routing();
+                log_message('debug', &quot;Router Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the route mapping
+         *
+         * This function determines what should be served based on the URI request,
+         * as well as any &quot;routes&quot; that have been set in the routing config file.
+         *
+         * @access        private
+         * @return        void
+         */
+        function _set_routing()
+        {
+                // Are query strings enabled in the config file?
+                // If so, we're done since segment based URIs are not used with query strings.
+                if ($this-&gt;config-&gt;item('enable_query_strings') === TRUE AND isset($_GET[$this-&gt;config-&gt;item('controller_trigger')]))
+                {
+                        $this-&gt;set_class(trim($this-&gt;uri-&gt;_filter_uri($_GET[$this-&gt;config-&gt;item('controller_trigger')])));
+
+                        if (isset($_GET[$this-&gt;config-&gt;item('function_trigger')]))
+                        {
+                                $this-&gt;set_method(trim($this-&gt;uri-&gt;_filter_uri($_GET[$this-&gt;config-&gt;item('function_trigger')])));
+                        }
+                        
+                        return;
+                }
+                
+                // Load the routes.php file.
+                @include(APPPATH.'config/routes'.EXT);
+                $this-&gt;routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
+                unset($route);
+
+                // Set the default controller so we can display it in the event
+                // the URI doesn't correlated to a valid controller.
+                $this-&gt;default_controller = ( ! isset($this-&gt;routes['default_controller']) OR $this-&gt;routes['default_controller'] == '') ? FALSE : strtolower($this-&gt;routes['default_controller']);        
+                
+                // Fetch the complete URI string
+                $this-&gt;uri-&gt;_fetch_uri_string();
+        
+                // Is there a URI string? If not, the default controller specified in the &quot;routes&quot; file will be shown.
+                if ($this-&gt;uri-&gt;uri_string == '')
+                {
+                        if ($this-&gt;default_controller === FALSE)
+                        {
+                                show_error(&quot;Unable to determine what should be displayed. A default route has not been specified in the routing file.&quot;);
+                        }
+                        
+                        if (strpos($this-&gt;default_controller, '/') !== FALSE)
+                        {
+                                $x = explode('/', $this-&gt;default_controller);
+
+                                $this-&gt;set_class(end($x));
+                                $this-&gt;set_method('index');
+                                $this-&gt;_set_request($x);
+                        }
+                        else
+                        {
+                                $this-&gt;set_class($this-&gt;default_controller);
+                                $this-&gt;set_method('index');
+                                $this-&gt;_set_request(array($this-&gt;default_controller, 'index'));
+                        }
+
+                        // re-index the routed segments array so it starts with 1 rather than 0
+                        $this-&gt;uri-&gt;_reindex_segments();
+                        
+                        log_message('debug', &quot;No URI present. Default controller set.&quot;);
+                        return;
+                }
+                unset($this-&gt;routes['default_controller']);
+                
+                // Do we need to remove the URL suffix?
+                $this-&gt;uri-&gt;_remove_url_suffix();
+                
+                // Compile the segments into an array
+                $this-&gt;uri-&gt;_explode_segments();
+                
+                // Parse any custom routing that may exist
+                $this-&gt;_parse_routes();                
+                
+                // Re-index the segment array so that it starts with 1 rather than 0
+                $this-&gt;uri-&gt;_reindex_segments();
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the Route
+         *
+         * This function takes an array of URI segments as
+         * input, and sets the current class/method
+         *
+         * @access        private
+         * @param        array
+         * @param        bool
+         * @return        void
+         */
+        function _set_request($segments = array())
+        {
+                $segments = $this-&gt;_validate_request($segments);
+                
+                if (count($segments) == 0)
+                {
+                        return;
+                }
+                                                
+                $this-&gt;set_class($segments[0]);
+                
+                if (isset($segments[1]))
+                {
+                        // A scaffolding request. No funny business with the URL
+                        if ($this-&gt;routes['scaffolding_trigger'] == $segments[1] AND $segments[1] != '_ci_scaffolding')
+                        {
+                                $this-&gt;scaffolding_request = TRUE;
+                                unset($this-&gt;routes['scaffolding_trigger']);
+                        }
+                        else
+                        {
+                                // A standard method request
+                                $this-&gt;set_method($segments[1]);
+                        }
+                }
+                else
+                {
+                        // This lets the &quot;routed&quot; segment array identify that the default
+                        // index method is being used.
+                        $segments[1] = 'index';
+                }
+                
+                // Update our &quot;routed&quot; segment array to contain the segments.
+                // Note: If there is no custom routing, this array will be
+                // identical to $this-&gt;uri-&gt;segments
+                $this-&gt;uri-&gt;rsegments = $segments;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Validates the supplied segments.  Attempts to determine the path to
+         * the controller.
+         *
+         * @access        private
+         * @param        array
+         * @return        array
+         */        
+        function _validate_request($segments)
+        {
+                // Does the requested controller exist in the root folder?
+                if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
+                {
+                        return $segments;
+                }
+
+                // Is the controller in a sub-folder?
+                if (is_dir(APPPATH.'controllers/'.$segments[0]))
+                {                
+                        // Set the directory and remove it from the segment array
+                        $this-&gt;set_directory($segments[0]);
+                        $segments = array_slice($segments, 1);
+                        
+                        if (count($segments) &gt; 0)
+                        {
+                                // Does the requested controller exist in the sub-folder?
+                                if ( ! file_exists(APPPATH.'controllers/'.$this-&gt;fetch_directory().$segments[0].EXT))
+                                {
+                                        show_404($this-&gt;fetch_directory().$segments[0]);
+                                }
+                        }
+                        else
+                        {
+                                $this-&gt;set_class($this-&gt;default_controller);
+                                $this-&gt;set_method('index');
+                        
+                                // Does the default controller exist in the sub-folder?
+                                if ( ! file_exists(APPPATH.'controllers/'.$this-&gt;fetch_directory().$this-&gt;default_controller.EXT))
+                                {
+                                        $this-&gt;directory = '';
+                                        return array();
+                                }
+                        
+                        }
+
+                        return $segments;
+                }
+
+                // Can't find the requested controller...
+                show_404($segments[0]);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         *  Parse Routes
+         *
+         * This function matches any routes that may exist in
+         * the config/routes.php file against the URI to
+         * determine if the class/method need to be remapped.
+         *
+         * @access        private
+         * @return        void
+         */
+        function _parse_routes()
+        {
+                // Do we even have any custom routing to deal with?
+                // There is a default scaffolding trigger, so we'll look just for 1
+                if (count($this-&gt;routes) == 1)
+                {
+                        $this-&gt;_set_request($this-&gt;uri-&gt;segments);
+                        return;
+                }
+
+                // Turn the segment array into a URI string
+                $uri = implode('/', $this-&gt;uri-&gt;segments);
+
+                // Is there a literal match?  If so we're done
+                if (isset($this-&gt;routes[$uri]))
+                {
+                        $this-&gt;_set_request(explode('/', $this-&gt;routes[$uri]));                
+                        return;
+                }
+                                
+                // Loop through the route array looking for wild-cards
+                foreach ($this-&gt;routes as $key =&gt; $val)
+                {                                                
+                        // Convert wild-cards to RegEx
+                        $key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));
+                        
+                        // Does the RegEx match?
+                        if (preg_match('#^'.$key.'$#', $uri))
+                        {                        
+                                // Do we have a back-reference?
+                                if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE)
+                                {
+                                        $val = preg_replace('#^'.$key.'$#', $val, $uri);
+                                }
+                        
+                                $this-&gt;_set_request(explode('/', $val));                
+                                return;
+                        }
+                }
+
+                // If we got this far it means we didn't encounter a
+                // matching route so we'll set the site default route
+                $this-&gt;_set_request($this-&gt;uri-&gt;segments);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the class name
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_class($class)
+        {
+                $this-&gt;class = $class;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Fetch the current class
+         *
+         * @access        public
+         * @return        string
+         */        
+        function fetch_class()
+        {
+                return $this-&gt;class;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Set the method name
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_method($method)
+        {
+                $this-&gt;method = $method;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Fetch the current method
+         *
+         * @access        public
+         * @return        string
+         */        
+        function fetch_method()
+        {
+                if ($this-&gt;method == $this-&gt;fetch_class())
+                {
+                        return 'index';
+                }
+
+                return $this-&gt;method;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Set the directory name
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_directory($dir)
+        {
+                $this-&gt;directory = $dir.'/';
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         *  Fetch the sub-directory (if any) that contains the requested controller class
+         *
+         * @access        public
+         * @return        string
+         */        
+        function fetch_directory()
+        {
+                return $this-&gt;directory;
+        }
+
+}
+// END Router Class
+
+/* End of file Router.php */
+/* Location: ./system/libraries/Router.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesSessionphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Session.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Session.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Session.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,758 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Session Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Sessions
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/sessions.html
+ */
+class CI_Session {
+
+        var $sess_encrypt_cookie                = FALSE;
+        var $sess_use_database                        = FALSE;
+        var $sess_table_name                        = '';
+        var $sess_expiration                        = 7200;
+        var $sess_match_ip                                = FALSE;
+        var $sess_match_useragent                = TRUE;
+        var $sess_cookie_name                        = 'ci_session';
+        var $cookie_prefix                                = '';
+        var $cookie_path                                = '';
+        var $cookie_domain                                = '';
+        var $sess_time_to_update                = 300;
+        var $encryption_key                                = '';
+        var $flashdata_key                                 = 'flash';
+        var $time_reference                                = 'time';
+        var $gc_probability                                = 5;
+        var $userdata                                        = array();
+        var $CI;
+        var $now;
+
+        /**
+         * Session Constructor
+         *
+         * The constructor runs the session routines automatically
+         * whenever the class is instantiated.
+         */
+        function CI_Session($params = array())
+        {
+                log_message('debug', &quot;Session Class Initialized&quot;);
+
+                // Set the super object to a local variable for use throughout the class
+                $this-&gt;CI =&amp; get_instance();
+
+                // Set all the session preferences, which can either be set
+                // manually via the $params array above or via the config file
+                foreach (array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key)
+                {
+                        $this-&gt;$key = (isset($params[$key])) ? $params[$key] : $this-&gt;CI-&gt;config-&gt;item($key);
+                }
+
+                // Load the string helper so we can use the strip_slashes() function
+                $this-&gt;CI-&gt;load-&gt;helper('string');
+
+                // Do we need encryption? If so, load the encryption class
+                if ($this-&gt;sess_encrypt_cookie == TRUE)
+                {
+                        $this-&gt;CI-&gt;load-&gt;library('encrypt');
+                }
+
+                // Are we using a database?  If so, load it
+                if ($this-&gt;sess_use_database === TRUE AND $this-&gt;sess_table_name != '')
+                {
+                        $this-&gt;CI-&gt;load-&gt;database();
+                }
+
+                // Set the &quot;now&quot; time.  Can either be GMT or server time, based on the
+                // config prefs.  We use this to set the &quot;last activity&quot; time
+                $this-&gt;now = $this-&gt;_get_time();
+
+                // Set the session length. If the session expiration is
+                // set to zero we'll set the expiration two years from now.
+                if ($this-&gt;sess_expiration == 0)
+                {
+                        $this-&gt;sess_expiration = (60*60*24*365*2);
+                }
+                 
+                // Set the cookie name
+                $this-&gt;sess_cookie_name = $this-&gt;cookie_prefix.$this-&gt;sess_cookie_name;
+
+                // Run the Session routine. If a session doesn't exist we'll
+                // create a new one.  If it does, we'll update it.
+                if ( ! $this-&gt;sess_read())
+                {
+                        $this-&gt;sess_create();
+                }
+                else
+                {
+                        $this-&gt;sess_update();
+                }
+
+                // Delete 'old' flashdata (from last request)
+                   $this-&gt;_flashdata_sweep();
+
+                // Mark all new flashdata as old (data will be deleted before next request)
+                   $this-&gt;_flashdata_mark();
+
+                // Delete expired sessions if necessary
+                $this-&gt;_sess_gc();
+
+                log_message('debug', &quot;Session routines successfully run&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch the current session data if it exists
+         *
+         * @access        public
+         * @return        bool
+         */
+        function sess_read()
+        {
+                // Fetch the cookie
+                $session = $this-&gt;CI-&gt;input-&gt;cookie($this-&gt;sess_cookie_name);
+
+                // No cookie?  Goodbye cruel world!...
+                if ($session === FALSE)
+                {
+                        log_message('debug', 'A session cookie was not found.');
+                        return FALSE;
+                }
+
+                // Decrypt the cookie data
+                if ($this-&gt;sess_encrypt_cookie == TRUE)
+                {
+                        $session = $this-&gt;CI-&gt;encrypt-&gt;decode($session);
+                }
+                else
+                {
+                        // encryption was not used, so we need to check the md5 hash
+                        $hash         = substr($session, strlen($session)-32); // get last 32 chars
+                        $session = substr($session, 0, strlen($session)-32);
+
+                        // Does the md5 hash match?  This is to prevent manipulation of session data in userspace
+                        if ($hash !==  md5($session.$this-&gt;encryption_key))
+                        {
+                                log_message('error', 'The session cookie data did not match what was expected. This could be a possible hacking attempt.');
+                                $this-&gt;sess_destroy();
+                                return FALSE;
+                        }
+                }
+
+                // Unserialize the session array
+                $session = $this-&gt;_unserialize($session);
+
+                // Is the session data we unserialized an array with the correct format?
+                if ( ! is_array($session) OR ! isset($session['session_id']) OR ! isset($session['ip_address']) OR ! isset($session['user_agent']) OR ! isset($session['last_activity']))
+                {
+                        $this-&gt;sess_destroy();
+                        return FALSE;
+                }
+
+                // Is the session current?
+                if (($session['last_activity'] + $this-&gt;sess_expiration) &lt; $this-&gt;now)
+                {
+                        $this-&gt;sess_destroy();
+                        return FALSE;
+                }
+
+                // Does the IP Match?
+                if ($this-&gt;sess_match_ip == TRUE AND $session['ip_address'] != $this-&gt;CI-&gt;input-&gt;ip_address())
+                {
+                        $this-&gt;sess_destroy();
+                        return FALSE;
+                }
+
+                // Does the User Agent Match?
+                if ($this-&gt;sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this-&gt;CI-&gt;input-&gt;user_agent(), 0, 50)))
+                {
+                        $this-&gt;sess_destroy();
+                        return FALSE;
+                }
+
+                // Is there a corresponding session in the DB?
+                if ($this-&gt;sess_use_database === TRUE)
+                {
+                        $this-&gt;CI-&gt;db-&gt;where('session_id', $session['session_id']);
+
+                        if ($this-&gt;sess_match_ip == TRUE)
+                        {
+                                $this-&gt;CI-&gt;db-&gt;where('ip_address', $session['ip_address']);
+                        }
+
+                        if ($this-&gt;sess_match_useragent == TRUE)
+                        {
+                                $this-&gt;CI-&gt;db-&gt;where('user_agent', $session['user_agent']);
+                        }
+
+                        $query = $this-&gt;CI-&gt;db-&gt;get($this-&gt;sess_table_name);
+
+                        // No result?  Kill it!
+                        if ($query-&gt;num_rows() == 0)
+                        {
+                                $this-&gt;sess_destroy();
+                                return FALSE;
+                        }
+
+                        // Is there custom data?  If so, add it to the main session array
+                        $row = $query-&gt;row();
+                        if (isset($row-&gt;user_data) AND $row-&gt;user_data != '')
+                        {
+                                $custom_data = $this-&gt;_unserialize($row-&gt;user_data);
+
+                                if (is_array($custom_data))
+                                {
+                                        foreach ($custom_data as $key =&gt; $val)
+                                        {
+                                                $session[$key] = $val;
+                                        }
+                                }
+                        }
+                }
+
+                // Session is valid!
+                $this-&gt;userdata = $session;
+                unset($session);
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Write the session data
+         *
+         * @access        public
+         * @return        void
+         */
+        function sess_write()
+        {
+                // Are we saving custom data to the DB?  If not, all we do is update the cookie
+                if ($this-&gt;sess_use_database === FALSE)
+                {
+                        $this-&gt;_set_cookie();
+                        return;
+                }
+
+                // set the custom userdata, the session data we will set in a second
+                $custom_userdata = $this-&gt;userdata;
+                $cookie_userdata = array();
+
+                // Before continuing, we need to determine if there is any custom data to deal with.
+                // Let's determine this by removing the default indexes to see if there's anything left in the array
+                // and set the session data while we're at it
+                foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
+                {
+                        unset($custom_userdata[$val]);
+                        $cookie_userdata[$val] = $this-&gt;userdata[$val];
+                }
+
+                // Did we find any custom data?  If not, we turn the empty array into a string
+                // since there's no reason to serialize and store an empty array in the DB
+                if (count($custom_userdata) === 0)
+                {
+                        $custom_userdata = '';
+                }
+                else
+                {
+                        // Serialize the custom data array so we can store it
+                        $custom_userdata = $this-&gt;_serialize($custom_userdata);
+                }
+
+                // Run the update query
+                $this-&gt;CI-&gt;db-&gt;where('session_id', $this-&gt;userdata['session_id']);
+                $this-&gt;CI-&gt;db-&gt;update($this-&gt;sess_table_name, array('last_activity' =&gt; $this-&gt;userdata['last_activity'], 'user_data' =&gt; $custom_userdata));
+
+                // Write the cookie.  Notice that we manually pass the cookie data array to the
+                // _set_cookie() function. Normally that function will store $this-&gt;userdata, but
+                // in this case that array contains custom data, which we do not want in the cookie.
+                $this-&gt;_set_cookie($cookie_userdata);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Create a new session
+         *
+         * @access        public
+         * @return        void
+         */
+        function sess_create()
+        {
+                $sessid = '';
+                while (strlen($sessid) &lt; 32)
+                {
+                        $sessid .= mt_rand(0, mt_getrandmax());
+                }
+
+                // To make the session ID even more secure we'll combine it with the user's IP
+                $sessid .= $this-&gt;CI-&gt;input-&gt;ip_address();
+
+                $this-&gt;userdata = array(
+                                                        'session_id'         =&gt; md5(uniqid($sessid, TRUE)),
+                                                        'ip_address'         =&gt; $this-&gt;CI-&gt;input-&gt;ip_address(),
+                                                        'user_agent'         =&gt; substr($this-&gt;CI-&gt;input-&gt;user_agent(), 0, 50),
+                                                        'last_activity'        =&gt; $this-&gt;now
+                                                        );
+
+
+                // Save the data to the DB if needed
+                if ($this-&gt;sess_use_database === TRUE)
+                {
+                        $this-&gt;CI-&gt;db-&gt;query($this-&gt;CI-&gt;db-&gt;insert_string($this-&gt;sess_table_name, $this-&gt;userdata));
+                }
+
+                // Write the cookie
+                $this-&gt;_set_cookie();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Update an existing session
+         *
+         * @access        public
+         * @return        void
+         */
+        function sess_update()
+        {
+                // We only update the session every five minutes by default
+                if (($this-&gt;userdata['last_activity'] + $this-&gt;sess_time_to_update) &gt;= $this-&gt;now)
+                {
+                        return;
+                }
+
+                // Save the old session id so we know which record to
+                // update in the database if we need it
+                $old_sessid = $this-&gt;userdata['session_id'];
+                $new_sessid = '';
+                while (strlen($new_sessid) &lt; 32)
+                {
+                        $new_sessid .= mt_rand(0, mt_getrandmax());
+                }
+
+                // To make the session ID even more secure we'll combine it with the user's IP
+                $new_sessid .= $this-&gt;CI-&gt;input-&gt;ip_address();
+
+                // Turn it into a hash
+                $new_sessid = md5(uniqid($new_sessid, TRUE));
+
+                // Update the session data in the session data array
+                $this-&gt;userdata['session_id'] = $new_sessid;
+                $this-&gt;userdata['last_activity'] = $this-&gt;now;
+
+                // _set_cookie() will handle this for us if we aren't using database sessions
+                // by pushing all userdata to the cookie.
+                $cookie_data = NULL;
+
+                // Update the session ID and last_activity field in the DB if needed
+                if ($this-&gt;sess_use_database === TRUE)
+                {
+                        // set cookie explicitly to only have our session data
+                        $cookie_data = array();
+                        foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
+                        {
+                                $cookie_data[$val] = $this-&gt;userdata[$val];
+                        }
+
+                        $this-&gt;CI-&gt;db-&gt;query($this-&gt;CI-&gt;db-&gt;update_string($this-&gt;sess_table_name, array('last_activity' =&gt; $this-&gt;now, 'session_id' =&gt; $new_sessid), array('session_id' =&gt; $old_sessid)));
+                }
+
+                // Write the cookie
+                $this-&gt;_set_cookie($cookie_data);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Destroy the current session
+         *
+         * @access        public
+         * @return        void
+         */
+        function sess_destroy()
+        {
+                // Kill the session DB row
+                if ($this-&gt;sess_use_database === TRUE AND isset($this-&gt;userdata['session_id']))
+                {
+                        $this-&gt;CI-&gt;db-&gt;where('session_id', $this-&gt;userdata['session_id']);
+                        $this-&gt;CI-&gt;db-&gt;delete($this-&gt;sess_table_name);
+                }
+
+                // Kill the cookie
+                setcookie(
+                                        $this-&gt;sess_cookie_name,
+                                        addslashes(serialize(array())),
+                                        ($this-&gt;now - 31500000),
+                                        $this-&gt;cookie_path,
+                                        $this-&gt;cookie_domain,
+                                        0
+                                );
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a specific item from the session array
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function userdata($item)
+        {
+                return ( ! isset($this-&gt;userdata[$item])) ? FALSE : $this-&gt;userdata[$item];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch all session data
+         *
+         * @access        public
+         * @return        mixed
+         */
+        function all_userdata()
+        {
+                return ( ! isset($this-&gt;userdata)) ? FALSE : $this-&gt;userdata;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add or change data in the &quot;userdata&quot; array
+         *
+         * @access        public
+         * @param        mixed
+         * @param        string
+         * @return        void
+         */
+        function set_userdata($newdata = array(), $newval = '')
+        {
+                if (is_string($newdata))
+                {
+                        $newdata = array($newdata =&gt; $newval);
+                }
+
+                if (count($newdata) &gt; 0)
+                {
+                        foreach ($newdata as $key =&gt; $val)
+                        {
+                                $this-&gt;userdata[$key] = $val;
+                        }
+                }
+
+                $this-&gt;sess_write();
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Delete a session variable from the &quot;userdata&quot; array
+         *
+         * @access        array
+         * @return        void
+         */
+        function unset_userdata($newdata = array())
+        {
+                if (is_string($newdata))
+                {
+                        $newdata = array($newdata =&gt; '');
+                }
+
+                if (count($newdata) &gt; 0)
+                {
+                        foreach ($newdata as $key =&gt; $val)
+                        {
+                                unset($this-&gt;userdata[$key]);
+                        }
+                }
+
+                $this-&gt;sess_write();
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Add or change flashdata, only available
+         * until the next request
+         *
+         * @access        public
+         * @param        mixed
+         * @param        string
+         * @return        void
+         */
+        function set_flashdata($newdata = array(), $newval = '')
+        {
+                if (is_string($newdata))
+                {
+                        $newdata = array($newdata =&gt; $newval);
+                }
+
+                if (count($newdata) &gt; 0)
+                {
+                        foreach ($newdata as $key =&gt; $val)
+                        {
+                                $flashdata_key = $this-&gt;flashdata_key.':new:'.$key;
+                                $this-&gt;set_userdata($flashdata_key, $val);
+                        }
+                }
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Keeps existing flashdata available to next request.
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function keep_flashdata($key)
+        {
+                // 'old' flashdata gets removed.  Here we mark all
+                // flashdata as 'new' to preserve it from _flashdata_sweep()
+                // Note the function will return FALSE if the $key
+                // provided cannot be found
+                $old_flashdata_key = $this-&gt;flashdata_key.':old:'.$key;
+                $value = $this-&gt;userdata($old_flashdata_key);
+
+                $new_flashdata_key = $this-&gt;flashdata_key.':new:'.$key;
+                $this-&gt;set_userdata($new_flashdata_key, $value);
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Fetch a specific flashdata item from the session array
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function flashdata($key)
+        {
+                $flashdata_key = $this-&gt;flashdata_key.':old:'.$key;
+                return $this-&gt;userdata($flashdata_key);
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Identifies flashdata as 'old' for removal
+         * when _flashdata_sweep() runs.
+         *
+         * @access        private
+         * @return        void
+         */
+        function _flashdata_mark()
+        {
+                $userdata = $this-&gt;all_userdata();
+                foreach ($userdata as $name =&gt; $value)
+                {
+                        $parts = explode(':new:', $name);
+                        if (is_array($parts) &amp;&amp; count($parts) === 2)
+                        {
+                                $new_name = $this-&gt;flashdata_key.':old:'.$parts[1];
+                                $this-&gt;set_userdata($new_name, $value);
+                                $this-&gt;unset_userdata($name);
+                        }
+                }
+        }
+
+        // ------------------------------------------------------------------------
+
+        /**
+         * Removes all flashdata marked as 'old'
+         *
+         * @access        private
+         * @return        void
+         */
+
+        function _flashdata_sweep()
+        {
+                $userdata = $this-&gt;all_userdata();
+                foreach ($userdata as $key =&gt; $value)
+                {
+                        if (strpos($key, ':old:'))
+                        {
+                                $this-&gt;unset_userdata($key);
+                        }
+                }
+
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get the &quot;now&quot; time
+         *
+         * @access        private
+         * @return        string
+         */
+        function _get_time()
+        {
+                if (strtolower($this-&gt;time_reference) == 'gmt')
+                {
+                        $now = time();
+                        $time = mktime(gmdate(&quot;H&quot;, $now), gmdate(&quot;i&quot;, $now), gmdate(&quot;s&quot;, $now), gmdate(&quot;m&quot;, $now), gmdate(&quot;d&quot;, $now), gmdate(&quot;Y&quot;, $now));
+                }
+                else
+                {
+                        $time = time();
+                }
+
+                return $time;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Write the session cookie
+         *
+         * @access        public
+         * @return        void
+         */
+        function _set_cookie($cookie_data = NULL)
+        {
+                if (is_null($cookie_data))
+                {
+                        $cookie_data = $this-&gt;userdata;
+                }
+
+                // Serialize the userdata for the cookie
+                $cookie_data = $this-&gt;_serialize($cookie_data);
+
+                if ($this-&gt;sess_encrypt_cookie == TRUE)
+                {
+                        $cookie_data = $this-&gt;CI-&gt;encrypt-&gt;encode($cookie_data);
+                }
+                else
+                {
+                        // if encryption is not used, we provide an md5 hash to prevent userside tampering
+                        $cookie_data = $cookie_data.md5($cookie_data.$this-&gt;encryption_key);
+                }
+
+                // Set the cookie
+                setcookie(
+                                        $this-&gt;sess_cookie_name,
+                                        $cookie_data,
+                                        $this-&gt;sess_expiration + time(),
+                                        $this-&gt;cookie_path,
+                                        $this-&gt;cookie_domain,
+                                        0
+                                );
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Serialize an array
+         *
+         * This function first converts any slashes found in the array to a temporary
+         * marker, so when it gets unserialized the slashes will be preserved
+         *
+         * @access        private
+         * @param        array
+         * @return        string
+         */
+        function _serialize($data)
+        {
+                if (is_array($data))
+                {
+                        foreach ($data as $key =&gt; $val)
+                        {
+                                $data[$key] = str_replace('\\', '{{slash}}', $val);
+                        }
+                }
+                else
+                {
+                        $data = str_replace('\\', '{{slash}}', $data);
+                }
+
+                return serialize($data);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Unserialize
+         *
+         * This function unserializes a data string, then converts any
+         * temporary slash markers back to actual slashes
+         *
+         * @access        private
+         * @param        array
+         * @return        string
+         */
+        function _unserialize($data)
+        {
+                $data = @unserialize(strip_slashes($data));
+
+                if (is_array($data))
+                {
+                        foreach ($data as $key =&gt; $val)
+                        {
+                                $data[$key] = str_replace('{{slash}}', '\\', $val);
+                        }
+
+                        return $data;
+                }
+
+                return str_replace('{{slash}}', '\\', $data);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Garbage collection
+         *
+         * This deletes expired session rows from database
+         * if the probability percentage is met
+         *
+         * @access        public
+         * @return        void
+         */
+        function _sess_gc()
+        {
+                if ($this-&gt;sess_use_database != TRUE)
+                {
+                        return;
+                }
+
+                srand(time());
+                if ((rand() % 100) &lt; $this-&gt;gc_probability)
+                {
+                        $expire = $this-&gt;now - $this-&gt;sess_expiration;
+
+                        $this-&gt;CI-&gt;db-&gt;where(&quot;last_activity &lt; {$expire}&quot;);
+                        $this-&gt;CI-&gt;db-&gt;delete($this-&gt;sess_table_name);
+
+                        log_message('debug', 'Session garbage collection performed.');
+                }
+        }
+
+
+}
+// END Session Class
+
+/* End of file Session.php */
+/* Location: ./system/libraries/Session.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesSha1php"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Sha1.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Sha1.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Sha1.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,251 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * SHA1 Encoding Class
+ *
+ * Purpose: Provides 160 bit hashing using The Secure Hash Algorithm
+ * developed at the National Institute of Standards and Technology. The 40
+ * character SHA1 message hash is computationally infeasible to crack.
+ *
+ * This class is a fallback for servers that are not running PHP greater than
+ * 4.3, or do not have the MHASH library.
+ *
+ * This class is based on two scripts:
+ *
+ * Marcus Campbell's PHP implementation (GNU license)
+ * http://www.tecknik.net/sha-1/
+ *
+ * ...which is based on Paul Johnston's JavaScript version
+ * (BSD license). http://pajhome.org.uk/
+ *
+ * I encapsulated the functions and wrote one additional method to fix
+ * a hex conversion bug. - Rick Ellis
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Encryption
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/general/encryption.html
+ */
+class CI_SHA {
+
+        function CI_SHA()
+        {
+                log_message('debug', &quot;SHA1 Class Initialized&quot;);
+        }
+
+        /**
+         * Generate the Hash
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function generate($str)
+        {
+                $n = ((strlen($str) + 8) &gt;&gt; 6) + 1;
+
+                for ($i = 0; $i &lt; $n * 16; $i++)
+                {
+                        $x[$i] = 0;
+                }
+
+                for ($i = 0; $i &lt; strlen($str); $i++)
+                {
+                        $x[$i &gt;&gt; 2] |= ord(substr($str, $i, 1)) &lt;&lt; (24 - ($i % 4) * 8);
+                }
+
+                $x[$i &gt;&gt; 2] |= 0x80 &lt;&lt; (24 - ($i % 4) * 8);
+
+                $x[$n * 16 - 1] = strlen($str) * 8;
+
+                $a =  1732584193;
+                $b = -271733879;
+                $c = -1732584194;
+                $d =  271733878;
+                $e = -1009589776;
+
+                for ($i = 0; $i &lt; count($x); $i += 16)
+                {
+                        $olda = $a;
+                        $oldb = $b;
+                        $oldc = $c;
+                        $oldd = $d;
+                        $olde = $e;
+
+                        for($j = 0; $j &lt; 80; $j++)
+                        {
+                                if ($j &lt; 16)
+                                {
+                                        $w[$j] = $x[$i + $j];
+                                }
+                                else
+                                {
+                                        $w[$j] = $this-&gt;_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1);
+                                }
+
+                                $t = $this-&gt;_safe_add($this-&gt;_safe_add($this-&gt;_rol($a, 5), $this-&gt;_ft($j, $b, $c, $d)), $this-&gt;_safe_add($this-&gt;_safe_add($e, $w[$j]), $this-&gt;_kt($j)));
+
+                                $e = $d;
+                                $d = $c;
+                                $c = $this-&gt;_rol($b, 30);
+                                $b = $a;
+                                $a = $t;
+                        }
+
+                        $a = $this-&gt;_safe_add($a, $olda);
+                        $b = $this-&gt;_safe_add($b, $oldb);
+                        $c = $this-&gt;_safe_add($c, $oldc);
+                        $d = $this-&gt;_safe_add($d, $oldd);
+                        $e = $this-&gt;_safe_add($e, $olde);
+                }
+
+                return $this-&gt;_hex($a).$this-&gt;_hex($b).$this-&gt;_hex($c).$this-&gt;_hex($d).$this-&gt;_hex($e);
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Convert a decimal to hex
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */        
+        function _hex($str)
+        {
+                $str = dechex($str);
+
+                if (strlen($str) == 7)
+                {
+                        $str = '0'.$str;
+                }
+
+                return $str;
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         *  Return result based on iteration
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _ft($t, $b, $c, $d)
+        {
+                if ($t &lt; 20)
+                        return ($b &amp; $c) | ((~$b) &amp; $d);
+                if ($t &lt; 40)
+                        return $b ^ $c ^ $d;
+                if ($t &lt; 60)
+                        return ($b &amp; $c) | ($b &amp; $d) | ($c &amp; $d);
+
+                return $b ^ $c ^ $d;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Determine the additive constant
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _kt($t)
+        {
+                if ($t &lt; 20)
+                {
+                        return 1518500249;
+                }
+                else if ($t &lt; 40)
+                {
+                        return 1859775393;
+                }
+                else if ($t &lt; 60)
+                {
+                        return -1894007588;
+                }
+                else
+                {
+                        return -899497514;
+                }
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Add integers, wrapping at 2^32
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _safe_add($x, $y)
+        {
+                $lsw = ($x &amp; 0xFFFF) + ($y &amp; 0xFFFF);
+                $msw = ($x &gt;&gt; 16) + ($y &gt;&gt; 16) + ($lsw &gt;&gt; 16);
+
+                return ($msw &lt;&lt; 16) | ($lsw &amp; 0xFFFF);
+        }
+          
+        // --------------------------------------------------------------------
+
+        /**
+         * Bitwise rotate a 32-bit number
+         *
+         * @access        private
+         * @return        integer
+         */        
+        function _rol($num, $cnt)
+        {
+                return ($num &lt;&lt; $cnt) | $this-&gt;_zero_fill($num, 32 - $cnt);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Pad string with zero
+         *
+         * @access        private
+         * @return        string
+         */        
+        function _zero_fill($a, $b)
+        {
+                $bin = decbin($a);
+
+                if (strlen($bin) &lt; $b)
+                {
+                        $bin = 0;
+                }
+                else
+                {
+                        $bin = substr($bin, 0, strlen($bin) - $b);
+                }
+
+                for ($i=0; $i &lt; $b; $i++)
+                {
+                        $bin = &quot;0&quot;.$bin;
+                }
+
+                return bindec($bin);
+        }
+}
+// END CI_SHA
+
+/* End of file Sha1.php */
+/* Location: ./system/libraries/Sha1.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesTablephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Table.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Table.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Table.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,440 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.3.1
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * HTML Table Generating Class
+ *
+ * Lets you create tables manually or from database result objects, or arrays.
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        HTML Tables
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/uri.html
+ */
+class CI_Table {
+
+        var $rows                                = array();
+        var $heading                        = array();
+        var $auto_heading                = TRUE;        
+        var $caption                        = NULL;        
+        var $template                         = NULL;
+        var $newline                        = &quot;\n&quot;;
+        var $empty_cells                = &quot;&quot;;
+        
+        
+        function CI_Table()
+        {
+                log_message('debug', &quot;Table Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set the template
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function set_template($template)
+        {
+                if ( ! is_array($template))
+                {
+                        return FALSE;
+                }
+        
+                $this-&gt;template = $template;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set the table heading
+         *
+         * Can be passed as an array or discreet params
+         *
+         * @access        public
+         * @param        mixed
+         * @return        void
+         */
+        function set_heading()
+        {
+                $args = func_get_args();
+                $this-&gt;heading = (is_array($args[0])) ? $args[0] : $args;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set columns.  Takes a one-dimensional array as input and creates
+         * a multi-dimensional array with a depth equal to the number of
+         * columns.  This allows a single array with many elements to  be
+         * displayed in a table that has a fixed column count.
+         *
+         * @access        public
+         * @param        array
+         * @param        int
+         * @return        void
+         */
+        function make_columns($array = array(), $col_limit = 0)
+        {
+                if ( ! is_array($array) OR count($array) == 0)
+                {
+                        return FALSE;
+                }
+                
+                // Turn off the auto-heading feature since it's doubtful we 
+                // will want headings from a one-dimensional array
+                $this-&gt;auto_heading = FALSE;
+                
+                if ($col_limit == 0)
+                {
+                        return $array;
+                }
+        
+                $new = array();
+                while(count($array) &gt; 0)
+                {        
+                        $temp = array_splice($array, 0, $col_limit);
+                        
+                        if (count($temp) &lt; $col_limit)
+                        {
+                                for ($i = count($temp); $i &lt; $col_limit; $i++)
+                                {
+                                        $temp[] = '&amp;nbsp;';
+                                }
+                        }
+                        
+                        $new[] = $temp;
+                }
+                
+                return $new;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set &quot;empty&quot; cells
+         *
+         * Can be passed as an array or discreet params
+         *
+         * @access        public
+         * @param        mixed
+         * @return        void
+         */
+        function set_empty($value)
+        {
+                $this-&gt;empty_cells = $value;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Add a table row
+         *
+         * Can be passed as an array or discreet params
+         *
+         * @access        public
+         * @param        mixed
+         * @return        void
+         */
+        function add_row()
+        {
+                $args = func_get_args();
+                $this-&gt;rows[] = (is_array($args[0])) ? $args[0] : $args;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add a table caption
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */
+        function set_caption($caption)
+        {
+                $this-&gt;caption = $caption;
+        }        
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate the table
+         *
+         * @access        public
+         * @param        mixed
+         * @return        string
+         */
+        function generate($table_data = NULL)
+        {
+                // The table data can optionally be passed to this function
+                // either as a database result object or an array
+                if ( ! is_null($table_data))
+                {
+                        if (is_object($table_data))
+                        {
+                                $this-&gt;_set_from_object($table_data);
+                        }
+                        elseif (is_array($table_data))
+                        {
+                                $set_heading = (count($this-&gt;heading) == 0 AND $this-&gt;auto_heading == FALSE) ? FALSE : TRUE;
+                                $this-&gt;_set_from_array($table_data, $set_heading);
+                        }
+                }
+        
+                // Is there anything to display?  No?  Smite them!
+                if (count($this-&gt;heading) == 0 AND count($this-&gt;rows) == 0)
+                {
+                        return 'Undefined table data';
+                }
+        
+                // Compile and validate the template date
+                $this-&gt;_compile_template();
+        
+        
+                // Build the table!
+                
+                $out = $this-&gt;template['table_open'];
+                $out .= $this-&gt;newline;                
+
+                // Add any caption here
+                if ($this-&gt;caption)
+                {
+                        $out .= $this-&gt;newline;
+                        $out .= '&lt;caption&gt;' . $this-&gt;caption . '&lt;/caption&gt;';
+                        $out .= $this-&gt;newline;
+                }
+
+                // Is there a table heading to display?
+                if (count($this-&gt;heading) &gt; 0)
+                {
+                        $out .= $this-&gt;template['heading_row_start'];
+                        $out .= $this-&gt;newline;                
+
+                        foreach($this-&gt;heading as $heading)
+                        {
+                                $out .= $this-&gt;template['heading_cell_start'];
+                                $out .= $heading;
+                                $out .= $this-&gt;template['heading_cell_end'];
+                        }
+
+                        $out .= $this-&gt;template['heading_row_end'];
+                        $out .= $this-&gt;newline;                                
+                }
+
+                // Build the table rows
+                if (count($this-&gt;rows) &gt; 0)
+                {
+                        $i = 1;
+                        foreach($this-&gt;rows as $row)
+                        {
+                                if ( ! is_array($row))
+                                {
+                                        break;
+                                }
+                        
+                                // We use modulus to alternate the row colors
+                                $name = (fmod($i++, 2)) ? '' : 'alt_';
+                        
+                                $out .= $this-&gt;template['row_'.$name.'start'];
+                                $out .= $this-&gt;newline;                
+        
+                                foreach($row as $cell)
+                                {
+                                        $out .= $this-&gt;template['cell_'.$name.'start'];
+                                        
+                                        if ($cell === &quot;&quot;)
+                                        {
+                                                $out .= $this-&gt;empty_cells;
+                                        }
+                                        else
+                                        {
+                                                $out .= $cell;
+                                        }
+                                        
+                                        $out .= $this-&gt;template['cell_'.$name.'end'];
+                                }
+        
+                                $out .= $this-&gt;template['row_'.$name.'end'];
+                                $out .= $this-&gt;newline;        
+                        }
+                }
+
+                $out .= $this-&gt;template['table_close'];
+        
+                return $out;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Clears the table arrays.  Useful if multiple tables are being generated
+         *
+         * @access        public
+         * @return        void
+         */
+        function clear()
+        {
+                $this-&gt;rows                                = array();
+                $this-&gt;heading                        = array();
+                $this-&gt;auto_heading                = TRUE;        
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Set table data from a database result object
+         *
+         * @access        public
+         * @param        object
+         * @return        void
+         */
+        function _set_from_object($query)
+        {
+                if ( ! is_object($query))
+                {
+                        return FALSE;
+                }
+                
+                // First generate the headings from the table column names
+                if (count($this-&gt;heading) == 0)
+                {
+                        if ( ! method_exists($query, 'list_fields'))
+                        {
+                                return FALSE;
+                        }
+                        
+                        $this-&gt;heading = $query-&gt;list_fields();
+                }
+                                
+                // Next blast through the result array and build out the rows
+                
+                if ($query-&gt;num_rows() &gt; 0)
+                {
+                        foreach ($query-&gt;result_array() as $row)
+                        {
+                                $this-&gt;rows[] = $row;
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Set table data from an array
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */
+        function _set_from_array($data, $set_heading = TRUE)
+        {
+                if ( ! is_array($data) OR count($data) == 0)
+                {
+                        return FALSE;
+                }
+                
+                $i = 0;
+                foreach ($data as $row)
+                {
+                        if ( ! is_array($row))
+                        {
+                                $this-&gt;rows[] = $data;
+                                break;
+                        }
+                                                
+                        // If a heading hasn't already been set we'll use the first row of the array as the heading
+                        if ($i == 0 AND count($data) &gt; 1 AND count($this-&gt;heading) == 0 AND $set_heading == TRUE)
+                        {
+                                $this-&gt;heading = $row;
+                        }
+                        else
+                        {
+                                $this-&gt;rows[] = $row;
+                        }
+                        
+                        $i++;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Compile Template
+         *
+         * @access        private
+         * @return        void
+         */
+         function _compile_template()
+         {         
+                 if ($this-&gt;template == NULL)
+                 {
+                         $this-&gt;template = $this-&gt;_default_template();
+                         return;
+                 }
+                
+                $this-&gt;temp = $this-&gt;_default_template();
+                foreach (array('table_open','heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val)
+                {
+                        if ( ! isset($this-&gt;template[$val]))
+                        {
+                                $this-&gt;template[$val] = $this-&gt;temp[$val];
+                        }
+                }         
+         }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Default Template
+         *
+         * @access        private
+         * @return        void
+         */
+        function _default_template()
+        {
+                return  array (
+                                                'table_open'                         =&gt; '&lt;table border=&quot;0&quot; cellpadding=&quot;4&quot; cellspacing=&quot;0&quot;&gt;',
+
+                                                'heading_row_start'         =&gt; '&lt;tr&gt;',
+                                                'heading_row_end'                 =&gt; '&lt;/tr&gt;',
+                                                'heading_cell_start'        =&gt; '&lt;th&gt;',
+                                                'heading_cell_end'                =&gt; '&lt;/th&gt;',
+
+                                                'row_start'                         =&gt; '&lt;tr&gt;',
+                                                'row_end'                                 =&gt; '&lt;/tr&gt;',
+                                                'cell_start'                        =&gt; '&lt;td&gt;',
+                                                'cell_end'                                =&gt; '&lt;/td&gt;',
+
+                                                'row_alt_start'                 =&gt; '&lt;tr&gt;',
+                                                'row_alt_end'                         =&gt; '&lt;/tr&gt;',
+                                                'cell_alt_start'                =&gt; '&lt;td&gt;',
+                                                'cell_alt_end'                        =&gt; '&lt;/td&gt;',
+
+                                                'table_close'                         =&gt; '&lt;/table&gt;'
+                                        );        
+        }
+        
+
+}
+
+
+/* End of file Table.php */
+/* Location: ./system/libraries/Table.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesTrackbackphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Trackback.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Trackback.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Trackback.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,547 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Trackback Class
+ *
+ * Trackback Sending/Receiving Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Trackbacks
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/trackback.html
+ */
+class CI_Trackback {
+                
+        var $time_format        = 'local';
+        var $charset                = 'UTF-8';
+        var $data                        = array('url' =&gt; '', 'title' =&gt; '', 'excerpt' =&gt; '', 'blog_name' =&gt; '', 'charset' =&gt; '');
+        var $convert_ascii        = TRUE;
+        var $response                = '';
+        var $error_msg                = array();
+
+        /**
+         * Constructor
+         *
+         * @access        public
+         */
+        function CI_Trackback()
+        {
+                log_message('debug', &quot;Trackback Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Send Trackback
+         *
+         * @access        public
+         * @param        array
+         * @return        bool
+         */        
+        function send($tb_data)
+        {                
+                if ( ! is_array($tb_data))
+                {
+                        $this-&gt;set_error('The send() method must be passed an array');
+                        return FALSE;
+                }
+                
+                // Pre-process the Trackback Data
+                foreach (array('url', 'title', 'excerpt', 'blog_name', 'ping_url') as $item)
+                {
+                        if ( ! isset($tb_data[$item]))
+                        {
+                                $this-&gt;set_error('Required item missing: '.$item);
+                                return FALSE;
+                        }
+                        
+                        switch ($item)
+                        {
+                                case 'ping_url'        : $$item = $this-&gt;extract_urls($tb_data[$item]);
+                                        break;
+                                case 'excerpt'        : $$item = $this-&gt;limit_characters($this-&gt;convert_xml(strip_tags(stripslashes($tb_data[$item]))));
+                                        break;
+                                case 'url'                 : $$item = str_replace('&amp;#45;', '-', $this-&gt;convert_xml(strip_tags(stripslashes($tb_data[$item]))));
+                                        break;
+                                default                        : $$item = $this-&gt;convert_xml(strip_tags(stripslashes($tb_data[$item])));
+                                        break;
+                        }
+
+                        // Convert High ASCII Characters
+                        if ($this-&gt;convert_ascii == TRUE)
+                        {
+                                if ($item == 'excerpt')
+                                {
+                                        $$item = $this-&gt;convert_ascii($$item);
+                                }
+                                elseif ($item == 'title')
+                                {
+                                        $$item = $this-&gt;convert_ascii($$item);
+                                }
+                                elseif($item == 'blog_name')
+                                {
+                                        $$item = $this-&gt;convert_ascii($$item);
+                                }
+                        }
+                }
+
+                // Build the Trackback data string
+                $charset = ( ! isset($tb_data['charset'])) ? $this-&gt;charset : $tb_data['charset'];
+                
+                $data = &quot;url=&quot;.rawurlencode($url).&quot;&amp;title=&quot;.rawurlencode($title).&quot;&amp;blog_name=&quot;.rawurlencode($blog_name).&quot;&amp;excerpt=&quot;.rawurlencode($excerpt).&quot;&amp;charset=&quot;.rawurlencode($charset);
+                                
+                // Send Trackback(s)
+                $return = TRUE;
+                if (count($ping_url) &gt; 0)
+                {
+                        foreach ($ping_url as $url)
+                        {
+                                if ($this-&gt;process($url, $data) == FALSE)
+                                {
+                                        $return = FALSE;
+                                }
+                        }        
+                }
+
+                return $return;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Receive Trackback  Data
+         *
+         * This function simply validates the incoming TB data.
+         * It returns false on failure and true on success.
+         * If the data is valid it is set to the $this-&gt;data array
+         * so that it can be inserted into a database.
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function receive()
+        {                                          
+                foreach (array('url', 'title', 'blog_name', 'excerpt') as $val)
+                {
+                        if ( ! isset($_POST[$val]) OR $_POST[$val] == '')
+                        {
+                                $this-&gt;set_error('The following required POST variable is missing: '.$val);
+                                return FALSE;
+                        }
+                        
+                        $this-&gt;data['charset'] = ( ! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset']));
+        
+                        if ($val != 'url' &amp;&amp; function_exists('mb_convert_encoding'))
+                        {
+                                $_POST[$val] = mb_convert_encoding($_POST[$val], $this-&gt;charset, $this-&gt;data['charset']);
+                        }
+                        
+                        $_POST[$val] = ($val != 'url') ? $this-&gt;convert_xml(strip_tags($_POST[$val])) : strip_tags($_POST[$val]);
+                        
+                        if ($val == 'excerpt')
+                        {
+                                $_POST['excerpt'] = $this-&gt;limit_characters($_POST['excerpt']);
+                        }
+                        
+                        $this-&gt;data[$val] = $_POST[$val];
+                }
+
+                return TRUE;
+        }        
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Send Trackback Error Message
+         *
+         * Allows custom errors to be set.  By default it
+         * sends the &quot;incomplete information&quot; error, as that's
+         * the most common one.
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function send_error($message = 'Incomplete Information')
+        {
+                echo &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;utf-8\&quot;?&quot;.&quot;&gt;\n&lt;response&gt;\n&lt;error&gt;1&lt;/error&gt;\n&lt;message&gt;&quot;.$message.&quot;&lt;/message&gt;\n&lt;/response&gt;&quot;;
+                exit;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Send Trackback Success Message
+         *
+         * This should be called when a trackback has been
+         * successfully received and inserted.
+         *
+         * @access        public
+         * @return        void
+         */                
+        function send_success()
+        {
+                echo &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;utf-8\&quot;?&quot;.&quot;&gt;\n&lt;response&gt;\n&lt;error&gt;0&lt;/error&gt;\n&lt;/response&gt;&quot;;
+                exit;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Fetch a particular item
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function data($item)
+        {
+                return ( ! isset($this-&gt;data[$item])) ? '' : $this-&gt;data[$item];
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Process Trackback
+         *
+         * Opens a socket connection and passes the data to
+         * the server.  Returns true on success, false on failure
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        bool
+         */        
+        function process($url, $data)
+        {
+                $target = parse_url($url);
+        
+                // Open the socket
+                if ( ! $fp = @fsockopen($target['host'], 80))
+                {
+                        $this-&gt;set_error('Invalid Connection: '.$url);
+                        return FALSE;
+                }
+
+                // Build the path
+                $ppath = ( ! isset($target['path'])) ? $url : $target['path'];
+                
+                $path = (isset($target['query']) &amp;&amp; $target['query'] != &quot;&quot;) ? $ppath.'?'.$target['query'] : $ppath;
+
+                // Add the Trackback ID to the data string
+                if ($id = $this-&gt;get_id($url))
+                {
+                        $data = &quot;tb_id=&quot;.$id.&quot;&amp;&quot;.$data;
+                }
+
+                // Transfer the data
+                fputs ($fp, &quot;POST &quot; . $path . &quot; HTTP/1.0\r\n&quot; );
+                fputs ($fp, &quot;Host: &quot; . $target['host'] . &quot;\r\n&quot; );
+                fputs ($fp, &quot;Content-type: application/x-www-form-urlencoded\r\n&quot; );
+                fputs ($fp, &quot;Content-length: &quot; . strlen($data) . &quot;\r\n&quot; );
+                fputs ($fp, &quot;Connection: close\r\n\r\n&quot; );
+                fputs ($fp, $data);
+
+                // Was it successful?
+                $this-&gt;response = &quot;&quot;;
+                
+                while( ! feof($fp))
+                {
+                        $this-&gt;response .= fgets($fp, 128);
+                }
+                @fclose($fp);
+                
+                if (stristr($this-&gt;response, '&lt;error&gt;0&lt;/error&gt;') === FALSE)
+                {
+                        $message = 'An unknown error was encountered';
+                        
+                        if (preg_match(&quot;/&lt;message&gt;(.*?)&lt;\/message&gt;/is&quot;, $this-&gt;response, $match))
+                        {
+                                $message = trim($match['1']);
+                        }
+                        
+                        $this-&gt;set_error($message);
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Extract Trackback URLs
+         *
+         * This function lets multiple trackbacks be sent.
+         * It takes a string of URLs (separated by comma or
+         * space) and puts each URL into an array
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function extract_urls($urls)
+        {                
+                // Remove the pesky white space and replace with a comma.
+                $urls = preg_replace(&quot;/\s*(\S+)\s*/&quot;, &quot;\\1,&quot;, $urls);
+                
+                // If they use commas get rid of the doubles.
+                $urls = str_replace(&quot;,,&quot;, &quot;,&quot;, $urls);
+                
+                // Remove any comma that might be at the end
+                if (substr($urls, -1) == &quot;,&quot;)
+                {
+                        $urls = substr($urls, 0, -1);
+                }
+                                
+                // Break into an array via commas
+                $urls = preg_split('/[,]/', $urls);
+                
+                // Removes duplicates
+                $urls = array_unique($urls);
+                
+                array_walk($urls, array($this, 'validate_url'));
+                
+                return $urls;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Validate URL
+         *
+         * Simply adds &quot;http://&quot; if missing
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function validate_url($url)
+        {
+                $url = trim($url);
+
+                if (substr($url, 0, 4) != &quot;http&quot;)
+                {
+                        $url = &quot;http://&quot;.$url;
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Find the Trackback URL's ID
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function get_id($url)
+        {        
+                $tb_id = &quot;&quot;;
+                
+                if (strstr($url, '?'))
+                {
+                        $tb_array = explode('/', $url);
+                        $tb_end   = $tb_array[count($tb_array)-1];
+                        
+                        if ( ! is_numeric($tb_end))
+                        {
+                                $tb_end  = $tb_array[count($tb_array)-2];
+                        }
+                        
+                        $tb_array = explode('=', $tb_end);
+                        $tb_id        = $tb_array[count($tb_array)-1];
+                }
+                else
+                {
+                        $url = rtrim($url, '/');
+                                
+                        $tb_array = explode('/', $url);
+                        $tb_id        = $tb_array[count($tb_array)-1];
+                        
+                        if ( ! is_numeric($tb_id))
+                        {
+                                $tb_id  = $tb_array[count($tb_array)-2];
+                        }
+                }        
+                                
+                if ( ! preg_match (&quot;/^([0-9]+)$/&quot;, $tb_id))
+                {
+                        return false;
+                }
+                else
+                {
+                        return $tb_id;
+                }                
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Convert Reserved XML characters to Entities
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function convert_xml($str)
+        {
+                $temp = '__TEMP_AMPERSANDS__';
+                
+                $str = preg_replace(&quot;/&amp;#(\d+);/&quot;, &quot;$temp\\1;&quot;, $str);
+                $str = preg_replace(&quot;/&amp;(\w+);/&quot;,  &quot;$temp\\1;&quot;, $str);
+                
+                $str = str_replace(array(&quot;&amp;&quot;,&quot;&lt;&quot;,&quot;&gt;&quot;,&quot;\&quot;&quot;, &quot;'&quot;, &quot;-&quot;),
+                                                   array(&quot;&amp;amp;&quot;, &quot;&amp;lt;&quot;, &quot;&amp;gt;&quot;, &quot;&amp;quot;&quot;, &quot;&amp;#39;&quot;, &quot;&amp;#45;&quot;),
+                                                   $str);
+                        
+                $str = preg_replace(&quot;/$temp(\d+);/&quot;,&quot;&amp;#\\1;&quot;,$str);
+                $str = preg_replace(&quot;/$temp(\w+);/&quot;,&quot;&amp;\\1;&quot;, $str);
+                        
+                return $str;
+        }        
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Character limiter
+         *
+         * Limits the string based on the character count. Will preserve complete words.
+         *
+         * @access        public
+         * @param        string
+         * @param        integer
+         * @param        string
+         * @return        string
+         */
+        function limit_characters($str, $n = 500, $end_char = '&amp;#8230;')
+        {
+                if (strlen($str) &lt; $n)
+                {
+                        return $str;
+                }
+
+                $str = preg_replace(&quot;/\s+/&quot;, ' ', str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;, &quot;\n&quot;), ' ', $str));
+        
+                if (strlen($str) &lt;= $n)
+                {
+                        return $str;
+                }
+                                                                                
+                $out = &quot;&quot;;
+                foreach (explode(' ', trim($str)) as $val)
+                {
+                        $out .= $val.' ';                        
+                        if (strlen($out) &gt;= $n)
+                        {
+                                return trim($out).$end_char;
+                        }                
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * High ASCII to Entities
+         *
+         * Converts Hight ascii text and MS Word special chars
+         * to character entities
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function convert_ascii($str)
+        {
+           $count        = 1;
+           $out        = '';
+           $temp        = array();
+                
+           for ($i = 0, $s = strlen($str); $i &lt; $s; $i++)
+           {
+                   $ordinal = ord($str[$i]);
+                
+                   if ($ordinal &lt; 128)
+                   {
+                           $out .= $str[$i];                        
+                   }
+                   else
+                   {
+                           if (count($temp) == 0)
+                           {
+                                   $count = ($ordinal &lt; 224) ? 2 : 3;
+                           }
+                        
+                           $temp[] = $ordinal;
+                        
+                           if (count($temp) == $count)
+                           {
+                                   $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
+        
+                                   $out .= '&amp;#'.$number.';';
+                                   $count = 1;
+                                   $temp = array();
+                           }
+                   }
+           }
+        
+           return $out;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set error message
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_error($msg)
+        {
+                log_message('error', $msg);
+                $this-&gt;error_msg[] = $msg;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Show error messages
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function display_errors($open = '&lt;p&gt;', $close = '&lt;/p&gt;')
+        {        
+                $str = '';
+                foreach ($this-&gt;error_msg as $val)
+                {
+                        $str .= $open.$val.$close;
+                }
+        
+                return $str;
+        }
+
+}
+// END Trackback Class
+
+/* End of file Trackback.php */
+/* Location: ./system/libraries/Trackback.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesTypographyphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Typography.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Typography.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Typography.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,406 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Typography Class
+ *
+ *
+ * @access                private
+ * @category        Helpers
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/helpers/
+ */
+class CI_Typography {
+
+        // Block level elements that should not be wrapped inside &lt;p&gt; tags
+        var $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul';
+        
+        // Elements that should not have &lt;p&gt; and &lt;br /&gt; tags within them.
+        var $skip_elements        = 'p|pre|ol|ul|dl|object|table';
+        
+        // Tags we want the parser to completely ignore when splitting the string.
+        var $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var';
+        
+        // array of block level elements that require inner content to be within another block level element
+        var $inner_block_required = array('blockquote');
+        
+        // the last block element parsed
+        var $last_block_element = '';
+        
+        // whether or not to protect quotes within { curly braces }
+        var $protect_braced_quotes = FALSE;
+        
+        /**
+         * Nothing to do here...
+         *
+         */
+        function CI_Typography()
+        {
+        }
+
+        /**
+         * Auto Typography
+         *
+         * This function converts text, making it typographically correct:
+         *         - Converts double spaces into paragraphs.
+         *         - Converts single line breaks into &lt;br /&gt; tags
+         *         - Converts single and double quotes into correctly facing curly quote entities.
+         *         - Converts three dots into ellipsis.
+         *         - Converts double dashes into em-dashes.
+         *  - Converts two spaces into entities
+         *
+         * @access        public
+         * @param        string
+         * @param        bool        whether to reduce more then two consecutive newlines to two
+         * @return        string
+         */
+        function auto_typography($str, $reduce_linebreaks = FALSE)
+        {
+                if ($str == '')
+                {
+                        return '';
+                }
+
+                // Standardize Newlines to make matching easier
+                if (strpos($str, &quot;\r&quot;) !== FALSE)
+                {
+                        $str = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;), &quot;\n&quot;, $str);                        
+                }
+                        
+                // Reduce line breaks.  If there are more than two consecutive linebreaks
+                // we'll compress them down to a maximum of two since there's no benefit to more.
+                if ($reduce_linebreaks === TRUE)
+                {
+                        $str = preg_replace(&quot;/\n\n+/&quot;, &quot;\n\n&quot;, $str);
+                }   
+
+                // HTML comment tags don't conform to patterns of normal tags, so pull them out separately, only if needed
+                $html_comments = array();
+                if (strpos($str, '&lt;!--') !== FALSE)
+                {
+                        if (preg_match_all(&quot;#(&lt;!\-\-.*?\-\-&gt;)#s&quot;, $str, $matches))
+                        {
+                                for ($i = 0, $total = count($matches[0]); $i &lt; $total; $i++)
+                                {
+                                        $html_comments[] = $matches[0][$i];
+                                        $str = str_replace($matches[0][$i], '{@HC'.$i.'}', $str);
+                                }
+                        }
+                }
+                
+                // match and yank &lt;pre&gt; tags if they exist.  It's cheaper to do this separately since most content will
+                // not contain &lt;pre&gt; tags, and it keeps the PCRE patterns below simpler and faster
+                if (strpos($str, '&lt;pre') !== FALSE)
+                {
+                        $str = preg_replace_callback(&quot;#&lt;pre.*?&gt;.*?&lt;/pre&gt;#si&quot;, array($this, '_protect_characters'), $str);
+                }
+                
+                // Convert quotes within tags to temporary markers.
+                $str = preg_replace_callback(&quot;#&lt;.+?&gt;#si&quot;, array($this, '_protect_characters'), $str);
+
+                // Do the same with braces if necessary
+                if ($this-&gt;protect_braced_quotes === TRUE)
+                {
+                        $str = preg_replace_callback(&quot;#\{.+?\}#si&quot;, array($this, '_protect_characters'), $str);                
+                }
+                                
+                // Convert &quot;ignore&quot; tags to temporary marker.  The parser splits out the string at every tag 
+                // it encounters.  Certain inline tags, like image tags, links, span tags, etc. will be 
+                // adversely affected if they are split out so we'll convert the opening bracket &lt; temporarily to: {@TAG}
+                $str = preg_replace(&quot;#&lt;(/*)(&quot;.$this-&gt;inline_elements.&quot;)([ &gt;])#i&quot;, &quot;{@TAG}\\1\\2\\3&quot;, $str);
+
+                // Split the string at every tag.  This expression creates an array with this prototype:
+                // 
+                //         [array]
+                //         {
+                //                 [0] = &lt;opening tag&gt;
+                //                 [1] = Content...
+                //                 [2] = &lt;closing tag&gt;
+                //                 Etc...
+                //         }        
+                $chunks = preg_split('/(&lt;(?:[^&lt;&gt;]+(?:&quot;[^&quot;]*&quot;|\'[^\']*\')?)+&gt;)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
+                
+                // Build our finalized string.  We cycle through the array, skipping tags, and processing the contained text        
+                $str = '';
+                $process = TRUE;
+                $paragraph = FALSE;
+                $current_chunk = 0;
+                $total_chunks = count($chunks);
+                
+                foreach ($chunks as $chunk)
+                { 
+                        $current_chunk++;
+                        
+                        // Are we dealing with a tag? If so, we'll skip the processing for this cycle.
+                        // Well also set the &quot;process&quot; flag which allows us to skip &lt;pre&gt; tags and a few other things.
+                        if (preg_match(&quot;#&lt;(/*)(&quot;.$this-&gt;block_elements.&quot;).*?&gt;#&quot;, $chunk, $match))
+                        {
+                                if (preg_match(&quot;#&quot;.$this-&gt;skip_elements.&quot;#&quot;, $match[2]))
+                                {
+                                        $process =  ($match[1] == '/') ? TRUE : FALSE;
+                                }
+                                
+                                if ($match[1] == '')
+                                {
+                                        $this-&gt;last_block_element = $match[2];
+                                }
+
+                                $str .= $chunk;
+                                continue;
+                        }
+                        
+                        if ($process == FALSE)
+                        {
+                                $str .= $chunk;
+                                continue;
+                        }
+                        
+                        //  Force a newline to make sure end tags get processed by _format_newlines()
+                        if ($current_chunk == $total_chunks)
+                        {
+                                $chunk .= &quot;\n&quot;;  
+                        }
+                        
+                        //  Convert Newlines into &lt;p&gt; and &lt;br /&gt; tags
+                        $str .= $this-&gt;_format_newlines($chunk);
+                }
+                
+                // No opening block level tag?  Add it if needed.
+                if ( ! preg_match(&quot;/^\s*&lt;(?:&quot;.$this-&gt;block_elements.&quot;)/i&quot;, $str))
+                {
+                        $str = preg_replace(&quot;/^(.*?)&lt;(&quot;.$this-&gt;block_elements.&quot;)/i&quot;, '&lt;p&gt;$1&lt;/p&gt;&lt;$2', $str);
+                }
+                
+                // Convert quotes, elipsis, em-dashes, non-breaking spaces, and ampersands
+                $str = $this-&gt;format_characters($str);
+                
+                // restore HTML comments
+                for ($i = 0, $total = count($html_comments); $i &lt; $total; $i++)
+                {
+                        // remove surrounding paragraph tags, but only if there's an opening paragraph tag
+                        // otherwise HTML comments at the ends of paragraphs will have the closing tag removed
+                        // if '&lt;p&gt;{@HC1}' then replace &lt;p&gt;{@HC1}&lt;/p&gt; with the comment, else replace only {@HC1} with the comment
+                        $str = preg_replace('#(?(?=&lt;p&gt;\{@HC'.$i.'\})&lt;p&gt;\{@HC'.$i.'\}(\s*&lt;/p&gt;)|\{@HC'.$i.'\})#s', $html_comments[$i], $str);
+                }
+                                
+                // Final clean up
+                $table = array(
+                
+                                                // If the user submitted their own paragraph tags within the text
+                                                // we will retain them instead of using our tags.
+                                                '/(&lt;p[^&gt;*?]&gt;)&lt;p&gt;/'                =&gt; '$1', // &lt;?php BBEdit syntax coloring bug fix
+                                                
+                                                // Reduce multiple instances of opening/closing paragraph tags to a single one
+                                                '#(&lt;/p&gt;)+#'                        =&gt; '&lt;/p&gt;',
+                                                '/(&lt;p&gt;\W*&lt;p&gt;)+/'        =&gt; '&lt;p&gt;',
+                                                
+                                                // Clean up stray paragraph tags that appear before block level elements
+                                                '#&lt;p&gt;&lt;/p&gt;&lt;('.$this-&gt;block_elements.')#'        =&gt; '&lt;$1',
+
+                                                // Clean up stray non-breaking spaces preceeding block elements
+                                                '#(&amp;nbsp;\s*)+&lt;('.$this-&gt;block_elements.')#'        =&gt; '  &lt;$2',
+
+                                                // Replace the temporary markers we added earlier
+                                                '/\{@TAG\}/'                =&gt; '&lt;',
+                                                '/\{@DQ\}/'                        =&gt; '&quot;',
+                                                '/\{@SQ\}/'                        =&gt; &quot;'&quot;,
+                                                '/\{@DD\}/'                        =&gt; '--',
+                                                '/\{@NBS\}/'                =&gt; '  '
+
+                                                );
+                
+                // Do we need to reduce empty lines?
+                if ($reduce_linebreaks === TRUE)
+                {
+                        $table['#&lt;p&gt;\n*&lt;/p&gt;#'] = '';
+                }
+                else
+                {
+                        // If we have empty paragraph tags we add a non-breaking space
+                        // otherwise most browsers won't treat them as true paragraphs
+                        $table['#&lt;p&gt;&lt;/p&gt;#'] = '&lt;p&gt;&amp;nbsp;&lt;/p&gt;';
+                }
+                
+                return preg_replace(array_keys($table), $table, $str);
+
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Format Characters
+         *
+         * This function mainly converts double and single quotes
+         * to curly entities, but it also converts em-dashes,
+         * double spaces, and ampersands
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function format_characters($str)
+        {
+                static $table;
+                
+                if ( ! isset($table))
+                {
+                        $table = array(                                        
+                                                        // nested smart quotes, opening and closing
+                                                        // note that rules for grammar (English) allow only for two levels deep
+                                                        // and that single quotes are _supposed_ to always be on the outside
+                                                        // but we'll accommodate both
+                                                        // Note that in all cases, whitespace is the primary determining factor
+                                                        // on which direction to curl, with non-word characters like punctuation
+                                                        // being a secondary factor only after whitespace is addressed.
+                                                        '/\'&quot;(\s|$)/'                                        =&gt; '&amp;#8217;&amp;#8221;$1',
+                                                        '/(^|\s|&lt;p&gt;)\'&quot;/'                                =&gt; '$1&amp;#8216;&amp;#8220;',
+                                                        '/\'&quot;(\W)/'                                                =&gt; '&amp;#8217;&amp;#8221;$1',
+                                                        '/(\W)\'&quot;/'                                                =&gt; '$1&amp;#8216;&amp;#8220;',
+                                                        '/&quot;\'(\s|$)/'                                        =&gt; '&amp;#8221;&amp;#8217;$1',
+                                                        '/(^|\s|&lt;p&gt;)&quot;\'/'                                =&gt; '$1&amp;#8220;&amp;#8216;',
+                                                        '/&quot;\'(\W)/'                                                =&gt; '&amp;#8221;&amp;#8217;$1',
+                                                        '/(\W)&quot;\'/'                                                =&gt; '$1&amp;#8220;&amp;#8216;',
+
+                                                        // single quote smart quotes
+                                                        '/\'(\s|$)/'                                        =&gt; '&amp;#8217;$1',
+                                                        '/(^|\s|&lt;p&gt;)\'/'                                =&gt; '$1&amp;#8216;',
+                                                        '/\'(\W)/'                                                =&gt; '&amp;#8217;$1',
+                                                        '/(\W)\'/'                                                =&gt; '$1&amp;#8216;',
+
+                                                        // double quote smart quotes
+                                                        '/&quot;(\s|$)/'                                                =&gt; '&amp;#8221;$1',
+                                                        '/(^|\s|&lt;p&gt;)&quot;/'                                        =&gt; '$1&amp;#8220;',
+                                                        '/&quot;(\W)/'                                                =&gt; '&amp;#8221;$1',
+                                                        '/(\W)&quot;/'                                                =&gt; '$1&amp;#8220;',
+
+                                                        // apostrophes
+                                                        &quot;/(\w)'(\w)/&quot;                                        =&gt; '$1&amp;#8217;$2',
+
+                                                        // Em dash and ellipses dots
+                                                        '/\s?\-\-\s?/'                                        =&gt; '&amp;#8212;',
+                                                        '/(\w)\.{3}/'                                        =&gt; '$1&amp;#8230;',
+
+                                                        // double space after sentences
+                                                        '/(\W)  /'                                                =&gt; '$1&amp;nbsp; ',
+
+                                                        // ampersands, if not a character entity
+                                                        '/&amp;(?!#?[a-zA-Z0-9]{2,};)/'                =&gt; '&amp;amp;'
+                                                );
+                }
+
+                return preg_replace(array_keys($table), $table, $str);
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Format Newlines
+         *
+         * Converts newline characters into either &lt;p&gt; tags or &lt;br /&gt;
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function _format_newlines($str)
+        {
+                if ($str == '')
+                {
+                        return $str;
+                }
+                
+                if (strpos($str, &quot;\n&quot;) === FALSE  &amp;&amp; ! in_array($this-&gt;last_block_element, $this-&gt;inner_block_required))
+                {
+                        return $str;
+                }
+                
+                // Convert two consecutive newlines to paragraphs
+                $str = str_replace(&quot;\n\n&quot;, &quot;&lt;/p&gt;\n\n&lt;p&gt;&quot;, $str);
+                
+                // Convert single spaces to &lt;br /&gt; tags
+                $str = preg_replace(&quot;/([^\n])(\n)([^\n])/&quot;, &quot;\\1&lt;br /&gt;\\2\\3&quot;, $str);
+                
+                // Wrap the whole enchilada in enclosing paragraphs
+                if ($str != &quot;\n&quot;)
+                {
+                        $str =  '&lt;p&gt;'.$str.'&lt;/p&gt;';
+                }
+
+                // Remove empty paragraphs if they are on the first line, as this
+                // is a potential unintended consequence of the previous code
+                $str = preg_replace(&quot;/&lt;p&gt;&lt;\/p&gt;(.*)/&quot;, &quot;\\1&quot;, $str, 1);
+                
+                return $str;
+        }
+        
+        // ------------------------------------------------------------------------
+        
+        /**
+         * Protect Characters
+         *
+         * Protects special characters from being formatted later
+         * We don't want quotes converted within tags so we'll temporarily convert them to {@DQ} and {@SQ}
+          * and we don't want double dashes converted to emdash entities, so they are marked with {@DD}
+          * likewise double spaces are converted to {@NBS} to prevent entity conversion
+         *
+         * @access        public
+         * @param        array
+         * @return        string
+         */
+        function _protect_characters($match)
+        {
+                return str_replace(array(&quot;'&quot;,'&quot;','--','  '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $match[0]);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Convert newlines to HTML line breaks except within PRE tags
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */                
+        function nl2br_except_pre($str)
+        {
+                $ex = explode(&quot;pre&gt;&quot;,$str);
+                $ct = count($ex);
+        
+                $newstr = &quot;&quot;;
+                for ($i = 0; $i &lt; $ct; $i++)
+                {
+                        if (($i % 2) == 0)
+                        {
+                                $newstr .= nl2br($ex[$i]);
+                        }
+                        else
+                        {
+                                $newstr .= $ex[$i];
+                        }
+                
+                        if ($ct - 1 != $i)
+                                $newstr .= &quot;pre&gt;&quot;;
+                }
+        
+                return $newstr;
+        }
+        
+}
+// END Typography Class
+
+/* End of file Typography.php */
+/* Location: ./system/libraries/Typography.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesURIphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/URI.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/URI.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/URI.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,585 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * URI Class
+ *
+ * Parses URIs and determines routing
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        URI
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/uri.html
+ */
+class CI_URI {
+
+        var        $keyval        = array();
+        var $uri_string;
+        var $segments                = array();
+        var $rsegments                = array();
+
+        /**
+         * Constructor
+         *
+         * Simply globalizes the $RTR object.  The front
+         * loads the Router class early on so it's not available
+         * normally as other classes are.
+         *
+         * @access        public
+         */
+        function CI_URI()
+        {
+                $this-&gt;config =&amp; load_class('Config');
+                log_message('debug', &quot;URI Class Initialized&quot;);
+        }
+
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get the URI String
+         *
+         * @access        private
+         * @return        string
+         */
+        function _fetch_uri_string()
+        {
+                if (strtoupper($this-&gt;config-&gt;item('uri_protocol')) == 'AUTO')
+                {
+                        // If the URL has a question mark then it's simplest to just
+                        // build the URI string from the zero index of the $_GET array.
+                        // This avoids having to deal with $_SERVER variables, which
+                        // can be unreliable in some environments
+                        if (is_array($_GET) &amp;&amp; count($_GET) == 1 &amp;&amp; trim(key($_GET), '/') != '')
+                        {
+                                $this-&gt;uri_string = key($_GET);
+                                return;
+                        }
+
+                        // Is there a PATH_INFO variable?
+                        // Note: some servers seem to have trouble with getenv() so we'll test it two ways
+                        $path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
+                        if (trim($path, '/') != '' &amp;&amp; $path != &quot;/&quot;.SELF)
+                        {
+                                $this-&gt;uri_string = $path;
+                                return;
+                        }
+
+                        // No PATH_INFO?... What about QUERY_STRING?
+                        $path =  (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
+                        if (trim($path, '/') != '')
+                        {
+                                $this-&gt;uri_string = $path;
+                                return;
+                        }
+
+                        // No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists?
+                        $path = str_replace($_SERVER['SCRIPT_NAME'], '', (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO'));
+                        if (trim($path, '/') != '' &amp;&amp; $path != &quot;/&quot;.SELF)
+                        {
+                                // remove path and script information so we have good URI data
+                                $this-&gt;uri_string = $path;
+                                return;
+                        }
+
+                        // We've exhausted all our options...
+                        $this-&gt;uri_string = '';
+                }
+                else
+                {
+                        $uri = strtoupper($this-&gt;config-&gt;item('uri_protocol'));
+
+                        if ($uri == 'REQUEST_URI')
+                        {
+                                $this-&gt;uri_string = $this-&gt;_parse_request_uri();
+                                return;
+                        }
+
+                        $this-&gt;uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
+                }
+
+                // If the URI contains only a slash we'll kill it
+                if ($this-&gt;uri_string == '/')
+                {
+                        $this-&gt;uri_string = '';
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Parse the REQUEST_URI
+         *
+         * Due to the way REQUEST_URI works it usually contains path info
+         * that makes it unusable as URI data.  We'll trim off the unnecessary
+         * data, hopefully arriving at a valid URI that we can use.
+         *
+         * @access        private
+         * @return        string
+         */
+        function _parse_request_uri()
+        {
+                if ( ! isset($_SERVER['REQUEST_URI']) OR $_SERVER['REQUEST_URI'] == '')
+                {
+                        return '';
+                }
+
+                $request_uri = preg_replace(&quot;|/(.*)|&quot;, &quot;\\1&quot;, str_replace(&quot;\\&quot;, &quot;/&quot;, $_SERVER['REQUEST_URI']));
+
+                if ($request_uri == '' OR $request_uri == SELF)
+                {
+                        return '';
+                }
+
+                $fc_path = FCPATH.SELF;
+                if (strpos($request_uri, '?') !== FALSE)
+                {
+                        $fc_path .= '?';
+                }
+
+                $parsed_uri = explode(&quot;/&quot;, $request_uri);
+
+                $i = 0;
+                foreach(explode(&quot;/&quot;, $fc_path) as $segment)
+                {
+                        if (isset($parsed_uri[$i]) &amp;&amp; $segment == $parsed_uri[$i])
+                        {
+                                $i++;
+                        }
+                }
+
+                $parsed_uri = implode(&quot;/&quot;, array_slice($parsed_uri, $i));
+
+                if ($parsed_uri != '')
+                {
+                        $parsed_uri = '/'.$parsed_uri;
+                }
+
+                return $parsed_uri;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Filter segments for malicious characters
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _filter_uri($str)
+        {
+                if ($str != '' &amp;&amp; $this-&gt;config-&gt;item('permitted_uri_chars') != '' &amp;&amp; $this-&gt;config-&gt;item('enable_query_strings') == FALSE)
+                {
+                        if ( ! preg_match(&quot;|^[&quot;.preg_quote($this-&gt;config-&gt;item('permitted_uri_chars')).&quot;]+$|i&quot;, $str))
+                        {
+                                header('HTTP/1.1 400 Bad Request');
+                                show_error('The URI you submitted has disallowed characters.');
+                        }
+                }
+
+                // Convert programatic characters to entities
+                $bad        = array('$',                 '(',                 ')',                 '%28',                 '%29');
+                $good        = array('&amp;#36;',        '&amp;#40;',        '&amp;#41;',        '&amp;#40;',        '&amp;#41;');
+
+                return str_replace($bad, $good, $str);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Remove the suffix from the URL if needed
+         *
+         * @access        private
+         * @return        void
+         */
+        function _remove_url_suffix()
+        {
+                if  ($this-&gt;config-&gt;item('url_suffix') != &quot;&quot;)
+                {
+                        $this-&gt;uri_string = preg_replace(&quot;|&quot;.preg_quote($this-&gt;config-&gt;item('url_suffix')).&quot;$|&quot;, &quot;&quot;, $this-&gt;uri_string);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Explode the URI Segments. The individual segments will
+         * be stored in the $this-&gt;segments array.
+         *
+         * @access        private
+         * @return        void
+         */
+        function _explode_segments()
+        {
+                foreach(explode(&quot;/&quot;, preg_replace(&quot;|/*(.+?)/*$|&quot;, &quot;\\1&quot;, $this-&gt;uri_string)) as $val)
+                {
+                        // Filter segments for security
+                        $val = trim($this-&gt;_filter_uri($val));
+
+                        if ($val != '')
+                        {
+                                $this-&gt;segments[] = $val;
+                        }
+                }
+        }
+
+        // --------------------------------------------------------------------
+        /**
+         * Re-index Segments
+         *
+         * This function re-indexes the $this-&gt;segment array so that it
+         * starts at 1 rather than 0.  Doing so makes it simpler to
+         * use functions like $this-&gt;uri-&gt;segment(n) since there is
+         * a 1:1 relationship between the segment array and the actual segments.
+         *
+         * @access        private
+         * @return        void
+         */
+        function _reindex_segments()
+        {
+                array_unshift($this-&gt;segments, NULL);
+                array_unshift($this-&gt;rsegments, NULL);
+                unset($this-&gt;segments[0]);
+                unset($this-&gt;rsegments[0]);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a URI Segment
+         *
+         * This function returns the URI segment based on the number provided.
+         *
+         * @access        public
+         * @param        integer
+         * @param        bool
+         * @return        string
+         */
+        function segment($n, $no_result = FALSE)
+        {
+                return ( ! isset($this-&gt;segments[$n])) ? $no_result : $this-&gt;segments[$n];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a URI &quot;routed&quot; Segment
+         *
+         * This function returns the re-routed URI segment (assuming routing rules are used)
+         * based on the number provided.  If there is no routing this function returns the
+         * same result as $this-&gt;segment()
+         *
+         * @access        public
+         * @param        integer
+         * @param        bool
+         * @return        string
+         */
+        function rsegment($n, $no_result = FALSE)
+        {
+                return ( ! isset($this-&gt;rsegments[$n])) ? $no_result : $this-&gt;rsegments[$n];
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate a key value pair from the URI string
+         *
+         * This function generates and associative array of URI data starting
+         * at the supplied segment. For example, if this is your URI:
+         *
+         *        example.com/user/search/name/joe/location/UK/gender/male
+         *
+         * You can use this function to generate an array with this prototype:
+         *
+         * array (
+         *                        name =&gt; joe
+         *                        location =&gt; UK
+         *                        gender =&gt; male
+         *                 )
+         *
+         * @access        public
+         * @param        integer        the starting segment number
+         * @param        array        an array of default values
+         * @return        array
+         */
+        function uri_to_assoc($n = 3, $default = array())
+        {
+                 return $this-&gt;_uri_to_assoc($n, $default, 'segment');
+        }
+        /**
+         * Identical to above only it uses the re-routed segment array
+         *
+         */
+        function ruri_to_assoc($n = 3, $default = array())
+        {
+                 return $this-&gt;_uri_to_assoc($n, $default, 'rsegment');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate a key value pair from the URI string or Re-routed URI string
+         *
+         * @access        private
+         * @param        integer        the starting segment number
+         * @param        array        an array of default values
+         * @param        string        which array we should use
+         * @return        array
+         */
+        function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
+        {
+                if ($which == 'segment')
+                {
+                        $total_segments = 'total_segments';
+                        $segment_array = 'segment_array';
+                }
+                else
+                {
+                        $total_segments = 'total_rsegments';
+                        $segment_array = 'rsegment_array';
+                }
+
+                if ( ! is_numeric($n))
+                {
+                        return $default;
+                }
+
+                if (isset($this-&gt;keyval[$n]))
+                {
+                        return $this-&gt;keyval[$n];
+                }
+
+                if ($this-&gt;$total_segments() &lt; $n)
+                {
+                        if (count($default) == 0)
+                        {
+                                return array();
+                        }
+
+                        $retval = array();
+                        foreach ($default as $val)
+                        {
+                                $retval[$val] = FALSE;
+                        }
+                        return $retval;
+                }
+
+                $segments = array_slice($this-&gt;$segment_array(), ($n - 1));
+
+                $i = 0;
+                $lastval = '';
+                $retval  = array();
+                foreach ($segments as $seg)
+                {
+                        if ($i % 2)
+                        {
+                                $retval[$lastval] = $seg;
+                        }
+                        else
+                        {
+                                $retval[$seg] = FALSE;
+                                $lastval = $seg;
+                        }
+
+                        $i++;
+                }
+
+                if (count($default) &gt; 0)
+                {
+                        foreach ($default as $val)
+                        {
+                                if ( ! array_key_exists($val, $retval))
+                                {
+                                        $retval[$val] = FALSE;
+                                }
+                        }
+                }
+
+                // Cache the array for reuse
+                $this-&gt;keyval[$n] = $retval;
+                return $retval;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Generate a URI string from an associative array
+         *
+         *
+         * @access        public
+         * @param        array        an associative array of key/values
+         * @return        array
+         */
+        function assoc_to_uri($array)
+        {
+                $temp = array();
+                foreach ((array)$array as $key =&gt; $val)
+                {
+                        $temp[] = $key;
+                        $temp[] = $val;
+                }
+
+                return implode('/', $temp);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a URI Segment and add a trailing slash
+         *
+         * @access        public
+         * @param        integer
+         * @param        string
+         * @return        string
+         */
+        function slash_segment($n, $where = 'trailing')
+        {
+                return $this-&gt;_slash_segment($n, $where, 'segment');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a URI Segment and add a trailing slash
+         *
+         * @access        public
+         * @param        integer
+         * @param        string
+         * @return        string
+         */
+        function slash_rsegment($n, $where = 'trailing')
+        {
+                return $this-&gt;_slash_segment($n, $where, 'rsegment');
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch a URI Segment and add a trailing slash - helper function
+         *
+         * @access        private
+         * @param        integer
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function _slash_segment($n, $where = 'trailing', $which = 'segment')
+        {
+                if ($where == 'trailing')
+                {
+                        $trailing        = '/';
+                        $leading        = '';
+                }
+                elseif ($where == 'leading')
+                {
+                        $leading        = '/';
+                        $trailing        = '';
+                }
+                else
+                {
+                        $leading        = '/';
+                        $trailing        = '/';
+                }
+                return $leading.$this-&gt;$which($n).$trailing;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Segment Array
+         *
+         * @access        public
+         * @return        array
+         */
+        function segment_array()
+        {
+                return $this-&gt;segments;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Routed Segment Array
+         *
+         * @access        public
+         * @return        array
+         */
+        function rsegment_array()
+        {
+                return $this-&gt;rsegments;
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Total number of segments
+         *
+         * @access        public
+         * @return        integer
+         */
+        function total_segments()
+        {
+                return count($this-&gt;segments);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Total number of routed segments
+         *
+         * @access        public
+         * @return        integer
+         */
+        function total_rsegments()
+        {
+                return count($this-&gt;rsegments);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch the entire URI string
+         *
+         * @access        public
+         * @return        string
+         */
+        function uri_string()
+        {
+                return $this-&gt;uri_string;
+        }
+
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Fetch the entire Re-routed URI string
+         *
+         * @access        public
+         * @return        string
+         */
+        function ruri_string()
+        {
+                return '/'.implode('/', $this-&gt;rsegment_array()).'/';
+        }
+
+}
+// END URI Class
+
+/* End of file URI.php */
+/* Location: ./system/libraries/URI.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesUnit_testphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Unit_test.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Unit_test.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Unit_test.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,347 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.3.1
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Unit Testing Class
+ *
+ * Simple testing class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        UnitTesting
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/uri.html
+ */
+class CI_Unit_test {
+
+        var $active                        = TRUE;
+        var $results                 = array();
+        var $strict                        = FALSE;
+        var $_template                 = NULL;
+        var $_template_rows        = NULL;
+
+        function CI_Unit_test()
+        {
+                log_message('debug', &quot;Unit Testing Class Initialized&quot;);
+        }        
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Run the tests
+         *
+         * Runs the supplied tests
+         *
+         * @access        public
+         * @param        mixed
+         * @param        mixed
+         * @param        string
+         * @return        string
+         */        
+        function run($test, $expected = TRUE, $test_name = 'undefined')
+        {
+                if ($this-&gt;active == FALSE)
+                {
+                        return FALSE;
+                }
+        
+                if (in_array($expected, array('is_string', 'is_bool', 'is_true', 'is_false', 'is_int', 'is_numeric', 'is_float', 'is_double', 'is_array', 'is_null'), TRUE))
+                {
+                        $expected = str_replace('is_float', 'is_double', $expected);
+                        $result = ($expected($test)) ? TRUE : FALSE;        
+                        $extype = str_replace(array('true', 'false'), 'bool', str_replace('is_', '', $expected));
+                }
+                else
+                {
+                        if ($this-&gt;strict == TRUE)
+                                $result = ($test === $expected) ? TRUE : FALSE;        
+                        else
+                                $result = ($test == $expected) ? TRUE : FALSE;        
+                        
+                        $extype = gettype($expected);
+                }
+                                
+                $back = $this-&gt;_backtrace();
+        
+                $report[] = array (
+                                                        'test_name'                        =&gt; $test_name,
+                                                        'test_datatype'                =&gt; gettype($test),
+                                                        'res_datatype'                =&gt; $extype,
+                                                        'result'                        =&gt; ($result === TRUE) ? 'passed' : 'failed',
+                                                        'file'                                =&gt; $back['file'],
+                                                        'line'                                =&gt; $back['line']
+                                                );
+
+                $this-&gt;results[] = $report;                
+                                
+                return($this-&gt;report($this-&gt;result($report)));
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Generate a report
+         *
+         * Displays a table with the test data
+         *
+         * @access        public
+         * @return        string
+         */
+        function report($result = array())
+        {
+                if (count($result) == 0)
+                {
+                        $result = $this-&gt;result();
+                }
+
+                $CI =&amp; get_instance();
+                $CI-&gt;load-&gt;language('unit_test');
+
+                $this-&gt;_parse_template();
+
+                $r = '';
+                foreach ($result as $res)
+                {
+                        $table = '';
+
+                        foreach ($res as $key =&gt; $val)
+                        {
+
+                                if ($key == $CI-&gt;lang-&gt;line('ut_result'))
+                                {
+                                        if ($val == $CI-&gt;lang-&gt;line('ut_passed'))
+                                        {
+                                                $val = '&lt;span style=&quot;color: #0C0;&quot;&gt;'.$val.'&lt;/span&gt;';
+                                        }
+                                        elseif ($val == $CI-&gt;lang-&gt;line('ut_failed'))
+                                        {
+                                                $val = '&lt;span style=&quot;color: #C00;&quot;&gt;'.$val.'&lt;/span&gt;';
+                                        }
+                                }
+
+                                $temp = $this-&gt;_template_rows;
+                                $temp = str_replace('{item}', $key, $temp);
+                                $temp = str_replace('{result}', $val, $temp);
+                                $table .= $temp;
+                        }
+
+                        $r .= str_replace('{rows}', $table, $this-&gt;_template);
+                }
+
+                return $r;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Use strict comparison
+         *
+         * Causes the evaluation to use === rather than ==
+         *
+         * @access        public
+         * @param        bool
+         * @return        null
+         */
+        function use_strict($state = TRUE)
+        {
+                $this-&gt;strict = ($state == FALSE) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Make Unit testing active
+         *
+         * Enables/disables unit testing
+         *
+         * @access        public
+         * @param        bool
+         * @return        null
+         */
+        function active($state = TRUE)
+        {
+                $this-&gt;active = ($state == FALSE) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Result Array
+         *
+         * Returns the raw result data
+         *
+         * @access        public
+         * @return        array
+         */
+        function result($results = array())
+        {        
+                $CI =&amp; get_instance();
+                $CI-&gt;load-&gt;language('unit_test');
+                
+                if (count($results) == 0)
+                {
+                        $results = $this-&gt;results;
+                }
+                
+                $retval = array();
+                foreach ($results as $result)
+                {
+                        $temp = array();
+                        foreach ($result as $key =&gt; $val)
+                        {
+                                if (is_array($val))
+                                {
+                                        foreach ($val as $k =&gt; $v)
+                                        {
+                                                if (FALSE !== ($line = $CI-&gt;lang-&gt;line(strtolower('ut_'.$v))))
+                                                {
+                                                        $v = $line;
+                                                }                                
+                                                $temp[$CI-&gt;lang-&gt;line('ut_'.$k)] = $v;                                        
+                                        }
+                                }
+                                else
+                                {
+                                        if (FALSE !== ($line = $CI-&gt;lang-&gt;line(strtolower('ut_'.$val))))
+                                        {
+                                                $val = $line;
+                                        }                                
+                                        $temp[$CI-&gt;lang-&gt;line('ut_'.$key)] = $val;
+                                }
+                        }
+                        
+                        $retval[] = $temp;
+                }
+        
+                return $retval;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the template
+         *
+         * This lets us set the template to be used to display results
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_template($template)
+        {
+                $this-&gt;_template = $template;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Generate a backtrace
+         *
+         * This lets us show file names and line numbers
+         *
+         * @access        private
+         * @return        array
+         */
+        function _backtrace()
+        {
+                if (function_exists('debug_backtrace'))
+                {
+                        $back = debug_backtrace();
+                        
+                        $file = ( ! isset($back['1']['file'])) ? '' : $back['1']['file'];
+                        $line = ( ! isset($back['1']['line'])) ? '' : $back['1']['line'];
+                                                
+                        return array('file' =&gt; $file, 'line' =&gt; $line);
+                }
+                return array('file' =&gt; 'Unknown', 'line' =&gt; 'Unknown');
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get Default Template
+         *
+         * @access        private
+         * @return        string
+         */
+        function _default_template()
+        {        
+                $this-&gt;_template = &quot;\n&quot;.'&lt;table style=&quot;width:100%; font-size:small; margin:10px 0; border-collapse:collapse; border:1px solid #CCC;&quot;&gt;';
+                $this-&gt;_template .= '{rows}';
+                $this-&gt;_template .= &quot;\n&quot;.'&lt;/table&gt;';
+                
+                $this-&gt;_template_rows = &quot;\n\t&quot;.'&lt;tr&gt;';
+                $this-&gt;_template_rows .= &quot;\n\t\t&quot;.'&lt;th style=&quot;text-align: left; border-bottom:1px solid #CCC;&quot;&gt;{item}&lt;/th&gt;';
+                $this-&gt;_template_rows .= &quot;\n\t\t&quot;.'&lt;td style=&quot;border-bottom:1px solid #CCC;&quot;&gt;{result}&lt;/td&gt;';
+                $this-&gt;_template_rows .= &quot;\n\t&quot;.'&lt;/tr&gt;';        
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Parse Template
+         *
+         * Harvests the data within the template {pseudo-variables}
+         *
+         * @access        private
+         * @return        void
+         */
+         function _parse_template()
+         {
+                 if ( ! is_null($this-&gt;_template_rows))
+                 {
+                         return;
+                 }
+                 
+                 if (is_null($this-&gt;_template))
+                 {
+                         $this-&gt;_default_template();
+                         return;
+                 }
+                 
+                if ( ! preg_match(&quot;/\{rows\}(.*?)\{\/rows\}/si&quot;, $this-&gt;_template, $match))
+                {
+                         $this-&gt;_default_template();
+                         return;
+                }
+
+                $this-&gt;_template_rows = $match['1'];
+                $this-&gt;_template = str_replace($match['0'], '{rows}', $this-&gt;_template);         
+         }
+         
+}
+// END Unit_test Class
+
+/**
+ * Helper functions to test boolean true/false
+ *
+ *
+ * @access        private
+ * @return        bool
+ */
+function is_true($test)
+{
+        return (is_bool($test) AND $test === TRUE) ? TRUE : FALSE;
+}
+function is_false($test)
+{
+        return (is_bool($test) AND $test === FALSE) ? TRUE : FALSE;
+}
+
+
+/* End of file Unit_test.php */
+/* Location: ./system/libraries/Unit_test.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesUploadphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Upload.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Upload.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Upload.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,949 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * File Uploading Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Uploads
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/file_uploading.html
+ */
+class CI_Upload {
+        
+        var $max_size                = 0;
+        var $max_width                = 0;
+        var $max_height                = 0;
+        var $max_filename        = 0;
+        var $allowed_types        = &quot;&quot;;
+        var $file_temp                = &quot;&quot;;
+        var $file_name                = &quot;&quot;;
+        var $orig_name                = &quot;&quot;;
+        var $file_type                = &quot;&quot;;
+        var $file_size                = &quot;&quot;;
+        var $file_ext                = &quot;&quot;;
+        var $upload_path        = &quot;&quot;;
+        var $overwrite                = FALSE;
+        var $encrypt_name        = FALSE;
+        var $is_image                = FALSE;
+        var $image_width        = '';
+        var $image_height        = '';
+        var $image_type                = '';
+        var $image_size_str        = '';
+        var $error_msg                = array();
+        var $mimes                        = array();
+        var $remove_spaces        = TRUE;
+        var $xss_clean                = FALSE;
+        var $temp_prefix        = &quot;temp_file_&quot;;
+                
+        /**
+         * Constructor
+         *
+         * @access        public
+         */
+        function CI_Upload($props = array())
+        {
+                if (count($props) &gt; 0)
+                {
+                        $this-&gt;initialize($props);
+                }
+                
+                log_message('debug', &quot;Upload Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Initialize preferences
+         *
+         * @access        public
+         * @param        array
+         * @return        void
+         */        
+        function initialize($config = array())
+        {
+                $defaults = array(
+                                                        'max_size'                        =&gt; 0,
+                                                        'max_width'                        =&gt; 0,
+                                                        'max_height'                =&gt; 0,
+                                                        'max_filename'                =&gt; 0,
+                                                        'allowed_types'                =&gt; &quot;&quot;,
+                                                        'file_temp'                        =&gt; &quot;&quot;,
+                                                        'file_name'                        =&gt; &quot;&quot;,
+                                                        'orig_name'                        =&gt; &quot;&quot;,
+                                                        'file_type'                        =&gt; &quot;&quot;,
+                                                        'file_size'                        =&gt; &quot;&quot;,
+                                                        'file_ext'                        =&gt; &quot;&quot;,
+                                                        'upload_path'                =&gt; &quot;&quot;,
+                                                        'overwrite'                        =&gt; FALSE,
+                                                        'encrypt_name'                =&gt; FALSE,
+                                                        'is_image'                        =&gt; FALSE,
+                                                        'image_width'                =&gt; '',
+                                                        'image_height'                =&gt; '',
+                                                        'image_type'                =&gt; '',
+                                                        'image_size_str'        =&gt; '',
+                                                        'error_msg'                        =&gt; array(),
+                                                        'mimes'                                =&gt; array(),
+                                                        'remove_spaces'                =&gt; TRUE,
+                                                        'xss_clean'                        =&gt; FALSE,
+                                                        'temp_prefix'                =&gt; &quot;temp_file_&quot;
+                                                );        
+        
+        
+                foreach ($defaults as $key =&gt; $val)
+                {
+                        if (isset($config[$key]))
+                        {
+                                $method = 'set_'.$key;
+                                if (method_exists($this, $method))
+                                {
+                                        $this-&gt;$method($config[$key]);
+                                }
+                                else
+                                {
+                                        $this-&gt;$key = $config[$key];
+                                }                        
+                        }
+                        else
+                        {
+                                $this-&gt;$key = $val;
+                        }
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Perform the file upload
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function do_upload($field = 'userfile')
+        {
+                // Is $_FILES[$field] set? If not, no reason to continue.
+                if ( ! isset($_FILES[$field]))
+                {
+                        $this-&gt;set_error('upload_no_file_selected');
+                        return FALSE;
+                }
+                
+                // Is the upload path valid?
+                if ( ! $this-&gt;validate_upload_path())
+                {
+                        // errors will already be set by validate_upload_path() so just return FALSE
+                        return FALSE;
+                }
+
+                // Was the file able to be uploaded? If not, determine the reason why.
+                if ( ! is_uploaded_file($_FILES[$field]['tmp_name']))
+                {
+                        $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error'];
+
+                        switch($error)
+                        {
+                                case 1:        // UPLOAD_ERR_INI_SIZE
+                                        $this-&gt;set_error('upload_file_exceeds_limit');
+                                        break;
+                                case 2: // UPLOAD_ERR_FORM_SIZE
+                                        $this-&gt;set_error('upload_file_exceeds_form_limit');
+                                        break;
+                                case 3: // UPLOAD_ERR_PARTIAL
+                                   $this-&gt;set_error('upload_file_partial');
+                                        break;
+                                case 4: // UPLOAD_ERR_NO_FILE
+                                   $this-&gt;set_error('upload_no_file_selected');
+                                        break;
+                                case 6: // UPLOAD_ERR_NO_TMP_DIR
+                                        $this-&gt;set_error('upload_no_temp_directory');
+                                        break;
+                                case 7: // UPLOAD_ERR_CANT_WRITE
+                                        $this-&gt;set_error('upload_unable_to_write_file');
+                                        break;
+                                case 8: // UPLOAD_ERR_EXTENSION
+                                        $this-&gt;set_error('upload_stopped_by_extension');
+                                        break;
+                                default :   $this-&gt;set_error('upload_no_file_selected');
+                                        break;
+                        }
+
+                        return FALSE;
+                }
+
+                // Set the uploaded data as class variables
+                $this-&gt;file_temp = $_FILES[$field]['tmp_name'];                
+                $this-&gt;file_name = $this-&gt;_prep_filename($_FILES[$field]['name']);
+                $this-&gt;file_size = $_FILES[$field]['size'];                
+                $this-&gt;file_type = preg_replace(&quot;/^(.+?);.*$/&quot;, &quot;\\1&quot;, $_FILES[$field]['type']);
+                $this-&gt;file_type = strtolower($this-&gt;file_type);
+                $this-&gt;file_ext         = $this-&gt;get_extension($_FILES[$field]['name']);
+                
+                // Convert the file size to kilobytes
+                if ($this-&gt;file_size &gt; 0)
+                {
+                        $this-&gt;file_size = round($this-&gt;file_size/1024, 2);
+                }
+
+                // Is the file type allowed to be uploaded?
+                if ( ! $this-&gt;is_allowed_filetype())
+                {
+                        $this-&gt;set_error('upload_invalid_filetype');
+                        return FALSE;
+                }
+
+                // Is the file size within the allowed maximum?
+                if ( ! $this-&gt;is_allowed_filesize())
+                {
+                        $this-&gt;set_error('upload_invalid_filesize');
+                        return FALSE;
+                }
+
+                // Are the image dimensions within the allowed size?
+                // Note: This can fail if the server has an open_basdir restriction.
+                if ( ! $this-&gt;is_allowed_dimensions())
+                {
+                        $this-&gt;set_error('upload_invalid_dimensions');
+                        return FALSE;
+                }
+
+                // Sanitize the file name for security
+                $this-&gt;file_name = $this-&gt;clean_file_name($this-&gt;file_name);
+                
+                // Truncate the file name if it's too long
+                if ($this-&gt;max_filename &gt; 0)
+                {
+                        $this-&gt;file_name = $this-&gt;limit_filename_length($this-&gt;file_name, $this-&gt;max_filename);
+                }
+
+                // Remove white spaces in the name
+                if ($this-&gt;remove_spaces == TRUE)
+                {
+                        $this-&gt;file_name = preg_replace(&quot;/\s+/&quot;, &quot;_&quot;, $this-&gt;file_name);
+                }
+
+                /*
+                 * Validate the file name
+                 * This function appends an number onto the end of
+                 * the file if one with the same name already exists.
+                 * If it returns false there was a problem.
+                 */
+                $this-&gt;orig_name = $this-&gt;file_name;
+
+                if ($this-&gt;overwrite == FALSE)
+                {
+                        $this-&gt;file_name = $this-&gt;set_filename($this-&gt;upload_path, $this-&gt;file_name);
+                        
+                        if ($this-&gt;file_name === FALSE)
+                        {
+                                return FALSE;
+                        }
+                }
+
+                /*
+                 * Move the file to the final destination
+                 * To deal with different server configurations
+                 * we'll attempt to use copy() first.  If that fails
+                 * we'll use move_uploaded_file().  One of the two should
+                 * reliably work in most environments
+                 */
+                if ( ! @copy($this-&gt;file_temp, $this-&gt;upload_path.$this-&gt;file_name))
+                {
+                        if ( ! @move_uploaded_file($this-&gt;file_temp, $this-&gt;upload_path.$this-&gt;file_name))
+                        {
+                                 $this-&gt;set_error('upload_destination_error');
+                                 return FALSE;
+                        }
+                }
+                
+                /*
+                 * Run the file through the XSS hacking filter
+                 * This helps prevent malicious code from being
+                 * embedded within a file.  Scripts can easily
+                 * be disguised as images or other file types.
+                 */
+                if ($this-&gt;xss_clean == TRUE)
+                {
+                        $this-&gt;do_xss_clean();
+                }
+
+                /*
+                 * Set the finalized image dimensions
+                 * This sets the image width/height (assuming the
+                 * file was an image).  We use this information
+                 * in the &quot;data&quot; function.
+                 */
+                $this-&gt;set_image_properties($this-&gt;upload_path.$this-&gt;file_name);
+
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Finalized Data Array
+         *        
+         * Returns an associative array containing all of the information
+         * related to the upload, allowing the developer easy access in one array.
+         *
+         * @access        public
+         * @return        array
+         */        
+        function data()
+        {
+                return array (
+                                                'file_name'                        =&gt; $this-&gt;file_name,
+                                                'file_type'                        =&gt; $this-&gt;file_type,
+                                                'file_path'                        =&gt; $this-&gt;upload_path,
+                                                'full_path'                        =&gt; $this-&gt;upload_path.$this-&gt;file_name,
+                                                'raw_name'                        =&gt; str_replace($this-&gt;file_ext, '', $this-&gt;file_name),
+                                                'orig_name'                        =&gt; $this-&gt;orig_name,
+                                                'file_ext'                        =&gt; $this-&gt;file_ext,
+                                                'file_size'                        =&gt; $this-&gt;file_size,
+                                                'is_image'                        =&gt; $this-&gt;is_image(),
+                                                'image_width'                =&gt; $this-&gt;image_width,
+                                                'image_height'                =&gt; $this-&gt;image_height,
+                                                'image_type'                =&gt; $this-&gt;image_type,
+                                                'image_size_str'        =&gt; $this-&gt;image_size_str,
+                                        );
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Upload Path
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_upload_path($path)
+        {
+                // Make sure it has a trailing slash
+                $this-&gt;upload_path = rtrim($path, '/').'/';
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the file name
+         *
+         * This function takes a filename/path as input and looks for the
+         * existence of a file with the same name. If found, it will append a
+         * number to the end of the filename to avoid overwriting a pre-existing file.
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function set_filename($path, $filename)
+        {
+                if ($this-&gt;encrypt_name == TRUE)
+                {                
+                        mt_srand();
+                        $filename = md5(uniqid(mt_rand())).$this-&gt;file_ext;        
+                }
+        
+                if ( ! file_exists($path.$filename))
+                {
+                        return $filename;
+                }
+        
+                $filename = str_replace($this-&gt;file_ext, '', $filename);
+                
+                $new_filename = '';
+                for ($i = 1; $i &lt; 100; $i++)
+                {                        
+                        if ( ! file_exists($path.$filename.$i.$this-&gt;file_ext))
+                        {
+                                $new_filename = $filename.$i.$this-&gt;file_ext;
+                                break;
+                        }
+                }
+
+                if ($new_filename == '')
+                {
+                        $this-&gt;set_error('upload_bad_filename');
+                        return FALSE;
+                }
+                else
+                {
+                        return $new_filename;
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Maximum File Size
+         *
+         * @access        public
+         * @param        integer
+         * @return        void
+         */        
+        function set_max_filesize($n)
+        {
+                $this-&gt;max_size = ((int) $n &lt; 0) ? 0: (int) $n;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Maximum File Name Length
+         *
+         * @access        public
+         * @param        integer
+         * @return        void
+         */        
+        function set_max_filename($n)
+        {
+                $this-&gt;max_filename = ((int) $n &lt; 0) ? 0: (int) $n;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Maximum Image Width
+         *
+         * @access        public
+         * @param        integer
+         * @return        void
+         */        
+        function set_max_width($n)
+        {
+                $this-&gt;max_width = ((int) $n &lt; 0) ? 0: (int) $n;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Maximum Image Height
+         *
+         * @access        public
+         * @param        integer
+         * @return        void
+         */        
+        function set_max_height($n)
+        {
+                $this-&gt;max_height = ((int) $n &lt; 0) ? 0: (int) $n;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Allowed File Types
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_allowed_types($types)
+        {
+                $this-&gt;allowed_types = explode('|', $types);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Image Properties
+         *
+         * Uses GD to determine the width/height/type of image
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_image_properties($path = '')
+        {
+                if ( ! $this-&gt;is_image())
+                {
+                        return;
+                }
+
+                if (function_exists('getimagesize'))
+                {
+                        if (FALSE !== ($D = @getimagesize($path)))
+                        {        
+                                $types = array(1 =&gt; 'gif', 2 =&gt; 'jpeg', 3 =&gt; 'png');
+
+                                $this-&gt;image_width                = $D['0'];
+                                $this-&gt;image_height                = $D['1'];
+                                $this-&gt;image_type                = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']];
+                                $this-&gt;image_size_str        = $D['3'];  // string containing height and width
+                        }
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set XSS Clean
+         *
+         * Enables the XSS flag so that the file that was uploaded
+         * will be run through the XSS filter.
+         *
+         * @access        public
+         * @param        bool
+         * @return        void
+         */
+        function set_xss_clean($flag = FALSE)
+        {
+                $this-&gt;xss_clean = ($flag == TRUE) ? TRUE : FALSE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Validate the image
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function is_image()
+        {
+                // IE will sometimes return odd mime-types during upload, so here we just standardize all
+                // jpegs or pngs to the same file type.
+
+                $png_mimes  = array('image/x-png');
+                $jpeg_mimes = array('image/jpg', 'image/jpe', 'image/jpeg', 'image/pjpeg');
+                
+                if (in_array($this-&gt;file_type, $png_mimes))
+                {
+                        $this-&gt;file_type = 'image/png';
+                }
+                
+                if (in_array($this-&gt;file_type, $jpeg_mimes))
+                {
+                        $this-&gt;file_type = 'image/jpeg';
+                }
+
+                $img_mimes = array(
+                                                        'image/gif',
+                                                        'image/jpeg',
+                                                        'image/png',
+                                                   );
+
+                return (in_array($this-&gt;file_type, $img_mimes, TRUE)) ? TRUE : FALSE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Verify that the filetype is allowed
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function is_allowed_filetype()
+        {
+                if (count($this-&gt;allowed_types) == 0 OR ! is_array($this-&gt;allowed_types))
+                {
+                        $this-&gt;set_error('upload_no_file_types');
+                        return FALSE;
+                }
+
+                $image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');
+
+                foreach ($this-&gt;allowed_types as $val)
+                {
+                        $mime = $this-&gt;mimes_types(strtolower($val));
+
+                        // Images get some additional checks
+                        if (in_array($val, $image_types))
+                        {
+                                if (getimagesize($this-&gt;file_temp) === FALSE)
+                                {
+                                        return FALSE;
+                                }
+                        }
+
+                        if (is_array($mime))
+                        {
+                                if (in_array($this-&gt;file_type, $mime, TRUE))
+                                {
+                                        return TRUE;
+                                }
+                        }
+                        else
+                        {
+                                if ($mime == $this-&gt;file_type)
+                                {
+                                        return TRUE;
+                                }        
+                        }                
+                }
+                
+                return FALSE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Verify that the file is within the allowed size
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function is_allowed_filesize()
+        {
+                if ($this-&gt;max_size != 0  AND  $this-&gt;file_size &gt; $this-&gt;max_size)
+                {
+                        return FALSE;
+                }
+                else
+                {
+                        return TRUE;
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Verify that the image is within the allowed width/height
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function is_allowed_dimensions()
+        {
+                if ( ! $this-&gt;is_image())
+                {
+                        return TRUE;
+                }
+
+                if (function_exists('getimagesize'))
+                {
+                        $D = @getimagesize($this-&gt;file_temp);
+
+                        if ($this-&gt;max_width &gt; 0 AND $D['0'] &gt; $this-&gt;max_width)
+                        {
+                                return FALSE;
+                        }
+
+                        if ($this-&gt;max_height &gt; 0 AND $D['1'] &gt; $this-&gt;max_height)
+                        {
+                                return FALSE;
+                        }
+
+                        return TRUE;
+                }
+
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Validate Upload Path
+         *
+         * Verifies that it is a valid upload path with proper permissions.
+         *
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function validate_upload_path()
+        {
+                if ($this-&gt;upload_path == '')
+                {
+                        $this-&gt;set_error('upload_no_filepath');
+                        return FALSE;
+                }
+                
+                if (function_exists('realpath') AND @realpath($this-&gt;upload_path) !== FALSE)
+                {
+                        $this-&gt;upload_path = str_replace(&quot;\\&quot;, &quot;/&quot;, realpath($this-&gt;upload_path));
+                }
+
+                if ( ! @is_dir($this-&gt;upload_path))
+                {
+                        $this-&gt;set_error('upload_no_filepath');
+                        return FALSE;
+                }
+
+                if ( ! is_really_writable($this-&gt;upload_path))
+                {
+                        $this-&gt;set_error('upload_not_writable');
+                        return FALSE;
+                }
+
+                $this-&gt;upload_path = preg_replace(&quot;/(.+?)\/*$/&quot;, &quot;\\1/&quot;,  $this-&gt;upload_path);
+                return TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Extract the file extension
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function get_extension($filename)
+        {
+                $x = explode('.', $filename);
+                return '.'.end($x);
+        }        
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Clean the file name for security
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */                
+        function clean_file_name($filename)
+        {
+                $bad = array(
+                                                &quot;&lt;!--&quot;,
+                                                &quot;--&gt;&quot;,
+                                                &quot;'&quot;,
+                                                &quot;&lt;&quot;,
+                                                &quot;&gt;&quot;,
+                                                '&quot;',
+                                                '&amp;',
+                                                '$',
+                                                '=',
+                                                ';',
+                                                '?',
+                                                '/',
+                                                &quot;%20&quot;,
+                                                &quot;%22&quot;,
+                                                &quot;%3c&quot;,                // &lt;
+                                                &quot;%253c&quot;,         // &lt;
+                                                &quot;%3e&quot;,                 // &gt;
+                                                &quot;%0e&quot;,                 // &gt;
+                                                &quot;%28&quot;,                 // (
+                                                &quot;%29&quot;,                 // )
+                                                &quot;%2528&quot;,         // (
+                                                &quot;%26&quot;,                 // &amp;
+                                                &quot;%24&quot;,                 // $
+                                                &quot;%3f&quot;,                 // ?
+                                                &quot;%3b&quot;,                 // ;
+                                                &quot;%3d&quot;                // =
+                                        );
+                                        
+                $filename = str_replace($bad, '', $filename);
+
+                return stripslashes($filename);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Limit the File Name Length
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */                
+        function limit_filename_length($filename, $length)
+        {
+                if (strlen($filename) &lt; $length)
+                {
+                        return $filename;
+                }
+        
+                $ext = '';
+                if (strpos($filename, '.') !== FALSE)
+                {
+                        $parts                = explode('.', $filename);
+                        $ext                = '.'.array_pop($parts);
+                        $filename        = implode('.', $parts);
+                }
+        
+                return substr($filename, 0, ($length - strlen($ext))).$ext;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Runs the file through the XSS clean function
+         *
+         * This prevents people from embedding malicious code in their files.
+         * I'm not sure that it won't negatively affect certain files in unexpected ways,
+         * but so far I haven't found that it causes trouble.
+         *
+         * @access        public
+         * @return        void
+         */        
+        function do_xss_clean()
+        {                
+                $file = $this-&gt;upload_path.$this-&gt;file_name;
+                
+                if (filesize($file) == 0)
+                {
+                        return FALSE;
+                }
+
+                if (($data = @file_get_contents($file)) === FALSE)
+                {
+                        return FALSE;
+                }
+                
+                if ( ! $fp = @fopen($file, FOPEN_READ_WRITE))
+                {
+                        return FALSE;
+                }
+
+                $CI =&amp; get_instance();        
+                $data = $CI-&gt;input-&gt;xss_clean($data);
+                
+                flock($fp, LOCK_EX);
+                fwrite($fp, $data);
+                flock($fp, LOCK_UN);
+                fclose($fp);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set an error message
+         *
+         * @access        public
+         * @param        string
+         * @return        void
+         */        
+        function set_error($msg)
+        {
+                $CI =&amp; get_instance();        
+                $CI-&gt;lang-&gt;load('upload');
+                
+                if (is_array($msg))
+                {
+                        foreach ($msg as $val)
+                        {
+                                $msg = ($CI-&gt;lang-&gt;line($val) == FALSE) ? $val : $CI-&gt;lang-&gt;line($val);                                
+                                $this-&gt;error_msg[] = $msg;
+                                log_message('error', $msg);
+                        }                
+                }
+                else
+                {
+                        $msg = ($CI-&gt;lang-&gt;line($msg) == FALSE) ? $msg : $CI-&gt;lang-&gt;line($msg);
+                        $this-&gt;error_msg[] = $msg;
+                        log_message('error', $msg);
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Display the error message
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function display_errors($open = '&lt;p&gt;', $close = '&lt;/p&gt;')
+        {
+                $str = '';
+                foreach ($this-&gt;error_msg as $val)
+                {
+                        $str .= $open.$val.$close;
+                }
+        
+                return $str;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * List of Mime Types
+         *
+         * This is a list of mime types.  We use it to validate
+         * the &quot;allowed types&quot; set by the developer
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function mimes_types($mime)
+        {
+                global $mimes;
+        
+                if (count($this-&gt;mimes) == 0)
+                {
+                        if (@require_once(APPPATH.'config/mimes'.EXT))
+                        {
+                                $this-&gt;mimes = $mimes;
+                                unset($mimes);
+                        }
+                }
+        
+                return ( ! isset($this-&gt;mimes[$mime])) ? FALSE : $this-&gt;mimes[$mime];
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Prep Filename
+         *
+         * Prevents possible script execution from Apache's handling of files multiple extensions
+         * http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext
+         *
+         * @access        private
+         * @param        string
+         * @return        string
+         */
+        function _prep_filename($filename)
+        {
+                if (strpos($filename, '.') === FALSE)
+                {
+                        return $filename;
+                }
+
+                $parts                = explode('.', $filename);
+                $ext                = array_pop($parts);
+                $filename        = array_shift($parts);
+
+                foreach ($parts as $part)
+                {
+                        if ($this-&gt;mimes_types(strtolower($part)) === FALSE)
+                        {
+                                $filename .= '.'.$part.'_';
+                        }
+                        else
+                        {
+                                $filename .= '.'.$part;
+                        }
+                }
+
+                // file name override, since the exact name is provided, no need to
+                // run it through a $this-&gt;mimes check.
+                if ($this-&gt;file_name != '')
+                {
+                        $filename = $this-&gt;file_name;
+                }
+
+                $filename .= '.'.$ext;
+                
+                return $filename;
+        }
+
+        // --------------------------------------------------------------------
+
+}
+// END Upload Class
+
+/* End of file Upload.php */
+/* Location: ./system/libraries/Upload.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesUser_agentphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/User_agent.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/User_agent.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/User_agent.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,502 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * User Agent Class
+ *
+ * Identifies the platform, browser, robot, or mobile devise of the browsing agent
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        User Agent
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/user_agent.html
+ */
+class CI_User_agent {
+
+        var $agent                = NULL;
+        
+        var $is_browser        = FALSE;
+        var $is_robot        = FALSE;
+        var $is_mobile        = FALSE;
+
+        var $languages        = array();
+        var $charsets        = array();
+        
+        var $platforms        = array();
+        var $browsers        = array();
+        var $mobiles        = array();
+        var $robots                = array();
+        
+        var $platform        = '';
+        var $browser        = '';
+        var $version        = '';
+        var $mobile                = '';
+        var $robot                = '';
+        
+        /**
+         * Constructor
+         *
+         * Sets the User Agent and runs the compilation routine
+         *
+         * @access        public
+         * @return        void
+         */                
+        function CI_User_agent()
+        {
+                if (isset($_SERVER['HTTP_USER_AGENT']))
+                {
+                        $this-&gt;agent = trim($_SERVER['HTTP_USER_AGENT']);
+                }
+                
+                if ( ! is_null($this-&gt;agent))
+                {
+                        if ($this-&gt;_load_agent_file())
+                        {
+                                $this-&gt;_compile_data();
+                        }
+                }
+                
+                log_message('debug', &quot;User Agent Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Compile the User Agent Data
+         *
+         * @access        private
+         * @return        bool
+         */                
+        function _load_agent_file()
+        {
+                if ( ! @include(APPPATH.'config/user_agents'.EXT))
+                {
+                        return FALSE;
+                }
+                
+                $return = FALSE;
+                
+                if (isset($platforms))
+                {
+                        $this-&gt;platforms = $platforms;
+                        unset($platforms);
+                        $return = TRUE;
+                }
+
+                if (isset($browsers))
+                {
+                        $this-&gt;browsers = $browsers;
+                        unset($browsers);
+                        $return = TRUE;
+                }
+
+                if (isset($mobiles))
+                {
+                        $this-&gt;mobiles = $mobiles;
+                        unset($mobiles);
+                        $return = TRUE;
+                }
+                
+                if (isset($robots))
+                {
+                        $this-&gt;robots = $robots;
+                        unset($robots);
+                        $return = TRUE;
+                }
+
+                return $return;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Compile the User Agent Data
+         *
+         * @access        private
+         * @return        bool
+         */                
+        function _compile_data()
+        {
+                $this-&gt;_set_platform();
+        
+                foreach (array('_set_browser', '_set_robot', '_set_mobile') as $function)
+                {
+                        if ($this-&gt;$function() === TRUE)
+                        {
+                                break;
+                        }
+                }        
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the Platform
+         *
+         * @access        private
+         * @return        mixed
+         */                
+        function _set_platform()
+        {
+                if (is_array($this-&gt;platforms) AND count($this-&gt;platforms) &gt; 0)
+                {
+                        foreach ($this-&gt;platforms as $key =&gt; $val)
+                        {
+                                if (preg_match(&quot;|&quot;.preg_quote($key).&quot;|i&quot;, $this-&gt;agent))
+                                {
+                                        $this-&gt;platform = $val;
+                                        return TRUE;
+                                }
+                        }
+                }
+                $this-&gt;platform = 'Unknown Platform';
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the Browser
+         *
+         * @access        private
+         * @return        bool
+         */                
+        function _set_browser()
+        {
+                if (is_array($this-&gt;browsers) AND count($this-&gt;browsers) &gt; 0)
+                {
+                        foreach ($this-&gt;browsers as $key =&gt; $val)
+                        {                
+                                if (preg_match(&quot;|&quot;.preg_quote($key).&quot;.*?([0-9\.]+)|i&quot;, $this-&gt;agent, $match))
+                                {
+                                        $this-&gt;is_browser = TRUE;
+                                        $this-&gt;version = $match[1];
+                                        $this-&gt;browser = $val;
+                                        $this-&gt;_set_mobile();
+                                        return TRUE;
+                                }
+                        }
+                }
+                return FALSE;
+        }
+                        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the Robot
+         *
+         * @access        private
+         * @return        bool
+         */                
+        function _set_robot()
+        {
+                if (is_array($this-&gt;robots) AND count($this-&gt;robots) &gt; 0)
+                {                
+                        foreach ($this-&gt;robots as $key =&gt; $val)
+                        {
+                                if (preg_match(&quot;|&quot;.preg_quote($key).&quot;|i&quot;, $this-&gt;agent))
+                                {
+                                        $this-&gt;is_robot = TRUE;
+                                        $this-&gt;robot = $val;
+                                        return TRUE;
+                                }
+                        }
+                }
+                return FALSE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the Mobile Device
+         *
+         * @access        private
+         * @return        bool
+         */                
+        function _set_mobile()
+        {
+                if (is_array($this-&gt;mobiles) AND count($this-&gt;mobiles) &gt; 0)
+                {                
+                        foreach ($this-&gt;mobiles as $key =&gt; $val)
+                        {
+                                if (FALSE !== (strpos(strtolower($this-&gt;agent), $key)))
+                                {
+                                        $this-&gt;is_mobile = TRUE;
+                                        $this-&gt;mobile = $val;
+                                        return TRUE;
+                                }
+                        }
+                }        
+                return FALSE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the accepted languages
+         *
+         * @access        private
+         * @return        void
+         */                        
+        function _set_languages()
+        {
+                if ((count($this-&gt;languages) == 0) AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) AND $_SERVER['HTTP_ACCEPT_LANGUAGE'] != '')
+                {
+                        $languages = preg_replace('/(;q=[0-9\.]+)/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_LANGUAGE'])));
+                        
+                        $this-&gt;languages = explode(',', $languages);
+                }
+                
+                if (count($this-&gt;languages) == 0)
+                {
+                        $this-&gt;languages = array('Undefined');
+                }        
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set the accepted character sets
+         *
+         * @access        private
+         * @return        void
+         */                        
+        function _set_charsets()
+        {        
+                if ((count($this-&gt;charsets) == 0) AND isset($_SERVER['HTTP_ACCEPT_CHARSET']) AND $_SERVER['HTTP_ACCEPT_CHARSET'] != '')
+                {
+                        $charsets = preg_replace('/(;q=.+)/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_CHARSET'])));
+                        
+                        $this-&gt;charsets = explode(',', $charsets);
+                }
+                
+                if (count($this-&gt;charsets) == 0)
+                {
+                        $this-&gt;charsets = array('Undefined');
+                }        
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Is Browser
+         *
+         * @access        public
+         * @return        bool
+         */                
+        function is_browser()
+        {
+                return $this-&gt;is_browser;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Is Robot
+         *
+         * @access        public
+         * @return        bool
+         */                
+        function is_robot()
+        {
+                return $this-&gt;is_robot;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Is Mobile
+         *
+         * @access        public
+         * @return        bool
+         */                
+        function is_mobile()
+        {
+                return $this-&gt;is_mobile;
+        }        
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Is this a referral from another site?
+         *
+         * @access        public
+         * @return        bool
+         */                        
+        function is_referral()
+        {
+                return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? FALSE : TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Agent String
+         *
+         * @access        public
+         * @return        string
+         */                        
+        function agent_string()
+        {
+                return $this-&gt;agent;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get Platform
+         *
+         * @access        public
+         * @return        string
+         */                        
+        function platform()
+        {
+                return $this-&gt;platform;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get Browser Name
+         *
+         * @access        public
+         * @return        string
+         */                        
+        function browser()
+        {
+                return $this-&gt;browser;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get the Browser Version
+         *
+         * @access        public
+         * @return        string
+         */                        
+        function version()
+        {
+                return $this-&gt;version;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get The Robot Name
+         *
+         * @access        public
+         * @return        string
+         */                                
+        function robot()
+        {
+                return $this-&gt;robot;
+        }
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get the Mobile Device
+         *
+         * @access        public
+         * @return        string
+         */                        
+        function mobile()
+        {
+                return $this-&gt;mobile;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get the referrer
+         *
+         * @access        public
+         * @return        bool
+         */                        
+        function referrer()
+        {
+                return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get the accepted languages
+         *
+         * @access        public
+         * @return        array
+         */                        
+        function languages()
+        {
+                if (count($this-&gt;languages) == 0)
+                {
+                        $this-&gt;_set_languages();
+                }
+        
+                return $this-&gt;languages;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Get the accepted Character Sets
+         *
+         * @access        public
+         * @return        array
+         */                        
+        function charsets()
+        {
+                if (count($this-&gt;charsets) == 0)
+                {
+                        $this-&gt;_set_charsets();
+                }
+        
+                return $this-&gt;charsets;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Test for a particular language
+         *
+         * @access        public
+         * @return        bool
+         */                        
+        function accept_lang($lang = 'en')
+        {
+                return (in_array(strtolower($lang), $this-&gt;languages(), TRUE)) ? TRUE : FALSE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Test for a particular character set
+         *
+         * @access        public
+         * @return        bool
+         */                        
+        function accept_charset($charset = 'utf-8')
+        {
+                return (in_array(strtolower($charset), $this-&gt;charsets(), TRUE)) ? TRUE : FALSE;
+        }
+        
+        
+}
+
+
+/* End of file User_agent.php */
+/* Location: ./system/libraries/User_agent.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesValidationphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Validation.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Validation.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Validation.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,875 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validation Class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Validation
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/validation.html
+ */
+class CI_Validation {
+        
+        var $CI;
+        var $error_string                = '';
+        var $_error_array                = array();
+        var $_rules                                = array();
+        var $_fields                        = array();
+        var $_error_messages        = array();
+        var $_current_field          = '';
+        var $_safe_form_data         = FALSE;
+        var $_error_prefix                = '&lt;p&gt;';
+        var $_error_suffix                = '&lt;/p&gt;';
+
+        
+
+        /**
+         * Constructor
+         *
+         */        
+        function CI_Validation()
+        {        
+                $this-&gt;CI =&amp; get_instance();
+                
+                if (function_exists('mb_internal_encoding'))
+                {
+                        mb_internal_encoding($this-&gt;CI-&gt;config-&gt;item('charset'));
+                }
+                
+                log_message('debug', &quot;Validation Class Initialized&quot;);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Fields
+         *
+         * This function takes an array of field names as input
+         * and generates class variables with the same name, which will
+         * either be blank or contain the $_POST value corresponding to it
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        void
+         */
+        function set_fields($data = '', $field = '')
+        {        
+                if ($data == '')
+                {
+                        if (count($this-&gt;_fields) == 0)
+                        {
+                                return FALSE;
+                        }
+                }
+                else
+                {
+                        if ( ! is_array($data))
+                        {
+                                $data = array($data =&gt; $field);
+                        }
+                        
+                        if (count($data) &gt; 0)
+                        {
+                                $this-&gt;_fields = $data;
+                        }
+                }                
+                        
+                foreach($this-&gt;_fields as $key =&gt; $val)
+                {
+                        $this-&gt;$key = ( ! isset($_POST[$key])) ? '' : $this-&gt;prep_for_form($_POST[$key]);
+                        
+                        $error = $key.'_error';
+                        if ( ! isset($this-&gt;$error))
+                        {
+                                $this-&gt;$error = '';
+                        }
+                }                
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Rules
+         *
+         * This function takes an array of field names and validation
+         * rules as input ad simply stores is for use later.
+         *
+         * @access        public
+         * @param        mixed
+         * @param        string
+         * @return        void
+         */
+        function set_rules($data, $rules = '')
+        {
+                if ( ! is_array($data))
+                {
+                        if ($rules == '')
+                                return;
+                                
+                        $data = array($data =&gt; $rules);
+                }
+        
+                foreach ($data as $key =&gt; $val)
+                {
+                        $this-&gt;_rules[$key] = $val;
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Error Message
+         *
+         * Lets users set their own error messages on the fly.  Note:  The key
+         * name has to match the  function name that it corresponds to.
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */
+        function set_message($lang, $val = '')
+        {
+                if ( ! is_array($lang))
+                {
+                        $lang = array($lang =&gt; $val);
+                }
+        
+                $this-&gt;_error_messages = array_merge($this-&gt;_error_messages, $lang);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set The Error Delimiter
+         *
+         * Permits a prefix/suffix to be added to each error message
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        void
+         */        
+        function set_error_delimiters($prefix = '&lt;p&gt;', $suffix = '&lt;/p&gt;')
+        {
+                $this-&gt;_error_prefix = $prefix;
+                $this-&gt;_error_suffix = $suffix;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Run the Validator
+         *
+         * This function does all the work.
+         *
+         * @access        public
+         * @return        bool
+         */                
+        function run()
+        {
+                // Do we even have any data to process?  Mm?
+                if (count($_POST) == 0 OR count($this-&gt;_rules) == 0)
+                {
+                        return FALSE;
+                }
+        
+                // Load the language file containing error messages
+                $this-&gt;CI-&gt;lang-&gt;load('validation');
+                                                        
+                // Cycle through the rules and test for errors
+                foreach ($this-&gt;_rules as $field =&gt; $rules)
+                {
+                        //Explode out the rules!
+                        $ex = explode('|', $rules);
+
+                        // Is the field required?  If not, if the field is blank  we'll move on to the next test
+                        if ( ! in_array('required', $ex, TRUE))
+                        {
+                                if ( ! isset($_POST[$field]) OR $_POST[$field] == '')
+                                {
+                                        continue;
+                                }
+                        }
+                        
+                        /*
+                         * Are we dealing with an &quot;isset&quot; rule?
+                         *
+                         * Before going further, we'll see if one of the rules
+                         * is to check whether the item is set (typically this
+                         * applies only to checkboxes).  If so, we'll
+                         * test for it here since there's not reason to go
+                         * further
+                         */
+                        if ( ! isset($_POST[$field]))
+                        {                        
+                                if (in_array('isset', $ex, TRUE) OR in_array('required', $ex))
+                                {
+                                        if ( ! isset($this-&gt;_error_messages['isset']))
+                                        {
+                                                if (FALSE === ($line = $this-&gt;CI-&gt;lang-&gt;line('isset')))
+                                                {
+                                                        $line = 'The field was not set';
+                                                }                                                        
+                                        }
+                                        else
+                                        {
+                                                $line = $this-&gt;_error_messages['isset'];
+                                        }
+                                        
+                                        // Build the error message
+                                        $mfield = ( ! isset($this-&gt;_fields[$field])) ? $field : $this-&gt;_fields[$field];
+                                        $message = sprintf($line, $mfield);
+
+                                        // Set the error variable.  Example: $this-&gt;username_error
+                                        $error = $field.'_error';
+                                        $this-&gt;$error = $this-&gt;_error_prefix.$message.$this-&gt;_error_suffix;
+                                        $this-&gt;_error_array[] = $message;
+                                }
+                                                
+                                continue;
+                        }
+        
+                        /*
+                         * Set the current field
+                         *
+                         * The various prepping functions need to know the
+                         * current field name so they can do this:
+                         *
+                         * $_POST[$this-&gt;_current_field] == 'bla bla';
+                         */
+                        $this-&gt;_current_field = $field;
+
+                        // Cycle through the rules!
+                        foreach ($ex As $rule)
+                        {
+                                // Is the rule a callback?                        
+                                $callback = FALSE;
+                                if (substr($rule, 0, 9) == 'callback_')
+                                {
+                                        $rule = substr($rule, 9);
+                                        $callback = TRUE;
+                                }
+                                
+                                // Strip the parameter (if exists) from the rule
+                                // Rules can contain a parameter: max_length[5]
+                                $param = FALSE;
+                                if (preg_match(&quot;/(.*?)\[(.*?)\]/&quot;, $rule, $match))
+                                {
+                                        $rule        = $match[1];
+                                        $param        = $match[2];
+                                }
+                                
+                                // Call the function that corresponds to the rule
+                                if ($callback === TRUE)
+                                {
+                                        if ( ! method_exists($this-&gt;CI, $rule))
+                                        {                 
+                                                continue;
+                                        }
+                                        
+                                        $result = $this-&gt;CI-&gt;$rule($_POST[$field], $param);        
+                                        
+                                        // If the field isn't required and we just processed a callback we'll move on...
+                                        if ( ! in_array('required', $ex, TRUE) AND $result !== FALSE)
+                                        {
+                                                continue 2;
+                                        }
+                                        
+                                }
+                                else
+                                {                                
+                                        if ( ! method_exists($this, $rule))
+                                        {
+                                                /*
+                                                 * Run the native PHP function if called for
+                                                 *
+                                                 * If our own wrapper function doesn't exist we see
+                                                 * if a native PHP function does. Users can use
+                                                 * any native PHP function call that has one param.
+                                                 */
+                                                if (function_exists($rule))
+                                                {
+                                                        $_POST[$field] = $rule($_POST[$field]);
+                                                        $this-&gt;$field = $_POST[$field];
+                                                }
+                                                                                        
+                                                continue;
+                                        }
+                                        
+                                        $result = $this-&gt;$rule($_POST[$field], $param);
+                                }
+                                                                
+                                // Did the rule test negatively?  If so, grab the error.
+                                if ($result === FALSE)
+                                {
+                                        if ( ! isset($this-&gt;_error_messages[$rule]))
+                                        {
+                                                if (FALSE === ($line = $this-&gt;CI-&gt;lang-&gt;line($rule)))
+                                                {
+                                                        $line = 'Unable to access an error message corresponding to your field name.';
+                                                }                                                
+                                        }
+                                        else
+                                        {
+                                                $line = $this-&gt;_error_messages[$rule];
+                                        }                                
+
+                                        // Build the error message
+                                        $mfield = ( ! isset($this-&gt;_fields[$field])) ? $field : $this-&gt;_fields[$field];
+                                        $mparam = ( ! isset($this-&gt;_fields[$param])) ? $param : $this-&gt;_fields[$param];
+                                        $message = sprintf($line, $mfield, $mparam);
+                                        
+                                        // Set the error variable.  Example: $this-&gt;username_error
+                                        $error = $field.'_error';
+                                        $this-&gt;$error = $this-&gt;_error_prefix.$message.$this-&gt;_error_suffix;
+
+                                        // Add the error to the error array
+                                        $this-&gt;_error_array[] = $message;                                
+                                        continue 2;
+                                }                                
+                        }
+                        
+                }
+                
+                $total_errors = count($this-&gt;_error_array);
+
+                /*
+                 * Recompile the class variables
+                 *
+                 * If any prepping functions were called the $_POST data
+                 * might now be different then the corresponding class
+                 * variables so we'll set them anew.
+                 */        
+                if ($total_errors &gt; 0)
+                {
+                        $this-&gt;_safe_form_data = TRUE;
+                }
+                
+                $this-&gt;set_fields();
+
+                // Did we end up with any errors?
+                if ($total_errors == 0)
+                {
+                        return TRUE;
+                }
+                
+                // Generate the error string
+                foreach ($this-&gt;_error_array as $val)
+                {
+                        $this-&gt;error_string .= $this-&gt;_error_prefix.$val.$this-&gt;_error_suffix.&quot;\n&quot;;
+                }
+
+                return FALSE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Required
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function required($str)
+        {
+                if ( ! is_array($str))
+                {
+                        return (trim($str) == '') ? FALSE : TRUE;
+                }
+                else
+                {
+                        return ( ! empty($str));
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Match one field to another
+         *
+         * @access        public
+         * @param        string
+         * @param        field
+         * @return        bool
+         */
+        function matches($str, $field)
+        {
+                if ( ! isset($_POST[$field]))
+                {
+                        return FALSE;
+                }
+                
+                return ($str !== $_POST[$field]) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Minimum Length
+         *
+         * @access        public
+         * @param        string
+         * @param        value
+         * @return        bool
+         */        
+        function min_length($str, $val)
+        {
+                if (preg_match(&quot;/[^0-9]/&quot;, $val))
+                {
+                        return FALSE;
+                }
+
+                if (function_exists('mb_strlen'))
+                {
+                        return (mb_strlen($str) &lt; $val) ? FALSE : TRUE;                
+                }
+
+                return (strlen($str) &lt; $val) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Max Length
+         *
+         * @access        public
+         * @param        string
+         * @param        value
+         * @return        bool
+         */        
+        function max_length($str, $val)
+        {
+                if (preg_match(&quot;/[^0-9]/&quot;, $val))
+                {
+                        return FALSE;
+                }
+                
+                if (function_exists('mb_strlen'))
+                {
+                        return (mb_strlen($str) &gt; $val) ? FALSE : TRUE;                
+                }
+
+                return (strlen($str) &gt; $val) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Exact Length
+         *
+         * @access        public
+         * @param        string
+         * @param        value
+         * @return        bool
+         */        
+        function exact_length($str, $val)
+        {
+                if (preg_match(&quot;/[^0-9]/&quot;, $val))
+                {
+                        return FALSE;
+                }
+        
+                if (function_exists('mb_strlen'))
+                {
+                        return (mb_strlen($str) != $val) ? FALSE : TRUE;                
+                }
+
+                return (strlen($str) != $val) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Valid Email
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function valid_email($str)
+        {
+                return ( ! preg_match(&quot;/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix&quot;, $str)) ? FALSE : TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Valid Emails
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function valid_emails($str)
+        {
+                if (strpos($str, ',') === FALSE)
+                {
+                        return $this-&gt;valid_email(trim($str));
+                }
+                
+                foreach(explode(',', $str) as $email)
+                {
+                        if (trim($email) != '' &amp;&amp; $this-&gt;valid_email(trim($email)) === FALSE)
+                        {
+                                return FALSE;
+                        }
+                }
+                
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Validate IP Address
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function valid_ip($ip)
+        {
+                return $this-&gt;CI-&gt;input-&gt;valid_ip($ip);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Alpha
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */                
+        function alpha($str)
+        {
+                return ( ! preg_match(&quot;/^([a-z])+$/i&quot;, $str)) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Alpha-numeric
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function alpha_numeric($str)
+        {
+                return ( ! preg_match(&quot;/^([a-z0-9])+$/i&quot;, $str)) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Alpha-numeric with underscores and dashes
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function alpha_dash($str)
+        {
+                return ( ! preg_match(&quot;/^([-a-z0-9_-])+$/i&quot;, $str)) ? FALSE : TRUE;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Numeric
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function numeric($str)
+        {
+                return (bool)preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
+
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Is Numeric
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+          function is_numeric($str)
+        {
+                return ( ! is_numeric($str)) ? FALSE : TRUE;
+        } 
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Integer
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */        
+        function integer($str)
+        {
+                return (bool)preg_match( '/^[\-+]?[0-9]+$/', $str);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Is a Natural number  (0,1,2,3, etc.)
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function is_natural($str)
+        {   
+                   return (bool)preg_match( '/^[0-9]+$/', $str);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Is a Natural number, but not a zero  (1,2,3, etc.)
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function is_natural_no_zero($str)
+        {   
+                if ( ! preg_match( '/^[0-9]+$/', $str))
+                {
+                        return FALSE;
+                }
+        
+                if ($str == 0)
+                {
+                        return FALSE;
+                }
+
+                return TRUE;
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Valid Base64
+         *
+         * Tests a string for characters outside of the Base64 alphabet
+         * as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
+         *
+         * @access        public
+         * @param        string
+         * @return        bool
+         */
+        function valid_base64($str)
+        {
+                return (bool) ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
+        }
+
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Select
+         *
+         * Enables pull-down lists to be set to the value the user
+         * selected in the event of an error
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function set_select($field = '', $value = '')
+        {
+                if ($field == '' OR $value == '' OR  ! isset($_POST[$field]))
+                {
+                        return '';
+                }
+                        
+                if ($_POST[$field] == $value)
+                {
+                        return ' selected=&quot;selected&quot;';
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Radio
+         *
+         * Enables radio buttons to be set to the value the user
+         * selected in the event of an error
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function set_radio($field = '', $value = '')
+        {
+                if ($field == '' OR $value == '' OR  ! isset($_POST[$field]))
+                {
+                        return '';
+                }
+                        
+                if ($_POST[$field] == $value)
+                {
+                        return ' checked=&quot;checked&quot;';
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Set Checkbox
+         *
+         * Enables checkboxes to be set to the value the user
+         * selected in the event of an error
+         *
+         * @access        public
+         * @param        string
+         * @param        string
+         * @return        string
+         */        
+        function set_checkbox($field = '', $value = '')
+        {
+                if ($field == '' OR $value == '' OR  ! isset($_POST[$field]))
+                {
+                        return '';
+                }
+                        
+                if ($_POST[$field] == $value)
+                {
+                        return ' checked=&quot;checked&quot;';
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Prep data for form
+         *
+         * This function allows HTML to be safely shown in a form.
+         * Special characters are converted.
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */
+        function prep_for_form($data = '')
+        {
+                if (is_array($data))
+                {
+                        foreach ($data as $key =&gt; $val)
+                        {
+                                $data[$key] = $this-&gt;prep_for_form($val);
+                        }
+                        
+                        return $data;
+                }
+                
+                if ($this-&gt;_safe_form_data == FALSE OR $data == '')
+                {
+                        return $data;
+                }
+
+                return str_replace(array(&quot;'&quot;, '&quot;', '&lt;', '&gt;'), array(&quot;&amp;#39;&quot;, &quot;&amp;quot;&quot;, '&amp;lt;', '&amp;gt;'), stripslashes($data));
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Prep URL
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function prep_url($str = '')
+        {
+                if ($str == 'http://' OR $str == '')
+                {
+                        $_POST[$this-&gt;_current_field] = '';
+                        return;
+                }
+                
+                if (substr($str, 0, 7) != 'http://' &amp;&amp; substr($str, 0, 8) != 'https://')
+                {
+                        $str = 'http://'.$str;
+                }
+                
+                $_POST[$this-&gt;_current_field] = $str;
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Strip Image Tags
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function strip_image_tags($str)
+        {
+                $_POST[$this-&gt;_current_field] = $this-&gt;CI-&gt;input-&gt;strip_image_tags($str);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * XSS Clean
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function xss_clean($str)
+        {
+                $_POST[$this-&gt;_current_field] = $this-&gt;CI-&gt;input-&gt;xss_clean($str);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Convert PHP tags to entities
+         *
+         * @access        public
+         * @param        string
+         * @return        string
+         */        
+        function encode_php_tags($str)
+        {
+                $_POST[$this-&gt;_current_field] = str_replace(array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'),  array('&amp;lt;?php', '&amp;lt;?PHP', '&amp;lt;?', '?&amp;gt;'), $str);
+        }
+
+}
+// END Validation Class
+
+/* End of file Validation.php */
+/* Location: ./system/libraries/Validation.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesXmlrpcphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpc.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpc.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpc.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,1421 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+if ( ! function_exists('xml_parser_create'))
+{        
+        show_error('Your PHP installation does not support XML');
+}
+
+
+// ------------------------------------------------------------------------
+
+/**
+ * XML-RPC request handler class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        XML-RPC
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/xmlrpc.html
+ */
+class CI_Xmlrpc {
+
+        var $debug                        = FALSE;         // Debugging on or off        
+        var $xmlrpcI4                = 'i4';
+        var $xmlrpcInt                = 'int';
+        var $xmlrpcBoolean        = 'boolean';
+        var $xmlrpcDouble        = 'double';        
+        var $xmlrpcString        = 'string';
+        var $xmlrpcDateTime        = 'dateTime.iso8601';
+        var $xmlrpcBase64        = 'base64';
+        var $xmlrpcArray        = 'array';
+        var $xmlrpcStruct        = 'struct';
+        
+        var $xmlrpcTypes        = array();
+        var $valid_parents        = array();
+        var $xmlrpcerr                = array();        // Response numbers
+        var $xmlrpcstr                = array();  // Response strings
+        
+        var $xmlrpc_defencoding = 'UTF-8';
+        var $xmlrpcName                        = 'XML-RPC for CodeIgniter';
+        var $xmlrpcVersion                = '1.1';
+        var $xmlrpcerruser                = 800; // Start of user errors
+        var $xmlrpcerrxml                = 100; // Start of XML Parse errors
+        var $xmlrpc_backslash        = ''; // formulate backslashes for escaping regexp
+        
+        var $client;
+        var $method;
+        var $data;
+        var $message                        = '';
+        var $error                                = '';                  // Error string for request
+        var $result;
+        var $response                        = array();  // Response from remote server
+
+
+        //-------------------------------------
+        //  VALUES THAT MULTIPLE CLASSES NEED
+        //-------------------------------------
+
+        function CI_Xmlrpc ($config = array())
+        {
+                $this-&gt;xmlrpcName                 = $this-&gt;xmlrpcName;
+                $this-&gt;xmlrpc_backslash = chr(92).chr(92);
+                
+                // Types for info sent back and forth
+                $this-&gt;xmlrpcTypes = array(
+                        $this-&gt;xmlrpcI4           =&gt; '1',
+                        $this-&gt;xmlrpcInt          =&gt; '1',
+                        $this-&gt;xmlrpcBoolean  =&gt; '1',
+                        $this-&gt;xmlrpcString   =&gt; '1',
+                        $this-&gt;xmlrpcDouble   =&gt; '1',
+                        $this-&gt;xmlrpcDateTime =&gt; '1',
+                        $this-&gt;xmlrpcBase64   =&gt; '1',
+                        $this-&gt;xmlrpcArray        =&gt; '2',
+                        $this-&gt;xmlrpcStruct   =&gt; '3'
+                        );
+                        
+                // Array of Valid Parents for Various XML-RPC elements
+                $this-&gt;valid_parents = array('BOOLEAN'                        =&gt; array('VALUE'),
+                                                                         'I4'                                =&gt; array('VALUE'),
+                                                                         'INT'                                =&gt; array('VALUE'),
+                                                                         'STRING'                        =&gt; array('VALUE'),
+                                                                         'DOUBLE'                        =&gt; array('VALUE'),
+                                                                         'DATETIME.ISO8601'        =&gt; array('VALUE'),
+                                                                         'BASE64'                        =&gt; array('VALUE'),
+                                                                         'ARRAY'                        =&gt; array('VALUE'),
+                                                                         'STRUCT'                        =&gt; array('VALUE'),
+                                                                         'PARAM'                        =&gt; array('PARAMS'),
+                                                                         'METHODNAME'                =&gt; array('METHODCALL'),
+                                                                         'PARAMS'                        =&gt; array('METHODCALL', 'METHODRESPONSE'),
+                                                                         'MEMBER'                        =&gt; array('STRUCT'),
+                                                                         'NAME'                                =&gt; array('MEMBER'),
+                                                                         'DATA'                                =&gt; array('ARRAY'),
+                                                                         'FAULT'                        =&gt; array('METHODRESPONSE'),
+                                                                         'VALUE'                        =&gt; array('MEMBER', 'DATA', 'PARAM', 'FAULT')
+                                                                         );
+                        
+                        
+                // XML-RPC Responses
+                $this-&gt;xmlrpcerr['unknown_method'] = '1';
+                $this-&gt;xmlrpcstr['unknown_method'] = 'This is not a known method for this XML-RPC Server';
+                $this-&gt;xmlrpcerr['invalid_return'] = '2';
+                $this-&gt;xmlrpcstr['invalid_return'] = 'The XML data receieved was either invalid or not in the correct form for XML-RPC.  Turn on debugging to examine the XML data further.';
+                $this-&gt;xmlrpcerr['incorrect_params'] = '3';
+                $this-&gt;xmlrpcstr['incorrect_params'] = 'Incorrect parameters were passed to method';
+                $this-&gt;xmlrpcerr['introspect_unknown'] = '4';
+                $this-&gt;xmlrpcstr['introspect_unknown'] = &quot;Cannot inspect signature for request: method unknown&quot;;
+                $this-&gt;xmlrpcerr['http_error'] = '5';
+                $this-&gt;xmlrpcstr['http_error'] = &quot;Did not receive a '200 OK' response from remote server.&quot;;
+                $this-&gt;xmlrpcerr['no_data'] = '6';
+                $this-&gt;xmlrpcstr['no_data'] ='No data received from server.';
+                
+                $this-&gt;initialize($config);
+                
+                log_message('debug', &quot;XML-RPC Class Initialized&quot;);
+        }
+        
+        
+        //-------------------------------------
+        //  Initialize Prefs
+        //-------------------------------------
+
+        function initialize($config = array())
+        {
+                if (count($config) &gt; 0)
+                {
+                        foreach ($config as $key =&gt; $val)
+                        {
+                                if (isset($this-&gt;$key))
+                                {
+                                        $this-&gt;$key = $val;                        
+                                }
+                        }
+                }
+        }
+        // END
+        
+        //-------------------------------------
+        //  Take URL and parse it
+        //-------------------------------------
+
+        function server($url, $port=80)
+        {
+                if (substr($url, 0, 4) != &quot;http&quot;)
+                {
+                        $url = &quot;http://&quot;.$url;
+                }
+                
+                $parts = parse_url($url);
+                
+                $path = ( ! isset($parts['path'])) ? '/' : $parts['path'];
+                
+                if (isset($parts['query']) &amp;&amp; $parts['query'] != '')
+                {
+                        $path .= '?'.$parts['query'];
+                }        
+                
+                $this-&gt;client = new XML_RPC_Client($path, $parts['host'], $port);
+        }
+        // END
+        
+        //-------------------------------------
+        //  Set Timeout
+        //-------------------------------------
+
+        function timeout($seconds=5)
+        {
+                if ( ! is_null($this-&gt;client) &amp;&amp; is_int($seconds))
+                {
+                        $this-&gt;client-&gt;timeout = $seconds;
+                }
+        }
+        // END
+        
+        //-------------------------------------
+        //  Set Methods
+        //-------------------------------------
+
+        function method($function)
+        {
+                $this-&gt;method = $function;
+        }
+        // END
+        
+        //-------------------------------------
+        //  Take Array of Data and Create Objects
+        //-------------------------------------
+
+        function request($incoming)
+        {
+                if ( ! is_array($incoming))
+                {
+                        // Send Error
+                }
+                
+                $this-&gt;data = array();
+                
+                foreach($incoming as $key =&gt; $value)
+                {
+                        $this-&gt;data[$key] = $this-&gt;values_parsing($value);
+                }
+        }
+        // END
+        
+        
+        //-------------------------------------
+        //  Set Debug
+        //-------------------------------------
+
+        function set_debug($flag = TRUE)
+        {
+                $this-&gt;debug = ($flag == TRUE) ? TRUE : FALSE;
+        }
+        
+        //-------------------------------------
+        //  Values Parsing
+        //-------------------------------------
+
+        function values_parsing($value, $return = FALSE)
+        {
+                if (is_array($value) &amp;&amp; isset($value['0']))
+                {
+                        if ( ! isset($value['1']) OR (! isset($this-&gt;xmlrpcTypes[$value['1']])))
+                        {
+                                if (is_array($value[0]))
+                                {
+                                        $temp = new XML_RPC_Values($value['0'], 'array');
+                                }
+                                else
+                                {
+                                        $temp = new XML_RPC_Values($value['0'], 'string');
+                                }
+                        }
+                        elseif(is_array($value['0']) &amp;&amp; ($value['1'] == 'struct' OR $value['1'] == 'array'))
+                        {
+                                while (list($k) = each($value['0']))
+                                {
+                                        $value['0'][$k] = $this-&gt;values_parsing($value['0'][$k], TRUE);
+                                }
+                                
+                                $temp = new XML_RPC_Values($value['0'], $value['1']);
+                        }
+                        else
+                        {
+                                $temp = new XML_RPC_Values($value['0'], $value['1']);
+                        }
+                }
+                else
+                {
+                        $temp = new XML_RPC_Values($value, 'string');
+                }
+
+                return $temp;
+        }
+        // END
+
+
+        //-------------------------------------
+        //  Sends XML-RPC Request
+        //-------------------------------------
+
+        function send_request()
+        {
+                $this-&gt;message = new XML_RPC_Message($this-&gt;method,$this-&gt;data);
+                $this-&gt;message-&gt;debug = $this-&gt;debug;
+        
+                if ( ! $this-&gt;result = $this-&gt;client-&gt;send($this-&gt;message))
+                {
+                        $this-&gt;error = $this-&gt;result-&gt;errstr;
+                        return FALSE;
+                }
+                elseif( ! is_object($this-&gt;result-&gt;val))
+                {
+                        $this-&gt;error = $this-&gt;result-&gt;errstr;
+                        return FALSE;
+                }
+                
+                $this-&gt;response = $this-&gt;result-&gt;decode();
+                
+                return TRUE;
+        }
+        // END
+        
+        //-------------------------------------
+        //  Returns Error
+        //-------------------------------------
+
+        function display_error()
+        {
+                return $this-&gt;error;
+        }
+        // END
+        
+        //-------------------------------------
+        //  Returns Remote Server Response
+        //-------------------------------------
+
+        function display_response()
+        {
+                return $this-&gt;response;
+        }
+        // END
+        
+        //-------------------------------------
+        //  Sends an Error Message for Server Request
+        //-------------------------------------
+        
+        function send_error_message($number, $message)
+        {
+                return new XML_RPC_Response('0',$number, $message);
+        }
+        // END
+        
+        
+        //-------------------------------------
+        //  Send Response for Server Request
+        //-------------------------------------
+        
+        function send_response($response)
+        {
+                // $response should be array of values, which will be parsed
+                // based on their data and type into a valid group of XML-RPC values
+                
+                $response = $this-&gt;values_parsing($response);
+        
+                return new XML_RPC_Response($response);
+        }
+        // END
+        
+} // END XML_RPC Class
+
+        
+        
+/**
+ * XML-RPC Client class
+ *
+ * @category        XML-RPC
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/xmlrpc.html
+ */
+class XML_RPC_Client extends CI_Xmlrpc
+{
+        var $path                        = '';
+        var $server                        = '';
+        var $port                        = 80;
+        var $errno                        = '';
+        var $errstring                = '';
+        var $timeout                = 5;
+        var $no_multicall        = false;
+
+        function XML_RPC_Client($path, $server, $port=80)
+        {
+                parent::CI_Xmlrpc();
+                
+                $this-&gt;port = $port;
+                $this-&gt;server = $server;
+                $this-&gt;path = $path;
+        }
+        
+        function send($msg)
+        {
+                if (is_array($msg))
+                {
+                        // Multi-call disabled
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['multicall_recursion'],$this-&gt;xmlrpcstr['multicall_recursion']);
+                        return $r;
+                }
+
+                return $this-&gt;sendPayload($msg);
+        }
+
+        function sendPayload($msg)
+        {        
+                $fp = @fsockopen($this-&gt;server, $this-&gt;port,$this-&gt;errno, $this-&gt;errstr, $this-&gt;timeout);
+                
+                if ( ! is_resource($fp))
+                {
+                        error_log($this-&gt;xmlrpcstr['http_error']);
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['http_error'],$this-&gt;xmlrpcstr['http_error']);
+                        return $r;
+                }
+                
+                if(empty($msg-&gt;payload))
+                {
+                        // $msg = XML_RPC_Messages
+                        $msg-&gt;createPayload();
+                }
+                
+                $r = &quot;\r\n&quot;;
+                $op  = &quot;POST {$this-&gt;path} HTTP/1.0$r&quot;;
+                $op .= &quot;Host: {$this-&gt;server}$r&quot;;
+                $op .= &quot;Content-Type: text/xml$r&quot;;
+                $op .= &quot;User-Agent: {$this-&gt;xmlrpcName}$r&quot;;
+                $op .= &quot;Content-Length: &quot;.strlen($msg-&gt;payload). &quot;$r$r&quot;;
+                $op .= $msg-&gt;payload;
+                
+
+                if ( ! fputs($fp, $op, strlen($op)))
+                {
+                        error_log($this-&gt;xmlrpcstr['http_error']);
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['http_error'], $this-&gt;xmlrpcstr['http_error']);
+                        return $r;
+                }
+                $resp = $msg-&gt;parseResponse($fp);
+                fclose($fp);
+                return $resp;
+        }
+
+} // end class XML_RPC_Client
+
+
+/**
+ * XML-RPC Response class
+ *
+ * @category        XML-RPC
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/xmlrpc.html
+ */
+class XML_RPC_Response
+{
+        var $val = 0;
+        var $errno = 0;
+        var $errstr = '';
+        var $headers = array();
+
+        function XML_RPC_Response($val, $code = 0, $fstr = '')
+        {        
+                if ($code != 0)
+                {
+                        // error
+                        $this-&gt;errno = $code;
+                        $this-&gt;errstr = htmlentities($fstr);
+                }
+                else if ( ! is_object($val))
+                {
+                        // programmer error, not an object
+                        error_log(&quot;Invalid type '&quot; . gettype($val) . &quot;' (value: $val) passed to XML_RPC_Response.  Defaulting to empty value.&quot;);
+                        $this-&gt;val = new XML_RPC_Values();
+                }
+                else
+                {
+                        $this-&gt;val = $val;
+                }
+        }
+
+        function faultCode()
+        {
+                return $this-&gt;errno;
+        }
+
+        function faultString()
+        {
+                return $this-&gt;errstr;
+        }
+
+        function value()
+        {
+                return $this-&gt;val;
+        }
+        
+        function prepare_response()
+        {
+                $result = &quot;&lt;methodResponse&gt;\n&quot;;
+                if ($this-&gt;errno)
+                {
+                        $result .= '&lt;fault&gt;
+        &lt;value&gt;
+                &lt;struct&gt;
+                        &lt;member&gt;
+                                &lt;name&gt;faultCode&lt;/name&gt;
+                                &lt;value&gt;&lt;int&gt;' . $this-&gt;errno . '&lt;/int&gt;&lt;/value&gt;
+                        &lt;/member&gt;
+                        &lt;member&gt;
+                                &lt;name&gt;faultString&lt;/name&gt;
+                                &lt;value&gt;&lt;string&gt;' . $this-&gt;errstr . '&lt;/string&gt;&lt;/value&gt;
+                        &lt;/member&gt;
+                &lt;/struct&gt;
+        &lt;/value&gt;
+&lt;/fault&gt;';
+                }
+                else
+                {
+                        $result .= &quot;&lt;params&gt;\n&lt;param&gt;\n&quot; .
+                                        $this-&gt;val-&gt;serialize_class() .
+                                        &quot;&lt;/param&gt;\n&lt;/params&gt;&quot;;
+                }
+                $result .= &quot;\n&lt;/methodResponse&gt;&quot;;
+                return $result;
+        }
+        
+        function decode($array=FALSE)
+        {
+                $CI =&amp; get_instance();
+
+                if ($array !== FALSE &amp;&amp; is_array($array))
+                {
+                        while (list($key) = each($array))
+                        {
+                                if (is_array($array[$key]))
+                                {
+                                        $array[$key] = $this-&gt;decode($array[$key]);
+                                }
+                                else
+                                {
+                                        $array[$key] = $CI-&gt;input-&gt;xss_clean($array[$key]);
+                                }
+                        }
+                        
+                        $result = $array;
+                }
+                else
+                {
+                        $result = $this-&gt;xmlrpc_decoder($this-&gt;val);
+                        
+                        if (is_array($result))
+                        {
+                                $result = $this-&gt;decode($result);
+                        }
+                        else
+                        {
+                                $result = $CI-&gt;input-&gt;xss_clean($result);
+                        }
+                }
+                
+                return $result;
+        }
+
+        
+        
+        //-------------------------------------
+        //  XML-RPC Object to PHP Types
+        //-------------------------------------
+
+        function xmlrpc_decoder($xmlrpc_val)
+        {
+                $kind = $xmlrpc_val-&gt;kindOf();
+
+                if($kind == 'scalar')
+                {
+                        return $xmlrpc_val-&gt;scalarval();
+                }
+                elseif($kind == 'array')
+                {
+                        reset($xmlrpc_val-&gt;me);
+                        list($a,$b) = each($xmlrpc_val-&gt;me);
+                        $size = count($b);
+                        
+                        $arr = array();
+
+                        for($i = 0; $i &lt; $size; $i++)
+                        {
+                                $arr[] = $this-&gt;xmlrpc_decoder($xmlrpc_val-&gt;me['array'][$i]);
+                        }
+                        return $arr;
+                }
+                elseif($kind == 'struct')
+                {
+                        reset($xmlrpc_val-&gt;me['struct']);
+                        $arr = array();
+
+                        while(list($key,$value) = each($xmlrpc_val-&gt;me['struct']))
+                        {
+                                $arr[$key] = $this-&gt;xmlrpc_decoder($value);
+                        }
+                        return $arr;
+                }
+        }
+        
+        
+        //-------------------------------------
+        //  ISO-8601 time to server or UTC time
+        //-------------------------------------
+
+        function iso8601_decode($time, $utc=0)
+        {
+                // return a timet in the localtime, or UTC
+                $t = 0;
+                if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $time, $regs))
+                {
+                        if ($utc == 1)
+                                $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+                        else
+                                $t = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+                }
+                return $t;
+        }
+        
+} // End Response Class
+
+
+
+/**
+ * XML-RPC Message class
+ *
+ * @category        XML-RPC
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/xmlrpc.html
+ */
+class XML_RPC_Message extends CI_Xmlrpc
+{
+        var $payload;
+        var $method_name;
+        var $params                        = array();
+        var $xh                         = array();
+
+        function XML_RPC_Message($method, $pars=0)
+        {
+                parent::CI_Xmlrpc();
+                
+                $this-&gt;method_name = $method;
+                if (is_array($pars) &amp;&amp; count($pars) &gt; 0)
+                {
+                        for($i=0; $i&lt;count($pars); $i++)
+                        {
+                                // $pars[$i] = XML_RPC_Values
+                                $this-&gt;params[] = $pars[$i];
+                        }
+                }
+        }
+        
+        //-------------------------------------
+        //  Create Payload to Send
+        //-------------------------------------
+        
+        function createPayload()
+        {
+                $this-&gt;payload = &quot;&lt;?xml version=\&quot;1.0\&quot;?&quot;.&quot;&gt;\r\n&lt;methodCall&gt;\r\n&quot;;
+                $this-&gt;payload .= '&lt;methodName&gt;' . $this-&gt;method_name . &quot;&lt;/methodName&gt;\r\n&quot;;
+                $this-&gt;payload .= &quot;&lt;params&gt;\r\n&quot;;
+                
+                for($i=0; $i&lt;count($this-&gt;params); $i++)
+                {
+                        // $p = XML_RPC_Values
+                        $p = $this-&gt;params[$i];
+                        $this-&gt;payload .= &quot;&lt;param&gt;\r\n&quot;.$p-&gt;serialize_class().&quot;&lt;/param&gt;\r\n&quot;;
+                }
+                
+                $this-&gt;payload .= &quot;&lt;/params&gt;\r\n&lt;/methodCall&gt;\r\n&quot;;
+        }
+        
+        //-------------------------------------
+        //  Parse External XML-RPC Server's Response
+        //-------------------------------------
+        
+        function parseResponse($fp)
+        {
+                $data = '';
+                
+                while($datum = fread($fp, 4096))
+                {
+                        $data .= $datum;
+                }
+                
+                //-------------------------------------
+                //  DISPLAY HTTP CONTENT for DEBUGGING
+                //-------------------------------------
+                
+                if ($this-&gt;debug === TRUE)
+                {
+                        echo &quot;&lt;pre&gt;&quot;;
+                        echo &quot;---DATA---\n&quot; . htmlspecialchars($data) . &quot;\n---END DATA---\n\n&quot;;
+                        echo &quot;&lt;/pre&gt;&quot;;
+                }
+                
+                //-------------------------------------
+                //  Check for data
+                //-------------------------------------
+
+                if($data == &quot;&quot;)
+                {
+                        error_log($this-&gt;xmlrpcstr['no_data']);
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['no_data'], $this-&gt;xmlrpcstr['no_data']);
+                        return $r;
+                }
+                
+                
+                //-------------------------------------
+                //  Check for HTTP 200 Response
+                //-------------------------------------
+                
+                if (strncmp($data, 'HTTP', 4) == 0 &amp;&amp; ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data))
+                {
+                        $errstr= substr($data, 0, strpos($data, &quot;\n&quot;)-1);
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['http_error'], $this-&gt;xmlrpcstr['http_error']. ' (' . $errstr . ')');
+                        return $r;
+                }
+                
+                //-------------------------------------
+                //  Create and Set Up XML Parser
+                //-------------------------------------
+        
+                $parser = xml_parser_create($this-&gt;xmlrpc_defencoding);
+
+                $this-&gt;xh[$parser]                                 = array();
+                $this-&gt;xh[$parser]['isf']                 = 0;
+                $this-&gt;xh[$parser]['ac']                 = '';
+                $this-&gt;xh[$parser]['headers']          = array();
+                $this-&gt;xh[$parser]['stack']                 = array();
+                $this-&gt;xh[$parser]['valuestack'] = array();
+                $this-&gt;xh[$parser]['isf_reason'] = 0;
+
+                xml_set_object($parser, $this);
+                xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+                xml_set_element_handler($parser, 'open_tag', 'closing_tag');
+                xml_set_character_data_handler($parser, 'character_data');
+                //xml_set_default_handler($parser, 'default_handler');
+
+
+                //-------------------------------------
+                //  GET HEADERS
+                //-------------------------------------
+                
+                $lines = explode(&quot;\r\n&quot;, $data);
+                while (($line = array_shift($lines)))
+                {
+                        if (strlen($line) &lt; 1)
+                        {
+                                break;
+                        }
+                        $this-&gt;xh[$parser]['headers'][] = $line;
+                }
+                $data = implode(&quot;\r\n&quot;, $lines);
+                
+                
+                //-------------------------------------
+                //  PARSE XML DATA
+                //-------------------------------------          
+
+                if ( ! xml_parse($parser, $data, count($data)))
+                {
+                        $errstr = sprintf('XML error: %s at line %d',
+                                        xml_error_string(xml_get_error_code($parser)),
+                                        xml_get_current_line_number($parser));
+                        //error_log($errstr);
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['invalid_return'], $this-&gt;xmlrpcstr['invalid_return']);
+                        xml_parser_free($parser);
+                        return $r;
+                }
+                xml_parser_free($parser);
+                
+                // ---------------------------------------
+                //  Got Ourselves Some Badness, It Seems
+                // ---------------------------------------
+                
+                if ($this-&gt;xh[$parser]['isf'] &gt; 1)
+                {
+                        if ($this-&gt;debug === TRUE)
+                        {
+                                echo &quot;---Invalid Return---\n&quot;;
+                                echo $this-&gt;xh[$parser]['isf_reason'];
+                                echo &quot;---Invalid Return---\n\n&quot;;
+                        }
+                                
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['invalid_return'],$this-&gt;xmlrpcstr['invalid_return'].' '.$this-&gt;xh[$parser]['isf_reason']);
+                        return $r;
+                }
+                elseif ( ! is_object($this-&gt;xh[$parser]['value']))
+                {
+                        $r = new XML_RPC_Response(0, $this-&gt;xmlrpcerr['invalid_return'],$this-&gt;xmlrpcstr['invalid_return'].' '.$this-&gt;xh[$parser]['isf_reason']);
+                        return $r;
+                }
+                
+                //-------------------------------------
+                //  DISPLAY XML CONTENT for DEBUGGING
+                //-------------------------------------          
+                
+                if ($this-&gt;debug === TRUE)
+                {
+                        echo &quot;&lt;pre&gt;&quot;;
+                        
+                        if (count($this-&gt;xh[$parser]['headers'] &gt; 0))
+                        {
+                                echo &quot;---HEADERS---\n&quot;;
+                                foreach ($this-&gt;xh[$parser]['headers'] as $header)
+                                {
+                                        echo &quot;$header\n&quot;;
+                                }
+                                echo &quot;---END HEADERS---\n\n&quot;;
+                        }
+                        
+                        echo &quot;---DATA---\n&quot; . htmlspecialchars($data) . &quot;\n---END DATA---\n\n&quot;;
+                        
+                        echo &quot;---PARSED---\n&quot; ;
+                        var_dump($this-&gt;xh[$parser]['value']);
+                        echo &quot;\n---END PARSED---&lt;/pre&gt;&quot;;
+                }
+                
+                //-------------------------------------
+                //  SEND RESPONSE
+                //-------------------------------------
+                
+                $v = $this-&gt;xh[$parser]['value'];
+                        
+                if ($this-&gt;xh[$parser]['isf'])
+                {
+                        $errno_v = $v-&gt;me['struct']['faultCode'];
+                        $errstr_v = $v-&gt;me['struct']['faultString'];
+                        $errno = $errno_v-&gt;scalarval();
+
+                        if ($errno == 0)
+                        {
+                                // FAULT returned, errno needs to reflect that
+                                $errno = -1;
+                        }
+
+                        $r = new XML_RPC_Response($v, $errno, $errstr_v-&gt;scalarval());
+                }
+                else
+                {
+                        $r = new XML_RPC_Response($v);
+                }
+
+                $r-&gt;headers = $this-&gt;xh[$parser]['headers'];
+                return $r;
+        }
+        
+        // ------------------------------------
+        //  Begin Return Message Parsing section
+        // ------------------------------------
+        
+        // quick explanation of components:
+        //   ac - used to accumulate values
+        //   isf - used to indicate a fault
+        //   lv - used to indicate &quot;looking for a value&quot;: implements
+        //                the logic to allow values with no types to be strings
+        //   params - used to store parameters in method calls
+        //   method - used to store method name
+        //         stack - array with parent tree of the xml element,
+        //                         used to validate the nesting of elements
+
+        //-------------------------------------
+        //  Start Element Handler
+        //-------------------------------------
+
+        function open_tag($the_parser, $name, $attrs)
+        {
+                // If invalid nesting, then return
+                if ($this-&gt;xh[$the_parser]['isf'] &gt; 1) return;
+                
+                // Evaluate and check for correct nesting of XML elements
+                
+                if (count($this-&gt;xh[$the_parser]['stack']) == 0)
+                {
+                        if ($name != 'METHODRESPONSE' &amp;&amp; $name != 'METHODCALL')
+                        {
+                                $this-&gt;xh[$the_parser]['isf'] = 2;
+                                $this-&gt;xh[$the_parser]['isf_reason'] = 'Top level XML-RPC element is missing';
+                                return;
+                        }
+                }
+                else
+                {
+                        // not top level element: see if parent is OK
+                        if ( ! in_array($this-&gt;xh[$the_parser]['stack'][0], $this-&gt;valid_parents[$name], TRUE))
+                        {
+                                $this-&gt;xh[$the_parser]['isf'] = 2;
+                                $this-&gt;xh[$the_parser]['isf_reason'] = &quot;XML-RPC element $name cannot be child of &quot;.$this-&gt;xh[$the_parser]['stack'][0];
+                                return;
+                        }
+                }
+                
+                switch($name)
+                {
+                        case 'STRUCT':
+                        case 'ARRAY':
+                                // Creates array for child elements
+                                
+                                $cur_val = array('value' =&gt; array(),
+                                                                 'type'         =&gt; $name);
+                                                                
+                                array_unshift($this-&gt;xh[$the_parser]['valuestack'], $cur_val);
+                        break;
+                        case 'METHODNAME':
+                        case 'NAME':
+                                $this-&gt;xh[$the_parser]['ac'] = '';
+                        break;
+                        case 'FAULT':
+                                $this-&gt;xh[$the_parser]['isf'] = 1;
+                        break;
+                        case 'PARAM':
+                                $this-&gt;xh[$the_parser]['value'] = null;
+                        break;
+                        case 'VALUE':
+                                $this-&gt;xh[$the_parser]['vt'] = 'value';
+                                $this-&gt;xh[$the_parser]['ac'] = '';
+                                $this-&gt;xh[$the_parser]['lv'] = 1;
+                        break;
+                        case 'I4':
+                        case 'INT':
+                        case 'STRING':
+                        case 'BOOLEAN':
+                        case 'DOUBLE':
+                        case 'DATETIME.ISO8601':
+                        case 'BASE64':
+                                if ($this-&gt;xh[$the_parser]['vt'] != 'value')
+                                {
+                                        //two data elements inside a value: an error occurred!
+                                        $this-&gt;xh[$the_parser]['isf'] = 2;
+                                        $this-&gt;xh[$the_parser]['isf_reason'] = &quot;'Twas a $name element following a &quot;.$this-&gt;xh[$the_parser]['vt'].&quot; element inside a single value&quot;;
+                                        return;
+                                }
+                                
+                                $this-&gt;xh[$the_parser]['ac'] = '';
+                        break;
+                        case 'MEMBER':
+                                // Set name of &lt;member&gt; to nothing to prevent errors later if no &lt;name&gt; is found
+                                $this-&gt;xh[$the_parser]['valuestack'][0]['name'] = '';
+                                
+                                // Set NULL value to check to see if value passed for this param/member
+                                $this-&gt;xh[$the_parser]['value'] = null;
+                        break;
+                        case 'DATA':
+                        case 'METHODCALL':
+                        case 'METHODRESPONSE':
+                        case 'PARAMS':
+                                // valid elements that add little to processing
+                        break;
+                        default:
+                                /// An Invalid Element is Found, so we have trouble
+                                $this-&gt;xh[$the_parser]['isf'] = 2;
+                                $this-&gt;xh[$the_parser]['isf_reason'] = &quot;Invalid XML-RPC element found: $name&quot;;
+                        break;
+                }
+                
+                // Add current element name to stack, to allow validation of nesting
+                array_unshift($this-&gt;xh[$the_parser]['stack'], $name);
+
+                if ($name != 'VALUE') $this-&gt;xh[$the_parser]['lv'] = 0;
+        }
+        // END
+
+
+        //-------------------------------------
+        //  End Element Handler
+        //-------------------------------------
+
+        function closing_tag($the_parser, $name)
+        {
+                if ($this-&gt;xh[$the_parser]['isf'] &gt; 1) return;
+                
+                // Remove current element from stack and set variable
+                // NOTE: If the XML validates, then we do not have to worry about
+                // the opening and closing of elements.  Nesting is checked on the opening
+                // tag so we be safe there as well.
+                
+                $curr_elem = array_shift($this-&gt;xh[$the_parser]['stack']);
+        
+                switch($name)
+                {
+                        case 'STRUCT':
+                        case 'ARRAY':
+                                $cur_val = array_shift($this-&gt;xh[$the_parser]['valuestack']);
+                                $this-&gt;xh[$the_parser]['value'] = ( ! isset($cur_val['values'])) ? array() : $cur_val['values'];
+                                $this-&gt;xh[$the_parser]['vt']        = strtolower($name);
+                        break;
+                        case 'NAME':
+                                $this-&gt;xh[$the_parser]['valuestack'][0]['name'] = $this-&gt;xh[$the_parser]['ac'];
+                        break;
+                        case 'BOOLEAN':
+                        case 'I4':
+                        case 'INT':
+                        case 'STRING':
+                        case 'DOUBLE':
+                        case 'DATETIME.ISO8601':
+                        case 'BASE64':
+                                $this-&gt;xh[$the_parser]['vt'] = strtolower($name);
+                                
+                                if ($name == 'STRING')
+                                {
+                                        $this-&gt;xh[$the_parser]['value'] = $this-&gt;xh[$the_parser]['ac'];
+                                }
+                                elseif ($name=='DATETIME.ISO8601')
+                                {
+                                        $this-&gt;xh[$the_parser]['vt']        = $this-&gt;xmlrpcDateTime;
+                                        $this-&gt;xh[$the_parser]['value'] = $this-&gt;xh[$the_parser]['ac'];
+                                }
+                                elseif ($name=='BASE64')
+                                {
+                                        $this-&gt;xh[$the_parser]['value'] = base64_decode($this-&gt;xh[$the_parser]['ac']);
+                                }
+                                elseif ($name=='BOOLEAN')
+                                {
+                                        // Translated BOOLEAN values to TRUE AND FALSE
+                                        if ($this-&gt;xh[$the_parser]['ac'] == '1')
+                                        {
+                                                $this-&gt;xh[$the_parser]['value'] = TRUE;
+                                        }
+                                        else
+                                        {
+                                                $this-&gt;xh[$the_parser]['value'] = FALSE;
+                                        }
+                                }
+                                elseif ($name=='DOUBLE')
+                                {
+                                        // we have a DOUBLE
+                                        // we must check that only 0123456789-.&lt;space&gt; are characters here
+                                        if ( ! preg_match('/^[+-]?[eE0-9\t \.]+$/', $this-&gt;xh[$the_parser]['ac']))
+                                        {
+                                                $this-&gt;xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND';
+                                        }
+                                        else
+                                        {
+                                                $this-&gt;xh[$the_parser]['value'] = (double)$this-&gt;xh[$the_parser]['ac'];
+                                        }
+                                }
+                                else
+                                {
+                                        // we have an I4/INT
+                                        // we must check that only 0123456789-&lt;space&gt; are characters here
+                                        if ( ! preg_match('/^[+-]?[0-9\t ]+$/', $this-&gt;xh[$the_parser]['ac']))
+                                        {
+                                                $this-&gt;xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND';
+                                        }
+                                        else
+                                        {
+                                                $this-&gt;xh[$the_parser]['value'] = (int)$this-&gt;xh[$the_parser]['ac'];
+                                        }
+                                }
+                                $this-&gt;xh[$the_parser]['ac'] = '';
+                                $this-&gt;xh[$the_parser]['lv'] = 3; // indicate we've found a value
+                        break;
+                        case 'VALUE':
+                                // This if() detects if no scalar was inside &lt;VALUE&gt;&lt;/VALUE&gt;
+                                if ($this-&gt;xh[$the_parser]['vt']=='value')
+                                {
+                                        $this-&gt;xh[$the_parser]['value']        = $this-&gt;xh[$the_parser]['ac'];
+                                        $this-&gt;xh[$the_parser]['vt']        = $this-&gt;xmlrpcString;
+                                }
+                                
+                                // build the XML-RPC value out of the data received, and substitute it
+                                $temp = new XML_RPC_Values($this-&gt;xh[$the_parser]['value'], $this-&gt;xh[$the_parser]['vt']);
+                                
+                                if (count($this-&gt;xh[$the_parser]['valuestack']) &amp;&amp; $this-&gt;xh[$the_parser]['valuestack'][0]['type'] == 'ARRAY')
+                                {
+                                        // Array
+                                        $this-&gt;xh[$the_parser]['valuestack'][0]['values'][] = $temp;
+                                }
+                                else
+                                {
+                                        // Struct
+                                        $this-&gt;xh[$the_parser]['value'] = $temp;
+                                }
+                        break;
+                        case 'MEMBER':
+                                $this-&gt;xh[$the_parser]['ac']='';
+                                
+                                // If value add to array in the stack for the last element built
+                                if ($this-&gt;xh[$the_parser]['value'])
+                                {
+                                        $this-&gt;xh[$the_parser]['valuestack'][0]['values'][$this-&gt;xh[$the_parser]['valuestack'][0]['name']] = $this-&gt;xh[$the_parser]['value'];
+                                }
+                        break;
+                        case 'DATA':
+                                $this-&gt;xh[$the_parser]['ac']='';
+                        break;
+                        case 'PARAM':
+                                if ($this-&gt;xh[$the_parser]['value'])
+                                {
+                                        $this-&gt;xh[$the_parser]['params'][] = $this-&gt;xh[$the_parser]['value'];
+                                }
+                        break;
+                        case 'METHODNAME':
+                                $this-&gt;xh[$the_parser]['method'] = ltrim($this-&gt;xh[$the_parser]['ac']);
+                        break;
+                        case 'PARAMS':
+                        case 'FAULT':
+                        case 'METHODCALL':
+                        case 'METHORESPONSE':
+                                // We're all good kids with nuthin' to do
+                        break;
+                        default:
+                                // End of an Invalid Element.  Taken care of during the opening tag though
+                        break;
+                }
+        }
+
+        //-------------------------------------
+        //  Parses Character Data
+        //-------------------------------------
+
+        function character_data($the_parser, $data)
+        {
+                if ($this-&gt;xh[$the_parser]['isf'] &gt; 1) return; // XML Fault found already
+                
+                // If a value has not been found
+                if ($this-&gt;xh[$the_parser]['lv'] != 3)
+                {
+                        if ($this-&gt;xh[$the_parser]['lv'] == 1)
+                        {
+                                $this-&gt;xh[$the_parser]['lv'] = 2; // Found a value
+                        }
+                                
+                        if( ! @isset($this-&gt;xh[$the_parser]['ac']))
+                        {
+                                $this-&gt;xh[$the_parser]['ac'] = '';
+                        }
+                                
+                        $this-&gt;xh[$the_parser]['ac'] .= $data;
+                }
+        }
+        
+        
+        function addParam($par) { $this-&gt;params[]=$par; }
+        
+        function output_parameters($array=FALSE)
+        {
+                $CI =&amp; get_instance();        
+
+                if ($array !== FALSE &amp;&amp; is_array($array))
+                {
+                        while (list($key) = each($array))
+                        {
+                                if (is_array($array[$key]))
+                                {
+                                        $array[$key] = $this-&gt;output_parameters($array[$key]);
+                                }
+                                else
+                                {
+                                        $array[$key] = $CI-&gt;input-&gt;xss_clean($array[$key]);
+                                }
+                        }
+                        
+                        $parameters = $array;
+                }
+                else
+                {
+                        $parameters = array();
+                
+                        for ($i = 0; $i &lt; count($this-&gt;params); $i++)
+                        {
+                                $a_param = $this-&gt;decode_message($this-&gt;params[$i]);
+                                
+                                if (is_array($a_param))
+                                {
+                                        $parameters[] = $this-&gt;output_parameters($a_param);
+                                }
+                                else
+                                {
+                                        $parameters[] = $CI-&gt;input-&gt;xss_clean($a_param);
+                                }
+                        }        
+                }
+                
+                return $parameters;
+        }
+        
+        
+        function decode_message($param)
+        {
+                $kind = $param-&gt;kindOf();
+
+                if($kind == 'scalar')
+                {
+                        return $param-&gt;scalarval();
+                }
+                elseif($kind == 'array')
+                {
+                        reset($param-&gt;me);
+                        list($a,$b) = each($param-&gt;me);
+                        
+                        $arr = array();
+
+                        for($i = 0; $i &lt; count($b); $i++)
+                        {
+                                $arr[] = $this-&gt;decode_message($param-&gt;me['array'][$i]);
+                        }
+                        
+                        return $arr;
+                }
+                elseif($kind == 'struct')
+                {
+                        reset($param-&gt;me['struct']);
+                        
+                        $arr = array();
+
+                        while(list($key,$value) = each($param-&gt;me['struct']))
+                        {
+                                $arr[$key] = $this-&gt;decode_message($value);
+                        }
+                        
+                        return $arr;
+                }
+        }
+        
+} // End XML_RPC_Messages class
+
+
+
+/**
+ * XML-RPC Values class
+ *
+ * @category        XML-RPC
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/xmlrpc.html
+ */
+class XML_RPC_Values extends CI_Xmlrpc
+{
+        var $me         = array();
+        var $mytype        = 0;
+
+        function XML_RPC_Values($val=-1, $type='')
+        {        
+                parent::CI_Xmlrpc();
+                
+                if ($val != -1 OR $type != '')
+                {
+                        $type = $type == '' ? 'string' : $type;
+                        
+                        if ($this-&gt;xmlrpcTypes[$type] == 1)
+                        {
+                                $this-&gt;addScalar($val,$type);
+                        }
+                        elseif ($this-&gt;xmlrpcTypes[$type] == 2)
+                        {
+                                $this-&gt;addArray($val);
+                        }
+                        elseif ($this-&gt;xmlrpcTypes[$type] == 3)
+                        {
+                                $this-&gt;addStruct($val);
+                        }
+                }
+        }
+
+        function addScalar($val, $type='string')
+        {
+                $typeof = $this-&gt;xmlrpcTypes[$type];
+                
+                if ($this-&gt;mytype==1)
+                {
+                        echo '&lt;strong&gt;XML_RPC_Values&lt;/strong&gt;: scalar can have only one value&lt;br /&gt;';
+                        return 0;
+                }
+                
+                if ($typeof != 1)
+                {
+                        echo '&lt;strong&gt;XML_RPC_Values&lt;/strong&gt;: not a scalar type (${typeof})&lt;br /&gt;';
+                        return 0;
+                }
+
+                if ($type == $this-&gt;xmlrpcBoolean)
+                {
+                        if (strcasecmp($val,'true')==0 OR $val==1 OR ($val==true &amp;&amp; strcasecmp($val,'false')))
+                        {
+                                $val = 1;
+                        }
+                        else
+                        {
+                                $val=0;
+                        }
+                }
+
+                if ($this-&gt;mytype == 2)
+                {
+                        // adding to an array here
+                        $ar = $this-&gt;me['array'];
+                        $ar[] = new XML_RPC_Values($val, $type);
+                        $this-&gt;me['array'] = $ar;
+                }
+                else
+                {
+                        // a scalar, so set the value and remember we're scalar
+                        $this-&gt;me[$type] = $val;
+                        $this-&gt;mytype = $typeof;
+                }
+                return 1;
+        }
+
+        function addArray($vals)
+        {
+                if ($this-&gt;mytype != 0)
+                {
+                        echo '&lt;strong&gt;XML_RPC_Values&lt;/strong&gt;: already initialized as a [' . $this-&gt;kindOf() . ']&lt;br /&gt;';
+                        return 0;
+                }
+
+                $this-&gt;mytype = $this-&gt;xmlrpcTypes['array'];
+                $this-&gt;me['array'] = $vals;
+                return 1;
+        }
+
+        function addStruct($vals)
+        {
+                if ($this-&gt;mytype != 0)
+                {
+                        echo '&lt;strong&gt;XML_RPC_Values&lt;/strong&gt;: already initialized as a [' . $this-&gt;kindOf() . ']&lt;br /&gt;';
+                        return 0;
+                }
+                $this-&gt;mytype = $this-&gt;xmlrpcTypes['struct'];
+                $this-&gt;me['struct'] = $vals;
+                return 1;
+        }
+
+        function kindOf()
+        {
+                switch($this-&gt;mytype)
+                {
+                        case 3:
+                                return 'struct';
+                                break;
+                        case 2:
+                                return 'array';
+                                break;
+                        case 1:
+                                return 'scalar';
+                                break;
+                        default:
+                                return 'undef';
+                }
+        }
+
+        function serializedata($typ, $val)
+        {
+                $rs = '';
+                
+                switch($this-&gt;xmlrpcTypes[$typ])
+                {
+                        case 3:
+                                // struct
+                                $rs .= &quot;&lt;struct&gt;\n&quot;;
+                                reset($val);
+                                while(list($key2, $val2) = each($val))
+                                {
+                                        $rs .= &quot;&lt;member&gt;\n&lt;name&gt;{$key2}&lt;/name&gt;\n&quot;;
+                                        $rs .= $this-&gt;serializeval($val2);
+                                        $rs .= &quot;&lt;/member&gt;\n&quot;;
+                                }
+                                $rs .= '&lt;/struct&gt;';
+                        break;
+                        case 2:
+                                // array
+                                $rs .= &quot;&lt;array&gt;\n&lt;data&gt;\n&quot;;
+                                for($i=0; $i &lt; count($val); $i++)
+                                {
+                                        $rs .= $this-&gt;serializeval($val[$i]);
+                                }
+                                $rs.=&quot;&lt;/data&gt;\n&lt;/array&gt;\n&quot;;
+                                break;
+                        case 1:
+                                // others
+                                switch ($typ)
+                                {
+                                        case $this-&gt;xmlrpcBase64:
+                                                $rs .= &quot;&lt;{$typ}&gt;&quot; . base64_encode((string)$val) . &quot;&lt;/{$typ}&gt;\n&quot;;
+                                        break;
+                                        case $this-&gt;xmlrpcBoolean:
+                                                $rs .= &quot;&lt;{$typ}&gt;&quot; . ((bool)$val ? '1' : '0') . &quot;&lt;/{$typ}&gt;\n&quot;;
+                                        break;
+                                        case $this-&gt;xmlrpcString:
+                                                $rs .= &quot;&lt;{$typ}&gt;&quot; . htmlspecialchars((string)$val). &quot;&lt;/{$typ}&gt;\n&quot;;
+                                        break;
+                                        default:
+                                                $rs .= &quot;&lt;{$typ}&gt;{$val}&lt;/{$typ}&gt;\n&quot;;
+                                        break;
+                                }
+                        default:
+                        break;
+                }
+                return $rs;
+        }
+
+        function serialize_class()
+        {
+                return $this-&gt;serializeval($this);
+        }
+
+        function serializeval($o)
+        {
+                $ar = $o-&gt;me;
+                reset($ar);
+                
+                list($typ, $val) = each($ar);
+                $rs = &quot;&lt;value&gt;\n&quot;.$this-&gt;serializedata($typ, $val).&quot;&lt;/value&gt;\n&quot;;
+                return $rs;
+        }
+        
+        function scalarval()
+        {
+                reset($this-&gt;me);
+                list($a,$b) = each($this-&gt;me);
+                return $b;
+        }
+
+
+        //-------------------------------------
+        // Encode time in ISO-8601 form.
+        //-------------------------------------
+        
+        // Useful for sending time in XML-RPC
+
+        function iso8601_encode($time, $utc=0)
+        {        
+                if ($utc == 1)
+                {
+                        $t = strftime(&quot;%Y%m%dT%H:%M:%S&quot;, $time);
+                }
+                else
+                {
+                        if (function_exists('gmstrftime'))
+                                $t = gmstrftime(&quot;%Y%m%dT%H:%M:%S&quot;, $time);
+                        else
+                                $t = strftime(&quot;%Y%m%dT%H:%M:%S&quot;, $time - date('Z'));
+                }
+                return $t;
+        }
+        
+}
+// END XML_RPC_Values Class
+
+/* End of file Xmlrpc.php */
+/* Location: ./system/libraries/Xmlrpc.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesXmlrpcsphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpcs.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpcs.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Xmlrpcs.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,536 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+if ( ! function_exists('xml_parser_create'))
+{        
+        show_error('Your PHP installation does not support XML');
+}
+
+if ( ! class_exists('CI_Xmlrpc'))
+{
+        show_error('You must load the Xmlrpc class before loading the Xmlrpcs class in order to create a server.');
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * XML-RPC server class
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        XML-RPC
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/xmlrpc.html
+ */
+class CI_Xmlrpcs extends CI_Xmlrpc
+{
+        var $methods                = array();         //array of methods mapped to function names and signatures
+        var $debug_msg                = '';                // Debug Message
+        var $system_methods = array(); // XML RPC Server methods
+        var $controller_obj;
+
+        var $object                        = FALSE;
+        
+        
+        //-------------------------------------
+        //  Constructor, more or less
+        //-------------------------------------
+
+        function CI_Xmlrpcs($config=array())
+        {        
+                parent::CI_Xmlrpc();
+                $this-&gt;set_system_methods();
+        
+                if (isset($config['functions']) &amp;&amp; is_array($config['functions']))
+                {
+                        $this-&gt;methods = array_merge($this-&gt;methods, $config['functions']);
+                }
+                
+                log_message('debug', &quot;XML-RPC Server Class Initialized&quot;);
+        }
+        
+        //-------------------------------------
+        //  Initialize Prefs and Serve
+        //-------------------------------------
+        
+        function initialize($config=array())
+        {        
+                if (isset($config['functions']) &amp;&amp; is_array($config['functions']))
+                {
+                        $this-&gt;methods = array_merge($this-&gt;methods, $config['functions']);
+                }
+                
+                if (isset($config['debug']))
+                {
+                        $this-&gt;debug = $config['debug'];
+                }
+                
+                if (isset($config['object']) &amp;&amp; is_object($config['object']))
+                {
+                        $this-&gt;object = $config['object'];
+                }
+        }
+        
+        //-------------------------------------
+        //  Setting of System Methods
+        //-------------------------------------
+        
+        function set_system_methods ()
+        {
+                $this-&gt;methods = array(
+                                        'system.listMethods'         =&gt; array(
+                                                                                                        'function' =&gt; 'this.listMethods',
+                                                                                                        'signature' =&gt; array(array($this-&gt;xmlrpcArray, $this-&gt;xmlrpcString), array($this-&gt;xmlrpcArray)),
+                                                                                                        'docstring' =&gt; 'Returns an array of available methods on this server'),
+                                        'system.methodHelp'                 =&gt; array(
+                                                                                                        'function' =&gt; 'this.methodHelp',
+                                                                                                        'signature' =&gt; array(array($this-&gt;xmlrpcString, $this-&gt;xmlrpcString)),
+                                                                                                        'docstring' =&gt; 'Returns a documentation string for the specified method'),
+                                        'system.methodSignature' =&gt; array(
+                                                                                                        'function' =&gt; 'this.methodSignature',
+                                                                                                        'signature' =&gt; array(array($this-&gt;xmlrpcArray, $this-&gt;xmlrpcString)),
+                                                                                                        'docstring' =&gt; 'Returns an array describing the return type and required parameters of a method'),
+                                        'system.multicall'                 =&gt; array(
+                                                                                                'function' =&gt; 'this.multicall',
+                                                                                                'signature' =&gt; array(array($this-&gt;xmlrpcArray, $this-&gt;xmlrpcArray)),
+                                                                                                'docstring' =&gt; 'Combine multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details')
+                                        );
+        }
+
+
+        //-------------------------------------
+        //  Main Server Function
+        //-------------------------------------
+        
+        function serve()
+        {
+                $r = $this-&gt;parseRequest();
+                $payload  = '&lt;?xml version=&quot;1.0&quot; encoding=&quot;'.$this-&gt;xmlrpc_defencoding.'&quot;?'.'&gt;'.&quot;\n&quot;;
+                $payload .= $this-&gt;debug_msg;
+                $payload .= $r-&gt;prepare_response();
+                
+                header(&quot;Content-Type: text/xml&quot;);
+                header(&quot;Content-Length: &quot;.strlen($payload));
+                exit($payload);
+        }
+
+        //-------------------------------------
+        //  Add Method to Class
+        //-------------------------------------
+        
+        function add_to_map($methodname,$function,$sig,$doc)
+        {
+                $this-&gt;methods[$methodname] = array(
+                        'function'  =&gt; $function,
+                        'signature' =&gt; $sig,
+                        'docstring' =&gt; $doc
+                );
+        }
+
+
+        //-------------------------------------
+        //  Parse Server Request
+        //-------------------------------------
+        
+        function parseRequest($data='')
+        {
+                global $HTTP_RAW_POST_DATA;
+                
+                //-------------------------------------
+                //  Get Data
+                //-------------------------------------
+
+                if ($data == '')
+                {
+                        $data = $HTTP_RAW_POST_DATA;
+                }
+
+                //-------------------------------------
+                //  Set up XML Parser
+                //-------------------------------------
+                
+                $parser = xml_parser_create($this-&gt;xmlrpc_defencoding);
+                $parser_object = new XML_RPC_Message(&quot;filler&quot;);
+                
+                $parser_object-&gt;xh[$parser]                                        = array();
+                $parser_object-&gt;xh[$parser]['isf']                        = 0;
+                $parser_object-&gt;xh[$parser]['isf_reason']        = '';
+                $parser_object-&gt;xh[$parser]['params']                = array();
+                $parser_object-&gt;xh[$parser]['stack']                = array();
+                $parser_object-&gt;xh[$parser]['valuestack']        = array();
+                $parser_object-&gt;xh[$parser]['method']                = '';
+
+                xml_set_object($parser, $parser_object);
+                xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+                xml_set_element_handler($parser, 'open_tag', 'closing_tag');
+                xml_set_character_data_handler($parser, 'character_data');
+                //xml_set_default_handler($parser, 'default_handler');
+                
+                
+                //-------------------------------------
+                //  PARSE + PROCESS XML DATA
+                //-------------------------------------          
+                
+                if ( ! xml_parse($parser, $data, 1))
+                {
+                        // return XML error as a faultCode
+                        $r = new XML_RPC_Response(0,
+                        $this-&gt;xmlrpcerrxml + xml_get_error_code($parser),
+                        sprintf('XML error: %s at line %d',
+                                xml_error_string(xml_get_error_code($parser)),
+                                xml_get_current_line_number($parser)));
+                        xml_parser_free($parser);
+                }
+                elseif($parser_object-&gt;xh[$parser]['isf'])
+                {
+                        return new XML_RPC_Response(0, $this-&gt;xmlrpcerr['invalid_return'], $this-&gt;xmlrpcstr['invalid_return']);
+                }
+                else
+                {
+                        xml_parser_free($parser);
+                        
+                        $m = new XML_RPC_Message($parser_object-&gt;xh[$parser]['method']);
+                        $plist='';
+                        
+                        for($i=0; $i &lt; count($parser_object-&gt;xh[$parser]['params']); $i++)
+                        {
+                                if ($this-&gt;debug === TRUE)
+                                {
+                                        $plist .= &quot;$i - &quot; .  print_r(get_object_vars($parser_object-&gt;xh[$parser]['params'][$i]), TRUE). &quot;;\n&quot;;
+                                }
+                                
+                                $m-&gt;addParam($parser_object-&gt;xh[$parser]['params'][$i]);
+                        }
+                        
+                        if ($this-&gt;debug === TRUE)
+                        {
+                                echo &quot;&lt;pre&gt;&quot;;
+                                echo &quot;---PLIST---\n&quot; . $plist . &quot;\n---PLIST END---\n\n&quot;;
+                                echo &quot;&lt;/pre&gt;&quot;;
+                        }
+                        
+                        $r = $this-&gt;_execute($m);
+                }
+                
+                //-------------------------------------
+                //  SET DEBUGGING MESSAGE
+                //-------------------------------------          
+                
+                if ($this-&gt;debug === TRUE)
+                {
+                        $this-&gt;debug_msg = &quot;&lt;!-- DEBUG INFO:\n\n&quot;.$plist.&quot;\n END DEBUG--&gt;\n&quot;;
+                }
+                
+                return $r;
+        }
+
+        //-------------------------------------
+        //  Executes the Method
+        //-------------------------------------
+        
+        function _execute($m)
+        {
+                $methName = $m-&gt;method_name;
+                
+                // Check to see if it is a system call
+                $system_call = (strncmp($methName, 'system', 5) == 0) ? TRUE : FALSE;
+                
+                //-------------------------------------
+                //  Valid Method
+                //-------------------------------------
+                
+                if ( ! isset($this-&gt;methods[$methName]['function']))
+                {
+                        return new XML_RPC_Response(0, $this-&gt;xmlrpcerr['unknown_method'], $this-&gt;xmlrpcstr['unknown_method']);
+                }
+                
+                //-------------------------------------
+                //  Check for Method (and Object)
+                //-------------------------------------
+                        
+                $method_parts = explode(&quot;.&quot;, $this-&gt;methods[$methName]['function']);
+                $objectCall = (isset($method_parts['1']) &amp;&amp; $method_parts['1'] != &quot;&quot;) ? TRUE : FALSE;
+                
+                if ($system_call === TRUE)
+                {
+                        if ( ! is_callable(array($this,$method_parts['1'])))
+                        {
+                                return new XML_RPC_Response(0, $this-&gt;xmlrpcerr['unknown_method'], $this-&gt;xmlrpcstr['unknown_method']);
+                        }
+                }
+                else
+                {
+                        if ($objectCall &amp;&amp; ! is_callable(array($method_parts['0'],$method_parts['1'])))
+                        {
+                                return new XML_RPC_Response(0, $this-&gt;xmlrpcerr['unknown_method'], $this-&gt;xmlrpcstr['unknown_method']);
+                        }
+                        elseif ( ! $objectCall &amp;&amp; ! is_callable($this-&gt;methods[$methName]['function']))
+                        {
+                                return new XML_RPC_Response(0, $this-&gt;xmlrpcerr['unknown_method'], $this-&gt;xmlrpcstr['unknown_method']);
+                        }
+                }
+                
+                //-------------------------------------
+                //  Checking Methods Signature
+                //-------------------------------------
+                
+                if (isset($this-&gt;methods[$methName]['signature']))
+                {
+                        $sig = $this-&gt;methods[$methName]['signature'];
+                        for($i=0; $i&lt;count($sig); $i++)
+                        {
+                                $current_sig = $sig[$i];
+                
+                                if (count($current_sig) == count($m-&gt;params)+1)
+                                {
+                                        for($n=0; $n &lt; count($m-&gt;params); $n++)
+                                        {
+                                                $p = $m-&gt;params[$n];
+                                                $pt = ($p-&gt;kindOf() == 'scalar') ? $p-&gt;scalarval() : $p-&gt;kindOf();
+                                                
+                                                if ($pt != $current_sig[$n+1])
+                                                {
+                                                        $pno = $n+1;
+                                                        $wanted = $current_sig[$n+1];
+                                                        
+                                                        return new XML_RPC_Response(0,
+                                                                $this-&gt;xmlrpcerr['incorrect_params'],
+                                                                $this-&gt;xmlrpcstr['incorrect_params'] .
+                                                                &quot;: Wanted {$wanted}, got {$pt} at param {$pno})&quot;);
+                                                }
+                                        }
+                                }
+                        }
+                }
+
+                //-------------------------------------
+                //  Calls the Function
+                //-------------------------------------
+
+                if ($objectCall === TRUE)
+                {
+                        if ($method_parts[0] == &quot;this&quot; &amp;&amp; $system_call == TRUE)
+                        {
+                                return call_user_func(array($this, $method_parts[1]), $m);
+                        }
+                        else
+                        {
+                                if ($this-&gt;object === FALSE)
+                                {
+                                        $CI =&amp; get_instance();
+                                        return $CI-&gt;$method_parts['1']($m);
+                                }
+                                else
+                                {
+                                        return $this-&gt;object-&gt;$method_parts['1']($m);
+                                        //return call_user_func(array(&amp;$method_parts['0'],$method_parts['1']), $m);
+                                }
+                        }
+                }
+                else
+                {
+                        return call_user_func($this-&gt;methods[$methName]['function'], $m);
+                }
+        }
+        
+        
+        //-------------------------------------
+        //  Server Function:  List Methods
+        //-------------------------------------
+        
+        function listMethods($m)
+        {
+                $v = new XML_RPC_Values();
+                $output = array();
+                
+                foreach($this-&gt;methods as $key =&gt; $value)
+                {
+                        $output[] = new XML_RPC_Values($key, 'string');
+                }
+                
+                foreach($this-&gt;system_methods as $key =&gt; $value)
+                {
+                        $output[]= new XML_RPC_Values($key, 'string');
+                }
+
+                $v-&gt;addArray($output);
+                return new XML_RPC_Response($v);
+        }
+        
+        //-------------------------------------
+        //  Server Function:  Return Signature for Method
+        //-------------------------------------
+                
+        function methodSignature($m)
+        {
+                $parameters = $m-&gt;output_parameters();
+                $method_name = $parameters[0];
+                
+                if (isset($this-&gt;methods[$method_name]))
+                {
+                        if ($this-&gt;methods[$method_name]['signature'])
+                        {
+                                $sigs = array();
+                                $signature = $this-&gt;methods[$method_name]['signature'];
+                                
+                                for($i=0; $i &lt; count($signature); $i++)
+                                {
+                                        $cursig = array();
+                                        $inSig = $signature[$i];
+                                        for($j=0; $j&lt;count($inSig); $j++)
+                                        {
+                                                $cursig[]= new XML_RPC_Values($inSig[$j], 'string');
+                                        }
+                                        $sigs[]= new XML_RPC_Values($cursig, 'array');
+                                }
+                                $r = new XML_RPC_Response(new XML_RPC_Values($sigs, 'array'));
+                        }
+                        else
+                        {
+                                $r = new XML_RPC_Response(new XML_RPC_Values('undef', 'string'));
+                        }
+                }
+                else
+                {
+                        $r = new XML_RPC_Response(0,$this-&gt;xmlrpcerr['introspect_unknown'], $this-&gt;xmlrpcstr['introspect_unknown']);
+                }
+                return $r;
+        }
+        
+        //-------------------------------------
+        //  Server Function:  Doc String for Method
+        //-------------------------------------
+        
+        function methodHelp($m)
+        {
+                $parameters = $m-&gt;output_parameters();
+                $method_name = $parameters[0];
+        
+                if (isset($this-&gt;methods[$method_name]))
+                {
+                        $docstring = isset($this-&gt;methods[$method_name]['docstring']) ? $this-&gt;methods[$method_name]['docstring'] : '';
+                        
+                        return new XML_RPC_Response(new XML_RPC_Values($docstring, 'string'));
+                }
+                else
+                {
+                        return new XML_RPC_Response(0, $this-&gt;xmlrpcerr['introspect_unknown'], $this-&gt;xmlrpcstr['introspect_unknown']);
+                }
+        }
+
+        //-------------------------------------
+        //  Server Function:  Multi-call
+        //-------------------------------------
+
+        function multicall($m)
+        {
+                // Disabled
+                return new XML_RPC_Response(0, $this-&gt;xmlrpcerr['unknown_method'], $this-&gt;xmlrpcstr['unknown_method']);
+                
+                $parameters = $m-&gt;output_parameters();
+                $calls = $parameters[0];
+
+                $result = array();
+
+                foreach ($calls as $value)
+                {
+                        //$attempt = $this-&gt;_execute(new XML_RPC_Message($value[0], $value[1]));
+                        
+                        $m = new XML_RPC_Message($value[0]);
+                        $plist='';
+                        
+                        for($i=0; $i &lt; count($value[1]); $i++)
+                        {
+                                $m-&gt;addParam(new XML_RPC_Values($value[1][$i], 'string'));
+                        }
+                        
+                        $attempt = $this-&gt;_execute($m);
+
+                        if ($attempt-&gt;faultCode() != 0)
+                        {
+                                return $attempt;
+                        }
+
+                        $result[] = new XML_RPC_Values(array($attempt-&gt;value()), 'array');
+                }
+
+                return new XML_RPC_Response(new XML_RPC_Values($result, 'array'));
+        }
+        
+        
+        //-------------------------------------
+        //  Multi-call Function:  Error Handling
+        //-------------------------------------
+
+        function multicall_error($err)
+        {
+                $str  = is_string($err) ? $this-&gt;xmlrpcstr[&quot;multicall_${err}&quot;] : $err-&gt;faultString();
+                $code = is_string($err) ? $this-&gt;xmlrpcerr[&quot;multicall_${err}&quot;] : $err-&gt;faultCode();
+                
+                $struct['faultCode'] = new XML_RPC_Values($code, 'int');
+                $struct['faultString'] = new XML_RPC_Values($str, 'string');
+        
+                return new XML_RPC_Values($struct, 'struct');
+        }
+        
+        
+        //-------------------------------------
+        //  Multi-call Function:  Processes method
+        //-------------------------------------
+        
+        function do_multicall($call)
+        {
+                if ($call-&gt;kindOf() != 'struct')
+                        return $this-&gt;multicall_error('notstruct');
+                elseif ( ! $methName = $call-&gt;me['struct']['methodName'])
+                        return $this-&gt;multicall_error('nomethod');
+                
+                list($scalar_type,$scalar_value)=each($methName-&gt;me);
+                $scalar_type = $scalar_type == $this-&gt;xmlrpcI4 ? $this-&gt;xmlrpcInt : $scalar_type;
+                        
+                if ($methName-&gt;kindOf() != 'scalar' OR $scalar_type != 'string')
+                        return $this-&gt;multicall_error('notstring');
+                elseif ($scalar_value == 'system.multicall')
+                        return $this-&gt;multicall_error('recursion');
+                elseif ( ! $params = $call-&gt;me['struct']['params'])
+                        return $this-&gt;multicall_error('noparams');
+                elseif ($params-&gt;kindOf() != 'array')
+                        return $this-&gt;multicall_error('notarray');
+                        
+                list($a,$b)=each($params-&gt;me);
+                $numParams = count($b);
+
+                $msg = new XML_RPC_Message($scalar_value);
+                for ($i = 0; $i &lt; $numParams; $i++)
+                {
+                        $msg-&gt;params[] = $params-&gt;me['array'][$i];
+                }
+
+                $result = $this-&gt;_execute($msg);
+
+                if ($result-&gt;faultCode() != 0)
+                {
+                        return $this-&gt;multicall_error($result);
+                }
+
+                return new XML_RPC_Values(array($result-&gt;value()), 'array');
+        }        
+        
+}
+// END XML_RPC_Server class
+
+
+/* End of file Xmlrpcs.php */
+/* Location: ./system/libraries/Xmlrpcs.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesZipphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Zip.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Zip.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/Zip.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,359 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Zip Compression Class
+ *
+ * This class is based on a library I found at Zend:
+ * http://www.zend.com/codex.php?id=696&amp;single=1
+ *
+ * The original library is a little rough around the edges so I
+ * refactored it and added several additional methods -- Rick Ellis
+ *
+ * @package                CodeIgniter
+ * @subpackage        Libraries
+ * @category        Encryption
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/libraries/zip.html
+ */
+class CI_Zip  {
+
+        var $zipdata         = '';
+        var $directory         = '';
+        var $entries         = 0;
+        var $file_num         = 0;
+        var $offset                = 0;
+
+        function CI_Zip()
+        {
+                log_message('debug', &quot;Zip Compression Class Initialized&quot;);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add Directory
+         *
+         * Lets you add a virtual directory into which you can place files.
+         *
+         * @access        public
+         * @param        mixed        the directory name. Can be string or array
+         * @return        void
+         */
+        function add_dir($directory)
+        {
+                foreach ((array)$directory as $dir)
+                {
+                        if ( ! preg_match(&quot;|.+/$|&quot;, $dir))
+                        {
+                                $dir .= '/';
+                        }
+
+                        $this-&gt;_add_dir($dir);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add Directory
+         *
+         * @access        private
+         * @param        string        the directory name
+         * @return        void
+         */
+        function _add_dir($dir)
+        {
+                $dir = str_replace(&quot;\\&quot;, &quot;/&quot;, $dir);
+
+                $this-&gt;zipdata .=
+                        &quot;\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;
+                        .pack('V', 0) // crc32
+                        .pack('V', 0) // compressed filesize
+                        .pack('V', 0) // uncompressed filesize
+                        .pack('v', strlen($dir)) // length of pathname
+                        .pack('v', 0) // extra field length
+                        .$dir
+                        // below is &quot;data descriptor&quot; segment
+                        .pack('V', 0) // crc32
+                        .pack('V', 0) // compressed filesize
+                        .pack('V', 0); // uncompressed filesize
+
+                $this-&gt;directory .=
+                        &quot;\x50\x4b\x01\x02\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;
+                        .pack('V',0) // crc32
+                        .pack('V',0) // compressed filesize
+                        .pack('V',0) // uncompressed filesize
+                        .pack('v', strlen($dir)) // length of pathname
+                        .pack('v', 0) // extra field length
+                        .pack('v', 0) // file comment length
+                        .pack('v', 0) // disk number start
+                        .pack('v', 0) // internal file attributes
+                        .pack('V', 16) // external file attributes - 'directory' bit set
+                        .pack('V', $this-&gt;offset) // relative offset of local header
+                        .$dir;
+
+                $this-&gt;offset = strlen($this-&gt;zipdata);
+                $this-&gt;entries++;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Add Data to Zip
+         *
+         * Lets you add files to the archive. If the path is included
+         * in the filename it will be placed within a directory.  Make
+         * sure you use add_dir() first to create the folder.
+         *
+         * @access        public
+         * @param        mixed
+         * @param        string
+         * @return        void
+         */        
+        function add_data($filepath, $data = NULL)
+        {
+                if (is_array($filepath))
+                {
+                        foreach ($filepath as $path =&gt; $data)
+                        {
+                                $this-&gt;_add_data($path, $data);
+                        }
+                }
+                else
+                {
+                        $this-&gt;_add_data($filepath, $data);
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Add Data to Zip
+         *
+         * @access        private
+         * @param        string        the file name/path
+         * @param        string        the data to be encoded
+         * @return        void
+         */        
+        function _add_data($filepath, $data)
+        {
+                $filepath = str_replace(&quot;\\&quot;, &quot;/&quot;, $filepath);
+
+                $uncompressed_size = strlen($data);
+                $crc32  = crc32($data);
+
+                $gzdata = gzcompress($data);
+                $gzdata = substr($gzdata, 2, -4);
+                $compressed_size = strlen($gzdata);
+
+                $this-&gt;zipdata .=
+                        &quot;\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00\x00\x00\x00\x00&quot;
+                        .pack('V', $crc32)
+                        .pack('V', $compressed_size)
+                        .pack('V', $uncompressed_size)
+                        .pack('v', strlen($filepath)) // length of filename
+                        .pack('v', 0) // extra field length
+                        .$filepath
+                        .$gzdata; // &quot;file data&quot; segment
+
+                $this-&gt;directory .=
+                        &quot;\x50\x4b\x01\x02\x00\x00\x14\x00\x00\x00\x08\x00\x00\x00\x00\x00&quot;
+                        .pack('V', $crc32)
+                        .pack('V', $compressed_size)
+                        .pack('V', $uncompressed_size)
+                        .pack('v', strlen($filepath)) // length of filename
+                        .pack('v', 0) // extra field length
+                        .pack('v', 0) // file comment length
+                        .pack('v', 0) // disk number start
+                        .pack('v', 0) // internal file attributes
+                        .pack('V', 32) // external file attributes - 'archive' bit set
+                        .pack('V', $this-&gt;offset) // relative offset of local header
+                        .$filepath;
+
+                $this-&gt;offset = strlen($this-&gt;zipdata);
+                $this-&gt;entries++;
+                $this-&gt;file_num++;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Read the contents of a file and add it to the zip
+         *
+         * @access        public
+         * @return        bool
+         */        
+        function read_file($path, $preserve_filepath = FALSE)
+        {
+                if ( ! file_exists($path))
+                {
+                        return FALSE;
+                }
+
+                if (FALSE !== ($data = file_get_contents($path)))
+                {
+                        $name = str_replace(&quot;\\&quot;, &quot;/&quot;, $path);
+                        
+                        if ($preserve_filepath === FALSE)
+                        {
+                                $name = preg_replace(&quot;|.*/(.+)|&quot;, &quot;\\1&quot;, $name);
+                        }
+
+                        $this-&gt;add_data($name, $data);
+                        return TRUE;
+                }
+                return FALSE;
+        }
+
+        // ------------------------------------------------------------------------
+        
+        /**
+         * Read a directory and add it to the zip.
+         *
+         * This function recursively reads a folder and everything it contains (including
+         * sub-folders) and creates a zip based on it.  Whatever directory structure
+         * is in the original file path will be recreated in the zip file.
+         *
+         * @access        public
+         * @param        string        path to source
+         * @return        bool
+         */        
+        function read_dir($path)
+        {        
+                if ($fp = @opendir($path))
+                {
+                        while (FALSE !== ($file = readdir($fp)))
+                        {
+                                if (@is_dir($path.$file) &amp;&amp; substr($file, 0, 1) != '.')
+                                {                                        
+                                        $this-&gt;read_dir($path.$file.&quot;/&quot;);
+                                }
+                                elseif (substr($file, 0, 1) != &quot;.&quot;)
+                                {
+                                        if (FALSE !== ($data = file_get_contents($path.$file)))
+                                        {                                                
+                                                $this-&gt;add_data(str_replace(&quot;\\&quot;, &quot;/&quot;, $path).$file, $data);
+                                        }
+                                }
+                        }
+                        return TRUE;
+                }
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Get the Zip file
+         *
+         * @access        public
+         * @return        binary string
+         */        
+        function get_zip()
+        {
+                // Is there any data to return?
+                if ($this-&gt;entries == 0)
+                {
+                        return FALSE;
+                }
+
+                $zip_data = $this-&gt;zipdata;
+                $zip_data .= $this-&gt;directory.&quot;\x50\x4b\x05\x06\x00\x00\x00\x00&quot;;
+                $zip_data .= pack('v', $this-&gt;entries); // total # of entries &quot;on this disk&quot;
+                $zip_data .= pack('v', $this-&gt;entries); // total # of entries overall
+                $zip_data .= pack('V', strlen($this-&gt;directory)); // size of central dir
+                $zip_data .= pack('V', strlen($this-&gt;zipdata)); // offset to start of central dir
+                $zip_data .= &quot;\x00\x00&quot;; // .zip file comment length
+
+                return $zip_data;
+        }
+        
+        // --------------------------------------------------------------------
+
+        /**
+         * Write File to the specified directory
+         *
+         * Lets you write a file
+         *
+         * @access        public
+         * @param        string        the file name
+         * @return        bool
+         */        
+        function archive($filepath)
+        {
+                if ( ! ($fp = @fopen($filepath, FOPEN_WRITE_CREATE_DESTRUCTIVE)))
+                {
+                        return FALSE;
+                }
+
+                flock($fp, LOCK_EX);        
+                fwrite($fp, $this-&gt;get_zip());
+                flock($fp, LOCK_UN);
+                fclose($fp);
+
+                return TRUE;        
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Download
+         *
+         * @access        public
+         * @param        string        the file name
+         * @param        string        the data to be encoded
+         * @return        bool
+         */
+        function download($filename = 'backup.zip')
+        {
+                if ( ! preg_match(&quot;|.+?\.zip$|&quot;, $filename))
+                {
+                        $filename .= '.zip';
+                }
+
+                $zip_content =&amp; $this-&gt;get_zip();
+
+                $CI =&amp; get_instance();
+                $CI-&gt;load-&gt;helper('download');
+
+                force_download($filename, $zip_content);
+        }
+
+        // --------------------------------------------------------------------
+
+        /**
+         * Initialize Data
+         *
+         * Lets you clear current zip data.  Useful if you need to create
+         * multiple zips with different data.
+         *
+         * @access        public
+         * @return        void
+         */                
+        function clear_data()
+        {
+                $this-&gt;zipdata                = '';
+                $this-&gt;directory        = '';
+                $this-&gt;entries                = 0;
+                $this-&gt;file_num                = 0;
+                $this-&gt;offset                = 0;
+        }
+        
+}
+
+/* End of file Zip.php */
+/* Location: ./system/libraries/Zip.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlibrariesindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/libraries/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemlogsindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/logs/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/logs/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/logs/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystempluginscaptcha_piphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/captcha_pi.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/captcha_pi.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/captcha_pi.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,356 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/*
+Instructions:
+
+Load the plugin using:
+
+         $this-&gt;load-&gt;plugin('captcha');
+
+Once loaded you can generate a captcha like this:
+        
+        $vals = array(
+                                        'word'                 =&gt; 'Random word',
+                                        'img_path'         =&gt; './captcha/',
+                                        'img_url'         =&gt; 'http://example.com/captcha/',
+                                        'font_path'         =&gt; './system/fonts/texb.ttf',
+                                        'img_width'         =&gt; '150',
+                                        'img_height' =&gt; 30,
+                                        'expiration' =&gt; 7200
+                                );
+        
+        $cap = create_captcha($vals);
+        echo $cap['image'];
+        
+
+NOTES:
+        
+        The captcha function requires the GD image library.
+        
+        Only the img_path and img_url are required.
+        
+        If a &quot;word&quot; is not supplied, the function will generate a random
+        ASCII string.  You might put together your own word library that
+        you can draw randomly from.
+        
+        If you do not specify a path to a TRUE TYPE font, the native ugly GD
+        font will be used.
+        
+        The &quot;captcha&quot; folder must be writable (666, or 777)
+        
+        The &quot;expiration&quot; (in seconds) signifies how long an image will
+        remain in the captcha folder before it will be deleted.  The default
+        is two hours.
+
+RETURNED DATA
+
+The create_captcha() function returns an associative array with this data:
+
+  [array]
+  (
+        'image' =&gt; IMAGE TAG
+        'time'        =&gt; TIMESTAMP (in microtime)
+        'word'        =&gt; CAPTCHA WORD
+  )
+
+The &quot;image&quot; is the actual image tag:
+&lt;img src=&quot;http://example.com/captcha/12345.jpg&quot; width=&quot;140&quot; height=&quot;50&quot; /&gt;
+
+The &quot;time&quot; is the micro timestamp used as the image name without the file
+extension.  It will be a number like this:  1139612155.3422
+
+The &quot;word&quot; is the word that appears in the captcha image, which if not
+supplied to the function, will be a random string.
+
+
+ADDING A DATABASE
+
+In order for the captcha function to prevent someone from posting, you will need
+to add the information returned from create_captcha() function to your database.
+Then, when the data from the form is submitted by the user you will need to verify
+that the data exists in the database and has not expired.
+
+Here is a table prototype:
+
+        CREATE TABLE captcha (
+         captcha_id bigint(13) unsigned NOT NULL auto_increment,
+         captcha_time int(10) unsigned NOT NULL,
+         ip_address varchar(16) default '0' NOT NULL,
+         word varchar(20) NOT NULL,
+         PRIMARY KEY `captcha_id` (`captcha_id`),
+         KEY `word` (`word`)
+        )
+
+
+Here is an example of usage with a DB.
+
+On the page where the captcha will be shown you'll have something like this:
+
+        $this-&gt;load-&gt;plugin('captcha');
+        $vals = array(
+                                        'img_path'         =&gt; './captcha/',
+                                        'img_url'         =&gt; 'http://example.com/captcha/'
+                                );
+        
+        $cap = create_captcha($vals);
+
+        $data = array(
+                                        'captcha_id'        =&gt; '',
+                                        'captcha_time'        =&gt; $cap['time'],
+                                        'ip_address'        =&gt; $this-&gt;input-&gt;ip_address(),
+                                        'word'                        =&gt; $cap['word']
+                                );
+
+        $query = $this-&gt;db-&gt;insert_string('captcha', $data);
+        $this-&gt;db-&gt;query($query);
+                
+        echo 'Submit the word you see below:';
+        echo $cap['image'];
+        echo '&lt;input type=&quot;text&quot; name=&quot;captcha&quot; value=&quot;&quot; /&gt;';
+
+
+Then, on the page that accepts the submission you'll have something like this:
+
+        // First, delete old captchas
+        $expiration = time()-7200; // Two hour limit
+        $DB-&gt;query(&quot;DELETE FROM captcha WHERE captcha_time &lt; &quot;.$expiration);                
+
+        // Then see if a captcha exists:
+        $sql = &quot;SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND date &gt; ?&quot;;
+        $binds = array($_POST['captcha'], $this-&gt;input-&gt;ip_address(), $expiration);
+        $query = $this-&gt;db-&gt;query($sql, $binds);
+        $row = $query-&gt;row();
+
+        if ($row-&gt;count == 0)
+        {
+                echo &quot;You must submit the word that appears in the image&quot;;
+        }
+
+*/
+
+
+        
+/**
+|==========================================================
+| Create Captcha
+|==========================================================
+|
+*/
+function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
+{                
+        $defaults = array('word' =&gt; '', 'img_path' =&gt; '', 'img_url' =&gt; '', 'img_width' =&gt; '150', 'img_height' =&gt; '30', 'font_path' =&gt; '', 'expiration' =&gt; 7200);                
+        
+        foreach ($defaults as $key =&gt; $val)
+        {
+                if ( ! is_array($data))
+                {
+                        if ( ! isset($$key) OR $$key == '')
+                        {
+                                $$key = $val;
+                        }
+                }
+                else
+                {                        
+                        $$key = ( ! isset($data[$key])) ? $val : $data[$key];
+                }
+        }
+        
+        if ($img_path == '' OR $img_url == '')
+        {
+                return FALSE;
+        }
+
+        if ( ! @is_dir($img_path))
+        {
+                return FALSE;
+        }
+        
+        if ( ! is_really_writable($img_path))
+        {
+                return FALSE;
+        }
+                        
+        if ( ! extension_loaded('gd'))
+        {
+                return FALSE;
+        }                
+        
+        // -----------------------------------
+        // Remove old images        
+        // -----------------------------------
+                        
+        list($usec, $sec) = explode(&quot; &quot;, microtime());
+        $now = ((float)$usec + (float)$sec);
+                        
+        $current_dir = @opendir($img_path);
+        
+        while($filename = @readdir($current_dir))
+        {
+                if ($filename != &quot;.&quot; and $filename != &quot;..&quot; and $filename != &quot;index.html&quot;)
+                {
+                        $name = str_replace(&quot;.jpg&quot;, &quot;&quot;, $filename);
+                
+                        if (($name + $expiration) &lt; $now)
+                        {
+                                @unlink($img_path.$filename);
+                        }
+                }
+        }
+        
+        @closedir($current_dir);
+
+        // -----------------------------------
+        // Do we have a &quot;word&quot; yet?
+        // -----------------------------------
+        
+   if ($word == '')
+   {
+                $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+
+                $str = '';
+                for ($i = 0; $i &lt; 8; $i++)
+                {
+                        $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
+                }
+                
+                $word = $str;
+   }
+        
+        // -----------------------------------
+        // Determine angle and position        
+        // -----------------------------------
+        
+        $length        = strlen($word);
+        $angle        = ($length &gt;= 6) ? rand(-($length-6), ($length-6)) : 0;
+        $x_axis        = rand(6, (360/$length)-16);                        
+        $y_axis = ($angle &gt;= 0 ) ? rand($img_height, $img_width) : rand(6, $img_height);
+        
+        // -----------------------------------
+        // Create image
+        // -----------------------------------
+                        
+        // PHP.net recommends imagecreatetruecolor(), but it isn't always available
+        if (function_exists('imagecreatetruecolor'))
+        {
+                $im = imagecreatetruecolor($img_width, $img_height);
+        }
+        else
+        {
+                $im = imagecreate($img_width, $img_height);
+        }
+                        
+        // -----------------------------------
+        //  Assign colors
+        // -----------------------------------
+        
+        $bg_color                = imagecolorallocate ($im, 255, 255, 255);
+        $border_color        = imagecolorallocate ($im, 153, 102, 102);
+        $text_color                = imagecolorallocate ($im, 204, 153, 153);
+        $grid_color                = imagecolorallocate($im, 255, 182, 182);
+        $shadow_color        = imagecolorallocate($im, 255, 240, 240);
+
+        // -----------------------------------
+        //  Create the rectangle
+        // -----------------------------------
+        
+        ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
+        
+        // -----------------------------------
+        //  Create the spiral pattern
+        // -----------------------------------
+        
+        $theta                = 1;
+        $thetac                = 7;
+        $radius                = 16;
+        $circles        = 20;
+        $points                = 32;
+
+        for ($i = 0; $i &lt; ($circles * $points) - 1; $i++)
+        {
+                $theta = $theta + $thetac;
+                $rad = $radius * ($i / $points );
+                $x = ($rad * cos($theta)) + $x_axis;
+                $y = ($rad * sin($theta)) + $y_axis;
+                $theta = $theta + $thetac;
+                $rad1 = $radius * (($i + 1) / $points);
+                $x1 = ($rad1 * cos($theta)) + $x_axis;
+                $y1 = ($rad1 * sin($theta )) + $y_axis;
+                imageline($im, $x, $y, $x1, $y1, $grid_color);
+                $theta = $theta - $thetac;
+        }
+
+        // -----------------------------------
+        //  Write the text
+        // -----------------------------------
+        
+        $use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
+                
+        if ($use_font == FALSE)
+        {
+                $font_size = 5;
+                $x = rand(0, $img_width/($length/3));
+                $y = 0;
+        }
+        else
+        {
+                $font_size        = 16;
+                $x = rand(0, $img_width/($length/1.5));
+                $y = $font_size+2;
+        }
+
+        for ($i = 0; $i &lt; strlen($word); $i++)
+        {
+                if ($use_font == FALSE)
+                {
+                        $y = rand(0 , $img_height/2);
+                        imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
+                        $x += ($font_size*2);
+                }
+                else
+                {                
+                        $y = rand($img_height/2, $img_height-3);
+                        imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
+                        $x += $font_size;
+                }
+        }
+        
+
+        // -----------------------------------
+        //  Create the border
+        // -----------------------------------
+
+        imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);                
+
+        // -----------------------------------
+        //  Generate the image
+        // -----------------------------------
+        
+        $img_name = $now.'.jpg';
+
+        ImageJPEG($im, $img_path.$img_name);
+        
+        $img = &quot;&lt;img src=\&quot;$img_url$img_name\&quot; width=\&quot;$img_width\&quot; height=\&quot;$img_height\&quot; style=\&quot;border:0;\&quot; alt=\&quot; \&quot; /&gt;&quot;;
+        
+        ImageDestroy($im);
+                
+        return array('word' =&gt; $word, 'time' =&gt; $now, 'image' =&gt; $img);
+}
+
+
+/* End of file captcha_pi.php */
+/* Location: ./system/plugins/captcha_pi.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystempluginsindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystempluginsjs_calendar_piphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/js_calendar_pi.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/js_calendar_pi.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/plugins/js_calendar_pi.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,629 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/*
+Instructions:
+
+Load the plugin using:
+
+         $this-&gt;load-&gt;plugin('js_calendar');
+
+Once loaded you'll add the calendar script to the &lt;head&gt; of your page like this:
+
+&lt;?php echo js_calendar_script('my_form');  ?&gt;
+
+The above function will be passed the name of your form.
+
+Then to show the actual calendar you'll do this:
+
+&lt;?php echo js_calendar_write('entry_date', time(), true);?&gt;
+&lt;form name=&quot;my_form&quot;&gt;
+&lt;input type=&quot;text&quot; name=&quot;entry_date&quot; value=&quot;&quot; onblur=&quot;update_calendar(this.name, this.value);&quot; /&gt;
+&lt;p&gt;&lt;a href=&quot;javascript:void(0);&quot; onClick=&quot;set_to_time('entry_date', '&lt;?php echo time();?&gt;')&quot; &gt;Today&lt;/a&gt;&lt;/p&gt;
+&lt;/form&gt;
+
+
+Note:  The first parameter is the name of the field containing your date, the second parameter contains the &quot;now&quot; time,
+and the third tells the calendar whether to highlight the current day or not.
+
+Lastly, you'll need some CSS for your calendar:
+
+.calendar {
+        border: 1px #6975A3 solid;
+        background-color: transparent;
+}
+.calheading {
+        background-color: #7C8BC0;
+        color: #fff;
+        font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+        font-size: 11px;
+        font-weight: bold;
+        text-align: center;
+}
+.calnavleft {
+        background-color: #7C8BC0;
+        font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+        font-size: 10px;
+        font-weight: bold;
+        color: #fff;
+        padding: 4px;
+        cursor: pointer;
+}
+.calnavright {
+        background-color: #7C8BC0;
+        font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+        font-size: 10px;
+        font-weight: bold;
+        color: #fff;
+        text-align:  right;
+        padding: 4px;
+        cursor: pointer;
+}
+.caldayheading {
+        background-color: #000;
+        color: #fff;
+        font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+        font-size: 10px;
+        text-align: center;
+        padding: 6px 2px 6px 2px;
+}
+.caldaycells{
+        color: #000;
+        background-color: #D1D7E6;
+        font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+        font-size: 11px;
+        text-align: center;
+        padding: 4px;
+        border: 1px #E0E5F1 solid;
+        cursor: pointer;
+}
+.caldaycellhover{
+        color: #fff;
+        background-color: #B3BCD4;
+        font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+        font-size: 11px;
+        text-align: center;
+        padding: 4px;
+        border: 1px #B3BCD4 solid;
+        cursor: pointer;
+}
+.caldayselected{
+        background-color: #737FAC;
+        color:        #fff;
+        font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+        font-size: 11px;
+        font-weight: bold;
+        text-align: center;
+        border: 1px #566188 solid;
+        padding: 3px;
+        cursor: pointer;
+}
+.calblanktop {
+        background-color: #fff;
+        padding: 4px;
+}
+.calblankbot {
+        background-color: #fff;
+        padding: 4px;
+}
+
+
+*/
+
+function js_calendar_script($form_name = 'entryform')
+{                
+$CI =&amp; get_instance();
+$CI-&gt;load-&gt;language('calendar');
+ob_start();
+?&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+&lt;!--
+var form_name        = &quot;&lt;?php echo $form_name; ?&gt;&quot;;
+var format                = 'us'; // eu or us
+var days                = new Array(
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_su');?&gt;', // Sunday, short name
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_mo');?&gt;', // Monday, short name
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_tu');?&gt;', // Tuesday, short name
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_wed');?&gt;', // Wednesday, short name
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_thu');?&gt;', // Thursday, short name
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_fri');?&gt;', // Friday, short name
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_sat');?&gt;' // Saturday, short name
+                                );
+var months                = new Array(
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_january');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_february');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_march');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_april');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_mayl');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_june');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_july');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_august');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_september');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_october');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_november');?&gt;',
+                                        '&lt;?php echo $CI-&gt;lang-&gt;line('cal_december');?&gt;'
+                                );
+var last_click        = new Array();
+var current_month  = '';
+var current_year   = '';
+var last_date  = '';
+        
+function calendar(id, d, highlight, adjusted)
+{                
+        if (adjusted == undefined)
+        {        
+                var d = new Date(d * 1000);
+        }
+
+        this.id                        = id;
+        this.highlight        = highlight;
+        this.date_obj        = d;
+        this.write                = build_calendar;
+        this.total_days        = total_days;
+        this.month                = d.getMonth();
+        this.date                = d.getDate();
+        this.day                = d.getDay();
+        this.year                = d.getFullYear();
+        this.hours                = d.getHours();
+        this.minutes        = d.getMinutes();
+        this.seconds        = d.getSeconds();
+        this.date_str        = date_str;
+                                
+        if (highlight == false)
+        {
+                this.selected_date = '';
+        }
+        else
+        {
+                this.selected_date = this.year + '' + this.month + '' + this.date;
+        }
+                        
+        //        Set the &quot;selected date&quot;
+        d.setDate(1);
+        this.firstDay = d.getDay();
+        
+        //then reset the date object to the correct date
+        d.setDate(this.date);
+}
+                
+//        Build the body of the calendar
+function build_calendar()
+{
+        var str = '';
+        
+        //        Calendar Heading
+        
+        str += '&lt;div id=&quot;cal' + this.id + '&quot;&gt;';
+        str += '&lt;table class=&quot;calendar&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; &gt;';
+        str += '&lt;tr&gt;';
+        str += '&lt;td class=&quot;calnavleft&quot; onClick=&quot;change_month(-1, \'' + this.id + '\')&quot;&gt;&amp;lt;&amp;lt;&lt;\/td&gt;';
+        str += '&lt;td colspan=&quot;5&quot; class=&quot;calheading&quot;&gt;' + months[this.month] + ' ' + this.year + '&lt;\/td&gt;';
+        str += '&lt;td class=&quot;calnavright&quot; onClick=&quot;change_month(1, \'' + this.id + '\')&quot;&gt;&amp;gt;&amp;gt;&lt;\/td&gt;';
+        str += '&lt;\/tr&gt;';
+        
+        //        Day Names
+        
+        str += '&lt;tr&gt;';
+        
+        for (i = 0; i &lt; 7; i++)
+        {
+                str += '&lt;td class=&quot;caldayheading&quot;&gt;' + days[i] + '&lt;\/td&gt;';
+        }
+        
+        str += '&lt;\/tr&gt;';
+        
+        //        Day Cells
+                
+        str += '&lt;tr&gt;';
+        
+        selDate = (last_date != '') ? last_date : this.date;
+        
+        for (j = 0; j &lt; 42; j++)
+        {
+                var displayNum = (j - this.firstDay + 1);
+                
+                if (j &lt; this.firstDay) // leading empty cells
+                {
+                        str += '&lt;td class=&quot;calblanktop&quot;&gt;&amp;nbsp;&lt;\/td&gt;';
+                }
+                else if (displayNum == selDate &amp;&amp; this.highlight == true) // Selected date
+                {
+                        str += '&lt;td id=&quot;' + this.id +'selected&quot; class=&quot;caldayselected&quot; onClick=&quot;set_date(this,\'' + this.id + '\')&quot;&gt;' + displayNum + '&lt;\/td&gt;';
+                }
+                else if (displayNum &gt; this.total_days())
+                {
+                        str += '&lt;td class=&quot;calblankbot&quot;&gt;&amp;nbsp;&lt;\/td&gt;'; // trailing empty cells
+                }
+                else  // Unselected days
+                {
+                        str += '&lt;td id=&quot;&quot; class=&quot;caldaycells&quot; onClick=&quot;set_date(this,\'' + this.id + '\'); return false;&quot;  onMouseOver=&quot;javascript:cell_highlight(this,\'' + displayNum + '\',\'' + this.id + '\');&quot; onMouseOut=&quot;javascript:cell_reset(this,\'' + displayNum + '\',\'' + this.id + '\');&quot; &gt;' + displayNum + '&lt;\/td&gt;';
+                }
+                
+                if (j % 7 == 6)
+                {
+                        str += '&lt;\/tr&gt;&lt;tr&gt;';
+                }
+        }
+
+        str += '&lt;\/tr&gt;';        
+        str += '&lt;\/table&gt;';
+        str += '&lt;\/div&gt;';
+        
+        return str;
+}
+
+//        Total number of days in a month
+function total_days()
+{        
+        switch(this.month)
+        {
+                case 1: // Check for leap year
+                        if ((  this.date_obj.getFullYear() % 4 == 0
+                                &amp;&amp; this.date_obj.getFullYear() % 100 != 0)
+                                || this.date_obj.getFullYear() % 400 == 0)
+                                return 29;
+                        else
+                                return 28;
+                case 3:
+                        return 30;
+                case 5:
+                        return 30;
+                case 8:
+                        return 30;
+                case 10:
+                        return 30
+                default:
+                        return 31;
+        }
+}
+
+//        Highlight Cell on Mouseover
+function cell_highlight(td, num, cal)
+{
+        cal = eval(cal);
+
+        if (last_click[cal.id]  != num)
+        {
+                td.className = &quot;caldaycellhover&quot;;
+        }
+}                
+
+//        Reset Cell on MouseOut
+function cell_reset(td, num, cal)
+{        
+        cal = eval(cal);
+
+        if (last_click[cal.id] == num)
+        {
+                td.className = &quot;caldayselected&quot;;
+        }
+        else
+        {
+                td.className = &quot;caldaycells&quot;;
+        }
+}                
+
+//        Clear Field
+function clear_field(id)
+{                                
+        eval(&quot;document.&quot; + form_name + &quot;.&quot; + id + &quot;.value = ''&quot;);
+        
+        document.getElementById(id + &quot;selected&quot;).className = &quot;caldaycells&quot;;
+        document.getElementById(id + &quot;selected&quot;).id = &quot;&quot;;        
+        
+        cal = eval(id);
+        cal.selected_date = '';                
+}                
+
+
+//        Set date to specified time
+function set_to_time(id, raw)
+{                        
+        if (document.getElementById(id + &quot;selected&quot;))
+        {                        
+                document.getElementById(id + &quot;selected&quot;).className = &quot;caldaycells&quot;;
+                document.getElementById(id + &quot;selected&quot;).id = &quot;&quot;;        
+        }
+        
+        document.getElementById('cal' + id).innerHTML = '&lt;div id=&quot;tempcal'+id+'&quot;&gt;&amp;nbsp;&lt;'+'/div&gt;';                                
+                
+        var nowDate = new Date();
+        nowDate.setTime = raw * 1000;
+        
+        current_month        = nowDate.getMonth();
+        current_year        = nowDate.getFullYear();
+        current_date        = nowDate.getDate();
+        
+        oldcal = eval(id);
+        oldcal.selected_date = current_year + '' + current_month + '' + current_date;                                
+
+        cal = new calendar(id, nowDate, true, true);                
+        cal.selected_date = current_year + '' + current_month + '' + current_date;        
+        
+        last_date = cal.date;
+        
+        document.getElementById('tempcal'+id).innerHTML = cal.write();        
+        
+        insert_date(cal);
+}
+
+//        Set date to what is in the field
+var lastDates = new Array();
+
+function update_calendar(id, dateValue)
+{
+        if (lastDates[id] == dateValue) return;
+        
+        lastDates[id] = dateValue;
+        
+        var fieldString = dateValue.replace(/\s+/g, ' ');
+        
+        while (fieldString.substring(0,1) == ' ')
+        {
+                fieldString = fieldString.substring(1, fieldString.length);
+        }
+        
+        var dateString = fieldString.split(' ');
+        var dateParts = dateString[0].split('-')
+
+        if (dateParts.length &lt; 3) return;
+        var newYear  = dateParts[0];
+        var newMonth = dateParts[1];
+        var newDay   = dateParts[2];
+        
+        if (isNaN(newDay)  || newDay &lt; 1 || (newDay.length != 1 &amp;&amp; newDay.length != 2)) return;
+        if (isNaN(newYear) || newYear &lt; 1 || newYear.length != 4) return;
+        if (isNaN(newMonth) || newMonth &lt; 1 || (newMonth.length != 1 &amp;&amp; newMonth.length != 2)) return;
+        
+        if (newMonth &gt; 12) newMonth = 12;
+        
+        if (newDay &gt; 28)
+        {
+                switch(newMonth - 1)
+                {
+                        case 1: // Check for leap year
+                                if ((newYear % 4 == 0 &amp;&amp; newYear % 100 != 0) || newYear % 400 == 0)
+                                {
+                                        if (newDay &gt; 29) newDay = 29;
+                                }
+                                else
+                                {
+                                        if (newDay &gt; 28) newDay = 28;
+                                }
+                        case 3:
+                                if (newDay &gt; 30) newDay = 30;
+                        case 5:
+                                if (newDay &gt; 30) newDay = 30;
+                        case 8:
+                                if (newDay &gt; 30) newDay = 30;
+                        case 10:
+                                if (newDay &gt; 30) newDay = 30;
+                        default:
+                                if (newDay &gt; 31) newDay = 31;
+                }
+        }
+        
+        if (document.getElementById(id + &quot;selected&quot;))
+        {                        
+                document.getElementById(id + &quot;selected&quot;).className = &quot;caldaycells&quot;;
+                document.getElementById(id + &quot;selected&quot;).id = &quot;&quot;;        
+        }
+        
+        document.getElementById('cal' + id).innerHTML = '&lt;div id=&quot;tempcal'+id+'&quot;&gt;&amp;nbsp;&lt;'+'/div&gt;';                                
+                
+        var nowDate = new Date();
+        nowDate.setDate(newDay);
+        nowDate.setMonth(newMonth - 1);
+        nowDate.setYear(newYear);
+        nowDate.setHours(12);
+        
+        current_month        = nowDate.getMonth();
+        current_year        = nowDate.getFullYear();
+
+        cal = new calendar(id, nowDate, true, true);                                                
+        document.getElementById('tempcal'+id).innerHTML = cal.write();        
+}
+
+//        Set the date
+function set_date(td, cal)
+{                                        
+
+        cal = eval(cal);
+        
+        // If the user is clicking a cell that is already
+        // selected we'll de-select it and clear the form field
+        
+        if (last_click[cal.id] == td.firstChild.nodeValue)
+        {
+                td.className = &quot;caldaycells&quot;;
+                last_click[cal.id] = '';
+                remove_date(cal);
+                cal.selected_date =  '';
+                return;
+        }
+                                
+        // Onward!
+        if (document.getElementById(cal.id + &quot;selected&quot;))
+        {
+                document.getElementById(cal.id + &quot;selected&quot;).className = &quot;caldaycells&quot;;
+                document.getElementById(cal.id + &quot;selected&quot;).id = &quot;&quot;;
+        }
+                                                                        
+        td.className = &quot;caldayselected&quot;;
+        td.id = cal.id + &quot;selected&quot;;
+
+        cal.selected_date = cal.date_obj.getFullYear() + '' + cal.date_obj.getMonth() + '' + cal.date;                        
+        cal.date_obj.setDate(td.firstChild.nodeValue);
+        cal = new calendar(cal.id, cal.date_obj, true, true);
+        cal.selected_date = cal.date_obj.getFullYear() + '' + cal.date_obj.getMonth() + '' + cal.date;                        
+        
+        last_date = cal.date;
+
+        //cal.date
+        last_click[cal.id] = cal.date;
+                                
+        // Insert the date into the form
+        insert_date(cal);
+}
+/*
+//        Insert the date into the form field
+function insert_date(cal)
+{
+        cal = eval(cal);
+        fval = eval(&quot;document.&quot; + form_name + &quot;.&quot; + cal.id);        
+        
+        if (fval.value == '')
+        {
+                fval.value = cal.date_str('y');
+        }
+        else
+        {
+                time = fval.value.substring(10);
+                new_date = cal.date_str('n') + time;
+                fval.value = new_date;
+        }        
+}
+*/                
+//        Remove the date from the form field
+function remove_date(cal)
+{
+        cal = eval(cal);
+        fval = eval(&quot;document.&quot; + form_name + &quot;.&quot; + cal.id);        
+        fval.value = '';
+}
+
+//        Change to a new month
+function change_month(mo, cal)
+{                
+        cal = eval(cal);
+
+        if (current_month != '')
+        {
+                cal.date_obj.setMonth(current_month);
+                cal.date_obj.setYear(current_year);
+        
+                current_month        = '';
+                current_year        = '';
+        }
+                                
+        var newMonth = cal.date_obj.getMonth() + mo;
+        var newDate  = cal.date_obj.getDate();
+        
+        if (newMonth == 12)
+        {
+                cal.date_obj.setYear(cal.date_obj.getFullYear() + 1)
+                newMonth = 0;
+        }
+        else if (newMonth == -1)
+        {
+                cal.date_obj.setYear(cal.date_obj.getFullYear() - 1)
+                newMonth = 11;
+        }
+        
+        if (newDate &gt; 28)
+        {
+                var newYear = cal.date_obj.getFullYear();
+                
+                switch(newMonth)
+                {
+                        case 1: // Check for leap year
+                                if ((newYear % 4 == 0 &amp;&amp; newYear % 100 != 0) || newYear % 400 == 0)
+                                {
+                                        if (newDate &gt; 29) newDate = 29;
+                                }
+                                else
+                                {
+                                        if (newDate &gt; 28) newDate = 28;
+                                }
+                        case 3:
+                                if (newDate &gt; 30) newDate = 30;
+                        case 5:
+                                if (newDate &gt; 30) newDate = 30;
+                        case 8:
+                                if (newDate &gt; 30) newDate = 30;
+                        case 10:
+                                if (newDate &gt; 30) newDate = 30;
+                        default:
+                                if (newDate &gt; 31) newDate = 31;
+                }
+        }
+        
+        cal.date_obj.setDate(newDate);
+        cal.date_obj.setMonth(newMonth);
+        new_mdy        = cal.date_obj.getFullYear() + '' + cal.date_obj.getMonth() + '' + cal.date;
+        
+        highlight = (cal.selected_date == new_mdy) ? true : false;                        
+        cal = new calendar(cal.id, cal.date_obj, highlight, true);                         
+        document.getElementById('cal' + cal.id).innerHTML = cal.write();        
+}
+
+//        Finalize the date string
+function date_str(time)
+{
+        var month = this.month + 1;
+        if (month &lt; 10)
+                month = '0' + month;
+                
+        var day                = (this.date  &lt; 10)         ?  '0' + this.date                : this.date;
+        var minutes        = (this.minutes  &lt; 10)        ?  '0' + this.minutes        : this.minutes;
+                
+        if (format == 'us')
+        {
+                var hours        = (this.hours &gt; 12) ? this.hours - 12 : this.hours;
+                var ampm        = (this.hours &gt; 11) ? 'PM' : 'AM'
+        }
+        else
+        {
+                var hours        = this.hours;
+                var ampm        = '';
+        }
+        
+        if (time == 'y')
+        {
+                return this.year + '-' + month + '-' + day + '  ' + hours + ':' + minutes + ' ' + ampm;                
+        }
+        else
+        {
+                return this.year + '-' + month + '-' + day;
+        }
+}
+
+//--&gt;
+&lt;/script&gt;
+&lt;?php
+
+$r = ob_get_contents();
+ob_end_clean();
+return $r;
+}
+
+
+function js_calendar_write($field_id, $time = '', $highlight = TRUE)
+{
+        if ($time == '')
+                $time = time();
+
+        return
+        '&lt;script type=&quot;text/javascript&quot;&gt;
+                var '.$field_id.' = new calendar(&quot;'.$field_id.'&quot;, '.$time.', '.(($highlight == TRUE) ? 'true' : 'false').');
+                document.write('.$field_id.'.write());
+        &lt;/script&gt;';        
+}        
+
+
+/* End of file js_calendar_pi.php */
+/* Location: ./system/plugins/js_calendar_pi.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingScaffoldingphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/Scaffolding.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/Scaffolding.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/Scaffolding.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,291 @@
</span><ins>+&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package                CodeIgniter
+ * @author                ExpressionEngine Dev Team
+ * @copyright        Copyright (c) 2008 - 2009, EllisLab, Inc.
+ * @license                http://codeigniter.com/user_guide/license.html
+ * @link                http://codeigniter.com
+ * @since                Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Scaffolding Class
+ *
+ * Provides the Scaffolding framework
+ *
+ * @package                CodeIgniter
+ * @subpackage        Scaffolding
+ * @author                ExpressionEngine Dev Team
+ * @link                http://codeigniter.com/user_guide/general/scaffolding.html
+ */
+class Scaffolding {
+
+        var $CI;
+        var $current_table;
+        var $base_url = '';
+        var $lang = array();
+
+        function Scaffolding($db_table)
+        {
+                $this-&gt;CI =&amp; get_instance();
+                
+                $this-&gt;CI-&gt;load-&gt;database(&quot;&quot;, FALSE, TRUE);                        
+                $this-&gt;CI-&gt;load-&gt;library('pagination');
+                
+                // Turn off caching
+                $this-&gt;CI-&gt;db-&gt;cache_off();
+                                
+                /**
+                 * Set the current table name
+                 * This is done when initializing scaffolding:
+                 * $this-&gt;load-&gt;scaffolding('table_name')
+                 *
+                 */
+                $this-&gt;current_table = $db_table;
+                
+                /**
+                 * Set the path to the &quot;view&quot; files
+                 * We'll manually override the &quot;view&quot; path so that
+                 * the load-&gt;view function knows where to look.
+                 */
+                
+                $this-&gt;CI-&gt;load-&gt;_ci_view_path = BASEPATH.'scaffolding/views/';
+
+                // Set the base URL
+                $this-&gt;base_url = $this-&gt;CI-&gt;config-&gt;site_url().'/'.$this-&gt;CI-&gt;uri-&gt;segment(1).$this-&gt;CI-&gt;uri-&gt;slash_segment(2, 'both');
+                $this-&gt;base_uri = $this-&gt;CI-&gt;uri-&gt;segment(1).$this-&gt;CI-&gt;uri-&gt;slash_segment(2, 'leading');
+
+                // Set a few globals
+                $data = array(
+                                                'image_url'        =&gt; $this-&gt;CI-&gt;config-&gt;system_url().'scaffolding/images/',
+                                                'base_uri'  =&gt; $this-&gt;base_uri,
+                                                'base_url'        =&gt; $this-&gt;base_url,
+                                                'title'                =&gt; $this-&gt;current_table
+                                        );
+                
+                $this-&gt;CI-&gt;load-&gt;vars($data);
+                
+                // Load the language file and create variables
+                $this-&gt;lang = $this-&gt;CI-&gt;load-&gt;scaffold_language('scaffolding', '', TRUE);
+                $this-&gt;CI-&gt;load-&gt;vars($this-&gt;lang);
+                                
+                //  Load the helper files we plan to use
+                $this-&gt;CI-&gt;load-&gt;helper(array('url', 'form'));
+                
+                                
+                log_message('debug', 'Scaffolding Class Initialized');
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * &quot;Add&quot; Page
+         *
+         * Shows a form representing the currently selected DB
+         * so that data can be inserted
+         *
+         * @access        public
+         * @return        string        the HTML &quot;add&quot; page
+         */
+        function add()
+        {        
+                $data = array(
+                                                'title'        =&gt;  ( ! isset($this-&gt;lang['scaff_add'])) ? 'Add Data' : $this-&gt;lang['scaff_add'],
+                                                'fields' =&gt; $this-&gt;CI-&gt;db-&gt;field_data($this-&gt;current_table),
+                                                'action' =&gt; $this-&gt;base_uri.'/insert'
+                                        );
+        
+                $this-&gt;CI-&gt;load-&gt;view('add', $data);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Insert the data
+         *
+         * @access        public
+         * @return        void        redirects to the view page
+         */
+        function insert()
+        {                
+                if ($this-&gt;CI-&gt;db-&gt;insert($this-&gt;current_table, $_POST) === FALSE)
+                {
+                        $this-&gt;add();
+                }
+                else
+                {
+                        redirect($this-&gt;base_uri.'/view/');
+                }
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * &quot;View&quot; Page
+         *
+         * Shows a table containing the data in the currently
+         * selected DB
+         *
+         * @access        public
+         * @return        string        the HTML &quot;view&quot; page
+         */
+        function view()
+        {
+                // Fetch the total number of DB rows
+                $total_rows = $this-&gt;CI-&gt;db-&gt;count_all($this-&gt;current_table);
+                
+                if ($total_rows &lt; 1)
+                {
+                        return $this-&gt;CI-&gt;load-&gt;view('no_data');
+                }
+                
+                // Set the query limit/offset
+                $per_page = 20;
+                $offset = $this-&gt;CI-&gt;uri-&gt;segment(4, 0);
+                
+                // Run the query
+                $query = $this-&gt;CI-&gt;db-&gt;get($this-&gt;current_table, $per_page, $offset);
+
+                // Now let's get the field names                                
+                $fields = $this-&gt;CI-&gt;db-&gt;list_fields($this-&gt;current_table);
+                
+                // We assume that the column in the first position is the primary field.
+                $primary = current($fields);
+
+                // Pagination!
+                $this-&gt;CI-&gt;pagination-&gt;initialize(
+                                                        array(
+                                                                        'base_url'                 =&gt; $this-&gt;base_url.'/view',
+                                                                        'total_rows'         =&gt; $total_rows,
+                                                                        'per_page'                 =&gt; $per_page,
+                                                                        'uri_segment'         =&gt; 4,
+                                                                        'full_tag_open'         =&gt; '&lt;p&gt;',
+                                                                        'full_tag_close' =&gt; '&lt;/p&gt;'
+                                                                        )
+                                                                );        
+
+                $data = array(
+                                                'title'        =&gt;  ( ! isset($this-&gt;lang['scaff_view'])) ? 'View Data' : $this-&gt;lang['scaff_view'],
+                                                'query'                =&gt; $query,
+                                                'fields'        =&gt; $fields,
+                                                'primary'        =&gt; $primary,
+                                                'paginate'        =&gt; $this-&gt;CI-&gt;pagination-&gt;create_links()
+                                        );
+                                                
+                $this-&gt;CI-&gt;load-&gt;view('view', $data);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * &quot;Edit&quot; Page
+         *
+         * Shows a form representing the currently selected DB
+         * so that data can be edited
+         *
+         * @access        public
+         * @return        string        the HTML &quot;edit&quot; page
+         */
+        function edit()
+        {
+                if (FALSE === ($id = $this-&gt;CI-&gt;uri-&gt;segment(4)))
+                {
+                        return $this-&gt;view();
+                }
+
+                // Fetch the primary field name
+                $primary = $this-&gt;CI-&gt;db-&gt;primary($this-&gt;current_table);                                
+
+                // Run the query
+                $query = $this-&gt;CI-&gt;db-&gt;get_where($this-&gt;current_table, array($primary =&gt; $id));
+
+                $data = array(
+                                                'title'        =&gt;  ( ! isset($this-&gt;lang['scaff_edit'])) ? 'Edit Data' : $this-&gt;lang['scaff_edit'],
+                                                'fields'        =&gt; $query-&gt;field_data(),
+                                                'query'                =&gt; $query-&gt;row(),
+                                                'action'        =&gt; $this-&gt;base_uri.'/update/'.$this-&gt;CI-&gt;uri-&gt;segment(4)
+                                        );
+        
+                $this-&gt;CI-&gt;load-&gt;view('edit', $data);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Update
+         *
+         * @access        public
+         * @return        void        redirects to the view page
+         */
+        function update()
+        {        
+                // Fetch the primary key
+                $primary = $this-&gt;CI-&gt;db-&gt;primary($this-&gt;current_table);                                
+
+                // Now do the query
+                $this-&gt;CI-&gt;db-&gt;update($this-&gt;current_table, $_POST, array($primary =&gt; $this-&gt;CI-&gt;uri-&gt;segment(4)));
+                
+                redirect($this-&gt;base_uri.'/view/');
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Delete Confirmation
+         *
+         * @access        public
+         * @return        string        the HTML &quot;delete confirm&quot; page
+         */
+        function delete()
+        {
+                if ( ! isset($this-&gt;lang['scaff_del_confirm']))
+                {
+                        $message = 'Are you sure you want to delete the following row: '.$this-&gt;CI-&gt;uri-&gt;segment(4);
+                }
+                else
+                {
+                        $message = $this-&gt;lang['scaff_del_confirm'].' '.$this-&gt;CI-&gt;uri-&gt;segment(4);
+                }
+                
+                $data = array(
+                                                'title'                =&gt; ( ! isset($this-&gt;lang['scaff_delete'])) ? 'Delete Data' : $this-&gt;lang['scaff_delete'],
+                                                'message'        =&gt; $message,
+                                                'no'                =&gt; anchor(array($this-&gt;base_uri, 'view'), ( ! isset($this-&gt;lang['scaff_no'])) ? 'No' : $this-&gt;lang['scaff_no']),
+                                                'yes'                =&gt; anchor(array($this-&gt;base_uri, 'do_delete', $this-&gt;CI-&gt;uri-&gt;segment(4)), ( ! isset($this-&gt;lang['scaff_yes'])) ? 'Yes' : $this-&gt;lang['scaff_yes'])
+                                        );
+        
+                $this-&gt;CI-&gt;load-&gt;view('delete', $data);
+        }
+        
+        // --------------------------------------------------------------------
+        
+        /**
+         * Delete
+         *
+         * @access        public
+         * @return        void        redirects to the view page
+         */
+        function do_delete()
+        {                
+                // Fetch the primary key
+                $primary = $this-&gt;CI-&gt;db-&gt;primary($this-&gt;current_table);                                
+
+                // Now do the query
+                $this-&gt;CI-&gt;db-&gt;where($primary, $this-&gt;CI-&gt;uri-&gt;segment(4));
+                $this-&gt;CI-&gt;db-&gt;delete($this-&gt;current_table);
+
+                header(&quot;Refresh:0;url=&quot;.site_url(array($this-&gt;base_uri, 'view')));
+                exit;
+        }
+
+}
+
+/* End of file Scaffolding.php */
+/* Location: ./system/scaffolding/Scaffolding.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingimagesbackgroundjpg"></a>
<div class="binary"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/background.jpg</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/background.jpg
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx">   + application/octet-stream
</span><a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingimagesindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingimageslogojpg"></a>
<div class="binary"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/logo.jpg</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/images/logo.jpg
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx">   + application/octet-stream
</span><a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsaddphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/add.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/add.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/add.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;?php  $this-&gt;load-&gt;view('header');  ?&gt;
+
+&lt;p&gt;&lt;?php echo anchor(array($base_uri, 'view'), '&amp;lt; '.$scaff_view_all); ?&gt;&lt;/p&gt;
+
+
+&lt;?php echo form_open($action); ?&gt;
+
+&lt;table border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;1&quot;&gt;
+&lt;?php foreach($fields as $field): ?&gt;
+
+&lt;?php if ($field-&gt;primary_key == 1) continue; ?&gt;
+
+&lt;tr&gt;
+        &lt;td&gt;&lt;?php echo $field-&gt;name; echo ' '.$field-&gt;default; ?&gt;&lt;/td&gt;
+        
+        &lt;?php if ($field-&gt;type == 'blob'): ?&gt;
+        &lt;td&gt;&lt;textarea class=&quot;textarea&quot; name=&quot;&lt;?php echo $field-&gt;name; ?&gt;&quot; cols=&quot;60&quot; rows=&quot;10&quot; &gt;&lt;?php echo form_prep($field-&gt;default); ?&gt;&lt;/textarea&gt;&lt;/td&gt;
+        &lt;?php else : ?&gt;
+        &lt;td&gt;&lt;input class=&quot;input&quot; name=&quot;&lt;?php echo $field-&gt;name; ?&gt;&quot; value=&quot;&lt;?php echo form_prep($field-&gt;default); ?&gt;&quot; size=&quot;60&quot; /&gt;&lt;/td&gt;
+        &lt;?php endif; ?&gt;
+        
+&lt;/tr&gt;
+&lt;?php endforeach; ?&gt;
+&lt;/table&gt;
+
+&lt;input type=&quot;submit&quot; class=&quot;submit&quot; value=&quot;Insert&quot; /&gt;
+
+&lt;/form&gt;
+
+&lt;?php $this-&gt;load-&gt;view('footer'); 
+/* End of file add.php */
+/* Location: ./system/scaffolding/views/add.php */
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsdeletephp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/delete.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/delete.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/delete.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;?php  $this-&gt;load-&gt;view('header');  ?&gt;
+
+&lt;p&gt;&lt;?php echo $message; ?&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;?php echo $no; ?&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;?php echo $yes; ?&gt;
+
+&lt;?php $this-&gt;load-&gt;view('footer'); 
+/* End of file delete.php */
+/* Location: ./system/scaffolding/views/delete.php */
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewseditphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/edit.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/edit.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/edit.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;?php $this-&gt;load-&gt;view('header');  ?&gt;
+
+
+&lt;p&gt;&lt;?php echo anchor(array($base_uri, 'view'), '&amp;lt; '.$scaff_view_all);?&gt;&lt;/p&gt;
+
+
+&lt;?php echo form_open($action); ?&gt;
+
+&lt;table border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;1&quot;&gt;
+&lt;?php foreach($fields as $field): ?&gt;
+
+&lt;?php if ($field-&gt;primary_key == 1) continue; ?&gt;
+
+&lt;tr&gt;
+        &lt;td&gt;&lt;?php echo  $field-&gt;name; ?&gt;&lt;/td&gt;
+        
+        &lt;?php if ($field-&gt;type == 'blob'): ?&gt;
+        &lt;td&gt;&lt;textarea class=&quot;textarea&quot; name=&quot;&lt;?php echo $field-&gt;name;?&gt;&quot; cols=&quot;60&quot; rows=&quot;10&quot; &gt;&lt;?php $f = $field-&gt;name; echo form_prep($query-&gt;$f); ?&gt;&lt;/textarea&gt;&lt;/td&gt;
+        &lt;?php else : ?&gt;
+        &lt;td&gt;&lt;input class=&quot;input&quot; value=&quot;&lt;?php $f = $field-&gt;name; echo form_prep($query-&gt;$f); ?&gt;&quot; name=&quot;&lt;?php echo $field-&gt;name; ?&gt;&quot; size=&quot;60&quot; /&gt;&lt;/td&gt;
+        &lt;?php endif; ?&gt;
+        
+&lt;/tr&gt;
+&lt;?php endforeach; ?&gt;
+&lt;/table&gt;
+
+&lt;input type=&quot;submit&quot; class=&quot;submit&quot; value=&quot;Update&quot; /&gt;
+
+&lt;/form&gt;
+
+&lt;?php $this-&gt;load-&gt;view('footer'); 
+/* End of file edit.php */
+/* Location: ./system/scaffolding/views/edit.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsfooterphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/footer.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/footer.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/footer.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+&lt;/div&gt;
+
+&lt;div id=&quot;footer&quot;&gt;
+&lt;p&gt;&lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt;, by &lt;a href=&quot;http://www.EllisLab.com&quot;&gt;EllisLab&lt;/a&gt; -  Version &lt;?php echo CI_VERSION ?&gt;&lt;/p&gt;
+&lt;p&gt;Page rendered in {elapsed_time}&lt;/p&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsheaderphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/header.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/header.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/header.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+
+&lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
+
+&lt;style type='text/css'&gt;
+&lt;?php $this-&gt;file(BASEPATH.'scaffolding/views/stylesheet.css'); ?&gt;
+&lt;/style&gt;
+
+&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
+&lt;meta http-equiv='expires' content='-1' /&gt;
+&lt;meta http-equiv= 'pragma' content='no-cache' /&gt;
+
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;div id=&quot;header&quot;&gt;
+&lt;div id=&quot;header_left&quot;&gt;
+&lt;h3&gt;Scaffolding:&amp;nbsp; &lt;?php echo $title; ?&gt;&lt;/h3&gt;
+&lt;/div&gt;
+&lt;div id=&quot;header_right&quot;&gt;
+&lt;?php echo anchor(array($base_uri, 'view'), $scaff_view_records); ?&gt; &amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;
+&lt;?php echo anchor(array($base_uri, 'add'),  $scaff_create_record); ?&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;br clear=&quot;all&quot;&gt;
+&lt;div id=&quot;outer&quot;&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsindexhtml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/index.html (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/index.html                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/index.html        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+        &lt;title&gt;403 Forbidden&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Directory access is forbidden.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsno_dataphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/no_data.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/no_data.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/no_data.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+&lt;?php  $this-&gt;load-&gt;view('header');  ?&gt;
+
+&lt;p&gt;&lt;?php echo $scaff_no_data; ?&gt;&lt;/p&gt;
+&lt;p&gt;&lt;?php echo anchor(array($base_uri, 'add'), $scaff_create_record); ?&gt;&lt;/p&gt;
+
+&lt;?php $this-&gt;load-&gt;view('footer'); 
+/* End of file no_data.php */
+/* Location: ./system/scaffolding/views/no_data.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsstylesheetcss"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/stylesheet.css (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/stylesheet.css                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/stylesheet.css        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+body {
+ margin: 0;
+ padding: 0;
+ font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+ font-size: 11px;
+ color: #4F5155;
+ background: #fff url(&lt;?php echo $image_url; ?&gt;background.jpg) repeat-x left top;
+}
+
+a {
+ color: #8B0D00;
+ background-color: transparent;
+ text-decoration: none;
+ font-weight: bold;
+}
+
+a:visited {
+ color: #8B0D00;
+ background-color: transparent;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #000;
+ text-decoration: none;
+ background-color: transparent;
+}
+
+
+#header {
+ margin: 0;
+ padding: 0;
+}
+
+#header_left {
+ background-color: transparent;
+ float: left;
+ padding: 21px 0 0 32px;
+ margin: 0
+}
+
+#header_right {
+ background-color: transparent;
+ float: right;
+ text-align: right;
+ padding: 35px 50px 20px 0;
+ margin: 0
+}
+
+#footer {
+ margin: 20px 0 15px 0;
+ padding: 0;
+}
+
+#footer p {
+ font-size: 10px;
+ color: #999;
+ text-align: center;
+}
+
+#outer {
+ margin: 30px 40px 0 40px;
+}
+
+img {
+ padding:0;
+ border: 0;
+ margin: 0;
+}
+
+.nopad {
+ padding:0;
+ border: 0;
+ margin: 0;
+}
+
+table {
+ background-color: #efefef;
+}
+
+th {
+ background-color: #eee;
+ font-weight: bold;
+ padding: 6px;
+ text-align: left;
+}
+
+td {
+ background-color: #fff;
+ padding: 6px;
+}
+
+
+form {
+ margin: 0;
+ padding: 0;
+}
+
+.input {
+ font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+ font-size: 11px;
+ width: 600px;
+ color: #333;
+ border: 1px solid #B3B4BD;
+ font-size: 11px;
+ height: 2em;
+ padding: 0;
+ margin: 0;
+}
+
+.textarea {
+ font-family: Lucida Grande, Verdana, Geneva, Sans-serif;
+ font-size: 12px;
+ width: 600px;
+ color: #333;
+ border: 1px solid #B3B4BD;
+ padding: 0;
+ margin: 0;
+}
+
+.select {
+ background-color: #fff;
+ font-size:  11px;
+ font-weight: normal;
+ color: #333;
+ padding: 0;
+ margin: 0 0 3px 0;
+}
+
+.checkbox {
+ background-color: transparent;
+ padding: 0;
+ border: 0;
+}
+
+.submit {
+ background-color: #8B0D00;
+ color: #FFF;
+ font-weight: normal;
+ border: 1px solid #000;
+ margin: 6px 0 0 0;
+ padding: 1px 5px 1px 5px;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribDelphiWorldfmcsystemscaffoldingviewsviewphp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/view.php (0 => 14141)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/view.php                                (rev 0)
+++ freeswitch/trunk/contrib/DelphiWorld/fmc/system/scaffolding/views/view.php        2009-07-06 22:02:30 UTC (rev 14141)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;?php  $this-&gt;load-&gt;view('header');  ?&gt;
+
+&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; style=&quot;width:100%&quot;&gt;
+ &lt;tr&gt;
+        &lt;th&gt;Edit&lt;/th&gt;
+        &lt;th&gt;Delete&lt;/th&gt;
+        &lt;?php foreach($fields as $field): ?&gt;
+        &lt;th&gt;&lt;?php echo $field; ?&gt;&lt;/th&gt;
+        &lt;?php endforeach; ?&gt;
+&lt;/tr&gt;
+
+&lt;?php foreach($query-&gt;result() as $row): ?&gt;
+ &lt;tr&gt;
+        &lt;td&gt;&amp;nbsp;&lt;?php echo anchor(array($base_uri, 'edit', $row-&gt;$primary), $scaff_edit); ?&gt;&amp;nbsp;&lt;/td&gt;
+         &lt;td&gt;&lt;?php echo anchor(array($base_uri, 'delete', $row-&gt;$primary), $scaff_delete); ?&gt;&lt;/td&gt;
+         &lt;?php foreach($fields as $field): ?&gt;        
+        &lt;td&gt;&lt;?php echo form_prep($row-&gt;$field);?&gt;&lt;/td&gt;
+        &lt;?php endforeach; ?&gt;
+ &lt;/tr&gt;
+&lt;?php endforeach; ?&gt;
+&lt;/table&gt;
+
+&lt;?php echo $paginate; ?&gt;
+
+&lt;?php $this-&gt;load-&gt;view('footer'); 
+/* End of file view.php */
+/* Location: ./system/scaffolding/views/view.php */
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>