function dbsearch()
 {
     commonHeader();
     $personnel = isset($_REQUEST['personnel']) && is_array($_REQUEST['personnel']) ? $_REQUEST['personnel'] : array();
     $type = @DCL_Sanitize::ToIntArray($_REQUEST['type']);
     $priority = @DCL_Sanitize::ToIntArray($_REQUEST['priority']);
     $status = @$_REQUEST['status'];
     $account = @DCL_Sanitize::ToIntArray($_REQUEST['account']);
     $is_public = @$_REQUEST['is_public'];
     $entity_source_id = @DCL_Sanitize::ToIntArray($_REQUEST['entity_source_id']);
     $createdon = @$_REQUEST['createdon'];
     $closedon = @$_REQUEST['closedon'];
     $statuson = @$_REQUEST['statuson'];
     $lastactionon = @$_REQUEST['lastactionon'];
     $module_id = isset($_REQUEST['module_id']) && is_array($_REQUEST['module_id']) ? $_REQUEST['module_id'] : array();
     $tags = $_REQUEST['tags'];
     $searchText = $_REQUEST['searchText'];
     $columns = $_REQUEST['columns'];
     $groups = $_REQUEST['groups'];
     $order = $_REQUEST['order'];
     $columnhdrs = $_REQUEST['columnhdrs'];
     $dcl_status_type = @DCL_Sanitize::ToIntArray($_REQUEST['dcl_status_type']);
     $product = @DCL_Sanitize::ToIntArray($_REQUEST['product']);
     $department = @DCL_Sanitize::ToIntArray($_REQUEST['department']);
     $dateFrom = DCL_Sanitize::ToDate($_REQUEST['dateFrom']);
     $dateTo = DCL_Sanitize::ToDate($_REQUEST['dateTo']);
     $oDB = new dclDB();
     if (strlen($columnhdrs) > 0) {
         $columnhdrs = explode(',', $columnhdrs);
     } else {
         $columnhdrs = array();
     }
     if (strlen($columns) > 0) {
         $columns = explode(',', $columns);
     } else {
         $columns = array();
     }
     if (strlen($groups) > 0) {
         $groups = explode(',', $groups);
     } else {
         $groups = array();
     }
     if (strlen($order) > 0) {
         $order = explode(',', $order);
     } else {
         $order = array();
     }
     $objView =& CreateObject('dcl.boView');
     $objView->table = 'tickets';
     if (count($personnel) > 0 || count($department) > 0) {
         $fieldList = array('responsible', 'createdby', 'closedby');
         $bStrippedDepartments = false;
         $pers_sel = array();
         foreach ($fieldList as $field) {
             if (!isset($_REQUEST[$field]) || $_REQUEST[$field] != '1') {
                 continue;
             }
             if (count($personnel) > 0) {
                 if (!$bStrippedDepartments) {
                     $bStrippedDepartments = true;
                     // Have actual personnel?  If so, only set personnel for their associated departments instead of the department
                     // then unset the department from the array
                     foreach ($personnel as $encoded_pers) {
                         list($dpt_id, $pers_id) = explode(',', $encoded_pers);
                         $pers_sel[count($pers_sel)] = $pers_id;
                         if (count($department) > 0 && in_array($dpt_id, $department)) {
                             foreach ($department as $key => $department_id) {
                                 if ($department_id == $dpt_id) {
                                     unset($department[$key]);
                                     break;
                                 }
                             }
                         }
                     }
                 }
                 $pers_sel = DCL_Sanitize::ToIntArray($pers_sel);
                 if (count($pers_sel) > 0) {
                     $objView->AddDef('filter', $field, $pers_sel);
                 }
             }
             if (count($department) > 0) {
                 $objView->AddDef('filter', $field . '.department', $department);
             }
         }
     }
     $fieldList = array('priority', 'type', 'account', 'entity_source_id');
     while (list($key, $field) = each($fieldList)) {
         ${$field} = DCL_Sanitize::ToIntArray(${$field});
         if (count(${$field}) > 0) {
             $objView->AddDef('filter', $field, ${$field});
         }
     }
     if (trim($tags) != '') {
         $objView->AddDef('filter', 'dcl_tag.tag_desc', $tags);
     }
     if (count($is_public) > 0) {
         foreach ($is_public as $publicValue) {
             $objView->AddDef('filter', 'is_public', $oDB->Quote(DCL_Sanitize::ToYN($publicValue)));
         }
     }
     if (count($module_id) > 0) {
         // Have modules?  If so, only set module IDs for their associated products instead of the product ID
         // then unset the product id from the array
         $module = array();
         foreach ($module_id as $encoded_mod) {
             list($mod_prod_id, $mod_id) = explode(',', $encoded_mod);
             $module[count($module)] = $mod_id;
             if (count($product) > 0 && in_array($mod_prod_id, $product)) {
                 foreach ($product as $key => $product_id) {
                     if ($product_id == $mod_prod_id) {
                         unset($product[$key]);
                         break;
                     }
                 }
             }
         }
         $module = DCL_Sanitize::ToIntArray($module);
         if (count($module) > 0) {
             $objView->AddDef('filter', 'module_id', $module);
         }
     }
     if (count($product) > 0) {
         $objView->AddDef('filter', 'product', $product);
     }
     if (count($status) > 0) {
         // Have statuses?  If so, only set status IDs for their associated types instead of the status type ID
         // then unset the status type id from the array
         $statuses = array();
         foreach ($status as $encoded_status) {
             list($type_id, $status_id) = explode(',', $encoded_status);
             if (($type_id = DCL_Sanitize::ToInt($type_id)) !== null && ($status_id = DCL_Sanitize::ToInt($status_id)) !== null) {
                 $statuses[count($statuses)] = $status_id;
                 if (count($dcl_status_type) > 0 && in_array($type_id, $dcl_status_type)) {
                     foreach ($dcl_status_type as $key => $status_type_id) {
                         if ($status_type_id == $type_id) {
                             unset($dcl_status_type[$key]);
                             break;
                         }
                     }
                 }
             }
         }
         $objView->AddDef('filter', 'status', $statuses);
     }
     if (count($dcl_status_type) > 0) {
         $objView->AddDef('filter', 'statuses.dcl_status_type', $dcl_status_type);
     }
     if ($dateFrom !== null || $dateTo !== null) {
         if ($dateFrom !== null) {
             $dateFrom .= ' 00:00:00';
         } else {
             $dateFrom = '';
         }
         if ($dateTo !== null) {
             $dateTo .= ' 23:59:59';
         } else {
             $dateTo = '';
         }
         $fieldList = array('createdon', 'closedon', 'statuson', 'lastactionon');
         foreach ($fieldList as $field) {
             if (${$field} == '1') {
                 $objView->AddDef('filterdate', $field, array($dateFrom, $dateTo));
             }
         }
     }
     if ($searchText != '') {
         $objView->AddDef('filterlike', 'issue', $searchText);
         $objView->AddDef('filterlike', 'summary', $searchText);
     }
     if (count($columns) > 0) {
         $objView->AddDef('columns', '', $columns);
     } else {
         $objView->AddDef('columns', '', array('ticketid', 'responsible', 'product', 'account', 'status', 'contact', 'contactphone', 'summary'));
     }
     if (count($groups) > 0) {
         foreach ($groups as $key => $groupField) {
             if ($groupField == 'priorities.name') {
                 $groups[$key] = 'priorities.weight';
             } else {
                 if ($groupField == 'severities.name') {
                     $groups[$key] = 'severities.weight';
                 }
             }
         }
         $objView->AddDef('groups', '', $groups);
     }
     if (count($columnhdrs) > 0) {
         $objView->AddDef('columnhdrs', '', $columnhdrs);
     }
     if (count($order) > 0) {
         foreach ($order as $key => $orderField) {
             if ($orderField == 'priorities.name') {
                 $order[$key] = 'priorities.weight';
             } else {
                 if ($orderField == 'severities.name') {
                     $order[$key] = 'severities.weight';
                 }
             }
         }
         $objView->AddDef('order', '', $order);
     } else {
         $objView->AddDef('order', '', array('ticketid'));
     }
     $objView->style = 'report';
     if (isset($_REQUEST['title']) && $_REQUEST['title'] != '') {
         $objView->title = $oDB->GPCStripSlashes($_REQUEST['title']);
     } else {
         $objView->title = STR_TCK_TICKETSEARCHRESULTS;
     }
     $obj =& CreateObject('dcl.htmlTicketResults');
     $obj->Render($objView);
 }
示例#2
0
            $content = 'You need to run the upgrade scripts for your database up to 20010321.  This version';
            $content .= ' introduced the dcl_config table that tracks system settings and current version.';
            $content .= '  See the doc directory for how the upgrade process works.  After upgrading, select';
            $content .= ' Reload to continue the upgrade process.';
            $b_reload = true;
        }
        include 'install_tpl.php';
        break;
    case "insertData":
        include_once "../inc/config.php";
        include_once "../inc/functions.inc.php";
        include_once './default_records.inc.php';
        $oDB = new dclDB();
        include_once 'setup.inc.php';
        // gets current version
        $oDB->Execute("INSERT INTO dcl_config (dcl_config_name, dcl_config_field, dcl_config_varchar) VALUES ('DCL_VERSION', 'dcl_config_varchar', " . $oDB->Quote($setup_info['dcl']['version']) . ")");
        $content = '<div style="width: 50%; text-align: left; padding-left: 200px;">';
        $content .= $GLOBALS['__import_content__'];
        $content .= '</div>';
        $b_next = array('finish', _INSTALL_L117);
        $title = _INSTALL_L116;
        include 'install_tpl.php';
        break;
    case 'finish':
        $title = _INSTALL_L32;
        $content = "<table width='60%' align='center'><tr><td align='left'>\n";
        include './language/' . $language . '/finish.php';
        $content .= "</td></tr></table>\n";
        include 'install_tpl.php';
        break;
}