Example #1
0
     //cot_redirect(cot_url('admin', "m=extrafields&n=$n&d=$durl", '', true));
 } elseif ($a == 'del' && isset($name)) {
     /* === Hook === */
     foreach (cot_getextplugins('admin.extrafields.delete') as $pl) {
         include $pl;
     }
     /* ===== */
     if (cot_extrafield_remove($n, $name)) {
         cot_message('adm_extrafield_removed');
     } else {
         cot_error('adm_extrafield_not_removed');
     }
     //cot_redirect(cot_url('admin', "m=extrafields&n=$n&d=$durl", '', true));
 }
 $cache && $cache->db->remove('cot_extrafields', 'system');
 cot_load_extrafields(true);
 $totalitems = $db->query("SELECT COUNT(*) FROM {$db_extra_fields} WHERE field_location = '{$n}'")->fetchColumn();
 $res = $db->query("SELECT * FROM {$db_extra_fields} WHERE field_location = '{$n}' ORDER BY field_name ASC LIMIT {$d}, " . $maxperpage);
 $pagenav = cot_pagenav('admin', 'm=extrafields&n=' . $n, $d, $totalitems, $maxperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
 $field_types = array('input', 'inputint', 'currency', 'double', 'textarea', 'select', 'checkbox', 'radio', 'datetime', 'country', 'range', 'checklistbox', 'file');
 $ii = 0;
 /* === Hook - Part1 : Set === */
 $extp = cot_getextplugins('admin.extrafields.loop');
 /* ===== */
 foreach ($res->fetchAll() as $row) {
     $ii++;
     $t->assign(array('ADMIN_EXTRAFIELDS_ROW_NAME' => cot_inputbox('text', 'field_name[' . $row['field_name'] . ']', $row['field_name'], 'class="exfldname"'), 'ADMIN_EXTRAFIELDS_ROW_FIELDNAME' => htmlspecialchars($row['field_name']), 'ADMIN_EXTRAFIELDS_ROW_DESCRIPTION' => cot_textarea('field_description[' . $row['field_name'] . ']', $row['field_description'], 1, 30, 'class="exflddesc"'), 'ADMIN_EXTRAFIELDS_ROW_SELECT' => cot_selectbox($row['field_type'], 'field_type[' . $row['field_name'] . ']', $field_types, $field_types, false, 'class="exfldtype"'), 'ADMIN_EXTRAFIELDS_ROW_VARIANTS' => cot_textarea('field_variants[' . $row['field_name'] . ']', $row['field_variants'], 1, 60, 'class="exfldvariants"'), 'ADMIN_EXTRAFIELDS_ROW_PARAMS' => cot_textarea('field_params[' . $row['field_name'] . ']', $row['field_params'], 1, 60, 'class="exfldparams"'), 'ADMIN_EXTRAFIELDS_ROW_HTML' => cot_textarea('field_html[' . $row['field_name'] . ']', $row['field_html'], 1, 60, 'class="exfldhtml"'), 'ADMIN_EXTRAFIELDS_ROW_DEFAULT' => cot_textarea('field_default[' . $row['field_name'] . ']', $row['field_default'], 1, 60, 'class="exflddefault"'), 'ADMIN_EXTRAFIELDS_ROW_REQUIRED' => cot_checkbox($row['field_required'], 'field_required[' . $row['field_name'] . ']', '', 'class="exfldrequired"'), 'ADMIN_EXTRAFIELDS_ROW_ENABLED' => cot_checkbox($row['field_enabled'], 'field_enabled[' . $row['field_name'] . ']', '', 'title="' . $L['adm_extrafield_enable'] . '" class="exfldenabled" '), 'ADMIN_EXTRAFIELDS_ROW_PARSE' => cot_selectbox($row['field_parse'], 'field_parse[' . $row['field_name'] . ']', $parse_type, array($L['Default'], $L['No']), false, 'class="exfldparse"'), 'ADMIN_EXTRAFIELDS_ROW_BIGNAME' => strtoupper($row['field_name']), 'ADMIN_EXTRAFIELDS_ROW_ID' => $row['field_name'], 'ADMIN_EXTRAFIELDS_ROW_DEL_URL' => cot_url('admin', 'm=extrafields&n=' . $n . '&a=del&name=' . $row['field_name']), 'ADMIN_EXTRAFIELDS_ROW_COUNTER_ROW' => $ii, 'ADMIN_EXTRAFIELDS_ROW_ODDEVEN' => cot_build_oddeven($ii)));
     /* === Hook - Part2 : Include === */
     foreach ($extp as $pl) {
         include $pl;
     }
Example #2
0
                include $pl;
            }
            /* ===== */
            @unlink($extrafield['field_params'] . $fielddata);
        }
    }
}
/**
 * Loads extrafields data into global
 * @param bool $forcibly Forcibly reload exflds
 * @global array $cot_extrafields
 * @global CotDB $db
 * @global Cache $cache
 */
function cot_load_extrafields($forcibly = false)
{
    global $db, $cot_extrafields, $db_extra_fields, $cache;
    if (empty($cot_extrafields) || $forcibly) {
        $cot_extrafields = array();
        $where = defined('COT_INSTALL') ? "1" : "field_enabled=1";
        $fieldsres = $db->query("SELECT * FROM {$db_extra_fields} WHERE {$where} ORDER BY field_type ASC");
        while ($row = $fieldsres->fetch()) {
            $cot_extrafields[$row['field_location']][$row['field_name']] = $row;
        }
        $fieldsres->closeCursor();
        $cache && $cache->db->store('cot_extrafields', $cot_extrafields, 'system');
    }
}
/* ======== Extrafields Pre-load ======== */
cot_load_extrafields();
$cot_extrafields[$db_structure] = !empty($cot_extrafields[$db_structure]) ? $cot_extrafields[$db_structure] : array();