PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
admin
/
models
<?php class UploadTemplateForm extends CFormModel { public $file; public function rules() { return array( array('file', 'file', 'types'=>'zip', 'safe' => false), ); } public function save($item = null) { if ($this->validate()) { $targetDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'templates'; if (!file_exists($targetDir)) { @mkdir($targetDir); } $now = date('Y-m-d H:i:s'); $filename = $this->file->name; $this->file->saveAs($targetDir.DIRECTORY_SEPARATOR.$filename); $filename = $this->file->name; $templatename = substr($filename, 0, strripos($filename, '.')); $template = new Site; $template->name = $templatename; $template->display_name = $templatename; $template->plan_id = Yii::app()->params["start_plan"]; $template->description = $templatename; $template->is_created_complete = 1; $template->category = 0; $template->priority = 1; $template->is_template = 1; $template->date_added = $now; $template->date_modified = $now; $template->owner_id = Yii::app()->user->id; $template->last_modified_id = Yii::app()->user->id; $template->is_template_active = 1; if (!($template->validate() && $template->save())) { $this->addErrors($template->getErrors()); return false; } $template->importZip($targetDir.DIRECTORY_SEPARATOR.$filename); @unlink($targetDir.DIRECTORY_SEPARATOR.$filename); return $template; } else { return false; } } }
[+]
..
[-] DBPageForm.php
[edit]
[-] PlanDescriptionForm.php
[edit]
[-] HostingConfigurationForm.php
[edit]
[-] MailConfigurationForm.php
[edit]
[-] TemplateForm.php
[edit]
[-] ModuleForm.php
[edit]
[-] PageForm.php
[edit]
[-] PaymentConfigurationForm.php
[edit]
[-] CategoryForm.php
[edit]
[-] TermForm.php
[edit]
[-] DbListForm.php
[edit]
[-] ModuleDataForm.php
[edit]
[-] UploadTemplateForm.php
[edit]
[-] PlanConditionForm.php
[edit]
[-] ChangeDomainForm.php
[edit]
[-] LanguageForm.php
[edit]
[-] SkinPresetForm.php
[edit]
[-] PlanForm.php
[edit]
[-] UpgradePageForm.php
[edit]
[-] MailTemplateForm.php
[edit]
[-] ColorForm.php
[edit]
[-] MakeTempleteFromSiteForm.php
[edit]
[-] ResetPassForm.php
[edit]
[-] InterfaceForm.php
[edit]
[-] ContentForm.php
[edit]
[-] UserForm.php
[edit]
[-] ExtendPageForm.php
[edit]
[-] ConfigurationForm.php
[edit]
[-] ModuleCategoryForm.php
[edit]
[-] SocialShareButtonForm.php
[edit]