Example #1
1
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
//initialize document
$pdf->AliasNbPages();
// add a page
$pdf->AddPage();
// ---------------------------------------------------------
// set font
$pdf->SetFont("arialunicid0", "B", 12);
//B= bold , I = Italic , U = Underlined
//Document Header
//Line1
$slen = strlen(dPgetConfig('company_name') . "\n") + $str_pad;
$pdf->writeHTMLCell($header_w + $slen, $header_h, $x, $y, dPgetConfig('company_name'));
$pdf->writeHTMLCell($header_w, $header_h, $x + $slen, $y, date("Y/m/d"));
// (Width,Height,Text,Border,Align,Fill,Line,x,y,reset,stretch,ishtml,autopadding,maxh)
// Line break - Line2
$y = $y + $header_line_gap;
// set font
$pdf->SetFont("", "B", 12);
// Title
$slen = mb_strlen($AppUI->_('Project Overdue Task Report')) + $str_pad;
$pdf->writeHTMLCell($header_w + $slen, $header_h, $x, $y, $AppUI->_('Project Overdue Task Report'));
// Line break - Line3
$y = $y + $header_line_gap;
$slen = mb_strlen($date->format($df) . " " . $AppUI->_('Tasks Due to be Completed By')) + $str_pad + 20;
$pdf->writeHTMLCell($header_w + $slen, $header_h, $x, $y, $date->format($df) . " " . $AppUI->_('Tasks Due to be Completed By'));
// Line break - Line4
$y = $y + $header_line_gap;
Example #2
0
function createTask($obj)
{
    // Include any files for handling module-specific requirements
    foreach (findTabModules('tasks', 'addedit') as $mod) {
        $fname = dPgetConfig('root_dir') . "/modules/{$mod}/tasks_dosql.addedit.php";
        dprint(__FILE__, __LINE__, 3, "checking for {$fname}");
        if (file_exists($fname)) {
            require_once $fname;
        }
    }
    // If we have an array of pre_save functions, perform them in turn.
    if (isset($pre_save)) {
        foreach ($pre_save as $pre_save_function) {
            $pre_save_function();
        }
    } else {
        dprint(__FILE__, __LINE__, 1, "No pre_save functions.");
    }
    $msg = $obj->store();
    if ($msg) {
        return false;
    }
    if (isset($post_save)) {
        foreach ($post_save as $post_save_function) {
            $post_save_function();
        }
    }
    if ($notify) {
        if ($msg = $obj->notify($comment)) {
            $AppUI->setMsg($msg, UI_MSG_ERROR);
        }
    }
    return true;
}
Example #3
0
 function dPacl($opts = null)
 {
     global $db;
     if (!is_array($opts)) {
         $opts = array();
     }
     $opts['db_type'] = dPgetConfig('dbtype');
     $opts['db_host'] = dPgetConfig('dbhost');
     $opts['db_user'] = dPgetConfig('dbuser');
     $opts['db_password'] = dPgetConfig('dbpass');
     $opts['db_name'] = dPgetConfig('dbname');
     $opts['caching'] = dPgetConfig('gacl_cache', false);
     $opts['force_cache_expire'] = dPgetConfig('gacl_expire', true);
     $opts['cache_dir'] = dPgetConfig('gacl_cache_dir', '/tmp');
     $opts['cache_expire_time'] = dPgetConfig('gacl_timeout', 600);
     $opts['db'] = $db;
     /*
      * We can add an ADODB instance instead of the database connection details. 
      * This might be worth looking at in the future.
      */
     if (dPgetConfig('debug', 0) > 10) {
         $this->_debug = true;
     }
     parent::gacl_api($opts);
 }
function getPermission($mod, $perm, $item_id = 0)
{
    global $AppUI;
    $perms =& $AppUI->acl();
    $dbprefix = dPgetConfig('dbprefix', '');
    // First check if the module is readable, i.e. has view permission.
    $result = $perms->checkModuleItem($mod, $perm, $item_id);
    // We need to check if we are allowed to view in the parent module item.
    // This can be done a lot better in PHPGACL, but is here for compatibility.
    if ($item_id && $perm == 'view') {
        if ($mod == 'task_log') {
            $sql = 'SELECT task_log_task FROM ' . $dbprefix . 'task_log WHERE task_log_id =' . $item_id;
            $task_id = db_loadResult($sql);
            $result = $result && getPermission('tasks', $perm, $task_id);
        } else {
            if ($mod == 'tasks') {
                $sql = 'SELECT task_project FROM ' . $dbprefix . 'tasks WHERE task_id =' . $item_id;
                $project_id = db_loadResult($sql);
                $result = $result && getPermission('projects', $perm, $project_id);
            } else {
                if ($mod == 'projects') {
                    $sql = 'SELECT project_company FROM ' . $dbprefix . 'projects WHERE project_id =' . $item_id;
                    $company_id = db_loadResult($sql);
                    $result = $result && getPermission('companies', $perm, $company_id);
                }
            }
        }
    }
    return $result;
}
Example #5
0
 /**
  *	Object constructor to set table and key field
  *
  *	Can be overloaded/supplemented by the child class
  *	@param string $table name of the table in the db schema relating to child class
  *	@param string $key name of the primary key field in the table
  */
 function CDpObject($table, $key)
 {
     $this->_tbl = $table;
     $this->_tbl_key = $key;
     dPgetConfig('dbprefix', '');
     $this->_query =& new DBQuery();
 }
Example #6
0
 /**
  *	Object constructor to set table and key field
  *
  *	Can be overloaded/supplemented by the child class
  *	@param string $table name of the table in the db schema relating to child class
  *	@param string $key name of the primary key field in the table
  *	@param string $perm_name permission module name relating to child class (default $table)
  */
 function CDpObject($table, $key, $perm_name = '')
 {
     $this->_tbl = $table;
     $this->_tbl_key = $key;
     $this->_permission_name = $perm_name ? $perm_name : $table;
     dPgetConfig('dbprefix', '');
     $this->_query =& new DBQuery();
 }
Example #7
0
 function DBQuery($prefix = null)
 {
     if (isset($prefix)) {
         $this->_table_prefix = $prefix;
     } else {
         $this->_table_prefix = dPgetConfig('dbprefix', '');
     }
     $this->clear();
 }
function isWorkingDay()
{
    global $AppUI;
    $working_days = dPgetConfig("cal_working_days");
    if (is_null($working_days)) {
        $working_days = array('1', '2', '3', '4', '5');
    } else {
        $working_days = explode(",", $working_days);
    }
    return in_array($this->getDayOfWeek(), $working_days);
}
Example #9
0
 function remove()
 {
     $dbprefix = dPgetConfig('dbprefix', '');
     $success = 1;
     $bulk_sql[] = "DROP TABLE `{$dbprefix}project_designer_options`";
     foreach ($bulk_sql as $s) {
         db_exec($s);
         if (db_error()) {
             $success = 0;
         }
     }
     return $success;
 }
 function load($oid = null, $strip = true)
 {
     $result = parent::load($oid, $strip);
     if ($result && $oid) {
         $working_hours = dPgetConfig('daily_working_hours') ? dPgetConfig('daily_working_hours') : 8;
         $q = new DBQuery();
         $q->addTable('projects');
         $q->addQuery(" SUM(t1.task_duration * t1.task_percent_complete" . " * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}" . ", t1.task_duration_type)) AS project_percent_complete");
         $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
         $q->addWhere(" project_id = {$oid} AND t1.task_id = t1.task_parent");
         $this->project_percent_complete = $q->loadResult();
     }
     return $result;
 }
Example #11
0
function sendNewPass()
{
    global $AppUI;
    $_live_site = dPgetConfig('base_url');
    $_sitename = dPgetConfig('company_name');
    // ensure no malicous sql gets past
    $checkusername = trim(dPgetParam($_POST, 'checkusername', ''));
    $checkusername = db_escape($checkusername);
    $confirmEmail = trim(dPgetParam($_POST, 'checkemail', ''));
    $confirmEmail = mb_strtolower(db_escape($confirmEmail));
    $q = new DBQuery();
    $q->addTable('users', 'u');
    $q->addQuery('u.user_id');
    $q->addWhere('user_username=\'' . $checkusername . '\' AND LOWER(contact_email)=\'' . $confirmEmail . '\'');
    $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id');
    if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) {
        $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $newpass = makePass();
    $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW);
    $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}";
    $m = new Mail();
    // create the mail
    $m->From("dotProject@" . dPgetConfig('site_domain'));
    $m->To($confirmEmail);
    $m->Subject($subject);
    $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
    // set the body
    $m->Send();
    // send the mail
    $newpass = md5($newpass);
    $q->clear();
    $q->addTable('users');
    $q->addUpdate('user_password', $newpass, true);
    $q->addWhere('user_id=\'' . $user_id . '\'');
    $cur = $q->exec();
    if (!$cur) {
        die('SQL error' . $database->stderr(true));
    } else {
        $AppUI->setMsg('New User Password created and emailed to you');
        $AppUI->redirect();
    }
}
Example #12
0
File: index.php Project: n2i/xvnkb
function show_issue($summary, $bugid, $username, $email)
{
    $mantispath = dPgetConfig('mantis_path');
    $parm = $username;
    $parm .= "||";
    $parm .= $bugid;
    $parm .= "||";
    $parm .= $email;
    $parm .= "||";
    $parm = base64_encode($parm);
    $link = "<a href=";
    $link .= $mantispath;
    $link .= "/index_dp.php?parm=";
    $link .= $parm;
    $link .= " target=_blank";
    $link .= ">";
    $link .= $summary;
    $link .= "</a>";
    return $link;
}
Example #13
0
 function dPacl($opts = null)
 {
     global $db;
     if (!is_array($opts)) {
         $opts = array();
     }
     $opts['db_type'] = dPgetConfig('dbtype');
     $opts['db_host'] = dPgetConfig('dbhost');
     $opts['db_user'] = dPgetConfig('dbuser');
     $opts['db_password'] = dPgetConfig('dbpass');
     $opts['db_name'] = dPgetConfig('dbname');
     $opts['db'] = $db;
     // We can add an ADODB instance instead of the database
     // connection details.  This might be worth looking at in
     // the future.
     if (dPgetConfig('debug', 0) > 10) {
         $this->_debug = true;
     }
     parent::gacl_api($opts);
 }
Example #14
0
function sendNewPass()
{
    global $AppUI;
    $_live_site = dPgetConfig('base_url');
    $_sitename = dPgetConfig('company_name');
    // ensure no malicous sql gets past
    $checkusername = trim(dPgetParam($_POST, 'checkusername', ''));
    $checkusername = db_escape($checkusername);
    $confirmEmail = trim(dPgetParam($_POST, 'checkemail', ''));
    $confirmEmail = mb_strtolower(db_escape($confirmEmail));
    $query = 'SELECT user_id FROM users LEFT JOIN contacts ON user_contact = contact_id' . " WHERE user_username='******' AND LOWER(contact_email)='{$confirmEmail}'";
    if (!($user_id = db_loadResult($query)) || !$checkusername || !$confirmEmail) {
        $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $newpass = makePass();
    $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW);
    $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}";
    $m = new Mail();
    // create the mail
    $m->From("dotProject@" . dPgetConfig('site_domain'));
    $m->To($confirmEmail);
    $m->Subject($subject);
    $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
    // set the body
    $m->Send();
    // send the mail
    $newpass = md5($newpass);
    $sql = "UPDATE users SET user_password='******' WHERE user_id='{$user_id}'";
    $cur = db_exec($sql);
    if (!$cur) {
        die('SQL error' . $database->stderr(true));
    } else {
        $AppUI->setMsg('New User Password created and emailed to you');
        $AppUI->redirect();
    }
}
    die('You should not access this file directly.');
}
global $AppUI, $project_id, $deny, $canRead, $canEdit, $dPconfig, $start_date, $end_date;
global $this_day, $event_filter, $event_filter_list;
require_once $AppUI->getModuleClass('calendar');
$perms =& $AppUI->acl();
$user_id = $AppUI->user_id;
$other_users = false;
$no_modify = false;
$start_date = isset($start_date) ? $start_date : new CDate('0000-00-00 00:00:00');
$end_date = isset($end_date) ? $end_date : new CDate('9999-12-31 23:59:59');
// assemble the links for the events
$events = CEvent::getEventsForPeriod($start_date, $end_date, 'all', null, $project_id);
//echo '<pre>' . print_r($events, true) .  '</pre>';
$start_hour = dPgetConfig('cal_day_start');
$end_hour = dPgetConfig('cal_day_end');
$tf = $AppUI->getPref('TIMEFORMAT');
$df = $AppUI->getPref('SHDATEFORMAT');
$types = dPgetSysVal('EventType');
?>
<table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl">
	<tr>
		<th><?php 
echo $AppUI->_('Date');
?>
</th>
		<th><?php 
echo $AppUI->_('Type');
?>
</th>
		<th><?php 
Example #16
0
    } else {
        ?>
<script language="javascript">
function submitIt() {
	var f = document.frmEdit;
	var msg = '';

	if (f.new_pwd1.value.length < <?php 
        echo dPgetConfig('password_min_len');
        ?>
) {
        	msg += "<?php 
        echo $AppUI->_('chgpwValidNew', UI_OUTPUT_JS);
        ?>
" + <?php 
        echo dPgetConfig('password_min_len');
        ?>
;
			f.new_pwd1.focus();
	}
	if (f.new_pwd1.value != f.new_pwd2.value) {
		msg += "\n<?php 
        echo $AppUI->_('chgpwNoMatch', UI_OUTPUT_JS);
        ?>
";
		f.new_pwd2.focus();
	}
	if (msg.length < 1) {
		f.submit();
	} else {
		alert(msg);
Example #17
0
			    	<td>
		 <?php 
}
?>
		</table>
	</td>
</table>

<?php 
$tabBox = new CTabBox("?m=projects&a=view&project_id={$project_id}", "", $tab);
$query_string = "?m=projects&a=view&project_id={$project_id}";
// tabbed information boxes
// Note that we now control these based upon module requirements.
$canViewTask = $perms->checkModule('tasks', 'view');
if ($canViewTask) {
    $tabBox->add(dPgetConfig('root_dir') . "/modules/tasks/tasks", 'Tasks');
    $tabBox->add(dPgetConfig('root_dir') . "/modules/tasks/tasks", 'Tasks (Inactive)');
}
if ($perms->checkModule('forums', 'view')) {
    $tabBox->add(dPgetConfig('root_dir') . "/modules/projects/vw_forums", 'Forums');
}
//if ($perms->checkModule('files', 'view'))
//	$tabBox->add( dPgetConfig('root_dir')."/modules/projects/vw_files", 'Files' );
if ($canViewTask) {
    $tabBox->add(dPgetConfig('root_dir') . "/modules/tasks/viewgantt", 'Gantt Chart');
    $tabBox->add(dPgetConfig('root_dir') . "/modules/projects/vw_logs", 'Task Logs');
}
$tabBox->loadExtras($m);
$f = 'all';
$min_view = true;
$tabBox->show();
            // Mark contact as private
            $obj = new CUser();
            $contact = new CContact();
            $obj->load($user_id);
            if ($contact->load($obj->user_contact)) {
                $contact->contact_private = 1;
                $contact->store();
            }
        }
    } else {
        $AppUI->setMsg('failed to delete role', UI_MSG_ERROR);
    }
} else {
    if ($user_role) {
        $public_contact = false;
        if (dPgetConfig('user_contact_activate') && !$perms->checkLogin($user_id)) {
            $public_contact = true;
        }
        if ($perms->insertUserRole($user_role, $user_id)) {
            $AppUI->setMsg('added', UI_MSG_OK, true);
            if ($public_contact) {
                // Mark contact as public
                $obj = new CUser();
                $contact = new CContact();
                $obj->load($user_id);
                if ($contact->load($obj->user_contact)) {
                    $contact->contact_private = 0;
                    $contact->store();
                }
            }
        } else {
Example #19
0
 /**
  * Injects a reminder event into the event queue.
  * Repeat interval is one day, repeat count
  * and days to trigger before event overdue is
  * set in the system config.
  */
 function addReminder()
 {
     $day = 86400;
     if (!dPgetConfig('task_reminder_control')) {
         return;
     }
     if (!$this->task_end_date) {
         // No end date, can't do anything.
         return $this->clearReminder(true);
         // Also no point if it is changed to null
     }
     if ($this->task_percent_complete >= 100) {
         return $this->clearReminder(true);
     }
     $eq = new EventQueue();
     $pre_charge = dPgetConfig('task_reminder_days_before', 1);
     $repeat = dPgetConfig('task_reminder_repeat', 100);
     /*
      * If we don't need any arguments (and we don't) then we set this to null. 
      * We can't just put null in the call to add as it is passed by reference.
      */
     $args = null;
     // Find if we have a reminder on this task already
     $old_reminders = $eq->find('tasks', 'remind', $this->task_id);
     if (count($old_reminders)) {
         /* 
          * It shouldn't be possible to have more than one reminder, 
          * but if we do, we may as well clean them up now.
          */
         foreach ($old_reminders as $old_id => $old_data) {
             $eq->remove($old_id);
         }
     }
     // Find the end date of this task, then subtract the required number of days.
     $date = new CDate($this->task_end_date);
     $today = new CDate(date('Y-m-d'));
     if (CDate::compare($date, $today) < 0) {
         $start_day = time();
     } else {
         $start_day = $date->getDate(DATE_FORMAT_UNIXTIME);
         $start_day -= $day * $pre_charge;
     }
     $eq->add(array($this, 'remind'), $args, 'tasks', false, $this->task_id, 'remind', $start_day, $day, $repeat);
 }
Example #20
0
           	<?php 
    echo '</a>';
    ?>
      	</table>
	</td>
</tr>
<tr id="files" <?php 
    echo isset($view_options[0]['pd_option_view_files']) ? $view_options[0]['pd_option_view_files'] ? 'style="visibility:visible;display:"' : 'style="visibility:collapse;display:none"' : 'style="visibility:visible;display:"';
    ?>
>
	<td colspan="2" class="hilite">
	<?php 
    //Permission check here
    $canViewFiles = $perms->checkModule('files', 'view');
    if ($canViewFiles) {
        require dPgetConfig('root_dir') . "/modules/projectdesigner/vw_files.php";
    } else {
        echo $AppUI->_('You do not have permission to view files');
    }
    ?>
	</td>
</tr>
</table>
<div style="display:none;">
<table class="tbl">
<tr><td id="td_sample">&nbsp;</td></tr>
</table>
</div>
<script language="javascript">
var original_bgc = getStyle('td_sample', 'background-color', 'backgroundColor');
</script>
Example #21
0
 /**
  * Send email via an SMTP connection.
  *
  * Work based loosly on that of Bugs Genie, which appears to be in turn based on something from 'Ninebirds'
  *
  * @access public
  */
 function SMTPSend()
 {
     global $AppUI;
     // Start the connection to the server
     $error_number = 0;
     $error_message = '';
     $headers =& $this->xheaders;
     $this->socket = fsockopen($this->host, $this->port, $error_number, $error_message, $this->timeout);
     if (!$this->socket) {
         dprint(__FILE__, __LINE__, 1, "Error on connecting to host {$this->host} at port {$this->port}: {$error_message} ({$error_number})");
         $AppUI->setMsg("Cannot connect to SMTP Host: {$error_message} ({$error_number})");
         return FALSE;
     }
     // Read the opening stuff;
     $this->socketRead();
     // Send the protocol start
     $this->socketSend('HELO ' . $this->getHostName());
     if ($this->sasl && $this->username) {
         $this->socketSend("AUTH LOGIN");
         $this->socketSend(base64_encode($this->username));
         $rcv = $this->socketSend(base64_encode($this->password));
         if (strpos($rcv, '235') !== 0) {
             dprint(__FILE__, __LINE__, 1, 'Authentication failed on server: ' . $rcv);
             $AppUI->setMsg('Failed to login to SMTP server: ' . $rcv);
             fclose($this->socket);
             return FALSE;
         }
     }
     // Determine the mail from address.
     if (!isset($headers['From'])) {
         $from = dPgetConfig('admin_user') . '@' . dPgetConfig('site_domain');
     } else {
         // Search for the parts of the email address
         if (preg_match('/.*<([^@]+@[a-z0-9\\._-]+)>/i', $headers['From'], $matches)) {
             $from = $matches[1];
         } else {
             $from = $headers['From'];
         }
     }
     $rcv = $this->socketSend("MAIL FROM: <{$from}>");
     if (substr($rcv, 0, 1) != '2') {
         $AppUI->setMsg("Failed to send email: {$rcv}", UI_MSG_ERROR);
         return FALSE;
     }
     foreach ($this->ato as $to_address) {
         if (strpos($to_address, '<') !== FALSE) {
             preg_match('/^.*<([^@]+\\@[a-z0-9\\._-]+)>/i', $to_address, $matches);
             if (isset($matches[1])) {
                 $to_address = $matches[1];
             }
         }
         $rcv = $this->socketSend("RCPT TO: <{$to_address}>");
         if (substr($rcv, 0, 1) != '2') {
             $AppUI->setMsg("Failed to send email: {$rcv}", UI_MSG_ERROR);
             return FALSE;
         }
     }
     $this->socketSend('DATA');
     foreach ($headers as $hdr => $val) {
         $this->socketSend("{$hdr}: {$val}", FALSE);
     }
     // Now build the To Headers as well.
     $this->socketSend('Date: ' . date('r'), FALSE);
     $this->socketSend('', FALSE);
     $this->socketSend($this->fullBody, FALSE);
     $result = $this->socketSend(".\r\nQUIT");
     if (strpos($result, '250') === 0) {
         return TRUE;
     } else {
         dprint(__FILE__, __LINE__, 1, "Failed to send email from {$from} to {$to_address}: {$result}");
         $AppUI->setMsg("Failed to send email: {$result}");
         return FALSE;
     }
 }
Example #22
0
*/
// MODULE CONFIGURATION DEFINITION
$config = array();
$config['mod_name'] = 'TimeCard';
$config['mod_version'] = '2.1';
$config['mod_directory'] = 'timecard';
$config['mod_setup_class'] = 'CSetupTimeCard';
$config['mod_type'] = 'user';
$config['mod_ui_name'] = 'Time Card';
$config['mod_ui_icon'] = 'TimeCard.png';
$config['mod_description'] = 'Time Card allows easy access to a weekly timecard based on existing task logs.';
$config['mod_config'] = true;
if (@$a == 'setup') {
    echo dPshowModuleConfig($config);
}
require_once dPgetConfig('root_dir') . '/modules/system/syskeys/syskeys.class.php';
/*
// MODULE SETUP CLASS
	This class must contain the following methods:
	install - creates the required db tables
	remove - drop the appropriate db tables
	upgrade - upgrades tables from previous versions
*/
class CSetupTimeCard
{
    /*
    	Install routine
    */
    function install()
    {
        return true;
Example #23
0
<?php

if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// $Id: ae_depend.php,v 1.12.4.3 2007/09/19 13:45:52 theideaman Exp $
global $AppUI, $dPconfig, $task_parent_options, $loadFromTab;
global $can_edit_time_information, $obj;
global $durnTypes, $task_project, $task_id, $tab;
//Time arrays for selects
$start = intval(dPgetConfig('cal_day_start'));
$end = intval(dPgetConfig('cal_day_end'));
$inc = intval(dPgetConfig('cal_day_increment'));
if ($start === null) {
    $start = 8;
}
if ($end === null) {
    $end = 17;
}
if ($inc === null) {
    $inc = 15;
}
$hours = array();
for ($current = $start; $current < $end + 1; $current++) {
    if ($current < 10) {
        $current_key = "0" . $current;
    } else {
        $current_key = $current;
    }
    if (stristr($AppUI->getPref('TIMEFORMAT'), "%p")) {
        //User time format in 12hr
Example #24
0
$display_project_name = $obj->project_name;
if (!$suppressHeaders) {
    ?>
<script language="javascript">

function changeIt() {
        var f=document.changeMe;
        f.submit();
}
</script>

<?php 
}
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$reports = $AppUI->readFiles(dPgetConfig('root_dir') . "/modules/projects/reports", "\\.php\$");
// setup the title block
if (!$suppressHeaders) {
    $titleBlock = new CTitleBlock('Project Reports');
    $titleBlock->addButton("projects list", 'index.php?m=projects');
    $titleBlock->show();
}
$report_type_var = dPgetParam($_GET, 'report_type', '');
if (!empty($report_type_var)) {
    $report_type_var = '&report_type=' . $report_type;
}
$title_ext = '';
if ($report_type != '') {
    $rfx = DP_BASE_DIR . "/modules/projects/reports/" . $report_type . '.' . $AppUI->user_locale . '.txt';
    if (file_exists($rfx)) {
        $ds = file($rfx);
Example #25
0
<?php

/* HELPDESK $Id: list.php,v 1.78 2005/12/28 20:02:49 theideaman Exp $ */
include_once dPgetConfig('root_dir') . '/modules/helpdesk/helpdesk.functions.php';
include_once "./modules/helpdesk/config.php";
$allowedCompanies = getAllowedCompanies();
$allowedProjects = getAllowedProjects();
$ipr = dPgetSysVal('HelpDeskPriority');
$ist = dPgetSysVal('HelpDeskStatus');
$AppUI->savePlace();
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$format = $df . " " . $tf;
// check sort order
if (isset($_GET['orderby'])) {
    $AppUI->setState('HelpDeskIdxOrderBy', $_GET['orderby']);
}
$orderby = $AppUI->getState('HelpDeskIdxOrderBy') ? $AppUI->getState('HelpDeskIdxOrderBy') : 'item_id';
// check sort order way (asc/desc)
if (isset($_GET['orderdesc'])) {
    $AppUI->setState('HelpDeskIdxOrderDesc', $_GET['orderdesc']);
}
$orderdesc = $AppUI->getState('HelpDeskIdxOrderDesc') ? $AppUI->getState('HelpDeskIdxOrderDesc') : 0;
if (isset($_GET['page'])) {
    $AppUI->setState('HelpDeskListPage', $_GET['page']);
} else {
    // If page isn't mentioned, we need to reset
    $AppUI->setState('HelpDeskListPage', 0);
}
$page = $AppUI->getState('HelpDeskListPage') ? $AppUI->getState('HelpDeskListPage') : 0;
$tarr = array();
Example #26
0
<?php

/* STYLE/DEFAULT $Id: lostpass.php 5872 2009-04-25 00:09:56Z merlinyoda $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title><?php 
echo @dPgetConfig('page_title');
?>
</title>
	<meta http-equiv="Content-Type" content="text/html;charset=<?php 
echo isset($locale_char_set) ? $locale_char_set : 'UTF-8';
?>
" />
       	<title><?php 
echo $dPconfig['company_name'];
?>
 :: dotProject Login</title>
	<meta http-equiv="Pragma" content="no-cache" />
	<meta name="Version" content="<?php 
echo @$AppUI->getVersion();
?>
" />
	<link rel="stylesheet" type="text/css" href="./style/<?php 
echo $uistyle;
?>
Example #27
0
if (!$canAccess) {
    $AppUI->redirect("m=public&a=access_denied");
}
// setup the title block
$titleBlock = new CTitleBlock('Trouble Ticket Management', 'gconf-app-icon.png', $m, "{$m}.{$a}");
if ($canAuthor) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new ticket') . '">', '', '<form name="ticketform" action="?m=ticketsmith&amp;a=post_ticket" method="post">', '</form>');
}
$titleBlock->show();
require DP_BASE_DIR . '/modules/ticketsmith/config.inc.php';
require DP_BASE_DIR . '/modules/ticketsmith/common.inc.php';
$column = $CONFIG["order_by"];
$direction = $CONFIG["message_order"];
$offset = 0;
$limit = $CONFIG["view_rows"];
$dbprefix = dPgetConfig('dbprefix', '');
$type = dPgetCleanParam($_GET, 'type', '');
$column = dPgetCleanParam($_GET, 'column', $column);
$direction = dPgetCleanParam($_GET, 'direction', $direction);
$offset = dPgetCleanParam($_GET, 'offset', $offset);
$action = dPgetCleanParam($_REQUEST, 'action', null);
if ($type == '') {
    if ($AppUI->getState("ticket_type")) {
        $type = $AppUI->getState("ticket_type");
    } else {
        $type = "Open";
    }
} else {
    $AppUI->setState("ticket_type", $type);
}
/* expunge deleted tickets */
Example #28
0
$sort = dPgetCleanParam($_REQUEST, 'sort', 'asc');
$forum_id = (int) dPgetParam($_REQUEST, 'forum_id', 0);
$message_id = (int) dPgetParam($_REQUEST, 'message_id', 0);
if (!getPermission('forums', 'view', $message_id)) {
    $AppUI->redirect("m=public&a=access_denied");
}
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('forum_messages', 'msg');
$q->addQuery('msg.*, contact_first_name, contact_last_name, contact_email, user_username,
			forum_moderated, visit_user');
$q->addJoin('forum_visits', 'v', "visit_user = {$AppUI->user_id} AND visit_forum = {$forum_id} AND visit_message = msg.message_id");
$q->addJoin('users', 'u', 'message_author = u.user_id');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
$q->addWhere("forum_id = message_forum AND (message_id = {$message_id} OR message_parent = {$message_id})");
if (dPgetConfig('forum_descendent_order') || dPgetCleanParam($_REQUEST, 'sort', 0)) {
    $q->addOrder("message_date {$sort}");
}
$messages = $q->loadList();
$x = false;
$date = new CDate();
$pdfdata = array();
$pdfhead = array('Date', 'User', 'Message');
$new_messages = array();
foreach ($messages as $row) {
    // Find the parent message - the topic.
    if ($row['message_id'] == $message_id) {
        $topic = $row['message_title'];
    }
    $q = new DBQuery();
    $q->addTable('forum_messages');
Example #29
0
function showDays()
{
    global $allocated_hours_sum, $end_date, $start_date, $AppUI, $user_list, $user_names, $user_usage, $hideNonWd, $table_header, $table_rows, $df, $working_days_count, $total_hours_capacity, $total_hours_capacity_all;
    $days_difference = $end_date->dateDiff($start_date);
    $actual_date = $start_date;
    $working_days_count = 0;
    $allocated_hours_sum = 0;
    $table_header = "<tr><th>" . $AppUI->_("User") . "</th>";
    for ($i = 0; $i <= $days_difference; $i++) {
        if ($actual_date->isWorkingDay() || !$actual_date->isWorkingDay() && !$hideNonWd) {
            $table_header .= "<th>" . utf8_encode(Date_Calc::getWeekdayAbbrname($actual_date->day, $actual_date->month, $actual_date->year, 3)) . "<br>" . $actual_date->format('%d/%m') . "</th>";
        }
        if ($actual_date->isWorkingDay()) {
            $working_days_count++;
        }
        $actual_date->addDays(1);
    }
    $table_header .= "<th nowrap='nowrap' colspan='2'>" . $AppUI->_("Allocated") . "</th></tr>";
    $table_rows = "";
    foreach ($user_list as $user_id => $user_data) {
        @($user_names[$user_id] = $user_data["user_username"]);
        if (isset($user_usage[$user_id])) {
            $table_rows .= "<tr><td nowrap='nowrap'>(" . $user_data["user_username"] . ") " . $user_data["contact_first_name"] . " " . $user_data["contact_last_name"] . "</td>";
            $actual_date = $start_date;
            for ($i = 0; $i <= $days_difference; $i++) {
                if ($actual_date->isWorkingDay() || !$actual_date->isWorkingDay() && !$hideNonWd) {
                    $table_rows .= "<td>";
                    if (isset($user_usage[$user_id][$actual_date->format("%Y%m%d")])) {
                        $hours = number_format($user_usage[$user_id][$actual_date->format("%Y%m%d")], 2);
                        $table_rows .= $hours;
                        $percentage_used = round($hours / dPgetConfig("daily_working_hours") * 100);
                        $bar_color = "blue";
                        if ($percentage_used > 100) {
                            $bar_color = "red";
                            $percentage_used = 100;
                        }
                        $table_rows .= "<div style='height:2px;width:{$percentage_used}%; background-color:{$bar_color}'>&nbsp;</div>";
                    } else {
                        $table_rows .= "&nbsp;";
                    }
                    $table_rows .= "</td>";
                }
                $actual_date->addDays(1);
            }
            $array_sum = array_sum($user_usage[$user_id]);
            $average_user_usage = number_format($array_sum / ($working_days_count * dPgetConfig("daily_working_hours")) * 100, 2);
            $allocated_hours_sum += $array_sum;
            $bar_color = "blue";
            if ($average_user_usage > 100) {
                $bar_color = "red";
                $average_user_usage = 100;
            }
            $table_rows .= "<td ><div align='left'>" . round($array_sum, 2) . " " . $AppUI->_("hours") . "</td> <td align='right'> " . $average_user_usage;
            $table_rows .= "%</div>";
            $table_rows .= "<div align='left' style='height:2px;width:{$average_user_usage}%; background-color:{$bar_color}'>&nbsp;</div></td>";
            $table_rows .= "</tr>";
        }
    }
    $total_hours_capacity = $working_days_count * dPgetConfig("daily_working_hours") * count($user_usage);
    $total_hours_capacity_all = $working_days_count * dPgetConfig("daily_working_hours") * count($user_list);
}
Example #30
-1
/**
 * Processes an HTML attribute value and ensures it does not contain an URL
 * with a disallowed protocol (e.g. javascript:)
 *
 * @param $string
 *   The string with the attribute value.
 * @param $decode
 *   Whether to decode entities in the $string. Set to FALSE if the $string
 *   is in plain text, TRUE otherwise. Defaults to TRUE.
 * @return
 *   Cleaned up and HTML-escaped version of $string.
 */
function filter_xss_bad_protocol($string, $decode = TRUE)
{
    static $allowed_protocols;
    if (!isset($allowed_protocols)) {
        $allowed_protocols = array_flip(dPgetConfig('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'tel', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'rtsp')));
    }
    // Get the plain text representation of the attribute value (i.e. its meaning).
    if ($decode) {
        $string = decode_entities($string);
    }
    // Iteratively remove any invalid protocol found.
    do {
        $before = $string;
        $colonpos = strpos($string, ':');
        if ($colonpos > 0) {
            // We found a colon, possibly a protocol. Verify.
            $protocol = substr($string, 0, $colonpos);
            // If a colon is preceded by a slash, question mark or hash, it cannot
            // possibly be part of the URL scheme. This must be a relative URL,
            // which inherits the (safe) protocol of the base document.
            if (preg_match('![/?#]!', $protocol)) {
                break;
            }
            // Per RFC2616, section 3.2.3 (URI Comparison) scheme comparison must be case-insensitive
            // Check if this is a disallowed protocol.
            if (!isset($allowed_protocols[strtolower($protocol)])) {
                $string = substr($string, $colonpos + 1);
            }
        }
    } while ($before != $string);
    return check_plain($string);
}