Ejemplo n.º 1
0
/**
 * get auth for churchdb
 *
 * @return array
 */
function churchdb_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 121, 'view birthdaylist', 'churchdb', null, t('view.birthdaylist'), 1);
    $cc_auth = addAuth($cc_auth, 122, 'view memberliste', 'churchdb', null, t('view.memberliste'), 1);
    $cc_auth = addAuth($cc_auth, 101, 'view', 'churchdb', null, t('view.x', 'ChurchDB'), 1);
    $cc_auth = addAuth($cc_auth, 106, 'view statistics', 'churchdb', null, t('view.statistics'), 1);
    $cc_auth = addAuth($cc_auth, 107, 'view tags', 'churchdb', null, t('view.tags'), 1);
    $cc_auth = addAuth($cc_auth, 108, 'view history', 'churchdb', null, t('view.history'), 1);
    $cc_auth = addAuth($cc_auth, 113, 'view comments', 'churchdb', 'cdb_comment_viewer', t('view.comments'), 1);
    $cc_auth = addAuth($cc_auth, 105, 'view address', 'churchdb', null, t('view.address'), 1);
    $cc_auth = addAuth($cc_auth, 103, 'view alldetails', 'churchdb', null, t('view.alldetails'), 1);
    $cc_auth = addAuth($cc_auth, 116, 'view archive', 'churchdb', null, t('view.archive'), 1);
    $cc_auth = addAuth($cc_auth, 120, 'complex filter', 'churchdb', null, t('use.complex.filters'), 1);
    $cc_auth = addAuth($cc_auth, 118, 'push/pull archive', 'churchdb', null, t('archivate.persons'), 1);
    $cc_auth = addAuth($cc_auth, 109, 'edit relations', 'churchdb', null, t('edit.relations'), 1);
    $cc_auth = addAuth($cc_auth, 110, 'edit groups', 'churchdb', null, t('edit.groups'), 1);
    $cc_auth = addAuth($cc_auth, 119, 'create person', 'churchdb', null, t('create.persons'), 1);
    $cc_auth = addAuth($cc_auth, 123, 'create person without agreement', 'churchdb', null, t('create.persons.without.agreement'), 1);
    $cc_auth = addAuth($cc_auth, 111, 'write access', 'churchdb', null, t('write.access.persons'), 1);
    $cc_auth = addAuth($cc_auth, 102, 'view alldata', 'churchdb', 'cdb_bereich', t('view.alldata'), 1);
    $cc_auth = addAuth($cc_auth, 117, 'send sms', 'churchdb', null, t('send.sms'), 1);
    $cc_auth = addAuth($cc_auth, 112, 'export data', 'churchdb', null, t('export.data'), 1);
    $cc_auth = addAuth($cc_auth, 115, 'view group', 'churchdb', 'cdb_gruppe', t('view.group'), 0);
    $cc_auth = addAuth($cc_auth, 104, 'view group statistics', 'churchdb', null, t('view.group.statistics'), 1);
    $cc_auth = addAuth($cc_auth, 114, 'administer groups', 'churchdb', null, t('administer.groups'), 1);
    $cc_auth = addAuth($cc_auth, 199, 'edit masterdata', 'churchdb', null, t('edit.masterdata'), 1);
    return $cc_auth;
}
Ejemplo n.º 2
0
/**
 * get auth
 * @return unknown
 */
function churchreport_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 701, 'view', 'churchreport', null, t('view.x', 'ChurchReport'), 1);
    $cc_auth = addAuth($cc_auth, 799, 'edit masterdata', 'churchreport', null, t('edit.masterdata'), 1);
    return $cc_auth;
}
Ejemplo n.º 3
0
/**
 * get auth for churchdb
 * 
 * @return array
 */
function churchdb_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 121, 'view birthdaylist', 'churchdb', null, 'Geburtagsliste einsehen', 1);
    $cc_auth = addAuth($cc_auth, 122, 'view memberliste', 'churchdb', null, 'Mitgliederliste einsehen', 1);
    $cc_auth = addAuth($cc_auth, 101, 'view', 'churchdb', null, 'ChurchDB sehen', 1);
    $cc_auth = addAuth($cc_auth, 106, 'view statistics', 'churchdb', null, 'Gesamtstatistik einsehen', 1);
    $cc_auth = addAuth($cc_auth, 107, 'view tags', 'churchdb', null, 'Tags einsehen', 1);
    $cc_auth = addAuth($cc_auth, 108, 'view history', 'churchdb', null, 'Historie eines Datensatzes ansehen', 1);
    $cc_auth = addAuth($cc_auth, 113, 'view comments', 'churchdb', 'cdb_comment_viewer', 'Kommentare einsehen', 1);
    $cc_auth = addAuth($cc_auth, 105, 'view address', 'churchdb', null, 'Zusätzlich Adressdaten der sichtbaren Personen einsehen (Strasse)', 1);
    $cc_auth = addAuth($cc_auth, 103, 'view alldetails', 'churchdb', null, 'Alle Informationen der sichtbaren Person sehen, inkl. Adressdaten, Gruppenzuordnung, etc.', 1);
    $cc_auth = addAuth($cc_auth, 116, 'view archive', 'churchdb', null, 'Personen-Archiv einsehen', 1);
    $cc_auth = addAuth($cc_auth, 120, 'complex filter', 'churchdb', null, '"Weitere Filter" darf verwendet werden', 1);
    $cc_auth = addAuth($cc_auth, 118, 'push/pull archive', 'churchdb', null, 'Personen ins Archiv verschieben und zurückholen', 1);
    $cc_auth = addAuth($cc_auth, 109, 'edit relations', 'churchdb', null, 'Beziehungen der sichtbaren Personen editieren', 1);
    $cc_auth = addAuth($cc_auth, 110, 'edit groups', 'churchdb', null, 'Alle Gruppenzuordnungen der sichtbaren Personen editieren', 1);
    $cc_auth = addAuth($cc_auth, 119, 'create person', 'churchdb', null, 'Darf Personen erstellen', 1);
    $cc_auth = addAuth($cc_auth, 123, 'create person without agreement', 'churchdb', null, 'Darf Personen auch ohne Einverständnis erstellen.', 1);
    $cc_auth = addAuth($cc_auth, 111, 'write access', 'churchdb', null, 'Schreibzugriff auf alle sichtbaren Personen', 1);
    $cc_auth = addAuth($cc_auth, 102, 'view alldata', 'churchdb', 'cdb_bereich', 'Alle Personen des jeweiligen Bereiches sichtbar machen', 1);
    $cc_auth = addAuth($cc_auth, 117, 'send sms', 'churchdb', null, 'SMS-Schnittstelle verwenden', 1);
    $cc_auth = addAuth($cc_auth, 112, 'export data', 'churchdb', null, 'Die Daten aller(!) Personen exportieren', 1);
    $cc_auth = addAuth($cc_auth, 115, 'view group', 'churchdb', 'cdb_gruppe', 'Einzelne Gruppen einsehen - inklusive versteckte Gruppen', 0);
    $cc_auth = addAuth($cc_auth, 104, 'view group statistics', 'churchdb', null, 'Gruppenstatistik aller Gruppen einsehen', 1);
    $cc_auth = addAuth($cc_auth, 114, 'administer groups', 'churchdb', null, 'Gruppen administrieren, d.h. erstellen, löschen, etc.', 1);
    $cc_auth = addAuth($cc_auth, 199, 'edit masterdata', 'churchdb', null, 'Stammdaten editieren', 1);
    return $cc_auth;
}
Ejemplo n.º 4
0
function churchreport_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 701, 'view', 'churchreport', null, 'ChurchReport sehen', 1);
    $cc_auth = addAuth($cc_auth, 799, 'edit masterdata', 'churchreport', null, 'Stammdaten editieren', 1);
    return $cc_auth;
}
Ejemplo n.º 5
0
/**
 * TODO: not used? 
 * 
 * @return array $cc_auth
 */
function churchcore_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 1, 'administer settings', "churchcore", null, 'Admin-Einstellungen anpassen', 1);
    $cc_auth = addAuth($cc_auth, 2, 'administer persons', 'churchcore', null, 'Berechtigungen setzen, löschen und Benutzer simulieren', 1);
    $cc_auth = addAuth($cc_auth, 3, 'view logfile', 'churchcore', null, 'Logfile einsehen', 1);
    $cc_auth = addAuth($cc_auth, 4, 'view whoisonline', 'churchcore', null, 'Auf der Startseite sehen, wer aktuell online ist', 1);
    return $cc_auth;
}
Ejemplo n.º 6
0
function churchwiki_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 501, 'view', 'churchwiki', null, 'ChurchWiki sehen', 1);
    $cc_auth = addAuth($cc_auth, 502, 'view category', 'churchwiki', 'cc_wikicategory', 'Einzelne Wiki-Kategorien sehen', 1);
    $cc_auth = addAuth($cc_auth, 503, 'edit category', 'churchwiki', 'cc_wikicategory', 'Einzelne Wiki-Kategorien editieren', 1);
    $cc_auth = addAuth($cc_auth, 599, 'edit masterdata', 'churchwiki', null, 'Stammdaten editieren', 1);
    return $cc_auth;
}
Ejemplo n.º 7
0
/**
 * get auth
 * @return auth
 */
function churchwiki_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 501, 'view', 'churchwiki', null, t('view.x', getConf("churchwiki_name")), 1);
    $cc_auth = addAuth($cc_auth, 502, 'view category', 'churchwiki', 'cc_wikicategory', t('view.wiki.category'), 1);
    $cc_auth = addAuth($cc_auth, 503, 'edit category', 'churchwiki', 'cc_wikicategory', t('edit.wiki.category'), 1);
    $cc_auth = addAuth($cc_auth, 599, 'edit masterdata', 'churchwiki', null, t('edit.masterdata'), 1);
    return $cc_auth;
}
Ejemplo n.º 8
0
function churchservice_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 301, 'view', 'churchservice', null, t('view.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 304, 'view servicegroup', 'churchservice', 'cs_servicegroup', t('view.servicegroup.churchservice.cs_servicegroup'), 1);
    $cc_auth = addAuth($cc_auth, 305, 'edit servicegroup', 'churchservice', 'cs_servicegroup', t('edit.servicegroup.churchservice.cs_servicegroup'), 1);
    $cc_auth = addAuth($cc_auth, 302, 'view history', 'churchservice', null, t('view.history.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 303, 'edit events', 'churchservice', null, t('edit.events.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 309, 'edit template', 'churchservice', null, t('edit.template.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 307, 'manage absent', 'churchservice', null, t('manage.absent.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 321, 'view facts', 'churchservice', null, t('view.facts.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 308, 'edit facts', 'churchservice', null, t('edit.facts.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 322, 'export facts', 'churchservice', null, t('export.facts.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 331, 'view agenda', 'churchservice', 'cc_calcategory', t('view.agenda.churchservice.cc_calcategory'), 1);
    $cc_auth = addAuth($cc_auth, 332, 'edit agenda', 'churchservice', 'cc_calcategory', t('edit.agenda.churchservice.cc_calcategory'), 1);
    $cc_auth = addAuth($cc_auth, 333, 'edit agenda templates', 'churchservice', 'cc_calcategory', t('edit.agenda.templates.churchservice.cc_calcategory'), 1);
    $cc_auth = addAuth($cc_auth, 313, 'view songcategory', 'churchservice', 'cs_songcategory', t('view.songcategory.churchservice.cs_songcategory'), 1);
    $cc_auth = addAuth($cc_auth, 311, 'view song', 'churchservice', null, t('view.song.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 312, 'edit song', 'churchservice', null, t('edit.song.churchservice'), 1);
    $cc_auth = addAuth($cc_auth, 399, 'edit masterdata', 'churchservice', null, t('edit.masterdata.churchservice'), 1);
    return $cc_auth;
}
Ejemplo n.º 9
0
 protected function post_id_authClass_start_end_handler()
 {
     addAuth($this->id, $this->authClass, $this->start, $this->end);
     header('Location: ' . filter_input(INPUT_SERVER, 'PHP_SELF'));
     return false;
 }
Ejemplo n.º 10
0
            deleteAuth($updates, $authinfo["userid"], $username);
            xsuccess(count($updates) . " links updated", "json");
        } else {
            if ($mode == "history") {
                $result = readHistory($authinfo["userid"], "json");
                echo $result;
                die;
            } else {
                if ($mode == "devices") {
                    $result = getDevices($authinfo["userid"], "json");
                    echo $result;
                    die;
                } else {
                    if ($mode == "addauth") {
                        $device = $json["device"];
                        $r = addAuth($username, $authinfo["userid"], $device, $developer);
                        if ($r["success"] == "") {
                            xerror($r["error"], "json");
                        } else {
                            xdevice($device, $r["success"], "json");
                        }
                    }
                }
            }
        }
    }
    // remove plain text. no plain text api for account
} else {
    xerror("no post data");
}
function checkAuth($username, $auth, $mode = false)
Ejemplo n.º 11
0
function churchcal_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 401, 'view', 'churchcal', null, 'ChurchCal sehen', 1);
    $cc_auth = addAuth($cc_auth, 403, 'view category', 'churchcal', 'cc_calcategory', 'Einzelne Kalender sehen', 0);
    $cc_auth = addAuth($cc_auth, 404, 'edit category', 'churchcal', 'cc_calcategory', 'In einzelnen Kalender Termine erstellen, editieren etc.', 0);
    //$cc_auth=addAuth($cc_auth, 407,'create personal category', 'churchcal', null, 'Persönlichen Kalender erstellen', 1);
    //$cc_auth=addAuth($cc_auth, 406,'admin personal category', 'churchcal', null, 'Persönliche Kalender administrieren', 1);
    $cc_auth = addAuth($cc_auth, 408, 'create group category', 'churchcal', null, 'Gruppenkalender erstellen', 1);
    $cc_auth = addAuth($cc_auth, 405, 'admin group category', 'churchcal', null, 'Gruppenkalender administrieren', 1);
    $cc_auth = addAuth($cc_auth, 402, 'admin church category', 'churchcal', null, 'Gemeindekalender administrieren', 1);
    return $cc_auth;
}
Ejemplo n.º 12
0
/**
 * get auth for churchcal
 * @return array auth
 */
function churchcal_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 401, 'view', 'churchcal', null, t('view.x', getConf("churchcal_name")), 1);
    $cc_auth = addAuth($cc_auth, 403, 'view category', 'churchcal', 'cc_calcategory', t('view.single.calendar'), 0);
    $cc_auth = addAuth($cc_auth, 404, 'edit category', 'churchcal', 'cc_calcategory', t('edit.single.calendar'), 0);
    $cc_auth = addAuth($cc_auth, 409, 'assistance mode', 'churchcal', null, t('assistant.mode'), 1);
    $cc_auth = addAuth($cc_auth, 407, 'create personal category', 'churchcal', null, 'Persönlichen Kalender erstellen', 1);
    $cc_auth = addAuth($cc_auth, 406, 'admin personal category', 'churchcal', null, 'Persönliche Kalender administrieren', 1);
    $cc_auth = addAuth($cc_auth, 408, 'create group category', 'churchcal', null, t('create.group.calendar'), 1);
    $cc_auth = addAuth($cc_auth, 405, 'admin group category', 'churchcal', null, t('administer.group.calendar'), 1);
    $cc_auth = addAuth($cc_auth, 402, 'admin church category', 'churchcal', null, t('administer.church.calendar'), 1);
    return $cc_auth;
}
Ejemplo n.º 13
0
    /**
      Define any javascript needed
      @return A javascript string
    function javascript_content(){
        $js ="";
        return $js;
    
    }
    */
    function body_content()
    {
        global $FANNIE_AUTH_ENABLED;
        include '../config.php';
        ob_start();
        echo showInstallTabs('Authentication');
        ?>

<form action=InstallAuthenticationPage.php method=post>
<h1 class="install">
    <?php 
        if (!$this->themed) {
            echo "<h1 class='install'>{$this->header}</h1>";
        }
        ?>
</h1>
<?php 
        if (is_writable('../config.php')) {
            echo "<div class=\"alert alert-success\"><i>config.php</i> is writeable</div>";
        } else {
            echo "<div class=\"alert alert-danger;\"><b>Error</b>: config.php is not writeable</div>";
        }
        ?>
<hr />
<p class="ichunk" style="margin-top: 1.0em;">
<b>Authentication enabled</b>
<?php 
        echo installSelectField('FANNIE_AUTH_ENABLED', $FANNIE_AUTH_ENABLED, array(1 => 'Yes', 0 => 'No'), false, false);
        ?>
</p><!-- /.ichunk -->
<?php 
        // Default to Authenticate ("Authenticate Everything") or not.
        if ($FANNIE_AUTH_ENABLED) {
            echo "<p class='ichunk'>";
            echo "<b>Authenticate by default </b>";
            echo installSelectField('FANNIE_AUTH_DEFAULT', $FANNIE_AUTH_DEFAULT, array(1 => 'Yes', 0 => 'No'), false, false);
            echo "If 'Yes' all Admin utilities will require Login<br />";
            echo "If 'No' only those utilities coded for it will require Login";
            echo "</p><!-- /.ichunk -->";
        }
        if ($FANNIE_AUTH_ENABLED) {
            if (!function_exists("login")) {
                include $FANNIE_ROOT . 'auth/login.php';
            }
            // if no users exist, offer to create one
            if (getNumUsers() == 0) {
                $success = False;
                if (isset($_REQUEST['newuser']) && isset($_REQUEST['newpass'])) {
                    $FANNIE_AUTH_ENABLED = False;
                    // toggle to bypass user checking
                    $newUser = $_REQUEST['newuser'];
                    $success = createLogin($_REQUEST['newuser'], $_REQUEST['newpass']);
                    if ($success) {
                        echo "<i>User " . $_REQUEST['newuser'] . " created</i><br />";
                        $FANNIE_AUTH_ENABLED = True;
                        // toggle enforce error checking
                        $success = addAuth($_REQUEST['newuser'], 'admin');
                        if ($success) {
                            echo "<i>User " . $_REQUEST['newuser'] . " is an admin</i><br />";
                            echo "You can use these credentials at the <a href='../auth/ui/' target='_aui'>Authentication Interface</a></br />";
                            echo " Other protected pages may require different credentials.<br />";
                            $success = addAuth($_REQUEST['newuser'], 'sysadmin');
                            if ($success) {
                                echo "<i>User " . $_REQUEST['newuser'] . " is a sysadmin</i><br />";
                                echo "You can use these credentials at the Installation and Configuration Interface (these pages)</br />";
                                // populate known privileges table automatically
                                $db = FannieDB::get($FANNIE_OP_DB);
                                ob_start();
                                // don't care about primary key errors
                                \COREPOS\Fannie\API\data\DataLoad::loadSampleData($db, 'userKnownPrivs');
                                ob_end_clean();
                                // loaddata() has no return value; success assumed.
                                echo "Table {$FANNIE_OP_DB}.userKnownPrivs has been populated with the standard privilege set.<br />";
                            } else {
                                echo "<b>Error making user {$newUser} a sysadmin</b><br />";
                            }
                        } else {
                            echo "<b>Error making user {$newUser} an admin</b><br />";
                        }
                    } else {
                        echo "<b>Error creating initial user</b><br />";
                    }
                    $FANNIE_AUTH_ENABLED = True;
                    // toggle enforce error checking
                }
                if (!$success) {
                    echo "<br /><i>No users defined. To create an initial admin user,\n                enter a username and password below</i><br />";
                    echo 'Username: <input type="text" name="newuser" /><br />';
                    echo 'Password: <input type="password" name="newpass" /><br />';
                }
            } else {
                echo "<p class='ichunk'>You can manage Login users and groups via the <a href='../auth/ui/' target='_aui'>Authentication Interface</a>";
                echo "</p><!-- /.ichunk -->";
            }
            echo "<p class='ichunk'><a href='../../documentation/Fannie/developer/auth.html' target='_audoc'>How Authentication Works</a>";
            echo "</p><!-- /.ichunk -->";
        }
        ?>
<hr />
<b>Allow shadow logins</b>
<?php 
        echo installSelectField('FANNIE_AUTH_SHADOW', $FANNIE_AUTH_SHADOW, array(1 => 'Yes', 0 => 'No'), false, false);
        if (!file_exists("../auth/shadowread/shadowread")) {
            echo "<div class=\"alert alert-danger\"><b>Error</b>: shadowread utility does not exist</div>";
            echo "<div class=\"well\">";
            echo "shadowread lets Fannie authenticate users agaist /etc/shadow. To create it:";
            echo "<pre>\ncd " . realpath('../auth/shadowread') . "\nmake\n    </pre>";
            echo "</div>";
        } else {
            $perms = fileperms("../auth/shadowread/shadowread");
            if ($perms == 0104755) {
                echo "<div class=\"alert alert-success\">shadowread utility has proper permissions</div>";
            } else {
                echo "<div class=\"alert alert-danger\"><b>Warning</b>: shadowread utility has incorrect permissions</div>";
                echo "<div class=\"well\">";
                echo "shadowread needs setuid permission. To fix it: ";
                echo "<pre>\ncd " . realpath('../auth/shadowread') . "\nsudo make install\n        </pre>";
                echo "</div>";
            }
        }
        ?>
<hr />
<b>Allow LDAP logins</b>
<?php 
        echo installSelectField('FANNIE_AUTH_LDAP', $FANNIE_AUTH_LDAP, array(1 => 'Yes', 0 => 'No'), false, false);
        if (!function_exists("ldap_connect")) {
            echo "<div class=\"alert alert-danger\"><b>Warning</b>: PHP install does not have LDAP support enabled</div>";
        } else {
            echo "<div class=\"alert alert-success\">PHP has LDAP support enabled</div>";
        }
        ?>
<br />
<label>LDAP Server Host</label>
<?php 
        echo installTextField('FANNIE_LDAP_SERVER', $FANNIE_LDAP_SERVER, '127.0.0.1');
        ?>
<label>LDAP Port</label>
<?php 
        echo installTextField('FANNIE_LDAP_PORT', $FANNIE_LDAP_PORT, '389');
        ?>
<label>LDAP Domain (DN)</label>
<?php 
        echo installTextField('FANNIE_LDAP_DN', $FANNIE_LDAP_DN, 'ou=People,dc=example,dc=org');
        ?>
<label>LDAP Username Field</label>
<?php 
        echo installTextField('FANNIE_LDAP_SEARCH_FIELD', $FANNIE_LDAP_SEARCH_FIELD, 'uid');
        ?>
<label>LDAP User ID# Field</label>
<?php 
        echo installTextField('FANNIE_LDAP_UID_FIELD', $FANNIE_LDAP_UID_FIELD, 'uidnumber');
        ?>
<label>LDAP Real Name Field</label>
<?php 
        echo installTextField('FANNIE_LDAP_RN_FIELD', $FANNIE_LDAP_RN_FIELD, 'cn');
        ?>
<hr />
<p>
    <button type=submit class="btn btn-default">Save Configuration</button>
</p>
</form>

<?php 
        return ob_get_clean();
        // body_content
    }
 public function action_register2()
 {
     global $txt, $modSettings, $context, $user_info;
     // Start collecting together any errors.
     $reg_errors = Error_Context::context('register', 0);
     // Check they are who they should be
     checkSession();
     if (!validateToken('register', 'post', true, false)) {
         $reg_errors->addError('token_verification');
     }
     // You can't register if it's disabled.
     if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3) {
         fatal_lang_error('registration_disabled', false);
     }
     // Well, if you don't agree, you can't register.
     if (!empty($modSettings['requireAgreement']) && !isset($_POST['checkbox_agreement'])) {
         $reg_errors->addError('agreement_unchecked');
     }
     // Make sure they came from *somewhere*, have a session.
     if (!isset($_SESSION['old_url'])) {
         redirectexit('action=register');
     }
     // Check their provider deatils match up correctly in case they're pulling something funny
     if ($_POST['provider'] != $_SESSION['extauth_info']['provider']) {
         redirectexit('action=register');
     }
     // Clean up
     foreach ($_POST as $key => $value) {
         if (!is_array($_POST[$key])) {
             $_POST[$key] = htmltrim__recursive(str_replace(array("\n", "\r"), '', $_POST[$key]));
         }
     }
     // Needed for isReservedName() and registerMember()
     require_once SUBSDIR . '/Members.subs.php';
     // Needed for generateValidationCode()
     require_once SUBSDIR . '/Auth.subs.php';
     // Set the options needed for registration.
     $regOptions = array('interface' => 'guest', 'username' => !empty($_POST['user']) ? $_POST['user'] : '', 'email' => !empty($_POST['email']) ? $_POST['email'] : '', 'check_reserved_name' => true, 'check_password_strength' => true, 'check_email_ban' => true, 'send_welcome_email' => !empty($modSettings['send_welcomeEmail']), 'require' => empty($modSettings['registration_method']) ? 'nothing' : ($modSettings['registration_method'] == 1 ? 'activation' : 'approval'));
     // Lets check for other errors before trying to register the member.
     if ($reg_errors->hasErrors()) {
         return $this->action_register();
     }
     mt_srand(time() + 1277);
     $regOptions['password'] = generateValidationCode();
     $regOptions['password_check'] = $regOptions['password'];
     // Registration needs to know your IP
     $req = request();
     $regOptions['ip'] = $user_info['ip'];
     $regOptions['ip2'] = $req->ban_ip();
     $memberID = registerMember($regOptions, 'register');
     // If there are "important" errors and you are not an admin: log the first error
     // Otherwise grab all of them and don't log anything
     if ($reg_errors->hasErrors(1) && !$user_info['is_admin']) {
         foreach ($reg_errors->prepareErrors(1) as $error) {
             fatal_error($error, 'general');
         }
     }
     // One last error check
     if ($reg_errors->hasErrors()) {
         return $this->action_register();
     }
     // Do our spam protection now.
     spamProtection('register');
     // Since all is well, we'll go ahead and associate the member's external account
     addAuth($memberID, $_SESSION['extauth_info']['provider'], $_SESSION['extauth_info']['uid'], $_SESSION['extauth_info']['name']);
     // Basic template variable setup.
     if (!empty($modSettings['registration_method'])) {
         loadTemplate('Register');
         $context += array('page_title' => $txt['register'], 'title' => $txt['registration_successful'], 'sub_template' => 'after', 'description' => $modSettings['registration_method'] == 2 ? $txt['approval_after_registration'] : $txt['activate_after_registration']);
     } else {
         call_integration_hook('integrate_activate', array($regOptions['username']));
         setLoginCookie(60 * $modSettings['cookieTime'], $memberID, hash('sha256', Util::strtolower($regOptions['username']) . $regOptions['password'] . $regOptions['register_vars']['password_salt']));
         redirectexit('action=auth;sa=check;member=' . $memberID, $context['server']['needs_login_fix']);
     }
 }
Ejemplo n.º 15
0
/**
 * get auth
 * @return auth
 */
function churchresource_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 201, 'view', 'churchresource', null, t('view.x', 'ChurchResource'), 1);
    $cc_auth = addAuth($cc_auth, 306, 'create bookings', 'churchresource', null, t('create.own.bookings'), 1);
    $cc_auth = addAuth($cc_auth, 204, 'create virtual bookings', 'churchresource', null, t('create.virtual.bookings'), 1);
    $cc_auth = addAuth($cc_auth, 202, 'administer bookings', 'churchresource', 'cr_resource', t('administer.bookings'), 1);
    $cc_auth = addAuth($cc_auth, 203, 'assistance mode', 'churchresource', null, t('assistant.mode'), 1);
    $cc_auth = addAuth($cc_auth, 299, 'edit masterdata', 'churchresource', null, t('edit.masterdata'), 1);
    return $cc_auth;
}
Ejemplo n.º 16
0
function churchresource_getAuth()
{
    $cc_auth = array();
    $cc_auth = addAuth($cc_auth, 201, 'view', 'churchresource', null, 'ChurchResource sehen', 1);
    $cc_auth = addAuth($cc_auth, 306, 'create bookings', 'churchresource', null, 'Eigene Buchugsanfragen erstellen', 1);
    $cc_auth = addAuth($cc_auth, 202, 'administer bookings', 'churchresource', 'cr_resource', 'Alle Anfragen editieren, ablehnen, etc.', 1);
    $cc_auth = addAuth($cc_auth, 203, 'assistance mode', 'churchresource', null, 'Im Auftrag eines anderen Buchungen durchf&uuml;hren', 1);
    $cc_auth = addAuth($cc_auth, 299, 'edit masterdata', 'churchresource', null, 'Stammdaten editieren', 1);
    return $cc_auth;
}
Ejemplo n.º 17
0
 $mode = $json["mode"];
 $developer = isset($json["dev"]) ? $json["dev"] : "unknown";
 if ($mode == "create") {
     $password = $json["password"];
     $email = $json["email"];
     $r = createAccount($username, $password, $email, $developer);
     if ($r == "") {
         xsuccess("account created", "json");
     } else {
         xerror($r, "json");
     }
 } else {
     if ($mode == "addauth") {
         $password = $json["password"];
         $device = $json["device"];
         $r = addAuth($username, $password, $device, $developer);
         if ($r["success"] == "") {
             xerror($r["error"], "json");
         } else {
             xdevice($device, $r["success"], "json");
         }
     }
 }
 $authinfo = checkAuth($username, $auth, "json");
 if ($mode == "update") {
     $updates = array();
     foreach ($json["links"] as $link) {
         $id = $link["id"];
         if (isset($link["comments"]) && $link["comments"] > -1) {
             $updates[$id]["comment"] = $link["comments"];
             if ($link["both"] == true || $link["both"] == "true" || $link["both"] == 1) {