Пример #1
0
function awcs_forum_admin_tplt($action)
{
    global $wgRequest, $action_url;
    $tplt_cls = new awc_admin_tplt_cls();
    $tplt_cls->tplt_id = 1;
    $tplt_cls->thm_id = 0;
    $spl = explode("/", $action);
    $todo = $spl[2];
    $tplt_cls->id = $spl[3];
    if ($tplt_cls->id == '' || !is_numeric($tplt_cls->id)) {
        $tplt_cls->id = $wgRequest->getVal('id');
    }
    $tplt_cls->tplt_what = $wgRequest->getVal('what');
    $tplt_cls->todo2 = $wgRequest->getVal('todo2');
    if ($tplt_cls->todo2 == null) {
        $tplt_cls->todo2 = $spl[3];
    }
    if ($todo != 'display') {
        Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'admin/tplt/display">' . get_awcsforum_word('admin_edittplt') . '</a>');
    } else {
        Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_edittplt'));
    }
    switch ($todo) {
        case 'save_func':
            $tplt_cls->save_func();
            break;
        case 'show_func':
            $tplt_cls->show_func();
            break;
        case 'show_section':
            $tplt_cls->section = $wgRequest->getVal('tplt_section');
            $tplt_cls->show_section();
            break;
        case 'export_xml':
            $tplt_cls->export_xml();
            break;
        case 'import_xml':
            $tplt_cls->import_xml();
            break;
        case 'update_tplt':
            $tplt_cls->update_tplt();
            break;
        case 'search':
            $tplt_cls->search();
            break;
        case 'find_and_replace':
            $tplt_cls->find_and_replace();
            break;
        case 'search_version':
            $tplt_cls->search_version();
            break;
        case 'tplt_delete':
            $tplt_cls->delete_all_tplt();
            break;
        case 'set_default':
            $tplt_cls->set_default();
            break;
        default:
            $tplt_cls->show_sections_list();
            break;
    }
}
$sql = $installCLS->clearTable($tbl);
$res = $dbw->query($sql);
$dbw->commit();
$dbw->begin();
/*  $dbw->nextSequenceValue( 'awc_f_TABLE_COL-ID_seq' );
 *  Needed for PostgreSQL
 */
#$thm_id = $dbw->nextSequenceValue( 'awc_f_theme_thm_id_seq' );
$dbw->insert('awc_f_theme', array('thm_title' => 'Default', 'thm_who' => 'AWC', 'thm_css_id' => '1', 'thm_tplt_id' => '2', 'thm_where' => 'wiki.anotherwebcom.com', 'thm_when' => $date_seperated), __METHOD__);
$thm_id = awcsforum_funcs::lastID($dbw, 'awc_f_theme', 'thm_id');
#print(">>thm_id= $thm_id <br>");
$css_cls->thm_id = $thm_id;
$css_cls->css_import($awc_install_dir . 'css.xml', '', true);
$wgOut->addHTML("CSS added... <hr>");
$tplt_cls->thm_id = $thm_id;
$tplt_cls->import_xml($awc_install_dir . 'tplt.xml', null, false, true);
$wgOut->addHTML("Skin Templates added... <hr>");
$res = $dbr->select('awc_f_theme_names', array('*'), '', __METHOD__, array('OFFSET' => '0', 'LIMIT' => '2'));
foreach ($res as $r) {
    if ($r->thmn_what == 'css') {
        $css_id = $r->thmn_id;
        $css_thmn_item_count = $r->thmn_item_count;
        $css_thmn_who = $r->thmn_who;
        $css_thmn_where = $r->thmn_where;
    }
    if ($r->thmn_what == 'tplt') {
        $tplt_id = $r->thmn_id;
    }
}
/*
 * CRAP - find better way