コード例 #1
0
ファイル: PhoneField.php プロジェクト: iHunt101/phlite
 function toString($value)
 {
     $config = $this->getConfiguration();
     list($phone, $ext) = explode("X", $value, 2);
     switch ($config['format']) {
         case 'us':
             $phone = Format::phone($phone);
             break;
     }
     if ($ext) {
         $phone .= " x{$ext}";
     }
     return $phone;
 }
コード例 #2
0
ファイル: directory.php プロジェクト: supaket/helpdesk
echo $row['dept_name'];
?>
&nbsp;</td>
            <td><?php 
echo $row['email'];
?>
&nbsp;</td>
            <td><?php 
echo Format::phone($row['phone']);
?>
&nbsp;<?php 
echo $ext;
?>
</td>
            <td><?php 
echo Format::phone($row['mobile']);
?>
&nbsp;</td>
        </tr>
        <?
        $class = ($class =='row2') ?'row1':'row2';
    }
    ?>
</table>
<?
else:
echo "<b>Problems displaying directory</b>";
endif;
include_once(STAFFINC_DIR.'footer.inc.php');
?>
コード例 #3
0
                <td><?php 
echo Format::htmlchars($ticket->getName());
?>
</td>
            </tr>
            <tr>
                <th width="100">Email:</th>
                <td><?php 
echo $ticket->getEmail();
?>
</td>
            </tr>
            <tr>
                <th>Phone:</th>
                <td><?php 
echo Format::phone($ticket->getPhoneNumber());
?>
</td>
            </tr>
        </table>
       </td>
    </tr>
</table>
<div class="msg">Subject: <?php 
echo Format::htmlchars($ticket->getSubject());
?>
</div>
<div>
    <?php 
if ($errors['err']) {
    ?>
コード例 #4
0
ファイル: class.staff.php プロジェクト: KingsleyGU/osticket
 function save($id, $vars, &$errors)
 {
     $vars['username'] = Format::striptags($vars['username']);
     $vars['firstname'] = Format::striptags($vars['firstname']);
     $vars['lastname'] = Format::striptags($vars['lastname']);
     if ($id && $id != $vars['id']) {
         $errors['err'] = __('Internal Error');
     }
     if (!$vars['firstname']) {
         $errors['firstname'] = __('First name required');
     }
     if (!$vars['lastname']) {
         $errors['lastname'] = __('Last name required');
     }
     $error = '';
     if (!$vars['username'] || !Validator::is_username($vars['username'], $error)) {
         $errors['username'] = $error ? $error : __('Username is required');
     } elseif (($uid = Staff::getIdByUsername($vars['username'])) && $uid != $id) {
         $errors['username'] = __('Username already in use');
     }
     if (!$vars['email'] || !Validator::is_valid_email($vars['email'])) {
         $errors['email'] = __('Valid email is required');
     } elseif (Email::getIdByEmail($vars['email'])) {
         $errors['email'] = __('Already in use system email');
     } elseif (($uid = Staff::getIdByEmail($vars['email'])) && $uid != $id) {
         $errors['email'] = __('Email already in use by another agent');
     }
     if ($vars['phone'] && !Validator::is_phone($vars['phone'])) {
         $errors['phone'] = __('Valid phone number is required');
     }
     if ($vars['mobile'] && !Validator::is_phone($vars['mobile'])) {
         $errors['mobile'] = __('Valid phone number is required');
     }
     if ($vars['passwd1'] || $vars['passwd2'] || !$id) {
         if ($vars['passwd1'] && strcmp($vars['passwd1'], $vars['passwd2'])) {
             $errors['passwd2'] = __('Passwords do not match');
         } elseif ($vars['backend'] != 'local' || $vars['welcome_email']) {
             // Password can be omitted
         } elseif (!$vars['passwd1'] && !$id) {
             $errors['passwd1'] = __('Temporary password is required');
             $errors['temppasswd'] = __('Required');
         } elseif ($vars['passwd1'] && strlen($vars['passwd1']) < 6) {
             $errors['passwd1'] = __('Password must be at least 6 characters');
         }
     }
     if (!$vars['dept_id']) {
         $errors['dept_id'] = __('Department is required');
     }
     if (!$vars['group_id']) {
         $errors['group_id'] = __('Group is required');
     }
     if (!$vars['timezone_id']) {
         $errors['timezone_id'] = __('Time zone selection is required');
     }
     // Ensure we will still have an administrator with access
     if ($vars['isadmin'] !== '1' || $vars['isactive'] !== '1') {
         $sql = 'select count(*), max(staff_id) from ' . STAFF_TABLE . ' WHERE isadmin=1 and isactive=1';
         if (($res = db_query($sql)) && (list($count, $sid) = db_fetch_row($res))) {
             if ($count == 1 && $sid == $id) {
                 $errors['isadmin'] = __('Cowardly refusing to remove or lock out the only active administrator');
             }
         }
     }
     if ($errors) {
         return false;
     }
     $sql = 'SET updated=NOW() ' . ' ,isadmin=' . db_input($vars['isadmin']) . ' ,isactive=' . db_input($vars['isactive']) . ' ,isvisible=' . db_input(isset($vars['isvisible']) ? 1 : 0) . ' ,onvacation=' . db_input(isset($vars['onvacation']) ? 1 : 0) . ' ,assigned_only=' . db_input(isset($vars['assigned_only']) ? 1 : 0) . ' ,dept_id=' . db_input($vars['dept_id']) . ' ,group_id=' . db_input($vars['group_id']) . ' ,timezone_id=' . db_input($vars['timezone_id']) . ' ,daylight_saving=' . db_input(isset($vars['daylight_saving']) ? 1 : 0) . ' ,username='******'username']) . ' ,firstname=' . db_input($vars['firstname']) . ' ,lastname=' . db_input($vars['lastname']) . ' ,email=' . db_input($vars['email']) . ' ,backend=' . db_input($vars['backend']) . ' ,phone="' . db_input(Format::phone($vars['phone']), false) . '"' . ' ,phone_ext=' . db_input($vars['phone_ext']) . ' ,mobile="' . db_input(Format::phone($vars['mobile']), false) . '"' . ' ,signature=' . db_input(Format::sanitize($vars['signature'])) . ' ,notes=' . db_input(Format::sanitize($vars['notes']));
     if ($vars['passwd1']) {
         $sql .= ' ,passwd=' . db_input(Passwd::hash($vars['passwd1']));
         if (isset($vars['change_passwd'])) {
             $sql .= ' ,change_passwd=1';
         }
     } elseif (!isset($vars['change_passwd'])) {
         $sql .= ' ,change_passwd=0';
     }
     if ($id) {
         $sql = 'UPDATE ' . STAFF_TABLE . ' ' . $sql . ' WHERE staff_id=' . db_input($id);
         if (db_query($sql) && db_affected_rows()) {
             return true;
         }
         $errors['err'] = sprintf(__('Unable to update %s.'), __('this agent')) . ' ' . __('Internal error occurred');
     } else {
         $sql = 'INSERT INTO ' . STAFF_TABLE . ' ' . $sql . ', created=NOW()';
         if (db_query($sql) && ($uid = db_insert_id())) {
             return $uid;
         }
         $errors['err'] = sprintf(__('Unable to create %s.'), __('this agent')) . ' ' . __('Internal error occurred');
     }
     return false;
 }
コード例 #5
0
ファイル: class.ticket.php プロジェクト: supaket/helpdesk
 function getPhoneNumber()
 {
     $phone = Format::phone($this->getPhone());
     if ($ext = $this->getPhoneExt()) {
         $phone .= " {$ext}";
     }
     return $phone;
 }
コード例 #6
0
ファイル: tickets.inc.php プロジェクト: nicolap/osTicket-1.7
    <?php 
if ($res && ($num = db_num_rows($res))) {
    $defaultDept = Dept::getDefaultDeptName();
    //Default public dept.
    while ($row = db_fetch_array($res)) {
        $dept = $row['ispublic'] ? $row['dept_name'] : $defaultDept;
        $subject = Format::htmlchars(Format::truncate($row['subject'], 40));
        if ($row['attachments']) {
            $subject .= '  &nbsp;&nbsp;<span class="Icon file"></span>';
        }
        $ticketID = $row['ticketID'];
        if ($row['isanswered'] && !strcasecmp($row['status'], 'open')) {
            $subject = "<b>{$subject}</b>";
            $ticketID = "<b>{$ticketID}</b>";
        }
        $phone = Format::phone($row['phone']);
        if ($row['phone_ext']) {
            $phone .= ' ' . $row['phone_ext'];
        }
        ?>
            <tr id="<?php 
        echo $row['ticketID'];
        ?>
">
                <td class="centered">
                <a class="Icon <?php 
        echo strtolower($row['source']);
        ?>
Ticket" title="<?php 
        echo $row['email'];
        ?>
コード例 #7
0
ファイル: class.staff.php プロジェクト: ed00m/osTicket-1.8
 function save($id, $vars, &$errors)
 {
     $vars['username'] = Format::striptags($vars['username']);
     $vars['firstname'] = Format::striptags($vars['firstname']);
     $vars['lastname'] = Format::striptags($vars['lastname']);
     if ($id && $id != $vars['id']) {
         $errors['err'] = 'Internal Error';
     }
     if (!$vars['firstname']) {
         $errors['firstname'] = 'First name required';
     }
     if (!$vars['lastname']) {
         $errors['lastname'] = 'Last name required';
     }
     $error = '';
     if (!$vars['username'] || !Validator::is_username($vars['username'], $error)) {
         $errors['username'] = $error ? $error : 'Username required';
     } elseif (($uid = Staff::getIdByUsername($vars['username'])) && $uid != $id) {
         $errors['username'] = '******';
     }
     if (!$vars['email'] || !Validator::is_email($vars['email'])) {
         $errors['email'] = 'Valid email required';
     } elseif (Email::getIdByEmail($vars['email'])) {
         $errors['email'] = 'Already in-use system email';
     } elseif (($uid = Staff::getIdByEmail($vars['email'])) && $uid != $id) {
         $errors['email'] = 'Email already in use by another staff member';
     }
     if ($vars['phone'] && !Validator::is_phone($vars['phone'])) {
         $errors['phone'] = 'Valid number required';
     }
     if ($vars['mobile'] && !Validator::is_phone($vars['mobile'])) {
         $errors['mobile'] = 'Valid number required';
     }
     if ($vars['passwd1'] || $vars['passwd2'] || !$id) {
         if ($vars['passwd1'] && strcmp($vars['passwd1'], $vars['passwd2'])) {
             $errors['passwd2'] = 'Password(s) do not match';
         } elseif ($vars['backend'] != 'local' || $vars['welcome_email']) {
             // Password can be omitted
         } elseif (!$vars['passwd1'] && !$id) {
             $errors['passwd1'] = 'Temp. password required';
             $errors['temppasswd'] = 'Required';
         } elseif ($vars['passwd1'] && strlen($vars['passwd1']) < 6) {
             $errors['passwd1'] = 'Must be at least 6 characters';
         }
     }
     if (!$vars['dept_id']) {
         $errors['dept_id'] = 'Department required';
     }
     if (!$vars['group_id']) {
         $errors['group_id'] = 'Group required';
     }
     if (!$vars['timezone_id']) {
         $errors['timezone_id'] = 'Time zone required';
     }
     if ($errors) {
         return false;
     }
     $sql = 'SET updated=NOW() ' . ' ,isadmin=' . db_input($vars['isadmin']) . ' ,isactive=' . db_input($vars['isactive']) . ' ,isvisible=' . db_input(isset($vars['isvisible']) ? 1 : 0) . ' ,onvacation=' . db_input(isset($vars['onvacation']) ? 1 : 0) . ' ,assigned_only=' . db_input(isset($vars['assigned_only']) ? 1 : 0) . ' ,dept_id=' . db_input($vars['dept_id']) . ' ,group_id=' . db_input($vars['group_id']) . ' ,timezone_id=' . db_input($vars['timezone_id']) . ' ,daylight_saving=' . db_input(isset($vars['daylight_saving']) ? 1 : 0) . ' ,username='******'username']) . ' ,firstname=' . db_input($vars['firstname']) . ' ,lastname=' . db_input($vars['lastname']) . ' ,email=' . db_input($vars['email']) . ' ,backend=' . db_input($vars['backend']) . ' ,phone="' . db_input(Format::phone($vars['phone']), false) . '"' . ' ,phone_ext=' . db_input($vars['phone_ext']) . ' ,mobile="' . db_input(Format::phone($vars['mobile']), false) . '"' . ' ,signature=' . db_input(Format::sanitize($vars['signature'])) . ' ,notes=' . db_input(Format::sanitize($vars['notes']));
     if ($vars['passwd1']) {
         $sql .= ' ,passwd=' . db_input(Passwd::hash($vars['passwd1']));
         if (isset($vars['change_passwd'])) {
             $sql .= ' ,change_passwd=1';
         }
     } elseif (!isset($vars['change_passwd'])) {
         $sql .= ' ,change_passwd=0';
     }
     if ($id) {
         $sql = 'UPDATE ' . STAFF_TABLE . ' ' . $sql . ' WHERE staff_id=' . db_input($id);
         if (db_query($sql) && db_affected_rows()) {
             return true;
         }
         $errors['err'] = 'Unable to update the user. Internal error occurred';
     } else {
         $sql = 'INSERT INTO ' . STAFF_TABLE . ' ' . $sql . ', created=NOW()';
         if (db_query($sql) && ($uid = db_insert_id())) {
             return $uid;
         }
         $errors['err'] = 'Unable to create user. Internal error';
     }
     return false;
 }
コード例 #8
0
                <td><?php 
echo Format::htmlchars($ticket->getName());
?>
</td>
            </tr>
            <tr>
                <th>Email:</th>
                <td><?php 
echo $ticket->getEmail();
?>
</td>
            </tr>
            <tr>
                <th>Phone:</th>
                <td><?php 
echo Format::phone($ticket->getPhone());
?>
</td>
            </tr>
            <tr>
                <th>Source:</th>
                <td><?php 
echo $ticket->getSource();
?>
&nbsp;&nbsp;<?php 
echo $ticket->getIP();
?>
</td>
            </tr>
        </table>
     </td>
コード例 #9
0
         <th width="80"><a <?php echo $ext_sort; ?> href="directory.php?<?php echo $qstr; ?>&sort=ext"><?php echo __(/* As in a phone number `extension` */ 'Extension');?></a></th>
         <th width="120"><a <?php echo $mobile_sort; ?> href="directory.php?<?php echo $qstr; ?>&sort=mobile"><?php echo __('Mobile Number');?></a></th>
     </tr>
 </thead>
 <tbody>
 <?php
     if($res && db_num_rows($res)):
         $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
         while ($row = db_fetch_array($res)) { ?>
            <tr id="<?php echo $row['staff_id']; ?>">
             <td>&nbsp;<?php echo Format::htmlchars($row['name']); ?></td>
             <td>&nbsp;<?php echo Format::htmlchars($row['dept']); ?></td>
             <td>&nbsp;<?php echo Format::htmlchars($row['email']); ?></td>
             <td>&nbsp;<?php echo Format::phone($row['phone']); ?></td>
             <td>&nbsp;<?php echo $row['phone_ext']; ?></td>
             <td>&nbsp;<?php echo Format::phone($row['mobile']); ?></td>
            </tr>
         <?php
         } //end of while.
     endif; ?>
 <tfoot>
  <tr>
     <td colspan="6">
         <?php if($res && $num) {
             echo '<div>&nbsp;'.__('Page').':'.$pageNav->getPageLinks().'&nbsp;</div>';
             ?>
         <?php } else {
             echo __('No agents found!');
         } ?>
     </td>
  </tr>
コード例 #10
0
                <td><?=Format::htmlchars($ticket->getName())?></td>
            </tr>
            <tr>
                <th>Email:</th>
                <td><?php 
                    echo $ticket->getEmail();
                    if(($related=$ticket->getRelatedTicketsCount())) {
                        echo sprintf('&nbsp;&nbsp;<a href="tickets.php?a=search&query=%s" title="Related Tickets">(<b>%d</b>)</a>',
                                    urlencode($ticket->getEmail()),$related);
                    }
                    ?>
                </td>
            </tr>
            <tr>
                <th>Phone:</th>
                <td><?=Format::phone($ticket->getPhoneNumber())?></td>
            </tr>
            <tr>
                <th>Source:</th>
                <td><?=$ticket->getSource()?></td>
            </tr>

        </table>
     </td>
    </tr>
    <tr><td colspan=2 class="msg">Subject: <?=Format::htmlchars($ticket->getSubject())?></td></tr>
    <tr>
     <td valign="top" width=50%>
        <table align="center" class="ticketinfo" cellspacing="1" cellpadding="3" width="100%" border=0>
            <tr>
                <th>Assigned Staff:</th>
コード例 #11
0
ファイル: class.ticket.php プロジェクト: hungnv0789/vhtm
    function getPhoneNumber(){
        $phone=Format::phone($this->getPhone());
        if(($ext=$this->getPhoneExt()))
            $phone.=" $ext";

        return $phone;
    }
コード例 #12
0
 function getPhoneNumber()
 {
     $phone = Format::phone($this->getPhone());
     return $phone;
 }