db_Count("core", "(*)", "e107_name = 'emote_default'"))
{
$tmp = 'a:28:{s:9:"alien!png";s:6:"!alien";s:10:"amazed!png";s:7:"!amazed";s:9:"angry!png";s:11:"!grr !angry";s:12:"biglaugh!png";s:4:"!lol";s:11:"cheesey!png";s:10:":D :oD :-D";s:12:"confused!png";s:10:":? :o? :-?";s:7:"cry!png";s:19:"&| &-| &o| :(( !cry";s:8:"dead!png";s:21:"x) xo) x-) x( xo( x-(";s:9:"dodge!png";s:6:"!dodge";s:9:"frown!png";s:10:":( :o( :-(";s:7:"gah!png";s:10:":@ :o@ :o@";s:8:"grin!png";s:10:":D :oD :-D";s:9:"heart!png";s:6:"!heart";s:8:"idea!png";s:10:":! :o! :-!";s:7:"ill!png";s:4:"!ill";s:7:"mad!png";s:13:"~:( ~:o( ~:-(";s:12:"mistrust!png";s:9:"!mistrust";s:11:"neutral!png";s:10:":| :o| :-|";s:12:"question!png";s:2:"?!";s:12:"rolleyes!png";s:10:"B) Bo) B-)";s:7:"sad!png";s:4:"!sad";s:10:"shades!png";s:10:"8) 8o) 8-)";s:7:"shy!png";s:4:"!shy";s:9:"smile!png";s:10:":) :o) :-)";s:11:"special!png";s:3:"%-6";s:12:"suprised!png";s:10:":O :oO :-O";s:10:"tongue!png";s:21:":p :op :-p :P :oP :-P";s:8:"wink!png";s:10:";) ;o) ;-)";}';
$sql->db_Insert("core", "'emote_default', '$tmp' ");
}
if (isset($_POST['active']))
{
if ($pref['smiley_activate'] != $_POST['smiley_activate']) {
$pref['smiley_activate'] = $_POST['smiley_activate'];
save_prefs();
$update = true;
}
admin_update($update);
}
/* get packs */
require_once(e_HANDLER."file_class.php");
$fl = new e_file;
$emote = new emotec;
foreach($_POST as $key => $value)
{
if(strstr($key, "subPack_"))
{
$subpack = str_replace("subPack_", "", $key);
$emote -> emoteConf($subpack);
break;
}
if(strstr($key, "defPack_"))
{
$pref['emotepack'] = str_replace("defPack_", "", $key);
save_prefs();
break;
}
}
$emote -> installCheck();
$emote -> listPacks();
class emotec
{
var $packArray;
function emotec()
{
/* constructor */
global $fl;
$this -> packArray = $fl -> get_dirs(e_IMAGE."emotes");
if(isset($_POST['sub_conf']))
{
$this -> saveConf();
}
}
function listPacks()
{
global $ns, $fl, $pref;
$text = "
";
$ns -> tablerender(EMOLAN_1, $text);
$text = "
";
$ns -> tablerender(EMOLAN_13, $text);
}
function emoteConf($packID)
{
global $ns, $fl, $pref, $sysprefs, $tp;
$corea = "emote_".$packID;
$emotecode = $sysprefs -> getArray($corea);
$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore');
$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'], ".xml") && !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html"))
{
$eArray[] = array('path' => $value['path'], 'fname' => $value['fname']);
}
}
$text = "
";
$ns -> tablerender(EMOLAN_15.": '".$packID."'", $text);
}
function saveConf()
{
global $ns, $sql, $tp;
$packID = $_POST['packID'];
unset($_POST['sub_conf'], $_POST['packID']);
foreach($_POST as $key => $value)
{
$key = str_replace("_", "!", $key);
$_POST[$key] = $value;
}
$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);
} else {
admin_update($sql->db_Insert("core", "'emote_".$packID."', '$tmp' "), 'insert', EMOLAN_16);
}
}
function installCheck()
{
global $sql, $fl;
foreach($this -> packArray as $value)
{
if(!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' "))
{
$fileArray = $fl -> get_files(e_IMAGE."emotes/".$value);
foreach($fileArray as $file)
{
if(strstr($file['fname'], ".xml"))
{
$confFile = array('file' => $file['fname'], 'type' => "xml");
}
else if(strstr($file['fname'], ".pak"))
{
$confFile = array('file' => $file['fname'], 'type' => "pak");
}
else if(strstr($file['fname'], ".php"))
{
$confFile = array('file' => $file['fname'], 'type' => "php");
}
}
/* .pak file ------------------------------------------------------------------------------------------------------------------------------------ */
if($confFile['type'] == "pak")
{
$filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
$pakconf = file ($filename);
$contentArray = array();
foreach($pakconf as $line)
{
if(trim($line) && strstr($line, "=+") && !strstr($line, ".txt") && !strstr($line, ".html") && !strstr($line, "cvs")) $contentArray[] = $line;
}
$confArray = array();
foreach($contentArray as $pakline)
{
$tmp = explode("=+:", $pakline);
$confIC = str_replace(".", "!", $tmp[0]);
$confArray[$confIC] = trim($tmp[2]);
}
$tmp = addslashes(serialize($confArray));
$sql->db_Insert("core", "'emote_".$value."', '$tmp' ");
echo "New emote pak found: ' ".$value."'
";
}
/* end ----------------------------------------------------------------------------------------------------------------------------------------- */
/* .xml file ------------------------------------------------------------------------------------------------------------------------------------ */
if($confFile['type'] == "xml")
{
$filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
$handle = fopen ($filename, "r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
preg_match_all("#\(.*?)\<\/emoticon\>#si", $contents, $match);
$confArray = array();
for($a=0; $a<=(count($match[0])); $a++)
{
preg_match_all("#\(.*?)\<\/string\>#si", $match[0][$a], $match2);
$codet = "";
foreach($match2[1] as $code)
{
$codet .= $code." ";
}
foreach($fileArray as $emote)
{
if(strstr($emote['fname'], $match[1][$a]))
{
$file = str_replace(".", "!", $emote['fname']);
}
}
$confArray[$file] = $codet;
}
$tmp = addslashes(serialize($confArray));
$sql->db_Insert("core", "'emote_".$value."', '$tmp' ");
echo "New emote xml pak found: ' ".$value."'
";
}
if($confFile['type'] == "php")
{
echo ".conf file found: installing '".$value."'
";
include_once(e_IMAGE."emotes/".$value."/".$confFile['file']);
$sql->db_Insert("core", "'emote_".$value."', '$_emoteconf' ");
echo "New emote php found: ' ".$value."'
";
}
/* end ----------------------------------------------------------------------------------------------------------------------------------------- */
}
}
}
}
require_once("footer.php");
?>