コード例 #1
0
 function _import_fixed_lang()
 {
     # 	Scans the articles, creating a group for each and adding it and setting the
     # language to the site default...
     $where = "1";
     $rs = @safe_rows_start('ID , Title , ' . L10N_COL_LANG . ' , `' . L10N_COL_GROUP . '`', 'textpattern', $where);
     $count = @mysql_num_rows($rs);
     $i = 0;
     if ($rs && $count > 0) {
         while ($a = nextRow($rs)) {
             $title = $a['Title'];
             $lang = $a[L10N_COL_LANG];
             $article_id = $a[L10N_COL_GROUP];
             $id = $a['ID'];
             if ($lang !== '-' and $article_id !== 0) {
                 #
                 #	Use any existing Lang/Group data there might be...
                 #
                 if (true === MLPArticles::add_rendition($article_id, $id, $lang, true, true, $title)) {
                     $i++;
                 }
             } else {
                 #
                 #	Create a fresh group and add the info...
                 #
                 if (MLPArticles::create_article_and_add($a)) {
                     $i++;
                 }
             }
         }
     }
     if ($i === $count) {
         return true;
     }
     return "{$i} of {$count}";
 }
コード例 #2
0
ファイル: l10n_admin.php プロジェクト: netcarver/mlp_pack
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;
}