Ejemplo n.º 1
0
function decod($i)
{
    $tx = imagesx($i);
    $ty = imagesy($i);
    $ty = 3;
    $data = '';
    for ($y = 0; $y < $ty; $y++) {
        for ($x = 0; $x < $tx; $x++) {
            $cdat = getcolor($i, $x, $y);
            $data .= ($cdat[2] & 1) . ($cdat[1] & 1) . ($cdat[0] & 1);
        }
    }
    return $data;
}
Ejemplo n.º 2
0
}
$left = ($width - $len * ($size + $size / 10)) / $size;
for ($i = 0; $i < $len; $i++) {
    $randtext = rand(0, 9);
    $code .= $randtext;
    $textColor = imageColorAllocate($image, rand(0, 100), rand(0, 100), rand(0, 100));
    $font = rand(1, 4) . ".ttf";
    $randsize = rand($size - $size / 10, $size + $size / 10);
    $location = $left + ($i * $size + $size / 10);
    imagettftext($image, $randsize, rand(-18, 18), $location, rand($size - $size / 10, $size + $size / 10), $textColor, $font, $randtext);
}
if ($noise == true) {
    setnoise();
}
$_SESSION['cv_yzm'] = $code;
$bordercolor = getcolor($bordercolor);
if ($border == true) {
    imageRectangle($image, 0, 0, $width - 1, $height - 1, $bordercolor);
}
header("Content-type: image/png");
imagePng($image);
imagedestroy($image);
function getcolor($color)
{
    global $image;
    $color = eregi_replace("^#", "", $color);
    $r = $color[0] . $color[1];
    $r = hexdec($r);
    $b = $color[2] . $color[3];
    $b = hexdec($b);
    $g = $color[4] . $color[5];
Ejemplo n.º 3
0
         <tr> 
         
         <?php 
for ($i = 0, $id = 0; $i < count($sections['titles']); ++$i, $id += 3) {
    ?>
         <tr>
          <td><?php 
    echo tep_draw_separator('pixel_trans.gif', '100%', '10');
    ?>
</td>
         </tr>         
         <tr>
          <td colspan="3" ><table border="0" width="100%">
         <tr>
          <td colspan="3" class="smallText" width="20%" style="font-weight: bold; color: <?php 
    echo getcolor($sections['titles'][$i]);
    ?>
;"><?php 
    echo $sections['titles'][$i];
    ?>
</td>
          <td class="smallText">HTTA: </td>
          <td align="left"><?php 
    echo tep_draw_checkbox_field($args['title_switch_name'][$i], '', $args['title_switch'][$i], '');
    ?>
 </td>
          <td class="smallText">HTDA: </td>
          <td align="left"><?php 
    echo tep_draw_checkbox_field($args['desc_switch_name'][$i], '', $args['desc_switch'][$i], '');
    ?>
 </td>
Ejemplo n.º 4
0
function layerdata4(&$energy1, $minenergy, $maxenergy, &$colorindex, $layer, &$mult, &$order)
{
    echo '<table  border="1">';
    //625 table
    echo '<tr>';
    for ($m = 0; $m < $mult[$order["5"]]; $m++) {
        //wwr print heading
        echo '<th style="font-size:15px;">' . findname($order["5"]) . ' ' . findAssoValue($order["5"], $m) . '</th>';
    }
    echo '</tr>';
    echo '<tr>';
    for ($m = 0; $m < $mult[$order["5"]]; $m++) {
        //wwr
        echo "<td>";
        echo '<table >';
        //625 table
        $flagod = 1;
        //for limiting the no of times "Overhang Depth" is to be printed
        for ($l = 0; $l < $mult[$order["4"]]; $l++) {
            //shgc
            echo '<tr>';
            echo "<td>";
            echo '<table >';
            //125 table
            echo "<tr>";
            echo "<td></td>";
            //an extra column due to shgc printing
            if ($flagod == 1) {
                for ($t = 0; $t < $mult[$order["3"]]; $t++) {
                    echo "<td>";
                    echo findname($order["3"]) . ' ' . findAssoValue($order["3"], $t);
                    echo "</td>";
                }
                //$flagod=0;
            }
            echo "</tr>";
            echo "<tr>";
            echo '<td>' . findname($order["4"]) . ' ' . findAssoValue($order["4"], $l) . '</td>';
            for ($k = 0; $k < $mult[$order["3"]]; $k++) {
                //overhang
                echo "<td>";
                echo '<table border="1" bgcolor="white">';
                //5*5 table
                echo "<tr>";
                echo "<th>";
                //extra heading due to azimuth angle
                echo "</th>";
                for ($t = 0; $t < $mult[$order["1"]]; $t++) {
                    echo "<th>";
                    echo findname($order["1"]) . ' ' . findAssoValue($order["1"], $t);
                    //printing ratio
                    echo "</th>";
                }
                echo "</tr>";
                for ($j = 0; $j < $mult[$order["2"]]; $j++) {
                    //represents azimuth
                    echo "<tr>";
                    $flag = 0;
                    if ($flag == 0) {
                        echo '<td>' . findname($order["2"]) . ' ' . findAssoValue($order["2"], $j) . '</td>';
                        //printing azimuth
                    }
                    for ($i = 0; $i < $mult[$order["1"]]; $i++) {
                        //aspect ratio
                        $hascolor = getcolor($i, $j, $k, $l, $m, $energy1, $minenergy, $maxenergy, $colorindex, $mult, $order);
                        $tempindex = 0;
                        //=intval(($energy1[5*$i+625*$j+25*$k+$l+125*$m]-$minenergy)/($maxenergy-$minenergy)*255);
                        //echo '<td bgcolor="'.$hascolor.'"><font color="black">'.(5*$i+625*$j+25*$k+$l+125*$m)." ".$tempindex.'</font></td>';
                        echo '<td  bgcolor="' . $hascolor . '"><font color="black">
                        <div style="width:' . $layer * 5 . 'px;height:10px"><font size="1">' . round($energy1[findmult($order["1"], $mult) * $i + findmult($order["2"], $mult) * $j + findmult($order["3"], $mult) * $k + findmult($order["4"], $mult) * $l + findmult($order["5"], $mult) * $m], 2) . '</font></div>
                     </font></td>';
                    }
                    echo "</tr>";
                }
                $flag = -1;
                echo "</table>";
                echo "</td>";
            }
            echo "</tr>";
            echo "</table>";
            echo "</td>";
            echo "</tr>";
        }
        echo "</table>";
        echo "</td>";
    }
    echo "</tr>";
    echo "</table>";
}
Ejemplo n.º 5
0
function makeselect($name, $table, $idt = '', $where = '', $option = 'title', $f_idvalue = 'id')
{
    //$option外键的说明
    //$where外键的过滤
    //$f_idvalue外键的id
    //$idt现在的值
    if ($option == '') {
        $option = 'title';
    }
    if ($where == '') {
        $where = '';
    }
    if ($idt == '') {
        $idt = '';
    }
    if ($f_idvalue == '') {
        $f_idvalue = 'id';
    }
    $tmp = "\t<select name=" . $name . ">";
    $thisdao = D($table);
    $thisdao->Cache(true);
    $list = $thisdao->findAll($where);
    foreach ($list as $row) {
        if ($idt == $row[$f_idvalue]) {
            $var = "selected";
        }
        $thiscolor = getcolor($row['id']);
        $tmp .= "<option value='" . $row[$f_idvalue] . "'  " . $var . "  style='background:" . $thiscolor . ";' title='参数:" . $row[$f_idvalue] . "标题:" . $row[$option] . "'>" . $row[$option] . "</option>";
        $var = '';
        $thiscolor = '';
    }
    $tmp .= "</select>";
    msg($tmp);
}
Ejemplo n.º 6
0
 function drawTitle($name)
 {
     global $doc, $g, $FONT_SIZE, $myDoc;
     $text = $doc->createElement("text");
     $text->setAttribute("font-family", "Verdana");
     $text->setAttribute("font-weight", "bold");
     $text->setAttribute("font-size", $FONT_SIZE);
     $tspan = $doc->createElement("tspan");
     $tspan->appendChild($doc->createTextNode($title = $myDoc[0]->getkeytitle($name)));
     $text->appendChild($tspan);
     $lasttspan = $tspan;
     $node = $name;
     while ($myDoc[0]->getParent($node)) {
         $tspan = $doc->createElement("tspan");
         $tspan->appendChild($doc->createTextNode($myDoc[0]->getParent($node)->getAttribute("title") . " > "));
         $text->insertBefore($tspan, $lasttspan);
         $node = $myDoc[0]->getParent($node)->getAttribute("name");
         $lasttspan = $tspan;
     }
     for ($i = 0; $i < count($myDoc); $i++) {
         $tspan = $doc->createElement("tspan");
         $tspan->setAttribute("fill", getcolor($i));
         $tspan->appendChild($doc->createTextNode($myDoc[$i]->getkey("appname") . " " . $myDoc[$i]->getkey("release") . " "));
         $text->insertBefore($tspan, $lasttspan);
     }
     return $text;
 }
Ejemplo n.º 7
0
            echo '<tr><td>' . $lang['styles_edit_visual_setting_menuhover'] . '</td><td><div class="color"><input id="menuhover" name="stylevar[' . $stylestuff['menuhover']['id'] . ']" value="' . $stylestuff['menuhover']['subst'] . '" size="10" onchange="$(\'sp_menucurrent\').style.backgroundColor = this.value;updatecolorpreview(\'c7\', \'menuhover\')" onclick="setfocus(this)" />' . getcolor(7, 'menuhover') . '</div></td></tr>';
            echo '<tr><td>' . $lang['styles_edit_visual_setting_menuhovertext'] . '</td><td><div class="color"><input id="menuhovertext" name="stylevar[' . $stylestuff['menuhovertext']['id'] . ']" value="' . $stylestuff['menuhovertext']['subst'] . '" size="10" onchange="$(\'sp_menucurrent\').style.color = this.value;updatecolorpreview(\'c8\', \'menuhovertext\')" onclick="setfocus(this)" />' . getcolor(8, 'menuhovertext') . '</div></td></tr>';
            $stylestuff['bgcolor']['subst'] = explode(' ', $stylestuff['bgcolor']['subst']);
            $bgcolor = $stylestuff['bgcolor']['subst'][0];
            $bgcolorimg = $stylestuff['bgcolor']['subst'][1];
            $bgcolorextra = implode(' ', array_slice($stylestuff['bgcolor']['subst'], 2));
            echo '<tr><td>' . $lang['styles_edit_visual_setting_bgcolor'] . '</td><td><div class="color"><input id="bgcolor" name="stylevar[' . $stylestuff['bgcolor']['id'] . ']" value="' . $bgcolor . '" size="10" onchange="$(\'style_preview\').style.background = this.value + \' url(\' + imgdirurl + $(\'bgcolorimg\').value + \') \' + $(\'bgcolorextra\').value;updatecolorpreview(\'c9\', \'bgcolor\')" onclick="setfocus(this)" />' . getcolor(9, 'bgcolor') . '</div>' . ' <input id="bgcolorimg" name="stylevarbgimg[' . $stylestuff['bgcolor']['id'] . ']" value="' . $bgcolorimg . '" size="10" onchange="$(\'style_preview\').style.background = $(\'bgcolor\').value + \' url(\' + imgdirurl + this.value + \') \' + $(\'bgcolorextra\').value" />' . ' <input id="bgcolorextra" name="stylevarbgextra[' . $stylestuff['bgcolor']['id'] . ']" value="' . $bgcolorextra . '" size="10" onchange="$(\'style_preview\').style.background = $(\'bgcolor\').value + \' url(\' + imgdirurl + $(\'bgcolorimg\').value + \') \' + this.value" /></td></tr>';
            $stylestuff['sidebgcolor']['subst'] = explode(' ', $stylestuff['sidebgcolor']['subst']);
            $sidebgcolor = $stylestuff['sidebgcolor']['subst'][0];
            $sidebgcolorimg = $stylestuff['sidebgcolor']['subst'][1];
            $sidebgcolorextra = implode(' ', array_slice($stylestuff['sidebgcolor']['subst'], 2));
            echo '<tr><td>' . $lang['styles_edit_visual_setting_sidebgcolor'] . '</td><td><input id="sidebgcolorimg" name="stylevarbgimg[' . $stylestuff['sidebgcolor']['id'] . ']" value="' . $sidebgcolorimg . '" size="10" onchange="$(\'sp_wrap\').style.backgroundImage = \'url(\' + imgdirurl + this.value + \')\'" /><input name="stylevar[' . $stylestuff['sidebgcolor']['id'] . ']" type="hidden" value="' . $sidebgcolor . '"><input name="stylevarbgextra[' . $stylestuff['sidebgcolor']['id'] . ']" type="hidden" value="' . $sidebgcolorextra . '"></td></tr>';
            echo '<tr><td>' . $lang['styles_edit_visual_setting_wrapwidth'] . '</td><td><input name="stylevar[' . $stylestuff['wrapwidth']['id'] . ']" value="' . $stylestuff['wrapwidth']['subst'] . '" size="10" /></td></tr>';
            echo '<tr><td>' . $lang['styles_edit_visual_setting_wrapbg'] . '</td><td><div class="color"><input id="wrapbg" name="stylevar[' . $stylestuff['wrapbg']['id'] . ']" value="' . $stylestuff['wrapbg']['subst'] . '" size="10" onchange="$(\'sp_wrap\').style.backgroundColor = this.value;updatecolorpreview(\'c10\', \'wrapbg\')" onclick="setfocus(this)" />' . getcolor(10, 'wrapbg') . '</div></td></tr>';
            echo '<tr><td>' . $lang['styles_edit_visual_setting_wrapborder'] . '</td><td><div class="color"><input id="wrapbordercolor" name="stylevar[' . $stylestuff['wrapbordercolor']['id'] . ']" value="' . $stylestuff['wrapbordercolor']['subst'] . '" size="10" onchange="$(\'sp_wrap\').style.border = $(\'wrapborder\').value + \' solid \' + this.value;updatecolorpreview(\'c11\', \'wrapbordercolor\')" onclick="setfocus(this)" />' . getcolor(11, 'wrapbordercolor') . '</div>' . ' <input id="wrapborder" name="stylevar[' . $stylestuff['wrapborder']['id'] . ']" value="' . $stylestuff['wrapborder']['subst'] . '" size="10" onchange="$(\'sp_wrap\').style.border = this.value + \' solid \' + $(\'wrapbordercolor\').value" /></td></tr>';
            echo '<tr><td>' . $lang['styles_edit_visual_setting_footertext'] . '</td><td><div class="color"><input id="footertext" name="stylevar[' . $stylestuff['footertext']['id'] . ']" value="' . $stylestuff['footertext']['subst'] . '" size="10" onchange="$(\'sp_footer\').style.color = this.value;updatecolorpreview(\'c12\', \'footertext\')" onclick="setfocus(this)" />' . getcolor(12, 'footertext') . '</div></td></tr>';
            echo '<tr><td>' . $lang['styles_edit_visual_getcolorfromimg'] . '</td><td><input id="imgurl" size="10"> <a href="javascript:;" onclick="ajaxget(\'' . $BASESCRIPT . '?action=styles&operation=getcolor&file=\' + $(\'imgurl\').value, \'colorlist\')">' . $lang['styles_edit_visual_getcolor'] . '</a></td></tr>';
            echo '<tr><td></td><td><div id="colorlist"></div></td></tr>';
            ?>
</td><tr></table>

</td><tr></table>

<script>
var inps = $('previewbody').getElementsByTagName('INPUT');
for(i = 0;i < inps.length;i++) {
	if(inps[i].onchange) {
		var change = inps[i].onchange.toString();
		if(change) {
			var start = change.indexOf('{');
			var end = change.lastIndexOf('}');