From: <chr...@us...> - 2018-06-23 03:14:35
|
Revision: 13367 http://sourceforge.net/p/xoops/svn/13367 Author: chronolabscoop Date: 2018-06-23 03:14:27 +0000 (Sat, 23 Jun 2018) Log Message: ----------- Periodical Backup Work in progress xoopsauth/authkey! Modified Paths: -------------- XoopsModules/authkey/trunk/modules/authkey/api/help.php XoopsModules/authkey/trunk/modules/authkey/api/index.php XoopsModules/authkey/trunk/modules/authkey/class/keys.php XoopsModules/authkey/trunk/modules/authkey/header.php XoopsModules/authkey/trunk/modules/authkey/include/functions.php XoopsModules/authkey/trunk/modules/authkey/index.php XoopsModules/authkey/trunk/modules/authkey/key.php XoopsModules/authkey/trunk/modules/authkey/language/english/main.php XoopsModules/authkey/trunk/modules/authkey/language/english/modinfo.php XoopsModules/authkey/trunk/modules/authkey/purchase.php XoopsModules/authkey/trunk/modules/authkey/xoops_version.php Added Paths: ----------- XoopsModules/authkey/trunk/modules/authkey/preloads/ XoopsModules/authkey/trunk/modules/authkey/preloads/auto.php XoopsModules/authkey/trunk/modules/authkey/preloads/index.html XoopsModules/authkey/trunk/modules/authkey/preloads/polling.php Modified: XoopsModules/authkey/trunk/modules/authkey/api/help.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/api/help.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/api/help.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -17,32 +17,17 @@ * @link https://sourceforge.net/p/xoops/svn/HEAD/tree/XoopsModules/authkey */ -global $authkeyModule, $op, $mode, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions, $groups; +global $authkeyModule, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions; -require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'header.php'; +require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'header.php'; $xoopsOption['template_main'] = 'authkeys_api_help.html'; -require_once dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'header.php'; +require_once dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'header.php'; $GLOBALS['xoopsTpl']->assign('authkeys_module_version', $authkeyModule->getVar('version')); $GLOBALS['xoopsTpl']->assign('authkeys_module_namings', $authkeyModule->getVar('name')); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/css/api-style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Labtop/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Labtop Bold/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Labtop Bold Italic/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Labtop Italic/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Labtop Superwide Boldish/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Labtop Thin/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Labtop Unicase/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/LHF Matthews Thin/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Life BT Bold/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Life BT Bold Italic/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Prestige Elite/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Prestige Elite Bold/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/media/Prestige Elite Normal/style.css'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/css/gradients.php'); -$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(dirname(__DIR__))) . '/assets/css/shadowing.php'); +$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(__DIR__)) . '/assets/css/api-style.css'); $GLOBALS['xoopsTpl']->assign('form_getkey', getHTMLForm('getkey')); $GLOBALS['xoopsTpl']->assign('form_htmlchars_getkey', htmlspecialchars(getHTMLForm('getkey'))); @@ -49,6 +34,6 @@ $GLOBALS['xoopsTpl']->assign('form_verify', getHTMLForm('verify')); $GLOBALS['xoopsTpl']->assign('form_htmlchars_verify', htmlspecialchars(getHTMLForm('verify'))); -require_once dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'footer.php'; +require_once dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'footer.php'; ?> Modified: XoopsModules/authkey/trunk/modules/authkey/api/index.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/api/index.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/api/index.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -103,13 +103,13 @@ } break; case "verify": - if (!strlen($inner['key'])) - $return = array('code' => 501, 'errors' => array(108 => 'Variable required to be passed the the xoopskey in the field element: "key" ~ field element not found!')); + if (!strlen($inner['xoopskey'])) + $return = array('code' => 501, 'errors' => array(108 => 'Variable required to be passed the the authkey/xoopskey in the field element: "xoopskey" ~ field element not found!')); if (empty($return)) { $keysHandler = xoops_getModuleHandler('keys', basename(dirname(__DIR__))); - if (!$token = XoopsCache::read("xoopskey_".md5($inner['key']))) + if (!$token = XoopsCache::read("xoopskey_".md5($inner['xoopskey']))) { - if (!$key = $keysHandler->getByXoopsKey($inner['key'])) + if (!$key = $keysHandler->getByXoopsKey($inner['xoopskey'])) $return = array('code' => 501, 'errors' => array(109 => 'Variable not found in database being passed as the xoopskey in the field element: "key" ~ field element data not found!')); if (is_object($key) && empty($return)) { @@ -222,11 +222,8 @@ XoopsCache::write("xoopskey_".md5(sha1($key->getVar('key'))), $data, 3600 * 24 * 7 * 4 * 36); } - if ($authkeyConfigsList['limited'] == true && $overlimit == true && authkeys_checkperm(_MI_AUTHKEY_PERM_UNLIMITEDCALLS, $key->getVar('id'), $key->getVar('uid')) == false) { - - $return = array('code'=>501, 'passed' => false, 'error' => array(110 => 'Over Limit of Calling Polls to API\'s')); - } - + if ($authkeyConfigsList['limited'] == true && $overlimit == true && !authkeys_checkperm(_MI_AUTHKEY_PERM_UNLIMITEDCALLS, $key->getVar('id'), $key->getVar('uid')) == false) + $return = array('code'=>501, 'passed' => false, 'errors' => array(110 => 'Over Limit of Calling Polls to API\'s')); } } break; Modified: XoopsModules/authkey/trunk/modules/authkey/class/keys.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/class/keys.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/class/keys.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -101,16 +101,29 @@ return false; } - function insert(AuthkeyKeys $object, $force = true, $notify = false) + function getUIDs() { + $sql = "SELECT DISTINCT `uid` FROM `" . $this->db->prefix('authkey_keys') . "` GROUP BY `uid`"; + $result = $this->db->queryF($sql); + $return = array(); + while($row = $this->db->fetchArray($result)) + { + $return[$row['uid']] = $row['uid']; + } + return $return; + } + + function insert(AuthkeyKeys $object, $force = true) + { if ($object->isNew()) { - if (authkeys_checkperm(_MI_AUTHKEY_PERM_STOPISSUINGKEY, $object->getVar('id'), $object->getVar('uid'))) + if (!authkeys_checkperm(_MI_AUTHKEY_PERM_STOPISSUINGKEY, false, $object->getVar('uid'))) return false; - if ($this->getCount(new Criteria('uid', $object->getVar('uid'))) > 0) - if (!authkeys_checkperm(_MI_AUTHKEY_PERM_ALLOWCREATING, $object->getVar('id'), $object->getVar('uid'))) + $criteria = new Criteria('uid', $object->getVar('uid')); + if ($this->getCount($criteria) >= 1) + if (!authkeys_checkperm(_MI_AUTHKEY_PERM_ALLOWCREATING, false, $object->getVar('uid'))) return false; $notify = true; @@ -152,7 +165,7 @@ xoops_load('XoopsMailer'); $object = $this->get($keyid); if ($object->getVar('uid') != 0) - $user = xoops_getHandler('users')->get($object->getVar('uid')); + $user = xoops_getHandler('member')->getUser($object->getVar('uid')); $mailer = new XoopsMailer($GLOBALS['xoopsConfig']['sitename'], $GLOBALS['xoopsConfig']['adminemail']); if (is_dir(dirname(__DIR__) . DS . 'language' . DS . $GLOBALS['xoopsConfig']['language'] . DS . 'mail_templates')) $mailer->setTemplateDir(dirname(__DIR__) . DS . 'language' . DS . $GLOBALS['xoopsConfig']['language'] . DS . 'mail_templates'); Modified: XoopsModules/authkey/trunk/modules/authkey/header.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/header.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/header.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -23,8 +23,6 @@ require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'mainfile.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'functions.php'; - $myts =& MyTextSanitizer::getInstance(); - if (empty($authkeyModule)) { if (is_a($authkeyModule = xoops_getHandler('module')->getByDirname(basename(__DIR__)), "XoopsModule")) Modified: XoopsModules/authkey/trunk/modules/authkey/include/functions.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/include/functions.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/include/functions.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -471,9 +471,9 @@ { $key = xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->get($keyid); if (is_object($key) && $key->getVar('uid') != 0) - $user = xoops_gethandler('users')->get($key->getVar('uid')); + $user = xoops_gethandler('member')->getUser($key->getVar('uid')); } elseif ($uid != 0) { - $user = xoops_gethandler('users')->get($uid); + $user = xoops_gethandler('member')->getUser($uid); } $groups = is_object($user) ? $user->getGroups() : (is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS)); Modified: XoopsModules/authkey/trunk/modules/authkey/index.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/index.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/index.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -17,133 +17,35 @@ * @link https://sourceforge.net/p/xoops/svn/HEAD/tree/XoopsModules/authkey */ +global $authkeyModule, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions; -include ('header.php'); +require_once __DIR__ . DIRECTORY_SEPARATOR . 'header.php'; -$xoopsOption['template_main'] = _XTR_TEMPLATE_INDEX; -include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_HEADER); +if (!is_object($GLOBALS['xoopsUser'])) +{ + redirect_header(XOOPS_URL . '/user.php', 8, _MN_AUTHKEY_LOGINREQUIRED); + exit(0); +} -$GLOBALS['xoopsTpl']->assign('passkey', xcenter_passkey()); -if ($GLOBALS['xoopsModuleConfig']['force_jquery']) $GLOBALS['xoTheme']->addScript(XOOPS_URL._XTR_PATH_JS_JQUERY); -if ($GLOBALS['xoopsModuleConfig']['json']) $GLOBALS['xoTheme']->addScript( XOOPS_URL._XTR_PATH_JS_CORE ); -$GLOBALS['xoTheme']->addStylesheet( XOOPS_URL._XTR_PATH_CSS_INDEX ); +$xoopsOption['template_main'] = 'authkeys_index.html'; +require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'header.php'; -$xcenter_handler =& xoops_getmodulehandler(_XTR_CLASS_XCENTER, _XTR_DIRNAME); +$criteria = new Criteria('uid', $GLOBALS['xoopsUser']->getVar('uid')); +$criteria->setSort('`title` ASC, `name` ASC, `company`'); +$criteria->setOrder('ASC'); -if (!empty($storyid)&&$xcenter_handler->getCount(new Criteria('storyid', $storyid))!=0) { - if ($xcenter = $xcenter_handler->getContent($storyid)) { +foreach(xoops_getModuleHandler('keys', basename(__DIR__))->getObjects($criteria) as $key) + $GLOBALS['xoopsTpl']->append('keys', $key->getValues(array_keys($key->vars))); - if (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_XCENTER,$xcenter['xcenter']->getVar('storyid'),$groups, $modid)) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - elseif ( !$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_CATEGORY,$xcenter['xcenter']->getVar('catid'),$groups, $modid) - && $GLOBALS['xoopsModuleConfig']['security'] != _XTR_SECURITY_BASIC ) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - else { - - if ($GLOBALS['xoopsModuleConfig']['htaccess']) - if (strpos($_SERVER['REQUEST_URI'], 'odules/')>0) { - $category_handler =& xoops_getmodulehandler(_XTR_CLASS_CATEGORY, _XTR_DIRNAME); - $category = $category_handler->getCategory($xcenter['xcenter']->getVar('catid')); - if ($category['text']->getVar('title')!='') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/'.xoops_sef($category['text']->getVar('title')).'/'.xoops_sef($xcenter['text']->getVar('ptitle')).'/'.$xcenter['xcenter']->getVar('storyid').','.$xcenter['xcenter']->getVar('catid').$GLOBALS['xoopsModuleConfig']['endofurl']); - } else { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/'.xoops_sef($xcenter['text']->getVar('ptitle')).'/'.$xcenter['xcenter']->getVar('storyid').','.$xcenter['xcenter']->getVar('catid').$GLOBALS['xoopsModuleConfig']['endofurl']); - } - exit(0); - } - - if ($xcenter['xcenter']->getVar('link')==1&&$xcenter['xcenter']->getVar('address')!='http://') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.$xcenter['xcenter']->getVar('address')); - exit(0); - } - - if ($xcenter['xcenter']->getVar('storyid')>0&&$xcenter['xcenter']->getVar('visible')==1) { - - if ($xcenter['xcenter']->getVar('publish')>time()&&$xcenter['xcenter']->getVar('publish')!=0) { - if ($xcenter['xcenter']->getVar('publish_storyid')>0) - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/?storyid='.$xcenter['xcenter']->getVar('publish_storyid'), 10, _XTR_TOBEPUBLISHED); - else - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/', 10, _XTR_TOBEPUBLISHED); - exit(0); - } elseif ($xcenter['xcenter']->getVar('expire')<time()&&$xcenter['xcenter']->getVar('expire')!=0) { - if ($xcenter['xcenter']->getVar('expire_storyid')>0) - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/?storyid='.$xcenter['xcenter']->getVar('expire_storyid'), 10, _XTR_XCENTEREXPIRED); - else - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/', 10, _XTR_XCENTEREXPIRED); - exit(0); - } elseif (strlen($xcenter['xcenter']->getVar('password'))==32) { - if (!isset($_COOKIE['xcenter_password'])) - $_COOKIE['xcenter_password'] = array(); - if ($_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]==false) - if (md5($_POST['password'])!=$xcenter['xcenter']->getVar('password')) { - $xoopsOption['template_main'] = _XTR_TEMPLATE_INDEX_PASSWORD; - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', xcenter_getPageTitle($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'keywords', xcenter_getMetaKeywords($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', xcenter_getMetaDescription($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoopsTpl']->assign('xoXcenter', array_merge($xcenter['xcenter']->toArray(), $xcenter['text']->toArray(), $xcenter['perms'])); - $GLOBALS['xoopsTpl']->assign('form', xcenter_passwordform($xcenter['xcenter']->getVar('storyid'))); - include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_FOOTER); - exit(0); - } else { - $_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]=true; - } - else - $_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]=true; - - - } - - $member_handler =& xoops_gethandler('member'); - $author = $member_handler->getUser($xcenter['xcenter']->getVar('uid')); - $GLOBALS['xoopsTpl']->assign('xoAuthor', $author->toArray()); - $GLOBALS['xoopsTpl']->assign('xoPubdate', date(_SHORTDATESTRING, $xcenter['xcenter']->getVar('date'))); - $GLOBALS['xoopsTpl']->assign('xoXcenter', array_merge($xcenter['xcenter']->toArray(), $xcenter['text']->toArray(), $xcenter['perms'])); - $GLOBALS['xoopsTpl']->assign('xoModule', $GLOBALS['xoopsModule']->toArray()); - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['xoopsModuleConfig']); - $GLOBALS['xoopsTpl']->assign('breadcrumb', xcenter_getBreadCrumb($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', xcenter_getPageTitle($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'keywords', xcenter_getMetaKeywords($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', xcenter_getMetaDescription($xcenter['xcenter']->getVar('storyid'))); - - $nohtml = ($xcenter['xcenter']->getVar('nohtml'))?0:1; - $nosmiley = ($xcenter['xcenter']->getVar('nosmiley'))?0:1; - $nobreaks = ($xcenter['xcenter']->getVar('nobreaks'))?0:1; - - $GLOBALS['xoopsTpl']->assign('catid', $xcenter['xcenter']->getVar('catid')); - $GLOBALS['xoopsTpl']->assign('xcenter_pagetitle', $xcenter['text']->getVar('ptitle')); - $GLOBALS['xoopsTpl']->assign('xcenter_text', $myts->displayTarea(clear_unicodeslashes($xcenter['text']->getVar('text')), $nohtml, $nosmiley, 1, 1, $nobreaks)); - - if (file_exists($GLOBALS['xoops']->path("/modules/tag/include/tagbar.php"))) { - include_once XOOPS_ROOT_PATH."/modules/tag/include/tagbar.php"; - $GLOBALS['xoopsTpl']->assign('tagbar', tagBar($xcenter['xcenter']->getVar('storyid'), $catid = 0)); - } - } else { - redirect_header(XOOPS_URL, 10, _XTR_NOTVISIBLE); - } - } - } -} else { - if ($xcenter = $xcenter_handler->getHompage()) { +$GLOBALS['xoopsTpl']->assign('authkeys_count', xoops_getModuleHandler('keys', basename(__DIR__))->getCount($criteria)); +$GLOBALS['xoopsTpl']->assign('authkeys_allow_creating', authkeys_checkperm(_MI_AUTHKEY_PERM_ALLOWCREATING, false, $GLOBALS['xoopsUser']->getVar('uid'))); +$GLOBALS['xoopsTpl']->assign('authkeys_allow_viewing', authkeys_checkperm(_MI_AUTHKEY_PERM_ALLOWVIEWING, false, $GLOBALS['xoopsUser']->getVar('uid'))); +$GLOBALS['xoopsTpl']->assign('authkeys_module_version', $authkeyModule->getVar('version')); +$GLOBALS['xoopsTpl']->assign('authkeys_module_namings', $authkeyModule->getVar('name')); - if (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_XCENTER,$xcenter['xcenter']->getVar('storyid'),$groups, $modid)) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - elseif (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_CATEGORY,$xcenter['xcenter']->getVar('catid'),$groups, $modid) - && $GLOBALS['xoopsModuleConfig']['security'] != _XTR_SECURITY_BASIC ) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - else { - - if ($xcenter['xcenter']->getVar('link')==1&&$xcenter['xcenter']->getVar('address')!='http://') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.$xcenter['xcenter']->getVar('address')); - exit(0); - } - - if ($xcenter['xcenter']->getVar('storyid')>0) { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/modules/xcenter/?storyid='.$xcenter['xcenter']->getVar('storyid')); - exit(0); - } - } - } -} -include $GLOBALS['xoops']->path('/include/comment_view.php'); -include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_FOOTER); -?> \ No newline at end of file +$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(__DIR__) . '/assets/css/style.css'); +if (is_file(XOOPS_ROOT_PATH . '/module/' . basename(__DIR__) . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/style.css')) + $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(__DIR__) . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/style.css'); +else + $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(__DIR__) . '/language/english/style.css'); + \ No newline at end of file Modified: XoopsModules/authkey/trunk/modules/authkey/key.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/key.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/key.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -1,149 +1,41 @@ -<?php -/** - * Authkey API Authentication Keys for xoops.org - * - * 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 (c) 2000-2019 Chronolabs Cooperative (8Bit.snails.email) - * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) - * @package authkey - * @since 1.0.7 - * @author Simon Antony Roberts <wis...@us...> - * @link https://sourceforge.net/p/xoops/svn/HEAD/tree/XoopsModules/authkey - */ - - -include ('header.php'); - -$xoopsOption['template_main'] = _XTR_TEMPLATE_INDEX; -include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_HEADER); - -$GLOBALS['xoopsTpl']->assign('passkey', xcenter_passkey()); -if ($GLOBALS['xoopsModuleConfig']['force_jquery']) $GLOBALS['xoTheme']->addScript(XOOPS_URL._XTR_PATH_JS_JQUERY); -if ($GLOBALS['xoopsModuleConfig']['json']) $GLOBALS['xoTheme']->addScript( XOOPS_URL._XTR_PATH_JS_CORE ); -$GLOBALS['xoTheme']->addStylesheet( XOOPS_URL._XTR_PATH_CSS_INDEX ); - -$xcenter_handler =& xoops_getmodulehandler(_XTR_CLASS_XCENTER, _XTR_DIRNAME); - -if (!empty($storyid)&&$xcenter_handler->getCount(new Criteria('storyid', $storyid))!=0) { - if ($xcenter = $xcenter_handler->getContent($storyid)) { - - if (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_XCENTER,$xcenter['xcenter']->getVar('storyid'),$groups, $modid)) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - elseif ( !$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_CATEGORY,$xcenter['xcenter']->getVar('catid'),$groups, $modid) - && $GLOBALS['xoopsModuleConfig']['security'] != _XTR_SECURITY_BASIC ) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - else { - - if ($GLOBALS['xoopsModuleConfig']['htaccess']) - if (strpos($_SERVER['REQUEST_URI'], 'odules/')>0) { - $category_handler =& xoops_getmodulehandler(_XTR_CLASS_CATEGORY, _XTR_DIRNAME); - $category = $category_handler->getCategory($xcenter['xcenter']->getVar('catid')); - if ($category['text']->getVar('title')!='') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/'.xoops_sef($category['text']->getVar('title')).'/'.xoops_sef($xcenter['text']->getVar('ptitle')).'/'.$xcenter['xcenter']->getVar('storyid').','.$xcenter['xcenter']->getVar('catid').$GLOBALS['xoopsModuleConfig']['endofurl']); - } else { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/'.xoops_sef($xcenter['text']->getVar('ptitle')).'/'.$xcenter['xcenter']->getVar('storyid').','.$xcenter['xcenter']->getVar('catid').$GLOBALS['xoopsModuleConfig']['endofurl']); - } - exit(0); - } - - if ($xcenter['xcenter']->getVar('link')==1&&$xcenter['xcenter']->getVar('address')!='http://') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.$xcenter['xcenter']->getVar('address')); - exit(0); - } - - if ($xcenter['xcenter']->getVar('storyid')>0&&$xcenter['xcenter']->getVar('visible')==1) { - - if ($xcenter['xcenter']->getVar('publish')>time()&&$xcenter['xcenter']->getVar('publish')!=0) { - if ($xcenter['xcenter']->getVar('publish_storyid')>0) - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/?storyid='.$xcenter['xcenter']->getVar('publish_storyid'), 10, _XTR_TOBEPUBLISHED); - else - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/', 10, _XTR_TOBEPUBLISHED); - exit(0); - } elseif ($xcenter['xcenter']->getVar('expire')<time()&&$xcenter['xcenter']->getVar('expire')!=0) { - if ($xcenter['xcenter']->getVar('expire_storyid')>0) - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/?storyid='.$xcenter['xcenter']->getVar('expire_storyid'), 10, _XTR_XCENTEREXPIRED); - else - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/', 10, _XTR_XCENTEREXPIRED); - exit(0); - } elseif (strlen($xcenter['xcenter']->getVar('password'))==32) { - if (!isset($_COOKIE['xcenter_password'])) - $_COOKIE['xcenter_password'] = array(); - if ($_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]==false) - if (md5($_POST['password'])!=$xcenter['xcenter']->getVar('password')) { - $xoopsOption['template_main'] = _XTR_TEMPLATE_INDEX_PASSWORD; - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', xcenter_getPageTitle($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'keywords', xcenter_getMetaKeywords($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', xcenter_getMetaDescription($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoopsTpl']->assign('xoXcenter', array_merge($xcenter['xcenter']->toArray(), $xcenter['text']->toArray(), $xcenter['perms'])); - $GLOBALS['xoopsTpl']->assign('form', xcenter_passwordform($xcenter['xcenter']->getVar('storyid'))); - include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_FOOTER); - exit(0); - } else { - $_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]=true; - } - else - $_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]=true; - - - } - - $member_handler =& xoops_gethandler('member'); - $author = $member_handler->getUser($xcenter['xcenter']->getVar('uid')); - $GLOBALS['xoopsTpl']->assign('xoAuthor', $author->toArray()); - $GLOBALS['xoopsTpl']->assign('xoPubdate', date(_SHORTDATESTRING, $xcenter['xcenter']->getVar('date'))); - $GLOBALS['xoopsTpl']->assign('xoXcenter', array_merge($xcenter['xcenter']->toArray(), $xcenter['text']->toArray(), $xcenter['perms'])); - $GLOBALS['xoopsTpl']->assign('xoModule', $GLOBALS['xoopsModule']->toArray()); - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['xoopsModuleConfig']); - $GLOBALS['xoopsTpl']->assign('breadcrumb', xcenter_getBreadCrumb($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', xcenter_getPageTitle($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'keywords', xcenter_getMetaKeywords($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', xcenter_getMetaDescription($xcenter['xcenter']->getVar('storyid'))); - - $nohtml = ($xcenter['xcenter']->getVar('nohtml'))?0:1; - $nosmiley = ($xcenter['xcenter']->getVar('nosmiley'))?0:1; - $nobreaks = ($xcenter['xcenter']->getVar('nobreaks'))?0:1; - - $GLOBALS['xoopsTpl']->assign('catid', $xcenter['xcenter']->getVar('catid')); - $GLOBALS['xoopsTpl']->assign('xcenter_pagetitle', $xcenter['text']->getVar('ptitle')); - $GLOBALS['xoopsTpl']->assign('xcenter_text', $myts->displayTarea(clear_unicodeslashes($xcenter['text']->getVar('text')), $nohtml, $nosmiley, 1, 1, $nobreaks)); - - if (file_exists($GLOBALS['xoops']->path("/modules/tag/include/tagbar.php"))) { - include_once XOOPS_ROOT_PATH."/modules/tag/include/tagbar.php"; - $GLOBALS['xoopsTpl']->assign('tagbar', tagBar($xcenter['xcenter']->getVar('storyid'), $catid = 0)); - } - } else { - redirect_header(XOOPS_URL, 10, _XTR_NOTVISIBLE); - } - } - } -} else { - if ($xcenter = $xcenter_handler->getHompage()) { - - if (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_XCENTER,$xcenter['xcenter']->getVar('storyid'),$groups, $modid)) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - elseif (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_CATEGORY,$xcenter['xcenter']->getVar('catid'),$groups, $modid) - && $GLOBALS['xoopsModuleConfig']['security'] != _XTR_SECURITY_BASIC ) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - else { - - if ($xcenter['xcenter']->getVar('link')==1&&$xcenter['xcenter']->getVar('address')!='http://') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.$xcenter['xcenter']->getVar('address')); - exit(0); - } - - if ($xcenter['xcenter']->getVar('storyid')>0) { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/modules/xcenter/?storyid='.$xcenter['xcenter']->getVar('storyid')); - exit(0); - } - } - } -} -include $GLOBALS['xoops']->path('/include/comment_view.php'); -include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_FOOTER); -?> \ No newline at end of file +<?php +/** + * Authkey API Authentication Keys for xoops.org + * + * 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 (c) 2000-2019 Chronolabs Cooperative (8Bit.snails.email) + * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) + * @package authkey + * @since 1.0.7 + * @author Simon Antony Roberts <wis...@us...> + * @link https://sourceforge.net/p/xoops/svn/HEAD/tree/XoopsModules/authkey + */ + +global $authkeyModule, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions; + +require_once __DIR__ . DIRECTORY_SEPARATOR . 'header.php'; + +if (!is_object($GLOBALS['xoopsUser'])) +{ + redirect_header(XOOPS_URL . '/user.php', 8, _MN_AUTHKEY_LOGINREQUIRED); + exit(0); +} + +$xoopsOption['template_main'] = 'authkeys_key.html'; +require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'header.php'; + +$GLOBALS['xoopsTpl']->assign('authkeys_module_version', $authkeyModule->getVar('version')); +$GLOBALS['xoopsTpl']->assign('authkeys_module_namings', $authkeyModule->getVar('name')); + +$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(__DIR__)) . '/assets/css/api-style.css'); +if (is_file(XOOPS_ROOT_PATH . '/module/' . basename(dirname(__DIR__)) . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/style.css')) + $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(__DIR__)) . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/style.css'); +else + $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(__DIR__)) . '/language/english/style.css'); + \ No newline at end of file Modified: XoopsModules/authkey/trunk/modules/authkey/language/english/main.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/language/english/main.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/language/english/main.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -18,5 +18,6 @@ */ - +define('_MN_AUTHKEY_LOGINREQUIRED', 'User login is required to use this part of the module!'); + ?> \ No newline at end of file Modified: XoopsModules/authkey/trunk/modules/authkey/language/english/modinfo.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/language/english/modinfo.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/language/english/modinfo.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -24,6 +24,9 @@ define('_MI_AUTHKEY_SUBJECT_ISSUINGKEY','Xoops.org ~ Issuing API Key: /?xoopskey=%s'); define('_MI_AUTHKEY_SUBJECT_LIMITREACHED','Xoops.org ~ %s Limit of API\'s Polling Reached over by: %s'); + //Title Template + define('_MI_AUTHKEY_KEY_TITLE', 'XoopsKey for: %s'); + // Periodically Based Constants define('_MI_AUTHKEY_PERIODICALLY_HOUR', 'Hourly'); define('_MI_AUTHKEY_PERIODICALLY_DAY', 'Daily'); Added: XoopsModules/authkey/trunk/modules/authkey/preloads/auto.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/preloads/auto.php (rev 0) +++ XoopsModules/authkey/trunk/modules/authkey/preloads/auto.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -0,0 +1,95 @@ +<?php +/** + * Authkey API Authentication Keys for xoops.org + * + * 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 (c) 2000-2019 Chronolabs Cooperative (8Bit.snails.email) + * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) + * @package authkey + * @since 1.0.7 + * @author Simon Antony Roberts <wis...@us...> + * @link https://sourceforge.net/p/xoops/svn/HEAD/tree/XoopsModules/authkey + */ + + + + +/** + * Profile core preloads + * + * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) + * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) + * @author trabis <lus...@gm...> + */ +class AuthkeyAutoPreload extends XoopsPreloadItem +{ + + /** + * @param $args + */ + public static function eventCoreIncludeCommonEnd($args) + { + xoops_loadLanguage('modinfo', basename(dirname(__DIR__))); + + global $authkeyModule, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions; + require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'header.php'; + + if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['authkeyConfigsList']['auto-generate'] == true) + { + $criteria = new Criteria('uid', $GLOBALS['xoopsUser']->getVar('uid')); + if (authkeys_checkperm(_MI_AUTHKEY_PERM_STOPISSUINGKEY, false, $GLOBALS['xoopsUser']->getVar('uid')) && xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->getCount($criteria) == 0) + { + $key = xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->create(); + $key->setVar('email', $GLOBALS['xoopsUser']->getVar('email')); + $key->setVar('title', sprintf(_MI_AUTHKEY_KEY_TITLE, $GLOBALS['xoopsUser']->getVar('uname'))); + $key->setVar('name', (strlen($GLOBALS['xoopsUser']->getVar('name'))==0?$GLOBALS['xoopsUser']->getVar('uname'):$GLOBALS['xoopsUser']->getVar('name'))); + $key->setVar('company', $GLOBALS['xoopsConfig']['sitename']); + $key->setVar('url', (strlen($GLOBALS['xoopsUser']->getVar('url'))==0?XOOPS_URL:$GLOBALS['xoopsUser']->getVar('url'))); + $key->setVar('key', authkey_getAuthKey()); + $key->setVar('uid', $GLOBALS['xoopsUser']->getVar('uid')); + xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->insert($key, true); + } + } + } + + + /** + * @param $args + */ + public static function eventCoreFooterEnd($args) + { + xoops_loadLanguage('modinfo', basename(dirname(__DIR__))); + + global $authkeyModule, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions; + require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'header.php'; + + xoops_load('XoopsCache'); + if (!$rrt = XoopsCache::read('auto-generate') && $GLOBALS['authkeyConfigsList']['auto-generate'] == true) + { + $criteria = new CriteriaCompo(new Criteria('uid', '(' . implode(', ', xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->getUIDs()) . ')', 'NOT IN')); + $criteria->add(new Criteria('level', '1', '>=')); + $criteria->setLimit($GLOBALS['authkeyConfigsList']['number-auto-generated']); + $criteria->setOrder("RAND()"); + foreach(xoops_getHandler('users')->getObjects($criteria, true) as $user) + if (authkeys_checkperm(_MI_AUTHKEY_PERM_STOPISSUINGKEY, false, $user->getVar('uid'))) + { + $key = xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->create(); + $key->setVar('email', $user->getVar('email')); + $key->setVar('title', sprintf(_MI_AUTHKEY_KEY_TITLE, $user->getVar('uname'))); + $key->setVar('name', (strlen($user->getVar('name'))==0?$user->getVar('uname'):$user->getVar('name'))); + $key->setVar('company', $GLOBALS['xoopsConfig']['sitename']); + $key->setVar('url', (strlen($user->getVar('url'))==0?XOOPS_URL:$user->getVar('url'))); + $key->setVar('key', authkey_getAuthKey()); + $key->setVar('uid', $user->getVar('uid')); + xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->insert($key, true); + } + XoopsCache::write('auto-generate', array("time"=>time()), $GLOBALS['authkeyConfigsList']['auto-generate-seconds']); + } + } +} Property changes on: XoopsModules/authkey/trunk/modules/authkey/preloads/auto.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/authkey/trunk/modules/authkey/preloads/index.html =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/preloads/index.html (rev 0) +++ XoopsModules/authkey/trunk/modules/authkey/preloads/index.html 2018-06-23 03:14:27 UTC (rev 13367) @@ -0,0 +1 @@ +<script>history.go(-1);</script> Property changes on: XoopsModules/authkey/trunk/modules/authkey/preloads/index.html ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: XoopsModules/authkey/trunk/modules/authkey/preloads/polling.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/preloads/polling.php (rev 0) +++ XoopsModules/authkey/trunk/modules/authkey/preloads/polling.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -0,0 +1,120 @@ +<?php +/** + * Authkey API Authentication Keys for xoops.org + * + * 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 (c) 2000-2019 Chronolabs Cooperative (8Bit.snails.email) + * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) + * @package authkey + * @since 1.0.7 + * @author Simon Antony Roberts <wis...@us...> + * @link https://sourceforge.net/p/xoops/svn/HEAD/tree/XoopsModules/authkey + */ + + + + +/** + * Profile core preloads + * + * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) + * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) + * @author trabis <lus...@gm...> + */ +class AuthkeyPollingPreload extends XoopsPreloadItem +{ + + /** + * @param $args + */ + public static function eventCoreIncludeCommonEnd($args) + { + xoops_loadLanguage('modinfo', basename(dirname(__DIR__))); + xoops_load('XoopsCache'); + + global $authkeyModule, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions; + require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'header.php'; + + if (!$rtt = XoopsCache::read('authkey_polling')) + { + $criteria = new CriteriaCompo(new Criteria('`stats-hour`', time(), "<="), 'OR'); + $criteria->add(new Criteria('`stats-day`', time(), "<="), 'OR'); + $criteria->add(new Criteria('`stats-week`', time(), "<="), 'OR'); + $criteria->add(new Criteria('`stats-month`', time(), "<="), 'OR'); + $criteria->add(new Criteria('`stats-quarter`', time(), "<="), 'OR'); + $criteria->add(new Criteria('`stats-year`', time(), "<="), 'OR'); + foreach(xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->getObjects($criteria) as $key) + { + if ($key->getVar('stats-hour') <= time()) + $key->setVar('stats-hour', time() + (3600)); + if ($key->getVar('stats-day') <= time()) + $key->setVar('stats-day', time() + (3600 * 24)); + if ($key->getVar('stats-week') <= time()) + $key->setVar('stats-week', time() + (3600 * 24 * 7)); + if ($key->getVar('stats-month') <= time()) + $key->setVar('stats-month', time() + (3600 * 24 * 7 * 4)); + if ($key->getVar('stats-quarter') <= time()) + $key->setVar('stats-quarter', time() + (3600 * 24 * 7 * 4 * 3)); + if ($key->getVar('stats-year') <= time()) + $key->setVar('stats-year', time() + (3600 * 24 * 7 * 4 * 12)); + + foreach(array(md5($key->getVar('key')), md5(md5($key->getVar('key'))), md5(sha1($key->getVar('key')))) as $keyy) { + if ($token = XoopsCache::read("xoopskey_".$keyy)) { + $key->setVar('calls-hour', $key->getVar('calls-hour') + $token['polling']); + $key->setVar('calls-day', $key->getVar('calls-day') + $token['polling']); + $key->setVar('calls-week', $key->getVar('calls-week') + $token['polling']); + $key->setVar('calls-month', $key->getVar('calls-month') + $token['polling']); + $key->setVar('calls-quarter', $key->getVar('calls-quarter') + $token['polling']); + $key->setVar('calls-year', $key->getVar('calls-year') + $token['polling']); + $token['polling'] = 0; + + $overlimit = false; + if ($authkeyConfigsList['limited']==true) + { + if ($key->getVar('limit-hour') < $key->getVar('calls-hour')) + { + $overlimit = true; + $key->setVar('overs-hour', $key->getVar('calls-hour') - $key->getVar('limit-hour')); + } + if ($key->getVar('limit-day') < $key->getVar('calls-day')) + { + $overlimit = true; + $key->setVar('overs-day', $key->getVar('calls-day') - $key->getVar('limit-day')); + } + if ($key->getVar('limit-week') < $key->getVar('calls-week')) + { + $overlimit = true; + $key->setVar('overs-week', $key->getVar('calls-week') - $key->getVar('limit-week')); + } + if ($key->getVar('limit-month') < $key->getVar('calls-month')) + { + $overlimit = true; + $key->setVar('overs-month', $key->getVar('calls-month') - $key->getVar('limit-month')); + } + if ($key->getVar('limit-quarter') < $key->getVar('calls-quarter')) + { + $overlimit = true; + $key->setVar('overs-quarter', $key->getVar('calls-quarter') - $key->getVar('limit-quarter')); + } + if ($key->getVar('limit-year') < $key->getVar('calls-year')) + { + $overlimit = true; + $key->setVar('overs-year', $key->getVar('calls-year') - $key->getVar('limit-year')); + } + } + + XoopsCache::write("xoopskey_".$keyy, $token, 3600 * 24 * 7 * 4 * 36); + } + } + @xoops_getModuleHandler('keys', basename(dirname(__DIR__)))->insert($key, true); + } + } + XoopsCache::write('authkey_polling', array('time'=>time()), $authkeyConfigsList['preload-seconds']); + } +} Property changes on: XoopsModules/authkey/trunk/modules/authkey/preloads/polling.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: XoopsModules/authkey/trunk/modules/authkey/purchase.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/purchase.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/purchase.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -17,133 +17,19 @@ * @link https://sourceforge.net/p/xoops/svn/HEAD/tree/XoopsModules/authkey */ +global $authkeyModule, $authkeyConfigsList, $authkeyConfigs, $authkeyConfigsOptions; -include ('header.php'); +require_once __DIR__ . DIRECTORY_SEPARATOR . 'header.php'; -$xoopsOption['template_main'] = _XTR_TEMPLATE_INDEX; -include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_HEADER); +$xoopsOption['template_main'] = 'authkeys_key.html'; +require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'header.php'; -$GLOBALS['xoopsTpl']->assign('passkey', xcenter_passkey()); -if ($GLOBALS['xoopsModuleConfig']['force_jquery']) $GLOBALS['xoTheme']->addScript(XOOPS_URL._XTR_PATH_JS_JQUERY); -if ($GLOBALS['xoopsModuleConfig']['json']) $GLOBALS['xoTheme']->addScript( XOOPS_URL._XTR_PATH_JS_CORE ); -$GLOBALS['xoTheme']->addStylesheet( XOOPS_URL._XTR_PATH_CSS_INDEX ); +$GLOBALS['xoopsTpl']->assign('authkeys_module_version', $authkeyModule->getVar('version')); +$GLOBALS['xoopsTpl']->assign('authkeys_module_namings', $authkeyModule->getVar('name')); -$xcenter_handler =& xoops_getmodulehandler(_XTR_CLASS_XCENTER, _XTR_DIRNAME); - -if (!empty($storyid)&&$xcenter_handler->getCount(new Criteria('storyid', $storyid))!=0) { - if ($xcenter = $xcenter_handler->getContent($storyid)) { - - if (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_XCENTER,$xcenter['xcenter']->getVar('storyid'),$groups, $modid)) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - elseif ( !$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_CATEGORY,$xcenter['xcenter']->getVar('catid'),$groups, $modid) - && $GLOBALS['xoopsModuleConfig']['security'] != _XTR_SECURITY_BASIC ) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - else { - - if ($GLOBALS['xoopsModuleConfig']['htaccess']) - if (strpos($_SERVER['REQUEST_URI'], 'odules/')>0) { - $category_handler =& xoops_getmodulehandler(_XTR_CLASS_CATEGORY, _XTR_DIRNAME); - $category = $category_handler->getCategory($xcenter['xcenter']->getVar('catid')); - if ($category['text']->getVar('title')!='') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/'.xoops_sef($category['text']->getVar('title')).'/'.xoops_sef($xcenter['text']->getVar('ptitle')).'/'.$xcenter['xcenter']->getVar('storyid').','.$xcenter['xcenter']->getVar('catid').$GLOBALS['xoopsModuleConfig']['endofurl']); - } else { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/'.xoops_sef($xcenter['text']->getVar('ptitle')).'/'.$xcenter['xcenter']->getVar('storyid').','.$xcenter['xcenter']->getVar('catid').$GLOBALS['xoopsModuleConfig']['endofurl']); - } - exit(0); - } - - if ($xcenter['xcenter']->getVar('link')==1&&$xcenter['xcenter']->getVar('address')!='http://') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.$xcenter['xcenter']->getVar('address')); - exit(0); - } - - if ($xcenter['xcenter']->getVar('storyid')>0&&$xcenter['xcenter']->getVar('visible')==1) { - - if ($xcenter['xcenter']->getVar('publish')>time()&&$xcenter['xcenter']->getVar('publish')!=0) { - if ($xcenter['xcenter']->getVar('publish_storyid')>0) - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/?storyid='.$xcenter['xcenter']->getVar('publish_storyid'), 10, _XTR_TOBEPUBLISHED); - else - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/', 10, _XTR_TOBEPUBLISHED); - exit(0); - } elseif ($xcenter['xcenter']->getVar('expire')<time()&&$xcenter['xcenter']->getVar('expire')!=0) { - if ($xcenter['xcenter']->getVar('expire_storyid')>0) - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/?storyid='.$xcenter['xcenter']->getVar('expire_storyid'), 10, _XTR_XCENTEREXPIRED); - else - redirect_header(XOOPS_URL.'/modules/'._XTR_DIRNAME.'/', 10, _XTR_XCENTEREXPIRED); - exit(0); - } elseif (strlen($xcenter['xcenter']->getVar('password'))==32) { - if (!isset($_COOKIE['xcenter_password'])) - $_COOKIE['xcenter_password'] = array(); - if ($_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]==false) - if (md5($_POST['password'])!=$xcenter['xcenter']->getVar('password')) { - $xoopsOption['template_main'] = _XTR_TEMPLATE_INDEX_PASSWORD; - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', xcenter_getPageTitle($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'keywords', xcenter_getMetaKeywords($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', xcenter_getMetaDescription($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoopsTpl']->assign('xoXcenter', array_merge($xcenter['xcenter']->toArray(), $xcenter['text']->toArray(), $xcenter['perms'])); - $GLOBALS['xoopsTpl']->assign('form', xcenter_passwordform($xcenter['xcenter']->getVar('storyid'))); - include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_FOOTER); - exit(0); - } else { - $_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]=true; - } - else - $_COOKIE['xcenter_password'][md5(sha1(XOOPS_LICENSE_KEY).$storyid)]=true; - - - } - - $member_handler =& xoops_gethandler('member'); - $author = $member_handler->getUser($xcenter['xcenter']->getVar('uid')); - $GLOBALS['xoopsTpl']->assign('xoAuthor', $author->toArray()); - $GLOBALS['xoopsTpl']->assign('xoPubdate', date(_SHORTDATESTRING, $xcenter['xcenter']->getVar('date'))); - $GLOBALS['xoopsTpl']->assign('xoXcenter', array_merge($xcenter['xcenter']->toArray(), $xcenter['text']->toArray(), $xcenter['perms'])); - $GLOBALS['xoopsTpl']->assign('xoModule', $GLOBALS['xoopsModule']->toArray()); - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['xoopsModuleConfig']); - $GLOBALS['xoopsTpl']->assign('breadcrumb', xcenter_getBreadCrumb($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', xcenter_getPageTitle($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'keywords', xcenter_getMetaKeywords($xcenter['xcenter']->getVar('storyid'))); - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', xcenter_getMetaDescription($xcenter['xcenter']->getVar('storyid'))); - - $nohtml = ($xcenter['xcenter']->getVar('nohtml'))?0:1; - $nosmiley = ($xcenter['xcenter']->getVar('nosmiley'))?0:1; - $nobreaks = ($xcenter['xcenter']->getVar('nobreaks'))?0:1; - - $GLOBALS['xoopsTpl']->assign('catid', $xcenter['xcenter']->getVar('catid')); - $GLOBALS['xoopsTpl']->assign('xcenter_pagetitle', $xcenter['text']->getVar('ptitle')); - $GLOBALS['xoopsTpl']->assign('xcenter_text', $myts->displayTarea(clear_unicodeslashes($xcenter['text']->getVar('text')), $nohtml, $nosmiley, 1, 1, $nobreaks)); - - if (file_exists($GLOBALS['xoops']->path("/modules/tag/include/tagbar.php"))) { - include_once XOOPS_ROOT_PATH."/modules/tag/include/tagbar.php"; - $GLOBALS['xoopsTpl']->assign('tagbar', tagBar($xcenter['xcenter']->getVar('storyid'), $catid = 0)); - } - } else { - redirect_header(XOOPS_URL, 10, _XTR_NOTVISIBLE); - } - } - } -} else { - if ($xcenter = $xcenter_handler->getHompage()) { - - if (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_XCENTER,$xcenter['xcenter']->getVar('storyid'),$groups, $modid)) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - elseif (!$gperm_handler->checkRight(_XTR_PERM_MODE_VIEW._XTR_PERM_TYPE_CATEGORY,$xcenter['xcenter']->getVar('catid'),$groups, $modid) - && $GLOBALS['xoopsModuleConfig']['security'] != _XTR_SECURITY_BASIC ) - redirect_header(XOOPS_URL, 10, _XTR_NOPERMISSIONS); - else { - - if ($xcenter['xcenter']->getVar('link')==1&&$xcenter['xcenter']->getVar('address')!='http://') { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.$xcenter['xcenter']->getVar('address')); - exit(0); - } - - if ($xcenter['xcenter']->getVar('storyid')>0) { - header( "HTTP/1.1 301 Moved Permanently" ); header('Location: '.XOOPS_URL.'/modules/xcenter/?storyid='.$xcenter['xcenter']->getVar('storyid')); - exit(0); - } - } - } -} -include $GLOBALS['xoops']->path('/include/comment_view.php'); -include_once $GLOBALS['xoops']->path(_XTR_PATH_PHP_FOOTER); -?> \ No newline at end of file +$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(__DIR__)) . '/assets/css/api-style.css'); +if (is_file(XOOPS_ROOT_PATH . '/module/' . basename(dirname(__DIR__)) . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/style.css')) + $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(__DIR__)) . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/style.css'); + else + $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/module/' . basename(dirname(__DIR__)) . '/language/english/style.css'); + \ No newline at end of file Modified: XoopsModules/authkey/trunk/modules/authkey/xoops_version.php =================================================================== --- XoopsModules/authkey/trunk/modules/authkey/xoops_version.php 2018-06-22 23:10:43 UTC (rev 13366) +++ XoopsModules/authkey/trunk/modules/authkey/xoops_version.php 2018-06-23 03:14:27 UTC (rev 13367) @@ -93,8 +93,8 @@ // Submenu Items $keys_handler =& xoops_getmodulehandler('keys', 'authkey'); $criteria = new CriteriaCompo(new Criteria('uid', $GLOBALS['xoopsUser']->getVar('uid'))); - $criteria->setOrder('created'); - $criteria->setSort('ASC'); + $criteria->setOrder('ASC'); + $criteria->setSort('`title`'); $keys = $keys_handler->getObjects($criteria, true); foreach($keys as $key) { $modversion['sub'][$i]['name'] = $key->getVar('title'); |