Ejemplo n.º 1
0
 /**
  * Main Constructor
  *
  * @access  public
  * @return  void
  */
 function SmartBridge_Plugin($plugin)
 {
     parent::Jaws_Plugin($plugin);
     $eg = $GLOBALS['app']->Registry->fetch('gadgets_enabled_items');
     if (Jaws_Error::isError($eg)) {
         $eg = array();
     }
     $this->_EnabledGadgets = explode(',', $eg);
 }
Ejemplo n.º 2
0
 /**
  * Generate a random mathematics equation
  *
  * @access  private
  * @return  string  random mathematics equation
  */
 private function randomEquation()
 {
     $fnum = mt_rand(1, 9);
     $snum = mt_rand(1, 9);
     $oprt = mt_rand(0, 2);
     // string numbers
     $objPlugin = Jaws_Plugin::getInstance('SpellNumber');
     if (!Jaws_Error::isError($objPlugin)) {
         $fsnum = $objPlugin->ParseText("[number]{$fnum}[/number]");
         $ssnum = $objPlugin->ParseText("[number]{$snum}[/number]");
     } else {
         $fsnum = $fnum;
         $ssnum = $snum;
     }
     switch ($oprt) {
         case 0:
             $result = $fnum + $snum;
             $equation = $fnum . '+' . $snum;
             $title = _t('POLICY_CAPTCHA_MATH_PLUS', $fsnum, $ssnum);
             break;
         case 1:
             // first & second numbers must different
             while ($fnum == $snum) {
                 $snum = mt_rand(1, 9);
             }
             // exchange value of variables
             if ($fnum < $snum) {
                 list($fnum, $snum) = array($snum, $fnum);
             }
             $result = $fnum - $snum;
             $equation = $fnum . '-' . $snum;
             $title = _t('POLICY_CAPTCHA_MATH_MINUS', $fsnum, $ssnum);
             break;
         case 2:
             $result = $fnum * $snum;
             $equation = $fnum . '*' . $snum;
             $title = _t('POLICY_CAPTCHA_MATH_MULTIPLY', $fsnum, $ssnum);
     }
     return array($equation, $result, $title);
 }
Ejemplo n.º 3
0
 /**
  * Disables the plugin
  *
  * @access  public
  * @return  array   Response array (notice or error)
  */
 function UninstallPlugin()
 {
     $this->gadget->CheckPermission('ManagePlugins');
     @(list($plugin) = jaws()->request->fetchAll('post'));
     $return = Jaws_Plugin::UninstallPlugin($plugin);
     if (Jaws_Error::isError($return)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('COMPONENTS_PLUGINS_UNINSTALL_FAILURE'), RESPONSE_ERROR);
     } else {
         $GLOBALS['app']->Session->PushLastResponse(_t('COMPONENTS_PLUGINS_UNINSTALL_OK', $plugin), RESPONSE_NOTICE);
     }
     return $GLOBALS['app']->Session->PopLastResponse();
 }