$tags = array("uid", "writer_id", "art_title", "art_summary", "art_image", "art_pages", "art_categories", "art_time_publish", "art_counter", "art_comments"); $articles_obj = $article_handler->getAll($criteria, $tags); } else { $articles_obj = array(); } $author_array = array(); $writer_array = array(); $users = array(); $writers = array(); foreach (array_keys($articles_obj) as $id) { $author_array[$articles_obj[$id]->getVar("uid")] = 1; $writer_array[$articles_obj[$id]->getVar("writer_id")] = 1; } if (!empty($author_array)) { include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/functions.author.php"; $users = art_getAuthorNameFromId(array_keys($author_array), true, true); } if (!empty($writer_array)) { include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/functions.author.php"; $writers = art_getWriterNameFromIds(array_keys($writer_array)); } $articles = array(); foreach (array_keys($articles_obj) as $id) { $_article = array("id" => $id, "title" => $articles_obj[$id]->getVar("art_title"), "author" => @$users[$articles_obj[$id]->getVar("uid")], "writer" => @$writers[$articles_obj[$id]->getVar("writer_id")], "time" => $articles_obj[$id]->getTime($xoopsModuleConfig["timeformat"]), "image" => $articles_obj[$id]->getImage(), "counter" => $articles_obj[$id]->getVar("art_counter"), "summary" => $articles_obj[$id]->getSummary(!empty($xoopsModuleConfig["display_summary"]))); $cats = $articles_obj[$id]->getCategories(); foreach ($cats as $catid) { if ($catid == 0 || !isset($categories_obj[$catid])) { continue; } $_article["categories"][$catid] = array("id" => $catid, "title" => $categories_obj[$catid]->getVar("cat_title")); }
} $author_array = array(); $writer_array = array(); $users = array(); $writers = array(); foreach (array_keys($articles_obj) as $id) { $author_array[] = $articles_obj[$id]->getVar("uid"); $writer_array[$articles_obj[$id]->getVar("writer_id")] = 1; } $moderators = $category_obj->getVar("cat_moderator"); if (is_array($moderators)) { $author_array = array_merge($author_array, $moderators); } if (!empty($author_array)) { include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/functions.author.php"; $users = art_getAuthorNameFromId($author_array, true, true); } if (!empty($writer_array)) { include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/functions.author.php"; $writers = art_getWriterNameFromIds(array_keys($writer_array)); } $category_moderators = array(); foreach ($moderators as $id) { $category_moderators[$id] = $users[$id]; } $articles = array(); foreach ($articles_id as $id) { $_article = array("id" => $id, "title" => $articles_obj[$id]->getVar("art_title"), "author" => @$users[$articles_obj[$id]->getVar("uid")], "writer" => @$writers[$articles_obj[$id]->getVar("writer_id")], "time" => $articles_obj[$id]->getTime($xoopsModuleConfig["timeformat"]), "image" => $articles_obj[$id]->getImage(), "counter" => $articles_obj[$id]->getVar("art_counter"), "comments" => $articles_obj[$id]->getVar("art_comments"), "trackbacks" => $articles_obj[$id]->getVar("art_trackbacks")); if (!empty($xoopsModuleConfig["display_summary"])) { $_article["summary"] = $articles_obj[$id]->getSummary(true); }
${$tag} = empty($_POST[$tag]) ? 0 : 1; } $doimage = 1; $p_text = $_POST["text"]; $p_text = $myts->previewTarea($p_text, $dohtml, $dosmiley, $doxcode, $doimage, $dobr); $article_data = array(); $article_data["id"] = $art_id; $article_data["cat_id"] = $cat_id; // title $article_data["title"] = $p_title; // image $article_data["image"] = $p_image; // Authors mod_loadFunctions("author"); $author_uid = $article_isNew ? $user_id : $article_obj->getVar("uid"); $authors = art_getAuthorNameFromId($author_uid, false, true); $article_data["author"] = $authors[$author_uid]; if (!empty($_POST["writer_id"])) { $article_obj->setVar("writer_id", $_POST["writer_id"]); $article_data["writer"] = $article_obj->getWriter(); } // source $article_data["source"] = $p_source; // publish time $article_data["time"] = art_formatTimestamp(time()); // counter $article_data["counter"] = 0; // rating data $article_data["rates"] = 0; $article_data["rating"] = 0; // summary
$article_data["cat_id"] = $category_id; if ($article_obj->getVar("art_forum")) { $article_data["forum"] = XOOPS_URL . "/modules/" . sprintf($xoopsModuleConfig["url_forum"], $article_obj->getVar("art_forum"), $xoopsModuleConfig["forum"]); } // title $article_data["title"] = $article_obj->getVar("art_title"); // image $article_data["image"] = $article_obj->getImage(); // Author /* * name * uid */ //$article_data["author"] = $article_obj->getAuthor(true); mod_loadFunctions("author"); $authors = art_getAuthorNameFromId($article_obj->getVar("uid"), false, true); $article_data["author"] = $authors[$article_obj->getVar("uid")]; // Writer /* * name * profile * avatar */ $article_data["writer"] = $article_obj->getWriter(); // source $article_data["source"] = $article_obj->getVar("art_source"); // publish time $article_data["time"] = $article_obj->getTime($xoopsModuleConfig["timeformat"]); // counter $article_data["counter"] = $article_obj->getVar("art_counter"); // rating data