function GetProducts($workspace_id) { $workspace_id = (int) $workspace_id; if ($workspace_id > 0) { $oDB = new dclDB(); $oDB->Query("SELECT w.product_id, p.name FROM dcl_workspace_product w, products p WHERE w.product_id = p.id AND w.workspace_id = {$workspace_id} ORDER BY p.name"); return $oDB->FetchAllRows(); } return array(); }
/** * Smarty escape modifier plugin * * Type: modifier<br> * Name: escape<br> * Purpose: Escape the string according to escapement type * @link http://smarty.php.net/manual/en/language.modifier.escape.php * escape (Smarty online manual) * @param string * @param html|htmlall|url|quotes|hex|hexentity|javascript * @return string */ function smarty_modifier_escape($string, $esc_type = 'html') { switch ($esc_type) { case 'html': return htmlspecialchars($string, ENT_QUOTES); case 'htmlall': return htmlentities($string, ENT_QUOTES); case 'link': $sText = nl2br(htmlspecialchars($string)); $sRetVal = eregi_replace('(http|ftp|telnet|irc|https)://[^<>[:space:]]+[[:alnum:]/]', '<a target="_blank" href="\\0">\\0</a>', $sText); // Pseudo stuff $sRetVal = eregi_replace('dcl://workorders/([0-9]+)[-]([0-9]+)', '<a href="' . menuLink() . '?menuAction=boWorkorders.viewjcn&jcn=\\1&seq=\\2">\\0</a>', $sRetVal); $sRetVal = eregi_replace('dcl://tickets/([0-9]+)', '<a href="' . menuLink() . '?menuAction=boTickets.view&ticketid=\\1">\\0</a>', $sRetVal); $sRetVal = eregi_replace('dcl://projects/([0-9]+)', '<a href="' . menuLink() . '?menuAction=boProjects.viewproject&wostatus=0&project=\\1">\\0</a>', $sRetVal); return $sRetVal; case 'url': return urlencode($string); case 'date': $o = new dclDB(); return $o->FormatDateForDisplay($string); case 'timestamp': $o = new dclDB(); return $o->FormatTimeStampForDisplay($string); case 'rawurl': return rawurlencode($string); case 'quotes': // escape unescaped single quotes return preg_replace("%(?<!\\\\)'%", "\\'", $string); case 'utf8xml': return utf8_encode(htmlspecialchars($string, ENT_NOQUOTES)); case 'hex': // escape every character into hex $return = ''; for ($x = 0; $x < strlen($string); $x++) { $return .= '%' . bin2hex($string[$x]); } return $return; case 'hexentity': $return = ''; for ($x = 0; $x < strlen($string); $x++) { $return .= '&#x' . bin2hex($string[$x]) . ';'; } return $return; case 'javascript': // escape quotes and backslashes and newlines return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n')); default: return $string; } }
function dbOrgEmail() { parent::dclDB(); $this->TableName = 'dcl_org_email'; LoadSchema($this->TableName); parent::Clear(); }
function dbContactAddr() { parent::dclDB(); $this->TableName = 'dcl_contact_addr'; LoadSchema($this->TableName); parent::Clear(); }
function dbOrgAlias() { parent::dclDB(); $this->TableName = 'dcl_org_alias'; LoadSchema($this->TableName); parent::Clear(); }
function dbPhoneType() { parent::dclDB(); $this->TableName = 'dcl_phone_type'; LoadSchema($this->TableName); parent::Clear(); }
function dbAddrType() { parent::dclDB(); $this->TableName = 'dcl_addr_type'; LoadSchema($this->TableName); parent::Clear(); }
function dbUserRole() { parent::dclDB(); $this->TableName = 'dcl_user_role'; LoadSchema($this->TableName); parent::Clear(); }
function dbWorkOrderTask() { parent::dclDB(); $this->TableName = 'dcl_wo_task'; LoadSchema($this->TableName); parent::Clear(); }
function dbTag() { parent::dclDB(); $this->TableName = 'dcl_tag'; LoadSchema($this->TableName); parent::Clear(); }
function dbOrgType() { parent::dclDB(); $this->TableName = 'dcl_org_type'; LoadSchema($this->TableName); parent::Clear(); }
function dbContactType() { parent::dclDB(); $this->TableName = 'dcl_contact_type'; LoadSchema($this->TableName); parent::Clear(); }
function dbHotlist() { parent::dclDB(); $this->TableName = 'dcl_hotlist'; LoadSchema($this->TableName); parent::Clear(); }
function dbWorkspaceUser() { parent::dclDB(); $this->TableName = 'dcl_workspace_user'; LoadSchema($this->TableName); parent::Clear(); }
function dbOrgProduct() { parent::dclDB(); $this->TableName = 'dcl_org_product_xref'; LoadSchema($this->TableName); parent::Clear(); }
function dbContactEmail() { parent::dclDB(); $this->TableName = 'dcl_contact_email'; LoadSchema($this->TableName); parent::Clear(); }
function dbSccs() { parent::dclDB(); $this->TableName = 'dcl_sccs'; LoadSchema($this->TableName); parent::Clear(); }
function dbProductBuild() { parent::dclDB(); $this->TableName = 'dcl_product_build'; LoadSchema($this->TableName); parent::Clear(); }
function dbOrgContact() { parent::dclDB(); $this->TableName = 'dcl_org_contact'; LoadSchema($this->TableName); parent::Clear(); }
function dbProductVersionItem() { parent::dclDB(); $this->TableName = 'dcl_product_version_item'; LoadSchema($this->TableName); parent::Clear(); }
function dbWorkspaceProduct() { parent::dclDB(); $this->TableName = 'dcl_workspace_product'; LoadSchema($this->TableName); parent::Clear(); }
function dbUrlType() { parent::dclDB(); $this->TableName = 'dcl_url_type'; LoadSchema($this->TableName); parent::Clear(); }
function dbEntitySource() { parent::dclDB(); $this->TableName = 'dcl_entity_source'; LoadSchema($this->TableName); parent::Clear(); }
function dbRolePerm() { parent::dclDB(); $this->TableName = 'dcl_role_perm'; LoadSchema($this->TableName); parent::Clear(); }
function dbProjectmap() { parent::dclDB(); $this->TableName = 'projectmap'; LoadSchema($this->TableName); $this->AuditEnabled = true; parent::Clear(); }
function dbBuildManager() { parent::dclDB(); $this->TableName = 'dcl_product_build_sccs'; LoadSchema($this->TableName); $this->oDbProductBuildException = CreateObject('dcl.dbProductBuildException'); parent::Clear(); }
function dbWorkOrderType() { parent::dclDB(); $this->TableName = 'dcl_wo_type'; $this->cacheEnabled = true; LoadSchema($this->TableName); $this->foreignKeys = array('workorders' => 'wo_type_id'); parent::Clear(); }
function DeleteByQuestion($id) { if (($id = DCL_Sanitize::ToInt($id)) === null) { trigger_error('Data sanitize failed.'); return -1; } $oDB = new dclDB(); if ($oDB->Query("SELECT answerid FROM faqanswers WHERE questionid = {$id}") == -1) { return -1; } while ($oDB->next_record()) { $this->answerid = $this->f(0); if ($this->Delete() == -1) { return -1; } } return 1; }
function Add($action, $actparam = '') { $this->id = $GLOBALS['DCLID']; $this->actionon = DCL_NOW; $this->actiontxt = $action; $this->actionparam = $actparam; if (parent::Add() == -1) { return -1; } }
function Render(&$oView) { global $dcl_info, $g_oSec; if (!is_object($oView)) { trigger_error('[htmlTicketBrowse::Render] ' . STR_VW_VIEWOBJECTNOTPASSED); return; } if (!$g_oSec->HasAnyPerm(array(DCL_ENTITY_TICKET => array($g_oSec->PermArray(DCL_PERM_VIEW), $g_oSec->PermArray(DCL_PERM_VIEWSUBMITTED), $g_oSec->PermArray(DCL_PERM_VIEWACCOUNT))))) { return PrintPermissionDenied(); } $this->oView =& $oView; // Reset start row if filter changes if (isset($_REQUEST['filter']) && $_REQUEST['filter'] == 'Filter') { $oView->startrow = 0; } if (!$this->_Execute()) { return; } $oTable = CreateObject('dcl.htmlTable'); $iEndOffset = 0; for ($iColumn = count($oView->groups); $iColumn < $this->oDB->NumFields(); $iColumn++) { $sFieldName = $this->oDB->GetFieldName($iColumn); if ($sFieldName == 'ticketid') { $oTable->assign('ticket_id_ordinal', $iColumn); } else { if ($sFieldName == '_num_tags_') { $iEndOffset--; $oTable->assign('num_tags_ordinal', $iColumn); } else { if ($sFieldName == 'tag_desc') { $oTable->assign('tag_ordinal', $iColumn); } } } } $oTable->setData($this->oDB->FetchAllRows()); for ($iColumn = 0; $iColumn < count($this->oView->groups); $iColumn++) { $oTable->addGroup($iColumn); $oTable->addColumn(''); } foreach ($this->oView->columnhdrs as $sColumn) { $oTable->addColumn($sColumn, 'string'); } $aOptions = array('Export' => array('menuAction' => 'boViews.export', 'hasPermission' => true)); foreach ($aOptions as $sDisplay => $aOption) { if ($aOption['hasPermission']) { $oTable->addToolbar($aOption['menuAction'], $sDisplay); } } $oDB = new dclDB(); $sSQL = $this->oView->GetSQL(true); if ($oDB->Query($sSQL) == -1) { return; } $oDB->next_record(); $iRecords = $oDB->f(0); $oDB->FreeResult(); if ($this->oView->numrows > 0) { if ($iRecords % $this->oView->numrows == 0) { $oTable->assign('VAL_PAGES', strval($iRecords / $this->oView->numrows)); } else { $oTable->assign('VAL_PAGES', strval(ceil($iRecords / $this->oView->numrows))); } $oTable->assign('VAL_PAGE', strval($this->oView->startrow / $this->oView->numrows + 1)); } else { $oTable->assign('VAL_PAGES', '0'); $oTable->assign('VAL_PAGE', '0'); } $oTable->assign('VAL_ENDOFFSET', $iEndOffset); $oTable->assign('VAL_FILTERMENUACTION', $this->sPagingMenuAction); $oTable->assign('VAL_FILTERSTARTROW', $this->oView->startrow); $oTable->assign('VAL_FILTERNUMROWS', $this->oView->numrows); $oTable->assign('VAL_FILTERSTATUS', isset($_REQUEST['filterStatus']) ? $_REQUEST['filterStatus'] : -1); $oTable->assign('VAL_FILTERTYPE', isset($_REQUEST['filterType']) ? $_REQUEST['filterType'] : -1); $oTable->assign('VAL_FILTERREPORTTO', isset($_REQUEST['filterReportto']) ? $_REQUEST['filterReportto'] : -1); $oTable->assign('VAL_FILTERPRODUCT', isset($_REQUEST['filterProduct']) ? $_REQUEST['filterProduct'] : -1); $oTable->assign('VAL_VIEWSETTINGS', $this->oView->GetForm()); $oTable->assign('VAL_ISPUBLIC', $g_oSec->IsPublicUser()); $oTable->setCaption($this->oView->title); $oTable->setShowChecks(false); $oTable->sTemplate = 'htmlTableTicket.tpl'; $oTable->render(); }