PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/e107_admin/emoticon.php

https://github.com/CasperGemini/e107
PHP | 695 lines | 529 code | 98 blank | 68 comment | 65 complexity | 2df14ac8be405979c8c9285e4b485405 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /*
  3. * e107 website system
  4. *
  5. * Copyright (C) 2008-2013 e107 Inc (e107.org)
  6. * Released under the terms and conditions of the
  7. * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
  8. *
  9. * Administration Area - Emotions Settings & Packs
  10. *
  11. *
  12. */
  13. require_once("../class2.php");
  14. if (!getperms("F"))
  15. {
  16. header("location:".e_BASE."index.php");
  17. exit;
  18. }
  19. include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
  20. $e_sub_cat = 'emoticon';
  21. require_once("auth.php");
  22. $mes = e107::getMessage();
  23. if(!$sql->db_Count("core", "(*)", "WHERE e107_name = 'emote_default' AND e107_value !='' "))
  24. { // Set up the default emotes
  25. // $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) ;-)";}';
  26. // $insert = array("e107_name"=>"emote_default", "e107_value"=>$tmp);
  27. // $sql->db_Replace("core", $insert);
  28. }
  29. // Change the active emote pack
  30. if (isset($_POST['active']))
  31. {
  32. if ($pref['smiley_activate'] != $_POST['smiley_activate'])
  33. {
  34. $pref['smiley_activate'] = $_POST['smiley_activate'];
  35. $admin_log->log_event($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03', $pref['emotepack'], E_LOG_INFORMATIVE, '');
  36. save_prefs();
  37. $update = true;
  38. }
  39. else
  40. {
  41. $mes->addInfo(LAN_NO_CHANGE);
  42. }
  43. }
  44. $ns->tablerender($caption, $mes->render() . $text);
  45. /* get packs */
  46. require_once(e_HANDLER."file_class.php");
  47. $fl = e107::getFile();
  48. $emote = new emotec;
  49. $one_pack = FALSE;
  50. // Check for pack-related buttons pressed
  51. foreach($_POST as $key => $value)
  52. {
  53. if(strstr($key, "subPack_"))
  54. {
  55. $subpack = str_replace("subPack_", "", $key);
  56. $emote->emoteConf($subpack);
  57. break;
  58. }
  59. if(strstr($key, "XMLPack_"))
  60. {
  61. $subpack = str_replace("XMLPack_", "", $key);
  62. $emote->emoteXML($subpack);
  63. break;
  64. }
  65. if(strstr($key, "defPack_"))
  66. {
  67. $pref['emotepack'] = str_replace("defPack_", "", $key);
  68. if(save_prefs())
  69. {
  70. $mes->addSuccess(LAN_UPDATED);
  71. }
  72. else
  73. {
  74. $mes->addInfo(LAN_NO_CHANGE);
  75. }
  76. $admin_log->log_event('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, '');
  77. break;
  78. }
  79. if(strstr($key, "scanPack_"))
  80. {
  81. $one_pack = str_replace("scanPack_", "", $key);
  82. break;
  83. }
  84. }
  85. $ns->tablerender($caption, $mes->render() . $text);
  86. $check = TRUE;
  87. //$check = $emote -> installCheck();
  88. $check = $emote->installCheck($one_pack);
  89. if($check!==FALSE)
  90. {
  91. $emote -> listPacks();
  92. }
  93. class emotec
  94. {
  95. var $packArray; // Stores an array of all available emote packs (as subdirectory names)
  96. function emotec()
  97. {
  98. /* constructor */
  99. $fl = e107::getFile();
  100. $this -> packArray = $fl->get_dirs(e_IMAGE."emotes");
  101. if(isset($_POST['sub_conf']))
  102. { // Update stored pack configuration
  103. $this -> saveConf();
  104. }
  105. }
  106. // List available emote packs
  107. function listPacks()
  108. {
  109. $pref = e107::getPref();
  110. $frm = e107::getForm();
  111. $fl = e107::getFile();
  112. $ns = e107::getRender();
  113. $mes = e107::getMessage();
  114. $text = "
  115. <ul class='nav nav-tabs'>
  116. <li class='active'><a href='#emoticon-activate' data-toggle='tab'>".EMOLAN_1."</a></li>
  117. <li><a href='#emoticon-packages' data-toggle='tab'>".EMOLAN_13."</a></li>
  118. </ul>
  119. <div class='tab-content'>
  120. <div class='tab-pane active' id='emoticon-activate'>
  121. <fieldset>
  122. <form method='post' action='".e_SELF."'>
  123. <legend>".EMOLAN_1."</legend>
  124. <table class='table adminform'>
  125. <colgroup>
  126. <col style='width:30%' />
  127. <col style='width:70%' />
  128. </colgroup>
  129. <tbody>
  130. <tr>
  131. <td>
  132. ".EMOLAN_4.":
  133. </td>
  134. <td>
  135. <div class='auto-toggle-area autocheck'>
  136. ".$frm->checkbox('smiley_activate', 1, varset($pref['smiley_activate'],0))."
  137. </div>
  138. </td>
  139. </tr>
  140. </tbody>
  141. </table>
  142. <div class='buttons-bar center'>
  143. ".$frm->admin_button('active','active','update',LAN_UPDATE)."
  144. </div>
  145. <fieldset>
  146. </form>
  147. </div>
  148. ";
  149. $text .= "
  150. <div class='tab-pane' id='emoticon-packages'>
  151. <form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'>
  152. <fieldset>
  153. <legend>".EMOLAN_13."</legend>
  154. <table class='table adminlist'>
  155. <colgroup>
  156. <col style='width:15%' />
  157. <col style='width:50%' />
  158. <col style='width:15%' />
  159. <col style='width:20%' />
  160. </colgroup>
  161. <thead>
  162. <tr>
  163. <th class='center'>".LAN_NAME."</th>
  164. <th class='center'>".EMOLAN_3."</th>
  165. <th class='center'>".LAN_STATUS."</th>
  166. <th class='center'>".LAN_OPTIONS."</th>
  167. </tr>
  168. </thead>
  169. <tbody>
  170. ";
  171. $reject = '~^emoteconf|\.html$|\.php$|\.txt$'; // Files to exclude
  172. foreach($this -> packArray as $pack)
  173. {
  174. $can_scan = FALSE;
  175. $emoteArray = $fl -> get_files(e_IMAGE.'emotes/'.$pack, $reject);
  176. $text .= "
  177. <tr>
  178. <td class='forumheader' style='width: 20%;'>{$pack}</td>
  179. <td class='forumheader' style='width: 20%;'>
  180. ";
  181. foreach($emoteArray as $emote)
  182. {
  183. if (strstr($emote['fname'], ".pak")
  184. || strstr($emote['fname'], ".xml")
  185. || strstr($emote['fname'], "phpBB"))
  186. {
  187. $can_scan = TRUE; // Allow re-scan of config files
  188. }
  189. //elseif (!strstr($emote['fname'], ".txt") && !strstr($emote['fname'], ".bak") && !strstr($emote['fname'], ".html") && !strstr($emote['fname'], ".php") )
  190. else
  191. { // Emote file found (might get other non-image files, but shouldn't)
  192. $text .= "<img src='".$emote['path'].$emote['fname']."' alt='' /> ";
  193. }
  194. }
  195. $text .= "
  196. </td>
  197. <td class='center middle'>".($pref['emotepack'] == $pack ? LAN_ACTIVE : "<button type='submit' name='defPack_".$pack."' value='".EMOLAN_11."'><span>".EMOLAN_11."</span></button>")."</td>
  198. <td>";
  199. $text .= $frm->admin_button('subPack_'.$pack,'edit','submit',LAN_CONFIGURE);
  200. if ($can_scan && ($pack != 'default'))
  201. {
  202. $text .= "
  203. <button class='submit' type='submit' name='scanPack_".$pack."'><span>".EMOLAN_26."</span></button>
  204. ";
  205. $text .= $frm->admin_button('scanPack_'.$pack,'active','submit',EMOLAN_26);
  206. }
  207. $text .= $frm->admin_button('XMLPack_'.$pack,'submit','submit',EMOLAN_28);
  208. $text .= "
  209. </td>
  210. </tr>
  211. ";
  212. }
  213. $text .= "
  214. </tbody>
  215. </table>
  216. </fieldset>
  217. </form>
  218. </div>
  219. </div>
  220. ";
  221. $ns->tablerender(EMOLAN_PAGE_TITLE, $mes->render().$text);
  222. }
  223. // Configure an individual emote pack
  224. function emoteConf($packID)
  225. {
  226. global $e107, $sysprefs;
  227. $frm = e107::getForm();
  228. $tp = e107::getParser();
  229. $fl = e107::getFile();
  230. $ns = e107::getRender();
  231. $corea = "emote_".$packID;
  232. $emotecode = $sysprefs -> getArray($corea);
  233. $reject = '~^emoteconf|\.html$|\.php$|\.txt$|\.pak$|\.xml|\.phpBB'; // Files to exclude
  234. $emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, $reject);
  235. $eArray = array();
  236. foreach($emoteArray as $value)
  237. {
  238. $eArray[] = array('path' => $value['path'], 'fname' => $value['fname']);
  239. }
  240. //XXX Not sure if we need to know rhe number of files found - count($eArray) - <div class='info-bar'><strong>Total ".count($eArray)." files found</strong></div>
  241. $text = "
  242. <form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'>
  243. <fieldset id='core-emoticon-configure'>
  244. <legend class='e-hideme'>".LAN_EDIT."</legend>
  245. <div class='info-bar'><strong>".sprintf(str_replace("[x]", "%u", EMOLAN_31), count($eArray))."</strong></div>
  246. <table class='table adminlist'>
  247. <colgroup>
  248. <col style='width:20px' />
  249. <col class='col-label' />
  250. <col class='col-control' />
  251. </colgroup>
  252. <thead>
  253. <tr>
  254. <th>".EMOLAN_5."</th>
  255. <th>".LAN_NAME."</th>
  256. <th class='last'>".EMOLAN_6."<span class='field-help'> ( ".EMOLAN_7." )</span></th>
  257. </tr>
  258. </thead>
  259. <tbody>
  260. ";
  261. foreach($eArray as $emote)
  262. {
  263. $ename = $emote['fname'];
  264. $evalue = str_replace(".", "!", $ename);
  265. $file_back = '';
  266. $text_back = '';
  267. if (!isset($emotecode[$evalue]))
  268. {
  269. $file_back = '<span class="error">&nbsp;&nbsp;'.EMOLAN_37.'</span>';
  270. }
  271. elseif (!$emotecode[$evalue])
  272. {
  273. $text_back = '<span class="error">&nbsp;&nbsp;'.EMOLAN_38.'</span>';
  274. }
  275. $text .= "
  276. <tr>
  277. <td class='center'><img src='".$emote['path'].$ename."' alt='' /></td>
  278. <td>".$ename."{$file_back}</td>
  279. <td>
  280. <input class='tbox input-text' type='text' name='{$evalue}' value='".$tp->toForm(varset($emotecode[$evalue],''))."' maxlength='200' />{$text_back}
  281. </td>
  282. </tr>
  283. ";
  284. }
  285. $text .= "
  286. </tbody>
  287. </table>
  288. <div class='buttons-bar center'>
  289. <input type='hidden' name='packID' value='{$packID}' />";
  290. $text .= $frm->admin_button('sub_conf', 'no-value', 'update', LAN_SAVE);
  291. $text .= $frm->admin_button('cancel','no-value', 'cancel' ,LAN_CANCEL);
  292. $text .= "
  293. </div>
  294. </fieldset>
  295. </form>";
  296. $ns->tablerender(EMOLAN_PAGE_TITLE.SEP.LAN_EDIT.": '".$packID."'", $text);
  297. }
  298. // Generate an XML file - packname.xml in root emoticon directory
  299. function emoteXML($packID, $strip_xtn = TRUE)
  300. {
  301. global $sysprefs;
  302. $mes = e107::getMessage();
  303. $fl = e107::getFile();
  304. $tp = e107::getParser();
  305. $fname = e_IMAGE."emotes/".$packID."/emoticons.xml";
  306. $backname = e_IMAGE."emotes/".$packID."/emoticons.bak";
  307. $corea = "emote_".$packID;
  308. $emotecode = $sysprefs -> getArray($corea);
  309. $reject = '~^emoteconf|\.html$|\.php$|\.txt$|\.pak$|\.xml|\.phpBB'; // Files to exclude
  310. $emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, $reject);
  311. $eArray = array();
  312. foreach($emoteArray as $value)
  313. {
  314. $eArray[] = $value['fname'];
  315. }
  316. $f_string = "<?xml version=\"1.0\"?".">\n<messaging-emoticon-map >\n\n\n";
  317. foreach($eArray as $emote)
  318. {
  319. // Optionally strip file extension
  320. $evalue = str_replace(".", "!", $emote);
  321. if ($strip_xtn) $ename = substr($emote,0,strrpos($emote,'.'));
  322. $f_string .= "<emoticon file=\"{$ename}\">\n";
  323. foreach (explode(' ',$tp -> toForm($emotecode[$evalue])) as $v)
  324. {
  325. if (trim($v)) $f_string .= "\t<string>{$v}</string>\n";
  326. }
  327. $f_string .= "</emoticon>\n";
  328. }
  329. $f_string .= "\n</messaging-emoticon-map>\n";
  330. if (is_file($backname)) unlink($backname); // Delete any old backup
  331. if (is_file($fname)) rename($fname,$backname);
  332. if (file_put_contents($fname,$f_string) === FALSE)
  333. {
  334. $mes->addWarning('<strong>'.EMOLAN_30.'</strong>:'.str_replace(e_IMAGE, e_IMAGE_ABS, $fname));
  335. }
  336. else
  337. {
  338. $mes->addSuccess('<strong>'.EMOLAN_29.'</strong>:'.str_replace(e_IMAGE, e_IMAGE_ABS, $fname));
  339. }
  340. }
  341. // Save configuration for an emote pack that's been edited
  342. function saveConf()
  343. {
  344. $sql = e107::getDb();
  345. $tp = e107::getParser();
  346. $packID = $_POST['packID'];
  347. unset($_POST['sub_conf'], $_POST['packID']);
  348. $encoded_emotes = $tp->toDB($_POST);
  349. // $tmp = addslashes(serialize($encoded_emotes));
  350. $tmp = e107::getArrayStorage()->WriteArray($encoded_emotes);
  351. if ($sql->db_Select("core", "*", "e107_name='emote_".$packID."'"))
  352. {
  353. e107::getMessage()->addAuto($sql->update("core", "`e107_value`='{$tmp}' WHERE `e107_name`='emote_".$packID."' "), 'update', LAN_SETSAVED, false, false);
  354. }
  355. else
  356. {
  357. e107::getMessage()->addAuto($sql->insert("core", "'emote_".$packID."', '$tmp' "), 'insert', LAN_SETSAVED, false, false);
  358. }
  359. }
  360. // Identify currently selected emote pack. Read in any new ones
  361. // Return false to disable listing of packs
  362. function installCheck($do_one = FALSE)
  363. {
  364. global $e107;
  365. $sql = e107::getDb();
  366. $fl = e107::getFile();
  367. $ns = e107::getRender();
  368. $mes = e107::getMessage();
  369. // Pick up a list of emote packs from the database
  370. $pack_local = array();
  371. if ($sql->db_Select("core","*","`e107_name` LIKE 'emote_%'"))
  372. {
  373. while ($row = $sql->db_Fetch())
  374. {
  375. $pack_local[substr($row['e107_name'],6)] = TRUE;
  376. }
  377. }
  378. foreach($this -> packArray as $value)
  379. {
  380. if(strpos($value,' ')!==FALSE)
  381. { // Highlight any directory names containing spaces - not allowed
  382. $msg = "
  383. <strong>".EMOLAN_17."</strong> ".EMOLAN_18.":
  384. <div>".LAN_NAME.": {$value}</div>
  385. <div>".EMOLAN_20.": ".e_IMAGE_ABS."emotes/</div>
  386. ";
  387. $mes->addError($msg);
  388. $ns->tablerender(EMOLAN_PAGE_TITLE.' - '.EMOLAN_21, $mes->render());
  389. return FALSE;
  390. }
  391. if (array_key_exists($value,$pack_local))
  392. {
  393. unset($pack_local[$value]);
  394. }
  395. if (($do_one == $value) || !$do_one && (!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' ")))
  396. { // Pack info not in DB, or to be re-scanned
  397. $no_error = TRUE;
  398. $File_type = EMOLAN_32.":";
  399. // Array of all files in the directory of the selected emote pack
  400. $fileArray = $fl -> get_files(e_IMAGE."emotes/".$value); // We actually want all the files in the directory
  401. $confFile = '';
  402. foreach($fileArray as $k => $file)
  403. {
  404. if(strstr($file['fname'], ".xml"))
  405. {
  406. $confFile = array('file' => $file['fname'], 'type' => "xml");
  407. }
  408. else if(strstr($file['fname'], ".pak"))
  409. {
  410. $confFile = array('file' => $file['fname'], 'type' => "pak");
  411. }
  412. else if(strstr($file['fname'], ".php"))
  413. {
  414. $confFile = array('file' => $file['fname'], 'type' => "php");
  415. }
  416. if ($confFile)
  417. {
  418. unset($fileArray[$k]);
  419. break;
  420. }
  421. }
  422. /* .pak file */
  423. if($confFile['type'] == "pak")
  424. {
  425. $filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
  426. $pakconf = file ($filename);
  427. $contentArray = array();
  428. foreach($pakconf as $line)
  429. {
  430. if(trim($line) && strstr($line, "=+") && !strstr($line, ".txt") && !strstr($line, ".html") && !strstr($line, "cvs")) $contentArray[] = $line;
  431. }
  432. $confArray = array();
  433. foreach($contentArray as $pakline)
  434. {
  435. $tmp = explode("=+:", $pakline);
  436. $confIC = str_replace(".", "!", $tmp[0]);
  437. $confArray[$confIC] = trim($tmp[2]);
  438. }
  439. // $tmp = addslashes(serialize($confArray));
  440. $tmp = e107::getArrayStorage()->WriteArray($confArray);
  441. $File_type = EMOLAN_22.":";
  442. }
  443. /* end */
  444. /* .xml file */
  445. if($confFile['type'] == "xml")
  446. {
  447. $filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
  448. $contents = file_get_contents($filename);
  449. $confArray = array();
  450. $xml_type = 0;
  451. if ((strpos($contents, "<icon>") !== FALSE) && (strpos($contents, "<icondef>") !== FALSE))
  452. { // xep-0038 format
  453. /* Example:
  454. <icon>
  455. <text>:-)</text>
  456. <text>:)</text>
  457. <object mime="image/png">happy.png</object>
  458. <object mime="audio/x-wav">choir.wav</object>
  459. </icon>*/
  460. preg_match_all("#\<icon>(.*?)\<\/icon\>#si", $contents, $match);
  461. $xml_type = 1;
  462. // $match[0] - complete emoticon entry
  463. // $match[1] - match string and object specification
  464. $item_index = 1;
  465. }
  466. elseif (strpos($contents, "<emoticon") !== FALSE)
  467. { // "Original" E107 format (as used on KDE, although they may be changing to XEP-0038)
  468. //echo "Decoding standard XML file<br />";
  469. preg_match_all("#\<emoticon file=\"(.*?)\"\>(.*?)\<\/emoticon\>#si", $contents, $match);
  470. $xml_type = 2;
  471. // $match[0] - complete emoticon entry
  472. // $match[1] - filename (may or may not not have file extension/suffix)
  473. // $match[2] - match string(s) representing emote
  474. $item_index = 2;
  475. }
  476. if ($xml_type)
  477. {
  478. for($a=0; $a < count($match[0]); $a++)
  479. {
  480. $e_file = '';
  481. switch ($xml_type)
  482. {
  483. case 1 : // xep-0038
  484. // Pull out a file name (only support first image type) - its in $fmatch[1]
  485. if (preg_match("#\<object\s*?mime\=[\"\']image\/.*?\>(.*?)\<\/object\>#si",$match[1][$a],$fmatch))
  486. {
  487. $e_file = $fmatch[1];
  488. // echo "xep-0038 file: ".$e_file."<br />";
  489. // Pull out all match strings - need to pick out any language definitions for posterity
  490. // but currently accept all language strings
  491. preg_match_all("#\<text(?:\s*?\>|\s*?xml\:lang\=\"(.*?)\"\>)(.*?)\<\/text\>#si", $match[1][$a], $match2);
  492. // $match2[1] is the languages
  493. // $match2[2] is the match strings
  494. $codet = implode(" ",$match2[2]);
  495. }
  496. break;
  497. case 2 :
  498. $e_file = $match[1][$a];
  499. // Now pull out all the 'match' strings
  500. preg_match_all("#\<string\>(.*?)\<\/string\>#si", $match[2][$a], $match2);
  501. $codet = implode(" ",$match2[1]);
  502. break;
  503. }
  504. // $e_file has the emote file name
  505. // $match2 has an array of substitution strings
  506. $file = '';
  507. foreach($fileArray as $emote)
  508. { // Check that the file exists
  509. if (strpos($e_file,".") === FALSE)
  510. { // File extension not specified - accept any file extension for match
  511. if(strpos($emote['fname'], $e_file.".") === 0)
  512. {
  513. $file = str_replace(".", "!", $emote['fname']);
  514. break;
  515. }
  516. }
  517. else
  518. { // File extension specified - do simple match
  519. if($emote['fname'] == $e_file)
  520. {
  521. $file = str_replace(".", "!", $emote['fname']);
  522. break;
  523. }
  524. }
  525. }
  526. // Only add if the file exists. OK if no definition - might want to be added
  527. if ($file)
  528. {
  529. $confArray[$file] = $codet;
  530. }
  531. }
  532. }
  533. else
  534. {
  535. //echo "Unsupported XML File Format<br /><br />";
  536. $mes->addWarning(EMOLAN_33);
  537. $no_error = FALSE;
  538. }
  539. // Save pack info in the database
  540. // $tmp = addslashes(serialize($confArray));
  541. $tmp = e107::getArrayStorage()->WriteArray($confArray);
  542. $File_type = EMOLAN_23.":";
  543. }
  544. if($confFile['type'] == "php")
  545. {
  546. include_once(e_IMAGE."emotes/".$value."/".$confFile['file']);
  547. $File_type = EMOLAN_24.":";
  548. $tmp = $_emoteconf; // Use consistent name
  549. }
  550. if ($no_error)
  551. {
  552. if ($do_one)
  553. { // Assume existing pack
  554. $sql->db_Update("core", "`e107_value`='{$tmp}' WHERE `e107_name`='emote_".$value."'");
  555. }
  556. else
  557. { // Assume new pack
  558. $sql->db_Insert("core", "'emote_".$value."', '{$tmp}' ");
  559. }
  560. $mes->addInfo("<strong>{$File_type}</strong> '{$value}'");
  561. }
  562. else
  563. { // Error occurred
  564. $mes->addError(EMOLAN_27.": '{$value}'");
  565. }
  566. }
  567. }
  568. if (count($pack_local))
  569. {
  570. foreach ($pack_local as $p => $d)
  571. {
  572. $mes->addInfo(EMOLAN_34.":".$p.EMOLAN_35);
  573. $sql->db_Delete("core","`e107_name` = 'emote_{$p}'");
  574. }
  575. }
  576. return TRUE;
  577. }
  578. }
  579. require_once("footer.php");
  580. /**
  581. * Handle page DOM within the page header
  582. *
  583. * @return string JS source
  584. */
  585. function headerjs()
  586. {
  587. require_once(e_HANDLER.'js_helper.php');
  588. //FIXME - how exactly to auto-call JS lan? This and more should be solved in Stage II.
  589. $ret = "
  590. <script type='text/javascript'>
  591. //add required core lan - delete confirm message
  592. </script>
  593. <script type='text/javascript' src='".e_JS."core/admin.js'></script>
  594. ";
  595. return $ret;
  596. }
  597. ?>