Example #1
0
 /**
  * executeViewInput
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewInput(&$render)
 {
     $render->setTemplateName($this->mAsset->mDirname . '_log_edit.html');
     $render->setAttribute('actionForm', $this->mActionForm);
     $render->setAttribute('object', $this->mObject);
     $render->setAttribute('myRpgs', Playermap_Utils::getMyRpg());
     $myGroupIds = Legacy_Utils::getModuleHandler('member', $this->mAsset->mDirname)->getMyGroupIdList();
     $render->setAttribute('myGroups', Legacy_Utils::getModuleHandler('group', $this->mAsset->mDirname)->getGroupListByIds($myGroupIds));
 }
Example #2
0
 /**
  * getCommonValue
  * 
  * @param	string	$key	data_id, title, uid, pubtime
  * @param	string	$req	player, rpg
  * @param	int		$tsize	thumbnail size
  * 
  * @return	void
  */
 public function getCommonValue($key, $req = null, $tsize = 2)
 {
     $value = null;
     switch ($key) {
         case 'data_id':
             $value = $this->get(self::PRIMARY);
             break;
         case 'title':
             if ($req == 'player') {
                 $this->loadRpg();
                 $value = $this->mRpg->get('title');
             } elseif ($req == 'rpg') {
                 $this->loadPlayer();
                 $value = $this->mPlayer->get('name');
             }
             break;
         case 'uid':
             $value = $this->get('uid');
             break;
         case 'url':
             if ($req == 'player') {
                 $this->loadRpg();
                 $value = $this->mRpg->renderUri();
             } elseif ($req == 'rpg') {
                 $this->loadPlayer();
                 $value = $this->mPlayer->renderUri();
             }
             break;
         case 'imageTag':
             if ($req == 'player') {
                 $this->loadRpg();
                 $value = Playermap_Utils::getImageTag($this->mRpg, $tsize, 'source');
             } elseif ($req == 'rpg') {
                 $this->loadPlayer();
                 $value = Playermap_Utils::getImageTag($this->mPlayer, $tsize, 'source');
             }
             break;
         case 'subinfo':
             $value = $this->get('rating');
             break;
         case 'pubtime':
             $value = $this->get('posttime');
             break;
     }
     return $value;
 }
 /**
  * _getIncSearchScript
  * 
  * @param	void
  * 
  * @return	string
  **/
 protected function _getIncSearchScript()
 {
     $searchList = Playermap_Utils::getSearchList('group');
     $base = rtrim(Legacy_Utils::renderUri($this->mAsset->mDirname, 'group', 1), 1);
     $idString = implode(',', $searchList['id']);
     $titleString = '"' . implode('","', $searchList['title']) . '"';
     $searchString = '"' . implode('","', $searchList['search']) . '"';
     return sprintf('var arr={"title":[%s],"search":[%s],"id":[%s]};$("#incsearch").add_incsearch_on($("#searchList"),arr,"%s");', $titleString, $searchString, $idString, $base);
 }
 /**
  * _uninstallBlocks
  * 
  * @param   void
  * 
  * @return  void
  **/
 private function _uninstallBlocks()
 {
     Playermap_InstallUtils::uninstallAllOfBlocks($this->_mXoopsModule, $this->mLog);
     $tplHandler =& Playermap_Utils::getXoopsHandler('tplfile');
     $cri = new Criteria('tpl_module', $this->_mXoopsModule->get('dirname'));
     if (!$tplHandler->deleteAll($cri)) {
         $this->mLog->addError(XCube_Utils::formatString(_MI_PLAYERMAP_INSTALL_ERROR_BLOCK_TPL_DELETED, $tplHandler->db->error()));
     }
 }
 /**
  * _getIncSearchScript
  * 
  * @param	void
  * 
  * @return	string
  **/
 protected function _getIncSearchScript()
 {
     $searchList = Playermap_Utils::getSearchList($this->mDataname);
     $listDirname = $this->mDataname == 'rpg' || $this->mDataname == 'book' ? TRPG_DIRNAME : PLAYERMAP_DIRNAME;
     $base = rtrim(Legacy_Utils::renderUri($listDirname, $this->mDataname, 1), 1);
     $idString = implode(',', $searchList['id']);
     $titleString = '"' . implode('","', $searchList['title']) . '"';
     $searchString = '"' . implode('","', $searchList['search']) . '"';
     return sprintf('var arr={"title":[%s],"search":[%s],"id":[%s]};$("#incsearch").add_incsearch_on($("#searchList"),arr,"%s");', $titleString, $searchString, $idString, $base);
 }
Example #6
0
 /**
  * getBlock
  * 
  * @param	Legacy_AbstractBlockProcedure  &$obj
  * @param	XoopsBlock	$block
  * 
  * @return	void
  **/
 public static function getBlock(&$obj, $block)
 {
     $moduleHandler =& Playermap_Utils::getXoopsHandler('module');
     $module =& $moduleHandler->get($block->get('mid'));
     if (is_object($module) && $module->getInfo('trust_dirname') == 'playermap') {
         require_once PLAYERMAP_TRUST_PATH . '/blocks/' . $block->get('func_file');
         $className = 'Playermap_' . substr($block->get('show_func'), 4);
         $obj = new $className($block);
     }
 }
 /**
  * _getRpgSelectScript
  * 
  * @param	void
  * 
  * @return	string
  **/
 protected function _getRpgSelectScript()
 {
     $searchList = Playermap_Utils::getSearchList('rpg');
     $idString = implode(',', $searchList['id']);
     $titleString = '"' . implode('","', $searchList['title']) . '"';
     $searchString = '"' . implode('","', $searchList['search']) . '"';
     return sprintf('var arr={"title":[%s],"search":[%s],"id":[%s]};$("#incsearch").add_incsearch_on($("#rpgSelect"),arr);', $titleString, $searchString, $idString);
 }
 /**
  * getOverrideFileInfo
  * 
  * @param   string  $file
  * @param   string  $prefix
  * @param   bool  $isSpDirName
  * 
  * @return  {string 'theme',string 'file',string 'dirname'}
  **/
 public static function getOverrideFileInfo($file, $prefix = null, $isSpDirName = false)
 {
     $ret = array('url' => null, 'path' => null, 'theme' => null, 'dirname' => null, 'file' => null);
     if (strpos($file, '..') !== false || strpos($prefix, '..' !== false)) {
         return $ret;
     }
     $root =& XCube_Root::getSingleton();
     $module =& $root->mContext->mXoopsModule;
     $dirName = $root->mContext->mRequest->getRequest('dirname');
     if ($isSpDirName && preg_match('/^\\w+$/', $dirName)) {
         $handler =& Playermap_Utils::getXoopsHandler('module');
         $module =& $handler->getByDirname($dirName);
     }
     $isModule = is_object($module);
     $theme = $root->mSiteConfig['Legacy']['Theme'];
     $ret['theme'] = $theme;
     $dirName = $isModule ? $module->get('dirname') : null;
     $trustDirName = $isModule ? $module->getInfo('trust_dirname') : null;
     $ret['file'] = $file;
     $file = $prefix . $file;
     switch (true) {
         case $isModule && file_exists($path = sprintf('%s/modules/%s/%s', XOOPS_THEME_PATH, $theme, $dirName, $file)):
             $ret['url'] = sprintf('%s/%s/modules/%s/%s', XOOPS_THEME_URL, $theme, $dirName, $file);
             $ret['path'] = $path;
             return $ret;
         case $isModule && file_exists($path = sprintf('%s/themes/%s/modules/%s/%s', XOOPS_TRUST_PATH, $theme, $trustDirName, $file)):
             $ret['path'] = $path;
             $ret['dirname'] = $trustDirName;
             return $ret;
         case file_exists($path = sprintf('%s/%s/%s', XOOPS_THEME_PATH, $theme, $file)):
             $ret['url'] = sprintf('%s/%s/%s', XOOPS_THEME_URL, $theme, $file);
             $ret['path'] = $path;
             $ret['dirname'] = null;
             return $ret;
         case file_exists($path = sprintf('%s/themes/%s/%s', XOOPS_TRUST_PATH, $theme, $file)):
             $ret['path'] = $path;
             $ret['dirname'] = null;
             return $ret;
         case $isModule && file_exists($path = sprintf('%s/%s/admin/templates/%s', XOOPS_MODULE_PATH, $dirName, $file)):
             $ret['url'] = sprintf('%s/%s/admin/templates/%s', XOOPS_MODULE_URL, $dirName, $file);
             $ret['path'] = $path;
             $ret['theme'] = null;
             return $ret;
         case $isModule && file_exists($path = sprintf('%s/modules/%s/admin/templates/%s', XOOPS_TRUST_PATH, $trustDirName, $file)):
             $ret['path'] = $path;
             $ret['theme'] = null;
             $ret['dirname'] = $trustDirName;
             return $ret;
         case file_exists($path = PLAYERMAP_ADMIN_RENDER_FALLBACK_PATH . '/' . $file):
             $ret['url'] = PLAYERMAP_ADMIN_RENDER_FALLBACK_URL . '/' . $file;
             $ret['path'] = $path;
             $ret['theme'] = null;
             $ret['dirname'] = null;
             return $ret;
         default:
             $ret['theme'] = null;
             $ret['dirname'] = null;
             $ret['file'] = null;
             return $ret;
     }
 }
Example #9
0
 /**
  * getCommonValue
  * 
  * @param	string	$key	data_id, title, uid, pubtime
  * @param	string	$req	player, rpg
  * @param	int		$tsize	thumbnail size
  * 
  * @return	void
  */
 public function getCommonValue($key, $req = null, $tsize = 2)
 {
     $value = null;
     switch ($key) {
         case 'data_id':
             $value = $this->get(self::PRIMARY);
             break;
         case 'title':
             $this->loadFriend();
             $value = $this->mFriend->get('name');
             break;
         case 'uid':
             $value = $this->get('uid');
             break;
         case 'url':
             $this->loadFriend();
             $value = $this->mFriend->renderUri();
             break;
         case 'imageTag':
             $this->loadFriend();
             $value = Playermap_Utils::getImageTag($this->mFriend, $tsize, 'source');
         case 'description':
             $this->loadFriend();
             $value = $this->mFriend->get('desctiption');
             break;
         case 'pubtime':
             $value = $this->get('posttime');
             break;
     }
     return $value;
 }
 /**
  * updateConfigOrderByInfo
  * 
  * @param   Legacy_PreferenceInformation  &$info
  * @param   XoopsModule  &$module
  * @param   Legacy_ModuleInstallLog  &$log
  * 
  * @return  bool
  **/
 public static function updateConfigOrderByInfo(&$info, &$module, &$log)
 {
     $configHandler =& Playermap_Utils::getXoopsHandler('config');
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('conf_modid', $module->get('mid')));
     $cri->add(new Criteria('conf_catid', 0));
     $cri->add(new Criteria('conf_name', $info->mName));
     $configs =& $configHandler->getConfigs($cri);
     if (!(count($configs) > 0 && is_object($configs[0]))) {
         $log->addError(_MI_PLAYERMAP_INSTALL_ERROR_CONFIG_NOT_FOUND);
         return false;
     }
     $config =& $configs[0];
     $config->set('conf_order', $info->mOrder);
     if (!$configHandler->insertConfig($config)) {
         $log->addError(XCube_Utils::formatString(_MI_PLAYERMAP_INSTALL_ERROR_CONFIG_UPDATED, $config->get('conf_name')));
         return false;
     }
     return true;
 }
Example #11
0
 /**
  * getCommonValue
  * 
  * @param	string	$key	data_id, title, uid, pubtime
  * @param	string	$req	player, rpg
  * @param	int		$tsize	thumbnail size
  * 
  * @return	void
  */
 public function getCommonValue($key, $req = null, $tsize = 2)
 {
     $value = null;
     switch ($key) {
         case 'data_id':
             $value = $this->get('group_id');
             break;
         case 'title':
             if ($req == 'player') {
                 $this->loadRpg();
                 $value = $this->mRpg->get('title');
             } elseif ($req == 'rpg') {
                 $this->loadPlayer();
                 $value = $this->mPlayer->get('name');
             }
             break;
         case 'uid':
             $value = $this->get('uid');
             break;
         case 'url':
             if ($req == 'player') {
                 $this->loadRpg();
                 $value = $this->mRpg->renderUri();
             } elseif ($req == 'rpg') {
                 $this->loadPlayer();
                 $value = $this->mPlayer->renderUri();
             }
             break;
         case 'imageTag':
             if ($req == 'player') {
                 $this->loadRpg();
                 $value = Playermap_Utils::getImageTag($this->mRpg, $tsize, 'source');
             } elseif ($req == 'rpg') {
                 $this->loadPlayer();
                 $value = Playermap_Utils::getImageTag($this->mPlayer, $tsize, 'source');
             }
             break;
         case 'subinfo':
             $place = $this->getPlace();
             $value = $place['title'];
             break;
         case 'description':
             $value = $this->get('description');
             break;
         case 'pubtime':
             if ($this->get('sessiontime') > 0) {
                 $value = $this->get('sessiontime');
             } else {
                 $value = $this->get('scheduletime');
             }
             break;
     }
     return $value;
 }
 /**
  * &_createPermission
  * 
  * @param   int  $group
  * 
  * @return  XoopsGroupPerm
  **/
 private function &_createPermission($group)
 {
     $gpermHandler =& Playermap_Utils::getXoopsHandler('groupperm');
     $perm =& $gpermHandler->create();
     $perm->setVar('gperm_groupid', $group);
     $perm->setVar('gperm_itemid', $this->_mXoopsModule->getVar('mid'));
     $perm->setVar('gperm_modid', 1);
     return $perm;
 }
Example #13
0
 /**
  * execute
  * 
  * @param	XCube_Controller  &$controller
  * 
  * @return	void
  **/
 public function execute(&$controller)
 {
     if ($this->_createAction() === false) {
         $this->doActionNotFoundError();
         die;
     }
     if ($this->mAction->prepare() === false) {
         $this->doPreparationError();
         die;
     }
     if ($this->mAction->hasPermission() === false) {
         $this->doPermissionError();
         die;
     }
     $viewStatus = Playermap_Utils::getEnv('REQUEST_METHOD') == 'POST' ? $this->mAction->execute() : $this->mAction->getDefaultView();
     if (in_array($viewStatus, $this->_mAllowViewNames)) {
         $methodName = 'executeView' . ucfirst($viewStatus);
         if (is_callable(array($this->mAction, $methodName))) {
             $render = $this->getRenderTarget();
             $this->mAction->{$methodName}($render);
             $render->setAttribute('xoops_pagetitle', $this->mAction->getPagetitle());
             $this->mAction->setHeaderScript();
         }
     }
 }
 /**
  * saveXoopsModule
  * 
  * @param   XoopsModule  &$module
  * 
  * @return  void
  **/
 public function saveXoopsModule(&$module)
 {
     $moduleHandler =& Playermap_Utils::getXoopsHandler('module');
     if ($moduleHandler->insert($module)) {
         $this->mLog->addReport(_MI_PLAYERMAP_INSTALL_MSG_UPDATE_FINISHED);
     } else {
         $this->mLog->addError(_MI_PLAYERMAP_INSTALL_ERROR_UPDATE_FINISHED);
     }
 }