You can subscribe to this list here.
2012 |
Jan
|
Feb
(214) |
Mar
(139) |
Apr
(198) |
May
(187) |
Jun
(151) |
Jul
(210) |
Aug
(169) |
Sep
(58) |
Oct
(53) |
Nov
(54) |
Dec
(301) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2013 |
Jan
(348) |
Feb
(178) |
Mar
(219) |
Apr
(154) |
May
(117) |
Jun
(194) |
Jul
(61) |
Aug
(132) |
Sep
(121) |
Oct
(110) |
Nov
(11) |
Dec
(18) |
2014 |
Jan
(34) |
Feb
(50) |
Mar
(82) |
Apr
(98) |
May
(39) |
Jun
(111) |
Jul
(67) |
Aug
(36) |
Sep
(33) |
Oct
(26) |
Nov
(53) |
Dec
(44) |
2015 |
Jan
(29) |
Feb
(47) |
Mar
(25) |
Apr
(19) |
May
(23) |
Jun
(20) |
Jul
(49) |
Aug
(7) |
Sep
(10) |
Oct
(10) |
Nov
(4) |
Dec
(25) |
2016 |
Jan
(8) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(3) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(7) |
Dec
(5) |
2017 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
(15) |
Jun
|
Jul
(18) |
Aug
(24) |
Sep
|
Oct
(14) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
(22) |
Mar
|
Apr
(11) |
May
(1) |
Jun
(17) |
Jul
(2) |
Aug
(2) |
Sep
|
Oct
(6) |
Nov
(5) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <tr...@us...> - 2012-12-01 22:36:48
|
Revision: 10297 http://sourceforge.net/p/xoops/svn/10297 Author: trabis Date: 2012-12-01 22:36:45 +0000 (Sat, 01 Dec 2012) Log Message: ----------- publisher - updating permissions and category for performance Modified Paths: -------------- XoopsModules/publisher/trunk/publisher/admin/category.php XoopsModules/publisher/trunk/publisher/archive.php XoopsModules/publisher/trunk/publisher/category.php XoopsModules/publisher/trunk/publisher/class/category.php XoopsModules/publisher/trunk/publisher/class/item.php XoopsModules/publisher/trunk/publisher/class/permission.php XoopsModules/publisher/trunk/publisher/include/common.php Modified: XoopsModules/publisher/trunk/publisher/admin/category.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/category.php 2012-12-01 15:55:26 UTC (rev 10296) +++ XoopsModules/publisher/trunk/publisher/admin/category.php 2012-12-01 22:36:45 UTC (rev 10297) @@ -109,25 +109,8 @@ $categoryObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 1); // Groups and permissions - if (isset($_POST['groups_read'])) { - $categoryObj->setGroups_read($_POST['groups_read']); - } else { - $categoryObj->setGroups_read(); - } $grpread = isset($_POST['groups_read']) ? $_POST['groups_read'] : array(); - - if (isset($_POST['groups_submit'])) { - $categoryObj->setGroups_submit($_POST['groups_submit']); - } else { - $categoryObj->setGroups_submit(); - } $grpsubmit = isset($_POST['groups_submit']) ? $_POST['groups_submit'] : array(); - - if (isset($_POST['groups_moderation'])) { - $categoryObj->setGroups_moderation($_POST['groups_moderation']); - } else { - $categoryObj->setGroups_moderation(); - } $grpmoderation = isset($_POST['groups_moderation']) ? $_POST['groups_moderation'] : array(); @@ -167,9 +150,9 @@ exit; } // TODO : put this function in the category class - publisher_saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); - publisher_saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); - publisher_saveCategoryPermissions($categoryObj->getGroups_moderation(), $categoryObj->categoryid(), 'category_moderation'); + publisher_saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + publisher_saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + publisher_saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); //Added by fx2024 @@ -180,18 +163,15 @@ $categoryObj = $publisher->getHandler('category')->create(); $categoryObj->setVar('name', $_POST['scname'][$i]); $categoryObj->setVar('parentid', $parentCat); - $categoryObj->setGroups_read($grpread); - $categoryObj->setGroups_submit($grpsubmit); - $categoryObj->setGroups_moderation($grpmoderation); if (!$categoryObj->store()) { redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); exit; } // TODO : put this function in the category class - publisher_saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); - publisher_saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); - publisher_saveCategoryPermissions($categoryObj->getGroups_moderation(), $categoryObj->categoryid(), 'category_moderation'); + publisher_saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + publisher_saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + publisher_saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); } } //end of fx2024 code @@ -209,7 +189,6 @@ $categoryObj->setVar('name', $_POST['name']); $categoryObj->setVar('description', $_POST['description']); $categoryObj->setVar('weight', $_POST['weight']); - $categoryObj->setGroups_read(isset($_POST['groups_read']) ? $_POST['groups_read'] : array()); if (isset($parentCat)) { $categoryObj->setVar('parentid', $parentCat); } Modified: XoopsModules/publisher/trunk/publisher/archive.php =================================================================== --- XoopsModules/publisher/trunk/publisher/archive.php 2012-12-01 15:55:26 UTC (rev 10296) +++ XoopsModules/publisher/trunk/publisher/archive.php 2012-12-01 22:36:45 UTC (rev 10297) @@ -70,6 +70,7 @@ //Get all articles dates as an array to save memory $items = $publisher->getHandler('item')->getAll($criteria, array('datesub'), false); $itemsCount = count($items); + if (!($itemsCount > 0)) { redirect_header(XOOPS_URL, 2, _MD_PUBLISHER_NO_TOP_PERMISSIONS); exit; @@ -144,6 +145,7 @@ $criteria->add($critdatesub); $criteria->setSort('o.datesub'); $criteria->setOrder('DESC'); + $criteria->setLimit(3000); $storyarray = $itemhandler->getByLink($criteria); //Query Efficiency? $count = count($storyarray); Modified: XoopsModules/publisher/trunk/publisher/category.php =================================================================== --- XoopsModules/publisher/trunk/publisher/category.php 2012-12-01 15:55:26 UTC (rev 10296) +++ XoopsModules/publisher/trunk/publisher/category.php 2012-12-01 22:36:45 UTC (rev 10297) @@ -162,7 +162,7 @@ $category['total'] = $thiscategory_itemcount; if (count($itemsObj) > 0) { - $userids = array(); + /*$userids = array(); if ($itemsObj) { foreach ($itemsObj as $key => $thisitem) { $itemids[] = $thisitem->getVar('itemid'); @@ -170,7 +170,8 @@ } } $member_handler = xoops_gethandler('member'); - $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($userids)) . ")", "IN"), true); + //$users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($userids)) . ")", "IN"), true); + */ // Adding the items of the selected category for ($i = 0; $i < $totalItemOnPage; $i++) { Modified: XoopsModules/publisher/trunk/publisher/class/category.php =================================================================== --- XoopsModules/publisher/trunk/publisher/class/category.php 2012-12-01 15:55:26 UTC (rev 10296) +++ XoopsModules/publisher/trunk/publisher/class/category.php 2012-12-01 22:36:45 UTC (rev 10297) @@ -32,21 +32,6 @@ /** * @var array */ - public $_groups_read = null; - - /** - * @var array - */ - public $_groups_submit = null; - - /** - * @var array - */ - public $_groups_moderation = null; - - /** - * @var array - */ public $_categoryPath = false; /** @@ -97,16 +82,6 @@ } /** - * Assigns permissions - */ - public function assignOtherProperties() - { - $this->_groups_read = $this->publisher->getHandler('permission')->getGrantedGroupsById('category_read', $this->categoryid()); - $this->_groups_submit = $this->publisher->getHandler('permission')->getGrantedGroupsById('item_submit', $this->categoryid()); - $this->_groups_moderation = $this->publisher->getHandler('permission')->getGrantedGroupsById('category_moderation', $this->categoryid()); - } - - /** * @return bool */ public function checkPermission() @@ -119,7 +94,7 @@ if (is_object($xoopsUser) && $xoopsUser->getVar('uid') == $this->moderator()) { return true; } - $categoriesGranted = $this->publisher->getHandler('permission')->getGrantedItems('category_read'); + $categoriesGranted = $this->publisher->getHandler('permission')->isGranted('category_read'); if (in_array($this->categoryid(), $categoriesGranted)) { $ret = true; } @@ -199,59 +174,26 @@ */ public function getGroups_read() { - if (count($this->_groups_read) < 1) { - $this->assignOtherProperties(); - } - return $this->_groups_read; + return $this->publisher->getHandler('permission')->getGrantedGroupsById('category_read', $this->categoryid()); } /** - * @param array $groups_read - */ - public function setGroups_read($groups_read = array('0')) - { - $this->_groups_read = $groups_read; - } - - /** * @return array|null */ public function getGroups_submit() { - if (count($this->_groups_submit) < 1) { - $this->assignOtherProperties(); - } - return $this->_groups_submit; + return $this->publisher->getHandler('permission')->getGrantedGroupsById('item_submit', $this->categoryid()); } /** - * @param array $groups_submit - */ - public function setGroups_submit($groups_submit = array('0')) - { - $this->_groups_submit = $groups_submit; - } - - /** * @return array|null */ public function getGroups_moderation() { - if (count($this->_groups_moderation) < 1) { - $this->assignOtherProperties(); - } - return $this->_groups_moderation; + return $this->publisher->getHandler('permission')->getGrantedGroupsById('category_moderation', $this->categoryid()); } /** - * @param array $groups_moderation - */ - public function setGroups_moderation($groups_moderation = array('0')) - { - $this->_groups_moderation = $groups_moderation; - } - - /** * @return string */ public function getCategoryUrl() @@ -412,10 +354,12 @@ */ public function &get($id) { - $obj = parent::get($id); - if (is_object($obj)) { - $obj->assignOtherProperties(); + static $cats; + if (isset($cats[$id])) { + return $cats[$id]; } + $obj = parent::get($id); + $cats[$id] = $obj; return $obj; } @@ -489,10 +433,7 @@ { $ret = array(); $theObjects = parent::getObjects($criteria, true); - $publisher_category_group = $this->publisher->getHandler('permission')->getGrantedGroups(); foreach ($theObjects as $theObject) { - $theObject->_groups_read = isset($publisher_category_group['category_read'][$theObject->categoryid()]) ? $publisher_category_group['category_read'][$theObject->categoryid()] : array(); - $theObject->_groups_submit = isset($publisher_category_group['item_submit'][$theObject->categoryid()]) ? $publisher_category_group['item_submit'][$theObject->categoryid()] : array(); if (!$id_as_key) { $ret[] = $theObject; } else { @@ -504,19 +445,6 @@ } /** - * @return array - */ - public function getAllCategoriesObj() - { - static $publisher_allCategoriesObj; - if (!isset($publisher_allCategoriesObj)) { - $publisher_allCategoriesObj = $this->getObjects(null, true); - $publisher_allCategoriesObj[0] = array(); - } - return $publisher_allCategoriesObj; - } - - /** * @param int $limit * @param int $start * @param int $parentid Modified: XoopsModules/publisher/trunk/publisher/class/item.php =================================================================== --- XoopsModules/publisher/trunk/publisher/class/item.php 2012-12-01 15:55:26 UTC (rev 10296) +++ XoopsModules/publisher/trunk/publisher/class/item.php 2012-12-01 22:36:45 UTC (rev 10297) @@ -77,7 +77,6 @@ foreach ($item->vars as $k => $v) { $this->assignVar($k, $v['value']); } - $this->assignOtherProperties(); } } @@ -94,15 +93,6 @@ } /** - * Just like the name says - */ - public function assignOtherProperties() - { - $publisher_allCategoriesObj = $this->publisher->getHandler('category')->getAllCategoriesObj(); - $this->_category = $publisher_allCategoriesObj[$this->getVar('categoryid')]; - } - - /** * @return null|PublisherCategory */ public function category() @@ -426,11 +416,7 @@ { global $xoopsConfig, $xoopsUser; $adminLinks = ''; - $groups = ($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $gperm_handler = xoops_gethandler('groupperm'); - $module_id = $this->publisher->getModule()->getVar('mid'); - // Do we have access to the parent category - if (is_object($xoopsUser) && (publisher_userIsAdmin() || publisher_userIsAuthor($this) || $gperm_handler->checkRight('item_submit', $this->categoryid(), $groups, $module_id))) { + if (is_object($xoopsUser) && (publisher_userIsAdmin() || publisher_userIsAuthor($this) || $this->publisher->getHandler('permission')->isGranted('item_submit', $this->categoryid()))) { if (publisher_userIsAdmin() || publisher_userIsAuthor($this) || publisher_userIsModerator($this)) { if ($this->publisher->getConfig('perm_edit') || publisher_userIsModerator($this) || publisher_userIsAdmin()) { // Edit button @@ -890,18 +876,14 @@ */ public function accessGranted() { - global $xoopsUser; if (publisher_userIsAdmin()) { return true; } if ($this->status() != _PUBLISHER_STATUS_PUBLISHED) { return false; } - $gperm_handler = xoops_gethandler('groupperm'); - $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $module_id = $this->publisher->getModule()->getVar('mid'); // Do we have access to the parent category - if ($gperm_handler->checkRight('category_read', $this->categoryid(), $groups, $module_id)) { + if ($this->publisher->getHandler('permission')->isGranted('category_read', $this->categoryid())) { return true; } return false; @@ -1181,11 +1163,7 @@ $theObjects[$myrow['itemid']] = $item; unset($item); } - // since we need the categoryObj and the items permissions for all these items, let's - // fetch them only once ;-) - $publisher_allCategoriesObj = $this->publisher->getHandler('category')->getAllCategoriesObj(); foreach ($theObjects as $theObject) { - $theObject->_category = isset($publisher_allCategoriesObj[$theObject->getVar('categoryid')]) ? $publisher_allCategoriesObj[$theObject->getVar('categoryid')] : null; if ($id_key == 'none') { $ret[] = $theObject; } elseif ($id_key == 'itemid') { @@ -1621,7 +1599,8 @@ public function getLastPublishedByCat($status = array(_PUBLISHER_STATUS_PUBLISHED)) { $ret = array(); - $cat = array(); + /*$cat = array(); + $sql = "SELECT categoryid, MAX(datesub) as date FROM " . $this->db->prefix('publisher_items') . " WHERE status IN (" . implode(',', $status) . ") GROUP BY categoryid"; $result = $this->db->query($sql); while ($row = $this->db->fetchArray($result)) { @@ -1644,6 +1623,19 @@ $ret[$row['categoryid']] = $item; unset($item); } + */ + $sql = "SELECT mi.categoryid, mi.itemid, mi.title, mi.short_url, mi.uid, mi.datesub"; + $sql .= " FROM (SELECT categoryid, MAX(datesub) AS date FROM " . $this->db->prefix('publisher_items'); + $sql .= " WHERE status IN (" . implode(',', $status) . ")"; + $sql .= " GROUP BY categoryid)mo"; + $sql .= " JOIN " . $this->db->prefix('publisher_items') . " mi ON mi.datesub = mo.date"; + $result = $this->db->query($sql); + while ($row = $this->db->fetchArray($result)) { + $item = new PublisherItem(); + $item->assignVars($row); + $ret[$row['categoryid']] = $item; + unset($item); + } return $ret; } Modified: XoopsModules/publisher/trunk/publisher/class/permission.php =================================================================== --- XoopsModules/publisher/trunk/publisher/class/permission.php 2012-12-01 15:55:26 UTC (rev 10296) +++ XoopsModules/publisher/trunk/publisher/class/permission.php 2012-12-01 22:36:45 UTC (rev 10297) @@ -21,9 +21,7 @@ * @version $Id$ */ defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); - include_once dirname(dirname(__FILE__)) . '/include/common.php'; - class PublisherPermissionHandler extends XoopsObjectHandler { /** @@ -47,8 +45,30 @@ */ public function getGrantedGroupsById($gperm_name, $id) { - $groups = $this->getGrantedGroups($gperm_name); - return isset($groups[$id]) ? $groups[$id] : array(); + static $items; + if (isset($items[$gperm_name][$id])) { + return $items[$gperm_name][$id]; + } + $groups = array(); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('gperm_modid', $this->publisher->getModule()->getVar('mid'))); + $criteria->add(new Criteria('gperm_name', $gperm_name)); + $criteria->add(new Criteria('gperm_itemid', $id)); + //Instead of calling groupperm handler and get objects, we will save some memory and do it our way + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $limit = $start = 0; + $sql = 'SELECT gperm_groupid FROM ' . $db->prefix('group_permission'); + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); + $limit = $criteria->getLimit(); + $start = $criteria->getStart(); + } + $result = $db->query($sql, $limit, $start); + while ($myrow = $db->fetchArray($result)) { + $groups[$myrow['gperm_groupid']] = $myrow['gperm_groupid']; + } + $items[$gperm_name][$id] = $groups; + return $groups; } /** @@ -56,27 +76,20 @@ * * @return array */ - public function getGrantedGroups($gperm_name = '') + public function getGrantedGroups($gperm_name) { - static $groups; - static $publisher_all_permissions_fetched; - if ($gperm_name) { - if (isset($groups[$gperm_name])) { - return $groups[$gperm_name]; - } elseif (true === $publisher_all_permissions_fetched) { - //trying to get non existing permission - return array(); - } - } else if (true === $publisher_all_permissions_fetched) { - return $groups; + static $items; + if (isset($items[$gperm_name])) { + return $items[$gperm_name]; } - $publisher_all_permissions_fetched = true; + $groups = array(); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('gperm_modid', $this->publisher->getModule()->getVar('mid'))); + $criteria->add(new Criteria('gperm_name', $gperm_name)); //Instead of calling groupperm handler and get objects, we will save some memory and do it our way $db = XoopsDatabaseFactory::getDatabaseConnection(); $limit = $start = 0; - $sql = 'SELECT * FROM ' . $db->prefix('group_permission'); + $sql = 'SELECT gperm_groupid FROM ' . $db->prefix('group_permission'); if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' ' . $criteria->renderWhere(); $limit = $criteria->getLimit(); @@ -84,10 +97,11 @@ } $result = $db->query($sql, $limit, $start); while ($myrow = $db->fetchArray($result)) { - $groups[$myrow['gperm_name']][$myrow['gperm_itemid']][] = $myrow['gperm_groupid']; + $groups[$myrow['gperm_groupid']] = $myrow['gperm_groupid']; } + $items[$gperm_name] = $groups; //Return the permission array - return $this->getGrantedGroups($gperm_name); + return $groups; } /** @@ -98,33 +112,36 @@ * * @return array */ - public function getGrantedItems($gperm_name, $id = null) + public function getGrantedItems($gperm_name, $id = 0) { + static $items; + if (isset($items[$gperm_name][$id])) { + return $items[$gperm_name][$id]; + } global $xoopsUser; - static $permissions; - if (!isset($permissions[$gperm_name]) || ($id != null && !isset($permissions[$gperm_name][$id]))) { - //Instead of calling groupperm handler and get objects, we will save some memory and do it our way - $criteria = new CriteriaCompo(new Criteria('gperm_name', $gperm_name)); - $criteria->add(new Criteria('gperm_modid', $this->publisher->getModule()->getVar('mid'))); - //Get user's groups - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); - $criteria2 = new CriteriaCompo(); - foreach ($groups as $gid) { - $criteria2->add(new Criteria('gperm_groupid', $gid), 'OR'); - } - $criteria->add($criteria2); - $db = XoopsDatabaseFactory::getDatabaseConnection(); - $sql = 'SELECT * FROM ' . $db->prefix('group_permission'); - $sql .= ' ' . $criteria->renderWhere(); - $result = $db->query($sql, 0, 0); - $permissions[$gperm_name] = array(); - while ($myrow = $db->fetchArray($result)) { - $permissions[$gperm_name][] = $myrow['gperm_itemid']; - } - $permissions[$gperm_name] = array_unique($permissions[$gperm_name]); + $ret = array(); + //Instead of calling groupperm handler and get objects, we will save some memory and do it our way + $criteria = new CriteriaCompo(new Criteria('gperm_name', $gperm_name)); + $criteria->add(new Criteria('gperm_modid', $this->publisher->getModule()->getVar('mid'))); + if ($id != 0) { + $criteria->add(new Criteria('gperm_itemid', $id)); } - //Return the permission array - return isset($permissions[$gperm_name]) ? $permissions[$gperm_name] : array(); + //Get user's groups + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); + $criteria2 = new CriteriaCompo(); + foreach ($groups as $gid) { + $criteria2->add(new Criteria('gperm_groupid', $gid), 'OR'); + } + $criteria->add($criteria2); + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $sql = 'SELECT gperm_itemid FROM ' . $db->prefix('group_permission'); + $sql .= ' ' . $criteria->renderWhere(); + $result = $db->query($sql, 0, 0); + while ($myrow = $db->fetchArray($result)) { + $ret[$myrow['gperm_itemid']] = $myrow['gperm_itemid']; + } + $items[$gperm_name][$id] = $ret; + return $ret; } /** @@ -135,13 +152,20 @@ */ public function isGranted($gperm_name, $id = null) { - static $permissions; - if ($id == null) return false; - if (!isset($permissions[$gperm_name]) || !isset($permissions[$gperm_name][$id])) { - $userpermissions = in_array($id, $this->getGrantedItems($gperm_name)) ? true : false; - $permissions[$gperm_name][$id] = $userpermissions; + $permissions = $this->getGrantedItems($gperm_name, $id); + if ($id == null) { + if (!empty($permissions)) { + return true; + } else { + return false; + } + } else { + if (!empty($permissions) && isset ($permissions[$id])) { + return true; + } else { + return false; + } } - return $permissions[$gperm_name][$id]; } /** Modified: XoopsModules/publisher/trunk/publisher/include/common.php =================================================================== --- XoopsModules/publisher/trunk/publisher/include/common.php 2012-12-01 15:55:26 UTC (rev 10296) +++ XoopsModules/publisher/trunk/publisher/include/common.php 2012-12-01 22:36:45 UTC (rev 10297) @@ -39,7 +39,7 @@ include_once PUBLISHER_ROOT_PATH . '/class/publisher.php'; include_once PUBLISHER_ROOT_PATH . '/class/request.php'; -$debug = true; +$debug = false; $publisher = PublisherPublisher::getInstance($debug); //This is needed or it will not work in blocks. |
From: <tr...@us...> - 2012-12-01 15:55:29
|
Revision: 10296 http://sourceforge.net/p/xoops/svn/10296 Author: trabis Date: 2012-12-01 15:55:26 +0000 (Sat, 01 Dec 2012) Log Message: ----------- Publisher - Fixing highlight Modified Paths: -------------- XoopsModules/publisher/trunk/publisher/include/search.inc.php Modified: XoopsModules/publisher/trunk/publisher/include/search.inc.php =================================================================== --- XoopsModules/publisher/trunk/publisher/include/search.inc.php 2012-12-01 01:34:13 UTC (rev 10295) +++ XoopsModules/publisher/trunk/publisher/include/search.inc.php 2012-12-01 15:55:26 UTC (rev 10296) @@ -50,12 +50,16 @@ $text = $obj->body(); $sanitized_text = ""; $text_i = strtolower($text); - $query = is_array($queryarray) ? $queryarray : array($queryarray); - $pos = strpos($text_i, strtolower($query)); //xoops_local("strpos", $text_i, strtolower($query)); - $start = max(($pos - 100), 0); - $length = strlen($query) + 200; //xoops_local("strlen", $query) + 200; - $context = $obj->highlight(xoops_substr($text, $start, $length, " [...]"), $query); - $sanitized_text .= "<p>[...] " . $context . "</p>"; + $queryarray = is_array($queryarray) ? $queryarray : array($queryarray); + + foreach ($queryarray as $query) { + $pos = strpos($text_i, strtolower($query)); //xoops_local("strpos", $text_i, strtolower($query)); + $start = max(($pos - 100), 0); + $length = strlen($query) + 200; //xoops_local("strlen", $query) + 200; + $context = $obj->highlight(xoops_substr($text, $start, $length, " [...]"), $query); + $sanitized_text .= "<p>[...] " . $context . "</p>"; + } + //End of highlight $item['text'] = $sanitized_text; $item['author'] = $obj->author_alias(); |
From: <tr...@us...> - 2012-12-01 01:34:16
|
Revision: 10295 http://sourceforge.net/p/xoops/svn/10295 Author: trabis Date: 2012-12-01 01:34:13 +0000 (Sat, 01 Dec 2012) Log Message: ----------- Updating cake cache engines and adding 2 more Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.cache.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/admin.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/image/scripts/image.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/preload.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme_blocks.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopseditor/xoopseditor.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Memcache.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Model.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Xcache.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Object.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Redis.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Wincache.php Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.cache.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.cache.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.cache.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -60,7 +60,7 @@ $dirname = ($dirname) ? $dirname : $xoops->moduleDirname; $key = "{$dirname}_{$name}"; - return XoopsCache::write($key, $data); + return Xoops_Cache::write($key, $data); } /** @@ -105,7 +105,7 @@ $dirname = ($dirname) ? $dirname : $xoops->moduleDirname; $key = "{$dirname}_{$name}"; - return XoopsCache::read($key); + return Xoops_Cache::read($key); } /** Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -36,9 +36,9 @@ } } else { - if (!$moduleConfig = XoopsCache::read("{$dirname}_config")) { + if (!$moduleConfig = Xoops_Cache::read("{$dirname}_config")) { $moduleConfig = mod_fetchConfig($dirname); - XoopsCache::write("{$dirname}_config", $moduleConfig); + Xoops_Cache::write("{$dirname}_config", $moduleConfig); } } if ($customConfig = @include XOOPS_ROOT_PATH . "/modules/{$dirname}/include/plugin.php") { @@ -105,7 +105,7 @@ } - return XoopsCache::delete("{$dirname}_config"); + return Xoops_Cache::delete("{$dirname}_config"); } function mod_clearConfg($dirname = "") Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/admin.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/admin.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/admin.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -87,7 +87,7 @@ $rssfile = 'adminnews-' . $xoops->getConfig('language'); $items = array(); - if (!$items = XoopsCache::read($rssfile)) { + if (!$items = Xoops_Cache::read($rssfile)) { $snoopy = new Snoopy(); $cnt = 0; foreach ($rssurl as $url) { @@ -108,7 +108,7 @@ } } krsort($items); - XoopsCache::write($rssfile, $items, 86400); + Xoops_Cache::write($rssfile, $items, 86400); } if ($items != '') { $ret = '<table class="outer width100">'; Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/image/scripts/image.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/image/scripts/image.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/image/scripts/image.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -155,7 +155,7 @@ */ public function getList($name, $extension = "") { - if ($items = XoopsCache::read("captcha_captcha_{$name}")) { + if ($items = Xoops_Cache::read("captcha_captcha_{$name}")) { return $items; } ; @@ -166,7 +166,7 @@ $items[] = $item; } } - XoopsCache::write("captcha_captcha_{$name}", $items); + Xoops_Cache::write("captcha_captcha_{$name}", $items); return $items; } Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/preload.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/preload.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/preload.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -79,7 +79,7 @@ */ private function _setPreloads() { - if ($modules_list = XoopsCache::read('system_modules_active')) { + if ($modules_list = Xoops_Cache::read('system_modules_active')) { $i = 0; foreach ($modules_list as $module) { if (is_dir($dir = XOOPS_ROOT_PATH . "/modules/{$module}/preloads/")) { Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -474,10 +474,8 @@ $xoops = Xoops::getInstance(); $xoops->logger->startTime('Page rendering'); - $cache = XoopsCache::getInstance(); - //Get meta information for cached pages - if ($this->contentCacheLifetime && $this->contentCacheId && $content = $cache->read($this->contentCacheId, $this->headersCacheEngine)) { + if ($this->contentCacheLifetime && $this->contentCacheId && $content = Xoops_Cache::read($this->contentCacheId, $this->headersCacheEngine)) { //we need to merge metas set by blocks with the module cached meta $this->htmlHeadStrings = array_merge($this->htmlHeadStrings, $content['htmlHeadStrings']); foreach ($content['metas'] as $type => $value) { Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme_blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme_blocks.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme_blocks.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -201,9 +201,7 @@ } } if (count($metas)) { - /* @var $cache XoopsCache */ - $cache = XoopsCache::getInstance(); - $cache->write($cacheid, $metas); + Xoops_Cache::write($cacheid, $metas); } } } else { @@ -213,8 +211,7 @@ //add block cached metas if ($this->theme && $bcachetime) { - $cache = XoopsCache::getInstance(); - if ($metas = $cache->read($cacheid)) { + if ($metas = Xoops_Cache::read($cacheid)) { foreach ($metas as $type => $value) { $this->theme->metas[$type] = array_merge($this->theme->metas[$type], $metas[$type]); } Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopseditor/xoopseditor.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopseditor/xoopseditor.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopseditor/xoopseditor.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -184,7 +184,7 @@ public function getList($noHtml = false) { $xoops = Xoops::getInstance(); - $list = XoopsCache::read('editorlist'); + $list = Xoops_Cache::read('editorlist'); if (empty($list)) { $list = array(); $order = array(); @@ -207,7 +207,7 @@ } } array_multisort($order, $list); - XoopsCache::write('editorlist', $list); + Xoops_Cache::write('editorlist', $list); } $editors = array_keys($list); Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -24,91 +24,190 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); /** - * Abstract class for storage engine for caching + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. * - * @package core - * @subpackage cache + * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Cache + * @since CakePHP(tm) v 1.2.0.4933 + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ + +/** + * Storage engine for CakePHP caching + * + * @package Cake.Cache + */ abstract class Xoops_Cache_Abstract { /** - * settings of current engine instance + * Settings of current engine instance * * @var array - * @access public */ - public $settings; + public $settings = array(); /** + * Contains the compiled string with all groups + * prefixes to be prepended to every key in this cache engine + * + * @var string + */ + protected $_groupPrefix = null; + + /** * Initialize the cache engine - * * Called automatically by the cache frontend * * @param array $settings Associative array of parameters for the engine - * @return bool True if the engine has been succesfully initialized, false if not + * + * @return boolean True if the engine has been successfully initialized, false if not */ public function init($settings = array()) { - $this->settings = array_merge(array('duration' => 31556926, 'probability' => 100), $settings); + $settings += $this->settings + array( + 'prefix' => 'xoops_' . substr(md5(XOOPS_URL), 0, 8) . '_' , + 'duration' => 3600, 'probability' => 100, 'groups' => array() + ); + $this->settings = $settings; + if (!empty($this->settings['groups'])) { + sort($this->settings['groups']); + $this->_groupPrefix = str_repeat('%s_', count($this->settings['groups'])); + } + if (!is_numeric($this->settings['duration'])) { + $this->settings['duration'] = strtotime($this->settings['duration']) - time(); + } return true; } /** * Garbage collection - * * Permanently remove all expired and deleted data * - * @access public + * @param integer $expires [optional] An expires timestamp, invalidataing all data before. + * + * @return void */ - public function gc() + public function gc($expires = null) { } /** * Write value for a key into cache * - * @param string $key Identifier for the data - * @param mixed $value Data to be cached - * @param mixed $duration How long to cache the data, in seconds + * @param string $key Identifier for the data + * @param mixed $value Data to be cached + * @param integer $duration How long to cache for. + * * @return boolean True if the data was successfully cached, false on failure - * @access public */ - abstract function write($key, &$value, $duration); + abstract public function write($key, $value, $duration); /** * Read a key from the cache * * @param string $key Identifier for the data + * * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it */ - abstract function read($key); + abstract public function read($key); /** + * Increment a number under the key and return incremented value + * + * @param string $key Identifier for the data + * @param integer $offset How much to add + * + * @return mixed New incremented value, false otherwise + */ + abstract public function increment($key, $offset = 1); + + /** + * Decrement a number under the key and return decremented value + * + * @param string $key Identifier for the data + * @param integer $offset How much to subtract + * + * @return mixed New incremented value, false otherwise + */ + abstract public function decrement($key, $offset = 1); + + /** * Delete a key from the cache * * @param string $key Identifier for the data + * * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed - * @access public */ - abstract function delete($key); + abstract public function delete($key); /** * Delete all keys from the cache * * @param boolean $check if true will check expiration, otherwise delete all + * * @return boolean True if the cache was successfully cleared, false otherwise - * @access public */ - abstract function clear($check); + abstract public function clear($check); /** + * Clears all values belonging to a group. Is upt to the implementing engine + * to decide whether actually deete the keys or just simulate it to acheive + * the same result. + * + * @param string $group name of the group to be cleared + * + * @return boolean + */ + public function clearGroup($group) + { + return false; + } + + /** + * Does whatever initialization for each group is required + * and returns the `group value` for each of them, this is + * the token representing each group in the cache key + * + * @return array + */ + public function groups() + { + return $this->settings['groups']; + } + + /** * Cache Engine settings * * @return array settings - * @access public */ public function settings() { return $this->settings; } -} \ No newline at end of file + + /** + * Generates a safe key for use with cache engine storage engines. + * + * @param string $key the key passed over + * + * @return mixed string $key or false + */ + public function key($key) + { + if (empty($key)) { + return false; + } + + $prefix = ''; + if (!empty($this->_groupPrefix)) { + $prefix = vsprintf($this->_groupPrefix, $this->groups()); + } + + $key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array(DIRECTORY_SEPARATOR, '/', '.'), '_', strval($key))))); + return $prefix . $key; + } +} Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -24,67 +24,69 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); /** - * APC storage engine for cache. - * - * - * PHP versions 4 and 5 - * - * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * + * APC storage engine for Xoops_Cache. + * PHP 5 + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project - * @package cake - * @subpackage cake.cake.libs.cache - * @since CakePHP(tm) v 1.2.0.4933 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Cache.Engine + * @since CakePHP(tm) v 1.2.0.4933 + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ /** * APC storage engine for cache * - * @package cake - * @subpackage cake.cake.libs.cache + * @package Cake.Cache.Engine */ class Xoops_Cache_Apc extends Xoops_Cache_Abstract { /** + * Contains the compiled group names + * (prefixed with the global configuration prefix) + * + * @var array + */ + protected $_compiledGroupNames = array(); + + /** * Initialize the Cache Engine - * * Called automatically by the cache frontend * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); * * @param array $settings array of setting for the engine + * * @return boolean True if the engine has been successfully initialized, false if not * @see CacheEngine::__defaults - * @access public */ public function init($settings = array()) { + $settings += array('engine' => 'Apc'); parent::init($settings); - return function_exists('apc_cache_info'); + return function_exists('apc_dec'); } /** * Write data for key into cache * - * @param string $key Identifier for the data - * @param mixed $value Data to be cached + * @param string $key Identifier for the data + * @param mixed $value Data to be cached * @param integer $duration How long to cache the data, in seconds + * * @return boolean True if the data was successfully cached, false on failure - * @access public */ - public function write($key, &$value, $duration) + public function write($key, $value, $duration) { + if ($duration == 0) { + $expires = 0; + } else { + $expires = time() + $duration; + } + apc_store($key . '_expires', $expires, $duration); return apc_store($key, $value, $duration); } @@ -92,20 +94,51 @@ * Read a key from the cache * * @param string $key Identifier for the data + * * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it - * @access public */ public function read($key) { + $time = time(); + $cachetime = intval(apc_fetch($key . '_expires')); + if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { + return false; + } return apc_fetch($key); } /** + * Increments the value of an integer cached key + * + * @param string $key Identifier for the data + * @param integer $offset How much to increment + * + * @return mixed New incremented value, false otherwise + */ + public function increment($key, $offset = 1) + { + return apc_inc($key, $offset); + } + + /** + * Decrements the value of an integer cached key + * + * @param string $key Identifier for the data + * @param integer $offset How much to subtract + * + * @return mixed New decremented value, false otherwise + */ + public function decrement($key, $offset = 1) + { + return apc_dec($key, $offset); + } + + /** * Delete a key from the cache * * @param string $key Identifier for the data + * * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed - * @access public */ public function delete($key) { @@ -113,14 +146,74 @@ } /** - * Delete all keys from the cache + * Delete all keys from the cache. This will clear every cache config using APC. * - * @param boolean $check if true will check expiration, otherwise delete all - * @return boolean True if the cache was successfully cleared, false otherwise - * @access public + * @param boolean $check If true, nothing will be cleared, as entries are removed + * from APC as they expired. This flag is really only used by FileEngine. + * + * @return boolean True Returns true. */ public function clear($check) { - return apc_clear_cache('user'); + if ($check) { + return true; + } + $info = apc_cache_info('user'); + $cacheKeys = $info['cache_list']; + unset($info); + foreach ($cacheKeys as $key) { + if (strpos($key['info'], $this->settings['prefix']) === 0) { + apc_delete($key['info']); + } + } + return true; } -} \ No newline at end of file + + /** + * Returns the `group value` for each of the configured groups + * If the group initial value was not found, then it initializes + * the group accordingly. + * + * @return array + */ + public function groups() + { + if (empty($this->_compiledGroupNames)) { + foreach ($this->settings['groups'] as $group) { + $this->_compiledGroupNames[] = $this->settings['prefix'] . $group; + } + } + + $groups = apc_fetch($this->_compiledGroupNames); + if (count($groups) !== count($this->settings['groups'])) { + foreach ($this->_compiledGroupNames as $group) { + if (!isset($groups[$group])) { + apc_store($group, 1); + $groups[$group] = 1; + } + } + ksort($groups); + } + + $result = array(); + $groups = array_values($groups); + foreach ($this->settings['groups'] as $i => $group) { + $result[] = $group . $groups[$i]; + } + return $result; + } + + /** + * Increments the group value to simulate deletion of all keys under a group + * old values will remain in storage until they expire. + * + * @param string $group + * + * @return boolean success + */ + public function clearGroup($group) + { + apc_inc($this->settings['prefix'] . $group, 1, $success); + return $success; + } +} Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -24,112 +24,96 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); /** - * File Storage engine for cache - * - * - * PHP versions 4 and 5 - * - * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * + * File Storage engine for Xoops_Cache. Filestorage is the slowest cache storage + * to read and write. However, it is good for servers that don't have other storage + * engine available, or have content which is not performance sensitive. + * You can configure a FileEngine cache, using Cache::config() + * PHP 5 + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project - * @package cake - * @subpackage cake.cake.libs.cache - * @since CakePHP(tm) v 1.2.0.4933 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @since CakePHP(tm) v 1.2.0.4933 + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ /** - * File Storage engine for cache + * File Storage engine for cache. Filestorage is the slowest cache storage + * to read and write. However, it is good for servers that don't have other storage + * engine available, or have content which is not performance sensitive. + * You can configure a FileEngine cache, using Cache::config() * - * @todo use the File and Folder classes (if it's not a too big performance hit) - * @package cake - * @subpackage cake.cake.libs.cache + * @package Cake.Cache.Engine */ class Xoops_Cache_File extends Xoops_Cache_Abstract { /** - * Instance of File class + * Instance of SplFileObject class * - * @var Xoops_File - * @access private + * @var SplFileObject $_File */ - private $file = null; + protected $_File = null; /** - * settings - * path = absolute path to cache directory, default => CACHE - * prefix = string prefix for filename, default => xoops_ - * lock = enable file locking on write, default => false - * serialize = serialize the data, default => false + * Settings + * - path = absolute path to cache directory + * - prefix = string prefix for filename + * - lock = enable file locking on write + * - serialize = serialize the data * * @var array - * @see CacheEngine::__defaults - * @access public + * @see Xoops_Cache_Abstract::__defaults */ public $settings = array(); /** - * Set to true if FileEngine::init(); and FileEngine::active(); do not fail. + * True unless Xoops_Cache_File::__active(); fails * * @var boolean - * @access private */ - private $active = false; + protected $_init = true; /** - * True unless FileEngine::active(); fails - * - * @var boolean - * @access private - */ - private $init = true; - - /** * Initialize the Cache Engine - * * Called automatically by the cache frontend - * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); + * To reinitialize the settings call Xoops_Cache::engine('EngineName', [optional] settings = array()); * * @param array $settings array of setting for the engine - * @return bool True if the engine has been successfully initialized, false if not - * @access public + * + * @return boolean True if the engine has been successfully initialized, false if not */ public function init($settings = array()) { + $settings += array( + 'engine' => 'File', 'path' => XOOPS_VAR_PATH . '/caches/xoops_cache', 'extension' => '.php', + 'lock' => false, 'serialize' => false, 'duration' => 31556926, + 'mask' => 0664 + ); parent::init($settings); - $defaults = array( - 'path' => XOOPS_VAR_PATH . '/caches/xoops_cache', 'extension' => '.php', 'prefix' => 'xoops_', - 'lock' => false, 'serialize' => false, 'duration' => 31556926 - ); - $this->settings = array_merge($defaults, $this->settings); - if (!isset($this->file)) { - $this->file = new XoopsFile($this->settings['path'] . '/index.html', true); + + if (DS === '\\') { + $this->settings['isWindows'] = true; } - $this->settings['path'] = $this->file->folder->cd($this->settings['path']); - if (empty($this->settings['path'])) { - return false; + if (substr($this->settings['path'], -1) !== DS) { + $this->settings['path'] .= DS; } - return $this->active(); + if (!empty($this->_groupPrefix)) { + $this->_groupPrefix = str_replace('_', DS, $this->_groupPrefix); + } + return $this->_active(); } /** * Garbage collection. Permanently remove all expired and deleted data * + * @param integer $expires [optional] An expires timestamp, invalidating all data before. + * * @return boolean True if garbage collection was successful, false on failure - * @access public */ - public function gc() + public function gc($expires = null) { return $this->clear(true); } @@ -137,49 +121,51 @@ /** * Write data for key into cache * - * @param string $key Identifier for the data - * @param mixed $value Data to be cached - * @param mixed $duration How long to cache the data, in seconds - * @return boolean True if the data was succesfully cached, false on failure - * @access public + * @param string $key Identifier for the data + * @param mixed $data Data to be cached + * @param integer $duration How long to cache the data, in seconds + * + * @return boolean True if the data was successfully cached, false on failure */ - public function write($key, &$value, $duration) + public function write($key, $data, $duration) { - if (!isset($value) || !$this->init) { + if ($data === '' || !$this->_init) { return false; } - if ($this->setKey($key) === false) { + if ($this->_setKey($key, true) === false) { return false; } - if ($duration == null) { - $duration = $this->settings['duration']; - } - $windows = false; $lineBreak = "\n"; - if (substr(PHP_OS, 0, 3) == "WIN") { + if ($this->settings['isWindows']) { $lineBreak = "\r\n"; - $windows = true; } + $expires = time() + $duration; if (!empty($this->settings['serialize'])) { - if ($windows) { - $value = str_replace('\\', '\\\\\\\\', serialize($value)); + if ($this->settings['isWindows']) { + $data = str_replace('\\', '\\\\\\\\', serialize($data)); } else { - $value = serialize($value); + $data = serialize($data); } - $contents = $expires . $lineBreak . $value . $lineBreak; + $contents = $expires . $lineBreak . $data . $lineBreak; } else { - $contents = $expires . $lineBreak . "return " . var_export($value, true) . ";" . $lineBreak; + $contents = $expires . $lineBreak . "return " . var_export($data, true) . ";" . $lineBreak; } if ($this->settings['lock']) { - $this->file->lock = true; + $this->_File->flock(LOCK_EX); } - $success = $this->file->write($contents); - $this->file->close(); + + $this->_File->rewind(); + $success = $this->_File->ftruncate(0) && $this->_File->fwrite($contents) && $this->_File->fflush(); + + if ($this->settings['lock']) { + $this->_File->flock(LOCK_UN); + } + return $success; } @@ -187,39 +173,53 @@ * Read a key from the cache * * @param string $key Identifier for the data + * * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it - * @access public */ public function read($key) { - if ($this->setKey($key) === false || !$this->init) { + if (!$this->_init || $this->_setKey($key) === false) { return false; } + if ($this->settings['lock']) { - $this->file->lock = true; + $this->_File->flock(LOCK_SH); } - $cachetime = $this->file->read(11); - if ($cachetime !== false && intval($cachetime) < time()) { - $this->file->close(); - $this->file->delete(); + $this->_File->rewind(); + $time = time(); + $cachetime = intval($this->_File->current()); + + if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { + if ($this->settings['lock']) { + $this->_File->flock(LOCK_UN); + } return false; } - $data = $this->file->read(true); - if (!empty($data) && !empty($this->settings['serialize'])) { - $data = stripslashes($data); - $data = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $data); - $data = unserialize($data); - if (is_array($data)) { - $data = XoopsUtility::recursive('stripslashes', $data); + $data = ''; + $this->_File->next(); + while ($this->_File->valid()) { + $data .= $this->_File->current(); + $this->_File->next(); + } + + if ($this->settings['lock']) { + $this->_File->flock(LOCK_UN); + } + + $data = trim($data); + + if ($data !== '' && !empty($this->settings['serialize'])) { + if ($this->settings['isWindows']) { + $data = str_replace('\\\\\\\\', '\\', $data); } + $data = unserialize((string)$data); } else { if ($data && empty($this->settings['serialize'])) { $data = eval($data); } } - $this->file->close(); return $data; } @@ -227,78 +227,134 @@ * Delete a key from the cache * * @param string $key Identifier for the data + * * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed - * @access public */ public function delete($key) { - if ($this->setKey($key) === false || !$this->init) { + if ($this->_setKey($key) === false || !$this->_init) { return false; } - return $this->file->delete(); + $path = $this->_File->getRealPath(); + $this->_File = null; + return unlink($path); } /** * Delete all values from the cache * * @param boolean $check Optional - only delete expired cache items + * * @return boolean True if the cache was successfully cleared, false otherwise - * @access public */ public function clear($check) { - if (!$this->init) { + if (!$this->_init) { return false; } - - if (false !== $check) { - $check = true; + $dir = dir($this->settings['path']); + if ($check) { + $now = time(); + $threshold = $now - $this->settings['duration']; } - - $dir = dir($this->settings['path']); - $now = time(); - $threshold = $now - $this->settings['duration']; - + $prefixLength = strlen($this->settings['prefix']); while (($entry = $dir->read()) !== false) { - if ($this->setKey(str_replace($this->settings['prefix'], '', $entry)) === false) { + if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) { continue; } + if ($this->_setKey($entry) === false) { + continue; + } if ($check) { - $mtime = $this->file->lastChange(); + $mtime = $this->_File->getMTime(); - if ($mtime === false || $mtime > $threshold) { + if ($mtime > $threshold) { continue; } - $expires = $this->file->read(11); - $this->file->close(); + $expires = (int)$this->_File->current(); if ($expires > $now) { continue; } } - $this->file->delete(); + $path = $this->_File->getRealPath(); + $this->_File = null; + if (file_exists($path)) { + unlink($path); + } } $dir->close(); return true; } /** - * Get absolute file for a given key + * Not implemented * - * @param string $key The key - * @return mixed Absolute cache file for the given key or false if erroneous - * @access private + * @param string $key + * @param integer $offset + * + * @return void */ - public function setKey($key) + public function decrement($key, $offset = 1) { - $this->file->folder->cd($this->settings['path']); - $this->file->name = $this->settings['prefix'] . $key . $this->settings['extension']; - $this->file->handle = null; - $this->file->info = null; - if (!$this->file->folder->inPath($this->file->pwd(), true)) { + trigger_error(sprintf('Files cannot be atomically decremented.')); + } + + /** + * Not implemented + * + * @param string $key + * @param integer $offset + * + * @return void + */ + public function increment($key, $offset = 1) + { + trigger_error(sprintf('Files cannot be atomically incremented.')); + } + + /** + * Sets the current cache key this class is managing, and creates a writable SplFileObject + * for the cache file the key is referring to. + * + * @param string $key The key + * @param boolean $createKey Whether the key should be created if it doesn't exists, or not + * + * @return boolean true if the cache key could be set, false otherwise + */ + protected function _setKey($key, $createKey = false) + { + $groups = null; + if (!empty($this->_groupPrefix)) { + $groups = vsprintf($this->_groupPrefix, $this->groups()); + } + $dir = $this->settings['path'] . $groups; + + if (!is_dir($dir)) { + mkdir($dir, 0777, true); + } + $path = new SplFileInfo($dir . $key); + + if (!$createKey && !$path->isFile()) { return false; } + if (empty($this->_File) || $this->_File->getBaseName() !== $key) { + $exists = file_exists($path->getPathname()); + try { + $this->_File = $path->openFile('c+'); + } catch (Exception $e) { + trigger_error($e->getMessage(), E_USER_WARNING); + return false; + } + unset($path); + + if (!$exists && !chmod($this->_File->getPathname(), (int)$this->settings['mask'])) { + trigger_error(sprintf('Could not apply permission mask "%s" on cache file "%s"', array( + $this->_File->getPathname(), $this->settings['mask'] + )), E_USER_WARNING); + } + } return true; } @@ -306,16 +362,57 @@ * Determine is cache directory is writable * * @return boolean - * @access private */ - function active() + protected function _active() { - if (!$this->active && $this->init && !is_writable($this->settings['path'])) { - $this->init = false; + $dir = new SplFileInfo($this->settings['path']); + if ($this->_init && !($dir->isDir() && $dir->isWritable())) { + $this->_init = false; trigger_error(sprintf('%s is not writable', $this->settings['path']), E_USER_WARNING); - } else { - $this->active = true; + return false; } return true; } -} \ No newline at end of file + + /** + * Generates a safe key for use with cache engine storage engines. + * + * @param string $key the key passed over + * + * @return mixed string $key or false + */ + public function key($key) + { + if (empty($key)) { + return false; + } + + $key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array( + DIRECTORY_SEPARATOR, '/', '.' + ), '_', strval($key))))); + if ($this->settings['extension']) { + $key .= $this->settings['extension']; + } + + return $key; + } + + /** + * Recursively deletes all files under any directory named as $group + * + * @var string $group + * @return boolean success + */ + public function clearGroup($group) + { + $directoryIterator = new RecursiveDirectoryIterator($this->settings['path']); + $contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST); + foreach ($contents as $object) { + $containsGroup = strpos($object->getPathName(), DS . $group . DS) !== false; + if ($object->isFile() && $containsGroup) { + unlink($object->getPathName()); + } + } + return true; + } +} Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Memcache.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Memcache.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Memcache.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -24,163 +24,297 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); /** - * Memcache storage engine for cache - * - * - * PHP versions 4 and 5 - * - * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * + * Memcache storage engine for Xoops_Cache + * PHP 5 + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project - * @package cake - * @subpackage cake.cake.libs.cache - * @since CakePHP(tm) v 1.2.0.4933 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Cache.Engine + * @since CakePHP(tm) v 1.2.0.4933 + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ + +/** + * Memcache storage engine for Xoops_Cache. Memcache has some limitations in the amount of + * control you have over expire times far in the future. See MemcacheEngine::write() for + * more information. + * + * @package Cake.Cache.Engine + */ class Xoops_Cache_Memcache extends Xoops_Cache_Abstract { /** + * Contains the compiled group names + * (prefixed with the global configuration prefix) + * + * @var array + **/ + protected $_compiledGroupNames = array(); + + /** * Memcache wrapper. * * @var Memcache - * @access private */ - private $memcache = null; + protected $_Memcache = null; /** - * settings - * servers = string or array of memcache servers, default => 127.0.0.1 - * compress = boolean, default => false + * Settings + * - servers = string or array of memcache servers, default => 127.0.0.1. If an + * array MemcacheEngine will use them as a pool. + * - compress = boolean, default => false * * @var array - * @access public */ public $settings = array(); /** * Initialize the Cache Engine - * * Called automatically by the cache frontend - * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); + * To reinitialize the settings call Xoops_Cache::engine('EngineName', [optional] settings = array()); * * @param array $settings array of setting for the engine + * * @return boolean True if the engine has been successfully initialized, false if not - * @access public */ public function init($settings = array()) { if (!class_exists('Memcache')) { return false; } + + $settings += array( + 'engine' => 'Memcache', 'servers' => array('127.0.0.1'), 'compress' => false, 'persistent' => true + ); parent::init($settings); - $defaults = array( - 'servers' => array( - '127.0.0.1' - ), 'compress' => false - ); - $this->settings = array_merge($defaults, $this->settings); - if (!$this->settings['compress']) { + if ($this->settings['compress']) { $this->settings['compress'] = MEMCACHE_COMPRESSED; } - if (!is_array($this->settings['servers'])) { - $this->settings['servers'] = array( - $this->settings['servers'] - ); + if (is_string($this->settings['servers'])) { + $this->settings['servers'] = array($this->settings['servers']); } - $this->memcache = null; - $this->memcache = new Memcache(); - foreach ($this->settings['servers'] as $server) { - $parts = explode(':', $server); - $host = $parts[0]; - $port = 11211; - if (isset($parts[1])) { - $port = $parts[1]; + if (!isset($this->_Memcache)) { + $return = false; + $this->_Memcache = new Memcache(); + foreach ($this->settings['servers'] as $server) { + list($host, $port) = $this->_parseServerString($server); + if ($this->_Memcache->addServer($host, $port, $this->settings['persistent'])) { + $return = true; + } } - if ($this->memcache->addServer($host, $port)) { - return true; + return $return; + } + return true; + } + + /** + * Parses the server address into the host/port. Handles both IPv6 and IPv4 + * addresses and Unix sockets + * + * @param string $server The server address string. + * + * @return array Array containing host, port + */ + protected function _parseServerString($server) + { + if ($server[0] == 'u') { + return array($server, 0); + } + if (substr($server, 0, 1) == '[') { + $position = strpos($server, ']:'); + if ($position !== false) { + $position++; } + } else { + $position = strpos($server, ':'); } - return false; + $port = 11211; + $host = $server; + if ($position !== false) { + $host = substr($server, 0, $position); + $port = substr($server, $position + 1); + } + return array($host, $port); } /** - * Write data for key into cache + * Write data for key into cache. When using memcache as your cache engine + * remember that the Memcache pecl extension does not support cache expiry times greater + * than 30 days in the future. Any duration greater than 30 days will be treated as never expiring. * - * @param string $key Identifier for the data - * @param mixed $value Data to be cached + * @param string $key Identifier for the data + * @param mixed $value Data to be cached * @param integer $duration How long to cache the data, in seconds + * * @return boolean True if the data was successfully cached, false on failure - * @access public + * @see http://php.net/manual/en/memcache.set.php */ - public function write($key, &$value, $duration) + public function write($key, $value, $duration) { - return $this->memcache->set($key, $value, $this->settings['compress'], $duration); + if ($duration > 30 * 24 * 60 * 60) { + $duration = 0; + } + return $this->_Memcache->set($key, $value, $this->settings['compress'], $duration); } /** * Read a key from the cache * * @param string $key Identifier for the data + * * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it - * @access public */ public function read($key) { - return $this->memcache->get($key); + return $this->_Memcache->get($key); } /** + * Increments the value of an integer cached key + * + * @param string $key Identifier for the data + * @param integer $offset How much to increment + * + * @return mixed New incremented value, false otherwise + */ + public function increment($key, $offset = 1) + { + if ($this->settings['compress']) { + trigger_error(sprintf('Method increment() not implemented for compressed cache in %s', __CLASS__)); + } + return $this->_Memcache->increment($key, $offset); + } + + /** + * Decrements the value of an integer cached key + * + * @param string $key Identifier for the data + * @param integer $offset How much to subtract + * + * @return mixed New decremented value, false otherwise + */ + public function decrement($key, $offset = 1) + { + if ($this->settings['compress']) { + trigger_error(sprintf('Method decrement() not implemented for compressed cache in %s', __CLASS__)); + } + return $this->_Memcache->decrement($key, $offset); + } + + /** * Delete a key from the cache * * @param string $key Identifier for the data + * * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed - * @access public */ public function delete($key) { - return $this->memcache->delete($key); + return $this->_Memcache->delete($key); } /** * Delete all keys from the cache * - * @param boolean $check if true will check expiration, otherwise delete all + * @param boolean $check + * * @return boolean True if the cache was successfully cleared, false otherwise - * @access public */ public function clear($check) { - return $this->memcache->flush(); + if ($check) { + return true; + } + foreach ($this->_Memcache->getExtendedStats('slabs') as $slabs) { + foreach (array_keys($slabs) as $slabId) { + if (!is_numeric($slabId)) { + continue; + } + + foreach ($this->_Memcache->getExtendedStats('cachedump', $slabId) as $stats) { + if (!is_array($stats)) { + continue; + } + foreach (array_keys($stats) as $key) { + if (strpos($key, $this->settings['prefix']) === 0) { + $this->_Memcache->delete($key); + } + } + } + } + } + return true; } /** * Connects to a server in connection pool * - * @param string $host host ip address or name + * @param string $host host ip address or name * @param integer $port Server port + * * @return boolean True if memcache server was connected - * @access public */ public function connect($host, $port = 11211) { - if ($this->memcache->getServerStatus($host, $port) === 0) { - if ($this->memcache->connect($host, $port)) { + if ($this->_Memcache->getServerStatus($host, $port) === 0) { + if ($this->_Memcache->connect($host, $port)) { return true; } return false; } return true; } -} \ No newline at end of file + + /** + * Returns the `group value` for each of the configured groups + * If the group initial value was not found, then it initializes + * the group accordingly. + * + * @return array + **/ + public function groups() + { + if (empty($this->_compiledGroupNames)) { + foreach ($this->settings['groups'] as $group) { + $this->_compiledGroupNames[] = $this->settings['prefix'] . $group; + } + } + + $groups = $this->_Memcache->get($this->_compiledGroupNames); + if (count($groups) !== count($this->settings['groups'])) { + foreach ($this->_compiledGroupNames as $group) { + if (!isset($groups[$group])) { + $this->_Memcache->set($group, 1, false, 0); + $groups[$group] = 1; + } + } + ksort($groups); + } + + $result = array(); + $groups = array_values($groups); + foreach ($this->settings['groups'] as $i => $group) { + $result[] = $group . $groups[$i]; + } + + return $result; + } + + /** + * Increments the group value to simulate deletion of all keys under a group + * old values will remain in storage until they expire. + * + * @param string $group + * + * @return boolean success + */ + public function clearGroup($group) + { + return (bool)$this->_Memcache->increment($this->settings['prefix'] . $group); + } +} Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Model.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Model.php 2012-11-30 22:26:36 UTC (rev 10294) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Model.php 2012-12-01 01:34:13 UTC (rev 10295) @@ -25,28 +25,24 @@ /** * Database Storage engine for cache - * - * * PHP versions 4 and 5 - * * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> * Copyright 2005-2008, Cake Software Foundation, Inc. * 1785 E. Sahara Avenue, Suite 490-204 * Las Vegas, Nevada 89104 - * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project - * @package cake + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake * @subpackage cake.cake.libs.cache - * @since CakePHP(tm) v 1.2.0.4933 - * @version $Revision$ + * @since CakePHP(tm) v 1.2.0.4933 + * @version $Revision$ * @modifiedby $LastChangedBy$ * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ class Xoops_Cache_Model extends Xoops_Cache_Abstract { @@ -78,11 +74,11 @@ /** * Initialize the Cache Engine - * * Called automatically by the cache frontend * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); * * @param array $settings array of setting for the engine + * * @return boolean True if the engine has been successfully initialized, false if not * @access public */ @@ -100,7 +96,6 @@ * Garbage collection. Permanently remove all expired and deleted data * * @access public - * * @return bool */ public function gc() @@ -111,9 +106,10 @@ /** * Write data for key into cache * - * @param string $key Identifier for the data - * @param mixed $value Data to be cached + * @param string $key Identifier for the data + * @param mixed $value Data to be cached * @param integer $duration How long to cache the data, in seconds + * * @return boolean True if the data was successfully cached, false on failure * @access public */ @@ -136,6 +132,7 @@ * Read a key from the cache * * @param string $key Identifier for the data + * * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it * @access public */ @@ -161,6 +158,7 @@ * Delete a key from the cache * * @param string $key Identifier for the data + * * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed * @access public */ @@ -174,6 +172,7 @@ * Delete all keys from the cache * * @param boolean $check if true will check expiration, otherwise delete all + * * @return boolean True if the cache was successfully cleared, false otherwise * @access public */ @@ -184,4 +183,30 @@ } return $this->model->deleteAll(); } + + /** + * Increments the value of an integer cached key + * + * @param string $key Identifier for the data + * @param integer $offset How much to increment + * + * @return mixed New incremented value, false otherwise + */ + public function increment($key, $offset = 1) + { + trigger_error(sprintf('Method increment() not implemented in class %s', __CLASS__)); + } + + /** + * Decrements the value of an integer cached key + * + * @param string $key Identifier for the data + * @param integer $offset How much to subtract + * + * @return mixed New decremented value, false otherwise + */ + public function decrement($key, $offset = ... [truncated message content] |
From: <tr...@us...> - 2012-11-30 22:26:40
|
Revision: 10294 http://sourceforge.net/p/xoops/svn/10294 Author: trabis Date: 2012-11-30 22:26:36 +0000 (Fri, 30 Nov 2012) Log Message: ----------- Adding cache, file and folder classes Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/jquery.php XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/file.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/xoopscaptcha.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/file.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/folder.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/xoopsfile.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/tplsets/jquery.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/xlanguage/class/xlanguage.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Load.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Memcache.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Model.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Xcache.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/index.html XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/File.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Folder.php Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/jquery.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/jquery.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/jquery.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -143,7 +143,7 @@ //echo $path_file . $file.'<br />'; $unzip = ''; $edit = false; - $file1 = XoopsFile::getHandler('file', $path_file . $file); + $file1 = new Xoops_File($path_file . $file); $extension_verif = $file1->ext(); switch ($extension_verif) { @@ -271,7 +271,7 @@ $restore = ''; } - $file = XoopsFile::getHandler('file', $path_file); + $file = new Xoops_File($path_file); $content = $file->read(); if (empty($content)) { echo _AM_SYSTEM_FILEMANAGER_EMPTY_FILE; @@ -316,7 +316,7 @@ XoopsLoad::load('pclzip', 'system'); XoopsLoad::load('pcltar', 'system'); - $file1 = XoopsFile::getHandler('file', $path_file); + $file1 = new Xoops_File($path_file); $extension = $file1->ext(); switch ($extension) { case 'zip': @@ -342,7 +342,7 @@ //Delete one file case 'filemanager_delete_file': - $file = XoopsFile::getHandler('file', $_REQUEST['path_file']); + $file = new Xoops_File($_REQUEST['path_file']); if (!$file->delete()) { $xoops->error(_AM_SYSTEM_FILEMANAGER_ERROR); } else { Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/main.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/main.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/extras/modules/system/admin/filemanager/main.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -83,8 +83,7 @@ foreach ($files as $file) { if (!preg_match('#.back#', $file)) { if (file_exists($root . $file) && $file != '.' && $file != '..' && !is_dir($root . $file)) { - /* @var $folder XoopsFileHandler */ - $folder = XoopsFile::getHandler('file', $root . $file); + $folder = new Xoops_File($root . $file); $extension_verif = $folder->ext(); switch ($extension_verif) { @@ -237,7 +236,7 @@ case 'filemanager_add_dir_save': $path = $system->cleanVars($_REQUEST, 'path', XOOPS_ROOT_PATH . '/', 'string'); - $folder = XoopsFile::getHandler('folder'); + $folder = new Xoops_Folder(); if ($folder->create($path . $_REQUEST['dir_name'], 0777)) { $indexFile = XOOPS_ROOT_PATH . "/modules/system/index.html"; copy($indexFile, $path . $_REQUEST['dir_name'] . "/index.html"); Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/file.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/file.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/file.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -114,7 +114,7 @@ ); $this->settings = array_merge($defaults, $this->settings); if (!isset($this->file)) { - $this->file = XoopsFile::getHandler('file', $this->settings['path'] . '/index.html', true); + $this->file = new Xoops_File($this->settings['path'] . '/index.html', true); } $this->settings['path'] = $this->file->folder->cd($this->settings['path']); if (empty($this->settings['path'])) { Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/xoopscaptcha.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/xoopscaptcha.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/captcha/xoopscaptcha.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -109,7 +109,7 @@ } else { $filename = 'captcha.config.' . $name; } - if ( !$config = $this->readConfig($filename) ) { + if ( !$config = $this->readConfig($filename) ) { $config = $this->loadBasicConfig( $name ); $this->writeConfig($filename, $config ); } @@ -148,10 +148,9 @@ * @return array */ function readConfig( $filename = 'config') - { + { $path_file = $this->configPath . $filename . '.php'; - XoopsLoad::load('XoopsFile'); - $file = XoopsFile::getHandler('file', $path_file); + $file = new Xoops_File($path_file); return eval(@$file->read()); } @@ -163,10 +162,9 @@ * @return array */ function writeConfig($filename = 'config', $config) - { + { $path_file = $this->configPath . $filename . '.php'; - XoopsLoad::load('XoopsFile'); - $file = XoopsFile::getHandler('file', $path_file); + $file = new Xoops_File($path_file); return $file->write( 'return ' . var_export($config, true) . ';'); } @@ -356,11 +354,11 @@ * @return string */ public function render() - { + { $sessionName = $this->config['name']; $_SESSION[$sessionName . '_name'] = $sessionName; - foreach ($this->config as $k => $config ) { - $_SESSION[$sessionName . '_' . $k] = $config; + foreach ($this->config as $k => $config ) { + $_SESSION[$sessionName . '_' . $k] = $config; } $form = ''; if (!$this->active || empty($this->config['name'])) { @@ -476,7 +474,7 @@ * @return array */ public function loadConfig($name = '') - { + { $this->config = empty($name) ? $this->handler->config : array_merge($this->handler->config, $this->handler->loadConfig($name)); Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/file.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/file.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/file.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -25,538 +25,7 @@ /** * Convenience class for reading, writing and appending to files. - * - * PHP versions 4 and 5 - * - * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project - * @package cake - * @subpackage cake.cake.libs - * @since CakePHP(tm) v 0.2.9 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ - -/** - * Convenience class for reading, writing and appending to files. - * - * @package cake - * @subpackage cake.cake.libs - */ -class XoopsFileHandler +class XoopsFileHandler extends Xoops_File { - /** - * folder object of the File - * - * @var XoopsFolderHandler - * @access public - */ - public $folder = null; - - /** - * Filename - * - * @var string - * @access public - */ - public $name = null; - - /** - * file info - * - * @var string - * @access public - */ - public $info = array(); - - /** - * Holds the file handler resource if the file is opened - * - * @var resource - * @access public - */ - public $handle = null; - - /** - * enable locking for file reading and writing - * - * @var boolean - * @access public - */ - public $lock = null; - - /** - * Constructor - * - * @param string $path Path to file - * @param boolean $create Create file if it does not exist (if true) - * @param integer $mode Mode to apply to the folder holding the file - * @access private - */ - function __construct($path, $create = false, $mode = 0755) - { - $this->folder = XoopsFile::getHandler('folder', dirname($path), $create, $mode); - if (!is_dir($path)) { - $this->name = basename($path); - } - if (!$this->exists()) { - if ($create === true) { - if ($this->safe($path) && $this->create() === false) { - return false; - } - } else { - return false; - } - } - return true; - } - - - /** - * Closes the current file if it is opened - */ - public function __destruct() - { - $this->close(); - } - - /** - * Creates the File. - * - * @return boolean Success - * @access public - */ - public function create() - { - $dir = $this->folder->pwd(); - if (is_dir($dir) && is_writable($dir) && !$this->exists()) { - if (touch($this->pwd())) { - return true; - } - } - return false; - } - - /** - * Opens the current file with a given $mode - * - * @param string $mode A valid 'fopen' mode string (r|w|a ...) - * @param boolean $force If true then the file will be re-opened even if its already opened, otherwise it won't - * @return boolean True on success, false on failure - * @access public - */ - public function open($mode = 'r', $force = false) - { - if (!$force && is_resource($this->handle)) { - return true; - } - if ($this->exists() === false) { - if ($this->create() === false) { - return false; - } - } - $this->handle = fopen($this->pwd(), $mode); - if (is_resource($this->handle)) { - return true; - } - return false; - } - - /** - * Return the contents of this File as a string. - * - * @param string|bool $bytes where to start - * @param string $mode - * @param boolean $force If true then the file will be re-opened even if its already opened, otherwise it won't - * @return mixed string on success, false on failure - * @access public - */ - public function read($bytes = false, $mode = 'rb', $force = false) - { - $success = false; - if ($this->lock !== null) { - if (flock($this->handle, LOCK_SH) === false) { - return false; - } - } - if ($bytes === false) { - $success = file_get_contents($this->pwd()); - } else { - if ($this->open($mode, $force) === true) { - if (is_int($bytes)) { - $success = fread($this->handle, $bytes); - } else { - $data = ''; - while (!feof($this->handle)) { - $data .= fgets($this->handle, 4096); - } - $success = trim($data); - } - } - } - if ($this->lock !== null) { - flock($this->handle, LOCK_UN); - } - return $success; - } - - /** - * Sets or gets the offset for the currently opened file. - * - * @param mixed $offset The $offset in bytes to seek. If set to false then the current offset is returned. - * @param integer $seek PHP Constant SEEK_SET | SEEK_CUR | SEEK_END determining what the $offset is relative to - * @return mixed True on success, false on failure (set mode), false on failure or integer offset on success (get mode) - * @access public - */ - public function offset($offset = false, $seek = SEEK_SET) - { - if ($offset === false) { - if (is_resource($this->handle)) { - return ftell($this->handle); - } - } else { - if ($this->open() === true) { - return fseek($this->handle, $offset, $seek) === 0; - } - } - return false; - } - - /** - * Prepares a ascii string for writing - * fixes line endings - * - * @param string $data Data to prepare for writing. - * @return string - * @access public - */ - public function prepare($data) - { - $lineBreak = "\n"; - if (substr(PHP_OS, 0, 3) == 'WIN') { - $lineBreak = "\r\n"; - } - return strtr($data, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak)); - } - - /** - * Write given data to this File. - * - * @param string $data Data to write to this File. - * @param string $mode Mode of writing. {@link http://php.net/fwrite See fwrite()}. - * @param bool $force force the file to open - * @return bool Success - * @access public - */ - public function write($data, $mode = 'w', $force = false) - { - $success = false; - if ($this->open($mode, $force) === true) { - if ($this->lock !== null) { - if (flock($this->handle, LOCK_EX) === false) { - return false; - } - } - if (fwrite($this->handle, $data) !== false) { - $success = true; - } - if ($this->lock !== null) { - flock($this->handle, LOCK_UN); - } - } - return $success; - } - - /** - * Append given data string to this File. - * - * @param string $data Data to write - * @param bool $force force the file to open - * @return bool Success - * @access public - */ - public function append($data, $force = false) - { - return $this->write($data, 'a', $force); - } - - /** - * Closes the current file if it is opened. - * - * @return boolean True if closing was successful or file was already closed, otherwise false - * @access public - */ - public function close() - { - if (!is_resource($this->handle)) { - return true; - } - return fclose($this->handle); - } - - /** - * Deletes the File. - * - * @return boolean Success - * @access public - */ - public function delete() - { - if ($this->exists()) { - return unlink($this->pwd()); - } - return false; - } - - /** - * Returns the File extension. - * - * @return string The File extension - * @access public - */ - public function info() - { - if ($this->info == null) { - $this->info = pathinfo($this->pwd()); - } - if (!isset($this->info['filename'])) { - $this->info['filename'] = $this->name(); - } - return $this->info; - } - - /** - * Returns the File extension. - * - * @return string The File extension - * @access public - */ - public function ext() - { - if ($this->info == null) { - $this->info(); - } - if (isset($this->info['extension'])) { - return $this->info['extension']; - } - return false; - } - - /** - * Returns the File name without extension. - * - * @return string The File name without extension. - * @access public - */ - public function name() - { - if ($this->info == null) { - $this->info(); - } - if (isset($this->info['extension'])) { - return basename($this->name, '.' . $this->info['extension']); - } elseif ($this->name) { - return $this->name; - } - return false; - } - - /** - * makes filename safe for saving - * - * @param string $name the name of the file to make safe if different from $this->name - * @param string $ext the extension of the file - * @return mixed - */ - public function safe($name = null, $ext = null) - { - if (!$name) { - $name = $this->name; - } - if (!$ext) { - $ext = $this->ext(); - } - return preg_replace('/[^\w\.-]+/', '_', basename($name, $ext)); - } - - /** - * Get md5 Checksum of file with previous check of Filesize - * - * @param mixed $maxsize in MB or true to force - * @return string md5 Checksum {@link http://php.net/md5_file See md5_file()} - * @access public - */ - public function md5($maxsize = 5) - { - if ($maxsize === true) { - return md5_file($this->pwd()); - } else { - $size = $this->size(); - if ($size && $size < ($maxsize * 1024) * 1024) { - return md5_file($this->pwd()); - } - } - return false; - } - - /** - * Returns the full path of the File. - * - * @return string Full path to file - * @access public - */ - public function pwd() - { - return $this->folder->slashTerm($this->folder->pwd()) . $this->name; - } - - /** - * Returns true if the File exists. - * - * @return bool true if it exists, false otherwise - * @access public - */ - public function exists() - { - $exists = (file_exists($this->pwd()) && is_file($this->pwd())); - return $exists; - } - - /** - * Returns the "chmod" (permissions) of the File. - * - * @return string Permissions for the file - * @access public - */ - public function perms() - { - if ($this->exists()) { - return substr(sprintf('%o', fileperms($this->pwd())), -4); - } - return false; - } - - /** - * Returns the Filesize, either in bytes or in human-readable format. - * - * @return bool|int filesize as int or as a human-readable string - * @access public - */ - public function size() - { - if ($this->exists()) { - return filesize($this->pwd()); - } - return false; - } - - /** - * Returns true if the File is writable. - * - * @return boolean true if its writable, false otherwise - * @access public - */ - public function writable() - { - return is_writable($this->pwd()); - } - - /** - * Returns true if the File is executable. - * - * @return boolean true if its executable, false otherwise - * @access public - */ - public function executable() - { - return is_executable($this->pwd()); - } - - /** - * Returns true if the File is readable. - * - * @return boolean true if file is readable, false otherwise - * @access public - */ - public function readable() - { - return is_readable($this->pwd()); - } - - /** - * Returns the File's owner. - * - * @return int|bool the Fileowner - */ - public function owner() - { - if ($this->exists()) { - return fileowner($this->pwd()); - } - return false; - } - - /** - * Returns the File group. - * - * @return int|bool the Filegroup - * @access public - */ - public function group() - { - if ($this->exists()) { - return filegroup($this->pwd()); - } - return false; - } - - /** - * Returns last access time. - * - * @return int|bool timestamp Timestamp of last access time - * @access public - */ - public function lastAccess() - { - if ($this->exists()) { - return fileatime($this->pwd()); - } - return false; - } - - /** - * Returns last modified time. - * - * @return int|bool timestamp Timestamp of last modification - * @access public - */ - public function lastChange() - { - if ($this->exists()) { - return filemtime($this->pwd()); - } - return false; - } - - /** - * Returns the current folder. - * - * @return XoopsFolderHandler Current folder - * @access public - */ - public function folder() - { - return $this->folder; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/folder.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/folder.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/folder.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -22,778 +22,8 @@ */ /** - * Convenience class for handling directories. - * - * PHP versions 4 and 5 - * - * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project - * @package cake - * @subpackage cake.cake.libs - * @since CakePHP(tm) v 0.2.9 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -/** * Folder structure browser, lists folders and files. - * - * Long description for class - * - * @package cake - * @subpackage cake.cake.libs */ - -class XoopsFolderHandler +class XoopsFolderHandler extends Xoops_Folder { - /** - * Path to Folder. - * - * @var string - * @access public - */ - public $path = null; - - /** - * Sortedness. - * - * @var boolean - * @access public - */ - public $sort = false; - - /** - * mode to be used on create. - * - * @var int|string - * @access public - */ - public $mode = '0755'; - - /** - * holds messages from last method. - * - * @var array - * @access private - */ - private $messages = array(); - - /** - * holds errors from last method. - * - * @var array - * @access private - */ - private $errors = false; - - /** - * holds array of complete directory paths. - * - * @var array - * @access private - */ - private $directories; - - /** - * holds array of complete file paths. - * - * @var array - * @access private - */ - private $files; - - /** - * Constructor. - * - * @param string $path Path to folder - * @param bool $create Create folder if not found - * @param mixed $mode Mode (CHMOD) to apply to created folder, false to ignore - */ - public function __construct($path = '', $create = true, $mode = false) - { - if (empty($path)) { - $path = XOOPS_VAR_PATH . '/caches/xoops_cache'; - } - if ($mode) { - $this->mode = intval($mode, 8); - } - if (!file_exists($path) && $create == true) { - $this->create($path, $this->mode); - } - if (!$this->isAbsolute($path)) { - $path = realpath($path); - } - $this->cd($path); - } - - /** - * Return current path. - * - * @return string Current path - * @access public - */ - public function pwd() - { - return $this->path; - } - - /** - * Change directory to $desired_path. - * - * @param string $path Path to the directory to change to - * @return bool|string The new path. Returns false on failure - * @access public - */ - public function cd($path) - { - $path = $this->realpath($path); - if (is_dir($path) && file_exists($path)) { - return $this->path = $path; - } - return false; - } - - /** - * Returns an array of the contents of the current directory, or false on failure. - * The returned array holds two arrays: one of dirs and one of files. - * - * @param boolean $sort - * @param mixed $exceptions either an array or boolean true will no grab dot files - * @return mixed Contents of current directory as an array, false on failure - * @access public - */ - public function read($sort = true, $exceptions = false) - { - $dirs = $files = array(); - $dir = opendir($this->path); - if ($dir !== false) { - while (false !== ($n = readdir($dir))) { - $item = false; - if (is_array($exceptions)) { - if (!in_array($n, $exceptions)) { - $item = $n; - } - } else { - if ((!preg_match('/^\\.+$/', $n) && $exceptions == false) || ($exceptions == true && !preg_match('/^\\.(.*)$/', $n))) { - $item = $n; - } - } - if ($item !== false) { - if (is_dir($this->addPathElement($this->path, $item))) { - $dirs[] = $item; - } else { - $files[] = $item; - } - } - } - if ($sort || $this->sort) { - sort($dirs); - sort($files); - } - closedir($dir); - } - return array( - $dirs, $files - ); - } - - /** - * Returns an array of all matching files in current directory. - * - * @param string $regexp_pattern Preg_match pattern (Defaults to: .*) - * @param bool $sort - * @return array Files that match given pattern - * @access public - */ - public function find($regexp_pattern = '.*', $sort = false) - { - $data = $this->read($sort); - if (!is_array($data)) { - return array(); - } - list ($dirs, $files) = $data; - $found = array(); - foreach ($files as $file) { - if (preg_match("/^{$regexp_pattern}$/i", $file)) { - $found[] = $file; - } - } - return $found; - } - - /** - * Returns an array of all matching files in and below current directory. - * - * @param string $pattern Preg_match pattern (Defaults to: .*) - * @param bool $sort - * @return array Files matching $pattern - * @access public - */ - public function findRecursive($pattern = '.*', $sort = false) - { - $startsOn = $this->path; - $out = $this->_findRecursive($pattern, $sort); - $this->cd($startsOn); - return $out; - } - - /** - * Private helper function for findRecursive. - * - * @param string $pattern Pattern to match against - * @param bool $sort - * @return array Files matching pattern - * @access private - */ - private function _findRecursive($pattern, $sort = false) - { - list ($dirs, $files) = $this->read($sort); - $found = array(); - foreach ($files as $file) { - if (preg_match("/^{$pattern}$/i", $file)) { - $found[] = $this->addPathElement($this->path, $file); - } - } - $start = $this->path; - foreach ($dirs as $dir) { - $this->cd($this->addPathElement($start, $dir)); - $found = array_merge($found, $this->findRecursive($pattern)); - } - return $found; - } - - /** - * Returns true if given $path is a Windows path. - * - * @param string $path Path to check - * @return boolean true if windows path, false otherwise - * @access public - * @static - */ - static function isWindowsPath($path) - { - if (preg_match('/^[A-Z]:\\\\/i', $path)) { - return true; - } - return false; - } - - /** - * Returns true if given $path is an absolute path. - * - * @param string $path Path to check - * @return bool - * @access public - * @static - */ - static function isAbsolute($path) - { - $match = preg_match('/^\\//', $path) || preg_match('/^[A-Z]:\\//i', $path); - return $match; - } - - /** - * Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.) - * - * @param string $path Path to check - * @return string Set of slashes ("\\" or "/") - * @access public - * @static - */ - static function normalizePath($path) - { - if (self::isWindowsPath($path)) { - return '\\'; - } - return '/'; - } - - /** - * Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.) - * - * @param string $path Path to check - * @return string Set of slashes ("\\" or "/") - * @access public - * @static - */ - static function correctSlashFor($path) - { - if (self::isWindowsPath($path)) { - return '\\'; - } - return '/'; - } - - /** - * Returns $path with added terminating slash (corrected for Windows or other OS). - * - * @param string $path Path to check - * @return string Path with ending slash - * @access public - * @static - */ - static function slashTerm($path) - { - if (self::isSlashTerm($path)) { - return $path; - } - return $path . self::correctSlashFor($path); - } - - /** - * Returns $path with $element added, with correct slash in-between. - * - * @param string $path Path - * @param string $element Element to and at end of path - * @return string Combined path - * @access public - * @static - */ - static function addPathElement($path, $element) - { - return self::slashTerm($path) . $element; - } - - /** - * Returns true if the File is in a given XoopsPath. - * - * @param string $path - * - * @return bool - * @access public - */ - public function inXoopsPath($path = '') - { - $dir = substr($this->slashTerm(XOOPS_ROOT_PATH), 0, -1); - $newdir = $dir . $path; - return $this->inPath($newdir); - } - - /** - * Returns true if the File is in given path. - * - * @param string $path - * @param bool $reverse - * @return bool - */ - public function inPath($path = '', $reverse = false) - { - $dir = $this->slashTerm($path); - $current = $this->slashTerm($this->pwd()); - if (!$reverse) { - $return = preg_match('/^(.*)' . preg_quote($dir, '/') . '(.*)/', $current); - } else { - $return = preg_match('/^(.*)' . preg_quote($current, '/') . '(.*)/', $dir); - } - if ($return == 1) { - return true; - } else { - return false; - } - } - - /** - * Change the mode on a directory structure recursively. - * - * @param string $path The path to chmod - * @param int|bool $mode octal value 0755 - * @param bool $recursive chmod recursively - * @param array $exceptions array of files, directories to skip - * @return bool Returns TRUE on success, FALSE on failure - * @access public - */ - public function chmod($path, $mode = false, $recursive = true, $exceptions = array()) - { - if (!$mode) { - $mode = $this->mode; - } - if ($recursive === false && is_dir($path)) { - if (chmod($path, intval($mode, 8))) { - $this->messages[] = sprintf('%s changed to %s', $path, $mode); - return true; - } else { - $this->errors[] = sprintf('%s NOT changed to %s', $path, $mode); - return false; - } - } - if (is_dir($path)) { - list ($paths) = $this->tree($path); - foreach ($paths as $fullpath) { - $check = explode('/', $fullpath); - $count = count($check); - - if (in_array($check[$count - 1], $exceptions)) { - continue; - } - - if (chmod($fullpath, intval($mode, 8))) { - $this->messages[] = sprintf('%s changed to %s', $fullpath, $mode); - } else { - $this->errors[] = sprintf('%s NOT changed to %s', $fullpath, $mode); - } - } - if (empty($this->errors)) { - return true; - } - } - return false; - } - - /** - * Returns an array of nested directories and files in each directory - * - * @param string $path the directory path to build the tree from - * @param boolean $hidden return hidden files and directories - * @param string $type either file or dir. null returns both files and directories - * @return mixed array of nested directories and files in each directory - * @access public - */ - public function tree($path, $hidden = true, $type = null) - { - $path = rtrim($path, '/'); - $this->files = array(); - $this->directories = array( - $path - ); - $directories = array(); - while (count($this->directories)) { - $dir = array_pop($this->directories); - $this->_tree($dir, $hidden); - array_push($directories, $dir); - } - if ($type === null) { - return array( - $directories, $this->files - ); - } - if ($type === 'dir') { - return $directories; - } - return $this->files; - } - - /** - * Private method to list directories and files in each directory - * - * @param string $path - * @param boolean $hidden - * @access private - */ - private function _tree($path, $hidden) - { - if (is_dir($path)) { - $dirHandle = opendir($path); - while (false !== ($item = readdir($dirHandle))) { - $found = false; - if (($hidden === true && $item != '.' && $item != '..') || ($hidden === false && !preg_match('/^\\.(.*)$/', $item))) { - $found = $path . '/' . $item; - } - if ($found !== false) { - if (is_dir($found)) { - array_push($this->directories, $found); - } else { - array_push($this->files, $found); - } - } - } - closedir($dirHandle); - } - } - - /** - * Create a directory structure recursively. - * - * @param string $pathname The directory structure to create - * @param int|bool $mode octal value 0755 - * @return bool Returns TRUE on success, FALSE on failure - * @access public - */ - public function create($pathname, $mode = false) - { - if (is_dir($pathname) || empty($pathname)) { - return true; - } - if (!$mode) { - $mode = $this->mode; - } - if (is_file($pathname)) { - $this->errors[] = sprintf('%s is a file', $pathname); - return true; - } - $nextPathname = substr($pathname, 0, strrpos($pathname, '/')); - if ($this->create($nextPathname, $mode)) { - if (!file_exists($pathname)) { - if (mkdir($pathname, intval($mode, 8))) { - $this->messages[] = sprintf('%s created', $pathname); - return true; - } else { - $this->errors[] = sprintf('%s NOT created', $pathname); - return false; - } - } - } - return true; - } - - /** - * Returns the size in bytes of this Folder. - * - * @return int - */ - public function dirsize() - { - $size = 0; - $directory = $this->slashTerm($this->path); - $stack = array($directory); - $count = count($stack); - for ($i = 0, $j = $count; $i < $j; ++$i) { - if (is_file($stack[$i])) { - $size += filesize($stack[$i]); - } else { - if (is_dir($stack[$i])) { - $dir = dir($stack[$i]); - if ($dir) { - while (false !== ($entry = $dir->read())) { - if ($entry == '.' || $entry == '..') { - continue; - } - $add = $stack[$i] . $entry; - if (is_dir($stack[$i] . $entry)) { - $add = $this->slashTerm($add); - } - $stack[] = $add; - } - $dir->close(); - } - } - } - $j = count($stack); - } - return $size; - } - - /** - * Recursively Remove directories if system allow. - * - * @param string $path Path of directory to delete - * @return boolean Success - * @access public - */ - public function delete($path) - { - $path = $this->slashTerm($path); - if (is_dir($path) === true) { - $normal_files = glob($path . '*'); - $hidden_files = glob($path . '\.?*'); - $files = array_merge($normal_files, $hidden_files); - if (is_array($files)) { - foreach ($files as $file) { - if (preg_match("/(\.|\.\.)$/", $file)) { - continue; - } - if (is_file($file) === true) { - if (unlink($file)) { - $this->messages[] = sprintf('%s removed', $path); - } else { - $this->errors[] = sprintf('%s NOT removed', $path); - } - } else { - if (is_dir($file) === true) { - if ($this->delete($file) === false) { - return false; - } - } - } - } - } - $path = substr($path, 0, strlen($path) - 1); - if (rmdir($path) === false) { - $this->errors[] = sprintf('%s NOT removed', $path); - return false; - } else { - $this->messages[] = sprintf('%s removed', $path); - } - } - return true; - } - - /** - * Recursive directory copy. - * - * @param array $options (to, from, chmod, skip) - * @return bool - * @access public - */ - public function copy($options = array()) - { - $to = null; - if (is_string($options)) { - $to = $options; - $options = array(); - } - $options = array_merge( - array('to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => array()), $options); - - $fromDir = $options['from']; - $toDir = $options['to']; - $mode = $options['mode']; - if (!$this->cd($fromDir)) { - $this->errors[] = sprintf('%s not found', $fromDir); - return false; - } - if (!is_dir($toDir)) { - mkdir($toDir, $mode); - } - if (!is_writable($toDir)) { - $this->errors[] = sprintf('%s not writable', $toDir); - return false; - } - $exceptions = array_merge(array('.', '..', '.svn'), $options['skip']); - $handle = opendir($fromDir); - if ($handle) { - while (false !== ($item = readdir($handle))) { - if (!in_array($item, $exceptions)) { - $from = $this->addPathElement($fromDir, $item); - $to = $this->addPathElement($toDir, $item); - if (is_file($from)) { - if (copy($from, $to)) { - chmod($to, intval($mode, 8)); - touch($to, filemtime($from)); - $this->messages[] = sprintf('%s copied to %s', $from, $to); - } else { - $this->errors[] = sprintf('%s NOT copied to %s', $from, $to); - } - } - if (is_dir($from) && !file_exists($to)) { - if (mkdir($to, intval($mode, 8))) { - chmod($to, intval($mode, 8)); - $this->messages[] = sprintf('%s created', $to); - $options = array_merge($options, array('to' => $to, 'from' => $from)); - $this->copy($options); - } else { - $this->errors[] = sprintf('%s not created', $to); - } - } - } - } - closedir($handle); - } else { - return false; - } - if (!empty($this->errors)) { - return false; - } - return true; - } - - /** - * Recursive directory move. - * - * @param array $options (to, from, chmod, skip) - * @return boolean Success - * @access public - */ - public function move($options) - { - $to = null; - if (is_string($options)) { - $to = $options; - $options = (array)$options; - } - $options = array_merge( - array('to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => array()), $options); - if ($this->copy($options)) { - if ($this->delete($options['from'])) { - return $this->cd($options['to']); - } - } - return false; - } - - /** - * get messages from latest method - * - * @return array - * @access public - */ - public function messages() - { - return $this->messages; - } - - /** - * get error from latest method - * - * @return array - * @access public - */ - public function errors() - { - return $this->errors; - } - - /** - * Get the real path (taking ".." and such into account) - * - * @param string $path Path to resolve - * @return string The resolved path - */ - public function realpath($path) - { - $path = trim($path); - if (strpos($path, '..') === false) { - if (!$this->isAbsolute($path)) { - $path = $this->addPathElement($this->path, $path); - } - return $path; - } - $parts = explode('/', $path); - $newparts = array(); - $newpath = $path{0} == '/' ? '/' : ''; - while (($part = array_shift($parts)) !== null) { - if ($part == '.' || $part == '') { - continue; - } - if ($part == '..') { - if (count($newparts) > 0) { - array_pop($newparts); - continue; - } else { - return false; - } - } - $newparts[] = $part; - } - $newpath .= implode('/', $newparts); - if (strlen($path > 1) && $path{strlen($path) - 1} == '/') { - $newpath .= '/'; - } - return $newpath; - } - - /** - * Returns true if given $path ends in a slash (i.e. is slash-terminated). - * - * @param string $path Path to check - * @return boolean true if path ends with slash, false otherwise - * @access public - * @static - */ - static function isSlashTerm($path) - { - if (preg_match('/[\/\\\]$/', $path)) { - return true; - } - return false; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/xoopsfile.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/xoopsfile.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/file/xoopsfile.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -45,7 +45,7 @@ { $handler = null; $name = strtolower(trim($name)); - $class = 'Xoops' . ucfirst($name) . 'Handler'; + $class = 'Xoops_' . ucfirst($name); if (in_array($name, array('file', 'folder'))) { $handler = new $class($path, $create, $mode); } else { Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/tplsets/jquery.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/tplsets/jquery.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/tplsets/jquery.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -95,7 +95,7 @@ $restore = ''; } - $file = XoopsFile::getHandler('file', $path_file); + $file = new Xoops_File($path_file); $content = $file->read(); if (empty($content)) { echo _AM_SYSTEM_TEMPLATES_EMPTY_FILE; Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/xlanguage/class/xlanguage.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/xlanguage/class/xlanguage.php 2012-11-30 20:46:21 UTC (rev 10293) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/xlanguage/class/xlanguage.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -99,7 +99,7 @@ { $path_file = $this->configPath . $this->configFile . $this->configFileExt; XoopsLoad::load('XoopsFile'); - $file = XoopsFile::getHandler('file', $path_file); + $file = new Xoops_File($path_file); return eval(@$file->read()); } @@ -117,8 +117,7 @@ { if ($this->CreatePath($this->configPath) ) { $path_file = $this->configPath . $this->configFile . $this->configFileExt; - XoopsLoad::load('XoopsFile'); - $file = XoopsFile::getHandler('file', $path_file); + $file = new Xoops_File($path_file); return $file->write( "return " . var_export($data, true) . ";"); } } Added: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -0,0 +1,114 @@ +<?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. +*/ + +/** + * Cache engine For XOOPS + * + * @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 + * @subpackage cache + * @since 2.3.0 + * @author Taiwen Jiang <ph...@us...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * Abstract class for storage engine for caching + * + * @package core + * @subpackage cache + */ +abstract class Xoops_Cache_Abstract +{ + /** + * settings of current engine instance + * + * @var array + * @access public + */ + public $settings; + + /** + * Initialize the cache engine + * + * Called automatically by the cache frontend + * + * @param array $settings Associative array of parameters for the engine + * @return bool True if the engine has been succesfully initialized, false if not + */ + public function init($settings = array()) + { + $this->settings = array_merge(array('duration' => 31556926, 'probability' => 100), $settings); + return true; + } + + /** + * Garbage collection + * + * Permanently remove all expired and deleted data + * + * @access public + */ + public function gc() + { + } + + /** + * Write value for a key into cache + * + * @param string $key Identifier for the data + * @param mixed $value Data to be cached + * @param mixed $duration How long to cache the data, in seconds + * @return boolean True if the data was successfully cached, false on failure + * @access public + */ + abstract function write($key, &$value, $duration); + + /** + * Read a key from the cache + * + * @param string $key Identifier for the data + * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it + */ + abstract function read($key); + + /** + * Delete a key from the cache + * + * @param string $key Identifier for the data + * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed + * @access public + */ + abstract function delete($key); + + /** + * Delete all keys from the cache + * + * @param boolean $check if true will check expiration, otherwise delete all + * @return boolean True if the cache was successfully cleared, false otherwise + * @access public + */ + abstract function clear($check); + + /** + * Cache Engine settings + * + * @return array settings + * @access public + */ + public function settings() + { + return $this->settings; + } +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Abstract.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -0,0 +1,126 @@ +<?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. +*/ + +/** + * Cache engine For XOOPS + * + * @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 + * @subpackage cache + * @since 2.3.0 + * @author Taiwen Jiang <ph...@us...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * APC storage engine for cache. + * + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> + * Copyright 2005-2008, Cake Software Foundation, Inc. + * 1785 E. Sahara Avenue, Suite 490-204 + * Las Vegas, Nevada 89104 + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.cake.libs.cache + * @since CakePHP(tm) v 1.2.0.4933 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ + +/** + * APC storage engine for cache + * + * @package cake + * @subpackage cake.cake.libs.cache + */ +class Xoops_Cache_Apc extends Xoops_Cache_Abstract +{ + /** + * Initialize the Cache Engine + * + * Called automatically by the cache frontend + * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); + * + * @param array $settings array of setting for the engine + * @return boolean True if the engine has been successfully initialized, false if not + * @see CacheEngine::__defaults + * @access public + */ + public function init($settings = array()) + { + parent::init($settings); + return function_exists('apc_cache_info'); + } + + /** + * Write data for key into cache + * + * @param string $key Identifier for the data + * @param mixed $value Data to be cached + * @param integer $duration How long to cache the data, in seconds + * @return boolean True if the data was successfully cached, false on failure + * @access public + */ + public function write($key, &$value, $duration) + { + return apc_store($key, $value, $duration); + } + + /** + * Read a key from the cache + * + * @param string $key Identifier for the data + * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it + * @access public + */ + public function read($key) + { + return apc_fetch($key); + } + + /** + * Delete a key from the cache + * + * @param string $key Identifier for the data + * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed + * @access public + */ + public function delete($key) + { + return apc_delete($key); + } + + /** + * Delete all keys from the cache + * + * @param boolean $check if true will check expiration, otherwise delete all + * @return boolean True if the cache was successfully cleared, false otherwise + * @access public + */ + public function clear($check) + { + return apc_clear_cache('user'); + } +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/Apc.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Cache/File.php 2012-11-30 22:26:36 UTC (rev 10294) @@ -0,0 +1,321 @@ +<?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. +*/ + +/** + * Cache engine For XOOPS + * + * @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 + * @subpackage cache + * @since 2.3.0 + * @author Taiwen Jiang <ph...@us...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * File Storage engine for cache + * + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> + * Copyright 2005-2008, Cake Software Foundation, Inc. + * 1785 E. Sahara Avenue, Suite 490-204 + * Las Vegas, Nevada 89104 + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.cake.libs.cache + * @since CakePHP(tm) v 1.2.0.4933 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ + +/** + * File Storage engine for cache + * + * @todo use the File and Folder classes (if it's not a too big performance hit) + * @package cake + * @subpackage cake.cake.libs.cache + */ +class Xoops_Cache_File extends Xoops_Cache_Abstract +{ + /** + * Instance of File class + * + * @var Xoops_File + * @access private + */ + private $file = null; + + /** + * settings + ... [truncated message content] |
From: <ma...@us...> - 2012-11-30 20:46:24
|
Revision: 10293 http://sourceforge.net/p/xoops/svn/10293 Author: mageg Date: 2012-11-30 20:46:21 +0000 (Fri, 30 Nov 2012) Log Message: ----------- add search in page module (with search.php) Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php 2012-11-30 20:46:21 UTC (rev 10293) @@ -0,0 +1,57 @@ +<?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. +*/ + +/** + * page module + * + * @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 page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ + +function page_search($queryarray, $andor, $limit, $offset, $userid) +{ + $xoops = Xoops::getInstance(); + $sql = "SELECT content_id, content_title, content_shorttext, content_text, content_author, content_create FROM " . $xoops->db->prefix("page_content") . " WHERE content_status != 0"; + + if ( $userid != 0 ) { + $sql .= " AND content_author=" . intval($userid); + } + + if ( is_array($queryarray) && $count = count($queryarray) ) + { + $sql .= " AND ((content_title LIKE '%$queryarray[0]%' OR content_text LIKE '%$queryarray[0]%' OR content_shorttext LIKE '%$queryarray[0]%')"; + + for ($i=1; $i < $count; $i++) { + $sql .= " $andor "; + $sql .= "(content_title LIKE '%$queryarray[$i]%' OR content_text LIKE '%$queryarray[$i]%' OR content_shorttext LIKE '%$queryarray[$i]%')"; + } + $sql .= ")"; + } + $sql .= " ORDER BY content_create DESC"; + $result = $xoops->db->queryF($sql, $limit, $offset); + + $ret = array(); + $i = 0; + while($myrow = $xoops->db->fetchArray($result)) { + $ret[$i]["image"] = "images/logo_small.png"; + $ret[$i]["link"] = "viewpage.php?id=" . $myrow["content_id"]; + $ret[$i]["title"] = $myrow["content_title"]; + $ret[$i]["time"] = $myrow["content_create"]; + $ret[$i]["content"] = $myrow["content_text"] . $myrow["content_shorttext"]; + $ret[$i]["uid"] = $myrow["content_author"]; + $i++; + } + return $ret; +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL |
From: <ma...@us...> - 2012-11-30 20:44:26
|
Revision: 10292 http://sourceforge.net/p/xoops/svn/10292 Author: mageg Date: 2012-11-30 20:44:24 +0000 (Fri, 30 Nov 2012) Log Message: ----------- add plugin "xoosocialnetwork" in page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2012-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2012-11-30 20:44:24 UTC (rev 10292) @@ -46,13 +46,8 @@ $admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALDISPLAY, '<span class="green">' . $content_display . '</span>'), 'content'); $admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALNOTDISPLAY, '<span class="red">' . $content_notdisplay . '</span>'), 'content'); -// configs -/*$admin_page->addConfigBoxLine($folder_path, 'folder'); -$admin_page->addConfigBoxLine(array($folder_path, '777'), 'chmod'); -$admin_page->addConfigBoxLine($folder_path . '/images', 'folder'); -$admin_page->addConfigBoxLine(array($folder_path . '/images', '777'), 'chmod'); -$admin_page->addConfigBoxLine($folder_path . '/images/category', 'folder'); -$admin_page->addConfigBoxLine(array($folder_path . '/images/category', '777'), 'chmod');*/ +// extension +$admin_page->addConfigBoxLine(array('xoosocialnetwork', 'warning'), 'extension'); $admin_page->renderIndex(); $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-11-30 20:44:24 UTC (rev 10292) @@ -122,7 +122,9 @@ $checkbox->addOption('pdf', _AM_PAGE_CONTENT_DOPDF); $checkbox->addOption('print', _AM_PAGE_CONTENT_DOPRINT); $checkbox->addOption('mail', _AM_PAGE_CONTENT_DOMAIL); - $checkbox->addOption('social', _AM_PAGE_CONTENT_DOSOCIAL); + if ($xoops->isActiveModule('xoosocialnetwork') == true) { + $checkbox->addOption('social', _AM_PAGE_CONTENT_DOSOCIAL); + } $checkbox->setDescription(_AM_PAGE_CONTENT_OPTIONS_DSC); $this->addElement($checkbox); //maindisplay Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html 2012-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html 2012-11-30 20:44:24 UTC (rev 10292) @@ -43,7 +43,11 @@ <{$content_shorttext}> <br /> <{$content_text}> - + <{if $navigation}> + <div class="clear"></div> + <{includeq file="module:page|page_navigation.html"}> + <div class="clear"></div> + <{/if}> </div> <{if $content_dofooter}> <div class="page_footer"> @@ -58,8 +62,6 @@ <{/if}> </div> <{/if}> -<{if $navigation}> - <div class="clear"></div> - <{includeq file="module:page|page_navigation.html"}> - <div class="clear"></div> +<{if $content_dosocial}> +<{includeq file='module:xoosocialnetwork|xoosocialnetwork.html'}> <{/if}> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php 2012-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php 2012-11-30 20:44:24 UTC (rev 10292) @@ -108,6 +108,7 @@ $xoopsTpl->assign('content_dohits', $view_content->getVar('content_dohits')); $xoopsTpl->assign('content_dorating', $view_content->getVar('content_dorating')); $xoopsTpl->assign('content_dotitle', $view_content->getVar('content_dotitle')); +$xoopsTpl->assign('content_dosocial', $view_content->getVar('content_dosocial')); $xoopsTpl->assign('content_donotifications', $view_content->getVar('content_donotifications')); $xoopsTpl->assign('content_docoms', $view_content->getVar('content_docoms')); if ($view_content->getVar('content_docoms') == false){ |
From: <ma...@us...> - 2012-11-30 20:27:39
|
Revision: 10291 http://sourceforge.net/p/xoops/svn/10291 Author: mageg Date: 2012-11-30 20:27:36 +0000 (Fri, 30 Nov 2012) Log Message: ----------- add extension or module config in moduleadmin Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/moduleadmin.php XoopsCore/branches/2.6.x/2.6.0/htdocs/language/english/admin.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/templates/admin/admin_index.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/moduleadmin.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/moduleadmin.php 2012-11-30 19:51:57 UTC (rev 10290) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/moduleadmin.php 2012-11-30 20:27:36 UTC (rev 10291) @@ -129,6 +129,38 @@ } } break; + + case "extension": + $xoops = Xoops::getInstance(); + if (is_array($value)) { + $text = $value[0]; + $type = $value[1]; + } else { + $text = $value; + $type = 'error'; + } + if ($xoops->isActiveModule($value) == false) { + $this->_itemConfigBoxLine[] = array('type' => $type, 'text' => sprintf(_AM_MODULEADMIN_CONFIG_EXTENSIONKO, $text)); + } else { + $this->_itemConfigBoxLine[] = array('type' => 'accept', 'text' => sprintf(_AM_MODULEADMIN_CONFIG_EXTENSIONOK, $text)); + } + break; + + case "module": + $xoops = Xoops::getInstance(); + if (is_array($value)) { + $text = $value[0]; + $type = $value[1]; + } else { + $text = $value; + $type = 'error'; + } + if ($xoops->isActiveModule($value) == false) { + $this->_itemConfigBoxLine[] = array('type' => $type, 'text' => sprintf(_AM_MODULEADMIN_CONFIG_MODULEKO, $text)); + } else { + $this->_itemConfigBoxLine[] = array('type' => 'accept', 'text' => sprintf(_AM_MODULEADMIN_CONFIG_MODULEOK, $text)); + } + break; } return true; } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/language/english/admin.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/language/english/admin.php 2012-11-30 19:51:57 UTC (rev 10290) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/language/english/admin.php 2012-11-30 20:27:36 UTC (rev 10291) @@ -29,6 +29,10 @@ define('_AM_MODULEADMIN_CONFIG_PHP','Minimum PHP required: %s (your version is %s)'); define('_AM_MODULEADMIN_CONFIG_XOOPS','Minimum XOOPS required: %s (your version is %s)'); define('_AM_MODULEADMIN_CONFIG_DB','minimum version required: %s (your version is %s)'); +define('_AM_MODULEADMIN_CONFIG_EXTENSIONKO',"The extension '%s' isn't installed"); +define('_AM_MODULEADMIN_CONFIG_EXTENSIONOK',"The extension '%s' is installed"); +define('_AM_MODULEADMIN_CONFIG_MODULEKO',"The module '%s' isn't installed"); +define('_AM_MODULEADMIN_CONFIG_MODULEOK',"The module '%s' is installed"); // About define('_AM_MODULEADMIN_ABOUT_CHANGELOG','Change log'); define('_AM_MODULEADMIN_ABOUT_DESCRIPTION','Description:'); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/templates/admin/admin_index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/templates/admin/admin_index.html 2012-11-30 19:51:57 UTC (rev 10290) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/templates/admin/admin_index.html 2012-11-30 20:27:36 UTC (rev 10291) @@ -28,6 +28,10 @@ <li class="red"> <span class="ico ico-cross"></span> <{$config.text}> </li> + <{elseif $config.type == 'warning'}> + <li class="orange"> + <span class="ico ico-warning"></span> <{$config.text}> + </li> <{else}> <li class="green"> <span class="ico ico-tick"></span> <{$config.text}> |
From: <tr...@us...> - 2012-11-30 19:52:00
|
Revision: 10290 http://sourceforge.net/p/xoops/svn/10290 Author: trabis Date: 2012-11-30 19:51:57 +0000 (Fri, 30 Nov 2012) Log Message: ----------- Fixing name of class Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php 2012-11-30 00:58:48 UTC (rev 10289) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php 2012-11-30 19:51:57 UTC (rev 10290) @@ -21,6 +21,6 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); -class Xoops_Database_AbstractFactory extends Xoops_Database_Factory +class XoopsDatabaseFactory extends Xoops_Database_Factory { } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php 2012-11-30 00:58:48 UTC (rev 10289) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php 2012-11-30 19:51:57 UTC (rev 10290) @@ -21,6 +21,6 @@ * @version $Id$ */ -class Xoops_Database_AbstractManager extends Xoops_Database_Mysql_Manager +class XoopsDatabaseManager extends Xoops_Database_Mysql_Manager { } \ No newline at end of file |
From: <tr...@us...> - 2012-11-30 00:58:54
|
Revision: 10289 http://sourceforge.net/p/xoops/svn/10289 Author: trabis Date: 2012-11-30 00:58:48 +0000 (Fri, 30 Nov 2012) Log Message: ----------- Updating dugris fix for groupby and moving auth classes Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/checklogin.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria/Element.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Stats.php XoopsCore/branches/2.6.x/2.6.0_trabis/upgrade/login.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ads.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Factory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ldap.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Provisioning.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Xoops.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth.php Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -31,87 +31,6 @@ * @author Pierre-Eric MENUET <pe...@fr...> * @copyright copyright (c) 2000-2003 XOOPS.org */ -class XoopsAuth +class XoopsAuth extends Xoops_Auth { - /** - * @var XoopsDatase|null - */ - protected $_dao; - - /** - * @var array - */ - protected $_errors; - - /** - * @var string - */ - protected $auth_method; - - /** - * Authentication Service constructor - * - * @param Xoops_Database_Abstract|null $dao - */ - public function __construct($dao) - { - $this->_dao = $dao; - } - - /** - * need to be write in the derived class - * - * @return bool - */ - public function authenticate() - { - $authenticated = false; - return $authenticated; - } - - /** - * @param int $err_no - * @param string $err_str - * @return void - */ - public function setErrors($err_no, $err_str) - { - $this->_errors[$err_no] = trim($err_str); - } - - /** - * return the errors for this object as an array - * - * @return array an array of errors - * @access public - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * return the errors for this object as html - * - * @return string html listing the errors - * @access public - */ - public function getHtmlErrors() - { - $xoops = Xoops::getInstance(); - $ret = '<br />'; - if ($xoops->getConfig('debug_mode') == 1 || $xoops->getConfig('debug_mode') == 2) { - if (!empty($this->_errors)) { - foreach ($this->_errors as $errstr) { - $ret .= $errstr . '<br/>'; - } - } else { - $ret .= _NONE . '<br />'; - } - $ret .= sprintf(_AUTH_MSG_AUTH_METHOD, $this->auth_method); - } else { - $ret .= _US_INCORRECTLOGIN; - } - return $ret; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -32,83 +32,6 @@ * @author Pierre-Eric MENUET <pe...@fr...> * @copyright copyright (c) 2000-2003 XOOPS.org */ -class XoopsAuthAds extends XoopsAuthLdap +class XoopsAuthAds extends Xoops_Auth_Ads { - /** - * Authentication Service constructor - * - * @param Xoops_Database_Abstract|null $dao - * @return void - */ - public function _construct(Xoops_Database_Abstract $dao = null) - { - parent::__construct($dao); - } - - /** - * Authenticate user again LDAP directory (Bind) - * 2 options : - * Authenticate directly with uname in the DN - * Authenticate with manager, search the dn - * - * @param string $uname Username - * @param string $pwd Password - * @return bool - */ - public function authenticate($uname, $pwd = null) - { - $authenticated = false; - if (!extension_loaded('ldap')) { - $this->setErrors(0, _AUTH_LDAP_EXTENSION_NOT_LOAD); - return $authenticated; - } - $this->_ds = ldap_connect($this->ldap_server, $this->ldap_port); - if ($this->_ds) { - ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version); - ldap_set_option($this->_ds, LDAP_OPT_REFERRALS, 0); - if ($this->ldap_use_TLS) { // We use TLS secure connection - if (!ldap_start_tls($this->_ds)) { - $this->setErrors(0, _AUTH_LDAP_START_TLS_FAILED); - } - } - // If the uid is not in the DN we proceed to a search - // The uid is not always in the dn - $userUPN = $this->getUPN($uname); - if (!$userUPN) { - return false; - } - // We bind as user to test the credentials - $authenticated = ldap_bind($this->_ds, $userUPN, $this->cp1252_to_utf8(stripslashes($pwd))); - if ($authenticated) { - // We load the Xoops User database - $dn = $this->getUserDN($uname); - if ($dn) { - return $this->loadXoopsUser($dn, $uname, $pwd); - } else { - return false; - } - } else { - $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userUPN . ')'); - } - } else { - $this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND); - } - @ldap_close($this->_ds); - return $authenticated; - } - - /** - * Return the UPN = userPrincipalName (Active Directory) - * userPrincipalName = gu...@CP... Often abbreviated to UPN, and - * looks like an email address. Very useful for logging on especially in - * a large Forest. Note UPN must be unique in the forest. - * - * @param $uname - * @return string userDN - */ - public function getUPN($uname) - { - $userDN = $uname . '@' . $this->ldap_domain_name; - return $userDN; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -32,310 +32,6 @@ * @author Pierre-Eric MENUET <pe...@fr...> * @copyright copyright (c) 2000-2003 XOOPS.org */ -class XoopsAuthLdap extends XoopsAuth +class XoopsAuthLdap extends Xoops_Auth_Ldap { - public $cp1252_map = array( - "\xc2\x80" => "\xe2\x82\xac", /** - * EURO SIGN - */ - "\xc2\x82" => "\xe2\x80\x9a", /** - * SINGLE LOW-9 QUOTATION MARK - */ - "\xc2\x83" => "\xc6\x92", /** - * LATIN SMALL LETTER F WITH HOOK - */ - "\xc2\x84" => "\xe2\x80\x9e", /** - * DOUBLE LOW-9 QUOTATION MARK - */ - "\xc2\x85" => "\xe2\x80\xa6", /** - * HORIZONTAL ELLIPSIS - */ - "\xc2\x86" => "\xe2\x80\xa0", /** - * DAGGER - */ - "\xc2\x87" => "\xe2\x80\xa1", /** - * DOUBLE DAGGER - */ - "\xc2\x88" => "\xcb\x86", /** - * MODIFIER LETTER CIRCUMFLEX ACCENT - */ - "\xc2\x89" => "\xe2\x80\xb0", /** - * PER MILLE SIGN - */ - "\xc2\x8a" => "\xc5\xa0", /** - * LATIN CAPITAL LETTER S WITH CARON - */ - "\xc2\x8b" => "\xe2\x80\xb9", /** - * SINGLE LEFT-POINTING ANGLE QUOTATION - */ - "\xc2\x8c" => "\xc5\x92", /** - * LATIN CAPITAL LIGATURE OE - */ - "\xc2\x8e" => "\xc5\xbd", /** - * LATIN CAPITAL LETTER Z WITH CARON - */ - "\xc2\x91" => "\xe2\x80\x98", /** - * LEFT SINGLE QUOTATION MARK - */ - "\xc2\x92" => "\xe2\x80\x99", /** - * RIGHT SINGLE QUOTATION MARK - */ - "\xc2\x93" => "\xe2\x80\x9c", /** - * LEFT DOUBLE QUOTATION MARK - */ - "\xc2\x94" => "\xe2\x80\x9d", /** - * RIGHT DOUBLE QUOTATION MARK - */ - "\xc2\x95" => "\xe2\x80\xa2", /** - * BULLET - */ - "\xc2\x96" => "\xe2\x80\x93", /** - * EN DASH - */ - "\xc2\x97" => "\xe2\x80\x94", /** - * EM DASH - */ - "\xc2\x98" => "\xcb\x9c", /** - * SMALL TILDE - */ - "\xc2\x99" => "\xe2\x84\xa2", /** - * TRADE MARK SIGN - */ - "\xc2\x9a" => "\xc5\xa1", /** - * LATIN SMALL LETTER S WITH CARON - */ - "\xc2\x9b" => "\xe2\x80\xba", /** - * SINGLE RIGHT-POINTING ANGLE QUOTATION - */ - "\xc2\x9c" => "\xc5\x93", /** - * LATIN SMALL LIGATURE OE - */ - "\xc2\x9e" => "\xc5\xbe", /** - * LATIN SMALL LETTER Z WITH CARON - */ - "\xc2\x9f" => "\xc5\xb8" - ); - /** - * LATIN CAPITAL LETTER Y WITH DIAERESIS - */ - - /** - * @var - */ - public $ldap_server; - - /** - * @var string - */ - - public $ldap_port = '389'; - /** - * @var string - */ - public $ldap_version = '3'; - - /** - * @var - */ - public $ldap_base_dn; - - /** - * @var - */ - public $ldap_loginname_asdn; - - /** - * @var - */ - public $ldap_loginldap_attr; - - /** - * @var - */ - public $ldap_mail_attr; - - /** - * @var - */ - public $ldap_name_attr; - - /** - * @var - */ - public $ldap_surname_attr; - - /** - * @var - */ - public $ldap_givenname_attr; - - /** - * @var - */ - public $ldap_manager_dn; - - /** - * @var - */ - public $ldap_manager_pass; - - /** - * @var - */ - public $_ds; - - /** - * @var - */ - public $ldap_use_TLS; - - /** - * @var - */ - public $ldap_domain_name; - - /** - * @var - */ - public $ldap_filter_person; - - /** - * Authentication Service constructor - * - * @param Xoops_Database_Abstract|null $dao - */ - public function __construct(Xoops_Database_Abstract $dao = null) - { - $xoops = Xoops::getInstance(); - $this->_dao = $dao; - //Configuration options that are stored in the database - $configs = $xoops->getConfigs(XOOPS_CONF_AUTH); - foreach ($configs as $key => $val) { - $this->$key = $val; - } - } - - /** - * XoopsAuthLdap::cp1252_to_utf8() - * - * @param string $str - * @return string - */ - public function cp1252_to_utf8($str) - { - return strtr(utf8_encode($str), $this->cp1252_map); - } - - /** - * Authenticate user again LDAP directory (Bind) - * 2 options : - * Authenticate directly with uname in the DN - * Authenticate with manager, search the dn - * - * @param string $uname Username - * @param string $pwd Password - * @return bool - */ - public function authenticate($uname, $pwd = null) - { - $authenticated = false; - if (!extension_loaded('ldap')) { - $this->setErrors(0, _AUTH_LDAP_EXTENSION_NOT_LOAD); - return $authenticated; - } - $this->_ds = ldap_connect($this->ldap_server, $this->ldap_port); - if ($this->_ds) { - ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version); - if ($this->ldap_use_TLS) { // We use TLS secure connection - if (!ldap_start_tls($this->_ds)) { - $this->setErrors(0, _AUTH_LDAP_START_TLS_FAILED); - } - } - // If the uid is not in the DN we proceed to a search - // The uid is not always in the dn - $userDN = $this->getUserDN($uname); - if (!$userDN) { - return false; - } - // We bind as user to test the credentials - $authenticated = ldap_bind($this->_ds, $userDN, stripslashes($pwd)); - if ($authenticated) { - // We load the Xoops User database - return $this->loadXoopsUser($userDN, $uname, $pwd); - } else { - $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userDN . ')'); - } - } else { - $this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND); - } - @ldap_close($this->_ds); - return $authenticated; - } - - /** - * Compose the user DN with the configuration. - * - * @param $uname - * @return bool|string userDN or false - */ - public function getUserDN($uname) - { - $userDN = false; - if (!$this->ldap_loginname_asdn) { - // Bind with the manager - if (!ldap_bind($this->_ds, $this->ldap_manager_dn, stripslashes($this->ldap_manager_pass))) { - $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $this->ldap_manager_dn . ')'); - return false; - } - $filter = $this->getFilter($uname); - $sr = ldap_search($this->_ds, $this->ldap_base_dn, $filter); - $info = ldap_get_entries($this->_ds, $sr); - if ($info['count'] > 0) { - $userDN = $info[0]['dn']; - } else { - $this->setErrors(0, sprintf(_AUTH_LDAP_USER_NOT_FOUND, $uname, $filter, $this->ldap_base_dn)); - } - } else { - $userDN = $this->ldap_loginldap_attr . '=' . $uname . ',' . $this->ldap_base_dn; - } - return $userDN; - } - - /** - * Load user from XOOPS Database - * - * @param string $uname - * @return mixed|string - */ - public function getFilter($uname) - { - if ($this->ldap_filter_person != '') { - $filter = str_replace('@@loginname@@', $uname, $this->ldap_filter_person); - } else { - $filter = $this->ldap_loginldap_attr . '=' . $uname; - } - return $filter; - } - - /** - * XoopsAuthLdap::loadXoopsUser() - * - * @param string $userdn - * @param string $uname - * @param string $pwd - * @return bool|XoopsUser - */ - public function loadXoopsUser($userdn, $uname, $pwd = null) - { - $xoopsUser = false; - $provisHandler = XoopsAuthProvisionning::getInstance($this); - $sr = ldap_read($this->_ds, $userdn, '(objectclass=*)'); - $entries = ldap_get_entries($this->_ds, $sr); - if ($entries['count'] > 0) { - $xoopsUser = $provisHandler->sync($entries[0], $uname, $pwd); - } else { - $this->setErrors(0, sprintf('loadXoopsUser - ' . _AUTH_LDAP_CANT_READ_ENTRY, $userdn)); - } - return $xoopsUser; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -32,221 +32,6 @@ * @author Pierre-Eric MENUET <pe...@fr...> * @copyright copyright (c) 2000-2003 XOOPS.org */ -class XoopsAuthProvisionning +class XoopsAuthProvisionning extends Xoops_Auth_Provisioning { - /** - * @var XoopsAuth - */ - protected $_auth_instance; - - /** - * @var bool - */ - public $ldap_provisionning; - - /** - * @var bool - */ - public $ldap_provisionning_upd; - - /** - * var array - */ - public $ldap_field_mapping; - - /** - * @var array - */ - public $ldap_provisionning_group; - - /** - * XoopsAuthProvisionning::getInstance() - * - * @static - * @param XoopsAuth $auth_instance - * @return XoopsAuthProvisionning - */ - static function getInstance(XoopsAuth &$auth_instance) - { - static $provis_instance; - if (!isset($provis_instance)) { - $provis_instance = new XoopsAuthProvisionning($auth_instance); - } - return $provis_instance; - } - - /** - * Authentication Service constructor - * - * @param XoopsAuth $auth_instance - */ - public function __construct(XoopsAuth &$auth_instance) - { - $xoops = Xoops::getInstance(); - $this->_auth_instance = $auth_instance; - $configs = $xoops->getConfigs(XOOPS_CONF_AUTH); - foreach ($configs as $key => $val) { - $this->$key = $val; - } - $config_gen = $xoops->getConfigs(XOOPS_CONF); - $this->default_TZ = $config_gen['default_TZ']; - $this->theme_set = $config_gen['theme_set']; - $this->com_mode = $config_gen['com_mode']; - $this->com_order = $config_gen['com_order']; - } - - /** - * Return a Xoops User Object - * - * @param $uname - * @return bool|XoopsUser - */ - public function getXoopsUser($uname) - { - $xoops = Xoops::getInstance(); - $member_handler = $xoops->getHandlerMember(); - $criteria = new Xoops_Criteria('uname', $uname); - $getuser = $member_handler->getUsers($criteria); - if (count($getuser) == 1) { - return $getuser[0]; - } else { - return false; - } - } - - /** - * Launch the synchronisation process - * - * @param $datas - * @param $uname - * @param null $pwd - * @return bool|XoopsUser - */ - public function sync($datas, $uname, $pwd = null) - { - $xoopsUser = $this->getXoopsUser($uname); - if (!$xoopsUser) { // Xoops User Database not exists - if ($this->ldap_provisionning) { - $xoopsUser = $this->add($datas, $uname, $pwd); - } else { - $this->_auth_instance->setErrors(0, sprintf(_AUTH_LDAP_XOOPS_USER_NOTFOUND, $uname)); - } - } else { // Xoops User Database exists - if ($this->ldap_provisionning && $this->ldap_provisionning_upd) { - $xoopsUser = $this->change($xoopsUser, $datas, $uname, $pwd); - } - } - return $xoopsUser; - } - - /** - * Add a new user to the system - * - * @return bool - */ - /** - * @param array $datas - * @param string $uname - * @param string $pwd - * @return bool|XoopsUser - */ - public function add($datas, $uname, $pwd = null) - { - $xoops = Xoops::getInstance(); - $ret = false; - $member_handler = $xoops->getHandlerMember(); - // Create XOOPS Database User - $newuser = $member_handler->createUser(); - $newuser->setVar('uname', $uname); - $newuser->setVar('pass', md5(stripslashes($pwd))); - $newuser->setVar('rank', 0); - $newuser->setVar('level', 1); - $newuser->setVar('timezone_offset', $this->default_TZ); - $newuser->setVar('theme', $this->theme_set); - $newuser->setVar('umode', $this->com_mode); - $newuser->setVar('uorder', $this->com_order); - $tab_mapping = explode('|', $this->ldap_field_mapping); - foreach ($tab_mapping as $mapping) { - $fields = explode('=', trim($mapping)); - if ($fields[0] && $fields[1]) { - $newuser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0])); - } - } - if ($member_handler->insertUser($newuser)) { - foreach ($this->ldap_provisionning_group as $groupid) { - $member_handler->addUserToGroup($groupid, $newuser->getVar('uid')); - } - $newuser->unsetNew(); - return $newuser; - } else { - $xoops->redirect(XOOPS_URL . '/user.php', 5, $newuser->getHtmlErrors()); - } - return $ret; - } - - /** - * Modify user information - * - * @param XoopsUser $xoopsUser - * @param array $datas - * @param string $uname - * @param string $pwd - * @return bool|XoopsUser - */ - public function change(XoopsUser &$xoopsUser, $datas, $uname, $pwd = null) - { - $xoops = Xoops::getInstance(); - $ret = false; - $member_handler = $xoops->getHandlerMember(); - $xoopsUser->setVar('pass', md5(stripslashes($pwd))); - $tab_mapping = explode('|', $this->ldap_field_mapping); - foreach ($tab_mapping as $mapping) { - $fields = explode('=', trim($mapping)); - if ($fields[0] && $fields[1]) { - $xoopsUser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0])); - } - } - if ($member_handler->insertUser($xoopsUser)) { - return $xoopsUser; - } else { - $xoops->redirect(XOOPS_URL . '/user.php', 5, $xoopsUser->getHtmlErrors()); - } - return $ret; - } - - /** - * Modify a user - * - * @return bool - */ - public function delete() - { - } - - /** - * Suspend a user - * - * @return bool - */ - public function suspend() - { - } - - /** - * Restore a user - * - * @return bool - */ - public function restore() - { - } - - /** - * Add a new user to the system - * - * @return bool - */ - public function resetpwd() - { - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -31,34 +31,6 @@ * @author Pierre-Eric MENUET <pe...@fr...> * @copyright copyright (c) 2000-2003 XOOPS.org */ -class XoopsAuthXoops extends XoopsAuth +class XoopsAuthXoops extends Xoops_Auth_Xoops { - /** - * Authentication Service constructor - * - * @param Xoops_Database_Abstract|null $dao - */ - public function __construct(Xoops_Database_Abstract $dao = null) - { - $this->_dao = $dao; - $this->auth_method = 'xoops'; - } - - /** - * Authenticate user - * - * @param string $uname - * @param string $pwd - * @return bool - */ - public function authenticate($uname, $pwd = null) - { - $xoops = Xoops::getInstance(); - $member_handler = $xoops->getHandlerMember(); - $user = $member_handler->loginUser($uname, $pwd); - if ($user == false) { - $this->setErrors(1, _US_INCORRECTLOGIN); - } - return $user; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -31,57 +31,6 @@ * @author Pierre-Eric MENUET <pe...@fr...> * @copyright copyright (c) 2000-2005 XOOPS.org */ -class XoopsAuthFactory +class XoopsAuthFactory extends Xoops_Auth_Factory { - /** - * Get a reference to the only instance of authentication class - * - * if the class has not been instantiated yet, this will also take - * care of that - * - * @param string $uname - * @return XoopsAuth|bool Reference to the only instance of authentication class - */ - static function getAuthConnection($uname) - { - $xoops = Xoops::getInstance(); - static $auth_instance; - if (!isset($auth_instance)) { - /* @var $config_handler XoopsConfigHandler */ - $authConfig = $xoops->getConfigs(XOOPS_CONF_AUTH); - if (empty($authConfig['auth_method'])) { // If there is a config error, we use xoops - $xoops_auth_method = 'xoops'; - } else { - $xoops_auth_method = $authConfig['auth_method']; - } - // Verify if uname allow to bypass LDAP auth - if (in_array($uname, $authConfig['ldap_users_bypass'])) { - $xoops_auth_method = 'xoops'; - } - - $ret = include_once $xoops->path('class/auth/auth_' . $xoops_auth_method . '.php'); - if ($ret == false) { - return false; - } - - $class = 'XoopsAuth' . ucfirst($xoops_auth_method); - if (!class_exists($class)) { - trigger_error(_XO_ER_CLASSNOTFOUND, E_USER_ERROR); - return false; - } - switch ($xoops_auth_method) { - case 'xoops': - $dao = Xoops_Database_Factory::getDatabaseConnection(); - break; - case 'ldap': - $dao = null; - break; - case 'ads': - $dao = null; - break; - } - $auth_instance = new $class($dao); - } - return $auth_instance; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/checklogin.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/checklogin.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/checklogin.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -34,7 +34,7 @@ $xoops->loadLanguage('auth'); -$xoopsAuth = XoopsAuthFactory::getAuthConnection($myts->addSlashes($uname)); +$xoopsAuth = Xoops_Auth_Factory::getAuthConnection($myts->addSlashes($uname)); $user = $xoopsAuth->authenticate($myts->addSlashes($uname), $myts->addSlashes($pass)); if (false != $user) { Copied: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ads.php (from rev 10288, XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ads.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ads.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -0,0 +1,114 @@ +<?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 Authentication Active directory class + * + * @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 + * @subpackage auth + * @since 2.0 + * @author Pierre-Eric MENUET <pe...@fr...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * XoopsAuthAds + * + * @package class + * @subpackage auth + * @description Authentication class for Active Directory + * @author Pierre-Eric MENUET <pe...@fr...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ +class Xoops_Auth_Ads extends Xoops_Auth_Ldap +{ + /** + * Authentication Service constructor + * + * @param Xoops_Database_Abstract|null $dao + * @return void + */ + public function _construct(Xoops_Database_Abstract $dao = null) + { + parent::__construct($dao); + } + + /** + * Authenticate user again LDAP directory (Bind) + * 2 options : + * Authenticate directly with uname in the DN + * Authenticate with manager, search the dn + * + * @param string $uname Username + * @param string $pwd Password + * @return bool + */ + public function authenticate($uname, $pwd = null) + { + $authenticated = false; + if (!extension_loaded('ldap')) { + $this->setErrors(0, _AUTH_LDAP_EXTENSION_NOT_LOAD); + return $authenticated; + } + $this->_ds = ldap_connect($this->ldap_server, $this->ldap_port); + if ($this->_ds) { + ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version); + ldap_set_option($this->_ds, LDAP_OPT_REFERRALS, 0); + if ($this->ldap_use_TLS) { // We use TLS secure connection + if (!ldap_start_tls($this->_ds)) { + $this->setErrors(0, _AUTH_LDAP_START_TLS_FAILED); + } + } + // If the uid is not in the DN we proceed to a search + // The uid is not always in the dn + $userUPN = $this->getUPN($uname); + if (!$userUPN) { + return false; + } + // We bind as user to test the credentials + $authenticated = ldap_bind($this->_ds, $userUPN, $this->cp1252_to_utf8(stripslashes($pwd))); + if ($authenticated) { + // We load the Xoops User database + $dn = $this->getUserDN($uname); + if ($dn) { + return $this->loadXoopsUser($dn, $uname, $pwd); + } else { + return false; + } + } else { + $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userUPN . ')'); + } + } else { + $this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND); + } + @ldap_close($this->_ds); + return $authenticated; + } + + /** + * Return the UPN = userPrincipalName (Active Directory) + * userPrincipalName = gu...@CP... Often abbreviated to UPN, and + * looks like an email address. Very useful for logging on especially in + * a large Forest. Note UPN must be unique in the forest. + * + * @param $uname + * @return string userDN + */ + public function getUPN($uname) + { + $userDN = $uname . '@' . $this->ldap_domain_name; + return $userDN; + } +} \ No newline at end of file Copied: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Factory.php (from rev 10288, XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Factory.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Factory.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -0,0 +1,87 @@ +<?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. +*/ + +/** + * Authentication class factory + * + * @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 + * @subpackage auth + * @since 2.0 + * @author Pierre-Eric MENUET <pe...@fr...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * + * @package kernel + * @subpackage auth + * @description Authentication class factory + * @author Pierre-Eric MENUET <pe...@fr...> + * @copyright copyright (c) 2000-2005 XOOPS.org + */ +class Xoops_Auth_Factory +{ + /** + * Get a reference to the only instance of authentication class + * + * if the class has not been instantiated yet, this will also take + * care of that + * + * @param string $uname + * @return Xoops_Auth|bool Reference to the only instance of authentication class + */ + static function getAuthConnection($uname) + { + $xoops = Xoops::getInstance(); + static $auth_instance; + if (!isset($auth_instance)) { + /* @var $config_handler XoopsConfigHandler */ + $authConfig = $xoops->getConfigs(XOOPS_CONF_AUTH); + if (empty($authConfig['auth_method'])) { // If there is a config error, we use xoops + $xoops_auth_method = 'xoops'; + } else { + $xoops_auth_method = $authConfig['auth_method']; + } + // Verify if uname allow to bypass LDAP auth + if (in_array($uname, $authConfig['ldap_users_bypass'])) { + $xoops_auth_method = 'xoops'; + } + + if (!file_exists($file = dirname(__FILE__) . DIRECTORY_SEPARATOR . ucfirst($xoops_auth_method) . '.php')) { + return false; + } + include_once $file; + $class = 'Xoops_Auth_' . ucfirst($xoops_auth_method); + if (!class_exists($class)) { + trigger_error(_XO_ER_CLASSNOTFOUND, E_USER_ERROR); + return false; + } + $dao = null; + switch ($xoops_auth_method) { + case 'xoops': + $dao = Xoops_Database_Factory::getDatabaseConnection(); + break; + case 'ldap': + $dao = null; + break; + case 'ads': + $dao = null; + break; + } + $auth_instance = new $class($dao); + } + return $auth_instance; + } +} \ No newline at end of file Copied: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ldap.php (from rev 10288, XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ldap.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Ldap.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -0,0 +1,341 @@ +<?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 Authentication Ldap class + * + * @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 + * @subpackage auth + * @since 2.0 + * @author Pierre-Eric MENUET <pe...@fr...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * Xoops_Auth_Ldap + * + * @package class + * @subpackage auth + * @description Authentication class for standard LDAP Server V2 or V3 + * @author Pierre-Eric MENUET <pe...@fr...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ +class Xoops_Auth_Ldap extends Xoops_Auth +{ + public $cp1252_map = array( + "\xc2\x80" => "\xe2\x82\xac", /** + * EURO SIGN + */ + "\xc2\x82" => "\xe2\x80\x9a", /** + * SINGLE LOW-9 QUOTATION MARK + */ + "\xc2\x83" => "\xc6\x92", /** + * LATIN SMALL LETTER F WITH HOOK + */ + "\xc2\x84" => "\xe2\x80\x9e", /** + * DOUBLE LOW-9 QUOTATION MARK + */ + "\xc2\x85" => "\xe2\x80\xa6", /** + * HORIZONTAL ELLIPSIS + */ + "\xc2\x86" => "\xe2\x80\xa0", /** + * DAGGER + */ + "\xc2\x87" => "\xe2\x80\xa1", /** + * DOUBLE DAGGER + */ + "\xc2\x88" => "\xcb\x86", /** + * MODIFIER LETTER CIRCUMFLEX ACCENT + */ + "\xc2\x89" => "\xe2\x80\xb0", /** + * PER MILLE SIGN + */ + "\xc2\x8a" => "\xc5\xa0", /** + * LATIN CAPITAL LETTER S WITH CARON + */ + "\xc2\x8b" => "\xe2\x80\xb9", /** + * SINGLE LEFT-POINTING ANGLE QUOTATION + */ + "\xc2\x8c" => "\xc5\x92", /** + * LATIN CAPITAL LIGATURE OE + */ + "\xc2\x8e" => "\xc5\xbd", /** + * LATIN CAPITAL LETTER Z WITH CARON + */ + "\xc2\x91" => "\xe2\x80\x98", /** + * LEFT SINGLE QUOTATION MARK + */ + "\xc2\x92" => "\xe2\x80\x99", /** + * RIGHT SINGLE QUOTATION MARK + */ + "\xc2\x93" => "\xe2\x80\x9c", /** + * LEFT DOUBLE QUOTATION MARK + */ + "\xc2\x94" => "\xe2\x80\x9d", /** + * RIGHT DOUBLE QUOTATION MARK + */ + "\xc2\x95" => "\xe2\x80\xa2", /** + * BULLET + */ + "\xc2\x96" => "\xe2\x80\x93", /** + * EN DASH + */ + "\xc2\x97" => "\xe2\x80\x94", /** + * EM DASH + */ + "\xc2\x98" => "\xcb\x9c", /** + * SMALL TILDE + */ + "\xc2\x99" => "\xe2\x84\xa2", /** + * TRADE MARK SIGN + */ + "\xc2\x9a" => "\xc5\xa1", /** + * LATIN SMALL LETTER S WITH CARON + */ + "\xc2\x9b" => "\xe2\x80\xba", /** + * SINGLE RIGHT-POINTING ANGLE QUOTATION + */ + "\xc2\x9c" => "\xc5\x93", /** + * LATIN SMALL LIGATURE OE + */ + "\xc2\x9e" => "\xc5\xbe", /** + * LATIN SMALL LETTER Z WITH CARON + */ + "\xc2\x9f" => "\xc5\xb8" + ); + /** + * LATIN CAPITAL LETTER Y WITH DIAERESIS + */ + + /** + * @var + */ + public $ldap_server; + + /** + * @var string + */ + + public $ldap_port = '389'; + /** + * @var string + */ + public $ldap_version = '3'; + + /** + * @var + */ + public $ldap_base_dn; + + /** + * @var + */ + public $ldap_loginname_asdn; + + /** + * @var + */ + public $ldap_loginldap_attr; + + /** + * @var + */ + public $ldap_mail_attr; + + /** + * @var + */ + public $ldap_name_attr; + + /** + * @var + */ + public $ldap_surname_attr; + + /** + * @var + */ + public $ldap_givenname_attr; + + /** + * @var + */ + public $ldap_manager_dn; + + /** + * @var + */ + public $ldap_manager_pass; + + /** + * @var + */ + public $_ds; + + /** + * @var + */ + public $ldap_use_TLS; + + /** + * @var + */ + public $ldap_domain_name; + + /** + * @var + */ + public $ldap_filter_person; + + /** + * Authentication Service constructor + * + * @param Xoops_Database_Abstract|null $dao + */ + public function __construct(Xoops_Database_Abstract $dao = null) + { + $xoops = Xoops::getInstance(); + $this->_dao = $dao; + //Configuration options that are stored in the database + $configs = $xoops->getConfigs(XOOPS_CONF_AUTH); + foreach ($configs as $key => $val) { + $this->$key = $val; + } + } + + /** + * Xoops_Auth_Ldap::cp1252_to_utf8() + * + * @param string $str + * @return string + */ + public function cp1252_to_utf8($str) + { + return strtr(utf8_encode($str), $this->cp1252_map); + } + + /** + * Authenticate user again LDAP directory (Bind) + * 2 options : + * Authenticate directly with uname in the DN + * Authenticate with manager, search the dn + * + * @param string $uname Username + * @param string $pwd Password + * @return bool + */ + public function authenticate($uname, $pwd = null) + { + $authenticated = false; + if (!extension_loaded('ldap')) { + $this->setErrors(0, _AUTH_LDAP_EXTENSION_NOT_LOAD); + return $authenticated; + } + $this->_ds = ldap_connect($this->ldap_server, $this->ldap_port); + if ($this->_ds) { + ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version); + if ($this->ldap_use_TLS) { // We use TLS secure connection + if (!ldap_start_tls($this->_ds)) { + $this->setErrors(0, _AUTH_LDAP_START_TLS_FAILED); + } + } + // If the uid is not in the DN we proceed to a search + // The uid is not always in the dn + $userDN = $this->getUserDN($uname); + if (!$userDN) { + return false; + } + // We bind as user to test the credentials + $authenticated = ldap_bind($this->_ds, $userDN, stripslashes($pwd)); + if ($authenticated) { + // We load the Xoops User database + return $this->loadXoopsUser($userDN, $uname, $pwd); + } else { + $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userDN . ')'); + } + } else { + $this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND); + } + @ldap_close($this->_ds); + return $authenticated; + } + + /** + * Compose the user DN with the configuration. + * + * @param $uname + * @return bool|string userDN or false + */ + public function getUserDN($uname) + { + $userDN = false; + if (!$this->ldap_loginname_asdn) { + // Bind with the manager + if (!ldap_bind($this->_ds, $this->ldap_manager_dn, stripslashes($this->ldap_manager_pass))) { + $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $this->ldap_manager_dn . ')'); + return false; + } + $filter = $this->getFilter($uname); + $sr = ldap_search($this->_ds, $this->ldap_base_dn, $filter); + $info = ldap_get_entries($this->_ds, $sr); + if ($info['count'] > 0) { + $userDN = $info[0]['dn']; + } else { + $this->setErrors(0, sprintf(_AUTH_LDAP_USER_NOT_FOUND, $uname, $filter, $this->ldap_base_dn)); + } + } else { + $userDN = $this->ldap_loginldap_attr . '=' . $uname . ',' . $this->ldap_base_dn; + } + return $userDN; + } + + /** + * Load user from XOOPS Database + * + * @param string $uname + * @return mixed|string + */ + public function getFilter($uname) + { + if ($this->ldap_filter_person != '') { + $filter = str_replace('@@loginname@@', $uname, $this->ldap_filter_person); + } else { + $filter = $this->ldap_loginldap_attr . '=' . $uname; + } + return $filter; + } + + /** + * Xoops_Auth_Ldap::loadXoopsUser() + * + * @param string $userdn + * @param string $uname + * @param string $pwd + * @return bool|XoopsUser + */ + public function loadXoopsUser($userdn, $uname, $pwd = null) + { + $xoopsUser = false; + $provisHandler = Xoops_Auth_Provisioning::getInstance($this); + $sr = ldap_read($this->_ds, $userdn, '(objectclass=*)'); + $entries = ldap_get_entries($this->_ds, $sr); + if ($entries['count'] > 0) { + $xoopsUser = $provisHandler->sync($entries[0], $uname, $pwd); + } else { + $this->setErrors(0, sprintf('loadXoopsUser - ' . _AUTH_LDAP_CANT_READ_ENTRY, $userdn)); + } + return $xoopsUser; + } +} \ No newline at end of file Copied: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Provisioning.php (from rev 10288, XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Provisioning.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Provisioning.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -0,0 +1,252 @@ +<?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. +*/ + +/** + * Authentication provisioning class + * + * @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 + * @subpackage auth + * @since 2.0 + * @author Pierre-Eric MENUET <pe...@fr...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * provide synchronisation method to Xoops User Database + * + * @package class + * @subpackage auth + * @description Authentication provisioning class. This class is responsible to + * @author Pierre-Eric MENUET <pe...@fr...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ +class Xoops_Auth_Provisioning +{ + /** + * @var Xoops_Auth + */ + protected $_auth_instance; + + /** + * @var bool + */ + public $ldap_provisioning; + + /** + * @var bool + */ + public $ldap_provisioning_upd; + + /** + * var array + */ + public $ldap_field_mapping; + + /** + * @var array + */ + public $ldap_provisioning_group; + + /** + * Xoops_Auth_Provisioning::getInstance() + * + * @static + * @param Xoops_Auth $auth_instance + * @return Xoops_Auth_Provisioning + */ + static function getInstance(Xoops_Auth &$auth_instance) + { + static $provis_instance; + if (!isset($provis_instance)) { + $provis_instance = new self($auth_instance); + } + return $provis_instance; + } + + /** + * Authentication Service constructor + * + * @param Xoops_Auth $auth_instance + */ + public function __construct(Xoops_Auth &$auth_instance) + { + $xoops = Xoops::getInstance(); + $this->_auth_instance = $auth_instance; + $configs = $xoops->getConfigs(XOOPS_CONF_AUTH); + foreach ($configs as $key => $val) { + $this->$key = $val; + } + $config_gen = $xoops->getConfigs(XOOPS_CONF); + $this->default_TZ = $config_gen['default_TZ']; + $this->theme_set = $config_gen['theme_set']; + $this->com_mode = $config_gen['com_mode']; + $this->com_order = $config_gen['com_order']; + } + + /** + * Return a Xoops User Object + * + * @param $uname + * @return bool|XoopsUser + */ + public function getXoopsUser($uname) + { + $xoops = Xoops::getInstance(); + $member_handler = $xoops->getHandlerMember(); + $criteria = new Xoops_Criteria('uname', $uname); + $getuser = $member_handler->getUsers($criteria); + if (count($getuser) == 1) { + return $getuser[0]; + } else { + return false; + } + } + + /** + * Launch the synchronisation process + * + * @param $datas + * @param $uname + * @param null $pwd + * @return bool|XoopsUser + */ + public function sync($datas, $uname, $pwd = null) + { + $xoopsUser = $this->getXoopsUser($uname); + if (!$xoopsUser) { // Xoops User Database not exists + if ($this->ldap_provisioning) { + $xoopsUser = $this->add($datas, $uname, $pwd); + } else { + $this->_auth_instance->setErrors(0, sprintf(_AUTH_LDAP_XOOPS_USER_NOTFOUND, $uname)); + } + } else { // Xoops User Database exists + if ($this->ldap_provisioning && $this->ldap_provisioning_upd) { + $xoopsUser = $this->change($xoopsUser, $datas, $uname, $pwd); + } + } + return $xoopsUser; + } + + /** + * Add a new user to the system + * + * @return bool + */ + /** + * @param array $datas + * @param string $uname + * @param string $pwd + * @return bool|XoopsUser + */ + public function add($datas, $uname, $pwd = null) + { + $xoops = Xoops::getInstance(); + $ret = false; + $member_handler = $xoops->getHandlerMember(); + // Create XOOPS Database User + $newuser = $member_handler->createUser(); + $newuser->setVar('uname', $uname); + $newuser->setVar('pass', md5(stripslashes($pwd))); + $newuser->setVar('rank', 0); + $newuser->setVar('level', 1); + $newuser->setVar('timezone_offset', $this->default_TZ); + $newuser->setVar('theme', $this->theme_set); + $newuser->setVar('umode', $this->com_mode); + $newuser->setVar('uorder', $this->com_order); + $tab_mapping = explode('|', $this->ldap_field_mapping); + foreach ($tab_mapping as $mapping) { + $fields = explode('=', trim($mapping)); + if ($fields[0] && $fields[1]) { + $newuser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0])); + } + } + if ($member_handler->insertUser($newuser)) { + foreach ($this->ldap_provisioning_group as $groupid) { + $member_handler->addUserToGroup($groupid, $newuser->getVar('uid')); + } + $newuser->unsetNew(); + return $newuser; + } else { + $xoops->redirect(XOOPS_URL . '/user.php', 5, $newuser->getHtmlErrors()); + } + return $ret; + } + + /** + * Modify user information + * + * @param XoopsUser $xoopsUser + * @param array $datas + * @param string $uname + * @param string $pwd + * @return bool|XoopsUser + */ + public function change(XoopsUser &$xoopsUser, $datas, $uname, $pwd = null) + { + $xoops = Xoops::getInstance(); + $ret = false; + $member_handler = $xoops->getHandlerMember(); + $xoopsUser->setVar('pass', md5(stripslashes($pwd))); + $tab_mapping = explode('|', $this->ldap_field_mapping); + foreach ($tab_mapping as $mapping) { + $fields = explode('=', trim($mapping)); + if ($fields[0] && $fields[1]) { + $xoopsUser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0])); + } + } + if ($member_handler->insertUser($xoopsUser)) { + return $xoopsUser; + } else { + $xoops->redirect(XOOPS_URL . '/user.php', 5, $xoopsUser->getHtmlErrors()); + } + return $ret; + } + + /** + * Modify a user + * + * @return bool + */ + public function delete() + { + } + + /** + * Suspend a user + * + * @return bool + */ + public function suspend() + { + } + + /** + * Restore a user + * + * @return bool + */ + public function restore() + { + } + + /** + * Add a new user to the system + * + * @return bool + */ + public function resetpwd() + { + } +} \ No newline at end of file Copied: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Xoops.php (from rev 10288, XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Xoops.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth/Xoops.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -0,0 +1,64 @@ +<?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. +*/ + +/** + * Authentication class for Native XOOPS + * + * @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 + * @subpackage auth + * @since 2.0 + * @author Pierre-Eric MENUET <pe...@fr...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * + * @package class + * @subpackage auth + * @description Authentication class for Native XOOPS + * @author Pierre-Eric MENUET <pe...@fr...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ +class Xoops_Auth_Xoops extends Xoops_Auth +{ + /** + * Authentication Service constructor + * + * @param Xoops_Database_Abstract|null $dao + */ + public function __construct(Xoops_Database_Abstract $dao = null) + { + $this->_dao = $dao; + $this->auth_method = 'xoops'; + } + + /** + * Authenticate user + * + * @param string $uname + * @param string $pwd + * @return bool + */ + public function authenticate($uname, $pwd = null) + { + $xoops = Xoops::getInstance(); + $member_handler = $xoops->getHandlerMember(); + $user = $member_handler->loginUser($uname, $pwd); + if ($user == false) { + $this->setErrors(1, _US_INCORRECTLOGIN); + } + return $user; + } +} \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -0,0 +1,117 @@ +<?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 Authentification base class + * + * @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 + * @subpackage auth + * @since 2.0 + * @author Pierre-Eric MENUET <pe...@fr...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * + * @package class + * @subpackage auth + * @description Authentification base class + * @author Pierre-Eric MENUET <pe...@fr...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ +class Xoops_Auth +{ + /** + * @var Xoops_Database_Abstract|null + */ + protected $_dao; + + /** + * @var array + */ + protected $_errors; + + /** + * @var string + */ + protected $auth_method; + + /** + * Authentication Service constructor + * + * @param Xoops_Database_Abstract|null $dao + */ + public function __construct($dao) + { + $this->_dao = $dao; + } + + /** + * need to be write in the derived class + * + * @return bool + */ + public function authenticate() + { + $authenticated = false; + return $authenticated; + } + + /** + * @param int $err_no + * @param string $err_str + * @return void + */ + public function setErrors($err_no, $err_str) + { + $this->_errors[$err_no] = trim($err_str); + } + + /** + * return the errors for this object as an array + * + * @return array an array of errors + * @access public + */ + public function getErrors() + { + return $this->_errors; + } + + /** + * return the errors for this object as html + * + * @return string html listing the errors + * @access public + */ + public function getHtmlErrors() + { + $xoops = Xoops::getInstance(); + $ret = '<br />'; + if ($xoops->getConfig('debug_mode') == 1 || $xoops->getConfig('debug_mode') == 2) { + if (!empty($this->_errors)) { + foreach ($this->_errors as $errstr) { + $ret .= $errstr . '<br/>'; + } + } else { + $ret .= _NONE . '<br />'; + } + $ret .= sprintf(_AUTH_MSG_AUTH_METHOD, $this->auth_method); + } else { + $ret .= _US_INCORRECTLOGIN; + } + return $ret; + } +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Auth.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria/Element.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria/Element.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria/Element.php 2012-11-30 00:58:48 UTC (rev 10289) @@ -159,4 +159,12 @@ { return $this->groupby ? " GROUP BY {$this->groupby}" : ""; } + + /** + * @return string + */ + public function getGroupbyField() + { + return $this->groupby ? $this->groupby : ""; + } } Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Stats.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Stats.php 2012-11-30 00:17:15 UTC (rev 10288) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Stats.php 2012-11-30 00:58:48 UTC (rev 10... [truncated message content] |
From: <tr...@us...> - 2012-11-30 00:17:35
|
Revision: 10288 http://sourceforge.net/p/xoops/svn/10288 Author: trabis Date: 2012-11-30 00:17:15 +0000 (Fri, 30 Nov 2012) Log Message: ----------- Start moving some classes to xoops_lib folder Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/object.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/model.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/criteria.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/database.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/mysqldatabase.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/sqlutility.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/logger/render.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/model/joint.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/model/read.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/model/stats.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/model/sync.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/model/write.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/model/xoopsmodel.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/module.textsanitizer.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/theme.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/userutility.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xml/rpc/xoopsapi.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoops.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopsform/formselectgroup.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopsform/formselectuser.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopslists.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/xoopsload.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/comments.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/edituser.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/image.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/imagemanager.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/comment_delete.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/comment_post.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/common.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/findusers.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/searchform.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/include/site-closed.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/include/createconfigform.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/include/functions.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/include/makedata.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/page_configsite.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/page_siteinit.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/page_tablescreate.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/page_tablesfill.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/install/page_theme.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/avatar.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/avataruserlink.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/block.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/blockmodulelink.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/cachemodel.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/comment.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/config.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/configcategory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/configitem.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/configoption.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/group.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/groupperm.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/image.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/imagecategory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/imageset.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/imagesetimg.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/member.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/membership.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/module.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/notification.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/object.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/online.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/privmessage.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/ranks.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/session.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/smilies.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/tplfile.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/tplset.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/kernel/user.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/lostpass.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/misc.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/avatars/admin/avatar_custom.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/avatars/admin/avatar_system.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/avatars/admin/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/admin/banners.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/admin/clients.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/admin/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/blocks/banners_blocks.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/class/banner.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/class/bannerclient.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/class/renderbanner.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/banners/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/mailusers/admin/send_mails.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/maintenance/admin/center.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/maintenance/admin/dump.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/maintenance/class/maintenance.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/admin/content.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/admin/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/admin/permissions.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/admin/related.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/blocks/page_blocks.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/class/form/page_related.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/class/page.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/class/page_content.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/class/page_rating.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/class/page_related.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/page/rating.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/pm/admin/prune.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/pm/class/message.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/pm/pmlite.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/pm/readpmsg.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/pm/viewpmsg.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/activate.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/admin/category.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/admin/field.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/admin/visibility.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/class/category.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/class/field.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/class/profile.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/class/regstep.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/class/visibility.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/edituser.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/include/update.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/lostpass.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/register.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/search.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/profile/userinfo.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/admin/advisory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/admin/center.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/admin/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/admin/prefix_manager.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/class/form/center.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/docs/changelog.txt XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/include/postcheck.inc.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/protector/include/precheck.inc.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/smilies/admin/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/smilies/admin/smilies.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/blocksadmin/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/comments/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/groups/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/images/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/preferences/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/tplsets/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/users/jquery.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/users/main.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin/users/users.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/admin.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/blocks/system_blocks.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/class/form/block.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/class/form/group.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/class/form/preference.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/class/module.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/help.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/system/include/update.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/userrank/admin/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/userrank/admin/userrank.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/xcaptcha/class/xcaptcha.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/modules/xlanguage/class/xlanguage.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/notifications.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/readpmsg.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/search.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/userinfo.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/viewpmsg.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/smarty/xoops_plugins/function.xoInboxCount.php XoopsCore/branches/2.6.x/2.6.0_trabis/upgrade/cnt-2.2.x-to-2.3.0/index.php XoopsCore/branches/2.6.x/2.6.0_trabis/upgrade/login.php XoopsCore/branches/2.6.x/2.6.0_trabis/upgrade/upd-2.4.x-to-2.5.0/dbmanager.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria/Compo.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria/Element.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Criteria.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Abstract.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Factory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Mysql/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Mysql/Manager.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Mysql/Proxy.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Mysql/Safe.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Mysql/Utility.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Database/Mysql.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Load.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Abstract.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Factory.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Joint.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Read.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Stats.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Sync.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Model/Write.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Object/ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Object/Handler.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops/Object.php XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/xoops_lib/Xoops.php Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/functions.config.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -75,7 +75,7 @@ return null; } $config_handler = $xoops->getHandlerConfig(); - $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid'))); + $criteria = new Xoops_Criteria_Compo(new Xoops_Criteria('conf_modid', $module->getVar('mid'))); $configs = $config_handler->getConfigs($criteria); $moduleConfig = array(); foreach (array_keys($configs) as $i) { Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/object.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/object.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/Frameworks/art/object.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -27,7 +27,7 @@ * {@link XoopsObject} **/ -class ArtObject extends XoopsObject +class ArtObject extends Xoops_Object { /** * @var string @@ -54,7 +54,7 @@ * */ -class ArtObjectHandler extends XoopsPersistableObjectHandler +class ArtObjectHandler extends Xoops_Object_Handler { var $db; @@ -62,7 +62,7 @@ /** * Constructor * - * @param object $db reference to the {@link XoopsDatabase} object + * @param object $db reference to the {@link Xoops_Database_Abstract} object **/ function __construct(&$db, $table, $className, $keyName, $identifierName) Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -51,7 +51,7 @@ /** * Authentication Service constructor * - * @param XoopsDatabase|null $dao + * @param Xoops_Database_Abstract|null $dao */ public function __construct($dao) { Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ads.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -37,10 +37,10 @@ /** * Authentication Service constructor * - * @param XoopsDatabase|null $dao + * @param Xoops_Database_Abstract|null $dao * @return void */ - public function _construct(XoopsDatabase $dao = null) + public function _construct(Xoops_Database_Abstract $dao = null) { parent::__construct($dao); } Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_ldap.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -202,9 +202,9 @@ /** * Authentication Service constructor * - * @param XoopsDatabase|null $dao + * @param Xoops_Database_Abstract|null $dao */ - public function __construct(XoopsDatabase $dao = null) + public function __construct(Xoops_Database_Abstract $dao = null) { $xoops = Xoops::getInstance(); $this->_dao = $dao; Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_provisionning.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -105,7 +105,7 @@ { $xoops = Xoops::getInstance(); $member_handler = $xoops->getHandlerMember(); - $criteria = new Criteria('uname', $uname); + $criteria = new Xoops_Criteria('uname', $uname); $getuser = $member_handler->getUsers($criteria); if (count($getuser) == 1) { return $getuser[0]; Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/auth_xoops.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -36,9 +36,9 @@ /** * Authentication Service constructor * - * @param XoopsDatabase|null $dao + * @param Xoops_Database_Abstract|null $dao */ - public function __construct(XoopsDatabase $dao = null) + public function __construct(Xoops_Database_Abstract $dao = null) { $this->_dao = $dao; $this->auth_method = 'xoops'; Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/auth/authfactory.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -71,7 +71,7 @@ } switch ($xoops_auth_method) { case 'xoops': - $dao = XoopsDatabaseFactory::getDatabaseConnection(); + $dao = Xoops_Database_Factory::getDatabaseConnection(); break; case 'ldap': $dao = null; Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/model.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/model.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/cache/model.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -141,8 +141,8 @@ */ public function read($key) { - $criteria = new CriteriaCompo(new Criteria($this->model->keyName, $key)); - //$criteria->add(new Criteria($this->fields[1], time(), ">")); + $criteria = new Xoops_Criteria_Compo(new Xoops_Criteria($this->model->keyName, $key)); + //$criteria->add(new Xoops_Criteria($this->fields[1], time(), ">")); $criteria->setLimit(1); $data = $this->model->getAll($criteria, null, true, false); @@ -166,7 +166,7 @@ */ public function delete($key) { - $criteria = new CriteriaCompo(new Criteria($this->model->keyName, $key)); + $criteria = new Xoops_Criteria_Compo(new Xoops_Criteria($this->model->keyName, $key)); return $this->model->deleteAll($criteria); } @@ -180,7 +180,7 @@ public function clear($check) { if ($check) { - return $this->model->deleteAll(new Criteria($this->fields[1], time(), '<= ')); + return $this->model->deleteAll(new Xoops_Criteria($this->fields[1], time(), '<= ')); } return $this->model->deleteAll(); } Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/criteria.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/criteria.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/criteria.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -32,241 +32,17 @@ * @abstract * @package class */ -abstract class CriteriaElement +abstract class CriteriaElement extends Xoops_Criteria_Element { - /** - * Sort order - * - * @var string - */ - protected $order = 'ASC'; - - /** - * @var string - */ - protected $sort = ''; - - /** - * Number of records to retrieve - * - * @var int - */ - protected $limit = 0; - - /** - * Offset of first record - * - * @var int - */ - protected $start = 0; - - /** - * @var string - */ - protected $groupby = ''; - - - /** - * Render the criteria element - */ - abstract function render(); - - /** - * Make the criteria into a SQL "WHERE" clause - */ - abstract function renderWhere(); - - /** - * Generate an LDAP filter from criteria - */ - abstract function renderLdap(); - - /** - * - * @param string $sort - */ - public function setSort($sort) - { - $this->sort = $sort; - } - - /** - * @return string - */ - public function getSort() - { - return $this->sort; - } - - /** - * @param string $order - */ - public function setOrder($order) - { - if ('DESC' == strtoupper($order)) { - $this->order = 'DESC'; - } - } - - /** - * @return string - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $limit - */ - public function setLimit($limit = 0) - { - $this->limit = intval($limit); - } - - /** - * @return int - */ - public function getLimit() - { - return $this->limit; - } - - /** - * @param int $start - */ - public function setStart($start = 0) - { - $this->start = intval($start); - } - - /** - * @return int - */ - public function getStart() - { - return $this->start; - } - - /** - * @param string $group - */ - public function setGroupby($group) - { - $this->groupby = $group; - } - - /** - * @return string - */ - public function getGroupby() - { - return $this->groupby ? " GROUP BY {$this->groupby}" : ""; - } } /** - * Collection of multiple {@link CriteriaElement}s + * Collection of multiple {@link Xoops_Criteria_Element}s * * @package class */ -class CriteriaCompo extends CriteriaElement +class CriteriaCompo extends Xoops_Criteria_Compo { - /** - * The elements of the collection - * - * @var array Array of {@link CriteriaElement} objects - */ - protected $criteriaElements = array(); - - /** - * Conditions - * - * @var array - */ - protected $conditions = array(); - - /** - * Constructor - * - * @param CriteriaElement|null $ele - * @param string $condition - */ - public function __construct(CriteriaElement $ele = null, $condition = 'AND') - { - if (isset($ele)) { - $this->add($ele, $condition); - } - } - - /** - * @param CriteriaElement $criteriaElement - * @param string $condition - * @return CriteriaCompo - */ - public function add(CriteriaElement $criteriaElement, $condition = 'AND') - { - $this->criteriaElements[] = $criteriaElement; - $this->conditions[] = $condition; - return $this; - } - - /** - * Make the criteria into a query string - * - * @return string - */ - public function render() - { - $ret = ''; - foreach ($this->criteriaElements as $i => $element) { - /* @var $element CriteriaElement */ - if ($i == 0) { - $ret = $element->render(); - } else { - if (!$render = $element->render()) { - continue; - } - $ret .= ' ' . $this->conditions[$i] . ' ' . $render; - } - $ret = "({$ret})"; - } - return $ret; - } - - /** - * Make the criteria into a SQL "WHERE" clause - * - * @return string - */ - public function renderWhere() - { - $ret = $this->render(); - $ret = ($ret != '') ? 'WHERE ' . $ret : $ret; - return $ret; - } - - /** - * Generate an LDAP filter from criteria - * - * @return string - * @author Nathan Dial nd...@tr... - */ - public function renderLdap() - { - $ret = ''; - foreach ($this->criteriaElements as $i => $element) { - /* @var $element CriteriaElement */ - if ($i == 0) { - $ret = $element->renderLdap(); - } else { - $cond = strtoupper($this->conditions[$i]); - $op = ($cond == "OR") ? "|" : "&"; - $ret = "({$op}{$ret}" . $element->renderLdap() . ")"; - } - } - return $ret; - } } /** @@ -274,124 +50,6 @@ * * @package class */ -class Criteria extends CriteriaElement +class Criteria extends Xoops_Criteria { - /** - * @var string - */ - public $prefix; - - /** - * @var string - */ - public $function; - - /** - * @var string - */ - public $column; - - /** - * @var string - */ - public $operator; - - /** - * @var mixed - */ - public $value; - - /** - * Constructor - * - * @param string $column - * @param string $value - * @param string $operator - * @param string $prefix - * @param string $function - */ - public function __construct($column, $value = '', $operator = '=', $prefix = '', $function = '') - { - $this->prefix = $prefix; - $this->function = $function; - $this->column = $column; - $this->value = $value; - $this->operator = $operator; - } - - /** - * Make a sql condition string - * - * @return string - */ - public function render() - { - $clause = (!empty($this->prefix) ? "{$this->prefix}." : "") . $this->column; - if (!empty($this->function)) { - $clause = sprintf($this->function, $clause); - } - if (in_array(strtoupper($this->operator), array('IS NULL', 'IS NOT NULL'))) { - $clause .= ' ' . $this->operator; - } else { - if ('' === ($value = trim($this->value))) { - return ''; - } - if (!in_array(strtoupper($this->operator), array('IN', 'NOT IN'))) { - if ((substr($value, 0, 1) != '`') && (substr($value, -1) != '`')) { - $value = "'{$value}'"; - } else { - if (!preg_match('/^[a-zA-Z0-9_\.\-`]*$/', $value)) { - $value = '``'; - } - } - } - $clause .= " {$this->operator} {$value}"; - } - return $clause; - } - - /** - * Generate an LDAP filter from criteria - * - * @return string - * @author Nathan Dial nd...@tr..., improved by Pierre-Eric MENUET pe...@so... - */ - public function renderLdap() - { - $clause = ''; - if ($this->operator == '>') { - $this->operator = '>='; - } - if ($this->operator == '<') { - $this->operator = '<='; - } - - if ($this->operator == '!=' || $this->operator == '<>') { - $operator = '='; - $clause = "(!(" . $this->column . $operator . $this->value . "))"; - } else { - if ($this->operator == 'IN') { - $newvalue = str_replace(array('(', ')'), '', $this->value); - $tab = explode(',', $newvalue); - foreach ($tab as $uid) { - $clause .= "({$this->column}={$uid})"; - } - $clause = '(|' . $clause . ')'; - } else { - $clause = "(" . $this->column . $this->operator . $this->value . ")"; - } - } - return $clause; - } - - /** - * Make a SQL "WHERE" clause - * - * @return string - */ - public function renderWhere() - { - $cond = $this->render(); - return empty($cond) ? '' : "WHERE {$cond}"; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/database.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/database.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/database.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -31,216 +31,6 @@ * @package kernel * @subpackage database */ -abstract class XoopsDatabase +abstract class XoopsDatabase extends Xoops_Database_Abstract { - /** - * Database connection - * - * @var resource - */ - public $conn; - - /** - * Prefix for tables in the database - * - * @var string - */ - public $prefix = ''; - - /** - * @var XoopsLogger - */ - public $logger; - - /** - * If statements that modify the database are selected - * - * @var boolean - */ - public $allowWebChanges = false; - - /** - * assign a {@link XoopsLogger} object to the database - * - * @see XoopsLogger - * - * @param XoopsLogger $logger reference to a {@link XoopsLogger} object - */ - public function setLogger(XoopsLogger $logger) - { - $this->logger = $logger; - } - - /** - * set the prefix for tables in the database - * - * @param string $value table prefix - */ - public function setPrefix($value) - { - $this->prefix = $value; - } - - /** - * attach the prefix.'_' to a given tablename - * if tablename is empty, only prefix will be returned - * - * @param string $tablename tablename - * - * @return string prefixed tablename, just prefix if tablename is empty - */ - public function prefix($tablename = '') - { - if ($tablename != '') { - return $this->prefix . '_' . $tablename; - } else { - return $this->prefix; - } - } - - /** - * @abstract - * - * @param bool $selectdb - * - * @return void - */ - abstract function connect($selectdb = true); - - /** - * @param $sequence - * - * @abstract - */ - abstract function genId($sequence); - - /** - * @param $result - * - * @abstract - */ - abstract function fetchRow($result); - - /** - * @param $result - * - * @return array - * @abstract - */ - abstract function fetchArray($result); - - /** - * @param $result - * - * @abstract - */ - abstract function fetchBoth($result); - - /** - * @param $result - * - * @abstract - */ - abstract function fetchObject($result); - - /** - * @abstract - */ - abstract function getInsertId(); - - /** - * @param $result - * - * @abstract - */ - abstract function getRowsNum($result); - - /** - * @abstract - */ - abstract function getAffectedRows(); - - /** - * @abstract - */ - abstract function close(); - - /** - * @param $result - * - * @abstract - */ - abstract function freeRecordSet($result); - - /** - * @abstract - */ - abstract function error(); - - /** - * @abstract - */ - abstract function errno(); - - /** - * @param $str - * - * @abstract - */ - abstract function quoteString($str); - - /** - * @param $string - * - * @abstract - */ - abstract function quote($string); - - /** - * @param $sql - * @param int $limit - * @param int $start - * - * @abstract - */ - abstract function queryF($sql, $limit = 0, $start = 0); - - /** - * @param $sql - * @param int $limit - * @param int $start - * - * @abstract - */ - abstract function query($sql, $limit = 0, $start = 0); - - /** - * @param $file - * - * @abstract - */ - abstract function queryFromFile($file); - - /** - * @param $result - * @param $offset - * - * @abstract - */ - abstract function getFieldName($result, $offset); - - /** - * @param $result - * @param $offset - * - * @abstract - */ - abstract function getFieldType($result, $offset); - - /** - * @param $result - * - * @abstract - */ - abstract function getFieldsNum($result); } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/databasefactory.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -21,73 +21,6 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); -class XoopsDatabaseFactory +class Xoops_Database_AbstractFactory extends Xoops_Database_Factory { - - /** - * Get a reference to the only instance of database class and connects to DB - * - * if the class has not been instantiated yet, this will also take - * care of that - * - * @static - * @staticvar XoopsDatabase The only instance of database class - * @return XoopsDatabase Reference to the only instance of database class - */ - static function getDatabaseConnection() - { - static $instance; - if (!isset($instance)) { - if (file_exists($file = XOOPS_ROOT_PATH . '/class/database/' . XOOPS_DB_TYPE . 'database.php')) { - require_once $file; - - if (!defined('XOOPS_DB_PROXY')) { - $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe'; - } else { - $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseProxy'; - } - - $xoopsPreload = XoopsPreload::getInstance(); - $xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class)); - /* @var $instance XoopsDatabase */ - $instance = new $class(); - $instance->setLogger(XoopsLogger::getInstance()); - $instance->setPrefix(XOOPS_DB_PREFIX); - if (!$instance->connect()) { - trigger_error('notrace:Unable to connect to database', E_USER_ERROR); - } - } else { - trigger_error('notrace:Failed to load database of type: ' . XOOPS_DB_TYPE . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING); - } - } - return $instance; - } - - /** - * Gets a reference to the only instance of database class. Currently - * only being used within the installer. - * - * @static - * @staticvar XoopsDatabase The only instance of database class - * @return XoopsDatabase Reference to the only instance of database class - */ - static function getDatabase() - { - static $database; - if (!isset($database)) { - if (file_exists($file = XOOPS_ROOT_PATH . '/class/database/' . XOOPS_DB_TYPE . 'database.php')) { - include_once $file; - if (!defined('XOOPS_DB_PROXY')) { - $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe'; - } else { - $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseProxy'; - } - unset($database); - $database = new $class(); - } else { - trigger_error('notrace:Failed to load database of type: ' . XOOPS_DB_TYPE . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING); - } - } - return $database; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/manager.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -21,276 +21,6 @@ * @version $Id$ */ -class XoopsDatabaseManager +class Xoops_Database_AbstractManager extends Xoops_Database_Mysql_Manager { - /** - * @var array - */ - private $s_tables = array(); - - /** - * @var array - */ - private $f_tables = array(); - - /** - * @var XoopsDatabase - */ - public $db; - - /** - * @var array - */ - public $successStrings = array( - 'create' => TABLE_CREATED, 'insert' => ROWS_INSERTED, 'alter' => TABLE_ALTERED, 'drop' => TABLE_DROPPED, - ); - - /** - * @var array - */ - public $failureStrings = array( - 'create' => TABLE_NOT_CREATED, 'insert' => ROWS_FAILED, 'alter' => TABLE_NOT_ALTERED, - 'drop' => TABLE_NOT_DROPPED, - ); - - /** - * - */ - public function __construct() - { - $this->db = XoopsDatabaseFactory::getDatabase(); - $this->db->setPrefix(XOOPS_DB_PREFIX); - $this->db->setLogger(XoopsLogger::getInstance()); - } - - /** - * @return bool - */ - public function isConnectable() - { - return ($this->db->connect(false) != false) ? true : false; - } - - /** - * @return bool - */ - public function dbExists() - { - return ($this->db->connect() != false) ? true : false; - } - - /** - * @return bool - */ - public function createDB() - { - $this->db->connect(false); - - $result = $this->db->query("CREATE DATABASE " . XOOPS_DB_NAME); - - return ($result != false) ? true : false; - } - - /** - * @param string $sql_file_path - * @return bool - */ - public function queryFromFile($sql_file_path) - { - if (!file_exists($sql_file_path)) { - return false; - } - $sql_query = trim(fread(fopen($sql_file_path, 'r'), filesize($sql_file_path))); - SqlUtility::splitMySqlFile($pieces, $sql_query); - $this->db->connect(); - foreach ($pieces as $piece) { - $piece = trim($piece); - // [0] contains the prefixed query - // [4] contains unprefixed table name - $prefixed_query = SqlUtility::prefixQuery($piece, $this->db->prefix()); - if ($prefixed_query != false) { - $table = $this->db->prefix($prefixed_query[4]); - if ($prefixed_query[1] == 'CREATE TABLE') { - if ($this->db->query($prefixed_query[0]) != false) { - if (!isset($this->s_tables['create'][$table])) { - $this->s_tables['create'][$table] = 1; - } - } else { - if (!isset($this->f_tables['create'][$table])) { - $this->f_tables['create'][$table] = 1; - } - } - } else { - if ($prefixed_query[1] == 'INSERT INTO') { - if ($this->db->query($prefixed_query[0]) != false) { - if (!isset($this->s_tables['insert'][$table])) { - $this->s_tables['insert'][$table] = 1; - } else { - $this->s_tables['insert'][$table]++; - } - } else { - if (!isset($this->f_tables['insert'][$table])) { - $this->f_tables['insert'][$table] = 1; - } else { - $this->f_tables['insert'][$table]++; - } - } - } else { - if ($prefixed_query[1] == 'ALTER TABLE') { - if ($this->db->query($prefixed_query[0]) != false) { - if (!isset($this->s_tables['alter'][$table])) { - $this->s_tables['alter'][$table] = 1; - } - } else { - if (!isset($this->s_tables['alter'][$table])) { - $this->f_tables['alter'][$table] = 1; - } - } - } else { - if ($prefixed_query[1] == 'DROP TABLE') { - if ($this->db->query('DROP TABLE ' . $table) != false) { - if (!isset($this->s_tables['drop'][$table])) { - $this->s_tables['drop'][$table] = 1; - } - } else { - if (!isset($this->s_tables['drop'][$table])) { - $this->f_tables['drop'][$table] = 1; - } - } - } - } - } - } - } - } - return true; - } - - /** - * @return string - */ - public function report() - { - $commands = array('create', 'insert', 'alter', 'drop'); - $content = '<ul class="log">'; - foreach ($commands as $cmd) { - if (!@empty($this->s_tables[$cmd])) { - foreach ($this->s_tables[$cmd] as $key => $val) { - $content .= '<li class="success">'; - $content .= ($cmd != 'insert') ? sprintf($this->successStrings[$cmd], $key) - : sprintf($this->successStrings[$cmd], $val, $key); - $content .= "</li>\n"; - } - } - } - foreach ($commands as $cmd) { - if (!@empty($this->f_tables[$cmd])) { - foreach ($this->f_tables[$cmd] as $key => $val) { - $content .= '<li class="failure">'; - $content .= ($cmd != 'insert') ? sprintf($this->failureStrings[$cmd], $key) - : sprintf($this->failureStrings[$cmd], $val, $key); - $content .= "</li>\n"; - } - } - } - $content .= '</ul>'; - return $content; - } - - /** - * @param $sql - * @return bool|resource - */ - public function query($sql) - { - $this->db->connect(); - return $this->db->query($sql); - } - - /** - * @param $table - * @return string - */ - public function prefix($table) - { - $this->db->connect(); - return $this->db->prefix($table); - } - - /** - * @param $ret - * @return array - */ - public function fetchArray($ret) - { - $this->db->connect(); - return $this->db->fetchArray($ret); - } - - /** - * @param $table - * @param $query - * @return bool|void - */ - public function insert($table, $query) - { - $this->db->connect(); - $table = $this->db->prefix($table); - $query = 'INSERT INTO ' . $table . ' ' . $query; - if (!$this->db->queryF($query)) { - if (!isset($this->f_tables['insert'][$table])) { - $this->f_tables['insert'][$table] = 1; - } else { - $this->f_tables['insert'][$table]++; - } - return false; - } else { - if (!isset($this->s_tables['insert'][$table])) { - $this->s_tables['insert'][$table] = 1; - } else { - $this->s_tables['insert'][$table]++; - } - return $this->db->getInsertId(); - } - } - - /** - * @return bool - */ - public function isError() - { - return (isset($this->f_tables)) ? true : false; - } - - /** - * @param $tables - * @return array - */ - public function deleteTables($tables) - { - $deleted = array(); - $this->db->connect(); - foreach ($tables as $key => $val) { - if (!$this->db->query("DROP TABLE " . $this->db->prefix($key))) { - $deleted[] = $val; - } - } - return $deleted; - } - - /** - * @param $table - * @return bool - */ - public function tableExists($table) - { - $table = trim($table); - $ret = false; - if ($table != '') { - $this->db->connect(); - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix($table); - $ret = (false != $this->db->query($sql)) ? true : false; - } - return $ret; - } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/mysqldatabase.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/mysqldatabase.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/mysqldatabase.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -32,305 +32,8 @@ * @package class * @subpackage database */ -class XoopsMySQLDatabase extends XoopsDatabase +class XoopsMySQLDatabase extends Xoops_Database_Mysql { - - /** - * connect to the database - * - * @param bool $selectdb select the database now? - * @return bool successful? - */ - public 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; - } - - /** - * 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 - */ - public function genId($sequence) - { - return 0; // will use auto_increment - } - - /** - * Get a result row as an enumerated array - * - * @param resource $result - * @return array - */ - public function fetchRow($result) - { - return @mysql_fetch_row($result); - } - - /** - * Fetch a result row as an associative array - * - * @param resource $result - * @return array - */ - public function fetchArray($result) - { - return @mysql_fetch_assoc($result); - } - - /** - * Fetch a result row as an associative array - * - * @param resource $result - * @return array - */ - public function fetchBoth($result) - { - return @mysql_fetch_array($result, MYSQL_BOTH); - } - - /** - * XoopsMySQLDatabase::fetchObjected() - * - * @param resource $result - * @return object|stdClass - */ - public function fetchObject($result) - { - return @mysql_fetch_object($result); - } - - /** - * Get the ID generated from the previous INSERT operation - * - * @return int - */ - public function getInsertId() - { - return mysql_insert_id($this->conn); - } - - /** - * Get number of rows in result - * - * @param resource $result - * @return int - */ - public function getRowsNum($result) - { - return @mysql_num_rows($result); - } - - /** - * Get number of affected rows - * - * @return int - */ - public function getAffectedRows() - { - return mysql_affected_rows($this->conn); - } - - /** - * Close MySQL connection - * - * @return void - */ - public function close() - { - mysql_close($this->conn); - } - - /** - * will free all memory associated with the result identifier result. - * - * @param resource $result query result - * @return bool TRUE on success or FALSE on failure. - */ - public 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. - */ - public 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. - */ - public 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 - */ - public function quoteString($str) - { - return $this->quote($str); - } - - /** - * Quotes a string for use in a query. - * - * @param $string - * @return string - */ - public 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 bool|resource query result or FALSE if successful - * or TRUE if successful and no result - */ - public 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 - */ - public 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 - */ - public function queryFromFile($file) - { - if (false !== ($fp = fopen($file, 'r'))) { - $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 $offset numerical field index - * @return string - */ - public 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 - */ - public function getFieldType($result, $offset) - { - return mysql_field_type($result, $offset); - } - - /** - * Get number of fields in result - * - * @param resource $result query result - * @return int - */ - public function getFieldsNum($result) - { - return mysql_num_fields($result); - } } /** @@ -341,21 +44,8 @@ * @package kernel * @subpackage database */ -class XoopsMySQLDatabaseSafe extends XoopsMySQLDatabase +class XoopsMySQLDatabaseSafe extends Xoops_Database_Mysql_Safe { - /** - * 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 - */ - public function query($sql, $limit = 0, $start = 0) - { - return $this->queryF($sql, $limit, $start); - } } /** @@ -369,25 +59,6 @@ * @package kernel * @subpackage database */ -class XoopsMySQLDatabaseProxy extends XoopsMySQLDatabase +class XoopsMySQLDatabaseProxy extends Xoops_Database_Mysql_Proxy { - /** - * 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 - */ - public 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 Modified: XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/sqlutility.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/sqlutility.php 2012-11-29 13:39:27 UTC (rev 10287) +++ XoopsCore/branches/2.6.x/2.6.0_trabis/htdocs/class/database/sqlutility.php 2012-11-30 00:17:15 UTC (rev 10288) @@ -29,142 +29,6 @@ * @package kernel * @subpackage database */ -class SqlUtility +class SqlUtility extends Xoops_Database_Mysql_Utility { - /** - * Function from phpMyAdmin (http://phpwizard.net/projects/phpMyAdmin/) - * - * Removes comment and splits large sql files into individual queries - * - * Last revision: September 23, 2001 - gandon - * - * @param array $ret the splitted sql commands - * @param string $sql the sql commands - * @return bool always true - * @access public - */ - static function splitMySqlFile(&$ret, $sql) - { - $sql = trim($sql); - $sql_len = strlen($sql); - $string_start = ''; - $in_string = false; - - for ($i = 0; $i < $sql_len; ++$i) { - $char = $sql[$i]; - // We are in a string, check for not escaped end of - // strings except for backquotes that can't be escaped - if ($in_string) { - for (; ;) { - $i = strpos($sql, $string_start, $i); - // No end ... [truncated message content] |
From: <du...@us...> - 2012-11-29 13:39:29
|
Revision: 10287 http://sourceforge.net/p/xoops/svn/10287 Author: dugris Date: 2012-11-29 13:39:27 +0000 (Thu, 29 Nov 2012) Log Message: ----------- BUG Fix : model/class/stats function getcount & getcounts Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php 2012-11-29 13:36:07 UTC (rev 10286) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php 2012-11-29 13:39:27 UTC (rev 10287) @@ -163,6 +163,14 @@ { return $this->groupby ? " GROUP BY {$this->groupby}" : ""; } + + /** + * @return string + */ + public function getGroupbyField() + { + return $this->groupby ? $this->groupby : ""; + } } /** Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php 2012-11-29 13:36:07 UTC (rev 10286) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php 2012-11-29 13:39:27 UTC (rev 10287) @@ -44,9 +44,9 @@ $field = ''; $groupby = false; if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - if ($criteria->getGroupby() != '') { + if ($criteria->getGroupbyField() != '') { $groupby = true; - $field = $criteria->getGroupby() . ", "; + $field = $criteria->getGroupbyField() . ", "; } } $sql = "SELECT {$field} COUNT(*) FROM `{$this->handler->table}`"; @@ -87,7 +87,7 @@ $sql_where = $criteria->renderWhere(); $limit = $criteria->getLimit(); $start = $criteria->getStart(); - if ($groupby = $criteria->getGroupby()) { + if ($groupby = $criteria->getGroupbyField()) { $groupby_key = $groupby; } } |
From: <du...@us...> - 2012-11-29 13:36:12
|
Revision: 10286 http://sourceforge.net/p/xoops/svn/10286 Author: dugris Date: 2012-11-29 13:36:07 +0000 (Thu, 29 Nov 2012) Log Message: ----------- Fix : search : use user name Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php 2012-11-28 23:04:17 UTC (rev 10285) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php 2012-11-29 13:36:07 UTC (rev 10286) @@ -187,7 +187,7 @@ $res[$i]['title'] = $myts->htmlspecialchars($results[$i]['title']); $res[$i]['title_highligh'] = preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlspecialchars($results[$i]['title'])); $res[$i]['uid'] = @intval($results[$i]['uid']); - $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid']); + $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); $res[$i]['time'] = !empty($results[$i]['time']) ? " (" . XoopsLocal::formatTimestamp(intval($results[$i]['time'])) . ")" : ""; $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); } @@ -249,7 +249,7 @@ $res[$i]['title'] = $myts->htmlspecialchars($results[$i]['title']); $res[$i]['title_highligh'] = preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlspecialchars($results[$i]['title'])); $res[$i]['uid'] = @intval($results[$i]['uid']); - $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid']); + $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); $res[$i]['time'] = !empty($results[$i]['time']) ? " (" . XoopsLocal::formatTimestamp(intval($results[$i]['time'])) . ")" : ""; $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); } |
From: <tr...@us...> - 2012-11-28 23:04:21
|
Revision: 10285 http://sourceforge.net/p/xoops/svn/10285 Author: trabis Date: 2012-11-28 23:04:17 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Creating branch for testing proposes Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0_trabis/ |
From: <tr...@us...> - 2012-11-28 14:06:31
|
Revision: 10284 http://sourceforge.net/p/xoops/svn/10284 Author: trabis Date: 2012-11-28 14:06:28 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Publisher - Improving highlighted results Modified Paths: -------------- XoopsModules/publisher/trunk/publisher/include/search.inc.php Modified: XoopsModules/publisher/trunk/publisher/include/search.inc.php =================================================================== --- XoopsModules/publisher/trunk/publisher/include/search.inc.php 2012-11-28 13:39:36 UTC (rev 10283) +++ XoopsModules/publisher/trunk/publisher/include/search.inc.php 2012-11-28 14:06:28 UTC (rev 10284) @@ -8,7 +8,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license @@ -18,30 +17,21 @@ * @author trabis <lus...@gm...> * @version $Id$ */ +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); -if (!defined("XOOPS_ROOT_PATH")) { - die("XOOPS root path not defined"); -} - include_once dirname(dirname(__FILE__)) . '/include/common.php'; function publisher_search($queryarray, $andor, $limit, $offset, $userid, $categories = array(), $sortby = 0, $searchin = "", $extra = "") { - global $myts; $publisher = PublisherPublisher::getInstance(); - $ret = array(); - if ($queryarray == '' || count($queryarray) == 0) { - $keywords = ''; $hightlight_key = ''; } else { $keywords = implode('+', $queryarray); $hightlight_key = "&keywords=" . $keywords; } - $itemsObjs = $publisher->getHandler('item')->getItemsFromSearch($queryarray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra); - $withCategoryPath = $publisher->getConfig('search_cat_path'); //xoops_load("xoopslocal"); $usersIds = array(); @@ -56,34 +46,24 @@ } $item['time'] = $obj->getVar('datesub'); //must go has unix timestamp $item['uid'] = $obj->uid(); - - /* - * "Fulltext search"/highlight needs better formulize - * - */ + //"Fulltext search/highlight $text = $obj->body(); $sanitized_text = ""; $text_i = strtolower($text); - $queryarray = is_array($queryarray) ? $queryarray : array($queryarray); - foreach ($queryarray as $query) { - if ($query != '') { - $pos = strpos($text_i, strtolower($query)); //xoops_local("strpos", $text_i, strtolower($query)); - $start = max(($pos - 100), 0); - $length = strlen($query) + 200; //xoops_local("strlen", $query) + 200; - - $context = $obj->highlight(xoops_substr($text, $start, $length, " [...]"), $query); - $sanitized_text .= "<p>[...] " . $context . "</p>"; - } - } + $query = is_array($queryarray) ? $queryarray : array($queryarray); + $pos = strpos($text_i, strtolower($query)); //xoops_local("strpos", $text_i, strtolower($query)); + $start = max(($pos - 100), 0); + $length = strlen($query) + 200; //xoops_local("strlen", $query) + 200; + $context = $obj->highlight(xoops_substr($text, $start, $length, " [...]"), $query); + $sanitized_text .= "<p>[...] " . $context . "</p>"; + //End of highlight $item['text'] = $sanitized_text; $item['author'] = $obj->author_alias(); $item['datesub'] = $obj->datesub($publisher->getConfig('format_date')); $usersIds[$obj->uid()] = $obj->uid(); - $ret[] = $item; unset($item, $sanitized_text); } - xoops_load('XoopsUserUtility'); $usersNames = XoopsUserUtility::getUnameFromIds($usersIds, $publisher->getConfig('format_realname'), true); foreach ($ret as $key => $item) { @@ -92,8 +72,5 @@ } } unset($usersNames, $usersIds); - return $ret; -} - -?> \ No newline at end of file +} \ No newline at end of file |
From: <tr...@us...> - 2012-11-28 13:39:40
|
Revision: 10283 http://sourceforge.net/p/xoops/svn/10283 Author: trabis Date: 2012-11-28 13:39:36 +0000 (Wed, 28 Nov 2012) Log Message: ----------- publisher - fixing bug 'protected' method Modified Paths: -------------- XoopsModules/publisher/trunk/publisher/class/item.php XoopsModules/publisher/trunk/publisher/class/session.php Modified: XoopsModules/publisher/trunk/publisher/class/item.php =================================================================== --- XoopsModules/publisher/trunk/publisher/class/item.php 2012-11-27 23:37:42 UTC (rev 10282) +++ XoopsModules/publisher/trunk/publisher/class/item.php 2012-11-28 13:39:36 UTC (rev 10283) @@ -96,7 +96,7 @@ /** * Just like the name says */ - protected function assignOtherProperties() + public function assignOtherProperties() { $publisher_allCategoriesObj = $this->publisher->getHandler('category')->getAllCategoriesObj(); $this->_category = $publisher_allCategoriesObj[$this->getVar('categoryid')]; Modified: XoopsModules/publisher/trunk/publisher/class/session.php =================================================================== --- XoopsModules/publisher/trunk/publisher/class/session.php 2012-11-27 23:37:42 UTC (rev 10282) +++ XoopsModules/publisher/trunk/publisher/class/session.php 2012-11-28 13:39:36 UTC (rev 10283) @@ -30,8 +30,6 @@ * Starts the session with session_start() * <strong>Note:</strong> that if the session has already started, * session_start() does nothing - * - * @access public */ protected function __construct() { @@ -94,7 +92,7 @@ session_destroy(); } - static function &getInstance() + static public function &getInstance() { static $_sess; if (!isset($_sess)) { |
From: <be...@us...> - 2012-11-27 23:37:45
|
Revision: 10282 http://sourceforge.net/p/xoops/svn/10282 Author: beckmi Date: 2012-11-27 23:37:42 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Adding Toplist module Added Paths: ----------- XoopsModules/toplist/ XoopsModules/toplist/branches/ XoopsModules/toplist/releases/ XoopsModules/toplist/trunk/ XoopsModules/toplist/trunk/toplist/ XoopsModules/toplist/trunk/toplist/add.php XoopsModules/toplist/trunk/toplist/admin/ XoopsModules/toplist/trunk/toplist/admin/admin_header.php XoopsModules/toplist/trunk/toplist/admin/index.html XoopsModules/toplist/trunk/toplist/admin/index.php XoopsModules/toplist/trunk/toplist/admin/menu.php XoopsModules/toplist/trunk/toplist/details.php XoopsModules/toplist/trunk/toplist/images/ XoopsModules/toplist/trunk/toplist/images/index.html XoopsModules/toplist/trunk/toplist/images/toplist.png XoopsModules/toplist/trunk/toplist/images/xoops-toplist.png XoopsModules/toplist/trunk/toplist/include/ XoopsModules/toplist/trunk/toplist/include/date.inc.php XoopsModules/toplist/trunk/toplist/include/functions.php XoopsModules/toplist/trunk/toplist/include/index.html XoopsModules/toplist/trunk/toplist/include/picture.php XoopsModules/toplist/trunk/toplist/include/sql.querys.inc.php XoopsModules/toplist/trunk/toplist/include/user_agent_data.class.php XoopsModules/toplist/trunk/toplist/include/xoops.php XoopsModules/toplist/trunk/toplist/index.php XoopsModules/toplist/trunk/toplist/language/ XoopsModules/toplist/trunk/toplist/language/english/ XoopsModules/toplist/trunk/toplist/language/english/admin.php XoopsModules/toplist/trunk/toplist/language/english/index.html XoopsModules/toplist/trunk/toplist/language/english/main.php XoopsModules/toplist/trunk/toplist/language/english/modinfo.php XoopsModules/toplist/trunk/toplist/language/german/ XoopsModules/toplist/trunk/toplist/language/german/admin.php XoopsModules/toplist/trunk/toplist/language/german/index.html XoopsModules/toplist/trunk/toplist/language/german/main.php XoopsModules/toplist/trunk/toplist/language/german/modinfo.php XoopsModules/toplist/trunk/toplist/language/index.html XoopsModules/toplist/trunk/toplist/sql/ XoopsModules/toplist/trunk/toplist/sql/index.html XoopsModules/toplist/trunk/toplist/sql/mysql.sql XoopsModules/toplist/trunk/toplist/templates/ XoopsModules/toplist/trunk/toplist/templates/index.html XoopsModules/toplist/trunk/toplist/templates/toplist_add.html XoopsModules/toplist/trunk/toplist/templates/toplist_code.html XoopsModules/toplist/trunk/toplist/templates/toplist_detail.html XoopsModules/toplist/trunk/toplist/templates/toplist_index.html XoopsModules/toplist/trunk/toplist/templates/toplist_navi.html XoopsModules/toplist/trunk/toplist/xoops_version.php Added: XoopsModules/toplist/trunk/toplist/add.php =================================================================== --- XoopsModules/toplist/trunk/toplist/add.php (rev 0) +++ XoopsModules/toplist/trunk/toplist/add.php 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1,56 @@ +<?php +// ------------------------------------------------------------------------- // +// XOOPS - PHP Content Management System // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------- // +// Based on: // +// myPHPNUKE Web Portal System - http://myphpnuke.com/ // +// PHP-NUKE Web Portal System - http://phpnuke.org/ // +// Thatware - http://thatware.org/ // +// ------------------------------------------------------------------------- // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// 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. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------- // + +include_once("../../mainfile.php"); + +if (!$xoopsUser) { + redirect_header( XOOPS_URL.'/user.php', 3, _MD_TOPLIST_SITE_MSG_NO_USER); +} + +$xoopsOption['show_cblock'] = 1; +$xoopsOption['template_main'] = "toplist_add.html"; +include $GLOBALS['xoops']->path('header.php'); + +if (isset($_POST['action'])) { + + if (!empty($_POST['name'])) { + + $user_id = $xoopsUser->getVar('uid'); + $website_name = stripslashes($_REQUEST['name']); + $website_url = $_REQUEST['url']; + $website_description = stripslashes($_REQUEST['description']); + $website_approve = 0; + + $result = $xoopsDB->queryF("insert into ".$xoopsDB->prefix("toplist_websites")." set user_id = '$user_id', website_name = '$website_name', website_url = '$website_url', website_description = '$website_description', website_approve = '$website_approve' ") or + redirect_header( XOOPS_URL.'/modules/toplist/', 3, _MD_TOPLIST_SITE_MSG_FALSE); + + redirect_header( XOOPS_URL.'/modules/toplist/', 3, _MD_TOPLIST_SITE_MSG_CHECKING); + exit(); + } else { + redirect_header( XOOPS_URL.'/modules/toplist/add.php', 3, _MD_TOPLIST_SITE_MSG_FALSE); + } +} +include $GLOBALS['xoops']->path('footer.php'); +?> Added: XoopsModules/toplist/trunk/toplist/admin/admin_header.php =================================================================== --- XoopsModules/toplist/trunk/toplist/admin/admin_header.php (rev 0) +++ XoopsModules/toplist/trunk/toplist/admin/admin_header.php 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1,27 @@ +<?php + + include '../../../mainfile.php'; + include_once XOOPS_ROOT_PATH.'/class/xoopsmodule.php'; + include XOOPS_ROOT_PATH.'/include/cp_functions.php'; + + if ( $xoopsUser ) { + $xoopsModule = XoopsModule::getByDirname("toplist"); + + if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) { + redirect_header(XOOPS_URL."/",2,_NOPERM); + exit(); + } + } + else { + redirect_header(XOOPS_URL."/",2,_NOPERM); + exit(); + } + + if ( file_exists("../language/".$xoopsConfig['language']."/admin.php") ) { + include("../language/".$xoopsConfig['language']."/admin.php"); + } + else { + include("../language/english/admin.php"); + } + +?> \ No newline at end of file Added: XoopsModules/toplist/trunk/toplist/admin/index.html =================================================================== --- XoopsModules/toplist/trunk/toplist/admin/index.html (rev 0) +++ XoopsModules/toplist/trunk/toplist/admin/index.html 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/toplist/trunk/toplist/admin/index.php =================================================================== --- XoopsModules/toplist/trunk/toplist/admin/index.php (rev 0) +++ XoopsModules/toplist/trunk/toplist/admin/index.php 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1,224 @@ +<?php +// ------------------------------------------------------------------------- // +// XOOPS - PHP Content Management System // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------- // +// Based on: // +// myPHPNUKE Web Portal System - http://myphpnuke.com/ // +// PHP-NUKE Web Portal System - http://phpnuke.org/ // +// Thatware - http://thatware.org/ // +// ------------------------------------------------------------------------- // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// 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. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------- // + + include_once 'admin_header.php'; + include XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; + + + if (isset($_GET['op']) && $_GET['op'] == 'Siteshow') { + $op = 'Siteshow'; + } + if (isset($_GET['op']) && $_GET['op'] == 'Siteeedit') { + $op = 'Siteedit'; + } + if (isset($_GET['op']) && $_GET['op'] == 'Siteblock') { + $op = 'Siteblock'; + } + if (isset($_GET['op']) && $_GET['op'] == 'Siteapprove') { + $op = 'Siteapprove'; + } + if (isset($_POST['op']) && $_POST['op'] == 'Sitesave') { + $op = 'Sitesave'; + } + +/*********************************************************/ +/* Ephemerids Functions to have a Historic Ephemerids */ +/*********************************************************/ + +function Choice() { + + global $xoopsModule; + xoops_cp_header(); + + echo '<table class="outer" width="100%"><tr><td class="even">'; + echo "<a href='../../system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule ->getVar('mid')."'>"._AM_TOPLIST_CONFIG."</a><br />"; + echo "<a href='index.php?op=Siteshow'>"._AM_TOPLIST_EDIT."</a><br />"; + echo '</td></tr></table>'; + xoops_cp_footer(); +} + +function Siteblock($block=0) { + + global $xoopsDB; + + if (isset($_POST['block']) && $_POST['block'] == 1) { + + $result = $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("toplist_websites")." SET website_approve = 0 WHERE id=".$xoopsDB->quoteString($_POST['id']).""); + redirect_header("index.php?op=Siteshow",2,_AM_TOPLIST_BLOCKTRUE); + exit(); + } + else { + xoops_cp_header(); + xoops_confirm(array('id' => $_GET['id'], 'block' => 1), 'index.php?op=Siteblock', _AM_TOPLIST_SUREBLOCKSITE); + xoops_cp_footer(); + } +} + +function Siteapprove() { + + global $xoopsDB; + + $result = $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("toplist_websites")." SET website_approve = 1 WHERE id=".$xoopsDB->quoteString($_GET['id']).""); + + redirect_header("index.php?op=Siteshow",2,_AM_TOPLIST_APPROVETRUE); + exit(); +} + + + +function Sitesave() { + + global $xoopsDB; + + $id = $_POST['id']; + $website_name = $_POST['website_name']; + $website_url = $_POST['website_url']; + $website_description = $_POST['website_description']; + $website_approve = $_POST['website_approve']; + + + $xoopsDB->query("UPDATE ".$xoopsDB->prefix('toplist_websites')." SET website_name = '".$website_name."', website_url = '".$website_url."', website_description = '".$website_description."', website_approve = '".$website_approve."' WHERE id = '".$id."'"); + redirect_header("index.php?op=Siteshow",3,_AM_TOPLIST_MSGMOD.$_POST['approved']); + exit(); +} + +function Siteedit($id) { + + global $xoopsDB, $xoopsModule; + $myts =& MyTextSanitizer::getInstance(); + xoops_cp_header(); + + $result=$xoopsDB->query("SELECT id, user_id, website_name, website_url, website_description, website_approve FROM ".$xoopsDB->prefix("toplist_websites")." WHERE id = $id "); + list($id, $user_id, $website_name, $website_url, $website_description, $website_approve) = $xoopsDB->fetchRow($result); + + /* + if($user_id !=0 ) { + $disabled="readonly='readonly'"; + } + */ + + $edform = new XoopsThemeForm(_AM_TOPLIST_EDITENTRY, "toplist", "index.php"); + $edformuname = new XoopsFormText(_AM_TOPLIST_SITENAME, "website_name", 75, 75, $website_name); + #$edformuname->setExtra(''.$disabled.''); + $edform->addElement($edformuname); + + $edformemail = new XoopsFormText(_AM_TOPLIST_URL, "website_url", 75, 75, $website_url); + #$edformemail->setExtra(''.$disabled.''); + $edform->addElement($edformemail); + + $edformmessage = new XoopsFormDhtmlTextArea(_AM_TOPLIST_DSC, 'website_description', $website_description, 10, 50); + $edform->addElement($edformmessage); + + $edformapprove = new XoopsFormRadioYN(_AM_TOPLIST_APPROVE, 'website_approve', $website_approve, _YES, _NO); + $edform->addElement($edformapprove); + + $op_hidden = new XoopsFormHidden("op", "Sitesave"); + $edform->addElement($op_hidden); + + $idmsg_hidden = new XoopsFormHidden("id", $_GET['id']); + $edform->addElement($idmsg_hidden); + + $submit_button = new XoopsFormButton("", "dbsubmit", _SUBMIT, "submit"); + $edform->addElement($submit_button); + + $edform->display(); + + + xoops_cp_footer(); +} + +function Siteshow() { + + global $xoopsDB; + $myts =& MyTextSanitizer::getInstance(); + xoops_cp_header(); + + echo "<table border='0' width='90%' class='outer' align='center'> + <tr> + <td class='even'><b>"._AM_TOPLIST_NUM."</b></td> + <td class='odd'><b>"._AM_TOPLIST_SITENAME."</b></td> + <td class='even'><b>"._AM_TOPLIST_URL."</b></td><td class='odd'><b>"._AM_TOPLIST_DSC."</b></td> + <td class='even'><b>"._AM_TOPLIST_ACTION."</b></td> + </tr>"; + + + $result=$xoopsDB->query("SELECT id, user_id, website_name, website_url, website_description, website_approve FROM ".$xoopsDB->prefix("toplist_websites")." ORDER BY id DESC"); + $nbmessage=$xoopsDB->getRowsNum($result); + + $i = 0; + while (list($id, $user_id, $website_name, $website_url, $website_description, $website_approve) = $xoopsDB->fetchRow($result)) { + + $message = ""; + $title = ""; + + $message=$myts->htmlSpecialChars($message, 0, 1, 1); + $title=$myts->htmlSpecialChars($title, 0, 0, 0); + + if($website_approve == 0) $approve="<a href='index.php?op=Siteapprove&id=$id'>"._AM_TOPLIST_APPROVE."</a> | "; + else $approve=""; + $i++; + + $website_description = substr ($website_description, 0, 30 ); + + echo "<tr> + <td class='odd'>$i.)</td> + <td class='odd'>$website_name </td> + <td class='odd'>$website_url </td> + <td class='even'>$website_description </td> + + <td class='odd'>".$approve."<a href='index.php?op=Siteeedit&id=$id'>"._AM_TOPLIST_EDIT."</a> | <a href='index.php?op=Siteblock&id=$id'>"._AM_TOPLIST_BLOCK."</a></td> + </tr>"; + $nbmessage--; + } + + echo "</table>"; + + xoops_cp_footer(); +} + + +switch($op) { + case "Sitesave": + Sitesave(); + break; + case "Siteedit": + Siteedit($_GET["id"]); + break; + case "Siteapprove": + Siteapprove(); + break; + case "Siteblock": + Siteblock(); + break; + + case "Siteshow": + Siteshow(); + break; + default: + Choice(); + break; +} + +?> Added: XoopsModules/toplist/trunk/toplist/admin/menu.php =================================================================== --- XoopsModules/toplist/trunk/toplist/admin/menu.php (rev 0) +++ XoopsModules/toplist/trunk/toplist/admin/menu.php 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1,7 @@ +<?php + +$adminmenu[1]['title'] = _MI_TOPLIST_MODULE_SETTINGS; +$adminmenu[1]['link'] = "admin/index.php?op=Siteshow"; + + +?> \ No newline at end of file Added: XoopsModules/toplist/trunk/toplist/details.php =================================================================== --- XoopsModules/toplist/trunk/toplist/details.php (rev 0) +++ XoopsModules/toplist/trunk/toplist/details.php 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1,210 @@ +<?php +// ------------------------------------------------------------------------- // +// XOOPS - PHP Content Management System // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------- // +// Based on: // +// myPHPNUKE Web Portal System - http://myphpnuke.com/ // +// PHP-NUKE Web Portal System - http://phpnuke.org/ // +// Thatware - http://thatware.org/ // +// ------------------------------------------------------------------------- // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// 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. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------- // + + + +if(strpos(getenv('REQUEST_URI'), '/modules/toplist/') === 0) +{ +$oldurl = getenv('REQUEST_URI'); +$newurl = str_replace("modules/toplist", "topliste", $oldurl); @header("HTTP/1.1 301 Moved Permanently"); +@header("Location: $newurl"); +} + +include_once("../../mainfile.php"); + +$xoopsOption['template_main'] = 'toplist_detail.html'; + +include $GLOBALS['xoops']->path('header.php'); + +require_once("include/functions.php"); +// check valid date +require_once("include/date.inc.php"); +// read xoops websites today +require_once("include/sql.querys.inc.php"); + +// follow link +$xoopsModuleConfig['toplist_nofollow'] == 0 ? $xoopsTpl->assign('follow', 'rel="nofollow"') : $xoopsTpl->assign('follow', ''); + +// today +$result21 = $xoopsDB->query($sql); + +#print_r($xoopsDB->fetchRow($result21)); +$website = array(); + +while(list($site_count, $timestamp, $url, $name, $description) = $xoopsDB->fetchRow($result21)) { + $website[$timestamp] = array("site_count" => $site_count, "timestamp" => $timestamp, "url" => $url, "name" => $name, "description" => $description); +} + +// user today exists? +if (count($website) > 0) { + + $j = 0; + foreach ($website as $key => $value) { + + if ($key >= $t_hour) { + $j++; + } + + $website_name = $value['name']; + $website_description = $value['description']; + $website_url = $value['url']; + } + $site_count = count($website); + $count_last_hour = $j; +} + + +$count_today = $site_count; +$count_week = 0; +$count_month = 0; +$count_six_month = 0; +$count_year = 0; +$count_always = 0; +$count_days = 0; +$highest_value = 0; + +#print_r($website); + + +$lowest_value = 10000000; + +// history +$result1 = $xoopsDB->query($sql1); +// url is valid + +#print_r($xoopsDB->fetchRow($result1)); +#exit(); + +while(list($site_count, $timestamp, $profileid, $url, $name, $description) = $xoopsDB->fetchRow($result1)) { + $website_history[$timestamp] = array("site_count" => $site_count, "timestamp" => $timestamp, "profilid" => $profileid, "url" => $url, "name" => $name, "description" => $description); +} + +#print_r($website_history); + +// history exists? +if (count($website_history) > 0) { + + foreach ($website_history as $key => $value) { + + // online_since + if (!isset($online_since)) { + $online_since = $key; + } + // yesterday + if ($key == $yesterday) { + $count_yesterday = $value['site_count']; + } + // week + if ($key >= $week) { + $count_week = $count_week + $value['site_count']; + } + // month + if ($key >= $t_month) { + $count_month = $count_month + $value['site_count']; + } + // six month + if ($key >= $t_six_month) { + $count_six_month = $count_six_month + $value['site_count']; + } + // year + if ($key >= $t_year) { + $count_year = $count_year + $value['site_count']; + } + // always + $count_always = $count_always + $value['site_count']; + + // count days + $count_days++; + + // highest value + $highest_value < $value['site_count'] ? $highest_value = $value['site_count'] : $highest_value = $highest_value; + + // lowest value + $lowest_value < $value['site_count'] ? $lowest_value = $lowest_value : $lowest_value = $value['site_count']; + + // website description + $website_description = $value['description']; + + // website name + $website_name = $value['name']; + + // website url + $website_url = $value['url']; + } +} + +$online_since = date("d.m.Y",$online_since); +$online_since == "01.01.1970" ? $online_since = date("d.m.Y",time()) : $online_since = $online_since; + +$online_since_day = $count_days+1; + +$highest_value = $highest_value < $count_today ? $highest_value = $count_today : $highest_value = $highest_value; +$lowest_value = $lowest_value > $count_today ? $lowest_value = $count_today : $lowest_value = $lowest_value; + +empty($lowest_value) ? $lowest_value = 0 : $lowest_value = $lowest_value; + +$count_last_hour = empty($count_last_hour) ? $count_last_hour = 0 : $count_last_hour = $count_last_hour; +$count_today = empty($count_today) ? $count_today = 0 : $count_today = $count_today; +$count_yesterday = empty($count_yesterday) ? $count_yesterday = 0 : $count_yesterday = $count_yesterday; +$count_week = $count_week + $count_today; + +empty($count_week) ? $count_week = 0 : $count_week = $count_week; + +$count_month = $count_month + $count_today; + +empty($count_month) ? $count_month = 0 : $count_month = $count_month; + +$count_six_month = $count_six_month + $count_today; + +empty($count_six_month) ? $count_six_month = 0 : $count_six_month = $count_six_month; + +$count_year = $count_year + $count_today; + +empty($count_year) ? $count_year = 0 : $count_year = $count_year; + +$count_always = $count_always + $count_today; + +$average = round($count_always / $online_since_day); + +$xoopsTpl->assign('website_name', $website_name); +$xoopsTpl->assign('website_description', $website_description); +$xoopsTpl->assign('website_url', $website_url); +$xoopsTpl->assign('online_since', $online_since); +$xoopsTpl->assign('online_since_day', $online_since_day); +$xoopsTpl->assign('highest_value', $highest_value); +$xoopsTpl->assign('lowest_value', $lowest_value); +$xoopsTpl->assign('count_last_hour', $count_last_hour); +$xoopsTpl->assign('count_today', $count_today); +$xoopsTpl->assign('count_yesterday', $count_yesterday); +$xoopsTpl->assign('count_week', $count_week); +$xoopsTpl->assign('count_month', $count_month); +$xoopsTpl->assign('count_six_month', $count_six_month); +$xoopsTpl->assign('count_year', $count_year); +$xoopsTpl->assign('count_always', $count_always); +$xoopsTpl->assign('count_average', $average); + +$xoopsTpl->assign('xoops_pagetitle', _MD_TOPLIST_ALWAYS." ".str_replace("http://www.","",$website_name)); +include(XOOPS_ROOT_PATH."/footer.php"); +?> \ No newline at end of file Added: XoopsModules/toplist/trunk/toplist/images/index.html =================================================================== --- XoopsModules/toplist/trunk/toplist/images/index.html (rev 0) +++ XoopsModules/toplist/trunk/toplist/images/index.html 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/toplist/trunk/toplist/images/toplist.png =================================================================== (Binary files differ) Property changes on: XoopsModules/toplist/trunk/toplist/images/toplist.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/toplist/trunk/toplist/images/xoops-toplist.png =================================================================== (Binary files differ) Property changes on: XoopsModules/toplist/trunk/toplist/images/xoops-toplist.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/toplist/trunk/toplist/include/date.inc.php =================================================================== --- XoopsModules/toplist/trunk/toplist/include/date.inc.php (rev 0) +++ XoopsModules/toplist/trunk/toplist/include/date.inc.php 2012-11-27 23:37:42 UTC (rev 10282) @@ -0,0 +1,51 @@ +<?php + +$hour = date("H"); +$day = date("d"); +$month = date("m"); +$year = date("Y"); + +$t_hour = mktime($hour-1,0,0,$month,$day,$year); +$today = mktime(0,0,0,$month,$day,$year); +$tomorrow = mktime(0,0,0,$month,$day+1,$year); +$yesterday = mktime(0,0,0,$month,$day-1,$year); +$week = mktime(0,0,0,$month,$day-6,$year); + +$t_month = mktime(0,0,0,$month-1,$day,$year); +$t_six_month = mktime(0,0,0,$month-6,$day,$year); +$t_year = mktime(0,0,0,$month,$day,$year-1); + +$history_array = array(); + +#echo $today."<br>".$tomorrow; + +// last id in database +$sql = "SELECT id, timestamp FROM ".$xoopsDB->prefix("toplist_log")." ORDER BY id DESC LIMIT 1"; +$result = $xoopsDB->query($sql) or exit("Error"); +$last_timestamp = $xoopsDB->fetchArray($result); + +// last timestamp +if ($last_timestamp['timestamp'] < $today) { + + $sql = "SELECT count(".$xoopsDB->prefix("toplist_log").".website_id) as visitors, ".$xoopsDB->prefix("toplist_log").".website_id FROM ".$xoopsDB->prefix("toplist_log")." + GROUP BY ".$xoopsDB->prefix("toplist_log").".website_id ORDER BY visitors DESC"; + + $result = $xoopsDB->query($sql); + + while(list($visitors, $user_id) = $xoopsDB->fetchRow($result)) { + + $history_array[] = array("website_id" => $user_id, + "site_count" => $visitors, + "timestamp" => $yesterday); + } + + for ($i=0;$i<count($history_array);$i++) { + $sql_history_write = "insert into ".$xoopsDB->prefix("toplist_history")." set website_id = '".$history_array[$i]['website_id']."', site_count = '".$history_array[$i]['site_count']."', timestamp = '$yesterday'"; + $result = $xoopsDB->queryF($sql_history_write); + } + + // delete toplist_log + $result = $xoops |
From: <be...@us...> - 2012-11-27 20:34:03
|
Revision: 10281 http://sourceforge.net/p/xoops/svn/10281 Author: beckmi Date: 2012-11-27 20:34:00 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Renaming folder Added Paths: ----------- XoopsModules/wfresource/trunk/wfresource/ Removed Paths: ------------- XoopsModules/wfresource/trunk/wfresources/ |
From: <txm...@us...> - 2012-11-27 17:13:58
|
Revision: 10280 http://sourceforge.net/p/xoops/svn/10280 Author: txmodxoops Date: 2012-11-27 17:13:56 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Added Added Paths: ----------- XoopsCore/tags/2.6 timgno/htdocs/media/xoops/images/icons/32/translations.png XoopsCore/tags/2.6 timgno/htdocs/media/xoops/images/icons/32/wizard.png Added: XoopsCore/tags/2.6 timgno/htdocs/media/xoops/images/icons/32/translations.png =================================================================== (Binary files differ) Property changes on: XoopsCore/tags/2.6 timgno/htdocs/media/xoops/images/icons/32/translations.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsCore/tags/2.6 timgno/htdocs/media/xoops/images/icons/32/wizard.png =================================================================== (Binary files differ) Property changes on: XoopsCore/tags/2.6 timgno/htdocs/media/xoops/images/icons/32/wizard.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream |
From: <txm...@us...> - 2012-11-27 17:12:32
|
Revision: 10279 http://sourceforge.net/p/xoops/svn/10279 Author: txmodxoops Date: 2012-11-27 17:12:31 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Added Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/32/translations.png XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/32/wizard.png Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/32/translations.png =================================================================== (Binary files differ) Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/32/translations.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/32/wizard.png =================================================================== (Binary files differ) Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/32/wizard.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream |
From: <txm...@us...> - 2012-11-27 16:56:21
|
Revision: 10278 http://sourceforge.net/p/xoops/svn/10278 Author: txmodxoops Date: 2012-11-27 16:56:17 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Revision Updated Modified Paths: -------------- XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/theme.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/tpl/footer.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/tpl/header.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/tpl/metas.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/tpl/scripts.html Added Paths: ----------- XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/jqm-init.css XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style-icons.css XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style.css XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/index.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/xlogo.png XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/js/jqm-init.js XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/modules/ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/modules/index.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/modules/system/ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/modules/system/index.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/modules/system/system_redirect.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/modules/system/system_siteclosed.html XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/tpl/dcontent.html Added: XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/jqm-init.css =================================================================== --- XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/jqm-init.css (rev 0) +++ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/jqm-init.css 2012-11-27 16:56:17 UTC (rev 10278) @@ -0,0 +1,457 @@ +/* jqm docs css + +Beware: lots of last-minute CSS going on in here +cobblers, shoes, +*/ + +body { background: #f9f9f9; padding:13px; } +body.ui-mobile-viewport { padding: 0; } +body, input, textarea, select, button { font-family: Helvetica, Arial, san-serif; } +.ui-mobile .type-home .ui-content { margin: 0; background: #e5e5e5 url(../images/jqm-sitebg.png) top center repeat-x; } +.ui-mobile #jqm-homeheader { padding: 40px 10px 0; text-align: center; margin: 0 auto; } +.ui-mobile #jqm-homeheader h1 { margin: 0 0 ; } +.ui-mobile #jqm-homeheader p { margin: .3em 0 0; line-height: 1.3; font-size: .9em; font-weight: bold; color: #666; } + +.type-home .ui-content .jqm-version { + display: block; + position: absolute; + width: 96px; + border: solid #fff; + border-width: 2px 1px; + padding: .25em 2.25em; + margin: 0 15px 0 0; + right: 0; + top: -2px; + background: #f7cf57; + color: #000; + font-size: .8em; + font-weight: bold; + text-align: center; + text-shadow: 0 1px 1px #fff; + z-index: 9; + -webkit-transform: rotate(45deg) translate(4.8em,-1em); + -moz-transform: rotate(45deg) translate(4.8em,-1em); + -ms-transform: rotate(45deg) translate(4.8em,-1em); + -o-transform: rotate(45deg) translate(4.8em,-1em); + transform: rotate(45deg); + -webkit-box-shadow: 0 0 6px rgba(0,0,0,.40); + -moz-box-shadow: 0 0 6px rgba(0,0,0,.40); + -o-box-shadow: 0 0 6px rgba(0,0,0,.40); + box-shadow: 0 0 6px rgba(0,0,0,.40); +} +.type-home .ui-content .jqm-version b { + color: #a21412; + font-weight: bold; +} + +.footer-docs { + padding: 5px 0; + clear:both; + color:#666; +} +.footer-docs p { + font-weight: normal; + font-size: .9em; +} +.ui-mobile-viewport .footer-docs p { + margin: .5em 15px; +} +.ui-mobile-viewport .footer-docs p.jqm-version { + font-weight: bold; +} +@media all and (min-width:650px) { + .ui-mobile-viewport .footer-docs { + overflow: hidden; + } + .ui-mobile-viewport .footer-docs p { + margin: 1em 15px; + float: left; + } + .ui-mobile-viewport .footer-docs p.jqm-version { + float: right; + font-weight: normal; + } +} + +h2 { margin:1.2em 0 .4em 0; } +p code { font-size:1.2em; font-weight:bold; } +h4 code {font-size:1.2em; font-weight:bold; } + +dt { font-weight: bold; margin: 2em 0 .5em; } +dt code, dd code { font-size:1.3em; line-height:150%; } +pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; } +strong { font-weight: bold; } + +#jqm-homeheader img { width: 275px; height: 78px; margin-top:-20px; } +img { max-width: 100%; } + +/* fluid images moved from jquery.mobile.core.css*/ +.ui-mobile img { + max-width: 100%; +} + +.ui-header .jqm-home { top: 0; } +nav { margin: 0; } + +p.intro { + font-size: .96em; + line-height: 1.3; + border-top: 1px solid #75ae18; + border-bottom: 0; + background: none; + margin: 1.5em 0; + padding: 1.5em 15px 0; +} +p.intro strong { + color: #558e08; +} + +.type-interior .content-secondary { + border-right: 0; + border-left: 0; + margin: 10px -15px 0; + background: #fff; + border-top: 1px solid #ccc; +} +.type-home .ui-content { + margin-top: 5px; + overflow: hidden; + position: relative; +} +.type-interior .ui-content { + padding-bottom: 0; +} +.content-secondary .ui-collapsible { + padding: 10px 15px; +} +.content-secondary .ui-collapsible-inset { + margin: 0; +} +.content-secondary .ui-collapsible-content { + padding: 0; + background: none; +} +.content-secondary .ui-listview { + margin: 0; +} +/* new API additions */ + +dt { + margin: 35px 0 15px 0; + background-color:#ddd; + font-weight:normal; +} +dt code { + display:inline-block; + font-weight:bold; + color:#56A00E; + padding:3px 7px; + margin-right:10px; + background-color:#fff; +} +dd { + margin-bottom:10px; +} +dd .default { font-weight:bold; } +dd pre { + margin:0 0 0 0; +} +dd code { font-weight: normal; } +dd pre code { + margin:0; + border:none; + font-weight:normal; + font-size:100%; + background-color:transparent; +} +dd h4 { margin:15px 0 0 0; } + +.localnav { + margin:0 0 20px 0; +} +.ui-mobile-viewport .localnav li { + float:left; +} +.localnav .ui-btn-inner { + padding: .6em 10px; + font-size:80%; +} + +/* custom dialog for the photos sharing */ +.ui-dialog.dialog-actionsheet .ui-dialog-contain { + margin-top: 0; +} + +/* popup examples */ +.type-interior .ui-popup-container .ui-content { padding: 15px !important; } + +/* F bar theme - just for the docs overview headers */ +.ui-bar-f { + border: 1px solid #56A00E; + background: #74b042; + color: #fff; + font-weight: bold; + text-shadow: 0 1px 1px #335413; + background-image: -webkit-gradient(linear, left top, left bottom, from(#74b042), to(#56A00E)); /* Saf4+, Chrome */ + background-image: -webkit-linear-gradient(#74b042, #56A00E); /* Chrome 10+, Saf5.1+ */ + background-image: -moz-linear-gradient(#74b042, #56A00E); /* FF3.6 */ + background-image: -ms-linear-gradient(#74b042, #56A00E); /* IE10 */ + background-image: -o-linear-gradient(#74b042, #56A00E); /* Opera 11.10+ */ + background-image: linear-gradient(#74b042, #56A00E); +} +.ui-bar-f, +.ui-bar-f input, +.ui-bar-f select, +.ui-bar-f textarea, +.ui-bar-f button { + font-family: Helvetica, Arial, sans-serif /*{global-font-family}*/; +} + +.ui-bar-f, +.ui-bar-f .ui-link-inherit { + color: #fff; +} +.ui-bar-f .ui-link { + color: #fff; + font-weight: bold; +} +.ui-btn-up-f { + border: 1px solid #3B6F07; + background: #56A00E; + font-weight: bold; + color: #fff; + text-shadow: 0 1px 1px #234403; + background-image: -webkit-gradient(linear, left top, left bottom, from(#74b042), to(#56A00E)); /* Saf4+, Chrome */ + background-image: -webkit-linear-gradient(#74b042, #56A00E); /* Chrome 10+, Saf5.1+ */ + background-image: -moz-linear-gradient(#74b042, #56A00E); /* FF3.6 */ + background-image: -ms-linear-gradient(#74b042, #56A00E); /* IE10 */ + background-image: -o-linear-gradient(#74b042, #56A00E); /* Opera 11.10+ */ + background-image: linear-gradient(#74b042, #56A00E); +} +.ui-btn-up-f a.ui-link-inherit { + color: #fff; +} +.ui-btn-hover-f { + border: 1px solid #3B6F07; + background: #6EBC1F; + font-weight: bold; + color: #fff; + text-shadow: 0 1px 1px #234403; + background-image: -webkit-gradient(linear, left top, left bottom, from(#8FC963), to(#6EBC1F)); /* Saf4+, Chrome */ + background-image: -webkit-linear-gradient(#8FC963, #6EBC1F); /* Chrome 10+, Saf5.1+ */ + background-image: -moz-linear-gradient(#8FC963, #6EBC1F); /* FF3.6 */ + background-image: -ms-linear-gradient(#8FC963, #6EBC1F); /* IE10 */ + background-image: -o-linear-gradient(#8FC963, #6EBC1F); /* Opera 11.10+ */ + background-image: linear-gradient(#8FC963, #6EBC1F); +} +.ui-btn-hover-f a.ui-link-inherit { + color: #fff; +} +.ui-btn-down-f { + border: 1px solid #3B6F07; + background: #3d3d3d; + font-weight: bold; + color: #fff; + text-shadow: 0 1px 1px #234403; + background-image: -webkit-gradient(linear, left top, left bottom, from(#56A00E), to(#64A234)); /* Saf4+, Chrome */ + background-image: -webkit-linear-gradient(#56A00E, #64A234); /* Chrome 10+, Saf5.1+ */ + background-image: -moz-linear-gradient(#56A00E, #64A234); /* FF3.6 */ + background-image: -ms-linear-gradient(#56A00E, #64A234); /* IE10 */ + background-image: -o-linear-gradient(#56A00E, #64A234); /* Opera 11.10+ */ + background-image: linear-gradient(#56A00E, #64A234); +} +.ui-btn-down-f a.ui-link-inherit { + color: #fff; +} +.ui-btn-up-f, +.ui-btn-hover-f, +.ui-btn-down-f { + font-family: Helvetica, Arial, sans-serif; + text-decoration: none; +} + + +/* docs site layout */ + +@media all and (min-width: 650px){ + + .type-home .ui-content { + margin-top: 5px; + } + .ui-mobile #jqm-homeheader { + max-width: 340px; + } + p.intro { + margin: 2em 0; + } + .type-home .ui-content, + .type-interior > .ui-content { + padding: 0; + } + .type-interior > .ui-content { + overflow: hidden; + } + .content-secondary { + text-align: left; + float: left; + width: 45%; + } + .content-secondary, + .type-interior .content-secondary { + margin: 30px 0 20px 2%; + padding: 20px 4% 0 0; + background: none; + border-top: none; + position: relative; + } + .type-interior .content-secondary::after { + content: ""; + display: inline-block; + position: absolute; + top: 0; + right: 0; + height: 1px; + width: 1px; + margin-bottom: -9999px; + padding-bottom: 9999px; + background: #bbb; + } + .type-index .content-secondary { + padding: 0; + } + .content-secondary .ui-collapsible { + margin: 0; + padding: 0; + } + .content-secondary .ui-collapsible-content { + border-left: none; + border-right: none; + } + .type-index .content-secondary .ui-listview { + margin: 0; + } + .ui-mobile #jqm-homeheader { + padding: 0; + } + .content-primary { + width: 45%; + float: right; + margin-top: 30px; + margin-right: 1%; + padding-right: 1%; + } + .content-primary ul:first-child { + margin-top: 0; + } + /* collapsible non-inset example */ + .content-primary .ui-collapsible-content ul:first-child { + margin-top: -10px; + } + .content-secondary h2 { + position: absolute; + left: -9999px; + } + .type-interior .content-primary { + padding: 1.5em 6% 3em 0; + margin: 0; + } + /* fix up the collapsibles - expanded on desktop */ + .content-secondary .ui-collapsible-inset { + margin-bottom: -1px; + } + .content-secondary .ui-collapsible-heading { + display: none; + } + .content-secondary .ui-collapsible-contain { + margin:0; + } + .content-secondary .ui-collapsible-content { + display: block; + margin: 0; + padding: 0; + } + .content-secondary .ui-collapsible-content, + .content-secondary .ui-collapsible-content > .ui-listview .ui-li-last { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } + .type-interior .content-secondary .ui-li-divider { + padding-top: 1em; + padding-bottom: 1em; + } + .type-interior .content-secondary { + margin: 0; + padding: 0; + } + +} +@media all and (min-width: 750px){ + .type-home .ui-content { + background-position: 39%; + } + .content-secondary { + width: 34%; + } + .content-primary { + width: 56%; + padding-right: 1%; + } +} + +@media all and (min-width: 1200px){ + .type-home .ui-content{ + background-position: 38.5%; + } + .content-secondary { + width: 30%; + padding-right:6%; + margin: 30px 0 20px 5%; + } + .type-interior .content-secondary { + margin: 0; + padding: 0; + } + .content-primary { + width: 50%; + margin-right: 5%; + padding-right: 3%; + } + .type-interior .content-primary { + width: 60%; + } +} + +/* reset for popup examples */ +.type-interior .ui-popup.ui-content, +.type-interior .ui-popup .ui-content { + background-position: 0 0; + background-repeat: no-repeat; + overflow: visible; +} + +/* tables documenting enum-type settings */ +.enum-value { + vertical-align: top; + white-space: nowrap; +} + +/* Navbar examples */ +.content-primary > .ui-header, +.content-primary > .ui-footer { + overflow: hidden; +} + +/* list styles */ +ul { margin:0; padding-left:0; } +ul li { list-style:none; padding:.7em 0; margin:0; border-bottom:1px solid #e3e3e3; } +ul ul li { border: none;} + +dl dd ul { padding-left: 40px; } +dl dd ul li { list-style: disc; } +dl dd ul li li { list-style: circle; } +dl dd ul li li li { list-style: square; } +dl dd ul li { border: none; } + +.ui-mobile-viewport .localnav li { + border: none; +} Added: XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style-icons.css =================================================================== --- XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style-icons.css (rev 0) +++ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style-icons.css 2012-11-27 16:56:17 UTC (rev 10278) @@ -0,0 +1,19 @@ +.ui-icon-myapphome-settings { + background: url("../img/home.png") no-repeat rgba(0, 0, 0, 0) !important; + background-size: 28px 23px; + } + +.ui-icon-myappcerca-settings { + background: url("../img/cerca.png") no-repeat rgba(0, 0, 0, 0) !important; + background-size: 28px 23px; + } + +.ui-icon-myappcarrello-settings { + background: url("../img/carrello.png") no-repeat rgba(0, 0, 0, 0) !important; + background-size: 28px 23px; + } + +.logo { + background: url(../img/xlogo.png) no-repeat rgba(0, 0, 0, 0) !important; + background-size: 100px 33px; +} \ No newline at end of file Added: XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style.css =================================================================== --- XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style.css (rev 0) +++ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/css/style.css 2012-11-27 16:56:17 UTC (rev 10278) @@ -0,0 +1,232 @@ +html, body {color: #000; background-color: #fff; margin: 0; padding: 0; font-size:9pt; font-family: Verdana, Arial, Helvetica, sans-serif;} + +.item {border: 1px solid #666;} +.itemHead {padding: 3px; background-color: #2A75C5; color: #fff;} +.itemInfo {text-align: right; padding: 3px; background-color: #efefef} +.itemTitle a {font-size: 1.2em; font-weight: bold; font-variant: small-caps; color: #fff; background-color: transparent;} +.itemPoster {font-size: .9em; font-style:italic;} +.itemPostDate {font-size: .9em; font-style:italic;} +.itemStats {font-size: .9em; font-style:italic;} +.itemBody {padding-left: 5px;} +.itemText {margin-top: 5px; margin-bottom: 5px; line-height: 1.5em;} +.itemText:first-letter {font-size: 1.3em; font-weight: bold;} +.itemFoot {text-align: right; padding: 3px; background-color: #efefef;} +.itemAdminLink {font-size: .9em;} +.itemPermaLink {font-size: .9em;} + +#content {text-align: left; padding: 8px;} + +caption {font-weight: bold;} +th, thead {background-color: #2A75C5; padding : 2px; color: #fff; vertical-align : middle;} +.outer {border: 1px solid #c0c0c0;} +.head {background-color: #c2cdd6; padding: 5px; font-weight: bold;} +.even {background-color: #dee3e7; padding: 5px;} +.odd {background-color: #E9E9E9; padding: 5px;} +.foot {background-color: #c2cdd6; padding: 5px; font-weight: bold;} + +.errorMsg,.confirmMsg, .resultMsg { padding: .8em; text-align:center; margin-bottom: 1em; border: 2px solid #ddd;} +.errorMsg { background-color: #FBE3E4; color: #D12F19; border-color: #FBC2C4; } +.confirmMsg { background-color: #FFF6BF; color: #817134; border-color: #FFD324; } +.resultMsg { background-color: #E6EFC2; color: #529214; border-color: #C6D880; } +.errorMsg a { background-color: transparent; color: #D12F19; } +.confirmMsg a { background-color: transparent; color: #817134; } +.successMsg a { background-color: transparent; color: #529214; } + +/*============== Styles for system_siteclosed.html (override system module) =================*/ +#xo-siteclose { + width: 400px; + margin: 100px auto; + background-color: #e2e2e2; + padding: 30px; + color: #000; + font-size: 1.2em; + font-weight: bold; + text-align: center; + border: 1px solid #666; +} +#xo-userbar_siteclosed { + display: block; + background: #2A75C5 url(xo-banner_bg.png) repeat-x left top; + padding-top: 8px; + padding-right: 1em; + color: #fff; + font-size : .8em; + text-align : center; +} +#xo-userbar_siteclosed form { + display: inline; + padding: 0; +} + +#xo-userbar_siteclosed input, #xo-userbar_siteclosed button { + width: 100px; + background-color: transparent; + color: #fff; + font-size : .9em; + margin: 2px; +} +#xo-userbar_siteclosed input:hover {} + +/*============== Styles for pagenav =================*/ +#xo-pagenav { + margin: 7px 0; + text-align: center; + font-size: 1.05em; +} +#xo-pagenav a { + text-decoration: none; +} +#xo-pagenav a:hover { + color: #fff; + background-color: #2A75C5; + border: 1px solid #fff; +} +.xo-pagact { + margin: 0; + padding: .2em .5em; + color: #fff; + background-color: #2A75C5; + border: 1px solid #fff; +} +.xo-counterpage, .xo-pagarrow { + margin: 0; + padding: .2em .5em; + color: #000; + background-color: #fff; + border: 1px solid #000; +} +.xo-counterpage:hover {} +.xo-pagarrow { + letter-spacing: 0.2em; +} +/*======= Tinymce background textarea ========*/ +body.mceContentBody { + margin: 0; + padding: 0; + background-color: #fff; + background-image: none; + color: #000; +} + +/* normal image */ +.normal-img { + background: #ccc; + border: solid 1px #000; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .4); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .4); + box-shadow: 0 1px 3px rgba(0, 0, 0, .4); +} +.normal-img-2 { + display: inline-block; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + -webkit-box-shadow: inset 0 1px 5px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 255, 255, 1), 0 -1px 0 rgba(0, 0, 0, .6); + -moz-box-shadow: inset 0 1px 5px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .9), 0 -1px 0 rgba(0, 0, 0, .6); + box-shadow: inset 0 1px 5px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, 1), 0 -1px 0 rgba(0, 0, 0, .6); +} + +/* rounded image styles */ +.rounded-img { + display: inline-block; + border: solid 1px #000; + overflow: hidden; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .4); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .4); + box-shadow: 0 1px 3px rgba(0, 0, 0, .4); +} +.rounded-img2 { + display: inline-block; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + -webkit-box-shadow: inset 0 1px 5px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .9), 0 -1px 0 rgba(0, 0, 0, .6); + -moz-box-shadow: inset 0 1px 5px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .9), 0 -1px 0 rgba(0, 0, 0, .6); + box-shadow: inset 0 1px 5px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .9), 0 -1px 0 rgba(0, 0, 0, .6); +} + +.ui-btn-icon-notext-tool { width: 45px; height: 30px; } +.ui-btn-icon-notext-tool .ui-btn-inner { padding:4px 5px 0px 9px; } +.ui-icon-tool { width: 28px; height: 23px; } +.ui-btn-icon-notext .ui-icon-tool { display: block; z-index: 0;} +.ui-icon-tool +{ + background: #000 /*{global-icon-color}*/; + background: rgba(0,0,0,0) /*{global-icon-disc}*/; + background-image: url(images/icons-18-white.png) /*{global-icon-set}*/; + background-repeat: no-repeat; + +} + +/* modifica css base */ +.ui-body-c{ + border: 1px solid #B3B3B3; /*{c-body-border}*/ + color: #333333; /*{c-body-color}*/ + text-shadow: 0 /*{c-body-shadow-x}*/ 1px /*{c-body-shadow-y}*/ 0 /*{c-body-shadow-radius}*/ #fff /*{c-body-shadow-color}*/; + background: #ffffff /*{c-body-background-color}*/; + background-image: -webkit-gradient(linear, left top, left bottom, from( #fff /*{c-body-background-start}*/), to( #fff /*{c-body-background-end}*/)); /* Saf4+, Chrome */ + background-image: -webkit-linear-gradient(#fff /*{c-body-background-start}*/, #fff /*{c-body-background-end}*/); /* Chrome 10+, Saf5.1+ */ + background-image: -moz-linear-gradient(#fff /*{c-body-background-start}*/, #fff /*{c-body-background-end}*/); /* FF3.6 */ + background-image: -ms-linear-gradient(#fff /*{c-body-background-start}*/, #fff /*{c-body-background-end}*/); /* IE10 */ + background-image: -o-linear-gradient(#fff /*{c-body-background-start}*/, #fff /*{c-body-background-end}*/); /* Opera 11.10+ */ + background-image: linear-gradient(#fff /*{c-body-background-start}*/, #fff /*{c-body-background-end}*/); +} + +.ui-btn-corner-top-tool { + -moz-border-radius-topleft: 0.5em /*{global-radii-buttons}*/; + -webkit-border-top-left-radius: 0.5em /*{global-radii-buttons}*/; + border-top-left-radius: 0.5em /*{global-radii-buttons}*/; + -moz-border-radius-topright: 0.5em /*{global-radii-buttons}*/; + -webkit-border-top-right-radius: 0.5em /*{global-radii-buttons}*/; + border-top-right-radius: 0.5em /*{global-radii-buttons}*/; +} + +.ui-btn-corner-all-tool { + -moz-border-radius: 0.5em /*{global-radii-buttons}*/; + -webkit-border-radius: 0.5em /*{global-radii-buttons}*/; + border-radius: 0.5em /*{global-radii-buttons}*/; +} + +.iconeHome {background-repeat:no-repeat;background-position:left top;display:block;width:139px;height:133px;overflow:hidden;text-indent:-1000px} +.iconeHome:hover {background-position: left -133px;} +.iconeHome:active {background-position: left -133px;} + +.ui-icon-myapphome-settings {background: url("/img/drawable-mdpi/home.png") no-repeat rgba(0, 0, 0, 0) !important;} +.ui-icon-myappcerca-settings {background: url("/img/drawable-mdpi/cerca.png") no-repeat rgba(0, 0, 0, 0) !important;} +.ui-icon-myappcarrello-settings {background: url("/img/drawable-mdpi/carrello.png") no-repeat rgba(0, 0, 0, 0) !important;} + +/*.header{background:url(../img/bg_header.png); repeat: left top; height: 47px;} +.carrello{background-image:url(../img/icons/menu_carrello.png)} +.catalogo{background-image:url(../img/icons/menu_catalogo.png)} +.top10{background-image:url(../img/icons/menu_topten.png)} +.help{background-image:url(../img/icons/menu_help.png)} +.logo{background:url(../img/xlogo.png) no-repeat left 4px; width:100px; height: 35px; text-indent: -1000px; margin:0px 2px;} + + scheda Prodotto +.spTitolo{font-family:Helvetica;font-size:18px;color:#035a9c;text-transform:uppercase;font-weight:bold} +.spAutore{font-family:Helvetica;font-size:13px;text-transform:uppercase;} +.spPrezzoNetto{font-family:Helvetica;font-size:16px;color:#035a9c;text-transform:uppercase;font-weight:bold} +.spPrezzoLordo{font-family:Helvetica;font-size:13px;} +.spSconto{font-family:Helvetica;font-size:16px;color:red;text-transform:uppercase;font-weight:bold} +.spEditore{font-family:Helvetica;font-size:16px;color:#035a9c;text-transform:uppercase;font-weight:bold} +.spPubblicazione{font-family:Helvetica;font-size:16px;color:#035a9c;text-transform:uppercase;font-weight:bold} +.spDescrizione{font-family:Helvetica;font-size:16px;color:#035a9c;font-weight:bold} + *//* scheda Prodotto */ + +@media only screen and (-webkit-min-device-pixel-ratio: 0.75) { + @import url("style-icons.css"); +} + +@media only screen and (-webkit-min-device-pixel-ratio: 1.5) { + @import url("style-icons.css"); +} + +@media only screen and (-webkit-min-device-pixel-ratio: 2) { + @import url("style-icons.css"); +} \ No newline at end of file Added: XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/index.html =================================================================== --- XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/index.html (rev 0) +++ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/index.html 2012-11-27 16:56:17 UTC (rev 10278) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/xlogo.png =================================================================== (Binary files differ) Property changes on: XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/img/xlogo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/js/jqm-init.js =================================================================== --- XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/js/jqm-init.js (rev 0) +++ XoopsCore/tags/2.5mobile timgno/htdocs/themes/mdefault/js/jqm-init.js 2012-11-27 16:56:17 UTC (rev 10278) @@ -0,0 +1,88 @@ +/* + * jQuery Mobile Framework Plugin by TXMod Xoops (http://www.txmodxoops.org) + * version: 1.00 (20-Nov-2012) + * @requires jQuery v1.7.1 or later + * + * Examples and documentation at: http://jquerymobile.com/ + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +//collapse page navs after use +$(function(){ + $('body').delegate('.content-secondary .ui-collapsible-content', 'click', function(){ + $(this).trigger("collapse"); + }); +}); + +// display the version of jQM +$(document).bind( 'pageinit', function() { + var version = $.mobile.version || "dev", + words = version.split( "-" ), + ver = words[0], + str = (words[1] || "Final"), + html = ver, + foothtml = "Version " + ver; + + if( str.indexOf( "rc" ) == -1 ){ + str = str.charAt( 0 ).toUpperCase() + str.slice( 1 ); + } else { + str = str.toUpperCase().replace(".", ""); + } + + if ( $.mobile.version && str ) { + html += " <b>" + str + "</b>"; + foothtml += " " + str; + } + + $( ".type-home .ui-content p.jqm-version" ).html( html ); + $( ".footer-docs p.jqm-version" ).html( foothtml ); +}); + +// Turn off AJAX for local file browsing +if ( location.protocol.substr(0,4) === 'file' || + location.protocol.substr(0,11) === '*-extension' || + location.protocol.substr(0,6) === 'widget' ) { + + // Start with links with only the trailing slash and that aren't external links + var fixLinks = function() { + $( "a[href$='/'], a[href='.'], a[href='..']" ).not( "[rel='external']" ).each( function() { + this.href = $( this ).attr( "href" ).replace( /\/$/, "" ) + "/index.php"; + }); + }; + + // fix the links for the initial page + $(fixLinks); + + // fix the links for subsequent ajax page loads + $(document).bind( 'pagecreate', fixLinks ); + + // Check to see if ajax can be used. This does a quick ajax request and blocks the page until its done + $.ajax({ + url: '.', + async: false, + isLocal: true + }).error(function() { + // Ajax doesn't work so turn it off + $( document ).bind( "mobileinit", function() { + $.mobile.ajaxEnabled = true; + $.support.touchOverflow = true; + $.mobile.touchOverflowEnabled = true; + + var message = $( '<div>' , { + 'class': "ui-footer ui-bar-e", + style: "overflow: auto; padding:10px 15px;", + 'data-ajax-warning': true + }); + + message + .append( "<h3>Note: Navigation may not work if viewed locally</h3>" ) + .append( "<p>The AJAX-based navigation used throughout the jQuery Mobile docs may need to be viewed on a web server to work in certain browsers. If you see an error message when you click a link, try a different browser or <a href='https://github.com/jquery/jquery-mobile/wiki/Downloadable-Docs-Help'>view help</a>.</p>" ); + + $( document ).bind( "pagecreate", function( event ) { + $( event.target ).append( message ); + |
From: <txm...@us...> - 2012-11-27 16:53:41
|
Revision: 10277 http://sourceforge.net/p/xoops/svn/10277 Author: txmodxoops Date: 2012-11-27 16:53:37 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Revision Modified Paths: -------------- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/about.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/bbs.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/header.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/index.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/languages.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/menu.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/wizard.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/files.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/googleprovider.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/iobase.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/languages.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/provider.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/translator.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/charset_utf-8.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/forms.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/functions.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/install.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/update.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/language/english/admin.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/language/english/google.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/language/english/modinfo.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/language/italian/admin.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/language/italian/google.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/language/italian/modinfo.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/providers/bing.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/providers/google.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/providers/mymemory.php XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/xoops_version.php Added Paths: ----------- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/footer.php Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/about.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/about.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/about.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,34 +1,24 @@ <?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. -*/ - /** - * Traslation Languages + * Xtransam extension module * + * 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 xtransam - * @since 1.3.0 - * @author Mamba - * @author Simon Roberts <si...@ch...> - * @version $Id: about.php 8469 2011-12-12 14:13:34Z beckmi $ - * @version $Id: about.php 9400 2012-12-04 12:58:28Z timgno $ + * @since 2.6.0 + * @version $Id: about.php 10270 2012-11-25 16:23:55Z timgno $ */ include dirname(__FILE__) . '/header.php'; -$xoops = Xoops::getInstance(); -$xoops->header(); +$adminMenu->renderNavigation('about.php'); +$adminMenu->renderAbout(); -$aboutAdmin = new XoopsModuleAdmin(); -$aboutAdmin->renderNavigation('about.php'); -$aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); - -$xoops->footer(); \ No newline at end of file +include dirname(__FILE__) . '/footer.php'; \ No newline at end of file Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/bbs.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/bbs.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/bbs.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,24 +1,20 @@ <?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. -*/ - /** - * Traslation Languages + * Xtransam extension module * + * 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 xtransam - * @since 1.3.0 - * @author Simon Roberts <si...@ch...> - * @author Timgno <in...@tx...> - * @version $Id: index.php 9400 2012-04-28 12:53:34Z timgno $ + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ */ include dirname(__FILE__) . '/header.php'; Added: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/footer.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/footer.php (rev 0) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/footer.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -0,0 +1,20 @@ +<?php +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @version $Id: footer.php 10270 2012-11-25 16:23:55Z timgno $ + */ + +$xoops->footer(); +?> \ No newline at end of file Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/header.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/header.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/header.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,26 +1,24 @@ <?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. -*/ - /** - * Traslation Languages + * Xtransam extension module * + * 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 xtransam - * @since 1.3.0 - * @author Taiwen Jiang <ph...@us...> - * @author Simon Roberts <si...@ch...> - * @version $Id: header.php 9400 2012-04-28 10:25:22Z timgno $ + * @since 2.6.0 + * @version $Id: header.php 10270 2012-11-25 16:23:55Z timgno $ */ require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; - +require_once dirname(dirname(__FILE__)) . '/include/forms.php'; $xoops = Xoops::getInstance(); -XoopsLoad::load('xtransam', 'xtransam'); \ No newline at end of file +$xoops->header(); +XoopsLoad::load('xtransam', 'xtransam'); + +$adminMenu = new XoopsModuleAdmin(); \ No newline at end of file Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/index.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/index.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/index.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,37 +1,26 @@ <?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. -*/ - /** - * Traslation Languages + * Xtransam extension module * + * 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 xtransam - * @since 1.3.0 - * @author Simon Roberts <si...@ch...> - * @author Timgno <in...@tx...> - * @version $Id: index.php 9400 2012-04-28 12:53:34Z timgno $ + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ */ include dirname(__FILE__) . '/header.php'; $xoops = Xoops::getInstance(); $xoops->header(); -$indexAdmin = new XoopsModuleAdmin(); -$indexAdmin->renderNavigation('index.php'); -$indexAdmin->renderIndex(); - -/*error_reporting(E_ALL); -global $xoopsDB, $xoopsModuleConfig; - $op = isset($_REQUEST['op'])?$_REQUEST['op']:'dashboard'; switch ($op){ @@ -69,11 +58,10 @@ break; case "languages": - echo $indexAdmin->addNavigation('index.php?op=languages'); - languagesForm_display(); - include "admin_footer.php"; + echo $adminMenu->renderNavigation('index.php?op=languages'); + languagesForm_display(); - break; + break; /**/ case "export": global $xoopsUser; @@ -115,9 +103,9 @@ $search = xtransam_convert_decode($tran->getVar('replacestr'), $tran->getVar('sm')); $name = xtransam_convert_decode($tran->getVar('name'), $tran->getVar('sm')); $translation = xtransam_convert_decode($tran->getVar('translation'), $tran->getVar('sm')); - *//*foreach($GLOBALS['charset_utf8'] as $search => $replace) + /*foreach($GLOBALS['charset_utf8'] as $search => $replace) $translation = str_replace($search, $replace, $translation); - $translation = htmlspecialchars($translation, ENT_QUOTES); *//* + $translation = htmlspecialchars($translation, ENT_QUOTES); */ $trans = get_html_translation_table(HTML_ENTITIES); $str = $translation; $encoded = strtr($str, $trans); @@ -150,8 +138,8 @@ break; case "manage": - echo $indexAdmin->addNavigation('index.php?op=manage'); - //echo $indexAdmin->renderIndex(); + echo $adminMenu->renderNavigation('index.php?op=manage'); + //echo $adminMenu->renderIndex(); managerForm_display($id, $fileid); break; @@ -214,31 +202,31 @@ case "bbs": - echo $indexAdmin->addNavigation('index.php?op=bbs'); - //echo $indexAdmin->renderIndex(); + echo $adminMenu->renderNavigation('index.php?op=bbs'); + //echo $adminMenu->renderIndex(); translationForm_display(false); - break; + break; case "wizard": - echo $indexAdmin->addNavigation('index.php?op=wizard'); - //echo $indexAdmin->renderIndex(); + echo $adminMenu->renderNavigation('index.php?op=wizard'); + //echo $adminMenu->renderIndex(); wizardForm_display($step); translationForm_display(true); - break; + break; case "dashboard": -default: - +default: + $trans_handler = xoops_getmodulehandler('translator', 'xtransam'); $lang_handler = xoops_getmodulehandler('languages', 'xtransam'); $files_handler = xoops_getmodulehandler('files', 'xtransam'); $iobase_handler = xoops_getmodulehandler('iobase', 'xtransam'); - $indexAdmin->addInfoBox(_AM_XTRANSAM_ADMIN_NUMTRASL); - $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMFILES."</label>", $files_handler->getCount(NULL), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMLINES."</label>", $trans_handler->getCount(NULL), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMPROJECTS."</label>", $iobase_handler->getCount(NULL), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMLANG."</label>", $lang_handler->getCount(NULL), 'Green'); + $adminMenu->addInfoBox(_AM_XTRANSAM_ADMIN_NUMTRASL); + $adminMenu->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMFILES."</label>", $files_handler->getCount(NULL), 'Green'); + $adminMenu->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMLINES."</label>", $trans_handler->getCount(NULL), 'Green'); + $adminMenu->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMPROJECTS."</label>", $iobase_handler->getCount(NULL), 'Green'); + $adminMenu->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMLANG."</label>", $lang_handler->getCount(NULL), 'Green'); xoops_load('xoopscache'); if (!class_exists('XoopsCache')) { // XOOPS 2.4 Compliance @@ -249,15 +237,15 @@ } if ($googlecodes = XoopsCache::read('xtransam_google_pause')) { - $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_GOOGLEAVAILABLE."</label>", _YES, 'Green'); - $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>".sprintf(_AM_XTRANSAM_THEREARE_GOOGLEERROR, $googlecodes['code'], $googlecodes['message'])."</label>", '', 'Green'); + $adminMenu->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_GOOGLEAVAILABLE."</label>", _YES, 'Green'); + $adminMenu->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>".sprintf(_AM_XTRANSAM_THEREARE_GOOGLEERROR, $googlecodes['code'], $googlecodes['message'])."</label>", '', 'Green'); } else { - $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_GOOGLEAVAILABLE."</label>", _NO, 'Green'); + $adminMenu->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_GOOGLEAVAILABLE."</label>", _NO, 'Green'); } - echo $indexAdmin->addNavigation("index.php") ; - echo $indexAdmin->renderIndex(); + echo $adminMenu->renderNavigation("index.php"); + echo $adminMenu->renderIndex(); break; -}*/ -$xoops->footer(); +} +include dirname(__FILE__) . '/footer.php'; \ No newline at end of file Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/languages.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/languages.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/languages.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,25 +1,22 @@ <?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. -*/ - /** - * Traslation Languages + * Xtransam extension module * + * 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 xtransam - * @since 1.3.0 - * @author Simon Roberts <si...@ch...> - * @author Timgno <in...@tx...> - * @version $Id: index.php 9400 2012-04-28 12:53:34Z timgno $ + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ */ + include dirname(__FILE__) . '/header.php'; $xoops = Xoops::getInstance(); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/menu.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/menu.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/menu.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,24 +1,22 @@ <?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. -*/ /** - * Traslation Languages + * Xtransam extension module * + * 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 xtransam - * @since 1.3.0 - * @author Taiwen Jiang <ph...@us...> - * @author Simon Roberts <si...@ch...> - * @version $Id: menu.php 9400 2012-04-28 10:40:24Z timgno $ + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ */ + $adminmenu = array(); $i = 1; $adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU1; $adminmenu[$i]["link"] = 'admin/index.php'; Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/wizard.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/wizard.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/admin/wizard.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,24 +1,20 @@ <?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. -*/ - /** - * Traslation Languages + * Xtransam extension module * + * 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 xtransam - * @since 1.3.0 - * @author Simon Roberts <si...@ch...> - * @author Timgno <in...@tx...> - * @version $Id: index.php 9400 2012-04-28 12:53:34Z timgno $ + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ */ include dirname(__FILE__) . '/header.php'; Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/files.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/files.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/files.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,31 +1,21 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// -- Author: Simon Roberts (si...@ch...) -- // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ if (!defined('XOOPS_ROOT_PATH')) { exit(); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/googleprovider.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/googleprovider.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/googleprovider.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,31 +1,21 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// -- Author: Simon Roberts (si...@ch...) -- // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ if (!defined('XOOPS_ROOT_PATH')) { exit(); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/iobase.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/iobase.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/iobase.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,29 +1,21 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ if (!defined('XOOPS_ROOT_PATH')) { exit(); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/languages.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/languages.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/languages.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,29 +1,21 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ if (!defined('XOOPS_ROOT_PATH')) { exit(); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/provider.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/provider.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/provider.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,31 +1,21 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// -- Author: Simon Roberts (si...@ch...) -- // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ if (!defined('XOOPS_ROOT_PATH')) { exit(); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/translator.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/translator.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/class/translator.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,29 +1,21 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ if (!defined('XOOPS_ROOT_PATH')) { exit(); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/charset_utf-8.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/charset_utf-8.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/charset_utf-8.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,34 +1,22 @@ <?php -// $Id: charset_utf8.php 0005 2011-01-30 13:07:28Z timgno $ -// ------------------------------------------------------------------------ // -// TXMod XOOPS - Modules & Themes for XOOPS // -// Copyright (c) 2011 txmodxoops.org // -// <http://www.txmodxoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: TXMod Xoops (AKA timgno) // -// URL: www.txmodxoops.org // -// Project: The XOOPS Project // -// ------------------------------------------------------------------------- // - +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: TXMod Xoops (AKA timgno) - www.txmodxoops.org + * @version $Id: charset_utf8.php 0005 2011-01-30 13:07:28Z timgno $ + */ + $GLOBALS['charset_utf8'] = array( '' => '', //Spazio // extra conversions '"' => '\"', Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/forms.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/forms.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/forms.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,31 +1,21 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// -- Author: Simon Roberts (si...@ch...) -- // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ function languagesForm_display() { $form_sel = new XoopsThemeForm(_AM_XTRANSAM_LANGUAGEMATRIX, "languages", $_SERVER['PHP_SELF'] .""); $form_sel->setExtra( "enctype='multipart/form-data'" ) ; @@ -199,43 +189,42 @@ $xl = new XoopsLists(); switch ($_POST['point']) { - case "core": - $form_sel->addElement(new XoopsFormHidden('step', 'save')); - $dlist = $xl->getDirListAsArray(XOOPS_ROOT_PATH.'/language'); + case "core": + $form_sel->addElement(new XoopsFormHidden('step', 'save')); + $dlist = $xl->getDirListAsArray(XOOPS_ROOT_PATH.'/language'); + break; + default: + case "module": + $form_sel->addElement(new XoopsFormHidden('step', 'save')); + $dlist = $xl->getDirListAsArray(XOOPS_ROOT_PATH.'/modules/'.$_POST['module'].'/language/'); + + $table_from = new XoopsFormSelect(_AM_XTRANSAM_SELECTLANGFROM.':', 'languagefrom'); + + $id = $lang_handler->validlanguage($_POST['path']); + if ($id>0) + { + $criteria = new Criteria('lang_id', $id); + $lang = $lang_handler->getObjects($criteria); + $validto[$lang[0]->getVar('lang_id')] = $lang[0]->getVar('name'); + } + + $table_from->addOptionArray($validto); + $form_sel->addElement($table_from); + + $table_to = new XoopsFormSelect(_AM_XTRANSAM_SELECTLANGTO.':', 'languageto'); + foreach($lang_handler->getObjects(NULL) as $lang) { + if (!in_array($lang->getVar('name'), $validto)) + $validfrom[$lang->getVar('lang_id')] = $lang->getVar('name'); + } + + $table_to->addOptionArray($validfrom); + $form_sel->addElement($table_to); + $form_sel->addElement(new XoopsFormHidden("op", "wizard")); + $form_sel->addElement(new XoopsFormButton('', 'send', _SEND, 'submit')); + $form_sel->display(); break; - default: - case "module": - $form_sel->addElement(new XoopsFormHidden('step', 'save')); - $dlist = $xl->getDirListAsArray(XOOPS_ROOT_PATH.'/modules/'.$_POST['module'].'/language/'); - } - - $table_from = new XoopsFormSelect(_AM_XTRANSAM_SELECTLANGFROM.':', 'languagefrom'); - - $id = $lang_handler->validlanguage($_POST['path']); - if ($id>0) - { - $criteria = new Criteria('lang_id', $id); - $lang = $lang_handler->getObjects($criteria); - $validto[$lang[0]->getVar('lang_id')] = $lang[0]->getVar('name'); - } - - $table_from->addOptionArray($validto); - $form_sel->addElement($table_from); - - $table_to = new XoopsFormSelect(_AM_XTRANSAM_SELECTLANGTO.':', 'languageto'); - foreach($lang_handler->getObjects(NULL) as $lang) { - if (!in_array($lang->getVar('name'), $validto)) - $validfrom[$lang->getVar('lang_id')] = $lang->getVar('name'); - } - - $table_to->addOptionArray($validfrom); - $form_sel->addElement($table_to); - $form_sel->addElement(new XoopsFormHidden("op", "wizard")); - $form_sel->addElement(new XoopsFormButton('', 'send', _SEND, 'submit')); - $form_sel->display(); - break; - - break; + } + break; case '2': $form_sel = new XoopsThemeForm(_AM_XTRANSAM_SELECTMODULEPATH, "sellang", $_SERVER['PHP_SELF'] .""); Modified: XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/functions.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/functions.php 2012-11-27 13:58:28 UTC (rev 10276) +++ XoopsCore/tags/2.6 timgno/htdocs/modules/xtransam/include/functions.php 2012-11-27 16:53:37 UTC (rev 10277) @@ -1,100 +1,25 @@ <?php -// $Autho: wishcraft $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2009 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// -- Author: Simon Roberts (si...@ch...) -- // -// ------------------------------------------------------------------------ // +/** + * Xtransam extension module + * + * 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 xtransam + * @since 2.6.0 + * @author: Simon Roberts (si...@ch...) + * @version $Id: index.php 10270 2012-11-25 16:23:55Z timgno $ + */ -if (!function_exists("xtransam_adminMenu")) { - function xtransam_adminMenu ($currentoption = 0) { - /* Nice buttons styles */ - global $xoopsConfig; - $module_handler =& xoops_gethandler('module'); - $xModule = $module_handler->getByDirname('xtransam'); - $dirname='xtransam'; - echo " - <style type='text/css'> - #form {float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/$dirname/images/bg.gif') repeat-x left bottom; font-size:93%; line-height:normal; border-bottom: 1px solid black; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;} - #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0; } - #buttonbar { float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/$dirname/images/bg.gif') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 0px; border-bottom: 1px solid black; } - #buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; } - #buttonbar li { display:inline; margin:0; padding:0; } - #buttonbar a { float:left; background:url('" . XOOPS_URL . "/modules/$dirname/images/left_both.gif') no-repeat left top; margin:0; padding:0 0 0 9px; text-decoration:none; } - #buttonbar a span { float:left; display:block; background:url('" . XOOPS_URL . "/modules/$dirname/images/right_both.gif') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; } - /* Commented Backslash Hack hides rule from IE5-Mac \*/ - #buttonbar a span {float:none;} - /* End IE5-Mac hack */ - #buttonbar a:hover span { color:#333; } - #buttonbar #current a { background-position:0 -150px; border-width:0; } - #buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; } - #buttonbar a:hover { background-position:0% -150px; } - #buttonbar a:hover span { background-position:100% -150px; } - </style>"; - - // global $xoopsDB, $xoModule, $xoopsConfig, $xoModuleConfig; - - $myts = &MyTextSanitizer::getInstance(); - - $tblColors = Array(); - // $adminmenu=array(); - if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { - include_once XOOPS_ROOT_PATH . '/modules/xtransam/language/' . $xoopsConfig['language'] . '/modinfo.php'; - } else { - include_once XOOPS_ROOT_PATH . '/modules/xtransam/english/modinfo.php'; - } - - echo "<table width=\"100%\" border='0'><tr><td>"; - echo "<div id='buttontop'>"; - echo "<table style=\"width: 100%; padding: 0; \" cellspacing=\"0\"><tr>"; - echo "<td style=\"width: 45%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\"><a class=\"nobutton\" href=\"".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=" . $xModule->getVar('mid') . "\">" . _PREFERENCES . "</a></td>"; - echo "<td style='font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;'><b>" . $myts->displayTarea($xModule->name()) ."</td>"; - echo "</tr></table>"; - echo "</div>"; - echo "<div id='buttonbar'>"; - echo "<ul>"; - $adminmenu = array(); - include XOOPS_ROOT_PATH . '/modules/xtransam/admin/menu.php'; - foreach ($adminmenu as $key => $value) { - $tblColors[$key] = ''; - $tblColors[$currentoption] = 'current'; - echo "<li id='" . $tblCo... [truncated message content] |
From: <tr...@us...> - 2012-11-27 13:58:43
|
Revision: 10276 http://sourceforge.net/p/xoops/svn/10276 Author: trabis Date: 2012-11-27 13:58:28 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Adding publisher module Added Paths: ----------- XoopsModules/publisher/ XoopsModules/publisher/branches/ XoopsModules/publisher/releases/ XoopsModules/publisher/trunk/ XoopsModules/publisher/trunk/publisher/ XoopsModules/publisher/trunk/publisher/admin/ XoopsModules/publisher/trunk/publisher/admin/about.php XoopsModules/publisher/trunk/publisher/admin/admin_header.php XoopsModules/publisher/trunk/publisher/admin/category.php XoopsModules/publisher/trunk/publisher/admin/clone.php XoopsModules/publisher/trunk/publisher/admin/file.php XoopsModules/publisher/trunk/publisher/admin/import/ XoopsModules/publisher/trunk/publisher/admin/import/index.html XoopsModules/publisher/trunk/publisher/admin/import/news.php XoopsModules/publisher/trunk/publisher/admin/import/smartsection.php XoopsModules/publisher/trunk/publisher/admin/import/wfsection.php XoopsModules/publisher/trunk/publisher/admin/import/xfsection.php XoopsModules/publisher/trunk/publisher/admin/import.php XoopsModules/publisher/trunk/publisher/admin/index.php XoopsModules/publisher/trunk/publisher/admin/item.php XoopsModules/publisher/trunk/publisher/admin/main.php XoopsModules/publisher/trunk/publisher/admin/menu.php XoopsModules/publisher/trunk/publisher/admin/mimetypes.php XoopsModules/publisher/trunk/publisher/admin/pagewrap.php XoopsModules/publisher/trunk/publisher/admin/permissions.php XoopsModules/publisher/trunk/publisher/admin/preferences.php XoopsModules/publisher/trunk/publisher/admin/pw_delete_file.php XoopsModules/publisher/trunk/publisher/admin/pw_upload_file.php XoopsModules/publisher/trunk/publisher/ajaxrating.txt XoopsModules/publisher/trunk/publisher/archive.php XoopsModules/publisher/trunk/publisher/author_items.php XoopsModules/publisher/trunk/publisher/backend.php XoopsModules/publisher/trunk/publisher/blocks/ XoopsModules/publisher/trunk/publisher/blocks/category_items_sel.php XoopsModules/publisher/trunk/publisher/blocks/date_to_date.php XoopsModules/publisher/trunk/publisher/blocks/index.html XoopsModules/publisher/trunk/publisher/blocks/items_columns.php XoopsModules/publisher/trunk/publisher/blocks/items_menu.php XoopsModules/publisher/trunk/publisher/blocks/items_new.php XoopsModules/publisher/trunk/publisher/blocks/items_random_item.php XoopsModules/publisher/trunk/publisher/blocks/items_recent.php XoopsModules/publisher/trunk/publisher/blocks/items_spot.php XoopsModules/publisher/trunk/publisher/blocks/latest_files.php XoopsModules/publisher/trunk/publisher/blocks/latest_news.php XoopsModules/publisher/trunk/publisher/blocks/search.php XoopsModules/publisher/trunk/publisher/category.php XoopsModules/publisher/trunk/publisher/changelog.txt XoopsModules/publisher/trunk/publisher/class/ XoopsModules/publisher/trunk/publisher/class/blockform.php XoopsModules/publisher/trunk/publisher/class/category.php XoopsModules/publisher/trunk/publisher/class/file.php XoopsModules/publisher/trunk/publisher/class/form/ XoopsModules/publisher/trunk/publisher/class/form/category.php XoopsModules/publisher/trunk/publisher/class/form/file.php XoopsModules/publisher/trunk/publisher/class/form/index.html XoopsModules/publisher/trunk/publisher/class/form/item.php XoopsModules/publisher/trunk/publisher/class/formdatetime.php XoopsModules/publisher/trunk/publisher/class/groupperm.php XoopsModules/publisher/trunk/publisher/class/highlighter.php XoopsModules/publisher/trunk/publisher/class/index.html XoopsModules/publisher/trunk/publisher/class/item.php XoopsModules/publisher/trunk/publisher/class/metagen.php XoopsModules/publisher/trunk/publisher/class/mimetype.php XoopsModules/publisher/trunk/publisher/class/permission.php XoopsModules/publisher/trunk/publisher/class/publisher.php XoopsModules/publisher/trunk/publisher/class/rating.php XoopsModules/publisher/trunk/publisher/class/request.php XoopsModules/publisher/trunk/publisher/class/session.php XoopsModules/publisher/trunk/publisher/class/themetabform.php XoopsModules/publisher/trunk/publisher/class/uploader.php XoopsModules/publisher/trunk/publisher/comment_delete.php XoopsModules/publisher/trunk/publisher/comment_edit.php XoopsModules/publisher/trunk/publisher/comment_new.php XoopsModules/publisher/trunk/publisher/comment_post.php XoopsModules/publisher/trunk/publisher/comment_reply.php XoopsModules/publisher/trunk/publisher/css/ XoopsModules/publisher/trunk/publisher/css/images/ XoopsModules/publisher/trunk/publisher/css/images/index.html XoopsModules/publisher/trunk/publisher/css/images/ui-bg_flat_0_aaaaaa_40x100.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_flat_75_ffffff_40x100.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_55_fbf9ee_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_65_ffffff_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_75_dadada_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_75_e6e6e6_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_95_fef1ec_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_222222_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_2e83ff_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_454545_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_888888_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_cd0a0a_256x240.png XoopsModules/publisher/trunk/publisher/css/index.html XoopsModules/publisher/trunk/publisher/css/jquery-ui-1.7.1.custom.css XoopsModules/publisher/trunk/publisher/css/jquery.popeye.style.css XoopsModules/publisher/trunk/publisher/css/publisher.css XoopsModules/publisher/trunk/publisher/docs/ XoopsModules/publisher/trunk/publisher/docs/changelog.txt XoopsModules/publisher/trunk/publisher/docs/credits.txt XoopsModules/publisher/trunk/publisher/docs/index.html XoopsModules/publisher/trunk/publisher/docs/install.txt XoopsModules/publisher/trunk/publisher/docs/lang_diff.txt XoopsModules/publisher/trunk/publisher/docs/licence.txt XoopsModules/publisher/trunk/publisher/docs/readme.txt XoopsModules/publisher/trunk/publisher/extra/ XoopsModules/publisher/trunk/publisher/extra/index.html XoopsModules/publisher/trunk/publisher/extra/seo/ XoopsModules/publisher/trunk/publisher/extra/seo/index.html XoopsModules/publisher/trunk/publisher/extra/seo/sample.htaccess XoopsModules/publisher/trunk/publisher/extra/seo/seo.txt XoopsModules/publisher/trunk/publisher/file.php XoopsModules/publisher/trunk/publisher/footer.php XoopsModules/publisher/trunk/publisher/header.php XoopsModules/publisher/trunk/publisher/images/ XoopsModules/publisher/trunk/publisher/images/VeraBd.ttf XoopsModules/publisher/trunk/publisher/images/arrow-bg.png XoopsModules/publisher/trunk/publisher/images/bg.gif XoopsModules/publisher/trunk/publisher/images/blank.png XoopsModules/publisher/trunk/publisher/images/bullet.gif XoopsModules/publisher/trunk/publisher/images/button_delete.png XoopsModules/publisher/trunk/publisher/images/button_edit.png XoopsModules/publisher/trunk/publisher/images/dot-grey.gif XoopsModules/publisher/trunk/publisher/images/gfx/ XoopsModules/publisher/trunk/publisher/images/gfx/count-2.png XoopsModules/publisher/trunk/publisher/images/gfx/enlarge-1.png XoopsModules/publisher/trunk/publisher/images/gfx/enlarge-2.png XoopsModules/publisher/trunk/publisher/images/gfx/index.html XoopsModules/publisher/trunk/publisher/images/gfx/loading.gif XoopsModules/publisher/trunk/publisher/images/gfx/next-1.png XoopsModules/publisher/trunk/publisher/images/gfx/next-2.png XoopsModules/publisher/trunk/publisher/images/gfx/next.gif XoopsModules/publisher/trunk/publisher/images/gfx/prev-1.png XoopsModules/publisher/trunk/publisher/images/gfx/prev-2.png XoopsModules/publisher/trunk/publisher/images/gfx/prev.gif XoopsModules/publisher/trunk/publisher/images/grad-bg.png XoopsModules/publisher/trunk/publisher/images/icon/ XoopsModules/publisher/trunk/publisher/images/icon/approve.gif XoopsModules/publisher/trunk/publisher/images/icon/cat.gif XoopsModules/publisher/trunk/publisher/images/icon/clone.gif XoopsModules/publisher/trunk/publisher/images/icon/close12.gif XoopsModules/publisher/trunk/publisher/images/icon/delete.gif XoopsModules/publisher/trunk/publisher/images/icon/delete.png XoopsModules/publisher/trunk/publisher/images/icon/doc.png XoopsModules/publisher/trunk/publisher/images/icon/edit.gif XoopsModules/publisher/trunk/publisher/images/icon/edit.png XoopsModules/publisher/trunk/publisher/images/icon/editcopy.png XoopsModules/publisher/trunk/publisher/images/icon/file.gif XoopsModules/publisher/trunk/publisher/images/icon/friend.gif XoopsModules/publisher/trunk/publisher/images/icon/index.html XoopsModules/publisher/trunk/publisher/images/icon/newanswer.gif XoopsModules/publisher/trunk/publisher/images/icon/open12.gif XoopsModules/publisher/trunk/publisher/images/icon/pdf.gif XoopsModules/publisher/trunk/publisher/images/icon/print.gif XoopsModules/publisher/trunk/publisher/images/icon/subcat.gif XoopsModules/publisher/trunk/publisher/images/icon32/ XoopsModules/publisher/trunk/publisher/images/icon32/editcopy.png XoopsModules/publisher/trunk/publisher/images/icon32/folder_txt.png XoopsModules/publisher/trunk/publisher/images/icon32/index.html XoopsModules/publisher/trunk/publisher/images/important-32.png XoopsModules/publisher/trunk/publisher/images/index.html XoopsModules/publisher/trunk/publisher/images/item_icon.gif XoopsModules/publisher/trunk/publisher/images/left_both.gif XoopsModules/publisher/trunk/publisher/images/links/ XoopsModules/publisher/trunk/publisher/images/links/approve.gif XoopsModules/publisher/trunk/publisher/images/links/cat.gif XoopsModules/publisher/trunk/publisher/images/links/clone.gif XoopsModules/publisher/trunk/publisher/images/links/close12.gif XoopsModules/publisher/trunk/publisher/images/links/delete.gif XoopsModules/publisher/trunk/publisher/images/links/delete.png XoopsModules/publisher/trunk/publisher/images/links/doc.png XoopsModules/publisher/trunk/publisher/images/links/edit.gif XoopsModules/publisher/trunk/publisher/images/links/edit.png XoopsModules/publisher/trunk/publisher/images/links/editcopy.png XoopsModules/publisher/trunk/publisher/images/links/file.gif XoopsModules/publisher/trunk/publisher/images/links/friend.gif XoopsModules/publisher/trunk/publisher/images/links/index.html XoopsModules/publisher/trunk/publisher/images/links/newanswer.gif XoopsModules/publisher/trunk/publisher/images/links/next.gif XoopsModules/publisher/trunk/publisher/images/links/open12.gif XoopsModules/publisher/trunk/publisher/images/links/pdf.gif XoopsModules/publisher/trunk/publisher/images/links/previous.gif XoopsModules/publisher/trunk/publisher/images/links/print.gif XoopsModules/publisher/trunk/publisher/images/links/subcat.gif XoopsModules/publisher/trunk/publisher/images/loadingbar.gif XoopsModules/publisher/trunk/publisher/images/module_logo.png XoopsModules/publisher/trunk/publisher/images/no.gif XoopsModules/publisher/trunk/publisher/images/off.png XoopsModules/publisher/trunk/publisher/images/on.png XoopsModules/publisher/trunk/publisher/images/popeye/ XoopsModules/publisher/trunk/publisher/images/popeye/bg1.png XoopsModules/publisher/trunk/publisher/images/popeye/compact3.png XoopsModules/publisher/trunk/publisher/images/popeye/enlarge3.png XoopsModules/publisher/trunk/publisher/images/popeye/index.html XoopsModules/publisher/trunk/publisher/images/popeye/loading3.gif XoopsModules/publisher/trunk/publisher/images/popeye/next3.png XoopsModules/publisher/trunk/publisher/images/popeye/prev3.png XoopsModules/publisher/trunk/publisher/images/right_both.gif XoopsModules/publisher/trunk/publisher/images/rss.gif XoopsModules/publisher/trunk/publisher/images/span-bg.gif XoopsModules/publisher/trunk/publisher/images/starrating.gif XoopsModules/publisher/trunk/publisher/images/transparent_bg.png XoopsModules/publisher/trunk/publisher/images/working.gif XoopsModules/publisher/trunk/publisher/include/ XoopsModules/publisher/trunk/publisher/include/ajax_rating.php XoopsModules/publisher/trunk/publisher/include/ajax_upload.php XoopsModules/publisher/trunk/publisher/include/comment_functions.php XoopsModules/publisher/trunk/publisher/include/common.php XoopsModules/publisher/trunk/publisher/include/constants.php XoopsModules/publisher/trunk/publisher/include/functions.php XoopsModules/publisher/trunk/publisher/include/index.html XoopsModules/publisher/trunk/publisher/include/media.textsanitizer.php XoopsModules/publisher/trunk/publisher/include/notification.inc.php XoopsModules/publisher/trunk/publisher/include/plugin.tag.php XoopsModules/publisher/trunk/publisher/include/search.inc.php XoopsModules/publisher/trunk/publisher/include/seo.inc.php XoopsModules/publisher/trunk/publisher/include/seo_functions.php XoopsModules/publisher/trunk/publisher/include/update.php XoopsModules/publisher/trunk/publisher/index.php XoopsModules/publisher/trunk/publisher/item.php XoopsModules/publisher/trunk/publisher/js/ XoopsModules/publisher/trunk/publisher/js/ajaxupload.3.9.js XoopsModules/publisher/trunk/publisher/js/behavior.js XoopsModules/publisher/trunk/publisher/js/cookies.js XoopsModules/publisher/trunk/publisher/js/funcs.js XoopsModules/publisher/trunk/publisher/js/index.html XoopsModules/publisher/trunk/publisher/js/jquery.easing.js XoopsModules/publisher/trunk/publisher/js/jquery.popeye-2.0.4.js XoopsModules/publisher/trunk/publisher/js/publisher.js XoopsModules/publisher/trunk/publisher/js/rating.js XoopsModules/publisher/trunk/publisher/js/script.easing.js XoopsModules/publisher/trunk/publisher/js/ui.core.js XoopsModules/publisher/trunk/publisher/js/ui.tabs.js XoopsModules/publisher/trunk/publisher/language/ XoopsModules/publisher/trunk/publisher/language/english/ XoopsModules/publisher/trunk/publisher/language/english/admin.php XoopsModules/publisher/trunk/publisher/language/english/blocks.php XoopsModules/publisher/trunk/publisher/language/english/common.php XoopsModules/publisher/trunk/publisher/language/english/help/ XoopsModules/publisher/trunk/publisher/language/english/help/help.html XoopsModules/publisher/trunk/publisher/language/english/help/index.html XoopsModules/publisher/trunk/publisher/language/english/index.html XoopsModules/publisher/trunk/publisher/language/english/mail_template/ XoopsModules/publisher/trunk/publisher/language/english/mail_template/category_item_published.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/category_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/global_item_category_created.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/global_item_published.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/global_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/index.html XoopsModules/publisher/trunk/publisher/language/english/mail_template/item_approved.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/item_rejected.tpl XoopsModules/publisher/trunk/publisher/language/english/main.php XoopsModules/publisher/trunk/publisher/language/english/modinfo.php XoopsModules/publisher/trunk/publisher/language/french/ XoopsModules/publisher/trunk/publisher/language/french/admin.php XoopsModules/publisher/trunk/publisher/language/french/blocks.php XoopsModules/publisher/trunk/publisher/language/french/common.php XoopsModules/publisher/trunk/publisher/language/french/index.html XoopsModules/publisher/trunk/publisher/language/french/mail_template/ XoopsModules/publisher/trunk/publisher/language/french/mail_template/category_item_published.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/category_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/global_item_category_created.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/global_item_published.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/global_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/index.html XoopsModules/publisher/trunk/publisher/language/french/mail_template/item_approved.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/item_rejected.tpl XoopsModules/publisher/trunk/publisher/language/french/main.php XoopsModules/publisher/trunk/publisher/language/french/modinfo.php XoopsModules/publisher/trunk/publisher/language/index.html XoopsModules/publisher/trunk/publisher/list.tag.php XoopsModules/publisher/trunk/publisher/makepdf.php XoopsModules/publisher/trunk/publisher/notification_update.php XoopsModules/publisher/trunk/publisher/pop.php XoopsModules/publisher/trunk/publisher/print.php XoopsModules/publisher/trunk/publisher/rate.php XoopsModules/publisher/trunk/publisher/search.php XoopsModules/publisher/trunk/publisher/sql/ XoopsModules/publisher/trunk/publisher/sql/index.html XoopsModules/publisher/trunk/publisher/sql/mysql.sql XoopsModules/publisher/trunk/publisher/submit.php XoopsModules/publisher/trunk/publisher/tcpdf/ XoopsModules/publisher/trunk/publisher/tcpdf/CHANGELOG.TXT XoopsModules/publisher/trunk/publisher/tcpdf/LICENSE.TXT XoopsModules/publisher/trunk/publisher/tcpdf/README.TXT XoopsModules/publisher/trunk/publisher/tcpdf/cache/ XoopsModules/publisher/trunk/publisher/tcpdf/cache/index.html XoopsModules/publisher/trunk/publisher/tcpdf/config/ XoopsModules/publisher/trunk/publisher/tcpdf/config/index.html XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/ XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/ar.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/de.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/en.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/fa.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/fr.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/index.html XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/nl.php XoopsModules/publisher/trunk/publisher/tcpdf/config/tcpdf_config.php XoopsModules/publisher/trunk/publisher/tcpdf/fonts/ XoopsModules/publisher/trunk/publisher/tcpdf/fonts/almohanad.ctg.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/almohanad.php XoopsModules/publisher/trunk/publisher/tcpdf/fonts/almohanad.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/dejavusans.ctg.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/dejavusans.php XoopsModules/publisher/trunk/publisher/tcpdf/fonts/dejavusans.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/index.html XoopsModules/publisher/trunk/publisher/tcpdf/htmlcolors.php XoopsModules/publisher/trunk/publisher/tcpdf/images/ XoopsModules/publisher/trunk/publisher/tcpdf/images/index.html XoopsModules/publisher/trunk/publisher/tcpdf/index.html XoopsModules/publisher/trunk/publisher/tcpdf/tcpdf.php XoopsModules/publisher/trunk/publisher/tcpdf/unicode_data.php XoopsModules/publisher/trunk/publisher/templates/ XoopsModules/publisher/trunk/publisher/templates/blocks/ XoopsModules/publisher/trunk/publisher/templates/blocks/index.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_category_items_sel.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_date_to_date.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_columns.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_menu.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_new.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_random_item.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_recent.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_spot.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_latest_files.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_latest_news.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_search_block.html XoopsModules/publisher/trunk/publisher/templates/index.html XoopsModules/publisher/trunk/publisher/templates/publisher_addfile.html XoopsModules/publisher/trunk/publisher/templates/publisher_archive.html XoopsModules/publisher/trunk/publisher/templates/publisher_author_items.html XoopsModules/publisher/trunk/publisher/templates/publisher_categories_table.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_full.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_list.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_summary.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_wfsection.html XoopsModules/publisher/trunk/publisher/templates/publisher_footer.html XoopsModules/publisher/trunk/publisher/templates/publisher_header.html XoopsModules/publisher/trunk/publisher/templates/publisher_item.html XoopsModules/publisher/trunk/publisher/templates/publisher_print.html XoopsModules/publisher/trunk/publisher/templates/publisher_rss.html XoopsModules/publisher/trunk/publisher/templates/publisher_search.html XoopsModules/publisher/trunk/publisher/templates/publisher_singleitem.html XoopsModules/publisher/trunk/publisher/templates/publisher_singleitem_block.html XoopsModules/publisher/trunk/publisher/templates/publisher_submit.html XoopsModules/publisher/trunk/publisher/thumb.php XoopsModules/publisher/trunk/publisher/view.tag.php XoopsModules/publisher/trunk/publisher/visit.php XoopsModules/publisher/trunk/publisher/xoops_version.php Added: XoopsModules/publisher/trunk/publisher/admin/about.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/about.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/about.php 2012-11-27 13:58:28 UTC (rev 10276) @@ -0,0 +1,32 @@ +<?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. +*/ + +/** + * Publisher + * + * @copyright The XOOPS Project (http://www.xoops.org) + * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) + * @package Publisher + * @since 1.0 + * @author Mage, Mamba + * @version $Id$ + */ + +include_once dirname(__FILE__) . '/admin_header.php'; + +xoops_cp_header(); + +$aboutAdmin = new ModuleAdmin(); + +echo $aboutAdmin->addNavigation('about.php'); +echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false); + +xoops_cp_footer(); \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/about.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsModules/publisher/trunk/publisher/admin/admin_header.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/admin_header.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/admin_header.php 2012-11-27 13:58:28 UTC (rev 10276) @@ -0,0 +1,46 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @author The SmartFactory <www.smartfactory.ca> + * @version $Id$ + */ + +include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php'; +include_once dirname(dirname(__FILE__)) . '/include/common.php'; +include_once XOOPS_ROOT_PATH . '/include/cp_header.php'; + +//xoops_loadLanguage('admin', PUBLISHER_DIRNAME); +xoops_loadLanguage('modinfo', PUBLISHER_DIRNAME); + +$imagearray = array( + 'editimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_edit.png' alt='" . _AM_PUBLISHER_ICO_EDIT . "' align='middle' />", + 'deleteimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_delete.png' alt='" . _AM_PUBLISHER_ICO_DELETE . "' align='middle' />", + 'online' => "<img src='" . PUBLISHER_IMAGES_URL . "/on.png' alt='" . _AM_PUBLISHER_ICO_ONLINE . "' align='middle' />", + 'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle' />", +); +if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ + include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); +}else{ + echo xoops_error('/Frameworks/moduleclasses/moduleadmin/ is required!!!'); +} +/* +$myts =& MyTextSanitizer::getInstance(); + +if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { + include_once(XOOPS_ROOT_PATH."/class/template.php"); + $xoopsTpl = new XoopsTpl(); +} */ \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/admin_header.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsModules/publisher/trunk/publisher/admin/category.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/category.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/category.php 2012-11-27 13:58:28 UTC (rev 10276) @@ -0,0 +1,431 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @author The SmartFactory <www.smartfactory.ca> + * @version $Id$ + */ + +include_once dirname(__FILE__) . '/admin_header.php'; + +$op = PublisherRequest::getString('op'); + +$op = isset($_POST['editor']) ? 'mod' : $op; +if (isset($_POST['addcategory'])) { + $op = 'addcategory'; +} + +// Where do we start ? +$startcategory = PublisherRequest::getInt('startcategory'); +$categoryid = PublisherRequest::getInt('categoryid'); + +switch ($op) { + + case "del": + $categoryObj = $publisher->getHandler('category')->get($categoryid); + $confirm = (isset($_POST['confirm'])) ? $_POST['confirm'] : 0; + $name = (isset($_POST['name'])) ? $_POST['name'] : ''; + if ($confirm) { + if (!$publisher->getHandler('category')->delete($categoryObj)) { + redirect_header("category.php", 1, _AM_PUBLISHER_DELETE_CAT_ERROR); + exit(); + } + redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name)); + exit(); + } else { + xoops_cp_header(); + xoops_confirm(array('op' => 'del', 'categoryid' => $categoryObj->categoryid(), 'confirm' => 1, 'name' => $categoryObj->name()), 'category.php', _AM_PUBLISHER_DELETECOL . " '" . $categoryObj->name() . "'. <br /> <br />" . _AM_PUBLISHER_DELETE_CAT_CONFIRM, _AM_PUBLISHER_DELETE); + xoops_cp_footer(); + } + break; + + case "mod": + //Added by fx2024 + $nb_subcats = isset($_POST['nb_subcats']) ? intval($_POST['nb_subcats']) : 0; + $nb_subcats = $nb_subcats + (isset($_POST['nb_sub_yet']) ? intval($_POST['nb_sub_yet']) : 4); + //end of fx2024 code + + publisher_cpHeader(); + publisher_editCat(true, $categoryid, $nb_subcats); + break; + + case "addcategory": + global $modify; + + $parentid = PublisherRequest::getInt('parentid'); + + if ($categoryid != 0) { + $categoryObj = $publisher->getHandler('category')->get($categoryid); + } else { + $categoryObj = $publisher->getHandler('category')->create(); + } + + // Uploading the image, if any + // Retreive the filename to be uploaded + if (isset($_FILES['image_file']['name']) && $_FILES['image_file']['name'] != "") { + $filename = $_POST["xoops_upload_file"][0]; + if (!empty($filename) || $filename != "") { + // TODO : implement publisher mimetype management + $max_size = $publisher->getConfig('maximum_filesize'); + $max_imgwidth = $publisher->getConfig('maximum_image_width'); + $max_imgheight = $publisher->getConfig('maximum_image_height'); + $allowed_mimetypes = publisher_getAllowedImagesTypes(); + + if ($_FILES[$filename]['tmp_name'] == "" || !is_readable($_FILES[$filename]['tmp_name'])) { + redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); + exit(); + } + + xoops_load('XoopsMediaUploader'); + $uploader = new XoopsMediaUploader(publisher_getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); + if ($uploader->fetchMedia($filename) && $uploader->upload()) { + $categoryObj->setVar('image', $uploader->getSavedFileName()); + } else { + redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR . $uploader->getErrors()); + exit(); + } + } + } else { + if (isset($_POST['image'])) { + $categoryObj->setVar('image', $_POST['image']); + } + } + $categoryObj->setVar('parentid', (isset($_POST['parentid'])) ? intval($_POST['parentid']) : 0); + + $applyall = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0; + $categoryObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 1); + + // Groups and permissions + if (isset($_POST['groups_read'])) { + $categoryObj->setGroups_read($_POST['groups_read']); + } else { + $categoryObj->setGroups_read(); + } + $grpread = isset($_POST['groups_read']) ? $_POST['groups_read'] : array(); + + if (isset($_POST['groups_submit'])) { + $categoryObj->setGroups_submit($_POST['groups_submit']); + } else { + $categoryObj->setGroups_submit(); + } + $grpsubmit = isset($_POST['groups_submit']) ? $_POST['groups_submit'] : array(); + + if (isset($_POST['groups_moderation'])) { + $categoryObj->setGroups_moderation($_POST['groups_moderation']); + } else { + $categoryObj->setGroups_moderation(); + } + $grpmoderation = isset($_POST['groups_moderation']) ? $_POST['groups_moderation'] : array(); + + + $categoryObj->setVar('name', $_POST['name']); + + //Added by skalpa: custom template support + if (isset($_POST['template'])) { + $categoryObj->setVar('template', $_POST['template']); + } + + if (isset($_POST['meta_description'])) { + $categoryObj->setVar('meta_description', $_POST['meta_description']); + } + if (isset($_POST['meta_keywords'])) { + $categoryObj->setVar('meta_keywords', $_POST['meta_keywords']); + } + if (isset($_POST['short_url'])) { + $categoryObj->setVar('short_url', $_POST['short_url']); + } + $categoryObj->setVar('moderator', intval($_POST['moderator'])); + $categoryObj->setVar('description', $_POST['description']); + + if (isset($_POST['header'])) { + $categoryObj->setVar('header', $_POST['header']); + } + + if ($categoryObj->isNew()) { + $redirect_msg = _AM_PUBLISHER_CATCREATED; + $redirect_to = 'category.php?op=mod'; + } else { + $redirect_msg = _AM_PUBLISHER_COLMODIFIED; + $redirect_to = 'category.php'; + } + + if (!$categoryObj->store()) { + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); + exit; + } + // TODO : put this function in the category class + publisher_saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); + publisher_saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); + publisher_saveCategoryPermissions($categoryObj->getGroups_moderation(), $categoryObj->categoryid(), 'category_moderation'); + + + //Added by fx2024 + $parentCat = $categoryObj->categoryid(); + $sizeof = sizeof($_POST['scname']); + for ($i = 0; $i < $sizeof; $i++) { + if ($_POST['scname'][$i] != '') { + $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj->setVar('name', $_POST['scname'][$i]); + $categoryObj->setVar('parentid', $parentCat); + $categoryObj->setGroups_read($grpread); + $categoryObj->setGroups_submit($grpsubmit); + $categoryObj->setGroups_moderation($grpmoderation); + + if (!$categoryObj->store()) { + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); + exit; + } + // TODO : put this function in the category class + publisher_saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); + publisher_saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); + publisher_saveCategoryPermissions($categoryObj->getGroups_moderation(), $categoryObj->categoryid(), 'category_moderation'); + } + } + //end of fx2024 code + redirect_header($redirect_to, 2, $redirect_msg); + exit(); + break; + + //Added by fx2024 + + case "addsubcats": + $categoryid = 0; + $nb_subcats = intval($_POST['nb_subcats']) + $_POST['nb_sub_yet']; + + $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj->setVar('name', $_POST['name']); + $categoryObj->setVar('description', $_POST['description']); + $categoryObj->setVar('weight', $_POST['weight']); + $categoryObj->setGroups_read(isset($_POST['groups_read']) ? $_POST['groups_read'] : array()); + if (isset($parentCat)) { + $categoryObj->setVar('parentid', $parentCat); + } + + publisher_cpHeader(); + publisher_editCat(true, $categoryid, $nb_subcats, $categoryObj); + exit(); + + break; + //end of fx2024 code + + case "cancel": + redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_BACK2IDX, '')); + exit(); + + case "default": + default: + publisher_cpHeader(); + //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); + + echo "<br />\n"; + echo "<form><div style=\"margin-bottom: 12px;\">"; + echo "<input type='button' name='button' onclick=\"location='category.php?op=mod'\" value='" . _AM_PUBLISHER_CATEGORY_CREATE . "'> "; + //echo "<input type='button' name='button' onclick=\"location='item.php?op=mod'\" value='" . _AM_PUBLISHER_CREATEITEM . "'> "; + echo "</div></form>"; + + // Creating the objects for top categories + $categoriesObj = $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); + + publisher_openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); + + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; + echo "<tr>"; + echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCATEGORYNAME . "</strong></td>"; + echo "<td width='60' class='bg3' width='65' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . "</strong></td>"; + echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; + echo "</tr>"; + $totalCategories = $publisher->getHandler('category')->getCategoriesCount(0); + if (count($categoriesObj) > 0) { + foreach ($categoriesObj as $key => $thiscat) { + publisher_displayCategory($thiscat); + } + } else { + echo "<tr>"; + echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOCAT . "</td>"; + echo "</tr>"; + $categoryid = '0'; + } + echo "</table>\n"; + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + $pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); + echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; + echo "<br />"; + publisher_closeCollapsableBar('createdcategories', 'createdcategoriesicon'); + echo "<br>"; + //editcat(false); + break; +} + +xoops_cp_footer(); + +function publisher_displayCategory($categoryObj, $level = 0) +{ + $publisher = PublisherPublisher::getInstance(); + + $description = $categoryObj->description(); + if (!XOOPS_USE_MULTIBYTES) { + if (strlen($description) >= 100) { + $description = substr($description, 0, (100 - 1)) . "..."; + } + } + $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . "&parentid=" . $categoryObj->parentid() . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>"; + $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>"; + + $spaces = ''; + for ($j = 0; $j < $level; $j++) { + $spaces .= ' '; + } + + echo "<tr>"; + echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/subcat.gif' alt='' /> " . $categoryObj->name() . "</a></td>"; + echo "<td class='even' align='center'>" . $categoryObj->weight() . "</td>"; + echo "<td class='even' align='center'> $modify $delete </td>"; + echo "</tr>"; + $subCategoriesObj = $publisher->getHandler('category')->getCategories(0, 0, $categoryObj->categoryid()); + if (count($subCategoriesObj) > 0) { + $level++; + foreach ($subCategoriesObj as $key => $thiscat) { + publisher_displayCategory($thiscat, $level); + } + } + unset($categoryObj); +} + +function publisher_editCat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null) +{ + $publisher = PublisherPublisher::getInstance(); + + // if there is a parameter, and the id exists, retrieve data: we're editing a category + if ($categoryid != 0) { + // Creating the category object for the selected category + $categoryObj = $publisher->getHandler('category')->get($categoryid); + if ($categoryObj->notLoaded()) { + redirect_header("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT); + exit(); + } + } else { + if (!$categoryObj) { + $categoryObj = $publisher->getHandler('category')->create(); + } + } + + if ($categoryid != 0) { + if ($showmenu) { + //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING); + } + echo "<br />\n"; + publisher_openCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO); + } else { + if ($showmenu) { + //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_CREATINGNEW); + } + publisher_openCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO); + } + + $sform = $categoryObj->getForm($nb_subcats); + $sform->display(); + + if (!$categoryid) { + publisher_closeCollapsableBar('createtable', 'createtableicon'); + } else { + publisher_closeCollapsableBar('edittable', 'edittableicon'); + } + + //Added by fx2024 + if ($categoryid) { + $sel_cat = $categoryid; + + publisher_openCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC); + // Get the total number of sub-categories + $categoriesObj = $publisher->getHandler('category')->get($sel_cat); + $totalsubs = $publisher->getHandler('category')->getCategoriesCount($sel_cat); + // creating the categories objects that are published + $subcatsObj = $publisher->getHandler('category')->getCategories(0, 0, $categoriesObj->categoryid()); + $totalSCOnPage = count($subcatsObj); + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; + echo "<tr>"; + echo "<td width='60' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATID . "</strong></td>"; + echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATCOLNAME . "</strong></td>"; + echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_SUBDESCRIPT . "</strong></td>"; + echo "<td width='60' class='bg3' align='right'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; + echo "</tr>"; + if ($totalsubs > 0) { + foreach ($subcatsObj as $subcat) { + $modify = "<a href='category.php?op=mod&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_MODIFY . "' alt='" . _AM_PUBLISHER_MODIFY . "' /></a>"; + $delete = "<a href='category.php?op=del&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETE . "' alt='" . _AM_PUBLISHER_DELETE . "' /></a>"; + echo "<tr>"; + echo "<td class='head' align='left'>" . $subcat->categoryid() . "</td>"; + echo "<td class='even' align='left'><a href='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/category.php?categoryid=" . $subcat->categoryid() . "&parentid=" . $subcat->parentid() . "'>" . $subcat->name() . "</a></td>"; + echo "<td class='even' align='left'>" . $subcat->description() . "</td>"; + echo "<td class='even' align='right'> {$modify} {$delete} </td>"; + echo "</tr>"; + } + } else { + echo "<tr>"; + echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOSUBCAT . "</td>"; + echo "</tr>"; + } + echo "</table>\n"; + echo "<br />\n"; + publisher_closeCollapsableBar('subcatstable', 'subcatsicon'); + + publisher_openCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC); + $startitem = PublisherRequest::getInt('startitem'); + // Get the total number of published ITEMS + $totalitems = $publisher->getHandler('item')->getItemsCount($sel_cat, array(_PUBLISHER_STATUS_PUBLISHED)); + // creating the items objects that are published + $itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $sel_cat); + $totalitemsOnPage = count($itemsObj); + $allcats = $publisher->getHandler('category')->getObjects(null, true); + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; + echo "<tr>"; + echo "<td width='40' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . "</strong></td>"; + echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCOLNAME . "</strong></td>"; + echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMDESC . "</strong></td>"; + echo "<td width='90' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . "</strong></td>"; + echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; + echo "</tr>"; + if ($totalitems > 0) { + for ($i = 0; $i < $totalitemsOnPage; $i++) { + $categoryObj =& $allcats[$itemsObj[$i]->categoryid()]; + $modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "' /></a>"; + $delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'/></a>"; + echo "<tr>"; + echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . "</td>"; + echo "<td class='even' align='left'>" . $categoryObj->name() . "</td>"; + echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . "</td>"; + echo "<td class='even' align='center'>" . $itemsObj[$i]->datesub('s') . "</td>"; + echo "<td class='even' align='center'> $modify $delete </td>"; + echo "</tr>"; + } + } else { + $itemid = -1; + echo "<tr>"; + echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . "</td>"; + echo "</tr>"; + } + echo "</table>\n"; + echo "<br />\n"; + $parentid = PublisherRequest::getInt('parentid'); + $pagenav_extra_args = "op=mod&categoryid=$sel_cat&parentid=$parentid"; + xoops_load('XoopsPageNav'); + $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenav_extra_args); + echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; + echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $sel_cat . "'\" value='" . _AM_PUBLISHER_CREATEITEM . "'> "; + echo "</div>"; + } + //end of fx2024 code +} \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/category.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsModules/publisher/trunk/publisher/admin/clone.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/clone.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/clone.php 2012-11-27 13:58:28 UTC (rev 10276) @@ -0,0 +1,167 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +include_once dirname(__FILE__) . "/admin_header.php"; + +publisher_cpHeader(); +//publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); +publisher_openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); + +if (@$_POST['op'] == 'submit') { + + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('clone.php', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); + exit(); + } + + $clone = $_POST['clone']; + + //check if name is valid + if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) { + redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_INVALIDNAME, $clone)); + exit(); + } + + // Check wether the cloned module exists or not + if ($clone && is_dir(XOOPS_ROOT_PATH . '/modules/' . $clone)) { + redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_EXISTS, $clone)); + } + + $patterns = array( + strtolower(PUBLISHER_DIRNAME) => strtolower($clone), + strtoupper(PUBLISHER_DIRNAME) => strtoupper($clone), + ucfirst(strtolower(PUBLISHER_DIRNAME)) => ucfirst(strtolower($clone)) + ); + + $patKeys = array_keys($patterns); + $patValues = array_values($patterns); + publisher_cloneFileFolder(PUBLISHER_ROOT_PATH); + $logocreated = publisher_createLogo(strtolower($clone)); + + $msg = ""; + if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($clone))) { + $msg .= sprintf(_AM_PUBLISHER_CLONE_CONGRAT, "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(strtolower($clone)) . "</a>") . "<br />\n"; + if (!$logocreated) { + $msg .= _AM_PUBLISHER_CLONE_IMAGEFAIL; + } + } else { + $msg .= _AM_PUBLISHER_CLONE_FAIL; + } + echo $msg; + +} else { + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true); + $clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, ''); + $clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC); + $form->addElement($clone, true); + $form->addElement(new XoopsFormHidden('op', 'submit')); + $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit')); + $form->display(); +} + +// End of collapsable bar +publisher_closeCollapsableBar('clone', 'cloneicon'); +xoops_cp_footer(); + +// work around for PHP < 5.0.x +if (!function_exists('file_put_contents')) { + function file_put_contents($filename, $data, $file_append = false) + { + if ($fp = fopen($filename, (!$file_append ? 'w+' : 'a+'))) { + fputs($fp, $data); + fclose($fp); + } + } +} + +// recursive clonning script +function publisher_cloneFileFolder($path) +{ + global $patKeys; + global $patValues; + + $newPath = str_replace($patKeys[0], $patValues[0], $path); + + if (is_dir($path)) { + // create new dir + mkdir($newPath); + + // check all files in dir, and process it + if ($handle = opendir($path)) { + while ($file = readdir($handle)) { + if ($file != '.' && $file != '..' && $file != '.svn') { + publisher_cloneFileFolder("{$path}/{$file}"); + } + } + closedir($handle); + } + } else { + + if (preg_match('/(.jpg|.gif|.png|.zip)$/i', $path)) { + // image + copy($path, $newPath); + } else { + // file, read it + $content = file_get_contents($path); + $content = str_replace($patKeys, $patValues, $content); + file_put_contents($newPath, $content); + } + } +} + +function publisher_createLogo($dirname) +{ + if (!extension_loaded("gd")) { + return false; + } else { + $required_functions = array("imagecreatetruecolor", "imagecolorallocate", "imagefilledrectangle", "imagejpeg", "imagedestroy", "imageftbbox"); + foreach ($required_functions as $func) { + if (!function_exists($func)) { + return false; + } + } + } + + if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png") || !file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/VeraBd.ttf")) { + return false; + } + + $imageModule = imagecreatefrompng($imageBase); + + //Erase old text + $grey_color = imagecolorallocate($imageModule, 237, 237, 237); + imagefilledrectangle($imageModule, 5, 35, 85, 46, $grey_color); + + // Write text + $text_color = imagecolorallocate($imageModule, 0, 0, 0); + $space_to_border = (80 - strlen($dirname) * 6.5) / 2; + imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($dirname), array()); + + // Set transparency color + $white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127); + imagefill($imageModule, 0, 0, $white); + imagecolortransparent($imageModule, $white); + imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png"); + imagedestroy($imageModule); + return true; +} + +?> \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/clone.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsModules/publisher/trunk/publisher/admin/file.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/file.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/file.php 2012-11-27 13:58:28 UTC (rev 10276) @@ -0,0 +1,163 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @author The SmartFactory <www.smartfactory.ca> + * @version $Id$ + */ + +include_once dirname(__FILE__) . '/admin_header.php'; + +$op = PublisherRequest::getString('op'); + +function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) +{ + $publisher = PublisherPublisher::getInstance(); + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + + // if there is a parameter, and the id exists, retrieve data: we're editing a file + if ($fileid != 0) { + + // Creating the File object + $fileObj = $publisher->getHandler('file')->get($fileid); + + if ($fileObj->notLoaded()) { + redirect_header("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); + exit(); + } + + if ($showmenu) { + //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_EDITING); + } + + echo "<br />\n"; + echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_EDITING . "</span>"; + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_EDITING_DSC . "</span>"; + publisher_openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + } else { + // there's no parameter, so we're adding an item + $fileObj = $publisher->getHandler('file')->create(); + $fileObj->setVar('itemid', $itemid); + if ($showmenu) { + //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_FILE_ADD); + } + echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_ADDING . "</span>"; + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_ADDING_DSC . "</span>"; + publisher_openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + } + + // FILES UPLOAD FORM + $files_form = $fileObj->getForm(); + $files_form->display(); + + if ($fileid != 0) { + publisher_closeCollapsableBar('editfile', 'editfileicon'); + } else { + publisher_closeCollapsableBar('addfile', 'addfileicon'); + } + +} + +$false = false; +/* -- Available operations -- */ +switch ($op) { + case "uploadfile"; + publisher_uploadFile(false, true, $false); + exit; + break; + + case "uploadanother"; + publisher_uploadFile(true, true, $false); + exit; + break; + + case "mod": + $fileid = isset($_GET['fileid']) ? $_GET['fileid'] : 0; + $itemid = isset($_GET['itemid']) ? $_GET['itemid'] : 0; + if (($fileid == 0) && ($itemid == 0)) { + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_NOITEMSELECTED); + exit(); + } + + publisher_cpHeader(); + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + + publishe... [truncated message content] |
From: <tr...@us...> - 2012-11-27 13:44:34
|
Revision: 10200 http://xoops.svn.sourceforge.net/xoops/?rev=10200&view=rev Author: trabis Date: 2012-11-27 13:44:22 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Adding publisher module Added Paths: ----------- XoopsModules/publisher/ XoopsModules/publisher/branches/ XoopsModules/publisher/releases/ XoopsModules/publisher/trunk/ XoopsModules/publisher/trunk/publisher/ XoopsModules/publisher/trunk/publisher/admin/ XoopsModules/publisher/trunk/publisher/admin/about.php XoopsModules/publisher/trunk/publisher/admin/admin_header.php XoopsModules/publisher/trunk/publisher/admin/category.php XoopsModules/publisher/trunk/publisher/admin/clone.php XoopsModules/publisher/trunk/publisher/admin/file.php XoopsModules/publisher/trunk/publisher/admin/import/ XoopsModules/publisher/trunk/publisher/admin/import/index.html XoopsModules/publisher/trunk/publisher/admin/import/news.php XoopsModules/publisher/trunk/publisher/admin/import/smartsection.php XoopsModules/publisher/trunk/publisher/admin/import/wfsection.php XoopsModules/publisher/trunk/publisher/admin/import/xfsection.php XoopsModules/publisher/trunk/publisher/admin/import.php XoopsModules/publisher/trunk/publisher/admin/index.php XoopsModules/publisher/trunk/publisher/admin/item.php XoopsModules/publisher/trunk/publisher/admin/main.php XoopsModules/publisher/trunk/publisher/admin/menu.php XoopsModules/publisher/trunk/publisher/admin/mimetypes.php XoopsModules/publisher/trunk/publisher/admin/pagewrap.php XoopsModules/publisher/trunk/publisher/admin/permissions.php XoopsModules/publisher/trunk/publisher/admin/preferences.php XoopsModules/publisher/trunk/publisher/admin/pw_delete_file.php XoopsModules/publisher/trunk/publisher/admin/pw_upload_file.php XoopsModules/publisher/trunk/publisher/ajaxrating.txt XoopsModules/publisher/trunk/publisher/archive.php XoopsModules/publisher/trunk/publisher/author_items.php XoopsModules/publisher/trunk/publisher/backend.php XoopsModules/publisher/trunk/publisher/blocks/ XoopsModules/publisher/trunk/publisher/blocks/category_items_sel.php XoopsModules/publisher/trunk/publisher/blocks/date_to_date.php XoopsModules/publisher/trunk/publisher/blocks/index.html XoopsModules/publisher/trunk/publisher/blocks/items_columns.php XoopsModules/publisher/trunk/publisher/blocks/items_menu.php XoopsModules/publisher/trunk/publisher/blocks/items_new.php XoopsModules/publisher/trunk/publisher/blocks/items_random_item.php XoopsModules/publisher/trunk/publisher/blocks/items_recent.php XoopsModules/publisher/trunk/publisher/blocks/items_spot.php XoopsModules/publisher/trunk/publisher/blocks/latest_files.php XoopsModules/publisher/trunk/publisher/blocks/latest_news.php XoopsModules/publisher/trunk/publisher/blocks/search.php XoopsModules/publisher/trunk/publisher/category.php XoopsModules/publisher/trunk/publisher/changelog.txt XoopsModules/publisher/trunk/publisher/class/ XoopsModules/publisher/trunk/publisher/class/blockform.php XoopsModules/publisher/trunk/publisher/class/category.php XoopsModules/publisher/trunk/publisher/class/file.php XoopsModules/publisher/trunk/publisher/class/form/ XoopsModules/publisher/trunk/publisher/class/form/category.php XoopsModules/publisher/trunk/publisher/class/form/file.php XoopsModules/publisher/trunk/publisher/class/form/index.html XoopsModules/publisher/trunk/publisher/class/form/item.php XoopsModules/publisher/trunk/publisher/class/formdatetime.php XoopsModules/publisher/trunk/publisher/class/groupperm.php XoopsModules/publisher/trunk/publisher/class/highlighter.php XoopsModules/publisher/trunk/publisher/class/index.html XoopsModules/publisher/trunk/publisher/class/item.php XoopsModules/publisher/trunk/publisher/class/metagen.php XoopsModules/publisher/trunk/publisher/class/mimetype.php XoopsModules/publisher/trunk/publisher/class/permission.php XoopsModules/publisher/trunk/publisher/class/publisher.php XoopsModules/publisher/trunk/publisher/class/rating.php XoopsModules/publisher/trunk/publisher/class/request.php XoopsModules/publisher/trunk/publisher/class/session.php XoopsModules/publisher/trunk/publisher/class/themetabform.php XoopsModules/publisher/trunk/publisher/class/uploader.php XoopsModules/publisher/trunk/publisher/comment_delete.php XoopsModules/publisher/trunk/publisher/comment_edit.php XoopsModules/publisher/trunk/publisher/comment_new.php XoopsModules/publisher/trunk/publisher/comment_post.php XoopsModules/publisher/trunk/publisher/comment_reply.php XoopsModules/publisher/trunk/publisher/css/ XoopsModules/publisher/trunk/publisher/css/images/ XoopsModules/publisher/trunk/publisher/css/images/index.html XoopsModules/publisher/trunk/publisher/css/images/ui-bg_flat_0_aaaaaa_40x100.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_flat_75_ffffff_40x100.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_55_fbf9ee_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_65_ffffff_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_75_dadada_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_75_e6e6e6_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_glass_95_fef1ec_1x400.png XoopsModules/publisher/trunk/publisher/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_222222_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_2e83ff_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_454545_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_888888_256x240.png XoopsModules/publisher/trunk/publisher/css/images/ui-icons_cd0a0a_256x240.png XoopsModules/publisher/trunk/publisher/css/index.html XoopsModules/publisher/trunk/publisher/css/jquery-ui-1.7.1.custom.css XoopsModules/publisher/trunk/publisher/css/jquery.popeye.style.css XoopsModules/publisher/trunk/publisher/css/publisher.css XoopsModules/publisher/trunk/publisher/docs/ XoopsModules/publisher/trunk/publisher/docs/changelog.txt XoopsModules/publisher/trunk/publisher/docs/credits.txt XoopsModules/publisher/trunk/publisher/docs/index.html XoopsModules/publisher/trunk/publisher/docs/install.txt XoopsModules/publisher/trunk/publisher/docs/lang_diff.txt XoopsModules/publisher/trunk/publisher/docs/licence.txt XoopsModules/publisher/trunk/publisher/docs/readme.txt XoopsModules/publisher/trunk/publisher/extra/ XoopsModules/publisher/trunk/publisher/extra/index.html XoopsModules/publisher/trunk/publisher/extra/seo/ XoopsModules/publisher/trunk/publisher/extra/seo/index.html XoopsModules/publisher/trunk/publisher/extra/seo/sample.htaccess XoopsModules/publisher/trunk/publisher/extra/seo/seo.txt XoopsModules/publisher/trunk/publisher/file.php XoopsModules/publisher/trunk/publisher/footer.php XoopsModules/publisher/trunk/publisher/header.php XoopsModules/publisher/trunk/publisher/images/ XoopsModules/publisher/trunk/publisher/images/VeraBd.ttf XoopsModules/publisher/trunk/publisher/images/arrow-bg.png XoopsModules/publisher/trunk/publisher/images/bg.gif XoopsModules/publisher/trunk/publisher/images/blank.png XoopsModules/publisher/trunk/publisher/images/bullet.gif XoopsModules/publisher/trunk/publisher/images/button_delete.png XoopsModules/publisher/trunk/publisher/images/button_edit.png XoopsModules/publisher/trunk/publisher/images/dot-grey.gif XoopsModules/publisher/trunk/publisher/images/gfx/ XoopsModules/publisher/trunk/publisher/images/gfx/count-2.png XoopsModules/publisher/trunk/publisher/images/gfx/enlarge-1.png XoopsModules/publisher/trunk/publisher/images/gfx/enlarge-2.png XoopsModules/publisher/trunk/publisher/images/gfx/index.html XoopsModules/publisher/trunk/publisher/images/gfx/loading.gif XoopsModules/publisher/trunk/publisher/images/gfx/next-1.png XoopsModules/publisher/trunk/publisher/images/gfx/next-2.png XoopsModules/publisher/trunk/publisher/images/gfx/next.gif XoopsModules/publisher/trunk/publisher/images/gfx/prev-1.png XoopsModules/publisher/trunk/publisher/images/gfx/prev-2.png XoopsModules/publisher/trunk/publisher/images/gfx/prev.gif XoopsModules/publisher/trunk/publisher/images/grad-bg.png XoopsModules/publisher/trunk/publisher/images/icon/ XoopsModules/publisher/trunk/publisher/images/icon/approve.gif XoopsModules/publisher/trunk/publisher/images/icon/cat.gif XoopsModules/publisher/trunk/publisher/images/icon/clone.gif XoopsModules/publisher/trunk/publisher/images/icon/close12.gif XoopsModules/publisher/trunk/publisher/images/icon/delete.gif XoopsModules/publisher/trunk/publisher/images/icon/delete.png XoopsModules/publisher/trunk/publisher/images/icon/doc.png XoopsModules/publisher/trunk/publisher/images/icon/edit.gif XoopsModules/publisher/trunk/publisher/images/icon/edit.png XoopsModules/publisher/trunk/publisher/images/icon/editcopy.png XoopsModules/publisher/trunk/publisher/images/icon/file.gif XoopsModules/publisher/trunk/publisher/images/icon/friend.gif XoopsModules/publisher/trunk/publisher/images/icon/index.html XoopsModules/publisher/trunk/publisher/images/icon/newanswer.gif XoopsModules/publisher/trunk/publisher/images/icon/open12.gif XoopsModules/publisher/trunk/publisher/images/icon/pdf.gif XoopsModules/publisher/trunk/publisher/images/icon/print.gif XoopsModules/publisher/trunk/publisher/images/icon/subcat.gif XoopsModules/publisher/trunk/publisher/images/icon32/ XoopsModules/publisher/trunk/publisher/images/icon32/editcopy.png XoopsModules/publisher/trunk/publisher/images/icon32/folder_txt.png XoopsModules/publisher/trunk/publisher/images/icon32/index.html XoopsModules/publisher/trunk/publisher/images/important-32.png XoopsModules/publisher/trunk/publisher/images/index.html XoopsModules/publisher/trunk/publisher/images/item_icon.gif XoopsModules/publisher/trunk/publisher/images/left_both.gif XoopsModules/publisher/trunk/publisher/images/links/ XoopsModules/publisher/trunk/publisher/images/links/approve.gif XoopsModules/publisher/trunk/publisher/images/links/cat.gif XoopsModules/publisher/trunk/publisher/images/links/clone.gif XoopsModules/publisher/trunk/publisher/images/links/close12.gif XoopsModules/publisher/trunk/publisher/images/links/delete.gif XoopsModules/publisher/trunk/publisher/images/links/delete.png XoopsModules/publisher/trunk/publisher/images/links/doc.png XoopsModules/publisher/trunk/publisher/images/links/edit.gif XoopsModules/publisher/trunk/publisher/images/links/edit.png XoopsModules/publisher/trunk/publisher/images/links/editcopy.png XoopsModules/publisher/trunk/publisher/images/links/file.gif XoopsModules/publisher/trunk/publisher/images/links/friend.gif XoopsModules/publisher/trunk/publisher/images/links/index.html XoopsModules/publisher/trunk/publisher/images/links/newanswer.gif XoopsModules/publisher/trunk/publisher/images/links/next.gif XoopsModules/publisher/trunk/publisher/images/links/open12.gif XoopsModules/publisher/trunk/publisher/images/links/pdf.gif XoopsModules/publisher/trunk/publisher/images/links/previous.gif XoopsModules/publisher/trunk/publisher/images/links/print.gif XoopsModules/publisher/trunk/publisher/images/links/subcat.gif XoopsModules/publisher/trunk/publisher/images/loadingbar.gif XoopsModules/publisher/trunk/publisher/images/module_logo.png XoopsModules/publisher/trunk/publisher/images/no.gif XoopsModules/publisher/trunk/publisher/images/off.png XoopsModules/publisher/trunk/publisher/images/on.png XoopsModules/publisher/trunk/publisher/images/popeye/ XoopsModules/publisher/trunk/publisher/images/popeye/bg1.png XoopsModules/publisher/trunk/publisher/images/popeye/compact3.png XoopsModules/publisher/trunk/publisher/images/popeye/enlarge3.png XoopsModules/publisher/trunk/publisher/images/popeye/index.html XoopsModules/publisher/trunk/publisher/images/popeye/loading3.gif XoopsModules/publisher/trunk/publisher/images/popeye/next3.png XoopsModules/publisher/trunk/publisher/images/popeye/prev3.png XoopsModules/publisher/trunk/publisher/images/right_both.gif XoopsModules/publisher/trunk/publisher/images/rss.gif XoopsModules/publisher/trunk/publisher/images/span-bg.gif XoopsModules/publisher/trunk/publisher/images/starrating.gif XoopsModules/publisher/trunk/publisher/images/transparent_bg.png XoopsModules/publisher/trunk/publisher/images/working.gif XoopsModules/publisher/trunk/publisher/include/ XoopsModules/publisher/trunk/publisher/include/ajax_rating.php XoopsModules/publisher/trunk/publisher/include/ajax_upload.php XoopsModules/publisher/trunk/publisher/include/comment_functions.php XoopsModules/publisher/trunk/publisher/include/common.php XoopsModules/publisher/trunk/publisher/include/constants.php XoopsModules/publisher/trunk/publisher/include/functions.php XoopsModules/publisher/trunk/publisher/include/index.html XoopsModules/publisher/trunk/publisher/include/media.textsanitizer.php XoopsModules/publisher/trunk/publisher/include/notification.inc.php XoopsModules/publisher/trunk/publisher/include/plugin.tag.php XoopsModules/publisher/trunk/publisher/include/search.inc.php XoopsModules/publisher/trunk/publisher/include/seo.inc.php XoopsModules/publisher/trunk/publisher/include/seo_functions.php XoopsModules/publisher/trunk/publisher/include/update.php XoopsModules/publisher/trunk/publisher/index.php XoopsModules/publisher/trunk/publisher/item.php XoopsModules/publisher/trunk/publisher/js/ XoopsModules/publisher/trunk/publisher/js/ajaxupload.3.9.js XoopsModules/publisher/trunk/publisher/js/behavior.js XoopsModules/publisher/trunk/publisher/js/cookies.js XoopsModules/publisher/trunk/publisher/js/funcs.js XoopsModules/publisher/trunk/publisher/js/index.html XoopsModules/publisher/trunk/publisher/js/jquery.easing.js XoopsModules/publisher/trunk/publisher/js/jquery.popeye-2.0.4.js XoopsModules/publisher/trunk/publisher/js/publisher.js XoopsModules/publisher/trunk/publisher/js/rating.js XoopsModules/publisher/trunk/publisher/js/script.easing.js XoopsModules/publisher/trunk/publisher/js/ui.core.js XoopsModules/publisher/trunk/publisher/js/ui.tabs.js XoopsModules/publisher/trunk/publisher/language/ XoopsModules/publisher/trunk/publisher/language/english/ XoopsModules/publisher/trunk/publisher/language/english/admin.php XoopsModules/publisher/trunk/publisher/language/english/blocks.php XoopsModules/publisher/trunk/publisher/language/english/common.php XoopsModules/publisher/trunk/publisher/language/english/help/ XoopsModules/publisher/trunk/publisher/language/english/help/help.html XoopsModules/publisher/trunk/publisher/language/english/help/index.html XoopsModules/publisher/trunk/publisher/language/english/index.html XoopsModules/publisher/trunk/publisher/language/english/mail_template/ XoopsModules/publisher/trunk/publisher/language/english/mail_template/category_item_published.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/category_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/global_item_category_created.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/global_item_published.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/global_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/index.html XoopsModules/publisher/trunk/publisher/language/english/mail_template/item_approved.tpl XoopsModules/publisher/trunk/publisher/language/english/mail_template/item_rejected.tpl XoopsModules/publisher/trunk/publisher/language/english/main.php XoopsModules/publisher/trunk/publisher/language/english/modinfo.php XoopsModules/publisher/trunk/publisher/language/french/ XoopsModules/publisher/trunk/publisher/language/french/admin.php XoopsModules/publisher/trunk/publisher/language/french/blocks.php XoopsModules/publisher/trunk/publisher/language/french/common.php XoopsModules/publisher/trunk/publisher/language/french/index.html XoopsModules/publisher/trunk/publisher/language/french/mail_template/ XoopsModules/publisher/trunk/publisher/language/french/mail_template/category_item_published.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/category_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/global_item_category_created.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/global_item_published.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/global_item_submitted.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/index.html XoopsModules/publisher/trunk/publisher/language/french/mail_template/item_approved.tpl XoopsModules/publisher/trunk/publisher/language/french/mail_template/item_rejected.tpl XoopsModules/publisher/trunk/publisher/language/french/main.php XoopsModules/publisher/trunk/publisher/language/french/modinfo.php XoopsModules/publisher/trunk/publisher/language/index.html XoopsModules/publisher/trunk/publisher/list.tag.php XoopsModules/publisher/trunk/publisher/makepdf.php XoopsModules/publisher/trunk/publisher/notification_update.php XoopsModules/publisher/trunk/publisher/pop.php XoopsModules/publisher/trunk/publisher/print.php XoopsModules/publisher/trunk/publisher/rate.php XoopsModules/publisher/trunk/publisher/search.php XoopsModules/publisher/trunk/publisher/sql/ XoopsModules/publisher/trunk/publisher/sql/index.html XoopsModules/publisher/trunk/publisher/sql/mysql.sql XoopsModules/publisher/trunk/publisher/submit.php XoopsModules/publisher/trunk/publisher/tcpdf/ XoopsModules/publisher/trunk/publisher/tcpdf/CHANGELOG.TXT XoopsModules/publisher/trunk/publisher/tcpdf/LICENSE.TXT XoopsModules/publisher/trunk/publisher/tcpdf/README.TXT XoopsModules/publisher/trunk/publisher/tcpdf/cache/ XoopsModules/publisher/trunk/publisher/tcpdf/cache/index.html XoopsModules/publisher/trunk/publisher/tcpdf/config/ XoopsModules/publisher/trunk/publisher/tcpdf/config/index.html XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/ XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/ar.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/de.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/en.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/fa.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/fr.php XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/index.html XoopsModules/publisher/trunk/publisher/tcpdf/config/lang/nl.php XoopsModules/publisher/trunk/publisher/tcpdf/config/tcpdf_config.php XoopsModules/publisher/trunk/publisher/tcpdf/fonts/ XoopsModules/publisher/trunk/publisher/tcpdf/fonts/almohanad.ctg.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/almohanad.php XoopsModules/publisher/trunk/publisher/tcpdf/fonts/almohanad.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/dejavusans.ctg.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/dejavusans.php XoopsModules/publisher/trunk/publisher/tcpdf/fonts/dejavusans.z XoopsModules/publisher/trunk/publisher/tcpdf/fonts/index.html XoopsModules/publisher/trunk/publisher/tcpdf/htmlcolors.php XoopsModules/publisher/trunk/publisher/tcpdf/images/ XoopsModules/publisher/trunk/publisher/tcpdf/images/index.html XoopsModules/publisher/trunk/publisher/tcpdf/index.html XoopsModules/publisher/trunk/publisher/tcpdf/tcpdf.php XoopsModules/publisher/trunk/publisher/tcpdf/unicode_data.php XoopsModules/publisher/trunk/publisher/templates/ XoopsModules/publisher/trunk/publisher/templates/blocks/ XoopsModules/publisher/trunk/publisher/templates/blocks/index.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_category_items_sel.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_date_to_date.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_columns.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_menu.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_new.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_random_item.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_recent.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_spot.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_latest_files.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_latest_news.html XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_search_block.html XoopsModules/publisher/trunk/publisher/templates/index.html XoopsModules/publisher/trunk/publisher/templates/publisher_addfile.html XoopsModules/publisher/trunk/publisher/templates/publisher_archive.html XoopsModules/publisher/trunk/publisher/templates/publisher_author_items.html XoopsModules/publisher/trunk/publisher/templates/publisher_categories_table.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_full.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_list.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_summary.html XoopsModules/publisher/trunk/publisher/templates/publisher_display_wfsection.html XoopsModules/publisher/trunk/publisher/templates/publisher_footer.html XoopsModules/publisher/trunk/publisher/templates/publisher_header.html XoopsModules/publisher/trunk/publisher/templates/publisher_item.html XoopsModules/publisher/trunk/publisher/templates/publisher_print.html XoopsModules/publisher/trunk/publisher/templates/publisher_rss.html XoopsModules/publisher/trunk/publisher/templates/publisher_search.html XoopsModules/publisher/trunk/publisher/templates/publisher_singleitem.html XoopsModules/publisher/trunk/publisher/templates/publisher_singleitem_block.html XoopsModules/publisher/trunk/publisher/templates/publisher_submit.html XoopsModules/publisher/trunk/publisher/thumb.php XoopsModules/publisher/trunk/publisher/view.tag.php XoopsModules/publisher/trunk/publisher/visit.php XoopsModules/publisher/trunk/publisher/xoops_version.php Added: XoopsModules/publisher/trunk/publisher/admin/about.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/about.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/about.php 2012-11-27 13:44:22 UTC (rev 10200) @@ -0,0 +1,32 @@ +<?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. +*/ + +/** + * Publisher + * + * @copyright The XOOPS Project (http://www.xoops.org) + * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) + * @package Publisher + * @since 1.0 + * @author Mage, Mamba + * @version $Id$ + */ + +include_once dirname(__FILE__) . '/admin_header.php'; + +xoops_cp_header(); + +$aboutAdmin = new ModuleAdmin(); + +echo $aboutAdmin->addNavigation('about.php'); +echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false); + +xoops_cp_footer(); \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/about.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsModules/publisher/trunk/publisher/admin/admin_header.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/admin_header.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/admin_header.php 2012-11-27 13:44:22 UTC (rev 10200) @@ -0,0 +1,46 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @author The SmartFactory <www.smartfactory.ca> + * @version $Id$ + */ + +include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php'; +include_once dirname(dirname(__FILE__)) . '/include/common.php'; +include_once XOOPS_ROOT_PATH . '/include/cp_header.php'; + +//xoops_loadLanguage('admin', PUBLISHER_DIRNAME); +xoops_loadLanguage('modinfo', PUBLISHER_DIRNAME); + +$imagearray = array( + 'editimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_edit.png' alt='" . _AM_PUBLISHER_ICO_EDIT . "' align='middle' />", + 'deleteimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_delete.png' alt='" . _AM_PUBLISHER_ICO_DELETE . "' align='middle' />", + 'online' => "<img src='" . PUBLISHER_IMAGES_URL . "/on.png' alt='" . _AM_PUBLISHER_ICO_ONLINE . "' align='middle' />", + 'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle' />", +); +if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ + include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); +}else{ + echo xoops_error('/Frameworks/moduleclasses/moduleadmin/ is required!!!'); +} +/* +$myts =& MyTextSanitizer::getInstance(); + +if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { + include_once(XOOPS_ROOT_PATH."/class/template.php"); + $xoopsTpl = new XoopsTpl(); +} */ \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/admin_header.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsModules/publisher/trunk/publisher/admin/category.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/category.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/category.php 2012-11-27 13:44:22 UTC (rev 10200) @@ -0,0 +1,431 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @author The SmartFactory <www.smartfactory.ca> + * @version $Id$ + */ + +include_once dirname(__FILE__) . '/admin_header.php'; + +$op = PublisherRequest::getString('op'); + +$op = isset($_POST['editor']) ? 'mod' : $op; +if (isset($_POST['addcategory'])) { + $op = 'addcategory'; +} + +// Where do we start ? +$startcategory = PublisherRequest::getInt('startcategory'); +$categoryid = PublisherRequest::getInt('categoryid'); + +switch ($op) { + + case "del": + $categoryObj = $publisher->getHandler('category')->get($categoryid); + $confirm = (isset($_POST['confirm'])) ? $_POST['confirm'] : 0; + $name = (isset($_POST['name'])) ? $_POST['name'] : ''; + if ($confirm) { + if (!$publisher->getHandler('category')->delete($categoryObj)) { + redirect_header("category.php", 1, _AM_PUBLISHER_DELETE_CAT_ERROR); + exit(); + } + redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name)); + exit(); + } else { + xoops_cp_header(); + xoops_confirm(array('op' => 'del', 'categoryid' => $categoryObj->categoryid(), 'confirm' => 1, 'name' => $categoryObj->name()), 'category.php', _AM_PUBLISHER_DELETECOL . " '" . $categoryObj->name() . "'. <br /> <br />" . _AM_PUBLISHER_DELETE_CAT_CONFIRM, _AM_PUBLISHER_DELETE); + xoops_cp_footer(); + } + break; + + case "mod": + //Added by fx2024 + $nb_subcats = isset($_POST['nb_subcats']) ? intval($_POST['nb_subcats']) : 0; + $nb_subcats = $nb_subcats + (isset($_POST['nb_sub_yet']) ? intval($_POST['nb_sub_yet']) : 4); + //end of fx2024 code + + publisher_cpHeader(); + publisher_editCat(true, $categoryid, $nb_subcats); + break; + + case "addcategory": + global $modify; + + $parentid = PublisherRequest::getInt('parentid'); + + if ($categoryid != 0) { + $categoryObj = $publisher->getHandler('category')->get($categoryid); + } else { + $categoryObj = $publisher->getHandler('category')->create(); + } + + // Uploading the image, if any + // Retreive the filename to be uploaded + if (isset($_FILES['image_file']['name']) && $_FILES['image_file']['name'] != "") { + $filename = $_POST["xoops_upload_file"][0]; + if (!empty($filename) || $filename != "") { + // TODO : implement publisher mimetype management + $max_size = $publisher->getConfig('maximum_filesize'); + $max_imgwidth = $publisher->getConfig('maximum_image_width'); + $max_imgheight = $publisher->getConfig('maximum_image_height'); + $allowed_mimetypes = publisher_getAllowedImagesTypes(); + + if ($_FILES[$filename]['tmp_name'] == "" || !is_readable($_FILES[$filename]['tmp_name'])) { + redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); + exit(); + } + + xoops_load('XoopsMediaUploader'); + $uploader = new XoopsMediaUploader(publisher_getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); + if ($uploader->fetchMedia($filename) && $uploader->upload()) { + $categoryObj->setVar('image', $uploader->getSavedFileName()); + } else { + redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR . $uploader->getErrors()); + exit(); + } + } + } else { + if (isset($_POST['image'])) { + $categoryObj->setVar('image', $_POST['image']); + } + } + $categoryObj->setVar('parentid', (isset($_POST['parentid'])) ? intval($_POST['parentid']) : 0); + + $applyall = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0; + $categoryObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 1); + + // Groups and permissions + if (isset($_POST['groups_read'])) { + $categoryObj->setGroups_read($_POST['groups_read']); + } else { + $categoryObj->setGroups_read(); + } + $grpread = isset($_POST['groups_read']) ? $_POST['groups_read'] : array(); + + if (isset($_POST['groups_submit'])) { + $categoryObj->setGroups_submit($_POST['groups_submit']); + } else { + $categoryObj->setGroups_submit(); + } + $grpsubmit = isset($_POST['groups_submit']) ? $_POST['groups_submit'] : array(); + + if (isset($_POST['groups_moderation'])) { + $categoryObj->setGroups_moderation($_POST['groups_moderation']); + } else { + $categoryObj->setGroups_moderation(); + } + $grpmoderation = isset($_POST['groups_moderation']) ? $_POST['groups_moderation'] : array(); + + + $categoryObj->setVar('name', $_POST['name']); + + //Added by skalpa: custom template support + if (isset($_POST['template'])) { + $categoryObj->setVar('template', $_POST['template']); + } + + if (isset($_POST['meta_description'])) { + $categoryObj->setVar('meta_description', $_POST['meta_description']); + } + if (isset($_POST['meta_keywords'])) { + $categoryObj->setVar('meta_keywords', $_POST['meta_keywords']); + } + if (isset($_POST['short_url'])) { + $categoryObj->setVar('short_url', $_POST['short_url']); + } + $categoryObj->setVar('moderator', intval($_POST['moderator'])); + $categoryObj->setVar('description', $_POST['description']); + + if (isset($_POST['header'])) { + $categoryObj->setVar('header', $_POST['header']); + } + + if ($categoryObj->isNew()) { + $redirect_msg = _AM_PUBLISHER_CATCREATED; + $redirect_to = 'category.php?op=mod'; + } else { + $redirect_msg = _AM_PUBLISHER_COLMODIFIED; + $redirect_to = 'category.php'; + } + + if (!$categoryObj->store()) { + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); + exit; + } + // TODO : put this function in the category class + publisher_saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); + publisher_saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); + publisher_saveCategoryPermissions($categoryObj->getGroups_moderation(), $categoryObj->categoryid(), 'category_moderation'); + + + //Added by fx2024 + $parentCat = $categoryObj->categoryid(); + $sizeof = sizeof($_POST['scname']); + for ($i = 0; $i < $sizeof; $i++) { + if ($_POST['scname'][$i] != '') { + $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj->setVar('name', $_POST['scname'][$i]); + $categoryObj->setVar('parentid', $parentCat); + $categoryObj->setGroups_read($grpread); + $categoryObj->setGroups_submit($grpsubmit); + $categoryObj->setGroups_moderation($grpmoderation); + + if (!$categoryObj->store()) { + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); + exit; + } + // TODO : put this function in the category class + publisher_saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); + publisher_saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); + publisher_saveCategoryPermissions($categoryObj->getGroups_moderation(), $categoryObj->categoryid(), 'category_moderation'); + } + } + //end of fx2024 code + redirect_header($redirect_to, 2, $redirect_msg); + exit(); + break; + + //Added by fx2024 + + case "addsubcats": + $categoryid = 0; + $nb_subcats = intval($_POST['nb_subcats']) + $_POST['nb_sub_yet']; + + $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj->setVar('name', $_POST['name']); + $categoryObj->setVar('description', $_POST['description']); + $categoryObj->setVar('weight', $_POST['weight']); + $categoryObj->setGroups_read(isset($_POST['groups_read']) ? $_POST['groups_read'] : array()); + if (isset($parentCat)) { + $categoryObj->setVar('parentid', $parentCat); + } + + publisher_cpHeader(); + publisher_editCat(true, $categoryid, $nb_subcats, $categoryObj); + exit(); + + break; + //end of fx2024 code + + case "cancel": + redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_BACK2IDX, '')); + exit(); + + case "default": + default: + publisher_cpHeader(); + //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); + + echo "<br />\n"; + echo "<form><div style=\"margin-bottom: 12px;\">"; + echo "<input type='button' name='button' onclick=\"location='category.php?op=mod'\" value='" . _AM_PUBLISHER_CATEGORY_CREATE . "'> "; + //echo "<input type='button' name='button' onclick=\"location='item.php?op=mod'\" value='" . _AM_PUBLISHER_CREATEITEM . "'> "; + echo "</div></form>"; + + // Creating the objects for top categories + $categoriesObj = $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); + + publisher_openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); + + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; + echo "<tr>"; + echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCATEGORYNAME . "</strong></td>"; + echo "<td width='60' class='bg3' width='65' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . "</strong></td>"; + echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; + echo "</tr>"; + $totalCategories = $publisher->getHandler('category')->getCategoriesCount(0); + if (count($categoriesObj) > 0) { + foreach ($categoriesObj as $key => $thiscat) { + publisher_displayCategory($thiscat); + } + } else { + echo "<tr>"; + echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOCAT . "</td>"; + echo "</tr>"; + $categoryid = '0'; + } + echo "</table>\n"; + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + $pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); + echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; + echo "<br />"; + publisher_closeCollapsableBar('createdcategories', 'createdcategoriesicon'); + echo "<br>"; + //editcat(false); + break; +} + +xoops_cp_footer(); + +function publisher_displayCategory($categoryObj, $level = 0) +{ + $publisher = PublisherPublisher::getInstance(); + + $description = $categoryObj->description(); + if (!XOOPS_USE_MULTIBYTES) { + if (strlen($description) >= 100) { + $description = substr($description, 0, (100 - 1)) . "..."; + } + } + $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . "&parentid=" . $categoryObj->parentid() . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>"; + $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>"; + + $spaces = ''; + for ($j = 0; $j < $level; $j++) { + $spaces .= ' '; + } + + echo "<tr>"; + echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/subcat.gif' alt='' /> " . $categoryObj->name() . "</a></td>"; + echo "<td class='even' align='center'>" . $categoryObj->weight() . "</td>"; + echo "<td class='even' align='center'> $modify $delete </td>"; + echo "</tr>"; + $subCategoriesObj = $publisher->getHandler('category')->getCategories(0, 0, $categoryObj->categoryid()); + if (count($subCategoriesObj) > 0) { + $level++; + foreach ($subCategoriesObj as $key => $thiscat) { + publisher_displayCategory($thiscat, $level); + } + } + unset($categoryObj); +} + +function publisher_editCat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null) +{ + $publisher = PublisherPublisher::getInstance(); + + // if there is a parameter, and the id exists, retrieve data: we're editing a category + if ($categoryid != 0) { + // Creating the category object for the selected category + $categoryObj = $publisher->getHandler('category')->get($categoryid); + if ($categoryObj->notLoaded()) { + redirect_header("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT); + exit(); + } + } else { + if (!$categoryObj) { + $categoryObj = $publisher->getHandler('category')->create(); + } + } + + if ($categoryid != 0) { + if ($showmenu) { + //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING); + } + echo "<br />\n"; + publisher_openCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO); + } else { + if ($showmenu) { + //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_CREATINGNEW); + } + publisher_openCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO); + } + + $sform = $categoryObj->getForm($nb_subcats); + $sform->display(); + + if (!$categoryid) { + publisher_closeCollapsableBar('createtable', 'createtableicon'); + } else { + publisher_closeCollapsableBar('edittable', 'edittableicon'); + } + + //Added by fx2024 + if ($categoryid) { + $sel_cat = $categoryid; + + publisher_openCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC); + // Get the total number of sub-categories + $categoriesObj = $publisher->getHandler('category')->get($sel_cat); + $totalsubs = $publisher->getHandler('category')->getCategoriesCount($sel_cat); + // creating the categories objects that are published + $subcatsObj = $publisher->getHandler('category')->getCategories(0, 0, $categoriesObj->categoryid()); + $totalSCOnPage = count($subcatsObj); + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; + echo "<tr>"; + echo "<td width='60' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATID . "</strong></td>"; + echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATCOLNAME . "</strong></td>"; + echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_SUBDESCRIPT . "</strong></td>"; + echo "<td width='60' class='bg3' align='right'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; + echo "</tr>"; + if ($totalsubs > 0) { + foreach ($subcatsObj as $subcat) { + $modify = "<a href='category.php?op=mod&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_MODIFY . "' alt='" . _AM_PUBLISHER_MODIFY . "' /></a>"; + $delete = "<a href='category.php?op=del&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETE . "' alt='" . _AM_PUBLISHER_DELETE . "' /></a>"; + echo "<tr>"; + echo "<td class='head' align='left'>" . $subcat->categoryid() . "</td>"; + echo "<td class='even' align='left'><a href='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/category.php?categoryid=" . $subcat->categoryid() . "&parentid=" . $subcat->parentid() . "'>" . $subcat->name() . "</a></td>"; + echo "<td class='even' align='left'>" . $subcat->description() . "</td>"; + echo "<td class='even' align='right'> {$modify} {$delete} </td>"; + echo "</tr>"; + } + } else { + echo "<tr>"; + echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOSUBCAT . "</td>"; + echo "</tr>"; + } + echo "</table>\n"; + echo "<br />\n"; + publisher_closeCollapsableBar('subcatstable', 'subcatsicon'); + + publisher_openCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC); + $startitem = PublisherRequest::getInt('startitem'); + // Get the total number of published ITEMS + $totalitems = $publisher->getHandler('item')->getItemsCount($sel_cat, array(_PUBLISHER_STATUS_PUBLISHED)); + // creating the items objects that are published + $itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $sel_cat); + $totalitemsOnPage = count($itemsObj); + $allcats = $publisher->getHandler('category')->getObjects(null, true); + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; + echo "<tr>"; + echo "<td width='40' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . "</strong></td>"; + echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCOLNAME . "</strong></td>"; + echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMDESC . "</strong></td>"; + echo "<td width='90' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . "</strong></td>"; + echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; + echo "</tr>"; + if ($totalitems > 0) { + for ($i = 0; $i < $totalitemsOnPage; $i++) { + $categoryObj =& $allcats[$itemsObj[$i]->categoryid()]; + $modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "' /></a>"; + $delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'/></a>"; + echo "<tr>"; + echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . "</td>"; + echo "<td class='even' align='left'>" . $categoryObj->name() . "</td>"; + echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . "</td>"; + echo "<td class='even' align='center'>" . $itemsObj[$i]->datesub('s') . "</td>"; + echo "<td class='even' align='center'> $modify $delete </td>"; + echo "</tr>"; + } + } else { + $itemid = -1; + echo "<tr>"; + echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . "</td>"; + echo "</tr>"; + } + echo "</table>\n"; + echo "<br />\n"; + $parentid = PublisherRequest::getInt('parentid'); + $pagenav_extra_args = "op=mod&categoryid=$sel_cat&parentid=$parentid"; + xoops_load('XoopsPageNav'); + $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenav_extra_args); + echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; + echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $sel_cat . "'\" value='" . _AM_PUBLISHER_CREATEITEM . "'> "; + echo "</div>"; + } + //end of fx2024 code +} \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/category.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsModules/publisher/trunk/publisher/admin/clone.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/clone.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/clone.php 2012-11-27 13:44:22 UTC (rev 10200) @@ -0,0 +1,167 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +include_once dirname(__FILE__) . "/admin_header.php"; + +publisher_cpHeader(); +//publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); +publisher_openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); + +if (@$_POST['op'] == 'submit') { + + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('clone.php', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); + exit(); + } + + $clone = $_POST['clone']; + + //check if name is valid + if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) { + redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_INVALIDNAME, $clone)); + exit(); + } + + // Check wether the cloned module exists or not + if ($clone && is_dir(XOOPS_ROOT_PATH . '/modules/' . $clone)) { + redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_EXISTS, $clone)); + } + + $patterns = array( + strtolower(PUBLISHER_DIRNAME) => strtolower($clone), + strtoupper(PUBLISHER_DIRNAME) => strtoupper($clone), + ucfirst(strtolower(PUBLISHER_DIRNAME)) => ucfirst(strtolower($clone)) + ); + + $patKeys = array_keys($patterns); + $patValues = array_values($patterns); + publisher_cloneFileFolder(PUBLISHER_ROOT_PATH); + $logocreated = publisher_createLogo(strtolower($clone)); + + $msg = ""; + if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($clone))) { + $msg .= sprintf(_AM_PUBLISHER_CLONE_CONGRAT, "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(strtolower($clone)) . "</a>") . "<br />\n"; + if (!$logocreated) { + $msg .= _AM_PUBLISHER_CLONE_IMAGEFAIL; + } + } else { + $msg .= _AM_PUBLISHER_CLONE_FAIL; + } + echo $msg; + +} else { + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true); + $clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, ''); + $clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC); + $form->addElement($clone, true); + $form->addElement(new XoopsFormHidden('op', 'submit')); + $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit')); + $form->display(); +} + +// End of collapsable bar +publisher_closeCollapsableBar('clone', 'cloneicon'); +xoops_cp_footer(); + +// work around for PHP < 5.0.x +if (!function_exists('file_put_contents')) { + function file_put_contents($filename, $data, $file_append = false) + { + if ($fp = fopen($filename, (!$file_append ? 'w+' : 'a+'))) { + fputs($fp, $data); + fclose($fp); + } + } +} + +// recursive clonning script +function publisher_cloneFileFolder($path) +{ + global $patKeys; + global $patValues; + + $newPath = str_replace($patKeys[0], $patValues[0], $path); + + if (is_dir($path)) { + // create new dir + mkdir($newPath); + + // check all files in dir, and process it + if ($handle = opendir($path)) { + while ($file = readdir($handle)) { + if ($file != '.' && $file != '..' && $file != '.svn') { + publisher_cloneFileFolder("{$path}/{$file}"); + } + } + closedir($handle); + } + } else { + + if (preg_match('/(.jpg|.gif|.png|.zip)$/i', $path)) { + // image + copy($path, $newPath); + } else { + // file, read it + $content = file_get_contents($path); + $content = str_replace($patKeys, $patValues, $content); + file_put_contents($newPath, $content); + } + } +} + +function publisher_createLogo($dirname) +{ + if (!extension_loaded("gd")) { + return false; + } else { + $required_functions = array("imagecreatetruecolor", "imagecolorallocate", "imagefilledrectangle", "imagejpeg", "imagedestroy", "imageftbbox"); + foreach ($required_functions as $func) { + if (!function_exists($func)) { + return false; + } + } + } + + if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png") || !file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/VeraBd.ttf")) { + return false; + } + + $imageModule = imagecreatefrompng($imageBase); + + //Erase old text + $grey_color = imagecolorallocate($imageModule, 237, 237, 237); + imagefilledrectangle($imageModule, 5, 35, 85, 46, $grey_color); + + // Write text + $text_color = imagecolorallocate($imageModule, 0, 0, 0); + $space_to_border = (80 - strlen($dirname) * 6.5) / 2; + imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($dirname), array()); + + // Set transparency color + $white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127); + imagefill($imageModule, 0, 0, $white); + imagecolortransparent($imageModule, $white); + imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png"); + imagedestroy($imageModule); + return true; +} + +?> \ No newline at end of file Property changes on: XoopsModules/publisher/trunk/publisher/admin/clone.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsModules/publisher/trunk/publisher/admin/file.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/file.php (rev 0) +++ XoopsModules/publisher/trunk/publisher/admin/file.php 2012-11-27 13:44:22 UTC (rev 10200) @@ -0,0 +1,163 @@ +<?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. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Publisher + * @since 1.0 + * @author trabis <lus...@gm...> + * @author The SmartFactory <www.smartfactory.ca> + * @version $Id$ + */ + +include_once dirname(__FILE__) . '/admin_header.php'; + +$op = PublisherRequest::getString('op'); + +function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) +{ + $publisher = PublisherPublisher::getInstance(); + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + + // if there is a parameter, and the id exists, retrieve data: we're editing a file + if ($fileid != 0) { + + // Creating the File object + $fileObj = $publisher->getHandler('file')->get($fileid); + + if ($fileObj->notLoaded()) { + redirect_header("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); + exit(); + } + + if ($showmenu) { + //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_EDITING); + } + + echo "<br />\n"; + echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_EDITING . "</span>"; + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_EDITING_DSC . "</span>"; + publisher_openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + } else { + // there's no parameter, so we're adding an item + $fileObj = $publisher->getHandler('file')->create(); + $fileObj->setVar('itemid', $itemid); + if ($showmenu) { + //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_FILE_ADD); + } + echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_ADDING . "</span>"; + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_ADDING_DSC . "</span>"; + publisher_openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + } + + // FILES UPLOAD FORM + $files_form = $fileObj->getForm(); + $files_form->display(); + + if ($fileid != 0) { + publisher_closeCollapsableBar('editfile', 'editfileicon'); + } else { + publisher_closeCollapsableBar('addfile', 'addfileicon'); + } + +} + +$false = false; +/* -- Available operations -- */ +switch ($op) { + case "uploadfile"; + publisher_uploadFile(false, true, $false); + exit; + break; + + case "uploadanother"; + publisher_uploadFile(true, true, $false); + exit; + break; + + case "mod": + $fileid = isset($_GET['fileid']) ? $_GET['fileid'] : 0; + $itemid = isset($_GET['itemid']) ? $_GET['itemid'] : 0; + if (($fileid == 0) && ($itemid == 0)) { + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_NOITEMSELECTED); + ... [truncated message content] |
From: <ma...@us...> - 2012-11-26 21:11:28
|
Revision: 10275 http://sourceforge.net/p/xoops/svn/10275 Author: mageg Date: 2012-11-26 21:11:26 +0000 (Mon, 26 Nov 2012) Log Message: ----------- fixed bug in search.php Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php 2012-11-26 21:10:22 UTC (rev 10274) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/search.php 2012-11-26 21:11:26 UTC (rev 10275) @@ -113,11 +113,10 @@ if ($andor != "OR" && $andor != "exact" && $andor != "AND") { $andor = "AND"; } - +$ignored_queries = array(); // holds kewords that are shorter than allowed minmum length $myts = MyTextSanitizer::getInstance(); if ($action != 'showallbyuser') { if ($andor != "exact") { - $ignored_queries = array(); // holds kewords that are shorter than allowed minmum length $temp_queries = preg_split('/[\s,]+/', $query); foreach ($temp_queries as $q) { $q = trim($q); |
From: <ma...@us...> - 2012-11-26 21:10:26
|
Revision: 10274 http://sourceforge.net/p/xoops/svn/10274 Author: mageg Date: 2012-11-26 21:10:22 +0000 (Mon, 26 Nov 2012) Log Message: ----------- add search in page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-11-25 20:56:32 UTC (rev 10273) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-11-26 21:10:22 UTC (rev 10274) @@ -67,6 +67,11 @@ // Menu $modversion['hasMain'] = 1; +// Search +$modversion['hasSearch'] = 1; +$modversion['search']['file'] = 'include/search.php'; +$modversion['search']['func'] = 'page_search'; + // Mysql file $modversion['sqlfile']['mysql'] = "sql/mysql.sql"; |