function export_xml($for_new_tplt = false, $redirect = true) { global $wgRequest, $action_url; # awc_pdie($action_url); $v = $wgRequest->getVal('ver'); if (strlen($v) > 1) { $and_ver = " AND tplt_forum_ver='{$v}'"; } else { $and_ver = null; } $r = $this->rDB->selectRow('awc_f_theme_names', array('thmn_title', 'thmn_when', 'thmn_who', 'thmn_where'), array('thmn_id' => $this->thmn_id)); $thmn_title = $r->thmn_title; $thmn_when = $r->thmn_when; $thmn_who = $r->thmn_who; $thmn_where = $r->thmn_where; $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $xml .= "<skin_tplts>\n"; $awc_f_theme_tplt = $this->rDB->tableName('awc_f_theme_tplt'); $sql = "SELECT * \n FROM {$awc_f_theme_tplt} \n WHERE tplt_thmn_id={$this->thmn_id} {$and_ver}"; # die($sql); $res = $this->rDB->query($sql); while ($r = $this->rDB->fetchObject($res)) { $when = isset($r->thmn_when) ? $r->thmn_when : $this->rDB->timestamp(); $xml .= " <tplt thmn_title=\"awc_default\" thmn_who=\"{$thmn_who}\" thmn_where=\"{$thmn_where}\" thmn_when=\"{$when}\" tplt_ver=\"{$r->tplt_ver}\" tplt_forum_ver=\"{$r->tplt_forum_ver}\">\n <tplt_section>{$r->tplt_section}</tplt_section>\n <tplt_function>{$r->tplt_function}</tplt_function>\n <tplt_code><![CDATA[{$r->tplt_code}]]></tplt_code>\n </tplt>\n"; # $xml .= " <tplt tplt_when=\"{$r->tplt_when}\" tplt_who=\"{$r->tplt_who}\"><![CDATA[".$r->tplt_code."]]></tplt>\n"; } $this->rDB->freeResult($res); $xml .= '</skin_tplts>'; if ($for_new_tplt) { return $xml; } $d = awcsforum_funcs::readabledate(wfTimestampNow()); $filename = awc_dir . "xported_files/skin_" . preg_replace("/[^a-z0-9-]/", "-", strtolower($thmn_title)) . "_" . preg_replace("/[^a-z0-9-]/", "-", strtolower($thmn_who)) . "_.xml"; if (strlen($v) > 1) { $hd = @fopen(awc_dir . "updates/{$v}/tplt.xml", "w"); } else { $hd = @fopen($filename . "", "w"); } @fwrite($hd, $xml); @fclose($hd); if ($redirect) { $info['msg'] = 'tplt_has_been_exported'; $info['url'] = awc_url . "admin/tplt/display"; return awcf_redirect($info); } return true; }
function lang_do_export_lang() { global $awcs_forum_config; $out = "<?PHP " . chr(10) . chr(10); $fields = array(); $fields[] = 'lang_txt_admin_raw'; $fields[] = 'lang_txt_mem_raw'; $fields[] = 'lang_txt_forum_raw'; $fields[] = 'lang_txt_tag_raw'; $fields[] = 'lang_txt_search_raw'; $fields[] = 'lang_txt_thread_raw'; $fields[] = 'lang_txt_redirects_raw'; $lang_info = lang_getinfo($this->lang_code, $fields); unset($fields); foreach ($lang_info as $id => $info) { if ($id != 'array_fields' and $id != 'single_fields') { foreach ($lang_info[$id] as $section => $key) { # die($section); if ($id != 'array_fields' and $id != 'single_fields' and !in_array($section, $lang_info['single_fields']) and strstr($section, '_raw')) { $section_name = str_replace('_raw', '', $section); $section_name = $section; $out .= "\${$section_name} = array( " . chr(10); foreach ($lang_info[$id][$section] as $k => $v) { $out .= "'" . $k . "' => \"" . str_replace('"', '\\"', trim($v)) . '", ' . chr(10); # $out .= "[[" . $k . " - Forum Definition|" . $k . "]] = " . str_replace('"', '\"', $v) . chr(10) . chr(10); } $out .= ");" . chr(10) . chr(10); #$out .= chr(10) . chr(10); } } } } $d = awcsforum_funcs::readabledate(wfTimestampNow()); $filename = awc_dir . "xported_files/lang_{$this->lang_code}_{$d}.txt"; $hd = @fopen($filename . "", "w"); @fwrite($hd, $out); @fclose($hd); return true; }
function export_xml($for_new_css = false, $forum_installer = false) { global $wgRequest; $v = $wgRequest->getVal('ver'); if (strlen($v) > 1) { $and_ver = " AND css_ver='{$v}'"; } else { $and_ver = null; } $dbr = wfGetDB(DB_SLAVE); $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; $awc_f_theme_names = $dbr->tableName('awc_f_theme_names'); $sql = "SELECT * FROM {$awc_f_theme_names} WHERE thmn_id={$this->css_id} {$and_ver}"; $res = $dbr->query($sql); $r = $dbr->fetchObject($res); $dbr->freeResult($res); $css_who = $r->thmn_who; $title = htmlentities($r->thmn_title, ENT_QUOTES, 'UTF-8'); //$css_ver = '1.0.0'; $css_name_count = $r->thmn_item_count; $where = $r->thmn_where; $who = htmlentities($r->thmn_who, ENT_QUOTES, 'UTF-8'); if ($for_new_css) { # awc_pdie($wgRequest); $who = $wgRequest->getVal('css_who'); $where = $wgRequest->getVal('css_where'); $title = $wgRequest->getVal('css_title'); } $xml .= "<style title=\"{$title}\" css_ver=\"1.0.0\" who=\"{$who}\" where=\"{$where}\" count=\"{$css_name_count}\">\n"; $awc_f_theme_css = $dbr->tableName('awc_f_theme_css'); $sql = "SELECT css_id, css_section, css_ver, css_att, css_code, css_custom, css_forumver, css_date \r\r\n FROM {$awc_f_theme_css} \r\r\n WHERE css_thmn_id={$this->css_id} ORDER BY css_custom DESC"; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { $xml .= "\t <css css_section=\"{$r->css_section}\" custom=\"{$r->css_custom}\" css_att=\"" . htmlentities($r->css_att, ENT_QUOTES, 'UTF-8') . "\" css_ver=\"{$r->css_ver}\" forum_ver=\"{$r->css_forumver}\" css_date=\"" . awcsforum_funcs::wikidate($r->css_date) . "\">" . htmlentities($r->css_code, ENT_QUOTES, 'UTF-8') . "</css>\n"; #$css[$r->css_section][$r->css_id] = array($r->css_att, $r->css_code, $r->css_ver, $r->css_custom, $r->css_forumver); } $dbr->freeResult($res); /** foreach($css as $group_name => $group_info){ $xml .= " <css_group name=\"$group_name\">\n"; foreach($group_info as $info){ if($forum_installer){ $dateis = wfTimestampNow() ; } else { $dateis = awcsforum_funcs::wikidate($info[5]); } #$xml .= " <template css_att=\"".str_replace('"', '\"', $info[0])."\" forum_ver=\"{$info[2]}\">{$info[1]}</template>\n"; $xml .= " <css custom=\"{$info[3]}\" css_att=\"".htmlentities($info[0], ENT_QUOTES, 'UTF-8')."\" css_ver=\"{$info[2]}\" forum_ver=\"{$info[4]}\" css_date=\"{$dateis}\">".htmlentities($info[1], ENT_QUOTES, 'UTF-8')."</css>\n"; } $xml .= " </css_group>\n\n"; } */ $xml .= '</style>'; if ($forum_installer) { return $xml; } if ($for_new_css) { return $xml; } $d = awcsforum_funcs::readabledate(wfTimestampNow()); $filename = awc_dir . "xported_files/css_" . preg_replace("/[^a-z0-9-]/", "-", strtolower($title)) . "_" . preg_replace("/[^a-z0-9-]/", "-", strtolower($who)) . "_{$css_ver}.xml"; if (strlen($v) > 1) { $hd = @fopen(awc_dir . "updates/{$v}/css.xml", "w"); } else { $hd = @fopen($filename . "", "w"); } @fwrite($hd, $xml); @fclose($hd); return true; }