function getContents($order = "", $treeTitle = "", $where = "", $treeSeparator = "\\", $originalSQL = "", $ignoreSelfOnTitle = false, $callback = false) { # This is used on bi_adm::edit.php too $output = array(); if ($this->options[CONS_MODULE_PARENT] != '') { if ($order == "" && $this->order != "") { $odb = array(); $ord = explode(",", $this->order); foreach ($ord as $orditem) { $orditem = trim($orditem); if (strpos($orditem, "+") !== false) { $orditem = str_replace("+", "", $orditem); if ($orditem == $this->options[CONS_MODULE_PARENT]) { continue; } // will add automaticaly if (isset($this->fields[$orditem])) { $odb[] = $this->name . "." . $orditem . " ASC"; } else { $odb[] = $orditem . " ASC"; } } else { $orditem = str_replace("-", "", $orditem); if ($orditem == $this->options[CONS_MODULE_PARENT]) { continue; } // will add automaticaly if (isset($this->fields[$orditem])) { $odb[] = $this->name . "." . $orditem . " DESC"; } else { $odb[] = $orditem . " DESC"; } } } $order = implode(",", $odb); } if ($originalSQL == "") { // built SQL, will use where provided $sql = $this->get_base_sql($where, $this->name . "." . $this->options[CONS_MODULE_PARENT] . " ASC" . ($order != '' ? ',' . $order : '')); } else { // give a full SQL, will just add proper order and treetitle $sql = $originalSQL; if (!is_array($sql)) { $sql = $this->parent->dbo->sqlarray_break($sql); } $sql['ORDER'] = explode(",", $this->name . "." . $this->options[CONS_MODULE_PARENT] . " ASC" . ($order != '' ? ',' . $order : '')); } if (!$this->parent->dbo->query($sql, $r, $n)) { $this->parent->errorControl->raise(146, $this->parent->dbo->log[count($this->parent->dbo->log) - 1], $this->name, 'on getContents'); } $this->parent->templateParams['core'] =& $this->parent; $this->parent->templateParams['module'] =& $this; for ($c = 0; $c < $n; $c++) { $tmpData = $this->parent->dbo->fetch_assoc($r); if ($callback !== false) { $tmpData = $callback($this->parent->template, $this->parent->templateParams, $tmpData); } $tmpData['#'] = $c; $tmpData = prepareDataToOutput($this->parent->template, $this->parent->templateParams, $tmpData); $output[] = $tmpData; } $treeObj = new ttree(); $treeObj->arrayToTree($output, $treeSeparator, $this->options[CONS_MODULE_PARENT], $treeTitle == '' ? $this->title : $treeTitle, $ignoreSelfOnTitle); return $treeObj; } else { $sql = $this->get_base_sql('', $order); $this->parent->dbo->query($sql, $r, $n); for ($c = 0; $c < $n; $c++) { $tmpData = $this->parent->dbo->fetch_assoc($r); $params = array('module' => $this); $tmpData = prepareDataToOutput($this->parent->template, $params, $tmpData); $tmpData['#'] = $c; $output[] = $tmpData; } } return $output; }
} $mode = $core->storage['friendlyurldata']['forum_operationmode']; if ($mode != 'bb' && $core->template->get("_masterpost") === false) { $mode = "bb"; } // force bb mode if we don't have master post (personalized template fail) // ckeditor if we can add data, shadowbox if image if (!$this->noregistration || $mode == "articles") { // if we don't allow registration, we also don't allow postings $core->addLink("ckeditor/ckeditor.js", true); $core->addLink("validators.js"); } // -- this will apply image tags and use _toggles $core->templateParams['core'] =& $this->parent; $core->templateParams['module'] = $core->loaded($core->storage['friendlyurlmodule']); $core->storage['friendlyurldata'] = prepareDataToOutput($core->template, $core->templateParams, $core->storage['friendlyurldata']); $core->template->fill($core->storage['friendlyurldata']); // -- // image meta if ($core->storage['friendlyurldata']['image'] == 'y') { $core->addScript("shadowbox"); $core->template->constants['METAFIGURE'] = $core->storage['friendlyurldata']['image_2']; } // add data from this FORUM data $core->template->assign("forumurla", $core->storage['friendlyurldata']['forum_urla'] != '' ? $core->storage['friendlyurldata']['forum_urla'] . "/" : ""); // add video from FORUMTHREAD (image handled on prepareDataToOutput) if ($core->storage['friendlyurldata']['video'] != '') { $core->template->assign("videoembed", getVideoFrame($core->storage['friendlyurldata']['video'], 0, 0, 'embed-responsive-item')); } else { $core->template->assign("_hasvideo"); }