Esempio n. 1
0
 while ($teams[] = $data->fetch_array($team_query)) {
 }
 $patrols = $data->select_fetch_all_rows($numpatrols, "groups", "WHERE ({$groups}) AND ispatrol = 1 ORDER BY teamname ASC", "id, teamname");
 $groups = group_sql_list_id("patrol", "OR");
 $members = $data->select_fetch_all_rows($nummembers, "members", "WHERE ({$groups}) ORDER BY lastName,firstName ASC", "id, lastName, firstName");
 $tpl->assign('teams', $teams);
 $tpl->assign('numteams', $numteams);
 $tpl->assign('patrols', $patrols);
 $tpl->assign('numpatrols', $numpatrols);
 $tpl->assign('members', $members);
 $tpl->assign('nummembers', $nummembers);
 $items['groups'] = unserialize($items['groups']);
 $items['patrols'] = unserialize($items['patrols']);
 $tpl->assign('item', $items);
 $location = "Edit " . censor($items['summary']) . " event";
 $colour = rgb2hex2rgb($items['colour']);
 $script .= "{literal}function makeTwoChars(inp) {\n                            return String(inp).length < 2 ? \"0\" + inp : inp;\n                    }\n\n                    function initialiseInputs() {\n                            // Clear any old values from the inputs (that might be cachedate by the browser after a page reload)\n                            document.getElementById(\"sdate\").value = \"{$startdate}\";\n                            document.getElementById(\"edate\").value = \"{$enddate}\";\n                            // Add the onchange event handler to the start date input\n                            document.getElementById(\"sdate\").onchange = setReservationDates;\n                            \n                    }\n                    function setReservationDates(e) {\n                            // Check the associatedate datePicker object is available (be safe)\n                            if(!(\"sdate\" in datePickerController.datePickers)) {\n                                    return;\n                            }\n                            \n                            // Check the value of the input is a date of the correct format\n                            var dt = datePickerController.dateFormat(this.value, datePickerController.datePickers[\"sdate\"].format.charAt(0) == \"m\");\n                            \n                            // If the input's value cannot be parsedate as a valid date then return\n                            if(dt == 0) return;\n\n                            // Grab the value set within the endDate input and parse it using the dateFormat method\n                            // N.B: The second parameter to the dateFormat function, if TRUE, tells the function to favour the m-d-y date format\n                            var edatev = datePickerController.dateFormat(document.getElementById(\"edate\").value, datePickerController.datePickers[\"edate\"].format.charAt(0) == \"m\");\n\n                            // Grab the end date datePicker Objects\n                            var edate = datePickerController.datePickers[\"edate\"];\n\n                            edate.setRangeLow( dt );\n                            \n                            // If theres a value already present within the end date input and it's smaller than the start date\n                            // then clear the end date value\n                            if(edatev < dt) {\n                                    document.getElementById(\"edate\").value = \"\";\n                            }\n                    }\n                    datePickerController.addEvent(window, 'load', initialiseInputs);{/literal}";
 $onDomReady .= "var r = new MooRainbow('colourSelector', {\n                                    'startColor': [{$colour['red']}, {$colour['green']}, {$colour['blue']}],\n                                    'onChange': function(color) {\n                                        \$('colour').value = color.hex;\n                                        \$('colour').style.backgroundColor = color.hex;\n                                    }\n                                });";
 $scriptList['tinyAdv'] = 1;
 $scriptList['datepicker'] = 1;
 $scriptList['mooRainbow'] = 1;
 $submit = $_POST['Submit'];
 if ($submit == "Update Item") {
     if (validate($_POST['validation'])) {
         $summary = safesql($_POST['summary'], "text");
         $startdate = safesql(strtotime($_POST['sdate']) + $_POST['stime']['Hour'] * 60 * 60 + $_POST['stime']['Minute'] * 60);
         $enddate = safesql(strtotime($_POST['edate']) + $_POST['etime']['Hour'] * 60 * 60 + $_POST['etime']['Minute'] * 60);
         $detail = safesql($_POST['story'], "text", false);
         $colour = safesql($_POST['colour'], "text");
         if (confirm('event')) {
             $message = "Your event has been updated, but first needs to be reviewed by an administrator.";
Esempio n. 2
0
     }
 }
 $calendar .= "</tr>";
 $numberRows = $items[$week]['number'];
 for ($k = 0; $k < $numberRows; $k++) {
     $calendar .= "<tr style=\"height:1.4em;\">";
     for ($j = 1; $j <= 7; $j++) {
         $tempDay = $weekStart + $j - 1;
         if (($j >= $startNum && $week == 1 || $week > 1) && $tempDay <= $days && $tempDay > 0) {
             if ($items[$week][$j][$k]['itemhere'] && !$items[$week][$j][$k]['placed']) {
                 if ($tempDay + $items[$week][$j][$k]['length'] > $days) {
                     $items[$week][$j][$k]['length'] = $days - $tempDay + 1;
                 }
                 $colour = rgb2hex2rgb($items[$week][$j][$k]['color']);
                 $colour1['b'] = $colour1['g'] = $colour1['r'] = ($colour['r'] + $colour['g'] + $colour['b']) / 3 > 100 ? 0 : 255;
                 $colour = rgb2hex2rgb($colour1['r'] . '.' . $colour1['g'] . '.' . $colour1['b']);
                 $calendar .= "<td colspan=\"{$items[$week][$j][$k]['length']}\" class=\"calendar_item\" style=\"vertical-align:middle;\"><div class=\"calendar_item_div\" style=\"background-color:{$items[$week][$j][$k]['color']};color:{$colour};border-color:{$colour}\"><span style=\"color:{$colour};\" class=\"hintanchor\" title=\"{$items[$week][$j][$k]['shortsummary']} :: &lt;b&gt;Start Date: &lt;/b&gt;{$items[$week][$j][$k]['startdate']}&lt;br /&gt;&lt;b&gt;Start Time: &lt;/b&gt;{$items[$week][$j][$k]['starttime']}&lt;br /&gt;&lt;b&gt;End Date: &lt;/b&gt;{$items[$week][$j][$k]['enddate']}&lt;br /&gt;&lt;b&gt;End Time: &lt;/b&gt;{$items[$week][$j][$k]['endtime']}&lt;br /&gt;{$items[$week][$j][$k]['detail']}\">{$items[$week][$j][$k]['summary']}</span>" . ($items[$week][$j][$k]['details'] == 1 ? "<a href=\"index.php?page=calender&amp;item={$items[$week][$j][$k]['id']}&amp;menuid={$menuid}\"><img src=\"{$templateinfo['imagedir']}page.gif\" alt=\"Read more\" title=\"Read more\" border=\"0\"/></a>" : '') . "</div></td>";
                 for ($l = $j; $l <= 7; $l++) {
                     if ($items[$week][$l][$k]['itemhere']) {
                         $items[$week][$l][$k]['placed'] = true;
                     }
                 }
             } elseif (!$items[$week][$j][$k]['itemhere']) {
                 $calendar .= "<td class=\"calendar_item\">&nbsp;</td>";
             }
         } else {
             $calendar .= "<td class=\"calendar_day_invalid\">&nbsp;</td>";
         }
     }
     $calendar .= "</tr>";
 }
/**
 * Zeichnet eine Textzeile.
 */
function twMachZeile($bild, $textfarbe, $schriftgroesse, $x, $y, $f, $text)
{
    // Textfarbe (noch von hex in rgb umwandeln)
    $arrFarbe = rgb2hex2rgb($textfarbe);
    $textfarbe = imagecolorallocate($bild, $arrFarbe[r], $arrFarbe[g], $arrFarbe[b]);
    // Schriftart ("/var/www/shirtbemaler/schriften/". $f. ".ttf";)
    $font = $_SESSION['dirDocumentRoot'] . $_SESSION['dirApplication'] . $_SESSION['dirFonts'] . $f . ".ttf";
    if (!file_exists($font)) {
        $font = $_SESSION['dirDocumentRoot'] . $_SESSION['dirApplication'] . $_SESSION['dirFonts'] . "arial.ttf";
    }
    // Nun entweder mit imagestring() oder mit imagettftext() den Text als Bild
    // erstellen. imagestring() is Scheiße, weil nur 5 schriften(-größen) gehen
    // und keine Neigung einstellbar ist(nur 90grad).
    // Also imagettftext():
    // array imagefttext(bild, fontgroesse, neigung, x, y, textfarbe, schriftdatei, text)
    // array imagefttext(image, float, float, int, int int, string, string [, array extrainfo] )
    // bild vorher mit imagecreate (oder mit imagecreatefromjpg(png)) erzeugen
    // x und y ist die linke untere Ecke des Textes (anders als bei imagestring)
    // textfarbe vorher mit imagecolorallocate() erzeugen
    // die Fontdatei am Besten gleich mit auf den Server legen
    imagettftext($bild, $schriftgroesse, 0, $x, $y, $textfarbe, $font, $text);
    ///imagettftext($bild, 16, 0, 10, 10, imagecolorallocate($bild, 255, 0, 0), "/var/www/shirtbemaler/fonts/arial.ttf", "Test-Text");
    ///array imagettftext ( resource $im, int $size, int $angle, int $x, int $y, int $col, string $fontfile, string $text )
    // oder
    ///imagestring($bild, $schriftgroesse, $x, $y, $text, $textfarbe);
}
Esempio n. 4
0
$step_x = $use_width / $resize_width;
$step_y = $use_height / $resize_height;
$step_width = $use_width / $columns;
$step_height = $use_height / $rows;
$kinskode = '';
for ($y = 0; $y < $step_y; $y++) {
    $r_y = round($y * $step_y) - $step_y / 2 + $step_y;
    for ($x = 0; $x < $step_x; $x++) {
        $r_x = round($x * $step_x) - $step_x / 2 + $step_x;
        $rgb = imagecolorat($newImg2, $r_x, $r_y);
        $r = $rgb >> 16 & 0xff;
        $g = $rgb >> 8 & 0xff;
        $b = $rgb & 0xff;
        $result = imagecolorclosest($palette, $r, $g, $b);
        $result = imagecolorsforindex($palette, $result);
        $flip = array_flip($colors);
        $kinskode .= $flip[rgb2hex2rgb($result['red'] . ',' . $result['green'] . ',' . $result['blue'])];
    }
    $kinskode .= PHP_EOL;
}
$return = array('status' => 'success', 'kinskode' => $kinskode);
if (!empty($return)) {
    if (isset($_GET['callback'])) {
        echo preg_replace("/[^a-z0-9 \\-\\_]/i", '', $_GET['callback']) . '(' . json_encode($return) . ')';
    } else {
        echo json_encode($return);
    }
}
imagedestroy($newImg2);
imagedestroy($newImg);
imagedestroy($palette);
Esempio n. 5
0
         }
         $action = '';
     }
 } elseif ($action == "editical" && pageauth("events", "edit") == 1 || $action == "newical" && pageauth("events", "add") == 1) {
     if ($action == "editical") {
         $calsql = $data->select_query("ical_items", "WHERE id = {$id}");
         $items = $data->fetch_array($calsql);
         $items['groups'] = unserialize($items['groups']);
     }
     if (pageauth("events", "limit") == 1) {
         $groups = group_sql_list_id("id", "OR");
         $teams = $data->select_fetch_all_rows($numteams, "groups", "WHERE ({$groups}) ORDER BY teamname ASC", "id, teamname");
     } else {
         $teams = $data->select_fetch_all_rows($numteams, "groups", "ORDER BY teamname ASC", "id, teamname");
     }
     $colour = $action == "editical" ? rgb2hex2rgb($items['colour']) : array("red" => 255, "green" => 255, "blue" => 255);
     $onDomReady .= "var r = new MooRainbow('colourSelector', {\n                    'startColor': [{$colour['red']}, {$colour['green']}, {$colour['blue']}],\n                    'onChange': function(color) {\n                        \$('colour').value = color.hex;\n                        \$('colour').style.backgroundColor = color.hex;\n                    }\n                });";
     $tpl->assign('teams', $teams);
     $tpl->assign('numteams', $numteams);
     $submit = $_POST['Submit'];
     if ($submit == "Submit") {
         $name = safesql($_POST['name'], "text");
         $link = safesql($_POST['link'], "text");
         $colour = safesql($_POST['colour'], "text");
         $groupallowed = safesql(serialize($_POST['groups']), "text");
         if ($action == "editical") {
             $sql = $data->update_query("ical_items", "name = {$name}, link = {$link}, `groups` = {$groupallowed}, colour = {$colour}", "id = {$id}");
             show_admin_message("iCalendar link updated", "{$pagename}&activetab=ical");
         } elseif ($action == "newical") {
             $sql = $data->insert_query("ical_items", "'', {$name}, {$link}, {$groupallowed}, {$colour}");
             show_admin_message("iCalendar link added", "{$pagename}&activetab=ical");