From: <wis...@us...> - 2015-10-06 20:43:30
|
Revision: 13155 http://sourceforge.net/p/xoops/svn/13155 Author: wishcraft Date: 2015-10-06 20:43:27 +0000 (Tue, 06 Oct 2015) Log Message: ----------- FOIP/FAX/PBX Module Prealpah 0.00.01 Added Paths: ----------- XoopsModules/ICTPBX/ XoopsModules/ICTPBX/trunk/ XoopsModules/ICTPBX/trunk/modules/ XoopsModules/ICTPBX/trunk/modules/ict/ XoopsModules/ICTPBX/trunk/modules/ict/admin/ XoopsModules/ICTPBX/trunk/modules/ict/class/ XoopsModules/ICTPBX/trunk/modules/ict/class/coredb.php XoopsModules/ICTPBX/trunk/modules/ict/class/did.php XoopsModules/ICTPBX/trunk/modules/ict/class/gateway.php XoopsModules/ICTPBX/trunk/modules/ict/class/service.php XoopsModules/ICTPBX/trunk/modules/ict/class/technology.php XoopsModules/ICTPBX/trunk/modules/ict/class/trunk.php XoopsModules/ICTPBX/trunk/modules/ict/class/user.php XoopsModules/ICTPBX/trunk/modules/ict/images/ XoopsModules/ICTPBX/trunk/modules/ict/images/icons/ XoopsModules/ICTPBX/trunk/modules/ict/images/icons/16/ XoopsModules/ICTPBX/trunk/modules/ict/images/icons/24/ XoopsModules/ICTPBX/trunk/modules/ict/images/icons/32/ XoopsModules/ICTPBX/trunk/modules/ict/include/ XoopsModules/ICTPBX/trunk/modules/ict/include/constants.php XoopsModules/ICTPBX/trunk/modules/ict/include/forms.php XoopsModules/ICTPBX/trunk/modules/ict/include/formselectcountry.php XoopsModules/ICTPBX/trunk/modules/ict/include/functions.php XoopsModules/ICTPBX/trunk/modules/ict/include/places-api.uris XoopsModules/ICTPBX/trunk/modules/ict/language/ XoopsModules/ICTPBX/trunk/modules/ict/language/english/ XoopsModules/ICTPBX/trunk/modules/ict/language/english/css/ XoopsModules/ICTPBX/trunk/modules/ict/language/english/emails.php XoopsModules/ICTPBX/trunk/modules/ict/language/english/errors.php XoopsModules/ICTPBX/trunk/modules/ict/language/english/forms.php XoopsModules/ICTPBX/trunk/modules/ict/language/english/images.php XoopsModules/ICTPBX/trunk/modules/ict/language/english/mail_template/ XoopsModules/ICTPBX/trunk/modules/ict/language/english/mail_template/existing-user-password-changed.html XoopsModules/ICTPBX/trunk/modules/ict/language/english/mail_template/new-ictpbx-user-created.html XoopsModules/ICTPBX/trunk/modules/ict/preloads/ XoopsModules/ICTPBX/trunk/modules/ict/sql/ XoopsModules/ICTPBX/trunk/modules/ict/sql/mysql.sql XoopsModules/ICTPBX/trunk/modules/ict/templates/ XoopsModules/ICTPBX/trunk/modules/ict/xoops_version.php XoopsModules/ICTPBX/trunk/uploads/ XoopsModules/ICTPBX/trunk/uploads/ictpbx/ Added: XoopsModules/ICTPBX/trunk/modules/ict/class/coredb.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/class/coredb.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/class/coredb.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,41 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + + +class CoreDB extends XoopsDatabase +{ + public function __call($name, $arguments) { + return self::_callStatic($name, $arguments); + } + + /** As of PHP 5.3.0 */ + public static function __callStatic($name, $arguments) { + $db = db_set_active('ictcore'); + $result = call_user_func_array($name, $arguments); + db_set_active(); + return $result; + } +} Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/class/coredb.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/class/did.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/class/did.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/class/did.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,116 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctDid extends XoopsObject +{ + /** + * Class Constructor + */ + function __construct() + { + $this->initVar('ictpbx_did_id', XOBJ_DTYPE_INT, null, true); + $this->initVar('did', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('description', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('assigned_to', XOBJ_DTYPE_INT, 0, false); + $this->initVar('forward_to', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('trunk_id', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created_by', XOBJ_DTYPE_INT, 0, false); + } + +} + + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctDidUserList extends XoopsObject +{ + /** + * Class Constructor + */ + function __construct($row = array()) + { + $this->initVar('ictpbx_did_id', XOBJ_DTYPE_INT, 0, false); + $this->initVar('ictpbx_user_id', XOBJ_DTYPE_INT, 0, false); + $this->initVar('account_id', XOBJ_DTYPE_INT, 0, false); + $this->initVar('did', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('description', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('assigned_to', XOBJ_DTYPE_INT, 0, false); + $this->initVar('forward_to', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('first_name', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('last_name', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('phone_number', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('mobile_number', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('fax_number', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('mail', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('uid', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created', XOBJ_DTYPE_INT, 0, false); + $this->initVar('user_created', XOBJ_DTYPE_INT, 0, false); + $this->assignVars($row); + } + +} + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctDidHandler extends XoopsPersistableObjectHandler +{ + + /** + * Class Constructor + * + * @param unknown_type $db + */ + function __construct(&$db) + { + parent::__construct($db, "ictpbx_did", "IctDid", "ictpbx_did_id", 'did'); + } + + function getDidByUserList($criteria = NULL) + { + $rows = array(); + $sql = "SELECT `ictpbx_did_id`, `ictpbx_user_id`, `did`, `description`, `assigned_to`, `forward_to`, `b`.`name` as `name`, `b`.`first_name` as `first_name`, `b`.`last_name` as `last_name`, `b`.`phone_number` as `phone_number`, `b`.`mobile_number` as `mobile_number`, `b`.`fax_number` as `fax_number`,`b`.`mail` as `mail`, `b`.`uid` as `uid`, `created`, `b`.`created` as `user_created` "; + $sql .= "FROM " . CoreDB::prefix("ictpbx_did") . " a LEFT JOIN " . CoreDB::prefix("ictpbx_user") . " b ON a.created_by = b.uid "; + if (!is_null($criteria)) + $sql .= $criteria->renderWhere(); + $result = CoreDB::queryF($sql); + while($row = CoreDB::fetchArray($result)) + { + $row['account_id'] = $row['ictpbx_did_id'] * $row['ictpbx_user_id'] + $row['uid']; + $rows[] = new IctDidUserList($row); + } + return $rows; + } +} +?> \ No newline at end of file Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/class/did.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/class/gateway.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/class/gateway.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/class/gateway.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,65 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctGateway extends XoopsObject +{ + /** + * Class Constructor + */ + function __construct() + { + $this->initVar('ictpbx_gateway_id', XOBJ_DTYPE_INT, null, true); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('type', XOBJ_DTYPE_INT, 0, false); + $this->initVar('active', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created_by', XOBJ_DTYPE_INT, 0, false); + } + +} + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctGatewayHandler extends XoopsPersistableObjectHandler +{ + + /** + * Class Constructor + * + * @param unknown_type $db + */ + function __construct(&$db) + { + parent::__construct($db, "ictpbx_gateway", "IctGateway", "ictpbx_gateway_id", 'name'); + } +} +?> \ No newline at end of file Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/class/gateway.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/class/service.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/class/service.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/class/service.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,64 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctService extends XoopsObject +{ + /** + * Class Constructor + */ + function __construct() + { + $this->initVar('ictpbx_service_id', XOBJ_DTYPE_INT, null, true); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('active', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created_by', XOBJ_DTYPE_INT, 0, false); + } + +} + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctServiceHandler extends XoopsPersistableObjectHandler +{ + + /** + * Class Constructor + * + * @param unknown_type $db + */ + function __construct(&$db) + { + parent::__construct($db, "ictpbx_service", "IctService", "ictpbx_service_id", 'name'); + } +} +?> \ No newline at end of file Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/class/service.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/class/technology.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/class/technology.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/class/technology.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,65 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctTechnology extends XoopsObject +{ + /** + * Class Constructor + */ + function __construct() + { + $this->initVar('ictpbx_technology_id', XOBJ_DTYPE_INT, null, true); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, 32); + $this->initVar('type', XOBJ_DTYPE_INT, 0, false); + $this->initVar('active', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created_by', XOBJ_DTYPE_INT, 0, false); + } + +} + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctTechnologyHandler extends XoopsPersistableObjectHandler +{ + + /** + * Class Constructor + * + * @param unknown_type $db + */ + function __construct(&$db) + { + parent::__construct($db, "ictpbx_technology", "IctTechnology", "ictpbx_technology_id", 'name'); + } +} +?> \ No newline at end of file Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/class/technology.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/class/trunk.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/class/trunk.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/class/trunk.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,77 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctTrunk extends XoopsObject +{ + /** + * Class Constructor + */ + function __construct() + { + $this->initVar('ictpbx_trunk_id', XOBJ_DTYPE_INT, null, true); + $this->initVar('type', XOBJ_DTYPE_INT, 0, false); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('host', XOBJ_DTYPE_OTHER, '', false); + $this->initVar('username', XOBJ_DTYPE_OTHER, 0, false); + $this->initVar('password', XOBJ_DTYPE_OTHER, 0, false); + $this->initVar('port', XOBJ_DTYPE_OTHER, 0, false); + $this->initVar('channel', XOBJ_DTYPE_INT, 0, false); + $this->initVar('prefix', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('dial_string', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('register_string', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('gateway_id', XOBJ_DTYPE_INT, 0, false); + $this->initVar('service_flag', XOBJ_DTYPE_INT, 0, false); + $this->initVar('technology_id', XOBJ_DTYPE_INT, 0, false); + $this->initVar('weight', XOBJ_DTYPE_INT, 0, false); + $this->initVar('active', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created_by', XOBJ_DTYPE_INT, 0, false); + } + +} + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctTrunkHandler extends XoopsPersistableObjectHandler +{ + + /** + * Class Constructor + * + * @param unknown_type $db + */ + function __construct(&$db) + { + parent::__construct($db, "ictpbx_trunk", "IctTrunk", "ictpbx_trunk_id", 'name'); + } +} +?> \ No newline at end of file Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/class/trunk.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/class/user.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/class/user.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/class/user.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,182 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctUser extends XoopsObject +{ + /** + * Class Constructor + */ + function __construct() + { + $this->initVar('ictpbx_user_id', XOBJ_DTYPE_INT, null, true); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('first_name', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('last_name', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('mail', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('phone_number', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('mobile_number', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('fax_number', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('address', XOBJ_DTYPE_TXTAREA, '', false); + $this->initVar('country', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('company', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('website', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('uid', XOBJ_DTYPE_INT, 0, false); + $this->initVar('active', XOBJ_DTYPE_INT, 0, false); + $this->initVar('credit', XOBJ_DTYPE_FLOAT, 0, false); + $this->initVar('free_bundle', XOBJ_DTYPE_INT, 0, false); + $this->initVar('reserved_credit', XOBJ_DTYPE_FLOAT, 0, false); + $this->initVar('reserved_free_bundle', XOBJ_DTYPE_INT, 0, false); + $this->initVar('package', XOBJ_DTYPE_TXTBOX, 0, false, 32); + $this->initVar('created', XOBJ_DTYPE_INT, 0, false); + $this->initVar('created_by', XOBJ_DTYPE_INT, 0, false); + } + +} + +/** + * @copyright copyright © 2015 labs.coop + */ +class IctUserHandler extends XoopsPersistableObjectHandler +{ + + /** + * Class Constructor + * + * @param unknown_type $db + */ + function __construct(&$db) + { + parent::__construct($db, "ictpbx_user", "IctUser", "ictpbx_user_id", 'name'); + } + + /** + * Handles Record Submition from Form Designations + * + * @param IctUser $user + * @param boolean $force + * @param array $formvalues + */ + function insertFromForm(IctUser $user, $force = true, $formvalues = array()) + { + if ($user->isNew()) + { + $isnew = true; + $mailpasswd = false; + if (isset($formvalues['passwd']) && empty($formvalues['passwd'])) + { + $formvalues['vpasswd'] = $formvalues['passwd'] = xoops_makepass(); + $mailpasswd = true; + } elseif (isset($formvalues['passwd']) && !empty($formvalues['passwd']) && isset($formvalues['vpasswd']) && !empty($formvalues['vpasswd']) && $formvalues['vpasswd'] != $formvalues['passwd']) + { + xoops_loadLanguages('errors'); + $GLOBALS['errors'][] = _ICTPBX_ERRORS_PASSWORD_MISMATCH; + return false; + } + $user_handler = xoops_gethandler('user'); + $xoopsuser = $user_handler->create(); + $xoopsuser->setVar('email', $user->getVar('mail')); + $xoopsuser->setVar('uname', $user->getVar('name')); + $xoopsuser->setVar('name', $user->getVar('first_name') . " " . $user->getVar('last_name')); + $xoopsuser->setVar('pass', md5($formvalues['passwd'])); + $xoopsuser->setVar('user_avatar', "ictpbx/blank.gif"); + $xoopsuser->setVar('user_from', $user->getVar('country')); + $xoopsuser->setVar('user_regdate', time()); + $xoopsuser->setVar('user_viewemail', $GLOBALS['ictModuleConfig']['newuser_user_viewmail']); + $xoopsuser->setVar('user_mailok', $GLOBALS['ictModuleConfig']['newuser_user_mailok']); + $user->setVar('uid', $user_handler->insert($xoopsuser, $force)); + $member_handler = xoops_gethandler('member'); + $member_handler->addUserToGroup(XOOPS_GROUP_USERS, $user->getVar('uid')); + if ($GLOBALS['ictModuleConfig']['newuser_group']!=XOOPS_GROUP_USERS) + $member_handler->addUserToGroup($GLOBALS['ictModuleConfig']['newuser_group'], $user->getVar('uid')); + $user->setVar('active', $GLOBALS['ictModuleConfig']['newuser_active']); + $user->setVar('credit', $GLOBALS['ictModuleConfig']['newuser_credit']); + $user->setVar('free_bundle', $GLOBALS['ictModuleConfig']['newuser_bundle']); + $user->setVar('reserved_credit', $GLOBALS['ictModuleConfig']['newuser_reserved_credit']); + $user->setVar('reserved_free_bundle', $GLOBALS['ictModuleConfig']['newuser_reserved_bundle']); + $user->setVar('package', $GLOBALS['ictModuleConfig']['newuser_package']); + $user->setVar('created', time()); + if (is_a($GLOBALS["xoopsUser"], "XoopsUser")) + $user->setVar('created_by', $GLOBALS["xoopsUser"]->getVar('uid')); + } else { + $isnew = false; + if (isset($formvalues['passwd']) && !empty($formvalues['passwd']) && isset($formvalues['vpasswd']) && !empty($formvalues['vpasswd']) && $formvalues['vpasswd'] != $formvalues['passwd']) + { + xoops_loadLanguages('errors'); + $GLOBALS['errors'][] = _ICTPBX_ERRORS_PASSWORD_MISMATCH; + return false; + } + if ($user->getVar('uid')!=0) + { + $user_handler = xoops_gethandler('user'); + $xoopsuser = $user_handler->get($user->getVar('uid')); + $xoopsuser->setVar('email', $user->getVar('mail')); + $xoopsuser->setVar('uname', $user->getVar('name')); + $xoopsuser->setVar('name', $user->getVar('first_name') . " " . $user->getVar('last_name')); + if (!empty($formvalues['passwd'])) + { + $xoopsuser->setVar('pass', md5($formvalues['passwd'])); + $mailpasswd = true; + } + $user_handler->insert($xoopsuser, $force); + + } + } + $id = parent::insert($user, $force); + if ($mailpasswd == true && is_a($xoopsuser, "XoopsUser")) + { + xoops_loadLanguages('emails'); + xoops_load("XoopsMailer"); + $xoopsMailer =& xoops_getMailer(); + $xoopsMailer->reset(); + $xoopsMailer->useMail(); + $xoopsMailer->setHTML(true); + $xoopsMailer->setTemplate(_ICTPBX_MAILTEMPLATE_PATH . DIRECTORY_SEPARATOR . ($isnew==true?'new-ictpbx-user-created.html':'existing-user-password-changed.html')); + $xoopsMailer->assign('FIRSTNAME', $user->getVar('first_name')); + $xoopsMailer->assign('LASTNAME', $user->getVar('last_name')); + $xoopsMailer->assign('USERNAME', $user->getVar('name')); + $xoopsMailer->assign('USEREMAIL', $user->getVar('mail')); + $xoopsMailer->assign('PASSWORD', $user->getVar('passwd')); + $xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); + $xoopsMailer->assign('ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); + $xoopsMailer->assign('SITEURL', XOOPS_URL . "/"); + $xoopsMailer->setToUser($xoopsuser); + $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); + $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); + $xoopsMailer->setSubject(sprintf(($isnew==true?_ICTPBX_EMAIL_SUBJECT_NEWUSER:_ICTPBX_EMAIL_SUBJECT_PASSCHANGE), $GLOBALS['xoopsConfig']['sitename'])); + if (!$xoopsMailer->send()) { + xoops_loadLanguages('errors'); + $GLOBALS['errors'][] = sprintf(_ICTPBX_ERRORS_EMAIL_NOTSENT, $user->getVar('mail')); + } + } + return $id; + } +} +?> \ No newline at end of file Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/class/user.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/include/constants.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/include/constants.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/include/constants.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,31 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +define("_ICTPBX_DIRNAME", basename(dirname(__DIR__))); +define('_ICTPBX_MAILTEMPLATE_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR . "language" . DIRECTORY_SEPARATOR . $GLOBALS["xoopsConfig"]["language"] . DIRECTORY_SEPARATOR . "mail_template"); +define('_ICTPBX_CSS_URI', XOOPS_URL . "/modules/" . _ICTPBX_DIRNAME . "/language/" . $GLOBALS["xoopsConfig"]["language"] . "/css"); \ No newline at end of file Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/include/constants.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/include/forms.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/include/forms.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/include/forms.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,700 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +require_once dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'xoopsformloader.php'; +require_once __DIR__ . DIRECTORY_SEPARATOR . 'formselectcountry.php'; + +/** + * Build the ictcore editing form. + * + * @ingroup forms + * @see ictcore_form_submit() + */ +function ictcore_form_user_register_form_alter(&$form, &$form_state) { + + xoops_loadLanguage('forms', _ICTFAX_DIRNAME); + + $frm = array(); + $frm['name']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_USERNAME, 'name', 32, $form_state['values']['name']); + $frm['name']['form']->addDescription(_ICTPBX_MN_FORM_USERNAME_DESC); + $frm['name']['require'] = true; + $frm['passwd']['form'] = new XoopsFormPassword(_ICTPBX_MN_FORM_PASSWD, 'passwd', 32, ''); + $frm['passwd']['form']->addDescription(_ICTPBX_MN_FORM_PASSWD_DESC); + $frm['passwd']['require'] = false; + $frm['vpasswd']['form'] = new XoopsFormPassword(_ICTPBX_MN_FORM_VPASSWD, 'vpasswd', 32, ''); + $frm['vpasswd']['form']->addDescription(_ICTPBX_MN_FORM_VPASSWD_DESC); + $frm['vpasswd']['require'] = false; + $frm['first_name']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_FIRSTNAME, 'first_name', 32, $form_state['values']['first_name']); + $frm['first_name']['form']->addDescription(_ICTPBX_MN_FORM_FIRSTNAME_DESC); + $frm['first_name']['require'] = true; + $frm['last_name']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_LASTNAME, 'last_name', 32, $form_state['values']['last_name']); + $frm['last_name']['form']->addDescription(_ICTPBX_MN_FORM_LASTNAME_DESC); + $frm['last_name']['require'] = true; + $frm['mail']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_EMAIL, 'mail', 32, $form_state['values']['mail']); + $frm['mail']['form']->addDescription(_ICTPBX_MN_FORM_EMAIL_DESC); + $frm['mail']['require'] = false; + $frm['company']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_COMPANY, 'company', 32, $form_state['values']['company']); + $frm['company']['form']->addDescription(_ICTPBX_MN_FORM_COMPANY_DESC); + $frm['company']['require'] = false; + $frm['website']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_WEBSITE, 'website', 32, $form_state['values']['website']); + $frm['website']['form']->addDescription(_ICTPBX_MN_FORM_WEBSITE_DESC); + $frm['website']['require'] = false; + $frm['phone_number']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_PHONE, 'phone_number', 32, $form_state['values']['phone_number']); + $frm['phone_number']['form']->addDescription(_ICTPBX_MN_FORM_PHONE_DESC); + $frm['phone_number']['require'] = true; + $frm['mobile_number']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_MOBILE, 'mobile_number', 32, $form_state['values']['mobile_number']); + $frm['mobile_number']['form']->addDescription(_ICTPBX_MN_FORM_MOBILE_DESC); + $frm['mobile_number']['require'] = false; + $frm['fax_number']['form'] = new XoopsFormText(_ICTPBX_MN_FORM_FAX, 'fax_number', 32, $form_state['values']['fax_number']); + $frm['fax_number']['form']->addDescription(_ICTPBX_MN_FORM_FAX_DESC); + $frm['fax_number']['require'] = false; + $frm['address']['form'] = new XoopsFormTextArea(_ICTPBX_MN_FORM_ADDRESS, 'address', $form_state['values']['address'], 5, 39); + $frm['address']['form']->addDescription(_ICTPBX_MN_FORM_ADDRESS_DESC); + $frm['address']['require'] = true; + $frm['country']['form'] = new IctpbxFormSelectCountry(_ICTPBX_MN_FORM_COUNTRY, 'country', $form_state['values']['country'], 1, true); + $frm['country']['form']->addDescription(_ICTPBX_MN_FORM_COUNTRY_DESC); + $frm['country']['require'] = true; + $frm['ictpbx_user_id']['form'] = new XoopsFormHidden('ictpbx_user_id', !isset($form_state['values']['ictpbx_user_id'])?'0':$form_state['values']['ictpbx_user_id']); + $frm['ictpbx_user_id']['require'] = false; + + $form = new XoopsTableForm(_ICTPBX_MN_FORM_TITLE_USERREGO, _ICTPBX_MN_FORM_IDENTITY_USERREGO, $_SERVER["REQUEST_URI"]); + foreach($frm as $key => $values) + $form->addElement($values['form'], $values['require']); + + return $form->render(); +} + +/** + * Build the did form. + */ +function ictpbx_did_form($form, &$form_state, $edit = array()) { + // It's safe to use on both an empty array, and an incoming array with full or partial data. + $edit += array( + 'account_id' => '', + 'phone' => '', + 'first_name' => '', + 'email' => '', + ); + + // If we're editing an existing fax, we'll add a value field to the form + // containing the fax's unique ID. + if (!empty($edit['account_id'])) { + $form['account_id'] = array( + '#type' => 'value', + '#value' => $edit['account_id'], + ); + } + + $form['info'] = array( + '#type' => 'fieldset', + '#title' => t('did Information'), + ); + + $form['info']['phone'] = array( + '#type' => 'textfield', + '#title' => t('DID Number'), + '#required' => TRUE, + '#default_value' => $edit['phone'], + ); + + $form['info']['first_name'] = array( + '#type' => 'textfield', + '#title' => t('Title'), + '#default_value' => $edit['first_name'], + ); + + $form['info']['email'] = array( + '#type' => 'textfield', + '#title' => t('Email'), + '#default_value' => $edit['email'], + ); + + $form['buttons']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + + return $form; +} + + + +/** + * Validate + * + */ +function ictpbx_did_form_validate($form, &$form_state) { + $did = $form_state['values']; + $query = "SELECT account_id FROM account WHERE phone = :phone"; + $result = CoreDB::db_query($query, array(':phone'=>$did['phone'])); + if ($res = $result->fetchAssoc()) { + form_set_error('phone', t('DID already exist!')); + } +} + + + + +/** + * Build the did batch form. + */ +function ictpbx_did_batch($form, &$form_state, $edit = array()) { + $edit += array( + 'from' => '', + 'to' => '', + 'first_name' => '', + 'email' => '', + ); + + $form['info'] = array( + '#type' => 'fieldset', + '#title' => t('DID Information'), + ); + + $form['info']['from'] = array( + '#type' => 'textfield', + '#title' => t('Range From'), + '#required' => TRUE, + '#default_value' => $edit['from'], + ); + + $form['info']['to'] = array( + '#type' => 'textfield', + '#title' => t('Range To'), + '#required' => TRUE, + '#default_value' => $edit['to'], + ); + + $form['info']['first_name'] = array( + '#type' => 'textfield', + '#title' => t('Title'), + '#default_value' => $edit['first_name'], + ); + + $form['info']['email'] = array( + '#type' => 'textfield', + '#title' => t('Email'), + '#default_value' => $edit['email'], + ); + + $form['buttons']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + + return $form; +} + +/** + * Validates did batch insert + */ +function ictpbx_did_batch_validate($form, &$form_state) { + $did = $form_state['values']; + + // validation in case of batch insert + if ($did['from'] == '' || $did['to'] == '') { + form_set_error('from', t('Both fileds in DID Range cannot be empty')); + } else { + if (!is_numeric($did['from']) || !is_numeric($did['to'])) { + form_set_error('from', t('Please enter a valid DID range only numbers are allowed!')); + } else { + $query = "SELECT count(account_id) as num FROM account WHERE phone >= :from AND phone<= :to"; + $result = CoreDB::db_query($query, array(':from'=>$did['from'], ':to'=>$did['to'])); + $count = $result->fetchField(); + } + } +} + + + +/** + * Build the did import form. + */ +function ictpbx_did_import($form, &$form_state, $edit = array()) { + $edit += array( + 'upload' => '', + 'to' => '', + 'first_name' => '', + 'email' => '', + ); + + $form['info'] = array( + '#type' => 'fieldset', + '#title' => t('did Information'), + ); + + // helper field for file upload + $form['#attributes'] = array('enctype' => "multipart/form-data"); + $form['info']['upload'] = array( + '#type' => 'file', + '#title' => t('Upload DID List'), + '#default_value' => $edit['upload'], + ); + $module_path = base_path() . drupal_get_path('module', 'ictpbx_did'); + $form['info']['example'] = array( + '#type' => 'markup', + '#markup' => t("Example File: <a href='$module_path/did_sample.csv'>did_sample.csv</a>"), + ); + + $form['buttons']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + + return $form; +} + +/** + * Validates did import insert + */ +function ictpbx_did_import_validate($form, &$form_state) { + +} + + +/** + * Build the did form. + */ +function ictpbx_did_assign($form, &$form_state, $edit = array()) { + $edit += array( + 'phone' => '', + 'first_name' => '', + 'email' => '', + ); + + $form['info'] = array( + '#type' => 'fieldset', + '#title' => t('DID Information'), + ); + + // containing the DID's unique ID. + if (!empty($edit['account_id'])) { + $form['info']['account_id'] = array( + '#type' => 'value', + '#value' => $edit['account_id'], + ); + } + + $form['info']['phone'] = array( + '#type' => 'textfield', + '#title' => t('DID Number'), + '#default_value' => $edit['phone'], + ); + + $form['info']['first_name'] = array( + '#type' => 'textfield', + '#title' => t('First_Name'), + '#default_value' => $edit['first_name'], + ); + + $form['setting'] = array( + '#type' => 'fieldset', + '#title' => t('User Information'), + ); + + $form['setting']['created_by'] = array( + '#type' => 'select', + '#title' => t('Assign to User'), + '#options' => array(0 => 'None') + ictcore_user_option(), + '#default_value' => $edit['created_by'], + ); + + $form['setting']['email'] = array( + '#type' => 'textfield', + '#title' => t('E-mail to Forward DID'), + '#default_value' => $edit['email'], + ); + + $form['buttons']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + + return $form; +} + + +/** + * Crates a input form + */ +function ictfax_form($form, &$form_state, $edit = array()) { + $edit += array( + 'send_to' => '', + 'send_from' => '', + 'text' => '', + 'file_name' => '', + 'try_max' => 1, + ); + + // Include the CTools tools that we need. + ctools_include('ajax'); + ctools_include('modal'); + // Add CTools' javascript to the page. + ctools_modal_add_js(); + // drupal_add_js(drupal_get_path('module', 'ictfax') . '/fax_answer.js'); + // If we're editing an existing fax, we'll add a value field to the form + // containing the fax's unique ID. + if (!empty($edit['cid'])) { + $form['cid'] = array( + '#type' => 'value', + '#value' => $edit['cid'], + ); + } + + $form['info'] = array( + '#type' => 'fieldset', + '#title' => t('Fax Information'), + ); + + $form['info']['send_to'] = array( + '#type' => 'textfield', + '#title' => t('Send To'), + '#required' => TRUE, + '#size' => 60, + '#maxlength' => 128, + '#description' => t('Click \'Phonebook\' to select fax #. where to send fax'), + '#default_value' => $edit['send_to'], + ); + + $form['info']['url'] = array( + '#type' => 'hidden', + // The name of the class is the #id of $form['ajax_button'] with "-url" + // suffix. + '#attributes' => array('class' => array('contact-button-url')), + '#value' => url('ictfax/phonebookpopup'), + ); + + $form['info']['ajax_button'] = array( + '#type' => 'button', + '#value' => 'Phonebook', + '#attributes' => array('class' => array('ctools-use-modal')), + '#id' => 'contact-button', + ); + + $form['info']['text'] = array( + '#type' => 'hidden', + '#title' => t('Message'), + '#required' => FALSE, + '#cols' => 60, + '#rows' => 10, + '#default_value' => $edit['text'], + ); + + // helper field for file upload + $form['#attributes'] = array('enctype' => "multipart/form-data"); + $form['info']['file_name'] = array( + '#type' => 'file', + '#title' => t('Fax file'), + '#required' => FALSE, + '#description' => t('Select a file to send as fax, please use only tif, pdf, jpg, png, gif or txt file'), + ); + + $form['info']['try_max'] = array( + '#type' => 'select', + '#title' => t('No. of Retries'), + '#options' => array( + 1 => t('[None]'), // no retry = 1 try + 2 => t('1'), // 1 retry = 2 tries and so on ... + 3 => t('2'), + 4 => t('3')), + '#description' => t('No. of tries if call failed'), + '#default_value' => $edit['try_max'], + ); + + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Create new Fax'), + ); + + return $form; +} + +/** + * Performs validation. + * + */ +function ictfax_form_validate($form, &$form_state) { + $transmission = $form_state['values']; + if (isset($transmission['transmission_id'])) { + // we are editing an existing record + $existing_record = $transmission['transmission_id']; + } + if ($transmission['send_to'] == '') { + form_set_error('send_to', t('Recipient cannot be empty')); + } + if (empty($transmission['send_to'])) { + form_set_error('send_to', t('Fax Number is required.')); + } else { + if (!ctype_digit(str_replace(array('+', ','), '',$transmission['send_to']))) { + form_set_error('send_to', t('Fax Number is not valid.')); + } + } + // Validate file + $allowedTypes = array( + 1=>'odt', 2=>'ott', 3=>'sxw', 4=>'stw', 5=>'doc', 6=>'dot', 7=>'sdw', 8=>'vor', 9=>'htm', 10=>'sdd', + 11=>'sdp', 12=>'wpd', 13=>'ods', 14=>'ots', 15=>'sxc', 16=>'stc', 17=>'xls', 18=>'xlw', 19=>'xlt', 20=>'sdc', + 21=>'csv', 22=>'odp', 23=>'otp', 24=>'sxi', 25=>'sti', 26=>'ppt', 27=>'pps', 28=>'pot', 29=>'sxd', 30=>'odt', + 31=>'ott', 32=>'sxw', 33=>'stw', 34=>'doc', 35=>'dot', 36=>'sdw', 37=>'vor', 38=>'htm', 39=>'sdd', 40=>'sdp', + 41=>'wpd', 42=>'ods', 43=>'ots', 44=>'sxc', 45=>'stc', 46=>'xls', 47=>'xlw', 48=>'xlt', 49=>'sdc', 50=>'csv', + 51=>'odp', 52=>'otp', 53=>'sxi', 54=>'sti', 55=>'ppt', 56=>'pps', 57=>'pot', 58=>'sxd', 59=>'txt', 60=>'tif', + 61=>'jpg', 62=>'pdf', 63=>'png', 64=>'gif', + ); + $validators = array('file_validate_extensions' => $allowedTypes); + $file = file_save_upload('file_name', $validators); + if ($file) { + $form_state['values']['file_name'] = $file; // drupal file object + } else { + form_set_error('file_name', "File is required"); + } +} + + +function ictfax_list_contacts($form, &$form_state, $edit = array()) { + $edit += array( + 'table' => '', + 'phone_list' => '', + ); + global $user; + + $header = array( + 'first_name' => t('First Name'), + 'last_name' => t('Last Name'), + 'phone' => t('phone'), + 'email' => t('E-Mail'), + ); + + $query = CoreDB::db_select('contact', 'c')->extend('PagerDefault'); + $query->fields('c', array('contact_id', 'first_name','last_name', 'phone', 'email')); + $query->condition('c.created_by', $user->uid,'='); + $result = $query->limit(10) + ->extend('TableSort') + ->orderByHeader($header) + ->execute(); + + $options = array(); + while ($contact = $result->fetchAssoc()) { + $options[$contact['contact_id']] = array( + 'first_name' => check_plain($contact['first_name']), + 'last_name' => check_plain($contact['last_name']), + 'phone' => check_plain($contact['phone']), + 'email' => check_plain($contact['email']), + ); + } + + $form['info']['table'] = array( + '#type' => 'tableselect', + '#header' => $header, + '#options' => $options, + '#multiple' => FALSE, + // '#input'=>true, + '#empty' => t('No record available'), + // '#advanced_select'=>false, + '#attributes' => '', + // '#default_value'=> $edit['table'], + ); + + $form['info']['pager'] = array( + '#type' => 'item', + '#markup' => theme('pager'), + ); + + $form['phone_list'] = array( + '#type' => 'hidden', + // '#value' => $edit['phone_list'], + ); + + $form['info']['submit'] = array( + '#type' => 'submit', + '#value' => t('Select'), + ); + + return $form; +} + + +/** + * Build the did form. + */ +function ictpbx_did_forward($form, &$form_state, $edit = array()) { + + $form['info'] = array( + '#type' => 'fieldset', + '#title' => t('DID Information'), + ); + + // containing the DID's unique ID. + if (!empty($edit['account_id'])) { + $form['info']['account_id'] = array( + '#type' => 'value', + '#value' => $edit['account_id'], + ); + } + + $form['info']['phone'] = array( + '#type' => 'textfield', + '#title' => t('DID Number'), + '#value' => $edit['phone'], + ); + + $form['setting'] = array( + '#type' => 'fieldset', + '#title' => t('User Information'), + ); + + $form['setting']['email'] = array( + '#type' => 'textfield', + '#title' => t('E-mail to Forward DID'), + '#default_value' => $edit['email'], + ); + + $form['buttons']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + + return $form; +} + + +/** + * Build the trunk form. + */ +function ictpbx_trunk_form($form, &$form_state, $edit = array()) { + // It's safe to use on both an empty array, and an incoming array with full or partial data. + $edit += array( + 'technology_id' => '', + 'name' => '', + 'description' => '', + 'username' => '', + 'password' => '', + 'host' => '', + 'port' => '', + // 'channel' => '1', + 'prefix' => '00', + 'dialstring' => 'sofia/gateway/%trunk/%phone', + 'register' => '', + 'active' => '', + + ); + + // If we're editing an existing fax, we'll add a value field to the form + // containing the fax's unique ID. + if (!empty($edit['provider_id'])) { + $form['provider_id'] = array( + '#type' => 'value', + '#value' => $edit['provider_id'], + ); + } + + $form['info'] = array( + '#type' => 'fieldset', + '#title' => t('Trunk Information'), + ); + + $form['info']['technology_id'] = array( + '#type' => 'select', + '#title' => t('Choose Provider Trunk Type'), + '#options' => ictcore_technology_option(), + '#default_value' => $edit['technology_id'], + ); + + $form['info']['name'] = array( + '#type' => 'textfield', + '#title' => t('Trunk Name'), + '#required' => TRUE, + '#default_value' => $edit['name'], + '#description' => t('Trunk name must match with gateway name that you created in freeswitch.'), + ); + + $form['info']['description'] = array( + '#type' => 'textarea', + '#title' => t('Trunk Description'), + '#default_value' => $edit['description'], + ); + + $form['info']['active'] = array( + '#type' => 'radios', + '#title' => t('Choose Status'), + '#options' => array(0 => 'Blocked', 1 => 'Active'), + '#default_value' => $edit['active'], + '#description' => t('Trunk name must match with gateway name that you created in freeswitch.'), + ); + + $form['setting'] = array( + '#type' => 'fieldset', + '#title' => t('Trunk Settings'), + ); + + $form['setting']['username'] = array( + '#type' => 'textfield', + '#title' => t('Username'), + '#default_value' => $edit['username'], + ); + + $form['setting']['password'] = array( + '#type' => 'textfield', + '#title' => t('Password'), + '#default_value' => $edit['password'], + ); + + $form['setting']['host'] = array( + '#type' => 'textfield', + '#title' => t('Host'), + '#default_value' => $edit['host'], + ); + + $form['setting']['port'] = array( + '#type' => 'textfield', + '#title' => t('Port'), + '#default_value' => $edit['port'], + ); + + $form['setting']['prefix'] = array( + '#type' => 'textfield', + '#title' => t('Add Prefix'), + '#default_value' => $edit['prefix'], + ); + + $form['setting']['dialstring'] = array( + '#type' => 'textfield', + '#title' => t('Dial String'), + '#default_value' => $edit['dialstring'], + ); + + $form['setting']['register'] = array( + '#type' => 'textfield', + '#title' => t('Register'), + '#default_value' => $edit['register'], + ); + + $form['buttons']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + + return $form; +} + Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/include/forms.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/include/formselectcountry.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/include/formselectcountry.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/include/formselectcountry.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,46 @@ +<?php +/** + * XOOPS form element + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage form + * @since 2.0.0 + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/ + * @version $Id: formselectcountry.php 12537 2014-05-19 14:19:33Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') || die('Restricted access'); + +xoops_load('XoopsLists'); +xoops_load('XoopsFormSelect'); + +/** + * A select field with countries + */ +class IctpbxFormSelectCountry extends XoopsFormSelect +{ + /** + * Constructor + * + * @param string $caption Caption + * @param string $name "name" attribute + * @param mixed $value Pre-selected value (or array of them). + * Legal are all 2-letter country codes (in capitals). + * @param int $size Number or rows. "1" makes a drop-down-list + * @param bool $envalued false is a hash key index with true being a named key index + */ + function IctpbxFormSelectCountry($caption, $name, $value = null, $size = 1, $envalued = false) + { + $this->XoopsFormSelect($caption, $name, $value, $size); + $this->addOptionArray(array_merge(array(""=>_ICTPBX_FORM_SELECT_CHOOSEOPTION),ictpbx_country_list_api($envalued))); + } +} Property changes on: XoopsModules/ICTPBX/trunk/modules/ict/include/formselectcountry.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/ICTPBX/trunk/modules/ict/include/functions.php =================================================================== --- XoopsModules/ICTPBX/trunk/modules/ict/include/functions.php (rev 0) +++ XoopsModules/ICTPBX/trunk/modules/ict/include/functions.php 2015-10-06 20:43:27 UTC (rev 13155) @@ -0,0 +1,1226 @@ +<?php +/** + * ICT-FAX Open Source Fax system based on ICT Innovations drupal modules + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright © 2012 ICT Innovations, All Rights Reserved + * @copyright © 2015 Chronolabs Cooperative, All Rights Reserved + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @subpackage ictfax + * @category foip/fax + * @since 1.0.1 + * @author Simon A. Roberts <wis...@us...> + * @author Falak Nawaz <su...@ic...> + * @author Nasir Iqbal <su...@ic...> + * @author Tahir Almas <su...@ic...> + * @see http://www.ictinnovations.com/ + * @see http://labs.coop/ + * @link mailto:in...@ic... + */ + +require_once __DIR__ . DIRECTORY_SEPARATOR . 'constants.php'; +require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'coredb.php'; + +function ictpbx_country_list_api($envalued = false) +{ + static $countries = array(); + if (!isset($countries[$envalued]) || empty($countries[$envalued])) + { + xoops_load("XoopsCache"); + if (!$countries[$envalued] = XoopsCache::read($cache = "ictpbx_countries".($envalued==false?"_hashed":"_named"))) + { + $placesapi = ictpbx_getFileContents(__DIR__ . DIRECTORY_SEPARATOR . "places-api.uris"); + $tries=-1; + while($tries < 9) + { + $tries++; + shuffle($placesapi); + $data = json_decode(ictpbx_getURL($placesapi[mt_rand(0, count($placesapi)-1)] . "/v1/list/list/json.api", 60, 60), true); + if (isset($data['countries']) && !empty($data['countries'])) + { + $tries = 9; + if ($envalued==0) + { + $countries[$envalued] = array(); + foreach($data['countries'] as $key => $values) + $countries[$envalued][$values['key']] = $values['Country']; + } else { + $countries[$envalued] = array()... [truncated message content] |