示例#1
0
文件: backend.php 项目: deltas1/icms1
?>
: </strong></td>
            <td valign="top">
                <select name="search_engine" style="width:245px">
                    <option value="" <?php 
if (!$model->config['search_engine']) {
    ?>
selected="selected"<?php 
}
?>
><?php 
echo $_LANG['AD_NATIVE'];
?>
</option>
                    <?php 
$provider_array = getProvidersList();
if ($provider_array) {
    foreach ($provider_array as $provider) {
        ?>
                    	<option value="<?php 
        echo $provider;
        ?>
" <?php 
        if ($model->config['search_engine'] == $provider) {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $provider;
        ?>
示例#2
0
}
cmsCore::loadModel('search');
$model = cms_model_search::initModel();
$opt = cmsCore::request('opt', 'str', '');
$toolmenu = array(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.optform.submit();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => '?view=components'));
cpToolMenu($toolmenu);
if ($opt == 'save') {
    if (!cmsUser::checkCsrfToken()) {
        cmsCore::error404();
    }
    $cfg = array();
    $cfg['perpage'] = cmsCore::request('perpage', 'int', 15);
    $cfg['comp'] = cmsCore::request('comp', 'array_str');
    $cfg['search_engine'] = preg_replace('/[^a-z_]/i', '', cmsCore::request('search_engine', 'str', ''));
    if ($model->config['search_engine'] && class_exists($model->config['search_engine']) && method_exists($model->config['search_engine'], 'getProviderConfig')) {
        foreach ($model->getProviderConfig() as $key => $value) {
            $cfg[$model->config['search_engine']][$value] = cmsCore::request($value, 'str', '');
        }
    }
    $inCore->saveComponentConfig('search', $cfg);
    cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
    cmsCore::redirectBack();
}
if ($opt == 'dropcache') {
    $model->truncateResults();
}
$tpl = cmsCore::c('page')->initTemplate('components', 'search_config')->assign('provider_array', getProvidersList())->assign('components', $model->components)->assign('records', cmsCore::c('db')->rows_count('cms_search', '1=1'))->assign('cfg', $model->config);
if ($cfg['search_engine'] && class_exists($cfg['search_engine']) && method_exists($cfg['search_engine'], 'getProviderConfig')) {
    $tpl->assign('provider_config', $model->getProviderConfig());
}
$tpl->display();