コード例 #1
0
ファイル: pages.php プロジェクト: Br3nda/openmicroblogger
 function pages_init()
 {
     include 'wp-content/language/lang_chooser.php';
     //Loads the language-file
     // app_register_init( table, action, apptitle, appname, number )
     if (member_of('administrators')) {
         app_register_init('pages', 'pagelist', 'Pages', 'pages', 2);
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: voitto/eggs
function authenticate_user($args)
{
    $path_info = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/';
    $parts = explode('/', $path_info);
    session_start();
    if (isset($_SESSION['face_userid'])) {
        return member_of($parts[2]);
    }
    $_SESSION['return_to'] = 'http://tweetiepic.com/shared/' . $parts[2];
    $fblogin = '******';
    redirect_to($fblogin);
}
コード例 #3
0
ファイル: settings.php プロジェクト: Br3nda/openmicroblogger
function post(&$vars)
{
    extract($vars);
    if (!get_profile_id()) {
        trigger_error('Sorry, the setting could not be saved', E_USER_ERROR);
    }
    $request->set_param(array('setting', 'profile_id'), get_profile_id());
    if (strpos($request->params['setting']['name'], 'password') !== false) {
        $request->set_param(array('setting', 'value'), md5_encrypt($request->params['setting']['value'], $db->dbname));
    }
    $settingname = $request->params['setting']['name'];
    $set = split('\\.', $settingname);
    if (is_array($set) && $set[0] == 'config') {
        if (!member_of('administrators')) {
            trigger_error('Sorry, you must be an administrator to do that', E_USER_ERROR);
        }
        $s = $Setting->find_by('name', $settingname);
        if ($s) {
            $db->delete_record($s);
        }
    }
    if ($settingname == 'app') {
        $do_install = false;
        $app = $settingname;
        $sources = environment('remote_sources');
        $remote_list = array();
        foreach ($sources as $name => $url) {
            $p = get_profile();
            $url = "http://" . $url . "&p=" . urlencode($p->profile_url) . "&a=" . urlencode($app);
            $curl = curl_init($url);
            curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($curl, CURLOPT_HEADER, false);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            $result = curl_exec($curl);
            if ($result) {
                if (trim($result) == 'install') {
                    $do_install = true;
                }
                continue;
            }
            curl_close($curl);
        }
        if (!$do_install) {
            trigger_error('Sorry, you are not authorized to install ' . $app, E_USER_ERROR);
        }
    }
    $resource->insert_from_post($request);
    header_status('201 Created');
    redirect_to($request->resource);
}
コード例 #4
0
ファイル: sidebar.php プロジェクト: Br3nda/openmicroblogger
                followgrid();
                ?>
      </div>
      <?php 
            }
            ?>
    
    
  <?php 
        }
    }
    ?>
  <?php 
    $links = array();
    global $request;
    if (member_of('administrators')) {
        $links['Admin'] = $request->url_for('admin');
    }
    $links['Logout'] = $request->url_for('openid_logout');
    $links['Register'] = $request->url_for('register');
    $links['Login'] = $request->url_for('email_login');
    ?>
    
  <?php 
    if (!isset($request->params['nickname'])) {
        ?>

    <p class="liother">
    <a href="<?php 
        base_url();
        ?>
コード例 #5
0
ファイル: admin.php プロジェクト: Br3nda/openmicroblogger
function _sources(&$vars)
{
    extract($vars);
    if (!member_of('administrators')) {
        trigger_error('sorry you must be an administrator to do that', E_USER_ERROR);
    }
    $aktwitter_tw_text_options = array('0' => 'false', '1' => 'true');
    $Setting =& $db->model('Setting');
    $returnvars = array();
    $TwitterUser =& $db->model('TwitterUser');
    $TwitterUser->find_by(array('eq' => 'not like', 'oauth_key' => ''), 1);
    $i = 1;
    while ($tu = $TwitterUser->MoveNext()) {
        $modevar = 'n' . $i . 'mode';
        $urlvar = 'n' . $i . 'url';
        $entryvar = 'n' . $i . 'entry';
        $nickvar = 'n' . $i . 'nick';
        $i++;
        ${$nickvar} = $tu->screen_name;
        ${$modevar} = $Setting->find_by('name', 'config.env.importtwitter_' . $tu->id);
        if (!${$modevar}) {
            ${$modevar} = $Setting->base();
            ${$modevar}->set_value('profile_id', get_profile_id());
            ${$modevar}->set_value('person_id', get_person_id());
            ${$modevar}->set_value('name', 'config.env.importtwitter_' . $tu->id);
            ${$modevar}->set_value('value', 0);
            ${$modevar}->save_changes();
            ${$modevar}->set_etag();
            ${$modevar} = $Setting->find(${$modevar}->id);
        }
        ${$urlvar} = $request->url_for(array('resource' => 'settings', 'id' => ${$modevar}->id, 'action' => 'put'));
        ${$entryvar} = ${$modevar}->FirstChild('entries');
        $returnvars[] =& ${$modevar};
        $returnvars[] =& ${$urlvar};
        $returnvars[] =& ${$entryvar};
        $returnvars[] =& ${$nickvar};
    }
    $returnvars[] =& $collection;
    $returnvars[] =& $profile;
    $returnvars[] =& $aktwitter_tw_text_options;
    $listvars = array(1 => 'friends_timeline', 0 => 'disabled');
    $returnvars[] =& $listvars;
    $returnvars[] =& $i;
    return vars($returnvars, get_defined_vars());
}
コード例 #6
0
ファイル: _functions.php プロジェクト: voitto/dbscript
function get_nav_links()
{
    global $request;
    $pid = get_app_id();
    $links = array();
    $i = get_profile($pid);
    $links["Public"] = base_url(true);
    if ($i && $i->id > 0) {
        $links["Personal"] = $request->url_for(array("resource" => "posts", "forid" => $i->id, "page" => 1));
        if (empty($i->post_notice)) {
            $links["Profile"] = $request->url_for(array("resource" => $i->nickname));
        } else {
            $links["Profile"] = $i->profile;
        }
        if (empty($i->post_notice)) {
            $links["@" . $i->nickname] = $request->url_for(array("resource" => $i->nickname)) . "/replies";
        } else {
            $links["@" . $i->nickname] = $i->profile . "/replies";
        }
    }
    if ($pid > 0) {
        if (member_of('administrators')) {
            $links["Admin"] = $request->url_for(array('resource' => 'admin'));
        }
        $links["Upload"] = $request->url_for(array('resource' => 'posts', 'action' => 'upload'));
        $links["Logout"] = $request->url_for("openid_logout");
    } else {
        $links["Register"] = $request->url_for("register");
        $links["Login"] = $request->url_for("email_login");
    }
    return $links;
}
コード例 #7
0
ファイル: model.php プロジェクト: Br3nda/openmicroblogger
 function can_superuser($resource)
 {
     if (!isset($this->access_list['superuser'][$resource])) {
         return false;
     }
     foreach ($this->access_list['superuser'][$resource] as $callback) {
         if (function_exists($callback)) {
             if ($callback()) {
                 return true;
             }
         } else {
             if (member_of($callback)) {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #8
0
ファイル: wp.php プロジェクト: Br3nda/openmicroblogger
function current_user_can($action, $post_id = false)
{
    if (member_of('administrators')) {
        return true;
    }
    global $request, $the_author;
    if ($action == 'publish_posts' && ($request->resource != 'posts' || $request->action != 'index')) {
        return false;
    } elseif ($action == 'publish_posts' && get_profile_id()) {
        return true;
    }
    $id = get_profile_id();
    if (!$id) {
        return false;
    }
    if (isset($request->params['byid'])) {
        $byid = $request->params['byid'];
    } else {
        $byid = 0;
    }
    if ($byid && $id == $byid) {
        return true;
    } elseif ($id == $the_author->id) {
        return true;
    }
    return false;
}