Minahito
minah****@users*****
2006年 10月 14日 (土) 23:55:26 JST
Index: xoops2jp/html/modules/legacy/blocks/legacy_waiting.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_waiting.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_waiting.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,8 @@ +<?php +function b_legacy_waiting_show() { + $modules = array(); + XCube_DelegateUtils::call('Legacyblock.Wating.Show', new XCube_Ref(&$modules)); + $block['modules'] = $modules; + return $block; +} +?> Index: xoops2jp/html/modules/legacy/blocks/legacy_search.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_search.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_search.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,7 @@ +<?php +function b_legacy_search_show() +{ + $block = array(1); + return $block; +} +?> Index: xoops2jp/html/modules/legacy/blocks/legacy_comments.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_comments.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_comments.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,47 @@ +<?php +function b_legacy_comments_show($options) { + $block = array(); + include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; + $comment_handler =& xoops_gethandler('comment'); + $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); + $criteria->setLimit(intval($options[0])); + $criteria->setSort('com_created'); + $criteria->setOrder('DESC'); + $comments =& $comment_handler->getObjects($criteria, true); + $member_handler =& xoops_gethandler('member'); + $module_handler =& xoops_gethandler('module'); + $modules =& $module_handler->getObjects(new Criteria('hascomments', 1), true); + $comment_config = array(); + foreach (array_keys($comments) as $i) { + $mid = $comments[$i]->getVar('com_modid'); + $com['module'] = '<a href="'.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/">'.$modules[$mid]->getVar('name').'</a>'; + if (!isset($comment_config[$mid])) { + $comment_config[$mid] = $modules[$mid]->getInfo('comments'); + } + $com['id'] = $i; + $com['title'] = '<a href="'.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'.$comment_config[$mid]['pageName'].'?'.$comment_config[$mid]['itemName'].'='.$comments[$i]->getVar('com_itemid').'&com_id='.$i.'&com_rootid='.$comments[$i]->getVar('com_rootid').'&'.htmlspecialchars($comments[$i]->getVar('com_exparams')).'#comment'.$i.'">'.$comments[$i]->getVar('com_title').'</a>'; + $com['icon'] = $comments[$i]->getVar('com_icon'); + $com['icon'] = ($com['icon'] != '') ? $com['icon'] : 'icon1.gif'; + $com['time'] = formatTimestamp($comments[$i]->getVar('com_created'),'m'); + if ($comments[$i]->getVar('com_uid') > 0) { + $poster =& $member_handler->getUser($comments[$i]->getVar('com_uid')); + if (is_object($poster)) { + $com['poster'] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$comments[$i]->getVar('com_uid').'">'.$poster->getVar('uname').'</a>'; + } else { + $com['poster'] = $GLOBALS['xoopsConfig']['anonymous']; + } + } else { + $com['poster'] = $GLOBALS['xoopsConfig']['anonymous']; + } + $block['comments'][] =& $com; + unset($com); + } + return $block; +} + +function b_legacy_comments_edit($options) { + $inputtag = "<input type='text' name='options[]' value='".intval($options[0])."' />"; + $form = sprintf(_MB_BASE_DISPLAYC, $inputtag); + return $form; +} +?> Index: xoops2jp/html/modules/legacy/blocks/legacy_siteinfo.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_siteinfo.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_siteinfo.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,64 @@ +<?php +function b_legacy_siteinfo_show($options) { + global $xoopsConfig, $xoopsUser; + $xoopsDB =& Database::getInstance(); + $myts =& MyTextSanitizer::getInstance(); + $block = array(); + if (!empty($options[3])) { + $block['showgroups'] = true; + $result = $xoopsDB->query("SELECT u.uid, u.uname, u.email, u.user_viewemail, u.user_avatar, g.name AS groupname FROM ".$xoopsDB->prefix("groups_users_link")." l LEFT JOIN ".$xoopsDB->prefix("users")." u ON l.uid=u.uid LEFT JOIN ".$xoopsDB->prefix("groups")." g ON l.groupid=g.groupid WHERE g.group_type='Admin' ORDER BY l.groupid, u.uid"); + if ($xoopsDB->getRowsNum($result) > 0) { + $prev_caption = ""; + $i = 0; + while ($userinfo = $xoopsDB->fetchArray($result)) { + if ($prev_caption != $userinfo['groupname']) { + $prev_caption = $userinfo['groupname']; + $block['groups'][$i]['name'] = $myts->htmlSpecialChars($userinfo['groupname']); + } + if (is_object($xoopsUser)) { + $block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => "<a href=\"javascript:openWithSelfMain('".XOOPS_URL."/pmlite.php?send2=1&to_userid=".$userinfo['uid']."','pmlite',450,370);\"><img src=\"".XOOPS_URL."/images/icons/pm_small.gif\" border=\"0\" width=\"27\" height=\"17\" alt=\"\" /></a>", 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']); + } else { + if ($userinfo['user_viewemail']) { + $block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => '<a href="mailto:'.$userinfo['email'].'"><img src="'.XOOPS_URL.'/images/icons/em_small.gif" border="0" width="16" height="14" alt="" /></a>', 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']); + } else { + $block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => ' ', 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']); + } + } + $i++; + } + } + } else { + $block['showgroups'] = false; + } + $block['logourl'] = XOOPS_URL.'/images/'.$options[2]; + if (is_object($xoopsUser)) { + $block['recoomendtime'] = time(); + } else { + $block['recoomendtime'] = 0; + } + $block['popup_width'] = $options[0]; + $block['popup_height'] = $options[1]; + return $block; +} + +function b_legacy_siteinfo_edit($options) { + $form = _MB_BASE_PWWIDTH." "; + $form .= "<input type='text' name='options[]' value='".$options[0]."' />"; + $form .= "<br />"._MB_BASE_PWHEIGHT." "; + $form .= "<input type='text' name='options[]' value='".$options[1]."' />"; + $form .= "<br />".sprintf(_MB_BASE_LOGO,XOOPS_URL."/images/")." "; + $form .= "<input type='text' name='options[]' value='".$options[2]."' />"; + $chk = ""; + $form .= "<br />"._MB_BASE_SADMIN." "; + if ( $options[3] == 1 ) { + $chk = " checked='checked'"; + } + $form .= "<input type='radio' name='options[3]' value='1'".$chk." /> "._YES.""; + $chk = ""; + if ( $options[3] == 0 ) { + $chk = " checked=\"checked\""; + } + $form .= " <input type='radio' name='options[3]' value='0'".$chk." />"._NO.""; + return $form; +} +?> Index: xoops2jp/html/modules/legacy/blocks/index.html diff -u /dev/null xoops2jp/html/modules/legacy/blocks/index.html:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/index.html Sat Oct 14 23:55:26 2006 @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Index: xoops2jp/html/modules/legacy/blocks/legacy_themes.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_themes.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_themes.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,47 @@ +<?php +function b_legacy_themes_show($options) +{ + global $xoopsConfig; + + if (count($xoopsConfig['theme_set_allowed']) == 0) { + return null; + } + + $theme_options = array(); + foreach ($xoopsConfig['theme_set_allowed'] as $theme) { + $theme_option['name'] = $theme; + if ($theme == $xoopsConfig['theme_set']) { + $theme_option['selected'] = 'selected="selected"'; + } else { + $theme_option['selected'] = ''; + } + $theme_options[] = $theme_option; + } + + $block = array(); + $block['count'] = count($xoopsConfig['theme_set_allowed']); + $block['mode'] = $options[0]; + $block['width'] = $options[1]; + $block['theme_options'] = $theme_options; + return $block; +} + +function b_legacy_themes_edit($options) +{ + + $chk = ""; + $form = _MB_BASE_LANG_THSHOW." "; + if ( $options[0] == 1 ) { + $chk = ' checked="checked"'; + } + $form .= '<input type="radio" name="options[0]" value="1"'.$chk.' /> '._YES; + $chk = ""; + if ( $options[0] == 0 ) { + $chk = ' checked="checked"'; + } + $form .= ' <input type="radio" name="options[0]" value="0"'.$chk.' />'._NO; + $form .= '<br />'._MB_BASE_LANG_THWIDTH.' '; + $form .= '<input type="text" name="options[1]" value="'.$options[1].'" />'; + return $form; +} +?> Index: xoops2jp/html/modules/legacy/blocks/legacy_mainmenu.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_mainmenu.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_mainmenu.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,33 @@ +<?php +function b_legacy_mainmenu_show() { + $root =& XCube_Root::getSingleton(); + $xoopsModule =& $root->mContext->mXoopsModule; + $xoopsUser =& $root->mController->mRoot->mContext->mXoopsUser; + + $block = array(); + + $module_handler =& xoops_gethandler('module'); + $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); + $criteria->add(new Criteria('isactive', 1)); + $criteria->add(new Criteria('weight', 0, '>')); + $modules =& $module_handler->getObjects($criteria, true); + $moduleperm_handler =& xoops_gethandler('groupperm'); + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + $read_allowed = $moduleperm_handler->getItemIds('module_read', $groups); + foreach (array_keys($modules) as $i) { + if (in_array($i, $read_allowed)) { + $block['modules'][$i]['name'] = $modules[$i]->getVar('name'); + $block['modules'][$i]['directory'] = $modules[$i]->getVar('dirname'); + $sublinks =& $modules[$i]->subLink(); + if ((count($sublinks) > 0) && (!empty($xoopsModule)) && ($i == $xoopsModule->getVar('mid'))) { + foreach($sublinks as $sublink){ + $block['modules'][$i]['sublinks'][] = array('name' => $sublink['name'], 'url' => XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url']); + } + } else { + $block['modules'][$i]['sublinks'] = array(); + } + } + } + return $block; +} +?> Index: xoops2jp/html/modules/legacy/blocks/legacy_notification.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_notification.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_notification.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,47 @@ +<?php +function b_legacy_notification_show() +{ + global $xoopsConfig, $xoopsUser, $xoopsModule; + include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; + + $root =& XCube_Root::getSingleton(); + $root->mLanguageManager->loadPageTypeMessageCatalog('notification'); + + // Notification must be enabled, and user must be logged in + if (empty($xoopsUser) || !notificationEnabled('block')) { + return false; // do not display block + } + $notification_handler =& xoops_gethandler('notification'); + // Now build the a nested associative array of info to pass + // to the block template. + $block = array(); + $categories =& notificationSubscribableCategoryInfo(); + if (empty($categories)) { + return false; + } + foreach ($categories as $category) { + $section['name'] = $category['name']; + $section['title'] = $category['title']; + $section['description'] = $category['description']; + $section['itemid'] = $category['item_id']; + $section['events'] = array(); + $subscribed_events =& $notification_handler->getSubscribedEvents ($category['name'], $category['item_id'], $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid')); + foreach (notificationEvents($category['name'], true) as $event) { + if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { + continue; + } + $subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0; + $section['events'][$event['name']] = array ('name'=>$event['name'], 'title'=>$event['title'], 'caption'=>$event['caption'], 'description'=>$event['description'], 'subscribed'=>$subscribed); + } + $block['categories'][$category['name']] = $section; + } + // Additional form data + $block['target_page'] = "notification_update.php"; + // FIXME: better or more standardized way to do this? + $script_url = explode('/', xoops_getenv('PHP_SELF')); + $script_name = $script_url[count($script_url)-1]; + $block['redirect_script'] = $script_name; + $block['submit_button'] = _NOT_UPDATENOW; + return $block; +} +?> Index: xoops2jp/html/modules/legacy/blocks/legacy_usermenu.php diff -u /dev/null xoops2jp/html/modules/legacy/blocks/legacy_usermenu.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:26 2006 +++ xoops2jp/html/modules/legacy/blocks/legacy_usermenu.php Sat Oct 14 23:55:26 2006 @@ -0,0 +1,44 @@ +<?php +/** + * @package Legacy + * @version $Id$ + */ + + /** + * This function is called back to display the user menu. + * + * [Template Variables] + * $block.uid ... Curent user id for the menu. + * $block.flagShowInbox ... If there is the pm module, set true. + * $block.inbox_url ... Return url to access inbox of pm. + * $block.new_messages ... amount of unread messages. + */ +function b_legacy_usermenu_show() +{ + $root =& XCube_Root::getSingleton(); + $xoopsUser =& $root->mController->mRoot->mContext->mXoopsUser; + + if (is_object($xoopsUser)) { + $block = array(); + + $block['uid'] = $xoopsUser->getVar('uid'); + $block['flagShowInbox'] = false; + + // + // Check does this system have PrivateMessage feature. + // + $url = $root->mController->getPMInboxUrl($block['uid']); + + if ($url != null) { + $block['inbox_url'] = $url; + $block['new_messages'] = $root->mController->getCountUnreadPM($block['uid']); + $block['flagShowInbox']=true; + } + + $block['show_adminlink'] = $xoopsUser->isAdmin(-1); + + return $block; + } + return false; +} +?>