function render()
 {
     global $xoopsOption, $xoopsConfig, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $xoopsTpl;
     $textutil =& xoonips_getutility('text');
     $xoopsOption['template_main'] = 'xoonips_import_log.html';
     if ($this->_params['result']) {
         include XOOPS_ROOT_PATH . '/header.php';
         $xoopsTpl->assign('result', $this->_params['result']);
         $xoopsTpl->assign('filename', $textutil->html_special_chars($this->_params['filename']));
         $xoopsTpl->assign('number_of_items', $this->_number_of_items());
         $xoopsTpl->assign('uname', $textutil->html_special_chars($this->_params['uname']));
         $xoopsTpl->assign('errors', $this->_params['errors']);
         $xoopsTpl->assign('log', $textutil->html_special_chars($this->_get_item_log()));
         include XOOPS_ROOT_PATH . '/footer.php';
     } else {
         include XOOPS_ROOT_PATH . '/header.php';
         $xoopsTpl->assign('result', false);
         $xoopsTpl->assign('filename', $this->_params['filename']);
         $xoopsTpl->assign('number_of_items', $this->_number_of_items());
         $xoopsTpl->assign('uname', $this->_params['uname']);
         $xoopsTpl->assign('errors', $this->_params['errors']);
         $xoopsTpl->assign('log', $this->_get_item_log());
         include XOOPS_ROOT_PATH . '/footer.php';
     }
 }
/**
 * 
 * @return array associative array of extra parameters
 */
function xoonips_extra_param_restore()
{
    $formdata =& xoonips_getutility('formdata');
    $extra_param_name = $formdata->getValueArray('post', 'extra_param_name', 's', false);
    $extra_params = array();
    foreach ($extra_param_name as $name) {
        if (!isset($_POST[$name])) {
            continue;
        }
        if (is_array($_POST[$name])) {
            $extra_params[$name] = $formdata->getValueArray('post', $name, 's', false);
        } else {
            $extra_params[$name] = $formdata->getValue('post', $name, 's', false);
        }
    }
    if (!empty($extra_params)) {
        return $extra_params;
    }
    // try to get serialized extra_param request
    $extra_param = $formdata->getValue('post', 'extra_param', 's', false);
    $extra_params = @unserialize($extra_param);
    if (is_array($extra_params)) {
        return $extra_params;
    }
    return array();
}
function item_get_userlist($upage)
{
    global $xoopsDB;
    global $xoopsUser;
    // myuid
    $myuid = $xoopsUser->getVar('uid', 'n');
    $xusers_handler =& xoonips_getormhandler('xoonips', 'users');
    $tables['users'] = $xoopsDB->prefix('users');
    $tables['xusers'] = $xoopsDB->prefix('xoonips_users');
    $join_criteria = new XooNIpsJoinCriteria('users', 'uid', 'uid');
    $criteria = new Criteria($tables['users'] . '.level', 0, '>');
    $criteria->setSort($tables['users'] . '.uname');
    $fields = array();
    $fields[] = $tables['xusers'] . '.uid';
    $fields[] = $tables['users'] . '.uname';
    $xusers_objs =& $xusers_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria);
    $textutil =& xoonips_getutility('text');
    $users = array();
    $users[] = array('uid' => 0, 'uname' => $textutil->html_special_chars(_AM_XOONIPS_MAINTENANCE_ITEM_LABEL_ALLUSERS), 'selected' => 'selected="selected"');
    foreach ($xusers_objs as $xusers_obj) {
        $uid = $xusers_obj->getVar('uid', 'e');
        $uname = $textutil->html_special_chars($xusers_obj->getExtraVar('uname'));
        $users[] = array('uid' => $uid, 'uname' => $uname, 'selected' => '');
    }
    return $users;
}
 function doAction()
 {
     $textutil =& xoonips_getutility('text');
     $this->_view_params['url_to_back'] = 'oaipmh_search.php?action=search';
     $this->_view_params['repository_name'] = $this->getRepositoryName($this->_formdata->getValue('post', 'identifier', 's', false));
     $this->_view_params['metadata'] = $this->getMetadataArray($this->_formdata->getValue('post', 'identifier', 's', false));
     $this->_view_params['hidden'] = array(array('name' => 'search_cache_id', 'value' => $this->_formdata->getValue('post', 'search_cache_id', 'i', false)), array('name' => 'search_flag', 'value' => '0'), array('name' => 'repository_id', 'value' => $this->_formdata->getValue('post', 'repository_id', 'i', false)), array('name' => 'keyword', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'keyword', 's', false))), array('name' => 'order_by', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'order_by', 's', false))), array('name' => 'order_dir', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'order_dir', 's', false))), array('name' => 'page', 'value' => $this->_formdata->getValue('post', 'page', 'i', false)), array('name' => 'metadata_per_page', 'value' => $this->_formdata->getValue('post', 'metadata_per_page', 'i', false)));
 }
function xoonips_item_list_header()
{
    $formdata =& xoonips_getutility('formdata');
    $order_by = $formdata->getValue('post', 'order_by', 's', false);
    $order_dir = $formdata->getValue('post', 'order_dir', 'i', false);
    $item_per_page = $formdata->getValue('post', 'item_per_page', 'i', false);
    return array('order_by' => $order_by, 'order_dir' => $order_dir, 'item_per_page' => $item_per_page);
}
 function XooNIpsAction()
 {
     $this->_params = array();
     $this->_response = new XooNIpsResponse();
     $this->_error =& $this->_response->getError();
     $this->_view_params = array();
     $this->_formdata =& xoonips_getutility('formdata');
 }
 /**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $unicode =& xoonips_getutility('unicode');
     $index = $this->response->getSuccess();
     $struct = new XoopsXmlRpcStruct();
     $struct->add('id', new XoopsXmlRpcInt($index['id']));
     $struct->add('name', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['name'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
     $struct->add('parent', new XoopsXmlRpcInt($index['parent']));
     $struct->add('open_level', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['open_level'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
     $struct->add('path', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['path'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
     return $struct;
 }
 function render()
 {
     global $xoopsOption, $xoopsConfig, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $xoopsTpl;
     $textutil =& xoonips_getutility('text');
     //create handler to include item_type.class.php
     $item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock');
     $xoopsOption['template_main'] = 'xoonips_transfer_user_item_confirm.html';
     include XOOPS_ROOT_PATH . '/header.php';
     $this->setXooNIpsStyleSheet($xoopsTpl);
     $xoopsTpl->assign('token_hidden', $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 600, 'xoonips_transfer_user_item_confirm'));
     $xoopsTpl->assign('to_uname', $textutil->html_special_chars($this->get_uname_by_uid($this->_params['to_uid'])));
     $xoopsTpl->assign('transfer_items', $this->get_transfer_item_template_vars());
     $xoopsTpl->assign('not_subscribed_group_message', sprintf(_MD_XOONIPS_TRANSFER_USER_ITEM_CONFIRM_USER_IS_NOT_SUBSCRIBED_TO_GROUPS, $textutil->html_special_chars($this->get_uname_by_uid($this->_params['to_uid'])), $this->get_gname_csv()));
     foreach ($this->_params as $key => $val) {
         $xoopsTpl->assign($key, $val);
     }
     include XOOPS_ROOT_PATH . '/footer.php';
 }
 /**
  * 
  * note: repository name is truncated in 70 chars
  * @access private
  * @return array of associative array of repository
  */
 function getRepositoryArrays()
 {
     $textutil =& xoonips_getutility('text');
     $handler =& xoonips_getormhandler('xoonips', 'oaipmh_repositories');
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('last_success_date', null, '!='));
     $criteria->add(new Criteria('enabled', 1));
     $criteria->add(new Criteria('deleted', 0));
     $rows =& $handler->getObjects($criteria);
     if (!$rows) {
         return array();
     }
     $result = array();
     foreach ($rows as $row) {
         $result[] = array('repository_id' => $row->getVar('repository_id', 's'), 'repository_name' => $textutil->truncate(trim($row->getVar('repository_name', 's')) != '' ? $row->getVar('repository_name', 's') : $row->getVar('URL', 's'), 70, '...'), 'metadata_count' => $row->getVar('metadata_count', 's'));
     }
     return $result;
 }
 /**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $metadata = $this->response->getSuccess();
     $resp = new XoopsXmlRpcStruct();
     $unicode =& xoonips_getutility('unicode');
     $resp->add('id', new XoopsXmlRpcInt($metadata['id']));
     $resp->add('filetype', new XoopsXmlRpcString($metadata['filetype']));
     $resp->add('originalname', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($metadata['originalname'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
     $resp->add('size', new XoopsXmlRpcInt($metadata['size']));
     $resp->add('mimetype', new XoopsXmlRpcString($metadata['mimetype']));
     $resp->add('caption', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($metadata['caption'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
     $resp->add('thumbnail', new XoopsXmlRpcBase64($metadata['thumbnail']));
     $resp->add('registration_date', new XoopsXmlRpcDatetime($metadata['registration_date']));
     $resp->add('last_modified_date', new XoopsXmlRpcDatetime($metadata['last_modified_date']));
     $resp->add('download_count', new XoopsXmlRpcInt($metadata['download_count']));
     $resp->add('download_count_sum', new XoopsXmlRpcInt($metadata['download_count_sum']));
     return $resp;
 }
function xoonips_admin_system_check_mysql(&$category)
{
    // mysql class
    $mysqlinfo =& xoonips_getutility('mysqlinfo');
    // version
    $name = 'MySQL version';
    $res = new XooNIpsAdminSystemCheckResult($name);
    $version = $mysqlinfo->getVersion('full');
    $res->setResult(_XASC_STATUS_OK, $version, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
    $category->registerResult($res);
    unset($res);
    if ($mysqlinfo->isVersion41orHigher()) {
        $keys = array('character_set_database' => true, 'character_set_client' => false, 'character_set_connection' => false, 'character_set_results' => false);
        foreach ($keys as $key => $is_database) {
            $res = new XooNIpsAdminSystemCheckResult($key);
            $charset = $mysqlinfo->getVariable($key);
            $accept_charsets = $mysqlinfo->getAcceptableCharsets($is_database, _CHARSET);
            if (in_array($charset, $accept_charsets)) {
                $res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
            } else {
                $res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL);
                $res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets));
                $category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL);
            }
            $category->registerResult($res);
            unset($res);
        }
    } else {
        $key = 'character_set';
        $res = new XooNIpsAdminSystemCheckResult($key);
        $charset = $mysqlinfo->getVariable($key);
        $accept_charsets = $mysqlinfo->getAcceptableCharsets(true, _CHARSET);
        if (in_array($charset, $accept_charsets)) {
            $res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
        } else {
            $res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL);
            $res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets));
            $category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL);
        }
        $category->registerResult($res);
        unset($res);
    }
}
 /**
  * load and execute xoonips logic.
  *
  * @param[in] XooNIpsXmlRpcRequest $request
  * @param[out] XooNIpsXmlRpcResponse $response
  *  result of logic(success/fault, response, error)
  */
 function execute(&$request, &$response)
 {
     // load logic instance
     $factory =& XooNIpsLogicFactory::getInstance();
     $logic =& $factory->create($request->getMethodName());
     if (!is_object($logic)) {
         $response->setResult(false);
         $error =& $response->getError();
         $logic = $request->getMethodName();
         $error->add(XNPERR_SERVER_ERROR, "can't create a logic of {$logic}");
         return;
     }
     // execute logic
     $params =& $request->getParams();
     $xoonips_response = new XooNIpsResponse();
     if (count($params) < 3) {
         $response->setResult(false);
         $error =& $response->getError();
         $error->add(XNPERR_MISSING_PARAM);
         return false;
     } else {
         if (count($params) > 3) {
             $response->setResult(false);
             $error =& $response->getError();
             $error->add(XNPERR_EXTRA_PARAM);
             return false;
         }
     }
     $vars = array();
     $vars[0] = $params[0];
     $unicode =& xoonips_getutility('unicode');
     $vars[1] = array();
     foreach ($params[1] as $key => $val) {
         $vars[1][$key] = $unicode->decode_utf8($val, xoonips_get_server_charset(), 'h');
     }
     $vars[2] = $params[2];
     $logic->execute($vars, $xoonips_response);
     //
     $response->setResult($xoonips_response->getResult());
     $response->setError($xoonips_response->getError());
     $response->setSuccess($xoonips_response->getSuccess());
 }
 /**
  * 
  * @param
  * @return void
  */
 function xmlEndElementHandler($parser, $name)
 {
     global $xoopsDB;
     $binder_item_links =& $this->_import_item->getVar('binder_item_links');
     $unicode =& xoonips_getutility('unicode');
     switch (implode('/', $this->_tag_stack)) {
         case "ITEM/DETAIL":
             if (count($binder_item_links) == 0) {
                 $this->_import_item->setErrors(E_XOONIPS_TAG_NOT_FOUND, " no binder_item_link" . $this->_get_parser_error_at());
             }
             break;
         case "ITEM/DETAIL/BINDER_ITEM_LINK":
             $handler =& xoonips_getormhandler('xnpbinder', 'binder_item_link');
             $link =& $handler->create();
             $link->set('item_id', intval($unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h')));
             $binder_item_links[] =& $link;
             break;
     }
     parent::xmlEndElementHandler($parser, $name);
 }
/**
 * Smarty xoonips_escape modifier plugin
 *
 * Type:     modifier<br>
 * Name:     xoonips_escape<br>
 * Purpose:  Escape the string according to escapement type
 * @param string $text input
 * @param string $type type of escape html, xml or javascript
 * @return string
 */
function smarty_modifier_xoonips_escape($text, $type = 'html')
{
    if (!function_exists('xoonips_getutility')) {
        // return empty string if xoonips function not loaded.
        return '';
    }
    $textutil =& xoonips_getutility('text');
    switch ($type) {
        case 'html':
            $text = $textutil->html_special_chars($text);
            break;
        case 'xml':
            $text = $textutil->xml_special_chars($text, _CHARSET);
            break;
        case 'javascript':
            $text = $textutil->javascript_special_chars($text);
            break;
    }
    return $text;
}
function xoonips_get_backend()
{
    $formdata =& xoonips_getutility('formdata');
    $itemtype = $formdata->getValue('get', 'itemtype', 's', true);
    $action = $formdata->getValue('get', 'action', 's', true);
    // check item type name
    $item_type_handler =& xoonips_getormhandler('xoonips', 'item_type');
    $criteria = new CriteriaCompo(new Criteria('name', $itemtype));
    $criteria->add(new Criteria('mid', NULL, '!='));
    if ($item_type_handler->getCount($criteria) != 1) {
        die('illegal request');
    }
    // check action name
    if (!preg_match('/^[a-z][_a-z]*$/', $action)) {
        die('illegal request');
    }
    $backend = '../' . $itemtype . '/backend/' . $action . '.php';
    if (!file_exists($backend)) {
        die('illegal request');
    }
    return $backend;
}
示例#16
0
 /**
  * open file resource
  *
  * @acccess protected
  * @param string $filename file name
  */
 function _open_file($filename)
 {
     if ($this->use_antiword) {
         // for antiword
         putenv('ANTIWORDHOME=' . $this->antiwordhome);
         $cmd = sprintf('antiword -t -m UTF-8.txt %s', $filename);
         $this->handle = @popen($cmd, 'rb');
     } else {
         // for wv
         $dirutil =& xoonips_getutility('directory');
         $this->tmpfile = $dirutil->tempnam($dirutil->get_tempdir(), 'XooNIpsFileSearchPluginWord');
         $cmd = sprintf('wvText %s %s', escapeshellarg($filename), escapeshellarg($this->tmpfile));
         // set LANG to UTF-8 for wvText(elinks)
         $lang = getenv('LANG');
         putenv('LANG=en_US.UTF-8');
         // execute wvText command
         @system($cmd);
         // restore original lang
         putenv('LANG=' . ($lang === false ? '' : $lang));
         $this->handle = @fopen($this->tmpfile, 'rb');
     }
 }
 /**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $file = $this->response->getSuccess();
     $filetype_handler =& xoonips_getormhandler('xoonips', 'file_type');
     $filetype = $filetype_handler->get($file->get('file_type_id'));
     if (!$filetype) {
         return new XooNIpsXmlRpcFault(106, 'file_type not found: id=' . $file->get('file_type_id'));
     }
     if (!file_exists($file->getFilepath())) {
         return new XooNIpsXmlRpcFault(106, 'file not found: id=' . $file->get('file_type_id'));
     }
     $resp = new XoopsXmlRpcStruct();
     $resp->add('id', new XoopsXmlRpcInt($file->get('file_id')));
     $resp->add('filetype', new XoopsXmlRpcString($filetype->get('name')));
     $unicode =& xoonips_getutility('unicode');
     $resp->add('originalname', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($file->get('original_file_name'), xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
     $resp->add('size', new XoopsXmlRpcInt($file->get('file_size')));
     $resp->add('mimetype', new XoopsXmlRpcString($file->get('mime_type')));
     $resp->add('caption', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($file->get('caption'), xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
     $resp->add('thumbnail', new XoopsXmlRpcBase64($file->get('thumbnail_file')));
     $resp->add('data', new XoopsXmlRpcBase64(file_get_contents($file->getFilepath())));
     return $resp;
 }
 function getObject($array)
 {
     $obj = new XooNIpsOrmFile();
     //$file_handler=&xoonips_getormhandler('xoonips', 'file');
     //$obj=&$file_handler->create();
     //
     // filetype to file_type_id
     $file_type_handler =& xoonips_getormhandler('xoonips', 'file_type');
     $filetypes =& $file_type_handler->getObjects(new Criteria('name', $array['filetype']));
     if (!$filetypes || count($filetypes) != 1) {
         return false;
     }
     //
     //
     $unicode =& xoonips_getutility('unicode');
     $obj->assignVar('file_id', $array['id']);
     $obj->assignVar('file_type_id', $filetypes[0]->get('file_type_id'));
     $obj->assignVar('original_file_name', $unicode->decode_utf8($array['originalname'], xoonips_get_server_charset(), 'h'));
     $obj->assignVar('file_size', intval($array['size']));
     $obj->assignVar('mime_type', $array['mimetype']);
     $obj->assignVar('caption', $unicode->decode_utf8($array['caption'], xoonips_get_server_charset(), 'h'));
     $obj->assignVar('thumbnail_file', $array['thumbnail']);
     return $obj;
 }
 function doAction()
 {
     global $xoopsUser;
     // get item_id
     $item_id = $this->_formdata->getValue('get', 'item_id', 'i', false);
     // permission check
     $item_compo_handler =& xoonips_getormcompohandler('xoonips', 'item');
     if (!$item_compo_handler->getPerm($item_id, $xoopsUser->getVar('uid'), 'read')) {
         $this->show_no_permission_error_page();
     }
     // get item_info_compo of $item_id
     $item_basic_handler =& xoonips_getormhandler('xoonips', 'item_basic');
     $item_basic = $item_basic_handler->get($item_id);
     $item_type_handler =& xoonips_getormhandler('xoonips', 'item_type');
     $item_type = $item_type_handler->get($item_basic->get('item_type_id'));
     $info_compo_handler =& xoonips_getormcompohandler($item_type->get('name'), 'item');
     $info_compo = $info_compo_handler->get($item_id);
     // read language file of item
     $langman =& xoonips_getutility('languagemanager');
     $langman->read('main.php', $item_type->get('name'));
     // set params
     $this->_view_params['template_file_name'] = $info_compo_handler->getTemplateFileName(XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL);
     $this->_view_params['template_vars'] = $info_compo_handler->getTemplateVar(XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL, $item_id, $xoopsUser->getVar('uid'));
 }
 /**
  * 
  * @param
  * @return void
  */
 function xmlEndElementHandler($parser, $name)
 {
     global $xoopsDB;
     $detail =& $this->_import_item->getVar('detail');
     $unicode =& xoonips_getutility('unicode');
     switch (implode('/', $this->_tag_stack)) {
         case "ITEM/DETAIL":
             foreach (array('model_type', 'rights', 'readme', 'use_cc', 'cc_commercial_use', 'cc_modification') as $key) {
                 if (is_null($detail->get($key, 'n'))) {
                     $this->_import_item->setErrors(E_XOONIPS_TAG_NOT_FOUND, " no {$key}" . $this->_get_parser_error_at());
                 }
             }
             //error if no creators
             if (count($this->_import_item->getVar('creator')) == 0) {
                 $this->_import_item->setErrors(E_XOONIPS_TAG_NOT_FOUND, " no creator" . $this->_get_parser_error_at());
             }
             break;
         case "ITEM/DETAIL/MODEL_TYPE":
         case "ITEM/DETAIL/RIGHTS":
         case "ITEM/DETAIL/README":
         case "ITEM/DETAIL/USE_CC":
         case "ITEM/DETAIL/CC_MODIFICATION":
         case "ITEM/DETAIL/CC_COMMERCIAL_USE":
             $detail->set(strtolower(end($this->_tag_stack)), $unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h'), true);
             break;
         case 'ITEM/DETAIL/CREATORS/CREATOR':
             if ($this->_detail_version != '1.03') {
                 break;
             }
             $creators =& $this->_import_item->getVar('creator');
             $creator_handler =& xoonips_getormhandler('xnpmodel', 'creator');
             $creator =& $creator_handler->create();
             $creator->set('creator', $unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h'));
             $creator->set('creator_order', count($creators));
             $creators[] = $creator;
             break;
         case "ITEM/DETAIL/CREATOR":
             if ($this->_detail_version != '1.00' && $this->_detail_version != '1.01' && $this->_detail_version != '1.02') {
                 //<creator> is only for 1.00, 1.01 and 1.02
                 break;
             }
             $creator_handler =& xoonips_getormhandler('xnpmodel', 'creator');
             $creators =& $this->_import_item->getVar('creator');
             $creator =& $creator_handler->create();
             $creator->set('creator', trim($unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h')));
             $creator->set('creator_order', 0);
             $creators[0] = $creator;
             break;
         case "ITEM/DETAIL/ATTACHMENT_DL_LIMIT":
             if ($this->_attachment_dl_limit_flag) {
                 $this->_import_item->setErrors(E_XOONIPS_TAG_REDUNDANT, "attachment_dl_limit is redundant" . $this->_get_parser_error_at());
             } else {
                 if (ctype_digit($this->_cdata)) {
                     $detail->set('attachment_dl_limit', intval($this->_cdata));
                     $this->_attachment_dl_limit_flag = true;
                 } else {
                     $this->_import_item->setErrors(E_XOONIPS_INVALID_VALUE, "invalid value(" . $this->_cdata . ") of attachment_dl_limit" . $this->_get_parser_error_at());
                 }
             }
             break;
         case "ITEM/DETAIL/ATTACHMENT_DL_NOTIFY":
             if ($this->_attachment_dl_notify_limit_flag) {
                 $this->_import_item->setErrors(E_XOONIPS_TAG_REDUNDANT, "attachment_dl_notify is redundant" . $this->_get_parser_error_at());
             } else {
                 if (ctype_digit($this->_cdata)) {
                     $detail->set('attachment_dl_notify', intval($this->_cdata));
                     $this->_attachment_dl_notify_limit_flag = true;
                 } else {
                     $this->_import_item->setErrors(E_XOONIPS_INVALID_VALUE, "invalid value(" . $this->_cdata . ") of attachment_dl_notify" . $this->_get_parser_error_at());
                 }
             }
             break;
         case "ITEM/DETAIL/FILE":
             $file_handler =& xoonips_getormhandler('xoonips', 'file');
             if ($this->_file_type_attribute == 'model_data') {
                 $this->_model_data_flag = true;
                 if (!$file_handler->insert($this->_model_data)) {
                     global $xoopsDB;
                     $this->_import_item->setErrors(E_XOONIPS_DB_QUERY, "can't insert attachment file:" . $this->_model_data->get('original_file_name') . $this->_get_parser_error_at());
                     trigger_error($xoopsDB->error());
                 }
                 $this->_model_data = $file_handler->get($this->_model_data->get('file_id'));
                 $this->_import_item->setVar('model_data', $this->_model_data);
                 $this->_import_item->setHasModelData();
                 $this->_file_type_attribute = null;
             } else {
                 if ($this->_file_type_attribute == 'preview') {
                     $this->_preview_flag = true;
                     if (!$file_handler->insert($this->_preview)) {
                         $this->_import_item->setErrors(E_XOONIPS_DB_QUERY, "can't insert attachment file:" . $this->_preview->get('original_file_name') . $this->_get_parser_error_at());
                     }
                     $this->_preview = $file_handler->get($this->_preview->get('file_id'));
                     $previews =& $this->_import_item->getVar('preview');
                     $previews[] = $this->_preview;
                     $this->_import_item->setHasPreview();
                     $this->_file_type_attribute = null;
                 } else {
                     die('unknown file type:' . $this->_file_type_attribute);
                 }
             }
             break;
         case 'ITEM/DETAIL/FILE/CAPTION':
             if ($this->_file_type_attribute == 'model_data') {
                 $this->_model_data->set('caption', $unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h'));
             } else {
                 if ($this->_file_type_attribute == 'preview') {
                     $this->_preview->set('caption', $unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h'));
                 }
             }
             break;
             break;
         case 'ITEM/DETAIL/FILE/THUMBNAIL':
             if ($this->_file_type_attribute == 'model_data') {
                 $this->_model_data->set('thumbnail_file', base64_decode($this->_cdata));
             } else {
                 if ($this->_file_type_attribute == 'preview') {
                     $this->_preview->set('thumbnail_file', base64_decode($this->_cdata));
                 }
             }
             break;
     }
     parent::xmlEndElementHandler($parser, $name);
 }
//  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';
        if (empty($error)) {
            redirect_header('showusers.php?uid=' . $uid, 0, _US_PROFUPDATED);
        } else {
            include XOOPS_ROOT_PATH . '/header.php';
            echo $error;
            include XOOPS_ROOT_PATH . '/footer.php';
        }
        exit;
    }
}
if ($op == 'editprofile') {
    include_once XOOPS_ROOT_PATH . '/header.php';
    include_once XOOPS_ROOT_PATH . '/include/xoopscodes.php';
    include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
    // RMV-NOTIFY
    $langman =& xoonips_getutility('languagemanager');
    $langman->read_pagetype('notification.php');
    include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
    // required mark, and required flag
    $required = array();
    foreach ($xconfig_keys as $key => $label) {
        if ($xconfig_vars[$key] != 'on') {
            $required[$key]['mark'] = _MD_XOONIPS_ACCOUNT_REQUIRED_MARK;
            $required[$key]['flag'] = true;
        } else {
            $required[$key]['mark'] = '';
            $required[$key]['flag'] = false;
        }
    }
    // TODO: check pankuzu
    echo '<p>';
    if ($error != 0) {
        if ($error == UPLOAD_ERR_INI_SIZE) {
            $errorMessage = _MD_XOONIPS_ITEM_UPLOAD_FILE_TOO_LARGE;
        } else {
            $errorMessage = _MD_XOONIPS_ITEM_UPLOAD_FILE_FAILED;
        }
        $getTextFromOpener = true;
    } else {
        // check mime type
        if (strstr($mimeType, 'text/plain') === false) {
            $errorMessage = 'unsupported file type : ' . $mimeType;
            $getTextFromOpener = true;
        } else {
            $text = file_get_contents($fileName);
            // convert encoding to _CHARSET
            $unicode =& xoonips_getutility('unicode');
            $text = $unicode->convert_encoding($text, _CHARSET, 'h');
            $getTextFromOpener = false;
        }
    }
} else {
    $getTextFromOpener = true;
}
xoops_header(false);
?>
</head>
<body <?php 
if ($getTextFromOpener) {
    echo 'onload="getTextFromOpener()"';
}
?>
 /**
  * return template variables of item
  * 
  * @param string $type defined symbol 
  *  XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL
  *  , XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_LIST
  *  , XOONIPS_TEMPLATE_TYPE_ITEM_DETAIL
  *  or XOONIPS_TEMPLATE_TYPE_ITEM_LIST
  * @param int $item_id
  * @param int $uid user id who get item
  * @return array of template variables
  */
 function getTemplateVar($type, $item_id, $uid)
 {
     $model =& $this->get($item_id);
     if (!is_object($model)) {
         return array();
     }
     $result = $this->getBasicTemplateVar($type, $model, $uid);
     $textutil =& xoonips_getutility('text');
     $detail =& $model->getVar('detail');
     switch ($type) {
         case XOONIPS_TEMPLATE_TYPE_ITEM_LIST:
             $result['creator'] = array();
             foreach ($model->getVar('creator') as $creator) {
                 $result['creator'][] = $creator->getVarArray('s');
             }
             return $result;
         case XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL:
         case XOONIPS_TEMPLATE_TYPE_ITEM_DETAIL:
         case XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_LIST:
             $result['xnpmodel_creator'] = xoonips_get_multiple_field_template_vars($detail->getCreators(), 'xnpmodel', 'creator');
             $result['detail'] = $detail->getVarArray('s');
             $result['detail']['model_type'] = $textutil->html_special_chars($this->get_model_type_label($detail->getVar('model_type', 's')));
             $result['detail']['model_type_value'] = $detail->getVar('model_type', 's');
             if ($detail->getVar('use_cc', 'n')) {
                 $result['detail']['rights'] = $detail->getVar('rights', 'n');
             }
             if (is_array($model->getVar('preview'))) {
                 $result['detail']['previews'] = array();
                 foreach ($model->getVar('preview') as $preview) {
                     $result['detail']['previews'][] = $this->getPreviewTemplateVar($preview);
                 }
             }
             $model_data = $model->getVar('model_data');
             if ($model_data->get('item_id') == $item_id) {
                 $result['detail']['model_data'] = $this->getAttachmentTemplateVar($model->getVar('model_data'));
             }
             return $result;
     }
     return $result;
 }
示例#25
0
function xnpbookGetModifiedFields($item_id)
{
    $ret = array();
    $detail = xnpbookGetDetailInformation($item_id);
    $formdata =& xoonips_getutility('formdata');
    if ($detail) {
        foreach (array('editor' => _MD_XNPBOOK_EDITOR_LABEL, 'publisher' => _MD_XNPBOOK_PUBLISHER_LABEL, 'isbn' => _MD_XNPBOOK_ISBN_LABEL, 'url' => _MD_XNPBOOK_URL_LABEL) as $k => $v) {
            $tmp = $formdata->getValue('post', $k, 's', false);
            if (!array_key_exists($k, $detail) || $tmp === NULL) {
                continue;
            }
            if ($detail[$k]['value'] != $tmp) {
                array_push($ret, $v);
            }
        }
        // was pdf file modified?
        if (xnpIsAttachmentModified('book_pdf', $item_id)) {
            array_push($ret, _MD_XNPBOOK_PDF_LABEL);
        }
        $formdata =& xoonips_getutility('formdata');
        $author_handler =& xoonips_getormhandler('xnpbook', 'author');
        $author_objs =& $formdata->getObjectArray('post', $author_handler->getTableName(), $author_handler, false);
        $detail_handler =& xoonips_getormhandler('xnpbook', 'item_detail');
        $detail_orm =& $detail_handler->get($item_id);
        $author_old_objs =& $detail_orm->getAuthors();
        if (!xoonips_is_same_objects($author_old_objs, $author_objs)) {
            array_push($ret, _MD_XNPBOOK_AUTHOR_LABEL);
        }
    }
    return $ret;
}
示例#26
0
/**
 * get indexes by searche criteria
 *
 * @param cond condition of SQL. if zero is not used.
 *  it can uses tx(index), ti(item), tlink(group_user_link) for table names
 * @param uid  user id
 * @param indexes returened indexes
 * @param criteriaString order,limit part of SQL
 * @return bool RES_OK if success
 *
 */
function _xnpal_getIndexesInternal($sess_id, $cond, $uid, &$indexes, $criteriaString)
{
    global $xoopsDB;
    $groupTable = $xoopsDB->prefix("xoonips_groups");
    $groupUserLinkTable = $xoopsDB->prefix("xoonips_groups_users_link");
    $indexTable = $xoopsDB->prefix("xoonips_index");
    $itemTable = $xoopsDB->prefix("xoonips_item_basic");
    $titleTable = $xoopsDB->prefix("xoonips_item_title");
    if ($cond == false) {
        $cond = " 1 ";
    }
    $accessRightCond = "1";
    if (!xnp_is_moderator($sess_id, $uid)) {
        $accessRightCond = " (  tx.open_level=1 " . " OR tx.open_level=2 AND tlink.uid is not NULL AND tx.gid != " . GID_DEFAULT . " OR tx.open_level=3 AND tx.uid = {$uid} )";
    }
    // アクセス権を表すSQL
    $sql = "SELECT tx.index_id as item_id, tx.parent_index_id, tx.uid, tx.gid, tx.open_level, tx.sort_number " . " , ti.item_type_id, ti.creation_date, ti.uid, ti.description, ti.last_update_date, tt.title as title " . " FROM      {$titleTable} as tt, " . " {$indexTable}  AS tx " . " LEFT JOIN {$itemTable}   AS ti on tx.index_id = ti.item_id " . " LEFT JOIN {$groupUserLinkTable}  AS tlink on tlink.gid = tx.gid and tlink.uid = {$uid} " . " LEFT JOIN {$groupTable}  AS tg on tx.gid = tg.gid " . " WHERE {$accessRightCond} AND ( tx.open_level != 2 OR tx.open_level = 2 AND tg.gid IS NOT NULL ) " . " AND tt.title_id=" . DEFAULT_ORDER_TITLE_OFFSET . " AND tt.item_id=ti.item_id" . " AND {$cond} {$criteriaString}";
    $result = $xoopsDB->query($sql);
    if (!$result) {
        _xnpal_setLastErrorString("error in _xnpal_getIndexesInternal " . $xoopsDB->error() . " sql={$sql}" . " at " . __LINE__ . " in " . __FILE__ . "\n" . xnp_get_last_error_string());
        return RES_DB_QUERY_ERROR;
    }
    $index_buf = array();
    $orderd_ids = array();
    //array of sorted item_id(s) to sort $index_buf in the end of this function
    while (list($index_id, $parent_index_id, $owner_uid, $gid, $open_level, $sort_number, $item_type_id, $creation_date, $contributor_uid, $description, $last_update_date) = $xoopsDB->fetchRow($result)) {
        $index = array('item_id' => $index_id, 'parent_index_id' => $parent_index_id, 'owner_uid' => $owner_uid == NULL ? 0 : $owner_uid, 'owner_gid' => $gid == NULL ? 0 : $gid, 'open_level' => $open_level, 'sort_number' => $sort_number, 'item_type_id' => $item_type_id, 'creation_date' => $creation_date, 'contributor_uid' => $contributor_uid, 'titles' => array(), 'keywords' => array(), 'description' => $description, 'last_update_date' => $last_update_date);
        $index_buf[$index_id] = $index;
        $orderd_ids[] = $index_id;
    }
    if (count($index_buf) > 0) {
        //get titles of selected item
        $sql = "SELECT item_id, title FROM " . $xoopsDB->prefix("xoonips_item_title") . " WHERE item_id IN ( " . implode(",", array_keys($index_buf)) . " ) ORDER BY item_id ASC, title_id ASC";
        $result = $xoopsDB->query($sql);
        if (!$result) {
            _xnpal_setLastErrorString("error in _xnpal_getIndexesInternal " . $xoopsDB->error() . " sql={$sql}" . " at " . __LINE__ . " in " . __FILE__ . "\n" . xnp_get_last_error_string());
            return RES_DB_QUERY_ERROR;
        }
        while ($row = $xoopsDB->fetchArray($result)) {
            $index_buf[$row['item_id']]['titles'][] = $row['title'];
        }
        $textutil =& xoonips_getutility('text');
        foreach ($index_buf as $k => $index) {
            // rename to "Private" if owwner_uid of index == $uid
            if ($index['parent_index_id'] == IID_ROOT && $index['open_level'] == OL_PRIVATE && $index['owner_uid'] == $uid) {
                $index_buf[$k]['titles'][DEFAULT_INDEX_TITLE_OFFSET] = XNP_PRIVATE_INDEX_TITLE;
            }
            $index_buf[$k]['html_title'] = $textutil->html_special_chars($index_buf[$k]['titles'][DEFAULT_INDEX_TITLE_OFFSET]);
        }
        //get keywords of selected item
        $sql = "SELECT item_id, keyword FROM " . $xoopsDB->prefix("xoonips_item_keyword") . " WHERE item_id IN ( " . implode(",", array_keys($index_buf)) . " ) ORDER BY item_id ASC, keyword_id ASC";
        $result = $xoopsDB->query($sql);
        if (!$result) {
            _xnpal_setLastErrorString("error in _xnpal_getIndexesInternal " . $xoopsDB->error() . " sql={$sql}" . " at " . __LINE__ . " in " . __FILE__ . "\n" . xnp_get_last_error_string());
            return RES_DB_QUERY_ERROR;
        }
        while ($row = $xoopsDB->fetchArray($result)) {
            $index_buf[$row['item_id']]['keywords'][] = $row['keyword'];
        }
    }
    // convert the associative array(index_buf) to the array(indexes) (keep order specified by criteriaString)
    foreach ($orderd_ids as $id) {
        $indexes[] = $index_buf[$id];
    }
    _xnpal_setLastErrorString("");
    return RES_OK;
}
 /**
  * return template variables of item
  * 
  * @param string $type defined symbol 
  *  XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL
  *  , XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_LIST
  *  , XOONIPS_TEMPLATE_TYPE_ITEM_DETAIL
  *  or XOONIPS_TEMPLATE_TYPE_ITEM_LIST
  * @param int $item_id
  * @param int $uid user id who get item
  * @return array of template variables
  */
 function getTemplateVar($type, $item_id, $uid)
 {
     $conference =& $this->get($item_id);
     if (!is_object($conference)) {
         return array();
     }
     $result = $this->getBasicTemplateVar($type, $conference, $uid);
     $textutil =& xoonips_getutility('text');
     $detail =& $conference->getVar('detail');
     switch ($type) {
         case XOONIPS_TEMPLATE_TYPE_ITEM_LIST:
             $result['author'] = array();
             foreach ($conference->getVar('author') as $author) {
                 $result['author'][] = $author->getVarArray('s');
             }
             $result['detail'] = $detail->getVarArray('s');
             $result['detail']['presentation_type'] = $this->get_presentation_type_label($detail->get('presentation_type'));
             return $result;
         case XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL:
         case XOONIPS_TEMPLATE_TYPE_ITEM_DETAIL:
         case XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_LIST:
             $result['xnpconference_author'] = xoonips_get_multiple_field_template_vars($detail->getAuthors(), 'xnpconference', 'author');
             $result['detail'] = $detail->getVarArray('s');
             $result['detail']['presentation_type'] = $textutil->html_special_chars($this->get_presentation_type_label($detail->get('presentation_type')));
             $result['detail']['presentation_type_value'] = $detail->get('presentation_type', 's');
             $tmp = $detail->getVar('conference_from_year', 'n');
             if (!empty($tmp)) {
                 $conference_from = date(DATE_FORMAT, mktime(0, 0, 0, $detail->getVar('conference_from_month', 'n'), $detail->getVar('conference_from_mday', 'n'), $detail->getVar('conference_from_year', 'n')));
                 $conference_to = date(DATE_FORMAT, mktime(0, 0, 0, $detail->getVar('conference_to_month', 'n'), $detail->getVar('conference_to_mday', 'n'), $detail->getVar('conference_to_year', 'n')));
             } else {
                 $conference_from = date(DATE_FORMAT, mktime(0, 0, 0, $basic['publication_month']['value'], $basic['publication_mday']['value'], $basic['publication_year']['value']));
                 $conference_to = $conference_from;
             }
             $result['detail']['conference_date'] = 'From:&nbsp;' . $conference_from . '&nbsp;&nbsp;&nbsp;To:&nbsp;' . $conference_to;
             $conference_paper = $conference->getVar('conference_paper');
             if ($conference_paper->get('item_id') == $item_id) {
                 $result['detail']['conference_paper'] = $this->getAttachmentTemplateVar($conference->getVar('conference_paper'));
             }
             $conference_file = $conference->getVar('conference_file');
             if ($conference_file->get('item_id') == $item_id) {
                 $result['detail']['conference_file'] = $this->getAttachmentTemplateVar($conference->getVar('conference_file'));
             }
             break;
     }
     return $result;
 }
示例#28
0
function xnppresentationGetModifiedFields($item_id)
{
    $formdata =& xoonips_getutility('formdata');
    $ret = array();
    $basic = xnpGetBasicInformationArray($item_id);
    if ($basic) {
        $publicationDateMonth = $formdata->getValue('post', 'publicationDateMonth', 'i', true);
        $publicationDateDay = $formdata->getValue('post', 'publicationDateDay', 'i', true);
        $publicationDateYear = $formdata->getValue('post', 'publicationDateYear', 'i', true);
        if (intval($basic['publication_month']) != intval($publicationDateMonth) || intval($basic['publication_mday']) != intval($publicationDateDay) || intval($basic['publication_year']) != intval($publicationDateYear)) {
            array_push($ret, _MD_XNPPRESENTATION_DATE_LABEL);
        }
    }
    $detail = xnppresentationGetDetailInformation($item_id);
    if ($detail) {
        foreach (array('presentation_type' => _MD_XNPPRESENTATION_PRESENTATION_TYPE_LABEL) as $k => $v) {
            $tmp = $formdata->getValue('post', $k, 's', false);
            if (!array_key_exists($k, $detail) || $tmp === NULL) {
                continue;
            }
            if ($detail[$k] != $tmp) {
                array_push($ret, $v);
            }
        }
        // is readme modified ?
        foreach (array('readme' => _MD_XOONIPS_ITEM_README_LABEL) as $k => $v) {
            $tmp = $formdata->getValue('post', "{$k}EncText", 's', true);
            if (!array_key_exists($k, $detail) || $tmp === NULL) {
                continue;
            }
            if ($detail[$k] != $tmp) {
                array_push($ret, $v);
            }
        }
        // is rights modified ?
        $rightsUseCC = $formdata->getValue('post', 'rightsUseCC', 'i', true);
        $rightsEncText = $formdata->getValue('post', 'rightsEncText', 's', true);
        if ($rightsUseCC !== NULL) {
            if ($rightsUseCC == 0) {
                if (array_key_exists('rights', $detail) && $rightsEncText != NULL && $rightsEncText != $detail['rights']) {
                    array_push($ret, _MD_XOONIPS_ITEM_RIGHTS_LABEL);
                }
            } else {
                if ($rightsUseCC == 1) {
                    foreach (array('rightsCCCommercialUse' => 'cc_commercial_use', 'rightsCCModification' => 'cc_modification') as $k => $v) {
                        $tmp = $formdata->getValue('post', $k, 'i', true);
                        if (!array_key_exists($v, $detail) || $tmp === NULL) {
                            continue;
                        }
                        if ($tmp != $detail[$v]) {
                            array_push($ret, _MD_XOONIPS_ITEM_RIGHTS_LABEL);
                            break;
                        }
                    }
                }
            }
        }
        // is modified data files ?
        if (xnpIsAttachmentModified('presentation_file', $item_id)) {
            array_push($ret, _MD_XNPPRESENTATION_PRESENTATION_FILE_LABEL);
        }
        $creator_handler =& xoonips_getormhandler('xnppresentation', 'creator');
        $creator_objs =& $formdata->getObjectArray('post', $creator_handler->getTableName(), $creator_handler, false);
        $detail_handler =& xoonips_getormhandler('xnppresentation', 'item_detail');
        $detail_orm =& $detail_handler->get($item_id);
        $creator_old_objs =& $detail_orm->getCreators();
        if (!xoonips_is_same_objects($creator_old_objs, $creator_objs)) {
            array_push($ret, _MD_XNPPRESENTATION_CREATOR_LABEL);
        }
    }
    return $ret;
}
$request_keys = array('ranking_download_file' => array('s', false, true));
$request_vals = xoonips_admin_get_requests('both', $request_keys);
$filename = $request_vals['ranking_download_file'];
if ($filename == '') {
    redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MSG_ILLACCESS);
    exit;
}
// check token ticket for pathinfo
$ticket_area = 'xoonips_admin_maintenance_ranking';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    if (!$xoopsGTicket->check(false, $ticket_area, false)) {
        redirect_header($xoonips_admin['mypage_url'], 3, $xoopsGTicket->getErrors());
        exit;
    }
}
$download =& xoonips_getutility('download');
if (!$download->check_pathinfo($filename)) {
    // reload for KHTML based browser
    $url = $xoonips_admin['mypage_url'];
    $url .= '&action=download';
    $url .= '&ranking_download_file=' . $filename;
    $url .= '&' . $xoopsGTicket->getTicketParamString(__LINE__, true, 10, $ticket_area);
    $url = $download->append_pathinfo($url, $filename);
    header('Location: ' . $url);
    exit;
}
// logic
$admin_ranking_handler =& xoonips_gethandler('xoonips', 'admin_ranking');
$zipfile_path = $admin_ranking_handler->create_sum_file();
if ($zipfile_path === false) {
    redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MAINTENANCE_RANKING_LOCKED);
示例#30
0
function xnpmodelGetModifiedFields($item_id)
{
    $ret = array();
    $formdata =& xoonips_getutility('formdata');
    $detail = xnpmodelGetDetailInformation($item_id);
    if ($detail) {
        foreach (array('model_type' => _MD_XNPMODEL_MODEL_TYPE_LABEL) as $k => $v) {
            $tmp = $formdata->getValue('post', $k, 's', false);
            if (!array_key_exists($k, $detail) || $tmp === NULL) {
                continue;
            }
            if ($detail[$k]['value'] != $tmp) {
                array_push($ret, $v);
            }
        }
        // is readme modified ?
        foreach (array('readme' => _MD_XOONIPS_ITEM_README_LABEL) as $k => $v) {
            $tmp = $formdata->getValue('post', "{$k}EncText", 's', false);
            if (!array_key_exists($k, $detail) || $tmp === NULL) {
                continue;
            }
            if ($tmp != $detail[$k]['value']) {
                array_push($ret, $v);
            }
        }
        // is rights modified ?
        $rightsUseCC = $formdata->getValue('post', 'rightsUseCC', 'i', false);
        $rightsEncText = $formdata->getValue('post', 'rightsEncText', 's', false);
        if ($rightsUseCC !== NULL) {
            if ($rightsUseCC == 0) {
                if (array_key_exists('rights', $detail) && $rightsEncText != NULL && $rightsEncText != $detail['rights']['value']) {
                    array_push($ret, _MD_XOONIPS_ITEM_RIGHTS_LABEL);
                }
            } else {
                if ($rightsUseCC == 1) {
                    foreach (array('rightsCCCommercialUse' => 'cc_commercial_use', 'rightsCCModification' => 'cc_modification') as $k => $v) {
                        $tmp = $formdata->getValue('post', $k, 'i', false);
                        if (!array_key_exists($v, $detail) || $tmp === NULL) {
                            continue;
                        }
                        if ($tmp != $detail[$v]['value']) {
                            array_push($ret, _MD_XOONIPS_ITEM_RIGHTS_LABEL);
                            break;
                        }
                    }
                }
            }
        }
        // was model file modified?
        if (xnpIsAttachmentModified('model_data', $item_id)) {
            array_push($ret, _MD_XNPMODEL_MODEL_FILE_LABEL);
        }
        $creator_handler =& xoonips_getormhandler('xnpmodel', 'creator');
        $creator_objs =& $formdata->getObjectArray('post', $creator_handler->getTableName(), $creator_handler, false);
        $detail_handler =& xoonips_getormhandler('xnpmodel', 'item_detail');
        $detail_orm =& $detail_handler->get($item_id);
        $creator_old_objs =& $detail_orm->getCreators();
        if (!xoonips_is_same_objects($creator_old_objs, $creator_objs)) {
            array_push($ret, _MD_XNPMODEL_CREATOR_LABEL);
        }
    }
    return $ret;
}