Ejemplo n.º 1
0
<?php

function generateurl($s)
{
    //Convert accented characters, and remove parentheses and apostrophes.
    $from = explode(',', "Ç,ç,Æ,æ,Œ,œ,Ð,ð,Á,á,É,é,Í,í,Ó,ó,Ú,ú,Ý,ý,À,à,È,è,Ì,ì,Ò,ò,Ù,ù,Ã,ã,Ñ,ñ,Õ,õ,Ä,ä,Ë,ë,Ï,ï,Ö,ö,Ü,ü,Ÿ,ÿ,Â,â,Ê,ê,Î,î,Ô,ô,Û,û,Ā,ā,Ē,ē,Ī,ī,Ō,ō,Ū,ū,Ȳ,ȳ,Ǣ,ǣ,Ḡ,ḡ,Ǟ,ǟ,Ȫ,ȫ,Ǖ,ǖ,Ṻ,ṻ,Ǡ,ǡ,Ȱ,ȱ,Ḹ,ḹ,Ṝ,ṝ,Ǭ,ǭ,Ȭ,ȭ,Ḗ,ḗ,Ṓ,ṓ,Ḕ,ḕ,Ṑ,ṑ,Ӣ,ӣ,Ӯ,ӯ,Ᾱ,ᾱ,Ῑ,ῑ,Ῡ,ῡ,Å,å,Ø,ø,ß,¿,¡,&,[,]");
    $to = explode(',', 'c,c,ae,ae,oe,oe,d,d,a,a,e,e,i,i,o,o,u,u,y,y,a,a,e,e,i,i,o,o,u,u,a,a,n,n,o,o,a,a,e,e,i,i,o,o,u,u,y,y,a,a,e,e,i,i,o,o,u,u,a,a,e,e,i,i,o,o,u,u,y,y,ae,ae,g,g,a,a,o,o,u,u,u,u,a,a,o,o,l,l,r,r,o,o,o,o,e,e,o,o,e,e,o,o,n,n,y,y,a,a,i,i,y,u,a,a,o,o,ss,?,!,and,,');
    //Do the replacements, and convert all other non-alphanumeric characters to spaces.
    $s = preg_replace('/[^()\\d\\p{L}]+/u', '-', str_replace($from, $to, trim($s)));
    //Correct conversions for words ending with apostrophes (i.e. 'duke-of-york-s-theatre' becomes 'duke-of-yorks-theatre').
    $s = preg_replace('/-(d-)|-(d)$|-(ll-)|-(ll)$|-(m-)|-(m)$|-(re-)|-(re)$|-(s-)|-(s)$|-(t-)|-(t)$|-(ve-)|-(ve)$/', '$1$2$3$4$5$6$7$8$9$10$11$12$13$14', $s);
    //Remove any hyphens (-) at the beginning or end of string and make lowercase.
    return strtolower(preg_replace('/(^-|-$)/', '', $s));
    //Remove 'the', 'a' and 'an' from URL by replacing last line of function code with the following (/i=regular expression modifier that makes regex match case insensitive.):-
    //return strtolower (preg_replace ('/(^-|-$)/', '', preg_replace ('/\b(^the|^a|^an)\b/i', '', $s)));
}
echo generateurl('Monkey');
//How to match Cyrillic characters with a regular expression: http://stackoverflow.com/questions/1716609/how-to-match-cyrillic-characters-with-a-regular-expression
//\p{L}
//Regular Expression for Japanese characters:  http://stackoverflow.com/questions/6787716/regular-expression-for-japanese-characters
//a href to person/役所-広司 does not work (solved in .htaccess?; needs to recognise URL stored in database which is currently '??-??')
//see below - Cyrillic (Russian) text cannot have alpha function applied (although Japanese fine...).
function potato($s)
{
    if (preg_match('/^(A |An |The |\\W+)(\\S+.*)$/i', $s)) {
        echo preg_replace('/^(A |An |The |\\W+)(\\S+.*)$/i', '$2', $s);
    } else {
        echo $prf_prsn_rl;
    }
}
echo potato('Хомэро анёмал праэчынт но хёз. Эю про чтэт дэлььиката, дуо экз эчжынт луптатум');
Ejemplo n.º 2
0
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['ctgry_nm']);
    $pagetitle = html($row['ctgry_nm']);
    $ctgry_nm = html($row['ctgry_nm']);
    $ctgry_id = html($ctgry_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $ctgry_id = cln($_POST['ctgry_id']);
    $ctgry_nm = trim(cln($_POST['ctgry_nm']));
    $ctgry_nm_session = $_POST['ctgry_nm'];
    $ctgry_url = generateurl($ctgry_nm);
    $errors = array();
    if (!preg_match('/\\S+/', $ctgry_nm)) {
        $errors['ctgry_nm'] = '**You must enter a category name.**';
    } elseif (strlen($ctgry_nm) > 255) {
        $errors['ctgry_nm'] = '</br>**Category name is allowed a maximum of 255 characters.**';
    } elseif (preg_match('/,,/', $ctgry_nm)) {
        $errors['ctgry_nm'] = '**Category name cannot include the following: [,,].**';
    } else {
        $sql = "SELECT ctgry_id, ctgry_nm FROM ctgry WHERE ctgry_url='{$ctgry_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing category URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
        }
Ejemplo n.º 3
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['thtr_typ_nm']);
    $pagetitle = html($row['thtr_typ_nm']);
    $thtr_typ_nm = html($row['thtr_typ_nm']);
    $thtr_typ_id = html($thtr_typ_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $thtr_typ_id = cln($_POST['thtr_typ_id']);
    $thtr_typ_nm = trim(cln($_POST['thtr_typ_nm']));
    $thtr_typ_url = generateurl($thtr_typ_nm);
    $thtr_typ_nm_session = $_POST['thtr_typ_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $thtr_typ_nm)) {
        $errors['thtr_typ_nm'] = '**You must enter a theatre type name.**';
    } elseif (strlen($thtr_typ_nm) > 255) {
        $errors['thtr_typ_nm'] = '</br>**Theatre type is allowed a maximum of 255 characters.**';
    } elseif (preg_match('/,,/', $thtr_typ_nm)) {
        $errors['thtr_typ_nm'] = '**Theatre type name cannot include the following: [,,].**';
    } else {
        $sql = "SELECT thtr_typ_id, thtr_typ_nm FROM thtr_typ WHERE thtr_typ_url='{$thtr_typ_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing theatre type URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
Ejemplo n.º 4
0
     $error = 'Error updating theatre info for submitted setting (time): ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 $sql = "DELETE FROM rel_tm WHERE rel_tm1='{$tm_id}'";
 if (!mysqli_query($link, $sql)) {
     $error = 'Error deleting time-related time associations: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (preg_match('/\\S+/', $rel_tm_list)) {
     $rel_tm_nms = explode(',,', $rel_tm_list);
     $n = 0;
     foreach ($rel_tm_nms as $rel_tm_nm) {
         $rel_tm_ordr = ++$n;
         $rel_tm_url = generateurl($rel_tm_nm);
         $rel_tm_alph = alph($rel_tm_nm);
         $sql = "SELECT 1 FROM tm WHERE tm_url='{$rel_tm_url}'";
         $result = mysqli_query($link, $sql);
         if (!$result) {
             $error = 'Error checking for existence of time: ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
         if (mysqli_num_rows($result) == 0) {
             $sql = "INSERT INTO tm(tm_nm, tm_alph, tm_url, tm_frm_dt_bce, tm_to_dt_bce, tm_rcr)\n                  VALUES('{$rel_tm_nm}', CASE WHEN '{$rel_tm_alph}'!='' THEN '{$rel_tm_alph}' END, '{$rel_tm_url}', 0, 0, 0)";
             if (!mysqli_query($link, $sql)) {
                 $error = 'Error adding time data: ' . mysqli_error($link);
                 include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
                 exit;
             }
Ejemplo n.º 5
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['ftr_nm']);
    $pagetitle = html($row['ftr_nm']);
    $ftr_nm = html($row['ftr_nm']);
    $ftr_id = html($ftr_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $ftr_id = cln($_POST['ftr_id']);
    $ftr_nm = trim(cln($_POST['ftr_nm']));
    $ftr_url = generateurl($ftr_nm);
    $ftr_nm_session = $_POST['ftr_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $ftr_nm)) {
        $errors['ftr_nm'] = '**You must enter a feature name.**';
    } elseif (strlen($ftr_nm) > 255) {
        $errors['ftr_nm'] = '</br>**Feature name is allowed a maximum of 255 characters.**';
    } elseif (preg_match('/,,/', $ftr_nm)) {
        $errors['ftr_nm'] = '**Feature name cannot include the following: [,,].**';
    } else {
        $sql = "SELECT ftr_id, ftr_nm FROM ftr WHERE ftr_url='{$ftr_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing feature URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
Ejemplo n.º 6
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['prd_vrsn_nm']);
    $pagetitle = html($row['prd_vrsn_nm']);
    $prd_vrsn_nm = html($row['prd_vrsn_nm']);
    $prd_vrsn_id = html($prd_vrsn_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $prd_vrsn_id = cln($_POST['prd_vrsn_id']);
    $prd_vrsn_nm = trim(cln($_POST['prd_vrsn_nm']));
    $prd_vrsn_url = generateurl($prd_vrsn_nm);
    $prd_vrsn_nm_session = $_POST['prd_vrsn_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $prd_vrsn_nm)) {
        $errors['prd_vrsn_nm'] = '**You must enter a production version name.**';
    } elseif (strlen($prd_vrsn_nm) > 255) {
        $errors['prd_vrsn_nm'] = '</br>**Production version is allowed a maximum of 255 characters.**';
    } elseif (preg_match('/,,/', $prd_vrsn_nm)) {
        $errors['prd_vrsn_nm'] = '**Production version name cannot include the following: [,,].**';
    } else {
        $sql = "SELECT prd_vrsn_id, prd_vrsn_nm\n            FROM prd_vrsn\n            WHERE prd_vrsn_url='{$prd_vrsn_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing prod version URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
Ejemplo n.º 7
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['crs_typ_nm']);
    $pagetitle = html($row['crs_typ_nm']);
    $crs_typ_nm = html($row['crs_typ_nm']);
    $crs_typ_id = html($crs_typ_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $crs_typ_id = cln($_POST['crs_typ_id']);
    $crs_typ_nm = trim(cln($_POST['crs_typ_nm']));
    $crs_typ_url = generateurl($crs_typ_nm);
    $crs_typ_nm_session = $_POST['crs_typ_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $crs_typ_nm)) {
        $errors['crs_typ_nm'] = '**You must enter a course type name.**';
    }
    if (strlen($crs_typ_nm) > 255) {
        $errors['crs_typ_nm'] = '</br>**Course type name is allowed a maximum of 255 characters.**';
    } else {
        $sql = "SELECT crs_typ_id, crs_typ_nm\n            FROM crs_typ\n            WHERE crs_typ_url='{$crs_typ_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing course type URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
        }
Ejemplo n.º 8
0
     $stdnt_prsn_sffx_num = trim($stdnt_prsn_sffx_num);
     $stdnt_prsn_sffx_rmn = ' (' . romannumeral($stdnt_prsn_sffx_num) . ')';
 } else {
     $stdnt_prsn_sffx_num = '0';
     $stdnt_prsn_sffx_rmn = '';
 }
 list($stdnt_prsn_frst_nm, $stdnt_prsn_lst_nm) = explode(';;', $stdnt_prsn_nm);
 $stdnt_prsn_frst_nm = trim($stdnt_prsn_frst_nm);
 $stdnt_prsn_lst_nm = trim($stdnt_prsn_lst_nm);
 if (preg_match('/\\S+/', $stdnt_prsn_lst_nm)) {
     $stdnt_prsn_lst_nm_dsply = ' ' . $stdnt_prsn_lst_nm;
 } else {
     $stdnt_prsn_lst_nm_dsply = '';
 }
 $stdnt_prsn_fll_nm = $stdnt_prsn_frst_nm . $stdnt_prsn_lst_nm_dsply;
 $stdnt_prsn_url = generateurl($stdnt_prsn_fll_nm . $stdnt_prsn_sffx_rmn);
 $sql = "SELECT 1 FROM prsn WHERE prsn_url='{$stdnt_prsn_url}'";
 $result = mysqli_query($link, $sql);
 if (!$result) {
     $error = 'Error checking for existence of student (person): ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (mysqli_num_rows($result) == 0) {
     $sql = "INSERT INTO prsn(prsn_url, prsn_fll_nm, prsn_frst_nm, prsn_lst_nm, prsn_sffx_num, comp_bool)\n                  VALUES('{$stdnt_prsn_url}', '{$stdnt_prsn_fll_nm}', '{$stdnt_prsn_frst_nm}', '{$stdnt_prsn_lst_nm}', '{$stdnt_prsn_sffx_num}', '0')";
     if (!mysqli_query($link, $sql)) {
         $error = 'Error adding course student (person) data: ' . mysqli_error($link);
         include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
         exit;
     }
 }
Ejemplo n.º 9
0
     $error = 'Error updating theatre info for submitted genre: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 $sql = "DELETE FROM rel_gnr WHERE rel_gnr1='{$gnr_id}'";
 if (!mysqli_query($link, $sql)) {
     $error = 'Error deleting genre-related genre associations: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (preg_match('/\\S+/', $rel_gnr_list)) {
     $rel_gnr_nms = explode(',,', $rel_gnr_list);
     $n = 0;
     foreach ($rel_gnr_nms as $rel_gnr_nm) {
         $rel_gnr_ordr = ++$n;
         $rel_gnr_url = generateurl($rel_gnr_nm);
         $sql = "SELECT 1 FROM gnr WHERE gnr_url='{$rel_gnr_url}'";
         $result = mysqli_query($link, $sql);
         if (!$result) {
             $error = 'Error checking for existence of genre: ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
         if (mysqli_num_rows($result) == 0) {
             $sql = "INSERT INTO gnr(gnr_nm, gnr_url) VALUES('{$rel_gnr_nm}', '{$rel_gnr_url}')";
             if (!mysqli_query($link, $sql)) {
                 $error = 'Error adding genre data: ' . mysqli_error($link);
                 include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
                 exit;
             }
         }
Ejemplo n.º 10
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['ssn_nm']);
    $pagetitle = html($row['ssn_nm']);
    $ssn_nm = html($row['ssn_nm']);
    $ssn_id = html($ssn_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $ssn_id = cln($_POST['ssn_id']);
    $ssn_nm = trim(cln($_POST['ssn_nm']));
    $ssn_url = generateurl($ssn_nm);
    $ssn_nm_session = $_POST['ssn_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $ssn_nm)) {
        $errors['ssn_nm'] = '**You must enter a season name.**';
    }
    if (strlen($ssn_nm) > 255) {
        $errors['ssn_nm'] = '</br>**Season name is allowed a maximum of 255 characters.**';
    } else {
        $ssn_alph = alph($ssn_nm);
        $sql = "SELECT ssn_id, ssn_nm FROM ssn WHERE ssn_url='{$ssn_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing season URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
Ejemplo n.º 11
0
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $awrd_ctgry_id = cln($_POST['awrd_ctgry_id']);
    $awrd_ctgry_nm = trim(cln($_POST['awrd_ctgry_nm']));
    $awrd_ctgry_session = $_POST['awrd_ctgry_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $awrd_ctgry_nm)) {
        $errors['awrd_ctgry_nm'] = '**You must enter an award category name.**';
    } elseif (strlen($awrd_ctgry_nm) > 255) {
        $errors['awrd_ctgry_nm'] = '</br>**Award category name is allowed a maximum of 255 characters.**';
    } elseif (preg_match('/@@/', $awrd_ctgry_nm) || preg_match('/==/', $awrd_ctgry_nm) || preg_match('/;;/', $awrd_ctgry_nm)) {
        $errors['awrd_ctgry_nm'] = '**Award category cannot include any of the following: [@@], [==], [;;].**';
    } else {
        $awrd_ctgry_url = generateurl($awrd_ctgry_nm);
        $awrd_ctgry_alph = alph($awrd_ctgry_nm);
        $sql = "SELECT awrd_ctgry_id, awrd_ctgry_nm FROM awrd_ctgry WHERE awrd_ctgry_url='{$awrd_ctgry_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing award category URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
        }
        $row = mysqli_fetch_array($result);
        if (mysqli_num_rows($result) > 0 && $row['awrd_ctgry_id'] !== $awrd_ctgry_id) {
            $errors['awrd_ctgry_nm'] = '</br>**Duplicate URL exists for: ' . html($row['awrd_ctgry_nm']) . '. You must keep the original name or assign an award category name without an existing URL.**';
        }
    }
    if (count($errors) > 0) {
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
Ejemplo n.º 12
0
     $error = 'Error updating theatre info for submitted ethnicity: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 $sql = "DELETE FROM rel_ethn WHERE rel_ethn1='{$ethn_id}'";
 if (!mysqli_query($link, $sql)) {
     $error = 'Error deleting ethnicity-related ethnicity associations: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (preg_match('/\\S+/', $rel_ethn_list)) {
     $rel_ethn_nms = explode(',,', $rel_ethn_list);
     $n = 0;
     foreach ($rel_ethn_nms as $rel_ethn_nm) {
         $rel_ethn_ordr = ++$n;
         $rel_ethn_url = generateurl($rel_ethn_nm);
         $sql = "SELECT 1 FROM ethn WHERE ethn_url='{$rel_ethn_url}'";
         $result = mysqli_query($link, $sql);
         if (!$result) {
             $error = 'Error checking for existence of ethnicity: ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
         if (mysqli_num_rows($result) == 0) {
             $sql = "INSERT INTO ethn(ethn_nm, ethn_url) VALUES('{$rel_ethn_nm}', '{$rel_ethn_url}')";
             if (!mysqli_query($link, $sql)) {
                 $error = 'Error adding ethnicity data: ' . mysqli_error($link);
                 include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
                 exit;
             }
         }
Ejemplo n.º 13
0
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (preg_match('/\\S+/', $var_char_list)) {
     $var_char_nms = explode(',,', $var_char_list);
     foreach ($var_char_nms as $var_char_nm) {
         if (preg_match('/^\\S+.*--[1-9][0-9]{0,5}$/', $var_char_nm)) {
             list($var_char_nm, $var_char_sffx_num) = explode('--', $var_char_nm);
             $var_char_nm = trim($var_char_nm);
             $var_char_sffx_num = trim($var_char_sffx_num);
             $var_char_sffx_rmn = ' (' . romannumeral($var_char_sffx_num) . ')';
         } else {
             $var_char_nm = trim($var_char_nm);
             $var_char_sffx_rmn = '';
         }
         $var_char_url = generateurl($var_char_nm . $var_char_sffx_rmn);
         $sql = "SELECT char_id\n              FROM role\n              WHERE char_url='{$var_char_url}'";
         $result = mysqli_query($link, $sql);
         if (!$result) {
             $error = 'Error checking for existing character URL (for existing character check): ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
         $row = mysqli_fetch_array($result);
         $var_char_id = $row['char_id'];
         $sql = "INSERT INTO var_char(var_char1, var_char2)\n              VALUES('{$char_id}', '{$var_char_id}')";
         if (!mysqli_query($link, $sql)) {
             $error = 'Error adding char-variable character association data: ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
Ejemplo n.º 14
0
     $agnt_prsn_sffx_num = trim($agnt_prsn_sffx_num);
     $agnt_prsn_sffx_rmn = ' (' . romannumeral($agnt_prsn_sffx_num) . ')';
 } else {
     $agnt_prsn_sffx_num = '0';
     $agnt_prsn_sffx_rmn = '';
 }
 list($agnt_prsn_frst_nm, $agnt_prsn_lst_nm) = explode(';;', $agnt_prsn_nm);
 $agnt_prsn_frst_nm = trim($agnt_prsn_frst_nm);
 $agnt_prsn_lst_nm = trim($agnt_prsn_lst_nm);
 if (preg_match('/\\S+/', $agnt_prsn_lst_nm)) {
     $agnt_prsn_lst_nm_dsply = ' ' . $agnt_prsn_lst_nm;
 } else {
     $agnt_prsn_lst_nm_dsply = '';
 }
 $agnt_prsn_fll_nm = $agnt_prsn_frst_nm . $agnt_prsn_lst_nm_dsply;
 $agnt_prsn_url = generateurl($agnt_prsn_fll_nm . $agnt_prsn_sffx_rmn);
 $agnt_ordr = ++$n;
 $sql = "SELECT 1 FROM prsn WHERE prsn_url='{$agnt_prsn_url}'";
 $result = mysqli_query($link, $sql);
 if (!$result) {
     $error = 'Error checking for existence of agent (person): ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (mysqli_num_rows($result) == 0) {
     $sql = "INSERT INTO prsn(prsn_fll_nm, prsn_frst_nm, prsn_lst_nm, prsn_sffx_num, prsn_url, comp_bool)\n                    VALUES('{$agnt_prsn_fll_nm}', '{$agnt_prsn_frst_nm}', '{$agnt_prsn_lst_nm}', '{$agnt_prsn_sffx_num}', '{$agnt_prsn_url}', '0')";
     if (!mysqli_query($link, $sql)) {
         $error = 'Error adding agent (person) data: ' . mysqli_error($link);
         include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
         exit;
     }
Ejemplo n.º 15
0
     $error = 'Error updating theatre info for submitted profession: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 $sql = "DELETE FROM rel_prof WHERE rel_prof1='{$prof_id}'";
 if (!mysqli_query($link, $sql)) {
     $error = 'Error deleting profession-related profession associations: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (preg_match('/\\S+/', $rel_prof_list)) {
     $rel_prof_nms = explode(',,', $rel_prof_list);
     $n = 0;
     foreach ($rel_prof_nms as $rel_prof_nm) {
         $rel_prof_ordr = ++$n;
         $rel_prof_url = generateurl($rel_prof_nm);
         $sql = "SELECT 1 FROM prof WHERE prof_url='{$rel_prof_url}'";
         $result = mysqli_query($link, $sql);
         if (!$result) {
             $error = 'Error checking for existence of profession: ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
         if (mysqli_num_rows($result) == 0) {
             $sql = "INSERT INTO prof(prof_nm, prof_url)\n                  VALUES('{$rel_prof_nm}', '{$rel_prof_url}')";
             if (!mysqli_query($link, $sql)) {
                 $error = 'Error adding profession data: ' . mysqli_error($link);
                 include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
                 exit;
             }
         }
Ejemplo n.º 16
0
     $prvs_lctn_nm = preg_replace('/(\\*)(.*\\S+)/', '$2', $prvs_lctn_nm);
     $lctn_prvs_sg = '1';
     $prvs_lctn_nm = trim($prvs_lctn_nm);
 } else {
     $lctn_prvs_sg = '0';
 }
 if (preg_match('/^\\S+.*--[1-9][0-9]{0,1}$/', $prvs_lctn_nm)) {
     list($prvs_lctn_nm, $prvs_lctn_sffx_num) = explode('--', $prvs_lctn_nm);
     $prvs_lctn_nm = trim($prvs_lctn_nm);
     $prvs_lctn_sffx_num = trim($prvs_lctn_sffx_num);
     $prvs_lctn_sffx_rmn = ' (' . romannumeral($prvs_lctn_sffx_num) . ')';
 } else {
     $prvs_lctn_nm = trim($prvs_lctn_nm);
     $prvs_lctn_sffx_rmn = '';
 }
 $prvs_lctn_url = generateurl($prvs_lctn_nm . $prvs_lctn_sffx_rmn);
 $prvs_lctn_alph = alph($prvs_lctn_nm);
 $sql = "SELECT 1 FROM lctn WHERE lctn_url='{$prvs_lctn_url}'";
 $result = mysqli_query($link, $sql);
 if (!$result) {
     $error = 'Error checking for existence of location: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (mysqli_num_rows($result) == 0) {
     $sql = "INSERT INTO lctn(lctn_nm, lctn_alph, lctn_sffx_num, lctn_url, lctn_exp, lctn_fctn)\n                VALUES('{$prvs_lctn_nm}', CASE WHEN '{$prvs_lctn_alph}'!='' THEN '{$prvs_lctn_alph}' END, '{$prvs_lctn_sffx_num}', '{$prvs_lctn_url}', '{$prvs_lctn_exp}', 0)";
     if (!mysqli_query($link, $sql)) {
         $error = 'Error adding location data: ' . mysqli_error($link);
         include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
         exit;
     }
Ejemplo n.º 17
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['comp_typ_nm']);
    $pagetitle = html($row['comp_typ_nm']);
    $comp_typ_nm = html($row['comp_typ_nm']);
    $comp_typ_id = html($comp_typ_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $comp_typ_id = cln($_POST['comp_typ_id']);
    $comp_typ_nm = trim(cln($_POST['comp_typ_nm']));
    $comp_typ_url = generateurl($comp_typ_nm);
    $comp_typ_nm_session = $_POST['comp_typ_nm'];
    $errors = array();
    if (!preg_match("/\\S+/", $comp_typ_nm)) {
        $errors['comp_typ_nm'] = '**You must enter a company type name.**';
    } elseif (strlen($comp_typ_nm) > 255) {
        $errors['comp_typ_nm'] = '</br>**Company type is allowed a maximum of 255 characters.**';
    } elseif (preg_match("/,,/", $comp_typ_nm)) {
        $errors['comp_typ_nm'] = '**Company type name cannot include the following: [,,].**';
    } else {
        $sql = "SELECT comp_typ_id, comp_typ_nm FROM comp_typ WHERE comp_typ_url='{$comp_typ_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing company type URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
Ejemplo n.º 18
0
     $mat_sffx_rmn = '';
     $mat_sffx_rmn_session = '';
 }
 $mat_url = generateurl($mat_nm . $mat_sffx_rmn);
 if (strlen($mat_nm) > 255 || strlen($mat_url) > 255) {
     $errors['mat_nm_excss_lngth'] = '</br>**Material name and its URL are allowed a maximum of 255 characters each.**';
 }
 $mat_alph = alph($mat_nm);
 if (!preg_match('/\\S+/', $frmt_nm)) {
     $errors['frmt_nm'] = '**You must enter a format name.**';
 } elseif (strlen($frmt_nm) > 255) {
     $errors['frmt_nm'] = '</br>**Format name is allowed a maximum of 255 characters.**';
 } elseif (preg_match('/--/', $frmt_nm) || preg_match('/;;/', $frmt_nm) || preg_match('/::/', $frmt_nm) || preg_match('/,,/', $frmt_nm)) {
     $errors['frmt_nm'] = '**Format name cannot include any of the following: [--], [;;], [::], [,,].**';
 } else {
     $frmt_url = generateurl($frmt_nm);
     $sql = "SELECT frmt_nm FROM frmt WHERE NOT EXISTS (SELECT 1 FROM frmt WHERE frmt_nm='{$frmt_nm}') AND frmt_url='{$frmt_url}'";
     $result = mysqli_query($link, $sql);
     if (!$result) {
         $error = 'Error checking for existing course-type URL: ' . mysqli_error($link);
         include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
         exit;
     }
     $row = mysqli_fetch_array($result);
     if (mysqli_num_rows($result) > 0) {
         $errors['frmt_nm'] = '</br>**Duplicate format URL exists. Did you mean to type: ' . html($row['frmt_nm']) . '?**';
     }
 }
 if (count($errors) == 0) {
     $mat_nm_frmt_session = $_POST['mat_nm'] . ' (' . $_POST['frmt_nm'] . ')' . $mat_sffx_rmn_session;
     $sql = "SELECT mat_id, mat_nm, mat_sffx_num, frmt_nm FROM mat INNER JOIN frmt ON frmtid=frmt_id WHERE mat_url='{$mat_url}' AND frmt_url='{$frmt_url}'";
Ejemplo n.º 19
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['abil_nm']);
    $pagetitle = html($row['abil_nm']);
    $abil_nm = html($row['abil_nm']);
    $abil_id = html($abil_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $abil_id = cln($_POST['abil_id']);
    $abil_nm = trim(cln($_POST['abil_nm']));
    $abil_url = generateurl($abil_nm);
    $abil_nm_session = $_POST['abil_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $abil_nm)) {
        $errors['abil_nm'] = '**You must enter an ability name.**';
    } elseif (strlen($abil_nm) > 255) {
        $errors['abil_nm'] = '</br>**Ability name is allowed a maximum of 255 characters.**';
    } elseif (preg_match('/,,/', $abil_nm)) {
        $errors['abil_nm'] = '**Ability name cannot include the following: [,,].**';
    } else {
        $sql = "SELECT abil_id, abil_nm FROM abil WHERE abil_url='{$abil_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing ability URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
Ejemplo n.º 20
0
 }
 if (substr_count($rvw_crtc, ';;') > 1) {
     $rvw_crtc_errors++;
     $rvw_crtc_smcln_excss_err_arr[] = $rvw_crtc;
     $errors['rvw_crtc_smcln_excss'] = '</br>**You may only use [;;] once per given-family name coupling. Please amend: ' . html(implode(' / ', $rvw_crtc_smcln_excss_err_arr)) . '.**';
 } elseif (preg_match('/\\S+.*;;(.*\\S+)?/', $rvw_crtc)) {
     list($rvw_crtc_frst_nm, $rvw_crtc_lst_nm) = explode(';;', $rvw_crtc);
     $rvw_crtc_frst_nm = trim($rvw_crtc_frst_nm);
     $rvw_crtc_lst_nm = trim($rvw_crtc_lst_nm);
     if (preg_match('/\\S+/', $rvw_crtc_lst_nm)) {
         $rvw_crtc_lst_nm_dsply = ' ' . $rvw_crtc_lst_nm;
     } else {
         $rvw_crtc_lst_nm_dsply = '';
     }
     $rvw_crtc_fll_nm = $rvw_crtc_frst_nm . $rvw_crtc_lst_nm_dsply;
     $rvw_crtc_url = generateurl($rvw_crtc_fll_nm . $rvw_crtc_sffx_rmn);
     if (strlen($rvw_crtc_fll_nm) > 255 || strlen($rvw_crtc_url) > 255) {
         $rvw_crtc_errors++;
         $errors['rvw_crtc_fll_nm_excss_lngth'] = '</br>**Critic name and its URL are allowed a maximum of 255 characters each. Please amend entries that exceed this amount.**';
     }
 } else {
     $rvw_crtc_errors++;
     $rvw_crtc_smcln_err_arr[] = $rvw_crtc;
     $errors['rvw_crtc_smcln'] = '</br>**You must assign a given name and family name to the following using [;;]: ' . html(implode(' / ', $rvw_crtc_smcln_err_arr)) . '.**';
 }
 if ($rvw_crtc_errors == 0) {
     $rvw_crtc_frst_nm_cln = cln($rvw_crtc_frst_nm);
     $rvw_crtc_lst_nm_cln = cln($rvw_crtc_lst_nm);
     $rvw_crtc_fll_nm_cln = cln($rvw_crtc_fll_nm);
     $rvw_crtc_sffx_num_cln = cln($rvw_crtc_sffx_num);
     $rvw_crtc_url_cln = cln($rvw_crtc_url);
Ejemplo n.º 21
0
     $prvsad_thtr_lctn_dsply = ' (' . $prvsad_thtr_lctn . ')';
 } else {
     $prvsad_thtr_lctn = NULL;
     $prvsad_thtr_lctn_dsply = '';
 }
 if (preg_match('/\\S+.*;;.*\\S+/', $prvsad_thtr_nm)) {
     list($prvsad_thtr_nm, $prvsad_sbthtr_nm) = explode(';;', $prvsad_thtr_nm);
     $prvsad_thtr_nm = trim($prvsad_thtr_nm);
     $prvsad_sbthtr_nm = trim($prvsad_sbthtr_nm);
     $prvsad_sbthtr_nm_dsply = ': ' . $prvsad_sbthtr_nm;
 } else {
     $prvsad_sbthtr_nm = NULL;
     $prvsad_sbthtr_nm_dsply = '';
 }
 $prvsad_thtr_fll_nm = $prvsad_thtr_nm . $prvsad_sbthtr_nm_dsply . $prvsad_thtr_lctn_dsply;
 $prvsad_thtr_url = generateurl($prvsad_thtr_fll_nm . $prvsad_thtr_sffx_rmn);
 $prvsad_thtr_alph = alph($prvsad_thtr_fll_nm);
 $sql = "SELECT 1 FROM thtr WHERE thtr_url='{$prvsad_thtr_url}'";
 $result = mysqli_query($link, $sql);
 if (!$result) {
     $error = 'Error checking for existence of theatre (against previously located theatre): ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (mysqli_num_rows($result) == 0) {
     $sql = "INSERT INTO thtr(thtr_nm, sbthtr_nm, thtr_lctn, thtr_fll_nm, thtr_alph, thtr_sffx_num, thtr_url, thtr_clsd, thtr_nm_exp, thtr_tr_ov)\n                  VALUES('{$prvsad_thtr_nm}', '{$prvsad_sbthtr_nm}', '{$prvsad_thtr_lctn}', '{$prvsad_thtr_fll_nm}', CASE WHEN '{$prvsad_thtr_alph}'!='' THEN '{$prvsad_thtr_alph}' END, '{$prvsad_thtr_sffx_num}', '{$prvsad_thtr_url}', 0, 0, 0)";
     if (!mysqli_query($link, $sql)) {
         $error = 'Error adding previous address theatre data: ' . mysqli_error($link);
         include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
         exit;
     }
Ejemplo n.º 22
0
    $awrds_id = html($awrds_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $awrds_id = cln($_POST['awrds_id']);
    $awrds_nm = trim(cln($_POST['awrds_nm']));
    $awrds_session = $_POST['awrds_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $awrds_nm)) {
        $errors['awrds_nm'] = '**You must enter an awards name.**';
    } elseif (strlen($awrds_nm) > 255) {
        $errors['awrds_nm'] = '</br>**Awards name is allowed a maximum of 255 characters.**';
    } else {
        $awrds_url = generateurl($awrds_nm);
        $awrds_alph = alph($awrds_nm);
        $sql = "SELECT awrds_id, awrds_nm FROM awrds WHERE awrds_url='{$awrds_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing awards URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
        }
        $row = mysqli_fetch_array($result);
        if (mysqli_num_rows($result) > 0 && $row['awrds_id'] !== $awrds_id) {
            $errors['awrds_nm'] = '</br>**Duplicate URL exists for: ' . html($row['awrds_nm']) . '. You must keep the original name or assign an awards name without an existing URL.**';
        }
    }
    if (count($errors) > 0) {
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
Ejemplo n.º 23
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['fstvl_nm']);
    $pagetitle = html($row['fstvl_nm']);
    $fstvl_nm = html($row['fstvl_nm']);
    $fstvl_id = html($fstvl_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $fstvl_id = cln($_POST['fstvl_id']);
    $fstvl_nm = trim(cln($_POST['fstvl_nm']));
    $fstvl_url = generateurl($fstvl_nm);
    $fstvl_nm_session = $_POST['fstvl_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $fstvl_nm)) {
        $errors['fstvl_nm'] = '**You must enter a festival name.**';
    } elseif (strlen($fstvl_nm) > 255) {
        $errors['fstvl_nm'] = '</br>**Festival name is allowed a maximum of 255 characters.**';
    } else {
        $fstvl_alph = alph($fstvl_nm);
        $sql = "SELECT fstvl_id, fstvl_nm FROM fstvl WHERE fstvl_url='{$fstvl_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing festival URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
            exit;
        }
Ejemplo n.º 24
0
     $lcnsr_prsn_sffx_num = trim($lcnsr_prsn_sffx_num);
     $lcnsr_prsn_sffx_rmn = ' (' . romannumeral($lcnsr_prsn_sffx_num) . ')';
 } else {
     $lcnsr_prsn_sffx_num = '0';
     $lcnsr_prsn_sffx_rmn = '';
 }
 list($lcnsr_prsn_frst_nm, $lcnsr_prsn_lst_nm) = explode(';;', $lcnsr_prsn_nm);
 $lcnsr_prsn_frst_nm = trim($lcnsr_prsn_frst_nm);
 $lcnsr_prsn_lst_nm = trim($lcnsr_prsn_lst_nm);
 if (preg_match('/\\S+/', $lcnsr_prsn_lst_nm)) {
     $lcnsr_prsn_lst_nm_dsply = ' ' . $lcnsr_prsn_lst_nm;
 } else {
     $lcnsr_prsn_lst_nm_dsply = '';
 }
 $lcnsr_prsn_fll_nm = $lcnsr_prsn_frst_nm . $lcnsr_prsn_lst_nm_dsply;
 $lcnsr_prsn_url = generateurl($lcnsr_prsn_fll_nm . $lcnsr_prsn_sffx_rmn);
 $lcnsr_ordr = ++$n;
 $sql = "SELECT 1 FROM prsn WHERE prsn_url='{$lcnsr_prsn_url}'";
 $result = mysqli_query($link, $sql);
 if (!$result) {
     $error = 'Error checking for existence of licensor (person): ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (mysqli_num_rows($result) == 0) {
     $sql = "INSERT INTO prsn(prsn_fll_nm, prsn_frst_nm, prsn_lst_nm, prsn_sffx_num, prsn_url, comp_bool)\n                    VALUES('{$lcnsr_prsn_fll_nm}', '{$lcnsr_prsn_frst_nm}', '{$lcnsr_prsn_lst_nm}', '{$lcnsr_prsn_sffx_num}', '{$lcnsr_prsn_url}', '0')";
     if (!mysqli_query($link, $sql)) {
         $error = 'Error adding licensor (person) data: ' . mysqli_error($link);
         include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
         exit;
     }
Ejemplo n.º 25
0
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (preg_match('/\\S+/', $rel_plc_list)) {
     $rel_plc_nms = explode(',,', $rel_plc_list);
     $n = 0;
     foreach ($rel_plc_nms as $rel_plc_nm) {
         $rel_plc_ordr = ++$n;
         if (preg_match('/^\\S+.*\\*$/', $rel_plc_nm)) {
             $rel_plc_nm = preg_replace('/(\\S+.*)(\\*)/', '$1', $rel_plc_nm);
             $plc_typ_rel = '1';
             $rel_plc_nm = trim($rel_plc_nm);
         } else {
             $plc_typ_rel = '0';
         }
         $rel_plc_url = generateurl($rel_plc_nm);
         $sql = "SELECT 1 FROM plc WHERE plc_url='{$rel_plc_url}'";
         $result = mysqli_query($link, $sql);
         if (!$result) {
             $error = 'Error checking for existence of place: ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
         if (mysqli_num_rows($result) == 0) {
             $sql = "INSERT INTO plc(plc_nm, plc_url)\n                  VALUES('{$rel_plc_nm}', '{$rel_plc_url}')";
             if (!mysqli_query($link, $sql)) {
                 $error = 'Error adding place data: ' . mysqli_error($link);
                 include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
                 exit;
             }
         }
Ejemplo n.º 26
0
     $comp_prsn_sffx_num = trim($comp_prsn_sffx_num);
     $comp_prsn_sffx_rmn = ' (' . romannumeral($comp_prsn_sffx_num) . ')';
 } else {
     $comp_prsn_sffx_num = '0';
     $comp_prsn_sffx_rmn = '';
 }
 list($comp_prsn_frst_nm, $comp_prsn_lst_nm) = explode(';;', $comp_prsn);
 $comp_prsn_frst_nm = trim($comp_prsn_frst_nm);
 $comp_prsn_lst_nm = trim($comp_prsn_lst_nm);
 if (preg_match('/\\S+/', $comp_prsn_lst_nm)) {
     $comp_prsn_lst_nm_dsply = ' ' . $comp_prsn_lst_nm;
 } else {
     $comp_prsn_lst_nm_dsply = '';
 }
 $comp_prsn_fll_nm = $comp_prsn_frst_nm . $comp_prsn_lst_nm_dsply;
 $comp_prsn_url = generateurl($comp_prsn_fll_nm . $comp_prsn_sffx_rmn);
 $comp_prsn_ordr = ++$n;
 $sql = "SELECT 1 FROM prsn WHERE prsn_url='{$comp_prsn_url}'";
 $result = mysqli_query($link, $sql);
 if (!$result) {
     $error = 'Error checking for existence of company member (person): ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (mysqli_num_rows($result) == 0) {
     $sql = "INSERT INTO prsn(prsn_url, prsn_fll_nm, prsn_frst_nm, prsn_lst_nm, prsn_sffx_num, comp_bool)\n                VALUES('{$comp_prsn_url}', '{$comp_prsn_fll_nm}', '{$comp_prsn_frst_nm}', '{$comp_prsn_lst_nm}', '{$comp_prsn_sffx_num}', '0')";
     if (!mysqli_query($link, $sql)) {
         $error = 'Error adding company member (person) data: ' . mysqli_error($link);
         include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
         exit;
     }
Ejemplo n.º 27
0
 }
 if (substr_count($wri_prsn_nm, ';;') > 1) {
     $wri_prsn_errors++;
     $wri_prsn_smcln_excss_err_arr[] = $wri_prsn_nm;
     $errors['wri_prsn_smcln_excss'] = '</br>**You may only use [;;] once per given-family name coupling. Please amend: ' . html(implode(' / ', $wri_prsn_smcln_excss_err_arr)) . '.**';
 } elseif (preg_match('/\\S+.*;;(.*\\S+)?/', $wri_prsn_nm)) {
     list($wri_prsn_frst_nm, $wri_prsn_lst_nm) = explode(';;', $wri_prsn_nm);
     $wri_prsn_frst_nm = trim($wri_prsn_frst_nm);
     $wri_prsn_lst_nm = trim($wri_prsn_lst_nm);
     if (preg_match('/\\S+/', $wri_prsn_lst_nm)) {
         $wri_prsn_lst_nm_dsply = ' ' . $wri_prsn_lst_nm;
     } else {
         $wri_prsn_lst_nm_dsply = '';
     }
     $wri_prsn_fll_nm = $wri_prsn_frst_nm . $wri_prsn_lst_nm_dsply;
     $wri_prsn_url = generateurl($wri_prsn_fll_nm . $wri_prsn_sffx_rmn);
     $wri_prsn_dplct_arr[] = $wri_prsn_url;
     if (count(array_unique($wri_prsn_dplct_arr)) < count($wri_prsn_dplct_arr)) {
         $errors['wri_prsn_dplct'] = '</br>**There are entries within a role array that create duplicate person URLs.**';
     }
     if (strlen($wri_prsn_fll_nm) > 255 || strlen($wri_prsn_url) > 255) {
         $wri_prsn_errors++;
         $errors['wri_prsn_excss_lngth'] = '</br>**Writer (person) name and its URL are allowed a maximum of 255 characters each. Please amend entries that exceed this amount.**';
     }
 } else {
     $wri_prsn_errors++;
     $wri_prsn_smcln_err_arr[] = $wri_prsn_nm;
     $errors['wri_prsn_smcln'] = '</br>**You must assign a given name and family name to the following using [;;]: ' . html(implode(' / ', $wri_prsn_smcln_err_arr)) . '.**';
 }
 if ($wri_prsn_errors == 0) {
     $wri_prsn_frst_nm_cln = cln($wri_prsn_frst_nm);
Ejemplo n.º 28
0
     $error = 'Error updating theatre info for submitted attribute: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 $sql = "DELETE FROM rel_attr WHERE rel_attr1='{$attr_id}'";
 if (!mysqli_query($link, $sql)) {
     $error = 'Error deleting attribute-related attribute associations: ' . mysqli_error($link);
     include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
     exit;
 }
 if (preg_match('/\\S+/', $rel_attr_list)) {
     $rel_attr_nms = explode(',,', $rel_attr_list);
     $n = 0;
     foreach ($rel_attr_nms as $rel_attr_nm) {
         $rel_attr_ordr = ++$n;
         $rel_attr_url = generateurl($rel_attr_nm);
         $sql = "SELECT 1 FROM attr WHERE attr_url='{$rel_attr_url}'";
         $result = mysqli_query($link, $sql);
         if (!$result) {
             $error = 'Error checking for existence of attribute: ' . mysqli_error($link);
             include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
             exit;
         }
         if (mysqli_num_rows($result) == 0) {
             $sql = "INSERT INTO attr(attr_nm, attr_url) VALUES('{$rel_attr_nm}', '{$rel_attr_url}')";
             if (!mysqli_query($link, $sql)) {
                 $error = 'Error adding attribute data: ' . mysqli_error($link);
                 include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
                 exit;
             }
         }
Ejemplo n.º 29
0
        include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';
        exit;
    }
    $row = mysqli_fetch_array($result);
    $pagetab = 'Edit: ' . html($row['txt_vrsn_nm']);
    $pagetitle = html($row['txt_vrsn_nm']);
    $txt_vrsn_nm = html($row['txt_vrsn_nm']);
    $txt_vrsn_id = html($txt_vrsn_id);
    include 'editform.html.php';
    exit;
}
if (isset($_POST['edit']) and $_POST['edit'] == 'Submit') {
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
    $txt_vrsn_id = cln($_POST['txt_vrsn_id']);
    $txt_vrsn_nm = trim(cln($_POST['txt_vrsn_nm']));
    $txt_vrsn_url = generateurl($txt_vrsn_nm);
    $txt_vrsn_nm_session = $_POST['txt_vrsn_nm'];
    $errors = array();
    if (!preg_match('/\\S+/', $txt_vrsn_nm)) {
        $errors['txt_vrsn_nm'] = '**You must enter a text version name.**';
    }
    if (strlen($txt_vrsn_nm) > 255) {
        $errors['txt_vrsn_nm'] = '</br>**Text version name is allowed a maximum of 255 characters.**';
    } elseif (preg_match('/,,/', $txt_vrsn_nm)) {
        $errors['txt_vrsn_nm'] = '**Text version name cannot include the following: [,,].**';
    } else {
        $sql = "SELECT txt_vrsn_id, txt_vrsn_nm FROM txt_vrsn WHERE txt_vrsn_url='{$txt_vrsn_url}'";
        $result = mysqli_query($link, $sql);
        if (!$result) {
            $error = 'Error checking for existing text version URL: ' . mysqli_error($link);
            include $_SERVER['DOCUMENT_ROOT'] . '/includes/error.html.php';