Beispiel #1
0
             if (in_array($tg['ponyid'], $TargetTagged)) {
                 continue;
             }
             if (!$CGDb->insert('tagged', array('tid' => $Target['tid'], 'ponyid' => $tg['ponyid']))) {
                 Response::fail('Tag ' . ($merging ? 'merging' : 'synonimizing') . " failed, please re-try.<br>Technical details: ponyid={$tg['ponyid']} tid={$Target['tid']}");
             }
         }
         if ($merging) {
             // No need to delete "tagged" table entries, constraints do it for us
             $CGDb->where('tid', $Tag['tid'])->delete('tags');
         } else {
             $CGDb->where('tid', $Tag['tid'])->delete('tagged');
             $CGDb->where('tid', $Tag['tid'])->update('tags', array('synonym_of' => $Target['tid'], 'uses' => 0));
         }
         foreach ($TargetTagged as $id) {
             Appearances::updateIndex($id);
         }
         Tags::updateUses($Target['tid']);
         Response::success('Tags successfully ' . ($merging ? 'merged' : 'synonymized'), $synoning || $merging ? array('target' => $Target) : null);
     }
 } else {
     if (preg_match(new RegExp('^([gs]et|make|del)cg(?:/(\\d+))?$'), $data, $_match)) {
         $action = $_match[1];
         $adding = $action === 'make';
         if (!$adding) {
             if (empty($_match[2])) {
                 Response::fail('Missing color group ID');
             }
             $GroupID = intval($_match[2], 10);
             $Group = $CGDb->where('groupid', $GroupID)->getOne('colorgroups');
             if (empty($GroupID)) {