示例#1
0
            addValue('time_end', $time_end);
            addValueArray('room_id', splittIDs($a_room));
            addValue('time_start', $time_end - $time_end_after_start);
        }
    }
    if (isset($_GET['time_start']) && is_numeric($_GET['time_start'])) {
        addValue('time_start', (int) $_GET['time_start']);
    }
    if (isset($_GET['time_end']) && is_numeric($_GET['time_end'])) {
        addValue('time_end', (int) $_GET['time_end']);
    }
    if (isset($_GET['user_assigned'])) {
        if (is_array($_GET['user_assigned'])) {
            addValueArray('user_assigned', $_GET['user_assigned']);
        } else {
            addValueArray('user_assigned', splittIDs($_GET['user_assigned']));
        }
    }
    if (isset($_GET['room']) && is_numeric($_GET['room'])) {
        // Single room
        addValueArray('room_id', array((int) $_GET['room'] => (int) $_GET['room']));
    }
}
/*
if($entry_add)
	addField ('submit',	'submit',	_('Add/Save entry'));
else
	addField ('submit',	'submit',	_('Save entry'));
*/
// Redirect
$view = 'entry';
示例#2
0
 function getDB()
 {
     if (!empty($this->id)) {
         if (is_array($this->id)) {
             // Composite PK
             $where = array();
             foreach ($this->db_field_id as $pk) {
                 $where[$pk] = '`' . $pk . '` = \'' . $this->id[$pk] . '\'';
             }
             $QUERY = mysql_query("\n\t\t\t\t\tSELECT * \n\t\t\t\t\tFROM\n\t\t\t\t\t\t`" . $this->db_table . "`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t" . implode(' AND ', $where));
         } else {
             $QUERY = mysql_query("\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`" . $this->db_table . "`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`" . $this->db_field_id . "` = '" . $this->id . "'");
         }
         if (mysql_num_rows($QUERY)) {
             foreach ($this->vars as $var) {
                 if (!$var['noDB']) {
                     if ($var['type'] == 'checkbox') {
                         $this->vars[$var['var']]['value_array'] = splittIDs(mysql_result($QUERY, 0, $var['var']));
                     } else {
                         $this->vars[$var['var']]['value'] = mysql_result($QUERY, 0, $var['var']);
                     }
                 }
             }
         } else {
             echo mysql_error();
             return false;
         }
         return TRUE;
     } else {
         return TRUE;
     }
 }
示例#3
0
    mysql_query("INSERT INTO `groups` ( `group_id` , `user_ids` , `group_name` ) VALUES ('', '', '" . $add . "');");
    header("Location: admin_group.php");
    exit;
} else {
    include "include/admin_middel.php";
    echo '<h1>' . __('Usergroups') . '</h1>';
    // Add
    echo '<form action="admin_group.php" method="post">' . chr(10);
    echo '<b>' . __('Add group') . '</b><br>' . chr(10);
    if ($login['user_access_useredit']) {
        echo '<input type="text" name="add"><br>' . chr(10);
        echo '<input type="submit" value="' . __('Add') . '">' . chr(10);
    } else {
        echo __('You are not allowed to do this.');
    }
    echo '<br><br>' . chr(10);
    // List of groups
    echo '<b>' . __('List of usergroups') . '</b><br>' . chr(10);
    $Q_groups = mysql_query("select * from `groups` order by 'group_name'");
    if (!mysql_num_rows($Q_groups)) {
        echo __('No groups found.');
    } else {
        while ($R_group = mysql_fetch_assoc($Q_groups)) {
            echo '- <a href="admin_group.php?gid=' . $R_group['group_id'] . '">' . $R_group['group_name'] . '</a> (' . count(splittIDs($R_group['user_ids'])) . ' ' . __('users') . ')<br>' . chr(10);
        }
    }
}
echo '</td>
</tr>
</table>
</HTML>';
示例#4
0
                $error_msg = $invoice->error();
                $error = $invoice->inndata_error;
                // array
            }
        } else {
            // Redirect
            header('Location: invoice_view.php?invoice_id=' . $invoice->invoice_id);
            exit;
        }
    }
} else {
    // Clean data
    $invoice = new invoice();
    // Entry sent?
    if (isset($_GET['entry_ids'])) {
        $entries1 = splittIDs($_GET['entry_ids']);
        if (count($entries1)) {
            $get_this_from_entry = array('customer_id' => 'invoice_to_customer_id', 'invoice_address_id' => 'invoice_to_address_id', 'invoice_electronic' => 'invoice_electronic', 'invoice_email' => 'invoice_to_email');
            $to_invoice = array();
            $entries = array();
            $failed_in = array();
            foreach ($entries1 as $entry_id) {
                $entry_id = (int) $entry_id;
                $entries[$entry_id] = getEntry($entry_id);
                if (!count($entries[$entry_id])) {
                    echo '<b>' . _('Error:') . '</b>' . _('Can\'t find the entry/one of the entries you tried to make an invoice from.');
                    exit;
                }
                $invoice->invoice_idlinks[] = 'e=' . $entry_id;
                // Setting the info found in the entry
                foreach ($get_this_from_entry as $entry_var => $invoice_var) {
     $changed[] = 'time_hour';
     $changed[] = 'time_min';
 }
 if (in_array('customer_id', $changed)) {
     $changed[] = 'customer_name';
 }
 if (in_array('customer_municipal_num', $changed)) {
     $changed[] = 'customer_municipal';
 }
 // Adding the one who changed something...
 $changed[] = 'time_last_edit';
 $time_last_edit = time();
 $edit_by = $entry['edit_by'];
 $edit_by[] = $login['user_id'];
 $changed[] = 'edit_by';
 $edit_by = splittalize(splittIDs(splittalize($edit_by)));
 // the extra functions = remove duplicates
 $rev_num = $entry['rev_num'] + 1;
 $changed[] = 'rev_num';
 $user_last_edit = $login['user_id'];
 $changed[] = 'user_last_edit';
 $i = 0;
 $SQL = "UPDATE `entry` SET ";
 foreach ($changed as $change) {
     $i++;
     if ($change == 'user_assigned' || $change == 'room_id') {
         $SQL .= "`{$change}` = '" . splittalize(${$change}) . "'";
     } elseif ($change == 'invoice_content') {
         $SQL .= "`{$change}` = '" . addslashes(serialize(${$change})) . "'";
     } else {
         $SQL .= "`{$change}` = '" . ${$change} . "'";
示例#6
0
function checkTime_User($start, $end, $user = 0)
{
    /*
    	returns:
    	$array[userid][entryid] = entryid;
    */
    if (is_array($user)) {
        $user_query = " and (";
        $i = 0;
        foreach ($user as $uid) {
            if ($uid == '0' && count($user) == 1) {
                return array();
            }
            $i++;
            $user_query .= "user_assigned like '%;{$uid};%'";
            if ($i < count($user)) {
                $user_query .= " || ";
            }
        }
        $user_query .= ")";
    } elseif ($user != 0) {
        $user_query = " and (user_assigned like '%;{$user};%')";
    } else {
        return array();
    }
    $Q_checktime = mysql_query("select entry_id, user_assigned from `entry` where \n\t\t(\n\t\t\t(time_start <= '{$start}' and time_end > '{$start}') or \n\t\t\t(time_start < '{$end}' and time_end >= '{$end}') or\n\t\t\t(time_start > '{$start}' and time_end < '{$end}')\n\t\t)\n\t\t{$user_query}");
    $return = array();
    if (!mysql_num_rows($Q_checktime)) {
        return $return;
    } else {
        while ($R_entry = mysql_fetch_assoc($Q_checktime)) {
            if (is_array($user)) {
                $R_entry['user_assigned'] = splittIDs($R_entry['user_assigned']);
                foreach ($user as $uid) {
                    if (in_array($uid, $R_entry['user_assigned'])) {
                        $return[$uid][$R_entry['entry_id']] = $R_entry['entry_id'];
                    }
                }
            } else {
                $return[$user][$R_entry['entry_id']] = $R_entry['entry_id'];
            }
        }
    }
    return $return;
}
示例#7
0
 	// TODO: Implement
 	$editor->makeNewField('user_areas', 'Tilgang til', 'checkbox', array('defaultValue' => -1));
 	$Q_area = mysql_query("select id as area_id, area_name from `mrbs_area` order by `area_name`");
 	$editor->addChoice('user_areas', -1, _('All areas'));
 	while($R_area = mysql_fetch_assoc($Q_area))
 		$editor->addChoice('user_areas', $R_area['area_id'], $R_area['area_name']);
 	*/
 $editor->getDB();
 if (isset($_POST['editor_submit'])) {
     if ($editor->input($_POST)) {
         if ($editor->performDBquery()) {
             // Edit of groups
             $Q_groups = mysql_query("select * from `groups` order by group_name");
             $first = true;
             while ($R_group = mysql_fetch_assoc($Q_groups)) {
                 $gusers = splittIDs($R_group['user_ids']);
                 // Users in group
                 if ($editor->vars['group_' . $R_group['group_id']]['value'] && !in_array($id, $gusers)) {
                     // Update
                     $gusers_new = $R_group['user_ids'] . ';' . $id . ';';
                     mysql_query("UPDATE `groups` SET `user_ids` = '" . $gusers_new . "' \n\t\t\t\t\t\t\tWHERE `group_id` = '" . $R_group['group_id'] . "' LIMIT 1 ;");
                 } elseif (!$editor->vars['group_' . $R_group['group_id']]['value'] && in_array($id, $gusers)) {
                     // Update
                     $gusers_new = str_replace(';' . $id . ';', '', $R_group['user_ids']);
                     mysql_query("UPDATE `groups` SET `user_ids` = '" . $gusers_new . "' \n\t\t\t\t\t\t\tWHERE `group_id` = '" . $R_group['group_id'] . "' LIMIT 1 ;");
                 }
             }
             // Redirect
             header('Location: ' . $_SERVER['PHP_SELF']);
             exit;
         } else {
        echo 'Fant ikke sliden du ville endre.';
        exit;
    }
    $slide = mysql_fetch_assoc($Q_slide);
    $slide_navn = $slide['slide_navn'];
    $slide_pri = $slide['slide_pri'] + 1;
    echo $slide['skjerm_id'];
    $skjerm_id = splittIDs($slide['skjerm_id']);
    if (isset($_GET['dato']) && is_numeric($_GET['dato']) && $_GET['dato'] > 0) {
        $slide_fra = mktime(0, 0, 0, date('m', $_GET['dato']), date('d', $_GET['dato']), date('Y', $_GET['dato']));
        $slide_til = mktime(23, 59, 59, date('m', $_GET['dato']), date('d', $_GET['dato']), date('Y', $_GET['dato']));
    } else {
        $slide_fra = $slide['slide_fra'];
        $slide_til = $slide['slide_til'];
    }
    $slide_nr = splittIDs($slide['slide_nr']);
    $slide_innhold_heading = $slide['slide_innhold_heading'];
    $slide_innhold = $slide['slide_innhold'];
} else {
    if (isset($_GET['skjerm_id']) && is_numeric($_GET['skjerm_id'])) {
        $skjerm_id = (int) $_GET['skjerm_id'];
    }
    if (isset($_GET['slide_nr']) && is_numeric($_GET['slide_nr']) && $skjerm_id != 0) {
        $slide_nr = $skjerm_id . ',' . (int) $_GET['slide_nr'];
    }
    /*if($skjerm_id > 0 && $slide_nr > 0)
    	{
    		$Q_slides = mysql_query("select slide_pri from `slides` where 
    			skjerm_id = '".$skjerm['skjerm_id']."' and 
    			slide_id='".$i."' and
    			(