Exemplo n.º 1
0
 function submitForm()
 {
     global $wgRequest, $wgOut, $IP, $wgUser;
     #---
     # used fields
     # "task-target-wiki" - name of target wiki
     # "task-auto-import" - checkbox, automatically create an image import task after this one
     $grabberTask = $wgRequest->getVal("task-grabber-list");
     $targetWiki = CloseWikiTask::normalizeName($wgRequest->getText("task-target-wiki"));
     #--- check if closed wiki is valid
     $tWikiId = CloseWikiTask::checkWiki($targetWiki);
     if (empty($tWikiId)) {
         $aFormData = array();
         $aFormData["errors"] = array();
         $aFormData["values"] = array("task-grabber-list" => $grabberTask, "task-target-wiki" => $targetWiki);
         if (empty($targetWiki)) {
             $aFormData["errors"]["task-target-wiki"] = "Name <em>{$targetWiki}</em> is not valid wikia domain.";
         }
         return $aFormData;
     } else {
         $this->createTask(array("grabber_task_id" => $grabberTask, "target_wiki_id" => $tWikiId));
         $wgOut->addHTML("<div class=\"successbox\" style=\"clear:both;\">Task added</div><hr style=\"clear: both;\"/>");
         return true;
     }
 }
Exemplo n.º 2
0
 function submitForm()
 {
     global $wgRequest, $wgOut, $wgUser;
     #---
     # used fields
     # "task-c-wiki" - name of closed wiki
     # "task-export" - checkbox, export articles to parent
     # "task-p-wiki" - name of parent wiki
     $bExport = $wgRequest->getCheck("task-export");
     $sCWiki = CloseWikiTask::normalizeName($wgRequest->getText("task-c-wiki"));
     $sPWiki = CloseWikiTask::normalizeName($wgRequest->getText("task-p-wiki"));
     #--- check if closed wiki is valid
     $iCWikiId = CloseWikiTask::checkWiki($sCWiki);
     #--- check if parent wiki is valid
     $iPWikiId = CloseWikiTask::checkWiki($sPWiki);
     if (empty($iCWikiId) || empty($iPWikiId) && $bExport === true) {
         $aFormData = array();
         $aFormData["errors"] = array();
         $aFormData["values"] = array("task-export" => $bExport, "task-c-wiki" => $sCWiki, "task-p-wiki" => $sPWiki);
         if (empty($iCWikiId)) {
             $aFormData["errors"]["task-c-wiki"] = "Name <em>{$sCWiki}</em> is not valid wikia domain.";
         }
         if (empty($iPWikiId) && $bExport === true) {
             $aFormData["errors"]["task-p-wiki"] = "Name <em>{$sPWiki}</em> is not valid wikia domain.";
         }
         return $aFormData;
     } else {
         #--- all correct, put data into database
         $this->mTaskID = $this->createTask(array("export" => $bExport, "source_wikia_id" => $iCWikiId, "target_wikia_id" => $iPWikiId));
         $wgOut->addHTML(Wikia::successbox("Task added"));
     }
     return true;
 }