function show($orderBy = 'short')
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_ORG, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     $oView = CreateObject('dcl.boView');
     $oView->startrow = 0;
     $oView->numrows = 25;
     $filterActive = '';
     if (isset($_REQUEST['filterActive'])) {
         $filterActive = $_REQUEST['filterActive'];
     }
     $oView->table = 'dcl_org';
     $oView->title = 'Browse Organizations';
     $oView->AddDef('columnhdrs', '', array('ID', 'Active', 'Name', 'Phone', 'Email', 'Internet'));
     $oView->AddDef('columns', '', array('org_id', 'active', 'name', 'dcl_org_phone.phone_number', 'dcl_org_email.email_addr', 'dcl_org_url.url_addr'));
     $oView->AddDef('order', '', array('name'));
     if ($filterActive == 'Y' || $filterActive == 'N') {
         $oView->AddDef('filter', 'active', "'{$filterActive}'");
     }
     $oHtml = CreateObject('dcl.htmlOrgBrowse');
     $oHtml->Render($oView);
 }
 function view()
 {
     global $g_oSec;
     commonHeader();
     if (($iID = @DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if (!$g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_VIEW, $iID)) {
         return PrintPermissionDenied();
     }
     $which = isset($_REQUEST['which']) ? $_REQUEST['which'] : '';
     if ($which != 'workorders' && $which != 'tickets' && $which != 'modules' && $which != 'release' && $which != 'build') {
         $which = null;
     }
     $versionid = null;
     if (isset($_REQUEST['versionid'])) {
         $versionid = @DCL_Sanitize::ToInt($_REQUEST['versionid']);
     }
     $obj =& CreateObject('dcl.htmlProductDetail');
     if ($which !== null) {
         if ($versionid !== null) {
             $obj->Show($iID, $which, $versionid);
         } else {
             $obj->Show($iID, $which);
         }
     } else {
         $obj->Show($iID);
     }
 }
 function show($orderBy = 'short')
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_ROLE, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     $oView = CreateObject('dcl.boView');
     $oView->startrow = 0;
     $oView->numrows = 25;
     $filterActive = '';
     if (isset($_REQUEST['filterActive'])) {
         $filterActive = $_REQUEST['filterActive'];
     }
     $oView->table = 'dcl_role';
     $oView->title = 'Browse Roles';
     $oView->AddDef('columnhdrs', '', array('ID', 'Active', 'Role'));
     $oView->AddDef('columns', '', array('role_id', 'active', 'role_desc'));
     $oView->AddDef('order', '', array('role_desc'));
     if ($filterActive == 'Y' || $filterActive == 'N') {
         $oView->AddDef('filter', 'active', "'{$filterActive}'");
     }
     $oHtml = CreateObject('dcl.htmlRoleBrowse');
     $oHtml->Render($oView);
 }
 function ShowEntryForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_PERSONNEL, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $Template =& CreateSmarty();
     $Template->assign('IS_EDIT', $isEdit);
     $oUserRole = CreateObject('dcl.dbUserRole');
     $oDept = CreateObject('dcl.htmlDepartments');
     if ($isEdit) {
         $Template->assign('VAL_PERSONNELID', $obj->id);
         $Template->assign('VAL_ACTIVE', $obj->active);
         $Template->assign('VAL_SHORT', $obj->short);
         $Template->assign('VAL_REPORTTO', $obj->reportto);
         $Template->assign('VAL_DEPARTMENT', $obj->department);
         $Template->assign('Roles', $oUserRole->GetGlobalRoles($obj->id));
         $oMeta =& CreateObject('dcl.DCL_MetadataDisplay');
         $aContact =& $oMeta->GetContact($obj->contact_id);
         $Template->assign('VAL_CONTACTID', $obj->contact_id);
         $Template->assign('VAL_CONTACTNAME', $aContact['name']);
     } else {
         $Template->assign('VAL_ACTIVE', 'Y');
         $Template->assign('VAL_REPORTTO', $GLOBALS['DCLID']);
         $Template->assign('VAL_DEPARTMENT', 0);
         $Template->assign('VAL_SHORT', '');
         $Template->assign('Roles', $oUserRole->GetGlobalRoles());
     }
     SmartyDisplay($Template, 'htmlPersonnelForm.tpl');
 }
 function ShowTopic($obj)
 {
     global $dcl_info, $g_oSec;
     if (!is_object($obj)) {
         trigger_error('[htmlFaqtopics::ShowTopic] ' . STR_FAQ_TOPICOBJECTNOTPASSED);
         return;
     }
     if (!$g_oSec->HasPerm(DCL_ENTITY_FAQ, DCL_PERM_VIEW, $obj->faqid)) {
         return PrintPermissionDenied();
     }
     $objFaq = CreateObject('dcl.dbFaq');
     if ($objFaq->Load($obj->faqid) == -1) {
         return;
     }
     $t =& CreateSmarty();
     $t->assign('VAL_FAQID', $objFaq->faqid);
     $t->assign('VAL_FAQNAME', $objFaq->name);
     $t->assign('VAL_DESCRIPTION', $obj->description);
     $t->assign('VAL_TOPICID', $obj->f('topicid'));
     $t->assign('VAL_TOPICNAME', $obj->name);
     $t->assign('PERM_ADDQUESTION', $g_oSec->HasPerm(DCL_ENTITY_FAQQUESTION, DCL_PERM_ADD, $obj->faqid));
     $t->assign('PERM_MODIFY', $g_oSec->HasPerm(DCL_ENTITY_FAQTOPIC, DCL_PERM_MODIFY));
     $t->assign('PERM_DELETE', $g_oSec->HasPerm(DCL_ENTITY_FAQTOPIC, DCL_PERM_DELETE));
     $objF = CreateObject('dcl.dbFaqquestions');
     if ($objF->LoadByFaqTopicID($obj->topicid) == -1) {
         return;
     }
     $aRecords = array();
     while ($objF->next_record()) {
         array_push($aRecords, $objF->Record);
     }
     $t->assign('VAL_QUESTIONS', $aRecords);
     SmartyDisplay($t, 'htmlFaqtopicsDetail.tpl');
 }
 function show()
 {
     global $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $objPersonnel = CreateObject('dcl.htmlPersonnel');
     $oDBPersonnel = CreateObject('dcl.dbPersonnel');
     if ($oDBPersonnel->Load($GLOBALS['DCLID']) == -1) {
         return;
     }
     $t =& CreateSmarty();
     $oSelect = CreateObject('dcl.htmlSelect');
     $t->assign('CMB_USERS', $objPersonnel->GetCombo(0, 'responsible', 'lastfirst', 0, false));
     $begindate = @DCL_Sanitize::ToDate($_REQUEST['begindate']);
     if ($begindate !== null) {
         $t->assign('VAL_BEGINDATE', $begindate);
     } else {
         $t->assign('VAL_BEGINDATE', '');
     }
     $enddate = @DCL_Sanitize::ToDate($_REQUEST['enddate']);
     if ($enddate !== null) {
         $t->assign('VAL_ENDDATE', $enddate);
     } else {
         $t->assign('VAL_ENDDATE', '');
     }
     SmartyDisplay($t, 'htmlSecAuditBrowse.tpl');
 }
 function ShowPage($sPage)
 {
     global $g_oSec, $dcl_info;
     commonHeader();
     if (($productid = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if (!$g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_VIEW, $productid)) {
         return PrintPermissionDenied();
     }
     $this->oProduct =& CreateObject('dcl.dbProducts');
     if ($this->oProduct->Load($productid) == -1) {
         trigger_error('Could not find a product with an id of ' . $productid, E_USER_ERROR);
         return;
     }
     $this->oSmarty->assign('VAL_ID', $this->oProduct->id);
     $this->oSmarty->assign('VAL_NAME', $this->oProduct->name);
     $this->oSmarty->assign('PERM_VIEWWO', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_VIEW));
     $this->oSmarty->assign('PERM_VIEWTCK', $g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_VIEW));
     $this->oSmarty->assign('PERM_WIKI', $dcl_info['DCL_WIKI_ENABLED'] == 'Y' && $g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_VIEWWIKI));
     $this->oSmarty->assign('PERM_EDIT', $g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_MODIFY));
     $this->oSmarty->assign('PERM_DELETE', $g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_DELETE));
     $this->oSmarty->assign('PERM_VERSIONS', $dcl_info['DCL_BUILD_MANAGER_ENABLED'] == 'Y' && $this->oProduct->is_versioned == 'Y');
     SmartyDisplay($this->oSmarty, $sPage);
 }
 function Show($id, $status, $responsible)
 {
     global $dcl_info, $dcl_domain_info, $dcl_domain, $g_oSec;
     if (!isset($_REQUEST['wogroupby'])) {
         $_REQUEST['wogroupby'] = 'none';
     }
     $bIsGrouping = $_REQUEST['wogroupby'] != 'none';
     if (!$g_oSec->HasPerm(DCL_ENTITY_HOTLIST, DCL_PERM_VIEW, $id)) {
         return PrintPermissionDenied();
     }
     if ($this->hotlist->Load($id) == -1) {
         trigger_error('Could not find a hotlist with an id of ' . $id, E_USER_ERROR);
         return;
     }
     $oMeta =& CreateObject('dcl.DCL_MetadataDisplay');
     $this->oSmarty->assign('VAL_HOTLISTID', $id);
     $this->oSmarty->assign('VAL_NAME', $this->hotlist->hotlist_tag);
     $this->oSmarty->assign('VAL_DESCRIPTION', $this->hotlist->hotlist_desc);
     $this->oSmarty->assign('VAL_FILTERSTATUS', $status);
     $this->oSmarty->assign('VAL_FILTERRESPONSIBLE', $responsible);
     $this->oSmarty->assign('VAL_FILTERGROUPBY', $_REQUEST['wogroupby']);
     $this->oSmarty->assign('OPT_GROUPBY', array('none' => STR_CMMN_SELECTONE, '3' => STR_WO_RESPONSIBLE, '7' => STR_WO_STATUS, '4' => STR_WO_PRODUCT, '5' => STR_CMMN_MODULE, '2' => STR_WO_TYPE));
     $this->oSmarty->assign('PERM_AUDIT', $g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_AUDIT));
     $this->oSmarty->assign('PERM_ATTACHFILE', $g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_ATTACHFILE));
     $this->oSmarty->assign('PERM_REMOVEFILE', $g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_REMOVEFILE));
     $this->SetStatistics();
     $this->SetTasks($status, $responsible, $bIsGrouping);
     SmartyDisplay($this->oSmarty, 'htmlHotlistProjectDetail.tpl');
 }
 function Render(&$oView)
 {
     global $g_oSec, $dcl_info;
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADDRTYPE, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     parent::Render($oView);
 }
 function submitModify()
 {
     global $g_oSession, $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_PREFS, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $bHasChanges = false;
     $o = CreateObject('dcl.dbPreferences');
     $o->personnel_id = $GLOBALS['DCLID'];
     $o->preferences_data = $g_oSession->Value('dcl_preferences');
     if (!isset($o->preferences_data) || !is_array($o->preferences_data) || count($o->preferences_data) < 1) {
         $o->preferences_data = array('DCL_PREF_TEMPLATE_SET' => $dcl_info['DCL_DEF_TEMPLATE_SET'], 'DCL_PREF_LANGUAGE' => $dcl_info['DCL_DEFAULT_LANGUAGE'], 'DCL_PREF_NOTIFY_DEFAULT' => 'N', 'DCL_PREF_CREATED_WATCH_OPTION' => 4);
         $o->Add();
         $bHasChanges = true;
     }
     $sOldTpl = $o->preferences_data['DCL_PREF_TEMPLATE_SET'];
     foreach ($_REQUEST as $pref => $setting) {
         if (substr($pref, 0, 9) != 'DCL_PREF_') {
             continue;
         }
         if ($pref == 'DCL_PREF_NOTIFY_DEFAULT') {
             $setting = DCL_Sanitize::ToYN($_REQUEST['DCL_PREF_NOTIFY_DEFAULT']);
         }
         if ($o->Value($pref) != $setting) {
             $bHasChanges = true;
             $o->Register($pref, $setting);
         }
     }
     if (!isset($_REQUEST['DCL_PREF_NOTIFY_DEFAULT'])) {
         $bHasChanges = true;
         $o->Register('DCL_PREF_NOTIFY_DEFAULT', 'N');
     }
     if ($bHasChanges) {
         $o->Edit();
         $g_oSession->Register('dcl_preferences', $o->preferences_data);
         $g_oSession->Edit();
     }
     // Template change?
     $sNewTpl = $o->preferences_data['DCL_PREF_TEMPLATE_SET'];
     if ($sNewTpl != $sOldTpl) {
         // Do we need to break out of frames?
         $menuAction = 'menuAction=htmlPreferences.modify';
         $sNewIsFramed = file_exists(DCL_ROOT . 'templates/' . $sNewTpl . '/frameset.php');
         $sOldIsFramed = file_exists(DCL_ROOT . 'templates/' . $sOldTpl . '/frameset.php');
         if ($sOldIsFramed) {
             if ($sNewIsFramed) {
                 RefreshTop(menuLink(DCL_WWW_ROOT . 'templates/' . $sNewTpl . '/frameset.php', $menuAction));
             } else {
                 RefreshTop(menuLink('', $menuAction));
             }
         } else {
             if ($sNewIsFramed) {
                 RefreshTop(menuLink(DCL_WWW_ROOT . 'templates/' . $sNewTpl . '/frameset.php', $menuAction));
             }
         }
     }
     $this->modify();
 }
 function Render(&$oView)
 {
     global $g_oSec, $dcl_info;
     if ($g_oSec->HasPerm(DCL_ENTITY_SOURCE, DCL_PERM_VIEW)) {
         parent::Render($oView);
     } else {
         return PrintPermissionDenied();
     }
 }
 function ShowSystemConfig()
 {
     global $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     $obj =& CreateObject('dcl.htmlAdminMain');
     $obj->Show();
 }
 function delete($aSource)
 {
     global $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_ROLE, DCL_PERM_DELETE)) {
         return PrintPermissionDenied();
     }
     $oDB =& CreateObject('dcl.dbRolePerm');
     $oDB->DeleteRole($aSource['role_id']);
     return parent::Delete($aSource);
 }
 function ShowResults()
 {
     global $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $begindate = @DCL_Sanitize::ToDateTime($_REQUEST['begindate'] . ' 00:00:00.00');
     $enddate = @DCL_Sanitize::ToDateTime($_REQUEST['enddate'] . ' 23:59:59.99');
     $responsible = DCL_Sanitize::ToInt($_REQUEST['responsible']);
     if ($begindate === null || $enddate === null) {
         commonHeader();
         trigger_error(STR_SEC_DATEERR, E_USER_ERROR);
         $this->Show(false);
         return;
     }
     $objDBPer =& CreateObject('dcl.dbPersonnel');
     $objDBSA =& CreateObject('dcl.dbSecAudit');
     $objDB = new DCLDb();
     $sCols = 'SA.id, ' . $objDBSA->ConvertTimestamp('SA.actionon', 'actionon') . ', SA.actiontxt, SA.actionparam';
     $sCols .= ', ' . $objDBPer->SelectAllColumns('Pers.');
     $sQuery = "SELECT {$sCols}\n\t\t\tFROM {$objDBSA->TableName} SA INNER JOIN {$objDBPer->TableName} Pers on \n\t\t\tSA.id = pers.id \n\t\t\tWHERE SA.actionon BETWEEN " . $objDBSA->DisplayToSQL($begindate) . ' and ' . $objDBSA->DisplayToSQL($enddate);
     if ($responsible == 0) {
         $respname = STR_SEC_ALLUSERS;
     } else {
         $objDBPer->Load($responsible);
         $respname = $objDBPer->short;
         $sQuery .= ' AND SA.id=' . $responsible;
     }
     $sQuery .= ' ORDER BY SA.actionon';
     $reportAr = null;
     if ($objDB->Query($sQuery) != -1) {
         if ($objDB->next_record()) {
             $idx = -1;
             do {
                 $idx++;
                 $reportAr[$idx][] = $objDB->f('short');
                 $reportAr[$idx][] = $objDB->FormatTimeStampForDisplay($objDB->f('actionon'));
                 $reportAr[$idx][] = $objDB->f('actiontxt');
                 $reportAr[$idx][] = $objDB->f('actionparam');
             } while ($objDB->next_record());
         } else {
             trigger_error(STR_SEC_RPTNODATA, E_USER_ERROR);
             $this->Show(false);
             return;
         }
     }
     $obj =& CreateObject('dcl.htmlSecAudit');
     if (!$obj->Render($reportAr, $begindate, $enddate, $respname)) {
         trigger_error(STR_SEC_RPTERROR, E_USER_ERROR);
         $this->Show(false);
         return;
     }
 }
 function Detail()
 {
     global $g_oSession, $g_oSec, $dcl_info;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_SESSION, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     echo '<pre>';
     print_r($g_oSession->session_data);
     echo '</pre>';
 }
 function displayPasswdForm()
 {
     global $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_PREFS, DCL_PERM_PASSWORD)) {
         return PrintPermissionDenied();
     }
     $oSmarty =& CreateSmarty();
     $oSmarty->assign('PERM_ADMIN', $g_oSec->HasPerm(DCL_ENTITY_GLOBAL, DCL_PERM_ADMIN));
     $oSmarty->assign('VAL_USERID', $GLOBALS['DCLID']);
     $oSmarty->assign('VAL_USERNAME', $GLOBALS['DCLNAME']);
     SmartyDisplay($oSmarty, 'htmlPersonnelPasswdForm.tpl');
 }
 function Show()
 {
     global $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     $oSmarty =& CreateSmarty();
     $oSmarty->assign('TXT_SETUPDESC', STR_ADMIN_SETUPDESC);
     $oSmarty->assign('TXT_SETUPTITLE', STR_ADMIN_SETUPTITLE);
     $oSmarty->assign('VAL_OPTIONS', $this->GetOptions());
     SmartyDisplay($oSmarty, 'htmlAdminMain.tpl');
 }
 function updateProducts($org_id, &$aProductID)
 {
     if (($org_id = DCL_Sanitize::ToInt($org_id)) === null) {
         return PrintPermissionDenied();
     }
     $aProductID = DCL_Sanitize::ToIntArray($aProductID);
     if ($aProductID === null || count($aProductID) == 0) {
         $aProductID = array("-1");
     }
     $sProductID = join(',', $aProductID);
     $this->Execute("DELETE FROM dcl_org_product_xref WHERE org_id = {$org_id} AND product_id NOT IN ({$sProductID})");
     $this->Execute("INSERT INTO dcl_org_product_xref (org_id, product_id) SELECT {$org_id}, id FROM products WHERE id IN ({$sProductID}) AND id NOT IN (SELECT product_id FROM dcl_org_product_xref WHERE org_id = {$org_id})");
 }
 function updateOrgs($contact_id, &$aOrgID)
 {
     if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
         return PrintPermissionDenied();
     }
     $aOrgID = DCL_Sanitize::ToIntArray($aOrgID);
     if ($aOrgID === null || count($aOrgID) == 0) {
         $aOrgID = array("-1");
     }
     $sOrgID = join(',', $aOrgID);
     $this->Execute("DELETE FROM dcl_org_contact WHERE contact_id = {$contact_id} AND org_id NOT IN ({$sOrgID})");
     $this->Execute("INSERT INTO dcl_org_contact (org_id, contact_id, created_on, created_by) SELECT org_id, {$contact_id}, " . $this->GetDateSQL() . ", " . $GLOBALS['DCLID'] . " FROM dcl_org WHERE org_id IN ({$sOrgID}) AND org_id NOT IN (SELECT org_id FROM dcl_org_contact WHERE contact_id = {$contact_id})");
 }
 function show()
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_REPORT)) {
         return PrintPermissionDenied();
     }
     if (($type = DCL_Sanitize::ToInt($_REQUEST['type'])) === null || ($id = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $oSmarty =& CreateSmarty();
     $oAudit =& CreateObject('dcl.boAudit');
     switch ($type) {
         case DCL_ENTITY_WORKORDER:
             if (($id2 = DCL_Sanitize::ToInt($_REQUEST['id2'])) === null) {
                 trigger_error('Data sanitize failed.');
                 return;
             }
             $this->aAudit = $oAudit->LoadDiff('dbWorkorders', array('jcn' => $id, 'seq' => $id2));
             $oSmarty->assign('VAL_ID', sprintf('%d-%d', $id, $id2));
             $oSmarty->assign('VAL_SUMMARY', $this->oMeta->GetWorkOrder($id, $id2));
             $oSmarty->assign('LNK_BACK', menuLink('', "menuAction=boWorkorders.viewjcn&jcn={$id}&seq={$id2}"));
             $oAccount =& CreateObject('dcl.dbWorkOrderAccount');
             $this->aAuditAccount = $oAccount->AuditWorkOrderList($id, $id2);
             $oProject =& CreateObject('dcl.dbProjectmap');
             $this->aAuditProject = $oProject->AuditWorkOrderList($id, $id2);
             break;
         case DCL_ENTITY_PROJECT:
             $this->aAudit = $oAudit->LoadDiff('dbProjects', array('projectid' => $id));
             $oSmarty->assign('VAL_ID', $id);
             $oSmarty->assign('VAL_SUMMARY', $this->oMeta->GetProject($id));
             $oSmarty->assign('LNK_BACK', menuLink('', "menuAction=boProjects.viewproject&wostatus=0&project={$id}"));
             $oProject =& CreateObject('dcl.dbProjectmap');
             $this->aAuditWorkOrder = $oProject->AuditProjectList($id);
             break;
         case DCL_ENTITY_TICKET:
             $this->aAudit = $oAudit->LoadDiff('dbTickets', array('ticketid' => $id));
             $oSmarty->assign('VAL_ID', $id);
             $oSmarty->assign('VAL_SUMMARY', $this->oMeta->GetTicket($id));
             $oSmarty->assign('LNK_BACK', menuLink('', "menuAction=boTickets.view&ticketid={$id}"));
             break;
     }
     $this->prepareForDisplay();
     $oSmarty->assign_by_ref('VAL_AUDITTRAIL', $this->aAudit);
     $oSmarty->assign_by_ref('VAL_AUDITACCOUNT', $this->aAuditAccount);
     $oSmarty->assign_by_ref('VAL_AUDITPROJECT', $this->aAuditProject);
     $oSmarty->assign_by_ref('VAL_AUDITWORKORDER', $this->aAuditWorkOrder);
     SmartyDisplay($oSmarty, 'htmlAuditTrail.tpl');
 }
 function add($aSource)
 {
     global $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_ORG, DCL_PERM_ADD) && !$g_oSec->HasPerm(DCL_ENTITY_CONTACT, DCL_PERM_ADD) && !$g_oSec->HasPerm(DCL_ENTITY_ORG, DCL_PERM_MODIFY) && !$g_oSec->HasPerm(DCL_ENTITY_CONTACT, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $this->oDB->InitFromArray($aSource);
     if ($this->oDB->Add() == -1) {
         return -1;
     }
     if (isset($this->sKeyField) && $this->sKeyField != '') {
         return $this->oDB->{$this->sKeyField};
     }
     return 1;
 }
 function Show()
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_BUILDMANAGER, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     if (($product_id = DCL_Sanitize::ToInt($_REQUEST['product_id'])) === null) {
         return PrintPermissionDenied();
     }
     if (($version_id = DCL_Sanitize::ToInt($_REQUEST['product_version_id'])) === null) {
         return PrintPermissionDenied();
     }
     $oProduct = CreateObject('dcl.dbProducts');
     $oProduct->Load($product_id);
     $oPV = CreateObject('dcl.dbProductVersion');
     if ($oPV->Load(array('product_version_id' => $version_id)) == -1) {
         ShowError('Failed to load version ID ' . $version_id, 'Error');
         return;
     }
     $this->oSmarty->assign('VAL_JSDATEFORMAT', GetJSDateFormat());
     $this->oSmarty->assign('VAL_FORMACTION', menuLink());
     if (isset($GLOBALS['add'])) {
         $this->oSmarty->assign('VAL_MENUACTION', 'boBuildManager.addRelease');
     } else {
         $this->oSmarty->assign('VAL_MENUACTION', 'boBuildManager.modifyRelease');
     }
     $this->oSmarty->assign('TXT_BM_ADD_RELEASE', STR_BM_MOD_RELEASE);
     $this->oSmarty->assign('TXT_BM_PRODUCT', STR_BM_PRODUCT);
     $this->oSmarty->assign('TXT_BM_RELEASE_ALIAS_TITLE', STR_BM_RELEASE_ALIAS_TITLE);
     $this->oSmarty->assign('TXT_BM_RELEASEDATE_DESC', STR_BM_RELEASEDATE_DESC);
     $this->oSmarty->assign('TXT_BM_RELEASEDATE', STR_BM_RELEASEDATE);
     $this->oSmarty->assign('VAL_PRODUCTNAME', $oProduct->name);
     $this->oSmarty->assign('VAL_PRODUCTID', $oProduct->id);
     $this->oSmarty->assign('VAL_VERSIONID', $version_id);
     $this->oSmarty->assign('VAL_VERSIONTEXT', $oPV->product_version_text);
     $this->oSmarty->assign('VAL_VERSIONDESCR', $oPV->product_version_descr);
     $this->oSmarty->assign('VAL_ACTIVE', $oPV->active);
     $this->oSmarty->assign('VAL_VERSIONACTUALDATE', $oPV->product_version_actual_date);
     $this->oSmarty->assign('VAL_VERSIONTARGETDATE', $oPV->product_version_target_date);
     $this->oSmarty->assign('date', $oPV->product_version_target_date);
     $this->oSmarty->assign('VAL_DATEELEMENT', 'product_version_target_date');
     $this->oSmarty->assign('VAL_WHICH', $GLOBALS['which']);
     SmartyDisplay($this->oSmarty, 'htmlBuildManagerReleaseForm.tpl');
 }
 function Render($oView)
 {
     global $dcl_info, $g_oSec, $g_oSession;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_BUILDMANAGER, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     $oDB = CreateObject('dcl.dbBuildManager');
     if ($oDB->query($oView->GetSQL()) == -1) {
         return;
     }
     $allRecs = $oDB->FetchAllRows();
     $oTable =& CreateObject('dcl.htmlTable');
     $oTable->setCaption($oView->title);
     $oTable->addColumn(STR_CMMN_ID, 'numeric');
     $oTable->addColumn(STR_BM_RELEASE_ALIAS_TITLE, 'string');
     $oTable->addColumn(STR_CMMN_ACTIVE, 'string');
     $oTable->addColumn(STR_BM_RELEASEDATE_DESC, 'string');
     $oTable->addColumn('Target Date', 'date');
     $oTable->addColumn('Actual Date', 'date');
     if (isset($this->ModNav) && ($this->ModNav == 'WO' || $this->ModNav == 'showfiles')) {
         $oTable->addToolbar(menuLink('', 'menuAction=boProducts.viewRelease&id=' . $this->id), 'Back');
     } else {
         $oTable->addToolbar(menuLink('', 'menuAction=boBuildManager.add&which=release&product_id=' . $this->productid . '&add=1'), STR_CMMN_NEW);
     }
     if (count($allRecs) > 0 && $g_oSec->HasPerm(DCL_ENTITY_GLOBAL, DCL_ENTITY_ADMIN)) {
         $oTable->addColumn(STR_CMMN_OPTIONS, 'html');
         for ($i = 0; $i < count($allRecs); $i++) {
             $options = '';
             if (isset($this->ModNav)) {
                 $options = '<a href="' . menuLink('', 'menuAction=boWorkorders.viewjcn&jcn=' . $allRecs[$i][1] . '&seq=' . $allRecs[$i][2]) . '">' . STR_CMMN_VIEW . '</a>';
             } else {
                 $versionid = $allRecs[$i][0];
                 $options = '<a href="' . menuLink('', 'menuAction=boProducts.viewBuild&product_version_id=' . $versionid . '&product_id=' . $this->productid) . '">' . STR_CMMN_VIEW . '</a>';
                 $options .= '&nbsp;|&nbsp;<a href="' . menuLink('', 'menuAction=htmlBuildManagerReleaseForm.Show&product_version_id=' . $versionid . '&product_id=' . $this->productid . '&which=release') . '">' . STR_CMMN_EDIT . '</a>';
                 $options .= '&nbsp;|&nbsp;<a href="' . menuLink('', 'menuAction=boBuildManager.ShowWorkOrders&product_version_id=' . $versionid . '&product_id=' . $this->productid . '&from=version') . '">' . STR_CMMN_SHOWVERSION . '</a>';
                 $options .= '&nbsp;|&nbsp;<a href="' . menuLink('', 'menuAction=boBuildManager.ShowFiles&product_version_id=' . $versionid . '&product_id=' . $this->productid . '&from=version') . '">' . STR_CMMN_SHOWFILES . '</a>';
             }
             $allRecs[$i][6] = $options;
         }
     }
     $oTable->setData($allRecs);
     $oTable->setShowRownum(true);
     $oTable->render();
 }
 function Page()
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_ROLE, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     $oView = CreateObject('dcl.boView');
     $oView->SetFromURL();
     if ((isset($_REQUEST['btnNav']) || isset($_REQUEST['jumptopage'])) && isset($_REQUEST['startrow']) && isset($_REQUEST['numrows'])) {
         if (isset($_REQUEST['btnNav']) && $_REQUEST['btnNav'] == '<<') {
             $oView->startrow = (int) $_REQUEST['startrow'] - (int) $_REQUEST['numrows'];
         } else {
             if (isset($_REQUEST['btnNav']) && $_REQUEST['btnNav'] == '>>') {
                 $oView->startrow = (int) $_REQUEST['startrow'] + (int) $_REQUEST['numrows'];
             } else {
                 $iPage = (int) $_REQUEST['jumptopage'];
                 if ($iPage < 1) {
                     $iPage = 1;
                 }
                 $oView->startrow = ($iPage - 1) * (int) $_REQUEST['numrows'];
             }
         }
         if ($oView->startrow < 0) {
             $oView->startrow = 0;
         }
         $oView->numrows = (int) $_REQUEST['numrows'];
     } else {
         $oView->numrows = 25;
         $oView->startrow = 0;
     }
     $filterActive = '0';
     if (isset($_REQUEST['filterActive'])) {
         $filterActive = $_REQUEST['filterActive'];
     }
     if ($filterActive != '0') {
         $oView->ReplaceDef('filter', 'active', "'{$filterActive}'");
     } else {
         $oView->RemoveDef('filter', 'active');
     }
     $this->sColumnTitle = STR_CMMN_OPTIONS;
     $this->bShowPager = true;
     $this->Render($oView);
 }
 function showForm($obj = '')
 {
     global $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_FORMTEMPLATES, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $t = CreateSmarty();
     if ($isEdit) {
         $t->assign('VAL_MENUACTION', 'boChecklistTpl.dbmodify');
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->dcl_chklst_tpl_active, 'dcl_chklst_tpl_active', 0, false));
         $t->assign('VAL_NAME', $obj->dcl_chklst_tpl_name);
         $t->assign('VAL_ID', $obj->dcl_chklst_tpl_id);
     } else {
         $t->assign('VAL_MENUACTION', 'boChecklistTpl.dbadd');
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'dcl_chklst_tpl_active', 0, false));
     }
     SmartyDisplay($t, 'htmlChklstTplAdd.tpl');
 }
 function Show($obj)
 {
     global $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_ATTRIBUTESETS, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     if (!is_object($obj)) {
         trigger_error('[htmlAttributesets::Show] ' . STR_ATTR_OBJECTNOTPASSED);
         return;
     }
     $t = CreateSmarty();
     $t->assign('VAL_ATTRIBUTESETNAME', $obj->name);
     SmartyDisplay($t, 'htmlAttributesetdetail.tpl');
     $objA = CreateObject('dcl.dbActions');
     $theAttributes = array('actions', 'priorities', 'severities', 'statuses');
     $aTitles = array('actions' => STR_ATTR_ACTIONS, 'priorities' => STR_ATTR_PRIORITIES, 'severities' => STR_ATTR_SEVERITIES, 'statuses' => STR_ATTR_STATUSES);
     for ($cnt = 0; $cnt < count($theAttributes); $cnt++) {
         $typeid = $cnt + 1;
         $section = $theAttributes[$cnt];
         $query = 'SELECT a.name FROM ' . $section . ' a, attributesetsmap b WHERE a.id=b.keyid ';
         $query .= ' AND b.setid=' . $obj->id;
         $query .= ' AND b.typeid=' . $typeid;
         $query .= ' ORDER BY ';
         if ($section == 'priorities' || $section == 'severities') {
             $query .= 'b.weight';
         } else {
             $query .= 'a.name';
         }
         if ($objA->Query($query) != -1) {
             $oTable = CreateObject('dcl.htmlTable');
             $oTable->setCaption($aTitles[$theAttributes[$cnt]]);
             $oTable->setInline(true);
             $oTable->addToolbar(menuLink('', 'menuAction=boAttributesets.showall'), STR_ATTR_ATTRIBUTESET);
             if ($g_oSec->HasPerm(DCL_ENTITY_ATTRIBUTESETS, DCL_PERM_MODIFY)) {
                 $oTable->addToolbar(menuLink('', 'menuAction=boAttributesets.showmapping&setid=' . $obj->id . '&typeid=' . $typeid), STR_ATTR_MAP);
             }
             $oTable->setData($objA->FetchAllRows());
             $oTable->addColumn(STR_CMMN_NAME, 'string');
             $oTable->render();
         }
     }
 }
 function dbmodify()
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $aCheckboxes = array('DCL_AUTO_DATE', 'DCL_PROJECT_XML_TEMPLATES', 'DCL_SMTP_ENABLED', 'DCL_GATEWAY_TICKET_ENABLED', 'DCL_GATEWAY_TICKET_AUTORESPOND', 'DCL_GATEWAY_TICKET_REPLY', 'DCL_PROJECT_INCLUDE_CHILD_STATS', 'DCL_PROJECT_INCLUDE_PARENT_STATS', 'DCL_PROJECT_BROWSE_PARENTS_ONLY', 'DCL_WO_NOTIFICATION_HTML', 'DCL_TCK_NOTIFICATION_HTML', 'DCL_GATEWAY_WO_ENABLED', 'DCL_GATEWAY_WO_AUTORESPOND', 'DCL_GATEWAY_WO_REPLY', 'DCL_WO_SECONDARY_ACCOUNTS_ENABLED', 'DCL_WIKI_ENABLED', 'DCL_SCCS_ENABLED', 'DCL_SMTP_AUTH_REQUIRED', 'DCL_BUILD_MANAGER_ENABLED', 'DCL_SEC_AUDIT_ENABLED', 'DCL_SEC_AUDIT_LOGIN_ONLY', 'DCL_FORCE_SECURE_GRAVATAR');
     // get all of the settings except for DCL_VERSION and LAST_CONFIG_UPDATE and update
     // the ones that have changed.
     $bHasUpdates = false;
     $oConfig =& CreateObject('dcl.dbConfig');
     $oConfig->LoadForModify();
     while ($oConfig->next_record()) {
         $oConfig->GetRow();
         if (isset($_REQUEST[$oConfig->dcl_config_name])) {
             $_REQUEST[$oConfig->dcl_config_name] = $oConfig->GPCStripSlashes($_REQUEST[$oConfig->dcl_config_name]);
         }
         // checkboxes need special handling
         if (in_array($oConfig->dcl_config_name, $aCheckboxes)) {
             $newVal = isset($_REQUEST[$oConfig->dcl_config_name]) && $_REQUEST[$oConfig->dcl_config_name] == 'Y' ? 'Y' : 'N';
             if ($newVal != $dcl_info[$oConfig->dcl_config_name]) {
                 $oConfig->{$oConfig->dcl_config_field} = $newVal;
                 $oConfigTemp = $oConfig;
                 $oConfigTemp->Edit();
                 $dcl_info[$oConfig->dcl_config_name] = $newVal;
                 $bHasUpdates = true;
             }
         } elseif (isset($_REQUEST[$oConfig->dcl_config_name]) && $dcl_info[$oConfig->dcl_config_name] != $_REQUEST[$oConfig->dcl_config_name]) {
             $oConfig->{$oConfig->dcl_config_field} = $_REQUEST[$oConfig->dcl_config_name];
             $oConfigTemp = $oConfig;
             $oConfigTemp->Edit();
             $dcl_info[$oConfig->dcl_config_name] = $_REQUEST[$oConfig->dcl_config_name];
             $bHasUpdates = true;
         }
     }
     if ($bHasUpdates) {
         $oConfigTemp->UpdateTimeStamp();
     }
     $obj =& CreateObject('dcl.htmlAdminMain');
     $obj->Show();
 }
 function Show()
 {
     global $g_oSec;
     commonHeader();
     if (($id = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if (!$g_oSec->HasPerm(DCL_ENTITY_HOTLIST, DCL_PERM_VIEW, $id)) {
         return PrintPermissionDenied();
     }
     $this->hotlist =& CreateObject('dcl.dbHotlist');
     if ($this->hotlist->Load($id) == -1) {
         trigger_error('Could not find a hotlist with an id of ' . $id, E_USER_ERROR);
         return;
     }
     $this->oSmarty->assign('VAL_HOTLISTID', $id);
     $this->oSmarty->assign('VAL_NAME', $this->hotlist->hotlist_desc);
     SmartyDisplay($this->oSmarty, 'htmlHotlistProjectDashboard.tpl');
 }
 function delete($aSource)
 {
     global $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_CONTACT, DCL_PERM_DELETE)) {
         return PrintPermissionDenied();
     }
     if (($id = @DCL_Sanitize::ToInt($aSource['contact_id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if (!$this->oDB->HasFKRef($id)) {
         $this->oDB->Execute("DELETE FROM dcl_contact_addr WHERE contact_id = {$id}");
         $this->oDB->Execute("DELETE FROM dcl_org_contact WHERE contact_id = {$id}");
         $this->oDB->Execute("DELETE FROM dcl_contact_email WHERE contact_id = {$id}");
         $this->oDB->Execute("DELETE FROM dcl_contact_note WHERE contact_id = {$id}");
         $this->oDB->Execute("DELETE FROM dcl_contact_phone WHERE contact_id = {$id}");
         $this->oDB->Execute("DELETE FROM dcl_contact_type_xref WHERE contact_id = {$id}");
     }
     parent::delete($aSource);
 }
 function GetHTML($part = 'all')
 {
     global $dcl_info;
     if (($wo_id = DCL_Sanitize::ToInt($_REQUEST['wo_id'])) === null || ($seq = DCL_Sanitize::ToInt($_REQUEST['seq'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if ($part == 'top') {
         $this->t->set_var('TXT_TITLE', 'Work Order ' . $wo_id . '-' . $seq . ' Organizations');
         $this->t->set_var('TXT_OK', STR_CMMN_OK);
         $this->t->set_var('TXT_PRINT', STR_CMMN_PRINT);
     } else {
         if ($part == 'main') {
             $this->t->set_block('hForm', 'sel', 'hSel');
             $this->t->set_var('hSel', '');
             switch ($_REQUEST['what']) {
                 case 'dcl_wo_account.wo_id':
                     $this->ListFromDb('dcl_wo_account', 'name', 'wo_id = ' . $wo_id . ' And seq = ' . $seq, 'name');
                     break;
                 default:
                     PrintPermissionDenied();
                     return "";
             }
         } else {
             $this->t = CreateTemplate(array('hForm' => 'htmlWindowList.tpl'));
             $this->t->set_var('TXT_TITLE', 'Work Order ' . $wo_id . '-' . $seq . ' Organizations');
             $this->t->set_var('TXT_OK', STR_CMMN_OK);
             switch ($_REQUEST['what']) {
                 case 'dcl_wo_account.wo_id':
                     $this->ListFromDb('dcl_wo_account', 'name', 'wo_id = ' . $wo_id . ' And seq = ' . $seq, 'name');
                     break;
                 default:
                     PrintPermissionDenied();
                     return "";
             }
             return $this->t->parse('out', 'hForm');
         }
     }
 }