コード例 #1
0
 function initTextyle($site_srl)
 {
     $oCounterController =& getController('counter');
     $oDocumentController =& getController('document');
     $oCommentController =& getController('comment');
     $oTagController =& getController('tag');
     $oAddonController =& getController('addon');
     $oEditorController =& getController('editor');
     $oTrackbackController =& getController('trackback');
     $oModuleModel =& getModel('module');
     $oTextyleModel =& getModel('textyle');
     $oMemberModel =& getModel('member');
     $site_info = $oModuleModel->getSiteInfo($site_srl);
     $module_srl = $site_info->index_module_srl;
     $args->site_srl = $site_srl;
     $oTextyle = new TextyleInfo($module_srl);
     if ($oTextyle->module_srl != $module_srl) {
         return new Object(-1, 'msg_invalid_request');
     }
     $oCounterController->deleteSiteCounterLogs($args->site_srl);
     $oAddonController->removeAddonConfig($args->site_srl);
     $args->module_srl = $module_srl;
     $output = executeQuery('textyle.deleteTextyleFavorites', $args);
     $output = executeQuery('textyle.deleteTextyleTags', $args);
     $output = executeQuery('textyle.deleteTextyleVoteLogs', $args);
     $output = executeQuery('textyle.deleteTextyleMemos', $args);
     $output = executeQuery('textyle.deleteTextyleReferer', $args);
     $output = executeQuery('textyle.deleteTextyleApis', $args);
     $output = executeQuery('textyle.deleteTextyleGuestbook', $args);
     $output = executeQuery('textyle.deleteTextyleSupporters', $args);
     $output = executeQuery('textyle.deletePublishLogs', $args);
     FileHandler::removeFile(sprintf("./files/cache/textyle/textyle_deny/%d.php", $module_srl));
     FileHandler::removeDir($oTextyleModel->getTextylePath($module_srl));
     // delete document comment tag
     $output = $oDocumentController->triggerDeleteModuleDocuments($args);
     $output = $oCommentController->triggerDeleteModuleComments($args);
     $output = $oTagController->triggerDeleteModuleTags($args);
     $output = $oTrackbackController->triggerDeleteModuleTrackbacks($args);
     $args->module_srl = $args->module_srl * -1;
     $output = $oDocumentController->triggerDeleteModuleDocuments($args);
     $output = $oCommentController->triggerDeleteModuleComments($args);
     $output = $oTagController->triggerDeleteModuleTags($args);
     $args->module_srl = $args->module_srl * -1;
     // set category
     $obj->module_srl = $module_srl;
     $obj->title = Context::getLang('init_category_title');
     $oDocumentController->insertCategory($obj);
     FileHandler::copyDir($this->module_path . 'skins/' . $this->skin, $oTextyleModel->getTextylePath($module_srl));
     $langType = Context::getLangType();
     $file = sprintf('%ssample/%s.html', $this->module_path, $langType);
     if (!file_exists(FileHandler::getRealPath($file))) {
         $file = sprintf('%ssample/ko.html', $this->module_path);
     }
     $member_info = $oMemberModel->getMemberInfoByEmailAddress($oTextyle->getUserId());
     $doc->module_srl = $module_srl;
     $doc->title = Context::getLang('sample_title');
     $doc->tags = Context::getLang('sample_tags');
     $doc->content = FileHandler::readFile($file);
     $doc->member_srl = $member_info->member_srl;
     $doc->user_id = $member_info->user_id;
     $doc->user_name = $member_info->user_name;
     $doc->nick_name = $member_info->nick_name;
     $doc->email_address = $member_info->email_address;
     $doc->homepage = $member_info->homepage;
     $output = $oDocumentController->insertDocument($doc, true);
     return new Object(1, 'success_textyle_init');
 }
コード例 #2
0
 /**
  * @brief Textyle return list
  **/
 function getTextyleList($args)
 {
     $output = executeQueryArray('textyle.getTextyleList', $args);
     if (!$output->toBool()) {
         return $output;
     }
     if (count($output->data)) {
         foreach ($output->data as $key => $val) {
             $oTextyle = null;
             $oTextyle = new TextyleInfo();
             $oTextyle->setAttribute($val);
             $output->data[$key] = null;
             $output->data[$key] = $oTextyle;
         }
     }
     return $output;
 }
コード例 #3
0
 /**
  * @brief comment insert
  **/
 function procTextyleInsertComment()
 {
     $oDocumentModel =& getModel('document');
     $oCommentModel =& getModel('comment');
     $oCommentController =& getController('comment');
     $oTextyleInfo = new TextyleInfo($this->textyle->textyle_srl);
     if (!$oTextyleInfo->isEnableComment()) {
         return new Object(-1, 'msg_not_permitted');
     }
     if (!$this->grant->write_comment) {
         return new Object(-1, 'msg_not_permitted');
     }
     $obj = Context::gets('document_srl', 'comment_srl', 'parent_srl', 'content', 'password', 'nick_name', 'member_srl', 'email_address', 'homepage', 'is_secret', 'notify_message');
     $obj->module_srl = $this->module_srl;
     $oDocument = $oDocumentModel->getDocument($obj->document_srl);
     if (!$oDocument->isExists()) {
         return new Object(-1, 'msg_not_permitted');
     }
     if (!$obj->comment_srl) {
         $obj->comment_srl = getNextSequence();
     } else {
         $comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
     }
     if ($comment->comment_srl != $obj->comment_srl) {
         if ($obj->parent_srl) {
             $parent_comment = $oCommentModel->getComment($obj->parent_srl);
             if (!$parent_comment->comment_srl) {
                 return new Object(-1, 'msg_invalid_request');
             }
             $output = $oCommentController->insertComment($obj);
         } else {
             $output = $oCommentController->insertComment($obj);
         }
         if ($output->toBool() && $this->module_info->admin_mail) {
             $oMail = new Mail();
             $oMail->setTitle($oDocument->getTitleText());
             $oMail->setContent(sprintf("From : <a href=\"%s#comment_%d\">%s#comment_%d</a><br/>\r\n%s", $oDocument->getPermanentUrl(), $obj->comment_srl, $oDocument->getPermanentUrl(), $obj->comment_srl, $obj->content));
             $oMail->setSender($obj->nick_name, $obj->email_address);
             $target_mail = explode(',', $this->module_info->admin_mail);
             for ($i = 0; $i < count($target_mail); $i++) {
                 $email_address = trim($target_mail[$i]);
                 if (!$email_address) {
                     continue;
                 }
                 $oMail->setReceiptor($email_address, $email_address);
                 $oMail->send();
             }
         }
     } else {
         $obj->parent_srl = $comment->parent_srl;
         $output = $oCommentController->updateComment($obj, $this->grant->manager);
         $comment_srl = $obj->comment_srl;
     }
     if (!$output->toBool()) {
         return $output;
     }
     $this->setMessage('success_registed');
     $this->add('mid', Context::get('mid'));
     $this->add('document_srl', $obj->document_srl);
     $this->add('comment_srl', $obj->comment_srl);
 }