Пример #1
0
function phpwcms_revision_r535()
{
    $status = true;
    // do former revision check – fallback to r534
    if (phpwcms_revision_check_temp('534') !== true) {
        $status = phpwcms_revision_check('534');
    }
    // change type of some content related fields from TEXT to MEDIUMTEXT
    // Retrieve Type of profession name
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_profession` WHERE Field='prof_name'");
    if (isset($result[0]['Type']) && strpos($result[0]['Type'], '100')) {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_profession` CHANGE `prof_name` `prof_name` VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    // Change profession ' n/a'
    _dbUpdate('phpwcms_profession', array('prof_name' => 'n/a'), "prof_name=' n/a'");
    // Import new professions
    $result = _dbCount("SELECT COUNT(*) FROM `" . DB_PREPEND . "phpwcms_profession`");
    if ($result < 25) {
        $jobs = array('academic', 'accountant', 'actor', 'administrative services department manager', 'administrator', 'administrator, IT', 'agricultural advisor', 'air steward', 'air-conditioning installer or mechanic', 'aircraft service technician', 'ambulance driver (non paramedic)', 'animal carer (not in farms)', 'animator', 'arable farm manager, field crop or vegetable', 'arable farmer, field crop or vegetable', 'architect', 'architect, landscape', 'artist', 'asbestos removal worker', 'assembler', 'assembly team leader', 'assistant', 'author', 'baker', 'bank clerk (back-office)', 'beauty therapist', 'beverage production process controller', 'biologist', 'blogger', 'boring machine operator', 'bricklayer', 'builder', 'butcher', 'car mechanic', 'career counsellor', 'caretaker', 'carpenter', 'charge nurse', 'check-out operator', 'chef', 'child-carer', 'civil engineering technician', 'civil servant', 'cleaning supervisor', 'clerk', 'climatologist', 'cloak room attendant', 'cnc operator', 'comic book writer', 'community health worker', 'company director', 'computer programmer', 'confectionery maker', 'construction operative', 'cook', 'cooling or freezing installer or mechanic', 'critic', 'database designer', 'decorator', 'dental hygienist', 'dental prosthesis technician', 'dentist', 'department store manager', 'designer', 'designer, graphic', 'designer, industrial', 'designer, interface', 'designer, interior', 'designer, screen', 'designer, web', 'dietician', 'diplomat', 'director', 'display designer', 'doctor', 'domestic housekeeper', 'economist', 'editor', 'education advisor', 'electrical engineer', 'electrical mechanic or fitter', 'electrician', 'engineer', 'engineering maintenance supervisor', 'estate agent', 'executive', 'executive secretary', 'farmer', 'felt roofer', 'filing clerk', 'film director', 'financial clerk', 'financial services manager', 'fire fighter', 'first line supervisor beverages workers', 'first line supervisor of cleaning workers', 'fisherman', 'fishmonger', 'flight attendant', 'floral arranger', 'food scientist', 'garage supervisor', 'garbage man', 'gardener, all other', 'general practitioner', 'geographer', 'geologist', 'hairdresser', 'head groundsman', 'head teacher', 'horse riding instructor', 'hospital nurse', 'hotel manager', 'house painter', 'hr manager', 'it applications programmer', 'it systems administrator', 'jeweller', 'journalist', 'judge', 'juggler', 'kitchen assistant', 'lathe setter-operator', 'lawyer', 'lecturer', 'legal secretary', 'lexicographer', 'library assistant', 'local police officer', 'logistics manager', 'machine tool operator', 'magician', 'makeup artist', 'manager', 'manager, all other health services', 'marketing manager', 'meat processing operator', 'mechanical engineering technician', 'medical laboratory technician', 'medical radiography equipment operator', 'metal moulder', 'metal production process operator', 'meteorologist', 'midwifery professional', 'miner', 'mortgage clerk', 'musical instrument maker', 'musician', 'non-commissioned officer armed forces', 'nurse', 'nursery school teacher', 'nursing aid', 'ophthalmic optician', 'optician', 'painter', 'payroll clerk', 'personal assistant', 'personal carer in an institution for the elderly', 'personal carer in an institution for the handicapped', 'personal carer in private homes', 'personnel clerk', 'pest controller', 'photographer', 'physician assistant', 'pilot', 'pipe fitter', 'plant maintenance mechanic', 'plumber', 'police inspector', 'police officer', 'policy advisor', 'politician', 'porter', 'post secondary education teacher', 'post sorting or distributing clerk', 'power plant operator', 'primary school head', 'primary school teacher', 'printer', 'printing machine operator', 'prison officer / warder', 'product manager', 'professional gambler', 'project manager', 'programmer', 'psychologist', 'puppeteer', 'quality inspector, all other products', 'receptionist', 'restaurant cook', 'road paviour', 'roofer', 'sailor', 'sales assistant, all other', 'sales or marketing manager', 'sales representative', 'sales support clerk', 'salesperson', 'scientist', 'seaman (armed forces)', 'secondary school manager', 'secondary school teacher', 'secretary', 'security guard', 'sheet metal worker', 'ship mechanic', 'shoe repairer, leather repairer', 'shop assistant', 'sign language Interpreter', 'singer', 'social media manager', 'social photographer', 'software analyst', 'software developer', 'software engineer', 'soldier', 'solicitor', 'speech therapist', 'steel fixer', 'stockman', 'structural engineer', 'student', 'surgeon', 'surgical footwear maker', 'swimming instructor', 'system operator', 'tailor', 'tailor, seamstress', 'tax inspector', 'taxi driver', 'teacher', 'telephone operator', 'telephonist', 'theorist', 'tile layer', 'translator', 'transport clerk', 'travel agency clerk', 'travel agent', 'truck driver long distances', 'trucker', 'TV cameraman', 'TV presenter', 'university professor', 'university researcher', 'vet', 'veterinary practitioner', 'vocational education teacher', 'waiter', 'waiting staff', 'web designer', 'web developer', 'webmaster', 'welder, all other', 'wood processing plant operator', 'writer', 'other', 'n/a');
        foreach ($jobs as $job) {
            $sql = 'INSERT IGNORE INTO `' . DB_PREPEND . 'phpwcms_profession` (prof_name) VALUES(' . _dbEscape($job) . ')';
            _dbQuery($sql, 'INSERT');
        }
    }
    return $status;
}
Пример #2
0
 $plugin['data']['shopprod_category'] = isset($_POST['shopprod_category']) && is_array($_POST['shopprod_category']) ? $_POST['shopprod_category'] : array();
 if (!$plugin['data']['shopprod_name1']) {
     $plugin['error']['shopprod_name1'] = 'No name';
 }
 if (!$plugin['data']['shopprod_ordernumber']) {
     $plugin['error']['shopprod_ordernumber'] = 'No order number';
 } else {
     $sql = 'SELECT COUNT(shopprod_id) FROM ' . DB_PREPEND . 'phpwcms_shop_products WHERE ';
     if ($plugin['data']['shopprod_id']) {
         $sql .= 'shopprod_id != ' . $plugin['data']['shopprod_id'] . ' AND ';
     }
     $sql .= "shopprod_ordernumber LIKE '" . aporeplace($plugin['data']['shopprod_ordernumber']) . "'";
     //if($plugin['data']['shopprod_lang']) {
     $sql .= " AND shopprod_lang='" . aporeplace($plugin['data']['shopprod_lang']) . "'";
     //}
     if (_dbCount($sql)) {
         $plugin['error']['shopprod_ordernumber'] = 'Unique order number necessary';
     }
 }
 $plugin['data']['shopprod_price'] = str_replace($BLM['thousands_sep'], '', $plugin['data']['shopprod_price']);
 $plugin['data']['shopprod_price'] = str_replace($BLM['dec_point'], '.', $plugin['data']['shopprod_price']);
 $plugin['data']['shopprod_price'] = floatval($plugin['data']['shopprod_price']);
 if (abs($plugin['data']['shopprod_price']) > 10000000000) {
     $plugin['error']['shopprod_price'] = 'Check price';
 }
 $plugin['data']['shopprod_weight'] = str_replace($BLM['thousands_sep'], '', $plugin['data']['shopprod_weight']);
 $plugin['data']['shopprod_weight'] = str_replace($BLM['dec_point'], '.', $plugin['data']['shopprod_weight']);
 $plugin['data']['shopprod_weight'] = floatval($plugin['data']['shopprod_weight']);
 $plugin['data']['shopprod_tag'] = strtolower(preg_replace('/[^0-9a-z, \\-_]/i', '', phpwcms_remove_accents($_POST['shopprod_tag'])));
 $plugin['data']['shopprod_tag'] = implode(', ', convertStringToArray($plugin['data']['shopprod_tag']));
 // Images
Пример #3
0
function checkLoginCount()
{
    $check = 0;
    if (!empty($_SESSION["wcs_user"])) {
        $sql = "SELECT COUNT(*) FROM " . DB_PREPEND . "phpwcms_userlog WHERE logged_user="******"wcs_user"]) . " AND logged_in=1";
        if (!empty($phpwcms['Login_IPcheck'])) {
            $sql .= " AND logged_ip=" . _dbEscape(getRemoteIP());
        }
        $check = _dbCount($sql);
        if ($check) {
            $sql = "UPDATE " . DB_PREPEND . "phpwcms_userlog SET logged_change=" . time() . " WHERE ";
            $sql .= "logged_user="******"wcs_user"]) . " AND logged_in=1";
            _dbQuery($sql, 'UPDATE');
        } else {
            destroyBackendSessionData();
        }
    }
    return $check;
}
    foreach ($_SESSION["klapp"] as $klapp_id => $klapp_value) {
        if (!$klapp_value) {
            unset($_SESSION["klapp"][$klapp_id]);
        }
    }
    mysql_query("UPDATE " . DB_PREPEND . "phpwcms_user SET usr_var_privatefile=" . _dbEscape(serialize($_SESSION["klapp"])) . " WHERE usr_id=" . $_SESSION["wcs_user_id"], $db);
}
//Zähler für die Listenfunktion setzen
$_SESSION["list_zaehler"] = 0;
//Feststellen, ob überhaupt Dateien/Ordner vorhanden sind
$sql = "SELECT COUNT(f_id) FROM " . DB_PREPEND . "phpwcms_file WHERE f_trash=0";
if (empty($_SESSION["wcs_user_admin"])) {
    $sql .= " AND f_uid=" . $_SESSION["wcs_user_id"];
}
$sql .= " LIMIT 1";
$count_user_files = _dbCount($sql);
//Wenn überhaupt Dateien für User vorhanden, dann Listing
if ($count_user_files) {
    //Beginn Tabelle für Dateilisting
    echo "<table width=\"538\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
    echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" width=\"1\" height=\"1\"></td></tr>\n";
    list_private(0, $db, 0, "phpwcms.php?do=files&amp;f=0", $_SESSION["wcs_user_id"], $cutID, $_SESSION["wcs_user_thumb"], $phpwcms);
    include_once PHPWCMS_ROOT . "/include/inc_lib/files.private-filelist.inc.php";
    echo "</table>\n";
    //Ende Tabelle
} else {
    //Wenn keinerlei Datensatz innerhalb Files durchlaufen wurde, dann
    echo "<img src=\"img/leer.gif\" width=\"1\" height=\"6\"><br />";
    echo $BL['be_fprivadd_nofolders'] . "&nbsp;&nbsp;";
    echo "[<a href=\"phpwcms.php?do=files&amp;f=0&amp;mkdir=0\">" . $BL['be_fpriv_button'] . "</a>]";
    echo "<br /><img src=\"img/leer.gif\" width=\"1\" height=\"6\">";
Пример #5
0
function checkLogin($mode = 'REDIRECT')
{
    $sql = "UPDATE " . DB_PREPEND . "phpwcms_userlog SET logged_in=0, logged_change='" . time() . "' ";
    $sql .= "WHERE logged_in=1 AND (" . time() . "-logged_change) > " . intval($GLOBALS['phpwcms']["max_time"]);
    _dbQuery($sql, 'UPDATE');
    checkLoginCount();
    if (empty($_SESSION["wcs_user"])) {
        @session_destroy();
        $ref_url = '';
        if (!empty($_SERVER['QUERY_STRING'])) {
            $ref_url = '?ref=' . rawurlencode(PHPWCMS_URL . 'phpwcms.php?' . xss_clean($_SERVER['QUERY_STRING']));
        }
        if ($mode == 'REDIRECT') {
            // check again if user was logged in and this is a valid redirect request
            $sql = 'SELECT COUNT(*)  FROM ' . DB_PREPEND . 'phpwcms_userlog WHERE ';
            $sql .= "logged_ip=" . _dbEscape(getRemoteIP()) . " AND ";
            $sql .= '( ' . time() . ' - logged_change ) < 3600';
            $ref_url = _dbCount($sql) > 0 ? get_login_file() . $ref_url : '';
            headerRedirect(PHPWCMS_URL . $ref_url);
        } else {
            return false;
        }
    }
    return true;
}
Пример #6
0
 function getImages($folder = 0)
 {
     $folders = array();
     $this->images = array();
     if (is_array($folder)) {
         foreach ($folder as $item) {
             $item = intval($item);
             $folders[$item] = $item;
         }
     } else {
         $folders[] = intval($folder);
     }
     if (count($folders)) {
         $folders = implode(',', $folders);
     }
     // check if folder(s) is(are) live
     $sql = 'SELECT COUNT(*) FROM ' . DB_PREPEND . 'phpwcms_file WHERE ';
     $sql .= 'f_id IN (' . $folders . ') AND f_kid=0 AND f_trash=0 AND f_aktiv=1 AND f_public=1';
     if (_dbCount($sql) > 0) {
         $this->image_limit = intval($this->image_limit);
         $this->image_sort = strtoupper($this->image_sort);
         switch ($this->image_sort) {
             case 'ASC':
                 $order_by = ' ORDER BY f_created ASC';
                 break;
             case 'RAND':
                 $order_by = ' ORDER BY RAND()';
                 break;
             case 'SORT-ASC':
                 $order_by = ' ORDER BY f_sort ASC';
                 break;
             case 'SORT-DESC':
                 $order_by = ' ORDER BY f_sort DESC';
                 break;
             case 'SORT-NAME-ASC':
                 $order_by = ' ORDER BY f_sort ASC, f_name ASC';
                 break;
             case 'SORT-NAME-DESC':
                 $order_by = ' ORDER BY f_sort DESC, f_name DESC';
                 break;
             case 'SORT-CREATE-ASC':
                 $order_by = ' ORDER BY f_sort ASC, f_created ASC';
                 break;
             case 'SORT-CREATE-DESC':
                 $order_by = ' ORDER BY f_sort DESC, f_created DESC';
                 break;
             default:
                 $order_by = ' ORDER BY f_created DESC';
         }
         $sql = 'SELECT * FROM ' . DB_PREPEND . 'phpwcms_file WHERE ';
         $sql .= 'f_pid IN (' . $folders . ') AND f_kid=1 AND ';
         $sql .= 'f_trash=0 AND f_aktiv=1 AND f_public=1 AND ';
         $sql .= "f_ext IN ('jpg', 'jpeg', 'gif', 'png')";
         $sql .= $order_by;
         if ($this->image_limit > 0) {
             $sql .= ' LIMIT ' . $this->image_limit;
         }
         $result = _dbQuery($sql);
         if (isset($result[0])) {
             $this->images = $result;
         }
     }
 }
Пример #7
0
     $news['sql_limit'] .= ', ' . $news['news_limit'];
 } else {
     $news['sql_limit'] = '';
 }
 // set defaults
 $news['current_page'] = 1;
 $news['total_pages'] = 1;
 $news['page_next'] = '';
 $news['page_prev'] = '';
 // pagination - no LIMIT, no ORDER BY
 if ($news['news_paginate'] == 1) {
     // count all news based on current query
     if ($news['news_joined_sql']) {
         $news['count_all'] = count(_dbQuery($news['sql_joined_count'] . $sql . $news['sql_limit']));
     } else {
         $news['count_all'] = _dbCount($news['sql_count'] . $sql);
         // handle skipped items
         if ($news['news_skip']) {
             $news['count_all'] = $news['count_all'] - $news['news_skip'];
             if ($news['count_all'] < 0) {
                 $news['count_all'] = 0;
             }
         }
         // check if less news should be used than news in db
         if ($news['news_limit'] && $news['news_limit'] < $news['count_all']) {
             $news['count_all'] = $news['news_limit'];
         }
     }
     // test and set page
     if (empty($_getVar['newspage'])) {
         $news['current_page'] = 1;
Пример #8
0
     }
     $cart_mode = 'terms';
     include $phpwcms['modules']['shop']['path'] . 'inc/cart.items.inc.php';
     $order_process = str_replace('{ITEMS}', implode($_tmpl['term_space'], $cart_items), $order_process);
     $terms_text = _getConfig('shop_pref_terms', '_shopPref');
     $terms_format = _getConfig('shop_pref_terms_format', '_shopPref');
     $order_process = str_replace('{TERMS}', $terms_format ? $terms_text : nl2br(html($terms_text)), $order_process);
     include $phpwcms['modules']['shop']['path'] . 'inc/cart.parse.inc.php';
     include $phpwcms['modules']['shop']['path'] . 'inc/shipping.parse.inc.php';
 } elseif (isset($_POST['shop_order_submit']) && !isset($_SESSION[CART_KEY]['error']['step2'])) {
     // OK agreed - now send order
     if ($_tmpl['config']['order_number_style'] == 'RANDOM') {
         $order_num = generic_string(8, 2);
     } else {
         // count all current orders
         $order_num = _dbCount('SELECT COUNT(*) FROM ' . DB_PREPEND . 'phpwcms_shop_orders') + 1;
         if (strpos($_tmpl['config']['order_number_style'], '%') !== FALSE) {
             $order_num = sprintf($_tmpl['config']['order_number_style'], $order_num);
         }
     }
     // prepare customer mail
     $order_process = $_tmpl['mail_customer'];
     foreach ($_SESSION[CART_KEY]['step1'] as $item_key => $row) {
         $order_process = render_cnt_template($order_process, $item_key, html($row));
     }
     $cart_mode = 'mail1';
     include $phpwcms['modules']['shop']['path'] . 'inc/cart.items.inc.php';
     $order_process = str_replace('{ITEMS}', implode(LF . LF, $cart_items), $order_process);
     include $phpwcms['modules']['shop']['path'] . 'inc/cart.parse.inc.php';
     $order_process = str_replace('{ORDER}', $order_num, $order_process);
     $order_process = render_cnt_date($order_process, time());
Пример #9
0
function get_structurelevel_single_article_alias($article_cid = 0)
{
    if (!is_intval($article_cid)) {
        return '';
    }
    global $content;
    if (empty($content['struct'][$article_cid]['acat_articlecount'])) {
        $sql = 'SELECT COUNT(article_id) FROM ' . DB_PREPEND . 'phpwcms_article ';
        $sql .= 'WHERE article_cid=' . $article_cid . ' AND article_aktiv=1 AND article_deleted=0';
        if (!PREVIEW_MODE) {
            $sql .= ' AND article_begin < NOW() AND article_end > NOW()';
        }
        $content['struct'][$article_cid]['acat_articlecount'] = _dbCount($sql);
    }
    // reset article alias/ID
    if ($content['struct'][$article_cid]['acat_articlecount'] === 1) {
        return empty($content['struct'][$article_cid]['acat_alias']) ? 'id=' . $article_cid : $content['struct'][$article_cid]['acat_alias'];
    }
    return '';
}
Пример #10
0
}
if (isset($_SESSION['filter_shop_products']) && is_array($_SESSION['filter_shop_products']) && count($_SESSION['filter_shop_products'])) {
    $_entry['filter_array'] = array();
    foreach ($_SESSION['filter_shop_products'] as $_entry['filter']) {
        //usr_name, usr_login, usr_email
        $_entry['filter_array'][] = "CONCAT(\tshopprod_ordernumber, \tshopprod_model,\t\t\tshopprod_name1,\n\t\t\t\t\t\t\t\t\t\t\t\tshopprod_name2,\t\t\tshopprod_tag,\t\t\t(shopprod_price+' '),\n\t\t\t\t\t\t\t\t\t\t\t\tshopprod_description1,\tshopprod_description2,\tshopprod_description3\n\t\t\t\t\t\t\t\t\t\t\t) LIKE '%" . aporeplace($_entry['filter']) . "%'";
    }
    if (count($_entry['filter_array'])) {
        $_SESSION['filter_shop_products'] = ' AND (' . implode(' OR ', $_entry['filter_array']) . ')';
        $_entry['query'] .= $_SESSION['filter_shop_products'];
    }
} elseif (isset($_SESSION['filter_shop_products']) && is_string($_SESSION['filter_shop_products'])) {
    $_entry['query'] .= $_SESSION['filter_shop_products'];
}
// paginating values
$_entry['count_total'] = _dbCount('SELECT COUNT(shopprod_id) FROM ' . DB_PREPEND . 'phpwcms_shop_products WHERE ' . $_entry['query']);
$_entry['pages_total'] = ceil($_entry['count_total'] / $_SESSION['list_count']);
if ($_SESSION['detail_page'] > $_entry['pages_total']) {
    $_SESSION['detail_page'] = empty($_entry['pages_total']) ? 1 : $_entry['pages_total'];
}
?>
<h1 class="title" style="margin-bottom:10px"><?php 
echo $BLM['listing_title'];
?>
</h1>

<div class="navBarLeft imgButton chatlist">
	&nbsp;&nbsp;
	<a href="<?php 
echo shop_url(array('controller=prod', 'edit=0'));
?>
Пример #11
0
    }
    if (isset($_SESSION['redirect_filter']) && is_array($_SESSION['redirect_filter']) && count($_SESSION['redirect_filter'])) {
        $_entry['filter_array'] = array();
        foreach ($_SESSION['redirect_filter'] as $_entry['filter']) {
            // search in alias/target fields
            $_entry['filter_array'][] = "CONCAT(alias, target) LIKE '%" . _dbEscape($_entry['filter'], false) . "%'";
        }
        if (count($_entry['filter_array'])) {
            $_SESSION['redirect_filter'] = ' AND (' . implode(' OR ', $_entry['filter_array']) . ')';
            $_entry['query'] .= $_SESSION['redirect_filter'];
        }
    } elseif (isset($_SESSION['redirect_filter']) && is_string($_SESSION['redirect_filter'])) {
        $_entry['query'] .= $_SESSION['redirect_filter'];
    }
    // paginating values
    $_entry['count_total'] = _dbCount('SELECT COUNT(rid) FROM ' . DB_PREPEND . 'phpwcms_redirect WHERE ' . $_entry['query']);
    $_entry['pages_total'] = ceil($_entry['count_total'] / $_SESSION['redirect_list_count']);
    if ($_SESSION['redirect_detail_page'] > $_entry['pages_total']) {
        $_SESSION['redirect_detail_page'] = empty($_entry['pages_total']) ? 1 : $_entry['pages_total'];
    }
    $_entry['limit'] = $_entry['pages_total'] > 1 ? ($_SESSION['redirect_detail_page'] - 1) * $_SESSION['redirect_list_count'] . ',' . $_SESSION['redirect_list_count'] : '';
    // now retrieve all articles
    $result = _dbGet('phpwcms_redirect', '*, UNIX_TIMESTAMP(changed) AS timestamp', $_entry['query'], '', 'changed DESC, views DESC', $_entry['limit']);
    ?>
	<h1 class="title"><?php 
    echo $BL['be_links'] . ' &amp; ' . $BL['be_redirects'];
    ?>
</h1>

	<form action="phpwcms.php?do=admin&amp;p=14" method="post" style="margin-bottom:1em;">
		<input type="hidden" name="do_pagination" value="1" /><?php 
Пример #12
0
 } else {
     $udata['user_login'] = $_SESSION[$_loginData['session_key'] . '_userdata']['login'];
     if (!empty($udata['user_password']) && strlen($udata['user_password']) < 4) {
         $uerror['user_password'] = '******';
     } elseif ($udata['user_password'] !== $udata['user_password2']) {
         $uerror['user_password'] = '******';
     }
 }
 $sql = 'SELECT COUNT(*) FROM ' . DB_PREPEND . "phpwcms_userdetail WHERE ";
 $sql .= "detail_login != '" . aporeplace($udata['user_login']) . "' AND ";
 $sql .= "detail_email = '" . aporeplace(strtolower($udata['user_email'])) . "'";
 if (empty($udata['user_email'])) {
     $uerror['user_email'] = 'E-Mail muss ausgef&uuml;llt werden';
 } elseif (!is_valid_email($udata['user_email'])) {
     $uerror['user_email'] = 'E-Mail muss valide sein';
 } elseif (_dbCount($sql)) {
     $uerror['user_email'] = 'E-Mail bereits registriert';
 }
 if (empty($udata['user_tel'])) {
     $uerror['user_tel'] = '@@Phone is required@@';
 } elseif (preg_match('/[^0-9\\+\\-\\(\\) ]/', $udata['user_tel'])) {
     $uerror['user_tel'] = '@@Only integers, spaces, parentheses, + or - are allowed@@';
 }
 if (empty($udata['user_name'])) {
     $uerror['user_name'] = '@@Name is required@@';
 }
 if (empty($udata['user_firstname'])) {
     $uerror['user_firstname'] = '@@First name is required@@';
 }
 if (empty($udata['user_street'])) {
     $uerror['user_street'] = '@@Street is required@@';
Пример #13
0
                </tr>
                <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
              </table></td>
          </tr>

          	<tr>
          		<td align="right" class="chatlist tdtop6 nowrap"><?php 
        echo $BL['be_structform_select_cp'];
        ?>
:&nbsp;</td>
          		<td class="checkbox-list v11">
          <?php 
        $has_allowed_cp = isset($set_allowed_cp) ? count($set_allowed_cp) : 0;
        foreach ($wcs_content_type as $key => $value) {
            // count used CPs so it is easier to decide if needed or not
            $used_count = _dbCount('SELECT COUNT(*) FROM ' . DB_PREPEND . 'phpwcms_articlecontent WHERE acontent_trash=0 AND acontent_type=' . _dbEscape($key));
            ?>

          			<label>
          				<input type="checkbox" name="allowed_cp[<?php 
            echo $key;
            ?>
]" value="<?php 
            echo $key;
            ?>
"<?php 
            if (!$has_allowed_cp || isset($set_allowed_cp[$key])) {
                ?>
 checked="checked"<?php 
            }
            ?>
Пример #14
0
 function countAll()
 {
     $sql = 'SELECT COUNT(cnt_id) FROM ' . DB_PREPEND . 'phpwcms_content WHERE ';
     $sql .= "cnt_module = 'news'" . $this->_where();
     $this->news_total = _dbCount($sql);
     return $this->news_total;
 }
Пример #15
0
function phpwcms_revision_r514()
{
    $status = true;
    // do former revision check – fallback to r509
    if (phpwcms_revision_check_temp('509') !== true) {
        $status = phpwcms_revision_check('509');
    }
    // Delete
    // empty temp images table
    _dbQuery('DROP TABLE IF EXISTS ' . DB_PREPEND . 'phpwcms_imgcache', 'DROP');
    // empty temp images directory
    $thumbnails = returnFileListAsArray(PHPWCMS_THUMB, 'jpg,jpeg,gif,png');
    if (is_array($thumbnails) && count($thumbnails)) {
        foreach ($thumbnails as $thumbnail) {
            @unlink(PHPWCMS_THUMB . $thumbnail['filename']);
        }
    }
    // Set file hash
    $result = _dbQuery("SHOW FIELDS FROM " . DB_PREPEND . "phpwcms_file WHERE Field='f_hash'");
    if ($status && !empty($result[0])) {
        // Remove unused fields but only when file storage upgrade from earlier update is done
        $count = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_file LIKE 'f_thumb_%'", 'COUNT_SHOW');
        if ($count === 2) {
            $count = _dbCount("SELECT * FROM " . DB_PREPEND . "phpwcms_file WHERE f_thumb_list != '' OR f_thumb_preview != ''");
            if ($count === 0) {
                _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file DROP f_thumb_list", 'ALTER');
                _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file DROP f_thumb_preview", 'ALTER');
                $status = true;
            } else {
                $status = false;
            }
        }
        $result = array_change_key_case($result[0], CASE_LOWER);
        if ($status && $result['type'] == 'varchar(50)') {
            $status = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file CHANGE f_hash f_hash VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
            // ensure all went well
            if ($status) {
                $result = _dbQuery("SHOW FIELDS FROM " . DB_PREPEND . "phpwcms_file WHERE Field='f_hash'");
                $status = false;
                if (!empty($result[0])) {
                    $result = array_change_key_case($result[0], CASE_LOWER);
                    if ($result['type'] == 'varchar(255)') {
                        $status = true;
                    }
                }
            }
        }
        // Rename Hash and files
        if ($status) {
            // Cleanup first — Check all files trashed or deleted and not yet physical accessible anymore
            $files = _dbGet('phpwcms_file', '*', 'f_trash IN (8,9) AND f_kid=1');
            if (isset($files[0]['f_id'])) {
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': Prepare removing non-existing, trashed or deleted files from phpwcms_file database table' . LF, 'a');
                $file_id = array();
                foreach ($files as $file) {
                    $file['storage_name'] = $file['f_hash'];
                    if ($file['f_ext']) {
                        $file['storage_name'] .= '.' . $file['f_ext'];
                    }
                    if (!is_file(PHPWCMS_STORAGE . $file['storage_name'])) {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': ' . json_encode($file) . LF, 'a');
                        $file_id[] = $file['f_id'];
                    }
                }
                $file_id = implode(',', $file_id);
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': File IDs to be deleted (' . $file_id . ')', 'a');
                if ($file_id) {
                    $result = _dbQuery('DELETE FROM ' . DB_PREPEND . 'phpwcms_file WHERE f_trash IN (8,9) AND f_kid=1 AND f_id IN (' . $file_id . ')', 'DELETE');
                    if (!empty($result['AFFECTED_ROWS'])) {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', ' // DONE: ' . $result['AFFECTED_ROWS'] . ' deleted', 'a');
                    } else {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', ' // DONE: None deleted', 'a');
                    }
                }
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', LF . LF . '---' . LF . LF, 'a');
            }
            // ToDo: implement new naming
        }
    } else {
        $status = false;
    }
    return $status;
}