From: <txm...@us...> - 2013-06-15 12:02:28
|
Revision: 11680 http://sourceforge.net/p/xoops/svn/11680 Author: txmodxoops Date: 2013-06-15 12:02:25 +0000 (Sat, 15 Jun 2013) Log Message: ----------- Added footer blocks Added Paths: ----------- XoopsCore/branches/2.5.x/2.5.6_timgno/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/class/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/class/xoopsblock.php XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/include/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/include/defines.php XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/admin/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/admin/system_blocks.html XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/class/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/class/block.php XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/themes/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/themes/default/ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/themes/default/centerFooter.html XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/themes/default/leftFooter.html XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/themes/default/rightFooter.html Added: XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/class/xoopsblock.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/class/xoopsblock.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/class/xoopsblock.php 2013-06-15 12:02:25 UTC (rev 11680) @@ -0,0 +1,619 @@ +<?php +/** + * XOOPS Block management + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @since 2.0.0 + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ + * @author Skalpa Keo <sk...@xo...> + * @author Taiwen Jiang <ph...@us...> + * @version $Id: xoopsblock.php 8066 2011-11-06 05:09:33Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +include_once $GLOBALS['xoops']->path( 'kernel/object.php' ); + +class XoopsBlock extends XoopsObject +{ + var $db; + + function XoopsBlock($id = null) + { + $this->db =& XoopsDatabaseFactory::getDatabaseConnection(); + $this->initVar('bid', XOBJ_DTYPE_INT, null, false); + $this->initVar('mid', XOBJ_DTYPE_INT, 0, false); + $this->initVar('func_num', XOBJ_DTYPE_INT, 0, false); + $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 255); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150); + //$this->initVar('position', XOBJ_DTYPE_INT, 0, false); + $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 150); + $this->initVar('content', XOBJ_DTYPE_TXTAREA, null, false); + $this->initVar('side', XOBJ_DTYPE_INT, 0, false); + $this->initVar('weight', XOBJ_DTYPE_INT, 0, false); + $this->initVar('visible', XOBJ_DTYPE_INT, 0, false); + // The block_type is in a mess, let's say: + // S - generated by system module + // M - generated by a non-system module + // C - Custom block + // D - cloned system/module block + // E - cloned custom block, DON'T use it + $this->initVar('block_type', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('c_type', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('isactive', XOBJ_DTYPE_INT, null, false); + + $this->initVar('dirname', XOBJ_DTYPE_TXTBOX, null, false, 50); + $this->initVar('func_file', XOBJ_DTYPE_TXTBOX, null, false, 50); + $this->initVar('show_func', XOBJ_DTYPE_TXTBOX, null, false, 50); + $this->initVar('edit_func', XOBJ_DTYPE_TXTBOX, null, false, 50); + + $this->initVar('template', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('bcachetime', XOBJ_DTYPE_INT, 0, false); + $this->initVar('last_modified', XOBJ_DTYPE_INT, 0, false); + + if (!empty($id)) { + if (is_array($id)) { + $this->assignVars($id); + } else { + $this->load(intval($id)); + } + } + } + + /** + * Load $id + * + * @param int $id + */ + function load($id) + { + $id = intval($id); + $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . ' WHERE bid = ' . $id; + $arr = $this->db->fetchArray($this->db->query($sql)); + $this->assignVars($arr); + } + + /** + * Store Block Data to Database + * + * @return int $id + */ + function store() + { + if (!$this->cleanVars()) { + return false; + } + foreach ($this->cleanVars as $k => $v) { + ${$k} = $v; + } + if (empty($bid)) { + $bid = $this->db->genId($this->db->prefix("newblocks") . "_bid_seq"); + $sql = sprintf("INSERT INTO %s (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES (%u, %u, %u, %s, %s, %s, %s, %u, %u, %u, %s, %s, %u, %s, %s, %s, %s, %s, %u, %u)", $this->db->prefix('newblocks'), $bid, $mid, $func_num, $this->db->quoteString($options), $this->db->quoteString($name), $this->db->quoteString($title), $this->db->quoteString($content), $side, $weight, $visible, $this->db->quoteString($block_type), $this->db->quoteString($c_type), 1, $this->db->quoteString($dirname), $this->db->quoteString($func_file), $this->db->quoteString($show_func), $this->db->quoteString($edit_func), $this->db->quoteString($template), $bcachetime, time()); + } else { + $sql = "UPDATE " . $this->db->prefix("newblocks") . " SET options=" . $this->db->quoteString($options); + // a custom block needs its own name + if ($this->isCustom() /* in_array( $block_type , array( 'C' , 'E' ) ) */) { + $sql .= ", name=" . $this->db->quoteString($name); + } + $sql .= ", isactive=" . $isactive . ", title=" . $this->db->quoteString($title) . ", content=" . $this->db->quoteString($content) . ", side=" . $side . ", weight=" . $weight . ", visible=" . $visible . ", c_type=" . $this->db->quoteString($c_type) . ", template=" . $this->db->quoteString($template) . ", bcachetime=" . $bcachetime . ", last_modified=" . time() . " WHERE bid=" . $bid; + } + if (!$this->db->query($sql)) { + $this->setErrors("Could not save block data into database"); + return false; + } + if (empty($bid)) { + $bid = $this->db->getInsertId(); + } + return $bid; + } + + /** + * Delete a ID from the database + * + * @return bool + */ + function delete() + { + $sql = sprintf("DELETE FROM %s WHERE bid = %u", $this->db->prefix('newblocks'), $this->getVar('bid')); + if (! $this->db->query($sql)) { + return false; + } + $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'block_read' AND gperm_itemid = %u AND gperm_modid = 1", $this->db->prefix('group_permission'), $this->getVar('bid')); + $this->db->query($sql); + $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $this->db->prefix('block_module_link'), $this->getVar('bid')); + $this->db->query($sql); + return true; + } + + /** + * do stripslashes/htmlspecialchars according to the needed output + * + * @param $format output use: S for Show and E for Edit + * @param $c_type type of block content + * @returns string + */ + function getContent($format = 's', $c_type = 't') + { + switch ($format) { + case 's': + // check the type of content + // H : custom HTML block + // P : custom PHP block + // S : use text sanitizater (smilies enabled) + // T : use text sanitizater (smilies disabled) + if ($c_type == 'H') { + return str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + } else if ($c_type == 'P') { + ob_start(); + echo eval($this->getVar('content', 'n')); + $content = ob_get_contents(); + ob_end_clean(); + return str_replace('{X_SITEURL}', XOOPS_URL . '/', $content); + } else if ($c_type == 'S') { + $myts =& MyTextSanitizer::getInstance(); + $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + return $myts->displayTarea($content, 1, 1); + } else { + $myts =& MyTextSanitizer::getInstance(); + $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + return $myts->displayTarea($content, 1, 0); + } + break; + case 'e': + return $this->getVar('content', 'e'); + break; + default: + return $this->getVar('content', 'n'); + break; + } + } + + /** + * Build Block + * + * @return unknown + */ + function buildBlock() + { + global $xoopsConfig, $xoopsOption, $xoTheme; + $block = array(); + if (!$this->isCustom()) { + // get block display function + $show_func = $this->getVar('show_func'); + if (!$show_func) { + return false; + } + if (!file_exists($func_file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) { + return false; + } + // must get lang files b4 including the file + // some modules require it for code that is outside the function + xoops_loadLanguage('blocks', $this->getVar('dirname')); + include_once $func_file; + + if (function_exists($show_func)) { + // execute the function + $options = explode('|', $this->getVar('options')); + $block = $show_func($options); + if (!$block) { + return false; + } + } else { + return false; + } + } else { + // it is a custom block, so just return the contents + $block['content'] = $this->getContent('s', $this->getVar('c_type')); + if (empty($block['content'])) { + return false; + } + } + return $block; + } + + /* + * Aligns the content of a block + * If position is 0, content in DB is positioned + * before the original content + * If position is 1, content in DB is positioned + * after the original content + */ + function buildContent($position, $content = "", $contentdb = "") + { + if ($position == 0) { + $ret = $contentdb . $content; + } else if ($position == 1) { + $ret = $content . $contentdb; + } + return $ret; + } + + /** + * Enter description here... + * + * @param string $originaltitle + * @param string $newtitle + * @return string title + */ + function buildTitle($originaltitle, $newtitle = '') + { + if ($newtitle != '') { + $ret = $newtitle; + } else { + $ret = $originaltitle; + } + return $ret; + } + + /** + * XoopsBlock::isCustom() + * + * @return + */ + function isCustom() + { + return in_array($this->getVar('block_type'), array( + 'C' , + 'E')); + } + + /** + * XoopsBlock::getOptions() + * + * @return + */ + function getOptions() + { + global $xoopsConfig; + if (!$this->isCustom()) { + $edit_func = $this->getVar('edit_func'); + if (!$edit_func) { + return false; + } + if (file_exists($GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) { + if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/blocks.php'))) { + include_once $file; + } elseif (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/english/blocks.php'))) { + include_once $file; + } + include_once $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')); + $options = explode("|", $this->getVar("options")); + $edit_form = $edit_func($options); + if (!$edit_form) { + return false; + } + return $edit_form; + } else { + return false; + } + } else { + return false; + } + } + + /** + * get all the blocks that match the supplied parameters + * @param $side 0: sideblock - left + * 1: sideblock - right + * 2: sideblock - left and right + * 3: centerblock - left + * 4: centerblock - right + * 5: centerblock - center + * 6: centerblock - left, right, center + * @param $groupid groupid (can be an array) + * @param $visible 0: not visible 1: visible + * @param $orderby order of the blocks + * @returns array of block objects + */ + function getAllBlocksByGroup($groupid, $asobject = true, $side = null, $visible = null, $orderby = "b.weight,b.bid", $isactive = 1) + { + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + if (!$asobject) { + $sql = 'SELECT b.bid '; + } else { + $sql = 'SELECT b.* '; + } + $sql .= "FROM " . $db->prefix("newblocks") . " b LEFT JOIN " . $db->prefix("group_permission") . " l ON l.gperm_itemid=b.bid WHERE gperm_name = 'block_read' AND gperm_modid = 1"; + if (is_array($groupid)) { + $sql .= " AND (l.gperm_groupid=" . $groupid[0] . ""; + $size = count($groupid); + if ($size > 1) { + for($i = 1; $i < $size; $i ++) { + $sql .= " OR l.gperm_groupid=" . $groupid[$i] . ""; + } + } + $sql .= ")"; + } else { + $sql .= " AND l.gperm_groupid=" . $groupid . ""; + } + $sql .= " AND b.isactive=" . $isactive; + if (isset($side)) { + // get both sides in sidebox? (some themes need this) + if ($side == XOOPS_SIDEBLOCK_BOTH) { + $side = "(b.side=0 OR b.side=1)"; + } elseif ($side == XOOPS_CENTERBLOCK_ALL) { + $side = "(b.side=3 OR b.side=4 OR b.side=5 OR b.side=7 OR b.side=8 OR b.side=9 )"; + } elseif ($side == XOOPS_FOOTERBLOCK_ALL) { + $side = "(b.side=10 OR b.side=11 OR b.side=12 )"; + } else { + $side = "b.side=" . $side; + } + $sql .= " AND " . $side; + } + if (isset($visible)) { + $sql .= " AND b.visible=$visible"; + } + $sql .= " ORDER BY $orderby"; + $result = $db->query($sql); + $added = array(); + while ($myrow = $db->fetchArray($result)) { + if (!in_array($myrow['bid'], $added)) { + if (!$asobject) { + $ret[] = $myrow['bid']; + } else { + $ret[] = new XoopsBlock($myrow); + } + array_push($added, $myrow['bid']); + } + } + return $ret; + } + + /** + * XoopsBlock::getAllBlocks() + * + * @param string $rettype + * @param mixed $side + * @param mixed $visible + * @param string $orderby + * @param integer $isactive + * @return + */ + function getAllBlocks($rettype = "object", $side = null, $visible = null, $orderby = "side,weight,bid", $isactive = 1) + { + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + $where_query = " WHERE isactive=" . $isactive; + if (isset($side)) { + // get both sides in sidebox? (some themes need this) + if ($side == 2) { + $side = "(side=0 OR side=1)"; + } elseif ($side == 6) { + $side = "(side=3 OR side=4 OR side=5 OR side=7 OR side=8 OR side=9)"; + } elseif ($side == 10) { + $side = "(side=11 OR side=12 OR side=13)"; + } else { + $side = "side=" . $side; + } + $where_query .= " AND " . $side; + } + if (isset($visible)) { + $where_query .= " AND visible=.". $visible; + } + $where_query .= " ORDER BY ".$orderby; + switch ($rettype) { + case "object": + $sql = "SELECT * FROM " . $db->prefix("newblocks") . "" . $where_query; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $ret[] = new XoopsBlock($myrow); + } + break; + case "list": + $sql = "SELECT * FROM " . $db->prefix("newblocks") . "" . $where_query; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $block = new XoopsBlock($myrow); + $title = $block->getVar("title"); + $title = empty($title) ? $block->getVar("name") : $title; + $ret[$block->getVar("bid")] = $title; + } + break; + case "id": + $sql = "SELECT bid FROM " . $db->prefix("newblocks") . "" . $where_query; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $ret[] = $myrow['bid']; + } + break; + } + //echo $sql; + return $ret; + } + + /** + * XoopsBlock::getByModule() + * + * @param mixed $moduleid + * @param mixed $asobject + * @return + */ + function getByModule($moduleid, $asobject = true) + { + $moduleid = intval($moduleid); + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + if ($asobject == true) { + $sql = $sql = "SELECT * FROM " . $db->prefix("newblocks") . " WHERE mid=" . $moduleid; + } else { + $sql = "SELECT bid FROM " . $db->prefix("newblocks") . " WHERE mid=" . $moduleid; + } + $result = $db->query($sql); + $ret = array(); + while ($myrow = $db->fetchArray($result)) { + if ($asobject) { + $ret[] = new XoopsBlock($myrow); + } else { + $ret[] = $myrow['bid']; + } + } + return $ret; + } + + /** + * XoopsBlock::getAllByGroupModule() + * + * @param mixed $groupid + * @param integer $module_id + * @param mixed $toponlyblock + * @param mixed $visible + * @param string $orderby + * @param integer $isactive + * @return + */ + function getAllByGroupModule($groupid, $module_id = 0, $toponlyblock = false, $visible = null, $orderby = 'b.weight, m.block_id', $isactive = 1) + { + $isactive = intval($isactive); + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + if (isset($groupid)) { + $sql = "SELECT DISTINCT gperm_itemid FROM " . $db->prefix('group_permission') . " WHERE gperm_name = 'block_read' AND gperm_modid = 1"; + if (is_array($groupid)) { + $sql .= ' AND gperm_groupid IN (' . implode(',', $groupid) . ')'; + } else { + if (intval($groupid) > 0) { + $sql .= ' AND gperm_groupid=' . intval($groupid); + } + } + $result = $db->query($sql); + $blockids = array(); + while ($myrow = $db->fetchArray($result)) { + $blockids[] = $myrow['gperm_itemid']; + } + if (empty($blockids)) { + return $blockids; + } + } + $sql = 'SELECT b.* FROM ' . $db->prefix('newblocks') . ' b, ' . $db->prefix('block_module_link') . ' m WHERE m.block_id=b.bid'; + $sql .= ' AND b.isactive=' . $isactive; + if (isset($visible)) { + $sql .= ' AND b.visible=' . intval($visible); + } + if (!isset($module_id)) { + } else if (!empty($module_id)) { + $sql .= ' AND m.module_id IN (0,' . intval($module_id); + if ($toponlyblock) { + $sql .= ',-1'; + } + $sql .= ')'; + } else { + if ($toponlyblock) { + $sql .= ' AND m.module_id IN (0,-1)'; + } else { + $sql .= ' AND m.module_id=0'; + } + } + if (!empty($blockids)) { + $sql .= ' AND b.bid IN (' . implode(',', $blockids) . ')'; + } + $sql .= ' ORDER BY ' . $orderby; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $block = new XoopsBlock($myrow); + $ret[$myrow['bid']] = & $block; + unset($block); + } + return $ret; + } + + /** + * XoopsBlock::getNonGroupedBlocks() + * + * @param integer $module_id + * @param mixed $toponlyblock + * @param mixed $visible + * @param string $orderby + * @param integer $isactive + * @return + */ + function getNonGroupedBlocks($module_id = 0, $toponlyblock = false, $visible = null, $orderby = 'b.weight, m.block_id', $isactive = 1) + { + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + $bids = array(); + $sql = "SELECT DISTINCT(bid) from " . $db->prefix('newblocks'); + if ($result = $db->query($sql)) { + while ($myrow = $db->fetchArray($result)) { + $bids[] = $myrow['bid']; + } + } + $sql = "SELECT DISTINCT(p.gperm_itemid) from " . $db->prefix('group_permission') . " p, " . $db->prefix('groups') . " g WHERE g.groupid=p.gperm_groupid AND p.gperm_name='block_read'"; + $grouped = array(); + if ($result = $db->query($sql)) { + while ($myrow = $db->fetchArray($result)) { + $grouped[] = $myrow['gperm_itemid']; + } + } + $non_grouped = array_diff($bids, $grouped); + if (!empty($non_grouped)) { + $sql = 'SELECT b.* FROM ' . $db->prefix('newblocks') . ' b, ' . $db->prefix('block_module_link') . ' m WHERE m.block_id=b.bid'; + $sql .= ' AND b.isactive=' . intval($isactive); + if (isset($visible)) { + $sql .= ' AND b.visible=' . intval($visible); + } + if (!isset($module_id)) { + } else if (!empty($module_id)) { + $sql .= ' AND m.module_id IN (0,' . intval($module_id); + if ($toponlyblock) { + $sql .= ',-1'; + } + $sql .= ')'; + } else { + if ($toponlyblock) { + $sql .= ' AND m.module_id IN (0,-1)'; + } else { + $sql .= ' AND m.module_id=0'; + } + } + $sql .= ' AND b.bid IN (' . implode(',', $non_grouped) . ')'; + $sql .= ' ORDER BY ' . $orderby; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $block = new XoopsBlock($myrow); + $ret[$myrow['bid']] =& $block; + unset($block); + } + } + return $ret; + } + + /** + * XoopsBlock::countSimilarBlocks() + * + * @param mixed $moduleId + * @param mixed $funcNum + * @param mixed $showFunc + * @return + */ + function countSimilarBlocks($moduleId, $funcNum, $showFunc = null) + { + $funcNum = intval($funcNum); + $moduleId = intval($moduleId); + if ($funcNum < 1 || $moduleId < 1) { + // invalid query + return 0; + } + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + if (isset($showFunc)) { + // showFunc is set for more strict comparison + $sql = sprintf("SELECT COUNT(*) FROM %s WHERE mid = %d AND func_num = %d AND show_func = %s", $db->prefix('newblocks'), $moduleId, $funcNum, $db->quoteString(trim($showFunc))); + } else { + $sql = sprintf("SELECT COUNT(*) FROM %s WHERE mid = %d AND func_num = %d", $db->prefix('newblocks'), $moduleId, $funcNum); + } + if (!$result = $db->query($sql)) { + return 0; + } + list ($count) = $db->fetchRow($result); + return $count; + } +} +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/include/defines.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/include/defines.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/include/defines.php 2013-06-15 12:02:25 UTC (rev 11680) @@ -0,0 +1,123 @@ +<?php +/** + * XOOPS constansts + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @since 2.0.0 + * @version $Id: defines.php 10054 2012-08-11 10:06:44Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * Define required Defines (I guess lol ) + */ +define('XOOPS_SIDEBLOCK_LEFT', 0); +define('XOOPS_SIDEBLOCK_RIGHT', 1); +define('XOOPS_SIDEBLOCK_BOTH', 2); +define('XOOPS_CENTERBLOCK_LEFT', 3); +define('XOOPS_CENTERBLOCK_RIGHT', 4); +define('XOOPS_CENTERBLOCK_CENTER', 5); +define('XOOPS_CENTERBLOCK_ALL', 6); +define('XOOPS_CENTERBLOCK_BOTTOMLEFT', 7); +define('XOOPS_CENTERBLOCK_BOTTOMRIGHT', 8); +define('XOOPS_CENTERBLOCK_BOTTOM', 9); +define('XOOPS_FOOTERBLOCK_ALL', 10); +define('XOOPS_FOOTERBLOCK_LEFT', 11); +define('XOOPS_FOOTERBLOCK_RIGHT', 12); +define('XOOPS_FOOTERBLOCK_CENTER', 13); +define('XOOPS_BLOCK_INVISIBLE', 0); +define('XOOPS_BLOCK_VISIBLE', 1); +define('XOOPS_MATCH_START', 0); +define('XOOPS_MATCH_END', 1); +define('XOOPS_MATCH_EQUAL', 2); +define('XOOPS_MATCH_CONTAIN', 3); +// YOU SHOULD AVOID USING THE FOLLOWING CONSTANTS, THEY WILL BE REMOVED +define('XOOPS_THEME_PATH', XOOPS_ROOT_PATH . '/themes'); +define('XOOPS_ADMINTHEME_PATH', XOOPS_ROOT_PATH . '/modules/system/themes'); +define('XOOPS_UPLOAD_PATH', XOOPS_ROOT_PATH . '/uploads'); +define('XOOPS_LIBRARY_PATH', XOOPS_ROOT_PATH . '/libraries'); +define('XOOPS_THEME_URL', XOOPS_URL . '/themes'); +define('XOOPS_ADMINTHEME_URL', XOOPS_URL . '/modules/system/themes'); +define('XOOPS_UPLOAD_URL', XOOPS_URL . '/uploads'); +define('XOOPS_LIBRARY_URL', XOOPS_URL . '/libraries'); + +// ----- BEGIN: Deprecated, move to template class ----- +// define('SMARTY_DIR', XOOPS_ROOT_PATH . '/class/smarty/'); +define('XOOPS_COMPILE_PATH', XOOPS_VAR_PATH . '/caches/smarty_compile'); +define('XOOPS_CACHE_PATH', XOOPS_VAR_PATH . '/caches/xoops_cache'); +// ----- END: Deprecated, move to template class ----- + +if (!defined('XOOPS_XMLRPC')) { + define('XOOPS_DB_CHKREF', 1); +} else { + define('XOOPS_DB_CHKREF', 0); +} + +/** + * User Mulitbytes + */ +// if ( !defined( 'XOOPS_USE_MULTIBYTES' ) ) { +// define('XOOPS_USE_MULTIBYTES', 0 ); +// } + +// IT IS A WRONG PLACE FOR THE FOLLOWING CONSTANTS +/* + * Some language definitions that cannot be translated + */ +define('_XOOPS_FATAL_MESSAGE', "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> +<html xmlns='http://www.w3.org/1999/xhtml'> +<head> +<meta http-equiv='Content-Type' content='text/html; charset=utf-8;charset=utf-8' /> +<title>Internal server error</title> +<style type='text/css'> +* { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif;} +body {font-size: 12px; background-color: #f0f0f0; text-align: center;} +#xo-siteblocked { + border: 1px solid #c0c4c0; + width: 375px; + height: 318px; + margin: 150px auto; + text-align: center; + background-color: #fff; + background-image: url(images/img_errors.png); + background-repeat: no-repeat; + background-position: 30px 50px; + padding-left: 300px; + padding-right: 30px; + border-radius: 15px; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; +} + #xo-siteblocked h1 {font-size: 1.7em; margin: 45px 0 30px 0;} + #xo-siteblocked h2 {font-size: 1.5em; margin: 0 0 30px 0;} + #xo-siteblocked h1, h2 {font-weight: normal; text-shadow: 1px 1px 2px #ccc;} + #xo-siteblocked a, #xo-siteblocked a:visited {color: #2cb0ff; text-decoration: none;} + #xo-siteblocked p { font-size: 1.3em; margin-top: 12px; line-height: 2em;} + #xo-siteblocked p.xo-siteblocked-message { height: 70px;} + #xo-siteblocked p.xo-siteblocked-desc { font-size: .9em; font-style: italic; margin-top: 25px;} +</style> +</head> +<body> + <div id='xo-siteblocked'> + <h1>A problem has occurred on our server!</h1> + <h2>Page is currently unavailable</h2> + <p class='xo-siteblocked-message'>We are working on a fix<br /><a href='/'>Please come back soon ...</a></p> + <p class='xo-siteblocked-desc'>Error : %s</p> + </div> +</body> +</html>" +); + +define('_XOOPS_FATAL_BACKTRACE', "Backtrace"); + +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/admin/system_blocks.html =================================================================== --- XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/admin/system_blocks.html (rev 0) +++ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/admin/system_blocks.html 2013-06-15 12:02:25 UTC (rev 11680) @@ -0,0 +1,107 @@ +<!-- Breadcrumb Header --> +<{includeq file="db:system_header.html"}> +<script type="text/javascript"> + IMG_ON = '<{xoAdminIcons success.png}>'; + IMG_OFF = '<{xoAdminIcons cancel.png}>'; +</script> +<{if $filterform}> +<div class="floatright"> + <div class="xo-buttons"> + <button id="xo-add-btn" class="ui-corner-all" onclick="self.location.href='admin.php?fct=blocksadmin&op=add';"> + <img src="<{xoAdminIcons add.png}>" alt="<{$smarty.const._AM_SYSTEM_BLOCKS_ADD}>" /> + <{$smarty.const._AM_SYSTEM_BLOCKS_ADD}> + </button> + </div> +</div> +<div class="clear"></div> +<div id="xo-block-dragndrop"> + <table class="outer"> + <tr> + <th> + <form name="<{$filterform.name}>" id="<{$filterform.name}>" action="<{$filterform.action}>" method="<{$filterform.method}>" <{$filterform.extra}> > + <div class="xo-blocksfilter"> + <{foreach item=element from=$filterform.elements}> + <{if $element.hidden != true}> + + <div class="xo-caption"><{$element.caption}></div> + <div class="xo-element"><{$element.body}></div> + <{else}> + <{$element.body}> + <{/if}> + <{/foreach}> + </div> + </form> + </th> + </tr> + <tr> + <td> + <table id="xo-block-managment"> + <tr> + <td side="0" class="xo-blocksection" rowspan="3" id="xo-leftcolumn"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDELEFT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=0}> + </td> + <td side="3" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDETOPLEFT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=3}> + </td> + <td side="5" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDETOPCENTER}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=5}> + </td> + <td side="4" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDETOPRIGHT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=4}> + </td> + <td side="1" class="xo-blocksection" rowspan="3" id="xo-rightcolumn"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDERIGHT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=1}> + </td> + </tr> + <tr style="height:30px;"> + <td colspan="3" class="xo-blockContent width5"> </td> + </tr> + <tr> + <td side="7" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDEBOTTOMLEFT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=7}> + </td> + <td side="9" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDEBOTTOMCENTER}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=9}> + </td> + <td side="8" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDEBOTTOMRIGHT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=8}> + </td> + </tr> + <tr> + <table id="xo-block-footer"> + <tr> + <td side="11" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDEFOOTERLEFT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=11}> + </td> + <td side="13" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDEFOOTERCENTER}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=13}> + </td> + <td side="12" class="xo-blocksection"> + <div class="xo-title"><{$smarty.const._AM_SYSTEM_BLOCKS_SIDEFOOTERRIGHT}></div> + <{includeq file="db:system_blocks_item.html" blocks=$blocks side=12}> + </td> + </tr> + </table> + </tr> + </table> + </td> + </tr> + </table> +</div> +<{/if}> +<div id="xo-block-add" <{if $filterform}>class="hide"<{/if}>> + <{if !$filterform}><br /><{/if}> + <{$blockform}> +</div> +<!-- Preview block --> +<div id="xo-preview-block" class="hide"></div> Added: XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/class/block.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/class/block.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.6_timgno/htdocs/modules/system/templates/class/block.php 2013-06-15 12:02:25 UTC (rev 11680) @@ -0,0 +1,564 @@ +<?php +/** + * Block Class Manager +* + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package system + * @version $Id: block.php 8066 2011-11-06 05:09:33Z beckmi $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +require_once XOOPS_ROOT_PATH . '/kernel/block.php'; + +/** + * System Block + * + * @copyright copyright (c) 2000 XOOPS.org + * @package system + */ +class SystemBlock extends XoopsBlock +{ + function __construct() + { + parent::__construct(); + } + + function getForm($mode='edit') + { + if ($this->isNew()) { + $title = _AM_SYSTEM_BLOCKS_ADDBLOCK; + $modules = array(-1); + $groups = array( XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS, XOOPS_GROUP_ADMIN ); + $this->setVar('block_type', 'C'); + $this->setVar('visible',1); + $op = 'save'; + } else { + // Search modules + $blocklinkmodule_handler =& xoops_getmodulehandler('blocklinkmodule'); + $criteria = new CriteriaCompo(new Criteria('block_id', $this->getVar('bid') )); + $blocklinkmodule = $blocklinkmodule_handler->getObjects($criteria); + foreach ($blocklinkmodule as $link) { + $modules[] = $link->getVar('module_id'); + } + // Saerch perms + $groupperm_handler =& xoops_gethandler('groupperm'); + $groups =& $groupperm_handler->getGroupIds('block_read', $this->getVar('bid')); + switch ($mode) { + case 'edit': + $title = _AM_SYSTEM_BLOCKS_EDITBLOCK; + break; + case 'clone': + $title = _AM_SYSTEM_BLOCKS_CLONEBLOCK; + $this->setVar('bid', 0); + if ( $this->isCustom() ) { + $this->setVar('block_type', 'C'); + } else { + $this->setVar('block_type', 'D'); + } + break; + } + $op = 'save'; + } + $form = new XoopsThemeForm($title, 'blockform', 'admin.php', 'post', true); + if (!$this->isNew()) { + $form->addElement(new XoopsFormLabel(_AM_SYSTEM_BLOCKS_NAME, $this->getVar('name'))); + } + // Side position + $side_select = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_TYPE, 'side', $this->getVar('side')); + $side_select->addOptionArray(array( + 0 => _AM_SYSTEM_BLOCKS_SBLEFT, + 1 => _AM_SYSTEM_BLOCKS_SBRIGHT, + 3 => _AM_SYSTEM_BLOCKS_CBLEFT, + 4 => _AM_SYSTEM_BLOCKS_CBRIGHT, + 5 => _AM_SYSTEM_BLOCKS_CBCENTER, + 7 => _AM_SYSTEM_BLOCKS_CBBOTTOMLEFT, + 8 => _AM_SYSTEM_BLOCKS_CBBOTTOMRIGHT, + 9 => _AM_SYSTEM_BLOCKS_CBBOTTOM, + 11 => _AM_SYSTEM_BLOCKS_CBFOOTERLEFT, + 12 => _AM_SYSTEM_BLOCKS_CBFOOTERRIGHT, + 13 => _AM_SYSTEM_BLOCKS_CBFOOTERCENTER)); + $form->addElement($side_select); + // Order + $form->addElement(new XoopsFormText(_AM_SYSTEM_BLOCKS_WEIGHT, 'weight', 2, 5, $this->getVar('weight'))); + // Display + $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_BLOCKS_VISIBLE, 'visible', $this->getVar('visible'))); + // Visible In + $mod_select = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_VISIBLEIN, 'modules', $modules, 5, true); + $module_handler =& xoops_gethandler('module'); + $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); + $criteria->add(new Criteria('isactive', 1)); + $module_list = $module_handler->getList($criteria); + $module_list[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; + $module_list[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; + ksort($module_list); + $mod_select->addOptionArray($module_list); + $form->addElement($mod_select); + // Title + $form->addElement(new XoopsFormText(_AM_SYSTEM_BLOCKS_TITLE, 'title', 50, 255, $this->getVar('title')), false ); + if ($this->isNew() || $this->isCustom()) { + $editor_configs=array(); + $editor_configs["name"] ="content_block"; + $editor_configs["value"] = $this->getVar('content', 'e'); + $editor_configs["rows"] = 20; + $editor_configs["cols"] = 100; + $editor_configs["width"] = "100%"; + $editor_configs["height"] = "400px"; + $editor_configs["editor"] = xoops_getModuleOption('blocks_editor', 'system'); + $form->addElement(new XoopsFormEditor(_AM_SYSTEM_BLOCKS_CONTENT, "content_block", $editor_configs), true); + if ( in_array( $editor_configs["editor"], array('dhtmltextarea','textarea' ) ) ) { + $ctype_select = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_CTYPE, 'c_type', $this->getVar('c_type')); + $ctype_select->addOptionArray(array( + 'H' => _AM_SYSTEM_BLOCKS_HTML, + 'P' => _AM_SYSTEM_BLOCKS_PHP, + 'S' => _AM_SYSTEM_BLOCKS_AFWSMILE, + 'T' => _AM_SYSTEM_BLOCKS_AFNOSMILE)); + $form->addElement($ctype_select); + } else { + $form->addElement(new XoopsFormHidden('c_type', 'H')); + } + } else { + if ($this->getVar('template') != '') { + $tplfile_handler =& xoops_gethandler('tplfile'); + $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $this->getVar('bid') ); + if (count($btemplate) > 0) { + $form->addElement(new XoopsFormLabel(_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate[0]->getVar('tpl_id') . '">' . _AM_SYSTEM_BLOCKS_EDITTPL . '</a>')); + } else { + $btemplate2 = $tplfile_handler->find('default', 'block', $this->getVar('bid')); + if (count($btemplate2) > 0) { + $form->addElement(new XoopsFormLabel(_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate2[0]->getVar('tpl_id') . '" rel="external">' . _AM_SYSTEM_BLOCKS_EDITTPL . '</a>')); + } + } + } + if ( $this->getOptions() != false ) { + $form->addElement(new XoopsFormLabel(_AM_SYSTEM_BLOCKS_OPTIONS, $this->getOptions())); + } else { + $form->addElement(new XoopsFormHidden('options', $this->getVar('options'))); + } + $form->addElement(new XoopsFormHidden('c_type', 'H')); + } + $cache_select = new XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $this->getVar('bcachetime')); + $cache_select->addOptionArray(array( + '0' => _NOCACHE, + '30' => sprintf(_SECONDS, 30), + '60' => _MINUTE, + '300' => sprintf(_MINUTES, 5), + '1800' => sprintf(_MINUTES, 30), + '3600' => _HOUR, + '18000' => sprintf(_HOURS, 5), + '86400' => _DAY, + '259200' => sprintf(_DAYS, 3), + '604800' => _WEEK, + '2592000' => _MONTH)); + $form->addElement($cache_select); + // Groups + $form->addElement(new XoopsFormSelectGroup( _AM_SYSTEM_BLOCKS_GROUP, 'groups', true, $groups, 5, true) ); + + $form->addElement(new XoopsFormHidden('block_type', $this->getVar('block_type'))); + $form->addElement(new XoopsFormHidden('mid', $this->getVar('mid'))); + $form->addElement(new XoopsFormHidden('func_num', $this->getVar('func_num'))); + $form->addElement(new XoopsFormHidden('func_file', $this->getVar('func_file'))); + $form->addElement(new XoopsFormHidden('show_func', $this->getVar('show_func'))); + $form->addElement(new XoopsFormHidden('edit_func', $this->getVar('edit_func'))); + $form->addElement(new XoopsFormHidden('template', $this->getVar('template'))); + $form->addElement(new XoopsFormHidden('dirname', $this->getVar('dirname'))); + $form->addElement(new XoopsFormHidden('name', $this->getVar('name'))); + $form->addElement(new XoopsFormHidden('bid', $this->getVar('bid'))); + $form->addElement(new XoopsFormHidden('op', $op )); + $form->addElement(new XoopsFormHidden('fct', 'blocksadmin')); + $button_tray = new XoopsFormElementTray('', ' '); + if ($this->isNew() || $this->isCustom()) { + $preview = new XoopsFormButton('', 'previewblock', _PREVIEW, 'preview'); + $preview->setExtra("onclick=\"blocks_preview();\""); + $button_tray->addElement( $preview ); + } + $button_tray->addElement(new XoopsFormButton('', 'submitblock', _SUBMIT, 'submit')); + $form->addElement($button_tray); + + return $form; + } + + /** + * XoopsBlock::getOptions() + * + * @return + */ + function getOptions() + { + global $xoopsConfig; + if (!$this->isCustom()) { + $edit_func = $this->getVar('edit_func'); + if (!$edit_func) { + return false; + } + if (file_exists($GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) { + if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/blocks.php'))) { + include_once $file; + } elseif (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/english/blocks.php'))) { + include_once $file; + } + include_once $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')); + $options = explode("|", $this->getVar("options")); + $edit_form = $edit_func($options); + if (!$edit_form) { + return false; + } + return $edit_form; + } else { + return false; + } + } else { + return false; + } + } + + function isCustom() + { + if ($this->getVar('block_type') == 'C') return true; + return false; + } + + /** + * do stripslashes/htmlspecialchars according to the needed output + * + * @param $format output use: S for Show and E for Edit + * @param $c_type type of block content + * @returns string + */ + function getContent($format = 's', $c_type = 'T') + { + $format = strtolower($format); + $c_type = strtoupper($c_type); + switch ($format) { + case 's': + // check the type of content + // H : custom HTML block + // P : custom PHP block + // S : use text sanitizater (smilies enabled) + // T : use text sanitizater (smilies disabled) + if ($c_type == 'H') { + return str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + } else if ($c_type == 'P') { + ob_start(); + echo eval($this->getVar('content', 'n')); + $content = ob_get_contents(); + ob_end_clean(); + return str_replace('{X_SITEURL}', XOOPS_URL . '/', $content); + } else if ($c_type == 'S') { + $myts =& MyTextSanitizer::getInstance(); + $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + return $myts->displayTarea($content, 1, 1); + } else { + $myts =& MyTextSanitizer::getInstance(); + $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + return $myts->displayTarea($content, 1, 0); + } + break; + case 'e': + return $this->getVar('content', 'e'); + break; + default: + return $this->getVar('content', 'n'); + break; + } + } +} + +/** + * System block handler class. (Singelton) + * + * This class is responsible for providing data access mechanisms to the data source + * of XOOPS block class objects. + * + * @copyright copyright (c) 2000 XOOPS.org + * @package system + * @subpackage avatar + */ +class SystemBlockHandler extends XoopsPersistableObjectHandler +{ + function __construct($db) + { + parent::__construct($db, 'newblocks', 'SystemBlock', 'bid', 'title'); + } + + function insert($obj) + { + $obj->setVar('last_modified', time()); + return parent::insert($obj); + } + + /** + * retrieve array of {@link XoopsBlock}s meeting certain conditions + * + * @param object $criteria {@link CriteriaElement} with conditions for the blocks + * @param bool $id_as_key should the blocks' bid be the key for the returned array? + * @return array {@link XoopsBlock}s matching the conditions + **/ + function getObjects($criteria = null, $id_as_key = false) + { + $ret = array(); + $limit = $start = 0; + $sql = 'SELECT DISTINCT(b.bid), b.* FROM ' . $this->db->prefix('newblocks') . ' b LEFT JOIN ' . $this->db->prefix('block_module_link') . ' l ON b.bid=l.block_id'; + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); + $limit = $criteria->getLimit(); + $start = $criteria->getStart(); + } + $result = $this->db->query($sql, $limit, $start); + if (!$result) { + return $ret; + } + + while ($myrow = $this->db->fetchArray($result)) { + $block = new SystemBlock(); + $block->assignVars($myrow); + if (!$id_as_key) { + $ret[] =& $block; + } else { + $ret[$myrow['bid']] = & $block; + } + unset($block); + } + return $ret; + } + + /** + * get all the blocks that match the supplied parameters + * + * @param $side + * 0: sideblock - left + * 1: sideblock - right + * 2: sideblock - left and right + * 3: centerblock - left + * 4: centerblock - right + * 5: centerblock - center + * 6: centerblock - left, right, center + * @param $groupid groupid (can be an array) + * @param $visible 0: not visible 1: visible + * @param $orderby order of the blocks + * @returns array of block objects + */ + function getAllBlocksByGroup($groupid, $asobject = true, $side = null, $visible = null, $orderby = "b.weight,b.bid", $isactive = 1) + { + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + if (!$asobject) { + $sql = 'SELECT b.bid '; + } else { + $sql = 'SELECT b.* '; + } + $sql .= "FROM " . $db->prefix("newblocks") . " b LEFT JOIN " . $db->prefix("group_permission") . " l ON l.gperm_itemid=b.bid WHERE gperm_name = 'block_read' AND gperm_modid = 1"; + if (is_array($groupid)) { + $sql .= " AND (l.gperm_groupid=" . $groupid[0] . ""; + $size = count($groupid); + if ($size > 1) { + for($i = 1; $i < $size; $i ++) { + $sql .= " OR l.gperm_groupid=" . $groupid[$i] . ""; + } + } + $sql .= ")"; + } else { + $sql .= " AND l.gperm_groupid=" . $groupid . ""; + } + $sql .= " AND b.isactive=" . $isactive; + if (isset($side)) { + // get both sides in sidebox? (some themes need this) + if ($side == XOOPS_SIDEBLOCK_BOTH) { + $side = "(b.side=0 OR b.side=1)"; + } elseif ($side == XOOPS_CENTERBLOCK_ALL) { + $side = "(b.side=3 OR b.side=4 OR b.side=5 OR b.side=7 OR b.side=8 OR b.side=9 )"; + } elseif ($side == XOOPS_FOOTERBLOCK_ALL) { + $side = "(b.side=11 OR b.side=12 OR b.side=13 )"; + } else { + $side = "b.side=" . $side; + } + $sql .= " AND " . $side; + } + if (isset($visible)) { + $sql .= " AND b.visible=$visible"; + } + $sql .= " ORDER BY $orderby"; + $result = $db->query($sql); + $added = array(); + while ($myrow = $db->fetchArray($result)) { + if (!in_array($myrow['bid'], $added)) { + if (!$asobject) { + $ret[] = $myrow['bid']; + } else { + $ret[] = new XoopsBlock($myrow); + } + array_push($added, $myrow['bid']); + } + } + return $ret; + } + + function getBlockByPerm( $groupid ) + { + $ret = array(); + if (isset($groupid)) { + $sql = "SELECT DISTINCT gperm_itemid FROM " . $this->db->prefix('group_permission') . " WHERE gperm_name = 'block_read' AND gperm_modid = 1"; + if ( is_array($groupid) ) { + $sql .= ' AND gperm_groupid IN (' . implode(',', $groupid) . ')'; + } else { + if (intval($groupid) > 0) { + $sql .= ' AND gperm_groupid=' . intval($groupid); + } + } + $result = $this->db->query($sql); + $blockids = array(); + while ( $myrow = $this->db->fetchArray( $result ) ) { + $blockids[] = $myrow['gperm_itemid']; + } + if (empty($blockids)) { + return $blockids; + } + return $blockids; + } + } + + function getAllByGroupModule($groupid, $module_id = 0, $toponlyblock = false, $visible = null, $orderby = 'b.weight, m.block_id', $isactive = 1) + { + $isactive = intval($isactive); + $db = $GLOBALS['xoopsDB']; + $ret = array(); + if (isset($groupid)) { + $sql = "SELECT DISTINCT gperm_itemid FROM ".$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1"; + if ( is_array($groupid) ) { + $sql .= ' AND gperm_groupid IN ('.implode(',', $groupid).')'; + } else { + if (intval($groupid) > 0) { + $sql .= ' AND gperm_groupid='.intval($groupid); + } + } + $result = $db->query($sql); + $blockids = array(); + while ( $myrow = $db->fetchArray($result) ) { + $blockids[] = $myrow['gperm_itemid']; + } + if (empty($blockids)) { + return $blockids; + } + } + $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid'; + $sql .= ' AND b.isactive='.$isactive; + if (isset($visible)) { + $sql .= ' AND b.visible='.intval($visible); + } + if (!isset($module_id)) { + } elseif (!empty($module_id)) { + $sql .= ' AND m.module_id IN (0,'. intval($module_id); + if ($toponlyblock) { + $sql .= ',-1'; + } + $sql .= ')'; + } else { + if ($toponlyblock) { + $sql .= ' AND m.module_id IN (0,-1)'; + } else { + $sql .= ' AND m.module_id=0'; + } + } + if (!empty($blockids)) { + $sql .= ' AND b.bid IN ('.implode(',', $blockids).')'; + } + $sql .= ' ORDER BY '.$orderby; + $result = $db->query($sql); + while ( $myrow = $db->fetchArray($result) ) { + $block = new XoopsBlock($myrow); + $ret[$myrow['bid']] =& $block; + unset($block); + } + return $ret; + } + + function getNonGroupedBlocks($module_id = 0, $toponlyblock = false, $visible = null, $orderby = 'b.weight, m.block_id', $isactive = 1) + { + $db = $GLOBALS['xoopsDB']; + $ret = array(); + $bids = array(); + $sql = "SELECT DISTINCT(bid) from ".$db->prefix('newblocks'); + if ($result = $db->query($sql)) { + while ( $myrow = $db->fetchArray($result) ) { + $bids[] = $myrow['bid']; + } + } + $sql = "SELECT DISTINCT(p.gperm_itemid) from ".$db->prefix('group_permission')." p, ".$db->prefix('groups')." g WHERE g.groupid=p.gperm_groupid AND p.gperm_name='block_read'"; + $grouped = array(); + if ($result = $db->query($sql)) { + while ( $myrow = $db->fetchArray($result) ) { + $grouped[] = $myrow['gperm_itemid']; + } + } + $non_grouped = array_diff($bids, $grouped); + if (!empty($non_grouped)) { + $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid'; + $sql .= ' AND b.isactive='.intval($isactive); + if (isset($visible)) { + $sql .= ' AND b.visible='.intval($visible); + } + if (!isset($module_id)) { + } elseif (!empty($module_id)) { + $sql .= ' AND m.module_id IN (0,'. intval($module_id); + if ($toponlyblock) { + $sql .= ',-1'; + } + $sql .= ')'; + } else { + if ($toponlyblock) { + $sql .= ' AND m.module_id IN (0,-1)'; + } else { + $sql .= ' AND m.module_id=0'; + } + } + $sql .= ' AND b.bid IN ('.... [truncated message content] |
From: <txm...@us...> - 2013-06-28 10:29:52
|
Revision: 11796 http://sourceforge.net/p/xoops/svn/11796 Author: txmodxoops Date: 2013-06-28 10:29:48 +0000 (Fri, 28 Jun 2013) Log Message: ----------- Added responsive pagenav end simpleform Added footer blocks Added Paths: ----------- XoopsCore/branches/2.5.x/2.5.7_timgno/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/pagenav.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsblock.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsform/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsform/responsiveform.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsformloader.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsload.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/include/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/include/defines.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/class/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/class/block.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/language/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/language/english/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/language/english/admin/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/language/english/admin/blocksadmin.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/templates/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/templates/admin/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/templates/admin/system_blocks.html XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/templates/system_pagenav.html XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/xoops_version.php XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/themes/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/themes/default/ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/themes/default/centerFooter.html XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/themes/default/leftFooter.html XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/themes/default/rightFooter.html Added: XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/pagenav.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/pagenav.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/pagenav.php 2013-06-28 10:29:48 UTC (rev 11796) @@ -0,0 +1,218 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * XOOPS page navigation + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package class + * @since 2.5.6 + * @author Kazumi Ono (http://www.myweb.ne.jp/, http://jp.xoops.org/) + * @author Gregory Mage (AKA Mage) + * @version $Id: pagenav.php 11791 2013-06-28 10:13:50Z timgno $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class XoopsPageNav +{ + /** + * *#@+ + * + * @access private + */ + /** + * @var int + */ + private $total; + + /** + * @var int + */ + private $perpage; + + /** + * @var int + */ + private $current; + + /** + * @var string + */ + private $url; + /** + * *#@- + */ + + /** + * Constructor + * + * @param int $total_items Total number of items + * @param int $items_perpage Number of items per page + * @param int $current_start First item on the current page + * @param string $start_name Name for "start" or "offset" + * @param string $extra_arg Additional arguments to pass in the URL + */ + public function __construct($total_items, $items_perpage, $current_start, $start_name = "start", $extra_arg = "") + { + $this->total = intval($total_items); + $this->perpage = intval($items_perpage); + $this->current = intval($current_start); + $this->extra = $extra_arg; + if ($extra_arg != '' && (substr($extra_arg, - 5) != '&' || substr($extra_arg, - 1) != '&')) { + $this->extra = '&' . $extra_arg; + } + $this->url = $_SERVER['PHP_SELF'] . '?' . trim($start_name) . '='; + } + + /** + * Create text navigation + * + * @param integer $offset + * @param string $size of pagination(Value: 'large', '', 'small', 'mini') + * @param string $align of pagination(Value: 'right', 'centered') + * @param string $prev_text text for previous + * @param string $next_text text for next + * @return string + */ + public function renderNav($offset = 4, $size = "", $align = "right", $prev_text = "«", $next_text = "»") + { + $xoopsTpl = new XoopsTpl(); + $ret = ''; + $nav = array(); + if ($this->total <= $this->perpage) { + return $ret; + } + if(($this->total != 0) && ($this->perpage != 0)) { + $total_pages = ceil($this->total / $this->perpage); + if ($total_pages > 1) { + $prev = $this->current - $this->perpage; + if ($prev >= 0) { + $xoopsTpl->assign('prev_text', $prev_text); + $xoopsTpl->assign('prev_url', $this->url . $prev . $this->extra); + } + $last = 0; + $last_text = ''; + $last_url = ''; + $first = 0; + $first_text = ''; + $first_url = ''; + $counter = 1; + $current_page = intval(floor(($this->current + $this->perpage) / $this->perpage)); + while ($counter <= $total_pages) { + if ($counter == $current_page) { + $nav['text'] = $counter; + $nav['url'] = ''; + $nav['active'] = 0; + } elseif (($counter > $current_page - $offset && $counter < $current_page + $offset) || $counter == 1 || $counter == $total_pages) { + if ($counter == $total_pages && $current_page < $total_pages - $offset) { + $nav['text'] = '...'; + $nav['url'] = ''; + $nav['active'] = 0; + $last = 1; + $last_text = $counter; + $last_url = $this->url . (($counter - 1) * $this->perpage) . $this->extra; + } else { + $nav['text'] = $counter; + $nav['url'] = $this->url . (($counter - 1) * $this->perpage) . $this->extra; + $nav['active'] = 1; + } + if ($counter == 1 && $current_page > 1 + $offset){ + $nav['text'] = '...'; + $nav['url'] = ''; + $nav['active'] = 0; + $first = 1; + $first_text = $counter; + $first_url = $this->url . (($counter - 1) * $this->perpage) . $this->extra; + } + } + $xoopsTpl->append_by_ref('xo_nav', $nav); + unset($nav); + $counter ++; + } + $xoopsTpl->assign('last', $last); + $xoopsTpl->assign('last_text', $last_text); + $xoopsTpl->assign('last_url', $last_url); + $xoopsTpl->assign('first', $first); + $xoopsTpl->assign('first_text', $first_text); + $xoopsTpl->assign('first_url', $first_url); + + $next = $this->current + $this->perpage; + if ($this->total > $next) { + $xoopsTpl->assign('next_text', $next_text); + $xoopsTpl->assign('next_url', $this->url . $next . $this->extra); + } + } + } + if ($size != ''){ + $size = ' pagination-' . $size; + } + $xoopsTpl->assign('size', $size); + $xoopsTpl->assign('align', ' pagination-' . $align); + $xoopsTpl->assign('pagination_nav', true); + $ret = $xoopsTpl->fetch('db:system_pagenav.html'); + $xoopsTpl->clear_assign('xo_nav'); + return $ret; + } + + /** + * Create a navigational dropdown list + * + * @param boolean $showbutton Show the "Go" button? + * @return string|false + */ + public function renderSelect($align = "right", $showbutton = false) + { + $xoopsTpl = new XoopsTpl(); + $ret = ''; + if ($this->total < $this->perpage) { + return $ret; + } + $total_pages = ceil($this->total / $this->perpage); + if ($total_pages > 1) { + $counter = 1; + $current_page = intval(floor(($this->current + $this->perpage) / $this->perpage)); + while ($counter <= $total_pages) { + $select['text'] = $counter; + $select['value'] = $this->url . (($counter - 1) * $this->perpage) . $this->extra; + if ($counter == $current_page) { + $select['selected'] = 1; + } else { + $select['selected'] = 0; + } + $xoopsTpl->append_by_ref('xo_select', $select); + unset($select); + $counter ++; + } + } + $xoopsTpl->assign('onchange', "location=this.options[this.options.selectedIndex].value;"); + $xoopsTpl->assign('pagination_select', true); + $xoopsTpl->assign('showbutton', $showbutton); + $xoopsTpl->assign('align', ' pagination-' . $align); + $ret = $xoopsTpl->fetch('module:system|system_pagenav.html'); + $xoopsTpl->clear_assign('xo_select'); + return $ret; + } + + /** + * Create navigation with images + * + * @param integer $offset + * @return string|false + */ + public function renderImageNav($offset = 4) + { + $xoopsTpl = new XoopsTpl(); + $xoopsTpl->deprecated('renderImageNav() is deprecated since 2.6.0. Please use renderNav()'); + return $this->renderNav($offset); + } +} \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsblock.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsblock.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsblock.php 2013-06-28 10:29:48 UTC (rev 11796) @@ -0,0 +1,619 @@ +<?php +/** + * XOOPS Block management + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @since 2.0.0 + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ + * @author Skalpa Keo <sk...@xo...> + * @author Taiwen Jiang <ph...@us...> + * @version $Id: xoopsblock.php 8066 2011-11-06 05:09:33Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +include_once $GLOBALS['xoops']->path( 'kernel/object.php' ); + +class XoopsBlock extends XoopsObject +{ + var $db; + + function XoopsBlock($id = null) + { + $this->db =& XoopsDatabaseFactory::getDatabaseConnection(); + $this->initVar('bid', XOBJ_DTYPE_INT, null, false); + $this->initVar('mid', XOBJ_DTYPE_INT, 0, false); + $this->initVar('func_num', XOBJ_DTYPE_INT, 0, false); + $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 255); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150); + //$this->initVar('position', XOBJ_DTYPE_INT, 0, false); + $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 150); + $this->initVar('content', XOBJ_DTYPE_TXTAREA, null, false); + $this->initVar('side', XOBJ_DTYPE_INT, 0, false); + $this->initVar('weight', XOBJ_DTYPE_INT, 0, false); + $this->initVar('visible', XOBJ_DTYPE_INT, 0, false); + // The block_type is in a mess, let's say: + // S - generated by system module + // M - generated by a non-system module + // C - Custom block + // D - cloned system/module block + // E - cloned custom block, DON'T use it + $this->initVar('block_type', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('c_type', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('isactive', XOBJ_DTYPE_INT, null, false); + + $this->initVar('dirname', XOBJ_DTYPE_TXTBOX, null, false, 50); + $this->initVar('func_file', XOBJ_DTYPE_TXTBOX, null, false, 50); + $this->initVar('show_func', XOBJ_DTYPE_TXTBOX, null, false, 50); + $this->initVar('edit_func', XOBJ_DTYPE_TXTBOX, null, false, 50); + + $this->initVar('template', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('bcachetime', XOBJ_DTYPE_INT, 0, false); + $this->initVar('last_modified', XOBJ_DTYPE_INT, 0, false); + + if (!empty($id)) { + if (is_array($id)) { + $this->assignVars($id); + } else { + $this->load(intval($id)); + } + } + } + + /** + * Load $id + * + * @param int $id + */ + function load($id) + { + $id = intval($id); + $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . ' WHERE bid = ' . $id; + $arr = $this->db->fetchArray($this->db->query($sql)); + $this->assignVars($arr); + } + + /** + * Store Block Data to Database + * + * @return int $id + */ + function store() + { + if (!$this->cleanVars()) { + return false; + } + foreach ($this->cleanVars as $k => $v) { + ${$k} = $v; + } + if (empty($bid)) { + $bid = $this->db->genId($this->db->prefix("newblocks") . "_bid_seq"); + $sql = sprintf("INSERT INTO %s (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES (%u, %u, %u, %s, %s, %s, %s, %u, %u, %u, %s, %s, %u, %s, %s, %s, %s, %s, %u, %u)", $this->db->prefix('newblocks'), $bid, $mid, $func_num, $this->db->quoteString($options), $this->db->quoteString($name), $this->db->quoteString($title), $this->db->quoteString($content), $side, $weight, $visible, $this->db->quoteString($block_type), $this->db->quoteString($c_type), 1, $this->db->quoteString($dirname), $this->db->quoteString($func_file), $this->db->quoteString($show_func), $this->db->quoteString($edit_func), $this->db->quoteString($template), $bcachetime, time()); + } else { + $sql = "UPDATE " . $this->db->prefix("newblocks") . " SET options=" . $this->db->quoteString($options); + // a custom block needs its own name + if ($this->isCustom() /* in_array( $block_type , array( 'C' , 'E' ) ) */) { + $sql .= ", name=" . $this->db->quoteString($name); + } + $sql .= ", isactive=" . $isactive . ", title=" . $this->db->quoteString($title) . ", content=" . $this->db->quoteString($content) . ", side=" . $side . ", weight=" . $weight . ", visible=" . $visible . ", c_type=" . $this->db->quoteString($c_type) . ", template=" . $this->db->quoteString($template) . ", bcachetime=" . $bcachetime . ", last_modified=" . time() . " WHERE bid=" . $bid; + } + if (!$this->db->query($sql)) { + $this->setErrors("Could not save block data into database"); + return false; + } + if (empty($bid)) { + $bid = $this->db->getInsertId(); + } + return $bid; + } + + /** + * Delete a ID from the database + * + * @return bool + */ + function delete() + { + $sql = sprintf("DELETE FROM %s WHERE bid = %u", $this->db->prefix('newblocks'), $this->getVar('bid')); + if (! $this->db->query($sql)) { + return false; + } + $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'block_read' AND gperm_itemid = %u AND gperm_modid = 1", $this->db->prefix('group_permission'), $this->getVar('bid')); + $this->db->query($sql); + $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $this->db->prefix('block_module_link'), $this->getVar('bid')); + $this->db->query($sql); + return true; + } + + /** + * do stripslashes/htmlspecialchars according to the needed output + * + * @param $format output use: S for Show and E for Edit + * @param $c_type type of block content + * @returns string + */ + function getContent($format = 's', $c_type = 't') + { + switch ($format) { + case 's': + // check the type of content + // H : custom HTML block + // P : custom PHP block + // S : use text sanitizater (smilies enabled) + // T : use text sanitizater (smilies disabled) + if ($c_type == 'H') { + return str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + } else if ($c_type == 'P') { + ob_start(); + echo eval($this->getVar('content', 'n')); + $content = ob_get_contents(); + ob_end_clean(); + return str_replace('{X_SITEURL}', XOOPS_URL . '/', $content); + } else if ($c_type == 'S') { + $myts =& MyTextSanitizer::getInstance(); + $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + return $myts->displayTarea($content, 1, 1); + } else { + $myts =& MyTextSanitizer::getInstance(); + $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); + return $myts->displayTarea($content, 1, 0); + } + break; + case 'e': + return $this->getVar('content', 'e'); + break; + default: + return $this->getVar('content', 'n'); + break; + } + } + + /** + * Build Block + * + * @return unknown + */ + function buildBlock() + { + global $xoopsConfig, $xoopsOption, $xoTheme; + $block = array(); + if (!$this->isCustom()) { + // get block display function + $show_func = $this->getVar('show_func'); + if (!$show_func) { + return false; + } + if (!file_exists($func_file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) { + return false; + } + // must get lang files b4 including the file + // some modules require it for code that is outside the function + xoops_loadLanguage('blocks', $this->getVar('dirname')); + include_once $func_file; + + if (function_exists($show_func)) { + // execute the function + $options = explode('|', $this->getVar('options')); + $block = $show_func($options); + if (!$block) { + return false; + } + } else { + return false; + } + } else { + // it is a custom block, so just return the contents + $block['content'] = $this->getContent('s', $this->getVar('c_type')); + if (empty($block['content'])) { + return false; + } + } + return $block; + } + + /* + * Aligns the content of a block + * If position is 0, content in DB is positioned + * before the original content + * If position is 1, content in DB is positioned + * after the original content + */ + function buildContent($position, $content = "", $contentdb = "") + { + if ($position == 0) { + $ret = $contentdb . $content; + } else if ($position == 1) { + $ret = $content . $contentdb; + } + return $ret; + } + + /** + * Enter description here... + * + * @param string $originaltitle + * @param string $newtitle + * @return string title + */ + function buildTitle($originaltitle, $newtitle = '') + { + if ($newtitle != '') { + $ret = $newtitle; + } else { + $ret = $originaltitle; + } + return $ret; + } + + /** + * XoopsBlock::isCustom() + * + * @return + */ + function isCustom() + { + return in_array($this->getVar('block_type'), array( + 'C' , + 'E')); + } + + /** + * XoopsBlock::getOptions() + * + * @return + */ + function getOptions() + { + global $xoopsConfig; + if (!$this->isCustom()) { + $edit_func = $this->getVar('edit_func'); + if (!$edit_func) { + return false; + } + if (file_exists($GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) { + if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/blocks.php'))) { + include_once $file; + } elseif (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/english/blocks.php'))) { + include_once $file; + } + include_once $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')); + $options = explode("|", $this->getVar("options")); + $edit_form = $edit_func($options); + if (!$edit_form) { + return false; + } + return $edit_form; + } else { + return false; + } + } else { + return false; + } + } + + /** + * get all the blocks that match the supplied parameters + * @param $side 0: sideblock - left + * 1: sideblock - right + * 2: sideblock - left and right + * 3: centerblock - left + * 4: centerblock - right + * 5: centerblock - center + * 6: centerblock - left, right, center + * @param $groupid groupid (can be an array) + * @param $visible 0: not visible 1: visible + * @param $orderby order of the blocks + * @returns array of block objects + */ + function getAllBlocksByGroup($groupid, $asobject = true, $side = null, $visible = null, $orderby = "b.weight,b.bid", $isactive = 1) + { + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + if (!$asobject) { + $sql = 'SELECT b.bid '; + } else { + $sql = 'SELECT b.* '; + } + $sql .= "FROM " . $db->prefix("newblocks") . " b LEFT JOIN " . $db->prefix("group_permission") . " l ON l.gperm_itemid=b.bid WHERE gperm_name = 'block_read' AND gperm_modid = 1"; + if (is_array($groupid)) { + $sql .= " AND (l.gperm_groupid=" . $groupid[0] . ""; + $size = count($groupid); + if ($size > 1) { + for($i = 1; $i < $size; $i ++) { + $sql .= " OR l.gperm_groupid=" . $groupid[$i] . ""; + } + } + $sql .= ")"; + } else { + $sql .= " AND l.gperm_groupid=" . $groupid . ""; + } + $sql .= " AND b.isactive=" . $isactive; + if (isset($side)) { + // get both sides in sidebox? (some themes need this) + if ($side == XOOPS_SIDEBLOCK_BOTH) { + $side = "(b.side=0 OR b.side=1)"; + } elseif ($side == XOOPS_CENTERBLOCK_ALL) { + $side = "(b.side=3 OR b.side=4 OR b.side=5 OR b.side=7 OR b.side=8 OR b.side=9 )"; + } elseif ($side == XOOPS_FOOTERBLOCK_ALL) { + $side = "(b.side=11 OR b.side=12 OR b.side=13 )"; + } else { + $side = "b.side=" . $side; + } + $sql .= " AND " . $side; + } + if (isset($visible)) { + $sql .= " AND b.visible=$visible"; + } + $sql .= " ORDER BY $orderby"; + $result = $db->query($sql); + $added = array(); + while ($myrow = $db->fetchArray($result)) { + if (!in_array($myrow['bid'], $added)) { + if (!$asobject) { + $ret[] = $myrow['bid']; + } else { + $ret[] = new XoopsBlock($myrow); + } + array_push($added, $myrow['bid']); + } + } + return $ret; + } + + /** + * XoopsBlock::getAllBlocks() + * + * @param string $rettype + * @param mixed $side + * @param mixed $visible + * @param string $orderby + * @param integer $isactive + * @return + */ + function getAllBlocks($rettype = "object", $side = null, $visible = null, $orderby = "side,weight,bid", $isactive = 1) + { + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + $where_query = " WHERE isactive=" . $isactive; + if (isset($side)) { + // get both sides in sidebox? (some themes need this) + if ($side == 2) { + $side = "(side=0 OR side=1)"; + } elseif ($side == 6) { + $side = "(side=3 OR side=4 OR side=5 OR side=7 OR side=8 OR side=9)"; + } elseif ($side == 10) { + $side = "(side=11 OR side=12 OR side=13)"; + } else { + $side = "side=" . $side; + } + $where_query .= " AND " . $side; + } + if (isset($visible)) { + $where_query .= " AND visible=.". $visible; + } + $where_query .= " ORDER BY ".$orderby; + switch ($rettype) { + case "object": + $sql = "SELECT * FROM " . $db->prefix("newblocks") . "" . $where_query; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $ret[] = new XoopsBlock($myrow); + } + break; + case "list": + $sql = "SELECT * FROM " . $db->prefix("newblocks") . "" . $where_query; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $block = new XoopsBlock($myrow); + $title = $block->getVar("title"); + $title = empty($title) ? $block->getVar("name") : $title; + $ret[$block->getVar("bid")] = $title; + } + break; + case "id": + $sql = "SELECT bid FROM " . $db->prefix("newblocks") . "" . $where_query; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $ret[] = $myrow['bid']; + } + break; + } + //echo $sql; + return $ret; + } + + /** + * XoopsBlock::getByModule() + * + * @param mixed $moduleid + * @param mixed $asobject + * @return + */ + function getByModule($moduleid, $asobject = true) + { + $moduleid = intval($moduleid); + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + if ($asobject == true) { + $sql = $sql = "SELECT * FROM " . $db->prefix("newblocks") . " WHERE mid=" . $moduleid; + } else { + $sql = "SELECT bid FROM " . $db->prefix("newblocks") . " WHERE mid=" . $moduleid; + } + $result = $db->query($sql); + $ret = array(); + while ($myrow = $db->fetchArray($result)) { + if ($asobject) { + $ret[] = new XoopsBlock($myrow); + } else { + $ret[] = $myrow['bid']; + } + } + return $ret; + } + + /** + * XoopsBlock::getAllByGroupModule() + * + * @param mixed $groupid + * @param integer $module_id + * @param mixed $toponlyblock + * @param mixed $visible + * @param string $orderby + * @param integer $isactive + * @return + */ + function getAllByGroupModule($groupid, $module_id = 0, $toponlyblock = false, $visible = null, $orderby = 'b.weight, m.block_id', $isactive = 1) + { + $isactive = intval($isactive); + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + if (isset($groupid)) { + $sql = "SELECT DISTINCT gperm_itemid FROM " . $db->prefix('group_permission') . " WHERE gperm_name = 'block_read' AND gperm_modid = 1"; + if (is_array($groupid)) { + $sql .= ' AND gperm_groupid IN (' . implode(',', $groupid) . ')'; + } else { + if (intval($groupid) > 0) { + $sql .= ' AND gperm_groupid=' . intval($groupid); + } + } + $result = $db->query($sql); + $blockids = array(); + while ($myrow = $db->fetchArray($result)) { + $blockids[] = $myrow['gperm_itemid']; + } + if (empty($blockids)) { + return $blockids; + } + } + $sql = 'SELECT b.* FROM ' . $db->prefix('newblocks') . ' b, ' . $db->prefix('block_module_link') . ' m WHERE m.block_id=b.bid'; + $sql .= ' AND b.isactive=' . $isactive; + if (isset($visible)) { + $sql .= ' AND b.visible=' . intval($visible); + } + if (!isset($module_id)) { + } else if (!empty($module_id)) { + $sql .= ' AND m.module_id IN (0,' . intval($module_id); + if ($toponlyblock) { + $sql .= ',-1'; + } + $sql .= ')'; + } else { + if ($toponlyblock) { + $sql .= ' AND m.module_id IN (0,-1)'; + } else { + $sql .= ' AND m.module_id=0'; + } + } + if (!empty($blockids)) { + $sql .= ' AND b.bid IN (' . implode(',', $blockids) . ')'; + } + $sql .= ' ORDER BY ' . $orderby; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $block = new XoopsBlock($myrow); + $ret[$myrow['bid']] = & $block; + unset($block); + } + return $ret; + } + + /** + * XoopsBlock::getNonGroupedBlocks() + * + * @param integer $module_id + * @param mixed $toponlyblock + * @param mixed $visible + * @param string $orderby + * @param integer $isactive + * @return + */ + function getNonGroupedBlocks($module_id = 0, $toponlyblock = false, $visible = null, $orderby = 'b.weight, m.block_id', $isactive = 1) + { + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $ret = array(); + $bids = array(); + $sql = "SELECT DISTINCT(bid) from " . $db->prefix('newblocks'); + if ($result = $db->query($sql)) { + while ($myrow = $db->fetchArray($result)) { + $bids[] = $myrow['bid']; + } + } + $sql = "SELECT DISTINCT(p.gperm_itemid) from " . $db->prefix('group_permission') . " p, " . $db->prefix('groups') . " g WHERE g.groupid=p.gperm_groupid AND p.gperm_name='block_read'"; + $grouped = array(); + if ($result = $db->query($sql)) { + while ($myrow = $db->fetchArray($result)) { + $grouped[] = $myrow['gperm_itemid']; + } + } + $non_grouped = array_diff($bids, $grouped); + if (!empty($non_grouped)) { + $sql = 'SELECT b.* FROM ' . $db->prefix('newblocks') . ' b, ' . $db->prefix('block_module_link') . ' m WHERE m.block_id=b.bid'; + $sql .= ' AND b.isactive=' . intval($isactive); + if (isset($visible)) { + $sql .= ' AND b.visible=' . intval($visible); + } + if (!isset($module_id)) { + } else if (!empty($module_id)) { + $sql .= ' AND m.module_id IN (0,' . intval($module_id); + if ($toponlyblock) { + $sql .= ',-1'; + } + $sql .= ')'; + } else { + if ($toponlyblock) { + $sql .= ' AND m.module_id IN (0,-1)'; + } else { + $sql .= ' AND m.module_id=0'; + } + } + $sql .= ' AND b.bid IN (' . implode(',', $non_grouped) . ')'; + $sql .= ' ORDER BY ' . $orderby; + $result = $db->query($sql); + while ($myrow = $db->fetchArray($result)) { + $block = new XoopsBlock($myrow); + $ret[$myrow['bid']] =& $block; + unset($block); + } + } + return $ret; + } + + /** + * XoopsBlock::countSimilarBlocks() + * + * @param mixed $moduleId + * @param mixed $funcNum + * @param mixed $showFunc + * @return + */ + function countSimilarBlocks($moduleId, $funcNum, $showFunc = null) + { + $funcNum = intval($funcNum); + $moduleId = intval($moduleId); + if ($funcNum < 1 || $moduleId < 1) { + // invalid query + return 0; + } + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + if (isset($showFunc)) { + // showFunc is set for more strict comparison + $sql = sprintf("SELECT COUNT(*) FROM %s WHERE mid = %d AND func_num = %d AND show_func = %s", $db->prefix('newblocks'), $moduleId, $funcNum, $db->quoteString(trim($showFunc))); + } else { + $sql = sprintf("SELECT COUNT(*) FROM %s WHERE mid = %d AND func_num = %d", $db->prefix('newblocks'), $moduleId, $funcNum); + } + if (!$result = $db->query($sql)) { + return 0; + } + list ($count) = $db->fetchRow($result); + return $count; + } +} +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsform/responsiveform.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsform/responsiveform.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsform/responsiveform.php 2013-06-28 10:29:48 UTC (rev 11796) @@ -0,0 +1,107 @@ +<?php +/** + * XOOPS theme form + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage form + * @since 2.0.0 + * @version $Id: themeform.php 8066 2011-11-06 05:09:33Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +xoops_load('XoopsForm'); + +/** + * Form that will output as a theme-enabled HTML table + * + * Also adds JavaScript to validate required fields + */ +class XoopsResponsiveForm extends XoopsForm +{ + /** + * Insert an empty row in the table to serve as a seperator. + * + * @param string $extra HTML to be displayed in the empty row. + * @param string $class CSS class name for <td> tag + */ + function insertBreak($extra = '', $class = '') + { + $class = ($class != '') ? preg_replace('/[^A-Za-z0-9\s\s_-]/i', '', $class) . " " : ''; + // Fix for $extra tag not showing + if ($extra) { + $extra = '<div class="' . $class . 'inline">' . $extra . '</div>'; + $this->addElement($extra); + } else { + $extra = '<div class="' . $class . 'block"> </div>'; + $this->addElement($extra); + } + } + + /** + * create HTML to output the form as a theme-enabled table with validation. + * + * YOU SHOULD AVOID TO USE THE FOLLOWING Nocolspan METHOD, IT WILL BE REMOVED + * + * To use the noColspan simply use the following example: + * + * $colspan = new XoopsFormDhtmlTextArea( '', 'key', $value, '100%', '100%' ); + * $colspan->setNocolspan(); + * $form->addElement( $colspan ); + * + * @return string + */ + function render() + { + $ele_name = $this->getName(); + $ret = '<form name="' . $ele_name . '" id="' . $ele_name . '" action="' . $this->getAction() . '" method="' . $this->getMethod() . '" onsubmit="return xoopsFormValidate_' . $ele_name . '();"' . $this->getExtra() . '> + <div width="100%" class="outer"> + <div class="head center">' . $this->getTitle() . '</div> + '; + $hidden = ''; + $class = 'even'; + foreach ($this->getElements() as $ele) { + if (!is_object($ele)) { + $ret .= $ele; + } else if (!$ele->isHidden()) { + if (!$ele->getNocolspan()) { + $ret .= '<div valign="top" align="left">'; + if (($caption = $ele->getCaption()) != '') { + $ret .= '<div class="xoops-form-element-caption' . ($ele->isRequired() ? '-required' : '') . '">'; + $ret .= '<span class="caption-text">' . $caption . '</span>'; + $ret .= '<span class="caption-marker">*</span>'; + $ret .= '</div>'; + } + if (($desc = $ele->getDescription()) != '') { + $ret .= '<div class="xoops-form-element-help">' . $desc . '</div>'; + } + $ret .= '<div class="' . $class . '">' . $ele->render() . '</div></div>' . NWLINE; + } else { + $ret .= '<div valign="top" align="left"><div class="head">'; + if (($caption = $ele->getCaption()) != '') { + $ret .= '<div class="xoops-form-element-caption' . ($ele->isRequired() ? '-required' : '') . '">'; + $ret .= '<span class="caption-text">' . $caption . '</span>'; + $ret .= '<span class="caption-marker">*</span>'; + $ret .= '</div>'; + } + $ret .= '</div></div><div valign="top" align="left"><div class="' . $class . '">' . $ele->render() . '</div></div>'; + } + } else { + $hidden .= $ele->render(); + } + } + $ret .= '</div>' . NWLINE . ' ' . $hidden . '</form>' . NWLINE; + $ret .= $this->renderValidationJS(true); + return $ret; + } +} +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsformloader.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsformloader.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsformloader.php 2013-06-28 10:29:48 UTC (rev 11796) @@ -0,0 +1,55 @@ +<?php +/** + * XOOPS form class loader + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @since 2.0.0 + * @version $Id: xoopsformloader.php 8066 2011-11-06 05:09:33Z beckmi $ + */ + + +xoops_load('XoopsForm'); +xoops_load('XoopsThemeForm'); +xoops_load('XoopsSimpleForm'); +xoops_load('XoopsResponsiveForm'); +xoops_load('XoopsFormElement'); +xoops_load('XoopsFormElementTray'); +xoops_load('XoopsFormLabel'); +xoops_load('XoopsFormCheckBox'); +xoops_load('XoopsFormPassword'); +xoops_load('XoopsFormButton'); +xoops_load('XoopsFormButtonTray'); // To be cleaned +xoops_load('XoopsFormHidden'); +xoops_load('XoopsFormFile'); +xoops_load('XoopsFormRadio'); +xoops_load('XoopsFormRadioYN'); +xoops_load('XoopsFormSelect'); +xoops_load('XoopsFormSelectGroup'); +xoops_load('XoopsFormSelectCheckGroup'); // To be cleaned +xoops_load('XoopsFormSelectUser'); +xoops_load('XoopsFormSelectTheme'); +xoops_load('XoopsFormSelectMatchOption'); +xoops_load('XoopsFormSelectCountry'); +xoops_load('XoopsFormSelectTimeZone'); +xoops_load('XoopsFormSelectLang'); +xoops_load('XoopsFormSelectEditor'); +xoops_load('XoopsFormText'); +xoops_load('XoopsFormTextArea'); +xoops_load('XoopsFormTextDateSelect'); +xoops_load('XoopsFormDhtmlTextArea'); +xoops_load('XoopsFormDateTime'); +xoops_load('XoopsFormHiddenToken'); +xoops_load('XoopsFormColorPicker'); +xoops_load('XoopsFormCaptcha'); +xoops_load('XoopsFormEditor'); + +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsload.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsload.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/class/xoopsload.php 2013-06-28 10:29:48 UTC (rev 11796) @@ -0,0 +1,242 @@ +<?php +/** + * Xoops Autoload class + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package class + * @since 2.3.0 + * @author Taiwen Jiang <ph...@us...> + * @version $Id: xoopsload.php 10686 2013-01-06 19:07:24Z beckmi $ + * @todo For PHP 5 compliant + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class XoopsLoad +{ + //static $loaded; + //static $configs; + + static function load($name, $type = "core") + { + static $loaded; + static $deprecated; + + if (!isset($deprecated)) { + $deprecated = array( + 'uploader' => 'xoopsmediauploader', + 'utility' => 'xoopsutility', + 'captcha' => 'xoopscaptcha', + 'cache' => 'xoopscache', + 'file' => 'xoopsfile', + 'model' => 'xoopsmodelfactory', + 'calendar' => 'xoopscalendar', + 'userutility' => 'xoopsuserutility', + ); + } + $name = strtolower($name); + if (in_array($type,array('core','class')) && array_key_exists($name, $deprecated)) { + if (isset($GLOBALS['xoopsLogger'])) { + $GLOBALS['xoopsLogger']->addDeprecated("xoops_load('{$name}') is deprecated, use xoops_load('{$deprecated[$name]}')"); + } else { + trigger_error("xoops_load('{$name}') is deprecated, use xoops_load('{$deprecated[$name]}')", E_USER_WARNING); + } + $name = $deprecated[$name]; + } + + $type = empty($type) ? 'core' : $type; + if (isset($loaded[$type][$name])) { + return $loaded[$type][$name]; + } + + if (class_exists($name, false)) { + $loaded[$type][$name] = true; + return true; + } + $isloaded = false; + switch ($type) { + case 'framework': + $isloaded = XoopsLoad::loadFramework($name); + break; + case 'class': + case 'core': + $type = 'core'; + $isloaded = XoopsLoad::loadCore($name); + break; + default: + $isloaded = XoopsLoad::loadModule($name, $type); + break; + } + $loaded[$type][$name] = $isloaded; + return $loaded[$type][$name]; + } + + /** + * Load core class + * + * @access private + */ + static function loadCore($name) + { + static $configs; + + if (!isset($configs)) { + $configs = XoopsLoad::loadCoreConfig(); + } + if (isset($configs[$name])) { + require $configs[$name]; + if (class_exists($name) && method_exists($name, '__autoload')) { + call_user_func(array($name , '__autoload')); + } + return true; + } elseif (file_exists($file = XOOPS_ROOT_PATH . '/class/' . $name . '.php')) { + include_once $file; + $class = 'Xoops' . ucfirst($name); + if (class_exists($class)) { + return $class; + } else { + trigger_error('Class ' . $name . ' not found in file ' . __FILE__ . 'at line ' . __LINE__, E_USER_WARNING); + } + } + return false; + } + + /** + * Load Framework class + * + * @access private + */ + function loadFramework($name) + { + if (!file_exists($file = XOOPS_ROOT_PATH . '/Frameworks/' . $name . '/xoops' . $name . '.php')) { + trigger_error('File ' . str_replace(XOOPS_ROOT_PATH, '', $file) . ' not found in file ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING); + return false; + } + include $file; + $class = 'Xoops' . ucfirst($name); + if (class_exists($class)) { + return $class; + } + } + /** + * Load module class + * + * @access private + */ + function loadModule($name, $dirname = null) + { + if (empty($dirname)) { + return false; + } + if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/class/' . $name . '.php')) { + include $file; + if (class_exists(ucfirst($dirname) . ucfirst($name))) { + return true; + } + } + return false; + } + + /** + * XoopsLoad::loadCoreConfig() + * + * @return + */ + static function loadCoreConfig() + { + return $configs = array( + 'xoopsuserutility' => XOOPS_ROOT_PATH . '/class/userutility.php', + 'xoopsmediauploader' => XOOPS_ROOT_PATH . '/class/uploader.php', + 'xoopsutility' => XOOPS_ROOT_PATH . '/class/utility/xoopsutility.php', + 'xoopscaptcha' => XOOPS_ROOT_PATH . '/class/captcha/xoopscaptcha.php', + 'xoopscache' => XOOPS_ROOT_PATH . '/class/cache/xoopscache.php', + 'xoopsfile' => XOOPS_ROOT_PATH . '/class/file/xoopsfile.php', + 'xoopsmodelfactory' => XOOPS_ROOT_PATH . '/class/model/xoopsmodel.php', + 'xoopscalendar' => XOOPS_ROOT_PATH . '/class/calendar/xoopscalendar.php', + 'xoopskernel' => XOOPS_ROOT_PATH . '/class/xoopskernel.php', + 'xoopssecurity' => XOOPS_ROOT_PATH . '/class/xoopssecurity.php', + 'xoopslogger' => XOOPS_ROOT_PATH . '/class/logger/xoopslogger.php', + 'xoopspagenav' => XOOPS_ROOT_PATH . '/class/pagenav.php', + 'xoopslists' => XOOPS_ROOT_PATH . '/class/xoopslists.php', + 'xoopslocal' => XOOPS_ROOT_PATH . '/include/xoopslocal.php', + 'xoopslocalabstract' => XOOPS_ROOT_PATH . '/class/xoopslocal.php', + 'xoopseditor' => XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php', + 'xoopseditorhandler' => XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php', + 'xoopsformloader' => XOOPS_ROOT_PATH . '/class/xoopsformloader.php', + 'xoopsformelement' => XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php', + 'xoopsform' => XOOPS_ROOT_PATH . '/class/xoopsform/form.php', + 'xoopsformlabel' => XOOPS_ROOT_PATH . '/class/xoopsform/formlabel.php', + 'xoopsformselect' => XOOPS_ROOT_PATH . '/class/xoopsform/formselect.php', + 'xoopsformpassword' => XOOPS_ROOT_PATH . '/class/xoopsform/formpassword.php', + 'xoopsformbutton' => XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php', + 'xoopsformbuttontray' => XOOPS_ROOT_PATH . '/class/xoopsform/formbuttontray.php', + 'xoopsformcheckbox' => XOOPS_ROOT_PATH . '/class/xoopsform/formcheckbox.php', + 'xoopsformselectcheckgroup' => XOOPS_ROOT_PATH . '/class/xoopsform/formselectcheckgroup.php', + 'xoopsformhidden' => XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php', + 'xoopsformfile' => XOOPS_ROOT_PATH . '/class/xoopsform/formfile.php', + 'xoopsformradio' => XOOPS_ROOT_PATH . '/class/xoopsform/formradio.php', + 'xoopsformradioyn' => XOOPS_ROOT_PATH . '/class/xoopsform/formradioyn.php', + 'xoopsformselectcountry' => XOOPS_ROOT_PATH . '/class/xoopsform/formselectcountry.php', + 'xoopsformselecttimezone' => XOOPS_ROOT_PATH . '/class/xoopsform/formselecttimezone.php', + 'xoopsformselectlang' => XOOPS_ROOT_PATH . '/class/xoopsform/formselectlang.php', + 'xoopsformselectgroup' => XOOPS_ROOT_PATH . '/class/xoopsform/formselectgroup.php', + 'xoopsformselectuser' => XOOPS_ROOT_PATH . '/class/xoopsform/formselectuser.php', + 'xoopsformselecttheme' => XOOPS_ROOT_PATH . '/class/xoopsform/formselecttheme.php', + 'xoopsformselectmatchoption' => XOOPS_ROOT_PATH . '/class/xoopsform/formselectmatchoption.php', + 'xoopsformtext' => XOOPS_ROOT_PATH . '/class/xoopsform/formtext.php', + 'xoopsformtextarea' => XOOPS_ROOT_PATH . '/class/xoopsform/formtextarea.php', + 'xoopsformdhtmltextarea' => XOOPS_ROOT_PATH . '/class/xoopsform/formdhtmltextarea.php', + 'xoopsformelementtray' => XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php', + 'xoopsthemeform' => XOOPS_ROOT_PATH . '/class/xoopsform/themeform.php', + 'xoopsresponsiveform' => XOOPS_ROOT_PATH . '/class/xoopsform/responsiveform.php', + 'xoopssimpleform' => XOOPS_ROOT_PATH . '/class/xoopsform/simpleform.php', + 'xoopsformtextdateselect' => XOOPS_ROOT_PATH . '/class/xoopsform/formtextdateselect.php', + 'xoopsformdatetime' => XOOPS_ROOT_PATH . '/class/xoopsform/formdatetime.php', + 'xoopsformhiddentoken' => XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php', + 'xoopsformcolorpicker' => XOOPS_ROOT_PATH . '/class/xoopsform/formcolorpicker.php', + 'xoopsformcaptcha' => XOOPS_ROOT_PATH . '/class/xoopsform/formcaptcha.php', + 'xoopsformeditor' => XOOPS_ROOT_PATH . '/class/xoopsform/formeditor.php', + 'xoopsformselecteditor' => XOOPS_ROOT_PATH . '/class/xoopsform/formselecteditor.php', + 'xoopsformcalendar' => XOOPS_ROOT_PATH . '/class/xoopsform/formcalendar.php', + ); + } + + /** + * XoopsLoad::loadConfig() + * + * @param mixed $data + * @return + */ + function loadConfig($data = null) + { + if (is_array($data)) { + $configs = $data; + } else { + if (! empty($data)) { + $dirname = $data; + } elseif (is_object($GLOBALS['xoopsModule'])) { + $dirname = $GLOBALS['xoopsModule']->getVar('dirname', 'n'); + } else { + return false; + } + if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/include/autoload.php')) { + if (! $configs = include $file) { + return false; + } + } + } + return $configs = array_merge(XoopsLoad::loadCoreConfig(), $configs); + } +} +// To be enabled in XOOPS 3.0 +// spl_autoload_register(array('XoopsLoad', 'load')); + + +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/include/defines.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/include/defines.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/include/defines.php 2013-06-28 10:29:48 UTC (rev 11796) @@ -0,0 +1,123 @@ +<?php +/** + * XOOPS constansts + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @since 2.0.0 + * @version $Id: defines.php 10054 2012-08-11 10:06:44Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * Define required Defines (I guess lol ) + */ +define('XOOPS_SIDEBLOCK_LEFT', 0); +define('XOOPS_SIDEBLOCK_RIGHT', 1); +define('XOOPS_SIDEBLOCK_BOTH', 2); +define('XOOPS_CENTERBLOCK_LEFT', 3); +define('XOOPS_CENTERBLOCK_RIGHT', 4); +define('XOOPS_CENTERBLOCK_CENTER', 5); +define('XOOPS_CENTERBLOCK_ALL', 6); +define('XOOPS_CENTERBLOCK_BOTTOMLEFT', 7); +define('XOOPS_CENTERBLOCK_BOTTOMRIGHT', 8); +define('XOOPS_CENTERBLOCK_BOTTOM', 9); +define('XOOPS_FOOTERBLOCK_ALL', 10); +define('XOOPS_FOOTERBLOCK_LEFT', 11); +define('XOOPS_FOOTERBLOCK_RIGHT', 12); +define('XOOPS_FOOTERBLOCK_CENTER', 13); +define('XOOPS_BLOCK_INVISIBLE', 0); +define('XOOPS_BLOCK_VISIBLE', 1); +define('XOOPS_MATCH_START', 0); +define('XOOPS_MATCH_END', 1); +define('XOOPS_MATCH_EQUAL', 2); +define('XOOPS_MATCH_CONTAIN', 3); +// YOU SHOULD AVOID USING THE FOLLOWING CONSTANTS, THEY WILL BE REMOVED +define('XOOPS_THEME_PATH', XOOPS_ROOT_PATH . '/themes'); +define('XOOPS_ADMINTHEME_PATH', XOOPS_ROOT_PATH . '/modules/system/themes'); +define('XOOPS_UPLOAD_PATH', XOOPS_ROOT_PATH . '/uploads'); +define('XOOPS_LIBRARY_PATH', XOOPS_ROOT_PATH . '/libraries'); +define('XOOPS_THEME_URL', XOOPS_URL . '/themes'); +define('XOOPS_ADMINTHEME_URL', XOOPS_URL . '/modules/system/themes'); +define('XOOPS_UPLOAD_URL', XOOPS_URL . '/uploads'); +define('XOOPS_LIBRARY_URL', XOOPS_URL . '/libraries'); + +// ----- BEGIN: Deprecated, move to template class ----- +// define('SMARTY_DIR', XOOPS_ROOT_PATH . '/class/smarty/'); +define('XOOPS_COMPILE_PATH', XOOPS_VAR_PATH . '/caches/smarty_compile'); +define('XOOPS_CACHE_PATH', XOOPS_VAR_PATH . '/caches/xoops_cache'); +// ----- END: Deprecated, move to template class ----- + +if (!defined('XOOPS_XMLRPC')) { + define('XOOPS_DB_CHKREF', 1); +} else { + define('XOOPS_DB_CHKREF', 0); +} + +/** + * User Mulitbytes + */ +// if ( !defined( 'XOOPS_USE_MULTIBYTES' ) ) { +// define('XOOPS_USE_MULTIBYTES', 0 ); +// } + +// IT IS A WRONG PLACE FOR THE FOLLOWING CONSTANTS +/* + * Some language definitions that cannot be translated + */ +define('_XOOPS_FATAL_MESSAGE', "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> +<html xmlns='http://www.w3.org/1999/xhtml'> +<head> +<meta http-equiv='Content-Type' content='text/html; charset=utf-8;charset=utf-8' /> +<title>Internal server error</title> +<style type='text/css'> +* { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif;} +body {font-size: 12px; background-color: #f0f0f0; text-align: center;} +#xo-siteblocked { + border: 1px solid #c0c4c0; + width: 375px; + height: 318px; + margin: 150px auto; + text-align: center; + background-color: #fff; + background-image: url(images/img_errors.png); + background-repeat: no-repeat; + background-position: 30px 50px; + padding-left: 300px; + padding-right: 30px; + border-radius: 15px; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; +} + #xo-siteblocked h1 {font-size: 1.7em; margin: 45px 0 30px 0;} + #xo-siteblocked h2 {font-size: 1.5em; margin: 0 0 30px 0;} + #xo-siteblocked h1, h2 {font-weight: normal; text-shadow: 1px 1px 2px #ccc;} + #xo-siteblocked a, #xo-siteblocked a:visited {color: #2cb0ff; text-decoration: none;} + #xo-siteblocked p { font-size: 1.3em; margin-top: 12px; line-height: 2em;} + #xo-siteblocked p.xo-siteblocked-message { height: 70px;} + #xo-siteblocked p.xo-siteblocked-desc { font-size: .9em; font-style: italic; margin-top: 25px;} +</style> +</head> +<body> + <div id='xo-siteblocked'> + <h1>A problem has occurred on our server!</h1> + <h2>Page is currently unavailable</h2> + <p class='xo-siteblocked-message'>We are working on a fix<br /><a href='/'>Please come back soon ...</a></p> + <p class='xo-siteblocked-desc'>Error : %s</p> + </div> +</body> +</html>" +); + +define('_XOOPS_FATAL_BACKTRACE', "Backtrace"); + +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/class/block.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/class/block.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_timgno/htdocs/modules/system/class/block.php 2013-06-28 10:29:48 UTC (rev 11796) @@ -0,0 +1,564 @@ +<?php +/** + * Block Class Manager +* + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package system + ... [truncated message content] |
From: <red...@us...> - 2013-08-11 23:26:27
|
Revision: 11898 http://sourceforge.net/p/xoops/svn/11898 Author: redheadedrod Date: 2013-08-11 23:26:23 +0000 (Sun, 11 Aug 2013) Log Message: ----------- Added Paths: ----------- XoopsCore/branches/2.5.x/2.5.7_redheadedrod/ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/Frameworks/ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/Frameworks/moduleclasses/ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/Frameworks/moduleclasses/moduleadmin/ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/Frameworks/moduleclasses/moduleadmin/moduleadmin.php XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/class/ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/class/database/ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/class/database/mysqldatabase.php Added: XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/Frameworks/moduleclasses/moduleadmin/moduleadmin.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/Frameworks/moduleclasses/moduleadmin/moduleadmin.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/Frameworks/moduleclasses/moduleadmin/moduleadmin.php 2013-08-11 23:26:23 UTC (rev 11898) @@ -0,0 +1,514 @@ +<?php +/** + * Frameworks Module Admin + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright Grégory Mage (Aka Mage) + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @author Grégory Mage (Aka Mage) + */ + +class ModuleAdmin +{ + + var $_itemButton = array(); + var $_itemInfoBox = array(); + var $_itemInfoBoxLine = array(); + var $_itemConfigBoxLine = array(); + var $_obj = array(); + + /** + * Constructor + */ + function __construct() + { + //global $xoopsModule, $xoTheme; + global $xoopsModule; + $this->_obj =& $xoopsModule; + echo "<style type=\"text/css\" media=\"screen\">@import \"" . XOOPS_URL . "/Frameworks/moduleclasses/moduleadmin/css/admin.css\";</style>"; + //$xoTheme->addStylesheet("Frameworks/moduleclasses/moduleadmin/css/admin.css"); + $this -> loadLanguage(); + } + + function getInfo() + { + $infoArray = array(); + if (!isset($infoArray) or empty($infoArray)) { + $infoArray = array(); + $infoArray['version'] = $this->getVersion(); + $infoArray['releasedate'] = $this->getReleaseDate(); + $infoArray['methods'] = $this->getClassMethods(); + } + return $infoArray; + } + + /** + * Return the Module Admin class version number + * return string version + **/ + function getVersion() + { + /** + * version is rev of this class + */ + Include_once 'xoops_version.php'; + $version = XOOPS_FRAMEWORKS_MODULEADMIN_VERSION; + return $version; + } + + /** + * Return the Module Admin class release date + * return string version + **/ + function getReleaseDate() + { + /** + * version is rev of this class + */ + Include_once 'xoops_version.php'; + $releasedate = XOOPS_FRAMEWORKS_MODULEADMIN_RELEASEDATE; + return $releasedate; + } + + /** + * Return the available methods for the class + * + * @return array methods supported by this class + */ + function getClassMethods() + { + $myMethods = get_class_methods(__CLASS__); + return $myMethods; + } + + //****************************************************************************************************************** + // loadLanguage + //****************************************************************************************************************** + // Loaf the language file. + //****************************************************************************************************************** + function loadLanguage() { + $language = $GLOBALS['xoopsConfig']['language']; + if ( !file_exists($fileinc = XOOPS_ROOT_PATH . "/Frameworks/moduleclasses/moduleadmin/language/{$language}/main.php" )){ + if ( !file_exists($fileinc = XOOPS_ROOT_PATH . "/Frameworks/moduleclasses/moduleadmin/language/english/main.php" )){ + return false; + } + } + $ret = include_once $fileinc; + return $ret; + } + //****************************************************************************************************************** + // renderMenuIndex + //****************************************************************************************************************** + // Creating a menu icon in the index + //****************************************************************************************************************** + function renderMenuIndex() + { + $path = XOOPS_URL . "/modules/" . $this->_obj->getVar('dirname') . "/"; + $pathsystem = XOOPS_URL . "/modules/system/"; + $this->_obj->loadAdminMenu(); + $ret = "<div class=\"rmmenuicon\">\n"; + foreach (array_keys( $this->_obj->adminmenu) as $i) { + if ($this->_obj->adminmenu[$i]['link'] != 'admin/index.php'){ + $ret .= "<a href=\"../" . $this->_obj->adminmenu[$i]['link'] . "\" title=\"" . (isset($this->_obj->adminmenu[$i]['desc']) ? $this->_obj->adminmenu[$i]['desc'] : '') . "\">"; + $ret .= "<img src=\"" . $path . $this->_obj->adminmenu[$i]['icon']. "\" alt=\"" . $this->_obj->adminmenu[$i]['title'] . "\" />"; + $ret .= "<span>" . $this->_obj->adminmenu[$i]['title'] . "</span>"; + $ret .= "</a>"; + } + } + if ($this->_obj->getInfo('help')) { + if (substr(XOOPS_VERSION, 0, 9) >= 'XOOPS 2.5'){ + $ret .= "<a href=\"" . $pathsystem . "help.php?mid=" . $this->_obj->getVar('mid', 's') . "&" . $this->_obj->getInfo('help') . "\" title=\"" . _AM_SYSTEM_HELP . "\">"; + $ret .= "<img width=\"32px\" src=\"" . XOOPS_URL . "/Frameworks/moduleclasses/icons/32/help.png\" alt=\"" . _AM_SYSTEM_HELP . "\" /> "; + $ret .= "<span>" . _AM_SYSTEM_HELP . "</span>"; + $ret .= "</a>"; + } + } + $ret .= "</div>\n<div style=\"clear: both;\"></div>\n"; + return $ret; + } + //****************************************************************************************************************** + // renderButton + //****************************************************************************************************************** + // Creating button + //****************************************************************************************************************** + function renderButton($position = "right", $delimeter = " ") + { + $path = XOOPS_URL . "/Frameworks/moduleclasses/icons/32/"; + switch ($position) + { + default: + case "right": + $ret = "<div class=\"floatright\">\n"; + break; + + case "left": + $ret = "<div class=\"floatleft\">\n"; + break; + + case "center": + $ret = "<div class=\"aligncenter\">\n"; + } + $ret .= "<div class=\"xo-buttons\">\n"; + foreach (array_keys( $this -> _itemButton) as $i) { + $ret .= "<a class='ui-corner-all tooltip' href='" . $this -> _itemButton[$i]['link'] . "' title='" . $this -> _itemButton[$i]['title'] . "'>"; + $ret .= "<img src='" . $path . $this -> _itemButton[$i]['icon'] . "' title='" . $this -> _itemButton[$i]['title'] . "' />" . $this -> _itemButton[$i]['title'] . ' ' . $this -> _itemButton[$i]['extra']; + $ret .= "</a>\n"; + $ret .= $delimeter; + } + $ret .= "</div>\n</div>\n"; + $ret .= "<br /> <br /><br />"; + return $ret; + } + + function addItemButton($title, $link, $icon = 'add', $extra = '') + { + $ret['title'] = $title; + $ret['link'] = $link; + $ret['icon'] = $icon . '.png'; + $ret['extra'] = $extra; + $this -> _itemButton[] = $ret; + return true; + + } + //****************************************************************************************************************** + // addConfigBoxLine + //****************************************************************************************************************** + // $value: value + // $type: type of config: 1- "default": Just a line with value. + // 2- "folder": check if this is an folder. + // 3- "chmod": check if this is the good chmod. + // For this type ("chmod"), the value is an array: array(path, chmod) + //****************************************************************************************************************** + function addConfigBoxLine($value = '', $type = 'default') + { + $line = ""; + $path = XOOPS_URL . "/Frameworks/moduleclasses/icons/16/"; + switch ($type) + { + default: + case "default": + $line .= "<span>" . $value . "</span>"; + break; + + case "folder": + if (!is_dir($value)){ + $line .= "<span style='color : red; font-weight : bold;'>"; + $line .= "<img src='" . $path . "off.png' >"; + $line .= sprintf(_AM_MODULEADMIN_CONFIG_FOLDERKO, $value); + $line .= "</span>\n"; + }else{ + $line .= "<span style='color : green;'>"; + $line .= "<img src='" . $path . "on.png' >"; + $line .= sprintf(_AM_MODULEADMIN_CONFIG_FOLDEROK, $value); + $line .= "</span>\n"; + } + break; + + case "chmod": + if (is_dir($value[0])){ + if (substr(decoct(fileperms($value[0])),2) != $value[1]) { + $line .= "<span style='color : red; font-weight : bold;'>"; + $line .= "<img src='" . $path . "off.png' >"; + $line .= sprintf(_AM_MODULEADMIN_CONFIG_CHMOD, $value[0], $value[1], substr(decoct(fileperms($value[0])),2)); + $line .= "</span>\n"; + }else{ + $line .= "<span style='color : green;'>"; + $line .= "<img src='" . $path . "on.png' >"; + $line .= sprintf(_AM_MODULEADMIN_CONFIG_CHMOD, $value[0], $value[1], substr(decoct(fileperms($value[0])),2)); + $line .= "</span>\n"; + } + } + break; + } + $this -> _itemConfigBoxLine[] = $line; + return true; + } + //****************************************************************************************************************** + // renderIndex + //****************************************************************************************************************** + // Creating an index + //****************************************************************************************************************** + function renderIndex() + { + $ret = "<table>\n<tr>\n"; + $ret .= "<td width=\"40%\">\n"; + $ret .= $this -> renderMenuIndex(); + $ret .= "</td>\n"; + $ret .= "<td width=\"60%\">\n"; + $ret .= $this -> renderInfoBox(); + $ret .= "</td>\n"; + $ret .= "</tr>\n"; + // If you use a config label + if ($this->_obj->getInfo('min_php') || $this->_obj->getInfo('min_xoops') || !empty($this -> _itemConfigBoxLine)){ + $ret .= "<tr>\n"; + $ret .= "<td colspan=\"2\">\n"; + $ret .= "<fieldset><legend class=\"label\">"; + $ret .= _AM_MODULEADMIN_CONFIG; + $ret .= "</legend>\n"; + + // php version + $path = XOOPS_URL . "/Frameworks/moduleclasses/icons/16/"; + if ($this->_obj->getInfo('min_php')){ + if (phpversion() < $this->_obj->getInfo('min_php')){ + $ret .= "<span style='color : red; font-weight : bold;'><img src='" . $path . "off.png' >" . sprintf(_AM_MODULEADMIN_CONFIG_PHP, $this->_obj->getInfo('min_php'), phpversion()) . "</span>\n"; + }else{ + $ret .= "<span style='color : green;'><img src='" . $path . "on.png' >" . sprintf(_AM_MODULEADMIN_CONFIG_PHP, $this->_obj->getInfo('min_php'), phpversion()) . "</span>\n"; + } + $ret .= "<br />"; + } + + // Database version + $path = XOOPS_URL . "/Frameworks/moduleclasses/icons/16/"; + $dbarray=$this->_obj->getInfo('min_db'); + if ($dbarray[XOOPS_DB_TYPE]) { + global $xoopsDB; // new line added by redheadedrod + $dbCurrentVersion= $xoopsDB->getServerVersion(); // new line added by redheadedrod + /* Remove hard coded code... Replaced by lines above + * also need to add getServerVersion to database connector. + switch (XOOPS_DB_TYPE) { + case "mysql": + global $xoopsDB; + echo $xoopsDB->getServerInfo(); + $dbCurrentVersion= $xoopsDB->getServerInfo(); + break; + case "mysqli": + $dbCurrentVersion = mysqli_get_server_info(); + break; + case "pdo": + global $xoopsDB; + $dbCurrentVersion = $xoopsDB->getAttribute(PDO::ATTR_SERVER_VERSION); + break; + default: + $dbCurrentVersion = '0'; + break; + } */ + $currentVerParts = explode('.', (string)$dbCurrentVersion); + $iCurrentVerParts = array_map('intval', $currentVerParts); + $dbRequiredVersion = $dbarray[XOOPS_DB_TYPE]; + $reqVerParts = explode('.', (string)$dbRequiredVersion); + $iReqVerParts = array_map('intval', $reqVerParts); + $icount = $j = count($iReqVerParts); + $reqVer = $curVer = 0; + for ($i=0; $i<$icount; $i++) { + $j--; + $reqVer += $iReqVerParts[$i] * pow(10, $j); + if (isset($iCurrentVerParts[$i])) { + $curVer += $iCurrentVerParts[$i] * pow(10, $j); + } else { + $curVer = $curVer * pow(10, $j); + } + } + if ($reqVer > $curVer) { + $ret .= "<span style='color : red; font-weight : bold;'><img src='" . $path . "off.png' >" . sprintf(XOOPS_DB_TYPE.' '._AM_MODULEADMIN_CONFIG_DB, $dbRequiredVersion, $dbCurrentVersion) . "</span><br />\n"; + } else { + $ret .= "<span style='color : green;'><img src='" . $path . "on.png' >" . sprintf(strtoupper(XOOPS_DB_TYPE).' '._AM_MODULEADMIN_CONFIG_DB, $dbRequiredVersion, $dbCurrentVersion) . "</span><br />\n"; + } + } + + // xoops version + if ($this->_obj->getInfo('min_xoops')){ + if (substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION)-6) < $this->_obj->getInfo('min_xoops')){ + $ret .= "<span style='color : red; font-weight : bold;'><img src='" . $path . "off.png' >" . sprintf(_AM_MODULEADMIN_CONFIG_XOOPS, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION)-6)) . "</span>\n"; + }else{ + $ret .= "<span style='color : green;'><img src='" . $path . "on.png' >" . sprintf(_AM_MODULEADMIN_CONFIG_XOOPS, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION)-6)) . "</span>\n"; + } + $ret .= "<br />"; + } + + // ModuleAdmin version + if ($this->_obj->getInfo('min_admin')){ + if ($this->getVersion() < $this->_obj->getInfo('min_admin')){ + $ret .= "<span style='color : red; font-weight : bold;'><img src='" . $path . "off.png' >" . sprintf(_AM_MODULEADMIN_CONFIG_ADMIN, $this->_obj->getInfo('min_admin'), $this->getVersion()) . "</span>\n"; + }else{ + $ret .= "<span style='color : green;'><img src='" . $path . "on.png' >" . sprintf(_AM_MODULEADMIN_CONFIG_ADMIN, $this->_obj->getInfo('min_admin'), $this->getVersion()) . "</span>\n"; + } + $ret .= "<br />"; + } + if (!empty($this -> _itemConfigBoxLine)){ + foreach (array_keys( $this -> _itemConfigBoxLine) as $i) { + $ret .= $this -> _itemConfigBoxLine[$i]; + $ret .= "<br />"; + } + } + $ret .= "</fieldset>\n"; + $ret .= "</td>\n"; + $ret .= "</tr>\n"; + } + $ret .= "</table>\n"; + return $ret; + } + //****************************************************************************************************************** + // addInfoBox + //****************************************************************************************************************** + // $title: title of an InfoBox + //****************************************************************************************************************** + function addInfoBox($title) + { + $ret['title'] = $title; + $this -> _itemInfoBox[] = $ret; + return true; + } + //****************************************************************************************************************** + // addInfoBoxLine + //****************************************************************************************************************** + // $label: title of InfoBox Line + // $text: + // $type: type of config: 1- "default": Just a line with value. + // 2- "information": check if this is an folder. + // 3- "chmod": check if this is the good chmod. + // For this type ("chmod"), the value is an array: array(path, chmod) + //****************************************************************************************************************** + function addInfoBoxLine($label, $text, $value = '', $color = 'inherit', $type = 'default') + { + $ret['label'] = $label; + $line = ""; + switch ($type) + { + default: + case "default": + $line .= sprintf($text, "<span style='color : " . $color . "; font-weight : bold;'>" . $value . "</span>"); + break; + + case "information": + $line .= $text; + break; + } + $ret['line'] = $line; + $this -> _itemInfoBoxLine[] = $ret; + return true; + } + function renderInfoBox() + { + $ret = ""; + foreach (array_keys( $this -> _itemInfoBox) as $i) { + $ret .= "<fieldset><legend class=\"label\">"; + $ret .= $this -> _itemInfoBox[$i]['title']; + $ret .= "</legend>\n"; + foreach (array_keys( $this -> _itemInfoBoxLine) as $k) { + if ($this -> _itemInfoBoxLine[$k]['label'] == $this -> _itemInfoBox[$i]['title']){ + $ret .= $this -> _itemInfoBoxLine[$k]['line']; + $ret .= "<br />"; + } + } + $ret .= "</fieldset>\n"; + $ret .= "<br/>\n"; + } + return $ret; + } + + + function renderAbout($paypal = '', $logo_xoops = true) + { + $path = XOOPS_URL . "/Frameworks/moduleclasses/icons/32/"; + + $ret = "<table>\n<tr>\n"; + $ret .= "<td width=\"50%\">\n"; + $date = explode('/',$this->_obj->getInfo('release_date')); + $author = explode(',',$this->_obj->getInfo('author')); + $nickname = explode(',',$this->_obj->getInfo('nickname')); + $release_date = formatTimestamp(mktime(0, 0, 0, $date[1], $date[2], $date[0]), 's'); + $module_info = '<div id="about"><label>' . _AM_MODULEADMIN_ABOUT_DESCRIPTION . '</label><text>' . $this->_obj->getInfo("description") . '</text><br /> + <label>' . _AM_MODULEADMIN_ABOUT_UPDATEDATE . '</label><text class="bold">' . formatTimestamp($this->_obj->getVar("last_update"),"m") . '</text><br /> + <label>' . _AM_MODULEADMIN_ABOUT_MODULESTATUS . '</label><text>' . $this->_obj->getInfo("module_status") . '</text><br /> + <label>' . _AM_MODULEADMIN_ABOUT_WEBSITE . '</label><text><a class="tooltip" href="http://' . $this->_obj->getInfo("module_website_url") . '" rel="external" title="'. $this->_obj->getInfo("module_website_name") . ' - ' . $this->_obj->getInfo("module_website_url") . '"> + ' . $this->_obj->getInfo("module_website_name") . '</a></text></div>'; + $ret .= "<table>\n<tr>\n<td width=\"100px\">\n"; + $ret .= "<img src='" . XOOPS_URL . "/modules/" . $this->_obj->getVar('dirname') . "/" . $this->_obj->getInfo('image') . "' alt='" . $this->_obj->getVar('name') . "' style='float: left; margin-right: 10px;' />\n"; + $ret .= "</td><td>\n"; + $ret .= "<div style='margin-top: 1px; margin-bottom: 4px; font-size: 18px; line-height: 18px; color: #2F5376; font-weight: bold;'>\n"; + $ret .= $this->_obj->getInfo('name') . " " . $this->_obj->getInfo('version') . " " . $this->_obj->getInfo('module_status') . " (" . $release_date . ")\n"; + $ret .= "<br />\n"; + $ret .= "</div>\n"; + $ret .= "<div style='line-height: 16px; font-weight: bold;'>\n"; + $ret .= "by "; + foreach (array_keys($author) as $i) { + $ret .= $author[$i]; + if (isset($nickname[$i]) && $nickname[$i] !='') { + $ret .= " (" . $nickname[$i] . "), "; + }else{ + $ret .= ", "; + } + } + $ret = substr($ret,0,-2); + $ret .= "</div>\n"; + $ret .= "<div style='line-height: 16px;'>\n"; + $ret.= "<a href=\"http://" . $this->_obj->getInfo('license_url'). "\" target=\"_blank\" >" . $this->_obj->getInfo('license'). "</a>\n"; + $ret .= "<br />\n"; + $ret .= "<a href=\"http://" . $this->_obj->getInfo('website') . "\" target=\"_blank\" >" . $this->_obj->getInfo('website') . "</a>\n"; + $ret .= "<br />\n"; + $ret .= "<br />\n"; + if ($paypal != ''){ + $ret .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> + <input type="hidden" name="cmd" value="_s-xclick"> + <input type="hidden" name="hosted_button_id" value="' . $paypal . '"> + <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> + <img alt="" border="0" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1"> + </form>'; + } + $ret .= "</div>\n"; + $ret .= "</td>\n</tr>\n</table>\n"; + $this -> addInfoBox(_AM_MODULEADMIN_ABOUT_MODULEINFO); + $this -> addInfoBoxLine(_AM_MODULEADMIN_ABOUT_MODULEINFO, $module_info, '', '', 'information'); + $ret .= $this -> renderInfoBox(); + $ret .= "</td>\n"; + $ret .= "<td width=\"50%\">\n"; + $ret .= "<fieldset><legend class=\"label\">\n"; + $ret .= _AM_MODULEADMIN_ABOUT_CHANGELOG; + $ret .= "</legend><br/>\n"; + $ret .= "<div class=\"txtchangelog\">\n"; + $language = $GLOBALS['xoopsConfig']['language']; + if ( !is_file( XOOPS_ROOT_PATH . "/modules/" . $this->_obj->getVar("dirname") . "/language/" . $language . "/changelog.txt" ) ){ + $language = 'english'; + } + $language = empty($language) ? $GLOBALS['xoopsConfig']['language'] : $language; + $file = XOOPS_ROOT_PATH. "/modules/" . $this->_obj->getVar("dirname") . "/language/" . $language . "/changelog.txt"; + if ( is_readable( $file ) ){ + $ret .= utf8_encode(implode("<br />", file( $file ))) . "\n"; + }else{ + $file = XOOPS_ROOT_PATH. "/modules/" . $this->_obj->getVar("dirname") . "/docs/changelog.txt"; + if ( is_readable( $file ) ){ + $ret .= utf8_encode(implode("<br />", file( $file ))) . "\n"; + } + } + $ret .= "</div>\n"; + $ret .= "</fieldset>\n"; + $ret .= "</td>\n"; + $ret .= "</tr>\n"; + $ret .= "</table>\n"; + if ($logo_xoops == true){ + $ret .= "<div align=\"center\">"; + $ret .= "<a href=\"http://www.xoops.org\" target=\"_blank\"><img src=\"" . $path . "xoopsmicrobutton.gif\" alt=\"XOOPS\" title=\"XOOPS\"></a>"; + $ret .= "</div>"; + } + return $ret; + } + + function addNavigation($menu = '') + { + $ret = ""; + $navigation = ""; + $path = XOOPS_URL . "/modules/" . $this->_obj->getVar('dirname') . "/"; + $this->_obj->loadAdminMenu(); + foreach (array_keys( $this->_obj->adminmenu) as $i) { + if ($this->_obj->adminmenu[$i]['link'] == "admin/" . $menu){ + $navigation .= $this->_obj->adminmenu[$i]['title'] . " | "; + $ret = "<div class=\"CPbigTitle\" style=\"background-image: url(" . $path . $this->_obj->adminmenu[$i]['icon'] . "); background-repeat: no-repeat; background-position: left; padding-left: 50px;\"> + <strong>" . $this->_obj->adminmenu[$i]['title'] . "</strong></div><br />"; + }else{ + $navigation .= "<a href = '../" . $this->_obj->adminmenu[$i]['link'] . "'>" . $this->_obj->adminmenu[$i]['title'] . "</a> | "; + } + } + if (substr(XOOPS_VERSION, 0, 9) < 'XOOPS 2.5'){ + $navigation .= "<a href = '../../system/admin.php?fct=preferences&op=showmod&mod=" . $this->_obj->getVar('mid') . "'>" . _MI_SYSTEM_ADMENU6 . "</a>"; + $ret = $navigation . "<br /><br />" . $ret; + } + return $ret; + } +} +?> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/class/database/mysqldatabase.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/class/database/mysqldatabase.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.7_redheadedrod/htdocs/class/database/mysqldatabase.php 2013-08-11 23:26:23 UTC (rev 11898) @@ -0,0 +1,417 @@ +<?php +/** + * MySQL access + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage database + * @since 1.0.0 + * @author Kazumi Ono <on...@xo...> + * @version $Id: mysqldatabase.php 10264 2012-11-21 04:52:11Z beckmi $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * + * @package kernel + * @subpackage database + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ + +/** + * base class + */ +include_once XOOPS_ROOT_PATH . '/class/database/database.php'; +// xoops_load( 'xoopsdatabase' ); +/** + * connection to a mysql database + * + * @abstract + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + * @package kernel + * @subpackage database + */ +class XoopsMySQLDatabase extends XoopsDatabase +{ + /** + * Database connection + * + * @var resource + */ + var $conn; + + /** + * connect to the database + * + * @param bool $selectdb select the database now? + * @return bool successful? + */ + function connect($selectdb = TRUE) + { + static $db_charset_set; + + if (!extension_loaded('mysql')) { + trigger_error('notrace:mysql extension not loaded', E_USER_ERROR); + return FALSE; + } + + $this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET'); + + if (XOOPS_DB_PCONNECT == 1) { + $this->conn = @mysql_pconnect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS); + } else { + $this->conn = @mysql_connect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS); + } + + if (!$this->conn) { + $this->logger->addQuery('', $this->error(), $this->errno()); + return FALSE; + } + if ($selectdb != FALSE) { + if (!mysql_select_db(XOOPS_DB_NAME)) { + $this->logger->addQuery('', $this->error(), $this->errno()); + return FALSE; + } + } + if (!isset($db_charset_set) && defined('XOOPS_DB_CHARSET') && XOOPS_DB_CHARSET) { + $this->queryF("SET NAMES '" . XOOPS_DB_CHARSET . "'"); + } + $db_charset_set = 1; + $this->queryF("SET SQL_BIG_SELECTS = 1"); + return TRUE; + } + + /** + * Return information about the database server in use + * + * This is a new function added for 2.5.7 and later to allow support for other databases. + * + * @return will return version of server in use + */ + function getServerVersion() + { + return mysql_get_server_info(); + } + + /** + * generate an ID for a new row + * + * This is for compatibility only. Will always return 0, because MySQL supports + * autoincrement for primary keys. + * + * @param string $sequence name of the sequence from which to get the next ID + * @return int always 0, because mysql has support for autoincrement + */ + function genId($sequence) + { + return 0; // will use auto_increment + } + + /** + * Get a result row as an enumerated array + * + * @param resource $result + * @return array + */ + function fetchRow($result) + { + return @mysql_fetch_row($result); + } + + /** + * Fetch a result row as an associative array + * + * @return array + */ + function fetchArray($result) + { + return @mysql_fetch_assoc($result); + } + + /** + * Fetch a result row as an associative array + * + * @return array + */ + function fetchBoth($result) + { + return @mysql_fetch_array($result, MYSQL_BOTH); + } + + /** + * XoopsMySQLDatabase::fetchObjected() + * + * @param mixed $result + * @return + */ + function fetchObject($result) + { + return @mysql_fetch_object($result); + } + + /** + * Get the ID generated from the previous INSERT operation + * + * @return int + */ + function getInsertId() + { + return mysql_insert_id($this->conn); + } + + /** + * Get number of rows in result + * + * @param resource $ query result + * @return int + */ + function getRowsNum($result) + { + return @mysql_num_rows($result); + } + + /** + * Get number of affected rows + * + * @return int + */ + function getAffectedRows() + { + return mysql_affected_rows($this->conn); + } + + /** + * Close MySQL connection + */ + function close() + { + mysql_close($this->conn); + } + + /** + * will free all memory associated with the result identifier result. + * + * @param resource $ query result + * @return bool TRUE on success or FALSE on failure. + */ + function freeRecordSet($result) + { + return mysql_free_result($result); + } + + /** + * Returns the text of the error message from previous MySQL operation + * + * @return bool Returns the error text from the last MySQL function, or '' (the empty string) if no error occurred. + */ + function error() + { + return @mysql_error(); + } + + /** + * Returns the numerical value of the error message from previous MySQL operation + * + * @return int Returns the error number from the last MySQL function, or 0 (zero) if no error occurred. + */ + function errno() + { + return @mysql_errno(); + } + + /** + * Returns escaped string text with single quotes around it to be safely stored in database + * + * @param string $str unescaped string text + * @return string escaped string text with single quotes around + */ + function quoteString($str) + { + return $this->quote($str); + } + + /** + * Quotes a string for use in a query. + */ + function quote($string) + { + return "'" . str_replace("\\\"", '"', str_replace("\\"", '"', mysql_real_escape_string($string, $this->conn))) . "'"; + } + + /** + * perform a query on the database + * + * @param string $sql a valid MySQL query + * @param int $limit number of records to return + * @param int $start offset of first record to return + * @return resource query result or FALSE if successful + * or TRUE if successful and no result + */ + function queryF($sql, $limit = 0, $start = 0) + { + if (!empty($limit)) { + if (empty($start)) { + $start = 0; + } + $sql = $sql . ' LIMIT ' . (int) $start . ', ' . (int) $limit; + } + $this->logger->startTime('query_time'); + $result = mysql_query($sql, $this->conn); + $this->logger->stopTime('query_time'); + $query_time = $this->logger->dumpTime('query_time', TRUE); + if ($result) { + $this->logger->addQuery($sql, NULL, NULL, $query_time); + return $result; + } else { + $this->logger->addQuery($sql, $this->error(), $this->errno(), $query_time); + return FALSE; + } + } + + /** + * perform a query + * + * This method is empty and does nothing! It should therefore only be + * used if nothing is exactly what you want done! ;-) + * + * @param string $sql a valid MySQL query + * @param int $limit number of records to return + * @param int $start offset of first record to return + * @abstract + */ + function query($sql, $limit = 0, $start = 0) + { + } + + /** + * perform queries from SQL dump file in a batch + * + * @param string $file file path to an SQL dump file + * @return bool FALSE if failed reading SQL file or TRUE if the file has been read and queries executed + */ + function queryFromFile($file) + { + if (FALSE !== ($fp = fopen($file, 'r'))) { + include_once XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; + $sql_queries = trim(fread($fp, filesize($file))); + SqlUtility::splitMySqlFile($pieces, $sql_queries); + foreach ($pieces as $query) { + // [0] contains the prefixed query + // [4] contains unprefixed table name + $prefixed_query = SqlUtility::prefixQuery(trim($query), $this->prefix()); + if ($prefixed_query != FALSE) { + $this->query($prefixed_query[0]); + } + } + return TRUE; + } + return FALSE; + } + + /** + * Get field name + * + * @param resource $result query result + * @param int $ numerical field index + * @return string + */ + function getFieldName($result, $offset) + { + return mysql_field_name($result, $offset); + } + + /** + * Get field type + * + * @param resource $result query result + * @param int $offset numerical field index + * @return string + */ + function getFieldType($result, $offset) + { + return mysql_field_type($result, $offset); + } + + /** + * Get number of fields in result + * + * @param resource $result query result + * @return int + */ + function getFieldsNum($result) + { + return mysql_num_fields($result); + } +} + +/** + * Safe Connection to a MySQL database. + * + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + * @package kernel + * @subpackage database + */ +class XoopsMySQLDatabaseSafe extends XoopsMySQLDatabase +{ + /** + * perform a query on the database + * + * @param string $sql a valid MySQL query + * @param int $limit number of records to return + * @param int $start offset of first record to return + * @return resource query result or FALSE if successful + * or TRUE if successful and no result + */ + function query($sql, $limit = 0, $start = 0) + { + return $this->queryF($sql, $limit, $start); + } +} + +/** + * Read-Only connection to a MySQL database. + * + * This class allows only SELECT queries to be performed through its + * {@link query()} method for security reasons. + * + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + * @package kernel + * @subpackage database + */ +class XoopsMySQLDatabaseProxy extends XoopsMySQLDatabase +{ + /** + * perform a query on the database + * + * this method allows only SELECT queries for safety. + * + * @param string $sql a valid MySQL query + * @param int $limit number of records to return + * @param int $start offset of first record to return + * @return resource query result or FALSE if unsuccessful + */ + function query($sql, $limit = 0, $start = 0) + { + $sql = ltrim($sql); + if (!$this->allowWebChanges && strtolower(substr($sql, 0, 6)) != 'select') { + trigger_error('Database updates are not allowed during processing of a GET request', E_USER_WARNING); + return FALSE; + } + + return $this->queryF($sql, $limit, $start); + } +} + +?> \ No newline at end of file |
From: <txm...@us...> - 2015-01-24 14:11:01
|
Revision: 12946 http://sourceforge.net/p/xoops/svn/12946 Author: txmodxoops Date: 2015-01-24 14:10:57 +0000 (Sat, 24 Jan 2015) Log Message: ----------- Added jquery ui libraries in default admin theme system Added Paths: ----------- XoopsCore/branches/2.5.x/2.5.8_timgno/ XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/ XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/ XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/system/ XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/system/themes/ XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/system/themes/default/ XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/system/themes/default/default.php Added: XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/system/themes/default/default.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/system/themes/default/default.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_timgno/htdocs/modules/system/themes/default/default.php 2015-01-24 14:10:57 UTC (rev 12946) @@ -0,0 +1,318 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +xoops_load('gui', 'system'); + +/* + * Xoops Cpanel default GUI class + * + * @copyright The XOOPS project http://sf.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package system + * @usbpackage GUI + * @since 2.4 + * @author Mamba XXXXXXXXXXXXXXXXXXX + * @author Mojtabajml <jam...@gm...> + * @author Voltan <djv...@gm...> + * @author BitC3R0 <Bi...@gm...> + * @author trabis <lus...@gm...> + * @version 1.2 + * @version $Id: default.php 12360 2014-03-08 09:46:59Z beckmi $ + */ + +/** + * Class XoopsGuiDefault + */ +class XoopsGuiDefault extends XoopsSystemGui +{ + + /** + * + */ + function __construct() + { + } + + function XoopsGuiDefault() + { + $this->__construct(); + } + + /** + * @return bool + */ + function validate() + { + return true; + } + + function header() + { + parent::header(); + + global $xoopsConfig, $xoopsUser, $xoopsModule, $xoTheme, $xoopsTpl; + $tpl =& $this->template; + + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); + // + $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); + // + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/styleswitch.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/formenu.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/menu.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tooltip.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tabs.jquery.tools.min.js'); + + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/style.css' ); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/dark.css', array('title' => 'dark', 'media' => 'screen')); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/silver.css', array('title' => 'silver', 'media' => 'screen')); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/orange.css', array('title' => 'orange', 'media' => 'screen')); + + $tpl->assign('lang_cp', _CPHOME); + //start system overview + //$tpl->assign('lang_xoops_version', XOOPS_VERSION); + $tpl->assign('lang_php_vesion', PHP_VERSION); + $tpl->assign('lang_mysql_version', mysql_get_server_info()); + $tpl->assign('lang_server_api', PHP_SAPI); + $tpl->assign('lang_os_name', PHP_OS); + $tpl->assign('safe_mode', ini_get( 'safe_mode' ) ? 'On' : 'Off'); + $tpl->assign('register_globals', ini_get( 'register_globals' ) ? 'On' : 'Off'); + $tpl->assign('magic_quotes_gpc', ini_get( 'magic_quotes_gpc' ) ? 'On' : 'Off'); + $tpl->assign('allow_url_fopen', ini_get( 'allow_url_fopen' ) ? 'On' : 'Off'); + $tpl->assign('fsockopen', function_exists( 'fsockopen' ) ? 'On' : 'Off'); + $tpl->assign('allow_call_time_pass_reference', ini_get( 'allow_call_time_pass_reference' ) ? 'On' : 'Off'); + $tpl->assign('post_max_size', ini_get( 'post_max_size' )); + $tpl->assign('max_input_time', ini_get( 'max_input_time' )); + $tpl->assign('output_buffering', ini_get( 'output_buffering' )); + $tpl->assign('max_execution_time', ini_get( 'max_execution_time' )); + $tpl->assign('memory_limit', ini_get( 'memory_limit' )); + $tpl->assign('file_uploads', ini_get( 'file_uploads' ) ? 'On' : 'Off'); + $tpl->assign('upload_max_filesize', ini_get( 'upload_max_filesize' )); + $tpl->assign('xoops_sitename', $xoopsConfig['sitename']); + + // ADD MENU ***************************************** + + //Add CONTROL PANEL Menu items + $menu = array(); + $menu[0]['link'] = XOOPS_URL; + $menu[0]['title'] = _YOURHOME; + $menu[0]['absolute'] = 1; + $menu[1]['link'] = XOOPS_URL . '/admin.php?xoopsorgnews=1'; + $menu[1]['title'] = _OXYGEN_NEWS; + $menu[1]['absolute'] = 1; + $menu[1]['icon'] = XOOPS_ADMINTHEME_URL . '/default/images/xoops.png'; + $menu[2]['link'] = XOOPS_URL . '/user.php?op=logout'; + $menu[2]['title'] = _LOGOUT; + $menu[2]['absolute'] = 1; + $menu[2]['icon'] = XOOPS_ADMINTHEME_URL . '/default/images/logout.png'; + $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php', 'text' => _CPHOME, 'menu' => $menu)); + + //add SYSTEM Menu items + include dirname(__FILE__) . '/menu.php'; + if (empty($xoopsModule) || 'system' == $xoopsModule->getVar('dirname', 'n')) { + $modpath = XOOPS_URL . '/admin.php'; + $modname = _OXYGEN_SYSOPTIONS; + $modid = 1; + $moddir = 'system'; + + $mod_options = $adminmenu; + foreach (array_keys($mod_options) as $item) { + $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? XOOPS_URL . '/modules/'.$moddir.'/' . $mod_options[$item]['link'] : $mod_options[$item]['link']; + $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : XOOPS_ADMINTHEME_URL . '/default/' . $mod_options[$item]['icon']; + unset($mod_options[$item]['icon_small']); + } + } else { + $moddir = $xoopsModule->getVar('dirname', 'n'); + $modpath = XOOPS_URL . '/modules/' . $moddir; + $modname = $xoopsModule->getVar('name'); + $modid = $xoopsModule->getVar('mid'); + + $mod_options = $xoopsModule->getAdminMenu(); + foreach (array_keys($mod_options) as $item) { + $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? XOOPS_URL . "/modules/{$moddir}/" . $mod_options[$item]['link'] : $mod_options[$item]['link']; + $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : XOOPS_URL . "/modules/{$moddir}/" . $mod_options[$item]['icon']; + } + } + + $tpl->assign('mod_options', $mod_options); + $tpl->assign('modpath', $modpath); + $tpl->assign('modname', $modname); + $tpl->assign('modid', $modid); + $tpl->assign('moddir', $moddir); + + // add MODULES Menu items + $module_handler =& xoops_gethandler('module'); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('hasadmin', 1)); + $criteria->add(new Criteria('isactive', 1)); + $criteria->setSort('mid'); + $mods = $module_handler->getObjects($criteria); + + $menu = array(); + $moduleperm_handler =& xoops_gethandler('groupperm'); + foreach ($mods as $mod) { + $rtn = array(); + $modOptions = array(); //add for sub menus + $sadmin = $moduleperm_handler->checkRight('module_admin', $mod->getVar('mid'), $xoopsUser->getGroups()); + if ($sadmin) { + $info = $mod->getInfo(); + if (!empty($info['adminindex'])) { + $rtn['link'] = XOOPS_URL . '/modules/'. $mod->getVar('dirname', 'n') . '/' . $info['adminindex']; + } else { + $rtn['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->getVar('mid'); + } + $rtn['title'] = $mod->name(); + $rtn['absolute'] = 1; + $rtn['url'] = XOOPS_URL . '/modules/'. $mod->getVar('dirname', 'n') . '/'; //add for sub menus + $modOptions = $mod->getAdminMenu(); //add for sub menus + $rtn['options'] = $modOptions; //add for sub menus + + if (isset($info['icon']) && $info['icon'] != '' ) { + $rtn['icon'] = XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . $info['icon']; + } + $menu[] = $rtn; + } + + } + $tpl->append('navitems', array('link' => XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin', + 'text' => _AM_SYSTEM_MODULES, 'dir' => $mod->getVar('dirname', 'n'), 'menu' => $menu)); + + // add preferences menu + $menu = array(); + + $OPT = array(); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=1', + 'title' => _OXYGEN_GENERAL, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=2', + 'title' => _OXYGEN_USERSETTINGS, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=3', + 'title' => _OXYGEN_METAFOOTER, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=4', + 'title' => _OXYGEN_CENSOR, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=5', + 'title' => _OXYGEN_SEARCH, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=6', + 'title' => _OXYGEN_MAILER, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=7', + 'title' => _OXYGEN_AUTHENTICATION, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=showmod&mod=1', + 'title' => _OXYGEN_MODULESETTINGS, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + + $menu[] = array( + 'link' => XOOPS_URL . '/modules/system/admin.php?fct=preferences', + 'title' => _OXYGEN_SYSOPTIONS, + 'absolute' => 1, + 'url' => XOOPS_URL . '/modules/system/', + 'options' => $OPT); + + foreach ($mods as $mod) { + $rtn = array(); + $sadmin = $moduleperm_handler->checkRight('module_admin', $mod->getVar('mid'), $xoopsUser->getGroups()); + if ($sadmin && ($mod->getVar('hasnotification') || is_array($mod->getInfo('config')) || is_array($mod->getInfo('comments')))) { + $rtn['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->getVar('mid'); + $rtn['title'] = $mod->name(); + $rtn['absolute'] = 1; + $rtn['icon'] = XOOPS_ADMINTHEME_URL . '/gui/oxygen/icons/prefs_small.png'; + $menu[] = $rtn; + } + } + $tpl->append('navitems', array('link' => XOOPS_URL . '/modules/system/admin.php?fct=preferences', 'text' => _OXYGEN_SITEPREF, 'dir' => $mod->getVar('dirname', 'n'), 'menu' => $menu)); + + //add OPTIONS/Links Menu Items + $menu = array(); + $menu[] = array( + 'link' => 'http://sourceforge.net/projects/xoops/', + 'title' => _OXYGEN_XOOPSPROJECT, + 'absolute' => 1); + $menu[] = array( + 'link' => 'http://xoops.org', + 'title' => _OXYGEN_WEBSITE, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/images/xoops.png'); + $menu[] = array( + 'link' => 'http://www.xoops.org/modules/repository/', + 'title' => _OXYGEN_XOOPSMODULES, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/images/xoops.png'); + $menu[] = array( + 'link' => 'http://www.xoops.org/modules/extgallery/', + 'title' => _OXYGEN_XOOPSTHEMES, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/images/tweb.png'); + + $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php','text' => _OXYGEN_INTERESTSITES, 'menu' => $menu)); + + //add OPTIONS/links for local support + if (file_exists($file = XOOPS_ADMINTHEME_PATH . '/default/language/' . $xoopsConfig['language'] . '/localsupport.php' )) { + $links = include XOOPS_ADMINTHEME_PATH . '/default/language/' . $xoopsConfig['language'] . '/localsupport.php'; + if ( count($links) > 0 ) { + $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php','text' => _OXYGEN_LOCALSUPPORT, 'menu' => $links)); + } + } + + if (is_object($xoopsModule) || !empty($_GET['xoopsorgnews'])) { + if (is_object($xoopsModule) && file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('adminmenu'))) { + include $file; + } + + return; + } + + foreach ($mods as $mod) { + + $sadmin = $moduleperm_handler->checkRight ( 'module_admin', $mod->getVar ( 'mid' ), $xoopsUser->getGroups () ); + if ($sadmin) { + $rtn = array (); + $info = $mod->getInfo (); + if (! empty ( $info ['adminindex'] )) { + $rtn ['link'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['adminindex']; + } else { + $rtn ['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->getVar ( 'mid' ); + } + $rtn ['title'] = $mod->getVar ('name'); + $rtn ['description'] = $mod->getInfo('description'); + $rtn ['absolute'] = 1; + if (isset ( $info ['icon_big'] )) { + $rtn ['icon'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['icon_big']; + } elseif (isset ( $info ['image'] )) { + $rtn ['icon'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['image']; + } + + $tpl->append ( 'modules', $rtn ); + } + + } + } +} |
From: <be...@us...> - 2015-02-17 00:26:36
|
Revision: 12988 http://sourceforge.net/p/xoops/svn/12988 Author: beckmi Date: 2015-02-17 00:26:34 +0000 (Tue, 17 Feb 2015) Log Message: ----------- Adding hack for SystemInfo link (pre-Alpha, proof of concept) Added Paths: ----------- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/readme.txt XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/systeminfo.jpg XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/class/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/class/XoopsSystemInfo.php XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/ZeroClipboard.swf XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/index.html XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.js XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.min.js XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/xoopssysteminfo.js XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php_original XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/xotpl/ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/xotpl/xo_accordion.html XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/xotpl/xo_accordion.html_original Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/readme.txt =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/readme.txt (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/readme.txt 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1,43 @@ +Many times, we ask the users asking for support, to provide us with the info about their installation. + +To make it easier, this hack, requested by Jim Garrett (aka Zyspec), adds a link in the Admin (see the picture systeminfo.jpg in this directory). When you click it, it will extract the info about your configuration (see an example below), and place it in your clipboard. You just need to paste it in the XOOPS Forums, when you ask for help. + +This is right now a proof of concept, looking for testers. + +EXAMPLE that would be copied to your clipboard: +============= + +XOOPS 2.5.8_Beta1 +PHP Version: 5.6.5 +mySQL Version: 5.6.22 +Server API: apache2handler +OS: WINNT +safe_mode: Off +register_globals: Off +register_globals: Off +allow_url_fopen: On +fsockopen: On +allow_call_time_pass_reference: Off +post_max_size: 8M +max_input_time: 120 +output_buffering: 4096 +max_execution_time: 60 +memory_limit: 512M +file_uploads: On +upload_max_filesize: 2M + +Active Modules: +--------------- +eXtCal 2.38 +News 1.71 +Publisher 1.02 +System 2.11 +User Profile 1.86 +Wfdownloads 3.23 + +Deactivated Modules: +--------------- +Forum 4.33 +My Links 3.11 +Private Messaging 1.1 +Protector 3.52 Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/systeminfo.jpg =================================================================== (Binary files differ) Index: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/systeminfo.jpg =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/systeminfo.jpg 2015-02-16 22:27:26 UTC (rev 12987) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/systeminfo.jpg 2015-02-17 00:26:34 UTC (rev 12988) Property changes on: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/docs_hack/systeminfo.jpg ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/class/XoopsSystemInfo.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/class/XoopsSystemInfo.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/class/XoopsSystemInfo.php 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1,152 @@ +<?php + +/* +if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { + include_once $GLOBALS['xoops']->path("/class/theme.php"); + $GLOBALS['xoTheme'] = new xos_opal_Theme(); +} + +$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js'); +$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.zclip.js'); +*/ + +/** + * Class XoopsSystemInfo + */ +class XoopsSystemInfo +{ + + function __construct() + { + } + + public function getSystemInfoValues() + { + //<{$lang_php_vesion}> +// $moduleVersion = $wfdownloads->getModule()->getInfo('version'); + $systemInformation = ''; + $systemInformation .= $GLOBALS['xoopsTpl']->get_template_vars('xoops_version') . '\n'; + $systemInformation .= _OXYGEN_VERSION_PHP . ': ' . PHP_VERSION . '\n'; + $systemInformation .= _OXYGEN_VERSION_MYSQL . ': ' . mysql_get_server_info() . ' \n'; + $systemInformation .= _OXYGEN_Server_API . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('lang_server_api') . ' \n'; + $systemInformation .= _OXYGEN_OS . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('lang_os_name') . ' \n'; + $systemInformation .= 'safe_mode' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('safe_mode') . ' \n'; + $systemInformation .= 'register_globals' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('register_globals') . ' \n'; + $systemInformation .= 'register_globals' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('magic_quotes_gpc') . ' \n'; + $systemInformation .= 'allow_url_fopen' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('allow_url_fopen') . ' \n'; + $systemInformation .= 'fsockopen' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('fsockopen') . ' \n'; + $systemInformation .= 'allow_call_time_pass_reference' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('allow_call_time_pass_reference') . ' \n'; + $systemInformation .= 'post_max_size' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('post_max_size') . ' \n'; + $systemInformation .= 'max_input_time' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('max_input_time') . ' \n'; + $systemInformation .= 'output_buffering' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('output_buffering') . ' \n'; + $systemInformation .= 'max_execution_time' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('max_execution_time') . ' \n'; + $systemInformation .= 'memory_limit' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('memory_limit') . ' \n'; + $systemInformation .= 'file_uploads' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('file_uploads') . ' \n'; + $systemInformation .= 'upload_max_filesize' . ': ' . $GLOBALS['xoopsTpl']->get_template_vars('upload_max_filesize') . ' \n'; +//$systemInformation = 'Module ' . $wfdownloads->getModule()->getInfo('name') . ' ' . $wfdownloads->getModule()->getInfo('version') . '\n'; + return $systemInformation; + } + + public function getSystemInfoLabels() + { + } + + public function getSystemInfoLabelsAndValues() + { + } + + public function assignSystemInfoValuesToSmarty($tpl) + { + //$tpl->assign('lang_xoops_version', XOOPS_VERSION); + $tpl->assign('lang_php_vesion', PHP_VERSION); + $tpl->assign('lang_mysql_version', mysql_get_server_info()); + $tpl->assign('lang_server_api', PHP_SAPI); + $tpl->assign('lang_os_name', PHP_OS); + $tpl->assign('safe_mode', ini_get('safe_mode') ? 'On' : 'Off'); + $tpl->assign('register_globals', ini_get('register_globals') ? 'On' : 'Off'); + $tpl->assign('magic_quotes_gpc', ini_get('magic_quotes_gpc') ? 'On' : 'Off'); + $tpl->assign('allow_url_fopen', ini_get('allow_url_fopen') ? 'On' : 'Off'); + $tpl->assign('fsockopen', function_exists('fsockopen') ? 'On' : 'Off'); + $tpl->assign('allow_call_time_pass_reference', ini_get('allow_call_time_pass_reference') ? 'On' : 'Off'); + $tpl->assign('post_max_size', ini_get('post_max_size')); + $tpl->assign('max_input_time', ini_get('max_input_time')); + $tpl->assign('output_buffering', ini_get('output_buffering')); + $tpl->assign('max_execution_time', ini_get('max_execution_time')); + $tpl->assign('memory_limit', ini_get('memory_limit')); + $tpl->assign('file_uploads', ini_get('file_uploads') ? 'On' : 'Off'); + $tpl->assign('upload_max_filesize', ini_get('upload_max_filesize')); + $tpl->assign('xoops_sitename', $GLOBALS['xoopsConfig']['sitename']); + } + + public function getActiveModules() + { + $module_handler = xoops_gethandler('module'); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('isactive', 1)); + $criteria->setSort('name'); + $criteria->setOrder('ASC'); + +// $tempModulesList = $module_handler->getList($criteria); + $tempModulesObj = $module_handler->getObjects($criteria); + +// sort($tempModulesList); + $activeModules = array(); + foreach ($tempModulesObj as $moduleObj) { + $activeModules[] = $moduleObj->getVar('name') . ' ' . round($moduleObj->getVar('version') / 100, 2); + } + + //sort the array + natcasesort($activeModules); + return $activeModules; + } + + public function getNonActiveModules() + { + $module_handler = xoops_gethandler('module'); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('isactive', 0)); + $criteria->setSort('name'); + $criteria->setOrder('ASC'); + +// $tempModulesList = $module_handler->getList($criteria); + $tempModulesObj = $module_handler->getObjects($criteria); + +// sort($tempModulesList); + $nonActiveModules = array(); + foreach ($tempModulesObj as $moduleObj) { + $nonActiveModules[] = $moduleObj->getVar('name') . ' ' . round($moduleObj->getVar('version') / 100, 2); + } + + //sort the array + natcasesort($nonActiveModules); + return $nonActiveModules; + } + + public function getActiveModulesList() + { + $activeModulesList = ''; + $activeModulesList .= ' \n'; + $activeModulesList .= 'Active Modules:' . ' \n'; + $activeModulesList .= '---------------' . ' \n'; + $activeModules = $this->getActiveModules(); + foreach ($activeModules as $key => $value) { + $activeModulesList .= $value . ' \n'; + } + return $activeModulesList; + } + + public function getNonActiveModulesList() + { + $nonActiveModulesList = ''; + $nonActiveModulesList .= ' \n'; + $nonActiveModulesList .= 'Deactivated Modules:' . ' \n'; + $nonActiveModulesList .= '---------------' . ' \n'; + $nonActiveModules = $this->getNonActiveModules(); + foreach ($nonActiveModules as $key => $value) { + $nonActiveModulesList .= $value . ' \n'; + } + return $nonActiveModulesList; + } + + +} Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/ZeroClipboard.swf =================================================================== (Binary files differ) Index: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/ZeroClipboard.swf =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/ZeroClipboard.swf 2015-02-16 22:27:26 UTC (rev 12987) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/ZeroClipboard.swf 2015-02-17 00:26:34 UTC (rev 12988) Property changes on: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/ZeroClipboard.swf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/index.html =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/index.html (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/index.html 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.js =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.js (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.js 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1,495 @@ +/* + * zClip :: jQuery ZeroClipboard v1.1.1 + * http://steamdev.com/zclip + * + * Copyright 2011, SteamDev + * Released under the MIT license. + * http://www.opensource.org/licenses/mit-license.php + * + * Date: Wed Jun 01, 2011 + */ + + +(function ($) { + + $.fn.zclip = function (params) { + + if (typeof params == "object" && !params.length) { + + var settings = $.extend({ + + path: 'ZeroClipboard.swf', + copy: null, + beforeCopy: null, + afterCopy: null, + clickAfter: true, + setHandCursor: true, + setCSSEffects: true + + }, params); + + + return this.each(function () { + + var o = $(this); + + if (o.is(':visible') && (typeof settings.copy == 'string' || $.isFunction(settings.copy))) { + + ZeroClipboard.setMoviePath(settings.path); + var clip = new ZeroClipboard.Client(); + + if($.isFunction(settings.copy)){ + o.bind('zClip_copy',settings.copy); + } + if($.isFunction(settings.beforeCopy)){ + o.bind('zClip_beforeCopy',settings.beforeCopy); + } + if($.isFunction(settings.afterCopy)){ + o.bind('zClip_afterCopy',settings.afterCopy); + } + + clip.setHandCursor(settings.setHandCursor); + clip.setCSSEffects(settings.setCSSEffects); + clip.addEventListener('mouseOver', function (client) { + o.trigger('mouseenter'); + }); + clip.addEventListener('mouseOut', function (client) { + o.trigger('mouseleave'); + }); + clip.addEventListener('mouseDown', function (client) { + + o.trigger('mousedown'); + + if(!$.isFunction(settings.copy)){ + clip.setText(settings.copy); + } else { + clip.setText(o.triggerHandler('zClip_copy')); + } + + if ($.isFunction(settings.beforeCopy)) { + o.trigger('zClip_beforeCopy'); + } + + }); + + clip.addEventListener('complete', function (client, text) { + + if ($.isFunction(settings.afterCopy)) { + + o.trigger('zClip_afterCopy'); + + } else { + if (text.length > 500) { + text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)"; + } + + o.removeClass('hover'); + alert("Copied text to clipboard:\n\n " + text); + } + + if (settings.clickAfter) { + o.trigger('click'); + } + + }); + + + clip.glue(o[0], o.parent()[0]); + + $(window).bind('load resize',function(){clip.reposition();}); + + + } + + }); + + } else if (typeof params == "string") { + + return this.each(function () { + + var o = $(this); + + params = params.toLowerCase(); + var zclipId = o.data('zclipId'); + var clipElm = $('#' + zclipId + '.zclip'); + + if (params == "remove") { + + clipElm.remove(); + o.removeClass('active hover'); + + } else if (params == "hide") { + + clipElm.hide(); + o.removeClass('active hover'); + + } else if (params == "show") { + + clipElm.show(); + + } + + }); + + } + + } + + + +})(jQuery); + + + + + + + +// ZeroClipboard +// Simple Set Clipboard System +// Author: Joseph Huckaby +var ZeroClipboard = { + + version: "1.0.7", + clients: {}, + // registered upload clients on page, indexed by id + moviePath: 'ZeroClipboard.swf', + // URL to movie + nextId: 1, + // ID of next movie + $: function (thingy) { + // simple DOM lookup utility function + if (typeof(thingy) == 'string') thingy = document.getElementById(thingy); + if (!thingy.addClass) { + // extend element with a few useful methods + thingy.hide = function () { + this.style.display = 'none'; + }; + thingy.show = function () { + this.style.display = ''; + }; + thingy.addClass = function (name) { + this.removeClass(name); + this.className += ' ' + name; + }; + thingy.removeClass = function (name) { + var classes = this.className.split(/\s+/); + var idx = -1; + for (var k = 0; k < classes.length; k++) { + if (classes[k] == name) { + idx = k; + k = classes.length; + } + } + if (idx > -1) { + classes.splice(idx, 1); + this.className = classes.join(' '); + } + return this; + }; + thingy.hasClass = function (name) { + return !!this.className.match(new RegExp("\\s*" + name + "\\s*")); + }; + } + return thingy; + }, + + setMoviePath: function (path) { + // set path to ZeroClipboard.swf + this.moviePath = path; + }, + + dispatch: function (id, eventName, args) { + // receive event from flash movie, send to client + var client = this.clients[id]; + if (client) { + client.receiveEvent(eventName, args); + } + }, + + register: function (id, client) { + // register new client to receive events + this.clients[id] = client; + }, + + getDOMObjectPosition: function (obj, stopObj) { + // get absolute coordinates for dom element + var info = { + left: 0, + top: 0, + width: obj.width ? obj.width : obj.offsetWidth, + height: obj.height ? obj.height : obj.offsetHeight + }; + + if (obj && (obj != stopObj)) { + info.left += obj.offsetLeft; + info.top += obj.offsetTop; + } + + return info; + }, + + Client: function (elem) { + // constructor for new simple upload client + this.handlers = {}; + + // unique ID + this.id = ZeroClipboard.nextId++; + this.movieId = 'ZeroClipboardMovie_' + this.id; + + // register client with singleton to receive flash events + ZeroClipboard.register(this.id, this); + + // create movie + if (elem) this.glue(elem); + } +}; + +ZeroClipboard.Client.prototype = { + + id: 0, + // unique ID for us + ready: false, + // whether movie is ready to receive events or not + movie: null, + // reference to movie object + clipText: '', + // text to copy to clipboard + handCursorEnabled: true, + // whether to show hand cursor, or default pointer cursor + cssEffects: true, + // enable CSS mouse effects on dom container + handlers: null, + // user event handlers + glue: function (elem, appendElem, stylesToAdd) { + // glue to DOM element + // elem can be ID or actual DOM element object + this.domElement = ZeroClipboard.$(elem); + + // float just above object, or zIndex 99 if dom element isn't set + var zIndex = 99; + if (this.domElement.style.zIndex) { + zIndex = parseInt(this.domElement.style.zIndex, 10) + 1; + } + + if (typeof(appendElem) == 'string') { + appendElem = ZeroClipboard.$(appendElem); + } else if (typeof(appendElem) == 'undefined') { + appendElem = document.getElementsByTagName('body')[0]; + } + + // find X/Y position of domElement + var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem); + + // create floating DIV above element + this.div = document.createElement('div'); + this.div.className = "zclip"; + this.div.id = "zclip-" + this.movieId; + $(this.domElement).data('zclipId', 'zclip-' + this.movieId); + var style = this.div.style; + style.position = 'absolute'; + style.left = '' + box.left + 'px'; + style.top = '' + box.top + 'px'; + style.width = '' + box.width + 'px'; + style.height = '' + box.height + 'px'; + style.zIndex = zIndex; + + if (typeof(stylesToAdd) == 'object') { + for (addedStyle in stylesToAdd) { + style[addedStyle] = stylesToAdd[addedStyle]; + } + } + + // style.backgroundColor = '#f00'; // debug + appendElem.appendChild(this.div); + + this.div.innerHTML = this.getHTML(box.width, box.height); + }, + + getHTML: function (width, height) { + // return HTML for movie + var html = ''; + var flashvars = 'id=' + this.id + '&width=' + width + '&height=' + height; + + if (navigator.userAgent.match(/MSIE/)) { + // IE gets an OBJECT tag + var protocol = location.href.match(/^https/i) ? 'https://' : 'http://'; + html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + protocol + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '" id="' + this.movieId + '" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + ZeroClipboard.moviePath + '" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="' + flashvars + '"/><param name="wmode" value="transparent"/></object>'; + } else { + // all other browsers get an EMBED tag + html += '<embed id="' + this.movieId + '" src="' + ZeroClipboard.moviePath + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="' + this.movieId + '" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + flashvars + '" wmode="transparent" />'; + } + return html; + }, + + hide: function () { + // temporarily hide floater offscreen + if (this.div) { + this.div.style.left = '-2000px'; + } + }, + + show: function () { + // show ourselves after a call to hide() + this.reposition(); + }, + + destroy: function () { + // destroy control and floater + if (this.domElement && this.div) { + this.hide(); + this.div.innerHTML = ''; + + var body = document.getElementsByTagName('body')[0]; + try { + body.removeChild(this.div); + } catch (e) {; + } + + this.domElement = null; + this.div = null; + } + }, + + reposition: function (elem) { + // reposition our floating div, optionally to new container + // warning: container CANNOT change size, only position + if (elem) { + this.domElement = ZeroClipboard.$(elem); + if (!this.domElement) this.hide(); + } + + if (this.domElement && this.div) { + var box = ZeroClipboard.getDOMObjectPosition(this.domElement); + var style = this.div.style; + style.left = '' + box.left + 'px'; + style.top = '' + box.top + 'px'; + } + }, + + setText: function (newText) { + // set text to be copied to clipboard + this.clipText = newText; + if (this.ready) { + this.movie.setText(newText); + } + }, + + addEventListener: function (eventName, func) { + // add user event listener for event + // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel + eventName = eventName.toString().toLowerCase().replace(/^on/, ''); + if (!this.handlers[eventName]) { + this.handlers[eventName] = []; + } + this.handlers[eventName].push(func); + }, + + setHandCursor: function (enabled) { + // enable hand cursor (true), or default arrow cursor (false) + this.handCursorEnabled = enabled; + if (this.ready) { + this.movie.setHandCursor(enabled); + } + }, + + setCSSEffects: function (enabled) { + // enable or disable CSS effects on DOM container + this.cssEffects = !! enabled; + }, + + receiveEvent: function (eventName, args) { + // receive event from flash + eventName = eventName.toString().toLowerCase().replace(/^on/, ''); + + // special behavior for certain events + switch (eventName) { + case 'load': + // movie claims it is ready, but in IE this isn't always the case... + // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function + this.movie = document.getElementById(this.movieId); + if (!this.movie) { + var self = this; + setTimeout(function () { + self.receiveEvent('load', null); + }, 1); + return; + } + + // firefox on pc needs a "kick" in order to set these in certain cases + if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { + var self = this; + setTimeout(function () { + self.receiveEvent('load', null); + }, 100); + this.ready = true; + return; + } + + this.ready = true; + try { + this.movie.setText(this.clipText); + } catch (e) {} + try { + this.movie.setHandCursor(this.handCursorEnabled); + } catch (e) {} + break; + + case 'mouseover': + if (this.domElement && this.cssEffects) { + this.domElement.addClass('hover'); + if (this.recoverActive) { + this.domElement.addClass('active'); + } + + + } + + + break; + + case 'mouseout': + if (this.domElement && this.cssEffects) { + this.recoverActive = false; + if (this.domElement.hasClass('active')) { + this.domElement.removeClass('active'); + this.recoverActive = true; + } + this.domElement.removeClass('hover'); + + } + break; + + case 'mousedown': + if (this.domElement && this.cssEffects) { + this.domElement.addClass('active'); + } + break; + + case 'mouseup': + if (this.domElement && this.cssEffects) { + this.domElement.removeClass('active'); + this.recoverActive = false; + } + break; + } // switch eventName + if (this.handlers[eventName]) { + for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { + var func = this.handlers[eventName][idx]; + + if (typeof(func) == 'function') { + // actual function reference + func(this, args); + } else if ((typeof(func) == 'object') && (func.length == 2)) { + // PHP style object + method, i.e. [myObject, 'myMethod'] + func[0][func[1]](this, args); + } else if (typeof(func) == 'string') { + // name of function + window[func](this, args); + } + } // foreach event handler defined + } // user defined handler for event + } + +}; + Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.min.js =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.min.js (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/jquery.zclip.min.js 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1,12 @@ +/* + * zClip :: jQuery ZeroClipboard v1.1.1 + * http://steamdev.com/zclip + * + * Copyright 2011, SteamDev + * Released under the MIT license. + * http://www.opensource.org/licenses/mit-license.php + * + * Date: Wed Jun 01, 2011 + */ + +(function(a){a.fn.zclip=function(c){if(typeof c=="object"&&!c.length){var b=a.extend({path:"ZeroClipboard.swf",copy:null,beforeCopy:null,afterCopy:null,clickAfter:true,setHandCursor:true,setCSSEffects:true},c);return this.each(function(){var e=a(this);if(e.is(":visible")&&(typeof b.copy=="string"||a.isFunction(b.copy))){ZeroClipboard.setMoviePath(b.path);var d=new ZeroClipboard.Client();if(a.isFunction(b.copy)){e.bind("zClip_copy",b.copy)}if(a.isFunction(b.beforeCopy)){e.bind("zClip_beforeCopy",b.beforeCopy)}if(a.isFunction(b.afterCopy)){e.bind("zClip_afterCopy",b.afterCopy)}d.setHandCursor(b.setHandCursor);d.setCSSEffects(b.setCSSEffects);d.addEventListener("mouseOver",function(f){e.trigger("mouseenter")});d.addEventListener("mouseOut",function(f){e.trigger("mouseleave")});d.addEventListener("mouseDown",function(f){e.trigger("mousedown");if(!a.isFunction(b.copy)){d.setText(b.copy)}else{d.setText(e.triggerHandler("zClip_copy"))}if(a.isFunction(b.beforeCopy)){e.trigger("zClip_beforeCopy")}});d.addEventListener("complete",function(f,g){if(a.isFunction(b.afterCopy)){e.trigger("zClip_afterCopy")}else{if(g.length>500){g=g.substr(0,500)+"...\n\n("+(g.length-500)+" characters not shown)"}e.removeClass("hover");alert("Copied text to clipboard:\n\n "+g)}if(b.clickAfter){e.trigger("click")}});d.glue(e[0],e.parent()[0]);a(window).bind("load resize",function(){d.reposition()})}})}else{if(typeof c=="string"){return this.each(function(){var f=a(this);c=c.toLowerCase();var e=f.data("zclipId");var d=a("#"+e+".zclip");if(c=="remove"){d.remove();f.removeClass("active hover")}else{if(c=="hide"){d.hide();f.removeClass("active hover")}else{if(c=="show"){d.show()}}}})}}}})(jQuery);var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}if(!a.addClass){a.hide=function(){this.style.display="none"};a.show=function(){this.style.display=""};a.addClass=function(b){this.removeClass(b);this.className+=" "+b};a.removeClass=function(d){var e=this.className.split(/\s+/);var b=-1;for(var c=0;c<e.length;c++){if(e[c]==d){b=c;c=e.length}}if(b>-1){e.splice(b,1);this.className=e.join(" ")}return this};a.hasClass=function(b){return !!this.className.match(new RegExp("\\s*"+b+"\\s*"))}}return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveEvent(b,c)}},register:function(b,a){this.clients[b]=a},getDOMObjectPosition:function(c,a){var b={left:0,top:0,width:c.width?c.width:c.offsetWidth,height:c.height?c.height:c.offsetHeight};if(c&&(c!=a)){b.left+=c.offsetLeft;b.top+=c.offsetTop}return b},Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);if(a){this.glue(a)}}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(d,b,e){this.domElement=ZeroClipboard.$(d);var f=99;if(this.domElement.style.zIndex){f=parseInt(this.domElement.style.zIndex,10)+1}if(typeof(b)=="string"){b=ZeroClipboard.$(b)}else{if(typeof(b)=="undefined"){b=document.getElementsByTagName("body")[0]}}var c=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div");this.div.className="zclip";this.div.id="zclip-"+this.movieId;$(this.domElement).data("zclipId","zclip-"+this.movieId);var a=this.div.style;a.position="absolute";a.left=""+c.left+"px";a.top=""+c.top+"px";a.width=""+c.width+"px";a.height=""+c.height+"px";a.zIndex=f;if(typeof(e)=="object"){for(addedStyle in e){a[addedStyle]=e[addedStyle]}}b.appendChild(this.div);this.div.innerHTML=this.getHTML(c.width,c.height)},getHTML:function(d,a){var c="";var b="id="+this.id+"&width="+d+"&height="+a;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+d+'" height="'+a+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+b+'"/><param name="wmode" value="transparent"/></object>'}else{c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+d+'" height="'+a+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+b+'" wmode="transparent" />'}return c},hide:function(){if(this.div){this.div.style.left="-2000px"}},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.domElement=null;this.div=null}},reposition:function(c){if(c){this.domElement=ZeroClipboard.$(c);if(!this.domElement){this.hide()}}if(this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement);var a=this.div.style;a.left=""+b.left+"px";a.top=""+b.top+"px"}},setText:function(a){this.clipText=a;if(this.ready){this.movie.setText(a)}},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;if(this.ready){this.movie.setHandCursor(a)}},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(d,f){d=d.toString().toLowerCase().replace(/^on/,"");switch(d){case"load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=true;return}this.ready=true;try{this.movie.setText(this.clipText)}catch(h){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(h){}break;case"mouseover":if(this.domElement&&this.cssEffects){this.domElement.addClass("hover");if(this.recoverActive){this.domElement.addClass("active")}}break;case"mouseout":if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass("active")){this.domElement.removeClass("active");this.recoverActive=true}this.domElement.removeClass("hover")}break;case"mousedown":if(this.domElement&&this.cssEffects){this.domElement.addClass("active")}break;case"mouseup":if(this.domElement&&this.cssEffects){this.domElement.removeClass("active");this.recoverActive=false}break}if(this.handlers[d]){for(var b=0,a=this.handlers[d].length;b<a;b++){var g=this.handlers[d][b];if(typeof(g)=="function"){g(this,f)}else{if((typeof(g)=="object")&&(g.length==2)){g[0][g[1]](this,f)}else{if(typeof(g)=="string"){window[g](this,f)}}}}}}}; \ No newline at end of file Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/xoopssysteminfo.js =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/xoopssysteminfo.js (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/js/systeminfo/xoopssysteminfo.js 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1,23 @@ +/** + * Created by mamba on 2015-02-16. + * source: http://www.steamdev.com/zclip + */ +$(document).ready(function () { + + $("a#copy-callbacks").zclip({ + path: 'modules/system/js/systeminfo/ZeroClipboard.swf', +// copy:$('#callback-paragraph').text(), + + copy: systemInformation, + + beforeCopy: function () { + $('#callback-paragraph').css('background', 'yellow'); + $(this).css('color', 'orange'); + }, + afterCopy: function () { + $('#callback-paragraph').css('background', 'green'); + $(this).css('color', 'purple'); + $(this).next('.check').show(); + } + }); +}); Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1,339 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +xoops_load('gui', 'system'); + +/* + * Xoops Cpanel default GUI class + * + * @copyright (c) 2000-2014 XOOPS Project (www.xoops.org) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package system + * @usbpackage GUI + * @since 2.4 + * @author Mamba XXXXXXXXXXXXXXXXXXX + * @author Mojtabajml <jam...@gm...> + * @author Voltan <djv...@gm...> + * @author BitC3R0 <Bi...@gm...> + * @author trabis <lus...@gm...> + * @version 1.2 + * @version $Id: default.php 12852 2014-11-17 03:34:31Z rgriffith $ + */ + +/** + * Class XoopsGuiDefault + */ + +class XoopsGuiDefault extends XoopsSystemGui +{ + + /** + * + */ + function __construct() + { + } + + function XoopsGuiDefault() + { + $this->__construct(); + } + + /** + * @return bool + */ + function validate() + { + return true; + } + + function header() + { + parent::header(); + + global $xoopsConfig, $xoopsUser, $xoopsModule, $xoTheme, $xoopsTpl; + $tpl =& $this->template; + + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/styleswitch.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/formenu.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/menu.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tooltip.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tabs.jquery.tools.min.js'); + + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/style.css' ); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/dark.css', array('title' => 'dark', 'media' => 'screen')); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/silver.css', array('title' => 'silver', 'media' => 'screen')); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/orange.css', array('title' => 'orange', 'media' => 'screen')); + + $tpl->assign('lang_cp', _CPHOME); + //start system overview + +//mamba ------------- start ----------------- + + include_once __DIR__ . '/../../class/XoopsSystemInfo.php'; + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/../js/systeminfo/jquery.zclip.min.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/../js/systeminfo/xoopssysteminfo.js'); + + $systemInfo = new XoopsSystemInfo; + $systemInfo->assignSystemInfoValuesToSmarty($tpl); + $systemInformation = $systemInfo->getSystemInfoValues(); + $systemInformation .= $systemInfo->getActiveModulesList(); + $systemInformation .= $systemInfo->getNonActiveModulesList(); + ?> + <script type="text/javascript"> + var systemInformation = "<?php echo $systemInformation ?>"; + </script> + <?php + + + //$tpl->assign('lang_xoops_version', XOOPS_VERSION); + +// $tpl->assign('lang_php_vesion', PHP_VERSION); +// $tpl->assign('lang_mysql_version', mysql_get_server_info()); +// $tpl->assign('lang_server_api', PHP_SAPI); +// $tpl->assign('lang_os_name', PHP_OS); +// $tpl->assign('safe_mode', ini_get( 'safe_mode' ) ? 'On' : 'Off'); +// $tpl->assign('register_globals', ini_get( 'register_globals' ) ? 'On' : 'Off'); +// $tpl->assign('magic_quotes_gpc', ini_get( 'magic_quotes_gpc' ) ? 'On' : 'Off'); +// $tpl->assign('allow_url_fopen', ini_get( 'allow_url_fopen' ) ? 'On' : 'Off'); +// $tpl->assign('fsockopen', function_exists( 'fsockopen' ) ? 'On' : 'Off'); +// $tpl->assign('allow_call_time_pass_reference', ini_get( 'allow_call_time_pass_reference' ) ? 'On' : 'Off'); +// $tpl->assign('post_max_size', ini_get( 'post_max_size' )); +// $tpl->assign('max_input_time', ini_get( 'max_input_time' )); +// $tpl->assign('output_buffering', ini_get( 'output_buffering' )); +// $tpl->assign('max_execution_time', ini_get( 'max_execution_time' )); +// $tpl->assign('memory_limit', ini_get( 'memory_limit' )); +// $tpl->assign('file_uploads', ini_get( 'file_uploads' ) ? 'On' : 'Off'); +// $tpl->assign('upload_max_filesize', ini_get( 'upload_max_filesize' )); +// $tpl->assign('xoops_sitename', $xoopsConfig['sitename']); + +//mamba ------------- end ----------------- + + + // ADD MENU ***************************************** + + //Add CONTROL PANEL Menu items + $menu = array(); + $menu[0]['link'] = XOOPS_URL; + $menu[0]['title'] = _YOURHOME; + $menu[0]['absolute'] = 1; + $menu[1]['link'] = XOOPS_URL . '/admin.php?xoopsorgnews=1'; + $menu[1]['title'] = _OXYGEN_NEWS; + $menu[1]['absolute'] = 1; + $menu[1]['icon'] = XOOPS_ADMINTHEME_URL . '/default/images/xoops.png'; + $menu[2]['link'] = XOOPS_URL . '/user.php?op=logout'; + $menu[2]['title'] = _LOGOUT; + $menu[2]['absolute'] = 1; + $menu[2]['icon'] = XOOPS_ADMINTHEME_URL . '/default/images/logout.png'; + $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php', 'text' => _CPHOME, 'menu' => $menu)); + + //add SYSTEM Menu items + include __DIR__ . '/menu.php'; + if (empty($xoopsModule) || 'system' == $xoopsModule->getVar('dirname', 'n')) { + $modpath = XOOPS_URL . '/admin.php'; + $modname = _OXYGEN_SYSOPTIONS; + $modid = 1; + $moddir = 'system'; + + $mod_options = $adminmenu; + foreach (array_keys($mod_options) as $item) { + $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? XOOPS_URL . '/modules/'.$moddir.'/' . $mod_options[$item]['link'] : $mod_options[$item]['link']; + $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : XOOPS_ADMINTHEME_URL . '/default/' . $mod_options[$item]['icon']; + unset($mod_options[$item]['icon_small']); + } + } else { + $moddir = $xoopsModule->getVar('dirname', 'n'); + $modpath = XOOPS_URL . '/modules/' . $moddir; + $modname = $xoopsModule->getVar('name'); + $modid = $xoopsModule->getVar('mid'); + + $mod_options = $xoopsModule->getAdminMenu(); + foreach (array_keys($mod_options) as $item) { + $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? XOOPS_URL . "/modules/{$moddir}/" . $mod_options[$item]['link'] : $mod_options[$item]['link']; + $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : XOOPS_URL . "/modules/{$moddir}/" . $mod_options[$item]['icon']; + } + } + + $tpl->assign('mod_options', $mod_options); + $tpl->assign('modpath', $modpath); + $tpl->assign('modname', $modname); + $tpl->assign('modid', $modid); + $tpl->assign('moddir', $moddir); + + // add MODULES Menu items + $module_handler =& xoops_gethandler('module'); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('hasadmin', 1)); + $criteria->add(new Criteria('isactive', 1)); + $criteria->setSort('mid'); + $mods = $module_handler->getObjects($criteria); + + $menu = array(); + $moduleperm_handler =& xoops_gethandler('groupperm'); + foreach ($mods as $mod) { + $rtn = array(); + $modOptions = array(); //add for sub menus + $sadmin = $moduleperm_handler->checkRight('module_admin', $mod->getVar('mid'), $xoopsUser->getGroups()); + if ($sadmin) { + $info = $mod->getInfo(); + if (!empty($info['adminindex'])) { + $rtn['link'] = XOOPS_URL . '/modules/'. $mod->getVar('dirname', 'n') . '/' . $info['adminindex']; + } else { + $rtn['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->getVar('mid'); + } + $rtn['title'] = htmlspecialchars($mod->name(), ENT_QUOTES); + $rtn['absolute'] = 1; + $rtn['url'] = XOOPS_URL . '/modules/'. $mod->getVar('dirname', 'n') . '/'; //add for sub menus + $modOptions = $mod->getAdminMenu(); //add for sub menus + $rtn['options'] = $modOptions; //add for sub menus + + if (isset($info['icon']) && $info['icon'] != '' ) { + $rtn['icon'] = XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . $info['icon']; + } + $menu[] = $rtn; + } + + } + $tpl->append('navitems', array('link' => XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin', + 'text' => _AM_SYSTEM_MODULES, 'dir' => $mod->getVar('dirname', 'n'), 'menu' => $menu)); + + // add preferences menu + $menu = array(); + + $OPT = array(); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=1', + 'title' => _OXYGEN_GENERAL, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=2', + 'title' => _OXYGEN_USERSETTINGS, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=3', + 'title' => _OXYGEN_METAFOOTER, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=4', + 'title' => _OXYGEN_CENSOR, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=5', + 'title' => _OXYGEN_SEARCH, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=6', + 'title' => _OXYGEN_MAILER, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=show&confcat_id=7', + 'title' => _OXYGEN_AUTHENTICATION, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + $OPT[] = array( + 'link' => 'admin.php?fct=preferences&op=showmod&mod=1', + 'title' => _OXYGEN_MODULESETTINGS, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png'); + + $menu[] = array( + 'link' => XOOPS_URL . '/modules/system/admin.php?fct=preferences', + 'title' => _OXYGEN_SYSOPTIONS, + 'absolute' => 1, + 'url' => XOOPS_URL . '/modules/system/', + 'options' => $OPT); + + foreach ($mods as $mod) { + $rtn = array(); + $sadmin = $moduleperm_handler->checkRight('module_admin', $mod->getVar('mid'), $xoopsUser->getGroups()); + if ($sadmin && ($mod->getVar('hasnotification') || is_array($mod->getInfo('config')) || is_array($mod->getInfo('comments')))) { + $rtn['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->getVar('mid'); + $rtn['title'] = htmlspecialchars($mod->name(), ENT_QUOTES); + $rtn['absolute'] = 1; + $rtn['icon'] = XOOPS_ADMINTHEME_URL . '/gui/oxygen/icons/prefs_small.png'; + $menu[] = $rtn; + } + } + $tpl->append('navitems', array('link' => XOOPS_URL . '/modules/system/admin.php?fct=preferences', 'text' => _OXYGEN_SITEPREF, 'dir' => $mod->getVar('dirname', 'n'), 'menu' => $menu)); + + //add OPTIONS/Links Menu Items + $menu = array(); + $menu[] = array( + 'link' => 'http://sourceforge.net/projects/xoops/', + 'title' => _OXYGEN_XOOPSPROJECT, + 'absolute' => 1); + $menu[] = array( + 'link' => 'http://xoops.org', + 'title' => _OXYGEN_WEBSITE, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/images/xoops.png'); + $menu[] = array( + 'link' => 'http://www.xoops.org/modules/repository/', + 'title' => _OXYGEN_XOOPSMODULES, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/images/xoops.png'); + $menu[] = array( + 'link' => 'http://www.xoops.org/modules/extgallery/', + 'title' => _OXYGEN_XOOPSTHEMES, + 'absolute' => 1, + 'icon' => XOOPS_ADMINTHEME_URL . '/default/images/tweb.png'); + + $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php','text' => _OXYGEN_INTERESTSITES, 'menu' => $menu)); + + //add OPTIONS/links for local support + if (file_exists($file = XOOPS_ADMINTHEME_PATH . '/default/language/' . $xoopsConfig['language'] . '/localsupport.php' )) { + $links = include XOOPS_ADMINTHEME_PATH . '/default/language/' . $xoopsConfig['language'] . '/localsupport.php'; + if ( count($links) > 0 ) { + $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php','text' => _OXYGEN_LOCALSUPPORT, 'menu' => $links)); + } + } + + if (is_object($xoopsModule) || !empty($_GET['xoopsorgnews'])) { + if (is_object($xoopsModule) && file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('adminmenu'))) { + include $file; + } + + return; + } + + foreach ($mods as $mod) { + + $sadmin = $moduleperm_handler->checkRight ( 'module_admin', $mod->getVar ( 'mid' ), $xoopsUser->getGroups () ); + if ($sadmin) { + $rtn = array (); + $info = $mod->getInfo (); + if (! empty ( $info ['adminindex'] )) { + $rtn ['link'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['adminindex']; + } else { + $rtn ['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->getVar ( 'mid' ); + } + $rtn ['title'] = htmlspecialchars($mod->getVar ('name'), ENT_QUOTES); + $rtn ['description'] = $mod->getInfo('description'); + $rtn ['absolute'] = 1; + if (isset ( $info ['icon_big'] )) { + $rtn ['icon'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['icon_big']; + } elseif (isset ( $info ['image'] )) { + $rtn ['icon'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['image']; + } + + $tpl->append ( 'modules', $rtn ); + } + + } + } +} Added: XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php_original =================================================================== --- XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php_original (rev 0) +++ XoopsCore/branches/2.5.x/2.5.8_hack_systeminfo/htdocs/modules/system/themes/default/default.php_original 2015-02-17 00:26:34 UTC (rev 12988) @@ -0,0 +1,315 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +xoops_load('gui', 'system'); + +/* + * Xoops Cpanel default GUI class + * + * @copyright (c) 2000-2014 XOOPS Project (www.xoops.org) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package system + * @usbpackage GUI + * @since 2.4 + * @author Mamba XXXXXXXXXXXXXXXXXXX + * @author Mojtabajml <jam...@gm...> + * @author Voltan <djv...@gm...> + * @author BitC3R0 <Bi...@gm...> + * @author trabis <lus...@gm...> + * @version 1.2 + * @version $Id: default.php 12852 2014-11-17 03:34:31Z rgriffith $ + */ + +/** + * Class XoopsGuiDefault + */ +class XoopsGuiDefault extends XoopsSystemGui +{ + + /** + * + */ + function __construct() + { + } + + function XoopsGuiDefault() + { + $this->__construct(); + } + + /** + * @return bool + */ + function validate() + { + return true; + } + + function header() + { + parent::header(); + + global $xoopsConfig, $xoopsUser, $xoopsModule, $xoTheme, $xoopsTpl; + $tpl =& $this->template; + + $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/styleswitch.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/formenu.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/menu.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tooltip.js'); + $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tabs.jquery.tools.min.js'); + + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/style.css' ); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/dark.css', array('title' => 'dark', 'media' => 'screen')); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/silver.css', array('title' => 'silver', 'media' => 'screen')); + $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/orange.css', array('title' => 'orange', 'media' => 'screen')); + + $tpl->assign('lang_cp', _CPHOME); + //start system overview + //$tpl->assign('lang_xoops_version', XOOPS_VERSION); + $tpl->assign('lang_php_vesion', PHP_VERSION); + $tpl->assign('lang_mysql_version', mysql_get_server_info()); + $tpl->assign('lang_server_api', PHP_SAPI); + $tpl->assign('lang_os_name', PHP_OS); + $tpl->assign('safe_mode', ini_get( 'safe_mode' ) ? 'On' : 'Off'); + $tpl->assign('register_globals', ini_get( 'register_globals' ) ? 'On' : 'Off'); + $tpl->assign('magic_quotes_gpc', ini_get( 'magic_quotes_gpc' ) ? 'On' : 'Off'); + $tpl->assign('allow_url_fopen', ini_get( 'allow_url_fopen' ) ? 'On' : 'Off'); + $tpl->assign('fsockopen', function_exists( 'fsockopen' ) ? 'On' : 'Off'); + $tpl->assign('allow_call_time_pass_reference', ini_get( 'allow_call_time_pass_reference' ) ? ... [truncated message content] |