当前位置: 首页>>代码示例>>PHP>>正文


PHP rex_sql::addGlobalUpdateFields方法代码示例

本文整理汇总了PHP中rex_sql::addGlobalUpdateFields方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::addGlobalUpdateFields方法的具体用法?PHP rex_sql::addGlobalUpdateFields怎么用?PHP rex_sql::addGlobalUpdateFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rex_sql的用法示例。


在下文中一共展示了rex_sql::addGlobalUpdateFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 static function syncCatname2Artname($params)
 {
     global $REX, $I18N;
     $id = $params['id'];
     $clang = $params['clang'];
     $name = $params['data']['catname'];
     if ($name != '') {
         $sql = new rex_sql();
         $sql->setTable($REX['TABLE_PREFIX'] . 'article');
         $sql->setWhere('id=' . $id . ' AND clang=' . $clang);
         $sql->setValue('name', $name);
         $sql->addGlobalUpdateFields();
         $sql->update();
         rex_deleteCacheArticle($id, $clang);
     }
 }
开发者ID:olien,项目名称:be_utilities,代码行数:16,代码来源:class.rex_articlename_sync.inc.php

示例2: save

 /**
  * @access public
  * @return Returns <code>true</code> on success or <code>false</code> on error
  */
 function save()
 {
     $sql = new rex_sql();
     $sql->setTable($this->_getTableName());
     $sql->setValue('re_id', $this->getParentId());
     $sql->setValue('name', $this->getName());
     $sql->setValue('path', $this->getPath());
     $sql->setValue('hide', $this->isHidden());
     if ($this->getId() !== null) {
         $sql->addGlobalUpdateFields();
         $sql->setWhere('id=' . $this->getId() . ' LIMIT 1');
         return $sql->update();
     } else {
         $sql->addGlobalCreateFields();
         return $sql->insert();
     }
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:21,代码来源:class.oomediacategory.inc.php

示例3: array

         } else {
             $message = $I18N->msg('content_error_movecategory');
         }
     } else {
         $message = $I18N->msg('no_rights_to_this_function');
     }
 }
 // ------------------------------------------ END: MOVE CATEGORY
 // ------------------------------------------ START: SAVE METADATA
 if (rex_post('savemeta', 'string')) {
     $meta_sql = new rex_sql();
     $meta_sql->setTable($REX['TABLE_PREFIX'] . "article");
     // $meta_sql->debugsql = 1;
     $meta_sql->setWhere("id='{$article_id}' AND clang={$clang}");
     $meta_sql->setValue('name', $meta_article_name);
     $meta_sql->addGlobalUpdateFields();
     if ($meta_sql->update()) {
         $article->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "article WHERE id='{$article_id}' AND clang='{$clang}'");
         $message = $I18N->msg("metadata_updated") . $message;
         rex_generateArticle($article_id);
         // ----- EXTENSION POINT
         $message = rex_register_extension_point('ART_META_UPDATED', $message, array('id' => $article_id, 'clang' => $clang, 'name' => $meta_article_name));
     } else {
         $message .= $meta_sql->getError();
     }
 }
 // ------------------------------------------ END: SAVE METADATA
 // ------------------------------------------ START: CONTENT HEAD MENUE
 $num_ctypes = count($REX['CTYPE']);
 $ctype_menu = '';
 if ($num_ctypes > 0) {
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:content.inc.php

示例4: save

 /**
  * @access public
  * @return Returns <code>true</code> on success or <code>false</code> on error
  */
 function save()
 {
     $sql = new rex_sql();
     $sql->setTable($this->_getTableName());
     $sql->setValue('re_file_id', $this->getParentId());
     $sql->setValue('category_id', $this->getCategoryId());
     $sql->setValue('filetype', $this->getType());
     $sql->setValue('filename', $this->getFileName());
     $sql->setValue('originalname', $this->getOrgFileName());
     $sql->setValue('filesize', $this->getSize());
     $sql->setValue('width', $this->getWidth());
     $sql->setValue('height', $this->getHeight());
     $sql->setValue('title', $this->getTitle());
     if ($this->getId() !== null) {
         $sql->addGlobalUpdateFields();
         $sql->setWhere('file_id=' . $this->getId() . ' LIMIT 1');
         return $sql->update();
     } else {
         $sql->addGlobalCreateFields();
         return $sql->insert();
     }
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:26,代码来源:class.oomedia.inc.php

示例5: rex_medienpool_saveMedia

/**
 * Holt ein upgeloadetes File und legt es in den Medienpool
 * Dabei wird kontrolliert ob das File schon vorhanden ist und es
 * wird eventuell angepasst, weiterhin werden die Fileinformationen übergeben
 *
 * @param $FILE
 * @param $rex_file_category
 * @param $FILEINFOS
 * @param $userlogin
*/
function rex_medienpool_saveMedia($FILE, $rex_file_category, $FILEINFOS, $userlogin = null)
{
    global $REX, $I18N;
    $rex_file_category = (int) $rex_file_category;
    $gc = new rex_sql();
    $gc->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file_category WHERE id=' . $rex_file_category);
    if ($gc->getRows() != 1) {
        $rex_file_category = 0;
    }
    $FILENAME = $FILE['name'];
    $FILESIZE = $FILE['size'];
    $FILETYPE = $FILE['type'];
    $NFILENAME = rex_medienpool_filename($FILENAME);
    $message = '';
    // ----- neuer filename
    $dstFile = $REX['MEDIAFOLDER'] . '/' . $NFILENAME;
    // ----- dateiupload
    $upload = true;
    if (!@move_uploaded_file($FILE['tmp_name'], $dstFile) && !@copy($FILE['tmp_name'], $dstFile)) {
        $message .= $I18N->msg("pool_file_movefailed");
        $ok = 0;
        $upload = false;
    }
    if ($upload) {
        chmod($dstFile, $REX['FILEPERM']);
        // get widht height
        $size = @getimagesize($dstFile);
        $FILESQL = new rex_sql();
        $FILESQL->setTable($REX['TABLE_PREFIX'] . 'file');
        $FILESQL->setValue('filetype', $FILETYPE);
        $FILESQL->setValue('title', $FILEINFOS['title']);
        $FILESQL->setValue('filename', $NFILENAME);
        $FILESQL->setValue('originalname', $FILENAME);
        $FILESQL->setValue('filesize', $FILESIZE);
        $FILESQL->setValue('width', $size[0]);
        $FILESQL->setValue('height', $size[1]);
        $FILESQL->setValue('category_id', $rex_file_category);
        // TODO Create + Update zugleich?
        $FILESQL->addGlobalCreateFields($userlogin);
        $FILESQL->addGlobalUpdateFields($userlogin);
        $FILESQL->insert();
        $ok = 1;
        $message .= $I18N->msg("pool_file_added");
    }
    $RETURN['title'] = $FILEINFOS['title'];
    $RETURN['width'] = $size[0];
    $RETURN['height'] = $size[1];
    $RETURN['type'] = $FILETYPE;
    $RETURN['msg'] = $message;
    $RETURN['ok'] = $ok;
    $RETURN['filename'] = $NFILENAME;
    $RETURN['old_filename'] = $FILENAME;
    return $RETURN;
}
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:64,代码来源:function_rex_generate.inc.php

示例6: stripslashes

     $IMOD->setValue('eingabe', $eingabe);
     $IMOD->setValue('ausgabe', $ausgabe);
     $IMOD->addGlobalCreateFields();
     $message = $IMOD->insert($I18N->msg('module_added'));
 } else {
     $modultyp->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'module where id=' . $modul_id);
     if ($modultyp->getRows() == 1) {
         $old_ausgabe = $modultyp->getValue('ausgabe');
         // $modultyp->setQuery("UPDATE ".$REX['TABLE_PREFIX']."modultyp SET name='$mname', eingabe='$eingabe', ausgabe='$ausgabe' WHERE id='$modul_id'");
         $UMOD = new rex_sql();
         $UMOD->setTable($REX['TABLE_PREFIX'] . 'module');
         $UMOD->setWhere('id=' . $modul_id);
         $UMOD->setValue('name', $mname);
         $UMOD->setValue('eingabe', $eingabe);
         $UMOD->setValue('ausgabe', $ausgabe);
         $UMOD->addGlobalUpdateFields();
         $message = $UMOD->update($I18N->msg('module_updated') . ' | ' . $I18N->msg('articel_updated'));
         $new_ausgabe = stripslashes($ausgabe);
         if ($old_ausgabe != $new_ausgabe) {
             // article updaten - nur wenn ausgabe sich veraendert hat
             $gc = new rex_sql();
             $gc->setQuery("SELECT DISTINCT(" . $REX['TABLE_PREFIX'] . "article.id) FROM " . $REX['TABLE_PREFIX'] . "article\r\n              LEFT JOIN " . $REX['TABLE_PREFIX'] . "article_slice ON " . $REX['TABLE_PREFIX'] . "article.id=" . $REX['TABLE_PREFIX'] . "article_slice.article_id\r\n              WHERE " . $REX['TABLE_PREFIX'] . "article_slice.modultyp_id='{$modul_id}'");
             for ($i = 0; $i < $gc->getRows(); $i++) {
                 rex_deleteCacheArticle($gc->getValue($REX['TABLE_PREFIX'] . "article.id"));
                 $gc->next();
             }
         }
     }
 }
 if (isset($goon) and $goon != '') {
     $save = 'nein';
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:module.modules.inc.php

示例7: array

    rex_generateArticle($id);
    // ----- EXTENSION POINT
    $amessage = rex_register_extension_point('ART_ADDED', $amessage, array('id' => $id, 'status' => 0, 'name' => $article_name, 're_id' => $category_id, 'prior' => $Position_New_Article, 'path' => $KATPATH, 'template_id' => $template_id));
} elseif (!empty($artedit_function) && $article_id != '' && $KATPERM) {
    // --------------------- ARTIKEL EDIT
    $Position_Article = (int) $Position_Article;
    if ($Position_Article == 0) {
        $Position_Article = 1;
    }
    $EA = new rex_sql();
    $EA->setTable($REX['TABLE_PREFIX'] . "article");
    $EA->setWhere("id='{$article_id}' and clang={$clang}");
    $EA->setValue('name', $article_name);
    $EA->setValue('template_id', $template_id);
    // $EA->setValue('path',$KATPATH);
    $EA->addGlobalUpdateFields();
    $EA->setValue('prior', $Position_Article);
    if ($EA->update()) {
        $amessage = $I18N->msg('article_updated');
        // ----- PRIOR
        rex_newArtPrio($category_id, $clang, $Position_Article, $thisArt->getValue('prior'));
        rex_generateArticle($article_id);
        // ----- EXTENSION POINT
        $amessage = rex_register_extension_point('ART_UPDATED', $amessage, array('id' => $article_id, 'status' => $thisArt->getValue('status'), 'name' => $article_name, 'clang' => $clang, 're_id' => $category_id, 'prior' => $Position_Article, 'path' => $KATPATH, 'template_id' => $template_id));
    } else {
        $amessage = $EA->getError();
    }
} elseif ($function == 'artdelete_function' && $article_id != '' && $KATPERM && !$REX_USER->hasPerm('editContentOnly[]')) {
    // --------------------- ARTIKEL DELETE
    $message = rex_deleteArticle($article_id);
    $re_id = $thisArt->getValue("re_id");
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:structure.inc.php

示例8: sort

$sel_extra->setId('userperm_extra');
if (isset($REX['EXTRAPERM'])) {
    sort($REX['EXTRAPERM']);
    $sel_extra->addArrayOptions($REX['EXTRAPERM'], false);
}
// --------------------------------- Title
rex_title($I18N->msg('title_user'), '');
// --------------------------------- FUNCTIONS
if (isset($FUNC_UPDATE) && $FUNC_UPDATE != '' || (isset($FUNC_APPLY) and $FUNC_APPLY != '')) {
    $loginReset = rex_request('logintriesreset', 'int');
    $userstatus = rex_request('userstatus', 'int');
    $updateuser = new rex_sql();
    $updateuser->setTable($REX['TABLE_PREFIX'] . 'user');
    $updateuser->setWhere('user_id=' . $user_id);
    $updateuser->setValue('name', $username);
    $updateuser->addGlobalUpdateFields();
    if ($REX['PSWFUNC'] != '' && $userpsw != $sql->getValue($REX['TABLE_PREFIX'] . 'user.psw')) {
        $userpsw = call_user_func($REX['PSWFUNC'], $userpsw);
    }
    $updateuser->setValue('psw', $userpsw);
    $updateuser->setValue('description', $userdesc);
    if ($loginReset == 1) {
        $updateuser->setValue('login_tries', '0');
    }
    if ($userstatus == 1) {
        $updateuser->setValue('status', 1);
    } else {
        $updateuser->setValue('status', 0);
    }
    $perm = '';
    if (isset($useradmin) and $useradmin == 1) {
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:user.inc.php

示例9:

     $faction->setValue('name', $name);
     $faction->setValue('preview', $previewaction);
     $faction->setValue('presave', $presaveaction);
     $faction->setValue('postsave', $postsaveaction);
     $faction->setValue('previewmode', $previewmode);
     $faction->setValue('presavemode', $presavemode);
     $faction->setValue('postsavemode', $postsavemode);
     if ($function == 'add') {
         $faction->addGlobalCreateFields();
         if ($faction->insert()) {
             $info = $I18N->msg('action_added');
         } else {
             $warning = $faction->getError();
         }
     } else {
         $faction->addGlobalUpdateFields();
         $faction->setWhere('id=' . $action_id);
         if ($faction->update()) {
             $info = $I18N->msg('action_updated');
         } else {
             $warning = $faction->getError();
         }
     }
     if (isset($goon) and $goon != '') {
         $save = 'nein';
     } else {
         $function = '';
     }
 }
 if ($save != '1') {
     if ($function == 'edit') {
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:module.action.inc.php

示例10: rex_medienpool_registerFile

function rex_medienpool_registerFile($physical_filename, $org_filename, $filename, $category_id, $title, $filesize, $filetype)
{
    global $REX, $REX_USER;
    $abs_file = $REX['MEDIAFOLDER'] . '/' . $physical_filename;
    if (!file_exists($abs_file)) {
        return false;
    }
    if (empty($filesize)) {
        $filesize = filesize($abs_file);
    }
    if (empty($filetype) && function_exists('mime_content_type')) {
        $filetype = mime_content_type($abs_file);
    }
    @chmod($abs_file, $REX['FILEPERM']);
    $filename = rex_medienpool_filename($filename, false);
    $org_filename = strtolower($org_filename);
    // Ggf Alte Datei umbennen
    rename($abs_file, $REX['MEDIAFOLDER'] . '/' . $filename);
    $abs_file = $REX['MEDIAFOLDER'] . '/' . $filename;
    // get widht height
    $size = @getimagesize($abs_file);
    $FILESQL = new rex_sql();
    // $FILESQL->debugsql=1;
    $FILESQL->setTable($REX['TABLE_PREFIX'] . "file");
    $FILESQL->setValue('filename', $filename);
    $FILESQL->setValue('originalname', $org_filename);
    $FILESQL->setValue('category_id', $category_id);
    $FILESQL->setValue('title', $title);
    $FILESQL->setValue('filesize', $filesize);
    $FILESQL->setValue('filetype', $filetype);
    $FILESQL->setValue('width', $size[0]);
    $FILESQL->setValue('height', $size[1]);
    // TODO Hier Update + Create zugleich?
    $FILESQL->addGlobalUpdateFields();
    $FILESQL->addGlobalCreateFields();
    $FILESQL->insert();
    return $FILESQL->getError() == '';
}
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:38,代码来源:medienpool.inc.php

示例11: rex_copyMeta

/**
 * Kopiert die Metadaten eines Artikels in einen anderen Artikel
 *
 * @param $from_id      ArtikelId des Artikels, aus dem kopiert werden (Quell ArtikelId)
 * @param $to_id        ArtikelId des Artikel, in den kopiert werden sollen (Ziel ArtikelId)
 * @param [$from_clang] ClangId des Artikels, aus dem kopiert werden soll (Quell ClangId)
 * @param [$to_clang]   ClangId des Artikels, in den kopiert werden soll (Ziel ClangId)
 * @param [$params]     Array von Spaltennamen, welche kopiert werden sollen
 */
function rex_copyMeta($from_id, $to_id, $from_clang = 0, $to_clang = 0, $params = array())
{
    global $REX, $REX_USER;
    $from_clang = (int) $from_clang;
    $to_clang = (int) $to_clang;
    $from_id = (int) $from_id;
    $to_id = (int) $to_id;
    if (!is_array($params)) {
        $params = array();
    }
    if ($from_id == $to_id && $from_clang == $to_clang) {
        return false;
    }
    $gc = new rex_sql();
    $gc->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='{$from_clang}' and id='{$from_id}'");
    if ($gc->getRows() == 1) {
        $uc = new rex_sql();
        // $uc->debugsql = 1;
        $uc->setTable($REX['TABLE_PREFIX'] . "article");
        $uc->setWhere("clang='{$to_clang}' and id='{$to_id}'");
        $uc->addGlobalUpdateFields();
        foreach ($params as $key => $value) {
            $var = $gc->getValue("{$value}");
            $uc->setValue("{$value}", $var);
        }
        $uc->update();
        rex_generateArticle($to_id, false);
        return true;
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:40,代码来源:function_rex_generate.inc.php

示例12: addslashes

     $TPL->setValue("content", $content);
     if ($function == "add") {
         $attributes = rex_setAttributes("ctype", $ctypes, "");
         $TPL->setValue("attributes", addslashes($attributes));
         $TPL->addGlobalCreateFields();
         if ($TPL->insert()) {
             $template_id = $TPL->getLastId();
             $message = $I18N->msg("template_added");
         } else {
             $message = $TPL->getError();
         }
     } else {
         $attributes = rex_setAttributes("ctype", $ctypes, $attributes);
         $TPL->setWhere("id='{$template_id}'");
         $TPL->setValue("attributes", addslashes($attributes));
         $TPL->addGlobalUpdateFields();
         $message = $TPL->update($I18N->msg("template_updated"));
     }
     // werte werden direkt wieder ausgegeben
     $templatename = stripslashes($templatename);
     $content = stripslashes($content);
     rex_deleteDir($REX['INCLUDE_PATH'] . "/generated/templates", 0);
     if (isset($goon) and $goon != "") {
         $function = "edit";
         $save = "nein";
     } else {
         $function = "";
     }
 }
 if (!isset($save) or $save != "ja") {
     echo '<a name="edit"></a>';
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:template.inc.php

示例13: rex_mediapool_updateMedia

/**
 * Holt ein upgeloadetes File und legt es in den Medienpool
 * Dabei wird kontrolliert ob das File schon vorhanden ist und es
 * wird eventuell angepasst, weiterhin werden die Fileinformationen übergeben
 *
 * @param $FILE
 * @param $rex_file_category
 * @param $FILEINFOS
 * @param $userlogin
*/
function rex_mediapool_updateMedia($FILE, &$FILEINFOS, $userlogin = null)
{
    global $REX, $I18N;
    $RETURN = array();
    $FILESQL = new rex_sql();
    // $FILESQL->debugsql = 1;
    $FILESQL->setTable($REX['TABLE_PREFIX'] . 'file');
    $FILESQL->setWhere('file_id=' . $FILEINFOS["file_id"]);
    $FILESQL->setValue('title', $FILEINFOS["title"]);
    $FILESQL->setValue('category_id', $FILEINFOS["rex_file_category"]);
    $msg = '';
    $updated = false;
    if ($_FILES['file_new']['name'] != '' && $_FILES['file_new']['name'] != 'none') {
        $ffilename = $_FILES['file_new']['tmp_name'];
        $ffiletype = $_FILES['file_new']['type'];
        $ffilesize = $_FILES['file_new']['size'];
        if ($ffiletype == $FILEINFOS["filetype"] || OOMedia::compareImageTypes($ffiletype, $FILEINFOS["filetype"])) {
            if (move_uploaded_file($ffilename, $REX['MEDIAFOLDER'] . '/' . $FILEINFOS["filename"]) || copy($ffilename, $REX['MEDIAFOLDER'] . '/' . $FILEINFOS["filename"])) {
                $RETURN["msg"] = $I18N->msg('pool_file_changed');
                $FILEINFOS["filetype"] = $ffiletype;
                $FILEINFOS["filesize"] = $ffilesize;
                $FILESQL->setValue('filetype', $FILEINFOS["filetype"]);
                // $FILESQL->setValue('originalname',$ffilename);
                $FILESQL->setValue('filesize', $FILEINFOS["filesize"]);
                if ($size = @getimagesize($REX['MEDIAFOLDER'] . '/' . $FILEINFOS["filename"])) {
                    $FILESQL->setValue('width', $size[0]);
                    $FILESQL->setValue('height', $size[1]);
                }
                @chmod($REX['MEDIAFOLDER'] . '/' . $FILEINFOS["filename"], $REX['FILEPERM']);
                $updated = true;
            } else {
                $RETURN["msg"] = $I18N->msg('pool_file_upload_error');
            }
        } else {
            $RETURN["msg"] = $I18N->msg('pool_file_upload_errortype');
        }
    }
    $RETURN["ok"] = 0;
    if (!isset($RETURN["msg"])) {
        $RETURN["msg"] = $I18N->msg('pool_file_infos_updated');
        $RETURN["filename"] = $FILEINFOS["filename"];
        $RETURN["filetype"] = $FILEINFOS["filetype"];
        $RETURN["file_id"] = $FILEINFOS["file_id"];
        $RETURN["ok"] = 1;
    }
    $FILESQL->addGlobalUpdateFields();
    $FILESQL->update();
    /*
    $RETURN['title'] = $FILEINFOS['title'];
    $RETURN['type'] = $FILETYPE;
    $RETURN['msg'] = $message;
    // Aus BC gruenden hier mit int 1/0
    $RETURN['ok'] = $success ? 1 : 0;
    $RETURN['filename'] = $NFILENAME;
    $RETURN['old_filename'] = $FILENAME;
    */
    return $RETURN;
}
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:68,代码来源:function_rex_mediapool.inc.php

示例14: rex_medienpool_saveMedia

/**
 * Holt ein upgeloadetes File und legt es in den Medienpool
 * Dabei wird kontrolliert ob das File schon vorhanden ist und es
 * wird eventuell angepasst, weiterhin werden die Fileinformationen übergeben
 *
 * @param $FILE
 * @param $rex_file_category
 * @param $FILEINFOS
 * @param $userlogin
*/
function rex_medienpool_saveMedia($FILE, $rex_file_category, $FILEINFOS, $userlogin = null)
{
    global $REX, $I18N;
    $rex_file_category = (int) $rex_file_category;
    $gc = new rex_sql();
    $gc->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file_category WHERE id=' . $rex_file_category);
    if ($gc->getRows() != 1) {
        $rex_file_category = 0;
    }
    $isFileUpload = isset($FILE['tmp_name']);
    $FILENAME = $FILE['name'];
    $FILESIZE = $FILE['size'];
    $FILETYPE = $FILE['type'];
    $NFILENAME = rex_medienpool_filename($FILENAME, $isFileUpload);
    $message = '';
    // ----- alter/neuer filename
    $srcFile = $REX['MEDIAFOLDER'] . '/' . $FILENAME;
    $dstFile = $REX['MEDIAFOLDER'] . '/' . $NFILENAME;
    $success = true;
    if ($isFileUpload) {
        if (!@move_uploaded_file($FILE['tmp_name'], $dstFile)) {
            $message .= $I18N->msg("pool_file_movefailed");
            $success = false;
        }
    } else {
        if (!@rename($srcFile, $dstFile)) {
            $message .= $I18N->msg("pool_file_movefailed");
            $success = false;
        }
    }
    if ($success) {
        @chmod($dstFile, $REX['FILEPERM']);
        // get widht height
        $size = @getimagesize($dstFile);
        if ($FILETYPE == '' && isset($size['mime'])) {
            $FILETYPE = $size['mime'];
        }
        $FILESQL = new rex_sql();
        $FILESQL->setTable($REX['TABLE_PREFIX'] . 'file');
        $FILESQL->setValue('filetype', $FILETYPE);
        $FILESQL->setValue('title', $FILEINFOS['title']);
        $FILESQL->setValue('filename', $NFILENAME);
        $FILESQL->setValue('originalname', $FILENAME);
        $FILESQL->setValue('filesize', $FILESIZE);
        if ($size) {
            $FILESQL->setValue('width', $size[0]);
            $FILESQL->setValue('height', $size[1]);
        }
        $FILESQL->setValue('category_id', $rex_file_category);
        // TODO Create + Update zugleich?
        $FILESQL->addGlobalCreateFields($userlogin);
        $FILESQL->addGlobalUpdateFields($userlogin);
        $FILESQL->insert();
        $message .= $I18N->msg("pool_file_added");
    }
    $RETURN['title'] = $FILEINFOS['title'];
    $RETURN['type'] = $FILETYPE;
    $RETURN['msg'] = $message;
    // Aus BC gruenden hier mit int 1/0
    $RETURN['ok'] = $success ? 1 : 0;
    $RETURN['filename'] = $NFILENAME;
    $RETURN['old_filename'] = $FILENAME;
    if ($size) {
        $RETURN['width'] = $size[0];
        $RETURN['height'] = $size[1];
    }
    // ----- EXTENSION POINT
    if ($success) {
        rex_register_extension_point('MEDIA_ADDED', '', $RETURN);
    }
    return $RETURN;
}
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:82,代码来源:function_rex_medienpool.inc.php

示例15: rex_articleStatus

/**
 * Ändert den Status des Artikels
 * 
 * @param int       $article_id Id des Artikels die gelöscht werden soll
 * @param int       $clang      Id der Sprache
 * @param int|null  $status     Status auf den der Artikel gesetzt werden soll, oder NULL wenn zum nächsten Status weitergeschaltet werden soll
 * 
 * @return array Ein Array welches den status sowie eine Fehlermeldung beinhaltet
 */
function rex_articleStatus($article_id, $clang, $status = null)
{
    global $REX, $I18N;
    $success = false;
    $message = '';
    $artStatusTypes = rex_articleStatusTypes();
    $GA = new rex_sql();
    $GA->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where id='{$article_id}' and clang={$clang}");
    if ($GA->getRows() == 1) {
        // Status wurde nicht von außen vorgegeben,
        // => zyklisch auf den nächsten Weiterschalten
        if (!$status) {
            $newstatus = ($GA->getValue('status') + 1) % count($artStatusTypes);
        } else {
            $newstatus = $status;
        }
        $EA = new rex_sql();
        $EA->setTable($REX['TABLE_PREFIX'] . "article");
        $EA->setWhere("id='{$article_id}' and clang={$clang}");
        $EA->setValue('status', $newstatus);
        $EA->addGlobalUpdateFields();
        if ($EA->update()) {
            $message = $I18N->msg('article_status_updated');
            rex_deleteCacheArticle($article_id, $clang);
            // ----- EXTENSION POINT
            $message = rex_register_extension_point('ART_STATUS', $message, array('id' => $article_id, 'clang' => $clang, 'status' => $newstatus));
            $success = true;
        } else {
            $message = $EA->getError();
        }
    } else {
        $message = $I18N->msg("no_such_category");
    }
    return array($success, $message);
}
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:44,代码来源:function_rex_structure.inc.php


注:本文中的rex_sql::addGlobalUpdateFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。