} $retval = json_encode($data); break; case 'autocompletetag': $tagcloud = new nexfileTagCloud(); $matches = $tagcloud->get_matchingtags($_GET['query']); $retval = implode("\n", $matches); break; case 'togglefavorite': $id = $filter->getCleanData('int', $_GET['id']); if ($_USER['uid'] > 1 and $id >= 1) { if (DB_count($_TABLES['nxfile_favorites'], array('uid', 'fid'), array($_USER['uid'], $id))) { $data['favimgsrc'] = plugin_geticon_nexfile('favorite-off'); DB_query("DELETE FROM {$_TABLES['nxfile_favorites']} WHERE uid={$_USER['uid']} AND fid={$id}"); } else { $data['favimgsrc'] = plugin_geticon_nexfile('favorite-on'); DB_query("INSERT INTO {$_TABLES['nxfile_favorites']} (uid,fid) VALUES ({$_USER['uid']},{$id})"); } $data['retcode'] = 200; } else { $data['retcode'] = 400; } $retval = json_encode($data); break; case 'search': $query = $filter->getCleanData('text', $_GET['query']); if (!empty($query)) { $data['retcode'] = 200; $data['displayhtml'] = nexdoc_displaySearchListing($query); $data['header'] = nexdoc_formatHeader(); $data['activefolder'] = nexdoc_displayActiveFolder(0, 'search');
function nexdoc_formatFavoriteImage($template, $fid) { global $_TABLES, $uid; if ($uid > 1 and $fid >= 1) { if (DB_count($_TABLES['nxfile_favorites'], array('uid', 'fid'), array($uid, $fid))) { $template->set_var('favorite_status_image', plugin_geticon_nexfile('favorite-on')); $template->set_var('LANG_favorite_status', 'Click to clear favorite'); } else { $template->set_var('favorite_status_image', plugin_geticon_nexfile('favorite-off')); $template->set_var('LANG_favorite_status', 'Click to mark item as a favorite'); } } else { $template->set_var('show_favorite', 'none'); } }