Beispiel #1
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('find_codes', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'find_codes'));
         }
         $path = get_custom_file_base() . '/sources/';
         $files = array();
         if (is_dir($path)) {
             $dh = opendir($path);
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..') {
                     if (!is_dir($path . $file)) {
                         $contents = file_get_contents($path . $file, FILE_TEXT);
                         if (strpos($contents, $parameters[0]) !== false) {
                             $files[] = $path . $file;
                         }
                     }
                     unset($contents);
                     // Got to be careful with that memory :-(
                 }
             }
             return array('', do_template('OCCLE_FIND_CODES', array('_GUID' => '3374d1a80727aecc271722f2184743d0', 'FILES' => $files)), '', '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
         // Directory doesn't exist
     }
 }
Beispiel #2
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('rmdir', array('h', 'f'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'rmdir'));
         } else {
             $parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
         }
         if (!$occle_fs->_is_dir($parameters[0])) {
             return array('', '', '', do_lang('NOT_A_DIR', '1'));
         }
         if (!array_key_exists('f', $options)) {
             $listing = $occle_fs->listing($parameters[0]);
             if (count($listing[0]) != 0 || count($listing[1]) != 0) {
                 return array('', '', '', do_lang('NOT_EMPTY_FORCE', '1'));
             }
         }
         $success = $occle_fs->remove_directory($parameters[0]);
         if ($success) {
             return array('', '', do_lang('SUCCESS'), '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
     }
 }
Beispiel #3
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('rm', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'rm'));
         }
         $success = true;
         foreach ($parameters as $i => $param) {
             $param = $occle_fs->_pwd_to_array($param);
             if (!$occle_fs->_is_file($param)) {
                 $success = false;
                 if ($i == 0 && count($parameters) == 1) {
                     return array('', '', '', do_lang('NOT_A_FILE', strval($i + 1)));
                 }
             }
             $success = $success && $occle_fs->remove_file($param);
         }
     }
     if ($success) {
         return array('', '', do_lang('SUCCESS'), '');
     } else {
         return array('', '', '', do_lang('INCOMPLETE_ERROR'));
     }
 }
Beispiel #4
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('watch_chatroom', array('h', 'u'), array(true)), '', '');
     } else {
         require_code('chat');
         if (array_key_exists('u', $options) || array_key_exists('unwatch', $options)) {
             delete_value('occle_watched_chatroom');
             $_chatroom = do_lang('SUCCESS');
         } elseif (array_key_exists(0, $parameters)) {
             if (is_numeric($parameters[0])) {
                 $chatroom = $parameters[0];
             } else {
                 $chatroom = get_chatroom_id($parameters[0]);
             }
             if (is_null($chatroom)) {
                 return array('', '', '', do_lang('MISSING_RESOURCE'));
             }
             set_value('occle_watched_chatroom', $chatroom);
             $_chatroom = get_chatroom_name($chatroom);
         } else {
             $_chatroom = get_chatroom_name(intval(get_value('occle_watched_chatroom')), true);
             if (is_null($_chatroom)) {
                 return array('', '', '', do_lang('MISSING_RESOURCE'));
             }
         }
         return array('', '', $_chatroom, '');
     }
 }
Beispiel #5
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('grep', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'grep'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'grep'));
         } else {
             $parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
         }
         if (!$occle_fs->_is_file($parameters[1])) {
             return array('', '', '', do_lang('NOT_A_FILE', '2'));
         }
         $_lines = unixify_line_format($occle_fs->read_file($parameters[1]));
         $lines = explode("\n", $_lines);
         if ($parameters[0] == '' || $parameters[0][0] != '#' && $parameters[0][0] != '/') {
             $parameters[0] = '#' . $parameters[0] . '#';
         }
         $matches = preg_grep($parameters[0], $lines);
         $output = '';
         foreach ($matches as $value) {
             $output .= $value . "\n";
         }
         return array('', '', $output, '');
     }
 }
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('send_chatmessage', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'send_chatmessage'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'send_chatmessage'));
         }
         require_code('chat');
         if (is_numeric($parameters[0])) {
             $chatroom = $parameters[0];
         } elseif ($parameters[0] == 'first-watched') {
             $_chatroom = get_value('occle_watched_chatroom');
             $chatroom = is_null($_chatroom) ? $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'id', NULL, 'ORDER BY id') : intval($_chatroom);
         } else {
             $chatroom = get_chatroom_id($parameters[0]);
         }
         if (is_null($chatroom)) {
             return array('', '', '', do_lang('MISSING_RESOURCE'));
         }
         chat_post_message($chatroom, $parameters[1], get_option('chat_default_post_font'), get_option('chat_default_post_colour'));
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #7
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('cat', array('h'), array('l')), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'cat'));
         }
         $line_numbers = array_key_exists('l', $options);
         $output = '';
         for ($i = 0; $i < count($parameters); $i++) {
             $parameters[$i] = $occle_fs->_pwd_to_array($parameters[$i]);
             if (!$occle_fs->_is_file($parameters[$i])) {
                 return array('', '', '', do_lang('NOT_A_FILE', integer_format($i + 1)));
             }
             $lines = explode(chr(10), $occle_fs->read_file($parameters[$i]));
             foreach ($lines as $j => $line) {
                 if ($line_numbers) {
                     $output .= str_pad(strval($j + 1), strlen(strval(count($lines)))) . '  ';
                 }
                 $output .= $line . chr(10);
             }
         }
         return array('', '', $output, '');
     }
 }
Beispiel #8
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return ~array  Array of stdcommand, stdhtml, stdout, and stderr responses (false: error)
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('ban_member', array('h', 'u'), array(true, true)), '', '');
     } else {
         if (get_forum_type() != 'ocf') {
             return array('', '', '', do_lang('NO_OCF'));
         }
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'ban_member'));
         }
         require_code('ocf_members_action');
         require_code('ocf_members_action2');
         require_lang('ocf');
         if (is_numeric($parameters[0])) {
             $member_id = $parameters[0];
         } else {
             $member_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($parameters[0]);
         }
         if (is_null($member_id)) {
             return array('', '', '', do_lang('USER_NO_EXIST'));
         }
         if (array_key_exists('u', $options) || array_key_exists('unban', $options)) {
             ocf_unban_member($member_id);
         } else {
             ocf_ban_member($member_id);
         }
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #9
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('find', array('h', 'p', 'r', 'f', 'd'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'find'));
         }
         if (!(array_key_exists('d', $options) || array_key_exists('directories', $options))) {
             $directories = false;
         } elseif (array_key_exists('d', $options)) {
             $directories = $options['d'] == '1';
         } else {
             $directories = $options['directories'] == '1';
         }
         if (!(array_key_exists('f', $options) || array_key_exists('files', $options))) {
             $files = true;
         } elseif (array_key_exists('f', $options)) {
             $files = $options['f'] == '1';
         } else {
             $files = $options['files'] == '1';
         }
         if (!array_key_exists(1, $parameters)) {
             $parameters[1] = $occle_fs->print_working_directory(true);
         } else {
             $parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
         }
         if (!$occle_fs->_is_dir($parameters[1])) {
             return array('', '', '', do_lang('NOT_A_DIR', '2'));
         }
         $listing = $occle_fs->search($parameters[0], array_key_exists('p', $options) || array_key_exists('preg', $options), array_key_exists('r', $options) || array_key_exists('recursive', $options), $files, $directories, $parameters[1]);
         return array('', do_template('OCCLE_LS', array('DIRECTORY' => $occle_fs->_pwd_to_string($parameters[1]), 'DIRECTORIES' => $listing[0], 'FILES' => $listing[1])), '', '');
     }
 }
Beispiel #10
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('mv', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'mv'));
         } else {
             $parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
         }
         if (!array_key_exists(1, $parameters)) {
             $parameters[1] = $occle_fs->print_working_directory(true);
         } else {
             $parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
         }
         if (!$occle_fs->_is_file($parameters[0])) {
             return array('', '', '', do_lang('NOT_A_FILE', '1'));
         }
         if (!$occle_fs->_is_dir($parameters[1])) {
             return array('', '', '', do_lang('NOT_A_DIR', '2'));
         }
         $success = $occle_fs->move_file($parameters[0], $parameters[1]);
         if ($success) {
             return array('', '', do_lang('SUCCESS'), '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
     }
 }
Beispiel #11
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('pwd', array('h'), array()), '', '');
     } else {
         return array('', '', $occle_fs->print_working_directory(), '');
     }
 }
Beispiel #12
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('date', array('h'), array()), '', '');
     } else {
         return array('', '', get_timezoned_date(time(), true, true), '');
     }
 }
Beispiel #13
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('bsod', array('h'), array()), '', '');
     } else {
         return array('bsod();', '', '', '(A(*$&(*!$*$!£@$!£*$NO CARRIER');
     }
 }
Beispiel #14
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('clear', array('h'), array()), '', '');
     } else {
         return array('clear_cl();', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #15
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('exit', array('h'), array()), '', '');
     } else {
         return array('if (document.getElementById(\'occle_box\')) load_occle(); else window.location.href=\'' . xmlentities(addslashes(static_evaluate_tempcode(build_url(array('page' => ''), '')))) . '\';', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #16
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('time', array('h'), array()), '', '');
     } else {
         return array('', '', strval(time()), '');
     }
 }
Beispiel #17
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('reset', array('h'), array()), '', '');
     } else {
         ocp_eatcookie('occle_dir');
         ocp_eatcookie('occle_state');
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #18
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('commands', array('h'), array()), '', '');
     } else {
         $hooks = find_all_hooks('modules', 'admin_occle_commands');
         $commands = array_keys($hooks);
         sort($commands);
         return array('', do_template('OCCLE_COMMANDS', array('COMMANDS' => $commands)), '', '');
     }
 }
Beispiel #19
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('echo', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', '');
         }
         return array('', '', $parameters[0], '');
     }
 }
Beispiel #20
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('database_upgrade', array('h'), array()), '', '');
     } else {
         require_code('upgrade');
         $result = upgrade_modules();
         if ($result == '') {
             $result = do_lang('NO_ACTION_REQUIRED');
         }
         return array('', $result, '', '');
     }
 }
Beispiel #21
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('integrity_check', array('h'), array()), '', '');
     } else {
         require_code('upgrade');
         $result = run_integrity_check(true, false, true);
         if ($result == '') {
             $result = do_lang('NO_ACTION_REQUIRED');
         }
         return array('', $result, '', '');
     }
 }
Beispiel #22
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('call', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'call'));
         }
         $details = page_link_decode($parameters[0]);
         $url = build_url($details[1], $details[0]);
         return array('window.open(unescape("' . urlencode($url->evaluate()) . '"),"occle_window1","");', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #23
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('whoami', array('h'), array()), '', '');
     } else {
         $member_id = get_member();
         $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id);
         if (is_null($username)) {
             $username = do_lang('GUEST');
         }
         return array('', '', $username . ' (#' . strval($member_id) . ')', '');
     }
 }
Beispiel #24
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('feedback', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'feedback'));
         }
         $url = 'http://ocportal.com/pg/feedback';
         $post = array('title' => 'OcCLE feedback', 'post' => '(From "' . get_custom_base_url() . '" via OcCLE.)[quote]' . $parameters[0] . '[/quote]');
         http_download_file($url, NULL, true, true, 'ocPortal', $post);
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #25
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('ls', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             $parameters[0] = $occle_fs->print_working_directory(true);
         } else {
             $parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
         }
         if (!$occle_fs->_is_dir($parameters[0])) {
             return array('', '', '', do_lang('NOT_A_DIR', '1'));
         }
         $listing = $occle_fs->listing($parameters[0]);
         return array('', do_template('OCCLE_LS', array('DIRECTORY' => $occle_fs->_pwd_to_string($parameters[0]), 'DIRECTORIES' => $listing[0], 'FILES' => $listing[1])), '', '');
     }
 }
Beispiel #26
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return ~array  Array of stdcommand, stdhtml, stdout, and stderr responses (false: error)
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('passwd', array('h', 'u'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'passwd'));
         }
         if (get_forum_type() != 'ocf') {
             return array('', '', '', do_lang('NO_OCF'));
         }
         require_code('ocf_members_action');
         require_code('ocf_members_action2');
         if (array_key_exists('u', $options)) {
             if (is_numeric($options['u'])) {
                 $member_id = $options['u'];
             } else {
                 $member_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($options['u']);
             }
         } elseif (array_key_exists('username', $options)) {
             if (is_numeric($options['username'])) {
                 $member_id = $options['username'];
             } else {
                 $member_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($options['username']);
             }
         } else {
             $member_id = get_member();
         }
         $update = array();
         $update['m_password_change_code'] = '';
         $salt = $GLOBALS['OCF_DRIVER']->get_member_row_field($member_id, 'm_pass_salt');
         if (is_null($salt)) {
             return array('', '', '', do_lang('_USER_NO_EXIST', array_key_exists('username', $options) ? $options['username'] : $options['u']));
         }
         if (get_value('no_password_hashing') === '1') {
             $update['m_password_compat_scheme'] = 'plain';
             $update['m_pass_salt'] = '';
             $update['m_pass_hash_salted'] = $parameters[0];
         } else {
             $update['m_password_compat_scheme'] = '';
             $update['m_pass_hash_salted'] = md5($salt . md5($parameters[0]));
         }
         $GLOBALS['SITE_DB']->query_update('f_members', $update, array('id' => $member_id), '', 1);
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #27
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('ban_ip', array('h', 'u'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'ban_ip'));
         }
         require_code('submit');
         if (array_key_exists('u', $options) || array_key_exists('unban', $options)) {
             unban_ip($parameters[0]);
         } else {
             ban_ip($parameters[0], array_key_exists(1, $parameters) ? $parameters[1] : '');
         }
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #28
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     require_code('config2');
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('closed', array('h', 'o', 'c'), array(true)), '', '');
     } else {
         if (array_key_exists('o', $options) || array_key_exists('open', $options)) {
             set_option('site_closed', '0');
         }
         if (array_key_exists('c', $options) || array_key_exists('close', $options)) {
             if (!array_key_exists(0, $parameters)) {
                 return array('', '', '', do_lang('MISSING_PARAM', '1', 'closed'));
             }
             set_option('site_closed', '1');
             set_option('closed', $parameters[0]);
         }
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
Beispiel #29
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  object  A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('edit', array('h'), array(true)), '', '');
     } else {
         // Show the editing UI
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'edit'));
         } else {
             $parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
         }
         if (!$occle_fs->_is_file($parameters[0])) {
             return array('', '', '', do_lang('NOT_A_FILE', '1'));
         }
         $file_contents = $occle_fs->read_file($parameters[0]);
         $parameters[0] = $occle_fs->_pwd_to_string($parameters[0]);
         return array('', do_template('OCCLE_EDIT', array('_GUID' => '8bbf2f9ef545a92b6865c35ed27cd6d4', 'UNIQ_ID' => uniqid('', true), 'FILE' => $parameters[0], 'SUBMIT_URL' => build_url(array('page' => 'admin_occle', 'command' => 'write "' . $parameters[0] . '" "{0}" < :echo addslashes(get_param(\'edit_content\'));'), get_module_zone('admin_occle')), 'FILE_CONTENTS' => $file_contents)), '', '');
     }
 }
Beispiel #30
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('alien_check', array('h'), array()), '', '');
     } else {
         require_code('upgrade');
         $master_data = @unserialize(file_get_contents(get_file_base() . '/data/files.dat', FILE_TEXT));
         if ($master_data === false) {
             $master_data = array();
         }
         $result = check_alien(file_exists(get_file_base() . '/data/files_previous.dat') ? unserialize(file_get_contents(get_file_base() . '/data/files_previous.dat', FILE_TEXT)) : array(), $master_data, get_file_base() . '/', '', true);
         if ($result == '') {
             $result = do_lang('NO_ACTION_REQUIRED');
         } else {
             require_lang('upgrade');
             $result .= do_lang('RM_HINT');
         }
         return array('', $result, '', '');
     }
 }