Exemplo n.º 1
1
 /** getConfig
  *  @return object $config
  */
 public function getConfig($temakor_id = 0)
 {
     $res = false;
     $db = JFactory::getDBO();
     if ($temakor_id != 0) {
         $db->setQuery('select * from #__beallitasok where id = (10+' . $temakor_id . ')');
         $res = $db->loadObject();
         if ($res->json == '' | $res->json == '[]') {
             $res = false;
         }
     }
     if ($res == false) {
         $db->setQuery('select * from #__beallitasok where id = 1');
         $res = $db->loadObject();
     }
     if ($res) {
         $result = JSON_decode($res->json);
     } else {
         $result = JSON_decode('{
   "temakor_felvivok":1,
   "tobbszintu_atruhazas":1,
   "atruhazas_lefele_titkos":0
   }');
     }
     return $result;
 }
 /**
  * @test
  */
 public function shouldRemoveProgressInfoFromRequest()
 {
     // given
     $handler = new RequestHandlerMock();
     // when
     $json = $handler->handle("Car/1/read", array('LudoDBProgressID' => $this->getUniqueProgressId()));
     $response = JSON_decode($json, true);
     $data = $response['response'];
     // then
     $this->assertTrue($response['success'], $json);
     $this->assertNotNull($data['brand'], $json);
     $this->assertEquals('Opel', $data['brand'], $json);
 }
Exemplo n.º 3
0
    /**
     * objektum generálás
     */
    function __construct()
    {
        parent::__construct();
        // ============================== FIGYELEM Ha több szüro mezo van akkor át kell írni! ===================
        $this->state = JSON_decode('{
		"orderCol":"1", 
		"orderDir":"asc",
		"filterStr":"",
		"limitstart":0,
		"limit":10,
		"id":""
		}
		');
        $this->message = JSON_decode('{
		"txt":"",
		"class":"msg"
		}
	    ');
        if (file_exists(JPATH_COMPONENT . '/helpers/keszlet.php')) {
            include_once JPATH_COMPONENT . '/helpers/keszlet.php';
            $this->helper = new keszletHelper();
        }
    }
Exemplo n.º 4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     // For this week's batch of items
     $requiredItems = array();
     if (isset($_GET['all'])) {
         // Want all orders for some reason, use with caution
         $orders = Order::orderBy('id', 'desc')->get();
         foreach ($orders as $order) {
             // Parse it so that the template knows how to use it
             $order->item_array = JSON_decode($order->item_array);
         }
     } else {
         // Get unpaid orders by default
         $orders = Order::where('paid', '=', 0)->orderBy('id', 'desc')->get();
         // Calculate totals for this batch
         foreach ($orders as $order) {
             $order->item_array = JSON_decode($order->item_array);
             foreach ($order->item_array as $item) {
                 if (array_key_exists($item->name, $requiredItems)) {
                     // The item was already added, just add the quantity
                     $requiredItems[$item->name] += $item->qty;
                 } else {
                     // The item isn't added yet, make a new entry
                     $requiredItems[$item->name] = $item->qty;
                 }
             }
         }
     }
     return Response::json(array('orders' => $orders, 'requiredItems' => $requiredItems));
     /*
             return view('orders.index')->with(array(
                 'orders' => $orders,
                 'requiredItems' => $requiredItems
             ));*/
 }
Exemplo n.º 5
0
    $ext[$tmp['se']] = $tmp;
}
// Languages
$langs = query_as_array("SELECT * FROM cardname WHERE card_id = {$id}");
?>
  <a href="http://magiccards.info/query?q=!<?php 
echo $card_bdd['name'];
?>
&v=card&s=cname">View on MCI</a>
  <table>
   <tr>
    <th>Extensions</th>
    <td>
     <ul>
<?php 
$json = JSON_decode($card_bdd['attrs']);
foreach ($ext as $i => $value) {
    if ($ext[$i]['nbpics'] == 0) {
        echo '      <li>' . $ext[$i]['name'] . ' (' . $ext[$i]['rarity'] . ')</li>';
    } else {
        if ($ext[$i]['nbpics'] == 1) {
            $imgurl = $cardimages_default . '/' . $ext[$i]['se'] . '/' . addslashes(card_img_by_name($card_bdd['name']));
            if (isset($json->transformed_attrs->name)) {
                $imgurl .= "', '" . $cardimages_default . '/' . $ext[$i]['se'] . '/' . addslashes(card_img_by_name($json->transformed_attrs->name));
            }
            echo '      <li><a href="extension.php?ext=' . $ext[$i]['se'] . '" onmouseover="javascript:setimage(\'' . $imgurl . '\')">' . $ext[$i]['name'] . '</a> (' . $ext[$i]['rarity'] . ')' . "\n";
            echo '      </li>';
            if (!isset($firstimgurl)) {
                $firstimgurl = $imgurl;
            }
        } else {
Exemplo n.º 6
0
 /**
  * szellemi termelés változat   adat térolás adatbázisba
  * @param object
  * @JRequest imgdel0,imgdel1,imgdel2,imgdel3
  * @JRequest img0, img1, img2, img3
  * @return boolean
  */
 public function save($item)
 {
     $user = JFactory::getUser();
     // eredeti rekord elérése
     $orig = $this->get_product_view_product_row($item->id);
     // eredeti images elérése
     if ($orig->images != '') {
         $origImages = JSON_decode($orig->images);
     } else {
         $origImages = array();
     }
     while (count($origImages) < 4) {
         $origImages[] = '';
     }
     // images_delete kérések teljesitése
     for ($i = 0; $i < 5; $i++) {
         $fn = 'imgdel' . $i;
         if (JRequest::getVar($fn) == 1) {
             unlink($origImages[$i]);
             $origImages[$i] = '';
         }
     }
     // alapértelmezett értékek beirása
     $item->published = 1;
     if ($item->model == '') {
         $item->model = $user->username;
     }
     $item->alias = strtolower(preg_replace("/[^A-Za-z0-9]/", '', $item->name));
     $item->date_added = date('Y-m-d H:i:s');
     $item->category_id = JRequest::getVar('category_id', $orig->category_id);
     if ($item->category_id == '') {
         $item->category_id = $orig->category_id;
     }
     // tárolás adatbázisba
     $table = JTable::getInstance('products', 'EcommercewdTable');
     foreach ($item as $fn => $fv) {
         $table->{$fn} = $fv;
     }
     $result = $table->store();
     // új product_id lekérdezése
     $product_id = $table->id;
     $this->product_id = $product_id;
     // image uploadok végrehajtása, új images kialakitása
     if ($result) {
         for ($i = 0; $i < 5; $i++) {
             if (file_exists($_FILES['img' . $i]['tmp_name']) & is_uploaded_file($_FILES['img' . $i]['tmp_name'])) {
                 $targetFile = 'media/com_ecommercewd/uploads/images/products/' . substr($product_id, 0, 2);
                 if (!is_dir($targetFile)) {
                     mkdir($targetFile, 0777);
                 }
                 $fileExt = strtolower(pathinfo($_FILES['img' . $i]['name'], PATHINFO_EXTENSION));
                 if ($fileExt == 'jpg' | $fileExt == 'png') {
                     $targetFile .= '/' . $product_id . '_' . $_FILES['img' . $i]['name'];
                     if (file_exists($targetFile)) {
                         unlink($targetFile);
                     }
                     if (move_uploaded_file($_FILES['img' . $i]["tmp_name"], $targetFile)) {
                         $origImages[$i] = $targetFile;
                     } else {
                         $this->setError(JTEXT::_('COM_ECOMMERCEWD_SAVE_ERROR_1'));
                         $result = false;
                     }
                 } else {
                     $this->setError(JTEXT::_('COM_ECOMMERCEWD_ILLEGAL_FILE_EXTENSION') . ' fileExt=' . $fileExt);
                     $result = false;
                 }
             }
         }
         // rekord update, új images adat kitárolása az adatbázisba
         $images = array();
         foreach ($origImages as $image) {
             if ($image != '') {
                 $images[] = $image;
             }
         }
         $table->images = JSON_encode($images);
         if ($table->store() == false) {
             $this->setError(JTEXT::_('COM_ECOMMERCEWD_SAVE_ERROR_2'));
             $result = false;
         }
     } else {
         $this->setError(JTEXT::_('COM_ECOMMERCEWD_SAVE_ERROR_0'));
     }
     return $result;
 }
Exemplo n.º 7
0
 /**
  * do cancelClick: redirect to lister
  * JRequest: --     
  */
 public function cancel()
 {
     // pop lister status from listStatusStack
     $session = JFactory::getSession();
     $listStatusStack = JSON_decode($session->get('listStatusStack', '[]'));
     $listStatus = $listStatusStack[count($listStatusStack) - 1];
     unset($listStatusStack[count($listStatusStack) - 1]);
     $link = JURI::base() . 'index.php?option=com_ammvc' . '&task=' . $this->viewName . '.list' . '&limitstart=' . $listStatus->limitstart . '&limit=' . $listStatus->limit . '&ordering=' . $listStatus->ordering . '&parent=' . $listStatus->parent . '&filterStr=' . $listStatus->filterStr;
     $this->setRedirect($link);
 }
Exemplo n.º 8
0
 /**
  * browse task
  * @return void
  * @request integer limit
  * @request integer limitstart
  * @request integer order
  * @request integer filterStr
  * @session object 'temakoroklist_status'   
  */
 public function browse()
 {
     jimport('hs.user.user');
     JHTML::_('behavior.modal');
     $temakor_id = JRequest::getVar('temakor', 0);
     $config = $this->temakorokHelper->getConfig($temakor_id);
     $kepviseletAtruhazasMegngedett = $config->tobbszintu_atruhazas == 1;
     $total = 0;
     $pagination = null;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     // alapértelmezett browser status beolvasása sessionból
     $session = JFactory::getSession();
     $brStatusStr = $session->get($this->NAME . 'list_status');
     if ($brStatusStr == '') {
         $brStatusStr = '{"limit":20,"limitStart":0,"order":1,"filterStr":""}';
     }
     $brStatus = JSON_decode($brStatusStr);
     $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
     $limit = JRequest::getVar('limit', $brStatus->limit);
     $order = JRequest::getVar('order', $brStatus->order);
     $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
     // browser status save to session and JRequest
     $brStatus->limit = $limit;
     $brStatus->limitStart = $limitStart;
     $brStatus->order = $order;
     $brStatus->filterStr = $filterStr;
     $session->set($this->NAME . 'list_status', JSON_encode($brStatus));
     JRequest::setVar('limit', $limit);
     JRequest::setVar('limitstart', $limitStart);
     JRequest::setVar('order', $order);
     JRequest::setVar('filterStr', $filterStr);
     // adattábla tartalom elérése és átadása a view -nek
     $items = $this->model->getItems();
     $this->view->set('Items', $items);
     // browser müködéshez linkek definiálása
     $reorderLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr);
     $doFilterLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&order=' . JRequest::getVar('order', '1');
     $itemLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1');
     $this->view->set('reorderLink', $reorderLink);
     $this->view->set('doFilterLink', $doFilterLink);
     $this->view->set('itemLink', $itemLink);
     // van ált. képviselője?
     $kepviseloje = 0;
     $db->setQuery('select k.kepviselo_id, u.name 
 from #__kepviselok k, #__users u
 where k.kepviselo_id = u.id and
         k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and
         k.lejarat >= "' . date('Y-m-d') . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $kepviseloje = $res->kepviselo_id;
     }
     // Ő maga képviselő jelölt?
     $kepviseloJelolt = false;
     $db->setQuery('select user_id 
 from #__kepviselojeloltek
 where  user_id = "' . $user->id . '" and temakor_id=0');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $kepviseloJelolt = true;
     }
     // kik a témakor felvivők?
     $temakor_felvivo = $this->temakor_felvivo();
     // akciók definiálása
     $akciok = array();
     if ($this->temakorokHelper->isAdmin($user) | $temakor_felvivo == 1 & $user->id > 0) {
         $akciok['ujTemakor'] = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . '&task=add';
     }
     if ($this->temakorokHelper->isAdmin($user)) {
         $akciok['beallitasok'] = JURI::base() . 'index.php?option=com_beallitasok';
     }
     $akciok['tagok'] = JURI::base() . 'index.php?option=com_tagok';
     $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_(strtoupper($this->NAME) . 'LIST_SUGO') . '&Itemid=435&tmpl=component';
     $this->view->set('Akciok', $akciok);
     // globális képviselő/képviselő jelölt gombok definiálása
     $kepviselo = array();
     $kepviselo['kepviselojeLink'] = '';
     $kepviselo['kepviseloJeloltLink'] = '';
     $kepviselo['kepviselotValasztLink'] = '';
     $kepviselo['ujJeloltLink'] = '';
     if ($user->id > 0) {
         if ($kepviseloje > 0) {
             $kepviseloUser = JFactory::getUser($kepviseloje);
             if ($kepviseloUser) {
                 $userEx = HsUser::getInstance($kepviseloje);
                 $kepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=show&id=' . $kepviseloje;
                 if (isset($userEx->image)) {
                     $kepviselo['image'] = $userEx->get('image');
                 } else {
                     $kepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />';
                 }
                 $kepviselo['nev'] = $kepviseloUser->name;
             }
         } else {
             if ($kepviseloJelolt) {
                 $kepviselo['kepviseloJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&view=kepviselojeloltek&task=add&id=' . $user->id;
             } else {
                 $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviseloklist&task=add&temekor=0&szavazas=0';
                 $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=0&szavazas=0&id=' . $user->id;
             }
         }
         if ($kepviseletAtruhazasMegngedett) {
             if ($kepviseloje == 0) {
                 $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviseloklist&task=add&temekor=0&szavazas=0';
             }
             if (!$kepviseloJelolt) {
                 $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=0&szavazas=0&id=' . $user->id;
             }
         }
     }
     $this->view->set('Kepviselo', $kepviselo);
     //lapozósor definiálása
     jimport('joomla.html.pagination');
     $total = $this->model->getTotal($filterStr);
     $pagination = new JPagination($total, $limitStart, $limit);
     $pagination->setAdditionalUrlParam('order', $order);
     $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr));
     $this->view->set('LapozoSor', $pagination->getListFooter());
     $this->view->display();
 }
Exemplo n.º 9
0
<?php

session_start();
$contents = file_get_contents('php://input');
$data = JSON_decode($contents);
//var_dump($data);
if (!empty($data)) {
    $sid = $data->SID;
    $firstname = $data->firstname;
    $surname = $data->surname;
    $sex = $data->sex;
    $year = $data->year;
    $username = $data->username;
    $password = $data->password;
    $class = $data->class;
}
$sql = "UPDATE MyStudents SET `firstname` = '{$firstname}', `lastname` = '{$surname}', `sex` = '{$sex}', `year` = '{$year}', `username` = '{$username}', `password` = '{$password}', `class` = '{$class}' WHERE `Sid` = '{$sid}'";
$conn = new mysqli("localhost", "root", "duckvin", "myDb");
if ($conn->connect_errno > 0) {
    die("Connection failed: " . mysqli_connect_error());
}
if ($conn->query($sql) === TRUE) {
    echo "Student updated";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
Exemplo n.º 10
0
 /**
  * $this->state feltöltése a session és JRequest  alapjánn
  * Ha JRequest érkezik az irja felül a session -t
  */
 protected function getState()
 {
     $session = JFactory::getSession();
     $storedState = JSON_decode($session->get($this->browserName . 'State'));
     if (is_object($storedState)) {
         $this->state = $storedState;
     }
     foreach ($this->state as $fn => $fv) {
         $this->state->{$fn} = JRequest::getVar($fn, $fv);
     }
 }
Exemplo n.º 11
0
                                    $db->setQuery('select sz.* 
	from #__szavazasok sz
	left outer join #__temakorok t on t.id = sz.temakor_id
	left outer join #__tagok ta on ta.temakor_id = sz.temakor_id
	where sz.id=' . $db->quote($data->poll_id) . ' and
	((ta.user_id = ' . $db->quote($user->id) . ') or (t.lathatosag = 0)) 
	limit 1');
                                    $szavazas = $db->loadObject();
                                    JRequest::setVar('szavazas', $szavazas->id);
                                    JRequest::setVar('temakor', $szavazas->temakor_id);
                                    if ($szavazas) {
                                        // ha van cachelt eredmény beolvasom azt  és azt használom
                                        $db->setQuery('select * from #__poll_value_cache where pollid="' . $szavazas->id . '" and vote_count = -1');
                                        $res = $db->loadObject();
                                        if ($res) {
                                            $result1 = JSON_decode($res->report);
                                            $result = $result->result;
                                            $result->voters = $result1->voters;
                                            $result->api_status = $result1->api_status;
                                        } else {
                                            // ha nincs most képzem az eredményt
                                            $c = new Condorcet($db, $szavazas->temmakor_id, $szavazas->id);
                                            $result = $c->report('json');
                                            $db->setQuery('select count(*) cc from #__szavazok where szavazas_id = ' . $db->quote($szavazas->id));
                                            $res = $db->loadObject();
                                            $result->voters = $res->cc;
                                            $result->api_status = "OK";
                                            // ha lezárt szavazás akkor tárolom a cache -be
                                            if ($szavazas->lezart == 1) {
                                                $db->setQuery('INSERT INTO #__poll_value_cache 
	        VALUES (' . $szavazas->temakor_id . ', 
Exemplo n.º 12
0
 /**
  * userData objektum lekérése az ADA szervertől
  * @param object token  {"access_token":"xxxxxxxx",......}
  * @return object  {"userid":"xxxxxxxx", "email":"xxxxxxxx",......}
  */
 protected function getADAuserData($token)
 {
     $userData = new stdClass();
     $url = $this->ADA_USER_URI;
     $data = array('timeout' => 30, 'redirection' => 10, 'httpversion' => '1.0', 'blocking' => true, 'cookies' => array(), 'sslverify' => $this->sslverify);
     $extraHeader = 'Authorization: Bearer ' . $token->access_token;
     $result = $this->remoteCall($url, 'GET', $data, $extraHeader);
     if ($result != '') {
         $userData = JSON_decode($result);
     }
     return $userData;
 }
Exemplo n.º 13
0
 /**
  * browse task
  * @return void
  * @request integer limit
  * @request integer limitstart
  * @request integer order
  * @request integer filterStr
  * @request integer temakor
  * @request integer szavazas      
  * @session object 'temakoroklist_status'   
  */
 public function browse()
 {
     jimport('hs.user.user');
     JHTML::_('behavior.modal');
     $total = 0;
     $pagination = null;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     // alapértelmezett browser status beolvasása sessionból
     $session = JFactory::getSession();
     $brStatusStr = $session->get($this->NAME . 'list_status');
     if ($brStatusStr == '') {
         $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":"","temakor_id":0,"szavazas_id":0}';
     }
     $brStatus = JSON_decode($brStatus);
     $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
     $limit = JRequest::getVar('limit', $brStatus->limit);
     $order = JRequest::getVar('order', $brStatus->order);
     $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
     if ($this->temakor_id == '') {
         $this->temakor_id = $brStatus->temakor_id;
     }
     if ($this->szavazas_id == '') {
         $this->szavazas_id = $brStatus->szavazas_id;
     }
     // browser status save to session and JRequest
     $brStatus->limit = $limit;
     $brStatus->limitStart = $limitStart;
     $brStatus->order = $order;
     $brStatus->filterStr = $filterStr;
     $brStatus->temakor_id = $this->temakor_id;
     $brStatus->szavazas_id = $this->szavazas_id;
     $session->set($this->NAME . 'list_status', JSON_encode($brStatus));
     JRequest::setVar('limit', $limit);
     JRequest::setVar('limitstart', $limitstart);
     JRequest::setVar('order', $order);
     JRequest::setVar('filterStr', $filterStr);
     JRequest::setVar('temakor', $this->temakor_id);
     JRequest::setVar('szavazas', $this->szavazas_id);
     // adattábla tartalom elérése és átadása a view -nek
     $items = $this->model->getItems();
     //DBG echo $this->model->getDBO()->getQuery();
     if ($this->model->getError() != '') {
         $this->view->Msg = $this->model->getError();
     }
     $this->view->set('Items', $items);
     $this->view->set('Temakor', $this->temakor);
     $this->view->set('Szavazas', $this->szavazas);
     $this->view->set('Title', JText::_('ALTERNATIVAK'));
     // browser müködéshez linkek definiálása
     if ($this->szavazas->vita1 == 1) {
         $itemLink = JURI::base() . 'index.php?option=com_alternativak&view=alternativak' . '&task=edit' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
     } else {
         $itemLink = '';
     }
     $backLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&temakor=' . $this->temakor_id . '&task=browse';
     $homeLink = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist' . '&task=browse';
     $this->view->set('itemLink', $itemLink);
     $this->view->set('backLink', $backLink);
     $this->view->set('homeLink', $homeLink);
     // van ált. képviselője?
     $altKepviseloje = 0;
     $db->setQuery('select k.kepviselo_id, u.name 
 from #__kepviselok k, #__users u
 where k.kepviselo_id = u.id and
         k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and
         k.lejarat >= "' . date('Y-m-d') . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $altKepviseloje = $res->kepviselo_id;
     }
     // van témakör képviselője?
     $kepviseloje = 0;
     $db->setQuery('select k.kepviselo_id, u.name 
 from #__kepviselok k, #__users u
 where k.kepviselo_id = u.id and
         k.user_id = "' . $user->id . '" and k.temakor_id=' . $this->temakor_id . ' and k.szavazas_id = 0 and
         k.lejarat >= "' . date('Y-m-d') . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $kepviseloje = $res->kepviselo_id;
     }
     // Ő maga képviselő jelölt?
     $kepviseloJelolt = false;
     $db->setQuery('select user_id 
 from #__kepviselojeloltek
 where  user_id = "' . $user->id . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $kepviseloJelolt = true;
     }
     // kik az alternativa felvivők?
     $alternativa_felvivo = $this->alternativa_felvivo();
     // akciók definiálása
     $akciok = array();
     if ($this->temakorokHelper->isAdmin($user) | $szavazas_felvivo == 10 & ($this->szavazas->szavazok = 1) & $user->id > 0 | $szavazas_felvivo == 10 & $this->userTag($this->temakor_id, $user) | $this->szavazasIndito($this->szavazas_id, $user)) {
         if ($this->szavazas->vita1 == 1) {
             $akciok['ujAlternativa'] = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . '&task=add' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id . '&limit=' . JRequest::getVar('limit', 20) . '&limitstart=' . JRequest::getVar('limitstart', 0) . '&order=' . JRequest::getVar('order', 1) . '&filterStr=' . JRequest::getVar('filterStr', '');
         }
     }
     if ($this->temakorokHelper->isAdmin($user) | $this->szavazas->letrehozo == $user->id) {
         $akciok['szavazasedit'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
     }
     if ($this->temakorokHelper->isAdmin($user) | $this->szavazas->letrehozo == $user->id) {
         $akciok['szavazastorles'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
     }
     if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) {
         $akciok['temakoredit'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=edit' . '&temakor=' . $this->temakor_id;
     }
     if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) {
         $akciok['temakortorles'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=deleteform' . '&temakor=' . $this->temakor_id;
     }
     if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) {
         if ($this->szavazas->vita1 == 1) {
             $akciok['alternativaedit'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
         }
     }
     if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) {
         if ($this->szavazas->vita1 == 1) {
             $akciok['alternativatorles'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
         }
     }
     if ($this->szavazas->szavazas == 1 & $user->id > 0) {
         $db = JFactory::getDBO();
         $db->setQuery('select id from #__szavazatok
   where szavazas_id="' . $this->szavazas_id . '" and
   user_id="' . $user->id . '"');
         $res = $db->loadObjectList();
         if (count($res) == 0) {
             $akciok['szavazok'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=szavazoform&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
         }
     }
     if ($this->szavazas->lezart == 1) {
         $akciok['eredmeny'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=eredmeny&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
     }
     $akciok['tagok'] = JURI::base() . 'index.php?option=com_tagok&temakor=' . $this->temakor_id;
     $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_(strtoupper($this->NAME) . 'LIST_SUGO') . '&Itemid=435&tmpl=component';
     $this->view->set('Akciok', $akciok);
     // globális képviselő/képviselő jelölt gombok definiálása
     $altKepviselo = array();
     $altKepviselo['kepviselojeLink'] = '';
     $kepviselo = array();
     $kepviselo['kepviselojeLink'] = '';
     $kepviselo['kepviseloJeloltLink'] = '';
     $kepviselo['kepviselotValasztLink'] = '';
     $kepviselo['ujJeloltLink'] = '';
     if ($user->id > 0) {
         if ($altKepviseloje > 0) {
             $kepviseloUser = JFactory::getUser($altKepviseloje);
             if ($kepviseloUser) {
                 $userEx = HsUser::getInstance($altKepviseloje);
                 $altKepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $altKepviseloje;
                 if (isset($userEx->image)) {
                     $altKepviselo['image'] = $userEx->get('image');
                 } else {
                     $altKepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />';
                 }
                 $altKepviselo['nev'] = $kepviseloUser->name;
             }
         }
         if ($kepviseloje > 0) {
             $kepviseloUser = JFactory::getUser($kepviseloje);
             if ($kepviseloUser) {
                 $userEx = HsUser::getInstance($kepviseloje);
                 $kepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $kepviseloje;
                 if (isset($userEx->image)) {
                     $kepviselo['image'] = $userEx->get('image');
                 } else {
                     $kepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />';
                 }
                 $kepviselo['nev'] = $kepviseloUser->name;
             }
         } else {
             if ($kepviseloJelolt) {
                 $kepviselo['kepviseloJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselo&task=edit&id=' . $user->id;
             } else {
                 $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=find&temekor=' . $this->temakor_id . '&szavazas=0';
                 $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=' . $this->temakor_id . '&szavazas=0&id=' . $user->id;
             }
         }
     }
     $this->view->set('Kepviselo', $kepviselo);
     $this->view->set('AltKepviselo', $altKepviselo);
     //lapozósor definiálása
     jimport('joomla.html.pagination');
     $total = $this->model->getTotal($filterStr);
     $pagination = new JPagination($total, $limitStart, $limit);
     $pagination->setAdditionalUrlParam('order', $order);
     $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr));
     $this->view->set('Lapozosor', $pagination->getListFooter());
     $this->view->display();
 }
Exemplo n.º 14
0
 public function available_boards(&$db)
 {
     try {
         $sql = 'SELECT boardid, title, client, creationDate, dueDate, is_locked, locked_by, lock_expires 
                 FROM storyboards
                 WHERE boardid 
                 IN (SELECT boardid FROM permissions WHERE userid = :userid) 
                 ORDER BY creationDate DESC';
         $stmt = $db->prepare($sql);
         $stmt->bindValue(':userid', $this->userid);
         $stmt->execute();
         $stmt->bindColumn('boardid', $boardid);
         $stmt->bindColumn('title', $title);
         $stmt->bindColumn('client', $client);
         $stmt->bindColumn('creationDate', $creationDate);
         $stmt->bindColumn('dueDate', $dueDate);
         $stmt->bindColumn('is_locked', $is_locked);
         $stmt->bindColumn('locked_by', $locked_by);
         $stmt->bindColumn('lock_expires', $lock_expires);
         $errorInfo = $stmt->errorInfo();
         if (isset($errorInfo[2])) {
             $error = $errorInfo[2];
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
     }
     $stmt->fetch(PDO::FETCH_BOUND);
     if ($boardid) {
         echo '<div class="board-selection">';
         echo '<h2>Select a Storyboard:</h2>';
         echo '<form method="post" action="/storyboardapp/"><fieldset>';
         $i = 0;
         do {
             echo "<label for=\"board-{$i}\"><input type=\"radio\" name=\"boardid\" id=\"board-{$i}\" value=\"{$boardid}\"> <p>" . JSON_decode($title) . ' by ' . JSON_decode($client) . " (created {$creationDate}";
             if ($dueDate != "") {
                 echo '; due ' . $dueDate;
             }
             echo ')';
             if ($is_locked && $locked_by != $this->userid && time() < $lock_expires) {
                 echo ' <span class="submessage">&ast; read-only</span>';
             }
             echo '</p></label>';
             $i++;
         } while ($stmt->fetch(PDO::FETCH_BOUND));
         echo '<label for="board-new"><input type="radio" name="boardid" id="board-new" value="new"> <p>New Storyboard</p></label>';
         echo '</fieldset>';
         echo '<input type="submit" value="Load Board" class="load-board-button">';
         echo '</form>';
         echo '<h4><span class="green">&ast; Boards may be read-only because they are currently being edited by someone else or because you do not have permission to edit them.</span></h4>';
         echo '</div>';
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 15
0
 /**
  * ujTag felvételi form
  * @return void
  * &JRequest: limit, limitstart, filterStr, order
  */
 public function ujTag()
 {
     JHTML::_('behavior.modal');
     $total = 0;
     $pagination = null;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     if (!$this->temakorokHelper->isAdmin($user) & !$this->temakor_admin) {
         echo '<div class="">Access denied</div>';
         return;
     }
     // alapértelmezett browser status beolvasása sessionból
     $session = JFactory::getSession();
     $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":""}';
     $brStatus = JSON_decode($brStatusStr);
     $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
     $limit = JRequest::getVar('limit', $brStatus->limit);
     $order = JRequest::getVar('order', $brStatus->order);
     $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
     JRequest::setVar('limit', $limit);
     JRequest::setVar('limitstart', $limitStart);
     JRequest::setVar('order', $order);
     JRequest::setVar('filterStr', $filterStr);
     // adattábla tartalom elérése és átadása a view -nek
     $items = $this->model->getItems();
     //DBG echo $this->model->getDBO()->getQuery();
     $this->view->set('Items', $items);
     // browser müködéshez linkek definiálása
     $reorderLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list&tas=ujTag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&temakor=' . $this->temakor_id . '&filterStr=' . urlencode($filterStr);
     $doFilterLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list&task=ujTag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&temakor=' . $this->temakor_id . '&order=' . JRequest::getVar('order', '1');
     if ($this->temakor_id > 0) {
         $itemLink = JURI::base() . 'index.php?option=com_tagok&view=tagok&task=doujtag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&temakor=' . $this->temakor_id . '&order=' . JRequest::getVar('order', '1');
     }
     $this->view->set('reorderLink', $reorderLink);
     $this->view->set('doFilterLink', $doFilterLink);
     $this->view->set('itemLink', $itemLink);
     // akciók definiálása
     $akciok = array();
     if ($this->temakor_id > 0) {
         $akciok['temakor'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist&task=browse' . '&temakor=' . $this->temakor_id;
     } else {
         $akciok['temakorok'] = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist&task=browse';
     }
     $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_('UJTAG_SUGO') . '&Itemid=435&tmpl=component';
     $this->view->set('Akciok', $akciok);
     $this->view->set('Title', JText::_('UJTAG'));
     $this->view->set('Temakor', $this->temakor);
     //lapozósor definiálása
     jimport('joomla.html.pagination');
     $total = $this->model->getTotal($filterStr);
     $pagination = new JPagination($total, $limitStart, $limit);
     $pagination->setAdditionalUrlParam('order', $order);
     $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr));
     $pagination->setAdditionalUrlParam('temakor', $this->temakor_id);
     $this->view->set('LapozoSor', $pagination->getListFooter());
     $this->view->setLayout('ujtag');
     $this->view->display();
 }
Exemplo n.º 16
0
 /**
  * képviselő eddigi szavazatainak megjelenítése
  * (böngésző képernyő)   
  * @return void
  * @JRequest integer temakor
  * @JRequest integer id  - kepviselo_id
  * @JRequest integer limitstart
  * @JRequest integer limit
  * @JRequest string filterStr
  * @JRequest integer order                     
  */
 public function szavazatok()
 {
     JHTML::_('behavior.modal');
     $total = 0;
     $pagination = null;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $view =& $this->getView('szavazatoklist', $viewType);
     $model =& $this->getModel('szavazatoklist');
     // alapértelmezett browser status beolvasása sessionból
     $session = JFactory::getSession();
     $brStatusStr = $session->get('szavazasoklist_status');
     if ($brStatusStr == '') {
         $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":""}';
     }
     $brStatus = JSON_decode($brStatus);
     $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
     $limit = JRequest::getVar('limit', $brStatus->limit);
     $order = JRequest::getVar('order', $brStatus->order);
     $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
     // browser status save to session and JRequest
     $brStatus->limit = $limit;
     $brStatus->limitStart = $limitStart;
     $brStatus->order = $order;
     $brStatus->filterStr = $filterStr;
     // ebben az esetben inkább ne jegyezze meg....
     //$session->set('szavazatoklist_status', JSON_encode($brStatus));
     JRequest::setVar('limit', $limit);
     JRequest::setVar('limitstart', $limitStart);
     JRequest::setVar('order', $order);
     JRequest::setVar('filterStr', $filterStr);
     // adattábla tartalom elérése és átadása a view -nek
     $items = $model->getItems();
     //DBG echo '<p>'.$model->getDBO()->getQuery().'</p>';
     // items-temakor-user hozzáférés ellenörzés
     if ($this->temakorokHelper->isAdmin($user) == false) {
         for ($i = 0; $i < count($items); $i++) {
             $item = $items[$i];
             if ($item->lathatosag == 1 & $user->id == 0 | $item->lathatosag == 2 & $this->temakorokHelper->userTag($item->id, $user) == false) {
                 // letiltott
                 $items[$i]->szmegenevezes = '***';
                 $items[$i]->amegenevezes = '***';
                 $items[$i]->pozicio = '**';
             }
         }
     }
     $view->set('Items', $items);
     // témakör beolvasása
     $db->setQuery('select * from #__temakorok where id="' . JRequest::getVar('temakor', 0) . '"');
     $view->Temakor = $db->loadObject();
     if ($view->Temakor == false) {
         $view->Temakor = new stdclass();
         $view->Temakor->megnevezes = JText::_('ALTALANOSKEPVISELO');
         $view->Temakor->id = 0;
     } else {
         $view->Temakor->megnevezes .= ' ' . JText::_('KEPVISELO');
     }
     // képviselő adatok beolvasása
     $view->set('Kuser', JFactory::getUser(JRequest::getVar('id', 0)));
     // browser müködéshez linkek definiálása
     $reorderLink = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=szavazatok' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&temakor=' . JRequest::getVar('temakor') . '&id=' . JRequest::getVar('id', 0);
     $doFilterLink = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=add' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . JRequest::getVar('temakor') . '&id=' . JRequest::getVar('id', 0);
     $view->set('reorderLink', $reorderLink);
     $view->set('doFilterLink', $doFilterLink);
     // akciók definiálása
     $akciok = array();
     $akciok['back'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=show' . '&temakor=' . JRequest::getVar('temakor') . '&id=' . JRequest::getVar('id', 0);
     $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_('SZAVAZATOKSUGO') . '&Itemid=435&tmpl=component';
     $view->set('Akciok', $akciok);
     //lapozósor definiálása
     jimport('joomla.html.pagination');
     $total = $model->getTotal($filterStr);
     $pagination = new JPagination($total, $limitStart, $limit);
     $pagination->setAdditionalUrlParam('order', $order);
     $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr));
     $view->set('LapozoSor', $pagination->getListFooter());
     // display
     $view->setLayout('browse');
     $view->display();
 }
Exemplo n.º 17
0
    /**
     * browse task
     * @return void
     * @request integer limit
     * @request integer limitstart
     * @request integer order
     * @request integer filterStr
     * @request integer temakor
     * @request integer szavazas      
     * @session object 'temakoroklist_status'   
     */
    public function browse()
    {
        jimport('hs.user.user');
        JHTML::_('behavior.modal');
        $total = 0;
        $pagination = null;
        $user = JFactory::getUser();
        $db = JFactory::getDBO();
        // hozzáférés ellenörzés
        if ($this->temakorokHelper->isAdmin($user) == false) {
            if ($this->temakor->lathatosag == 1 & $user->id == 0 | $this->temakor->lathatosag == 2 & $this->temakorokHelper->userTag($this->temakor->id, $user) == false) {
                // Redirect to login
                $this->temakorokHelper->getLogin(JText::_('TEMAKOR_NEKED_NEM_ELERHETO'));
            }
        }
        // alapértelmezett browser status beolvasása sessionból
        $session = JFactory::getSession();
        $brStatusStr = $session->get($this->NAME . 'list_status');
        if ($brStatusStr == '') {
            $brStatusStr = '{"limit":20,"limitStart":0,"order":1,"filterStr":"","temakor_id":0,"szavazas_id":0}';
        }
        $brStatus = JSON_decode($brStatusStr);
        $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
        $limit = JRequest::getVar('limit', $brStatus->limit);
        $order = JRequest::getVar('order', $brStatus->order);
        $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
        if ($this->temakor_id == '') {
            $this->temakor_id = $brStatus->temakor_id;
        }
        if ($this->szavazas_id == '') {
            $this->szavazas_id = $brStatus->szavazas_id;
        }
        // browser status save to session and JRequest
        $brStatus->limit = $limit;
        $brStatus->limitStart = $limitStart;
        $brStatus->order = $order;
        $brStatus->filterStr = $filterStr;
        $brStatus->temakor_id = $this->temakor_id;
        $brStatus->szavazas_id = $this->szavazas_id;
        $session->set($this->NAME . 'list_status', JSON_encode($brStatus));
        JRequest::setVar('limit', $limit);
        JRequest::setVar('limitstart', $limitStart);
        JRequest::setVar('order', $order);
        JRequest::setVar('filterStr', $filterStr);
        JRequest::setVar('temakor', $this->temakor_id);
        JRequest::setVar('szavazas', $this->szavazas_id);
        // adattábla tartalom elérése és átadása a view -nek
        $items = $this->model->getItems();
        $db->setQuery('select sum(igen) igen, sum(nem) nem
	from #__szavazasok_in
	where szavazas_id = ' . $db->quote($this->szavazas_id));
        $igenNem = $db->loadObject();
        // user szavazott?
        $db->setQuery('select * from #__szavazok where szavazas_id="' . $this->szavazas->id . '" and user_id="' . $user->id . '"');
        $szavazo = $db->loadObject();
        //DBG echo $this->model->getDBO()->getQuery();
        if ($this->model->getError() != '') {
            $this->view->Msg = $this->model->getError();
        }
        $this->view->set('Items', $items);
        $this->view->set('igen', $igenNem->igen);
        $this->view->set('nem', $igenNem->nem);
        $this->view->set('Temakor', $this->temakor);
        $this->view->set('Szulok', $this->temakorokHelper->getSzulok());
        $this->view->set('Szavazas', $this->szavazas);
        $this->view->set('Szavazo', $szavazo);
        $this->view->set('Title', JText::_('ALTERNATIVAK'));
        $this->view->set('TemakorGroupId', $this->temakorokHelper->getTemakorGroupId($this->temakor->id));
        //+ 2014.09.10 Az alternativa név csak akkor link ha jogosult módosítani
        $this->view->set('isAdmin', $this->temakorokHelper->isAdmin($user));
        $this->view->set('temakor_admin', $this->temakor_admin);
        $this->view->set('user', $user);
        //- 2014.09.10 Az alternativa név csak akkor link ha jogosult módosítani
        // hányan szavaztak már?
        $db->setQuery('select count(distinct szavazo_id) cc from #__szavazatok where szavazas_id="' . $this->szavazas->id . '"');
        $res = $db->loadObject();
        $szavaztak = $res->cc;
        $this->view->set('szavaztak', $szavaztak);
        // browser müködéshez linkek definiálása
        if ($this->szavazas->vita1 == 1) {
            $itemLink = JURI::base() . 'index.php?option=com_alternativak&view=alternativak' . '&task=edit' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
        } else {
            $itemLink = '';
        }
        $backLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&temakor=' . $this->temakor_id . '&task=browse';
        $homeLink = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist' . '&task=browse';
        $this->view->set('itemLink', $itemLink);
        $this->view->set('backLink', $backLink);
        $this->view->set('homeLink', $homeLink);
        // van ált. képviselője?
        $altKepviseloje = 0;
        $db->setQuery('select k.kepviselo_id, u.name 
    from #__kepviselok k, #__users u
    where k.kepviselo_id = u.id and
            k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and
            k.lejarat >= "' . date('Y-m-d') . '"');
        $res = $db->loadObject();
        if ($db->getErrorNum() > 0) {
            $db->stderr();
        }
        if ($res) {
            $altKepviseloje = $res->kepviselo_id;
        }
        // van témakör képviselője?
        $kepviseloje = 0;
        $db->setQuery('select k.kepviselo_id, u.name 
    from #__kepviselok k, #__users u
    where k.kepviselo_id = u.id and
            k.user_id = "' . $user->id . '" and k.temakor_id=' . $this->temakor_id . ' and k.szavazas_id = 0 and
            k.lejarat >= "' . date('Y-m-d') . '"');
        $res = $db->loadObject();
        if ($db->getErrorNum() > 0) {
            $db->stderr();
        }
        if ($res) {
            $kepviseloje = $res->kepviselo_id;
        }
        // Ő maga képviselő jelölt?
        $kepviseloJelolt = false;
        $db->setQuery('select user_id 
    from #__kepviselojeloltek
    where  user_id = "' . $user->id . '"');
        $res = $db->loadObject();
        if ($db->getErrorNum() > 0) {
            $db->stderr();
        }
        if ($res) {
            $kepviseloJelolt = true;
        }
        // kik az alternativa felvivők?
        $alternativa_felvivo = $this->alternativa_felvivo($user);
        // akciók definiálása
        $akciok = array();
        if ($this->temakorokHelper->isAdmin($user) | $szavazas_felvivo == 10 & ($this->szavazas->szavazok = 1) & $user->id > 0 | $szavazas_felvivo == 10 & $this->temakorokHelper->userTag($this->temakor_id, $user) | $this->temakor_admin | $this->alternativa_felvivo($user)) {
            if ($this->szavazas->vita1 == 1) {
                $akciok['ujAlternativa'] = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . '&task=add' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id . '&limit=' . JRequest::getVar('limit', 20) . '&limitstart=' . JRequest::getVar('limitstart', 0) . '&order=' . JRequest::getVar('order', 1) . '&filterStr=' . JRequest::getVar('filterStr', '');
            }
        }
        if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->szavazas->letrehozo == $user->id) {
            $akciok['szavazasedit'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
        }
        if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->szavazas->letrehozo == $user->id) {
            $akciok['szavazastorles'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
        }
        if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) {
            $akciok['temakoredit'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=edit' . '&temakor=' . $this->temakor_id;
        }
        if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) {
            $akciok['temakortorles'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=deleteform' . '&temakor=' . $this->temakor_id;
        }
        if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) {
            if ($this->szavazas->vita1 == 1) {
                $akciok['alternativaedit'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
            }
        }
        if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) {
            if ($this->szavazas->vita1 == 1) {
                $akciok['alternativatorles'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
            }
        }
        if ($this->szavazas->szavazas == 1 & $user->id > 0) {
            // a szavazás folyamatban van és bejelentkezett user
            $db = JFactory::getDBO();
            $db->setQuery('select id from #__szavazatok
      where szavazas_id="' . $this->szavazas_id . '" and
      user_id="' . $user->id . '"');
            $res = $db->loadObjectList();
            if (count($res) == 0) {
                // ez a user még nem szavazott
                if ($this->szavazas->szavazok == 1 | $this->szavazas->szavazok == 2 & $this->temakorokHelper->userTag($this->temakor_id, $user, false) | $this->szavazas->szavazok == 3 & $this->temakorokHelper->userTag($this->temakor_id, $user, true)) {
                    $akciok['szavazok'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=szavazoform&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
                }
            } else {
                $akciok['szavaztal'] = 'Y';
                if ($this->szavazas->titkos == 0) {
                    $akciok['szavazatTorles'] = JURI::base() . 'index.php?option=com_alternativak&&task=szavazattorles&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
                }
            }
        }
        // if ($this->szavazas->lezart == 1) {
        $akciok['eredmeny'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=eredmeny&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
        // }
        if ($this->szavazas->szavazas == 1 & $user->id > 0) {
            $akciok['emailszavazas'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=meghivo&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
        }
        $akciok['copy'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativaklist&task=copy' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
        $akciok['tagok'] = JURI::base() . 'index.php?option=com_tagok&temakor=' . $this->temakor_id;
        $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_(strtoupper($this->NAME) . 'LIST_SUGO') . '&Itemid=435&tmpl=component';
        $akciok['deleteSzavazas'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
        $this->view->set('Akciok', $akciok);
        // globális képviselő/képviselő jelölt gombok definiálása
        $altKepviselo = array();
        $altKepviselo['kepviselojeLink'] = '';
        $kepviselo = array();
        $kepviselo['kepviselojeLink'] = '';
        $kepviselo['kepviseloJeloltLink'] = '';
        $kepviselo['kepviselotValasztLink'] = '';
        $kepviselo['ujJeloltLink'] = '';
        if ($user->id > 0) {
            if ($altKepviseloje > 0) {
                $kepviseloUser = JFactory::getUser($altKepviseloje);
                if ($kepviseloUser) {
                    $userEx = HsUser::getInstance($altKepviseloje);
                    $altKepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $altKepviseloje;
                    if (isset($userEx->image)) {
                        $altKepviselo['image'] = $userEx->get('image');
                    } else {
                        $altKepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />';
                    }
                    $altKepviselo['nev'] = $kepviseloUser->name;
                }
            }
            if ($kepviseloje > 0) {
                $kepviseloUser = JFactory::getUser($kepviseloje);
                if ($kepviseloUser) {
                    $userEx = HsUser::getInstance($kepviseloje);
                    $kepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $kepviseloje;
                    if (isset($userEx->image)) {
                        $kepviselo['image'] = $userEx->get('image');
                    } else {
                        $kepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />';
                    }
                    $kepviselo['nev'] = $kepviseloUser->name;
                }
            } else {
                if ($kepviseloJelolt) {
                    $kepviselo['kepviseloJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselo&task=edit&id=' . $user->id;
                } else {
                    $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=find&temekor=' . $this->temakor_id . '&szavazas=0';
                    $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=' . $this->temakor_id . '&szavazas=0&id=' . $user->id;
                }
            }
        }
        $this->view->set('Kepviselo', $kepviselo);
        $this->view->set('AltKepviselo', $altKepviselo);
        //lapozósor definiálása
        jimport('joomla.html.pagination');
        $total = $this->model->getTotal($filterStr);
        $pagination = new JPagination($total, $limitStart, $limit);
        $pagination->setAdditionalUrlParam('order', $order);
        $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr));
        $this->view->set('LapozoSor', $pagination->getListFooter());
        // kacsolodó cikk id-jének elérése és átadása a viewer-nek
        $db->setQuery('SELECT id from #__content WHERE alias="sz' . $this->szavazas_id . '"');
        $res = $db->loadObject();
        if ($res) {
            $this->view->set('CommentId', $res->id);
        } else {
            $this->view->set('CommentId', 0);
        }
        $this->view->display();
    }
Exemplo n.º 18
0
function exchange_set_gravity_story_attachments($entry)
{
    $gf_story_images_field_id = $GLOBALS['EXCHANGE_PLUGIN_CONFIG']['GRAVITY_FORMS']['fields']['story-images'];
    // the story attachments
    $gf_story_title_field_id = $GLOBALS['EXCHANGE_PLUGIN_CONFIG']['GRAVITY_FORMS']['fields']['story-title'];
    //Retrieve story form ID from options and verify.
    $story_form_id = get_option('options_story_update_form');
    if (empty($story_form_id) || intval($entry['form_id']) !== intval($story_form_id)) {
        return;
    }
    $post_id = $entry['post_id'];
    $story_submission_hash = get_post_meta($post_id, 'story_form_submission_hash', true);
    if (sha1($entry['id'] . $entry[$gf_story_title_field_id]) !== $story_submission_hash) {
        return;
    }
    // Delete submission hash.
    delete_post_meta($post_id, 'story_form_submission_hash');
    $images = JSON_decode($entry[$gf_story_images_field_id]);
    if (!is_array($images) || count($images) < 1) {
        return;
    }
    // Attach images to post.
    foreach ($images as $image) {
        $attachment_id = exchange_create_image_id($image, $post_id);
    }
}
Exemplo n.º 19
0
 public function load_board(&$db, $boardid, $userid)
 {
     try {
         $sql = 'SELECT title, client, creationDate, dueDate, scenes, is_locked, locked_by, lock_expires
                 FROM storyboards
                 WHERE boardid = :boardid';
         $stmt = $db->prepare($sql);
         $stmt->bindValue(':boardid', $boardid);
         $stmt->execute();
         $stmt->bindColumn('title', $title);
         $stmt->bindColumn('client', $client);
         $stmt->bindColumn('creationDate', $creationDate);
         $stmt->bindColumn('dueDate', $dueDate);
         $stmt->bindColumn('scenes', $scenes);
         $stmt->bindColumn('is_locked', $is_locked);
         $stmt->bindColumn('locked_by', $locked_by);
         $stmt->bindColumn('lock_expires', $lock_expires);
         $errorInfo = $stmt->errorInfo();
         if (isset($errorInfo[2])) {
             $error = $errorInfo[2];
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
     }
     if (isset($error)) {
         return [false, $error];
     }
     $stmt->fetch(PDO::FETCH_BOUND);
     if ($creationDate) {
         $content['title'] = JSON_decode($title);
         $content['client'] = JSON_decode($client);
         $content['creationDate'] = strftime("%F", strtotime($creationDate));
         if ($dueDate !== NULL) {
             $content['dueDate'] = strftime("%F", strtotime($dueDate));
         } else {
             $content['dueDate'] = '';
         }
         $content['scenes'] = JSON_decode($scenes);
         if ($is_locked && $locked_by != $userid && time() < $lock_expires) {
             $content['readonly'] = true;
         } else {
             $content['readonly'] = false;
             try {
                 $sql = 'SELECT userid
                         FROM permissions
                         WHERE boardid = :boardid';
                 $stmt = $db->prepare($sql);
                 $stmt->bindValue(':boardid', $boardid);
                 $stmt->execute();
                 $stmt->bindColumn('userid', $userlist);
                 $errorInfo = $stmt->errorInfo();
                 if (isset($errorInfo[2])) {
                     $error = $errorInfo[2];
                 }
             } catch (Exception $e) {
                 $error = $e->getMessage();
             }
             if (isset($error)) {
                 return [false, $error];
             }
             $stmt->fetch(PDO::FETCH_BOUND);
             if ($userlist) {
                 $userarray = array();
                 do {
                     $userarray[] = $userlist;
                 } while ($stmt->fetch(PDO::FETCH_BOUND));
                 $usercount = count(array_count_values($userarray));
                 if ($usercount > 1) {
                     $this->is_shared = true;
                 } else {
                     $this->is_shared = false;
                 }
             }
             $this->lock_expires = time() + 5400;
             try {
                 $sql = 'UPDATE storyboards
                         SET is_locked = 1, locked_by = :locked_by, lock_expires = :lock_expires
                         WHERE boardid = :boardid';
                 $stmt = $db->prepare($sql);
                 $stmt->bindValue(':locked_by', $userid);
                 $stmt->bindValue(':lock_expires', $this->lock_expires);
                 $stmt->bindValue(':boardid', $boardid);
                 $stmt->execute();
                 $errorInfo = $stmt->errorInfo();
                 if (isset($errorInfo[2])) {
                     $error = $errorInfo[2];
                 }
             } catch (Exception $e) {
                 $error = $e->getMessage();
             }
             if (isset($error)) {
                 return [false, $error];
             }
         }
         $this->modify($boardid, $content);
     }
     return [true];
 }
Exemplo n.º 20
0
 /**
  * Return the post data
  */
 public function getPostData()
 {
     if (isset($_POST[$this->name])) {
         $val = $_POST[$this->name];
         $className = $this->getClass() ? $this->getClass() : 'stdClass';
         $decoded = JSON_decode(stripslashes($val));
         unset($items);
         unset($obj_item);
         $items = array();
         foreach ($decoded as $std_object) {
             $obj_item = new $className();
             foreach ($std_object as $subkey => $value) {
                 //substitui pq o ttable gera com quebra de linha no multifield
                 //$obj_item->$subkey = URLdecode($value);
                 $obj_item->{$subkey} = str_replace("\n", '', URLdecode($value));
             }
             $items[] = $obj_item;
         }
         return $items;
     } else {
         return '';
     }
 }
Exemplo n.º 21
0
// simplify the product record
$vod = JSON_decode($vod);
$vod = simplify($vod);
// console output
echo "<pre>";
print_r($vod);
echo "</pre>";
// store simplified record
$vod = JSON_encode($vod);
file_put_contents('cache/vod.json', $vod);
/* trends */
// fetch and store raw trends data
$trends = fetch('trends');
file_put_contents('cache/trends-raw.json', $trends);
// simplify product records
$records = JSON_decode($trends)->items;
$items = array();
foreach ($records as &$item) {
    $items[] = simplify($item);
}
// store complete simplified trends records
file_put_contents('cache/trends.json', JSON_encode($items));
// tranche simplified trends records
$slice = array_slice($items, 0, 8);
// console output
echo "<pre>";
print_r($slice);
echo "</pre>";
// store simplifed trend record tranche
$slice = JSON_encode($slice);
file_put_contents('cache/trends-top.json', $slice);
Exemplo n.º 22
0
 /**
  * Return the post data
  */
 public function getPostData()
 {
     if (isset($_POST[$this->name])) {
         $val = $_POST[$this->name];
         $className = $this->getClass() ? $this->getClass() : 'stdClass';
         $decoded = JSON_decode(stripslashes($val));
         unset($items);
         unset($obj_item);
         $items = array();
         if (is_array($decoded)) {
             foreach ($decoded as $std_object) {
                 $obj_item = new $className();
                 foreach ($std_object as $subkey => $value) {
                     // substitui pq o ttable gera com quebra de linha no multifield
                     $obj_item->{$subkey} = str_replace("\n", '', URLdecode($value));
                     // verifica se é um json
                     if (is_array(json_decode($obj_item->{$subkey}))) {
                         $content = json_decode($obj_item->{$subkey});
                         $return = array();
                         foreach ($content as $position) {
                             $return[$position->{'id'}] = $position->{'text'};
                         }
                         $obj_item->{$subkey} = $return;
                     }
                 }
                 $items[] = $obj_item;
             }
         }
         return $items;
     } else {
         return '';
     }
 }
        }
    }
}
//PART 2: NEW ANNOUNCEMENTS
//The maximum tweetid in the *announcements* table, grab everything newer than this via twitter api
$annoMaxId = 1024;
$resultset = mysql_query('SELECT max(tweetid) as maxid from ' . $appTableAnnouncements);
if (mysql_num_rows($resultset) > 0) {
    $row = mysql_fetch_array($resultset, MYSQL_ASSOC);
    $annoMaxId = $row['maxid'];
}
echo 'Announcements MAXID: ' . $annoMaxId . "\n";
//PART 2: Open the JSON file of the SPACES user timeline for reading
$tmhOAuth->request('GET', $tmhOAuth->url('1/statuses/user_timeline'), array('include_entities' => '0', 'include_rts' => '1', 'screen_name' => $twitterAccountName, 'count' => '20'));
//if ($data = file_get_contents_utf8("http://$twitterAccountName:$twitterAccountPass@api.twitter.com/1/statuses/user_timeline/$twitterAccountName.json?since_id=".$annoMaxId))
if ($tmhOAuth->response['code'] == 200) {
    $announcements = JSON_decode($tmhOAuth->response['response'], true);
    print_r($announcements);
    foreach ($announcements as $tweetdata) {
        $firstContestTag = hashtagFilter($tweetdata['text']);
        if (!empty($firstContestTag)) {
            $sql = 'REPLACE INTO ' . $appTableAnnouncements . ' (tweetid,content,SPChashtag) VALUES ("' . mysql_real_escape_string($tweetdata['id']) . '","' . mysql_real_escape_string(json_encode($tweetdata)) . "\",\"{$firstContestTag}\")";
            mysql_query($sql);
            #echo "$sql<br/><br/>!!".hashtagFilter($tweetdata['text']);
            printf(mysql_error() . "Records inserted: %d\n", mysql_affected_rows());
        }
    }
}
?>

Exemplo n.º 24
0
<?php

$modules = JSON_decode(file_get_contents('manifest.json'));
$payload = '';
foreach ($modules as $module) {
    $payload .= "<!--------------------------------------------------------------------------\n" . " {$module}\n" . "--------------------------------------------------------------------------->\n" . file_get_contents($module) . "\n";
}
// main index
$index = file_get_contents('main.html');
// replace client-side load instruction with constructed payload
$index = str_replace('<link rel="import" href="imports.html">', $payload, $index);
echo $index;
Exemplo n.º 25
0
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
if (array_key_exists("code", $_GET)) {
    // IDENTIFY USER
    $response = $yakwala->GetToken($_GET['code'], $redirect_uri);
    echo 'TOKEN' . $response->access_token;
    $yakwala->SetAccessToken($response->access_token);
    showUserBasics($response->user);
    $userid = $response->user->id;
    // POST a place
    $params = array("place" => json_encode(array("title" => 'place title3', "content" => 'place content', "yakcat" => array('50923b9afa9a95d409000', '50923b9afa9a95d409000001'), "freetag" => array('tag11', 'tag22'), "outgoinglink" => 'http://www.theplacewebsite.com', "location" => array('lat' => 48.2, 'lng' => 2.3), "formatted_address" => " 3 rue du Ruisseau, Paris , France", "address" => array("street_number" => "3", "street" => "rue du Ruisseau", "arr" => "", "city" => "Paris", "state" => "Paris", "area" => "Ile de France", "country" => "France", "zip" => "75018"), "contact" => array("tel" => "0123456789", "mobile" => "0612345678", "mail" => "*****@*****.**", "transportation" => "metro 3 station Ruisseau", "web" => "http://www.theplace.com", "opening" => "Tlj de 8h à 20h", "closing" => "dimanches et jours fériés", "specialopening" => "Nocture le jeudi de 19h à minuit"))), "picture" => "@C:\\miro.jpg;type=image/jpeg");
    $response = $yakwala->GetPrivate("api/place/" . $userid, $params, 'POST');
    echo '<br>RESULT:<br>';
    var_dump($response);
    $theplace = JSON_decode($response)->place;
    // POST an info ( in the user's feed )
    $params = array("info" => json_encode(array("title" => 'info TOTO', "content" => 'info content', "yakcat" => array('50923b9afa9a95d409000', '50923b9afa9a95d409000001'), "yaktype" => 3, "print" => '1', "freetag" => array('tag11', 'tag22'), "placeid" => array('_id' => $theplace->_id))), "picture" => "@C:\\miro.jpg;type=image/jpeg");
    $response = $yakwala->GetPrivate("api/user/feed/" . $userid, $params, 'POST');
    $insert = $response;
    echo '<br>RESULT:<br>';
    var_dump($insert);
    // POST an info ( in the user's feed )
    $params = array("info" => json_encode(array("title" => 'info DODOD', "content" => 'info content', "yakcat" => array('50923b9afa9a95d409000', '50923b9afa9a95d409000001'), "yaktype" => 3, "print" => '1', "freetag" => array('tag11', 'tag22'), "location" => array('lat' => 48.3, 'lng' => 2.4), "address" => " 3 rue du Ruisseau, Paris , France")), "picture" => "@C:\\miro.jpg;type=image/jpeg");
    $response = $yakwala->GetPrivate("api/user/feed/" . $userid, $params, 'POST');
    $insert = $response;
    echo '<br>RESULT:<br>';
    var_dump($insert);
} else {
    $authlink = $yakwala->AuthenticationLink($redirect_uri);
    //echo $authlink;
Exemplo n.º 26
0
<?php

header('Access-Control-Allow-Origin: http://game257530.konggames.com');
require 'db_connect.php';
$replays = [];
$s = "SELECT * FROM oa_best_race WHERE trackid=" . $_POST["map"] . " ORDER BY time";
if ($result = mysqli_query($link, $s)) {
    $i = 0;
    while ($row = mysqli_fetch_assoc($result)) {
        if ($i < $_POST['max'] && $_POST['bests'] === 'true' && $row['userid'] !== $_POST['userid'] || $row['userid'] === $_POST['userid'] && $_POST['own'] === 'true') {
            $topush = [$row['userid'], $row['userid']];
            if ($_POST['replay'] === 'true') {
                // wut
                array_push($topush, JSON_decode($row["replay"]));
            } else {
                array_push($topush, $row['time']);
            }
            array_push($replays, $topush);
            ++$i;
        }
    }
}
for ($i = 0; $i < count($replays); ++$i) {
    $s = "SELECT * FROM oa_users WHERE id=" . $replays[$i][0];
    if ($result = mysqli_query($link, $s)) {
        $done = false;
        while ($row = mysqli_fetch_assoc($result)) {
            if (!$done) {
                $replays[$i][0] = $row["name"];
                $done = true;
            }
Exemplo n.º 27
0
}
// Remote version
$content = @file_get_contents($version_url);
if ($content === false) {
    die('Unable to download remote version');
}
$remote_version = JSON_decode($content);
// Version changed
if ($remote_version != $local_version) {
    echo "Version change : {$local_version} -> {$remote_version} : \n";
    file_put_contents($version_file, $content);
    $content = @file_get_contents($changelog_url);
    if ($content === false) {
        die('Unable to download changelog');
    }
    $changelog = JSON_decode($content);
    foreach ($changelog as $log) {
        if (version_compare($log->version, $local_version, '>')) {
            echo "{$local_version} -> {$log->version} ({$log->when}) : \n";
            foreach ($log->changes as $change) {
                echo " - {$change}\n";
            }
            if (property_exists($log, 'newSetFiles')) {
                echo "New sets : " . join(', ', $log->newSetFiles) . "\n";
            }
            if (property_exists($log, 'updatedSetFiles')) {
                echo "Updated sets : " . join(', ', $log->updatedSetFiles) . "\n";
            }
            $local_version = $log->version;
            echo "\n";
        }
Exemplo n.º 28
0
function json_decode_loose($json)
{
    $GLOBALS['json_strings'] = array();
    #
    # first find obvious strings
    #
    #echo "PRE-FIND: $json\n";
    $json = preg_replace_callback('!"((?:[^\\\\"]|\\\\\\\\|\\\\")*)"!', 'json_dqs', $json);
    $json = preg_replace_callback("!'((?:[^\\\\']|\\\\\\\\|\\\\')*)'!", 'json_sqs', $json);
    #echo "POST-FIND: $json\n";
    #print_r($GLOBALS['json_strings']);
    $json = preg_replace('!\\s+!', '', $json);
    #
    # missing elements
    #
    $json = str_replace('[,', '[null,', $json);
    $json = str_replace('{,', '{', $json);
    $json = str_replace(',]', ']', $json);
    $json = str_replace(',}', '}', $json);
    $json = preg_replace('!\\[([^[{]+),(\\s*),!', '[$1,null,', $json);
    $json = preg_replace('!\\{([^[{]+),(\\s*),!', '{$1,', $json);
    #
    # quote unquoted key names
    #
    $json = preg_replace_callback('!([a-zA-Z0-9-_]+):!', 'json_key', $json);
    #
    # turn remaning barewords into nulls.
    # loosely based on the ECMA spec, but avoiding requiring unicode PCRE.
    # http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
    # (section 7.6)
    #
    $start = "[A-Za-z\$_]|(\\\\u[0-9A-Fa-f]{4})";
    $continue = $start . '|[0-9-.]';
    $json = preg_replace_callback("!(({$start})({$continue})*)!", 'json_bareword', $json);
    #
    # strip functions
    #
    $l = strlen($json);
    while (1) {
        $json = preg_replace("!null\\(([^()]*)\\)!", 'null', $json);
        $l2 = strlen($json);
        if ($l == $l2) {
            break;
        }
        $l = $l2;
    }
    #
    # replace the strings
    #
    #echo "PRE-CONV: $json\n";
    $pre = preg_quote($GLOBALS['json_str_prefix'], '!');
    $json = preg_replace_callback('!' . $pre . '(\\d+)!', 'json_strs', $json);
    #echo "POST-CONV: $json\n";
    $ret = JSON_decode($json, true);
    if ($ret === null) {
        die("Failed to parse JSON:\n{$json}\n");
    }
    return $ret;
}
Exemplo n.º 29
0
    /**
     * egy rekord olvasása id alapján, id='' esetén felvitelhez inicializált rekord
     * @param string id
     * @return record object kiegészitve a rooter filedel; ami a rooter php tartalma
     */
    public function getItem($id)
    {
        $db = JFactory::getDBO();
        $user = JFactory::getUser();
        if ($id == '' | $id == 0) {
            $result = new stdClass();
            // felvitelhez inicializálás
            $result->extension_id = 0;
            $result->client_id = 1;
            $result->enabled = 1;
            $result->manifest_cache = new stdClass();
            $result->manifest_cache->type = 'component';
            $result->manifest_cache->name = 'new_component';
            $result->manifest_cache->description = 'new component description';
            $result->manifest_cache->author = $user->username . ' ' . $user->email;
            $result->manifest_cache->copyRyght = '(c) ' . date('Y') . ')';
            $result->manifest_cache->license = 'GNU';
            $result->manifest_cache->version = 'V 1.00';
            $result->rooter = $this->loadTemplate($result->manifest_cache, JPATH_COMPONENT . '/templates/rooter.php');
        } else {
            $db->setQuery('select * 
		  from ' . $this->tableName . '
		  where ' . $this->tableId . '=' . $db->quote($id));
            $result = $db->loadObject();
            if ($db->setErrorNum() > 0) {
                $result = false;
                $this->setError($db->getErrorNum() . ' ' . $db->getErrorMsg());
            }
            $result->rooter = $this->loadRooter($result);
            $result->manifest_cache = JSON_decode($result->manifest_cache);
        }
        // init vagy load?
        return $result;
    }
Exemplo n.º 30
0
<?php

var_dump($_POST);
if (isset($_GET['logout'])) {
    setcookie('authenticatedUserId', '', time() - 1000);
    header('location: phpoefening-022-b.php');
}
$fileContent = file_get_contents('phpoefening-022-b.txt');
$userData = JSON_decode($fileContent, true);
$message = false;
$isAuthenticated = false;
if (isset($_POST['submit'])) {
    foreach ($userData as $id => $user) {
        if ($_POST['username'] == $user['username'] && $_POST['password'] == $user['password']) {
            $cookieTime = isset($_POST['rememberMe']) ? time() + 60 * 60 * 24 * 30 : time() + 3600;
            setcookie('authenticatedUserId', $id, $cookieTime);
            header('location: phpoefening-022-b.php');
            break;
        }
    }
    $message = 'Er ging iets mis. Probeer opnieuw.';
}
if (isset($_COOKIE['authenticatedUserId'])) {
    $userId = $_COOKIE['authenticatedUserId'];
    $message = 'Welkom ' . $userData[$userId]['username'] . '. U bent ingelogd.';
    $isAuthenticated = true;
}
?>

<!DOCTYPE html>
<html>