コード例 #1
0
ファイル: lhfaq.php プロジェクト: Adeelgill/livehelperchat
 public static function getSession()
 {
     if (!isset(self::$persistentSession)) {
         self::$persistentSession = new ezcPersistentSession(ezcDbInstance::get(), new ezcPersistentCodeManager('./pos/lhfaq'));
     }
     return self::$persistentSession;
 }
コード例 #2
0
ファイル: delete.php プロジェクト: Adeelgill/livehelperchat
<?php

if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
    die('Invalid CSFR Token');
    exit;
}
$faq = erLhcoreClassFaq::getSession()->load('erLhcoreClassModelFaq', $Params['user_parameters']['id']);
erLhcoreClassFaq::getSession()->delete($faq);
erLhcoreClassModule::redirect('faq/list');
exit;
コード例 #3
0
ファイル: new.php プロジェクト: Adeelgill/livehelperchat
<?php

$faq = new erLhcoreClassModelFaq();
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.new', array('faq' => $faq));
$tpl = erLhcoreClassTemplate::getInstance('lhfaq/new.tpl.php');
if (isset($_POST['Save'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect();
        exit;
    }
    $Errors = erLhcoreClassFaq::validateFaq($faq);
    if (count($Errors) == 0) {
        $faq->saveThis();
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.created', array('faq' => &$faq));
        erLhcoreClassModule::redirect('faq/list');
        exit;
    } else {
        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['Cancel'])) {
    erLhcoreClassModule::redirect('faq/list');
    exit;
}
$tpl->set('faq', $faq);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('faq/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('faq/list', 'FAQ')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('faq/new', 'New question')));
コード例 #4
0
ファイル: faqwidget.php プロジェクト: p4prawin/livechat
} else {
    $defaultTheme = erLhcoreClassModelChatConfig::fetch('default_theme_id')->current_value;
    if ($defaultTheme > 0) {
        try {
            $theme = erLhAbstractModelWidgetTheme::fetch($defaultTheme);
            $Result['theme'] = $theme;
            $dynamic_url_append .= '/(theme)/' . $theme->id;
        } catch (Exception $e) {
        }
    }
}
if (!empty($dynamic_url_append)) {
    $tpl->set('dynamic_url_append', $dynamic_url_append);
}
// We use direct queries in this file, because of its complexity
$session = erLhcoreClassFaq::getSession();
$q = $session->database->createSelectQuery();
$q->select("COUNT(id)")->from("lh_faq");
$whereConditions = array();
$whereConditions[] = $q->expr->eq('active', 1);
$whereConditions[] = $q->expr->lOr($q->expr->eq('url', $q->bindValue('')), $q->expr->eq('url', $q->bindValue(trim($matchStringURL))), $q->expr->lAnd($q->expr->eq('is_wildcard', $q->bindValue(1)), $q->expr->like($session->database->quote(trim($matchStringURL)), 'concat(left(url,length(url)-1),\'%\')')));
if ($identifier != '') {
    $whereConditions[] = $q->expr->eq('identifier', $q->bindValue($identifier));
}
$q->where($whereConditions);
$stmt = $q->prepare();
$stmt->execute();
$result = $stmt->fetchColumn();
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('faq/faqwidget') . $dynamic_url_append;
$pages->items_total = $result;
コード例 #5
0
 public function removeThis()
 {
     erLhcoreClassFaq::getSession()->delete($this);
 }