コード例 #1
0
 /**
  * The constructor
  *
  * Assigns the title, icon, module and help reference.  If the user does not
  * have permission to view the help module, then the context help icon is
  * not displayed.
  */
 public function __construct($title, $icon = '', $module = '', $helpref = '')
 {
     $this->title = $title;
     $this->icon = $icon;
     $this->module = $module;
     $this->helpref = $helpref;
     $this->cells1 = array();
     $this->cells2 = array();
     $this->crumbs = array();
     $this->showhelp = canView('help');
 }
コード例 #2
0
 /**
  * The constructor
  *
  * Assigns the title, icon, module and help reference.  If the user does not
  * have permission to view the help module, then the context help icon is
  * not displayed.
  */
 public function __construct($title, $icon = '', $module = '')
 {
     global $AppUI;
     $this->_AppUI = $AppUI;
     global $w2Pconfig;
     $this->_w2Pconfig = $w2Pconfig;
     $this->title = $title;
     $this->icon = $icon;
     $this->module = $module;
     $this->cells1 = array();
     $this->cells2 = array();
     $this->crumbs = array();
     $this->showhelp = canView('help');
     $this->count = 0;
 }
コード例 #3
0
No warranty whatsoever is given - use at your own risk. See index.php
 * 
*/
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $this_day, $prev_day, $next_day, $first_time, $last_time, $company_id, $event_filter, $event_filter_list, $AppUI;
// load the event types
$types = w2PgetSysVal('EventType');
$links = array();
$df = $AppUI->getPref('SHDATEFORMAT');
$perms =& $AppUI->acl();
$user_id = $AppUI->user_id;
$other_users = false;
$no_modify = false;
if (canView('admin')) {
    $other_users = true;
    if (($show_uid = w2PgetParam($_REQUEST, 'show_user_events', 0)) != 0) {
        $user_id = $show_uid;
        $no_modify = true;
        $AppUI->setState('event_user_id', $user_id);
    }
}
class CTask_ex extends CTask
{
    public function getAllTasksForPeriod($start_date, $end_date, $company_id = 0, $user_id = null)
    {
        global $AppUI;
        $q = new w2p_Database_Query();
        // convert to default db time stamp
        $db_start = $start_date->format(FMT_DATETIME_MYSQL);
コード例 #4
0
ファイル: events.php プロジェクト: rodoviario/ZoneMinder
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
if (!canView('Events') || !empty($_REQUEST['execute']) && !canEdit('Events')) {
    $view = "error";
    return;
}
if (!empty($_REQUEST['execute'])) {
    executeFilter($tempFilterName);
}
$countSql = 'SELECT count(E.Id) AS EventCount FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId) WHERE';
$eventsSql = 'SELECT E.Id,E.MonitorId,M.Name AS MonitorName,M.DefaultScale,E.Name,E.Width,E.Height,E.Cause,E.Notes,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived FROM Monitors AS M INNER JOIN Events AS E on (M.Id = E.MonitorId) WHERE';
if ($user['MonitorIds']) {
    $user_monitor_ids = ' M.Id in (' . $user['MonitorIds'] . ')';
    $countSql .= $user_monitor_ids;
    $eventsSql .= $user_monitor_ids;
} else {
    $countSql .= " 1";
    $eventsSql .= " 1";
コード例 #5
0
    $row['task_assigned_users'] = $q->loadList();
    $q->addQuery('count(task_id) as children');
    $q->addTable('tasks');
    $q->addWhere('task_parent = ' . (int) $row['task_id']);
    $q->addWhere('task_id <> task_parent');
    $row['children'] = $q->loadResult();
    $i = count($projects[$row['task_project']]['tasks']) + 1;
    $row['task_number'] = $i;
    $row['node_id'] = 'node_' . $i . '-' . $row['task_id'];
    if (strpos($row['task_duration'], '.') && $row['task_duration_type'] == 1) {
        $row['task_duration'] = floor($row['task_duration']) . ':' . round(60 * ($row['task_duration'] - floor($row['task_duration'])));
    }
    //pull the final task row into array
    $projects[$row['task_project']]['tasks'][] = $row;
}
$showEditCheckbox = isset($canEditTasks) && $canEditTasks || canView('admin');
$durnTypes = w2PgetSysVal('TaskDurationType');
$tempoTask = new CTask();
$userAlloc = $tempoTask->getAllocation('user_id');
$fieldList = array();
$fieldNames = array();
$module = new w2p_Core_Module();
$fields = $module->loadSettings('projectdesigner', 'task_list_print');
if (count($fields) > 0) {
    $fieldList = array_keys($fields);
    $fieldNames = array_values($fields);
} else {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('task_name', 'task_percent_complete', 'task_start_date', 'task_end_date', 'task_updated');
コード例 #6
0
ファイル: listtasks.php プロジェクト: eureka2/web2project
<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$perms =& $AppUI->acl();
if (!canView('tasks')) {
    $AppUI->redirect('m=public&a=access_denied');
}
$proj = (int) w2PgetParam($_GET, 'project', 0);
$userFilter = w2PgetParam($_GET, 'userFilter', false);
$q = new w2p_Database_Query();
$q->addQuery('t.task_id, t.task_name');
$q->addTable('tasks', 't');
if ($userFilter) {
    $q->addJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
    $q->addWhere('ut.user_id = ' . (int) $AppUI->user_id);
}
if ($proj != 0) {
    $q->addWhere('task_project = ' . (int) $proj);
}
$tasks = $q->loadList();
$q->clear();
?>

<script language="javascript" type="text/javascript">
function loadTasks() {
	var tasks = new Array();
	var sel = parent.document.forms['form'].new_task;
	while (sel.options.length) {
コード例 #7
0
            	</td>
            </tr>
           	<?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 = canView('files');
    if ($canViewFiles) {
        require w2PgetConfig('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" type="text/javascript">
コード例 #8
0
ファイル: console.php プロジェクト: ardiqghenatya/koptel2
     if (isset($_GET['pageOff' . $monitor['Id']])) {
         /* If pageOffset is greater than we actually have,
          * we need to adjust it */
         $pageOffset = validInteger($_GET['pageOff' . $monitor['Id']]);
         if ($pageOffset >= ceil($monitor['EventCount0'] / $numEvents)) {
             $pageOffset = 0;
         }
         $offset = $pageOffset * $numEvents;
     }
     $eventsSql .= " offset " . $offset;
 } else {
     unset($eventsSql);
 }
 xml_tag_val("PAGEOFF", $pageOffset);
 xml_tag_sec("EVENTS", 1);
 if (canView('Events') && isset($eventsSql)) {
     foreach (dbFetchAll(escapeSql($eventsSql)) as $event) {
         xml_tag_sec("EVENT", 1);
         xml_tag_val("ID", $event['Id']);
         xml_tag_val("NAME", $event['Name']);
         xml_tag_val("TIME", strftime(STRF_FMT_DATETIME_SHORTER, strtotime($event['StartTime'])));
         xml_tag_val("DURATION", $event['Length']);
         xml_tag_val("FRAMES", $event['Frames']);
         xml_tag_val("FPS", $event['Length'] > 0 ? ceil($event['Frames'] / $event['Length']) : 0);
         xml_tag_val("TOTSCORE", $event['TotScore']);
         xml_tag_val("AVGSCORE", $event['AvgScore']);
         xml_tag_val("MAXSCORE", $event['MaxScore']);
         /* Grab the max frame-id from Frames table. If AlarmFrames = 0, don't try
          * to grab any frames, and just signal the max frame index as index 0 */
         $fridx = 1;
         $alarmFrames = 1;
コード例 #9
0
function get_actual_end_date_pd($task_id, $task)
{
    global $AppUI;
    $q = new w2p_Database_Query();
    $mods = $AppUI->getActiveModules();
    if (!empty($mods['history']) && canView('history')) {
        $q->addQuery('MAX(history_date) as actual_end_date');
        $q->addTable('history');
        $q->addWhere('history_table=\'tasks\' AND history_item=' . $task_id);
    } else {
        $q->addQuery('MAX(task_log_date) AS actual_end_date');
        $q->addTable('task_log');
        $q->addWhere('task_log_task = ' . (int) $task_id);
    }
    $task_log_end_date = $q->loadResult();
    $edate = $task_log_end_date;
    $edate = $edate > $task->task_end_date || $task->task_percent_complete == 100 ? $edate : $task->task_end_date;
    return $edate;
}
コード例 #10
0
ファイル: actions.php プロジェクト: schrorg/ZoneMinder
                 dbQuery("insert into Devices set Name=?, KeyString=?", array($_REQUEST['newDevice']['Name'], $_REQUEST['newDevice']['KeyString']));
             }
             $refreshParent = true;
             $view = 'none';
         }
     } elseif ($action == "delete") {
         if (isset($_REQUEST['markDids'])) {
             foreach ($_REQUEST['markDids'] as $markDid) {
                 dbQuery("delete from Devices where Id=?", array($markDid));
                 $refreshParent = true;
             }
         }
     }
 }
 // Group view actions
 if (canView('Groups') && $action == "setgroup") {
     if (!empty($_REQUEST['gid'])) {
         setcookie("zmGroup", validInt($_REQUEST['gid']), time() + 3600 * 24 * 30 * 12 * 10);
     } else {
         setcookie("zmGroup", "", time() - 3600 * 24 * 2);
     }
     $refreshParent = true;
 }
 // Group edit actions
 if (canEdit('Groups')) {
     if ($action == "group") {
         # Should probably verfy that each monitor id is a valid monitor, that we have access to. HOwever at the moment, you have to have System permissions to do this
         $monitors = empty($_POST['newGroup']['MonitorIds']) ? NULL : implode(',', $_POST['newGroup']['MonitorIds']);
         if (!empty($_POST['gid'])) {
             dbQuery("UPDATE Groups SET Name=?, MonitorIds=? WHERE Id=?", array($_POST['newGroup']['Name'], $monitors, $_POST['gid']));
         } else {
コード例 #11
0
ファイル: cycle.php プロジェクト: moeiscool/ZoneMinder-video
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
if (!canView('Stream')) {
    $view = "error";
    return;
}
if (empty($_REQUEST['mode'])) {
    if (canStream()) {
        $mode = "stream";
    } else {
        $mode = "still";
    }
} else {
    $mode = validHtmlStr($_REQUEST['mode']);
}
$group = '';
$groupSql = '';
if (!empty($_REQUEST['group'])) {
コード例 #12
0
ファイル: view.php プロジェクト: eureka2/web2project
    $AppUI->setMsg('Event');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    $AppUI->savePlace();
}
//check if the user has view permission over the project
if ($event->event_project && !$perms->checkModuleItem('projects', 'view', $event->event_project)) {
    $AppUI->redirect('m=public&a=access_denied');
}
// load the event types
$types = w2PgetSysVal('EventType');
// load the event recurs types
$recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Every Month', 'Quarterly', 'Every 6 months', 'Every Year');
$assigned = $event->getAssigned();
if ($event->event_owner != $AppUI->user_id && !canView('admin')) {
    $canEdit = false;
}
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$start_date = $event->event_start_date ? new w2p_Utilities_Date($event->event_start_date) : new w2p_Utilities_Date();
$end_date = $event->event_end_date ? new w2p_Utilities_Date($event->event_end_date) : new w2p_Utilities_Date();
if ($event->event_project) {
    $project = new CProject();
    $event_project = $project->load($event->event_project)->project_name;
}
// setup the title block
$titleBlock = new CTitleBlock('View Event', 'myevo-appointments.png', $m, $m . '.' . $a);
if ($canEdit) {
    $titleBlock->addCell();
    $titleBlock->addCell('
コード例 #13
0
<?php

/* $Id: projectdesigner_crumb.index.reports.php 1522 2010-12-08 05:08:07Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/reports/projectdesigner_crumb.index.reports.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $titleBlock, $project_id;
$canView = canView('reports');
if ($canView) {
    $titleBlock->addCrumb('?m=reports&project_id=' . $project_id, 'reports');
}
コード例 #14
0
<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $task_id, $sf, $df, $canEdit, $m;
$perms =& $AppUI->acl();
if (!canView('task_log')) {
    $AppUI->redirect('m=public&a=access_denied');
}
$problem = (int) w2PgetParam($_GET, 'problem', null);
?>
<script language="javascript" type="text/javascript">
<?php 
// security improvement:
// some javascript functions may not appear on client side in case of user not having write permissions
// else users would be able to arbitrarily run 'bad' functions
$canDelete = canDelete('task_log');
if ($canDelete) {
    ?>
function delIt2(id) {
	if (confirm( '<?php 
    echo $AppUI->_('doDelete', UI_OUTPUT_JS) . ' ' . $AppUI->_('Task Log', UI_OUTPUT_JS) . '?';
    ?>
' )) {
		document.frmDelete2.task_log_id.value = id;
		document.frmDelete2.submit();
	}
}
<?php 
コード例 #15
0
function exportEvents($eids, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc, $exportFormat)
{
    if (canView('Events') && !empty($eids)) {
        $export_root = "zmExport";
        $export_listFile = "zmFileList.txt";
        $exportFileList = array();
        $html_eventMaster = '';
        if (is_array($eids)) {
            foreach ($eids as $eid) {
                $exportFileList = array_merge($exportFileList, exportFileList($eid, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc));
            }
        } else {
            $eid = $eids;
            $exportFileList = exportFileList($eid, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc);
        }
        // create an master image slider
        if ($exportImages) {
            if (!is_array($eids)) {
                $eids = array($eids);
            }
            $monitorPath = 'events/';
            $html_eventMaster = 'zmEventImagesMaster_' . date('Ymd_His') . '.html';
            if (!($fp = fopen($monitorPath . "/" . $html_eventMaster, "w"))) {
                Fatal("Can't open event images export file '{$html_eventMaster}'");
            }
            fwrite($fp, exportEventImagesMaster($eids));
            fclose($fp);
            $exportFileList[] = $monitorPath . "/" . $html_eventMaster;
        }
        $listFile = "temp/" . $export_listFile;
        if (!($fp = fopen($listFile, "w"))) {
            Fatal("Can't open event export list file '{$listFile}'");
        }
        foreach ($exportFileList as $exportFile) {
            fwrite($fp, "{$exportFile}\n");
        }
        fclose($fp);
        $archive = "";
        if ($exportFormat == "tar") {
            $archive = "temp/" . $export_root . ".tar.gz";
            @unlink($archive);
            $command = "tar --create --gzip --file={$archive} --files-from={$listFile}";
            exec(escapeshellcmd($command), $output, $status);
            if ($status) {
                Error("Command '{$command}' returned with status {$status}");
                if ($output[0]) {
                    Error("First line of output is '" . $output[0] . "'");
                }
                return false;
            }
        } elseif ($exportFormat == "zip") {
            $archive = "temp/zm_export.zip";
            $archive = "temp/" . $export_root . ".zip";
            @unlink($archive);
            $command = "cat " . escapeshellarg($listFile) . " | zip -q " . escapeshellarg($archive) . " -@";
            //cat zmFileList.txt | zip -q zm_export.zip -@
            //-bash: zip: command not found
            exec($command, $output, $status);
            if ($status) {
                Error("Command '{$command}' returned with status {$status}");
                if ($output[0]) {
                    Error("First line of output is '" . $output[0] . "'");
                }
                return false;
            }
        }
        //clean up temporary files
        if (!empty($html_eventMaster)) {
            unlink($monitorPath . '/' . $html_eventMaster);
        }
    }
    return $archive;
}
コード例 #16
0
ファイル: log.php プロジェクト: rodoviario/ZoneMinder
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
if (!canView('System')) {
    $view = "error";
    return;
}
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('SystemLog'));
?>
<body>
  <div id="page">
    <div id="header">
      <div id="headerButtons">
          <input type="button" value="<?php 
echo translate('More');
?>
" onclick="expandLog()"/>
          <input type="button" value="<?php 
コード例 #17
0
    public static function getForums(CAppUI $AppUI = null, $projectId)
    {
        global $AppUI;
        if ($AppUI->isActiveModule('forums') && canView('forums')) {
            $q = new w2p_Database_Query();
            $q->addTable('forums');
            $q->addQuery('forum_id, forum_project, forum_description, forum_owner, forum_name, forum_message_count,
				DATE_FORMAT(forum_last_date, "%d-%b-%Y %H:%i" ) forum_last_date,
				project_name, project_color_identifier, project_id');
            $q->addJoin('projects', 'p', 'project_id = forum_project', 'inner');
            $q->addWhere('forum_project = ' . (int) $projectId);
            $q->addOrder('forum_project, forum_name');
            return $q->loadHashList('forum_id');
        }
    }
コード例 #18
0
ファイル: actions.php プロジェクト: ralfoide/ZoneMinder
                 }
             }
         } elseif ($action == "delete") {
             foreach (getAffectedIds('markEid') as $markEid) {
                 deleteEvent($markEid);
                 $refreshParent = true;
             }
             if (!empty($_REQUEST['fid'])) {
                 dbQuery('DELETE FROM Filters WHERE Name=?', array($_REQUEST['fid']));
                 //$refreshParent = true;
             }
         }
     }
 }
 // Monitor control actions, require a monitor id and control view permissions for that monitor
 if (!empty($_REQUEST['mid']) && canView('Control', $_REQUEST['mid'])) {
     require_once 'control_functions.php';
     $mid = validInt($_REQUEST['mid']);
     if ($action == "control") {
         $monitor = dbFetchOne("select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id) where M.Id = ?", NULL, array($mid));
         $ctrlCommand = buildControlCommand($monitor);
         sendControlCommand($monitor['Id'], $ctrlCommand);
     } elseif ($action == "settings") {
         $args = " -m " . escapeshellarg($mid);
         $args .= " -B" . escapeshellarg($_REQUEST['newBrightness']);
         $args .= " -C" . escapeshellarg($_REQUEST['newContrast']);
         $args .= " -H" . escapeshellarg($_REQUEST['newHue']);
         $args .= " -O" . escapeshellarg($_REQUEST['newColour']);
         $zmuCommand = getZmuCommand($args);
         $zmuOutput = exec($zmuCommand);
         list($brightness, $contrast, $hue, $colour) = explode(' ', $zmuOutput);
コード例 #19
0
ファイル: index.php プロジェクト: illuminate3/web2project
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$tab = $AppUI->processIntState('UserIdxTab', $_GET, 'tab', 0);
$perms =& $AppUI->acl();
if (!canView('users')) {
    $AppUI->redirect(ACCESS_DENIED);
}
if (isset($_GET['stub'])) {
    $AppUI->setState('UserIdxStub', w2PgetParam($_GET, 'stub', null));
    $AppUI->setState('UserIdxWhere', '');
} elseif (isset($_POST['search_string'])) {
    $AppUI->setState('UserIdxWhere', $_POST['search_string']);
    $AppUI->setState('UserIdxStub', '');
}
$stub = $AppUI->getState('UserIdxStub');
$where = $AppUI->getState('UserIdxWhere');
$where = w2PformSafe($where, true);
if (isset($_GET['orderby'])) {
    $AppUI->setState('UserIdxOrderby', w2PgetParam($_GET, 'orderby', null));
}
$orderby = $AppUI->getState('UserIdxOrderby') ? $AppUI->getState('UserIdxOrderby') : 'user_username';
$orderby = $tab == 3 || $orderby != 'date_time_in' && $orderby != 'user_ip' ? $orderby : 'user_username';
// Pull First Letters
$letters = CUser::getFirstLetters();
$letters = $letters . CContact::getFirstLetters($AppUI->user_id, true);
$a2z = '<a href="./index.php?m=users&stub=0">' . $AppUI->_('All') . '</a>&nbsp;&nbsp;&nbsp;&nbsp;';
for ($c = 65; $c < 91; $c++) {
    $cu = chr($c);
コード例 #20
0
<?php

/* $Id: do_watch_forum.php 1595 2011-01-17 07:37:10Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/forums/do_watch_forum.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$perms =& $AppUI->acl();
if (!canView('forums')) {
    $AppUI->redirect('m=public&a=access_denied');
}
##
## Change forum watches
##
$watch = w2PgetParam($_POST, 'watch', '');
if ($watch) {
    // clear existing watches
    $q = new w2p_Database_Query();
    $q->setDelete('forum_watch');
    $q->addWhere('watch_user = '******'watch_' . $watch . ' IS NOT NULL');
    if (!$q->exec()) {
        $AppUI->setMsg(db_error(), UI_MSG_ERROR);
        $q->clear();
    } else {
        $q->clear();
        foreach ($_POST as $k => $v) {
            if (strpos($k, 'forum_') !== false) {
                $q->addTable('forum_watch');
                $q->addInsert('watch_user', $AppUI->user_id);
                $q->addInsert('watch_' . $watch, substr($k, 6));
                if (!$q->exec()) {
コード例 #21
0
ファイル: api.php プロジェクト: bill-mcgonigle/ZoneMinder
         $monitor = $monitors[$i];
         $monitor_str = "";
         $monitor_str .= make_tag("id", $monitor['Id']);
         $monitor_str .= make_tag("name", $monitor['Name']);
         $monitor_str .= make_tag("method", $monitor['Function']);
         $monitor_str .= make_tag("enabled", $monitor['Enabled']);
         $monitor_str .= make_tag("width", $monitor['Width']);
         $monitor_str .= make_tag("height", $monitor['Height']);
         print make_tag("monitor", $monitor_str);
     }
 } else {
     if ($_REQUEST['action'] == "get_connkey") {
         print make_tag("connkey", generateConnKey());
     } else {
         if ($_REQUEST['action'] == "event_stats") {
             if (!canView("Events")) {
                 ajaxError('Unrecognised action or insufficient permissions');
             }
             $eid = validInt($_REQUEST['eid']);
             $stats = dbFetchAll("select S.*,E.*,Z.Name as ZoneName,Z.Units,Z.Area,M.Name as MonitorName,M.Width,M.Height from Stats as S left join Events as E on S.EventId = E.Id left join Zones as Z on S.ZoneId = Z.Id left join Monitors as M on E.MonitorId = M.Id where S.EventId = '" . $eid . "' order by S.FrameId, S.ZoneId");
             for ($i = 0; $i < count($stats); $i++) {
                 $stat = $stats[$i];
                 $stat_str = "";
                 $stat_str .= make_tag("FrameId", $stat["FrameId"]);
                 $stat_str .= make_tag("PixelDiff", $stat["PixelDiff"]);
                 $stat_str .= make_tag("AlarmPixels", $stat["AlarmPixels"]);
                 $stat_str .= make_tag("FilterPixels", $stat["FilterPixels"]);
                 $stat_str .= make_tag("BlobPixels", $stat["BlobPixels"]);
                 $stat_str .= make_tag("Blobs", $stat["Blobs"]);
                 $stat_str .= make_tag("ZoneName", $stat["ZoneName"]);
                 $stat_str .= make_tag("Score", $stat["Score"]);
コード例 #22
0
ファイル: status.php プロジェクト: bill-mcgonigle/ZoneMinder
function collectData()
{
    global $statusData;
    if (isset($_REQUEST['MainFrameID']) && $_REQUEST['MainFrameID'] == "1") {
        $statusData["event"]["elements"]["MainFrameID"] = array("sql" => "(select FrameID from Frames where EventId=Events.id order by Score desc,FrameId limit 1)");
        $statusData["events"]["elements"]["MainFrameID"] = array("sql" => "(select FrameID from Frames where EventId=Events.id order by Score desc,FrameId limit 1)");
    }
    $entitySpec =& $statusData[strtolower(validJsStr($_REQUEST['entity']))];
    #print_r( $entitySpec );
    if (!canView($entitySpec['permission'])) {
        ajaxError('Unrecognised action or insufficient permissions');
    }
    if (!empty($entitySpec['func'])) {
        $data = eval("return( " . $entitySpec['func'] . " );");
    } else {
        $data = array();
        $postFuncs = array();
        $fieldSql = array();
        $joinSql = array();
        $groupSql = array();
        $elements =& $entitySpec['elements'];
        $lc_elements = array_change_key_case($elements);
        $id = false;
        if (isset($_REQUEST['id'])) {
            if (!is_array($_REQUEST['id'])) {
                $id = array(validJsStr($_REQUEST['id']));
            } else {
                $id = array_values($_REQUEST['id']);
            }
        }
        if (!isset($_REQUEST['element'])) {
            $_REQUEST['element'] = array_keys($elements);
        } else {
            if (!is_array($_REQUEST['element'])) {
                $_REQUEST['element'] = array(validJsStr($_REQUEST['element']));
            }
        }
        if (isset($entitySpec['selector'])) {
            if (!is_array($entitySpec['selector'])) {
                $entitySpec['selector'] = array($entitySpec['selector']);
            }
            foreach ($entitySpec['selector'] as $selector) {
                if (is_array($selector) && isset($selector['table']) && isset($selector['join'])) {
                    $joinSql[] = "left join " . $selector['table'] . " on " . $selector['join'];
                }
            }
        }
        foreach ($_REQUEST['element'] as $element) {
            if (!($elementData = $lc_elements[strtolower($element)])) {
                ajaxError("Bad " . validJsStr($_REQUEST['entity']) . " element " . $element);
            }
            if (isset($elementData['func'])) {
                $data[$element] = eval("return( " . $elementData['func'] . " );");
            } else {
                if (isset($elementData['postFunc'])) {
                    $postFuncs[$element] = $elementData['postFunc'];
                } else {
                    if (isset($elementData['zmu'])) {
                        $data[$element] = exec(escapeshellcmd(getZmuCommand(" " . $elementData['zmu'])));
                    } else {
                        if (isset($elementData['sql'])) {
                            $fieldSql[] = $elementData['sql'] . " as " . $element;
                        } else {
                            $fieldSql[] = $element;
                        }
                        if (isset($elementData['table']) && isset($elementData['join'])) {
                            $joinSql[] = "left join " . $elementData['table'] . " on " . $elementData['join'];
                        }
                        if (isset($elementData['group'])) {
                            $groupSql[] = $elementData['group'];
                        }
                    }
                }
            }
        }
        if (count($fieldSql)) {
            $sql = "select " . join(", ", $fieldSql) . " from " . $entitySpec['table'];
            if ($joinSql) {
                $sql .= " " . join(" ", array_unique($joinSql));
            }
            if ($id && !empty($entitySpec['selector'])) {
                $index = 0;
                $where = array();
                $values = array();
                foreach ($entitySpec['selector'] as $selector) {
                    if (is_array($selector)) {
                        $where[] = $selector['selector'] . ' = ?';
                        $values[] = validInt($id[$index]);
                    } else {
                        $where[] = $selector . ' = ?';
                        $values[] = validInt($id[$index]);
                    }
                    $index++;
                }
                $sql .= " where " . join(" and ", $where);
            }
            if ($groupSql) {
                $sql .= " group by " . join(",", array_unique($groupSql));
            }
            if (!empty($_REQUEST['sort'])) {
                $arr = explode(' ', $_REQUEST['sort']);
                $col = validCol($arr[0]);
                $dir = "";
                if (count($arr) == 2) {
                    if ($arr[1] == "desc") {
                        $dir = $arr[1];
                    }
                }
                $sql .= " order by {$col} {$dir}";
            }
            if (!empty($entitySpec['limit'])) {
                $limit = $entitySpec['limit'];
            } elseif (!empty($_REQUEST['count'])) {
                $limit = validInt($_REQUEST['count']);
            }
            $limit_offset = "";
            if (!empty($_REQUEST['offset'])) {
                $limit_offset = validInt($_REQUEST['offset']) . ", ";
            }
            if (!empty($limit)) {
                $sql .= " limit " . $limit_offset . $limit;
            }
            if (isset($limit) && $limit == 1) {
                if ($sqlData = dbFetchOne($sql, NULL, $values)) {
                    foreach ($postFuncs as $element => $func) {
                        $sqlData[$element] = eval('return( ' . $func . '( $sqlData ) );');
                    }
                    $data = array_merge($data, $sqlData);
                }
            } else {
                $count = 0;
                foreach (dbFetchAll($sql, NULL, $values) as $sqlData) {
                    foreach ($postFuncs as $element => $func) {
                        $sqlData[$element] = eval('return( ' . $func . '( $sqlData ) );');
                    }
                    $data[] = $sqlData;
                    if (isset($limi) && ++$count >= $limit) {
                        break;
                    }
                }
            }
        }
    }
    #print_r( $data );
    return $data;
}
コード例 #23
0
ファイル: tasks.class.php プロジェクト: eureka2/web2project
 public function getContacts(CAppUI $AppUI = null, $task_id)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     if (canView('contacts')) {
         $q = new w2p_Database_Query();
         $q->addTable('contacts', 'c');
         $q->addQuery('c.contact_id, contact_first_name, contact_last_name');
         $q->leftJoin('departments', 'd', 'dept_id = contact_department');
         $q->addQuery('dept_name');
         $q->addJoin('task_contacts', 'tc', 'tc.contact_id = c.contact_id', 'inner');
         $q->addWhere('tc.task_id = ' . (int) $task_id);
         $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_order_by, contact_email');
         $q->addWhere('(contact_owner = ' . (int) $AppUI->user_id . ' OR contact_private = 0)');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadHashList('contact_id');
     }
 }
コード例 #24
0
ファイル: viewmods.php プロジェクト: eureka2/web2project
<?php

/* $Id: viewmods.php 1504 2010-12-01 07:07:21Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/system/viewmods.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// check permissions
$perms =& $AppUI->acl();
$canEdit = canEdit('system');
$canRead = canView('system');
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
$hidden_modules = array('public', 'install');
$q = new w2p_Database_Query();
$q->addQuery('*');
$q->addTable('modules');
foreach ($hidden_modules as $no_show) {
    $q->addWhere('mod_directory <> \'' . $no_show . '\'');
}
$q->addOrder('mod_ui_order');
$modules = $q->loadList();
// get the modules actually installed on the file system
$modFiles = $AppUI->readDirs('modules');
$titleBlock = new CTitleBlock('Modules', 'power-management.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb('?m=system', 'System Admin');
$titleBlock->show();
?>

<table border="0" cellpadding="2" cellspacing="1" width="100%" class="tbl">
コード例 #25
0
ファイル: index.php プロジェクト: viniciusbudines/sisnuss
<?php

/* $Id: index.php 1835 2011-04-30 21:39:23Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/system/index.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$perms =& $AppUI->acl();
if (!canView('system')) {
    // let's see if the user has sys access
    $AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
$titleBlock = new CTitleBlock('System Administration', '48_my_computer.png', $m, $m . '.' . $a);
$titleBlock->show();
?>
<table class="std" width="100%" border="0" cellpadding="0" cellspacing="5">
  <tr>
    <td width="42">
      <?php 
echo w2PshowImage('control-center.png', 42, 42, '');
?>
    </td>
    <td align="left" class="subtitle">
      <?php 
echo $AppUI->_('System Status');
?>
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="left">
コード例 #26
0
ファイル: view.php プロジェクト: eureka2/web2project
?>
</strong>
			<table cellspacing="0" cellpadding="2" border="0" width="100%">
				<tr>
					<td class="hilite">
            <?php 
echo w2p_textarea($company->company_description);
?>
					</td>
				</tr>		
			</table>
			<?php 
$custom_fields = new w2p_Core_CustomFields($m, $a, $company->company_id, 'view');
$custom_fields->printHTML();
?>
		</td>
	</tr>
</table>

<?php 
// tabbed information boxes
$moddir = W2P_BASE_DIR . '/modules/companies/';
$tabBox = new CTabBox('?m=companies&a=view&company_id=' . $company_id, '', $tab);
$tabBox->add($moddir . 'vw_active', 'Active Projects');
$tabBox->add($moddir . 'vw_archived', 'Archived Projects');
if ($AppUI->isActiveModule('departments') && canView('departments')) {
    $tabBox->add($moddir . 'vw_depts', 'Departments');
}
$tabBox->add($moddir . 'vw_users', 'Users');
$tabBox->add($moddir . 'vw_contacts', 'Contacts');
$tabBox->show();
コード例 #27
0
ファイル: tasks.php プロジェクト: eureka2/web2project
?>
</th>
		<th nowrap="nowrap"><?php 
sort_by_item_title('Start Date', 'task_start_date', SORT_NUMERIC);
?>
</th>
		<th nowrap="nowrap"><?php 
sort_by_item_title('Duration', 'task_duration', SORT_NUMERIC);
?>
&nbsp;&nbsp;</th>
		<th nowrap="nowrap"><?php 
sort_by_item_title('Finish Date', 'task_end_date', SORT_NUMERIC);
?>
</th>
		<?php 
if (!empty($mods['history']) && canView('history')) {
    ?>
<th nowrap="nowrap"><?php 
    sort_by_item_title('Last Update', 'last_update', SORT_NUMERIC);
    ?>
</th><?php 
} else {
    $cols--;
}
if ($showEditCheckbox) {
    echo '<th width="1">&nbsp;</th>';
} else {
    $cols--;
}
?>
	</tr>
コード例 #28
0
ファイル: frame.php プロジェクト: rodoviario/ZoneMinder
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
if (!canView('Events')) {
    $view = "error";
    return;
}
$eid = validInt($_REQUEST['eid']);
if (!empty($_REQUEST['fid'])) {
    $fid = validInt($_REQUEST['fid']);
}
$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?';
$event = dbFetchOne($sql, NULL, array($eid));
if (!empty($fid)) {
    $sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?';
    if (!($frame = dbFetchOne($sql, NULL, array($eid, $fid)))) {
        $frame = array('FrameId' => $fid, 'Type' => 'Normal', 'Score' => 0);
    }
} else {
コード例 #29
0
ファイル: index.php プロジェクト: viniciusbudines/sisnuss
<?php

/* $Id: index.php 1771 2011-03-26 20:51:31Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/calendar/index.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// check permissions for this record
$perms =& $AppUI->acl();
$canRead = canView($m);
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
w2PsetMicroTime();
// retrieve any state parameters
if (isset($_REQUEST['company_id'])) {
    $AppUI->setState('CalIdxCompany', intval(w2PgetParam($_REQUEST, 'company_id', 0)));
}
$company_id = $AppUI->getState('CalIdxCompany', 0);
// Using simplified set/get semantics. Doesn't need as much code in the module.
$event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', 'my'), 'EVENTFILTER', 'my');
// get the passed timestamp (today if none)
$ctoday = new w2p_Utilities_Date();
$today = $ctoday->format(FMT_TIMESTAMP_DATE);
$date = w2PgetParam($_GET, 'date', $today);
// get the list of visible companies
$company = new CCompany();
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
// setup the title block
$titleBlock = new CTitleBlock('Monthly Calendar', 'myevo-appointments.png', $m, $m . '.' . $a);
コード例 #30
0
/* $Id: printproject.php 1825 2011-04-27 03:35:42Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/projectdesigner/printproject.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$project_id = (int) w2PgetParam($_GET, 'project_id', 0);
// check permissions for this module
$perms =& $AppUI->acl();
$canRead = $perms->checkModuleItem('projects', 'view', $project_id);
$canAddProject = $canRead;
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$task = new CTask();
$tasks = $task->getAllowedRecords($AppUI->user_id, 'task_id,task_name', 'task_name', null, $extra);
$tasks = arrayMerge(array('0' => $AppUI->_('(None)', UI_OUTPUT_RAW)), $tasks);
$canViewTasks = canView('tasks');
$canAddTasks = canAdd('tasks');
$canEditTasks = canEdit('tasks');
$canDeleteTasks = canDelete('tasks');
// get ProjectPriority from sysvals
$projectPriority = w2PgetSysVal('ProjectPriority');
$projectPriorityColor = w2PgetSysVal('ProjectPriorityColor');
$pstatus = w2PgetSysVal('ProjectStatus');
$ptype = w2PgetSysVal('ProjectType');
$priorities = w2Pgetsysval('TaskPriority');
$types = w2Pgetsysval('TaskType');
$project = new CProject();
// load the record data
$project->loadFull($AppUI, $project_id);
$obj = $project;
if (!$project) {