Ejemplo n.º 1
0
 function write_css()
 {
     global $awcs_forum_config;
     require awc_dir . 'includes/admin/admin_css_funk.php';
     $css_cls = new awc_admin_css_cls();
     $css_cls->css_id = $awcs_forum_config->cf_css_default;
     $out = $css_cls->export_xml(false, true);
     self::write_file('css.xml', $out);
 }
 function css_import($for_new_css = false, $xml_string = null, $fresh_install = false)
 {
     global $wgRequest, $awcs_forum_config;
     if (!$for_new_css) {
         if ($_FILES["new_css_file"]["error"] == '0') {
             $css_Path = $_FILES["new_css_file"]["tmp_name"];
             // $css_name = $_FILES["new_css_file"]["name"] ;
             $css_type = $_FILES["new_css_file"]["type"];
         } else {
             return awcs_forum_error('word_cssfile');
         }
         if (!file_exists($css_Path)) {
             return awcs_forum_error('word_cssfile');
         }
         if ($css_type != 'text/xml') {
             return awcs_forum_error('word_cssfile');
         }
     }
     if (!$for_new_css) {
         $css = simplexml_load_file($css_Path);
     } else {
         $css = simplexml_load_string($xml_string);
     }
     if ($fresh_install) {
         $css = simplexml_load_file($for_new_css);
     }
     $css_info = $css->attributes();
     $title = html_entity_decode($css_info['title'], ENT_QUOTES, 'UTF-8');
     $css_ver = $css_info['css_ver'];
     $who = html_entity_decode($css_info['who'], ENT_QUOTES, 'UTF-8');
     $where = html_entity_decode($css_info['where'], ENT_QUOTES, 'UTF-8');
     $css_name_count = html_entity_decode($css_info['count'], ENT_QUOTES, 'UTF-8');
     $info = array('who' => $who, 'where' => $where);
     $dbw = wfGetDB(DB_MASTER);
     # $theme_names_CSS_id = $dbw->nextSequenceValue( 'awc_f_theme_names_thmn_id_seq' );
     $dbw->insert('awc_f_theme_names', array('thmn_title' => $title, 'thmn_when' => $dbw->timestamp(), 'thmn_who' => $who, 'thmn_what' => 'css', 'thmn_where' => $where, 'thmn_item_count' => $css_name_count));
     $theme_names_CSS_id = awcsforum_funcs::lastID($dbw, 'awc_f_theme_names', 'thmn_id');
     # print('>thmn_css_id=' . $theme_names_CSS_id . '<br>');
     $css_code_count = 0;
     foreach ($css as $obj) {
         $att_attributes = $obj->attributes();
         $css_section = $att_attributes['css_section'];
         $css_att = $att_attributes['css_att'];
         $css_att = html_entity_decode($css_att, ENT_QUOTES, 'UTF-8');
         $css_forumver = $att_attributes['forum_ver'];
         $css_ver = $att_attributes['css_ver'];
         $css_custom = $att_attributes['custom'];
         $css_date = $att_attributes['css_date'];
         $css_code = html_entity_decode($obj, ENT_QUOTES, 'UTF-8');
         $dbw->insert('awc_f_theme_css', array('css_section' => $css_section, 'css_att' => $css_att, 'css_thmn_id' => $theme_names_CSS_id, 'css_code' => $css_code, 'css_thm_id' => $this->thm_id, 'css_custom' => $css_custom, 'css_ver' => $css_ver, 'css_date' => $dbw->timestamp(), 'css_forumver' => $css_forumver));
     }
     if ($fresh_install) {
         $dbw->begin();
         $dbw->update('awc_f_theme', array('thm_css_id' => $theme_names_CSS_id), array('thm_id' => $this->thm_id), '');
         $dbw->commit();
     }
     if (!$fresh_install) {
         awc_admin_css_cls::add_new_values(awc_dir . "updates/{$awcs_forum_config->cf_forumversion}/css.xml");
     }
     return true;
 }
$memTitle_cls->insert_new('Just Got Here', '0');
$memTitle_cls->insert_new('Clicked A Few Times', '5');
$memTitle_cls->insert_new('Gets Around', '45');
$memTitle_cls->insert_new('Forum Regular', '175');
$memTitle_cls->insert_new('Forum Vet', '300');
global $awcs_forum_config;
#require_once( awc_dir . 'admin.php' );
$awcs_forum_config = new awcf_fake_class();
$awcs_forum_config->thmn_id = 0;
require_once awc_dir . 'includes/admin/admin_funk.php';
require_once awc_dir . 'includes/admin/admin_lang_funk.php';
require_once awc_dir . 'includes/admin/admin_css_funk.php';
require_once awc_dir . 'includes/admin/admin_tplt.php';
$lang_cls = new awc_admin_lang_cls();
$tplt_cls = new awc_admin_tplt_cls();
$css_cls = new awc_admin_css_cls();
$lang_cls->lang_code = 'en';
$lang_cls->lang_do_import_lang($awc_install_dir . 'lang.txt');
$wgOut->addHTML("Language text added... <hr>");
$tbl = $dbw->tableName('awc_f_theme_tplt');
$sql = $installCLS->clearTable($tbl);
$res = $dbw->query($sql);
$tbl = $dbw->tableName('awc_f_theme');
$sql = $installCLS->clearTable($tbl);
$res = $dbw->query($sql);
$tbl = $dbw->tableName('awc_f_theme_names');
$sql = $installCLS->clearTable($tbl);
$res = $dbw->query($sql);
$tbl = $dbw->tableName('awc_f_theme_css');
$sql = $installCLS->clearTable($tbl);
$res = $dbw->query($sql);