30 'smiley_keywords' => array(
34 'smiley_path' => array(
43 $ilDB->createTable(
'chatroom_smilies', $fields );
44 $ilDB->addPrimaryKey(
'chatroom_smilies', array(
'smiley_id') );
45 $ilDB->createSequence(
'chatroom_smilies' );
58 array(
"icon_smile.gif",
":)\n:-)\n:smile:"),
59 array(
"icon_wink.gif",
";)\n;-)\n:wink:"),
60 array(
"icon_laugh.gif",
":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
61 array(
"icon_sad.gif",
":(\n:-(\n:sad:"),
62 array(
"icon_shocked.gif",
":o\n:-o\n:shocked:"),
63 array(
"icon_tongue.gif",
":p\n:-p\n:tongue:"),
64 array(
"icon_cool.gif",
":cool:"),
65 array(
"icon_eek.gif",
":eek:"),
66 array(
"icon_angry.gif",
":||\n:-||\n:angry:"),
67 array(
"icon_flush.gif",
":flush:"),
68 array(
"icon_idea.gif",
":idea:"),
69 array(
"icon_thumbup.gif",
":thumbup:"),
70 array(
"icon_thumbdown.gif",
":thumbdown:"),
73 $stmt = $ilDB->prepare(
"
74 INSERT INTO chatroom_smilies (smiley_id, smiley_keywords, smiley_path)
76 array(
"integer",
"text",
"text" )
79 foreach( $values as $val )
82 $ilDB->nextID(
"chatroom_smilies" ),
86 $stmt->execute(
$row );
97 if( !is_dir(
$path ) )
99 mkdir(
$path, 0755,
true );
137 if( !is_dir(
$path ) )
142 if( !is_dir(
$path ) )
162 "icon_thumbdown.gif",
165 foreach( $smilies as $smiley )
167 copy(
"templates/default/images/emoticons/$smiley",
$path .
"/$smiley" );
175 if( !is_writable(
$path ) )
193 "SELECT smiley_id, smiley_keywords, smiley_path
194 FROM chatroom_smilies"
198 for( $i = 0; $i <
$res->numRows(); $i++ )
200 $tmp =
$res->fetchRow();
202 "smiley_id" => $tmp[0],
203 "smiley_keywords" => $tmp[1],
204 "smiley_path" => $tmp[2],
223 $res = $ilDB->queryF(
"
224 SELECT smiley_id, smiley_keywords, smiley_path
225 FROM chatroom_smilies
226 WHERE smiley_id = %s ",
227 array(
'integer'), array($a_id)
230 if(
$res->numRows() )
232 $tmp =
$res->fetchRow();
234 "smiley_id" => $tmp[0],
235 "smiley_keywords" => $tmp[1],
236 "smiley_path" => $tmp[2],
241 throw new Exception(
'smiley with id $a_id not found' );
258 $sql =
"SELECT smiley_id, smiley_keywords, smiley_path FROM chatroom_smilies WHERE ";
260 $sql_parts = array();
262 foreach( $ids as $id )
264 $sql_parts[] .=
"smiley_id = " . $ilDB->quote( $id,
"integer" );
267 $sql .= join(
" OR ", $sql_parts );
268 $res = $ilDB->query( $sql );
271 for( $i = 0; $i <
$res->numRows(); $i++ )
273 $tmp =
$res->fetchRow();
275 "smiley_id" => $tmp[0],
276 "smiley_keywords" => $tmp[1],
277 "smiley_path" => $tmp[2],
296 if( count( $smilies ) <= 0 )
299 $sql_parts = array();
301 foreach( $smilies as $s )
303 unlink( $s[
"smiley_fullpath"] );
304 $sql_parts[] =
"smiley_id = " . $ilDB->quote( $s[
"smiley_id"],
'integer' );
307 $ilDB->manipulate(
"DELETE FROM chatroom_smilies WHERE " . join(
" OR ", $sql_parts ) );
322 "UPDATE chatroom_smilies
323 SET smiley_keywords = %s
326 array(
'text',
'integer'),
327 array($data[
"smiley_keywords"], $data[
"smiley_id"])
330 if( $data[
"smiley_path"] )
333 unlink( $sm[
"smiley_fullpath"] );
335 "UPDATE chatroom_smilies
339 array(
'text',
'integer'),
340 array($data[
"smiley_path"], $data[
"smiley_id"])
370 if( is_file(
$path ) )
374 "DELETE FROM chatroom_smilies
398 $stmt = $ilDB->prepare(
"
399 INSERT INTO chatroom_smilies (smiley_id, smiley_keywords, smiley_path)
402 "integer",
"text",
"text"
406 $ilDB->nextID(
"chatroom_smilies" ),
410 $stmt->execute(
$row );
421 $keywordscheck =
true;
424 $keywords_unchecked = explode(
"\n", $words );
425 if( count( $keywords_unchecked ) <= 0 )
426 $keywordscheck =
false;
432 foreach( $keywords_unchecked as $word )
435 $keywords[] = trim( $word );
439 if( $keywordscheck && count( $keywords ) <= 0 )
440 $keywordscheck =
false;