function listFiles($user, $pass, $section, $categorie) { $plugin =& JPluginHelper::getPlugin('xmlrpc', 'uploadxml'); $params = new JParameter($plugin->params); $groupsArticles = $params->get('groupsArticles'); $groupUs = $params->get('groupUsers'); $groupUsers = new UserArticle($groupUs, $groupsArticles); if ($section == '') { $section = $params->get('sectionid'); } if ($categorie == '') { $categorie = $params->get('catid'); } $order = "ID"; $order_dir = "ASC"; $limitstart = 0; $limit = 30; if (!plgUploadXMLJoomlaServices::authenticateUser($user, $pass)) { $myVal = new xmlrpcval("Nepovedlo se kvuli autentikaci uzivatele.", "string"); return $myVal; } $db =& JFactory::getDBO(); //nastavení where částí SQL dotazu $whereClause = ""; if ($section != -1) { $whereClause .= " AND ct.sectionid='" . $section . "'"; } if ($categorie != -1) { $whereClause .= " AND ct.catid='" . $categorie . "'"; } if ($filter != '') { $whereClause .= " AND ct.title LIKE '%" . $filter . "%'"; } $userObject =& JFactory::getUser($user); if (!$userObject->authorize('com_content', 'edit', 'content', 'all')) { if ($userObject->authorize('com_content', 'edit', 'content', 'own')) { $whereClause .= " AND ct.created_by='" . $userObject->get('id') . "'"; } else { } } $articles = $groupUsers->getArticles($userObject->id); for ($actualArticle = 0; $actualArticle < count($articles); $actualArticle++) { if ($articles[$actualArticle] == "") { continue; } if ($actualArticle == 0) { $whereClause .= " AND ( "; } if ($actualArticle + 1 == count($articles)) { $whereClause .= " ct.id = '" . $articles[$actualArticle] . "')"; break; } $whereClause .= " ct.id = '" . $articles[$actualArticle] . "' OR "; } $whereClause .= " AND ct.checked_out='0'"; //kontrola, jestli daný článek neupravuje někdo jiný... $whereClause .= " AND ct.state > '-2'"; $db->setQuery("SELECT ct.title,ct.id FROM #__content ct LEFT JOIN #__sections sec ON ct.sectionid=sec.id LEFT JOIN #__categories cat ON ct.catid=cat.id WHERE true {$whereClause} order by {$order} {$order_dir}", $limitstart, $limit); $rows = $db->loadObjectList(); return $rows; }
$col = 'bookmarked'; //### it may be necessary to sanitize the input.. but prepare/execute may not need it $value = $_REQUEST['bookmark']; } elseif (isset($_REQUEST['comments'])) { //### need to be decide how it works $col = 'comments'; $value = $_REQUEST['comments']; } elseif (isset($_REQUEST['persnote'])) { $col = 'personal_note'; //### it may be necessary to sanitize the input.. but prepare/execute may not need it $value = $_REQUEST['persnote']; } else { error('unrecognized command'); } $timer->setMarker('setup'); if (!UserArticle::setColumn($u, $a, $col, $value)) { //Probably it doesn't exist error('Update on the server failed!'); } $timer->setMarker('query'); InsertBenchmarkDB($timer); //Save the data on DB echo '{"result": "OK"}'; if (isset($XML_debug)) { $timer->display(true); // if you want to display immidiately and to output html formated //$profiling = $timer->getProfiling(); // get the profiler info as an associative array //echo "<br> This is the array: <br> <pre>"; //print_r($profiling); //echo "</pre><br>"; }