Пример #1
0
 function delete_rendition()
 {
     $has_privs = has_privs('article.delete');
     if (!$has_privs) {
         return false;
     }
     $vars = array('rendition');
     extract(gpsa($vars));
     $rendition = (int) $rendition;
     if (0 == $rendition) {
         return false;
     }
     #
     #	Read the translation from the master table, extracting Group and Lang...
     #
     $details = safe_row('*', 'textpattern', "`ID`={$rendition}");
     if (empty($details)) {
         return true;
     }
     $lang = $details[L10N_COL_LANG];
     $article = $details[L10N_COL_GROUP];
     #
     #	Delete from the master table...
     #
     $master_deleted = @safe_delete('textpattern', "`ID`={$rendition}");
     #
     #	Delete from the correct language rendition table...
     #
     $rendition_table = _l10n_make_textpattern_name(array('long' => $lang));
     $rendition_deleted = @safe_delete($rendition_table, "`ID`={$rendition}");
     #
     #	Delete from the article table...
     #
     $article_updated = MLPArticles::remove_rendition($article, $rendition, $lang);
     $result = false;
     if ($master_deleted and $rendition_deleted and $article_updated) {
         $this->parent->message = gTxt('l10n-rendition_delete_ok', array('{rendition}' => $rendition));
     } else {
         $results = MLPArticles::check_groups();
         if (!empty($results)) {
             $this->parent->message = $results[0][3];
         } else {
             $this->parent->message = 'Groups ok.';
         }
     }
     return $result;
 }
Пример #2
0
function _l10n_pre_multi_edit_cb($event, $step)
{
    global $l10n_vars;
    $method = gps('edit_method');
    $things = gps('selected');
    $work = array();
    #
    #	Scan the selected items, building a table of languages touched by the edit.
    # Also delete any group info on the delete method calls.
    #
    if ($things) {
        foreach ($things as $id) {
            $id = intval($id);
            $info = safe_row('*', 'textpattern', "`ID`='{$id}'");
            if ($info !== false) {
                $article = $info[L10N_COL_GROUP];
                $lang = $info[L10N_COL_LANG];
                $work[$id] = $lang;
                if ('delete' === $method) {
                    MLPArticles::remove_rendition($article, $id, $lang);
                }
            }
        }
    }
    #
    #	Pass the languages array to the post-process routine to reconstruct the
    # per-language tables that were changed by the edit...
    #
    $l10n_vars['update_work'] = $work;
}