<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// Manage Smilies
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_settings.gif" width="23" height="20"> '.$MsgText[0][60];
	$BrowserTitle = $MsgText[0][60];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[0][60];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[15] == 'y') {
	
			$PageContents = $MsgText[0][396].'<br><br><a href="#new">'.$MsgText[0][397].'</a><br><br><br><b>'.$MsgText[0][398].'</b>';
			
			
			$PageContents .= '<br><img src="'.$ImagesURL.'/admin/spacer.gif" border="0" width="1" height="2" alt=""><br><table width="100%" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="'.$Colors['Text'].'"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#ffffff">  
	  
	  <table width="100%" border="0" cellpadding="5" cellspacing="0">
    <tr>
      <td bgcolor="'.$Colors['Text'].'"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="'.$Colors['BG'].'"><b>'.$MsgText[0][399].'</b></td>
      <td bgcolor="'.$Colors['Text'].'"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="'.$Colors['BG'].'"><b>'.$MsgText[0][400].'</b></td>
	  <td bgcolor="'.$Colors['Text'].'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="'.$Colors['BG'].'"><b>'.$MsgText[0][401].'</b></td>
      <td bgcolor="'.$Colors['Text'].'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="'.$Colors['BG'].'"><b>'.$MsgText[0][402].'</b></td>
      <td bgcolor="'.$Colors['Text'].'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="'.$Colors['BG'].'"><b>'.$MsgText[0][403].'</b></td>
	  <td bgcolor="'.$Colors['Text'].'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="'.$Colors['BG'].'"><b>'.$MsgText[0][404].'</b></td>
  	  <td bgcolor="'.$Colors['Text'].'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="'.$Colors['BG'].'"><b>'.$MsgText[0][155].'&nbsp;/&nbsp;'.$MsgText[0][156].'</b></td>
    </tr>';

			
			$HiddenPrint[1] = $MsgText[0][118];
			$HiddenPrint[0] = $MsgText[0][119];
			
			$EnabledPrint[1] = $MsgText[0][118];
			$EnabledPrint[0] = $MsgText[0][119];
			
			
			$query553 = "select * from `".$Settings['DBPrefix']."core-Smilies` order by SmilieOrder asc";
			$result553 = mysql_query($query553) or die (mysql_error());
			
			$SmiliesCount = mysql_num_rows($result553);
			
			while ($row553 = mysql_fetch_array($result553)) {
				$SmilieCounter++;
			
				if ($BGColor == '#ffffff') {
					$BGColor = '#f0f0f0';
				}
				else {
					$BGColor = '#ffffff';
				}
				
				
				$InsertCodesPrint = '';
				
				if ($row553['InsertCode'] != '') {
					$InsertCodesPrint = $row553['InsertCode'];
				}
				if ($row553['InsertCode2'] != '') {
					$InsertCodesPrint .= ' &nbsp; '.$row553['InsertCode2'];
				}
				if ($row553['InsertCode3'] != '') {
					$InsertCodesPrint .= ' &nbsp; '.$row553['InsertCode3'];
				}
				if ($row553['InsertCode4'] != '') {
					$InsertCodesPrint .= ' &nbsp; '.$row553['InsertCode4'];
				}
				if ($row553['InsertCode5'] != '') {
					$InsertCodesPrint .= ' &nbsp; '.$row553['InsertCode5'];
				}
				
				
				if (substr($row553['ImageLink'],0,4) == 'http') {
					$ImageLink = $row553['ImageLink'];		
				}
				else {
					$ImageLink = $ImagesURL . '/smilies/' . $row553['ImageLink'];
				}
				
				
				if (strlen($row553['ImageLink']) > 25) {
					$row553['ImageLink'] = '...'.substr($row553['ImageLink'], (strlen($row553['ImageLink'])-25), 25);
				}
				
				
				
				if ($SmilieCounter == 1) {
				// first one
					$OrderLinks = '<a href="'.$MainURL.'/admin/smilies-order/'.$row553['RecordNumber'].'/down"><img src="'.$TemplateImagesURL.'/admin/arrow_down.gif" border="0" alt="Move Down"></a>';
				}
				else if ($SmilieCounter == $SmiliesCount) {
				// last one
					$OrderLinks = '<a href="'.$MainURL.'/admin/smilies-order/'.$row553['RecordNumber'].'/up"><img src="'.$TemplateImagesURL.'/admin/arrow_up.gif" border="0" alt="Move Up"></a>';
				}
				else {
				// middle ones
					$OrderLinks = '<a href="'.$MainURL.'/admin/smilies-order/'.$row553['RecordNumber'].'/up"><img src="'.$TemplateImagesURL.'/admin/arrow_up.gif" border="0" alt="Move Up"></a><a href="'.$MainURL.'/admin/smilies-order/'.$row553['RecordNumber'].'/down"><img src="'.$TemplateImagesURL.'/admin/arrow_down.gif" border="0"  alt="Move Down"></a>';
				}

			
			
				$PageContents .= '<tr>
			      <td bgcolor="'.$BGColor.'"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="#000000">'.$row553['Description'].' </td>
			      <td bgcolor="'.$BGColor.'"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="#000000">'.$row553['ImageLink'].' </td>
				  <td bgcolor="'.$BGColor.'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="#000000"><img src="'.$ImageLink.'" alt="" border="0"></td>
			      <td bgcolor="'.$BGColor.'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="#000000">'.$InsertCodesPrint.' </td>
			      <td bgcolor="'.$BGColor.'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="#000000">'.$HiddenPrint[$row553['Hidden']].' / '.$EnabledPrint[$row553['Enabled']].'</td>
					<td bgcolor="'.$BGColor.'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="#000000">'.$OrderLinks.'</td>
					<td bgcolor="'.$BGColor.'" align="center"><font face="'.$FontFace.'" size="'.($FontSize-1).'" color="#000000"><a href="'.$MainURL.'/admin/smilies-edit/'.$row553['RecordNumber'].'"><font color="'.$Colors['Link'].'">'.$MsgText[0][155].'</a> / <a href="'.$MainURL.'/admin/smilies-delete/'.$row553['RecordNumber'].'"><font color="'.$Colors['Link'].'">'.$MsgText[0][156].'</a></td>
			    </tr>';		
			
			}
			
			
			
			$PageContents .= '</table></td></tr></table></td></tr></table><br><br><br><a name="new"></a><b>'.$MsgText[0][397].'</b><br><form action="'.$MainURL.'/admin/smilies-new" method="post"><b>'.$MsgText[0][399].':</b><br><input type="text" name="Name" size="25"><br><br><b>'.$MsgText[0][400].':</b><br><input type="text" name="Filename" size="50"><br><font size="1">('.$MsgText[0][406].')<br></font><br><b>'.$MsgText[0][407].':</b><br><input type="text" name="InsertCode1" size="5">&nbsp;&nbsp;&nbsp;<input type="text" name="InsertCode2" size="5">&nbsp;&nbsp;&nbsp;<input type="text" name="InsertCode3" size="5">&nbsp;&nbsp;&nbsp;<input type="text" name="InsertCode4" size="5">&nbsp;&nbsp;&nbsp;<input type="text" name="InsertCode5" size="5"><br><br><b>'.$MsgText[0][408].'</b><br><select name="Hidden">
	<option value="0"> '.$MsgText[0][119].'</option>
	<option value="1"> '.$MsgText[0][118].'</option>
</select><br><br><b>'.$MsgText[0][409].'</b><br><select name="Enabled">
	<option value="1"> '.$MsgText[0][118].'</option>
	<option value="0"> '.$MsgText[0][119].'</option>
</select>
<br><br><br><input type="submit" value="'.$MsgText[0][410].'"></form>';
			
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

	// ========================================================================================




?>
