本文整理汇总了PHP中CBdd类的典型用法代码示例。如果您正苦于以下问题:PHP CBdd类的具体用法?PHP CBdd怎么用?PHP CBdd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBdd类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_footer
static function get_footer() {
$footer = CBdd::select_row("select * from footer where etat = 1");
if(!is_array($footer)) {
$footer['text'] = self::get_text_default();
}
return $footer;
}
示例2: __construct
function __construct($id_page = 0, $id_art = 0, $id_cat = 0) {
if($id_page) {
$sql = 'SELECT nom, text, description, keywords FROM page WHERE id = ' . $id_page;
$meta= CBdd::select_row($sql);
$this->title = $meta['nom'];
$keywords_default = $meta['keywords'] ? $meta['keywords'] : self::formate_to_keywords($meta['text']);
$description_default = substr(self::formate_to_description($meta['text']) . '. ' . ucwords(str_replace(',', '', $keywords_default)), 0, 254);
$this->description = $meta['description'] ? $meta['description'] : $description_default;
$this->keywords = $meta['keywords'] ? $meta['keywords'] : $keywords_default;
}
elseif($id_art) {
$sql = 'SELECT nom, nom as description, nom as keywords FROM article WHERE id = ' . $id_art;
$meta= CBdd::select_row($sql);
$this->title = $meta['nom'];
$this->description = $meta['description'] ? $meta['description'] : $meta['nom'];
$this->keywords = $meta['keywords'] ? $meta['keywords'] : $meta['nom'];
}
elseif($id_cat) {
$sql = 'SELECT nom, nom as description, nom as keywords FROM categorie WHERE id = ' . $id_cat;
$meta= CBdd::select_row($sql);
$this->title = $meta['nom'];
$this->description = $meta['description'] ? $meta['description'] : $meta['nom'];
$this->keywords = $meta['keywords'] ? $meta['keywords'] : $meta['nom'];
}
}
示例3: send
static function send($destinataire) {
$expediteur = CBdd::select_one("SELECT email FROM user WHERE type = 2", "email");
$id_texte = CConfiguration::get_valeur('WELCOME_TEXT_ID');
$sql_texte_select = "SELECT * FROM texte WHERE id = " . $id_texte;
$texte = CBdd::select_row($sql_texte_select);
$sql_user = "SELECT * FROM user WHERE email = '" . $destinataire . "'";
$user = CBdd::select_row($sql_user);
$message = str_replace('$NOM', $user['nom'], $texte['text']);
$message = str_replace('$PRENOM', $user['prenom'], $message);
//echo $message;
$sujet = $texte['nom'];
$sql_unicite_message = "SELECT id FROM email WHERE destinataire = '" . addslashes($destinataire) . "' AND nom = '" . addslashes($sujet) . "'";
// echo $sql_unicite_message;
if(CBdd::select_one($sql_unicite_message, 'id')) {
return 1;
}
$sql_email_insert = "INSERT INTO email(expediteur, destinataire, nom, text, etat) VALUES ('" . addslashes($expediteur) . "', '" . addslashes($destinataire) . "', '" . addslashes($sujet) . "', '" . addslashes($message) . "', '2')";
CBdd::insert($sql_email_insert);
return CMail::send_mail($destinataire, CFonction::force_stripslashes($sujet), CFonction::force_stripslashes($message), $expediteur, array(), 'Bcc: ' . $expediteur);
}
示例4: GetRSS
function GetRSS()
{
$this->checkValues();
$rssValue = "<?xml version=\"1.0\"?>\r\n";
$rssValue .= "<rss version=\"2.0\">\r\n";
$rssValue .= "<channel>\r\n";
$rssValue .= "<title>" . $this->channelTitle . "</title>\r\n";
$rssValue .= "<link>" . $this->channelLink . "</link>\r\n";
$rssValue .= "<description>" . $this->channelDesc . "</description>\r\n";
$rssValue .= "<image>\r\n";
$rssValue .= "<title>" . $this->imageTitle . "</title>\r\n";
$rssValue .= "<url>" . $this->imageURL . "</url>\r\n";
$rssValue .= "<link>" . $this->imageLink . "</link>\r\n";
$rssValue .= "</image>\r\n";
$sql = "SELECT * FROM page WHERE etat = 1 ORDER BY date DESC";
$res = CBdd::select($sql);
while($page = mysql_fetch_array($res))
{
$rssValue .= "<item>\r\n";
$rssValue .= "<title>" . $page['nom'] . "</title>\r\n";
$rssValue .= "<description>" . $page['description'] . "</description>\r\n";
$rssValue .= "<link>" .htmlentities(CUrl::get_href('page', $page['id'], $page['nom'])). "</link>\r\n";
$rssValue .= "</item>\r\n";
}
$rssValue .= "</channel>\r\n";
$rssValue .= "</rss>\r\n";
return $rssValue;
}
示例5: create
function create($sitemap_name = '') {
if(!$sitemap_name) $sitemap_name = SS_ADMIN_TO_USERFILE . "/sitemap.xml";
if(empty($sitemap_name)) $sitemap_name = "sitemap_" . $rep_name . ".xml";
$changefreq = array('daily', 'weekly', 'monthly');
$priority = array('0.1', '0.5', '1.0');
$tab_archive = array();
rsort($tab_archive);
$xml = simplexml_load_file(SS_ADMIN_TO_USERFILE . '/google/sitemap_base.xml');
//scan bdd
$sql = "SELECT * FROM page WHERE etat = 1";
$res = CBdd::select($sql);
while($page = mysql_fetch_array($res)) {
$url = $xml->addChild('url');
$url->addChild('loc', CUrl::get_urlsite() . "/" . CFunction::formate_chaine(utf8_decode($page['nom']), '-') . "_p" . $page['id']. ".html");
$url->addChild('lastmod', CDate::formate_date($page['date']));
$url->addChild('changefreq', $changefreq[rand(0, 2)]);
$url->addChild('priority', $priority[rand(0, 2)]);
}
$html = $xml->asXML();
file_put_contents($sitemap_name, $html);
}
示例6: get_keyword
function get_keyword() {
$sql = "(SELECT nom FROM artiste ORDER BY rand() LIMIT 5) UNION (SELECT nom FROM chanson ORDER BY rand() LIMIT 5)";
$res = CBdd::select($sql);
$keyword = "klip, gasy, clip, malagasy, chanson, chant, dago, malagasy, hira, vari�t�";
while($word = mysql_fetch_array($res)) {
$keyword .= "," . $word['nom'];
}
return $keyword;
}
示例7: get_option
static function get_option($selectedvalue, $tablename, $colvaluename="id", $colvuename="nom", $where=1) {
$option = "";
$sql = "SELECT " . $colvaluename . ", " . $colvuename . " FROM " . $tablename . " WHERE " . $where . " ORDER BY " . $colvuename;
$result = CBdd::select($sql);
while($array = mysql_fetch_array($result)) {
$selected = CForm::get_selected($selectedvalue, $array[$colvaluename]);
$option = $option . "<option value='" . $array[$colvaluename] . "'" . $selected . ">" . ucfirst(utf8_encode(substr($array[$colvuename], 0, 16))) . "</option>\n";
}
return $option;
}
示例8: get_design
static function get_design() {
$design = CBdd::select_row("select * from design where etat = 1");
if(!is_array($design)) {
$design['imgbando'] = "bando.jpg";
$design['text'] = self::get_text_default();
$design['couleur1'] = "#dd8753";
$design['couleur2'] = "#133087";
}
return $design;
}
示例9: get_option
static function get_option($selectedvalue, $idconfiguration) {
$option = "";
$sql = "SELECT choix FROM configuration WHERE id = " . $idconfiguration;
$result = CBdd::select_one($sql, "choix");
$choix_possible = explode('|', $result);
foreach($choix_possible as $valeur) {
$selected = CForm::get_selected($selectedvalue, $valeur);
$option = $option . "<option value='" . $valeur . "'" . $selected . ">" . $valeur . "</option>\n";
}
return $option;
}
示例10: show_db_content
function show_db_content($arr_type=array('table', 'function', 'procedure')) {
$arr_content = array();
foreach($arr_type as $type) {
$sql = "SHOW " . $type . " STATUS";
$res = CBdd::select($sql);
while($content = mysql_fetch_array($res)) {
if($type == 'table') $key = 0; else $key = 1;
array_push($arr_content, $content[$key]);
}
}
return $arr_content;
}
示例11: get_down
static function get_down($tablename, $id, $actif=0) {
if($actif) {
$sql = "select isendrang_" . $tablename . "(" . $id . ") as ok";
$res = CBdd::select_one($sql, 'ok');
$ret = ($res!=1) ? "<a href=?id=$id&a=1><img src='../img/downarrow.png' alt='down' /></a>" : "";
} else {
$sql = "select isendrang_" . $tablename . "(" . $id . ") as ok";
$res = CBdd::select_one($sql, 'ok');
$ret = ($res!=1) ? "<img src='../img/downarrow.png' alt='down' class='grise'/>" : "";
}
return $ret;
}
示例12: test_ficgrpmail_in_campagne
public static function test_ficgrpmail_in_campagne($iType=0,$iId=0){
$zSql = " ";
$zSql .= " SELECT id_groupe FROM campagne ";
if($iType == 2){
$zSql .= " INNER JOIN email ON ( email.id_campagne = campagne.id ) ";
$zSql .= " INNER JOIN moul_groupes ON ( moul_groupes.id = email.id_groupe) ";
$zSql .= " WHERE email.id_groupe = " . $iId . " AND email.type_groupe = " . $iType;
$oRes = CBdd::select_one($zSql,'id_groupe');
if($oRes) return 1;
else return 0;
}
}
示例13: load
function load($message_number) {
$sql_0 = "INSERT INTO email(id, nom, text, expediteur, destinataire, date, imap) VALUES ";
$sql_1 = "";
$info = $this->get_info($message_number);
$sql_1 = "(null, '". addslashes($info['subject']) . "', '" . addslashes($this->get_text($message_number)) . "', '". $info['from'] . "', '". $info['to'] . "', '". $this->formate_date($info['date']) . "', '". $info['message_id'] . "'),";
$sql = $sql_1 ? trim($sql_0 . $sql_1, ",") : "";
if($sql) {
return CBdd::insert($sql);
} else {
return false;
}
}
示例14: get_elements
static function get_elements() {
//recuperer l'id des questions
$sql = "SELECT id FROM question WHERE etat = 1 ORDER BY rang";
$res = CBdd::select($sql);
$html = "";
//boucler sur les elements
$i=1;
while($question = mysql_fetch_array($res)) {
$html .= "<p>" . self::get_element($question['id'], $i) . "</p>";
$i++;
}
return $html;
}
示例15: delete_user
function delete_user($md5_id) {
$sql = "SELECT email FROM user WHERE md5(id) = '".$md5_id."'";
$user_email = CBdd::select_one($sql, 'email');
$sql = "SELECT * FROM email WHERE destinataire LIKE '%".$email."%'";
$result = CBdd::select($sql);
$count = mysql_num_rows($result);
if(count($count)) {
while($email = mysql_fetch_array($result, MYSQL_ASSOC)) {
$destinataire = $email['destinataire'];
$destinataire = str_replace($user_email, '', $destinataire);
$destinataire = str_replace(array(',,', ';;', ';'), ",", $destinataire);
$email['destinataire'] = trim($destinataire, ',');
if(empty($destinataire)) {
$_email = new CTableEmail(array('id'=>$email['id']));
$_email->delete();
}
else {
//unset($email[id]);
$email['text'] = CFunction::addslashes($email['text']);
if(empty($email['id_campagne'])) {
$email['id_campagne'] = 0;
}
if(empty($email['id_groupe'])) {
$email['id_groupe'] = 0;
}
$_email = new CTableEmail($email);
$_email->update();
}
}
}
$sql = "DELETE FROM user WHERE md5(id) = '" . $md5_id . "'";
return CBdd::delete($sql);
}