function import_xml($for_new_tplt = false, $xml_string = null, $redirect = true, $installer = false) { global $wgRequest, $awcs_forum_config; // $cf_them = unserialize($awcs_forum_config->cf_default_forum_theme); // cf_default_forum_theme if (!$for_new_tplt) { if ($_FILES["new_tplt_file"]["error"] == '0') { $tplt_Path = $_FILES["new_tplt_file"]["tmp_name"]; // $tplt_name = $_FILES["new_tplt_file"]["name"] ; $tplt_type = $_FILES["new_tplt_file"]["type"]; } else { return awcs_forum_error('word_tpltfile'); } if (!file_exists($tplt_Path)) { return awcs_forum_error('word_tpltfile'); } if ($tplt_type != 'text/xml') { return awcs_forum_error('word_tpltfile'); } } else { $tplt_Path = $for_new_tplt; } if (strlen($xml_string) >= 0) { $tplt = simplexml_load_file($tplt_Path); #$tplt = simplexml_load_file($tplt_Path, 'SimpleXMLElement', LIBXML_NOCDATA); } else { $tplt = simplexml_load_string($xml_string); } $t = $tplt->tplt->attributes(); #$thmn_who = html_entity_decode($t['thmn_who'], ENT_NOQUOTES, 'UTF-8'); #$thmn_where = html_entity_decode($t['thmn_where'], ENT_NOQUOTES, 'UTF-8'); #$thmn_title = html_entity_decode($t['thmn_title'], ENT_NOQUOTES, 'UTF-8'); #$thmn_when = html_entity_decode($t['thmn_when'], ENT_NOQUOTES, 'UTF-8'); $thmn_who = $t['thmn_who']; $thmn_where = $t['thmn_where']; $thmn_title = $t['thmn_title']; $thmn_when = $t['thmn_when']; // $this->wDB->delete( 'awc_f_theme_tplt', array( 'tplt_thmn_id' => $this->thmn_id ), ''); // $this->wDB->delete( 'awc_f_theme_names', array( 'thmn_id' => $this->thmn_id ), ''); if ($thmn_when == "0000.00.00") { #$thmn_when = str_replace('.', '', $thmn_when) . '000000'; $thmn_when = $this->wDB->timestamp(); } # $thmn_id = $this->wDB->nextSequenceValue( 'awc_f_theme_names_thmn_id_seq' ); $this->wDB->insert('awc_f_theme_names', array('thmn_title' => $thmn_title, 'thmn_when' => $thmn_when, 'thmn_who' => $thmn_who, 'thmn_where' => $thmn_where, 'thmn_what' => 'tplt')); $thmn_id = awcsforum_funcs::lastID($this->wDB, 'awc_f_theme_names', 'thmn_id'); # print('>thmm_tplt_id=' . $thmn_id . '<br>'); if ($installer) { $this->wDB->begin(); $this->wDB->update('awc_f_theme', array('thm_tplt_id' => $thmn_id), array('thm_id' => $this->thm_id), ''); $this->wDB->commit(); } foreach ($tplt as $code) { $info = $code->attributes(); #$tplt_ver = html_entity_decode($info['tplt_ver'], ENT_NOQUOTES, 'UTF-8'); #$tplt_forum_ver = html_entity_decode($info['tplt_forum_ver'], ENT_NOQUOTES, 'UTF-8'); #$tplt_section = html_entity_decode($code->tplt_section, ENT_NOQUOTES, 'UTF-8'); #$tplt_function= html_entity_decode($code->tplt_function, ENT_NOQUOTES, 'UTF-8'); #$tplt_code = html_entity_decode($code->tplt_code, ENT_NOQUOTES, 'UTF-8'); $tplt_ver = $info['tplt_ver']; $tplt_forum_ver = $info['tplt_forum_ver']; $tplt_section = $code->tplt_section; $tplt_function = $code->tplt_function; $tplt_code = $code->tplt_code; $this->wDB->insert('awc_f_theme_tplt', array('tplt_section' => $tplt_section, 'tplt_function' => $tplt_function, 'tplt_code' => $tplt_code, 'tplt_ver' => $tplt_ver, 'tplt_forum_ver' => $tplt_forum_ver, 'tplt_thmn_id' => $thmn_id)); # awc_pdie($code); } unset($info); if ($redirect) { $info['msg'] = 'tplt_has_been_imported'; $info['url'] = awc_url . "admin/tplt/display"; return awcf_redirect($info); } return; }
/** * Add new emotion * * @since Version 2.5.8 */ function emotions_add() { global $wgRequest, $wgOut, $awc; $dbw = wfGetDB(DB_MASTER); #$bs = $dbw->nextSequenceValue( 'awc_f_emotions_e_id_seq' ); $dbw->insert('awc_f_emotions', array('e_code' => $wgRequest->getVal('code'), 'e_pic' => $wgRequest->getVal('pic'))); $e_id = awcsforum_funcs::lastID($dbw, 'awc_f_emotions', 'e_id'); if ($_FILES["upload"]["error"] == '0') { $path = $_FILES["upload"]["tmp_name"]; $name = $_FILES["upload"]["name"]; if (@move_uploaded_file($path, awc_dir . 'images/emotions/default/' . $name)) { $dbw->update('awc_f_emotions', array('e_pic' => $name), array('e_ID' => $e_id), ''); } } $wgOut->redirect(awc_url . "admin/get_emotions"); }
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; }
function add_thread($no_redirect = false) { global $awc_tables, $ForumStat, $awcUser; $wDB = wfGetDB(DB_MASTER); $this->t_lastdate = $wDB->timestamp(); wfRunHooks('awcsforum_add_newthread', array(&$this)); // 2.5.5 #$bs = $dbw->nextSequenceValue( 'awc_f_threads_t_id_seq' ); $wDB->insert('awc_f_threads', array('t_forumid' => $this->fID, 't_name' => $this->title, 't_starter' => $this->cur_memName, 't_starterid' => $this->cur_memID, 't_date' => $this->t_lastdate, 't_lastdate' => $this->t_lastdate, 't_ann' => $this->ann, 't_pin' => $this->sticky, 't_status' => $this->lock, 't_lastuser' => $this->cur_memName, 't_lastuserid' => $this->cur_memID)); $NewTid = awcsforum_funcs::lastID($wDB, 'awc_f_threads', 't_id'); $_SESSION['awc_rActive'][$NewTid] = $NewTid; unset($_SESSION['awc_nActive'][$NewTid]); if ($this->ann) { $wDB->insert('awc_f_anns', array('ann_id' => $NewTid)); } # $bs = $dbw->nextSequenceValue( 'awc_f_posts_p_id_seq' ); $p_wiki_hidden = $wDB->timestamp(); $wDB->insert('awc_f_posts', array('p_threadid' => $NewTid, 'p_post' => $this->post, 'p_title' => $this->title, 'p_user' => $this->cur_memName, 'p_userid' => $this->cur_memID, 'p_date' => $this->t_lastdate, 'p_editdate' => $this->t_lastdate, 'p_forumid' => $this->fID, 'p_wiki_hidden' => $p_wiki_hidden, 'p_thread_start' => 1)); $newid = awcsforum_funcs::lastID($wDB, 'awc_f_posts', 'p_id'); $_SESSION['awc_rActive'][$NewTid] = $this->t_lastdate; //$_SESSION['awc_rActive'][$newid] = $newid; //unset($_SESSION['awc_nActive'][$newid]); $time_now = $wDB->timestamp(); /* $wDB->query(str_replace(' ', '', "UPDATE {$awc_tables['awc_f_threads']} t JOIN {$awc_tables['awc_f_forums']} f ON t.forum_id=f.f_id SET f.f_threads = f.f_threads + 1, f.f_lastdate = ".$this->t_lastdate.", f.f_lastuser = '******', f.f_lastuserid = ". $this->cur_memID .", f.f_lasttitle = '". $this->title ."', f.f_threadid = '". $NewTid ."', t.t_postid = '". $newid ."' WHERE t_id = $NewTid")); */ $wDB->query("UPDATE {$awc_tables['awc_f_forums']} \r\r\n SET f_threads = f_threads + 1,\r\r\n f_lastdate = '" . $time_now . "',\r\r\n f_lastuser = '******',\r\r\n f_lastuserid = " . $this->cur_memID . ",\r\r\n f_lasttitle = '" . $this->title . "',\r\r\n f_threadid = '" . $NewTid . "'\r\r\n WHERE f_id =" . $this->fID); $wDB->update('awc_f_threads', array('t_postid' => $newid), array('t_id' => $NewTid), ''); $m_topics = $this->cur_m_topics; $m_posts = $this->cur_m_posts; $name = $this->cur_memName; if ($this->cur_memID != '0') { $wDB->update('awc_f_mems', array('m_posts' => $m_posts + 1, 'm_topics' => $m_topics + 1), array('m_id' => $this->cur_memID), ''); } if ($this->cf_add_post_text_to_wiki) { require_once awc_dir . 'includes/to_wiki_dbase.php'; $ws = new awcs_forum_wikisearch_cls(); $ws->post = $this->post; $ws->tID = $NewTid; $ws->pID = $newid; $ws->title = $this->title; $ws->p_wiki_hidden = $p_wiki_hidden; $ws->add_thread(); } if (isset($ForumStat)) { $ForumStat->stat_threads(1); } //$ForumStat->stat_posts(1); // $this->tID = $NewTid ; $wDB->commit(); require_once awc_dir . 'includes/subscribe.php'; $t_subscribe = new awcs_forum_subscribe(); $t_subscribe->fID = $this->fID; $t_subscribe->tID = $NewTid; $t_subscribe->cur_memID = $this->cur_memID; $t_subscribe->subscribe = $this->subscribe; $t_subscribe->title = $this->title; $t_subscribe->post = $this->post; $t_subscribe->m_thread_subsrib = $this->m_thread_subsrib; $t_subscribe->m_forum_subsrib = $this->m_forum_subsrib; $t_subscribe->forum_or_thread = 'forum'; wfRunHooks('awcsforum_add_newthread_forum_subscribe', array(&$t_subscribe, &$this)); // 2.5.5 $t_subscribe->check_user_forum_subscribe(); if ($no_redirect) { return; } $info['msg'] = 'thread_has_been_add'; $info['url'] = awc_url . "st/id" . $NewTid; return awcf_redirect($info); }
$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); $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; }
/** Gets Members forum options * * @uses GetMemInfo * @uses get_mem_forum_options * @uses clear_session * @uses set_session * @since Version 2.5.8 */ function get_mem_forum_options($where = '') { global $awc_ver; $this->has_mem_info = true; if ($this->mId != '0') { $this->guest = false; $user = array(); $user_get = array(); $user_get[] = 'm_idname'; $user_get[] = 'm_displaysigonce'; $user_get[] = 'm_displaysig'; $user_get[] = 'm_viewaadv'; $user_get[] = 'm_posts'; $user_get[] = 'm_topics'; if (version_compare(awcs_forum_ver, '2.5.3', '>=')) { // need a check for this $user_get[] = 'm_pmunread'; // .2.5.2 $user_get[] = 'm_pmoptions'; $user_get[] = 'm_pmpop'; $user_get[] = 'm_thread_subsrib'; $user_get[] = 'm_forum_subsrib'; $user_get[] = 'm_lasthere'; $user_get[] = 'm_lasttouch'; $user_get[] = 'm_where'; $user_get[] = 'm_forumoptions'; $user_get[] = 'm_menu_options'; } $user = GetMemInfo($this->mId, $user_get, false); if ($user == 'error') { return; } if ($user['name'] == '') { # die($this->mName); /** @changeVer 2.5.8 - Added default PM options for new members*/ $dbw = wfGetDB(DB_MASTER); $dbw->insert('awc_f_mems', array('m_idname' => $this->mName, 'm_id' => $this->mId, 'm_forumoptions' => serialize($this->m_forumoptions), 'm_pmoptions' => serialize($this->m_pmoptions))); $m_id = awcsforum_funcs::lastID($dbw, 'awc_f_mems', 'm_id'); wfRunHooks('awcsforum_memAddedToDbase', array($m_id, $this)); // added 2.5.8 $sql = $dbw->selectSQLText(array('awc_f_stats'), array('*'), '', __METHOD__, array('OFFSET' => '0', 'LIMIT' => '1')); # $awc_f_stats = $dbw->tableName('awc_f_stats'); # $sql = "SELECT * FROM $awc_f_stats LIMIT 1"; $dbw->ignoreErrors(true); if ($res = $dbw->query($sql)) { $r = $dbw->fetchRow($res); $stats_id = $r['stats_id']; $stat_mems = $r['stat_mems'] + 1; $dbw->freeResult($res); unset($r); $dbw->update('awc_f_stats', array('stat_mems' => $stat_mems), array('stats_id' => $stats_id), ''); } $dbw->ignoreErrors(false); unset($m_forumoptions, $dbw, $res); self::get_mem_forum_options(); } foreach ($user as $u => $v) { $this->{$u} = $v; } unset($user, $user_get); if (!isset($awcs_forum_config->cf_save_recent_in_dabase) or $awcs_forum_config->cf_save_recent_in_dabase == '0') { // $this->m_lasthere - has already been set from dbase info, this will set for cookie info... $this->m_lasthere = isset($_COOKIE["awc_startTime"]) ? $_COOKIE["awc_startTime"] : awcsforum_funcs::wikidate(wfTimestampNow()); } // awc_pdie($this); // $awcstart = isset($_SESSION['awc_startTime']) ? $_SESSION['awc_startTime'] : null; if (!isset($_SESSION['awc_startTime']) or empty($_SESSION['awc_startTime'])) { awcsforum_funcs::clear_session(); awcsforum_funcs::set_session($this->m_lasthere); } } }
function sendpm($to_name, $title, $msg, $save_sent = false, $sendto_names = null) { global $wgUser, $wgOut, $wgPasswordSender, $IP, $awc_tables, $awcs_forum_config; // awcsforum_funcs::get_page_lang(array('lang_txt_mem')); /* if ( !file_exists($IP . '/includes/AutoLoader.php')){ require($IP . "/includes/UserMailer.php"); } */ $sender_name = $wgUser->mName; $sender_id = $wgUser->mId; $send_msg_text = false; if (isset($awcs_forum_config->cf_send_pm_body_in_email) and $awcs_forum_config->cf_send_pm_body_in_email == '1') { $send_msg_text = true; } $user_get = array(); $user_get[] = 'm_id'; $dbw = wfGetDB(DB_MASTER); $date_seperated = $dbw->timestamp(); $pm_count = null; $to_address = array(); /* set up email stuff here so its not included in the loop */ $send_title = get_awcsforum_word('mem_pm_email_newpmawaiting') . ' ' . $title; $send_body = get_awcsforum_word('mem_pm_email_newpmawaitingbody'); $send_body .= " \n" . $sender_name; $send_body .= " \n\n <a href='" . awcsforum_funcs::awcforum_url('member_options/pminbox') . "'>" . awcsforum_funcs::awcforum_url('member_options/pminbox') . "</a> \n\r\n\r"; require_once awc_dir . 'send_mail.php'; $html = true; if ($awcs_forum_config->cf_send_email_html == '0') { $html = false; } foreach ($to_name as $id => $send_to_info) { $pm_count++; if ($pm_count == 1) { #$bs = $dbw->nextSequenceValue( 'awc_f_pms_pm_id_seq' ); $dbw->insert('awc_f_pms', array('pm_title' => $title, 'pm_text' => $msg)); $pm_id = awcsforum_funcs::lastID($dbw, 'awc_f_pms', 'pm_id'); } $dbw->insert('awc_f_pms_info', array('pmi_pmid' => $pm_id, 'pmi_sender' => $sender_name, 'pmi_sender_id' => $sender_id, 'pmi_receipt_id' => $send_to_info['id'], 'pmi_receipt' => $sendto_names, 'pmi_send_date' => $date_seperated)); # $mem = GetMemInfo($id, $user_get); # if(isset($mem['name'])){ # awc_pdie($wgUser->mId); if ($send_to_info['forum_username'] != 'no_name' or $send_to_info['id'] == $wgUser->mId) { $dbw->query("UPDATE {$awc_tables['awc_f_mems']} \n SET m_pmtotal = m_pmtotal + 1,\n m_pmunread = m_pmunread + 1, \n m_pminbox = m_pminbox + 1,\n m_pmpop = '1'\n WHERE m_id =" . $send_to_info['id']); } else { $dbw->insert('awc_f_mems', array('m_id' => $send_to_info['id'], 'm_idname' => $send_to_info['name'], 'm_pmtotal' => '1', 'm_pmunread' => '1', 'm_pminbox' => '1', 'm_pmpop' => '1')); } /* @changeVer 2.5.8 */ if (isset($send_to_info['email']) && !empty($send_to_info['email']) && $send_to_info['email'] != 'no_email') { $to_address[] = new MailAddress($send_to_info['email']); if ($send_to_info['pass_pm_text'] == '1' and $send_msg_text) { $send_body .= "\n\r\n\r" . awcsforum_mailer::check_msg_len($msg, 0); } awcsforum_mailer::send_mail($to_address, $send_title, $send_body, $html); } } if ($save_sent) { $dbw->insert('awc_f_pms_info', array('pmi_pmid' => $pm_id, 'pmi_sender' => $sender_name, 'pmi_sender_id' => $sender_id, 'pmi_receipt_id' => $sender_id, 'pmi_receipt' => $sendto_names, 'pmi_send_date' => $date_seperated, 'pmi_folder_id' => '1', 'pmi_read_date' => $date_seperated, 'pmi_read' => '1')); $mem = GetMemInfo($id, $user_get); if (isset($mem['name'])) { $dbw->query("UPDATE {$awc_tables['awc_f_mems']} \n SET m_pmtotal = m_pmtotal + 1,\n m_pmsent = m_pmsent + 1\n WHERE m_id =" . $sender_id); } else { $dbw->insert('awc_f_mems', array('m_id' => $sender_id, 'm_idname' => $wgUser->mName, 'm_pmtotal' => '1', 'm_pmsent' => '1')); } } $wgOut->redirect(awc_url . 'member_options/pminbox'); }