Beispiel #1
0
 function save_field($passed_smarty = '')
 {
     global $smarty, $db;
     //$eip_item = $smarty->get_template_vars($eip_item_name);
     if ($passed_smarty != '') {
         $smarty = $passed_smarty;
     }
     $eip_item_name = $_REQUEST['var_id'];
     if (strpos($eip_item_name, "_-_") > 0) {
         $eip_a = substr($eip_item_name, 0, strpos($eip_item_name, "_-_"));
         $eip_b = substr($eip_item_name, strpos($eip_item_name, "_-_") + 3, 100);
         $keyval = $eip_b;
         $eip_item = $smarty->get_template_vars($eip_a);
         $this->SavedItemName = $eip_a;
     } else {
         $eip_item = $smarty->get_template_vars($eip_item_name);
         $keyval = $_REQUEST['keyval'];
         $this->SavedItemName = $eip_item_name;
     }
     $this->SavedItemFieldName = $eip_item['field_name'];
     $this->SavedItemValue = $_REQUEST['var_value'];
     $this->SavedItemKeyValue = $keyval;
     // set some defaults
     if (!isset($eip_item['keyvaltype']) || $eip_item['keyvaltype'] == "") {
         $eip_item['keyvaltype'] = "number";
     }
     if (!isset($eip_item['eip_type']) || $eip_item['eip_type'] == "") {
         $eip_item['eip_type'] = "text";
     }
     if (!isset($eip_item['field_type']) || $eip_item['field_type'] == "") {
         $eip_item['field_type'] = "text";
     }
     $eip_item['field_name'];
     $sql = "UPDATE " . $eip_item['table_name'] . " set " . $eip_item['field_name'] . " = ";
     if ($eip_item['field_type'] == "text") {
         $sql .= '"' . safeAddSlashes($_REQUEST['var_value']) . '"';
     }
     if ($eip_item['field_type'] == "number") {
         $sql .= intval($_REQUEST['var_value']);
     }
     $sql .= " where " . $eip_item['key'] . " = ";
     if ($eip_item['keyvaltype'] == "text") {
         $sql .= '"' . safeAddSlashes($keyval) . '"';
     }
     if ($eip_item['keyvaltype'] == "number") {
         $sql .= intVal($keyval);
     }
     $sql .= ";";
     $db->query($sql);
     return str_replace("_ne_st_ed_", " : ", $_REQUEST['var_value']);
 }
Beispiel #2
0
function Cat_Safe_Names()
{
    // this was moved out of dbtree.php because it's only needed when changing
    // category information
    global $db;
    $cats = $db->get_col("Select category_name from " . table_categories . ";");
    if ($cats) {
        foreach ($cats as $catname) {
            $db->query("UPDATE `" . table_categories . '` SET `category_name` = "' . safeAddSlashes($catname) . '"' . ", `category_safe_name` = '" . makeCategoryFriendly($catname) . "' WHERE `category_name` =" . '"' . safeAddSlashes($catname) . '";');
        }
    }
    $cats = $db->get_col("Select category__auto_id from " . table_categories . ";");
    if ($cats) {
        foreach ($cats as $catid) {
            $db->query("UPDATE `" . table_categories . "` SET `category_id` = " . $catid . " WHERE `category__auto_id` ='" . $catid . "';");
        }
    }
}
Beispiel #3
0
function Cat_Safe_Names()
{
    global $db;
    $cats = $db->get_col("Select category_name from " . table_categories . ";");
    if ($cats) {
        foreach ($cats as $catname) {
            $db->query("UPDATE `" . table_categories . '` SET `category_name` = "' . safeAddSlashes($catname) . '"' . ", `category_safe_name` = '" . makeCategoryFriendly($catname) . "' WHERE `category_name` =" . '"' . safeAddSlashes($catname) . '";');
        }
    }
    $cats = $db->get_col("Select category__auto_id from " . table_categories . ";");
    if ($cats) {
        foreach ($cats as $catid) {
            $db->query("UPDATE `" . table_categories . "` SET `category_id` = " . $catid . " WHERE `category__auto_id` ='" . $catid . "';");
        }
    }
}