Example #1
1
File: fn.php Project: pr4ka5a/telek
function teltree_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $teltree_keyword, $teltree_param = '', $smsc = '', $raw_message = '')
{
    $ps = explode(" ", $raw_message, 2);
    $kk = strtoupper($ps[0]);
    $username = "******";
    if ($teltree_keyword == 'DAFTAR') {
        $pecah = preg_split("/#/", $ps[1], null, PREG_SPLIT_NO_EMPTY);
        $data = array();
        $data['name'] = trim($pecah[0]);
        $data['username'] = trim($pecah[0]);
        $data['mobile'] = $sms_sender;
        $data['email'] = str_replace(' ', '', $data['name']) . "@noreply.org";
        $data['parent_uid'] = 1;
        //----- ini parentnya admin
        $data['status'] = 4;
        //---ini artinya ditambahkan ke sub user
        $ret = user_add($data);
        $ok = $ret['status'] ? TRUE : FALSE;
        if ($ok) {
            echo "okee";
            $items = array('uid' => 1, 'name' => $data['name'], 'mobile' => $data['mobile'], 'email' => $data['email'], 'tags' => $tags);
            if ($c_pid = dba_add(_DB_PREF_ . '_featurePhonebook', $items)) {
                $save_to_group = TRUE;
                _log('Success to add contact pid:' . $c_pid . ' m:' . $data['mobile'] . ' n:' . $data['name'] . ' e:' . $data['email'] . ' tags:[' . $data['tags'] . ']', 2, 'teltree');
            } else {
                _log('Fail to add contact pid:' . $c_pid . ' m:' . $data['mobile'] . ' n:' . $data['name'] . ' e:' . $data['email'] . ' tags:[' . $data['tags'] . ']', 2, 'teltree');
            }
            $balasan = "Selamat anda telah terdaftar di Telephone Tree";
            $gagal = "Maaf Sistem sedang mengalami gangguan, silahkan coba beberapa saat lagi";
            if ($save_to_group) {
                $unicode = core_detect_unicode($balasan);
                $balasan = addslashes($balasan);
                // $username = "******";
                //$smsc = "dev";
                _log("returns:" . $balasan, 2, "teltree");
                sendsms_helper($username, $sms_sender, $balasan, 'text', $unicode, $smsc);
            } else {
                $unicode = core_detect_unicode($gagal);
                $balasan = addslashes($gagal);
                _log("returns:" . $gagal, 2, "teltree");
                sendsms_helper($username, $sms_sender, $balasan, 'text', $unicode, $smsc);
                _log_print("returns empty", 2, "teltree");
            }
        } else {
            echo "gagal";
        }
        return $ret;
        //$ok = true;
    } elseif ($kk == 'GABUNG') {
        /*$gpids = dba_search(_DB_PREF_ . '_featurePhonebook_group','code',array(
        			
        		));*/
        $uid = user_mobile2uid($sms_sender);
        $group_code = strtoupper($ps[1]);
        $list = dba_search(_DB_PREF_ . '_featurePhonebook', 'id', array('uid' => 1, 'mobile' => $sms_sender));
        if ($group_code && $sms_sender) {
            /*--dummy code--*/
            $c_pid = dba_search(_DB_PREF_ . '_featurePhonebook', 'id', array('uid' => 1, 'mobile' => $sms_sender));
            $gpids = dba_search(_DB_PREF_ . '_featurePhonebook_group', 'id', array('uid' => 1, 'code' => $group_code));
            foreach ($gpids as $gpid) {
                foreach ($gpid as $key => $val) {
                    $items = array('gpid' => $val, 'pid' => $c_pid[0]['id']);
                    if (dba_isavail(_DB_PREF_ . '_featurePhonebook_group_contacts', $items, 'AND')) {
                        if (dba_add(_DB_PREF_ . '_featurePhonebook_group_contacts', $items)) {
                            $list = dba_search(_DB_PREF_ . '_featurePhonebook_group', 'code', array('uid' => 1));
                            _log('contact added to group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 2, 'phonebook_edit');
                            if ($iid = $c_pid[0]['id']) {
                                $bal_grup = "selamat anda telah tergabung di grup" . $list[$iid]['code'];
                                $unicode = core_detect_unicode($bal_grup);
                                $bal_grup = addslashes($bal_grup);
                                _log("returns:" . $bal_grup, 2, "telek");
                                sendsms_helper($username, $sms_sender, $bal_grup, 'text', $unicode, $smsc);
                                _log("returns empty", 2, "sms custom");
                            }
                        } else {
                            _log('contact edited but fail to save in group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 2, 'phonebook_edit');
                        }
                    }
                }
            }
        }
        //$ok = true;
    } elseif ($kk == 'KELUAR') {
        $uid = user_mobile2uid($sms_sender);
        $group_code = strtoupper($ps[1]);
        //_log($sms_sender . ' '. $group_code, 2 , 'test');
        if ($group_code && $sms_sender) {
            //		_log($sms_sender . ' '. $group_code, 2 , 'test');
            $c_pid = dba_search(_DB_PREF_ . '_featurePhonebook', 'id', array('uid' => 1, 'mobile' => $sms_sender));
            $gpids = dba_search(_DB_PREF_ . '_featurePhonebook_group', 'id', array('uid' => 1, 'code' => $group_code));
            foreach ($gpids as $gpid) {
                foreach ($gpid as $key => $val) {
                    $items = array('gpid' => $val, 'pid' => $c_pid[0]['id']);
                    //				_log($sms_sender . ' '. $group_code, 2 , 'test');
                    if (!dba_isavail(_DB_PREF_ . '_featurePhonebook_group_contacts', $items, 'AND')) {
                        if (dba_remove(_DB_PREF_ . '_featurePhonebook_group_contacts', $items)) {
                            if ($iid = $c_pid[0]['id']) {
                                $bal_grup = "anda telah keluar dari grup" . $list[$iid]['code'];
                                $unicode = core_detect_unicode($bal_grup);
                                $bal_grup = addslashes($bal_grup);
                                _log("returns:" . $bal_grup, 2, "telek");
                                sendsms_helper($username, $sms_sender, $bal_grup, 'text', $unicode, $smsc);
                                _log("returns empty", 2, "sms custom");
                            }
                            _log('contact removed from group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 2, 'teltree_phonebook_edit');
                        } else {
                            _log('contact fail to remove from group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 2, 'teltree_phonebook_edit');
                        }
                    } else {
                        _log('failed ' . $val . ' ' . $c_pid[0]['id'], 2, 'test');
                    }
                }
            }
        }
    }
}
Example #2
0
/**
 * Remove notification
 *
 * @param integer $uid
 *        User ID
 * @param string $id
 *        Notification ID
 * @return boolean
 */
function notif_remove($uid, $id)
{
    $ret = FALSE;
    $db_table = _DB_PREF_ . '_tblNotif';
    if ($result = dba_remove($db_table, array('uid' => $uid, 'id' => $id))) {
        _log('uid:' . $uid . ' id:' . $id, 2, 'notif_remove');
        $ret = TRUE;
    }
    return $ret;
}
Example #3
0
/**
 * Remove country
 * @param string $id Country ID
 * @return boolean
 */
function country_remove($id)
{
    $ret = FALSE;
    if (!$id) {
        return FALSE;
    }
    $db_table = _DB_PREF_ . '_tblCountry';
    if ($result = dba_remove($db_table, array('id' => $id))) {
        logger_print('id:' . $id, 3, 'country_remove');
        $ret = TRUE;
    }
    return $ret;
}
Example #4
0
/**
 * Remove a mobile number from stoplist
 *
 * @param integer $uid
 *        User ID
 * @param string $mobile
 *        single mobile number
 * @return boolean TRUE on added
 */
function stoplist_hook_blacklist_mobile_remove($uid, $mobile)
{
    $ret = FALSE;
    $conditions = array('mobile' => $mobile);
    if ($uid = (int) $uid) {
        $conditions['uid'] = $uid;
    }
    if (blacklist_mobile_isexists(0, $mobile)) {
        $removed = dba_remove(_DB_PREF_ . '_featureStoplist', $conditions);
        if ($removed) {
            _log('removed mobile from stoplist mobile:' . $mobile . ' uid:' . $uid, 2, 'stoplist_hook_blacklist_mobile_remove');
            $ret = TRUE;
        }
    } else {
        _log('mobile number is not in stoplist mobile:' . $mobile . ' uid:' . $uid, 2, 'stoplist_hook_blacklist_mobile_remove');
        $ret = TRUE;
    }
    return $ret;
}
Example #5
0
function registry_remove($uid, $registry_group, $registry_family = '', $registry_key = '')
{
    $ret = FALSE;
    $db_table = _DB_PREF_ . '_tblRegistry';
    if ($registry_group && $registry_family && $registry_key) {
        $conditions = array('uid' => $uid, 'registry_group' => $registry_group, 'registry_family' => $registry_family, 'registry_key' => $registry_key);
        $ret = dba_remove($db_table, $conditions);
    } else {
        if ($registry_group && $registry_family) {
            $conditions = array('uid' => $uid, 'registry_group' => $registry_group, 'registry_family' => $registry_family);
            $ret = dba_remove($db_table, $conditions);
        } else {
            if ($registry_group) {
                $conditions = array('uid' => $uid, 'registry_group' => $registry_group);
                $ret = dba_remove($db_table, $conditions);
            }
        }
    }
    return $ret;
}
Example #6
0
function credit_hook_rate_addusercredit($uid, $amount)
{
    global $plugin_config;
    $db_table = $plugin_config['credit']['db_table'];
    $parent_uid = user_getparentbyuid($uid);
    $username = user_uid2username($uid);
    $status = user_getfieldbyuid($uid, 'status');
    $balance = (double) rate_getusercredit($username);
    $amount = (double) $amount;
    if (abs($amount) <= 0) {
        _log('amount cannot be zero. amount:[' . $amount . ']', 2, 'credit_hook_rate_addusercredit');
        return FALSE;
    }
    // add to balance
    $balance = $balance + $amount;
    // record it
    $id = dba_add($db_table, array('parent_uid' => $parent_uid, 'uid' => $uid, 'username' => $username, 'status' => $status, 'create_datetime' => core_get_datetime(), 'amount' => $amount, 'balance' => $balance, 'flag_deleted' => 0));
    // update user's credit
    if ($id) {
        _log('saved id:' . $id . ' parent_uid:' . $parent_uid . ' uid:' . $uid . ' username:'******' amount:' . $amount . ' balance:' . $balance, 3, 'credit_add');
        if (rate_setusercredit($uid, $balance)) {
            _log('updated uid:' . $uid . ' credit:' . $balance, 3, 'credit_add');
            return TRUE;
        } else {
            _log('fail to update uid:' . $uid . ' credit:' . $balance, 3, 'credit_add');
            dba_remove($db_table, array('id' => $id));
            return FALSE;
        }
    } else {
        _log('fail to save parent_uid:' . $parent_uid . ' uid:' . $uid . ' username:'******' amount:' . $amount . ' balance:' . $balance, 3, 'credit_add');
        return FALSE;
    }
}
Example #7
0
     $itemid = $_REQUEST['itemid'];
     $items = array();
     foreach ($checkid as $key => $val) {
         if (strtoupper($val) == 'ON') {
             if ($itemid[$key]) {
                 $items[] = $itemid[$key];
             }
         }
     }
     $removed = FALSE;
     $go = $_REQUEST['go'];
     switch ($go) {
         case 'delete':
             foreach ($items as $item) {
                 $conditions = array('id' => $item);
                 if (dba_remove(_DB_PREF_ . '_featureStoplist', $conditions)) {
                     $removed = TRUE;
                 }
             }
             break;
     }
     $search = themes_search_session();
     $nav = themes_nav_session();
     if ($removed) {
         $_SESSION['dialog']['info'][] = _('Mobile numbers have been deleted');
     }
     $ref = $search['url'] . '&search_keyword=' . $search['keyword'] . '&search_category=' . $search['category'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
     header("Location: " . _u($ref));
     exit;
     break;
 case "stoplist_add":
Example #8
0
            } else {
                $_SESSION['error_string'] = _('Fail to edit SMSC');
            }
        } else {
            $_SESSION['error_string'] = _('Unknown error');
            header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=gateway_list'));
            exit;
        }
        header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=edit_smsc&id=' . $c_id));
        exit;
        break;
    case 'del_smsc':
        if ($c_id = $_REQUEST['id']) {
            $db_table = _DB_PREF_ . '_tblGateway';
            $condition = array('id' => $c_id);
            if (dba_remove($db_table, $condition)) {
                $_SESSION['error_string'] = _('SMSC has been removed');
            } else {
                $_SESSION['error_string'] = _('Fail to remove SMSC');
            }
        } else {
            $_SESSION['error_string'] = _('Unknown error');
        }
        header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=gateway_list'));
        exit;
        break;
    default:
        $content = "\n\t\t\t<h3>" . _('List of gateways and SMSCs') . "</h3>\n\t\t\t<ul class='nav nav-tabs nav-justified' id='playsms-tab'>\n\t\t\t\t<li class=active><a href='#tabs-gateway' data-toggle=tab>" . _('Gateways') . "</a></li>\n\t\t\t\t<li><a href='#tabs-virtual' data-toggle=tab>" . _('SMSCs') . "</a></li>\n\t\t\t</ul>\n\t\t\t<div class=tab-content>\n\t\t\t\t<div id='tabs-gateway' class='tab-pane fade in active'>\n\t\t\t\t\t" . _gateway_display() . "\n\t\t\t\t</div>\n\t\t\t\t<div id='tabs-virtual' class='tab-pane fade'>\n\t\t\t\t\t" . _gateway_display_smsc() . "\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<script type=\"text/javascript\" src=\"" . $core_config['http_path']['plug'] . "/themes/common/jscss/jquery.cookie.js\"></script>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\$('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e){\n\t\t\t\t\t\t//save the latest tab using a cookie:\n\t\t\t\t\t\t\$.cookie('gateway_last_tab', \$(e.target).attr('href'));\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t//activate latest tab, if it exists:\n\t\t\t\t\tvar lastTab = \$.cookie('gateway_last_tab');\n\t\t\t\t\tif (lastTab) {\n\t\t\t\t\t\t\$('ul.nav-tabs').children().removeClass('active');\n\t\t\t\t\t\t\$('a[href='+ lastTab +']').parents('li:first').addClass('active');\n\t\t\t\t\t\t\$('div.tab-content').children().removeClass('in active');\n\t\t\t\t\t\t\$(lastTab).addClass('in active');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t</script>\n\t\t";
}
$final_content = _err_display() . "\n\t<h2>" . _('Manage gateway and SMSC') . "</h2>\n\t" . $content;
_p($final_content);
Example #9
0
/**
 * Remove IP address from blacklist
 *
 * @param string $label
 *        single label, can be $username or $uid, its up to the implementator
 * @param string $ip
 *        single IP address
 * @return boolean TRUE on removed
 */
function firewall_hook_blacklist_removeip($label, $ip)
{
    $ret = FALSE;
    $c_uid = user_username2uid($label);
    $condition = array('uid' => $c_uid, 'ip_address' => $ip);
    $removed = dba_remove(_DB_PREF_ . '_featureFirewall', $condition);
    if ($removed) {
        _log('remove IP from blacklist ip:' . $ip . ' uid:' . $c_uid, 2, 'firewall_hook_blacklist_removeip');
        $ret = TRUE;
    }
    return $ret;
}
Example #10
0
     $option_flag_sender = "\n\t\t\t<option value='0' {$selected_0}>" . _('Me only') . "</option>\n\t\t\t<option value='1' {$selected_1}>" . _('Members') . "</option>\n\t\t\t<option value='2' {$selected_2}>" . _('Anyone') . "</option>";
     $content = _dialog() . "\n\t\t\t<h2>" . _('Phonebook') . "</h2>\n\t\t\t<h3>" . _('Edit group') . "</h3>\n\t\t\t<p>\n\t\t\t<form action=\"index.php?app=main&inc=feature_phonebook&route=group&op=actions&go=edit\" method=POST>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=gpid value=\"{$gpid}\">\n\t\t\t<table class=playsms-table>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('Group name') . "</td>\n\t\t\t\t<td><input type=text name=group_name value=\"" . phonebook_groupid2name($user_config['uid'], $gpid) . "\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Group code') . "</td>\n\t\t\t\t<td><input type=text name=group_code value=\"" . phonebook_groupid2code($user_config['uid'], $gpid) . "\" size=10> " . _hint(_('Please use uppercase and make it short')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Share phonebook and allow broadcast') . "</td>\n\t\t\t\t<td><select name=flag_sender>" . $option_flag_sender . "</select> " . _hint(_('Share this phonebook group and set permission for broadcasting SMS to this group from mobile phone')) . "</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\"></p>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_phonebook&route=group&op=list');
     if ($err = TRUE) {
         _p(_dialog());
     }
     _p($content);
     break;
 case "actions":
     $nav = themes_nav_session();
     $search = themes_search_session();
     $go = $_REQUEST['go'];
     switch ($go) {
         case 'delete':
             if ($gpid = $_REQUEST['gpid']) {
                 if (!dba_count(_DB_PREF_ . '_featurePhonebook_group_contacts', array('gpid' => $gpid))) {
                     if (dba_remove(_DB_PREF_ . '_featurePhonebook_group', array('uid' => $user_config['uid'], 'id' => $gpid))) {
                         $_SESSION['dialog']['info'][] = _('Selected group has been deleted');
                     } else {
                         $_SESSION['dialog']['danger'][] = _('Fail to delete group');
                     }
                 } else {
                     $_SESSION['dialog']['danger'][] = _('Unable to delete group until the group is empty');
                 }
             }
             $ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&search_category=' . $search['category'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
             header("Location: " . _u($ref));
             exit;
             break;
         case 'add':
             $group_name = $_POST['group_name'];
             $group_code = strtoupper(trim($_POST['group_code']));
Example #11
0
/**
 * Remove IP address from blacklist
 *
 * @param string $label
 *        single label, can be $username or $uid, its up to the implementator
 * @param string $ip
 *        single IP address
 * @return boolean TRUE on removed
 */
function firewall_hook_blacklist_removeip($label, $ip)
{
    $ret = FALSE;
    $condition = array('uid' => user_username2uid($label), 'ip_address' => $ip);
    $removed = dba_remove(_DB_PREF_ . '_featureFirewall', $condition);
    if ($removed) {
        $ret = TRUE;
    }
    return $ret;
}
Example #12
0
function sms_subscribe_member_remove($member_id)
{
    $db_table = _DB_PREF_ . "_featureSubscribe_member";
    $conditions = array('member_id' => $member_id);
    return dba_remove($db_table, $conditions);
}
Example #13
0
 $email = str_replace("\"", "", $email);
 if ($c_pid && $mobile && $name) {
     $items = array('name' => $name, 'mobile' => $mobile, 'email' => $email);
     $conditions = array('id' => $c_pid, 'uid' => $uid);
     dba_update(_DB_PREF_ . '_featurePhonebook', $items, $conditions, 'AND');
     logger_print('contact edited pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_edit');
 } else {
     $_SESSION['error_string'] = _('You must fill mandatory fields');
     header("Location: " . _u('index.php?app=main&inc=feature_phonebook&op=phonebook_list'));
     exit;
     break;
 }
 foreach ($gpids as $gpid) {
     $maps[][$c_pid] = $gpid;
 }
 dba_remove(_DB_PREF_ . '_featurePhonebook_group_contacts', array('pid' => $c_pid));
 foreach ($maps as $map) {
     foreach ($map as $key => $val) {
         $gpid = $val;
         $c_pid = $key;
         $items = array('gpid' => $gpid, 'pid' => $c_pid);
         if (dba_isavail(_DB_PREF_ . '_featurePhonebook_group_contacts', $items, 'AND')) {
             if (dba_add(_DB_PREF_ . '_featurePhonebook_group_contacts', $items)) {
                 logger_print('contact added to group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_edit');
             } else {
                 logger_print('contact edited but fail to save in group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_edit');
             }
         }
     }
 }
 $_SESSION['error_string'] = _('Contact has been edited');
Example #14
0
/**
 * Delete existing user
 *
 * @param integer $uid
 *        	User ID
 * @return array $ret('error_string', 'status')
 */
function user_remove($uid, $forced = FALSE)
{
    global $user_config;
    $ret['error_string'] = _('Unknown error has occurred');
    $ret['status'] = FALSE;
    if ($forced || auth_isadmin() || $user_config['status'] == 3) {
        if ($username = user_uid2username($uid)) {
            if (!($uid == 1)) {
                if ($uid == $user_config['uid']) {
                    $ret['error_string'] = _('Currently logged in user is immune to deletion');
                } else {
                    $subusers = user_getsubuserbyuid($uid);
                    if (count($subusers) > 0) {
                        $ret['error_string'] = _('Unable to delete this user until all subusers under this user have been removed');
                        return $ret;
                    }
                    if ($user_config['status'] == 3) {
                        $parent_uid = user_getparentbyuid($uid);
                        if ($parent_uid != $user_config['uid']) {
                            $ret['error_string'] = _('Unable to delete other users');
                            return $ret;
                        }
                    }
                    if (dba_remove(_DB_PREF_ . '_tblUser', array('uid' => $uid))) {
                        user_banned_remove($uid);
                        _log('user removed u:' . $username . ' uid:' . $uid, 2, 'user_remove');
                        $ret['error_string'] = _('Account has been removed') . " (" . _('username') . ": " . $username . ")";
                        $ret['status'] = TRUE;
                    }
                }
            } else {
                $ret['error_string'] = _('User is immune to deletion') . " (" . _('username') . ": " . $username . ")";
            }
        } else {
            $ret['error_string'] = _('User does not exist');
        }
    } else {
        $ret['error_string'] = _('User deletion unavailable');
    }
    return $ret;
}
Example #15
0
    case 'delete':
        foreach ($items as $item) {
            if (dba_remove(_DB_PREF_ . '_featurePhonebook', array('uid' => $user_config['uid'], 'id' => $item))) {
                dba_remove(_DB_PREF_ . '_featurePhonebook_group_contacts', array('pid' => $item));
                $_SESSION['dialog']['info'][] = _('Selected contact has been deleted');
            }
        }
        break;
}
$gpid = 0;
$ops = explode('_', _OP_);
if ($ops[0] == 'move' && $ops[1]) {
    $gpid = $ops[1];
}
if ($gpid && dba_valid(_DB_PREF_ . '_featurePhonebook_group', 'id', $gpid)) {
    foreach ($items as $item) {
        if (dba_valid(_DB_PREF_ . '_featurePhonebook', 'id', $item)) {
            if (dba_remove(_DB_PREF_ . '_featurePhonebook_group_contacts', array('pid' => $item)) or dba_isavail(_DB_PREF_ . '_featurePhonebook_group_contacts', array('pid' => $item))) {
                $data = array('pid' => $item, 'gpid' => $gpid);
                if (dba_add(_DB_PREF_ . '_featurePhonebook_group_contacts', $data)) {
                    $_SESSION['dialog']['info'][] = _('Selected contact moved to new group');
                }
            }
        }
    }
}
$search = themes_search_session();
$nav = themes_nav_session();
$ref = $search['url'] . '&search_keyword=' . $search['keyword'] . '&search_category=' . $search['category'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
header("Location: " . _u($ref));
exit;
Example #16
0
     $checkid = $_REQUEST['checkid'];
     $itemid = $_REQUEST['itemid'];
     $items = array();
     foreach ($checkid as $key => $val) {
         if (strtoupper($val) == 'ON') {
             if ($itemid[$key]) {
                 $items[] = $itemid[$key];
             }
         }
     }
     $go = $_REQUEST['go'];
     switch ($go) {
         case 'delete':
             foreach ($items as $item) {
                 $conditions = array('id' => $item);
                 dba_remove(_DB_PREF_ . '_featureFirewall', $conditions);
             }
             break;
     }
     $search = themes_search_session();
     $nav = themes_nav_session();
     $_SESSION['error_string'] = _('IP addreses has been deleted');
     $ref = $search['url'] . '&search_keyword=' . $search['keyword'] . '&search_category=' . $search['category'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
     header("Location: " . _u($ref));
     exit;
     break;
 case "firewall_add":
     $content = _err_display() . "\n\t\t\t<h2>" . _('Manage firewall') . "</h2>\n\t\t\t<h3>" . _('Add blocked IP addresses') . " " . _hint(_('Multiple IP addresses must be comma seperated')) . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_firewall&op=firewall_add_yes' method='post'>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('Select username')) . "</td>\n\t\t\t\t<td>" . themes_select_users_single('add_username') . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('IP addresses')) . "</td>\n\t\t\t\t<td><textarea name='add_ip_address' required></textarea></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<p><input type='submit' class='button' value='" . _('Save') . "'></p>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_firewall&op=firewall_list');
     _p($content);
     break;
 case "firewall_add_yes":