Пример #1
0
 function __construct()
 {
     $this->status = 1;
     $this->status_array = arrayToObject(array(array('id' => 1, 'name' => "Active"), array('id' => 0, 'name' => "Deactive")));
     $this->size_array = arrayToObject(array(array('id' => "normal", 'name' => "normal"), array('id' => "large", 'name' => "large")));
     $this->date = date('Y-m-d H:i:s');
 }
 public static function _index($div, $plt)
 {
     $division = Division::findByName(strtolower($div));
     $platoonId = Platoon::getIdFromNumber($plt, $division->id);
     if (!is_null($platoonId)) {
         $user = User::find(intval($_SESSION['userid']));
         $member = Member::find(intval($_SESSION['memberid']));
         $tools = Tool::find_all($user->role);
         $divisions = Division::find_all();
         $platoon = Platoon::findById($platoonId);
         $members = arrayToObject(Platoon::members($platoonId));
         $js = 'platoon';
         $memberIdList = Platoon::memberIdsList($platoonId);
         $activity = arrayToObject(Platoon::forumActivity($platoonId));
         $bdate = date("Y-m-d", strtotime("now - 30 days"));
         $edate = date("Y-m-d", strtotime("now"));
         $div = $division->id;
         Flight::render('platoon/main/statistics', compact('platoon', 'activity'), 'statistics');
         Flight::render('platoon/main/members', compact('division', 'members', 'js', 'bdate', 'edate'), 'membersTable');
         Flight::render('platoon/main/index', compact('user', 'member', 'division', 'platoon', 'memberIdList', 'plt', 'div', 'members', 'platoonId'), 'content');
         Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
     } else {
         Flight::redirect('404/', 404);
     }
 }
Пример #3
0
 public static function members($squad_id)
 {
     // finds active, LOAs, and pending members
     $sql = "SELECT * FROM " . Member::$table . " WHERE squad_id = {$squad_id} AND (status_id = 1 OR status_id = 3 OR status_id = 999)";
     $sql .= " ORDER BY member.rank_id DESC, member.join_date DESC";
     return arrayToObject(Flight::aod()->sql($sql)->many());
 }
Пример #4
0
 public function setUp()
 {
     $config = array('mysql' => array('mySqlDb' => 'foo', 'mySqlHost' => 'bar', 'mySqlUser' => 'foo', 'mySqlPassword' => 'bar'), 'user' => array('email' => '*****@*****.**'), 'application' => array('appId' => 'fooId'));
     $config = arrayToObject($config);
     $params = array('db' => true);
     $this->db = new DatabaseMySqlOverride($config, $params);
 }
Пример #5
0
 public function login($referer = '')
 {
     if ($this->loggedUser->Admin->id > 0) {
         $this->redirect($this->request->webroot);
     }
     $referer = urldecode($referer);
     $this->layout = "login";
     if (!empty($this->request->data)) {
         $admin = $this->UserAdmin->findByEmail($this->request->data['UserAdmin']['email']);
         $this->setCookie();
         if (empty($admin) || $admin['UserAdmin']['password'] != sha1($this->request->data['UserAdmin']['password'])) {
             $this->Session->setFlash(__('The email or password you entered is incorrect.'), 'flash/error');
         } elseif ($admin['UserAdmin']['status'] == USER_ADMIN_DISABLE) {
             $this->Session->setFlash(__('Your account has been disabled.'), 'flash/error');
         } else {
             $this->loggedUser = new stdClass();
             $this->loggedUser->User = new stdClass();
             $this->loggedUser->User->id = 0;
             unset($admin['UserAdmin']['password']);
             $this->loggedUser->Admin = arrayToObject($admin['UserAdmin']);
             $this->Session->write('loggedUser', $this->loggedUser);
             $this->redirect($referer);
         }
     }
 }
Пример #6
0
 public function setUp()
 {
     $config = array('credentials' => array('awsKey' => 'foo', 'awsSecret' => 'bar'), 'aws' => array('s3BucketName' => 'foo', 's3Host' => 'bar'));
     $config = arrayToObject($config);
     $params = array('db' => true);
     $this->fs = new FileSystemS3Override($config, $params);
 }
Пример #7
0
 public static function findByDivision($game_id, $limit = false)
 {
     if (!$limit) {
         $limit = 10;
     }
     return arrayToObject(Flight::aod()->from(self::$table)->where(array("member.game_id" => $game_id))->limit($limit)->sortDesc('date')->join('actions', array('actions.id' => 'user_actions.type_id'))->join('member', array('member.member_id' => 'user_actions.target_id'))->select(array('date', 'user_id', 'type_id', 'target_id', 'verbage', 'icon'))->many());
 }
 public static function _manage_inactives()
 {
     $user = User::find(intval($_SESSION['userid']));
     $member = Member::find(intval($_SESSION['memberid']));
     $tools = Tool::find_all($user->role);
     $divisions = Division::find_all();
     switch ($user->role) {
         case User::isDev():
             $type = "div";
             $id = $member->game_id;
             break;
         case 1:
             $type = "sqd";
             //$id = $member->squad_id; break;
         //$id = $member->squad_id; break;
         case 2:
             $type = "plt";
             $id = $member->platoon_id;
             break;
         case 3:
             $type = "div";
             $id = $member->game_id;
             break;
         default:
             $type = "div";
             $id = $member->game_id;
             break;
     }
     $flagged_inactives = Member::findInactives($id, $type, true);
     $flaggedCount = count($flagged_inactives) ? count($flagged_inactives) : 0;
     $inactives = Member::findInactives($id, $type);
     $inactiveCount = count($inactives) ? count($inactives) : 0;
     Flight::render('manage/inactive_members', array('member' => $member, 'user' => $user, 'inactives' => arrayToObject($inactives), 'flagged' => arrayToObject($flagged_inactives), 'flaggedCount' => $flaggedCount, 'inactiveCount' => $inactiveCount), 'content');
     Flight::render('layouts/application', array('user' => $user, 'member' => $member, 'tools' => $tools, 'divisions' => $divisions, 'js' => 'manage'));
 }
Пример #9
0
 public function setUp()
 {
     $config = array('credentials' => array('awsKey' => 'foo', 'awsSecret' => 'bar'), 'aws' => array('simpleDbDomain' => 'sdbdomain'), 'user' => array('email' => '*****@*****.**'), 'application' => array('appId' => 'fooId'));
     $config = arrayToObject($config);
     $params = array('db' => true);
     $this->db = new DatabaseSimpleDbOverride($config, $params);
 }
Пример #10
0
 /**
  * @param $name
  * @return null
  */
 public function getByName($name)
 {
     foreach ($this->data as $val) {
         if ($val['name'] == $name) {
             return arrayToObject($val['name']);
         }
     }
     return null;
 }
Пример #11
0
function arrayToObject($array)
{
    foreach ($array as $key => $value) {
        if (is_array($value)) {
            $array[$key] = arrayToObject($value);
        }
    }
    return (object) $array;
}
Пример #12
0
 protected function create($id)
 {
     $this->apiType = (new \Member\Open\Type())->getById($id);
     if (!$this->apiType) {
         throw new \Exception('没有开通的第三方接入');
     }
     //init api
     $config = arrayToObject(C("open:" . $this->apiType->key));
     $this->openApi = \System\Library\Open\OpenFactory::createOpenApi($this->apiType->key, $config);
 }
Пример #13
0
 public static function findSquadLeaders($gid, $order_by_rank = false)
 {
     $sql = "SELECT last_activity, rank.abbr, member_id, forum_name, platoon.name, member.battlelog_name FROM " . Member::$table . " LEFT JOIN platoon ON platoon.id = member.platoon_id LEFT JOIN rank ON rank.id = member.rank_id WHERE member.game_id = {$gid} AND position_id = 5";
     if ($order_by_rank) {
         $sql .= " ORDER BY member.rank_id DESC, member.forum_name ASC ";
     } else {
         $sql .= " ORDER BY platoon.id, forum_name";
     }
     $params = Flight::aod()->sql($sql)->one();
     return arrayToObject($params);
 }
Пример #14
0
function arrayToObject($e)
{
    if (gettype($e) != 'array') {
        return;
    }
    foreach ($e as $k => $v) {
        if (gettype($v) == 'array' || getType($v) == 'object') {
            $e[$k] = (object) arrayToObject($v);
        }
    }
    return (object) $e;
}
Пример #15
0
 public function setUp()
 {
     $this->file = 'file.jpg';
     $this->photo = array('id' => 'foo', 'path10x10' => "/{$this->file}");
     if (class_exists('vfsStream')) {
         vfsStreamWrapper::register();
         vfsStreamWrapper::setRoot(new vfsStreamDirectory('fsDir'));
         $this->root = vfsStream::url('fsDir');
         $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild($this->file), 'Init validation that vfs file does not exist failed');
     }
     $this->vfsPath = sprintf('%s%s', $this->root, $this->photo['path10x10']);
     $this->host = 'http://test';
     $config = array('localfs' => array('fsRoot' => $this->root, 'fsHost' => $this->host), 'paths' => array('temp' => sys_get_temp_dir()));
     $config = arrayToObject($config);
     $params = array('db' => true);
     $this->fs = new FileSystemLocal($config, $params);
 }
function arrayToObject($result_query) {
if (!is_array($result_query)) {
return $result_query;
}
$object = new stdClass();
if (is_array($result_query) && count($result_query) > 0) {
foreach ($result_query as $name=>$value) {
// $name = strtolower(trim($name));
// if (!empty($name)) {
$object->$name = arrayToObject($value);
// }
}
return $object;
}
else {
return FALSE;
}
}
Пример #17
0
function arrayToObject($array)
{
    if (!is_array($array)) {
        return $array;
    }
    $object = new stdClass();
    if (is_array($array) && count($array) > 0) {
        foreach ($array as $name => $value) {
            $name = strtolower(trim($name));
            if (!empty($name)) {
                $object->{$name} = arrayToObject($value);
            }
        }
        return $object;
    } else {
        return FALSE;
    }
}
Пример #18
0
 public function verifyLogin($email, $password)
 {
     $message = '';
     $loggedUser = new stdClass();
     $user = $this->findByUserEmail($email);
     if (empty($user) || empty($user['UserModel']) || !$this->checkPassword($password, $user['UserModel']['user_pass'])) {
         $message = __('The email or password you entered is incorrect');
     } elseif ($user['UserModel']['user_status'] == USER_DISABLE) {
         $message = __('Your account has been disabled');
     } elseif ($user['UserModel']['user_status'] == USER_INACTIVE) {
         $message = __('Your account was not activated. Please check your email then active the account to continue');
     } else {
         //$history = new UserLoginHistory();
         //$history->save(array('user_id' => $user['UserModel']['id'], 'ip' => $_SERVER['REMOTE_ADDR']), array('validate' => false));
         $loggedUser->Admin = new stdClass();
         $loggedUser->Admin->id = 0;
         $loggedUser->User = arrayToObject($user['UserModel']);
         $roles = new UserRoleAccess();
         $loggedUser->Role = Hash::combine($roles->findByUserId($user['UserModel']['id']), 'UserRoleAccess.role_id', 'UserRoleAccess.role_id');
     }
     return array('status' => empty($message) ? true : false, 'message' => $message, 'user' => $loggedUser);
 }
Пример #19
0
function pb_switch($d, $set = '')
{
    if (empty($set)) {
        if (!empty($d)) {
            if (is_array($d)) {
                $r = arrayToObject($d);
            }
            if (is_object($d)) {
                $r = objectToArray($d);
            }
            return $r;
        } else {
            return false;
        }
    } else {
        if ($set == 'object') {
            return arrayToObject($d);
        } else {
            if ($set == 'array') {
                return objectToArray($d);
            }
        }
    }
}
Пример #20
0
function kib_e()
{

	$modul = $_GET['menuID'];
	$mode = $_GET['mode'];
	$tab = $_GET['tab'];
	$skpd_id = $_GET['skpd_id'];
	$kib = $_GET['kib'];
	$tahun = $_GET['tahun'];
	$kelompok=$_GET['bidang'];
	$tipe=$_GET['tipe_file'];
	// pr($_GET);
	$data=array(
	    "modul"=>"14",
	    "mode"=>"1",
	    "kib"=>"KIB-E",
	    "tahun"=>"2010",
	    "skpd_id"=>"",
	    "kelompok"=>$kelompok,
	    "tab"=>"1"
	);

	//mendeklarasikan report_engine. FILE utama untuk reporting
	$REPORT=new report_engine();

	//menggunakan api untuk query berdasarkan variable yg telah dimasukan
	$REPORT->set_data($data);

	//mendapatkan jenis query yang digunakan
	$query=$REPORT->list_query($data);
	// pr($query);
	//mengenerate query
	// $result_query=$REPORT->retrieve_query($query);
	$table_name = "asetlain";
	$result_query=$REPORT->QueryKib($query,$table_name);
	$result = arrayToObject($result_query);
	if ($result){
		print(json_encode(array('status'=>true, 'data'=>$result)));
	}else{
		print(json_encode(array('status'=>false)));
	}
	
	exit;
}
Пример #21
0
								<?php 
                echo ordsuffix($i);
                ?>
 Squad - TBA <span class="badge"><?php 
                echo Squad::countSquadMembers($squad->id);
                ?>
</span>

							<?php 
            }
            ?>
						</a>

						<?php 
            $squadMembers = arrayToObject(Squad::findSquadMembers($squad->id));
            ?>
						<?php 
            if (count((array) $squadMembers)) {
                ?>

							<!-- get squad members -->
							<div class='squad-group collapse' id='collapseSquad_<?php 
                echo $i;
                ?>
'>

								<?php 
                foreach ($squadMembers as $player) {
                    ?>
									<?php 
Пример #22
0
   </tr>
   <tr>
   <td style="width:960px;" colspan="3" valign="top">

<br />
<!-- BEGIN: moduleGroup -->
<div class="moduleGroup" style="width:960px;">
 <div class="moduleContainer">
  <div class="epi-chromeBorder">
   <div class="epi-chromeBG">
    <div class="two" style="float:none; width:950px;">
     <div style="width:950px;">
      <h3 style="margin-top:6px;" class="cornered boxShadowSmall">News Headline Archives</h3>
<?php 
foreach ($arrHeadlines as $key => $val) {
    $objHeadline = arrayToObject($arrHeadlines[$key]);
    ?>
<!-- SET: <?php 
    echo $objHeadline->id;
    ?>
 -->
<div class="newsArticle clearfix" style="min-height:80px; max-height:200px; height:auto; border-bottom:1px dotted #CCCCCC;">
 <div class="two" style="border:0px; width:750px;">
  <div>
   <span class="date"><?php 
    echo generateDateString($objHeadline->news_post_month, $objHeadline->news_post_day, $objHeadline->news_post_year);
    ?>
</span><br />
   <a href="<?php 
    echo BASE_URL_RSB;
    ?>
Пример #23
0
<div class='panel panel-primary'>

	<div class='panel-heading'><strong>BF Server Activity</strong> (<?php 
echo $totalGames;
?>
 games in 30 days)<span class='pull-right'> Last <?php 
echo MAX_GAMES_ON_PROFILE;
?>
 games</span></div>

	<?php 
if ($totalGames > 0) {
    ?>
		<?php 
    $games = arrayToObject($games);
    ?>
		<?php 
    foreach ($games as $game) {
        ?>
			<a class="list-group-item clearfix" href="<?php 
        echo generate_report_link($game->game_id, $game->report_id);
        ?>
" target="_blank">
				<span class="pull-right">

					<?php 
        if (!is_null($game->map_name)) {
            ?>
						<img src='assets/images/maps/<?php 
            echo strtolower($game->map_name);
Пример #24
0
        <div class='col-xs-1 hidden-sm hidden-xs'>
            <?php 
echo Member::avatar($memberInfo->member_id, 'large');
?>
</div>

        <div class='col-xs-5'>
            <h2>
                <strong><?php 
echo Rank::convert($memberInfo->rank_id)->abbr . " " . $memberInfo->forum_name;
?>
</strong>
					<span class="games_played">
						<?php 
if (count($gamesPlayed)) {
    $gamesPlayed = arrayToObject($gamesPlayed);
    ?>
                            <?php 
    foreach ($gamesPlayed as $game) {
        ?>
                            <?php 
        $img = "assets/images/game_icons/16x16/{$game->short_name}.png";
        ?>
                            <?php 
        if (file_exists($img)) {
            ?>
                                <sup><img class="img-circle" title="<?php 
            echo $game->full_name;
            ?>
"
                                          src="<?php 
Пример #25
0
 /**
  * @depends testValidateVfsFunctionSuccess
  */
 public function testWriteConfFailure()
 {
     $_SERVER['HTTP_HOST'] = 'foo';
     $this->plugin->inject('config', arrayToObject(array('paths' => array('userdata' => 'foobar'))));
     $this->plugin->load();
     $res = $this->plugin->writeConf('Fake1', 'foo');
     $this->assertFalse($res);
 }
Пример #26
0
 public function testSetEmail()
 {
     $session = $this->getMock('session', array('set'));
     $session->expects($this->any())->method('set')->will($this->returnValue('*****@*****.**'));
     $config = arrayToObject(array('secrets' => array('secret' => 'foo')));
     $this->user->inject('config', $config);
     $this->user->inject('session', $session);
     $res = $this->user->setEmail('foo');
     $this->assertNull($res);
 }
Пример #27
0
 private function getListData($model)
 {
     if (method_exists($model, 'getList')) {
         return $model->getList();
     } else {
         $schema = $model->schema();
         $class = get_class($model);
         $query = array();
         $query['conditions'] = array($class . '.deleted_time IS NULL');
         $query['order'] = array("{$class}.parent_id ASC", "{$class}.order ASC");
         $data = $model->find('all', $query);
         $list = array();
         foreach ($data as $obj) {
             $other = $obj;
             unset($other[$class]);
             $list[$obj[$class][$this->primaryField]] = arrayToObject($obj[$class]);
             $list[$obj[$class][$this->primaryField]]->OtherRelatedData = $other;
         }
         return $list;
     }
 }
Пример #28
0
 * Environment setup...
 ************************************/
require 'includes/application.php';
/************************************ 
 * Get the news headline data...
 ************************************/
$intArticleID = getHeadlineID($strModifierClean);
$objHeadline = arrayToObject(getNewsHeadlineData($intArticleID));
$strPageTitle = $objHeadline->news_title;
$strPageDescription = $objHeadline->news_summary;
$strPageKeywords = $objHeadline->news_tags;
/************************************
 * Get the previous/next headline...
 ************************************/
$objPrevURL = arrayToObject(getPrevNextArticle($objHeadline->id, 'prev'));
$objNextURL = arrayToObject(getPrevNextArticle($objHeadline->id, 'next'));
/************************************
 * Include the HTML header...
 ************************************/
include 'include/public_header.php';
?>
<!-- BEGIN: PREV / NEXT -->
<div class="divPrevNext" style="width:99%; height:25px; margin-top:5px;">
<?php 
if (!empty($objNextURL->url)) {
    ?>
	<div id="btnNext" class="boxShadowSmall" title="<?php 
    echo $objNextURL->url;
    ?>
" onclick="location.href='<?php 
    echo BASE_URL_RSB;
Пример #29
0
<?php

/******************************************************
 * Created by: Randy Baker
 * Created on: 23-JUL-2012
 * ----------------------------------------------------
 * IFRAME Rendering Page (render.php)
 ******************************************************/
/************************************
 * Environment setup...
 ************************************/
require 'includes/application.php';
/************************************
 * Get the news headline data...
************************************/
$objHeadline = arrayToObject(getNewsHeadlineData($intRenderID));
echo $objHeadline->news_body;
Пример #30
0
include '../../includes/classes/wsdl.class.php';
include '../../includes/classes/logger.class.php';
$action = $_REQUEST['act'];
$error = '';
$data = '';
$properties = GetCompanyProperties();
$wsdl = new wsdl('http://services.rs.ge/WayBillService/WayBillService.asmx?WSDL', 'mplus:406137014', '123456');
$_log = Logger::instance('../../log/wsdl/wsdl/', Logger::OFF);
switch ($action) {
    case 'sync':
        $array = array("create_date_s" => $_REQUEST['create_date_s'], "create_date_e" => $_REQUEST['create_date_e'], "waybill_number" => $_REQUEST['waybill_number'], "seller_tin" => $_REQUEST['seller_tin']);
        $array = array_diff($array, array(''));
        if (empty($array)) {
            $error = 'შეავსეთ სინქრონიზაციისათვის აუცილებელი ველი(ები)!';
        } else {
            $params = arrayToObject($array);
            $arr = $wsdl->get_buyer_waybills($params);
            for ($i = 0; $i < count($arr); $i++) {
                $wsdl->set_waybill_id($arr[$i]);
                $wsdl->get_waybill(1);
            }
            $arr = $wsdl->get_waybills($params);
            for ($i = 0; $i < count($arr); $i++) {
                $wsdl->set_waybill_id($arr[$i]);
                $wsdl->get_waybill(0);
            }
        }
        break;
    case 'send_overhead':
        $overhead_id = $_REQUEST['id'];
        $row = GetOverhead($overhead_id);