Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- ** Monster Top List 1.4
- ** Supplied By: lord
- ** Nullification By: Zygote
- ** */
- new UserCP;
- class UserCP
- { var $session;
- var $session_return;
- var $user = array();
- function usercp()
- { global $mtl;
- $mtl->load_lang_file("usercp");
- $mtl->load_skin_file("usercp");
- $mtl->session = new Session;
- $mtl->session_return = $mtl->session->start();
- //////////////////////////////////////////////////////
- // Do not show error message for certain screens //
- //////////////////////////////////////////////////////
- $dont_show = array('00', '13','14','15','16','17'); // When not to show login screen
- if($mtl->session_return['no'] == '0' AND !in_array($mtl->input['CODE'], $dont_show))
- { $this->show_login(); }
- //////////////////////////////////////////////////////
- // Play with our session display and cookies //
- //////////////////////////////////////////////////////
- $temp_session = $mtl->session_return['no'];
- $mtl->session = "";
- if($mtl->get_cookie("session") != $temp_session) // If the Session Cookie != Session Variable...then show ?s= in the URL path...?!
- { $mtl->hidden_session = "<input type='hidden' name='s' value='{$temp_session}' />";
- $mtl->session = $temp_session;
- $mtl->sessionhtml = "s={$temp_session}&";
- }
- $this->user = $mtl->session_return['user'];
- ///////////////////////////////////////////////////////
- // If we have multi-accounts we need to instruct the //
- // user to select a site to edit. //
- //////////////////////////////////////////////////////
- $mustselect = array('02','05','11','12','18','19','28');
- if($this->user['id'] == 0 AND in_array($mtl->input['CODE'], $mustselect))
- { $output = $this->load_top(array ('title' => ' - '.$mtl->lang['error_title']));
- $output .= "<b>{$mtl->lang['error']}</b><br /><br />\n{$mtl->lang['mustselect']}";
- $output .= "<br /><br /><center><font size='3'><b><a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&CODE=22'>{$mtl->lang['selsite']}</a></b></font></center>";
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?s='.$mtl->session.'&act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['error_title'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- ///////////////////////////////////////////////////////
- // General Config (Strip sessions and create a title //
- //////////////////////////////////////////////////////
- if(count($this->user) > 1)
- { foreach($this->user as $n => $v)
- { $this->user[$n] = stripslashes($v); }
- $this->user['top'] = "<b>".str_replace("<#sitename#>", "<a href='{$mtl->config['filename']}?out={$this->user['id']}' target='_blank'>{$this->user['site_name']}</a>", str_replace("<#siteurl#>", $this->user['site_url'], $mtl->lang['currentlyediting']))."</b>";
- }
- ///////////////////////////////////////////////////////
- // Disable Account Functions if we're running plugin //
- //////////////////////////////////////////////////////
- if($mtl->config['userrow']['default'] != 1)
- { $disable = array('03','07','08','09','10','13','14','15','16','20','21');
- if(in_array($mtl->input['CODE'], $disable))
- { $mtl->output->error($mtl->lang['invalid_use']); }
- }
- ///////////////////////////////////////////////////////
- // Load the correct action //
- //////////////////////////////////////////////////////
- switch($mtl->input['CODE'])
- { case '01':
- $this->logout($temp_session);
- break;
- case '02':
- $this->show_site_settings();
- break;
- case '03':
- $this->notepad_pro();
- break;
- case '04':
- $this->overview_pro();
- break;
- case '05':
- $this->show_image();
- break;
- case '06':
- $this->image_pro();
- break;
- case '07':
- $this->change_email();
- break;
- case '08':
- $this->change_email_pro();
- break;
- case '09':
- $this->change_pw();
- break;
- case '10':
- $this->change_pw_pro();
- break;
- case '11':
- $this->show_code();
- break;
- case '12':
- $this->show_rate();
- break;
- case '13':
- $this->forget_pw_show();
- break;
- case '14':
- $this->forget_pw_email();
- break;
- case '15':
- $this->forget_pw_change();
- break;
- case '16':
- $this->forget_pw_change_pro();
- break;
- case '17':
- $this->show_hits();
- break;
- case '18':
- $this->show_posimage();
- break;
- case '19':
- $this->show_ring();
- break;
- case '20':
- $this->show_general();
- break;
- case '21':
- $this->general_pro();
- break;
- case '22':
- $this->select_site();
- break;
- case '23':
- $this->do_select();
- break;
- case '24':
- $this->add_site();
- break;
- case '25':
- $this->do_add_site();
- break;
- case '26':
- $this->del_site();
- break;
- case '27':
- $this->do_del_site();
- break;
- case '28':
- $this->show_overview();
- break;
- case '29':
- $this->show_code_contents();
- break;
- default:
- $this->show_main();
- break;
- }
- }
- function show_code_contents()
- { global $mtl, $DB;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['websitecodes']));
- $output .= "<br />";
- $output .= $mtl->lang['codeintro'];
- $output .= "<br /><br />";
- if($mtl->config['enable_img'] == 1)
- { $output .= "<b><a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&site={$this->user['id']}&CODE=18'>{$mtl->lang['image_code']}</a></b> - {$mtl->lang['image_code_desc']}<br />";
- }
- if($mtl->config["enable_votes_record"] == 1)
- { $output .= "<b><a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&site={$this->user['id']}&CODE=11'>{$mtl->lang['vote_code']}</a></b> - {$mtl->lang['vote_code_desc']}<br />";
- }
- if($mtl->config["enable_hits_record"] == 1 AND $mtl->config['enable_img'] != 1)
- { $output .= "<b><a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&site={$this->user['id']}&CODE=17'>{$mtl->lang['hits_code']}</a></b> - {$mtl->lang['hits_code_desc']}<br />";
- }
- if($mtl->config["enable_webring"] == 1)
- { $output .= "<b><a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&site={$this->user['id']}&CODE=19'>{$mtl->lang['ring_code']}</a></b> - {$mtl->lang['ring_code_desc']}<br />";
- }
- if($mtl->config["enable_rating"] == 1)
- { $output .= "<b><a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&site={$this->user['id']}&CODE=12'>{$mtl->lang['rate_code']}</a></b> - {$mtl->lang['rate_code_desc']}<br />";
- }
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['websitecodes'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['websitecodes'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function do_del_site()
- { global $mtl, $DB;
- if($mtl->config['enable_multaccts'] != 1)
- { $mtl->output->error($mtl->lang['invalid_use']); }
- if($mtl->config['site_delete'] != 1)
- { $mtl->output->error($mtl->lang['cannot_delete']); }
- if($mtl->input['check'] != 1)
- { $output = $this->load_top(array ('title' => '- '.$mtl->lang['delsite']));
- $DB->query("SELECT id,site_name FROM mtl_sites WHERE owner='{$this->user['uid']}' AND id='{$mtl->input['selectsite']}' AND a_ban!='1'");
- if($DB->count() != 1)
- { $mtl->output->error($mtl->lang['not_exist']); }
- $r = $DB->fetch_row();
- $output .= str_replace("<##site##>", $r['site_name'], $mtl->lang['areyousure']);
- $output .= "\n<br /><br />\n<b><a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&CODE=27&site={$r['id']}&check=1'>{$mtl->lang['yes']}</a>\n :: <a href='javascript:history.back(-1)'>{$mtl->lang['no']}</a></b>\n";
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['delsite'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- else
- { $DB->query("DELETE FROM mtl_sites WHERE owner='{$this->user['uid']}' AND id='{$mtl->input['site']}'");
- $DB->query("UPDATE mtl_categories SET sites=sites-1 WHERE id='{$this->user['cat']}'");
- $mtl->output->screen( array ( 'message' => $mtl->lang['site_del'], 'go' => '?'.$mtl->sessionhtml.'act=ucp' ));
- }
- }
- function del_site()
- { global $mtl, $DB;
- if($mtl->config['enable_multaccts'] != 1)
- { $mtl->output->error($mtl->lang['invalid_use']); }
- if($mtl->config['site_delete'] != 1)
- { $output = $this->load_top(array ('title' => ' - '.$mtl->lang['error_title']));
- $output .= "<b>{$mtl->lang['error']}</b><br /><br />\n{$mtl->lang['cannot_delete']}";
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['error_title'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- $count = $DB->count($DB->query("SELECT id FROM mtl_sites WHERE owner='{$this->user['uid']}'"));
- if($count == 1)
- { $mtl->output->error($mtl->lang['mustactive']); }
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['delsite']));
- $output .= "<b>{$mtl->lang['selectsitetodel']}</b><br /><br />\n";
- $output .= "<form action='{$mtl->config['filename']}' method='post'>\n<input type='hidden' name='act' value='ucp' />\n<input type='hidden' name='CODE' value='27' />\n{$mtl->hidden_session}\n";
- $DB->query("SELECT id,site_name,site_url FROM mtl_sites WHERE owner='{$this->user['uid']}' AND a_ban!='1'");
- if($DB->count() == 0)
- { $mtl->output->error($mtl->lang['nosites']); }
- while($r = $DB->fetch_row())
- { $output .= $mtl->skin->usercp->select_site($r);;
- }
- $output .= "<br /><input type='submit' value='{$mtl->lang['delsite']}' class='select' />\n</form>";
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['delsite'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function do_add_site()
- { global $mtl, $DB;
- if($mtl->config['enable_multaccts'] != 1)
- { $mtl->output->error($mtl->lang['invalid_use']); }
- if($DB->count($DB->query("SELECT id FROM mtl_sites")) > $mtl->config['reg_max'] AND $mtl->config['reg_max'] != 0)
- { $mtl->output->error($mtl->lang['regmax']); }
- $count = $DB->count($DB->query("SELECT id FROM mtl_sites WHERE owner='{$this->user['uid']}'"));
- if(($this->user['max_sites'] != 0 AND $done = 1 AND $this->user['max_sites'] <= $count) OR ($done != 1 AND $mtl->config['max_sites'] != 0 AND $mtl->config['max_sites'] <= $count))
- { $mtl->output->error($mtl->lang['maxsites']); }
- if(strlen($mtl->input['site_name']) < 2)
- { $mtl->output->error($mtl->lang['short_site_name']); }
- else if(!preg_match("/http:\/\//", $mtl->input['site_url']))
- { $mtl->output->error($mtl->lang['invalid_url'] ); }
- else if($DB->count($DB->query("SELECT id FROM mtl_sites WHERE id!='{$this->user['id']}' AND lower(site_url) LIKE '".strtolower($mtl->input['site_url'])."%'")) == 1)
- { $mtl->output->error($mtl->lang['url_exists']); }
- else if($mtl->config['enable_categories'] == 1 AND $DB->count($DB->query("SELECT id FROM mtl_categories WHERE id='{$mtl->input['cat']}'")) != 1)
- { $mtl->output->error($mtl->lang['invalid_category']); }
- $site_accept_admin = 1;
- $owner_accept = 1;
- if($mtl->config['site_admin'] == 1) // The SITE requires Admin Validation
- { $site_accept_admin = 0; }
- $tmp = $DB->query("SELECT * FROM mtl_users WHERE uid='".$this->user['uid']."' AND password='".$this->user['password']."' AND ban!=1");
- $data = $DB->fetch_row($tmp);
- $a_mail = $data['a_mail'];
- $a_admin = $data['a_admin'];
- if($a_admin != 1 OR $a_admin != 1)
- { $owner_accept = 0; }
- if($mtl->config['userrow']['default'] != 1)
- { $owner_accept = 1; }
- $insert = array (
- 'owner' => $this->user['uid'],
- 'owner_accept' => $owner_accept,
- 'date' => time(),
- 'a_admin' => $site_accept_admin,
- 'site_name' => htmlspecialchars($mtl->input['site_name'], ENT_QUOTES),
- 'site_url' => htmlspecialchars($mtl->input['site_url'], ENT_QUOTES),
- 'site_desc' => htmlspecialchars($mtl->input['site_desc'], ENT_QUOTES),
- 'a_hide' => $mtl->input['hide'],
- 'cat' => $mtl->input['cat'],
- 'in_webring' => $mtl->input['in_webring'],
- );
- $insert = $DB->insert($insert);
- $DB->query("INSERT INTO mtl_sites ({$insert['columns']}) VALUES ({$insert['values']})");
- if($owner_accept == 1 AND $site_accept_admin == 1)
- { $DB->query("UPDATE mtl_categories SET sites=sites+1 WHERE id='{$mtl->input['cat']}'"); }
- if($mtl->config['site_email_info'] == 1 AND $site_accept_admin ==1)
- { $mail = array (
- 'to_name' => $this->user['username'],
- 'to_mail' => $this->user['email'],
- 'subject' => $mtl->lang['site_reg_at'],
- 'message' => $mtl->make_message(array("act" => "new_site_email", "username" => $mtl->input['username'], "site_name" => $mtl->input['site_name'], "site_url" => $mtl->input['site_url'])),
- );
- $mtl->mailer($mail);
- }
- $mtl->output->screen( array ( 'message' => $mtl->lang['site_added'], 'go' => '?'.$mtl->sessionhtml.'act=ucp' ));
- }
- function add_site()
- { global $mtl, $DB;
- if($DB->count($DB->query("SELECT id FROM mtl_sites")) > $mtl->config['reg_max'] AND $mtl->config['reg_max'] != 0)
- { $mtl->output->error($mtl->lang['regmax']); }
- if($mtl->config['enable_multaccts'] != 1)
- { $mtl->output->error($mtl->lang['invalid_use']); }
- $count = $DB->count($DB->query("SELECT id FROM mtl_sites WHERE owner='{$this->user['uid']}'"));
- if(($this->user['max_sites'] != 0 AND $done = 1 AND $this->user['max_sites'] <= $count) OR ($done != 1 AND $mtl->config['max_sites'] != 0 AND $mtl->config['max_sites'] <= $count))
- { $output = $this->load_top(array ('title' => ' - '.$mtl->lang['error_title']));
- $output .= "<b>{$mtl->lang['error']}</b><br /><br />\n{$mtl->lang['maxsites']}";
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['error_title'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- $data['CODE'] = '25';
- $data['top'] = $mtl->lang['addsiteintro'];
- $data['submit'] = $mtl->lang['addsite'];
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['addsite']));
- $xoutput = $mtl->skin->usercp->site_settings($data);
- if($mtl->config['enable_userhide'] == 1)
- { $xoutput = str_replace("<!-- Allow Hide Start", "", $xoutput);
- $xoutput = str_replace("Allow Hide End-->", "", $xoutput);
- }
- if($mtl->config['enable_categories'] == 1) // Are categories enabled?
- { $cats = $DB->query("SELECT id,name,parent FROM mtl_categories WHERE status=1 AND catallow='' ORDER BY position asc");
- if($DB->count($cats) > 1) // Do we have categories? Rarely should be no
- { $select_cat = "<select name='cat' class='select'>\n";
- $select_cat .= "<option value='' selected='selected'>{$mtl->lang['select_category']}</option>\n";
- while($r = $DB->fetch_row($cats))
- { $ourcats[] = $r;
- }
- $select_cat .= $this->generate_cats($ourcats);
- $select_cat .= "</select>\n";
- $xoutput = str_replace("<!-- Allow Category Start", "", $xoutput);
- $xoutput = str_replace("End Allow Cattegory-->", "", $xoutput);
- $xoutput = str_replace("--Cat List--", $select_cat, $xoutput);
- }
- }
- if($mtl->config["enable_webring"] == 1)
- { $xoutput = str_replace("<!-- Allow Webring Start", "", $xoutput);
- $xoutput = str_replace("Allow Webring End-->", "", $xoutput);
- }
- $output .= $xoutput;
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['addsite'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function select_site()
- { global $mtl, $DB;
- if($mtl->config['enable_multaccts'] != 1)
- { $mtl->output->error($mtl->lang['invalid_use']); }
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['selsite']));
- $output .= "<b>{$mtl->lang['selectsitetoedit']}</b><br /><br />\n";
- $output .= "<form action='{$mtl->config['filename']}' method='post'>\n<input type='hidden' name='act' value='ucp' />\n<input type='hidden' name='CODE' value='23' />\n{$mtl->hidden_session}\n";
- $DB->query("SELECT id,site_name,site_url FROM mtl_sites WHERE owner='{$this->user['uid']}' AND a_ban!='1'");
- if($DB->count() == 0)
- { $mtl->output->error($mtl->lang['nosites']); }
- while($r = $DB->fetch_row())
- { $output .= $mtl->skin->usercp->select_site($r);;
- }
- $output .= "<br /><input type='submit' value='{$mtl->lang['selsite']}' class='select' />\n</form>";
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['selsite'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function do_select()
- { global $mtl, $DB;
- if($mtl->config['enable_multaccts'] != 1)
- { $mtl->output->error($mtl->lang['invalid_use']); }
- if(!isset($mtl->input['selectsite']))
- { $mtl->output->error($mtl->lang['mustchoosesite']); }
- $mtl->output->screen( array ( 'message' => $mtl->lang['settings_updated'], 'go' => '?'.$mtl->sessionhtml.'act=ucp&CODE=28' ));
- }
- function logout($session) // CODE '01'
- { global $mtl, $DB;
- $DB->query("DELETE FROM mtl_sessions WHERE id='{$session}'");
- $mtl->set_cookie($mtl->config['userrow']['uidcookie'], '', 1, 1);
- $mtl->set_cookie($mtl->config['userrow']['passcookie'], '', 1, 1);
- $mtl->set_cookie($mtl->config['userrow']['sessioncookie'], '', 1, 1);
- $mtl->set_cookie("session", "", 1);
- $mtl->output->screen( array ( 'message' => $mtl->lang['logout_msg'], ));
- }
- function show_site_settings() // CODE '02'
- { global $mtl, $DB;
- $this->user['hide_select'] = $this->user['a_hide'] ? "checked='checked'" : "";
- $this->user['in_webring'] = $this->user['in_webring'] ? "checked='checked'" : "";
- $this->user['CODE'] = '04';
- $this->user['submit'] = $mtl->lang['update'];
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['general_options']));
- $xoutput = $mtl->skin->usercp->site_settings($this->user);
- if($mtl->config['enable_userhide'] == 1)
- { $xoutput = str_replace("<!-- Allow Hide Start", "", $xoutput);
- $xoutput = str_replace("Allow Hide End-->", "", $xoutput);
- }
- if($mtl->config["enable_webring"] == 1)
- { $xoutput = str_replace("<!-- Allow Webring Start", "", $xoutput);
- $xoutput = str_replace("Allow Webring End-->", "", $xoutput);
- }
- if($mtl->config['enable_categories'] == 1) // Are categories enabled?
- { $cats = $DB->query("SELECT id,name,parent FROM mtl_categories WHERE status=1 AND catallow='' ORDER BY position asc");
- if($DB->count($cats) > 1) // Do we have categories? Rarely should be no
- { $select_cat = "<select name='cat' class='select'>\n";
- $select_cat .= "<option value=''>{$mtl->lang['select_category']}</option>\n";
- while($r = $DB->fetch_row($cats))
- { $ourcats[] = $r;
- }
- $select_cat .= $this->generate_cats($ourcats, 0, '', $this->user['cat']);
- $select_cat .= "</select>\n";
- $xoutput = str_replace("<!-- Allow Category Start", "", $xoutput);
- $xoutput = str_replace("End Allow Cattegory-->", "", $xoutput);
- $xoutput = str_replace("--Cat List--", $select_cat, $xoutput);
- }
- }
- $output .= $xoutput;
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['site_overview'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function overview_pro() // CODE '04'
- { global $mtl, $DB;
- if(strlen($mtl->input['site_name']) < 2)
- { $mtl->output->error($mtl->lang['short_site_name']); }
- else if(!preg_match("/http:\/\//", $mtl->input['site_url']))
- { $mtl->output->error($mtl->lang['invalid_url'] ); }
- else if($DB->count($DB->query("SELECT id FROM mtl_sites WHERE id!='{$this->user['id']}' AND lower(site_url) LIKE '".strtolower($mtl->input['site_url'])."%'")) == 1)
- { $mtl->output->error($mtl->lang['url_exists']); }
- else if($mtl->config['enable_categories'] == 1 AND $DB->count($DB->query("SELECT id FROM mtl_categories WHERE id='{$mtl->input['cat']}'")) != 1)
- { $mtl->output->error($mtl->lang['invalid_category']); }
- $update = array (
- 'site_name' => htmlspecialchars($mtl->input['site_name'], ENT_QUOTES),
- 'site_url' => htmlspecialchars($mtl->input['site_url'], ENT_QUOTES),
- 'site_desc' => htmlspecialchars($mtl->input['site_desc'], ENT_QUOTES),
- );
- if($mtl->config['enable_userhide'] == 1)
- { $update['a_hide'] = $mtl->input['hide']; }
- if($mtl->config["enable_webring"] == 1)
- { $update['in_webring'] = $mtl->input['in_webring']; }
- if($mtl->config["enable_categories"] == 1)
- { $update['cat'] = $mtl->input['cat']; }
- // Now do the Site IPs:
- $ip = $mtl->siteip_gethostbyname($update['site_url']);
- if (!$mtl->siteip_check_duplicate($ip))
- {
- $mtl->output->error($mtl->lang['duplicate_siteip']);
- exit;
- }
- else
- { $mtl->siteip_insert($ip); }
- // End Site IPs \\
- $DB->query("UPDATE mtl_sites SET ".$DB->update($update)." WHERE id='{$this->user['id']}'");
- $mtl->output->screen( array ( 'message' => $mtl->lang['settings_updated'], 'go' => '?'.$mtl->sessionhtml.'act=ucp&CODE=02' ));
- }
- function show_general() // CODE '20'
- { global $mtl, $DB;
- $this->user['visitor_email'] = $this->user['allow_guest_email'] ? "checked='checked'" : "";
- $this->user['admin_email'] = $this->user['allow_admin_mail'] ? "checked='checked'" : "";
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['general_options']));
- $output .= $mtl->skin->usercp->general_options($this->user);
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['general_options'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function general_pro() // CODE '21'
- { global $mtl, $DB;
- $update = array (
- 'allow_guest_email' => $mtl->input['visitor_email'],
- 'allow_admin_mail ' => $mtl->input['admin_email'],
- );
- $DB->query("UPDATE mtl_users SET ".$DB->update($update)." WHERE uid='{$this->user['uid']}'");
- $mtl->output->screen( array ( 'message' => $mtl->lang['settings_updated'], 'go' => '?'.$mtl->sessionhtml.'act=ucp&CODE=20' ));
- }
- function notepad_pro() // CODE '03'
- { global $mtl, $DB;
- $DB->query("UPDATE mtl_users SET notepad='".$mtl->input['notes']."',notepad_size='{$mtl->input['size']}' WHERE uid='{$this->user['uid']}'");
- $this->user['notepad'] = $mtl->input['notes'];
- $this->user['notepad_size'] = $mtl->input['size'];
- $this->show_main();
- }
- function show_image() // CODE '05'
- { global $mtl;
- if($mtl->config['rows_banner'] == 0)
- { $mtl->output->error($mtl->lang['banner_not_enabled']); }
- if(preg_match("/http:\/\//", $this->user['site_banner']))
- { $data['select_link'] = "checked='checked'";
- $data['link'] = $this->user['site_banner'];
- $data['image'] = "<img src='".$this->user['site_banner']."' alt='".$this->user['name']."'><br /><br />";
- }
- else if($this->user['site_banner'] != '0' AND $this->user['site_banner'] != "")
- { $data['select_upload'] = "checked='checked'";
- $data['image'] = "<img src='".$mtl->config['banner_http'].$this->user['id'].".".$this->user['site_banner']."' alt='".$this->user['name']."'><br /><br />";
- }
- else
- { $data['select_none'] = "checked='checked'"; }
- $data['top'] = $this->user['top'];
- $choose = $mtl->skin->usercp->image_choose($data);
- if($mtl->config['banner_upload'] == 1)
- { $choose = str_replace("<!--Start Upload", "", $choose);
- $choose = str_replace("End Upload-->", "", $choose);
- }
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['image_options']));
- $output .= $choose;
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['image_options'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['image_options'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function image_pro() // CODE '06'
- { global $DB, $mtl;
- if($mtl->config['rows_banner'] == 0)
- { $mtl->output->error($mtl->lang['banner_not_enabled'] ); }
- if($mtl->input['type'] == 'link')
- { if($mtl->config['banner_link'] != 1)
- { $mtl->output->error($mtl->lang['banner_link_disable'] ); }
- if(!preg_match("/http:\/\//", $mtl->input['image_url']))
- { $mtl->output->error($mtl->lang['invalid_url'] ); }
- if(!$size = @getimagesize($mtl->input['image_url']))
- { $mtl->output->error($mtl->lang['invalidimage']); }
- $ex = explode('.', $mtl->input['image_url']);
- $ex = $ex[count($ex) - 1];
- $vex = explode(',', $mtl->config['banner_ex']);
- if(!in_array($ex, $vex))
- { $mtl->output->error($mtl->lang['invalidimage']); }
- list($max_width, $max_height) = explode("x", $mtl->config['banner_max']);
- if($mtl->config['banner_exact'] == 0 AND ($size[0] > $max_width OR $size[1] > $max_height))
- { $mtl->lang['too_big_image'] = str_replace("<##width##>", $max_width, $mtl->lang['too_big_image']);
- $mtl->lang['too_big_image'] = str_replace("<##height##>", $max_height, $mtl->lang['too_big_image']);
- $mtl->output->error($mtl->lang['too_big_image']);
- }
- if($mtl->config['banner_exact'] == 1 AND ($size[0] != $max_width OR $size[1] != $max_height))
- { $mtl->lang['wrong_size'] = str_replace("<##width##>", $max_width, $mtl->lang['wrong_size']);
- $mtl->lang['wrong_size'] = str_replace("<##height##>", $max_height, $mtl->lang['wrong_size']);
- $mtl->output->error($mtl->lang['wrong_size']);
- }
- if($this->user['site_banner'] != '0' AND $this->user['site_banner'] != "" AND !preg_match("/http:\/\//", $this->user['site_banner']))
- { @unlink($mtl->config['banner_path'].$this->user['id'].".".$this->user['site_banner']); }
- $DB->query("UPDATE mtl_sites SET site_banner='".addslashes($mtl->input['image_url'])."' WHERE id='".$this->user['id']."'");
- }
- else if($mtl->input['type'] == 'upload')
- { if($mtl->config['banner_upload'] != 1)
- { $mtl->output->error($mtl->lang['banner_upload_disable'] ); }
- $file = $mtl->file("image_upload");
- $size = round($file['size']/1024, 2);
- $extensions = explode(",", $mtl->config['banner_ex']);
- if(!in_array($file['ex'], $extensions))
- { $mtl->output->error($mtl->lang['invalidimage'] ); }
- if($file['size'] > ($mtl->config['banner_size'] * 1000))
- { $mtl->output->error($mtl->lang['image_too_large'].$size."kb"); }
- $size = getimagesize($file['file']);
- list($max_width, $max_height) = explode("x", $mtl->config['banner_max']);
- if($mtl->config['banner_exact'] == 0 AND ($size[0] > $max_width OR $size[1] > $max_height))
- { $mtl->lang['too_big_image'] = str_replace("<##width##>", $max_width, $mtl->lang['too_big_image']);
- $mtl->lang['too_big_image'] = str_replace("<##height##>", $max_height, $mtl->lang['too_big_image']);
- $mtl->output->error($mtl->lang['too_big_image']);
- }
- if($mtl->config['banner_exact'] == 1 AND ($size[0] != $max_width OR $size[1] != $max_height))
- { $mtl->lang['wrong_size'] = str_replace("<##width##>", $max_width, $mtl->lang['wrong_size']);
- $mtl->lang['wrong_size'] = str_replace("<##height##>", $max_height, $mtl->lang['wrong_size']);
- $mtl->output->error($mtl->lang['wrong_size']);
- }
- $path = $mtl->config['banner_path'].$this->user['id'].".$file[ex]";
- if($this->user['site_banner'] != '0' AND $this->user['site_banner'] != "" AND !preg_match("/http:\/\//", $this->user['site_banner']))
- { @unlink($mtl->config['banner_path'].$this->user['id'].".".$this->user['site_banner']); }
- copy($file['file'], $path) or $mtl->output->error("The file could not be copied");
- //@chmod($path, 7777);
- $DB->query("UPDATE mtl_sites SET site_banner='$file[ex]' WHERE id='".$this->user['id']."'");
- }
- else if($mtl->input['type'] == 'none')
- { if($this->user['site_banner'] != '0' AND $this->user['site_banner'] != "" AND !preg_match("/http:\/\//", $this->user['site_banner']))
- { @unlink($mtl->config['banner_path'].$this->user['id'].".".$this->user['site_banner']); }
- $DB->query("UPDATE mtl_sites SET site_banner='0' WHERE id='".$this->user['id']."'"); }
- else
- { $mtl->output->error($mtl->lang['invalid_use']); }
- $mtl->output->screen( array ( 'message' => $mtl->lang['image_change_succ'], 'go' => '?'.$mtl->sessionhtml.'act=ucp&CODE=05', ));
- }
- function change_email() // CODE '07'
- { global $mtl, $DB;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['change_email']));
- $output .= $mtl->skin->usercp->change_email();
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['change_email'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['change_email'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function change_email_pro() // CODE '08'
- { global $mtl, $DB;
- if($mtl->check_email($mtl->input['email']))
- { $mtl->output->error($mtl->lang['invalid_email'] ); }
- if($mtl->input['email'] != $mtl->input['email_confirm'])
- { $mtl->output->error($mtl->lang['match_email'] ); }
- if($mtl->input['email'] == $this->user['email'])
- { $mtl->output->error($mtl->lang['current_email'] ); }
- if($mtl->config['reg_email'] == 1)
- { $accept_mail = 0;
- $val = substr(md5(microtime()), 15);
- $mail = array (
- 'to_name' => $this->user['username'],
- 'to_mail' => $mtl->input['email'],
- 'subject' => $mtl->lang['change_email_val'],
- 'message' => $mtl->make_message(array("username" => $this->user['username'], "act" => "revalidate", "val" => $val)),
- );
- $mtl->mailer($mail);
- $DB->query("UPDATE mtl_users SET a_valkey='$val',email='".$mtl->input['email']."',a_mail='0' WHERE uid='".$this->user['uid']."'");
- $mtl->output->screen( array ( 'go' => '?'.$mtl->sessionhtml.'act=ucp', 'message' => $mtl->lang['val_email_send'], ));
- }
- else
- { $DB->query("UPDATE mtl_users SET email='".$mtl->input['email']."' WHERE uid='".$this->user['id']."'");
- $mtl->output->screen( array ( 'go' => '?'.$mtl->sessionhtml.'act=ucp', 'message' => $mtl->lang['val_done'], ));
- }
- }
- function change_pw() // CODE '09'
- { global $DB, $mtl;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['change_pw']));
- $output .= $mtl->skin->usercp->change_pw();
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['change_pw'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['change_pw'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function change_pw_pro() // CODE '10'
- { global $DB, $mtl;
- if(md5($mtl->input['current_pw']) != $this->user['password'])
- { $mtl->output->error($mtl->lang['incorrect_pw'] ); }
- if(strlen($mtl->input['password']) < $mtl->config['min_letters'])
- { $mtl->output->error($mtl->lang['pw_short'] ); }
- if($mtl->input['confirm_pw'] != $mtl->input['password'])
- { $mtl->output->error($mtl->lang['pass_match'] ); }
- $DB->query("UPDATE mtl_users SET password='".md5($mtl->input['password'])."' WHERE uid='".$this->user['uid']."'");
- $mtl->output->screen( array ( 'message' => $mtl->lang['password_change_succ'], ));
- }
- function show_code() // CODE '11'
- { global $mtl;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['vote_code']));
- $code['code'] = str_replace("%url%", $mtl->config['url'] . $mtl->config['filename'] . "?vote=" . $this->user['id'], $mtl->config['vote_code']);
- $code['code_orig'] = $code['code']; // Create a Preview Code
- $code['code'] = str_replace('<', '<', $code['code']);
- $code['code'] = str_replace('>/', '>', $code['code']);
- $code['intro'] = str_replace('<##link##>', "{$mtl->base_url}&act=faq&store=1", $mtl->lang['code_intro']);
- $code['top'] = $this->user['top'];
- $output .= $mtl->skin->usercp->vote_code($code);
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['vote_code'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function show_rate() // CODE '12'
- { global $mtl;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['rate_code']));
- $code['code'] = str_replace("%url%", $mtl->config['url'] . $mtl->config['filename'], $mtl->config['rate_code']);
- $code['code'] = str_replace("%id%", $this->user['id'], $code['code']);
- $code['code_orig'] = $code['code'];
- $code['code'] = str_replace('<', '<', $code['code']);
- $code['code'] = str_replace('>', '>', $code['code']);
- $code['code_spaced'] = nl2br($code['code']);
- $code['intro'] = str_replace('<##link##>', "{$mtl->base_url}&act=faq&store=1", $mtl->lang['rate_intro']);
- $code['top'] = $this->user['top'];
- $output .= $mtl->skin->usercp->rate_code($code);
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['rate_code'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function forget_pw_show() // CODE '13'
- { global $mtl;
- $output = $mtl->skin->usercp->forget_pw_form();
- $nav = array (
- 'url' => '?act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['forget_pw'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['forget_pw'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function forget_pw_email() // CODE '14'
- { global $DB, $mtl;
- if($mtl->check_email($mtl->input['email']))
- { $mtl->output->error($mtl->lang['invalid_email'] ); }
- $query = $DB->query("SELECT uid,username,email FROM mtl_users WHERE email='".$mtl->input['email']."'");
- if($DB->count() < 1)
- { $mtl->output->error($mtl->lang['email_account_missing'] ); }
- while($r = $DB->fetch_row($query))
- {
- $sess = substr(md5(microtime()), 25);
- $mail = array (
- 'to_name' => $r['username'],
- 'to_mail' => $r['email'],
- 'subject' => $mtl->lang['forgetpw'],
- 'message' => $mtl->make_message(array("act" => "forget_pw", "val" => $sess, "username" => $r['username'])),
- );
- $mtl->mailer($mail);
- $DB->query("UPDATE mtl_users SET a_valkey_pw='$sess' WHERE uid='".$r['uid']."'");
- }
- $mtl->output->screen( array ( 'message' => $mtl->lang['email_sent']));
- }
- function forget_pw_change() // CODE '15'
- { global $DB, $mtl;
- if(!isset($mtl->input['val']))
- { $mtl->output->error($mtl->lang['valid_key'] ); }
- $DB->query("SELECT uid,username,a_valkey_pw FROM mtl_users WHERE a_valkey_pw='".$mtl->input['val']."'");
- if($DB->count() != 1)
- { $mtl->output->error($mtl->lang['valid_key'] ); }
- $output = $mtl->skin->usercp->forget_pw_change($DB->fetch_row($query));
- $nav = array (
- 'url' => '?act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['forget_pw_change'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['forget_pw_change'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function forget_pw_change_pro() // CODE '16'
- { global $DB, $mtl;
- if(strlen($mtl->input['password']) < $mtl->config['min_letters'])
- { $mtl->output->error($mtl->lang['pw_short'] ); }
- else if($mtl->input['confirm_pw'] != $mtl->input['password'])
- { $mtl->output->error($mtl->lang['pass_match'] ); }
- if(!isset($mtl->input['val']) OR $mtl->input['val'] == "")
- { $mtl->output->error($mtl->lang['valid_key'] ); }
- $DB->query("SELECT uid,username FROM mtl_users WHERE a_valkey_pw='".$mtl->input['val']."'");
- if($DB->count() < 1)
- { $mtl->output->error($mtl->lang['valid_key'] ); }
- $r = $DB->fetch_row();
- $DB->query("UPDATE mtl_users SET password='".md5($mtl->input['password'])."',a_valkey_pw='' WHERE uid='".$r['uid']."'");
- $mtl->output->screen( array ( 'go' => '?act=ucp', 'message' => $mtl->lang['password_change_succ'], ));
- }
- function show_hits() // CODE '17'
- { global $mtl;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['hits_code']));
- $code['code'] = "<img src='{$mtl->config['url']}{$mtl->config['filename']}?hit={$this->user['id']}' width='0' height='0'>";
- $code['code_spaced'] = str_replace('<', '<', $code['code']);
- $code['code_spaced'] = str_replace('>', '>', $code['code_spaced']);
- $code['intro'] = str_replace('<##link##>', "{$mtl->base_url}&act=faq&store=1", $mtl->lang['hits_intro']);
- $code['top'] = $this->user['top'];
- $output .= $mtl->skin->usercp->hits_code($code);
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['hits_code'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function show_posimage() // CODE '18'
- { global $mtl, $root_path, $DB;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['image_code']));
- $simp_image_sets = '';
- $dh = opendir($root_path."html/nums/");
- while($file = readdir($dh))
- {
- $simp_image_data = array('img_set' => htmlentities($file));
- $code = str_replace("%url%", "{$mtl->config['url']}{$mtl->config['filename']}?vote={$this->user['id']}", $mtl->config['image_code']);
- $code = str_replace("%imgurl%", "{$mtl->config['url']}{$mtl->config['filename']}?img={$this->user['id']}&img_set=" . rawurlencode($file), $code);
- $simp_image_data['code'] = htmlentities($code);
- if($file{0} === '.' || !is_dir($setDir = ($root_path . "html/nums/" . $file)))
- {
- continue;
- }
- $dh2 = opendir($setDir);
- $images = array();
- while($file2 = readdir($dh2))
- {
- if($file2{0} !== '.'
- && is_file($setDir . '/' . $file2)
- && preg_match('/([0-9]+)([-+]([0-9]+)?)?\.(.*)$/', $file2, $m))
- {
- $images[(int)$m[1]] = $file2;
- }
- }
- closedir($dh2);
- if($images)
- {
- ksort($images);
- $simp_image_data['sample_images'] = '';
- foreach($images as $img)
- {
- $simp_image_data['sample_images'] .= "<img src='html/nums/{$file}/{$img}' />";
- }
- $simp_image_sets .= $mtl->skin->usercp->image_set($simp_image_data);
- }
- }
- closedir($dh);
- if($simp_image_sets)
- {
- $simp_image_sets = $mtl->skin->usercp->image_sets
- (array
- ('intro' => $mtl->lang['simp_image_intro'],
- 'sets' => $simp_image_sets,
- )
- );
- }
- $dyn_image_sets = '';
- $DB->query("SELECT img_id, img_name from mtl_images ORDER BY img_name");
- while($r = $DB->fetch_row())
- {
- $dyn_image_data = array('img_set' => htmlentities($r['img_name']));
- $code = str_replace("%url%", "{$mtl->config['url']}{$mtl->config['filename']}?vote={$this->user['id']}", $mtl->config['image_code']);
- $code = str_replace("%imgurl%", "{$mtl->config['url']}{$mtl->config['filename']}?img={$this->user['id']}&img_id=" . rawurlencode($r['img_id']), $code);
- $dyn_image_data['code'] = htmlentities($code);
- $dyn_image_data['sample_images'] =
- "<img src=\"index.php?img={$this->user['id']}&img_id=" . rawurlencode($r['img_id']) . "\" />";
- $dyn_image_sets .= $mtl->skin->usercp->image_set($dyn_image_data);
- }
- if($dyn_image_sets)
- {
- $dyn_image_sets = $mtl->skin->usercp->image_sets
- (array
- ('intro' => $mtl->lang['simp_image_intro'],
- 'sets' => $dyn_image_sets,
- )
- );
- }
- $data = array();
- $data['intro'] = str_replace('<##link##>', "{$mtl->base_url}&act=faq&store=2", $mtl->lang['image_intro']);
- if(! ($simp_image_sets || $dyn_image_sets))
- {
- // No custom image sets available, use the defaults
- $simp_image_data = array('img_set' => 'MTL');
- $code = str_replace("%url%", "{$mtl->config['url']}{$mtl->config['filename']}?vote={$this->user['id']}", $mtl->config['image_code']);
- $code = str_replace("%imgurl%", "{$mtl->config['url']}{$mtl->config['filename']}?img={$this->user['id']}", $code);
- $simp_image_data['code'] = htmlentities($code);
- $dh2 = opendir($setDir = ($root_path."html/nums/"));
- $images = array();
- while($file2 = readdir($dh2))
- {
- if($file2{0} !== '.'
- && is_file($setDir . '/' . $file2)
- && preg_match('/(?:no)?([0-9]+)([-+]([0-9]+)?)?\.(.*)$/', $file2, $m))
- {
- $images[(int)$m[1]] = $file2;
- }
- }
- closedir($dh2);
- if($images)
- {
- ksort($images);
- $simp_image_data['sample_images'] = '';
- foreach($images as $img)
- {
- $simp_image_data['sample_images'] .= "<img src='html/nums/{$file}/{$img}' />";
- }
- $simp_image_sets .= $mtl->skin->usercp->image_set($simp_image_data);
- }
- if($simp_image_sets)
- {
- $simp_image_sets = $mtl->skin->usercp->image_sets
- (array
- ('intro' => $mtl->lang['simp_image_intro'],
- 'sets' => $simp_image_sets,
- )
- );
- }
- }
- $data['simp_image_sets'] = $simp_image_sets;
- $data['dyn_image_sets'] = $dyn_image_sets;
- $output .= $mtl->skin->usercp->image_code($data);
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['image_code'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function show_ring() // CODE '19'
- { global $mtl;
- $output = $this->load_top(array ('title' => '- '.$mtl->lang['ring_code']));
- $code['code'] = str_replace("%url%", $mtl->config['url'] . $mtl->config['filename'], $mtl->config['ring_code']);
- $code['code'] = str_replace("%id%", $this->user['id'], $code['code']);
- $code['code'] = str_replace("%mtlname%", $mtl->config['name'], $code['code']);
- $code['code_orig'] = $code['code'];
- $code['code'] = str_replace('<', '<', $code['code']);
- $code['code'] = str_replace('>', '>', $code['code']);
- $code['code_spaced'] = nl2br($code['code']);
- $code['intro'] = str_replace('<##link##>', "{$mtl->base_url}&act=faq&store=2", $mtl->lang['ring_intro']);
- $code['top'] = $this->user['top'];
- $output .= $mtl->skin->usercp->ring_code($code);
- $output .= $mtl->skin->usercp->usercp_foot();
- $nav = array (
- 'url' => '?'.$mtl->sessionhtml.'act=ucp',
- 'name' => $mtl->lang['usercp'],
- 'name2' => $mtl->lang['ring_code'],
- );
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $nav, 'DATA' => $output));
- }
- function show_overview()
- { global $mtl, $DB;
- $this->user['weeks'] = str_replace("<##weeks##>", round((time()-$this->user['date'])/(3600*24)/7, 1), $mtl->lang['weeks_on_list']);
- $this->user['rating'] = "<img src='html/{$mtl->skin_choice['dir']}/images/star_".$mtl->work_rating($this->user['rating'], $this->user['rating_total']).".gif' alt='".str_replace("<##times##>", $this->user['rating_total'], $mtl->lang['rated_times'])."' border='0'>";
- $this->user['past_rating'] = "<img src='html/{$mtl->skin_choice['dir']}/images/star_{$this->user['rating_past']}.gif' alt='{$mtl->lang['rating']}' border='0'>";
- $this->user['date'] = $mtl->date($this->user['date'], 'long');
- $this->user[$size.'_select'] = "selected='selected'";
- $this->user['a_admin'] = ($this->user['a_admin'] == 1) ? $mtl->lang['yes'] : $mtl->lang['no'];
- $output = $this->load_top();
- $output .= $mtl->skin->usercp->show_site_overview($this->user);
- $output .= $mtl->skin->usercp->usercp_foot();
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $mtl->lang['usercp'], 'DATA' => $output));
- }
- function show_main() // DEFAULT
- { global $mtl, $DB;
- if($this->user['notepad_size'] == 18)
- { $size = "large"; }
- else if($this->user['notepad_size'] == 12)
- { $size = "medium"; }
- else
- { $size = "small"; }
- $this->user['date'] = $mtl->date($this->user['udate'], 'long');
- $this->user[$size.'_select'] = "selected='selected'";
- $tmp = $DB->query("SELECT * FROM mtl_users WHERE uid='".$this->user['uid']."' AND password='".$this->user['password']."' AND ban!=1");
- $data = $DB->fetch_row($tmp);
- $a_mail = $data['a_mail'];
- $a_admin = $data['a_admin'];
- $this->user['a_mail'] = ($a_mail == 1) ? $mtl->lang['yes'] : $mtl->lang['no'];
- $this->user['ua_admin'] = ($a_admin == 1) ? $mtl->lang['yes'] : $mtl->lang['no'];
- if($this->user['notepad'] == "")
- { $this->user['notepad'] = $mtl->lang['notepad_intro']; }
- $this->user['count'] = $DB->count($DB->query("SELECT id FROM mtl_sites WHERE owner='{$this->user['uid']}'"));
- if($mtl->config['enable_multaccts'] == 1)
- { $this->user['select'] = "<br /><br /><b>".str_replace("<##selecturl##>", "<a href='{$mtl->base_url}{$mtl->sessionhtml}act=ucp&CODE=22'>", $mtl->lang['welcomeselect'])."</b>"; }
- if($this->user['max_sites'] == 0)
- { $this->user['max_sites'] = $mtl->config['max_sites']; }
- $output = $this->load_top();
- $output .= $mtl->skin->usercp->main($this->user);
- $output .= $mtl->skin->usercp->usercp_foot();
- $outputarray = explode('<!--Site Listing-->', $output);
- if(count($outputarray) == 1)
- { $output = $outputarray[0]; }
- else
- { $output = $outputarray[0];
- $DB->query("SELECT id,name FROM mtl_categories");
- while($r = $DB->fetch_row())
- { $cat[$r['id']] = $r['name']; }
- $cat['1'] = $mtl->lang['noneselected'];
- $cat[''] = $mtl->lang['noneselected'];
- $cat['0'] = $mtl->lang['noneselected'];
- $DB->query("SELECT id,a_admin,cat,site_name,in_webring,votes,out,hits,rating_total,rating
- FROM mtl_sites
- WHERE owner='{$this->user['uid']}'
- ORDER BY site_name ASC");
- $middle = $outputarray[1];
- if($mtl->config['rows_banner'] != 0)
- { $middle = str_replace("<!--Show Image Options", "", $middle);
- $middle = str_replace("End Image Options-->", "", $middle);
- }
- while($r = $DB->fetch_row())
- { $toutput = $middle;
- $toutput = str_replace("<!--Site Name-->", $r['site_name'], $toutput);
- $toutput = str_replace("<!--Category-->", $cat[$r['cat']], $toutput);
- $toutput = str_replace("<!--ID-->", $r['id'], $toutput);
- $output .= $toutput;
- }
- $output .= $outputarray[2];
- }
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['usercp'], 'NAV' => 1, 'NAV_DATA' => $mtl->lang['usercp'], 'DATA' => $output));
- }
- function show_login()
- { global $mtl;
- /// To show a form/login
- $output = $mtl->skin->usercp->login_form();
- $mtl->output->do_output(array('TITLE' => $mtl->config['name'] . ' - ' . $mtl->lang['login'], 'NAV' => 1, 'NAV_DATA' => $mtl->lang['login'], 'DATA' => $output));
- }
- function load_top($array=array())
- { global $mtl;
- if($mtl->config['userrow']['pathtoprofile'] != '')
- { $array['general'] = $mtl->config['userrow']['pathtoprofile']; }
- else
- { $array['general'] = "{$mtl->base_url}{$mtl->sessionhtml}act=ucp&CODE=20"; }
- if($mtl->config['userrow']['pathtochangeemail'] != '')
- { $array['email'] = $mtl->config['userrow']['pathtochangeemail']; }
- else
- { $array['email'] = "{$mtl->base_url}{$mtl->sessionhtml}act=ucp&CODE=07"; }
- if($mtl->config['userrow']['pathtochangepass'] != '')
- { $array['pass'] = $mtl->config['userrow']['pathtochangepass']; }
- else
- { $array['pass'] = "{$mtl->base_url}{$mtl->sessionhtml}act=ucp&CODE=09"; }
- $top = $mtl->skin->usercp->usercp_top($array);
- if($mtl->config['rows_banner'] != 0)
- { $top = str_replace("<!--Show Image Options", "", $top);
- $top = str_replace("End Image Options-->", "", $top);
- }
- if($mtl->config["enable_votes_record"] == 1)
- { $top = str_replace("<!--Show Vote Code", "", $top);
- $top = str_replace("End Vote Code-->", "", $top);
- }
- if($mtl->config["enable_hits_record"] == 1 AND $mtl->config['enable_img'] != 1)
- { $top = str_replace("<!--Show Hits Code", "", $top);
- $top = str_replace("End Hits Code-->", "", $top);
- }
- if($mtl->config['enable_img'] == 1)
- { $top = str_replace("<!--Show Image Code", "", $top);
- $top = str_replace("End Image Code-->", "", $top);
- }
- if($mtl->config["enable_rating"] == 1)
- { $top = str_replace("<!--Show Rate Code", "", $top);
- $top = str_replace("End Rate Code-->", "", $top);
- }
- if($mtl->config["enable_webring"] == 1)
- { $top = str_replace("<!--Show Ring Code", "", $top);
- $top = str_replace("End Ring Code-->", "", $top);
- }
- if($mtl->config['enable_multaccts'] == 1)
- { $top = str_replace("<!--Show Multi-Site Options", "", $top);
- $top = str_replace("End Multi-Site Options-->", "", $top);
- }
- $showcode = array('02','04','05','06','11','12','17','18','19','28','29');
- if($this->user['id'] != 0 AND $mtl->input['CODE'] != '' AND in_array($mtl->input['CODE'], $showcode))
- { $top = str_replace("<!--Start Site-Dependent Contents", "", $top);
- $top = str_replace("End Site-Dependent Contents-->", "", $top);
- $top = str_replace("<!--ID-->", $this->user['id'], $top);
- $top = str_replace("<!--TOP-->", $this->user['top'], $top);
- }
- else
- { $top = preg_replace("/<!--Start Site-Dependent Contents(.*?)End Site-Dependent Contents-->/si", "", $top);
- }
- return $top;
- }
- function generate_cats($cats,$parent=0,$space='',$currentcat='')
- { for($i = 0; $i < count($cats); $i++)
- { if($cats[$i]['parent'] == $parent)
- { $ourlist[] = $cats[$i]; }
- }
- if(!isset($ourlist))
- { return; }
- foreach($ourlist as $cat)
- { if($currentcat == $cat['id']) // Show user which category they're viewing
- { $sel = " selected";
- }
- else
- { $sel = ""; }
- $output .= "<option value='{$cat['id']}'{$sel}>".$space." ".$star.$cat['name'].$star."</option>\n". $this->generate_cats($cats, $cat['id'], $space . '--', $currentcat); }
- return $output;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement