function preAction()
 {
     global $xoopsUser;
     xoonips_deny_guest_access();
     xoonips_allow_post_method();
     $extra_params = xoonips_extra_param_restore();
     xoonips_validate_request($this->is_valid_transferee_user(@$extra_params['to_uid']));
     xoonips_validate_request($this->is_readable_all_items($this->_formdata->getValueArray('post', 'selected_original', 'i', false), $xoopsUser->getVar('uid')));
 }
 function doAction()
 {
     global $xoopsUser;
     $extra_params = xoonips_extra_param_restore();
     if (array_key_exists('to_uid', $extra_params)) {
         $this->_view_params['to_uid'] = $extra_params['to_uid'];
     }
     $item_ids_to_transfer = array();
     if ('add_selected_item' == $this->_formdata->getValue('post', 'op', 's', false)) {
         $item_ids_to_transfer = array_merge($this->get_selected(), $this->get_selected_hidden());
     } else {
         $item_ids_to_transfer = $this->_formdata->getValueArray('post', 'selected_original', 'i', false);
     }
     $item_ids_to_transfer = $this->sort_item_ids_by_title($item_ids_to_transfer);
     $this->_view_params['items_to_transfer'] = xoonips_transfer_get_transferrable_item_information($xoopsUser->getVar('uid'), $item_ids_to_transfer);
     $this->_view_params['to_user_options'] = xoonips_transfer_get_users_for_dropdown($xoopsUser->getVar('uid'));
     $this->_view_params['transfer_enable'] = $this->is_all_transferrable_items($xoopsUser->getVar('uid'), $item_ids_to_transfer);
 }
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
//  advanced search form for register binder
include 'include/common.inc.php';
// disable to link index tree
$xoonipsURL = '';
$xoopsOption['template_main'] = 'xoonips_advanced_search_itemselect.html';
include XOOPS_ROOT_PATH . '/header.php';
include_once 'include/extra_param.inc.php';
$formdata =& xoonips_getutility('formdata');
$textutil =& xoonips_getutility('text');
$xoopsTpl->assign('extra_param', $textutil->html_special_chars(serialize(xoonips_extra_param_restore())));
$xoopsTpl->assign('submit_url', $textutil->html_special_chars($formdata->getValue('post', 'submit_url', 's', false)));
$xoopsTpl->assign('selected_original', $formdata->getValueArray('post', 'selected_original', 'i', false));
include 'include/advanced_search.inc.php';
include XOOPS_ROOT_PATH . '/footer.php';
/**
 * get form data(named xoonips_item_id) from extra_param or POST.
 *
 * If extra_param is given in form data, it returns extra_param['xoonips_item_id'].
 * Otherwise returns $_POST['xoonips_item_id'].
 * @return array of integer(item id of binder's item)
 */
function xnpbinder_get_xoonips_item_id()
{
    $extra_param = xoonips_extra_param_restore();
    if ($extra_param) {
        return is_array(@$extra_param['xoonips_item_id']) ? $extra_param['xoonips_item_id'] : array();
    }
    $formdata =& xoonips_getutility('formdata');
    $result = $formdata->getValueArray('post', 'xoonips_item_id', 'i', false, array());
    return $result;
}
$xnpsid = $_SESSION['XNPSID'];
xnpEncodeMacSafariPost();
xnpEncodeMacSafariGet();
// if there is post_id, it restores $_POST.
$formdata =& xoonips_getutility('formdata');
$post_id = $formdata->getValue('get', 'post_id', 's', false);
if (isset($post_id) && $_SERVER["REQUEST_METHOD"] == 'GET') {
    if (isset($_SESSION['post_id']) && isset($_SESSION['post_id'][$post_id])) {
        $_POST = unserialize($_SESSION['post_id'][$post_id]);
    }
}
foreach (array('item_id' => 0, 'scrollX' => 0, 'scrollY' => 0) as $k => $v) {
    ${$k} = $formdata->getValue('both', $k, 'i', false);
}
// extra_item['item_id'] has priority over $_POST['item_id']
$extra_param = xoonips_extra_param_restore();
if ($extra_param) {
    $item_id = array_key_exists('item_id', $extra_param) ? $extra_param['item_id'] : $item_id;
}
xoonips_deny_guest_access();
$uid = $_SESSION['xoopsUserId'];
//Uncertified user can't access(except XOOPS administrator).
if (!$xoopsUser->isAdmin($xoopsModule->getVar('mid')) && !xnp_is_activated($xnpsid, $uid)) {
    redirect_header(XOOPS_URL . '/modules/xoonips/index.php', 3, _MD_XOONIPS_MODERATOR_NOT_ACTIVATED);
    exit;
}
//error if item is locked
$item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock');
if ($item_lock_handler->isLocked($item_id)) {
    redirect_header(XOOPS_URL . '/modules/xoonips/detail.php?item_id=' . $item_id, 5, sprintf(_MD_XOONIPS_ERROR_CANNOT_EDIT_LOCKED_ITEM, xoonips_get_lock_type_string($item_lock_handler->getLockType($item_id))));
    exit;