function show(&$environment, $option) { $dirName = $environment->getDirName(); static $id = 0; if (defined('MYGMAP_GMAPI_INCLUDED')) { $block['gmapi_include'] = 0; } else { $block['gmapi_include'] = 1; define('MYGMAP_GMAPI_INCLUDED', 1); } $markerHandler =& NBFrame::getHandler('MyGmapMarker', $environment); $markerObject =& $markerHandler->get($option[0]); if ($markerObject) { $configHandler =& NBFrame::getHandler('NBFrame.xoops.Config', NBFrame::null()); $block['mygmap_API'] = $configHandler->getModuleConfig($dirName, 'mygmap_api'); $block['dirname'] = $dirName; $block['divid'] = 'mygmap_mini_' . $id; $id++; $block['id'] = $markerObject->getVar('mygmap_marker_id'); $block['category_id'] = $markerObject->getVar('mygmap_marker_category_id'); $block['title'] = $markerObject->getVar('mygmap_marker_title'); $block['lat'] = $markerObject->getVar('mygmap_marker_lat'); $block['lng'] = $markerObject->getVar('mygmap_marker_lng'); $block['zoom'] = $markerObject->getVar('mygmap_marker_zoom'); $block['maptype'] = $markerObject->getVar('mygmap_marker_maptype'); return $block; } else { return null; } }
function &buildEditForm(&$object) { $parentCategoryHandler =& NBFrame::getHandler('SimpleLinkCategory', $this->mEnvironment); $this->addOptionArray('category_parent_id', $parentCategoryHandler->getParentSelectOptionArray($object->getKey())); $form =& parent::buildEditForm($object); return $form; }
function getRSS(&$items) { $linkHandler =& NBFrame::getHandler('SimpleLinkLink', $this->mEnvironment); $linkObjects =& $linkHandler->getObjects(); foreach ($linkObjects as $linkObject) { $item = array('title' => $linkObject->getVar('link_name'), 'link' => $this->mEnvironment->getUrlBase(), 'guid' => $this->mEnvironment->getUrlBase(), 'pubdate' => 0); $items[] = $item; } }
function prepare() { $this->categoryHandler =& NBFrame::getHandler('SimpleLinkCategory', $this->mEnvironment); $this->addElement('link_id', '#', 20, array('sort' => true)); $this->addElement('link_name', $this->__l('link_name'), 200, array('sort' => true)); $this->addElement('link_category_id', $this->__l('link_category_id'), 150, array('sort' => true)); $this->addElement('link_weight', $this->__l('link_weight'), 150, array('sort' => true)); $this->addElement('__SimpleEditLink__', '', 50, array('caption' => $this->__l('Edit'))); $this->addElement('__SimpleDeleteLink__', '', 50, array('caption' => $this->__l('Delete'))); }
function prepare() { $this->categoryHandler =& NBFrame::getHandler('MyGmapCategory', $this->mEnvironment); $this->addElement('mygmap_marker_id', '#', 20, array('sort' => true)); $this->addElement('mygmap_marker_category_id', $this->__l('mygmap_marker_category_id'), 150, array('sort' => true)); $this->addElement('mygmap_marker_title', $this->__l('mygmap_marker_title'), 300); $this->addElement('mygmap_marker_icontext', $this->__l('mygmap_marker_icontext'), 50, array('sort' => true)); $this->addElement('mygmap_marker_maptype', $this->__l('mygmap_marker_maptype'), 80, array('sort' => true)); $this->addElement('__SimpleEditLink__', '', 50, array('caption' => $this->__l('Edit'))); $this->addElement('__SimpleDeleteLink__', '', 50, array('caption' => $this->__l('Delete'))); }
function prepare() { $this->addElement('mygmap_marker_category_id', new XoopsFormSelect($this->__l('mygmap_marker_category_id'), 'mygmap_marker_category_id')); $this->addElement('mygmap_marker_icontext', new XoopsFormSelect($this->__l('mygmap_marker_icontext'), 'mygmap_marker_icontext')); $this->addElement('mygmap_marker_zoom', new XoopsFormSelect($this->__l('mygmap_marker_zoom'), 'mygmap_marker_zoom')); $this->addElement('mygmap_marker_maptype', new XoopsFormSelect($this->__l('mygmap_marker_maptype'), 'mygmap_marker_maptype')); $this->addObjectOptionArray('mygmap_marker_category_id', 'MyGmapCategory'); $markerHandler =& NBFrame::getHandler('MyGmapMarker', $this->mEnvironment); $this->addOptionArray('mygmap_marker_icontext', $markerHandler->getIconListArray()); $this->addOptionArray('mygmap_marker_zoom', array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23', '24' => '24')); $this->addOptionArray('mygmap_marker_maptype', array('0' => '----', '1' => $this->__l('Maptype Map'), '2' => $this->__l('Maptype Satelite'), '3' => $this->__l('Maptype Hybrid'))); }
function checkGroupPerm($mode, $bypassAdminCheck = false) { $categoryHandler =& NBFrame::getHandler('MyGmapCategory', $this->mHandler->mEnvironment); if ($categoryObject =& $categoryHandler->get($this->getVar('mygmap_marker_category_id'))) { if ($categoryObject->checkGroupPerm($mode, $bypassAdminCheck)) { return true; } $this->setErrors('Category Permission Error'); return false; } return true; }
function insert(&$record, $force = false, $updateOnlyChanged = false) { if ($result = parent::insert($record, $force, $updateOnlyChanged)) { $id = $record->get('tpl_id'); $tplSourceHandler =& NBFrame::getHandler('NBFrame.xoops.TplSource', $this->mEnvironment); if (!($tplSourceObject =& $tplSourceHandler->get($id))) { $tplSourceObject =& $tplSourceHandler->create(); $tplSourceObject->set('tpl_id', $id); } $tplSourceObject->set('tpl_source', $record->get('tpl_source')); $result = $tplSourceHandler->insert($tplSourceObject, $force); } return $result; }
function prepare() { $this->addElement('mygmap_marker_id', new XoopsFormHidden('mygmap_marker_id', 0)); $this->addElement('mygmap_marker_category_id', new XoopsFormSelect($this->__l('mygmap_marker_category_id'), 'mygmap_marker_category_id')); $this->addElement('mygmap_marker_title', new XoopsFormText($this->__l('mygmap_marker_title'), 'mygmap_marker_title', 35, 255)); $this->addElement('mygmap_marker_desc', new XoopsFormDhtmlTextArea($this->__l('mygmap_marker_desc'), 'mygmap_marker_desc', '', 8, 25)); $this->addElement('mygmap_marker_icontext', new XoopsFormSelect($this->__l('mygmap_marker_icontext'), 'mygmap_marker_icontext')); $this->addElement('mygmap_marker_maptype', new XoopsFormSelect($this->__l('mygmap_marker_maptype'), 'mygmap_marker_maptype')); $this->addElement('mygmap_marker_lat', new XoopsFormHidden('mygmap_marker_lat', 0)); $this->addElement('mygmap_marker_lng', new XoopsFormHidden('mygmap_marker_lng', 0)); $this->addElement('mygmap_marker_zoom', new XoopsFormHidden('mygmap_marker_zoom', 0)); $categoryHandler =& NBFrame::getHandler('MyGmapCategory', $this->mEnvironment); $this->addOptionArray('mygmap_marker_category_id', $categoryHandler->getSelectOptionArray(null, 'markereditlist')); $markerHandler =& NBFrame::getHandler('MyGmapmarker', $this->mEnvironment); $this->addOptionArray('mygmap_marker_icontext', $markerHandler->getIconListArray()); $this->addOptionArray('mygmap_marker_maptype', array('0' => '----', '1' => $this->__l('Maptype Map'), '2' => $this->__l('Maptype Satelite'), '3' => $this->__l('Maptype Hybrid'))); }
function setModuleConfig($dirName, $confName, $confValue, $categoryId = 0) { $moduleHandler =& NBFrame::getHandler('NBFrame.xoops.Module', NBFrame::null()); $moduleObject =& $moduleHandler->getByDirname($dirName); $moduleId = $moduleObject->getVar('mid'); $criteria = new CriteriaCompo(new Criteria('conf_modid', $moduleId)); $criteria->add(new Criteria('conf_catid', $categoryId)); $criteria->add(new Criteria('conf_name', $confName)); $configObjects = $this->getObjects($criteria, false); if (count($configObjects) == 1) { $configObjects[0]->setVar('conf_value', $confValue); $this->insert($configObjects[0]); } if (empty($this->_moduleConfigCache[$dirName])) { $this->_moduleConfigCache[$moduleId][$categoryId][$confName] = $confValue; } return $value; }
function search(&$environment, $queryarray, $andor, $limit, $offset, $userid) { $ret = array(); $markerHandler =& NBFrame::getHandler('MyGmapMarker', $environment); if (is_array($queryarray) && ($count = count($queryarray))) { $criteria0 = new CriteriaCompo(new Criteria('mygmap_marker_title', '%' . $queryarray[0] . '%', 'LIKE')); $criteria0->add(new Criteria('mygmap_marker_desc', '%' . $queryarray[0] . '%', 'LIKE'), 'OR'); $criteria =& new CriteriaCompo($criteria0); for ($i = 1; $i < $count; $i++) { $criteria0 = new CriteriaCompo(new Criteria('mygmap_marker_title', '%' . $queryarray[$i] . '%', 'LIKE')); $criteria0->add(new Criteria('mygmap_marker_desc', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); $criteria->add($criteria0, $andor); } } else { $criteria =& new CriteriaCompo(new CriteriaElement()); } if ($userid) { $criteria->add(new Criteria('_NBsys_create_user', $userid)); } $criteria->setLimit($limit); $criteria->setStart($offset); $markerObjects = $markerHandler->getObjects($criteria); foreach ($markerObjects as $markerObject) { $desc = $markerObject->getVar('mygmap_marker_desc'); if (!empty($desc) && function_exists('xoops_make_context')) { $context = xoops_make_context(strip_tags($desc), $queryarray); } else { if (!empty($desc) && function_exists('search_make_context')) { if (!empty($_GET['showcontext']) && $_GET['showcontext'] == 1) { $context = search_make_context(strip_tags($desc), $queryarray); } } else { $context = ''; } } $ret[] = array('title' => $markerObject->getVar('mygmap_marker_title'), 'uid' => $markerObject->getVar('_NBsys_create_user'), 'time' => $markerObject->getVar('_NBsys_update_time'), 'page' => $markerObject->getVar('mygmap_marker_title'), 'link' => $environment->getActionUrl('MyGmapMain', array('cat' => $markerObject->getVar('mygmap_marker_category_id'), 'id' => $markerObject->getVar('mygmap_marker_id')), 'html', true), 'context' => $context); } return $ret; }
function search(&$environment, $queryarray, $andor, $limit, $offset, $userid) { $ret = array(); $linkHandler =& NBFrame::getHandler('SimpleLinkLink', $environment); if (is_array($queryarray) && ($count = count($queryarray))) { $criteria =& new CriteriaCompo(new Criteria('link_name', '%' . $queryarray[0] . '%', 'LIKE')); for ($i = 1; $i < $count; $i++) { $criteria->add(new Criteria('link_name', '%' . $queryarray[$i] . '%', 'LIKE'), $andor); } } else { if ($userid) { return array(); } $criteria =& new CriteriaCompo(new CriteriaElement()); } $criteria->setLimit($limit); $criteria->setStart($offset); $linkObjects = $linkHandler->getObjects($criteria); foreach ($linkObjects as $linkObject) { $ret[] = array('title' => $linkObject->getVar('link_name'), 'page' => $linkObject->getVar('link_name'), 'uid' => 0); } return $ret; }
function executeDefaultOp() { $this->mList = array(); $this->mModuleObject =& $this->mEnvironment->getModule(); $linkHandler =& NBFrame::getHandler('SimpleLinkLink', $this->mEnvironment); $categoryHandler =& NBFrame::getHandler('SimpleLinkCategory', $this->mEnvironment); $category = $this->mRequest->getParam('cat'); if (!empty($category)) { $criteria =& $categoryHandler->getChildrenCriteria('category_id', $category); } else { $criteria =& new CriteriaElement(); } $criteria->setSort('category_weight'); $categoryObjects =& $categoryHandler->getNestedObjects($criteria, ''); foreach ($categoryObjects as $categoryObject) { $criteria =& new Criteria('link_category_id', $categoryObject->getVar('category_id')); $criteria->setSort('link_weight'); $linkObjects = $linkHandler->getObjects($criteria); $categoryObject->assignVar('link_objects', $linkObjects); $this->mList[] = $categoryObject; } return NBFRAME_ACTION_VIEW_DEFAULT; }
function executeGpermOp() { $mid = $GLOBALS['xoopsModule']->getVar('mid'); $criteria =& new Criteria('mid', $mid); $this->mObjects =& $this->mObjectHandler->getObjects($criteria); $groupPermHandler =& NBFrame::getHandler('NBFrame.xoops.GroupPerm', NBFrame::null()); foreach ($this->mGroupPermSysKeys as $groupPermKey) { $this->mRequest->defParam('gperm_' . $groupPermKey, 'POST', 'array-int', array()); $groups = $this->mRequest->getParam('gperm_' . $groupPermKey); $groupPermHandler->setRight($groupPermKey, $mid, $groups, 1); } foreach ($this->mGroupPermModuleKeys as $groupPermKey) { $this->mRequest->defParam('gperm_' . $groupPermKey, 'POST', 'array-int', array()); $groups = $this->mRequest->getParam('gperm_' . $groupPermKey); $groupPermHandler->setRight($groupPermKey, 1, $groups, $mid); } foreach ($this->mObjects as $object) { $bid = $object->getKey(); $this->mRequest->defParam('gperm_block_read_' . $bid, 'POST', 'array-int', array()); $groups = $this->mRequest->getParam('gperm_block_read_' . $bid); $groupPermHandler->setRight('block_read', $bid, $groups, 1); } return NBFRAME_ACTION_SUCCESS; }
function executeDefaultOp() { if ($GLOBALS['xoopsUserIsAdmin']) { $this->mRequest->defParam('lat', 'POST', 'float', NBFRAME_NO_DEFAULT_PARAM, true); $this->mRequest->defParam('lng', 'POST', 'float', NBFRAME_NO_DEFAULT_PARAM, true); $this->mRequest->defParam('zoom', 'POST', 'int', NBFRAME_NO_DEFAULT_PARAM, true); if (!$this->mRequest->hasError()) { $params = $this->mRequest->getParam(); $update_configs = array('mygmap_lat', 'mygmap_lng', 'mygmap_zoom'); $update_vars = array('mygmap_lat' => $params['lat'], 'mygmap_lng' => $params['lng'], 'mygmap_zoom' => $params['zoom']); $configHandler =& NBFrame::getHandler('NBFrame.xoops.Config', NBFrame::null()); foreach ($update_vars as $conf_name => $conf_value) { $configHandler->setModuleConfig($this->mDirName, $conf_name, $conf_value); } return NBFRAME_ACTION_SUCCESS; } else { $this->mErrorMsg = $this->__e('Invalid Operation'); return NBFRAME_ACTION_ERROR; } } else { $this->mErrorMsg = $this->__e('Permission Error'); return NBFRAME_ACTION_ERROR; } }
function checkRight($perm, $bypassAdminCheck = false) { $groupPermHandler =& NBFrame::getHandler('NBFrame.xoops.GroupPerm', NBFrame::null()); return $groupPermHandler->checkRightByObjectKey($perm, $this, $bypassAdminCheck); }
function getModuleListArray() { $moduleHandler =& NBFrame::getHandler('NBFrame.xoops.Module', $this->mEnvironment); $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); $criteria->add(new Criteria('isactive', 1)); $module_list = $moduleHandler->getSelectOptionArray($criteria); $module_list[-1] = $this->__l('Top Page'); $module_list[0] = $this->__l('All Pages'); ksort($module_list); return $module_list; }
function setRightByObjectKey($gpermName, &$gpermObject, $gpermGroupIds) { if (is_object($gpermObject->mHandler)) { $environment =& $gpermObject->mHandler->mEnvironment; } else { $environment = null; } if (!empty($environment)) { $moduleHandler =& NBFrame::getHandler('NBFrame.xoops.Module', NBFrame::null()); $moduleObject =& $environment->getModule(); } else { $moduleObject =& $GLOBALS['xoopsModule']; } $moduleID = $moduleObject->get('mid'); $this->setRight($gpermName, $gpermObject->getKey(), $gpermGroupIds, $moduleID); }
function checkAltSys($dirOnly = true) { if (defined('XOOPS_TRUST_PATH')) { if (is_dir(XOOPS_TRUST_PATH . '/libs/altsys')) { if ($dirOnly) { return true; } else { $moduleHandler =& NBFrame::getHandler('NBFrame.xoops.Module', NBFrame::null()); if ($moduleHandler->getByDirname('altsys')) { return true; } } } } return false; }
function installTemplates($force = false) { require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $this->addMsg('NBFrame Duplicatable Template Definition starts...'); $moduleInfo = $this->_getModuleInfo(); $tplFileHandler =& NBFrame::getHandler('NBFrame.xoops.TplFile', $this->mEnvironment); $tempaltePath = $this->mEnvironment->findFile('templates', ''); $templateFiles = glob($tempaltePath . '/*.html'); $tempaltePath = $this->mEnvironment->findFile('templates', '', false, '='); $templateFiles0 = glob($tempaltePath . '/' . $this->mEnvironment->prefix('*.html')); if (is_array($templateFiles0)) { foreach ($templateFiles0 as $key => $value) { $templateFiles0[$key] = preg_replace('/' . preg_quote($this->mEnvironment->prefix(''), '/') . '/', '', basename($value)); } $templateFiles = array_merge($templateFiles, $templateFiles0); } foreach ($templateFiles as $key => $value) { $templateFiles[$key] = basename($value); } $templateFiles = array_unique($templateFiles); foreach ($templateFiles as $templateFileBaseName) { $templateFile = $this->mEnvironment->findFile($templateFileBaseName, '/templates'); $templateName = $this->mDirName . '_' . $templateFileBaseName; $fileContent = file($templateFile); $fileContent = implode('', $fileContent); $criteria =& new CriteriaCompo(new Criteria('tpl_module', $this->mDirName)); $criteria->add(new Criteria('tpl_file', $templateName)); $criteria->add(new Criteria('tpl_tplset', 'default')); $criteria->add(new Criteria('tpl_type', 'module')); if ($tplFileObjects = $tplFileHandler->getObjects($criteria)) { foreach ($tplFileObjects as $tplFileObject) { if ($tplFileObject->get('tpl_lastmodified') != filemtime($templateFile)) { $tplFileObject->set('tpl_lastmodified', filemtime($templateFile)); $tplFileObject->set('tpl_source', $fileContent); $tplFileHandler->insert($tplFileObject, $force); $this->clearTplCache($tpl, $templateName); } } } else { $tplFileObject =& $tplFileHandler->create(); $tplFileObject->set('tpl_refid', $moduleInfo['mid']); $tplFileObject->set('tpl_module', $this->mDirName); $tplFileObject->set('tpl_tplset', 'default'); $tplFileObject->set('tpl_file', $templateName); $tplFileObject->set('tpl_desc', ''); $tplFileObject->set('tpl_lastmodified', filemtime($templateFile)); $tplFileObject->set('tpl_type', 'module'); $tplFileObject->set('tpl_source', $fileContent); $tplFileHandler->insert($tplFileObject, $force); $this->clearTplCache($tpl, $templateName); } $this->addMsg(' Define Module Template(' . $templateName . ')'); } if (!empty($moduleInfo['blocks'])) { foreach ($moduleInfo['blocks'] as $key => $blockDef) { if (isset($blockDef['template'])) { $basename = preg_replace('/^' . $this->mDirName . '_/', '', $blockDef['template']); $templateFile = $this->mEnvironment->findFile($basename, '/templates/blocks'); if ($templateFile) { $templateName = $this->mDirName . '_' . $basename; $fileContent = file($templateFile); $fileContent = implode('', $fileContent); $criteria =& new CriteriaCompo(new Criteria('tpl_module', $this->mDirName)); $criteria->add(new Criteria('tpl_file', $templateName)); $criteria->add(new Criteria('tpl_type', 'block')); $criteria->add(new Criteria('tpl_tplset', 'default')); if ($tplFileObjects = $tplFileHandler->getObjects($criteria)) { foreach ($tplFileObjects as $tplFileObject) { if ($tplFileObject->get('tpl_lastmodified') != filemtime($templateFile)) { $tplFileObject->set('tpl_lastmodified', filemtime($templateFile)); $tplFileObject->set('tpl_source', $fileContent); $tplFileHandler->insert($tplFileObject, $force); $this->clearTplCache($tpl, $templateName); } } } else { $tplFileObject =& $tplFileHandler->create(); $tplFileObject->set('tpl_refid', $key); $tplFileObject->set('tpl_module', $this->mDirName); $tplFileObject->set('tpl_tplset', 'default'); $tplFileObject->set('tpl_file', $templateName); $tplFileObject->set('tpl_desc', ''); $tplFileObject->set('tpl_lastmodified', filemtime($templateFile)); $tplFileObject->set('tpl_type', 'block'); $tplFileObject->set('tpl_source', $fileContent); $tplFileHandler->insert($tplFileObject, $force); $this->clearTplCache($tpl, $templateName); } $this->addMsg(' Define Block Template(' . $templateName . ')'); } } } } $this->addMsg('NBFrame Duplicatable Template Definition ends...'); }
function addObjectOptionArray($name, $objectClass, $criteria = null, $gperm_mode = '', $bypassAdminCheck = false) { $objectHandler =& NBFrame::getHandler($objectClass, $this->mEnvironment); $this->addOptionArray($name, $objectHandler->getSelectOptionArray($criteria, $gperm_mode, $bypassAdminCheck)); }
function &getModule() { if (!is_object($this->mModule)) { $moduleHandler =& NBFrame::getHandler('NBFrame.xoops.Module', NBFrame::null()); $this->mModule =& $moduleHandler->getByEnvironment($this); if (is_object($this->mModule)) { $this->mModule->getInfo(); } } return $this->mModule; }
function prepare($classprefix, $name, $caption) { parent::prepare(); $this->mDefaultOp = 'edit'; $this->mAllowedOp = array('edit', 'new', 'insert', 'save'); $this->mName = $name; $this->mCaption = $caption; if (!$this->mObjectHandler) { $this->mObjectHandler =& NBFrame::getHandler($classprefix, $this->mEnvironment); } $this->setObjectKeyField(); if (empty($this->mListSortDefault)) { $this->mListSortDefault = $this->mObjectKeyFields[0]; } if (empty($this->mListOrderDefault)) { $this->mListOrderDefault = 'asc'; } }
function prepare() { $this->addElement('link_category_id', new XoopsFormSelect($this->__l('link_category_id'), 'link_category_id')); $categoryHandler =& NBFrame::getHandler('SimpleLinkCategory', $this->mEnvironment); $this->addOptionArray('link_category_id', $categoryHandler->getSelectOptionArray()); }
/** * レコードの削除 * * @param NBFrameObject $record * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function delete(&$record, $force = false) { if (is_a($record, 'NBFrameObject') && $record->mClassName != $this->mEntityClassName) { return false; } if (!$record->cleanVars()) { $this->mErrors[] = $this->db->error(); return false; } $vars = $record->getVars(); $whereList = ""; $whereDelim = ""; foreach ($record->cleanVars as $field => $value) { if ($record->isKey($field)) { if ($vars[$field]['data_type'] == XOBJ_DTYPE_INT || $vars[$field]['data_type'] == XOBJ_DTYPE_FLOAT) { $value = $value; } else { $value = $this->db->quoteString($value); } $whereList .= $whereDelim . "`{$field}` = " . $value; $whereDelim = " AND "; } } $sql = sprintf("DELETE FROM %s WHERE %s", $this->mTableName, $whereList); if (!($result =& $this->query($sql, $force))) { return false; } if (count($record->mGroupPermAttrib) > 0) { $groupPermHandler =& NBFrame::getHandler('NBFrame.xoops.GroupPerm', NBFrame::null()); foreach ($record->mGroupPermAttrib as $field => $permKey) { $groupPermHandler->setRightByObjectKey($permKey, $record, array()); } } return true; }
$noCommonActions[] = 'NBFrame.GetModuleIcon'; $noCommonActions[] = 'NBFrame.GetImage'; $noCommonActions[] = 'NBFrame.LoadCalendarJS'; $environment->setAttribute('NoCommonAction', $noCommonActions); if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], $noCommonActions)) { require_once XOOPS_ROOT_PATH . '/include/common.php'; } else { foreach (array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES') as $bad_global) { if (isset($_REQUEST[$bad_global])) { exit; } } if (class_exists('XCube_Root')) { $root =& XCube_Root::getSingleton(); $root->mController->executeCommonSubset(true); $configHandler =& NBFrame::getHandler('NBFrame.xoops.Config', NBFrame::null()); $language = $configHandler->getConfig('language'); $filename = XOOPS_MODULE_PATH . '/legacy/language/' . $language . '/charset_' . XOOPS_DB_TYPE . '.php'; if (file_exists($filename)) { require_once $filename; } } else { if (empty($GLOBALS['xoopsDB'])) { require_once XOOPS_ROOT_PATH . '/include/functions.php'; require_once XOOPS_ROOT_PATH . '/class/errorhandler.php'; require_once XOOPS_ROOT_PATH . '/class/logger.php'; require_once XOOPS_ROOT_PATH . '/include/functions.php'; require_once XOOPS_ROOT_PATH . '/class/database/databasefactory.php'; require_once XOOPS_ROOT_PATH . '/kernel/object.php'; require_once XOOPS_ROOT_PATH . '/class/criteria.php'; require_once XOOPS_ROOT_PATH . '/class/module.textsanitizer.php';
function executeDefaultOp() { $myts =& MyTextSanitizer::getInstance(); $this->elements['markers'] = array(); $this->elements['category'] = array(); $this->elements['overlay'] = array(); $categoryHandler =& NBFrame::getHandler('MyGmapCategory', $this->mEnvironment); $criteria = new Criteria(1, intNBCriteriaVal(1)); $categoryObjects =& $categoryHandler->getObjects($criteria); $this->elements['catlist'] = array(); $this->elements['catlist'][] = array('id' => -1, 'name' => $this->__l('All Categories')); foreach ($categoryObjects as $categoryObject) { $mygmap_cat = array(); $mygmap_cat['id'] = $categoryObject->getVar('mygmap_category_id'); $mygmap_cat['name'] = $categoryObject->getVar('mygmap_category_name'); $this->elements['catlist'][] = $mygmap_cat; } $this->elements['maptype'] = $GLOBALS['xoopsModuleConfig']['mygmap_maptype']; if (isset($_GET['lat']) && isset($_GET['lng'])) { $mygmap_marker = array(); $mygmap_marker['id'] = 0; $this->elements['center_lat'] = $mygmap_marker['lat'] = floatval($_GET['lat']); $this->elements['center_lng'] = $mygmap_marker['lng'] = floatval($_GET['lng']); $this->elements['zoom'] = $mygmap_marker['zoom'] = isset($_GET['z']) ? intval($_GET['z']) : $GLOBALS['xoopsModuleConfig']['mygmap_z']; $this->elements['maptype'] = isset($_GET['t']) ? intval($_GET['t']) : $GLOBALS['xoopsModuleConfig']['mygmap_maptype']; $mygmap_marker['mark'] = isset($_GET['mark']) ? htmlspecialchars(strtoupper($_GET['mark']), ENT_QUOTES) : ''; $mygmap_text = !empty($_GET['text']) ? mb_convert_encoding($_GET['text'], 'EUC-JP', 'auto') : $GLOBALS['xoopsModuleConfig']['mygmap_text2']; $mygmap_marker['text'] = str_replace("'", "\\'", $myts->makeTareaData4Show($mygmap_text)); $this->elements['markers'][] = $mygmap_marker; } elseif (!empty($_GET['cat']) || !empty($GLOBALS['xoopsModuleConfig']['mygmap_cat'])) { $category_id = !empty($_GET['cat']) ? intval($_GET['cat']) : $GLOBALS['xoopsModuleConfig']['mygmap_cat']; $markerHandler =& NBFrame::getHandler('MyGmapMarker', $this->mEnvironment); if ($category_id != -1) { $categoryObject =& $categoryHandler->get($category_id); $this->elements['center_lat'] = $this->elements['category']['lat'] = $categoryObject->getVar('mygmap_category_lat'); $this->elements['center_lng'] = $this->elements['category']['lng'] = $categoryObject->getVar('mygmap_category_lng'); $this->elements['zoom'] = $this->elements['category']['zoom'] = $categoryObject->getVar('mygmap_category_zoom'); $this->elements['category']['maptype'] = $categoryObject->getVar('mygmap_category_maptype'); $this->elements['maptype'] = $this->elements['category']['maptype'] ? $this->elements['category']['maptype'] : $this->elements['maptype']; $this->elements['category']['id'] = $categoryObject->getVar('mygmap_category_id'); $this->elements['category']['name'] = $categoryObject->getVar('mygmap_category_name'); $this->elements['category']['desc'] = $categoryObject->getVar('mygmap_category_desc'); $this->elements['category']['can_edit'] = $categoryObject->checkGroupPerm('write', true); if ($categoryObject->getVar('mygmap_category_overlay')) { $this->elements['overlay'][] = $this->overlayURL($categoryObject->getVar('mygmap_category_overlay')); } } else { $this->elements['center_lat'] = $mygmap_marker['lat'] = $GLOBALS['xoopsModuleConfig']['mygmap_lat']; $this->elements['center_lng'] = $mygmap_marker['lng'] = $GLOBALS['xoopsModuleConfig']['mygmap_lng']; $this->elements['zoom'] = $GLOBALS['xoopsModuleConfig']['mygmap_zoom']; $this->elements['category']['id'] = -1; foreach ($categoryObjects as $categoryObject) { $categoryCanEdit[$categoryObject->getKey()] = $categoryObject->checkGroupPerm('write', true); if ($categoryObject->getVar('mygmap_category_overlay')) { $this->elements['overlay'][] = $this->overlayURL($categoryObject->getVar('mygmap_category_overlay')); } } } if (!empty($_GET['id'])) { $map_id = intval($_GET['id']); if ($markerObject =& $markerHandler->get($map_id)) { $this->elements['center_lat'] = $markerObject->getVar('mygmap_marker_lat'); $this->elements['center_lng'] = $markerObject->getVar('mygmap_marker_lng'); $this->elements['zoom'] = $markerObject->getVar('mygmap_marker_zoom'); $this->elements['maptype'] = $markerObject->getVar('mygmap_marker_maptype') ? $markerObject->getVar('mygmap_marker_maptype') : $this->elements['maptype']; } } if ($category_id != -1) { $criteria =& new Criteria('mygmap_marker_category_id', $category_id); } else { $criteria = null; } $markerObjects =& $markerHandler->getObjects($criteria); foreach ($markerObjects as $markerObject) { $mygmap_marker = array(); $mygmap_marker['id'] = $markerObject->getVar('mygmap_marker_id'); $mygmap_marker['lat'] = $markerObject->getVar('mygmap_marker_lat'); $mygmap_marker['lng'] = $markerObject->getVar('mygmap_marker_lng'); $mygmap_marker['zoom'] = $markerObject->getVar('mygmap_marker_zoom'); $mygmap_marker['maptype'] = $markerObject->getVar('mygmap_marker_maptype'); $mygmap_marker['mark'] = $markerObject->getVar('mygmap_marker_icontext'); $mygmap_title = htmlspecialchars($markerObject->getVar('mygmap_marker_title'), ENT_QUOTES); $mygmap_desc = $markerObject->getVar('mygmap_marker_desc'); $mygmap_marker['title'] = $mygmap_title; $mygmap_marker['text'] = '<b>' . $mygmap_title . '</b>' . '<hr />' . $mygmap_desc; if ($category_id != -1) { $mygmap_marker['canedit'] = NBFrame::checkRight('marker_edit') && $this->elements['category']['can_edit']; } else { $mygmap_marker['canedit'] = NBFrame::checkRight('marker_edit') && $categoryCanEdit[$markerObject->getVar('mygmap_marker_category_id')]; } $this->elements['markers'][] = $mygmap_marker; } usort($this->elements['markers'], array(&$this, 'usort_cmp')); } else { $mygmap_marker = array(); $mygmap_marker['id'] = 0; $this->elements['center_lat'] = $mygmap_marker['lat'] = $GLOBALS['xoopsModuleConfig']['mygmap_lat']; $this->elements['center_lng'] = $mygmap_marker['lng'] = $GLOBALS['xoopsModuleConfig']['mygmap_lng']; $this->elements['zoom'] = $GLOBALS['xoopsModuleConfig']['mygmap_zoom']; $mygmap_marker['mark'] = ''; $mygmap_text = $GLOBALS['xoopsModuleConfig']['mygmap_text1']; $mygmap_marker['text'] = str_replace("'", "\\'", $myts->makeTareaData4Show($mygmap_text)); $mygmap_marker['canedit'] = false; $this->elements['markers'][] = $mygmap_marker; } $areaHandler =& NBFrame::getHandler('MyGmapArea', $this->mEnvironment); $criteria = new Criteria(1, intNBCriteriaVal(1)); $criteria->setSort('mygmap_area_order'); $areaObjects =& $areaHandler->getObjects($criteria); $this->elements['areas'] = array(); foreach ($areaObjects as $areaObject) { $mygmap_area = array(); $mygmap_area['id'] = $areaObject->getVar('mygmap_area_id'); $mygmap_area['name'] = $areaObject->getVar('mygmap_area_name'); $mygmap_area['lat'] = $areaObject->getVar('mygmap_area_lat'); $mygmap_area['lng'] = $areaObject->getVar('mygmap_area_lng'); $mygmap_area['zoom'] = $areaObject->getVar('mygmap_area_zoom'); $mygmap_area['maptype'] = $areaObject->getVar('mygmap_area_maptype'); $mygmap_area['desc'] = $areaObject->getVar('mygmap_area_desc'); $this->elements['areas'][] = $mygmap_area; } $this->elements['addr'] = !empty($_GET['q']) ? mb_convert_encoding(htmlspecialchars($_GET['q'], ENT_QUOTES), 'EUC-JP', 'UTF-8,EUC-JP,SJIS') : ''; $this->elements['station'] = !empty($_GET['s']) ? mb_convert_encoding(htmlspecialchars($_GET['s'], ENT_QUOTES), 'EUC-JP', 'UTF-8,EUC-JP,SJIS') : ''; NBFrame::using('MyGmapUtils', $this->mEnvironment); foreach (MyGmapUtils::getPluginFiles($this->mDirName, 'php') as $file) { require_once $file; $class = basename($file); $class = substr($class, 0, strlen($class) - 4); if (class_exists($class)) { call_user_func_array(array($class, 'executeDefaultOp'), array(&$this)); } } return NBFRAME_ACTION_VIEW_DEFAULT; }