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

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

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



array (template_uid=>$uid,

project_id=>$project_id);

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

}

// Removes pageRemoveDraft ($project_uid, $page_uid, $draft_uid, $fromdisk = FALSE)

{

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

! valcheck:isuid ($page_uid) ||! valcheck:isuid ($draft_uid))

{Bad input;

}

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

$project_id = $this->getIdByUid ($this->db_tables_projects, project_uid, $project_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);($fromdisk)

{

// Getting draft published bool

$what = array(published);

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

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

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

$published = $row[0];($published)

{

// 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);

$url = $row[0];

// Removing page

$gen = new Generator();

$gen->RemovePage($url);

}

}

// Removing draft

$table_name = $this->db_tables_page_drafts;

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

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

}

// Gets id by uidfunction getIdByUid ($table_name, $uid_name, $uid_value)

{

// Getting template id from uid

$what = array(id);

$from = array ($table_name);

$condition = array ($uid_name=>$uid_value);

$row = $this->dbm->GetData ($what, $from, $condition);(int)$row[0];

}

// Gets id by uid with equality conditionfunction getIdByUidCond ($table_name, $uid_name, $uid_value,

$cond_name, $cond_value)

{

// Getting template id from uid

$what = array(id);

$from = array ($table_name);

$condition = array ($uid_name=>$uid_value,

$cond_name=>$cond_value);

$row = $this->dbm->GetData ($what, $from, $condition);(int)$row[0];

}

// Returns template dataGetTemplate ($project_uid, $template_uid, $draft_uid)

{

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

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

{Bad input;

}

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

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

$template_id = $this->getIdByUidCond ($this->db_tables_templates, template_uid, $template_uid, project_id, $project_id);

$what = array (object_data);

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

$condition = array (draft_uid=>$draft_uid,

template_id=>$template_id);

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

}

// Returns page dataGetPageDraft ($project_uid, $page_uid, $draft_uid)

{

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

! valcheck:isuid ($page_uid) ||! valcheck:isuid ($draft_uid))

{Bad input;

}

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

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

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

$what = array (object_data);

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

$condition = array (draft_uid=>$draft_uid,

page_id=>$page_id);

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

}

// Returns all pages infoMccGetPages ($project_uid)

{

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

{Bad input;

}

global $config_delim_normal;$config_delim_sub;$config_delim_subsub;

$res = ;

// Getting all pages

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

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

$what = array (id, page_uid, page_url);

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

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

$rows = $this->dbm->GetAllData ($what, $from, $condition);

//page_uid; page_url; draft1, pub; draft2, pub|page_uid; page_url; draft1, pub

$c = count($rows) - 1;($rows as $row)

{

$res.= $row[1].$config_delim_sub.$row[2];

// Getting all drafts

$page_id = $row[0];

$what = array (draft_uid, published);

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

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

$rowsd = $this->dbm->GetAllData ($what, $from, $condition);($rowsd as $rowd)

{

$res.= $config_delim_sub.$rowd[0].$config_delim_subsub.$rowd[1];

}($c!= 0)

{

$res.= $config_delim_normal;

}

$c -= 1;

}$res;

}

// Returns all templates infoMccGetTemplates ($project_uid)

{

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

{Bad input;

}

$config_delim_normal;$config_delim_sub;$config_delim_subsub;

$res = ;

// Getting all templates

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

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

$what = array (id, template_uid);

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

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

$rows = $this->dbm->GetAllData ($what, $from, $condition);

//template_uid|template_uid|template_uid

$c = count($rows) - 1;($rows as $row)

{

$res.= $row[1];($c!= 0)

{

$res.= $config_delim_normal;

}

$c -= 1;

}$res;

}

// Returns status of projectMccGetStatus ($project_uid)

{$config_delim_normal;$config_delim_sub;$config_delim_subsub;

$res = ;

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

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

// Getting templates count

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

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

$count = $this->dbm->GetCount ($from, $condition);

$res.= $count.$config_delim_normal;

// Getting pages count

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

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

$count = $this->dbm->GetCount ($from, $condition);

$res.= $count.$config_delim_normal;

// Getting resources count

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

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

$count = $this->dbm->GetCount ($from, $condition);

$res.= $count;

$res;

}

// Returns resources infoGetResources ($project_uid,

$usedin_type = FALSE,

$usedin_uid = FALSE)

{

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

{Bad input 1;

}

//TODO: make better check on type, and standartize it(($usedin_type &&! valcheck:isuid ($usedin_type)) ||

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

{Bad input 2;

}

$config_delim_normal;$config_delim_sub;$config_delim_subsub;

$res = ;

// Getting all resources

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

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

// If resource from page or template($usedin_type)

{($usedin_type == p)

{

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

}

{

$usedin_id = $this->getIdByUidCond ($this->db_tables_templates, template_uid, $usedin_uid, project_id, $project_id);

}

// Getting ids of associated resources

$what = array (resource_id);

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

$condition = array (usedin_type=>$usedin_type,

usedin_id=>$usedin_id);

$rows = $this->dbm->GetAllData ($what, $from, $condition);

$c = count($rows) - 1;($rows as $row)

{

$resource_id = $row[0];

$what = array (resource_uid, path'