1############################################################################### 2# Palette.pm # 3# $Date: 12.02.14 $ # 4############################################################################### 5# YaBB: Yet another Bulletin Board # 6# Open-Source Community Software for Webmasters # 7# Version: YaBB 2.6.11 # 8# Packaged: December 2, 2014 # 9# Distributed by: http://www.yabbforum.com # 10# =========================================================================== # 11# Copyright (c) 2000-2014 YaBB (www.yabbforum.com) - All Rights Reserved. # 12# Software by: The YaBB Development Team # 13# with assistance from the YaBB community. # 14############################################################################### 15use CGI::Carp qw(fatalsToBrowser); 16our $VERSION = '2.6.11'; 17 18$palettepmver = 'YaBB 2.6.11 $Revision: 1611 $'; 19if ( $action eq 'detailedversion' ) { return 1; } 20 21sub ColorPicker { 22 my $picktask = $INFO{'task'}; 23 24 if ( $INFO{'palnr'} && $iamadmin ) { 25 my @new_pal; 26 for my $i ( 0 .. ( @pallist - 1 ) ) { 27 if ( $i == ( $INFO{'palnr'} - 1 ) && $INFO{'palcolor'} ) { 28 push @new_pal, "#$INFO{'palcolor'}"; 29 } 30 else { push @new_pal, "$pallist[$i]"; } 31 } 32 @pallist = @new_pal; 33 34 require Admin::NewSettings; 35 SaveSettingsTo('Settings.pm'); 36 } 37 38 $gzcomp = 0; 39 print_output_header(); 40 41 print qq~ 42<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 43<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$abbr_lang" lang="$abbr_lang"> 44<head> 45<title>Palette</title> 46<meta http-equiv="Content-Type" content="text/html; charset=$yymycharset" /> 47<link rel="stylesheet" href="$yyhtml_root/Templates/Forum/$usestyle.css" type="text/css" /> 48 49<script type="text/javascript"> 50var picktask = '$picktask'; 51 52function Pickshowcolor(color) { 53 if ( c=color.match(/rgb\\((\\d+?)\\, (\\d+?)\\, (\\d+?)\\)/i) ) { 54 var rhex = tohex(c[1]); 55 var ghex = tohex(c[2]); 56 var bhex = tohex(c[3]); 57 var newcolor = '#'+rhex+ghex+bhex; 58 } 59 else { 60 newcolor = color; 61 } 62 if(picktask == "post") { 63 passcolor=newcolor.replace(/#/, ""); 64 if(document.getElementById("defpal1").checked) { 65 opener.document.getElementById("defaultpal1").style.backgroundColor=newcolor; 66 location.href='$scripturl?action=palette;palnr=1;palcolor=' + passcolor + ';task=$picktask'; 67 } 68 else if(document.getElementById("defpal2").checked) { 69 opener.document.getElementById("defaultpal2").style.backgroundColor=newcolor; 70 location.href='$scripturl?action=palette;palnr=2;palcolor=' + passcolor + ';task=$picktask'; 71 } 72 else if(document.getElementById("defpal3").checked) { 73 opener.document.getElementById("defaultpal3").style.backgroundColor=newcolor; 74 location.href='$scripturl?action=palette;palnr=3;palcolor=' + passcolor + ';task=$picktask'; 75 } 76 else if(document.getElementById("defpal4").checked) { 77 opener.document.getElementById("defaultpal4").style.backgroundColor=newcolor; 78 location.href='$scripturl?action=palette;palnr=4;palcolor=' + passcolor + ';task=$picktask'; 79 } 80 else if(document.getElementById("defpal5").checked) { 81 opener.document.getElementById("defaultpal5").style.backgroundColor=newcolor; 82 location.href="$scripturl?action=palette;palnr=5;palcolor=" + passcolor + ';task=$picktask'; 83 } 84 else if(document.getElementById("defpal6").checked) { 85 opener.document.getElementById("defaultpal6").style.backgroundColor=newcolor; 86 location.href='$scripturl?action=palette;palnr=6;palcolor=' + passcolor + ';task=$picktask'; 87 } 88 else { 89 window.close(); 90 opener.AddSelText("[color="+newcolor+"]","[/color]"); 91 } 92 } 93 else { 94 if(picktask == "templ") opener.previewColor(newcolor); 95 if(picktask == "templ_0") opener.previewColor_0(newcolor); 96 if(picktask == "templ_1") opener.previewColor_1(newcolor); 97 } 98// window.close(); 99} 100 101</script> 102</head> 103 104<body> 105<div class="windowbg" style="position: absolute; top: 0px; left: 0px; width: 300px; height: 308px; border: 1px black outset;"> 106<div style="position: relative; top: 4px; left: 5px; width: 288px; height: 209px; padding-left: 1px; padding-top: 1px; border: 0px; background-color: black;">~ 107 or croak "$croak{'print'} colorpicker"; 108 109 foreach my $z ( 0 .. 255 ) { 110 showcolor($z); 111 } 112 print q~ 113 <span class="showcolor" style="background-color: #222222;" onclick="Pickshowcolor('#222222')"> </span> 114 <span class="showcolor" style="background-color: #333333;" onclick="Pickshowcolor('#333333')"> </span> 115 <span class="showcolor" style="background-color: #444444;" onclick="Pickshowcolor('#444444')"> </span> 116 <span class="showcolor" style="background-color: #555555;" onclick="Pickshowcolor('#555555')"> </span> 117 <span class="showcolor" style="background-color: #666666;" onclick="Pickshowcolor('#666666')"> </span> 118 <span class="showcolor" style="background-color: #777777;" onclick="Pickshowcolor('#777777')"> </span> 119 <span class="showcolor" style="background-color: #888888;" onclick="Pickshowcolor('#888888')"> </span> 120 <span class="showcolor" style="background-color: #aaaaaa;" onclick="Pickshowcolor('#aaaaaa')"> </span> 121 <span class="showcolor" style="background-color: #bbbbbb;" onclick="Pickshowcolor('#bbbbbb')"> </span> 122 <span class="showcolor" style="background-color: #cccccc;" onclick="Pickshowcolor('#cccccc')"> </span> 123 <span class="showcolor" style="background-color: #dddddd;" onclick="Pickshowcolor('#dddddd')"> </span> 124 <span class="showcolor" style="background-color: #eeeeee;" onclick="Pickshowcolor('#eeeeee')"> </span> 125 <form name="dodefpal" id="dodefpal" action="">~ 126 or croak "$croak{'print'} input"; 127 128 if ( $iamadmin && $picktask eq 'post' ) { 129 print qq~ 130 <span id="defpal_1" class="defpalx" style="background-color: $pallist[0]"><input type="radio" name="defpal" id="defpal1" value="defcolor1" class="defpal_b" style="background-color: $pallist[0];" title="Default palette" /></span> 131 <span id="defpal_2" class="defpalx" style="background-color:$pallist[1]"><input type="radio" name="defpal" id="defpal2" value="defcolor2" style="background-color:$pallist[1];" class="defpal_b" title="Default palette" /></span> 132 <span id="defpal_3" style="background-color:$pallist[2]" class="defpalx"><input type="radio" name="defpal" id="defpal3" value="defcolor3" style="background-color:$pallist[2];" class="defpal_b" title="Default palette" /></span> 133 <span id="defpal_4" style="background-color:$pallist[3]" class="defpalx"><input type="radio" name="defpal" id="defpal4" value="defcolor4" style="background-color:$pallist[3];" class="defpal_b" title="Default palette" /></span> 134 <span id="defpal_5" style="background-color:$pallist[4]" class="defpalx"><input type="radio" name="defpal" id="defpal5" value="defcolor5" style="background-color:$pallist[4];" class="defpal_b" title="Default palette" /></span> 135 <span id="defpal_6" style="background-color:$pallist[5]" class="defpalx"><input type="radio" name="defpal" id="defpal6" value="defcolor6" style="background-color:$pallist[5];" class="defpal_b" title="Default palette" /></span>~ 136 or croak "$croak{'print'} input"; 137 } 138 else { 139 print q~ 140 <input type="hidden" id="defpal1" value="" /> 141 <input type="hidden" id="defpal2" value="" /> 142 <input type="hidden" id="defpal3" value="" /> 143 <input type="hidden" id="defpal4" value="" /> 144 <input type="hidden" id="defpal5" value="" /> 145 <input type="hidden" id="defpal6" value="" /> 146 ~ or croak "$croak{'print'} input"; 147 } 148 149 print qq~ 150 <input type="submit" class="none" /></form> 151</div> 152<div style="position: relative; top: 9px; left: 5px; width: 289px; height: 17px; border: 1px black solid;"> 153 <span id="viewcolor" style="float: left; width: 192px; height: 17px; border-right: 1px black solid; font-size: 5px; cursor: pointer;" onclick="Pickshowcolor(this.style.backgroundColor)"> </span> 154 <span style="float: right; width: 72px; height: 15px;"> 155 <input class="windowbg" name="viewcode" id="viewcode" type="text" style="width: 70px; font-size: 11px; border: 0px; display: inline;" readonly="readonly" /> 156 </span> 157</div> 158<div class="catbg" style="position: relative; top: 15px; left: 10px; width: 277px; height: 56px; border-width: 1px; border-style: outset;"> 159 <img src="$defaultimagesdir/knapbagrms01.gif" alt="" style="position:absolute; top:0; left:0; z-index:1; width:275px; height:16px;" /> 160 <img src="$defaultimagesdir/knapred.gif" id="knapImg1" alt="" class="skyd" style="position:absolute; left:4px; top:2px; cursor:pointer; z-index:2; width:13px; height:15px;" /> 161 <img src="$defaultimagesdir/knapbagrms01.gif" alt="" style="position:absolute; top:16px; left:0; z-index:1; width:275px; height:16px;" /> 162 <img src="$defaultimagesdir/knapgreen.gif" id="knapImg2" alt="" class="skyd" style="position:absolute; left:4px; top:18px; cursor:pointer; z-index:2; width:13px; height:15px;" /> 163 <img src="$defaultimagesdir/knapbagrms01.gif" alt="" style="position:absolute; top:32px; left:0; z-index:1; width:275px; height:16px;" /> 164 <img src="$defaultimagesdir/knapblue.gif" id="knapImg3" alt="" class="skyd" style="position:absolute; left:4px; top:34px; cursor:pointer; z-index:2; width:13px; height:15px;" /> 165</div> 166</div> 167 168<script src="$yyhtml_root/palette.js" type="text/javascript"></script> 169 170</body> 171</html>~ or croak "$croak{'print'} body"; 172 return; 173} 174 175sub showcolor { 176 177 #deep nest removed to sub# 178 my ($z) = @_; 179 if ( $z % 51 == 0 ) { 180 my $c1 = sprintf '%02x', $z; 181 foreach my $y ( 0 .. 255 ) { 182 if ( $y % 51 == 0 ) { 183 my $c2 = sprintf '%02x', $y; 184 foreach my $x ( 0 .. 255 ) { 185 if ( $x % 51 == 0 ) { 186 my $c3 = sprintf '%02x', $x; 187 print 188qq~\n <span title="#$c3$c2$c1" class="deftrows" style="background-color: #$c3$c2$c1;" onclick="Pickshowcolor('#$c3$c2$c1')"> </span>~ 189 or croak "$croak{'print'} span"; 190 } 191 } 192 } 193 } 194 } 195 return; 196} 1971; 198