示例#1
0
 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;
 }