Example #1
1
function create_user($email, $passwd, $repasswd, $firstname, $middlename, $lastname)
{
    if (strcmp($passwd, $repasswd) !== 0) {
        die("Password and Re-Enter Password is not equal");
    }
    $sql = "INSERT INTO user001 (ur_id, password, f_nm, m_nm, l_nm, cr_dt, cr_by)\nVALUES ('{$email}', '{$passwd}', '{$firstname}', '{$middlename}', '{$lastname}', now(), current_user());";
    $h_success = "Location:reg_success.html";
    $h_fail = "Location:reg_fail.php";
    $servername = "localhost";
    $username = "******";
    $password = "******";
    $dbname = "ESPDB";
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    if ($conn->query($sql) === TRUE) {
        echo "User Successfully Registered";
        register($_POST[firstname], $_POST[middlename], $_POST[lastname], $_POST[email], $_POST[dob], $_POST[phone], $_POST[addr1], $_POST[addr2], $_POST[city], $_POST[state], $_POST[country], $_POST[postalCode]);
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
        $msg = "Error: " . "<br>" . $conn->error;
        $h_fail = $h_fail . "?msg=" . $msg;
        header($h_fail);
        exit;
    }
    $conn->close();
}
Example #2
1
function GamePage()
{
    global $base_uri;
    $uid = params('user');
    if (!isset($_SESSION['uid'])) {
        return 0;
    } else {
        createToken($_SESSION['uid']);
    }
    $reg = 0;
    $shit = 0;
    if (!isset($uid) || $uid == "") {
        $uid = $_SESSION['uid'];
    } else {
        if (!check_registration($uid)) {
            $reg = 1;
        }
        $shit = 1;
    }
    $user = getUserInfo($_SESSION['access_token'], $uid, 'photo_max');
    if ($reg) {
        register($uid, $user['first_name'], $user['last_name']);
    }
    echo $user['first_name'] . " " . $user['last_name'];
    echo "<img src=\"" . $user['photo_max'] . "\" /><br><br>";
    if ($shit) {
        echo "<a href=\"/shit/" . $_SESSION['uid'] . "/" . $uid . "/" . getToken($_SESSION['uid']) . "\">shit</a><br>";
    }
    $friends = getUserFriends($_SESSION['access_token'], $uid);
    foreach ($friends as $friend) {
        echo $friend["first_name"] . " " . $friend["last_name"] . "<br>";
        echo "<a href=\"{$base_uri}/game/" . $friend['uid'] . "\"><img src=\"" . $friend["photo_50"] . "\" /></a><hr>";
    }
}
 public function save_slave($intSlaveID, $strMasterKey, $arrValues)
 {
     if ($strMasterKey == "") {
         return false;
     }
     $crypt = register('encrypt', array($strMasterKey));
     if ($intSlaveID) {
         //Update
         $arrQuery = array('name' => $arrValues['name'], 'domain' => $arrValues['domain'], 'uniqueid' => $arrValues['uniqueid'], 'db_type' => $arrValues['db_type'], 'db_host' => $crypt->encrypt($arrValues['db_host']), 'db_user' => $crypt->encrypt($arrValues['db_user']), 'db_password' => $crypt->encrypt($arrValues['db_password']), 'db_database' => $crypt->encrypt($arrValues['db_database']), 'db_prefix' => $crypt->encrypt($arrValues['db_prefix']), 'cookie_name' => $arrValues['cookie_name']);
         $objQuery = $this->db->prepare("UPDATE __plugin_sso :p WHERE id=?")->set($arrQuery)->execute($intSlaveID);
         if ($objQuery) {
             $id = $intSlaveID;
         } else {
             return false;
         }
     } else {
         //Insert
         $arrQuery = array('name' => $arrValues['name'], 'domain' => $arrValues['domain'], 'uniqueid' => $arrValues['uniqueid'], 'db_type' => $arrValues['db_type'], 'db_host' => $crypt->encrypt($arrValues['db_host']), 'db_user' => $crypt->encrypt($arrValues['db_user']), 'db_password' => $crypt->encrypt($arrValues['db_password']), 'db_database' => $crypt->encrypt($arrValues['db_database']), 'db_prefix' => $crypt->encrypt($arrValues['db_prefix']), 'cookie_name' => $arrValues['cookie_name']);
         $objQuery = $this->db->prepare("INSERT INTO __plugin_sso :p")->set($arrQuery)->execute();
         if ($objQuery) {
             $id = $objQuery->insertId;
         } else {
             return false;
         }
     }
     if ($id) {
         $this->pdh->enqueue_hook('eqdkp_sso_update');
         return $id;
     }
     return false;
 }
Example #4
0
 public function insert_log()
 {
     if ($this->in->get('log', '') != '') {
         include_once "../includes/epgp_parser.class.php";
         $parser = register('epgp_parser');
         //Check if event belongs to more than one MultiDKP-Pool
         $arrMDKPPools = $this->pdh->get('event', 'multidkppools', array($this->in->get('event', 0)));
         if (count($arrMDKPPools) > 1) {
             $this->core->message($this->user->lang('epgpimport_error_more_mdkp4event'), $this->user->lang('error'), 'red');
             $this->display();
             return;
         }
         $mixedResult = $parser->parse($this->in->get('log', ''), $this->in->get('event', 0), $this->in->get('itempool', 0));
         if (!$mixedResult) {
             //error
             $this->core->message($this->user->lang('epgpimport_error_wrongformat'), $this->user->lang('error'), 'red');
         } else {
             //success
             $this->core->message($this->user->lang('epgpimport_success'), $this->user->lang('success'), 'green');
             $this->tpl->assign_vars(array('RAID_ID' => $mixedResult));
             $this->core->set_vars(array('page_title' => $this->user->lang('epgpimport_import'), 'template_path' => $this->pm->get_data('epgpimport', 'template_path'), 'template_file' => 'admin/finished.html', 'display' => true));
         }
     } else {
         $this->core->message($this->user->lang('epgpimport_error_nolog'), $this->user->lang('error'), 'red');
     }
 }
 public static function parse($input)
 {
     if (trim($input->head->gameinfo->game) == 'Runes of Magic' and register('config')->get('default_game') != 'rom' or trim($input->head->gameinfo->game) == 'World of Warcraft' and register('config')->get('default_game') != 'wow') {
         message_die(register('user')->lang('wrong_game'));
     }
     $lang = trim($input->head->gameinfo->language);
     #$this->rli->add_data['log_lang'] = substr($lang, 0, 2);
     $xml = $input->raiddata;
     $data = array();
     foreach ($xml->zones->children() as $zone) {
         $data['zones'][] = array(trim($zone->name), (int) trim($zone->enter), (int) trim($zone->leave), (int) trim($zone->difficulty));
     }
     foreach ($xml->bosskills->children() as $bosskill) {
         $data['bosses'][] = array(trim($bosskill->name), (int) trim($bosskill->time), (int) trim($bosskill->difficulty));
     }
     foreach ($xml->members->children() as $xmember) {
         $name = trim($xmember->name);
         $note = isset($xmember->note) ? trim($xmember->note) : '';
         $data['members'][] = array($name, trim($xmember->class), trim($xmember->race), trim($xmember->level), $note);
         foreach ($xmember->times->children() as $time) {
             $attrs = $time->attributes();
             $type = (string) $attrs['type'];
             $extra = isset($attrs['extra']) ? (string) $attrs['extra'] : '';
             $data['times'][] = array($name, (int) $time, $type, $extra);
         }
     }
     foreach ($xml->items->children() as $xitem) {
         $cost = isset($xitem->cost) ? trim($xitem->cost) : '';
         $id = isset($xitem->itemid) ? trim($xitem->itemid) : '';
         $data['items'][] = array(trim($xitem->name), trim($xitem->member), $cost, (int) $id, (int) trim($xitem->time));
     }
     return $data;
 }
 public function display($messages = array())
 {
     // -- Messages ------------------------------------------------------------
     if ($messages) {
         foreach ($messages as $name) {
             $this->core->message($name, $this->user->lang('guildbank'), 'green');
         }
     }
     // get the saved data
     $arrValues = $this->config->get_config('guildbank');
     if ($this->arrData !== false) {
         $arrValues = $this->arrData;
     }
     // -- Template ------------------------------------------------------------
     // initialize form class
     $objForm = register('form', array('gb_settings'));
     $objForm->reset_fields();
     $objForm->lang_prefix = 'gb_';
     $objForm->validate = true;
     $objForm->use_fieldsets = true;
     $objForm->add_fieldsets($this->fields());
     // Output the form, pass values in
     $objForm->output($arrValues);
     $this->core->set_vars(array('page_title' => $this->user->lang('guildbank') . ' ' . $this->user->lang('settings'), 'template_path' => $this->pm->get_data('guildbank', 'template_path'), 'template_file' => 'admin/manage_settings.html', 'display' => true));
 }
Example #7
0
function DownloadImage($img)
{
    $pfh = register('file_handler');
    $puf = register('urlfetcher');
    $thumbfolder = $pfh->FolderPath('news/thumb', 'eqdkp');
    $imgfolder = $pfh->FolderPath('news', 'eqdkp');
    //If its an dynamic image...
    $extension_array = array('jpg', 'png', 'gif', 'jpeg');
    $path_parts = pathinfo($img);
    if (!in_array(strtolower($path_parts['extension']), $extension_array)) {
        return false;
    }
    // Load it...
    $tmp_name = md5(rand());
    $pfh->CheckCreateFile($imgfolder . $tmp_name);
    $pfh->putContent($imgfolder . $tmp_name, $puf->fetch($img));
    $i = getimagesize($imgfolder . $tmp_name);
    // Image is no image, lets remove it
    if (!$i) {
        $pfh->Delete($imgfolder . $tmp_name);
        return false;
    }
    $myFileName = $imgfolder . substr(md5(rand()), 0, 8) . '_' . $path_parts['filename'] . '.' . $path_parts['extension'];
    $pfh->rename($imgfolder . $tmp_name, $myFileName);
    return $myFileName;
}
    public function output()
    {
        $this->tpl->js_file($this->server_path . 'portal/articleslider/js/responsiveslides.min.js');
        $intLimit = $this->config('maxitems') ? intval($this->config('maxitems')) : 5;
        $intTimeout = $this->config('timeout') ? intval($this->config('timeout')) : 5000;
        $strWidth = strlen($this->config('width')) ? intval($this->config('width')) : '100%';
        $intHeight = strlen($this->config('height')) ? intval($this->config('height')) : 300;
        $intWordcount = strlen($this->config('wordcount')) ? intval($this->config('wordcount')) : 160;
        $blnAuto = true;
        if (strlen($this->config('auto'))) {
            $blnAuto = $this->config('auto');
        }
        $this->tpl->add_css("\n.rslides {\n  position: relative;\n  list-style: none;\n  overflow: hidden;\n  padding: 0;\n  margin: 0;\n}\n\n.rslides li {\n  -webkit-backface-visibility: hidden;\n  position: absolute;\n  display: none;\n  width: 100%;\n  left: 0;\n  top: 0;\n  }\n\n.rslides li:first-child {\n  position: relative;\n  display: block;\n  float: left;\n  }\n\n.rslides img {\n  display: block;\n  height: auto;\n  float: left;\n  width: 100%;\n  border: 0;\n  }\n.callbacks {\n  position: relative;\n  list-style: none;\n  overflow: hidden;\n  width: 100%;\n  padding: 0;\n  margin: 0;\n  }\n.callbacks_container.slider_" . $this->id . " {\n  position: relative;\n  margin: auto;\n" . ($strWidth != "100%" ? 'max-width: ' . $strWidth . ';' : '') . "\n  }\n.callbacks li {\n  position: absolute;\n  width: 100%;\n  left: 0;\n  bottom: 0;\n  }\n\n.callbacks img {\n  display: block;\n  position: relative;\n  z-index: 1;\n  height: auto;\n  width: 100%;\n  border: 0;\n}\n\t\t\t\t\n.slider_" . $this->id . " .callbacks_imagecontainer {\n\tmax-height: " . $intHeight . "px;\n\toverflow: hidden;\n}\n\t\t\t\t\n.callbacks .caption {\n  display: block;\n  position: absolute;\n  z-index: 2;\n  font-size: 14px;\n  text-shadow: none;\n  color: #fff;\n  background: #000;\n  background: rgba(0,0,0, .7);\n  left: 0;\n  right: 0;\n  bottom: 0;\n  padding: 10px 20px;\n  margin: 0;\n  max-width: none;\n}\n\n.callbacks_container:hover .callbacks_nav {\n\tdisplay:block;\t\n}\t\t\t\t\n\n.callbacks_nav {\n  position: absolute;\n  -webkit-tap-highlight-color: rgba(0,0,0,0);\n  top: 52%;\n  left: 0;\n  opacity: 0.7;\n  z-index: 3;\n  text-indent: -9999px;\n  overflow: hidden;\n  text-decoration: none;\n  height: 61px;\n  width: 38px;\n  background: transparent url(\"" . $this->server_path . "portal/articleslider/images/themes.gif\") no-repeat left top;\n  margin-top: -45px;\ndisplay:none;\n  }\n\n.callbacks_nav:active {\n  opacity: 1.0;\n  }\n\n.callbacks_nav.next {\n  left: auto;\n  background-position: right top;\n  right: 0;\n  border-top-left-radius: 4px;\n  border-bottom-left-radius: 4px;\n  }\n.callbacks_nav.prev {\n\tborder-top-right-radius: 4px;\n\tborder-bottom-right-radius: 4px;\t\n}\t\t\t\n.callbacks_tabs {\n  margin-top: 10px;\n  text-align: center;\n  }\n\n.callbacks_tabs li {\n  display: inline;\n  float: none;\n  _float: left;\n  *float: left;\n  margin-right: 5px;\n  }\n\n.callbacks_tabs a {\n  text-indent: -9999px;\n  overflow: hidden;\n  -webkit-border-radius: 15px;\n  -moz-border-radius: 15px;\n  border-radius: 15px;\n  background: #ccc;\n  background: rgba(0,0,0, .2);\n  display: inline-block;\n  _display: block;\n  *display: block;\n  -webkit-box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);\n  -moz-box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);\n  box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);\n  width: 14px;\n  height: 14px;\n  }\n\n.callbacks_here a {\n  background: #222;\n  background: rgba(0,0,0, .8);\n  }\t\t\t\n\t\t");
        $arrCategories = $this->config('categories');
        if (empty($arrCategories)) {
            $arrCategories = array();
        }
        $arrArticles = array();
        foreach ($arrCategories as $intCategoryID) {
            $arrArticles = array_merge($arrArticles, $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, $this->user->id, false, true)));
        }
        $arrArticles = array_unique($arrArticles);
        $arrSortedArticles = $this->pdh->sort($arrArticles, 'articles', 'date', 'desc');
        $arrSortedArticles = $this->pdh->limit($arrSortedArticles, 0, $intLimit);
        $this->tpl->add_js('		
		$("#slider_' . $this->id . '").responsiveSlides({
	        auto: ' . ($blnAuto ? 'true' : 'false') . ',
	        pager: true,
	        nav: true,
	        speed: 500,
			timeout: ' . $intTimeout . ',
			pause: true,
			namespace: "callbacks",
	      });
		', 'docready');
        $strOut = '<div class="callbacks_container slider_' . $this->id . '"><ul class="rslides" id="slider_' . $this->id . '">';
        foreach ($arrSortedArticles as $intArticleID) {
            $strOut .= '<li><a href="' . $this->controller_path . $this->pdh->get('articles', 'path', array($intArticleID)) . '">';
            $strPreviewImage = $this->pdh->get('articles', 'previewimage', array($intArticleID));
            if (strlen($strPreviewImage)) {
                $strImage = register('pfh')->FileLink($strPreviewImage, 'files', 'absolute');
            } else {
                $strImage = $this->server_path . 'portal/articleslider/images/dummy.jpg';
            }
            $strTitle = $this->pdh->get('articles', 'title', array($intArticleID));
            $strOut .= '<div class="callbacks_imagecontainer"><img src="' . $strImage . '" alt="' . $strTitle . '" /></div>';
            if (strlen($strTitle)) {
                $strText = $this->pdh->get('articles', 'text', array($intArticleID));
                $strText = $this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags($strText));
                $strText = strip_tags(xhtml_entity_decode($strText));
                $strText = truncate($strText, $intWordcount, '...', false, true);
                $strOut .= '<p class="caption"><span style="font-weight:bold;">' . $strTitle . '</span><br />';
                $strOut .= $strText;
                $strOut .= '</p>';
            }
            $strOut .= '</a></li>';
        }
        $strOut .= "</ul></div>";
        return $strOut;
    }
Example #9
0
 public function process($strHook, $arrParams = array(), $blnRecursive = false)
 {
     //Init Plugins and Portal modules for registering hooks
     register('pm');
     register('portal');
     //Register global hooks
     $this->scanGlobalHookFolder();
     if (!isset($this->hooks[$strHook])) {
         return $blnRecursive ? $arrParams : array();
     }
     $arrOutput = $blnRecursive ? $arrParams : array();
     foreach ($this->hooks[$strHook] as $hook) {
         include_once $this->root_path . $hook['classpath'] . '/' . $hook['class'] . '.class.php';
         $objHookClass = register($hook['class']);
         if ($objHookClass) {
             $strMethodname = $hook['method'];
             if ($blnRecursive) {
                 $arrOutput = $objHookClass->{$strMethodname}($arrOutput);
             } else {
                 $arrOutput[$hook['class']] = $objHookClass->{$strMethodname}($arrParams);
             }
         }
     }
     return $arrOutput;
 }
Example #10
0
 /**
  * Attempt to register a new user.
  *
  * @return \Illuminate\Http\Response
  */
 public function postRegister()
 {
     if (!Config::get('credentials.regallowed')) {
         return Redirect::route('account.register');
     }
     $input = Binput::only(['first_name', 'last_name', 'email', 'password', 'password_confirmation']);
     $val = UserRepository::validate($input, array_keys($input));
     if ($val->fails()) {
         return Redirect::route('account.register')->withInput()->withErrors($val->errors());
     }
     $this->throttler->hit();
     try {
         unset($input['password_confirmation']);
         $user = register($input);
         if (!Config::get('credentials.activation')) {
             $mail = ['url' => URL::to(Config::get('core.home', '/')), 'email' => $user->getLogin(), 'subject' => Config::get('core.name') . ' - Welcome'];
             Mail::queue('emails.welcome', $mail, function ($message) use($mail) {
                 $message->to($mail['email'])->subject($mail['subject']);
             });
             $user->attemptActivation($user->getActivationCode());
             $user->addGroup(getGroupProvider()->findByName('Users'));
             return Redirect::to(Config::get('core.home', '/'))->with('success', 'Your account has been created successfully.');
         }
         $code = $user->getActivationCode();
         $mail = ['url' => URL::to(Config::get('core.home', '/')), 'link' => URL::route('account.activate', ['id' => $user->id, 'code' => $code]), 'email' => $user->getLogin(), 'subject' => Config::get('core.name') . ' - Welcome'];
         Mail::queue('emails.welcome', $mail, function ($message) use($mail) {
             $message->to($mail['email'])->subject($mail['subject']);
         });
         return Redirect::to(Config::get('core.home', '/'))->with('success', 'Your account has been created. Check your email for the confirmation link.');
     } catch (UserExistsException $e) {
         return Redirect::route('account.register')->withInput()->withErrors($val->errors())->with('error', 'That email address is taken.');
     }
 }
Example #11
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->user->check_auth('a_awards_add');
     register("pm");
     $handler = array('active' => array('process' => 'set_active'), 'special' => array('process' => 'set_special'), 'sort' => array('process' => 'set_sort_ids'));
     parent::__construct(false, $handler);
     $this->process();
 }
Example #12
0
 public function __construct()
 {
     $this->user->check_auth('u_chat_view');
     register("pm");
     $handler = array('userlist' => array('process' => 'get_userlist'), 'openConversation' => array('process' => 'openConversation'), 'closeConversation' => array('process' => 'closeConversation'), 'loadOpenConversations' => array('process' => 'loadOpenConversations'), 'save' => array('process' => 'saveMessage'), 'markRead' => array('process' => 'markRead'), 'checkNew' => array('process' => 'checkNew'), 'getUser' => array('process' => 'getUser'), 'addUser' => array('process' => 'addUser'), 'changeTitle' => array('process' => 'changeTitle'), 'loadLatestMessages' => array('process' => 'loadLatestMessages'), 'loadOlderMessages' => array('process' => 'loadOlderMessages'), 'archiveGroupConv' => array('process' => 'archiveGroupConversation'), 'unreadTooltip' => array('process' => 'unreadTooltip'), 'leaveConversation' => array('process' => 'leaveConversation'));
     parent::__construct(false, $handler);
     $this->process();
 }
Example #13
0
 public function display()
 {
     include_once $this->root_path . 'libraries/twofactor/googleAuthenticator.class.php';
     $ga = new PHPGangsta_GoogleAuthenticator();
     $secret = $ga->createSecret();
     $this->tpl->assign_vars(array('TWOFACTOR_KEY' => $secret, 'TWOFACTOR_QR' => $ga->getQRCodeGoogleUrl(str_replace(' ', '_', 'EQdkpPlus ' . $this->config->get('guildtag')), $secret), 'TWOFACTOR_KEY_ENCR' => rawurlencode(register('encrypt')->encrypt($secret))));
     $this->core->set_vars(array('page_title' => "", 'header_format' => "simple", 'template_file' => 'twofactor_init.html', 'display' => true));
 }
function PCRE()
{
    global $user_password;
    if (preg_match('/^[0-9a-zA-Z]{8,16}$/', $user_password)) {
        register();
    } else {
        echo "Error";
    }
}
Example #15
0
function login_or_register($login_pressed, $register_pressed, $login_username, $login_password, $register_username, $register_password, $register_confirm_password)
{
    if (!empty($login_pressed)) {
        return login($login_username, $login_password);
    } elseif (!empty($register_pressed)) {
        return register($register_username, $register_password, $register_confirm_password);
    }
    return "";
}
Example #16
0
 /**
  * delete
  * Delete entries
  */
 public function delete()
 {
     $messages = array();
     $rc = register('ShoutboxClass')->deleteShoutboxEntry($this->in->get('delete_id', 0));
     if ($rc !== false) {
         $messages[] = $this->user->lang('sb_delete_success');
     }
     $this->display($messages);
 }
 public function add($strName, $strEmail, $strAuthKey, $strActivationKey, $strContent, $intActivated = 1)
 {
     $resQuery = $this->db->query("INSERT INTO __guildrequest_requests :params", array('tstamp' => $this->time->time, 'username' => $strName, 'email' => register('encrypt')->encrypt($strEmail), 'auth_key' => $strAuthKey, 'lastvisit' => 0, 'activation_key' => $strActivationKey, 'status' => 0, 'activated' => $intActivated, 'closed' => 0, 'content' => $strContent, 'voting_yes' => 0, 'voting_no' => 0, 'voted_user' => ''));
     $this->pdh->enqueue_hook('guildrequest_requests_update');
     if ($resQuery) {
         return $this->db->insert_id();
     }
     return false;
 }
 public function __get($name)
 {
     if ($name == 'type') {
         return self::$type;
     }
     $class = register($name);
     if ($class) {
         return $class;
     }
     return null;
 }
 public function getImporterClass($strImportername)
 {
     include_once $this->root_path . 'plugins/cmsimport/includes/importer_generic.class.php';
     if (is_file($this->root_path . 'plugins/cmsimport/importer/' . $strImportername . '_importer.class.php')) {
         include_once $this->root_path . 'plugins/cmsimport/importer/' . $strImportername . '_importer.class.php';
         $objImporter = register($strImportername . '_importer');
         if ($objImporter) {
             return $objImporter;
         }
     }
     return false;
 }
Example #20
0
 /**
  * delete
  * Delete entries
  */
 public function delete()
 {
     $messages = array();
     $delete_ids = $this->in->getArray('selected_ids', 'int');
     if (is_array($delete_ids) && count($delete_ids) > 0) {
         foreach ($delete_ids as $delete_id) {
             register('ShoutboxClass')->deleteShoutboxEntry($delete_id);
         }
         $messages[] = $this->user->lang('sb_delete_success');
     }
     $this->display($messages);
 }
Example #21
0
 public function get_html_leaderboard($mdkpid, $view_list, $settings, $with_twinks = false)
 {
     $arrMdkpIDList = $this->pdh->get('multidkp', 'id_list');
     $this->mdkpid = $mdkpid ? $mdkpid : $settings['default_pool'];
     $this->mdkpid = in_array($this->mdkpid, $arrMdkpIDList) ? $this->mdkpid : (isset($arrMdkpIDList[0]) ? $arrMdkpIDList[0] : 0);
     $columns = $settings['columns'];
     $arrGameClasses = array_keys($this->game->get('classes', 'id_0'));
     $arrDiff = array_diff($arrGameClasses, $columns);
     foreach ($arrDiff as $val) {
         array_push($columns, $val);
     }
     $break = isset($settings['maxperrow']) ? $settings['maxperrow'] : 5;
     $max_member = isset($settings['maxpercolumn']) ? $settings['maxpercolumn'] : 5;
     $sort = isset($settings['sort_direction']) ? $settings['sort_direction'] : 'asc';
     $column = isset($settings['column_type']) ? $settings['column_type'] : 'classid';
     //sort direction
     $this->sort_direction = $sort == 'asc' ? 1 : -1;
     //system dependant output
     $this->vpre = $this->pdh->pre_process_preset('current', array(), 0);
     $view_list = $this->pdh->aget('member', $column, 0, array($view_list));
     $column_list = array();
     foreach ($view_list as $member_id => $col) {
         if (is_array($columns) && in_array($col, $columns)) {
             $column_list[$col][] = $member_id;
         }
     }
     if (count($column_list) < 1 || count(current($column_list)) < 1) {
         return '';
     }
     $mdkp_sel = new hdropdown('lb_mdkpid', array('options' => $this->pdh->aget('multidkp', 'name', 0, array($this->pdh->get('multidkp', 'id_list'))), 'js' => ' onchange="$(\'#lbc\').val(1); form.submit();"', 'value' => $this->mdkpid));
     $leaderboard = '<div id="toggleLeaderboard"><div class="tableHeader"><h2>' . $this->user->lang('leaderboard') . '<span class="toggle_button"></span></h2></div><div class="toggle_container">' . $this->user->lang('select_leaderboard') . ': ' . $mdkp_sel . '<div class="leaderboard">';
     $colnr = 0;
     $with_twinks = $with_twinks === false ? !intval($this->config->get('show_twinks')) : $with_twinks;
     $intWidth = count($column_list) < $break ? floor(100 / count($column_list)) : floor(100 / $break);
     foreach ($columns as $col) {
         if (!isset($column_list[$col])) {
             continue;
         }
         $member_ids = $column_list[$col];
         $leaderboard .= '<div class="floatLeft ' . ($column == 'classid' ? 'leaderboard_class_' . $col : 'leaderboard_role_' . $col) . '" style="width:' . $intWidth . '%"><div><table class="table fullwidth borderless nowrap colorswitch"><tr><th colspan="2">';
         $leaderboard .= $column == 'classid' ? $this->game->decorate('primary', $col) . ' <span class="class_' . $col . '">' . $this->game->get_name('primary', $col) . '</span>' : $this->game->decorate('roles', $col) . ' ' . $this->pdh->get('roles', 'name', array($col));
         $leaderboard .= '</th></tr>';
         usort($member_ids, array(&$this, "sort_by_points"));
         $rows = $max_member < count($member_ids) ? $max_member : count($member_ids);
         for ($i = 0; $i < $rows; $i++) {
             $leaderboard .= '<tr><td class="left">' . $this->pdh->geth('member', 'memberlink', array($member_ids[$i], register('routing')->build('character', false, false, false), '', false, false, true, true)) . '</td><td class="right">' . $this->pdh->geth($this->vpre[0], $this->vpre[1], $this->vpre[2], array('%member_id%' => $member_ids[$i], '%dkp_id%' => $this->mdkpid, '%use_controller%' => true, '%with_twink%' => $with_twinks)) . '</td></tr>';
         }
         $leaderboard .= '</table></div></div>';
     }
     $this->jquery->Collapse('#toggleLeaderboard');
     $leaderboard .= '</div><div class="clear"></div></div></div>';
     return $leaderboard;
 }
Example #22
0
 public function add()
 {
     $arrFields = array('font' => array('type' => 'file', 'lang' => 'sg_font', 'extensions' => array('ttf'), 'folder' => $this->pfh->FolderPath('fonts', 'signatures'), 'numerate' => true));
     $objForm = register('form', array('addfont'));
     $objForm->reset_fields();
     $objForm->langPrefix = 'mc_';
     $objForm->validate = true;
     $objForm->add_fields($arrFields);
     $this->tpl->assign_vars(array('S_UPLOAD' => true));
     $objForm->output();
     $this->core->set_vars(array('page_title' => $this->user->lang('sg_manage_fonts'), 'template_path' => $this->pm->get_data('siggenerator', 'template_path'), 'template_file' => 'admin/fonts.html', 'display' => true));
 }
Example #23
0
 public function edit()
 {
     $strNotificationID = $this->in->get('id');
     $arrData = $this->pdh->get('notification_types', 'data', array($strNotificationID));
     if (!$arrData) {
         $this->display();
         return;
     }
     $arrMethods = register('ntfy')->getAvailableNotificationMethods(true);
     array_unshift($arrMethods, register('user')->lang('notification_type_none'), register('user')->lang('notification_type_eqdkp'));
     $this->tpl->assign_vars(array('NOTIFICATION_ID' => $strNotificationID, 'DD_PRIORITY' => new hdropdown('priority', array('value' => $this->pdh->get('notification_types', 'prio', array($strNotificationID)), 'options' => array(0 => $this->user->lang('notification_prio_0'), 1 => $this->user->lang('notification_prio_1'), 2 => $this->user->lang('notification_prio_2')))), 'ICON' => $this->pdh->get('notification_types', 'icon', array($strNotificationID)), 'DD_DEFAULT' => new hdropdown('default', array('value' => $this->pdh->get('notification_types', 'default', array($strNotificationID)), 'options' => $arrMethods)), 'GROUP_RADIO' => new hradio('group', array('value' => $this->pdh->get('notification_types', 'group', array($strNotificationID)))), 'GROUP_AT_SPINNER' => new hspinner('group_at', array('value' => $this->pdh->get('notification_types', 'group_at', array($strNotificationID)), 'min' => 0)), 'OVERWRITE_RADIO' => new hradio('overwrite', array('value' => 0))));
     $this->core->set_vars(array('page_title' => $this->user->lang('manage_notifications') . ': ' . $strNotificationID, 'template_file' => 'admin/manage_notifications_edit.html', 'display' => true));
 }
 private static function create_page_object()
 {
     $pdh = register('pdh');
     $preset = array('points', 'earned', array('%member_id%', '%dkp_id%', '%event_id%', '%with_twink%'), array());
     $pdh->update_user_preset('event_earned', $preset);
     $preset = array('points', 'spent', array('%member_id%', '%dkp_id%', '%event_id%', 0, '%with_twink%'), array());
     $pdh->update_user_preset('event_spent', $preset);
     $preset = array('points', 'adjustment', array('%member_id%', '%dkp_id%', '%event_id%', '%with_twink%'), array());
     $pdh->update_user_preset('event_adjustment', $preset);
     $preset = array('points', 'current', array('%member_id%', '%dkp_id%', '%event_id%', 0, '%with_twink%'), array('%dkp_id%', false, false));
     $pdh->update_user_preset('event_current', $preset);
     $pdh->delete_page('quickdkp');
     $pdh->add_page('quickdkp', array('hptt_quickdkp_tooltip' => array('name' => 'hptt_quickdkp_tooltip', 'table_main_sub' => '%event_id%', 'table_subs' => array('%event_id%', '%member_id%', '%dkp_id%'), 'page_ref' => 'listraids.php', 'no_root' => true, 'show_numbers' => false, 'show_select_boxes' => false, 'show_detail_twink' => false, 'table_sort_col' => 0, 'table_sort_dir' => 'desc', 'table_presets' => array(array('name' => 'ename', 'sort' => false, 'th_add' => '', 'td_add' => ''), array('name' => 'event_earned', 'sort' => false, 'th_add' => '', 'td_add' => ''), array('name' => 'event_spent', 'sort' => false, 'th_add' => '', 'td_add' => ''), array('name' => 'event_adjustment', 'sort' => false, 'th_add' => '', 'td_add' => ''), array('name' => 'event_current', 'sort' => false, 'th_add' => '', 'td_add' => '')))));
 }
Example #25
0
 public function display()
 {
     $blnIsUser = $this->user->is_signedin() && $this->user->check_auth('u_files_man', false);
     if (!$blnIsUser) {
         header("HTTP/1.0 403 Access Denied");
         return;
     }
     $blnResult = register('uploader')->upload_mime('file', 'system/articleimages', array("image/jpeg", "image/png", "image/gif"), array('jpg', 'png', 'gif'), 'uploaded_' . md5(rand()), register('pfh')->FolderPath('', 'files'));
     if ($blnResult) {
         header('Content-type: application/json; charset=utf-8');
         echo json_encode(array('location' => register('pfh')->FolderPath('system/articleimages', 'files', 'absolute') . $blnResult));
         return;
     }
     header("HTTP/1.0 500 Server Error");
 }
Example #26
0
 public function isRegistered($strHookname)
 {
     if (!$this->blnScanned) {
         //Init Plugins and Portal modules for registering hooks
         register('pm');
         register('portal');
         //Register global hooks
         $this->scanGlobalHookFolder();
         $this->blnScanned = true;
     }
     if (isset($this->hooks[$strHookname])) {
         return true;
     }
     return false;
 }
 public static function install($child = false)
 {
     $intTwitchFieldID = register('pdh')->get('user_profilefields', 'field_by_name', array('twitch'));
     $intHitboxFieldID = register('pdh')->get('user_profilefields', 'field_by_name', array('hitbox'));
     //Create Twitch Profilefield
     if (!$intTwitchFieldID) {
         $arrOptions = array('name' => 'Twitch', 'lang_var' => '', 'type' => 'text', 'length' => 30, 'minlength' => 3, 'validation' => '[\\w_\\.]+', 'required' => 0, 'show_on_registration' => 0, 'enabled' => 1, 'is_contact' => 1, 'contact_url' => 'http://www.twitch.tv/%s', 'icon_or_image' => 'fa-twitch', 'bridge_field' => null);
         register('pdh')->put('user_profilefields', 'insert_field', array($arrOptions, array()));
     }
     //Create Hitbox Profilefield
     if (!$intHitboxFieldID) {
         $arrOptions = array('name' => 'Hitbox', 'lang_var' => '', 'type' => 'text', 'length' => 30, 'minlength' => 3, 'validation' => '[\\w_\\.]+', 'required' => 0, 'show_on_registration' => 0, 'enabled' => 1, 'is_contact' => 1, 'contact_url' => 'http://www.hitbox.tv/%s', 'icon_or_image' => '', 'bridge_field' => null);
         register('pdh')->put('user_profilefields', 'insert_field', array($arrOptions, array()));
     }
     register('pdh')->process_hook_queue();
 }
 public function add($strName, $strEmail, $strAuthKey, $strActivationKey, $strContent, $intActivated = 1)
 {
     $arrQuery = array('tstamp' => $this->time->time, 'username' => $strName, 'email' => register('encrypt')->encrypt($strEmail), 'auth_key' => $strAuthKey, 'lastvisit' => 0, 'activation_key' => $strActivationKey, 'status' => 0, 'activated' => $intActivated, 'closed' => 0, 'content' => $strContent, 'voting_yes' => 0, 'voting_no' => 0, 'voted_user' => '', 'user_id' => $this->user->id > 0 ? $this->user->id : 0);
     $objQuery = $this->db->prepare("INSERT INTO __guildrequest_requests :p")->set($arrQuery)->execute();
     $this->pdh->enqueue_hook('guildrequest_requests_update');
     if ($objQuery) {
         $id = $objQuery->insertId;
         $log_action = $this->logs->diff(false, $arrQuery, $this->arrLogLang);
         $this->log_insert("action_request_added", $log_action, $id, $arrQuery["username"], 0, 'guildrequest');
         //Insert Data into Statistics Plugin
         if ($this->pm->check('statistics', PLUGIN_INSTALLED)) {
             $this->pdh->put('statistics_plugin', 'insert', array('guildrequest_applications', 1));
         }
         return $id;
     }
     return false;
 }
Example #29
0
    public function _construct()
    {
        $out = '<input type="' . self::$type . '" name="' . $this->name . '" ';
        if (empty($this->id)) {
            $this->id = $this->cleanid($this->name);
        }
        $out .= 'id="' . $this->id . '" ';
        if (isset($this->value)) {
            $out .= 'value="' . $this->value . '" ';
        }
        if (!empty($this->class)) {
            $out .= 'class="' . $this->class . '" ';
        }
        if (!empty($this->size)) {
            $out .= 'size="' . $this->size . '" ';
        }
        if ($this->readonly) {
            $out .= 'readonly="readonly" ';
        }
        if (!empty($this->js)) {
            $out .= $this->js . ' ';
        }
        if ($this->preview) {
            $out .= 'onchange="previewImage_' . $this->name . '(this);"';
        }
        $out .= ' />';
        if ($this->required) {
            $out .= '<span class="fv_msg" data-errormessage="' . registry::fetch('user')->lang('fv_required') . '"></span>';
        }
        if ($this->preview) {
            $out = '<img src="' . (isset($this->value) && $this->value ? $this->value : registry::get_const('server_path') . 'images/global/default-image.svg') . '" class="uploadPreview" style="max-height: 60px;"/>' . $out;
            register('tpl')->add_js('
			function previewImage_' . $this->name . '(object) {
				if (object.files[0].type == "image/jpeg" || object.files[0].type == "image/png" || object.files[0].type == "image/gif"){
					var oFReader = new FileReader();
					oFReader.readAsDataURL(object.files[0]);
			
					oFReader.onload = function (oFREvent) {
						$(object).parent().find(\'.uploadPreview\').attr(\'src\', oFREvent.target.result);
					};
				}
			};');
        }
        $this->out = $out;
    }
Example #30
0
 function __construct($init = NULL, $aliases = NULL, $name = NULL)
 {
     $this->key2values = [];
     $this->value2key = [];
     $this->all_sub_keys = [];
     $this->level = [];
     $this->simple_keys = [];
     $this->recursive_keys = [];
     $this->name = $name;
     if ($aliases === NULL) {
         $aliases = [];
     }
     $this->aliases = $aliases;
     #echo "\$init:\n";
     #var_dump($init);
     if ($init !== NULL) {
         foreach ($init as $k => $v) {
             if (!is_array($v)) {
                 _die("bad type, not array");
             }
             if (is_vec($v)) {
                 $this->simple_keys[] = $k;
                 register2($this, $k, $v);
             } else {
                 $this->recursive_keys[] = $k;
                 foreach ($v as $_ => &$v_) {
                     register($this, $k, $_);
                     #echo "\$v_:\n";
                     #var_dump($v_);
                     if (!ISDEPATH($v_)) {
                         $v_ = DEPATH($v_, $aliases);
                     }
                     $this->all_sub_keys = array_merge($this->all_sub_keys, $v_->all_sub_keys);
                     register3($this, $v_->key2values);
                 }
             }
             $this->level[$k] = $v;
         }
     }
     # Sort and remove duplicates
     $this->all_sub_keys = array_values(array_unique($this->all_sub_keys));
     foreach (array_keys($this->key2values) as $k) {
         $this->key2values[$k] = array_unique($this->key2values[$k]);
     }
 }