|
|
|
@@ -1,6 +1,6 @@
|
|
|
|
|
<?php
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
* admin_icons.php
|
|
|
|
|
* admin_smilies.php
|
|
|
|
|
* -------------------
|
|
|
|
|
* begin : Thu May 31, 2001
|
|
|
|
|
* copyright : (C) 2001 The phpBB Group
|
|
|
|
@@ -43,7 +43,7 @@ require('pagestart.' . $phpEx);
|
|
|
|
|
//
|
|
|
|
|
// Do we have general permissions?
|
|
|
|
|
//
|
|
|
|
|
if ( !$acl->get_acl_admin('general') )
|
|
|
|
|
if (!$acl->get_acl_admin('general'))
|
|
|
|
|
{
|
|
|
|
|
message_die(MESSAGE, $lang['No_admin']);
|
|
|
|
|
}
|
|
|
|
@@ -51,374 +51,389 @@ if ( !$acl->get_acl_admin('general') )
|
|
|
|
|
//
|
|
|
|
|
// Check to see what mode we should operate in.
|
|
|
|
|
//
|
|
|
|
|
if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
|
|
|
|
|
if (isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']))
|
|
|
|
|
{
|
|
|
|
|
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
|
|
|
|
|
$mode = (!empty($HTTP_POST_VARS['mode'])) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$mode = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$delimeter = '=+:';
|
|
|
|
|
$delimiter = '=+:';
|
|
|
|
|
$smilies_images = $smilies_paks = array();
|
|
|
|
|
$click_return = '<br /><br />' . sprintf($lang['Click_return_smileadmin'], '<a href="admin_smilies.' . $phpEx . $SID . '">', '</a>');
|
|
|
|
|
$click_return .= '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="index.' . $phpEx . $SID . '&pane=right">', '</a>');
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Read a listing of uploaded smilies for use in the add or edit smliey code...
|
|
|
|
|
//
|
|
|
|
|
$dir = @opendir($phpbb_root_path . $board_config['smilies_path']);
|
|
|
|
|
|
|
|
|
|
while( $file = @readdir($dir) )
|
|
|
|
|
if ($mode == 'edit' || !empty($HTTP_POST_VARS['add']) || !empty($HTTP_POST_VARS['import_pak']))
|
|
|
|
|
{
|
|
|
|
|
if ( is_file($phpbb_root_path . $board_config['smilies_path'] . '/' . $file) )
|
|
|
|
|
$dir = @opendir($phpbb_root_path . $board_config['smilies_path']);
|
|
|
|
|
while ($file = @readdir($dir))
|
|
|
|
|
{
|
|
|
|
|
$img_size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $file);
|
|
|
|
|
|
|
|
|
|
if ( $img_size[0] && $img_size[1] )
|
|
|
|
|
if (is_file($phpbb_root_path . $board_config['smilies_path'] . '/' . $file))
|
|
|
|
|
{
|
|
|
|
|
$smiley_images[] = $file;
|
|
|
|
|
}
|
|
|
|
|
else if( eregi('.pak$', $file) )
|
|
|
|
|
{
|
|
|
|
|
$smiley_paks[] = $file;
|
|
|
|
|
$img_size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $file);
|
|
|
|
|
|
|
|
|
|
if (preg_match('/\.(gif|png|jpg)$/i', $file) || (!empty($img_size[0]) && !empty($img_size[1])))
|
|
|
|
|
{
|
|
|
|
|
$smilies_images[] = $file;
|
|
|
|
|
}
|
|
|
|
|
elseif (preg_match('/\.pak$/i', $file))
|
|
|
|
|
{
|
|
|
|
|
$smilies_paks[] = $file;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@closedir($dir);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@closedir($dir);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Select main mode
|
|
|
|
|
//
|
|
|
|
|
if ( isset($HTTP_GET_VARS['import_pack']) || isset($HTTP_POST_VARS['import_pack']) )
|
|
|
|
|
if (isset($HTTP_POST_VARS['import_pak']))
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Import a list a "Smiley Pack"
|
|
|
|
|
//
|
|
|
|
|
$smile_pak = ( isset($HTTP_POST_VARS['smile_pak']) ) ? $HTTP_POST_VARS['smile_pak'] : $HTTP_GET_VARS['smile_pak'];
|
|
|
|
|
$clear_current = ( isset($HTTP_POST_VARS['clear_current']) ) ? $HTTP_POST_VARS['clear_current'] : $HTTP_GET_VARS['clear_current'];
|
|
|
|
|
$replace_existing = ( isset($HTTP_POST_VARS['replace']) ) ? intval($HTTP_POST_VARS['replace']) : intval($HTTP_GET_VARS['replace']);
|
|
|
|
|
|
|
|
|
|
if ( !empty($smile_pak) )
|
|
|
|
|
if (!empty($HTTP_POST_VARS['smilies_pak']))
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// The user has already selected a smile_pak file.. Import it.
|
|
|
|
|
// The user has already selected a smilies_pak file.. Import it.
|
|
|
|
|
//
|
|
|
|
|
if ( !empty($clear_current) )
|
|
|
|
|
if (!empty($HTTP_POST_VARS['clear_current']))
|
|
|
|
|
{
|
|
|
|
|
$sql = "DELETE
|
|
|
|
|
FROM " . SMILIES_TABLE;
|
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
$db->sql_query('DELETE FROM ' . SMILIES_TABLE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$sql = "SELECT code
|
|
|
|
|
FROM ". SMILIES_TABLE;
|
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
$result = $db->sql_query('SELECT code FROM ' . SMILIES_TABLE);
|
|
|
|
|
|
|
|
|
|
$cur_smilies = $db->sql_fetchrowset($result);
|
|
|
|
|
|
|
|
|
|
for( $i = 0; $i < count($cur_smilies); $i++ )
|
|
|
|
|
$smilies = array();
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
|
{
|
|
|
|
|
$k = $cur_smilies[$i]['code'];
|
|
|
|
|
$smiles[$k] = 1;
|
|
|
|
|
$smilies[$row['code']] = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$fcontents = @file($phpbb_root_path . $board_config['smilies_path'] . '/'. $smile_pak);
|
|
|
|
|
$fcontents = @file($phpbb_root_path . $board_config['smilies_path'] . '/'. $smilies_pak);
|
|
|
|
|
|
|
|
|
|
if ( empty($fcontents) )
|
|
|
|
|
if (empty($fcontents))
|
|
|
|
|
{
|
|
|
|
|
message_die(ERROR, "Couldn't read smiley pak file", "", __LINE__, __FILE__, $sql);
|
|
|
|
|
message_die(ERROR, 'Could not read smiley pak file' . $click_return);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for( $i = 0; $i < count($fcontents); $i++ )
|
|
|
|
|
foreach ($fcontents as $line)
|
|
|
|
|
{
|
|
|
|
|
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
|
|
|
|
|
$smile_data = explode($delimiter, trim($line));
|
|
|
|
|
|
|
|
|
|
for( $j = 2; $j < count($smile_data); $j++)
|
|
|
|
|
$smile_url = $smile_data[0];
|
|
|
|
|
$emotion = $smile_data[1];
|
|
|
|
|
$code = htmlentities($smile_data[2]);
|
|
|
|
|
|
|
|
|
|
if (!isset($smile_data[4]))
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Replace > and < with the proper html_entities for matching.
|
|
|
|
|
// The size isn't specified, try to get it from the file and if it fails
|
|
|
|
|
// arbitrary set it to 15 and let the user correct it later.
|
|
|
|
|
//
|
|
|
|
|
$smile_data[$j] = htmlentities($smile_data[$j]);
|
|
|
|
|
$k = $smile_data[$j];
|
|
|
|
|
|
|
|
|
|
if ( $smiles[$k] == 1 )
|
|
|
|
|
{
|
|
|
|
|
if ( !empty($replace_existing) )
|
|
|
|
|
{
|
|
|
|
|
$sql = "UPDATE " . SMILIES_TABLE . "
|
|
|
|
|
SET smile_url = '" . str_replace("\'", "''", $smile_data[0]) . "', emoticon = '" . str_replace("\'", "''", $smile_data[1]) . "'
|
|
|
|
|
WHERE code = '" . str_replace("\'", "''", $smile_data[$j]) . "'";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$sql = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon)
|
|
|
|
|
VALUES('" . str_replace("\'", "''", $smile_data[$j]) . "', '" . str_replace("\'", "''", $smile_data[0]) . "', '" . str_replace("\'", "''", $smile_data[1]) . "')";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $sql != '' )
|
|
|
|
|
{
|
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message_die(MESSAGE, $lang['smiley_import_success']);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Display the script to get the smile_pak cfg file...
|
|
|
|
|
//
|
|
|
|
|
$smile_paks_select = "<select name='smile_pak'><option value=''>" . $lang['Select_pak'] . "</option>";
|
|
|
|
|
|
|
|
|
|
foreach ( $smiley_paks as $key => $value )
|
|
|
|
|
{
|
|
|
|
|
if ( !empty($value) )
|
|
|
|
|
{
|
|
|
|
|
$smile_paks_select .= "<option>" . $value . "</option>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$smile_paks_select .= "</select>";
|
|
|
|
|
|
|
|
|
|
$hidden_vars = "<input type='hidden' name='mode' value='import'>";
|
|
|
|
|
|
|
|
|
|
$template->set_filenames(array(
|
|
|
|
|
"body" => "admin/smile_import_body.tpl")
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$template->assign_vars(array(
|
|
|
|
|
"L_SMILEY_TITLE" => $lang['smiley_title'],
|
|
|
|
|
"L_SMILEY_EXPLAIN" => $lang['smiley_import_inst'],
|
|
|
|
|
"L_SMILEY_IMPORT" => $lang['smiley_import'],
|
|
|
|
|
"L_SELECT_LBL" => $lang['choose_smile_pak'],
|
|
|
|
|
"L_IMPORT" => $lang['import'],
|
|
|
|
|
"L_CONFLICTS" => $lang['smile_conflicts'],
|
|
|
|
|
"L_DEL_EXISTING" => $lang['del_existing_smileys'],
|
|
|
|
|
"L_REPLACE_EXISTING" => $lang['replace_existing'],
|
|
|
|
|
"L_KEEP_EXISTING" => $lang['keep_existing'],
|
|
|
|
|
|
|
|
|
|
"S_SMILEY_ACTION" => append_sid("admin_smilies.$phpEx"),
|
|
|
|
|
"S_SMILE_SELECT" => $smile_paks_select,
|
|
|
|
|
"S_HIDDEN_FIELDS" => $hidden_vars)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$template->pparse("body");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( isset($HTTP_POST_VARS['export_pack']) || isset($HTTP_GET_VARS['export_pack']) )
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Export our smiley config as a smiley pak...
|
|
|
|
|
//
|
|
|
|
|
if ( $HTTP_GET_VARS['export_pack'] == "send" )
|
|
|
|
|
{
|
|
|
|
|
$sql = "SELECT *
|
|
|
|
|
FROM " . SMILIES_TABLE;
|
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
|
|
$resultset = $db->sql_fetchrowset($result);
|
|
|
|
|
|
|
|
|
|
$smile_pak = '';
|
|
|
|
|
for($i = 0; $i < count($resultset); $i++ )
|
|
|
|
|
{
|
|
|
|
|
$smile_pak .= $resultset[$i]['smile_url'] . $delimeter;
|
|
|
|
|
$smile_pak .= $resultset[$i]['emoticon'] . $delimeter;
|
|
|
|
|
$smile_pak .= $resultset[$i]['code'] . "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header("Content-Type: text/x-delimtext; name=\"smiles.pak\"");
|
|
|
|
|
header("Content-disposition: attachment; filename=smiles.pak");
|
|
|
|
|
|
|
|
|
|
echo $smile_pak;
|
|
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message_die(MESSAGE, sprintf($lang['export_smiles'], '<a href="' . "admin_smilies.$phpEx$SID&export_pack=send" . '">', '</a>'));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if( isset($HTTP_POST_VARS['add']) )
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Admin has selected to add a smiley.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
$template->set_filenames(array(
|
|
|
|
|
"body" => "admin/smile_edit_body.tpl")
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$filename_list = "";
|
|
|
|
|
for( $i = 0; $i < count($smiley_images); $i++ )
|
|
|
|
|
{
|
|
|
|
|
$filename_list .= '<option value="' . $smiley_images[$i] . '">' . $smiley_images[$i] . '</option>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$s_hidden_fields = '<input type="hidden" name="mode" value="savenew" />';
|
|
|
|
|
|
|
|
|
|
$template->assign_vars(array(
|
|
|
|
|
"L_SMILEY_TITLE" => $lang['smiley_title'],
|
|
|
|
|
"L_SMILEY_CONFIG" => $lang['smiley_config'],
|
|
|
|
|
"L_SMILEY_EXPLAIN" => $lang['smiley_instr'],
|
|
|
|
|
"L_SMILEY_CODE" => $lang['smiley_code'],
|
|
|
|
|
"L_SMILEY_URL" => $lang['smiley_url'],
|
|
|
|
|
"L_SMILEY_EMOTION" => $lang['smiley_emot'],
|
|
|
|
|
"L_SUBMIT" => $lang['Submit'],
|
|
|
|
|
"L_RESET" => $lang['Reset'],
|
|
|
|
|
|
|
|
|
|
"SMILEY_IMG" => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smiley_images[0],
|
|
|
|
|
|
|
|
|
|
"S_SMILEY_ACTION" => append_sid("admin_smilies.$phpEx"),
|
|
|
|
|
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
|
|
|
|
"S_FILENAME_OPTIONS" => $filename_list,
|
|
|
|
|
"S_SMILEY_BASEDIR" => $phpbb_root_path . $board_config['smilies_path'])
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$template->pparse("body");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
switch( $mode )
|
|
|
|
|
{
|
|
|
|
|
case 'delete':
|
|
|
|
|
|
|
|
|
|
$smiley_id = ( !empty($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : intval($HTTP_GET_VARS['id']);
|
|
|
|
|
|
|
|
|
|
$sql = "DELETE FROM " . SMILIES_TABLE . "
|
|
|
|
|
WHERE smilies_id = " . $smiley_id;
|
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
|
|
|
|
|
message_die(GENERAL_MESSAGE, $lang['smiley_del_success']);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'edit':
|
|
|
|
|
|
|
|
|
|
$smiley_id = ( !empty($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : intval($HTTP_GET_VARS['id']);
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
|
|
|
FROM " . SMILIES_TABLE . "
|
|
|
|
|
WHERE smilies_id = " . $smiley_id;
|
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
|
|
$smile_data = $db->sql_fetchrow($result);
|
|
|
|
|
|
|
|
|
|
$filename_list = "";
|
|
|
|
|
for( $i = 0; $i < count($smiley_images); $i++ )
|
|
|
|
|
{
|
|
|
|
|
// $selected =
|
|
|
|
|
if( $smiley_images[$i] == $smile_data['smile_url'] )
|
|
|
|
|
{
|
|
|
|
|
$smiley_selected = "selected=\"selected\"";
|
|
|
|
|
$smiley_edit_img = $smiley_images[$i];
|
|
|
|
|
$size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_url);
|
|
|
|
|
$smile_width = (!empty($size[0])) ? $size[0] : 15;
|
|
|
|
|
$smile_height = (!empty($size[1])) ? $size[1] : 15;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$smiley_selected = "";
|
|
|
|
|
$smile_width = $smile_data[3];
|
|
|
|
|
$smile_height = $smile_data[4];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$filename_list .= '<option value="' . $smiley_images[$i] . '"' . $smiley_selected . '>' . $smiley_images[$i] . '</option>';
|
|
|
|
|
if (!empty($smilies[$code]))
|
|
|
|
|
{
|
|
|
|
|
if (!empty($HTTP_POST_VARS['replace_existing']))
|
|
|
|
|
{
|
|
|
|
|
$code_sql = str_replace("'", "''", str_replace('\\', '\\\\', $code));
|
|
|
|
|
$sql = array(
|
|
|
|
|
'smile_url' => $smile_url,
|
|
|
|
|
'smile_height' => $smile_height,
|
|
|
|
|
'smile_width' => $smile_width,
|
|
|
|
|
'emoticon' => $emotion
|
|
|
|
|
);
|
|
|
|
|
$db->sql_query_array('UPDATE ' . SMILIES_TABLE . " SET WHERE code = '$code_sql'", $sql);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$sql = array(
|
|
|
|
|
'code' => $code,
|
|
|
|
|
'smile_url' => $smile_url,
|
|
|
|
|
'smile_height' => $smile_height,
|
|
|
|
|
'smile_width' => $smile_width,
|
|
|
|
|
'emoticon' => $emotion
|
|
|
|
|
);
|
|
|
|
|
$db->sql_query_array('INSERT INTO ' . SMILIES_TABLE, $sql);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$template->set_filenames(array(
|
|
|
|
|
"body" => "admin/smile_edit_body.tpl")
|
|
|
|
|
message_die(MESSAGE, $lang['Smilies_import_success'] . $click_return);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!count($smilies_paks))
|
|
|
|
|
{
|
|
|
|
|
$smilies_paks_select = $lang['No_smilies_pak'];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$smilies_paks_select = '<select name="smilies_pak">';
|
|
|
|
|
|
|
|
|
|
foreach ($smilies_paks as $pak)
|
|
|
|
|
{
|
|
|
|
|
$smilies_paks_select .= '<option>' . htmlspecialchars($pak) . '</option>';
|
|
|
|
|
}
|
|
|
|
|
$smilies_paks_select .= '</select>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
page_header($lang['Import_smilies']);
|
|
|
|
|
?>
|
|
|
|
|
<h1><?php echo $lang['Import_smilies'] ?></h1>
|
|
|
|
|
|
|
|
|
|
<p><?php echo $lang['Import_smilies_explain'] ?></p>
|
|
|
|
|
|
|
|
|
|
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>"><table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
|
|
|
<tr>
|
|
|
|
|
<th class="thHead" colspan="2"><?php echo $lang['Smilies_import'] ?></th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2"><?php echo $lang['Select_package'] ?></td>
|
|
|
|
|
<td class="row2"><?php echo $smilies_paks_select ?></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row1"><?php echo $lang['Delete_existing_smilies'] ?></td>
|
|
|
|
|
<td class="row1"><input type="checkbox" name="clear_current" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2" colspan="2" align="center"><?php echo $lang['Smilies_conflicts'] ?><br />
|
|
|
|
|
<table align="center" border="0"><tr><td>
|
|
|
|
|
<input type="radio" name="replace_existing" value="1" checked="checked" /> <?php echo $lang['Replace_existing_smilies'] ?> <br />
|
|
|
|
|
<input type="radio" name="replace_existing" value="0" /> <?php echo $lang['Keep_existing_smilies'] ?> </td></tr></table>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="catBottom" colspan="2" align="center"><input class="mainoption" name="import_pak" type="submit" value="<?php echo $lang['Import_smilies'] ?>" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table></form>
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
page_footer();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
elseif (isset($HTTP_GET_VARS['export_pak']))
|
|
|
|
|
{
|
|
|
|
|
$smilies_pak = '';
|
|
|
|
|
|
|
|
|
|
$result = $db->sql_query('SELECT * FROM ' . SMILIES_TABLE);
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
|
{
|
|
|
|
|
$smilies_pak .= $row['smile_url'] . $delimiter;
|
|
|
|
|
$smilies_pak .= $row['emoticon'] . $delimiter;
|
|
|
|
|
$smilies_pak .= $row['code'] . $delimiter;
|
|
|
|
|
$smilies_pak .= $row['smile_height'] . $delimiter;
|
|
|
|
|
$smilies_pak .= $row['smile_width'] . "\n";
|
|
|
|
|
}
|
|
|
|
|
$db->sql_close();
|
|
|
|
|
|
|
|
|
|
header('Content-Type: text/x-delimtext; name="smilies.pak"');
|
|
|
|
|
header('Content-disposition: attachment; filename=smilies.pak"');
|
|
|
|
|
|
|
|
|
|
echo $smilies_pak;
|
|
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
elseif (isset($HTTP_POST_VARS['export_pak']))
|
|
|
|
|
{
|
|
|
|
|
page_header($lang['Export_smilies']);
|
|
|
|
|
message_die(MESSAGE, sprintf($lang['Export_smilies_explain'], '<a href="admin_smilies.' . $phpEx . $SID . '&export_pak=send">', '</a>') . $click_return);
|
|
|
|
|
}
|
|
|
|
|
elseif (isset($HTTP_POST_VARS['add']))
|
|
|
|
|
{
|
|
|
|
|
$filename_list = '';
|
|
|
|
|
foreach ($smilies_images as $smile_url)
|
|
|
|
|
{
|
|
|
|
|
if (!isset($default_image))
|
|
|
|
|
{
|
|
|
|
|
$default_image = $smile_url;
|
|
|
|
|
}
|
|
|
|
|
$filename_list .= '<option value="' . $smile_url . '">' . htmlspecialchars($smile_url) . '</option>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
page_header($lang['Add_smile']);
|
|
|
|
|
?>
|
|
|
|
|
<h1><?php echo $lang['Add_smile'] ?></h1>
|
|
|
|
|
|
|
|
|
|
<script language="javascript" type="text/javascript" defer="defer">
|
|
|
|
|
<!--
|
|
|
|
|
function update_smile(newimage)
|
|
|
|
|
{
|
|
|
|
|
document.smile_image.src = "<?php echo $phpbb_root_path . $board_config['smilies_path'] ?>/" + newimage;
|
|
|
|
|
}
|
|
|
|
|
function update_smile_dimensions()
|
|
|
|
|
{
|
|
|
|
|
document.forms[0].smile_height.value = document.smile_image.height;
|
|
|
|
|
document.forms[0].smile_width.value = document.smile_image.width;
|
|
|
|
|
}
|
|
|
|
|
<?php echo (!empty($default_image)) ? 'update_smile("' . $default_image . '");' : '' ?>
|
|
|
|
|
//-->
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&mode=create"><table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
|
|
|
<tr>
|
|
|
|
|
<th class="thHead" colspan="2"><?php echo $lang['smile_config'] ?></th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2"><?php echo $lang['Smile_code'] ?></td>
|
|
|
|
|
<td class="row2"><input type="text" name="smile_code" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row1"><?php echo $lang['Smile_url'] ?></td>
|
|
|
|
|
<td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> <img name="smile_image" src="../images/spacer.gif" border="0" alt="" onLoad="update_smile_dimensions()" /> </td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2"><?php echo $lang['Smile_width'] ?></td>
|
|
|
|
|
<td class="row2"><input type="text" size="4" name="smile_width" value="0" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row1"><?php echo $lang['Smile_height'] ?></td>
|
|
|
|
|
<td class="row1"><input type="text" size="4" name="smile_height" value="0" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2"><?php echo $lang['Smile_emotion'] ?></td>
|
|
|
|
|
<td class="row2"><input type="text" name="smile_emotion" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="catBottom" colspan="2" align="center"><input class="mainoption" type="submit" value="<?php echo $lang['Submit'] ?>" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table></form>
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
page_footer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch ($mode)
|
|
|
|
|
{
|
|
|
|
|
case 'delete':
|
|
|
|
|
$db->sql_query('DELETE FROM ' . SMILIES_TABLE . ' WHERE smilies_id = ' . intval($HTTP_GET_VARS['smile_id']));
|
|
|
|
|
message_die(MESSAGE, $lang['Smile_deleted'] . $click_return);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'edit':
|
|
|
|
|
$smile_id = intval($HTTP_GET_VARS['smile_id']);
|
|
|
|
|
|
|
|
|
|
$sql = 'SELECT *
|
|
|
|
|
FROM ' . SMILIES_TABLE . "
|
|
|
|
|
WHERE smilies_id = $smile_id";
|
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
$smile_data = $db->sql_fetchrow($result);
|
|
|
|
|
|
|
|
|
|
$filename_list = '';
|
|
|
|
|
foreach ($smilies_images as $smile_url)
|
|
|
|
|
{
|
|
|
|
|
if ($smile_url == $smile_data['smile_url'])
|
|
|
|
|
{
|
|
|
|
|
$smile_selected = ' selected="selected"';
|
|
|
|
|
$smile_edit_img = $smile_url;;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$smile_selected = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$filename_list .= '<option value="' . $smile_url . '"' . htmlspecialchars($smile_url) . $smile_selected . '>' . $smile_url . '</option>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
page_header($lang['Edit_smile']);
|
|
|
|
|
?>
|
|
|
|
|
<h1><?php echo $lang['Edit_smile'] ?></h1>
|
|
|
|
|
|
|
|
|
|
<script language="javascript" type="text/javascript" defer="defer">
|
|
|
|
|
<!--
|
|
|
|
|
function update_smile(newimage)
|
|
|
|
|
{
|
|
|
|
|
document.smile_image.src = "<?php echo $phpbb_root_path . $board_config['smilies_path'] ?>/" + newimage;
|
|
|
|
|
}
|
|
|
|
|
function update_smile_dimensions()
|
|
|
|
|
{
|
|
|
|
|
if (document.smile_image.height)
|
|
|
|
|
{
|
|
|
|
|
document.forms[0].smile_height.value = document.smile_image.height;
|
|
|
|
|
document.forms[0].smile_width.value = document.smile_image.width;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//-->
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&mode=modify"><table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
|
|
|
<tr>
|
|
|
|
|
<th class="thHead" colspan="2"><?php echo $lang['smile_config'] ?></th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2"><?php echo $lang['Smile_code'] ?></td>
|
|
|
|
|
<td class="row2"><input type="text" name="smile_code" value="<?php echo $smile_data['code'] ?>" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row1"><?php echo $lang['Smile_url'] ?></td>
|
|
|
|
|
<td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> <img name="smile_image" src="<?php echo $phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_edit_img ?>" border="0" alt="" onLoad="update_smile_dimensions()" /> </td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2"><?php echo $lang['Smile_emotion'] ?></td>
|
|
|
|
|
<td class="row2"><input type="text" name="smile_emotion" value="<?php echo $smile_data['emoticon'] ?>" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row1"><?php echo $lang['Smile_width'] ?></td>
|
|
|
|
|
<td class="row1"><input type="text" size="3" name="smile_width" value="<?php echo $smile_data['smile_width'] ?>" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="row2"><?php echo $lang['Smile_height'] ?></td>
|
|
|
|
|
<td class="row2"><input type="text" size="3" name="smile_height" value="<?php echo $smile_data['smile_height'] ?>" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="catBottom" colspan="2" align="center"><input type="hidden" name="smile_id" value="<?php echo $smile_data['smilies_id'] ?>" /><input class="mainoption" type="submit" value="<?php echo $lang['Submit'] ?>" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table></form>
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
page_footer();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'create':
|
|
|
|
|
case 'modify':
|
|
|
|
|
|
|
|
|
|
$sql = array(
|
|
|
|
|
'code' => htmlspecialchars(stripslashes($HTTP_POST_VARS['smile_code'])),
|
|
|
|
|
'smile_url' => stripslashes($HTTP_POST_VARS['smile_url']),
|
|
|
|
|
'smile_height' => intval($HTTP_POST_VARS['smile_height']),
|
|
|
|
|
'smile_width' => intval($HTTP_POST_VARS['smile_width']),
|
|
|
|
|
'emoticon' => stripslashes($HTTP_POST_VARS['smile_emotion'])
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="smile_id" value="' . $smile_data['smilies_id'] . '" />';
|
|
|
|
|
|
|
|
|
|
$template->assign_vars(array(
|
|
|
|
|
"SMILEY_CODE" => $smile_data['code'],
|
|
|
|
|
"SMILEY_EMOTICON" => $smile_data['emoticon'],
|
|
|
|
|
|
|
|
|
|
"L_SMILEY_TITLE" => $lang['smiley_title'],
|
|
|
|
|
"L_SMILEY_CONFIG" => $lang['smiley_config'],
|
|
|
|
|
"L_SMILEY_EXPLAIN" => $lang['smile_desc'],
|
|
|
|
|
"L_SMILEY_CODE" => $lang['smiley_code'],
|
|
|
|
|
"L_SMILEY_URL" => $lang['smiley_url'],
|
|
|
|
|
"L_SMILEY_EMOTION" => $lang['smiley_emot'],
|
|
|
|
|
"L_SUBMIT" => $lang['Submit'],
|
|
|
|
|
"L_RESET" => $lang['Reset'],
|
|
|
|
|
|
|
|
|
|
"SMILEY_IMG" => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smiley_edit_img,
|
|
|
|
|
|
|
|
|
|
"S_SMILEY_ACTION" => append_sid("admin_smilies.$phpEx"),
|
|
|
|
|
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
|
|
|
|
"S_FILENAME_OPTIONS" => $filename_list,
|
|
|
|
|
"S_SMILEY_BASEDIR" => $phpbb_root_path . $board_config['smilies_path'])
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$template->pparse("body");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'save':
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Get the submitted data, being careful to ensure that we only
|
|
|
|
|
// accept the data we are looking for.
|
|
|
|
|
//
|
|
|
|
|
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? $HTTP_POST_VARS['smile_code'] : $HTTP_GET_VARS['smile_code'];
|
|
|
|
|
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? $HTTP_POST_VARS['smile_url'] : $HTTP_GET_VARS['smile_url'];
|
|
|
|
|
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? $HTTP_POST_VARS['smile_emotion'] : $HTTP_GET_VARS['smile_emotion'];
|
|
|
|
|
$smile_id = ( isset($HTTP_POST_VARS['smile_id']) ) ? intval($HTTP_POST_VARS['smile_id']) : intval($HTTP_GET_VARS['smile_id']);
|
|
|
|
|
|
|
|
|
|
$smile_code = htmlspecialchars($smile_code);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Proceed with updating the smiley table.
|
|
|
|
|
//
|
|
|
|
|
$sql = "UPDATE " . SMILIES_TABLE . "
|
|
|
|
|
SET code = '" . str_replace("\'", "''", $smile_code) . "', smile_url = '" . str_replace("\'", "''", $smile_url) . "', emoticon = '" . str_replace("\'", "''", $smile_emotion) . "'
|
|
|
|
|
WHERE smilies_id = $smile_id";
|
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
|
|
|
|
|
message_die(MESSAGE, $lang['smiley_edit_success']);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'savenew':
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Get the submitted data being careful to ensure the the data
|
|
|
|
|
// we recieve and process is only the data we are looking for.
|
|
|
|
|
//
|
|
|
|
|
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? $HTTP_POST_VARS['smile_code'] : $HTTP_GET_VARS['smile_code'];
|
|
|
|
|
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? $HTTP_POST_VARS['smile_url'] : $HTTP_GET_VARS['smile_url'];
|
|
|
|
|
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? $HTTP_POST_VARS['smile_emotion'] : $HTTP_GET_VARS['smile_emotion'];
|
|
|
|
|
|
|
|
|
|
$smile_code = htmlspecialchars($smile_code);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Save the data to the smiley table.
|
|
|
|
|
//
|
|
|
|
|
$sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon)
|
|
|
|
|
VALUES ('" . str_replace("\'", "''", $smile_code) . "', '" . str_replace("\'", "''", $smile_url) . "', '" . str_replace("\'", "''", $smile_emotion) . "')";
|
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
|
|
|
|
|
message_die(MESSAGE, $lang['smiley_add_success']);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if ($mode == 'modify')
|
|
|
|
|
{
|
|
|
|
|
$db->sql_query_array('UPDATE ' . SMILIES_TABLE . ' SET WHERE smilies_id = ' . $HTTP_POST_VARS['smile_id'], $sql);
|
|
|
|
|
message_die(MESSAGE, $lang['Smile_edited'] . $click_return);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$db->sql_query_array('INSERT INTO ' . SMILIES_TABLE, $sql);
|
|
|
|
|
message_die(MESSAGE, $lang['Smile_added'] . $click_return);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
|
|
|
FROM " . SMILIES_TABLE;
|
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
|
|
$result = $db->sql_query('SELECT * FROM ' . SMILIES_TABLE);
|
|
|
|
|
page_header($lang['Emoticons']);
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<h1><?php echo $lang['Emoticons']; ?></h1>
|
|
|
|
|
|
|
|
|
|
<p><?php echo $lang['Emoticons_explain']; ?></p>
|
|
|
|
|
|
|
|
|
|
<form method="post" action="<?php echo "admin_smilies.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
|
|
|
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
|
|
|
<tr>
|
|
|
|
|
<th><?php echo $lang['Code']; ?></th>
|
|
|
|
|
<th><?php echo $lang['Smile']; ?></th>
|
|
|
|
@@ -427,7 +442,7 @@ switch( $mode )
|
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
if ( $row = $db->sql_fetchrow($result) )
|
|
|
|
|
if ($row = $db->sql_fetchrow($result))
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
@@ -438,8 +453,8 @@ switch( $mode )
|
|
|
|
|
<td class="<?php echo $row_class; ?>" align="center"><?php echo htmlspecialchars($row['code']); ?></td>
|
|
|
|
|
<td class="<?php echo $row_class; ?>" align="center"><img src="<?php echo './../' . $board_config['smilies_path'] . '/' . $row['smile_url']; ?>" width="<?php echo $row['smile_width']; ?>" height="<?php echo $row['smile_height']; ?>" alt="<?php echo htmlspecialchars($row['code']); ?>" /></td>
|
|
|
|
|
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['emoticon']; ?></td>
|
|
|
|
|
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=edit&id=" . $row['smilies_id']; ?>"><?php echo $lang['Edit']; ?></a></td>
|
|
|
|
|
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=delete&id=" . $row['smilies_id']; ?>"><?php echo $lang['Delete']; ?></a></td>
|
|
|
|
|
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=edit&smile_id=" . $row['smilies_id']; ?>"><?php echo $lang['Edit']; ?></a></td>
|
|
|
|
|
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=delete&smile_id=" . $row['smilies_id']; ?>"><?php echo $lang['Delete']; ?></a></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
@@ -449,7 +464,7 @@ switch( $mode )
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="cat" colspan="5" align="center"><input type="submit" name="add" value="<?php echo $lang['smile_add']; ?>" class="mainoption" /> <input class="liteoption" type="submit" name="import_pack" value="<?php echo $lang['import_smile_pack']; ?>"> <input class="liteoption" type="submit" name="export_pack" value="<?php echo $lang['export_smile_pack']; ?>"></td>
|
|
|
|
|
<td class="cat" colspan="5" align="center"><input type="submit" name="add" value="<?php echo $lang['Add_smile']; ?>" class="mainoption" /> <input class="liteoption" type="submit" name="import_pak" value="<?php echo $lang['Import_smilies']; ?>"> <input class="liteoption" type="submit" name="export_pak" value="<?php echo $lang['Export_smilies']; ?>"></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table></form>
|
|
|
|
|
|
|
|
|
@@ -459,5 +474,4 @@ switch( $mode )
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|