Ejemplo n.º 1
0
                $contacts->delete($contact_id, '', false);
            }
        }
        unset($contacts_to_delete);
        /* Create the groups */
        // Group perms for the default group
        $modules = array('addressbook', 'calendar', 'email', 'filemanager', 'manual', 'preferences', 'notes', 'todo');
        $acls[] = array('appname' => 'preferences', 'location' => 'changepassword', 'rights' => 1);
        $group = array('username' => 'default');
        $defaultgroupid = add_account($group, 'g', array(), $modules);
        $group = array('username' => 'admins');
        $admingroupid = add_account($group, 'g', array(), array('admin'));
        insert_default_prefs($defaultgroupid);
        // set some default prefs
        $groups = array($defaultgroupid, $admingroupid);
        $accountid = add_account($admin_acct, 'u', $groups, array('admin'), $acls);
        Header('Location: index.php');
        exit;
    }
}
$tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template', $tpl_root);
$setup_tpl->set_file(array('T_head' => 'head.tpl', 'T_footer' => 'footer.tpl', 'T_alert_msg' => 'msg_alert_msg.tpl', 'T_login_main' => 'login_main.tpl', 'T_login_stage_header' => 'login_stage_header.tpl', 'T_accounts' => 'accounts.tpl'));
$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain');
$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain');
$setup_tpl->set_var('lang_cookies_must_be_enabled', lang('<b>NOTE:</b> You must have cookies enabled to use setup and header admin!'));
$GLOBALS['phpgw_setup']->html->show_header(lang('Demo Server Setup'));
$setup_tpl->set_var('action_url', 'accounts.php');
/* detect whether anything will be deleted before alerting */
$db->query('SELECT config_value FROM phpgw_config' . " WHERE config_name = 'account_repository'", __LINE__, __FILE__);
$db->next_record();
Ejemplo n.º 2
0
//check if button submit is clicked
$message = '';
if (isset($_POST['submit'])) {
    $photo = $_FILES['photo'];
    if ($photo && !$photo['error']) {
        $name = $photo['name'];
        $type = $photo['type'];
        $path = $photo['tmp_name'];
        $bytes = file_get_contents($path);
        $fName = trim($_POST['fName']);
        $mName = trim($_POST['mName']);
        $lName = trim($_POST['lName']);
        $id = trim($_POST['id']);
        $pass = trim($_POST['pass']);
        add_admin($id, $fName, $mName, $lName, 1);
        add_account($id, $pass, 'admin');
        add_photo($id, $name, $type, $bytes, 'admin', 1);
        $target = "../uploadedPhotos/";
        $target = $target . basename($_FILES['photo']['name']);
        if (move_uploaded_file($_FILES['photo']['tmp_name'], $target)) {
            //echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory";
        }
        $message = "<div class = 'alert alert-success' style = 'width: 265px;'>Successfully added.</div>";
        echo "<script>";
        //go back to viewPhotos page after 3 seconds.
        echo "setTimeout(function(){ document.location = '?p=manageAdmin/viewAdmin'; }, 2000);";
        echo "</script>";
    } else {
        $message = "<div class = 'alert alert-warning' style = 'width: 265px;'>Photo is invalid!</div>";
    }
}
Ejemplo n.º 3
0
        $name = $photo['name'];
        $type = $photo['type'];
        $path = $photo['tmp_name'];
        $bytes = file_get_contents($path);
        $fName = trim($_POST['fName']);
        $mName = trim($_POST['mName']);
        $lName = trim($_POST['lName']);
        $id = trim($_POST['id']);
        $course = trim($_POST['COURSE']);
        $yr = trim($_POST['YR']);
        $lab = trim($_POST['lab']);
        $days = trim($_POST['days']);
        $time = trim($_POST['time']);
        $pass = trim($_POST['pass']);
        add_working($id, $fName, $mName, $lName, $course, $yr, 1, $lab, $time, $days, date("y-m-d"));
        add_account($id, $pass, 'working scholar');
        add_photo($id, $name, $type, $bytes, 'working scholar', 1);
        $target = "../uploadedPhotos/";
        $target = $target . basename($_FILES['photo']['name']);
        if (move_uploaded_file($_FILES['photo']['tmp_name'], $target)) {
            //echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory";
        }
        $message = "<div class = 'alert alert-success' style = 'width: 265px;'>Successfully added.</div>";
        echo "<script>";
        //go back to viewPhotos page after 3 seconds.
        echo "setTimeout(function(){ document.location = '?p=viewWorking'; }, 2000);";
        echo "</script>";
    } else {
        $message = "<div class = 'alert alert-warning' style = 'width: 265px;'>Photo is invalid!</div>";
    }
}
Ejemplo n.º 4
0
    if (!file_exists("../private")) {
        mkdir("../private");
    }
    if (file_exists("../private/passwd")) {
        $serialized_comptes = file_get_contents("../private/passwd");
        $comptes = unserialize($serialized_comptes);
    } else {
        $comptes = array();
    }
    $submit = $_POST['submit'];
    if ($submit != 'OK') {
        return "ERROR\n";
    }
    $compte = array();
    $compte['login'] = $_POST['login'];
    $compte['passwd'] = hash("whirlpool", $_POST['passwd']);
    if ($compte['login'] == '' || $compte['passwd'] == '') {
        return "ERROR\n";
    }
    foreach ($comptes as $value) {
        if ($compte['login'] == $value['login']) {
            return "ERROR\n";
        }
    }
    $comptes[] = $compte;
    $serialized_comptes = serialize($comptes);
    file_put_contents("../private/passwd", $serialized_comptes);
    return "OK\n";
}
echo add_account();
Ejemplo n.º 5
0
if (!permissions()) {
    $tpl = new templates();
    echo "alert('" . $tpl->javascript_parse_text("{ERROR_NO_PRIVS}") . "');";
    die;
    exit;
}
if (isset($_GET["script"])) {
    popup_script();
    exit;
}
if (isset($_GET["popup"])) {
    popup();
    exit;
}
if (isset($_GET["remote_imap_server"])) {
    add_account();
    exit;
}
if (isset($_GET["imapsynclist"])) {
    imapsynclist();
    exit;
}
if (isset($_GET["imapSyncDelete"])) {
    imapSyncDelete();
    exit;
}
if (isset($_GET["AddForm"])) {
    add_popup();
    exit;
}
if (isset($_GET["events"])) {
Ejemplo n.º 6
0
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.user.inc');
	include_once('ressources/class.cron.inc');

	
	
	if((isset($_GET["uid"])) && (!isset($_GET["userid"]))){$_GET["userid"]=$_GET["uid"];}
	
	if(!permissions()){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}
	if(isset($_GET["script"])){popup_script();exit;}
	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_GET["remote_imap_server"])){add_account();exit;}
	if(isset($_GET["imapsynclist"])){imapsynclist();exit;}
	if(isset($_GET["imapSyncDelete"])){imapSyncDelete();exit;}
	if(isset($_GET["AddForm"])){add_popup();exit;}
	if(isset($_GET["events"])){events();exit;}
	if(isset($_GET["schedule"])){schedule();exit;}
	if(isset($_GET["imapsync_save_schedule"])){schedule_save();exit;}
	if(isset($_GET["imapRun"])){imapRun();exit;}
	if(isset($_GET["imapStop"])){imapStop();exit;}
	if(isset($_GET["toolbox"])){toolbox();exit;}
	if(isset($_GET["imapsync-folders"])){folders_sync_form();exit;}
	if(isset($_GET["folder-to-sync"])){folders_sync_add();exit;}
	if(isset($_GET["folder-to-sync-del"])){folders_sync_del();exit;}
	if(isset($_GET["imapsync-adv"])){adv_options_form();exit;}
	if(isset($_GET["syncinternaldate"])){adv_options_save();exit;}
	
Ejemplo n.º 7
0
        if ($account['code'] == '') {
            $account['code'] = replace_text_for_utf8($this->input->post('name'));
            // Have barcode?
            for ($i = is_account_code($account['code']); $i > 0; $i++) {
                $account['code'] = replace_text_for_utf8($this->input->post('name')) . '-' . $i;
                $i = is_account_code($account['code']);
            }
        } else {
            // Have barcode?
            if (is_account_code($account['code'])) {
                alertbox('alert-danger', get_lang('This barcode is found in the database.'));
                $continue = false;
            }
        }
        if ($continue) {
            $account_id = add_account($account);
            if ($account_id > 0) {
                alertbox('alert-success', get_lang('Operation is Successful'), '');
                $log['date'] = $this->input->post('log_time');
                $log['type'] = 'account';
                $log['title'] = get_lang('Account');
                $log['description'] = get_lang('Created a new account card.');
                $log['account_id'] = $account_id;
                add_log($log);
            } else {
                alertbox('alert-danger', get_lang('Error!'));
            }
        }
    }
}
?>
Ejemplo n.º 8
0
<?php

define("CRYPT_KEY", "\$1\$1245678\$");
$f = fopen('php://stdin', 'r');
while ($line = fgets($f)) {
    $matches = preg_split('/[\\s,]+/', $line);
    $account = trim($matches[0]);
    $pass_temp = trim($matches[1]);
    $password = crypt($pass_temp, CRYPT_KEY);
    $account = chk_account($account);
    echo add_account($account, $password);
}
function chk_account($account)
{
    #$account = strtolower($account);
    $size = strlen($account);
    $fixed_account = "";
    for ($i = 0; $i < $size; $i++) {
        $ascii = ord($account[$i]);
        // a~z or 0~9 or _
        //      if(($ascii>=97 && $ascii<=122) || ($ascii>=48 && $ascii<=57) || $ascii==95)
        //              $fixed_account .= $account[$i];
        if (preg_match('/[A-Za-z0-9_]/', $account[$i])) {
            $fixed_account .= $account[$i];
        }
    }
    return $fixed_account;
}
function add_account($account, $password)
{
    if (empty($account)) {
Ejemplo n.º 9
0
            $thisperson = $account_info[$accountid]['person_id'];
            // Do some checks before we try to import the data.
            if (!empty($thisacctid) && !empty($thisacctlid)) {
                $accounts->set_account($thisacctid, 'u');
                // Check if the account is already there.
                // If so, we won't try to create it again.
                $acct_exist = $acct->name2id($thisacctlid);
                if ($acct_exist) {
                    $thisacctid = $acct_exist;
                }
                $id_exist = $accounts->exists(intval($thisacctid));
                // If not, create it now.
                if ($id_exist) {
                    echo "<br />\nAdding User: {$thisacctlid} (uid: {$thisacctid})";
                    $thisaccount_info = array('type' => 'u', 'id' => $thisacctid, 'lid' => $thisacctlid, 'password' => '12345678XXxx_&', 'firstname' => $thisfirstname, 'lastname' => $thislastname, 'status' => 'A', 'expires' => -1, 'person_id' => $thisperson);
                    add_account($thisaccount_info, 'u');
                } else {
                    echo "<br />\nSkipping User: {$thisacctlid} (uid: {$thisacctid}) - Exists";
                }
            }
        }
    }
    $setup_complete = True;
}
$GLOBALS['phpgw_setup']->html->show_header('LDAP Export', '', 'config', $ConfigDomain);
if (isset($error) && $error) {
    //echo '<br /><center><b>Error:</b> '.$error.'</center>';
    $GLOBALS['phpgw_setup']->html->show_alert_msg('Error', $error);
}
if (isset($setup_complete) && $setup_complete) {
    echo '<br /><center>' . lang('Export has been completed!  You will need to set the user passwords manually.') . '</center>';
Ejemplo n.º 10
0
                $cnt_admins = count($admins);
                for ($a = 0; $a < $cnt_admins; ++$a) {
                    if ($admins[$a] == $thisacctlid) {
                        $acls[] = array('appname' => 'admin', 'location' => 'run', 'rights' => 1);
                    }
                }
                // Now make them a member of the 'Default' group.
                // But, only if the current user is not the group itself.
                if (!$defaultgroupid) {
                    $defaultgroupid = $accounts->name2id('Default');
                }
                if ($defaultgroupid) {
                    $groups = array($defaultgroupid);
                }
                if (!$id_exist) {
                    $thisacctid = add_account($thisaccount_info, 'u', $groups, array('admin'), $acls);
                }
                // Save these new acls.
            }
        }
    }
    $setup_complete = true;
}
$GLOBALS['phpgw_setup']->html->show_header('LDAP Import', '', 'config', $_COOKIE['ConfigDomain']);
if (isset($error) && $error) {
    //echo '<br /><center><b>Error:</b> '.$error.'</center>';
    $GLOBALS['phpgw_setup']->html->show_alert_msg('Error', $error);
}
if (isset($setup_complete) && $setup_complete) {
    echo '<br /><center>' . lang('Import has been completed!') . ' ' . lang('Click <a href="index.php">here</a> to return to setup.') . '</center>';
    $GLOBALS['phpgw_setup']->html->show_footer();