Example #1
0
function logout()
{
    session_destroy();
    session_start();
    $_SESSION['auth'] = array("logged" => False, "login_utc" => "", "cas_url" => Cas::getUrl());
    return is_logged();
}
Example #2
0
function index()
{
    global $timeformat, $home;
    if (is_logged()) {
        $output = '<p><form method="post" action="' . $home . 'shoutbox/escrevepost">
<textarea rows="8" cols="25" name="message"></textarea><br/>
<input type="submit" value="' . t("Enviar") . '">
</form></p><hr size="1">';
    }
    $qry = mysql_query("SELECT s.id AS d, s.text AS t, s.time AS i, a.login AS l FROM shoutbox s LEFT JOIN accounts a ON s.owner=a.id ORDER BY s.id DESC LIMIT 10");
    if (mysql_numrows($qry) != 0) {
        $response = true;
        while ($row = mysql_fetch_array($qry)) {
            $output .= '<p><h3>' . $row['t'] . '</h3><br/><h6>' . t("postado por") . ' ' . url("user/profile/{$row['l']}", $row['l']) . ' ' . t("em") . ' ' . date($timeformat, $row['i']);
            if (is_admin()) {
                $output .= '<br>' . url("shoutbox/del/{$row['d']}", t("[excluir]"));
            }
            $output .= '</p><hr size="1">';
        }
    } else {
        $output .= infobox(t("Não há mensagens na shoutbox."), false);
    }
    if ($response) {
        section(substr($output, 0, -13), t("Shoutbox"));
    } else {
        section($output, t("Shoutbox"));
    }
}
 function index()
 {
     if (is_logged()) {
         $this->load->library('form_validation');
         $this->form_validation->set_rules('creditcard_number', 'Credit Card Number', 'required|max_length[19]');
         $this->form_validation->set_rules('creditcard_month', 'Credit Card Expiration Month', 'required|max_length[2]');
         $this->form_validation->set_rules('creditcard_year', 'Credit Card Expiration Year', 'required|max_length[4]|callback_credit_card_expiration[' . $this->input->post('creditcard_month') . ']');
         if ($this->form_validation->run() !== false) {
             $creditcard_number = $this->input->post('creditcard_number');
             $creditcard_month = $this->input->post('creditcard_month');
             $creditcard_year = $this->input->post('creditcard_year');
             $creditcard_number = str_replace(' ', '', $creditcard_number);
             $this->load->model('order');
             $order = new $this->order();
             $order->customer_id = get_customer_id();
             $order->total = $this->cart->total();
             $order->creditcard_number = $creditcard_number;
             $order->creditcard_month = $creditcard_month;
             $order->creditcard_year = $creditcard_year;
             // save temporary order
             $this->session->set_userdata('order', serialize($order));
             redirect('checkout/review');
         }
         $this->load->view('checkout/payment');
     } else {
         $this->load->view('checkout/index');
     }
 }
Example #4
0
 function _authorize()
 {
     if (is_logged()) {
         redirect('main', 'refresh');
     }
     check_offline();
 }
Example #5
0
function index()
{
    if (is_logged()) {
        redir("dashboard");
    } else {
        redir("account/login");
    }
}
Example #6
0
 public function login()
 {
     if (is_logged()) {
         redirect(logged_url('dashboard'));
     }
     $this->data['title'] = 'Đăng nhập';
     $this->load->view('frontend/user/login', $this->data);
 }
Example #7
0
function is_readonly()
{
    $needAuth = Config::get('password') != '' ? 1 : 0;
    if ($needAuth && !is_logged()) {
        return true;
    }
    return false;
}
Example #8
0
function check_property($rand_prop, $hash_prop)
{
    if (is_logged()) {
        return $hash_prop == sha1($_SESSION['login_c'] . $rand_prop);
    } else {
        return false;
    }
}
 public function preview()
 {
     if (is_logged()) {
         $view = $this->input->get('view', true);
         $id = $this->input->get('id', true);
         $data['lng'] = $this->input->get('lang', true);
         if ($view && $id && $data['lng']) {
             $data['base_link'] = '?view=' . $view . '&id=' . $id . '';
             switch ($view) {
                 case 'stiri':
                     $data['title'] = 'Stiri';
                     $data['article'] = $this->mysql->get_row('stiri', array('id' => $id));
                     $this->load->view('frontend/preview/stiri_preview_template', $data);
                     break;
                 case 'cetatean':
                     $data['title'] = 'Cetateanul Activ';
                     $data['article'] = $this->mysql->get_row('cetatean', array('id' => $id));
                     $this->load->view('frontend/preview/stiri_preview_template', $data);
                     break;
                 case 'dosare':
                     $data['title'] = 'Dosare de coruptie';
                     $data['article'] = $this->mysql->get_row('dosare', array('id' => $id));
                     $this->load->view('frontend/preview/stiri_preview_template', $data);
                     break;
                 case 'achizitii':
                     $data['title'] = 'Achizitii publice';
                     $data['article'] = $this->mysql->get_row('achizitii', array('id' => $id));
                     $this->load->view('frontend/preview/stiri_preview_template', $data);
                     break;
                 case 'blog':
                     $data['title'] = 'Blog';
                     $data['article'] = $this->mysql->get_row('blog', array('id' => $id));
                     $this->load->view('frontend/preview/stiri_preview_template', $data);
                     break;
                 case 'interviu':
                     $data['title'] = 'Interviuri';
                     $data['article'] = $this->mysql->get_row('interviu', array('id' => $id));
                     $this->load->view('frontend/preview/stiri_preview_template', $data);
                     break;
                 case 'investigatii':
                     $data['title'] = 'Investigatii';
                     $data['article'] = $this->mysql->get_row('investigatii', array('id' => $id));
                     $data['caterg'] = $this->mysql->get_row('categorii', array('id_categorii' => $data['article']['cats']));
                     $data['slider'] = $this->mysql->get_All('slider', array('parent' => $data['article']['id']));
                     $data['vars'] = $this->mysql->get_All('vars');
                     $this->load->view('frontend/preview/investigatii_preview_template', $data);
                     break;
                 default:
                     echo 'Pagina pentru previzualizare este incorecta!';
                     break;
             }
         } else {
             echo 'Linkul pentru previzualizare este incorect sau lipsesc date pentru a putea identifica articolul cerut pentru previzualizare!';
         }
     } else {
         echo 'Trebuie sa fiti logat pentru a vizualiza acest preview!';
     }
 }
function login_required()
{
    if (!is_logged()) {
        die('Permission denied');
    }
    $id = $_SESSION['user']['id'];
    $user = new User();
    return $user->get("id = '{$id}'");
}
Example #11
0
 /**
  * Placeholder for default functions to be executed
  */
 public function index()
 {
     if (!is_logged()) {
         redirect('users/login');
     }
     //Get the user id
     //Load a home view
     $user = get_user();
     $this->load->view('users/home', array('user' => $user));
 }
Example #12
0
function have_write_access()
{
    if (Config::get('password') == '') {
        return true;
    }
    if (is_logged()) {
        return true;
    }
    return false;
}
Example #13
0
 function list_orders()
 {
     if (!is_logged()) {
         redirect('/');
     }
     $this->load->model('orders');
     $this->load->model('order');
     $data['orders'] = $this->orders->getAllFromCustomer(get_customer_id());
     $this->load->view('orders', $data);
 }
Example #14
0
 public function index()
 {
     if (is_logged(false)) {
         redirect(base_url());
     }
     set_theme('title', 'Login');
     set_theme('content', load_module('login', 'login'));
     set_theme('bodyClass', 'login bg-login printable');
     set_theme('pluginsJS', load_javascript(array('user-pages', 'initialize-login')), false);
     load_template();
 }
Example #15
0
 /**
  * Placeholder for default functions to be executed
  */
 public function index()
 {
     if (!is_logged()) {
         redirect('users/login');
     }
     //Get the user id
     //Load a home view
     $user = get_user();
     $this->template->set('menu_title', 'Data Majelis')->set('menu_group', 'active')->set('group_total', $config['total_rows'])->set('group', $group)->set('no', $no)->set('user', $user)->build('users/home');
     //$this->load->view('users/home', array('user'=>$user));
 }
Example #16
0
 public function index()
 {
     if (is_logged(false)) {
         set_theme('title', 'Dashboard');
         set_theme('content', '<h1>Painel Principal</h1>');
         set_theme('pluginsJS', load_javascript(array('initialize')), false);
         load_template();
     } else {
         redirect('login');
     }
 }
Example #17
0
 function getbonus()
 {
     if (!is_logged()) {
         redirect(base_url());
     }
     include APPPATH . "config/evote.php";
     $this->data['title'] = lang('off_vote');
     $text = icon('64x64/chart_up.png') . '<h2>Голосование на TOP EMUDEV</h2><p>После голосования нажмите получить бонус.</p>';
     $char = (int) office_secure($this->input->post('char'));
     if ($char <= 0) {
         redirect('evote');
     }
     $query = $this->MSSQL->query("SELECT Name FROM " . get_world() . ".dbo.tbl_base WHERE Serial='{$char}'");
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $char = preg_name($row->Name);
         }
         //for
     } else {
         redirect('evote');
     }
     # Генерация полной ссылки текущего года/месяца
     $FullLink = $config['logfile'] . md5(date("Ym")) . '.txt';
     # Получение данных статистики
     $data = file_get_contents($FullLink);
     # Разбитие данных в строки массива
     $rows = explode("\r\n", $data);
     $find = 0;
     for ($i = 0; $i < count($rows) - 1; $i++) {
         $row = explode("\t", $rows[$i]);
         if ($row[3] == '') {
             continue;
         }
         if ($row[3] == $char) {
             if (!$this->_id_exits($row[0])) {
                 $find++;
                 $text .= br(1) . icon('32x32/accept.png') . 'Бонус выдан';
                 if ($row[4] == 0) {
                     $summ = $config['normal'];
                 } else {
                     $summ = $config['sms'];
                 }
                 bonus_add(Get_AccountSerial(), $summ);
                 $this->_accepted($row);
             }
         }
     }
     //for
     if ($find == 0) {
         $text .= br(1) . icon('32x32/delete.png') . 'Голос не найден';
     }
     $this->data['content'] = $text;
     compile();
 }
Example #18
0
function get_user()
{
    if (!is_logged()) {
        return false;
    }
    $ci =& get_instance();
    $user_id = $ci->session->userdata('user_id');
    //REMOVE IF AUTOLOADED
    $ci->load->model('user');
    $ci->user->set_id($user_id);
    return $ci->user->get();
}
Example #19
0
 function main()
 {
     parent::Controller();
     $this->load->helper(array('fdcore_framework', 'office_framework', 'rf_framework', 'email', 'prototype'));
     $this->load->helper(array('language', 'url', 'file', 'security', 'date', 'form', 'html', 'pay'));
     $this->load->library(array('session', 'parser', 'table', 'ajax'));
     $this->lang->load('office', get_lang());
     RunFunc('connectdb|connectmydb|allow_ip|check_offline|check_sql_inject');
     $this->login = get_login();
     $this->output->enable_profiler(config('profiler', 'core'));
     if (!is_logged()) {
         redirect(base_url() . '#auth error');
     }
 }
Example #20
0
 function topsms()
 {
     parent::Controller();
     $this->load->helper(array('fdcore_framework', 'office_framework', 'rf_framework_helper'));
     $this->load->helper(array('language', 'url', 'security', 'form', 'html', 'pay', 'date'));
     $this->load->library(array('session', 'parser', 'table', 'ajax'));
     $this->lang->load('office', get_lang());
     $this->login = xss_clean($this->session->userdata('login'));
     RunFunc('connectdb|connectmydb|check_offline|check_sql_inject');
     $this->output->enable_profiler(config('profiler', 'core'));
     if (!is_logged()) {
         redirect(base_url());
     }
 }
Example #21
0
/**
 * Make items
 *
 * @param array $arr
 * @param string $type
 * @param int $i
 * @return string
 * @author Mauri Kujala <*****@*****.**>
 */
function makeitem($arr, $type, &$i)
{
    global $usex, $usey, $usez;
    $item_id = $arr["id"];
    $item_text = $arr["text"];
    $item_name = $arr["item_name"];
    $item_system_name = $arr["system_name"];
    $item_system_id = $arr["system_id"];
    $item_cat_name = $arr["catname"];
    $item_coordx = $arr["item_coordx"];
    $item_coordy = $arr["item_coordy"];
    $item_coordz = $arr["item_coordz"];
    if (valid_coordinates($item_coordx, $item_coordy, $item_coordz)) {
        $distance = number_format(sqrt(pow($item_coordx - $usex, 2) + pow($item_coordy - $usey, 2) + pow($item_coordz - $usez, 2)), 1) . " ly";
    } else {
        $distance = "n/a";
    }
    // if visited, change border color
    $visited = mysqli_num_rows(mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_visited_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $item_system_name) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1"));
    $style_override = $visited ? ' style="border-left: 3px solid #3DA822"' : "";
    $tdclass = $i % 2 ? "dark" : "light";
    // check if system has screenshots
    $screenshots = has_screenshots($item_system_name) ? '<a href="/Gallery.php?spgmGal=' . urlencode($item_system_name) . '" title="View image gallery"><img src="/style/img/image.png" class="icon" alt="Gallery" style="margin-left:5px;margin-right:0;vertical-align:top" /></a>' : "";
    // check if system is logged
    $loglink = is_logged($item_system_name) ? '<a href="log.php?system=' . urlencode($item_system_name) . '" style="color:inherit" title="System has log entries"><img src="/style/img/log.png" class="icon" style="margin-left:5px;margin-right:0;vertical-align:top" /></a>' : "";
    echo '<tr>
			<td class="' . $tdclass . '" style="min-width:420px;max-width:500px">
				<div class="poi"' . $style_override . '>
					<a href="javascript:void(0)" onclick="update_values(\'/get/get' . $type . 'EditData.php?' . $type . '_id=' . $item_id . '\',\'' . $item_id . '\');tofront(\'add' . $type . '\')" style="color:inherit" title="Click to edit entry">';
    echo '(' . $distance . ')';
    if (!empty($item_system_id)) {
        echo '</a>&nbsp;<a title="System information" href="/System.php?system_id=' . $item_system_id . '" style="color:inherit">';
    } elseif ($item_system_name != "") {
        echo '</a>&nbsp;<a title="System information" href="/System.php?system_name=' . urlencode($item_system_name) . '" style="color:inherit">';
    } else {
        echo '</a>&nbsp;<a href="#" style="color:inherit">';
    }
    if (empty($item_name)) {
        echo $item_system_name;
    } else {
        echo $item_name;
    }
    echo '</a>' . $loglink . $screenshots . '<span class="right" style="margin-left:5px">' . $item_cat_name . '</span><br />';
    echo nl2br($item_text);
    echo '		</div>';
    echo '	</td>';
    echo '</tr>';
    $i++;
}
Example #22
0
 public function get($params)
 {
     if (!is_logged()) {
         return;
     }
     if (is_string($params)) {
         $params = parse_params($params);
     }
     if ($params == false) {
         return;
     }
     $params['created_by'] = user_id();
     $get = parent::get($params);
     return $get;
 }
Example #23
0
 public function has_permission($params)
 {
     if (!is_logged()) {
         return;
     }
     if (isset($params['id']) and $params['id'] != 0) {
         $check_author = $this->get_by_id($params['id']);
         $author_id = user_id();
         if (isset($check_author['created_by']) and $check_author['created_by'] == $author_id) {
             return true;
         }
     } elseif (!isset($params['id']) or $params['id'] == 0) {
         return true;
     }
 }
Example #24
0
function mx_searchbox()
{
    if (is_logged()) {
        ?>
	<div class="searchbox"><div class="qsearch"><form name="searchbox" method="POST" action="<?php 
        echo mx_pageurl('');
        ?>
"><input id="q" name="q" type="text"
	placeholder="<?php 
        __('Search');
        ?>
"
	 onkeyup="return quicksearch(event,this,'q');"
	 onblur="return quicksearch(event,this,'q');"
	 ></form><div class="qresults"><div id="q_search" class="quicksearch"></div></div></div></div>
<?php 
    }
}
Example #25
0
function tm($cnt)
{
    global $site;
    if ($cnt === 'site_logo') {
        echo $site['site_logo'];
    } elseif ($cnt === 'site_name') {
        echo $site['site_name'];
    } elseif ($cnt === 'power') {
        power();
    } elseif ($cnt === 'title') {
        if (isset($_SESSION['pagetitle']) and !is_null($_SESSION['pagetitle'])) {
            echo $_SESSION['pagetitle'];
        } else {
            echo $site['site_name'];
        }
    } elseif ($cnt === 'footer') {
        if (is_logged()) {
        } else {
            echo 'Copyright &copy; ' . date("Y") . ' ' . $site['name'];
        }
    } elseif ($cnt === 'menu') {
        if (!is_logged()) {
            echo url('account/login', t('Login')) . "&nbsp;\n";
            echo url('account/signup', t('Cadastro'));
        } else {
            $qry = mysql_query("SELECT item,url FROM cfg_menu ORDER BY `order`");
            echo url("home", t("Home")) . "&nbsp;\n";
            if (mysql_num_rows($qry) != 0) {
                while ($row = mysql_fetch_array($qry)) {
                    echo url($row['url'], t($row['item'])) . "&nbsp;\n";
                }
            }
            if (is_admin()) {
                echo url("admin", t("Administração")) . "&nbsp;\n";
            }
            echo url("account/modify", t("Minha conta")) . "&nbsp;\n";
            echo url("account/logout", t("Sair")) . "&nbsp;\n";
        }
    } elseif ($cnt === 'content') {
        echo $_SESSION['swout'];
    } elseif ($cnt === 'head') {
        echo $_SESSION['swhead'];
    }
}
Example #26
0
    function login_menu()
    {
        if (!is_logged()) {
            ?>
<div class='login_menu'>
<a href='login.php'>Logowanie</a>
</div>
				<?php 
        } else {
            ?>
<div class='login_menu'>
Zalogowano jako <?php 
            echo username();
            ?>
 <a href='logout.php'>wyloguj</a>
</div>
				<?php 
        }
    }
Example #27
0
function ctrl_project_view() {
    try {
        $project = projects()->get(param(1));
        //check if online
        if ((!is_logged ()) && ($project->status==Project::PROJECT_OFFLINE)) {
            //no access
            die('page not found :'.param(1));
        }
        $output['project'] = $project;
        $output['menu'] = projects()->getMenu();
        try {
            output("project_".$project->style.".html.php",$output);
        } catch (Exception $e) {
            output("project_default.html.php",$output);
        }
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
Example #28
0
 public function index()
 {
     if (!is_logged()) {
         redirect('login');
     }
     // Use the same permissions for the list but use different statuses.
     $surveys = array();
     if (has_permission('view survey list any')) {
         redirect('surveys');
     } else {
         if (has_permission('view survey list assigned')) {
             redirect('surveys/open');
         }
     }
     // If regular user just show a empty page.
     $this->load->view('base/html_start');
     $this->load->view('components/navigation', array('active_menu' => 'dashboard'));
     $this->load->view('base/html_end');
 }
Example #29
0
 public function users($offset = 0)
 {
     if (!is_logged()) {
         redirect(base_url());
     }
     $limit = 2;
     $data['header']['title'] = "Users Page";
     $result = $this->users->users_record($limit, $this->uri->segment(3));
     $this->load->library('pagination');
     $config = array();
     $config['base_url'] = site_url('main/users');
     $config['total_rows'] = $result['num_rows'];
     $config['per_page'] = $limit;
     $config['uri_segment'] = 3;
     $this->pagination->initialize($config);
     $data['content']['pagination'] = $this->pagination->create_links();
     $data['content']['users'] = $result['result'];
     $data['content']['num_rows'] = $result['num_rows'];
     $this->template("pages/users", $data);
 }
Example #30
0
function mx_mnmain($page, $option, $action)
{
    global $FBcookie, $me, $mxuser;
    /*if (!$option) { ?>
    	<div class="whymusxpand"><a href="/bestdeal" alt="Click for More"><img src="/images/general/whymusxpand.png" /></a></div>
    	<?php }*/
    mx_checkbrowser();
    if ($_GET['fbp'] && $page == 'main') {
        if ($mxuser->fbdata['page']['id'] == MXFACEBOOKPAGE) {
            mx_mnfeatarts($page, $option, $action);
        } else {
            mx_showhtmlpage('facebook-noartist');
        }
    } else {
        if ($page == 'fbapp' || $option == 'fbapp') {
            mx_showhtmlpage('facebook-app');
        } else {
            if (!$option) {
                //mx_mnfeatarts($page,$option,$action);
                if (is_logged() && is_confirmed()) {
                    mx_showhtmlpage('main');
                } else {
                    if (is_logged() && !is_confirmed()) {
                        mx_showhtmlpage('noaccess');
                    } else {
                        mx_showhtmlpage('main-unlogged');
                    }
                }
            }
        }
    }
    if ($page == 'help') {
        mx_showhtmlpage('helpmain');
    }
    if ($action == 'signed') {
        //echo '<script type="text/javascript" src="'.mx_secureurl('http://www.surveymonkey.com/jsPop.aspx?sm=pCuB8uE5xQv1xdEu18bDGg_3d_3d').'"> </script>';
    }
}