Ejemplo n.º 1
0
 function upgrade_1_22()
 {
     global $sql, $sql2, $tp, $aa;
     $upgrade = TRUE;
     $sqlc = new db();
     $sqld = new db();
     //convert preferences for core default preferences
     if ($sqlc->db_Select("core", "*", "e107_name='pcontent' ")) {
         $row = $sqlc->db_Fetch();
         $tmp = e107::unserialize($row['e107_value']);
         //$tmp = $eArrayStorage->ReadxxxArray($row['e107_value']);
         //replace the id value for the content_pref
         $content_pref = array();
         foreach ($tmp as $k => $v) {
             if (substr($k, -2) == "_0") {
                 $k = str_replace("_0", "", $k);
             }
             if (strpos($k, "content_") === 0) {
                 $content_pref[$k] = $tp->toDB($v);
             }
         }
         if (!isset($content_pref['content_admin_subheading'])) {
             //add new options to the preferences
             $content_pref = $this->upgrade_1_22_prefs($content_pref);
             $tmp1 = e107::serialize($content_pref, true);
             //$tmp1 = $eArrayStorage->WritexxxArray($content_pref);
             $sqld->db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
         } else {
             $upgrade = FALSE;
         }
     }
     //convert preferences for all main parents
     if ($sqlc->db_Select("pcontent", "content_id, content_heading, content_pref", "LEFT(content_parent, 1) = '0' ")) {
         while ($row = $sqlc->db_Fetch()) {
             $id = $row['content_id'];
             $tmp = e107::unserialize($row['content_pref']);
             //$tmp = $eArrayStorage->ReadxxxArray($row['content_pref']);
             //replace the id value for the content_pref
             $l = strlen($id);
             $content_pref = array();
             foreach ($tmp as $k => $v) {
                 if (substr($k, -($l + 1)) == "_" . $id) {
                     $k = str_replace("_" . $id, "", $k);
                 }
                 if (strpos($k, "content_") === 0) {
                     $content_pref[$k] = $tp->toDB($v);
                 }
             }
             //add new options to the preferences
             if (!isset($content_pref['content_admin_subheading'])) {
                 $content_pref = $this->upgrade_1_22_prefs($content_pref);
                 $tmp1 = e107::serialize($content_pref, true);
                 //$tmp1 = $eArrayStorage->WritexxxArray($content_pref);
                 $sqld->db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='{$id}' ");
             } else {
                 $upgrade = FALSE;
             }
             //update menus
             $plugintable = "pcontent";
             $plugindir = e_PLUGIN . "content/";
             if (!is_object($aa)) {
                 require_once $plugindir . "handlers/content_class.php";
                 $aa = new content();
             }
             if ($row['content_parent'] == 0) {
                 //remove menu
                 @unlink(e_PLUGIN . "content/menus/content_" . $row['content_heading'] . "_menu.php");
                 //create menu
                 $aa->CreateParentMenu($id);
             }
         }
     }
     if ($upgrade === TRUE) {
         return CONTENT_ADMIN_CONVERSION_LAN_66 . "<br />";
     }
 }
Ejemplo n.º 2
0
        $e107cache->clear($plugintable);
        $message = CONTENT_ADMIN_ITEM_LAN_3;
    }
}
if (isset($delete) && $delete == 'submitted') {
    if ($sql->db_Delete($plugintable, "content_id='{$del_id}' ")) {
        $e107cache->clear($plugintable);
        $message = CONTENT_ADMIN_SUBMIT_LAN_8;
    }
}
//update options
if (isset($_POST['updateoptions'])) {
    $content_pref = $aa->UpdateContentPref($_POST['options_type']);
    $message = CONTENT_ADMIN_CAT_LAN_22 . "<br /><br />";
    if ($_POST['options_type'] != "0") {
        $message .= $aa->CreateParentMenu($_POST['options_type']);
    }
    $e107cache->clear($plugintable);
}
//update the inheritance of options
if (isset($_POST['updateinherit'])) {
    foreach ($_POST['id'] as $k => $v) {
        //get current
        $sql->db_Select($plugintable, "content_pref", "content_id='" . intval($k) . "' ");
        $row = $sql->db_Fetch();
        $content_pref = e107::unserialize($row['content_pref']);
        //$content_pref = $eArrayStorage->ReadxxxArray($row['content_pref']);
        //assign or remove inherit option
        if (isset($_POST['content_inherit']) && isset($_POST['content_inherit'][$k])) {
            $content_pref['content_inherit'] = "1";
        } else {