42 'smiley_keywords' => array(
46 'smiley_path' => array(
52 $ilDB->dropTable(
"chat_smilies");
53 $ilDB->dropTable(
"chat_smilies_seq");
55 $ilDB->createTable(
'chat_smilies', $fields);
56 $ilDB->addPrimaryKey(
'chat_smilies', array(
'smiley_id'));
57 $ilDB->createSequence(
'chat_smilies');
66 array(
"icon_smile.gif",
":)\n:-)\n:smile:"),
67 array(
"icon_wink.gif",
";)\n;-)\n:wink:"),
68 array(
"icon_laugh.gif",
":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
69 array(
"icon_sad.gif",
":(\n:-(\n:sad:"),
70 array(
"icon_shocked.gif",
":o\n:-o\n:shocked:"),
71 array(
"icon_tongue.gif",
":p\n:-p\n:tongue:"),
72 array(
"icon_cool.gif",
":cool:"),
73 array(
"icon_eek.gif",
":eek:"),
74 array(
"icon_angry.gif",
":||\n:-||\n:angry:"),
75 array(
"icon_flush.gif",
":flush:"),
76 array(
"icon_idea.gif",
":idea:"),
77 array(
"icon_thumbup.gif",
":thumbup:"),
78 array(
"icon_thumbdown.gif",
":thumbdown:"),
81 $stmt = $ilDB->prepare(
"
82 INSERT INTO chat_smilies (smiley_id, smiley_keywords, smiley_path)
85 "integer",
"text",
"text"
89 foreach($values as $val) {
91 $ilDB->nextID(
"chat_smilies"),
106 if (!is_dir(
$path)) {
107 mkdir(
$path, 0755,
true);
161 "icon_thumbdown.gif",
164 foreach($smilies as $smiley)
166 copy(
"templates/default/images/emoticons/$smiley",
$path .
"/$smiley");
176 if (!is_writable(
$path))
190 $res = $ilDB->query(
"SELECT smiley_id, smiley_keywords, smiley_path FROM chat_smilies");
193 for ($i = 0; $i <
$res->numRows(); $i++) {
194 $tmp =
$res->fetchRow();
196 "smiley_id" => $tmp[0],
197 "smiley_keywords" => $tmp[1],
198 "smiley_path" => $tmp[2],
214 $res = $ilDB->queryF(
"
215 SELECT smiley_id, smiley_keywords, smiley_path
218 ", array(
'integer'), array($a_id));
220 if (
$res->numRows()) {
221 $tmp =
$res->fetchRow();
223 "smiley_id" => $tmp[0],
224 "smiley_keywords" => $tmp[1],
225 "smiley_path" => $tmp[2],
230 throw new Exception(
'smiley with id $a_id not found');
236 if (!count($ids))
return;
238 $sql =
"SELECT smiley_id, smiley_keywords, smiley_path FROM chat_smilies WHERE ";
240 $sql_parts = array();
241 foreach($ids as $id) {
242 $sql_parts[] .=
"smiley_id = " . $ilDB->quote($id,
"integer");
245 $sql .= join(
" OR ", $sql_parts);
247 $res = $ilDB->query($sql);
249 for($i = 0; $i <
$res->numRows(); $i++) {
250 $tmp =
$res->fetchRow();
252 "smiley_id" => $tmp[0],
253 "smiley_keywords" => $tmp[1],
254 "smiley_path" => $tmp[2],
264 if (count($smilies) <= 0)
267 $sql_parts = array();
269 foreach($smilies as $s) {
270 unlink($s[
"smiley_fullpath"]);
271 $sql_parts[] =
"smiley_id = " . $ilDB->quote($s[
"smiley_id"],
'integer');
274 $ilDB->manipulate(
"DELETE FROM chat_smilies WHERE " . join(
" OR ", $sql_parts) );
282 SET smiley_keywords = %s
285 array(
'text',
'integer'),
286 array(
$data[
"smiley_keywords"],
$data[
"smiley_id"])
289 if (
$data[
"smiley_path"]) {
291 unlink($sm[
"smiley_fullpath"]);
297 array(
'text',
'integer'),
298 array(
$data[
"smiley_path"],
$data[
"smiley_id"])
318 "DELETE FROM chat_smilies
333 $stmt = $ilDB->prepare(
"
334 INSERT INTO chat_smilies (smiley_id, smiley_keywords, smiley_path)
337 "integer",
"text",
"text"
341 $ilDB->nextID(
"chat_smilies"),
345 $stmt->execute(
$row);
349 $keywordscheck =
true;
352 $keywords_unchecked = explode(
"\n", $words);
353 if (count($keywords_unchecked) <= 0)
354 $keywordscheck =
false;
356 if ($keywordscheck) {
358 foreach($keywords_unchecked as $word) {
360 $keywords[] = trim($word);
364 if ($keywordscheck && count($keywords) <= 0)
365 $keywordscheck =
false;
377 "SELECT smiley_keywords, smiley_path
381 $ar_search = array();
382 $ar_replace = array();
385 for($i = 0; $i < $q->numRows(); $i++) {
386 $row = $q->fetchRow();
387 $keywords = explode(
"\n",
$row[0]);
389 for ($x = 0; $x < count($keywords); $x++) {
390 $ar_search[] = $keywords[$x];
392 $tpl =
new ilTemplate(
"tpl.chat_smiley_line.html",
true,
true,
"Modules/Chat");
394 $tpl->setVariable(
"SMILEY_ALT", urlencode($keywords[$x]));
395 $tpl->parseCurrentBlock();
397 $ar_replace[] =
$tpl->get();
402 $str = str_replace($ar_search, $ar_replace, $str);