Inheritance: extends Controller
Ejemplo n.º 1
0
 public function show($condition = '')
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "bill_record WHERE 1 " . $condition;
     $q = $this->db->query($sql);
     $data = array();
     $user_id_array = array();
     $user_id = $space = '';
     $bill_id = 0;
     //目前取记录,根据某个订单的来检索
     include_once CUR_CONF_PATH . 'lib/bill.class.php';
     $this->bill = new bill();
     while ($row = $this->db->fetch_array($q)) {
         $checkbool = $row['bill_id'] ? $this->bill->checkLocked($row['bill_id']) : 0;
         $row['locked'] = $checkbool ? 1 : 0;
         if ($row['user_id']) {
             $user_id_array[$row['user_id']] = $row['user_id'];
         }
         $data[] = $row;
     }
     if ($user_id_array) {
         $user_id = implode(',', $user_id_array);
         include_once ROOT_PATH . 'lib/class/auth.class.php';
         $auth = new auth();
         $tmp = $auth->getMemberById($user_id);
         $user_info = array();
         foreach ($tmp as $k => $v) {
             $user_info[$v['id']] = $v['user_name'];
         }
         foreach ($data as $k => $v) {
             $data[$k]['user_name'] = $user_info[$v['user_id']];
         }
     }
     return $data;
 }
Ejemplo n.º 2
0
 /**
  */
 public function logout()
 {
     if ($access_token = $this->input['access_token']) {
         $data['access_token'] = $access_token;
     } else {
         $this->errorOutput(NO_ACCESS_TOKEN);
     }
     $Members = new members();
     $device_token = $Members->check_device_token(trim($this->input['device_token']));
     $udid = $Members->check_udid(trim($this->input['uuid']));
     if ($device_token === 0) {
         $this->errorOutput(ERROR_DEVICE_TOKEN);
     }
     if ($udid === 0) {
         $this->errorOutput(ERROR_UDID);
     }
     $auth = new auth();
     $logoutInfo = $auth->logout($data);
     //会员痕迹
     $member_trace_data = array('member_id' => $logoutInfo['user_id'], 'member_name' => $logoutInfo['user_name'], 'content_id' => $logoutInfo['user_id'], 'title' => $logoutInfo['user_name'], 'type' => 'logout', 'op_type' => '退出', 'appid' => $logoutInfo['appid'], 'appname' => $logoutInfo['display_name'], 'create_time' => TIMENOW, 'ip' => hg_getip(), 'device_token' => $device_token, 'udid' => $udid);
     $mMember = new member();
     $mMember->member_trace_create($member_trace_data);
     $_logoutInfo = array('member_id' => $logoutInfo['user_id'], 'member_name' => $logoutInfo['user_name'], 'is_member' => $logoutInfo['is_member'], 'logout' => $logoutInfo['logout']);
     $this->addItem($_logoutInfo);
     $this->output();
 }
Ejemplo n.º 3
0
 public function detail()
 {
     $id = $this->input['id'];
     if ($id) {
         $info = $this->obj->get_db_first($id);
         $db_relation = $this->obj->get_relation($id);
     }
     //获取支持全文检索的应用模块
     include_once ROOT_PATH . 'lib/class/auth.class.php';
     $auth = new auth();
     $app = $auth->get_app('', '', '', 0, 1000, array('use_textsearch' => 1));
     if ($app && is_array($app)) {
         foreach ($app as $k => $v) {
             $appid[] = $v['bundle'];
             $module = $auth->get_module('', '', implode(',', $appid), '', 0, 1000);
         }
     }
     $result['info'] = $info;
     $result['app'] = $app;
     $result['module'] = $module;
     $result['db_relation'] = $db_relation;
     //		print_r($result);exit;
     $this->addItem($result);
     $this->output();
 }
Ejemplo n.º 4
0
 public function show()
 {
     $uniqueid = '';
     $appname = $record = array();
     $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
     $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 1000;
     include_once ROOT_PATH . 'lib/class/auth.class.php';
     $auth = new auth();
     $app = $auth->get_app('', '', '', 0, 1000, array('use_textsearch' => 1));
     if ($app && is_array($app)) {
         foreach ($app as $k => $v) {
             $appid[] = $v['bundle'];
             $module = $auth->get_module('', '', implode(',', $appid), '', 0, 1000);
         }
     }
     if (is_array($module)) {
         foreach ($module as $k => $v) {
             $module_idarr[] = $v['mod_uniqueid'];
         }
         $all_relation = $this->obj->get_relation_by_m(implode("','", $module_idarr));
         //			print_r($all_relation);exit;
         foreach ($module as $k => $v) {
             $server_count[$v['app_uniqueid']][$v['mod_uniqueid']] = count($all_relation[$v['app_uniqueid']][$v['mod_uniqueid']]);
         }
     }
     $result['app'] = $app;
     $result['module'] = $module;
     $result['server_count'] = $server_count;
     $this->addItem($result);
     $this->output();
 }
Ejemplo n.º 5
0
 function insert($data, $param)
 {
     $user = new auth();
     for ($i = 0; $i < sizeof($param); $i++) {
         $data[$param[$i]] = $user->get($param[$i]);
     }
     db::dbs($GLOBALS['db_name'])->collection("class_blog")->insert($data);
 }
Ejemplo n.º 6
0
    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            $key_len = 54 - strlen($server_url);
            $key_len = max(6, $key_len);
            // we want at least 6
            $key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len;
            // we want at most $config['max_pass_chars']
            $user_actkey = substr(gen_rand_string(10), 0, $key_len);
            $user_password = gen_rand_string(8);
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->to($user_row['user_email'], $user_row['username']);
            $messenger->im($user_row['user_jabber'], $user_row['username']);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
Ejemplo n.º 7
0
 public function show()
 {
     include_once ROOT_PATH . 'lib/class/auth.class.php';
     $auth = new auth();
     $apps = $auth->get_app($this->settings['stat_app']);
     foreach ($apps as $k => $v) {
         $m = array('id' => $v['bundle'], "name" => $v['name'], "fid" => $v['bundle'], "depth" => 1, 'is_last' => 1);
         $this->addItem($m);
     }
     $this->output();
 }
Ejemplo n.º 8
0
 function save($name, $filename, $param)
 {
     //no need to check because in no case will they be executed :p
     $user = new auth();
     for ($i = 0; $i < sizeof($param); $i++) {
         $data[$param[$i]] = $user->get($param[$i]);
     }
     $data["location"] = $filename;
     $data["ip"] = $_SERVER['REMOTE_ADDR'];
     db::dbs($GLOBALS['db_name'])->collection("class_upload")->insert($data);
     move_uploaded_file($_FILES[$name]["tmp_name"], $GLOBALS['path_uploads'] . $filename);
 }
Ejemplo n.º 9
0
 public function show($condition = '')
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "bill WHERE 1 " . $condition;
     $q = $this->db->query($sql);
     $data = array();
     $user_id = $space = '';
     $project_id = $space_second = '';
     while ($row = $this->db->fetch_array($q)) {
         if ($row['user_id']) {
             $user_id .= $space . $row['user_id'];
             $space = ',';
         }
         if ($row['project_id']) {
             $project_id .= $space_second . $row['project_id'];
             $space_second = ',';
         }
         $row['cost_capital'] = hg_cny($row['cost']);
         $row['advice_capital'] = hg_cny($row['advice']);
         $data[] = $row;
     }
     if ($user_id) {
         include_once ROOT_PATH . 'lib/class/auth.class.php';
         $auth = new auth();
         $tmp = $auth->getMemberById($user_id);
         $user_info = array();
         foreach ($tmp as $k => $v) {
             $user_info[$v['id']] = $v['user_name'];
         }
     }
     if ($project_id) {
         include_once CUR_CONF_PATH . 'lib/project.class.php';
         $project = new project();
         $project_info = $tmp = array();
         $tmp = $project->show(' AND id IN(' . $project_id . ')');
         foreach ($tmp as $k => $v) {
             $project_info[$v['id']] = $v['name'];
         }
     }
     foreach ($data as $k => $v) {
         if ($user_info) {
             $data[$k]['user_name'] = $user_info[$v['user_id']];
         }
         if ($project_info) {
             $data[$k]['project_name'] = $project_info[$v['project_id']];
         }
         if (!$v['title']) {
             $data[$k]['title'] = date('Y-m-d', $v['business_time']) . '-' . $data[$k]['project_name'];
         }
     }
     return $data;
 }
Ejemplo n.º 10
0
function count_files($no = 0, $pref = '')
{
    // 0:DATA, 1:TB, 2:Referer, 3: DIFF, 4:BKUP, 5:CTR
    static $dir = array(DATA_DIR, TRACKBACK_DIR, REFERER_DIR, DIFF_DIR, BACKUP_DIR, COUNTER_DIR);
    static $ext = array('.txt', '.txt', '.ref', '.txt', BACKUP_EXT, '.count');
    // コンテンツ管理者以上は、全てのファイルを対象にする
    if (!auth::check_role('role_adm_contents')) {
        $pages = get_existpages($dir[$no], $ext[$no]);
    } else {
        // 自分が閲覧できるページ数のみ戻す
        $pages = auth::get_existpages($dir[$no], $ext[$no]);
    }
    // 条件なし
    if (empty($pref)) {
        return count($pages);
    }
    // 指定文書のカウント
    $i = 0;
    foreach ($pages as $page) {
        if (strpos($page, $pref) === 0) {
            $i++;
        }
    }
    return $i;
}
Ejemplo n.º 11
0
 /**
  * Shows a themed error page.
  * @see Kohana_Exception::handle
  */
 private static function _show_themed_error_page(Exception $e)
 {
     // Create a text version of the exception
     $error = Kohana_Exception::text($e);
     // Add this exception to the log
     Kohana_Log::add('error', $error);
     // Manually save logs after exceptions
     Kohana_Log::save();
     if (!headers_sent()) {
         if ($e instanceof Kohana_Exception) {
             $e->sendHeaders();
         } else {
             header("HTTP/1.1 500 Internal Server Error");
         }
     }
     $view = new Theme_View("page.html", "other", "error");
     if ($e instanceof Kohana_404_Exception) {
         $view->page_title = t("Dang...  Page not found!");
         $view->content = new View("error_404.html");
         $user = identity::active_user();
         $view->content->is_guest = $user && $user->guest;
         if ($view->content->is_guest) {
             $view->content->login_form = new View("login_ajax.html");
             $view->content->login_form->form = auth::get_login_form("login/auth_html");
             // Avoid anti-phishing protection by passing the url as session variable.
             Session::instance()->set("continue_url", url::current(true));
         }
     } else {
         $view->page_title = t("Dang...  Something went wrong!");
         $view->content = new View("error.html");
     }
     print $view;
 }
Ejemplo n.º 12
0
function plugin_newpage_action()
{
    global $vars;
    $_btn_edit = _('Edit');
    $_msg_newpage = _('New page');
    // if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
    if (auth::check_role('readonly')) {
        die_message(_('PKWK_READONLY prohibits editing'));
    }
    if (auth::is_check_role(PKWK_CREATE_PAGE)) {
        die_message(_('PKWK_CREATE_PAGE prohibits editing'));
    }
    if ($vars['page'] == '') {
        $retvars['msg'] = $_msg_newpage;
        $retvars['body'] = plugin_newpage_convert();
        return $retvars;
    } else {
        $page = strip_bracket($vars['page']);
        if (isset($vars['refer'])) {
            $r_page = get_fullname($page, $vars['refer']);
            $r_refer = 'refer=' . $vars['refer'];
        } else {
            $r_page = $page;
            $r_refer = '';
        }
        pkwk_headers_sent();
        header('Location: ' . get_page_location_uri($r_page, $r_refer));
        exit;
    }
}
Ejemplo n.º 13
0
function plugin_insert_convert()
{
    global $script, $vars, $digest;
    static $numbers = array();
    $_btn_insert = _('add');
    // if (PKWK_READONLY) return ''; // Show nothing
    if (auth::check_role('readonly')) {
        return '';
    }
    // Show nothing
    if (!isset($numbers[$vars['page']])) {
        $numbers[$vars['page']] = 0;
    }
    $insert_no = $numbers[$vars['page']]++;
    $s_page = htmlspecialchars($vars['page']);
    $s_digest = htmlspecialchars($digest);
    $s_cols = INSERT_COLS;
    $s_rows = INSERT_ROWS;
    $string = <<<EOD
<form action="{$script}" method="post">
 <div>
  <input type="hidden" name="insert_no" value="{$insert_no}" />
  <input type="hidden" name="refer"  value="{$s_page}" />
  <input type="hidden" name="plugin" value="insert" />
  <input type="hidden" name="digest" value="{$s_digest}" />
  <textarea name="msg" rows="{$s_rows}" cols="{$s_cols}"></textarea><br />
  <input type="submit" name="insert" value="{$_btn_insert}" />
 </div>
</form>
EOD;
    return $string;
}
Ejemplo n.º 14
0
function plugin_deleted_action()
{
    global $vars;
    $_deleted_plugin_title = _('The list of deleted pages');
    $_deleted_plugin_title_withfilename = _('The list of deleted pages (with filename)');
    $dir = isset($vars['dir']) ? $vars['dir'] : 'backup';
    $withfilename = isset($vars['file']);
    $_DIR['diff']['dir'] = DIFF_DIR;
    $_DIR['diff']['ext'] = '.txt';
    $_DIR['backup']['dir'] = BACKUP_DIR;
    $_DIR['backup']['ext'] = BACKUP_EXT;
    // .gz or .txt
    //$_DIR['cache' ]['dir'] = CACHE_DIR; // No way to delete them via web browser now
    //$_DIR['cache' ]['ext'] = '.ref';
    //$_DIR['cache' ]['ext'] = '.rel';
    if (!isset($_DIR[$dir])) {
        return array('msg' => 'Deleted plugin', 'body' => 'No such setting: Choose backup or diff');
    }
    $deleted_pages = array_diff(auth::get_existpages($_DIR[$dir]['dir'], $_DIR[$dir]['ext']), auth::get_existpages());
    if ($withfilename) {
        $retval['msg'] = $_deleted_plugin_title_withfilename;
    } else {
        $retval['msg'] = $_deleted_plugin_title;
    }
    $retval['body'] = page_list($deleted_pages, $dir, $withfilename);
    return $retval;
}
Ejemplo n.º 15
0
function plugin_ls2_show_lists($prefix, &$params)
{
    //	global $_ls2_err_nopages;
    $pages = array();
    if ($prefix != '') {
        foreach (auth::get_existpages() as $_page) {
            if (strpos($_page, $prefix) === 0) {
                $pages[] = $_page;
            }
        }
    } else {
        $pages = auth::get_existpages();
    }
    natcasesort($pages);
    if ($params['reverse']) {
        $pages = array_reverse($pages);
    }
    foreach ($pages as $page) {
        $params['page_ ' . $page] = 0;
    }
    if (empty($pages)) {
        return str_replace('$1', htmlspecialchars($prefix), '<p>' . _("There is no child page in ' \$1'") . '</p>');
    } else {
        $params['result'] = $params['saved'] = array();
        foreach ($pages as $page) {
            plugin_ls2_get_headings($page, $params, 1);
        }
        return join("\n", $params['result']) . join("\n", $params['saved']);
    }
}
Ejemplo n.º 16
0
function plugin_group_convert()
{
    global $_group_msg;
    $auth_key = auth::get_user_info();
    if (empty($auth_key['group'])) {
        return '';
    }
    $argv = func_get_args();
    $i = count($argv);
    if ($i < 2) {
        return <<<EOD
<div>
        <label>{$_group_msg['group']}</label>:
        {$auth_key['group']}
</div>

EOD;
    }
    $msg = $argv[$i - 1];
    array_pop($argv);
    if (in_array($auth_key['group'], $argv)) {
        return convert_html(str_replace("\r", "\n", $msg));
    }
    return '';
}
Ejemplo n.º 17
0
function plugin_tb_action()
{
    global $vars, $trackback;
    if (isset($vars['url'])) {
        // Receive and save a TrackBack Ping (both GET and POST)
        $url = $vars['url'];
        $tb_id = isset($vars['tb_id']) ? $vars['tb_id'] : '';
        plugin_tb_save($url, $tb_id);
        // Send a response (and exit)
    } else {
        if ($trackback && isset($vars['__mode']) && isset($vars['tb_id'])) {
            // Show TrackBacks received (and exit)
            switch ($vars['__mode']) {
                case 'rss':
                    plugin_tb_mode_rss($vars['tb_id']);
                    break;
                    // case 'view': plugin_tb_mode_view($vars['tb_id']); break;
                // case 'view': plugin_tb_mode_view($vars['tb_id']); break;
                case 'view':
                    return plugin_tb_mode_view($vars['tb_id']);
            }
        }
        // Show List of pages that TrackBacks reached
        $pages = auth::get_existpages(TRACKBACK_DIR, '.txt');
        if (!empty($pages)) {
            return array('msg' => 'Trackback list', 'body' => page_list($pages, 'read', FALSE));
        } else {
            return array('msg' => '', 'body' => '');
        }
    }
}
Ejemplo n.º 18
0
function plugin_mypage_convert()
{
    global $_mypage_msg;
    @(list($is_page) = func_get_args());
    $is_page = empty($is_page) ? false : true;
    $auth_key = auth::get_user_info();
    // 認証確認
    if (empty($auth_key['key'])) {
        return '';
    }
    // マイページ利用の確認
    if (empty($auth_key['mypage'])) {
        return '';
    }
    // マイページの作成により制御
    // マイページ未作成の場合
    // is_page : true  -> プラグイン利用ページに遷移 -> #mypage(1)
    //         : false -> 新規作成画面に遷移         -> #mypage
    // The page cannot be prepared. -> ページの準備ができていません。
    if ($is_page && !is_page($auth_key['mypage'])) {
        return $_mypage_msg['msg_no_page'];
    }
    // 画面に誘導
    header('Location: ' . get_page_location_uri($auth_key['mypage']));
    // 誘導失敗時の対処(ブラウザによる)
    die_message($_mypage_msg['err_jump']);
}
Ejemplo n.º 19
0
function plugin_ls_convert()
{
    global $vars;
    $with_title = FALSE;
    if (func_num_args()) {
        $args = func_get_args();
        $with_title = in_array('title', $args);
    }
    $prefix = $vars['page'] . '/';
    $pages = array();
    foreach (auth::get_existpages() as $page) {
        if (strpos($page, $prefix) === 0) {
            $pages[] = $page;
        }
    }
    natcasesort($pages);
    $ls = array();
    foreach ($pages as $page) {
        $comment = '';
        if ($with_title) {
            list($comment) = get_source($page);
            // 見出しの固有ID部を削除
            $comment = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/', '$1$2', $comment);
            $comment = '- ' . ereg_replace('^[-*]+', '', $comment);
        }
        $ls[] = "-[[{$page}]] {$comment}";
    }
    return convert_html($ls);
}
Ejemplo n.º 20
0
function plugin_doc_ini_action()
{
    global $script, $vars, $_doc_ini_msg;
    if (auth::check_role('role_adm_contents')) {
        die_message('NOT AUTHORIZED.');
    }
    if (empty($vars['page'])) {
        return;
    }
    if (!is_pagename($vars['page'])) {
        return '';
    }
    // Invalid page name;
    $action = empty($vars['action']) ? '' : $vars['action'];
    $retval = array();
    $msg_title = sprintf($_doc_ini_msg['msg_confirmation'], $vars['page']);
    if ($action === 'exec') {
        return plugin_doc_ini_exec($vars['page']);
    }
    $retval['body'] = <<<EOD
<form action="{$script}" method="post">
        <div>
\t{$msg_title}
                <input type="hidden" name="plugin" value="doc_ini" />
                <input type="hidden" name="action" value="exec" />
                <input type="hidden" name="page" value="{$vars['page']}" />
                <input type="submit" value="{$_doc_ini_msg['btn_exec']}" />
        </div>
</form>

EOD;
    $retval['msg'] = $_doc_ini_msg['title_confirmation'];
    return $retval;
}
 /**
  * Reusable function to get an authorization header value
  *
  * @param $webServiceId
  * @param $sharedSecret
  * @param $actor
  *
  * @return string
  */
 public static function getAuthorizationHeader($webServiceId, $sharedSecret, $actor)
 {
     $ws_nonce_array = auth::getNonce($webServiceId, $actor);
     $binaryHash = hash_hmac('sha512', $ws_nonce_array["nonceValue"], $sharedSecret, true);
     $hash = base64_encode($binaryHash);
     return "Nonce-Encoded-API-Key {$webServiceId},{$ws_nonce_array["nonceKey"]},{$hash}";
 }
Ejemplo n.º 22
0
 static function change_provider($new_provider)
 {
     $current_provider = module::get_var("gallery", "identity_provider");
     if (!empty($current_provider)) {
         module::uninstall($current_provider);
     }
     try {
         IdentityProvider::reset();
         $provider = new IdentityProvider($new_provider);
         module::set_var("gallery", "identity_provider", $new_provider);
         if (method_exists("{$new_provider}_installer", "initialize")) {
             call_user_func("{$new_provider}_installer::initialize");
         }
         module::event("identity_provider_changed", $current_provider, $new_provider);
         auth::login($provider->admin_user());
         Session::instance()->regenerate();
     } catch (Exception $e) {
         static $restore_already_running;
         // In case of error, make an attempt to restore the old provider.  Since that's calling into
         // this function again and can fail, we should be sure not to get into an infinite recursion.
         if (!$restore_already_running) {
             $restore_already_running = true;
             // Make sure new provider is not in the database
             module::uninstall($new_provider);
             // Lets reset to the current provider so that the gallery installation is still
             // working.
             module::set_var("gallery", "identity_provider", null);
             IdentityProvider::change_provider($current_provider);
             module::activate($current_provider);
             message::error(t("Error attempting to enable \"%new_provider\" identity provider, " . "reverted to \"%old_provider\" identity provider", array("new_provider" => $new_provider, "old_provider" => $current_provider)));
             $restore_already_running = false;
         }
         throw $e;
     }
 }
Ejemplo n.º 23
0
 public function __call($controller_name, $args)
 {
     if (Input::instance()->get("reauth_check")) {
         return self::_reauth_check();
     }
     if (auth::must_reauth_for_admin_area()) {
         return self::_prompt_for_reauth($controller_name, $args);
     }
     if (request::method() == "post") {
         access::verify_csrf();
     }
     if ($controller_name == "index") {
         $controller_name = "dashboard";
     }
     $controller_name = "Admin_{$controller_name}_Controller";
     if ($args) {
         $method = array_shift($args);
     } else {
         $method = "index";
     }
     if (!method_exists($controller_name, $method)) {
         throw new Kohana_404_Exception();
     }
     call_user_func_array(array(new $controller_name(), $method), $args);
 }
Ejemplo n.º 24
0
 /**
  * Make sure that we have a session and group_ids cached in the session.
  */
 static function load_user()
 {
     try {
         // Call IdentityProvider::instance() now to force the load of the user interface classes.
         // We are about to load the active user from the session and which needs the user definition
         // class, which can't be reached by Kohana's heiracrchical lookup.
         IdentityProvider::instance();
         $session = Session::instance();
         if (!($user = $session->get("user"))) {
             self::set_active_user($user = self::guest());
         }
         // The installer cannot set a user into the session, so it just sets an id which we should
         // upconvert into a user.
         // @todo set the user name into the session instead of 2 and then use it to get the user object
         if ($user === 2) {
             auth::login(IdentityProvider::instance()->admin_user());
         }
         if (!$session->get("group_ids")) {
             $ids = array();
             foreach ($user->groups() as $group) {
                 $ids[] = $group->id;
             }
             $session->set("group_ids", $ids);
         }
     } catch (Exception $e) {
         // Log it, so we at least have so notification that we swallowed the exception.
         Kohana_Log::add("error", "load_user Exception: " . $e->getMessage() . "\n" . $e->getTraceAsString());
         try {
             Session::instance()->destroy();
         } catch (Exception $e) {
             // We don't care if there was a problem destroying the session.
         }
         url::redirect(item::root()->abs_url());
     }
 }
Ejemplo n.º 25
0
function plugin_referer_action()
{
    global $vars, $referer;
    global $_referer_msg;
    // Setting: Off
    if (!$referer) {
        return array('msg' => '', 'body' => '');
    }
    if (isset($vars['page']) && $vars['page'] != '' && is_page($vars['page'])) {
        $sort = empty($vars['sort']) ? '0d' : $vars['sort'];
        return array('msg' => $_referer_msg['msg_H0_Refer'], 'body' => plugin_referer_body($vars['page'], $sort));
    }
    $pages = auth::get_existpages(TRACKBACK_DIR, '.ref');
    if (empty($pages)) {
        return array('msg' => '', 'body' => '');
    } else {
        $body = '';
        $sort = empty($vars['sort']) ? '0d' : $vars['sort'];
        foreach ($pages as $page) {
            $body .= '<h2>' . make_pagelink($page) . '</h2>';
            $body .= plugin_referer_body($page, $sort);
        }
        return array('msg' => 'referer list', 'body' => $body);
    }
}
Ejemplo n.º 26
0
 public static function uncachedRequest($url)
 {
     if (!function_exists('curl_init') || !kernel::Configuration("curlSupport")) {
         return file_get_contents($url);
     } else {
         $errno = CURLE_OK;
         $error = '';
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
         if (kernel::Configuration("authentication")) {
             curl_setopt($ch, CURLOPT_HTTPHEADER, array(auth::generateAuthHeader($url)));
         }
         curl_setopt($ch, CURLOPT_TIMEOUT, 10);
         curl_setopt($ch, CURLOPT_VERBOSE, false);
         curl_setopt($ch, CURLOPT_URL, $url);
         // Execute
         $response = curl_exec($ch);
         //Deal with HTTP errors
         $errno = curl_errno($ch);
         $error = curl_error($ch);
         curl_close($ch);
         if ($errno) {
             return false;
         } else {
             return $response;
         }
     }
 }
Ejemplo n.º 27
0
 /**
  * 
  * formmanager definitions
  * 
  */
 public function form_setup($form)
 {
     $form->fields['id_user']['value'] = auth::instance()->get_user()->id_user;
     $form->fields['id_user']['display_as'] = 'hidden';
     $form->fields['seotitle']['display_as'] = 'hidden';
     $form->fields['id_forum']['display_as'] = 'select';
     $form->fields['id_forum']['caption'] = 'name';
 }
Ejemplo n.º 28
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (!Auth::check()) {
         return view('account.login');
     }
     $orders = auth::user()->orders()->with('Items', 'Items.Product', 'Items.Product.images')->orderBy('created_at', 'asc')->limit(3)->get();
     return view('account.account', compact('orders'));
 }
Ejemplo n.º 29
0
 function __construct()
 {
     require 'libs/mark/michelf/markdown.inc.php';
     parent::__construct();
     auth::HandleLogin();
     $this->view->titl = 'Admin area';
     $this->view->canon = 'feedback';
 }
Ejemplo n.º 30
0
function plugin_version_value()
{
    //	if (PKWK_SAFE_MODE) return '';
    if (auth::check_role('safemode')) {
        return '';
    }
    return S_VERSION;
}