diff --git a/e107_admin/emoticon.php b/e107_admin/emoticon.php index 72776efb1..918f7e08a 100644 --- a/e107_admin/emoticon.php +++ b/e107_admin/emoticon.php @@ -1,20 +1,18 @@ db_Count("core", "(*)", "WHERE e107_name = 'emote_default'")) { // Set up the default emotes @@ -38,14 +38,19 @@ if(!$sql->db_Count("core", "(*)", "WHERE e107_name = 'emote_default'")) // Change the active emote pack if (isset($_POST['active'])) { -if ($pref['smiley_activate'] != $_POST['smiley_activate']) -{ - $pref['smiley_activate'] = $_POST['smiley_activate']; - $admin_log->log_event($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03',$pref['emotepack'],E_LOG_INFORMATIVE,''); - save_prefs(); - $update = true; - } - admin_update($update); + if ($pref['smiley_activate'] != $_POST['smiley_activate']) + { + $pref['smiley_activate'] = $_POST['smiley_activate']; + $admin_log->log_event($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03', $pref['emotepack'], E_LOG_INFORMATIVE, ''); + save_prefs(); + $update = true; + $emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS); + } + else + { + $emessage->add(LAN_NO_CHANGE); + } + } @@ -92,7 +97,7 @@ foreach($_POST as $key => $value) $check = TRUE; //$check = $emote -> installCheck(); -$check = $emote -> installCheck($one_pack); +$check = $emote->installCheck($one_pack); if($check!==FALSE) { $emote -> listPacks(); @@ -120,38 +125,68 @@ class emotec // List available emote packs function listPacks() { - global $ns, $fl, $pref; - - $text = "
-
- - - - - - - - - -
".EMOLAN_4.": ".($pref['smiley_activate'] ? "" : "")."
- -
-
-
- "; - - $ns -> tablerender(EMOLAN_1, $text); - + global $e107, $emessage, $fl, $pref; $text = " +
+
- - - - - - - "; +
+ ".EMOLAN_1." +
".EMOLAN_2."".EMOLAN_3."".EMOLAN_8."".EMOLAN_9."
+ + + + + + + + + + +
+ ".EMOLAN_4.": + +
+ +
+
+
+ +
+ +
+ + + "; + + //$e107->ns -> tablerender(EMOLAN_1, $text); + + + $text .= " +
+
+ ".EMOLAN_13." + + + + + + + + + + + + + + + + + "; $reject = '~^emoteconf|\.html$|\.php$|\.txt$'; // Files to exclude foreach($this -> packArray as $pack) @@ -173,66 +208,85 @@ class emotec { $can_scan = TRUE; // Allow re-scan of config files } -// elseif (!strstr($emote['fname'], ".txt") && !strstr($emote['fname'], ".bak") && !strstr($emote['fname'], ".html") && !strstr($emote['fname'], ".php") ) + //elseif (!strstr($emote['fname'], ".txt") && !strstr($emote['fname'], ".bak") && !strstr($emote['fname'], ".html") && !strstr($emote['fname'], ".php") ) else { // Emote file found (might get other non-image files, but shouldn't) $text .= " "; } } - $text .= " - - + + "; + $text .= " +

+ + "; + $text .= " + + + "; } $text .= " -
".EMOLAN_2."".EMOLAN_3."".EMOLAN_8."".EMOLAN_9."
".($pref['emotepack'] == $pack ? EMOLAN_10 : "")." - "; + $text .= " + ".($pref['emotepack'] == $pack ? EMOLAN_10 : "")." + + "; if ($can_scan && ($pack != 'default')) { - $text .= "

"; + $text .= " +

+ + "; } - $text .= "

"; - $text .= "
- - "; - $ns -> tablerender(EMOLAN_13, $text); + + +
+ +
+ "; + + $e107->ns->tablerender(EMOLAN_13, $emessage->render().$text); } // Configure an individual emote pack function emoteConf($packID) { - global $ns, $fl, $pref, $sysprefs, $tp; + global $e107, $fl, $sysprefs, $tp; $corea = "emote_".$packID; $emotecode = $sysprefs -> getArray($corea); -// $reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$'); $reject = '~^emoteconf|\.html$|\.php$|\.txt$|\.pak$|\.xml|\.phpBB'; // Files to exclude $emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, $reject); $eArray = array(); foreach($emoteArray as $value) { -/* if(!strstr($value['fname'], ".php") - && !strstr($value['fname'], ".txt") - && !strstr($value['fname'], ".pak") && !strstr($value['fname'], ".bak") - && !strstr($value['fname'], ".xml") - && !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html")) */ - { $eArray[] = array('path' => $value['path'], 'fname' => $value['fname']); - } } + //XXX Not sure if we need to know rhe number of files found - count($eArray) -
Total ".count($eArray)." files found
$text = "
- - - - - - +
+ ".EMOLAN_15." +
Total ".count($eArray)." files found
+
".EMOLAN_2."".EMOLAN_5."".EMOLAN_6." ( ".EMOLAN_7." )
+ + + + + + + + + + + + + "; foreach($eArray as $emote) @@ -244,38 +298,41 @@ class emotec if (!isset($emotecode[$evalue])) { - $file_back = ' background-color: #FF8000;'; + $file_back = '  Emote not set'; } elseif (!$emotecode[$evalue]) { - $text_back = ' background-color: #FF8000'; + $text_back = '  Empty value'; } $text .= " - - - - - + + + + + "; } - + $text .= " - - - - - -
".EMOLAN_5."".EMOLAN_2."".EMOLAN_6." ( ".EMOLAN_7." )
".$ename."
".$ename."{$file_back} + {$text_back} +
".count($eArray)." files
- -
"; - $ns -> tablerender(EMOLAN_15.": '".$packID."'", $text); + + +
+ + +
+ + "; + + $e107->ns->tablerender(EMOLAN_15.": '".$packID."'", $text); } // Generate an XML file - packname.xml in root emoticon directory function emoteXML($packID, $strip_xtn = TRUE) { - global $fl, $pref, $sysprefs, $tp; + global $fl, $sysprefs, $tp; $fname = e_IMAGE."emotes/".$packID."/emoticons.xml"; $backname = e_IMAGE."emotes/".$packID."/emoticons.bak"; @@ -283,21 +340,13 @@ class emotec $corea = "emote_".$packID; $emotecode = $sysprefs -> getArray($corea); -// $reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$'); $reject = '~^emoteconf|\.html$|\.php$|\.txt$|\.pak$|\.xml|\.phpBB'; // Files to exclude $emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, $reject); $eArray = array(); foreach($emoteArray as $value) { -/* if(!strstr($value['fname'], ".php") - && !strstr($value['fname'], ".txt") - && !strstr($value['fname'], ".pak") && !strstr($value['fname'], ".bak") - && !strstr($value['fname'], ".xml") - && !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html")) */ - { $eArray[] = $value['fname']; - } } $f_string = "\n\n\n\n"; @@ -305,14 +354,14 @@ class emotec foreach($eArray as $emote) { // Optionally strip file extension - $evalue = str_replace(".", "!", $emote); - if ($strip_xtn) $ename = substr($emote,0,strrpos($emote,'.')); - $f_string .= "\n"; - foreach (explode(' ',$tp -> toForm($emotecode[$evalue])) as $v) - { - if (trim($v)) $f_string .= "\t{$v}\n"; - } - $f_string .= "\n"; + $evalue = str_replace(".", "!", $emote); + if ($strip_xtn) $ename = substr($emote,0,strrpos($emote,'.')); + $f_string .= "\n"; + foreach (explode(' ',$tp -> toForm($emotecode[$evalue])) as $v) + { + if (trim($v)) $f_string .= "\t{$v}\n"; + } + $f_string .= "\n"; } $f_string .= "\n\n"; @@ -320,6 +369,7 @@ class emotec if (is_file($backname)) unlink($backname); // Delete any old backup if (is_file($fname)) rename($fname,$backname); + //XXX message handler if (file_put_contents($fname,$f_string) === FALSE) { echo "
".EMOLAN_30."".$fname."

"; @@ -334,20 +384,20 @@ class emotec // Save configuration for an emote pack that's been edited function saveConf() { - global $ns, $sql, $tp; + global $sql, $tp; $packID = $_POST['packID']; unset($_POST['sub_conf'], $_POST['packID']); - $encoded_emotes = $tp -> toDB($_POST); + $encoded_emotes = $tp->toDB($_POST); $tmp = addslashes(serialize($encoded_emotes)); if ($sql->db_Select("core", "*", "e107_name='emote_".$packID."'")) { - admin_update($sql->db_Update("core", "`e107_value`='{$tmp}' WHERE `e107_name`='emote_".$packID."' "), 'update', EMOLAN_16); + admin_update($sql->db_Update("core", "`e107_value`='{$tmp}' WHERE `e107_name`='emote_".$packID."' "), 'update', EMOLAN_16); } else { - admin_update($sql->db_Insert("core", "'emote_".$packID."', '$tmp' "), 'insert', EMOLAN_16); + admin_update($sql->db_Insert("core", "'emote_".$packID."', '$tmp' "), 'insert', EMOLAN_16); } } @@ -374,7 +424,7 @@ class emotec { // Highlight any directory names containing spaces - not allowed global $ns; $msg = " -
".EMOLAN_17."
".EMOLAN_18."


+
".EMOLAN_17."
".EMOLAN_18."
@@ -382,7 +432,7 @@ class emotec - +
".EMOLAN_19."
".$value."".e_IMAGE."emotes/".e_IMAGE_ABS."emotes/
"; @@ -591,5 +641,23 @@ class emotec } require_once("footer.php"); +/** + * Handle page DOM within the page header + * + * @return string JS source + */ +function headerjs() +{ + require_once(e_HANDLER.'js_helper.php'); + //FIXME - how exactly to auto-call JS lan? This and more should be solved in Stage II. + $ret = " + + + "; -?> + return $ret; +} +?> \ No newline at end of file diff --git a/e107_admin/header.php b/e107_admin/header.php index 55447f4fd..ba37d3b74 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -12,9 +12,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $ -| $Revision: 1.19 $ -| $Date: 2008-11-14 06:01:06 $ -| $Author: e107coders $ +| $Revision: 1.20 $ +| $Date: 2008-12-14 21:01:58 $ +| $Author: secretr $ +---------------------------------------------------------------+ */ @@ -442,26 +442,43 @@ if (!function_exists("parse_admin")) { } function admin_update($update, $type = 'update', $success = false, $failed = false) { - global $ns; + global $e107; + require_once(e_HANDLER."message_handler.php"); + $emessage = &eMessage::getInstance(); + if (($type == 'update' && $update) || ($type == 'insert' && $update !== false)) { - $caption = LAN_UPDATE; - $text = "".($success ? $success : LAN_UPDATED).""; - } else if ($type == 'delete' && $update) { - $caption = LAN_DELETE; - $text = "".($success ? $success : LAN_DELETED).""; - } else if (!mysql_errno()) { - if ($type == 'update') { - $caption = LAN_UPDATED_FAILED; - $text = "".LAN_NO_CHANGE."
".LAN_TRY_AGAIN."
"; - } else if ($type == 'delete') { - $caption = LAN_DELETE; - $text = "".LAN_DELETED_FAILED.".
".LAN_TRY_AGAIN."
"; + //$caption = LAN_UPDATE; + //$text = "".($success ? $success : LAN_UPDATED).""; + $emessage->add(($success ? $success : LAN_UPDATED), E_MESSAGE_SUCCESS); + } + elseif ($type == 'delete' && $update) + { + //$caption = LAN_DELETE; + //$text = "".($success ? $success : LAN_DELETED).""; + $emessage->add(($success ? $success : LAN_DELETED), E_MESSAGE_SUCCESS); + } + elseif (!mysql_errno()) + { + if ($type == 'update') + { + //$caption = LAN_UPDATED_FAILED; + //$text = "".LAN_NO_CHANGE."
".LAN_TRY_AGAIN."
"; + $emessage->add(LAN_NO_CHANGE.' '.LAN_TRY_AGAIN, E_MESSAGE_INFO); + } elseif ($type == 'delete') + { + //$caption = LAN_DELETE; + //$text = "".LAN_DELETED_FAILED.".
".LAN_TRY_AGAIN."
"; + $emessage->add(LAN_DELETED_FAILED.' '.LAN_TRY_AGAIN, E_MESSAGE_INFO); } - } else { - $caption = LAN_UPDATED_FAILED; - $text = "".($failed ? $failed : LAN_UPDATED_FAILED." - ".LAN_TRY_AGAIN)."
".LAN_ERROR." ".mysql_errno().": ".mysql_error(); + } + else + { + //$caption = LAN_UPDATED_FAILED; + $text = ($failed ? $failed : LAN_UPDATED_FAILED." - ".LAN_TRY_AGAIN)."
".LAN_ERROR." ".mysql_errno().": ".mysql_error(); + $emessage->add($text, E_MESSAGE_ERROR); } - $ns -> tablerender($caption, "
".$text."
"); + //$e107->ns->tablerender($caption, "
".$text."
"); + echo $emessage->render(); return $update; } diff --git a/e107_languages/English/admin/lan_emoticon.php b/e107_languages/English/admin/lan_emoticon.php index 3da74463e..ffa269ec2 100644 --- a/e107_languages/English/admin/lan_emoticon.php +++ b/e107_languages/English/admin/lan_emoticon.php @@ -1,14 +1,12 @@ \ No newline at end of file diff --git a/e107_languages/English/admin/lan_image.php b/e107_languages/English/admin/lan_image.php index 4069593ae..93922d25f 100644 --- a/e107_languages/English/admin/lan_image.php +++ b/e107_languages/English/admin/lan_image.php @@ -1,9 +1,10 @@