/** * Sets initial language configuration for global use. */ public function setLang() { $session = new Session(); $vars = new Vars(); if (!$session->exists('lang') || $vars->get('lang')) { $session->set('lang', $vars->get('lang') ? $vars->get('lang') : self::DEFAULT_LANG); } }
public function run() { $model = new Vars(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Vars'])) { $model->attributes = $_POST['Vars']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
function beginRequest($event) { $app = Yii::app(); $app->name = Vars::model()->find("varname='SITE_NAME'")->varvalue; $app->params['adminEmail'] = Vars::model()->find("varname='adminEmail'")->varvalue; $app->params['footerinfo'] = Vars::model()->find("varname='FOOTERINFO'")->varvalue; }
static function draw() { $page = self::urlArray(0); if ($page != "setupcomplete" && $page != "action" && file_exists(getSitePath() . "install/")) { forward("setupcomplete"); } $body = $header = $nav = $footer = NULL; if ($page) { $page_handler_class = "SocialApparatus\\" . ucfirst($page) . "PageHandler"; } else { $page_handler_class = "SocialApparatus\\HomePageHandler"; } Vars::clear(); if (class_exists($page_handler_class)) { $body = (new $page_handler_class())->view(); } else { new SystemMessage("Page not found."); forward("home"); } Vars::clear(); $header = display("page_elements/header"); Vars::clear(); $nav = display("page_elements/navigation"); Vars::clear(); $footer = display("page_elements/footer"); Vars::clear(); echo $header; echo $nav; echo $body; echo $footer; Debug::clear(); Dbase::con()->close(); die; }
static function getAllAssets($which_end) { // if cached already, return it if (isset(self::$assets)) { return self::$assets; } // otherwise, get it from settings $settings = Vars::getSettings(); $assets = array(); $i = 0; $indexes = array(); foreach ($settings['assets'][$which_end] as $type => $asset_group) { foreach ($asset_group as $asset_key => $asset_attributes) { $asset = new Asset(); $asset->type = $type; $asset->path = $asset_attributes['path']; $asset->source = $asset_attributes['source']; $asset->position = $asset_attributes['position']; $asset->weight = $asset_attributes['weight']; $asset->key = $asset_key; $assets[$i] = $asset; $indexes[$i] = $asset->weight; $i++; } } asort($indexes); $rtn = array(); foreach ($indexes as $key => $val) { $rtn[] = $assets[$key]; } return $rtn; }
public function getThumbnailUrl() { if ($this->getThumbnail()) { return get_sub_root() . "/files/avatars/" . $this->getThumbnail(); } $settings = Vars::getSettings(); return get_sub_root() . "/files/avatars/" . $settings['profile']['avatar_default']; }
public static function loadEngineTasks() { CodonRewrite::ProcessRewrite(); Vars::setParameters(); self::$activeModule = strtoupper(CodonRewrite::$current_module); Config::loadSettings(); self::loadModules(); }
public function delete() { $settings = Vars::getSettings(); // we delete avatar image first if ($this->getThumbnail() != $settings['profile']['avatar_default']) { @unlink(AVATAR_DIR . '/' . $this->getThumbnail()); } parent::delete(); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Vars::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
function testExecute() { $f1 = new Filter1(); $f2 = new Filter2(); $fc = new \Hiano\Filter\FilterChain(function () { Vars::$callback_executed = TRUE; }); $fc->addFilter($f1); $fc->addFilter($f2); $fc->execute(); $this->assertEquals(TRUE, Vars::$f1_executed); $this->assertEquals(TRUE, Vars::$f2_executed); $this->assertEquals(TRUE, Vars::$callback_executed); }
public function getArticles($page = 1, $category = null, $unread = null) { global $mysqli; $user_account_table = 'user_' . $this->getId() . '_account'; $user_category_table = 'user_' . $this->getId() . '_category'; $user_read_table = 'user_' . $this->getId() . '_read'; // where $where = array(); if ($category) { $where[] = " ua.category_id={$category} "; } if (sizeof($where)) { $where = " WHERE " . implode(' AND ', $where) . " "; if ($unread == 1) { $where .= " AND ur.article_id IS NULL "; } } else { $where = ''; if ($unread == 1) { $where = " WHERE ur.article_id IS NULL"; } } // join $join = ""; if ($unread == 1) { $join = " LEFT JOIN {$user_read_table} as ur ON ur.article_id=wa.id "; } // limit $limit = ""; if ($page) { $settings = Vars::getSettings(); $limit = " LIMIT " . ($page - 1) * $settings['articles_per_page'] . ", " . $settings['articles_per_page']; } // order by $order_by = ' ORDER BY wa.published_at DESC '; ///// final query $query = "SELECT wa.*, ua.id AS user_wechat_account_id FROM wechat_article as wa JOIN {$user_account_table} as ua ON ua.account_id=wa.account_id {$join} {$where} {$order_by} {$limit}"; //_debug($query); $result = $mysqli->query($query); $rtn = array(); while ($result && ($b = $result->fetch_object())) { $obj = new WechatArticle(); DBObject::importQueryResultToDbObject($b, $obj); $obj->user_wechat_account_id = $b->user_wechat_account_id; $rtn[] = $obj; } return $rtn; }
function sendTicketToClient($subject, $msg, array $attachements, $to) { $settings = Vars::getSettings(); $username = $settings['mail']['ticket']['username']; $password = $settings['mail']['ticket']['password']; if (strpos($username, '@') == false) { $username = decrypt($username); $password = decrypt($password); } load_library_phpmailer(); $mail = new PHPMailer(true); try { // $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) $mail->Mailer = $settings['mail']['ticket']['mailer']; $mail->SMTPAuth = true; // enable SMTP authentication $mail->CharSet = 'UTF-8'; $mail->SMTPSecure = $settings['mail']['ticket']['SMTPSecure']; // sets the prefix to the servier $mail->Host = $settings['mail']['ticket']['host']; // sets GMAIL as the SMTP server $mail->Port = $settings['mail']['ticket']['port']; // set the SMTP port for the GMAIL server $mail->Username = $username; // GMAIL username $mail->Password = $password; // GMAIL password $mail->AddReplyTo($settings['mail']['ticket']['from']); $mail->AddAddress($to); $mail->SetFrom($settings['mail']['ticket']['from'], $settings['sitename']); $mail->Subject = $subject; $mail->MsgHTML($msg); foreach ($attachements as $ticket) { $mail->addAttachment($ticket); } $mail->Send(); } catch (phpmailerException $e) { $log = new Log('mail', Log::ERROR, 'Failed to send email: ' . $e->errorMessage()); $log->save(); return false; } catch (Exception $e) { $log = new Log('mail', Log::ERROR, 'Failed to send email: ' . $e->getMessage()); $log->save(); return false; } return true; }
/** * 本体実行前にクラスを初期化する。 */ static function init() { //GET、POST、COOKIEの初期化 self::$post = $_POST; self::$get = $_GET; self::$cookie = $_COOKIE; if (get_magic_quotes_gpc()) { self::$post = map('stripslashes', self::$post); self::$get = map('stripslashes', self::$get); self::$cookie = map('stripslashes', self::$cookie); } self::$get = map('rawurldecode', self::$get); if (ini_get('mbstring.encoding_translation')) { $encode = ini_get('mbstring.internal_encoding'); $proc = "return mb_convert_encoding(\$str, 'UTF-8', '{$encode}');"; self::$post = map(create_function('$str', $proc), self::$post); } }
public static function ValidateConfirm() { $confid = Vars::GET('confirmid'); $sql = "UPDATE " . TABLE_PREFIX . "pilots SET confirmed=1, retired=0 WHERE salt='{$confid}'"; $res = DB::query($sql); if (DB::errno() != 0) { return false; } return true; }
* * NOTICE: All information contained herein is, and remains the property of SocialApparatus * and its suppliers, if any. The intellectual and technical concepts contained herein * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign * Patents, patents in process, and are protected by trade secret or copyright law. * * Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from SocialApparatus. * * Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $label = Vars::get("label"); $class = Vars::get("class"); $cancel = Vars("cancel"); if (!$label) { $label = "Save"; } if (!$class) { $class = "btn btn-success"; } if ($cancel) { echo <<<HTML <span class='btn-group'> HTML; } echo <<<HTML <input type="submit" class="{$class}" value="{$label}"> HTML;
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } $expire = $CFG->get('rank_regenerate'); $expire = 0; if (Cache::is_cached('top_10_players', $expire)) { Vars::set('players_rank', Cache::get('top_10_players')); } else { $players = array(); $sql = "SELECT player.id, player.name, player.level, player_index.empire \n FROM " . PLAYER_DATABASE . ".player \n LEFT JOIN " . PLAYER_DATABASE . ".player_index ON player_index.id=player.account_id \n LEFT JOIN " . PLAYER_DATABASE . ".guild_member ON guild_member.pid=player.id \n INNER JOIN " . ACCOUNT_DATABASE . ".account \n ON account.id=player.account_id\n WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'\n ORDER BY player.level DESC, player.exp DESC LIMIT 10"; $query = $DB->query($sql); while ($row = $DB->fetch($query)) { $players[] = $row; } Cache::set('top_10_players', $players); Vars::set('players_rank', $players); } if (Cache::is_cached('top_10_guilds', $expire)) { Vars::set('guilds_rank', Cache::get('top_10_guilds')); } else { $guilds = array(); $sql = "SELECT \n guild.name, guild.level, guild.win, guild.ladder_point, player_index.empire\n FROM " . PLAYER_DATABASE . ".guild \n LEFT JOIN " . PLAYER_DATABASE . ".player ON guild.master = player.id \n LEFT JOIN " . PLAYER_DATABASE . ".player_index ON player_index.id = player.account_id \n WHERE player.name NOT LIKE '[%]%' \n ORDER BY guild.ladder_point DESC LIMIT 10"; $query = $DB->query($sql); while ($row = $DB->fetch($query)) { $guilds[] = $row; } Cache::set('top_10_guilds', $guilds); Vars::set('guilds_rank', $guilds); }
* * Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $options = NULL; $field_value = Vars::get("value"); if (!$field_value) { $field_value = Vars::get('name'); } $name = Vars::get("name"); $label = Vars::get("label"); $options_values = Vars::get("options_values"); $class = Vars::get("class"); $args = arrayToArgs(Vars::get("args")); foreach ($options_values as $key => $value) { $checked = is_array($field_value) && in_array($key, $field_value) ? "checked" : ""; $options .= <<<HTML <div class="checkbox"> <label> <input type="checkbox" value="{$key}" name="{$name}[]" {$checked}> {$value} </label> </div> HTML; } $core = <<<HTML <div class='form-group'> HTML; if ($label) {
<?php require_once 'bootstrap.php'; $settings = Vars::getSettings(); /** rounting **/ $relative_uri; if ($settings['i18n']) { $relative_uri = get_request_uri_relative(); } else { $relative_uri = str_replace(get_sub_root(), '', get_request_uri()); } //_debug($settings['routing']); // try to match a route foreach ($settings['routing'] as $route) { $path = $route['path']; $isSecure = $route['isSecure']; $controller = $route['controller']; $i18n = $route['i18n']; // _debug($relative_uri); $vars = array(); $user = User::getInstance(); if (preg_match('/' . $path . '/', $relative_uri, $vars)) { // redirect to lang url if lang code is not here if ($i18n && $settings['i18n']) { HTML::redirectToI18nUrl(); } if ($isSecure && !$user->isLogin()) { dispatch('core/login'); } else { dispatch($controller, $vars); }
<?php /* * *********************************************************************** * * SocialApparatus CONFIDENTIAL * __________________ * * [2002] - [2017] SocialApparatus (http://SocialApparatus.co) * All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property of SocialApparatus * and its suppliers, if any. The intellectual and technical concepts contained herein * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign * Patents, patents in process, and are protected by trade secret or copyright law. * * Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from SocialApparatus. * * Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $user_guid = Vars::get("user_guid"); $user = getEntity($user_guid); $name = $user->first_name . " " . $user->last_name; $SiteName = getSiteName(); $output = translate("verify_email:subject", array($name, $SiteName)); echo $output;
* Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $value = Vars::get("value"); if (!$value) { $value = getInput('name'); } $name = Vars::get("name"); $label = Vars::get("label"); if ($label) { $label = "<label for='{$name}'>{$label}</label>"; } else { $label = NULL; } $required = Vars::get("required"); if ($required) { $required = "required='required'"; } else { $required = NULL; } $class = Vars::get("class"); $placeholder = Vars::get("placeholder"); echo <<<HTML <div class='form-group'> {$label} <input name="{$name}" type="email" class="{$class}" value="{$value}" placeholder="{$placeholder}" {$required}> </div> HTML ;
static function importFixture() { $settings = Vars::getSettings(); // import user fixture from "role.yml" if (User::tableExist() && isset($settings['users'])) { foreach ($settings['users'] as $user) { $u = new User(); $u->setEmail($user['email']); $u->setName($user['name']); $u->setPassword($user['password']); $u->setSalt($user['salt']); $roles = array(); foreach ($user['role'] as $role) { $roles[] = $role; } $u->setRole(implode(',', $roles)); $u->save(); } } }
* * NOTICE: All information contained herein is, and remains the property of SocialApparatus * and its suppliers, if any. The intellectual and technical concepts contained herein * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign * Patents, patents in process, and are protected by trade secret or copyright law. * * Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from SocialApparatus. * * Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $guid = Vars::get("guid"); $view_type = Vars::get("view_type"); $class = NULL; $user = getEntity($guid); $url = $user->getURL(); $footer = display("user/buttons"); $member_body = display("user/body", array("guid" => $guid)); switch ($view_type) { case "list": default: $timeago = display("output/friendly_time", array("timestamp" => $user->time_created)); $icon = $user->icon(MEDIUM, "media-object"); echo <<<HTML <button class="list-group-item member_list_element {$class}" data-guid="{$guid}"> <span class="media"> <span class="media-left"> {$icon}
<dt><?php echo $field->title; ?> </dt> <dd> <?php if ($field->type == 'dropdown') { echo "<select name=\"{$field->fieldname}\">"; $values = explode(',', $field->value); if (is_array($values)) { foreach ($values as $val) { $val = trim($val); echo "<option value=\"{$val}\">{$val}</option>"; } } echo '</select>'; } elseif ($field->type == 'textarea') { echo '<textarea name="' . $field->fieldname . '" class="customfield_textarea"></textarea>'; } else { ?> <input type="text" name="<?php echo $field->fieldname; ?> " value="<?php echo Vars::POST($field->fieldname); ?> " /></dd> <?php } } }
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Confirmare schimbare email'); if (isset($_SESSION['user_data']['email_token']) && $_SESSION['user_data']['email_token'] == '') { assign('content_tpl', 'content/emailchange/confirmation_error'); return; } $step = 'step1'; $args = Vars::get('args'); $username = isset($args[1]) ? $DB->escape($args[1]) : ''; $token = isset($args[1]) ? $DB->escape($args[2]) : ''; $data = $DB->select("id, email, new_email, email_step", ACCOUNT_DATABASE . ".account", "`login` LIKE '" . $username . "' AND `email_token` LIKE '" . $token . "'"); if (is_array($data)) { $args[0] = isset($args[0]) ? $args[0] : 'cancel'; if ($args[0] == 'confirm' && $data['email_step'] == 2) { $ok = $DB->query("UPDATE " . ACCOUNT_DATABASE . ".account SET `email`='" . $data['new_email'] . "', `email_token`='', `email_expire`='', `new_email`='', `email_step`='0' WHERE `id`='" . $data['id'] . "'"); $step = 'confirmation_confirm'; } elseif ($args[0] == 'accept' && $data['email_step'] == 1) { $token = sha1(microtime() . $data['email'] . rand(123151, 999999)); $ok = $DB->query("UPDATE " . ACCOUNT_DATABASE . ".account SET `email_token`='" . $token . "', `email_step`='2' WHERE `id`='" . $data['id'] . "'"); if ($ok) { $arr = array('login' => $username, 'site_name' => site_name(), 'site_url' => site_url(), 'token' => $token); $email_ses = email()->load('emailchange/emailchange_accept'); $email_ses->assign($arr); $email_ses->set('noreply@' . rtrim(site_name(), '/'), '', $data['new_email'], 'Schimbare de email'); $email_ses->send(); $step = 'step2'; }
* SocialApparatus CONFIDENTIAL * __________________ * * [2002] - [2017] SocialApparatus (http://SocialApparatus.co) * All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property of SocialApparatus * and its suppliers, if any. The intellectual and technical concepts contained herein * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign * Patents, patents in process, and are protected by trade secret or copyright law. * * Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from SocialApparatus. * * Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $timestamp = Vars::get("timestamp"); $date = date("c", $timestamp); ?> <small class="text-muted"> <i class="fa fa-clock-o"></i> <time class="timeago" datetime="<?php echo $date; ?> "> </time> </small><?php
<dt>Hub: *</dt> <dd> <select name="hub" id="hub"> <?php foreach ($hub_list as $hub) { echo '<option value="' . $hub->icao . '">' . $hub->icao . ' - ' . $hub->name . '</option>'; } ?> </select> </dd> <dt>Location: *</dt> <dd><select name="location"> <?php foreach ($country_list as $countryCode => $countryName) { if (Vars::POST('location') == $countryCode) { $sel = 'selected="selected"'; } else { $sel = ''; } echo '<option value="' . $countryCode . '" ' . $sel . '>' . $countryName . '</option>'; } ?> </select> <?php if ($location_error == true) { echo '<p class="error">Please enter your location</p>'; } ?> </dd>
<?php /* * *********************************************************************** * * SocialApparatus CONFIDENTIAL * __________________ * * [2002] - [2017] SocialApparatus (http://SocialApparatus.co) * All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property of SocialApparatus * and its suppliers, if any. The intellectual and technical concepts contained herein * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign * Patents, patents in process, and are protected by trade secret or copyright law. * * Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from SocialApparatus. * * Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $guid = Vars::get("guid"); echo display("buttons/like", array("guid" => $guid));
/** * Return a COOKIE variable. */ function cookie($var, $array = false) { return Vars::_request('cookie', $var, $array); }
$item_class = Vars::get("item_class"); if (!$item_class) { $item_class = "avatar_gallery"; } $link = Vars::get("link"); $file = getEntity($guid); classGateKeeper($file, "File"); $url = getSiteURL() . $file->getURL(); $owner_guid = $file->owner_guid; $owner = getEntity($owner_guid); $name = "<a href='" . $owner->getURL() . "'>" . $owner->first_name . " " . $owner->last_name . "</a>"; $view_type = Vars::get("view_type"); if (!$view_type) { $view_type = "list"; } $size = Vars::get("size"); if (!$size) { $size = MEDIUM; } $created = "Uploaded: by " . $name . " " . display("output/friendly_time", array("timestamp" => $file->time_created)); $icon = Image::getImageURL($file->guid, $size); $body_before = display("file/body_before", array("guid" => $guid)); $body_after = display("file/body_after", array("guid" => $guid)); $media_left_before = display("file:list:media:left:before", array("guid" => $guid)); $media_left_after = display("file:list:media:left:after", array("guid" => $guid)); $media_right_before = display("file:list:media:right:before", array("guid" => $guid)); $media_right_after = display("file:list:media:right:after", array("guid" => $guid)); if (getLoggedInUserGuid() == $file->owner_guid) { $buttons = "<a href='" . addTokenToURL(getSiteURL() . 'action/deleteFile/' . $guid) . "' class='btn btn-danger confirm'><i class='fa fa-times'></i></a>"; } $filename = $file->filename;
<?php /* * *********************************************************************** * * SocialApparatus CONFIDENTIAL * __________________ * * [2002] - [2017] SocialApparatus (http://SocialApparatus.co) * All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property of SocialApparatus * and its suppliers, if any. The intellectual and technical concepts contained herein * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign * Patents, patents in process, and are protected by trade secret or copyright law. * * Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from SocialApparatus. * * Contact Shane Barron admin@socia.us for more information. */ namespace SocialApparatus; denyDirect(); $inputs = Vars::get("inputs"); foreach ($inputs as $name => $value) { echo display("input/hidden", array("name" => $name, "value" => $value, "label" => NULL)); } echo display("input/textarea", array("name" => "comment", "placeholder" => "Your Comment", "label" => NULL, "class" => "form-control comment_textarea", "value" => NULL)); echo display("input/submit", array("label" => "Add Comment", "class" => "btn btn-info btn-sm add_comment_submit"));