/** * @param $data * @param null $name * @param null $dirname * @param null $groups * * @return bool */ function mod_createCacheFile_byGroup($data, $name = null, $dirname = null, $groups = null) { $name .= mod_generateCacheId_byGroup(); return mod_createCacheFile($data, $name, $dirname); }
function _getList($name, $extension = "") { $items = array(); /* if(@ include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.ini.php") { load_functions("cache"); if($items = mod_loadCacheFile("captcha_{$name}", "captcha")) { return $items; } } */ require_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $file_path = $this->config["rootpath"] . "/{$name}"; $files = XoopsLists::getFileListAsArray($file_path); foreach ($files as $item) { if (empty($extension) || preg_match("/(\\.{$extension})\$/i", $item)) { $items[] = $item; } } if (function_exists("mod_createCacheFile")) { mod_createCacheFile($items, "captcha_{$name}", "captcha"); } return $items; }
function createPermData($perm_name = "forum_all") { global $xoopsModule; if (is_object($xoopsModule) && $xoopsModule->getVar("dirname", "n") == "newbb") { $modid = $xoopsModule->getVar("mid"); } else { $module_handler =& xoops_gethandler("module"); $module =& $module_handler->getByDirname("newbb"); $modid = $module->getVar("mid"); unset($module); } if (in_array($perm_name, array("forum_all", "category_all"))) { $member_handler =& xoops_gethandler('member'); $groups = array_keys($member_handler->getGroupList()); $type = $perm_name == "category_all" ? "category" : "forum"; $object_handler =& xoops_getmodulehandler($type, 'newbb'); $object_ids = $object_handler->getIds(); foreach ($object_ids as $item_id) { $perms[$perm_name][$item_id] = $groups; } } else { $gperm_handler =& xoops_gethandler("groupperm"); $criteria = new CriteriaCompo(new Criteria('gperm_modid', $modid)); if (!empty($perm_name) && $perm_name != "forum_all" && $perm_name != "category_all") { $criteria->add(new Criteria('gperm_name', $perm_name)); } $permissions =& $this->getObjects($criteria); $perms = array(); foreach ($permissions as $gperm) { $item_id = $gperm->getVar('gperm_itemid'); $group_id = intval($gperm->getVar('gperm_groupid')); $perms[$gperm->getVar('gperm_name')][$item_id][] = $group_id; } } foreach (array_keys($perms) as $perm) { mod_createCacheFile($perms[$perm], "permission_{$perm}", "newbb"); } $ret = !empty($perm_name) ? @$perms[$perm_name] : $perms; return $ret; }
echo "<td><em style='color:" . $type_obj->getVar("type_color") . "'>" . $type_obj->getVar("type_name") . "</em></td>"; echo "<td>" . $type_obj->getVar("type_description") . "</td>"; echo "</tr>"; } echo "<tr><td colspan='3'>"; echo _AM_NEWBB_TYPE_ORDER_DESC . "<br /><br />"; echo "<input type='hidden' name='op' value='save_template' />"; echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; echo "<input type='reset' value='" . _CANCEL . "' />"; echo "</td></tr></table>"; echo "</form>"; echo "</fieldset>"; break; case "save_template": $templates = array_flip(array_filter($_POST['type_order'])); mod_createCacheFile($templates, "type_template"); redirect_header(xoops_getenv("PHP_SELF") . "?op=template", 2, _MD_DBUPDATED); break; case "apply": if (!($templates = mod_loadCacheFile("type_template"))) { redirect_header(xoops_getenv("PHP_SELF") . "?op=template", 2, _AM_NEWBB_TYPE_TEMPLATE); exit; } $category_handler =& xoops_getmodulehandler('category', 'newbb'); $criteria_category = new CriteriaCompo(new criteria('1', 1)); $criteria_category->setSort('cat_order'); $categories = $category_handler->getList($criteria_category); $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); $forums = $forum_handler->getTree(array_keys($categories), 0, "all"); foreach (array_keys($forums) as $c) { $fm_options[-1 * $c] = "[" . $categories[$c] . "]";
function newbb_createParentForumList() { $forum_handler =& xoops_getModuleHandler("forum", "newbb"); $criteria = new Criteria("1", 1); $criteria->setSort("parent_forum"); $criteria->setOrder("ASC"); $forums_obj = $forum_handler->getObjects($criteria); require_once XOOPS_ROOT_PATH . "/modules/newbb/class/tree.php"; $tree = new newbbObjectTree($forums_obj, "forum_id", "parent_forum"); $forum_array = array(); foreach (array_keys($forums_obj) as $key) { $parent_forum = $forums_obj[$key]->getVar("parent_forum"); if (!$parent_forum) { continue; } if (isset($forum_array[$parent_forum])) { $forum_array[$forums_obj[$key]->getVar("forum_id")] = $forum_array[$parent_forum]; $forum_array[$forums_obj[$key]->getVar("forum_id")][] = $parent_forum; } else { $forum_array[$forums_obj[$key]->getVar("forum_id")] = $tree->getParentForums($forums_obj[$key]->getVar("forum_id")); } } unset($forums_obj, $tree, $criteria); require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.cache.php'; mod_createCacheFile($forum_array, "forum_parent", "newbb"); return $forum_array; }
/** * Gets list of Captcha items (Internal Function) * @param string $name directory name to look in * @param string $extension extension of the files to look for * @return array array of Captcha items */ public function _getList($name, $extension = "") { $items = array(); $file_path = "{$name}"; $files = icms_core_Filesystem::getFileList($file_path); foreach ($files as $item) { if (empty($extension) || preg_match("/(\\.{$extension})\$/i", $item)) { $items[] = $item; } } if (function_exists("mod_createCacheFile")) { mod_createCacheFile($items, "captcha_{$name}", "captcha"); } return $items; }
function art_createSubCategoryList() { $category_handler =& xoops_getModuleHandler("category", $GLOBALS["artdirname"]); $criteria = new CriteriaCompo("1", 1); $criteria->setSort("cat_pid ASC, cat_order"); $criteria->setOrder("ASC"); $categories_obj = $category_handler->getObjects($criteria); require_once XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/class/tree.php"; $tree = new artTree($categories_obj, "cat_id", "cat_pid"); $category_array = array(); foreach (array_keys($categories_obj) as $key) { if (!($child = array_keys($tree->getAllChild($categories_obj[$key]->getVar("cat_id"))))) { continue; } $category_array[$categories_obj[$key]->getVar("cat_id")] = $child; } unset($categories_obj, $tree, $criteria); mod_createCacheFile($category_array, "category", $GLOBALS["artdirname"]); return $category_array; }
function setTemplate($perms) { return mod_createCacheFile($perms, "perm_template", "xforum"); }