Exemple #1
0
 function __construct()
 {
     include dirname(__FILE__) . '/settings_path.php';
     $settings = new settings();
     // load the settings
     $this->options = $settings->settings();
 }
 public static function login($user_id = null)
 {
     if ($user_id === null) {
         $user_id = template_session::get_user_id();
     }
     if (!$user_id) {
         return false;
     }
     $user = users::get($user_id);
     if (!$user) {
         return false;
     }
     template_session::set_user_id($user->id);
     template_session::set_user_name($user->name);
     $setting_popup = settings::get_popup($user->id);
     template_session::set_use_popup($setting_popup->value);
     switch ($user->role_id) {
         case RUDE_ROLE_ADMIN:
             template_session::set_authorized();
             template_session::set_admin();
             template_session::set_editor();
             template_session::set_user();
             break;
         case RUDE_ROLE_EDITOR:
             template_session::set_authorized();
             template_session::set_editor();
             template_session::set_user();
             break;
         case RUDE_ROLE_USER:
             template_session::set_authorized();
             template_session::set_user();
             break;
     }
     return true;
 }
 public function listAction()
 {
     $NS = new Zend_Session_Namespace('Default');
     $arrSort = array();
     $params = array();
     $page = $this->getRequest()->getParam('page');
     $sort = $this->getRequest()->getParam('sort');
     if (!empty($sort)) {
         $arrSort[] = $this->SortingData($sort);
         $arrSort[] = $sort;
     }
     $page = !empty($page) && is_numeric($page) ? $page : 1;
     $params['search'][] = array('method' => 'andWhere', 'criteria' => "(c.customer_id = ? OR c.parent_id = ?)", 'value' => array($NS->customer['customer_id'], $NS->customer['customer_id']));
     // 		$params['search'][] = array ('method' => 'whereIn', 'criteria' => "o.status_id", 'value' => array(Statuses::id('paid', 'orders'), Statuses::id('complete', 'orders')));
     $data = $this->services->findAll("d.order_id, oid.relationship_id, d.description, CONCAT(dm.domain, '.', ws.tld) as domain, s.status as Status, DATE_FORMAT(d.date_start, '" . settings::getMySQLDateFormat() . "') as Creation_Date, DATEDIFF(d.date_end, CURRENT_DATE) as daysleft, DATE_FORMAT(d.date_end, '" . settings::getMySQLDateFormat() . "') as Expiring_Date, d.product_id", $page, $NS->recordsperpage, $arrSort, $params);
     $data['currentpage'] = $page;
     for ($i = 0; $i < count($data['records']); $i++) {
         $data['records'][$i]['description'] = Shineisp_Commons_Utilities::truncate($data['records'][$i]['description'], 40);
         $data['records'][$i]['daysleft'] = $data['records'][$i]['daysleft'] < 30 ? "<span class='label label-danger'>" . $data['records'][$i]['daysleft'] . "</span>" : "<span class='label label-success'>" . $data['records'][$i]['daysleft'] . "</span>";
     }
     $data['columns'][] = $this->translator->translate('Description');
     $data['columns'][] = $this->translator->translate('Domain');
     $data['columns'][] = $this->translator->translate('Status');
     $data['columns'][] = $this->translator->translate('Creation Date');
     $data['columns'][] = $this->translator->translate('Days left');
     $data['columns'][] = $this->translator->translate('Expiry Date');
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->title = $this->translator->translate("Services List");
     $this->view->description = $this->translator->translate("List of all your own services subscribed");
     $this->view->service = $data;
 }
Exemple #4
0
 function save()
 {
     settings::set('feedback', 'feedback_email', params::get('feedback_email'));
     settings::set('feedback', 'feedback_subject', params::get('feedback_subject'));
     settings::save('feedback');
     headers::self();
 }
Exemple #5
0
 public static function initialisePlugin()
 {
     // NB Network activation will not upgrade a site
     // do upgrade will check current upgrade script version and apply as necessary
     upgrader::checkUpgrade();
     // 2 is required for $file to be populated
     add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'), 10, 2);
     add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
     add_action('wp_head', array(__CLASS__, 'addRssLink'), 100);
     // only include admin files when necessary.
     if (is_admin()) {
         include_once 'settings.php';
         include_once 'postMetaData.php';
         include_once 'categoryMetaData.php';
         settings::addHooks();
         categoryMetaData::addHooks();
         postMetaData::addHooks();
     }
     if (!wp_get_schedule('xmsg_ping')) {
         // ping in 2 hours from when setup.
         wp_schedule_event(time() + 60 * 60 * 2, 'daily', 'xmsg_ping');
     }
     add_action('xmsg_ping', array(__CLASS__, 'doPing'));
     // NB Network activation will not have set up the rules for the site.
     // Check if they exist and then reactivate.
     if (get_option(RULES_OPTION_NAME, null) != RULES_VERSION) {
         add_action('wp_loaded', array(__CLASS__, 'activateRewriteRules'), 99999, 1);
     }
 }
 public static function getInstance() {
     if(!self::$me) {
         $class = new settings();
         self::$me=$class;
     }
     return self::$me;
 }
 public function showMCServer($id)
 {
     if (count(DB::table('mcservers')->where('mcs_id', '=', $id)->first())) {
         $title = settings::get("siteName") . " - Servidor De Minecraft";
         return View::make('index.MCServer')->with('title', $title)->with('id', $id);
     } else {
         return Redirect::to(URL::to('/minecraft'));
     }
 }
Exemple #8
0
 public static function genToken()
 {
     try {
         $code = str_random(30);
         settings::set("securityToken", $code);
     } catch (ParseException $e) {
         printf("Can´t generate a new Token: %s", $e->getMessage());
     }
 }
Exemple #9
0
    public function reply()
    {
        include_once ROOT_DIR . 'lib/class/settings.class.php';
        $setting = new settings();
        $result_setttings = $setting->getMark('mblog_comment');
        if (!empty($result_setttings) && $result_setttings['state']) {
            $this->errorOutput('评论回复已关闭');
        }
        $userinfo = $this->mUser->verify_credentials();
        if (!$userinfo['id']) {
            $this->errorOutput(USENAME_NOLOGIN);
        }
        $status_id = intval($this->input['status_id']);
        $cid = intval($this->input['cid']);
        $text = urldecode($this->input['text']);
        (!$status_id || !$text) && $this->errorOutput(OBJECT_NULL);
        //点滴id为空就返回错误
        $time = time();
        $query_info = $this->db->query_first('SELECT member_id FROM ' . DB_PREFIX . 'status_comments WHERE id = ' . $cid);
        !$query_info && $this->errorOutput(OBJECT_NULL);
        $sql = 'INSERT INTO ' . DB_PREFIX . 'status_comments ( status_id , member_id , content , comment_time , reply_comment_id , reply_member_id )
				VALUES(' . $status_id . ', ' . $userinfo['id'] . ', "' . $text . '" , "' . $time . '" , ' . $cid . ',' . $query_info['member_id'] . ')';
        $this->db->query($sql);
        $insert_id = $this->db->insert_id();
        $query_info = $this->db->query_first('SELECT member_id FROM ' . DB_PREFIX . 'status_comments WHERE status_id = ' . $status_id . ' AND id = ' . $cid);
        //将该条点滴的评论次数加1
        $this->db->query('UPDATE ' . DB_PREFIX . 'status_extra SET comment_count = comment_count + 1 WHERE status_id = ' . $status_id);
        $members = $this->mUser->getUserById($userinfo['id']);
        $members = $members[0];
        $status = $this->mStatus->show($status_id);
        $return_array = array('id' => $insert_id, 'text' => $text, 'create_at' => $time, 'reply_member_id' => $query_info['member_id'], 'reply_comment_id' => $cid, 'status' => $status[0], 'user' => $members);
        if ($userinfo['id'] != $query_info['member_id'] && $userinfo['id'] != $status[0]['user']['id']) {
            $notify_userid = $query_info['member_id'] . ',' . $status[0]['user']['id'];
            //加通知
            include_once ROOT_PATH . 'lib/class/notify.class.php';
            $notify = new notify();
            $content = array('title' => '新回复', 'page_link' => SNS_MBLOG . 'all_comment.php');
            $content = serialize($content);
            $notyfy_arr = $notify->notify_send($notify_userid, $content, 2);
            //发新评论通知
        }
        $this->addItem($return_array);
        $this->output();
    }
Exemple #10
0
 /**
  * 上传处理
  */
 public function deal_upload()
 {
     include_once ROOT_DIR . 'lib/class/settings.class.php';
     $setting = new settings();
     $result_setttings = $setting->getMark('video');
     if (!empty($result_setttings) && $result_setttings['state']) {
         echo '视频发布已关闭';
     }
     $video_path = $_FILES['videofile']['tmp_name'];
     //视频的在本地的目录
     $file_name = basename($_FILES['videofile']['name']);
     //视频的文件
     $file_size = $_FILES['videofile']['size'];
     //视频的大小
     $video_name = trim($this->input['video_name']);
     //视频名称
     $video_brief = trim($this->input['video_brief']);
     //视频简介
     $video_tags = trim($this->input['video_tags']);
     //视频标签
     $video_sort = $this->input['video_sort'];
     //视频分类
     $video_copyright = $this->input['video_copyright'];
     //视频版权
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     $this->curl = new curl();
     $this->curl->setSubmitType('post');
     $this->curl->setReturnFormat('json');
     $this->curl->initPostData();
     $this->curl->addRequestData('a', 'deal_upload');
     $this->curl->addRequestData('video_path', $video_path);
     $this->curl->addFile($_FILES);
     $this->curl->addRequestData('file_name', $file_name);
     $this->curl->addRequestData('file_size', $file_size);
     $this->curl->addRequestData('video_name', $video_name);
     $this->curl->addRequestData('video_brief', $video_brief);
     $this->curl->addRequestData('video_tags', $video_tags);
     $this->curl->addRequestData('video_sort', $video_sort);
     $this->curl->addRequestData('video_copyright', $video_copyright);
     $r = $this->curl->request('video/upload_video.php');
     echo $r;
 }
Exemple #11
0
 /**
  * Устанавливает или проверяет статус дня рождения.
  *
  * @param integer $status статус
  *
  * @return integer 1 в случае успеха, 0 в случае ошибки
  */
 public function setStatus($status)
 {
     if (pg_affected_rows(settings::SetVariable('birthday' . $this->year, 'status', $status))) {
         return 1;
     }
     $sql = "INSERT INTO settings (id, module, variable, value) SELECT COALESCE(MAX(id),0)+1, 'birthday{$this->year}', 'status', '{$status}' FROM settings";
     if (pg_query(DBConnect(), $sql)) {
         return 1;
     }
     return 0;
 }
Exemple #12
0
 function sendFeedback()
 {
     $mail_content = params::get('message');
     $email = params::get('email');
     if (!empty($mail_content) && !empty($email)) {
         mail::from($email);
         mail::html($mail_content);
         mail::subject(settings::get('feedback', 'feedback_subject'));
         mail::send(settings::get('feedback', 'feedback_email'));
         headers::url('/contacts/success/');
     }
 }
Exemple #13
0
 function save()
 {
     settings::set('pages', 'global_page_keywords', params::get('global_page_keywords'));
     settings::set('pages', 'global_page_description', params::get('global_page_description'));
     settings::set('pages', 'global_page_keywords_check', params::isCheck('global_page_keywords_check'));
     settings::set('pages', 'global_page_description_check', params::isCheck('global_page_description_check'));
     settings::set('pages', 'redactor', params::isCheck('redactor'));
     settings::set('pages', 'jip', params::isCheck('jip'));
     settings::set('pages', 'global_page_title', params::get('global_page_title'));
     settings::save('pages');
     headers::self();
 }
Exemple #14
0
 function name($id) {
 	$name = '';
 	$attr1 = settings::getInstance()->getrow(array('tag'=>'table-archive'));
 	if ($attr1['value'])
         self::$var = @unserialize($attr1['value']);
     else
         self::$var = array();
     preg_match_all('/\(([\d\w]+)\)(\S+)/is',self::$var['attr1'],$result,PREG_SET_ORDER);
     $id_arr = explode(',',$id);
     foreach($result as $v){
    	    foreach($id_arr as $t_v){
    	    	if(in_array($t_v,$v))
    	    	   $name .= $v[2].' / ';
    	    }
     }
     return $name;
 }
 function list_action() {
 	chkpw('union_list');
     $set1=settings::getInstance();
     $sets1=$set1->getrow(array('tag'=>'table-'.$this->table));
     $setsdata1=unserialize($sets1['value']);
     $this->view->settings=$setsdata1;
     $where=null;
     $ordre='`userid` DESC';
     $limit=((front::get('page') -1) * $this->_pagesize).','.$this->_pagesize;
     $this->_view_table=$this->_table->getrows($where,$limit,$ordre,$this->_table->getcols('manage'));
     $this->view->record_count=$this->_table->record_count;
     $this->_view_user = new user;
     foreach($this->_view_table as $key=>$val) {
         $userunion = $this->_view_user->getrow(array('userid'=>$val['userid']));
         $val['point'] = $userunion['point'];
         $this->_view_table[$key] = $val;
     }
 }
 /**
  * Create the HTML
  *
  * @param string $action Name of AJAX action to run.
  * @param string|bool $atts Optional. Additional data-* to use in element. Each att must start with data-, unless it is whitelisted in the allow_without_data_prefix() method. "class" & 'data-action' can never be set here. The filter "baldrick_wp_front_end_html_attributes" gives you the ability to override those.
  * @param string|bool $text Optional. Text to use for link trigger. If false, the default, there will be no trigger.
  * *@param string|bool $api Optional. URL for AJAX API to process with. Default is WordPress' AJAX API
  *
  * @return string
  */
 public static function element($action, $atts = false, $text = false, $api = false)
 {
     $atts['class'] = settings::$baldrick_class;
     $atts['data-action'] = $action;
     if (!isset($atts['data-request'])) {
         if ($api && filter_var($api, FILTER_VALIDATE_URL)) {
             $atts['data-request'] = $api;
         } else {
             $atts['data-request'] = settings::default_api();
         }
     }
     $att_out = array();
     foreach ($atts as $att => $value) {
         if (0 !== strpos($att, 'data-')) {
             if (self::allow_without_data_prefix($att)) {
                 $att = 'data-' . $att;
             }
         }
         $att_out[] = esc_attr($att) . '="' . esc_attr($value) . '"';
     }
     /**
      * Filter the attributes used to build the HTML element for the Baldrick trigger
      *
      * IMPORTANT: This filter runs <em>after</em> attributes are validated and sanitized. No further validation, sanitization, or escaping is provided after this point, other than ensuring it returns an array.
      *
      * @param array $att_out The array of attributes that will be used to build the HTML element
      * @param string $action Current action being run.
      * @param array $atts The attributes passed to method, before validation.
      */
     $filter_atts = apply_filters('baldrick_wp_front_end_html_attributes', $att_out, $action, $atts);
     if (is_array($filter_atts)) {
         $att_out = $filter_atts;
     }
     $att_out = implode(' ', $att_out);
     $out[] = '<a ';
     $out[] = $att_out;
     $out[] = ' >';
     if ($text) {
         $out[] = $text;
     }
     $out[] = '</a>';
     return implode('', $out);
 }
Exemple #17
0
 static function getTags() {
 	$data=array();
 	$data[0] = '请选择';
 	$otag = new tag();
 	$row = $otag->getrows('',0,'tagid ASC');
 	if(is_array($row)){
 		foreach ($row as $arr){
 			$data[$arr['tagname']] = $arr['tagname'];
 		}
 	}
 	//return $data;
 	$sets=settings::getInstance()->getrow(array('tag'=>'table-hottag'));
 	if (!is_array($sets)){
 		return $data;
 	}
 	$data1=unserialize($sets['value']);
 	preg_match_all('%\(([\d\w\/\.-]+)\)(\S+)%m',$data1['hottag'],$result,PREG_SET_ORDER);
 	foreach ($result as $res)
 		$data[$res[2]]=$res[2];
 	
 	return $data;
 }
 public static function init()
 {
     $username = get('username');
     $password = get('password');
     //$role_id = get('role_id');
     if (!$username) {
         exit('Пожалуйста, укажите имя для пользователя.');
     }
     if (!$password) {
         exit('Пожалуйста, укажите пароль пользователю.');
     }
     if (string::length($password) < 6) {
         exit('Ваш пароль должен быть длиной 6 или более символов.');
     }
     if (users::is_exists($username)) {
         exit('Данный пользователь уже существует. Попробуйте указать другое имя.');
     }
     $user_id = users::add($username, $password, RUDE_ROLE_USER);
     if (!$user_id) {
         exit('Произошла непредвиденная ошибка. Пожалуйста, обратитесь к администратору сайта и расскажите после каких действий вы увидели данное сообщение.');
     }
     settings::add($user_id);
     template_session::login($user_id);
 }
Exemple #19
0
 public function comment()
 {
     include_once ROOT_DIR . 'lib/class/settings.class.php';
     $setting = new settings();
     $result_setttings = $setting->getMark('mblog_comment');
     if (!empty($result_setttings) && $result_setttings['state']) {
         $this->errorOutput('评论已关闭');
     }
     $userinfo = $this->mUser->verify_credentials();
     if (!$userinfo['id']) {
         $this->errorOutput(USENAME_NOLOGIN);
     }
     $id = $this->input['id'];
     $content = urldecode($this->input['content']);
     include_once ROOT_DIR . 'lib/class/banword.class.php';
     $banword = new banword();
     $status = 0;
     $banwords = $banword->banword(urlencode($content));
     if ($banwords && $banwords != 'null') {
         $status = 1;
         $banwords = implode(',', $banwords);
     } else {
         $banwords = '';
     }
     //此ID没有用处
     $cid = intval($this->input['cid']);
     $time = time();
     !$cid ? $and = '' : ($and = ' , reply_comment_id = ' . $cid);
     $sql = 'INSERT INTO ' . DB_PREFIX . 'status_comments SET status_id = ' . $id . ', flag = ' . $status . ',member_id = ' . $userinfo['id'] . ',content = "' . $content . '",comment_time = "' . $time . '",ip = "' . hg_getip() . '"';
     $sql .= $and;
     $this->setXmlNode('comments', 'comment');
     /**
      * 获取该条点滴的用户ID
      */
     $this->curl->setSubmitType('post');
     $this->curl->setReturnFormat('json');
     $this->curl->addRequestData('status_id', $id);
     $user_id = $this->curl->request('statuses/getUserIdByStatusId.php');
     /**
      * 获取该用户的权限
      */
     $this->curl->setSubmitType('post');
     $this->curl->setReturnFormat('json');
     $this->curl->addRequestData('id', $user_id);
     $tmp = $this->curl->request('users/get_authority.php');
     $authority = $tmp[0];
     //评论权限
     $comment_authority = intval($authority[18]);
     /**
      * 获取与该用户的关系
      */
     $this->curl->setSubmitType('post');
     $this->curl->setReturnFormat('json');
     $this->curl->addRequestData('source_id', $userinfo['id']);
     $this->curl->addRequestData('target_id', $user_id);
     $relation = $this->curl->request('friendships/show.php');
     //任何人可评论
     if ($comment_authority == 0) {
         $this->db->query($sql);
     }
     //关注的人可评论
     if ($comment_authority == 1) {
         //关注
         if ($relation == 3 || $relation == 1) {
             $this->db->query($sql);
         } else {
             $this->errorOutput(NO_AUTHORITY);
         }
     }
     //任何人不可评论
     if ($comment_authority == 2) {
         $this->errorOutput(NO_AUTHORITY);
     }
     //		$this->db->query($sql);
     $insert_id = $this->db->insert_id();
     $members = $this->mUser->getUserById($userinfo['id']);
     //评论者的信息数组
     $members = $members[0];
     //将点滴的评论次数加1
     $sql_str = 'UPDATE ' . DB_PREFIX . 'status_extra SET comment_count = comment_count + 1 WHERE status_id = ' . $id;
     $this->db->query($sql_str);
     $status_info = $this->mStatus->show($id);
     $return_array = array('id' => $insert_id, 'text' => $content, 'create_at' => $time, 'user' => $members, 'status' => $status_info[0]);
     $this->addItem($return_array);
     $this->output();
 }
Exemple #20
0
 }
 if (!isset($globalTransaction)) {
     $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
 }
 // Set some defaults values...
 if (!isset($globalAircraftImageSources)) {
     $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
     $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
 }
 if (!isset($globalSchedulesSources)) {
     $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
     $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
 }
 $settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
 if ($error == '') {
     settings::modify_settings($settings);
 }
 if ($error != '') {
     print '<div class="info column">' . $error . '</div>';
     require '../footer.php';
     exit;
 } else {
     if (isset($_POST['waypoints'])) {
         $_SESSION['waypoints'] = 1;
     }
     $_SESSION['install'] = 'database_import';
     //require('../footer.php');
     print '<div class="info column"><ul>';
     if (isset($_POST['createdb'])) {
         $_SESSION['done'] = array('Create database', 'Write configuration');
         print '<li>Create database....<strong>SUCCESS</strong></li>';
 function setting_action() {
     $this->_view_table=false;
     $set=settings::getInstance();
     $sets=$set->getrow(array('tag'=>'table-'.$this->table));
     $data=unserialize($sets['value']);
     if (front::post('submit')) {
         $var=front::$post;
         unset($var['submit']);
         $set->rec_replace(array('value'=>serialize($var),'tag'=>'table-'.$this->table,'array'=>var_export($var,true)));
         front::flash("{$this->tname}配置成功!");
     }
     $this->view->settings=$data;
 }
Exemple #22
0
 function usersettings($uid)
 {
     settings::settings();
     $this->table = TBL_UCONFIG;
     $this->loaduserdefaults();
     $this->loaduser($uid);
 }
Exemple #23
0
    ?>
</td>
				<td><a href="<?php 
    echo url::base();
    ?>
index.php/layout/form/update/<?php 
    echo $layouts->id;
    ?>
">Edit</a> |
                    <a class="remove_layout" id="<?php 
    echo $layouts->id;
    ?>
">Remove</a>
                     |
                    <?php 
    if (settings::view_xml()) {
        ?>
 
                    <a href="<?php 
        echo url::base();
        ?>
index.php/xml/layout/<?php 
        echo $layouts->id;
        ?>
" target="_blank">View XML</a> |
                    <?php 
    }
    ?>
                    <a id="<?php 
    echo $layouts->id;
    ?>
checkSession();
switch ($_GET['action']) {
    case 'open':
        $settings = new settings();
        echo $settings->open();
        break;
    case 'save':
        $settings = new settings();
        if (isset($_POST['content'])) {
            echo $settings->save($_POST['content']);
        } else {
            echo '{"status":"error","message":"Missing Parameters!"}';
        }
        break;
    case 'load':
        $settings = new settings();
        echo $settings->load();
        break;
    case 'saveCommands':
        if (isset($_POST['commands'])) {
            $result = file_put_contents("default.commands.json", $_POST['commands']);
            if ($result === false) {
                echo '{"status":"error","message":"Failed to save default commands!"}';
            } else {
                echo '{"status":"success","message":"Commands saved."}';
            }
        } else {
            echo '{"status":"error","message":"Missing Parameters!"}';
        }
        break;
    default:
 public function showMinecraftList()
 {
     $title = settings::get("siteName") . " - Minecraft";
     return View::make('index.minecraftList')->with('title', $title);
 }
Exemple #26
0
}
// Try to override some limits - maybe it helps some...
@set_time_limit(0);
@ini_set('memory_limit', '128M');
// Set PHP error handler to ours
set_error_handler(array('qi', 'msg_handler'), E_ALL);
// Make sure we have phpBB.
if (!file_exists($quickinstall_path . 'sources/phpBB3/common.' . $phpEx)) {
    gen_error_msg('phpBB not found. You need to download the latest phpBB 3.0.x, 3.1.x or 3.2.x from <a href="https://www.phpbb.com/downloads/">https://www.phpbb.com/downloads/</a>,<br />extract it and copy the phpBB3 folder to sources/. Choose the version you do most work with, for your own convenience.');
}
// Let's get the config.
$page = legacy_request_var('page', 'main');
$mode = legacy_request_var('mode', '');
$profile = legacy_request_var('qi_profile', '');
$page = $page == 'docs' ? 'about' : $page;
$settings = new settings($profile, $mode);
// This is only usefull when working on QI.
if (file_exists($quickinstall_path . 'purge_cache')) {
    $cache_dir = $settings->get_config('cache_dir', '');
    if (!empty($cache_dir)) {
        $cache_dir = $quickinstall_path . $cache_dir;
        $dh = opendir($cache_dir);
        while (($file = readdir($dh)) !== false) {
            if ($file[0] != '.') {
                unlink($cache_dir . $file);
            }
        }
        closedir($dh);
    }
}
// We need some phpBB functions too.
 public function signup($username, $fullname, $password, $email, $sex, $year, $month, $day, $language = '')
 {
     $result = array("error" => true);
     $helper = new helper($this->db);
     if (!helper::isCorrectLogin($username)) {
         $result = array("error" => true, "error_code" => ERROR_UNKNOWN, "error_type" => 0, "error_description" => "Incorrect login");
         return $result;
     }
     if ($helper->isLoginExists($username)) {
         $result = array("error" => true, "error_code" => ERROR_LOGIN_TAKEN, "error_type" => 0, "error_description" => "Login already taken");
         return $result;
     }
     if (empty($fullname)) {
         $result = array("error" => true, "error_code" => ERROR_UNKNOWN, "error_type" => 3, "error_description" => "Empty user full name");
         return $result;
     }
     if (!helper::isCorrectPassword($password)) {
         $result = array("error" => true, "error_code" => ERROR_UNKNOWN, "error_type" => 1, "error_description" => "Incorrect password");
         return $result;
     }
     if (!helper::isCorrectEmail($email)) {
         $result = array("error" => true, "error_code" => ERROR_UNKNOWN, "error_type" => 2, "error_description" => "Wrong email");
         return $result;
     }
     if ($helper->isEmailExists($email)) {
         $result = array("error" => true, "error_code" => ERROR_EMAIL_TAKEN, "error_type" => 2, "error_description" => "User with this email is already registered");
         return $result;
     }
     if ($sex < 0 || $sex > 1) {
         $sex = 0;
     }
     $salt = helper::generateSalt(3);
     $passw_hash = md5(md5($password) . $salt);
     $currentTime = time();
     $ip_addr = helper::ip_addr();
     $accountState = ACCOUNT_STATE_ENABLED;
     $default_user_balance = DEFAULT_BALANCE;
     $stmt = $this->db->prepare("INSERT INTO users (state, login, fullname, passw, email, salt, balance, bYear, bMonth, bDay, sex, regtime, ip_addr) value (:state, :username, :fullname, :password, :email, :salt, :balance, :bYear, :bMonth, :bDay, :sex, :createAt, :ip_addr)");
     $stmt->bindParam(":state", $accountState, PDO::PARAM_INT);
     $stmt->bindParam(":username", $username, PDO::PARAM_STR);
     $stmt->bindParam(":fullname", $fullname, PDO::PARAM_STR);
     $stmt->bindParam(":password", $passw_hash, PDO::PARAM_STR);
     $stmt->bindParam(":email", $email, PDO::PARAM_STR);
     $stmt->bindParam(":salt", $salt, PDO::PARAM_STR);
     $stmt->bindParam(":balance", $default_user_balance, PDO::PARAM_INT);
     $stmt->bindParam(":bYear", $year, PDO::PARAM_INT);
     $stmt->bindParam(":bMonth", $month, PDO::PARAM_INT);
     $stmt->bindParam(":bDay", $day, PDO::PARAM_INT);
     $stmt->bindParam(":sex", $sex, PDO::PARAM_INT);
     $stmt->bindParam(":createAt", $currentTime, PDO::PARAM_INT);
     $stmt->bindParam(":ip_addr", $ip_addr, PDO::PARAM_INT);
     if ($stmt->execute()) {
         $this->setId($this->db->lastInsertId());
         $settings = new settings($this->db);
         $this->setAdmob($settings->getIntValue("admob"));
         unset($settings);
         $this->setLanguage("en");
         $result = array("error" => false, 'accountId' => $this->id, 'username' => $username, 'password' => $password, 'error_code' => ERROR_SUCCESS, 'error_description' => 'SignUp Success!');
         return $result;
     }
     return $result;
 }
Exemple #28
0
 public static function addUser($frm_submitted)
 {
     global $obj_db;
     $str_query = 'SELECT * FROM users WHERE username = "******"';
     $obj_result = mysqli_query($obj_db, $str_query);
     $arr_user = mysqli_fetch_array($obj_result, MYSQLI_ASSOC);
     if ($obj_result !== false && !empty($arr_user) && $arr_user !== false) {
         if (SHOW_USERNAME_IN_FORM && !empty($frm_submitted['username'])) {
             return 'Username already exists';
         } else {
             return 'Username (emailaddress) already exists';
         }
     }
     $str_query = 'SELECT * FROM users WHERE email = "' . $frm_submitted['email'] . '"';
     $obj_result2 = mysqli_query($obj_db, $str_query);
     $arr_user2 = mysqli_fetch_array($obj_result2, MYSQLI_ASSOC);
     if ($obj_result2 !== false && !empty($arr_user2) && $arr_user2 !== false) {
         return 'Emailaddress already exists';
     }
     // generate random password
     $password = Utils::generatePassword();
     $bln_insert = false;
     if (User::isSuperAdmin()) {
         $usertype = 'admin';
         $admin_group = $_SESSION['calendar-uid']['uid'];
         $bln_insert = true;
     } else {
         if (User::isAdmin()) {
             $usertype = 'user';
             $admin_group = $_SESSION['calendar-uid']['uid'];
             $bln_insert = true;
         }
     }
     if ($bln_insert) {
         $send_activation_mail = Settings::getSetting('send_activation_mail', $admin_group);
         $bln_send_activation_mail = $send_activation_mail == 'on';
         $str_query = 'INSERT INTO users ( `firstname` ,`infix` ,`lastname` ,`username`,`password` ,`email` ,`registration_date` ,' . '`birth_date`, `active`, `ip`, `country`, `country_code`, `usertype`, `admin_group`) VALUES (' . '"' . $frm_submitted['firstname'] . '",' . '"' . $frm_submitted['infix'] . '",' . '"' . $frm_submitted['lastname'] . '",' . '"' . (isset($frm_submitted['username']) && !empty($frm_submitted['username']) ? $frm_submitted['username'] : $frm_submitted['email']) . '",' . '"' . self::getPasswordHashcode($password) . '",' . '"' . $frm_submitted['email'] . '",' . 'NOW(),' . '"",' . ($bln_send_activation_mail ? '0, ' : '1,') . '"",' . '"",' . '"",' . '"' . $usertype . '",' . $admin_group . ')';
         $res = mysqli_query($obj_db, $str_query);
         $int_user_id = mysqli_insert_id($obj_db);
         $hash_code = self::getUserHashcode($int_user_id);
         if ($bln_send_activation_mail) {
             $str_query = 'UPDATE `users` SET user_hash = "' . $hash_code . '" ' . ' WHERE `user_id` = ' . $int_user_id;
             $res2 = mysqli_query($obj_db, $str_query);
         }
         if ($res !== false) {
             $admin_mail = '';
             if (defined('ADMIN_EMAILADDRESS')) {
                 $admin_mail = ADMIN_EMAILADDRESS;
             }
             if (User::isSuperAdmin()) {
                 $bln_send = Utils::sendMail('add_admin', $frm_submitted['email'], $password, $frm_submitted);
                 if ($frm_submitted['copy_to_admin'] && !empty($admin_mail)) {
                     Utils::sendMail('copy_to_admin_admin_created', $admin_mail, $password, $frm_submitted);
                 }
                 // insert default settings
                 settings::saveDefaultSettings($int_user_id);
             } else {
                 if (User::isAdmin()) {
                     $bln_send = Utils::sendMail('add_user', $frm_submitted['email'], $password, $frm_submitted, $int_user_id, $hash_code);
                     if ($frm_submitted['copy_to_admin'] && !empty($admin_mail)) {
                         Utils::sendMail('copy_to_admin_user_created', $admin_mail, $password, $frm_submitted);
                     }
                 }
             }
             if ($bln_send) {
                 if (defined('SHOW_CREATED_PASSWORD_WHEN_ADMIN_ADDS_USER') && SHOW_CREATED_PASSWORD_WHEN_ADMIN_ADDS_USER) {
                     return array('insert' => true, 'mail' => 'send', 'password' => $password);
                 } else {
                     return array('insert' => true, 'mail' => 'send');
                 }
             } else {
                 if (defined('SHOW_CREATED_PASSWORD_WHEN_ADMIN_ADDS_USER') && SHOW_CREATED_PASSWORD_WHEN_ADMIN_ADDS_USER) {
                     return array('insert' => true, 'mail' => 'notsend', 'password' => $password);
                 } else {
                     return array('insert' => true, 'mail' => 'notsend');
                 }
             }
         } else {
             return array('insert' => false, 'mail' => 'notsend');
         }
     } else {
         return array('insert' => false, 'mail' => 'notsend', 'error' => 'You have no admin rights!');
     }
 }
 function gettypes() {
     $sets=settings::getInstance()->getrow(array('tag'=>'table-friendlink'));
     if (!is_array($sets))
         return;
     $data=unserialize($sets['value']);
     preg_match_all('%\(([\d\w\/\.-]+)\)(\S+)%m',$data['types'],$result,PREG_SET_ORDER);
     $data=array();
     foreach ($result as $res) $data[$res[1]]=$res[2];
     return $data;
 }
Exemple #30
0
 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   |
 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     |
 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |
 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |
 |                                                                         |
 +-------------------------------------------------------------------------+
*/
require_once "../../include/session.php";
require_once "include/fields.php";
foreach ($phpbms->modules as $module => $moduleinfo) {
    if ($module != "base" && file_exists("../" . $module . "/adminsettings.php")) {
        include "modules/" . $module . "/adminsettings.php";
    }
}
require_once "modules/base/include/adminsettings_include.php";
$settings = new settings($db);
if (!hasRights("Admin")) {
    goURL(APP_PATH . "noaccess.php");
}
if (isset($_POST["command"])) {
    $statusmessage = $settings->processForm($_POST);
}
$therecord = $settings->getSettings();
$pageTitle = "Configuration";
$phpbms->cssIncludes[] = "pages/base/adminsettings.css";
$phpbms->jsIncludes[] = "modules/base/javascript/adminsettings.js";
foreach ($phpbms->modules as $module => $moduleinfo) {
    if ($module != "base" && file_exists("../" . $module . "/javascript/adminsettings.js")) {
        $phpbms->jsIncludes[] = "modules/" . $module . "/javascript/adminsettings.js";
    }
}