Серверная часть системы создания и управления сайтами

Дипломная работа - Компьютеры, программирование

Другие дипломы по предмету Компьютеры, программирование

Скачать Бесплатно!
Для того чтобы скачать эту работу.
1. Пожалуйста введите слова с картинки:

2. И нажмите на эту кнопку.
закрыть



draftSavePageDraft ($project_uid, $page_uid, $draft_uid,

$template_uid = FALSE,

$modification_time = FALSE,

$page_url = FALSE,

$object_data = FALSE,

$published = FALSE,

$new_draftuid = FALSE,

$new_pageuid = FALSE)

{

// Checking if input is correct(! valcheck:isuid ($project_uid) ||! valcheck:isuid ($page_uid))

{Bad input 1;

}(($draft_uid &&! valcheck:isuid ($draft_uid)) ||

($template_uid &&! valcheck:isuid ($template_uid)) ||

($page_url &&! valcheck:isurl ($page_url)) ||

($modification_time &&! valcheck:isunixtime ($modification_time)) ||

($object_data &&! valcheck:isobjectdata ($object_data)) ||

($published &&! is_bool (strbool:tobool($published))) ||

($new_draftuid &&! valcheck:isuid ($new_draftuid)) ||

($new_pageuid &&! valcheck:isuid ($new_pageuid)))

{Bad input 2;

}

$this->dbm->SelectDatabase ($this->db_name);

$project_id = $this->getIdByUid ($this->db_tables_projects, project_uid, $project_uid);

// Assume url wont change

$old_page_url = FALSE;($page_url)

{

// Getting old url to delete old data

$what = array (page_url);

$from = array ($this->db_tables_pages);

$condition = array (page_uid=>$page_uid);

$row = $this->dbm->GetData ($what, $from, $condition);

$old_page_url = $row[0];

// Updating url

$table_name = $this->db_tables_pages;

$new_data = array (page_url=>$page_url);

$condition = array (page_uid=>$page_uid);

$this->dbm->UpdateData ($table_name, $new_data, $condition);

}($draft_uid)

{

$page_id = $this->getIdByUidCond ($this->db_tables_pages, page_uid, $page_uid, project_id, $project_id);

$draft_id = $this->getIdByUidCond ($this->db_tables_page_drafts, draft_uid, $draft_uid, page_id, $page_id);

// Updating draft

$table_name = $this->db_tables_page_drafts;

$new_data = array();($modification_time) $new_data [modification_time] = $modification_time;($object_data) $new_data [object_data] = $object_data;($published)

{(strbool:istrue($published))

{

// Unpublish all drafts

$table_name = $this->db_tables_page_drafts;

$new_data = array (published=>FALSE);

$condition = array (page_id=>$page_id);

$this->dbm->UpdateData ($table_name, $new_data, $condition);

}

 

$new_data[published] = strbool:tobool($published);

}($template_uid)

{

$template_id = $this->getIdByUidCond ($this->db_tables_templates, template_uid, $template_uid, project_id, $project_id);($template_id == 0)Error. No such template.;

$new_data [template_id] = $template_id;

}($new_draftuid)

{

$new_data [draft_uid] = $new_draftuid;

$draft_uid = $new_draftuid;

}

$condition = array (id=>$draft_id);

$this->dbm->UpdateData ($table_name, $new_data, $condition);

// Change uid of page($new_pageuid)

{

$table_name = $this->db_tables_pages;

$new_data = array (page_uid=>$new_pageuid);

$condition = array (id=>$page_id);

$this->dbm->UpdateData ($table_name, $new_data, $condition);

$page_uid = $new_pageuid;

}

}

 

$this->PublishPage ($project_id, $page_uid, $old_page_url);OK;

}

 

function PublishPage ($project_id, $page_uid, $old_page_url = FALSE)

{

// Getting page id from uid

$page_id = $this->getIdByUidCond ($this->db_tables_pages, page_uid, $page_uid, project_id, $project_id);

// Getting page url

$what = array (page_url);

$from = array ($this->db_tables_pages);

$condition = array (id=>$page_id);

$row = $this->dbm->GetData ($what, $from, $condition);

$page_url = $row[0];

 

// Getting draft uid

$what = array (draft_uid);

$from = array ($this->db_tables_page_drafts);

$condition = array (page_id=>$page_id,

published=>TRUE);

$row = $this->dbm->GetData ($what, $from, $condition);

$draft_uid = $row[0];

 

// If no drafts to publish, remove previous from disk(empty ($draft_uid))

{

$gen = new Generator();

$gen->RemovePage ($page_url);FALSE;

}

 

$draft_id = $this->getIdByUidCond ($this->db_tables_page_drafts, draft_uid, $draft_uid, page_id, $page_id);

 

// Getting page draft data

$what = array (object_data, template_id, modification_time);

$from = array ($this->db_tables_page_drafts);

$condition = array (id=>$draft_id);

$row = $this->dbm->GetData ($what, $from, $condition);

$page_data = $row[0];

$template_id = $row[1];

$modification_time = $row[2];

// Getting template data

$what = array (object_data);

$from = array ($this->db_tables_template_drafts);

$condition = array (template_id=>$template_id);

$row = $this->dbm->GetData ($what, $from, $condition);

$template_data = $row[0];

 

// Generate pae

$gen = new Generator();

$gen->GeneratePage ($page_url, $page_data, $template_data, $old_page_url);

 

// Update generation time

$generated_modification_time = $modification_time;

$generated_draft_uid = $draft_uid;

$table_name = $this->db_tables_pages;

$new_data = array (generated_modification_time=>$generated_modification_time,

generated_draft_uid=>$generated_draft_uid);

$condition = array (page_uid=>$page_uid);

$this->dbm->UpdateData ($table_name, $new_data, $condition);

}

 

// Removes resourceRemoveResource ($project_uid, $uid, $fromdisk = FALSE)

{

// Checking if input is correct(! valcheck:isuid ($project_uid) ||! valcheck:isuid($uid))

{Bad input;

}

$this->dbm->SelectDatabase ($this->db_name);

$project_id = $this->getIdByUid ($this->db_tables_projects, project_uid, $project_uid);($fromdisk)

{

// Getting resource path

$what = array(path);

$from = array ($this->db_tables_resources);

$condition = array (resource_uid=>$uid,

project_id=>$project_id);

$row = $this->dbm->GetData ($what, $from, $condition);

$path = $row[0];

// Removing resource

$gen = new Generator();

$gen->RemoveResourceFile($path);

}

// Removing links to resource

$resource_id = $this->getIdByUidCond ($this->db_tables_resources, resource_uid, $uid, project_id, $project_id);

$table_name = $this->db_tables_resource_usedin;

$condition = array (resource_id=>$resource_id);

$this->dbm->RemoveData ($table_name, $condition);

// Removing resource

$table_name = $this->db_tables_resources;

$condition = array (resource_uid=>$uid);

$this->dbm->RemoveData ($table_name, $condition);OK;

}

 

// Removes pageRemovePage ($project_uid, $uid, $fromdisk = FALSE)

{

// Checking if input is correct(! valcheck:isuid ($project_uid) ||! valcheck:isuid($uid))

{Bad input;

}

$this->dbm->SelectDatabase ($this->db_name);

$project_id = $this->getIdByUid ($this->db_tables_projects, project_uid, $project_uid);($fromdisk)

{

// Getting page url

$what = array (page_url);

$from = array ($this->db_tables_pages);

$condition = array (page_uid=>$uid,

project_id=>$project_id);

$row = $this->dbm->GetData ($what, $from, $condition);

$url = $row[0];

// Removing page

$gen = new Generator();

$gen->RemovePage($url);

}

// Removing drafts

$page_id = $this->getIdByUidCond ($this->db_tables_pages, page_uid, $uid, project_id, $project_id);

$table_name = $this->db_tables_page_drafts;

$condition = array (page_id=>$page_id);

$this->dbm->RemoveData ($table_name, $condition);

// Removing page

$table_name = $this->db_tables_pages;

$condition = array (page_uid=>$uid);

$this->dbm->RemoveData ($table_name, $condition);OK;

}

 

// Removes templateRemoveTemplate ($project_uid, $uid)

{

// Checking if input is correct(! valcheck:isuid ($project_uid) ||! valcheck:isuid($uid))

{Bad input;

}

$this->dbm->SelectDatabase ($this->db_name);

$project_id = $this->getIdByUid ($this->db_tables_projects, project_uid, $project_uid);

// Removing template

$table_name = $this->db_tables_templates;

$condition =

s