Example #1
0
function _moduleContent(&$smarty, $module_name)
{
    include_once "libs/paloSantoGrid.class.php";
    include_once "libs/paloSantoForm.class.php";
    include_once "libs/paloSantoOrganization.class.php";
    //folder path for custom templates
    $local_templates_dir = getWebDirModule($module_name);
    //conexion resource
    $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]);
    global $arrCredentials;
    $action = getAction();
    $content = "";
    switch ($action) {
        case "new_user":
            $content = viewFormUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "view":
            $content = viewFormUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "edit":
            $content = viewFormUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_new":
            $content = saveNewUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_edit":
            $content = saveEditUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "delete":
            $content = deleteUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "getGroups":
            $content = getGroups($pDB, $arrCredentials);
            break;
        case "getImage":
            $content = getImage($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "reloadAasterisk":
            $content = reloadAasterisk($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "reconstruct_mailbox":
            $content = reconstruct_mailbox($pDB, $arrConf, $arrCredentials);
            break;
            /*case "changes_email_quota":
              $content = changes_email_quota($smarty, $module_name, $pDB, $arrConf, $arrCredentials);
              break;*/
        /*case "changes_email_quota":
          $content = changes_email_quota($smarty, $module_name, $pDB, $arrConf, $arrCredentials);
          break;*/
        default:
            // report
            $content = reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
    }
    return $content;
}
Example #2
0
/**
 *if all input field filled correctly, password=password confirmation, and email address does not stored yet, call saveNewUser() which inserts to db
 */
function register()
{
    global $connection;
    $name = mysqli_real_escape_string($connection, $_POST['name']);
    $email = mysqli_real_escape_string($connection, $_POST['email']);
    $phone = mysqli_real_escape_string($connection, $_POST['phone']);
    $password = mysqli_real_escape_string($connection, $_POST['pass']);
    $confirm_password = mysqli_real_escape_string($connection, $_POST['confirm_pass']);
    if (empty($name) || empty($phone) || empty($email) || empty($password) || empty($confirm_password)) {
        header('Location:add_user.php?error=1');
    } elseif ($password !== $confirm_password) {
        header('Location:add_user.php?error=2');
    } elseif (checkUserExist($email)) {
        header('Location:add_user.php?error=3');
    } else {
        saveNewUser($name, $email, $phone, $password);
    }
}