Example #1
0
function module_sheet()
{
    global $global, $smarty;
    $cat = get_global('cat');
    $page = get_global('page');
    $prefix = 'data/mod-sheet';
    if ($cat) {
        $prefix = $prefix . '/cat-' . $cat;
    }
    $url = S_SERVER_URL . '?/data/cat-' . $cat . '/page-' . $page . '/index.html';
    $str = file_get_contents($url);
    $result = json_decode(rawurldecode($str), true);
    if (is_array($result)) {
        $server_cat_list = $result['cat_list'];
        $sheet = $result['sheet'];
        for ($i = 0; $i < count($sheet); $i++) {
            $obj = new article();
            $obj->set_where("art_title = '" . $sheet[$i]['art_title'] . "'");
            if ($obj->get_count()) {
                $sheet[$i]['is_exist'] = 1;
            } else {
                $sheet[$i]['is_exist'] = 0;
            }
        }
        $smarty->assign('page_sum', $result['page_sum']);
        $smarty->assign('prefix', $prefix);
    } else {
        $server_cat_list = array();
        $sheet = array();
    }
    $smarty->assign('article', $sheet);
    $cat_list = get_local_cat();
    if (count($cat_list) < count($server_cat_list)) {
        for ($i = 0; $i < count($server_cat_list); $i++) {
            $flag = false;
            for ($j = 0; $j < count($cat_list); $j++) {
                if ($server_cat_list[$i]['cat_id'] == $cat_list[$j]['server_id']) {
                    $flag = true;
                    if ($server_cat_list[$i]['cat_name'] != $cat_list[$j]['server_name']) {
                        $val = $server_cat_list[$i]['cat_id'] . '|' . $server_cat_list[$i]['cat_name'] . '|' . $cat_list[$i]['channel_id'] . '|' . $cat_list[$i]['cat_id'];
                        $obj = new varia();
                        $obj->set_value('var_value', $val);
                        $obj->set_where('var_id = ' . $cat_list[$i]['varia_id']);
                        $obj->edit();
                    }
                    break;
                }
            }
            if (!$flag) {
                $val = $server_cat_list[$i]['cat_id'] . '|' . $server_cat_list[$i]['cat_name'] . '|0|0';
                $obj = new varia();
                $obj->set_value('var_name', 'data_cat');
                $obj->set_value('var_value', $val);
                $obj->add();
            }
        }
        $cat_list = get_local_cat();
    }
    $smarty->assign('cat_list', $cat_list);
}
function rex_generateArticle($id, $refresh = 0)
{
    global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N;
    // artikel generieren
    // vorraussetzung: articel steht schon in der datenbank
    //
    // -> infos schreiben -> abhaengig von clang
    // --> artikel infos / einzelartikel metadaten
    // --> artikel content / einzelartikel content
    // --> listen generieren // wenn startpage = 1
    // ---> artikel liste
    // ---> category liste
    // --> cache loeschen
    // --------------------------------------------------- generiere generated/articles/xx.article
    $CL = $REX[CLANG];
    reset($CL);
    for ($i = 0; $i < count($CL); $i++) {
        $clang = key($CL);
        $REX[RC] = true;
        // keine Ausgabe als eval(CONTENT) sondern nur speichern in datei
        $CONT = new article();
        $CONT->setCLang($clang);
        $CONT->setArticleId($id);
        $article_content = "?>" . $CONT->getArticle();
        // --------------------------------------------------- Artikelparameter speichern
        $article = "<?\n" . "\n\$REX[ART][{$id}][article_id][{$clang}] = \"{$id}\";" . "\n\$REX[ART][{$id}][re_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("re_id")) . "\";" . "\n\$REX[ART][{$id}][name][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][catname][{$clang}] = \"" . rex_addslashes($CONT->getValue("catname")) . "\";" . "\n\$REX[ART][{$id}][cattype][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][alias][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][description][{$clang}] = \"" . rex_addslashes($CONT->getValue("description")) . "\";" . "\n\$REX[ART][{$id}][attribute][{$clang}] = \"" . rex_addslashes($CONT->getValue("attribute")) . "\";" . "\n\$REX[ART][{$id}][file][{$clang}] = \"" . rex_addslashes($CONT->getValue("file")) . "\";" . "\n\$REX[ART][{$id}][type_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("type_id")) . "\";" . "\n\$REX[ART][{$id}][teaser][{$clang}] = \"" . rex_addslashes($CONT->getValue("teaser")) . "\";" . "\n\$REX[ART][{$id}][startpage][{$clang}] = \"" . rex_addslashes($CONT->getValue("startpage")) . "\";" . "\n\$REX[ART][{$id}][prior][{$clang}] = \"" . rex_addslashes($CONT->getValue("prior")) . "\";" . "\n\$REX[ART][{$id}][path][{$clang}] = \"" . rex_addslashes($CONT->getValue("path")) . "\";" . "\n\$REX[ART][{$id}][status][{$clang}] = \"" . rex_addslashes($CONT->getValue("status")) . "\";" . "\n\$REX[ART][{$id}][online_from][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_from")) . "\";" . "\n\$REX[ART][{$id}][online_to][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_to")) . "\";" . "\n\$REX[ART][{$id}][createdate][{$clang}] = \"" . rex_addslashes($CONT->getValue("createdate")) . "\";" . "\n\$REX[ART][{$id}][updatedate][{$clang}] = \"" . rex_addslashes($CONT->getValue("updatedate")) . "\";" . "\n\$REX[ART][{$id}][keywords][{$clang}] = \"" . rex_addslashes($CONT->getValue("keywords")) . "\";" . "\n\$REX[ART][{$id}][template_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("template_id")) . "\";" . "\n\$REX[ART][{$id}][createuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("createuser")) . "\";" . "\n\$REX[ART][{$id}][updateuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("updateuser")) . "\";" . "\n\$REX[ART][{$id}][last_update_stamp][{$clang}] = \"" . time() . "\";" . "\n?>";
        if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", "w")) {
            fputs($fp, $article);
            fclose($fp);
            @chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", 0777);
        } else {
            $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
        }
        // --------------------------------------------------- Artikelcontent speichern
        if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", "w")) {
            fputs($fp, $article_content);
            fclose($fp);
            @chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", 0777);
        } else {
            $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
        }
        if ($MSG != "") {
            echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$MSG}</td></tr></table>";
        }
        $REX[RC] = false;
        // --------------------------------------------------- Listen generieren
        if ($CONT->getValue("startpage") == 1) {
            rex_generateLists($id);
            rex_generateLists($CONT->getValue("re_id"));
        } else {
            rex_generateLists($CONT->getValue("re_id"));
        }
        next($CL);
    }
    // --------------------------------------------------- recache all
    $Cache = new Cache();
    $Cache->removeAllCacheFiles();
}
Example #3
0
 public function get_champs()
 {
     $obj_article = new article("champ");
     $obj_article->fields = "id,titre,filtre1";
     $result = $obj_article->query();
     foreach ($result as $row) {
         $this->list_champs[$row["id"]] = $row["titre"];
         if ($row["filtre1"] == "1") {
             $this->list_champ_crypte[] = $row["id"];
         }
     }
 }
Example #4
0
 public function req_article($name)
 {
     $obj_article = new article($name);
     $obj_article->fields = "id,titre";
     $obj_article->orderby = "titre ASC";
     if (isset($this->id)) {
         $obj_article->where = "id=" . $this->id;
     } else {
         $obj_article->limit = "1";
     }
     $this->result = $obj_article->query();
 }
Example #5
0
function module_new_article()
{
    global $smarty;
    $obj = new article();
    $obj->set_field('art_id,art_channel_id,art_title,art_add_time');
    $obj->set_page_size(10);
    $list = $obj->get_list();
    for ($i = 0; $i < count($list); $i++) {
        $list[$i]['channel'] = get_data('channel', $list[$i]['art_channel_id'], 'cha_code');
        $list[$i]['short_title'] = cut_str($list[$i]['art_title'], 16);
    }
    $smarty->assign('new_article', $list);
}
Example #6
0
function module_tailor_sheet()
{
    global $global, $smarty;
    $obj = new varia();
    $obj->set_where("var_name = 'tailor_data_cat'");
    $list = $obj->get_list();
    if (count($list)) {
        for ($i = 0; $i < count($list); $i++) {
            $arr = explode('|', $list[$i]['var_value']);
            $cat_list[$i]['server_id'] = $arr[0];
            $cat_list[$i]['server_name'] = $arr[1];
        }
    } else {
        $cat_list = array();
    }
    $smarty->assign('cat_list', $cat_list);
    $data_username = rawurlencode(get_varia('data_username'));
    $data_password = rawurlencode(get_varia('data_password'));
    $cat = get_global('cat');
    $page = get_global('page');
    $prefix = 'data/mod-tailor_sheet';
    $page_sum = 1;
    $sheet = array();
    if ($cat) {
        $prefix = $prefix . '/cat-' . $cat;
    }
    $url = S_SERVER_URL . 'tailor.php?/tailor/cat-' . $cat . '/page-' . $page . '/data_username-' . $data_username . '/data_password-' . $data_password . '/index.html';
    $str = file_get_contents($url);
    $result = json_decode(rawurldecode($str), true);
    if (is_array($result)) {
        if ($result['error'] == 'no') {
            $sheet = $result['sheet'];
            for ($i = 0; $i < count($sheet); $i++) {
                $obj = new article();
                $obj->set_where("art_title = '" . $sheet[$i]['art_title'] . "'");
                if ($obj->get_count()) {
                    $sheet[$i]['is_exist'] = 1;
                } else {
                    $sheet[$i]['is_exist'] = 0;
                }
            }
            $page_sum = $result['page_sum'];
        }
    }
    $smarty->assign('page_sum', $page_sum);
    $smarty->assign('prefix', $prefix);
    $smarty->assign('article', $sheet);
}
Example #7
0
 /**
  * 后台主页信息
  */
 public function actionSystemmain()
 {
     $SYS = array('PHP版本:' => $_SERVER['SERVER_SOFTWARE'], '当前系统类型:' => php_uname('s'), 'PHP运行方式:' => php_sapi_name(), '服务器域名:' => $_SERVER['SERVER_NAME'], '服务器端口:' => $_SERVER['SERVER_PORT'], '北京时间:' => date('Y年m月d日 H:i:s', time()));
     $count = array('会员总数:' => Account::model()->count('id!=:ID', array(':ID' => 0)), '文章总数:' => article::model()->count('id!=:ID', array(':ID' => 0)), '评论总数:' => Comments::model()->count('id!=:ID', array(':ID' => 0)));
     $Role = Role::model()->find('id=:ID', array(':ID' => Yii::app()->session['USER_ACCOUNT']['roleId']));
     $basic = array('权限级别:' => $Role->name);
     $this->render('Systemmain', array('SYS' => $SYS, 'Info' => $count, 'basic' => $basic));
 }
Example #8
0
function module_sheet()
{
    global $global, $smarty;
    $prefix = $global['channel'] . '/mod-sheet';
    if (isset($global['field'])) {
        $prefix = $prefix . '/field-' . $global['field'];
    }
    if (isset($global['key'])) {
        $prefix = $prefix . '/key-' . $global['key'];
    }
    $obj = new article();
    $obj->set_where('art_channel_id = ' . $global['channel_id']);
    if (isset($global['key'])) {
        $obj->set_where($global['field'] . " like '%" . url_decode($global['key']) . "%'");
    }
    $obj->set_page_size(10);
    $obj->set_page_num($global['page']);
    $sheet = $obj->get_sheet();
    for ($i = 0; $i < count($sheet); $i++) {
        $sheet[$i]['cat_name'] = get_data('cat_art', $sheet[$i]['art_cat_id'], 'cat_name');
    }
    set_link($obj->get_page_sum());
    $smarty->assign('article', $sheet);
    $smarty->assign('prefix', $prefix);
}
Example #9
0
function getTexte($id)
{
    global $thisSite;
    //  $mySelect = new mySelect(__FILE__);
    //	$mySelect->tables=$thisSite->PREFIXE_TBL_GEN . "textes";
    //	$mySelect->fields="texte";
    //	$mySelect->where="id=:id AND lg=:lg";
    //	$mySelect->whereValue["id"]=array($id,PDO::PARAM_STR);
    //	$mySelect->whereValue["lg"]=array($thisSite->current_lang,PDO::PARAM_STR);
    //	$result=$mySelect->query();
    //	$row = current($result);
    //	return stripslashes($row["texte"]);
    $obj_article = new article("textes");
    $obj_article->where = "id=" . $id . "  AND lg='" . $thisSite->current_lang . "'";
    $result = $obj_article->query();
    $row = current($result);
    return $row;
}
Example #10
0
function module_edit()
{
    global $global, $smarty;
    $obj = new article();
    $obj->set_where('art_id = ' . $global['id']);
    $one = $obj->get_one();
    $smarty->assign('article', $one);
    $smarty->assign('editor_text', $one['art_text']);
    $list = array();
    $obj = new cat_art();
    $obj->set_where('cat_channel_id = ' . $global['channel_id']);
    $arr = $obj->get_list();
    if (count($arr) > 0) {
        $list = $obj->set_cat_order($arr);
    }
    $smarty->assign('cat_list', $list);
    $smarty->assign('upl_date', date('Ymd'));
}
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $article = article::findorfail($id);
     $tags = $article->gettags;
     $tagName = null;
     foreach ($tags as $tag) {
         $tagName .= $tag->name . ',';
     }
     return view('articles.edit', compact('article', 'tagName'));
 }
Example #12
0
 /**
  * Führt Prüfung durch, ob Artikel bearbeitet werden kann
  * @param \fpcm\model\articles\article $article
  * @return boolean
  */
 public function checkEditPermissions(article &$article)
 {
     if ($this->permissions === false) {
         return true;
     }
     $isAdmin = \fpcm\classes\baseconfig::$fpcmSession->getCurrentUser()->isAdmin();
     $permEditAll = $this->permissions->check(array('article' => 'editall'));
     $permEditOwn = $this->permissions->check(array('article' => 'edit'));
     if ($isAdmin || $permEditAll) {
         $article->setEditPermission(true);
         return true;
     }
     if (!$isAdmin && !$permEditAll && $permEditOwn && $article->getCreateuser() == \fpcm\classes\baseconfig::$fpcmSession->getUserId()) {
         $article->setEditPermission(true);
         return true;
     }
     $article->setEditPermission(false);
     return true;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(User $user)
 {
     $article = article::with('ArticleCategories')->where('user_id', $user->id)->get();
     $checkArticle = $article->isEmpty();
     //dd($article);
     if (\Auth::check()) {
         $url = str_contains($this->checkloginpage($user->name), \Auth::user()->name);
     } else {
         $url = false;
     }
     return view('userArticle.index', compact('user', 'article', 'url', 'checkArticle'));
 }
Example #14
0
function module_article_list()
{
    global $smarty;
    $obj = new cat_art();
    $obj->set_where('cat_best = 1');
    $best_cat = $obj->get_list();
    $art_list = array();
    if (count($best_cat) > 0) {
        $smarty->assign('show_all_art', 0);
        $list_len = get_varia('index_art_list_len');
        for ($i = 0; $i < count($best_cat); $i++) {
            $cat_id = $best_cat[$i]['cat_id'];
            $best_cat[$i]['channel'] = get_data('channel', $best_cat[$i]['cat_channel_id'], 'cha_code');
            $family = implode(',', get_cat_family('cat_art', $cat_id));
            $obj = new article();
            $obj->set_field('art_id,art_title,art_add_time');
            $obj->set_where("art_cat_id in ({$family})");
            $obj->set_page_size($list_len ? $list_len : 5);
            $list = $obj->get_list();
            for ($j = 0; $j < count($list); $j++) {
                $list[$j]['short_title'] = cut_str($list[$j]['art_title'], 22);
            }
            $art_list[$cat_id] = $list;
            unset($obj);
        }
        $smarty->assign('best_art_cat', $best_cat);
        $smarty->assign('art_list', $art_list);
    } else {
        $smarty->assign('show_all_art', 1);
    }
}
Example #15
0
function module_search_main()
{
    global $global, $smarty;
    $global['key'] = url_decode($global['key']);
    $list_len = get_varia('art_list_len');
    $obj = new article();
    $obj->set_field('art_id,art_channel_id,art_title,art_add_time');
    $obj->set_where("art_title like '%" . $global['key'] . "%'");
    $obj->set_page_size($list_len ? $list_len : 20);
    $obj->set_page_num($global['page']);
    $sheet = $obj->get_sheet();
    for ($i = 0; $i < count($sheet); $i++) {
        $sheet[$i]['channel'] = get_data('channel', $sheet[$i]['art_channel_id'], 'cha_code');
        $sheet[$i]['short_title'] = cut_str($sheet[$i]['art_title'], 42);
    }
    set_link($obj->get_page_sum());
    $smarty->assign('search', $sheet);
}
Example #16
0
 function addPage()
 {
     system::setParam("page", "addPage");
     article::getAllCats();
     $fill = array();
     $doRedirect = false;
     if (!empty($_POST["slug"])) {
         $fill["slug"] = core::generateSlug($_POST["slug"]);
     } else {
         if (!empty($_POST["title"])) {
             $fill["slug"] = core::generateSlug($_POST["title"]);
         }
     }
     $fill += $_POST;
     if (isset($_POST["picRealUpload"])) {
         $uploadedPics = blog::uploadOnePicture($fill["slug"]);
     }
     $fill["poster"] = "";
     if (isset($_FILES["poster"]) && $_FILES["poster"]["error"] == 0) {
         $uploadedPics = blog::uploadOnePicture($fill["slug"], "articleImages");
         if (isset($uploadedPics["poster"]) && $uploadedPics["poster"]) {
             $fill["poster"] = serialize($uploadedPics["poster"]);
         }
     }
     if (isset($_POST["savePost"])) {
         $savedPost = blog::writePost($fill, "article");
         if ($savedPost) {
             $doRedirect = true;
         }
     }
     blog::showAttachedPics($fill);
     $this->smarty->assign("fill", $fill);
     if ($doRedirect) {
         system::redirect(system::param("urlBase") . "listPage");
     }
 }
Example #17
0
 * 负责处理新发表文章的逻辑
 * Createed By C860 at 2014-1-19
 */
if (!class_exists('sys')) {
    include_once '../conf/config.php';
}
//需要登录
sys::needLog('../login.php');
//检测数据合法性
if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['content']) && !empty($_POST['content']) && isset($_POST['tags']) && !empty($_POST['tags'])) {
    //引入相关模型类
    include_once '../Models/article.php';
    include_once '../Models/tag_relate_article.php';
    include_once '../Models/user_info.php';
    $currentTime = date('Y-m-d H:i:s');
    //新增文章
    if (article::add($_POST['title'], $_POST['content'], $currentTime, $_SESSION['userId'])) {
        $ID = article::getId($_POST['title'], $_SESSION['userId'], $currentTime);
        $tags = explode('|', $_POST['tags']);
        foreach ($tags as $tag) {
            tag_relate_article::add($tag, $ID);
        }
        user_info::increaseArticleCount($_SESSION['userId']);
        sys::alert('发表成功!');
        sys::redirect('../index.php');
    }
} else {
    //引入相关模型类
    include_once 'Models/tag.php';
    $taglist = tag::getAllTags();
}
Example #18
0
if (isset($_POST["visibilite"])) {
    $visibilite = true;
} else {
    $visibilite = false;
}
if (isset($_FILES["file"])) {
    // Traitement des données
    // spécifier le chemin vers le répertoir des images
    $dossier = '../../../images/';
    // permet de récupérer le nom du fichier
    $fichier = basename($_FILES['file']['name']);
    // permet de récuperer l'extension du fichier et le transformer en minuscule
    $extension = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION));
    if ($extension == "jpg" || $extension == "png" || $extension == "gif") {
        if (move_uploaded_file($_FILES['file']['tmp_name'], $dossier . md5($fichier) . "." . $extension)) {
            $imageUploaded = md5($fichier) . "." . $extension;
            echo 'Upload effectué avec succès !';
        } else {
            echo 'Echec de l\'upload !';
        }
    } else {
        echo "Erreur extention";
    }
}
$article = new article($titre, $date, $categorie, $_GET['id'], $contenu, $visibilite, $imageUploaded);
$resultat = $article->savearticle();
if ($resultat == true) {
    echo "<br/>Article crée avec succès";
} else {
    echo "<br/>Echec de création";
}
if (isset($_POST['id'])) {
    $article = $db->selectObject('article', 'id=' . $_POST['id']);
    if ($article != null) {
        $loc = unserialize($article->location_data);
    }
} else {
    $article->rank = $db->max('article', 'rank', 'location_data', "location_data='" . serialize($loc) . "'");
    if ($article->rank == null) {
        $article->rank = 0;
    } else {
        $article->rank += 1;
    }
}
if (pathos_permissions_check("manage", $loc)) {
    $oldcatid = $article->category_id;
    $article = article::update($_POST, $article);
    $article->location_data = serialize($loc);
    if (isset($_POST['categories'])) {
        $article->category_id = $_POST['categories'];
    }
    if (isset($article->id)) {
        $article->id = $db->updateObject($article, "article");
    } else {
        $article->id = $db->insertObject($article, "article");
    }
    articlemodule::spiderContent($article);
    if ($oldcatid != $article->category_id) {
        $db->decrement('article', 'rank', 1, "location_data='" . serialize($loc) . "' AND rank > " . $article->rank . " AND category_id=" . $article->category_id);
    }
    pathos_flow_redirect();
} else {
Example #20
0
 /**
  *  添加文章
  */
 public function actionAddarc()
 {
     if ($_POST) {
         $article = new article();
         $article->title = $_POST['titles'];
         $article->article = $_POST['Html'];
         $article->cataId = $_POST['cata'];
         $article->remark = substr(strip_tags($_POST['info']), 0, 150);
         $article->time = date('Y-m-d H:i:s', time());
         $article->creater = Yii::app()->session['USER_ACCOUNT']['id'];
         $article->save(false);
         if ($AID = $article->attributes['id']) {
             foreach ($_POST['Tags'] as $key => $value) {
                 CActiveRecord::$db->createCommand()->insert('tagsasarticle', array('articleId' => $AID, 'tagsId' => $value, 'time' => date('Y-m-d H:i:s', time())));
             }
             exit('文章发表成功!');
         }
     }
     /**
      * 查询出分类列表
      */
     $Sql = 'SELECT * FROM `catalog`';
     $QueryRow = CActiveRecord::$db->createCommand($Sql)->queryAll();
     $QueryRow = $this->SelectdOrder($QueryRow, 0, 0);
     $this->ArrayToObject($QueryRow);
     /**
      * 查询出tags标签信息
      */
     $Sql = 'Select * from `tags` limit 0,8';
     $Tags = CACtiveRecord::$db->createCommand($Sql)->queryAll();
     $this->ArrayToObject($Tags);
     $this->render('insert', array('SelectAll' => $QueryRow, 'tagsbox' => $Tags));
 }
Example #21
0
// Sollte immer false bleiben
$REX['REDAXO'] = false;
// Wenn $REX[GG] = true; dann wird der
// Content aus den redaxo/include/generated/
// genommen
$REX['GG'] = true;
// setzte pfad und includiere klassen und funktionen
$REX['HTDOCS_PATH'] = "./";
include "./redaxo/include/master.inc.php";
// Starte einen neuen Artikel und setzte die aktuelle
// artikel id. wenn nicht vorhanden, nimm einen
// speziellen artikel. z.b. fehler seite oder home seite
if (!isset($article_id) or $article_id == '') {
    $article_id = $REX['START_ARTICLE_ID'];
}
$REX_ARTICLE = new article();
$REX_ARTICLE->setCLang($clang);
if ($REX_ARTICLE->setArticleId($article_id)) {
    echo $REX_ARTICLE->getArticleTemplate();
} elseif ($REX_ARTICLE->setArticleId($REX['NOTFOUND_ARTICLE_ID'])) {
    echo $REX_ARTICLE->getArticleTemplate();
} else {
    echo 'Kein Startartikel selektiert / No starting Article selected. Please click here to enter <a href="redaxo/index.php">redaxo</a>';
    $REX['STATS'] = 0;
}
// ----- caching end für output filter
$CONTENT = ob_get_contents();
ob_end_clean();
// ----- EXTENSION POINT
$CONTENT = rex_register_extension_point('OUTPUT_FILTER', $CONTENT);
// ----- EXTENSION POINT - keine Manipulation der Ausgaben ab hier (read only)
function generateArticle($id)
{
    global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N;
    // --------------------------------------------------- generiere generated/articles/xx.article
    $REX[RC] = true;
    // Generiere Content
    $CONT = new article();
    $CONT->setArticleId($id);
    $REX[TEMP] = $REX[BF];
    $REX[BF] = false;
    $article_content = "?>" . $CONT->getArticle();
    $REX[BF] = true;
    $article_bcontent = "?>" . $CONT->getArticle();
    $REX[BF] = $REX[TEMP];
    $article = "<?\r\n\r\n\$REX[ART][{$id}][name] = \"" . addslashes($CONT->getValue("name")) . "\";\r\n\$REX[ART][{$id}][beschreibung] = \"" . addslashes($CONT->getValue("beschreibung")) . "\";\r\n\$REX[ART][{$id}][suchbegriffe] = \"" . addslashes($CONT->getValue("suchbegriffe")) . "\";\r\n\$REX[ART][{$id}][category_id] = \"" . addslashes($CONT->getValue("category_id")) . "\";\r\n\$REX[ART][{$id}][article_id] = \"{$id}\";\r\n\$REX[ART][{$id}][type_id] = \"" . addslashes($CONT->getValue("type_id")) . "\";\r\n\$REX[ART][{$id}][file] = \"" . addslashes($CONT->getValue("file")) . "\";\r\n\$REX[ART][{$id}][startpage] = \"" . addslashes($CONT->getValue("startpage")) . "\";\r\n\$REX[ART][{$id}][prio] = \"" . addslashes($CONT->getValue("prio")) . "\";\r\n\$REX[ART][{$id}][path] = \"" . addslashes($CONT->getValue("path")) . "\";\r\n\$REX[ART][{$id}][online_von] = \"" . addslashes($CONT->getValue("online_von")) . "\";\r\n\$REX[ART][{$id}][online_bis] = \"" . addslashes($CONT->getValue("online_bis")) . "\";\r\n\$REX[ART][{$id}][erstelldatum] = \"" . addslashes($CONT->getValue("erstelldatum")) . "\";\r\n\$REX[ART][{$id}][template_id] = \"" . addslashes($CONT->getValue("template_id")) . "\";\r\n\$REX[ART][{$id}][status] = \"" . addslashes($CONT->getValue("status")) . "\";\r\n\r\n?>";
    // Artikelparameter speichern
    if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/" . $id . ".article", "w")) {
        fputs($fp, $article);
        fclose($fp);
    } else {
        $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
    }
    // Artikelcontent speichern
    if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/" . $id . ".content", "w")) {
        fputs($fp, $article_content);
        fclose($fp);
    } else {
        $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
    }
    // Artikel B content speichern [BARRIEREFREI]
    if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/" . $id . ".bcontent", "w")) {
        fputs($fp, $article_bcontent);
        fclose($fp);
    } else {
        $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "generated/articles/";
    }
    if ($MSG != "") {
        echo "\t<table border=0 cellpadding=5 cellspacing=1 width=770>\r\n\t\t\t<tr><td class=warning>{$MSG}</td></tr>\r\n\t\t\t</table>";
    }
    $REX[RC] = false;
}
Example #23
0
function module_article_main()
{
    global $global, $smarty;
    if (!$global['id']) {
        $art_best = get_global('best');
        $prefix = get_data('channel', $global['channel_id'], 'cha_code');
        $list_len = get_varia('art_list_len');
        $obj = new article();
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        if ($global['cat']) {
            $family = implode(',', get_cat_family('cat_art', $global['cat']));
            $obj->set_where("art_cat_id in ({$family})");
            $prefix .= '/cat-' . $global['cat'];
        }
        if ($art_best) {
            $obj->set_where('art_best = 1');
            $prefix .= '/best-1';
        }
        $obj->set_page_size($list_len ? $list_len : 20);
        $obj->set_page_num($global['page']);
        $sheet = $obj->get_sheet();
        for ($i = 0; $i < count($sheet); $i++) {
            $sheet[$i]['short_title'] = cut_str($sheet[$i]['art_title'], 42);
        }
        set_link($obj->get_page_sum());
        $smarty->assign('show_sheet', 1);
        $smarty->assign('article', $sheet);
        $smarty->assign('prefix', $prefix);
    } else {
        $obj = new article();
        $obj->set_field('art_id,art_title,art_author,art_add_time,art_text');
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        $obj->set_where('art_id = ' . $global['id']);
        $one = $obj->get_one();
        $smarty->assign('article', $one);
        $obj = new article();
        $obj->set_field('art_id,art_title');
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        $obj->set_where('art_id < ' . $global['id']);
        $one = $obj->get_one();
        if (count($one)) {
            $smarty->assign('next_id', $one['art_id']);
            $smarty->assign('next_title', cut_str($one['art_title'], 15));
        } else {
            $smarty->assign('next_id', '');
            $smarty->assign('next_title', '');
        }
        $obj = new article();
        $obj->set_field('art_id,art_title');
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        $obj->set_where('art_id > ' . $global['id']);
        $obj->set_order('');
        $obj->set_order('art_top', 'asc');
        $obj->set_order('art_index', 'asc');
        $obj->set_order('art_id', 'asc');
        $one = $obj->get_one();
        if (count($one)) {
            $smarty->assign('prev_id', $one['art_id']);
            $smarty->assign('prev_title', cut_str($one['art_title'], 15));
        } else {
            $smarty->assign('prev_id', '');
            $smarty->assign('prev_title', '');
        }
        $obj = new varia();
        $smarty->assign('share_code', im_filter($obj->get_value('share_code', true)));
        $smarty->assign('show_sheet', 0);
    }
}
Example #24
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
require DT_ROOT . '/module/' . $module . '/common.inc.php';
$MG['article_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback');
require DT_ROOT . '/include/post.func.php';
include load($module . '.lang');
include load('my.lang');
require MD_ROOT . '/article.class.php';
$do = new article($moduleid);
if (in_array($action, array('add', 'edit'))) {
    $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php');
    if ($FD) {
        require DT_ROOT . '/include/fields.func.php';
    }
    isset($post_fields) or $post_fields = array();
    $CP = $MOD['cat_property'];
    if ($CP) {
        require DT_ROOT . '/include/property.func.php';
    }
    isset($post_ppt) or $post_ppt = array();
}
$sql = $_userid ? "username='******'" : "ip='{$DT_IP}'";
$limit_used = $limit_free = $need_password = $need_captcha = $need_question = $fee_add = 0;
if (in_array($action, array('', 'add'))) {
    $r = $db->get_one("SELECT COUNT(*) AS num FROM {$table} WHERE {$sql} AND status>1");
    $limit_used = $r['num'];
    $limit_free = $MG['article_limit'] > $limit_used ? $MG['article_limit'] - $limit_used : 0;
}
switch ($action) {
    case 'add':
Example #25
0
// si validation du formulaire
if ($__POST["actionForm"] != "") {
    $formMaj->set_datas();
}
$newfield = new hidden();
$newfield->field = "id_parent";
$newfield->multiLang = false;
$newfield->defaultValue = $idParent;
$newfield->add();
$newfield = new input();
$newfield->field = "titre";
$newfield->multiLang = true;
$newfield->label = "Titre (si différent du type)";
$newfield->add();
// on charge tout les types de texte
$obj_article = new article("type_texte_itineraire");
$obj_article->fields = "id,titre";
$result = $obj_article->query();
$tab_type_texte_itineraire = array();
foreach ($result as $row) {
    $tab_type_texte_itineraire[$row["id"]] = $row["titre"];
}
// on charge les types de texte utilisés
$mySelect = new mySelect(__FILE__);
$mySelect->tables = $myTable;
$mySelect->fields = "type_texte";
$mySelect->where = "actif=1 AND lg='fr' and id_parent=" . $idParent;
$result = $mySelect->query();
$tab_type_texte = array();
foreach ($result as $row) {
    $tab_type_texte[] = $row["type_texte"];
Example #26
0
include_once "../../../init.php";
accessAuth();
// Récupérer le nom de l'utilisateur
$userTitre = $_SESSION['auth']['titre'];
$SessionIdType = $_SESSION['auth']['id_type'];
if (isset($__GET['id'])) {
    // Traitement du paramètre passer en GET
    // Doit etre uniquement un entier
    $id = intval($__GET['id']);
    $var_field_id = "id_categorie";
    // Récupérer les éléments par rapport à l'id catégorie passé en GET
    include "../element/elements.php";
    // Récupérer une valeur du projet par rapport à son titre dans l'ordre croissant
    $listprojets = array();
    foreach ($tabElement as $Kelem => $Velem) {
        $obj_article = new article("projet");
        $obj_article->fields = "id,titre";
        $obj_article->where = "actif=1 AND id=" . $Velem['id_projet'];
        $listprojets[$Kelem] = $obj_article->query();
    }
    //echoa($listprojets);
    $projets = array();
    foreach ($listprojets as $kListProjet => $vListProjet) {
        foreach ($listprojets[$kListProjet] as $Kprojet => $Vprojet) {
            $projets[] = array('titre' => $Vprojet['titre']);
        }
    }
    // Récupérer les catégories par rapport aux éléments donnée par la requête $tabElement
    include "../element/categories.php";
    if (!empty($list_element)) {
        // Récupérer les champs
Example #27
0
            $Cache->printCacheFile();
            if ($REX[CACHING_DEBUG]) {
                print "<br>CachedVersion<br>";
            }
            if ($REX[CACHING_DEBUG]) {
                print "Script time: " . showScripttime();
            }
            $SHOWARTICLE = false;
        } else {
            // start caching
            $Cache->startCacheFile();
        }
    }
}
if ($SHOWARTICLE) {
    $REX_ARTICLE = new article();
    $REX_ARTICLE->setCLang($clang);
    if ($REX_ARTICLE->setArticleId($article_id)) {
        $REX_ARTICLE->getArticleTemplate();
    } elseif ($REX_ARTICLE->setArticleId($REX[STARTARTIKEL_ID])) {
        $REX_ARTICLE->getArticleTemplate();
    } else {
        echo "Kein Startartikel selektiert / No starting Article selected. Please click here to enter <a href=redaxo/index.php>redaxo</a>";
        $REX[STATS] = 0;
    }
    //////////////////////////////////////////////
    // advanced caching
    //////////////////////////////////////////////
    if ($Cache->makeCacheFile) {
        $Cache->writeCacheFile();
        if ($REX[CACHING_DEBUG]) {
Example #28
0
 /**
  * Cnews::recycle()
  * 
  * @param integer $id
  * @param mixed $value
  * @return
  */
 function isolate_recycle($id = 0, $value)
 {
     if ($id != 0) {
         $news = new article($id);
         if (!$news->exists()) {
             show_404();
         }
         $news->recycle = ($news->recycle + 1) % 2;
         $news->save();
         $news->unset_home();
         if ($news->recycle == 1) {
             flash_message('success', "Xóa thành công.");
         } else {
             flash_message('success', "Phục hồi thành công.");
         }
     } else {
         $arr = $this->input->post('checkinput');
         foreach ($arr as $row) {
             $news = new article($row);
             $id = $news->id;
             $news->recycle = $value;
             $news->save();
             $news->unset_home();
             $news->clear();
         }
         if ($value == 1) {
             flash_message('success', "Xóa thành công.");
         } else {
             flash_message('success', "Phục hồi thành công.");
         }
     }
     $n = new Article($id);
     $newscatalogue = $n->newscatalogue;
     $this->session->set_userdata(array(config_item('session_admin') . 'menu_current' => $newscatalogue->navigation));
     if (empty($newscatalogue->menu_active)) {
         $dis['menu_active'] = "Tin";
     } else {
         $dis['menu_active'] = $newscatalogue->menu_active;
     }
     redirect($this->admin . "cnews/isolate_list_by_cat/" . $newscatalogue->id);
 }
/**
 * Generiert alle *.article u. *.content Dateien eines Artikels/einer Kategorie
 * 
 * @param $id ArtikelId des Artikels, der generiert werden soll 
 * @param $refreshall Boolean Bei True wird der Inhalte auch komplett neu generiert, bei False nur die Metainfos
 */
function rex_generateArticle($id, $refreshall = true)
{
    global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N;
    // artikel generieren
    // vorraussetzung: articel steht schon in der datenbank
    //
    // -> infos schreiben -> abhaengig von clang
    // --> artikel infos / einzelartikel metadaten
    // --> artikel content / einzelartikel content
    // --> listen generieren // wenn startpage = 1
    // ---> artikel liste
    // ---> category liste
    // --------------------------------------------------- generiere generated/articles/xx.article
    $CL = $REX['CLANG'];
    reset($CL);
    for ($i = 0; $i < count($CL); $i++) {
        $clang = key($CL);
        $REX['RC'] = true;
        // keine Ausgabe als eval(CONTENT) sondern nur speichern in datei
        $CONT = new article();
        $CONT->setCLang($clang);
        $CONT->setArticleId($id);
        // --------------------------------------------------- Artikelparameter speichern
        $article = "<?php\n" . "\n\$REX['ART']['{$id}']['article_id']['{$clang}'] = \"{$id}\";" . "\n\$REX['ART']['{$id}']['re_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("re_id")) . "\";" . "\n\$REX['ART']['{$id}']['name']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['catname']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("catname")) . "\";" . "\n\$REX['ART']['{$id}']['cattype']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['alias']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['description']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("description")) . "\";" . "\n\$REX['ART']['{$id}']['attribute']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("attribute")) . "\";" . "\n\$REX['ART']['{$id}']['file']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("file")) . "\";" . "\n\$REX['ART']['{$id}']['type_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("type_id")) . "\";" . "\n\$REX['ART']['{$id}']['teaser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("teaser")) . "\";" . "\n\$REX['ART']['{$id}']['startpage']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("startpage")) . "\";" . "\n\$REX['ART']['{$id}']['prior']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("prior")) . "\";" . "\n\$REX['ART']['{$id}']['path']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("path")) . "\";" . "\n\$REX['ART']['{$id}']['status']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("status")) . "\";" . "\n\$REX['ART']['{$id}']['online_from']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("online_from")) . "\";" . "\n\$REX['ART']['{$id}']['online_to']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("online_to")) . "\";" . "\n\$REX['ART']['{$id}']['createdate']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("createdate")) . "\";" . "\n\$REX['ART']['{$id}']['updatedate']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("updatedate")) . "\";" . "\n\$REX['ART']['{$id}']['keywords']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("keywords")) . "\";" . "\n\$REX['ART']['{$id}']['template_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("template_id")) . "\";" . "\n\$REX['ART']['{$id}']['createuser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("createuser")) . "\";" . "\n\$REX['ART']['{$id}']['updateuser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("updateuser")) . "\";" . "\n\$REX['ART']['{$id}']['last_update_stamp']['{$clang}'] = \"" . time() . "\";" . "\n?>";
        if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", "w")) {
            fputs($fp, $article);
            fclose($fp);
            @chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", 0777);
        } else {
            $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/";
        }
        // --------------------------------------------------- Artikelcontent speichern
        if ($refreshall) {
            if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", "w")) {
                $article_content = "?>" . $CONT->getArticle();
                fputs($fp, $article_content);
                fclose($fp);
                @chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", 0777);
            } else {
                $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/";
            }
        }
        if (isset($MSG) and $MSG != "") {
            echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$MSG}</td></tr></table>";
        }
        $REX['RC'] = false;
        // --------------------------------------------------- Listen generieren
        if ($CONT->getValue("startpage") == 1) {
            rex_generateLists($id);
            rex_generateLists($CONT->getValue("re_id"));
        } else {
            rex_generateLists($CONT->getValue("re_id"));
        }
        next($CL);
    }
}
Example #30
0
 if (isset($message) and $message != "") {
     echo "<tr><td align=center class=warning><img src=pics/warning.gif width=16 height=16 vspace=4></td><td class=warning>&nbsp;&nbsp;{$message}</td><td class=lgrey>&nbsp;</td></tr>";
 }
 if (isset($_REQUEST["msg"]) and $_REQUEST["msg"] != "") {
     echo "<tr><td align=center class=warning><img src=pics/warning.gif width=16 height=16 vspace=4></td><td class=warning>&nbsp;&nbsp;" . $_REQUEST["msg"] . "</td><td class=lgrey>&nbsp;</td></tr>";
 }
 echo "  <tr>\n          <td class=lgrey>&nbsp;</td>\n          <td valign=top class=lblue>";
 if ($mode == "edit") {
     if (!isset($slice_id)) {
         $slice_id = '';
     }
     if (!isset($function)) {
         $function = '';
     }
     // ------------------------------------------ START: MODULE EDITIEREN/ADDEN ETC.
     $CONT = new article();
     $CONT->setArticleId($article_id);
     $CONT->setSliceId($slice_id);
     $CONT->setMode($mode);
     $CONT->setCLang($clang);
     $CONT->setCType($ctype);
     $CONT->setEval(TRUE);
     $CONT->setFunction($function);
     eval("?>" . $CONT->getArticle());
     // ------------------------------------------ END: MODULE EDITIEREN/ADDEN ETC.
 } elseif ($mode == "meta") {
     // ------------------------------------------ START: META VIEW
     $extens = "";
     if (isset($save) and $save == "1") {
         $meta_sql = new sql();
         $meta_sql->setTable($REX['TABLE_PREFIX'] . "article");