Exemple #1
0
 private function onEdit()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error;
     }
     //		var_dump($_POST);
     $this->link->removeTags();
     $data = array('link_gid' => $form->getVar('link_gid'), 'link_score' => $form->getVar('link_score'), 'link_href' => $form->getVar('link_href'), 'link_descr' => $form->getVar('link_descr'), 'link_tags' => $form->getVar('link_tags'));
     if (false !== ($descr2 = $form->getVar('link_descr2'))) {
         $data['link_descr2'] = $descr2;
     }
     if (false === $this->link->saveVars($data)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $this->link->insertTags($this->module);
     $this->link->saveOption(GWF_Links::UNAFILIATE, isset($_POST['link_options&' . GWF_Links::UNAFILIATE]));
     $this->link->saveOption(GWF_Links::MEMBER_LINK, isset($_POST['link_options&' . GWF_Links::MEMBER_LINK]));
     $this->link->saveOption(GWF_Links::ONLY_PRIVATE, isset($_POST['link_options&' . GWF_Links::ONLY_PRIVATE]));
     if (GWF_User::isStaffS()) {
         $this->link->saveOption(GWF_Links::STICKY, isset($_POST['link_options&' . GWF_Links::STICKY]));
         if (false === $this->link->toggleModeration($this->module, isset($_POST['link_options&' . GWF_Links::IN_MODERATION]))) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     return $this->module->message('msg_edited');
 }
Exemple #2
0
 private static function checkLinkDown(Module_Links $module, GWF_Links $link)
 {
     # Get HREF
     $href = $link->getVar('link_href');
     if (strpos($href, '/') === 0) {
         $href = 'http://' . GWF_DOMAIN . GWF_WEB_ROOT . substr($href, 1);
     }
     if (GWF_HTTP::pageExists($href)) {
         self::notice("Checking {$href} ... UP");
         $link->saveVar('link_downcount', 0);
         $link->saveOption(GWF_Links::DOWN | GWF_Links::DEAD, false);
     } else {
         self::notice("Checking {$href} ... DOWN");
         $link->increase('link_downcount', 1);
         $bits = GWF_Links::DOWN;
         $count = $link->getVar('link_downcount');
         if ($count > GWF_Links::DOWNCOUNT_DEAD) {
             $bits |= GWF_Links::DEAD;
         }
         $link->saveOption($bits, true);
     }
     $link->saveVar('link_lastcheck', time());
 }