phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sms inc/class.sms.inc.php inc/class.uiautorepla...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] sms inc/class.sms.inc.php inc/class.uiautorepla...
Date: Wed, 31 May 2006 12:42:47 +0000

CVSROOT:        /sources/phpgroupware
Module name:    sms
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/05/31 12:42:46

Modified files:
        inc            : class.sms.inc.php class.uiautoreplay.inc.php 
                         class.uipolls.inc.php 
        setup          : default_records.inc.php 
Added files:
        inc            : feedcreator.class.php 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.sms.inc.php.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.uiautoreplay.inc.php.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.uipolls.inc.php.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/feedcreator.class.php?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/setup/default_records.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: sms/inc/class.sms.inc.php
diff -u sms/inc/class.sms.inc.php:1.11 sms/inc/class.sms.inc.php:1.12
--- sms/inc/class.sms.inc.php:1.11      Mon May 29 21:21:47 2006
+++ sms/inc/class.sms.inc.php   Wed May 31 12:42:46 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage sms
-       * @version $Id: class.sms.inc.php,v 1.11 2006/05/29 21:21:47 sigurdne 
Exp $
+       * @version $Id: class.sms.inc.php,v 1.12 2006/05/31 12:42:46 sigurdne 
Exp $
        */
 
        /**
@@ -353,17 +353,19 @@
                        {
                        // masked sender sets here
                                $masked_sender = 
substr_replace($sms_sender,'xxxx',-4);
-                               $db_query = "
-                                       INSERT INTO phpgw_sms_tblSMSIncoming 
+                               $sql = "
+                                       INSERT INTO phpgw_sms_tblsmsincoming 
                                        
(in_gateway,in_sender,in_masked,in_code,in_msg,in_datetime) 
                                        VALUES 
('$gateway_module','$sms_sender','$masked_sender','$target_code','$message','$sms_datetime')
                                        ";
-                               if ($cek_ok = @dba_insert_id($db_query))
+                               $this->db->query($sql,__LINE__,__FILE__);
+
+                               if ($cek_ok = 
$this->db->get_last_insert_id(phpgw_sms_tblsmsincoming,'in_id'))
                                {
                                        $db_query1 = "SELECT 
board_forward_email FROM phpgw_sms_featboard WHERE board_code='$target_code'";
-                                       $db_result1 = dba_query($db_query1);
-                                       $db_row1 = dba_fetch_array($db_result1);
-                                       $email = $db_row1[board_forward_email];
+                                       
$this->db->query($db_query1,__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $email = 
$this->db->f('board_forward_email');
                                        if ($email)
                                        {
                                                $subject = 
"[SMSGW-$target_code] from $sms_sender";
@@ -373,7 +375,7 @@
                                                $body .= "Code: 
$target_code\n\n";
                                                $body .= 
"Message:\n$message\n\n";
                                                $body .= $email_footer."\n\n";
-                                               
sendmail($email_service,$email,$subject,$body);
+                                               
$this->sendmail($email_service,$email,$subject,$body);
                                        }
                                        $ok = true;
                                }
@@ -546,7 +548,7 @@
                function outputtorss($code,$line="10")
                {
                        $web_title = $this->web_title;
-                       include_once 
"$this->apps_path[libs]/gpl/feedcreator.class.php";
+                       include_once 
"$this->apps_path[inc]/feedcreator.class.php";
                        $code = strtoupper($code);
                        if (!$line)
                        {
@@ -555,13 +557,13 @@
                        
                        $format_output = "RSS0.91";
                        $rss = new UniversalFeedCreator();
-                       $db_query1 = "SELECT * FROM phpgw_sms_tblSMSIncoming 
WHERE in_code='$code' ORDER BY in_datetime DESC LIMIT 0,$line";
-                       $db_result1 = dba_query($db_query1);
-                       while ($db_row1 = dba_fetch_array($db_result1))
-                       {
-                               $title = $db_row1[in_masked];
-                               $description = $db_row1[in_msg];
-                               $datetime = $db_row1[in_datetime];
+                       $db_query1 = "SELECT * FROM phpgw_sms_tblsmsincoming 
WHERE in_code='$code' ORDER BY in_datetime DESC LIMIT 0,$line";
+                       $this->db->query($db_query1,__LINE__,__FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $title = $this->db->f('in_masked');
+                               $description = $this->db->f('in_msg');
+                               $datetime = $this->db->f('in_datetime');
                                $items = new FeedItem();
                                $items->title = $title;
                                $items->description = $description;
Index: sms/inc/class.uiautoreplay.inc.php
diff -u sms/inc/class.uiautoreplay.inc.php:1.3 
sms/inc/class.uiautoreplay.inc.php:1.4
--- sms/inc/class.uiautoreplay.inc.php:1.3      Tue May 30 13:26:48 2006
+++ sms/inc/class.uiautoreplay.inc.php  Wed May 31 12:42:46 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage autoreplay
-       * @version $Id: class.uiautoreplay.inc.php,v 1.3 2006/05/30 13:26:48 
sigurdne Exp $
+       * @version $Id: class.uiautoreplay.inc.php,v 1.4 2006/05/31 12:42:46 
sigurdne Exp $
        */
 
        /**
@@ -103,12 +103,24 @@
                                $content .= "[<a href=" . 
$GLOBALS['phpgw']->link('/index.php','menuaction=sms.uiautoreplay.delete&autoreply_id='
 . $this->db->f('autoreply_id')) . ">x</a>] ";
                                $content .= " <b>Code:</b> " . 
$this->db->f('autoreply_code') . "&nbsp;&nbsp;<b>User:</b> $owner<br><br>";
                        }
-                       echo $content;
 
-                       echo "
+
+                       $content .= "
                            <p>
                            <a href=\"$add_url\">[ Add SMS autoreply ]</a>
                        ";
+
+                               $done_data = array(
+                               'menuaction'    => 
$this->currentapp.'.uiconfig.index');
+                               
+                               $done_url = 
$GLOBALS['phpgw']->link('/index.php',$done_data);
+
+                               $content .= "
+                                   <p><li>
+                                   <a href=\"$done_url\">Back</a>
+                                   <p>
+                               ";
+                       echo $content;
                }
 
                function add()
Index: sms/inc/class.uipolls.inc.php
diff -u sms/inc/class.uipolls.inc.php:1.1 sms/inc/class.uipolls.inc.php:1.2
--- sms/inc/class.uipolls.inc.php:1.1   Tue May 30 19:42:02 2006
+++ sms/inc/class.uipolls.inc.php       Wed May 31 12:42:46 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage polls
-       * @version $Id: class.uipolls.inc.php,v 1.1 2006/05/30 19:42:02 
sigurdne Exp $
+       * @version $Id: class.uipolls.inc.php,v 1.2 2006/05/31 12:42:46 
sigurdne Exp $
        */
 
        /**
@@ -20,7 +20,10 @@
        {
                var $public_functions = array(
                        'index'         => True,
+                       'add'           => True,
+                       'add_yes'               => True,
                        'view'          => True,
+                       'delete'                => True,
                        );
 
 
@@ -108,10 +111,133 @@
                            <p>
                        ";
 
+                               $done_data = array(
+                               'menuaction'    => 
$this->currentapp.'.uiconfig.index');
+                               
+                               $done_url = 
$GLOBALS['phpgw']->link('/index.php',$done_data);
+
+                               $content .= "
+                                   <p><li>
+                                   <a href=\"$done_url\">Back</a>
+                                   <p>
+                               ";
+
                        echo $content;  
                }
 
 
+
+               function add()
+               {
+               
+                       if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
+                       {
+                               $links = 
$this->menu->links('.config.autoreplay');
+                               $GLOBALS['phpgw_info']['flags']['xslt_app'] = 
True;
+                               $this->bocommon->no_access($links);
+                               return;
+                       }
+                       
+                       
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('SMS').' - '.lang('Add SMS poll');
+                       $GLOBALS['phpgw']->common->phpgw_header();
+
+                       echo parse_navbar();
+
+                       $err    = urldecode(get_var('err',array('POST','GET')));
+                       $add_autoreply_code     = 
get_var('add_autoreply_code',array('POST','GET'));
+
+                       if ($err)
+                       {
+                           $content = "<p><font color=red>$err</font><p>";
+                       }
+
+                       $add_data = array(
+                               'menuaction'    => 
$this->currentapp.'.uipolls.add_yes',
+                               'autoreply_id' => $autoreply_id
+                               );
+                               
+                       $add_url = 
$GLOBALS['phpgw']->link('/index.php',$add_data);
+
+
+                       $content .= "
+                           <p>
+                           <form action=$add_url method=post>
+                           <p>SMS poll code: <input type=text size=3 
maxlength=10 name=add_poll_code value=\"$add_poll_code\">
+                           <p>SMS poll title: <input type=text size=60 
maxlength=200 name=add_poll_title value=\"$add_poll_title\">
+                           <p><input type=submit class=button value=Add>
+                           </form>
+                       ";
+
+                       $done_data = array('menuaction' => 
$this->currentapp.'.uipolls.index');
+                       $done_url = 
$GLOBALS['phpgw']->link('/index.php',$done_data);
+
+                       $content .= "
+                           <p>
+                           <a href=\"$done_url\">[ Done ]</a>
+                           <p>
+                       ";
+
+
+                       echo $content;
+
+               }
+
+               function add_yes()
+               {
+               
+                       if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
+                       {
+                               $links = 
$this->menu->links('.config.autoreplay');
+                               $GLOBALS['phpgw_info']['flags']['xslt_app'] = 
True;
+                               $this->bocommon->no_access($links);
+                               return;
+                       }
+
+                       $add_poll_code  = 
strtoupper(get_var('add_poll_code',array('POST','GET')));
+                       $add_poll_title = 
get_var('add_poll_title',array('POST','GET'));
+
+                       $uid = $this->account;
+                       $target = 'add';
+
+                       if ($add_poll_title && $add_poll_code)
+                       {
+                           if ($this->sms->checkavailablecode($add_poll_code))
+                           {
+                                       $sql = "
+                                           INSERT INTO phpgw_sms_featpoll 
(uid,poll_code,poll_title)
+                                           VALUES 
('$uid','$add_poll_code','$add_poll_title')
+                                       ";
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+
+                                       $new_uid = 
$this->db->get_last_insert_id(phpgw_sms_featpoll,'poll_id');
+
+                                       $this->db->transaction_commit();
+                                       
+                                       if ($new_uid)
+                                       {
+                                           $error_string = "SMS poll with code 
`$add_poll_code` has been added";
+                                       }
+                           }
+                           else
+                           {
+                                       $error_string = "SMS code 
`$add_poll_code` already exists, reserved or use by other feature!";
+                           }
+                       }
+                       else
+                       {
+                           $error_string = "You must fill all fields!";
+                       }
+                       header ("Location: 
menu.php?inc=sms_poll&op=sms_poll_add&err=".urlencode($error_string));
+
+                       $add_data = array(
+                               'menuaction'    => 
$this->currentapp.'.uipolls.' . $target,
+                               'err' => urlencode($error_string)
+                               );
+
+                       
$GLOBALS['phpgw']->redirect_link('/index.php',$add_data);
+               }
+
                function view()
                {
                        if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
@@ -214,5 +340,75 @@
                        }
                }
 
+               function delete()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+                       if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
+                       {
+                               $this->bocommon->no_access($links);
+                               return;
+                       }
+
+                       $poll_id        = 
get_var('poll_id',array('POST','GET'));
+                       $confirm        = get_var('confirm',array('POST'));
+
+                       $link_data = array
+                       (
+                               'menuaction' => 
$this->currentapp.'.uipolls.index',
+                               'poll_id' => $poll_id
+                       );
+
+                       if (get_var('confirm',array('POST')))
+                       {
+                       //      $this->bo->delete_type($autoreply_id);
+
+                               $sql = "SELECT poll_title FROM 
phpgw_sms_featpoll WHERE poll_id='$poll_id'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db->next_record();
+
+                               $poll_title = $this->db->f('poll_title');
+
+                               if ($poll_title)
+                               {
+                                       $sql = "DELETE FROM phpgw_sms_featpoll 
WHERE poll_title='$poll_title'";
+                                       $this->db->transaction_begin();
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                                       if ($this->db->affected_rows())
+                               {
+                                               $sql = "DELETE FROM 
phpgw_sms_tblsmsincoming WHERE in_code='$poll_title'";
+                                               
$this->db->query($sql,__LINE__,__FILE__);       
+                                               $error_string = "SMS poll 
`$poll_title` with all its messages has been deleted!";
+                                       }
+                                       else
+                               {
+                                               $error_string = "Fail to delete 
SMS poll `$poll_title`";
+                               }
+                               $this->db->transaction_commit();
+                               }
+                                       
+                               $link_data['err'] = urlencode($error_string);
+
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+                       $data = array
+                       (
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipolls.delete&poll_id='
 . $poll_id),
+                               'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
+                               'lang_yes'                              => 
lang('yes'),
+                               'lang_yes_statustext'   => lang('Delete the 
entry'),
+                               'lang_no_statustext'    => lang('Back to the 
list'),
+                               'lang_no'                               => 
lang('no')
+                       );
+
+                       $appname                                        = 
lang('sms');
+                       $function_msg                                   = 
lang('delete poll');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+               }
        }
 ?>
Index: sms/setup/default_records.inc.php
diff -u sms/setup/default_records.inc.php:1.7 
sms/setup/default_records.inc.php:1.8
--- sms/setup/default_records.inc.php:1.7       Mon May 29 07:57:41 2006
+++ sms/setup/default_records.inc.php   Wed May 31 12:42:46 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage setup
-       * @version $Id: default_records.inc.php,v 1.7 2006/05/29 07:57:41 
sigurdne Exp $
+       * @version $Id: default_records.inc.php,v 1.8 2006/05/31 12:42:46 
sigurdne Exp $
        */
 
 
@@ -100,7 +100,7 @@
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_sms_featautoreply_scenario 
(autoreply_id,autoreply_scenario_param1,autoreply_scenario_param2,autoreply_scenario_param3,autoreply_scenario_param4,autoreply_scenario_param5,autoreply_scenario_param6,autoreply_scenario_param7,autoreply_scenario_result)
 VALUES (1,'INTERNET','DOWN','','','','','','Please contact sysadmin via phone: 
+62 21 8613027')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_sms_featautoreply_scenario 
(autoreply_id,autoreply_scenario_param1,autoreply_scenario_param2,autoreply_scenario_param3,autoreply_scenario_param4,autoreply_scenario_param5,autoreply_scenario_param6,autoreply_scenario_param7,autoreply_scenario_result)
 VALUES (1,'WEBMAIL','PASSWORD','ERROR','','','','','Please use forgot password 
link, and follow given instructions')");
 
-       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_sms_featboard 
(uid,board_code,board_forward_email,board_pref_template) VALUES 
(1,'PHP','address@hidden','<font color=black 
size=-1><b>##SENDER##</b></font><br><font color=black 
size=-2><i>##DATETIME##</i></font><br><font color=black 
size=-1>##MESSAGE##</font>')");
+       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_sms_featboard 
(uid,board_code,board_forward_email,board_pref_template) VALUES 
(1,'PHP','address@hidden','<font color=black 
size=-1><b>##SENDER##</b></font><br><font color=black 
size=-2><i>##DATETIME##</i></font><br><font color=black 
size=-1>##MESSAGE##</font>')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_sms_featcommand (uid,command_code,command_exec) VALUES 
(1,'UPTIME','/home/playsms/public_html/phpgroupware/sms/bin/uptime.sh 
##SMSSENDER##')");
 
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_sms_featcustom 
(uid,custom_code,custom_url) VALUES 
(1,'CURR','http://www.ngoprek.org/currency.php?toeuro=##CUSTOMPARAM##&sender=##SMSSENDER##')");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]