示例#1
0
 /**
  * Perform template install
  *
  * @access	private
  * @param   array 	$_post _POST array
  * @return  void
  */
 private function installing($_post)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], '_template_install', 0, 4);
     if (is_null($msg)) {
         // handle _post
         $post = array('name' => $_post['name'], 'css' => $_post['css'], 'id_theme' => $_post['id_theme'], 'description' => $_post['description'], 'sections' => $_post['sections']);
         $mod = new Template_model();
         $result = $mod->insert($post);
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // add permission on new template
         if ($result[1]) {
             $perm = new Permission_model();
             $array[] = array('action' => 'insert', 'id_what' => $result[0], 'id_user' => $_SESSION['xuid'], 'level' => 4);
             $res = $perm->pexec('templates', $array, 1);
             $theme = $mod->get_var($post['id_theme'], 'themes', 'name');
             $msg->update[] = array('element' => 'tdown', 'url' => BASE_URL . 'templates/index/' . $post['id_theme'] . '/' . $theme, 'title' => null);
         }
     }
     $this->response($msg);
 }