function check_catname() { require JPATH_COMPONENT_ADMINISTRATOR . DS . 'config.datsogallery.php'; $user = JFactory::getUser(); if ($user_categories && $user->id) { $post = JRequest::get('post'); $catname = JRequest::getVar('name', '', 'post', 'string'); $catname = JString::strtolower(trim($catname)); $db = JFactory::getDBO(); $db->setQuery('SELECT COUNT(cid)' . ' FROM #__datsogallery_catg' . ' WHERE user_id = ' . (int) $user->id); $count = $db->loadResult(); $db->setQuery('SELECT name' . ' FROM #__datsogallery_catg' . ' WHERE name = ' . $db->Quote($catname) . ' AND user_id = ' . $user->id); $name = $db->loadResult(); if ($count >= $ad_max_categories) { echo 'maxcat'; } elseif (JString::strtolower($name) == $catname) { echo 'exist'; } else { saveCatg(); refrCats($catname); } } else { exit; } }
require_once JPATH_COMPONENT . DS . 'includes' . DS . 'settings.php'; break; case "savesettings": saveConfig(); break; case "newcatg": editCatg(0); break; case "editcatg": editCatg($cid[0]); break; case "showcatg": viewCatg(); break; case "savecatg": saveCatg(); break; case "removecatg": removeCatg($cid); break; case "publishcatg": publishCatg($cid, 1); break; case "unpublishcatg": publishCatg($cid, 0); break; case "approvecatg": approveCatg($cid, 1); break; case "unapprovecatg": approveCatg($cid, 0);